Skip to content

Commit

Permalink
Merge pull request #15 from istresearch/add-schemes into develop
Browse files Browse the repository at this point in the history
PE-205: add schemes to floweditor
  • Loading branch information
baracudda authored Mar 27, 2024
2 parents 08060a3 + 4c4f5cd commit acbf4a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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

0 comments on commit acbf4a6

Please sign in to comment.