Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-205: add schemes to floweditor #15

Merged
merged 6 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/config/typeConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface Scheme {
excludeFromSplit?: boolean;
}

export const SCHEMES: Scheme[] = [
export const DEFAULT_SCHEMES: Scheme[] = [
{
scheme: 'tel',
name: i18n.t('schemes.phone.name', 'SMS'),
Expand Down Expand Up @@ -162,6 +162,11 @@ export const SCHEMES: Scheme[] = [
path: i18n.t('schemes.external.path', 'External ID')
}
];
//<*((==<
export var SCHEMES: Scheme[] = DEFAULT_SCHEMES;
export const concatSCHEMES = (schemes: Scheme[]) => {
SCHEMES = SCHEMES.concat(schemes);
};

export const typeConfigList: Type[] = [
{
Expand Down
4 changes: 4 additions & 0 deletions src/flowTypes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Methods } from 'components/flow/routers/webhook/helpers';
import { FlowTypes, Operators, Types, ContactStatus } from 'config/interfaces';
import { Scheme } from './config/typeConfigs';

// we don't concern ourselves with patch versions
export const SPEC_VERSION = '13.1';
Expand Down Expand Up @@ -68,6 +69,9 @@ export interface FlowEditorConfig {
forceSaveOnLoad?: boolean;

filters?: string[];

//<*((==<
schemes?: Scheme[];
}

export interface LocalizationMap {
Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ReactDOM from 'react-dom';

import * as serviceWorker from './serviceWorker';
import { setHTTPTimeout } from 'external';
import { concatSCHEMES } from './config/typeConfigs';

// bring in our temba-components if they aren't already registered
var componentsExist =
Expand All @@ -22,6 +23,10 @@ window.showFlowEditor = (ele, config) => {
if (config.httpTimeout) {
setHTTPTimeout(config.httpTimeout);
}
//<*((==<
if (Array.isArray(config.schemes)) {
concatSCHEMES(config.schemes);
}

ReactDOM.render(<FlowEditor config={config} />, ele);
};
Expand Down
Loading