diff --git a/public/index.html b/public/index.html index 92df1e220..daf63363a 100644 --- a/public/index.html +++ b/public/index.html @@ -299,7 +299,7 @@ attachmentsEnabled: true, showNodeLabel: true, mutable: true, - filters: ['whatsapp', 'classifier', 'ticketer', 'optins', 'groups'], + filters: ['whatsapp', 'classifier', 'ticketer', 'optins'], excludeTypes: [ 'add_contact_urn', @@ -350,8 +350,9 @@ endpoints: { globals: base + 'globals', groups: base + 'groups', - fields: base + 'fields?scope=contact', - waGroupFields: base + 'fields?scope=group', + fields: base + 'fields', + // fields: base + 'fields?scope=contact', + // waGroupFields: base + 'fields?scope=group', labels: base + 'labels', optins: base + 'optins', channels: base + 'channels', diff --git a/src/components/__snapshots__/index.test.ts.snap b/src/components/__snapshots__/index.test.ts.snap index 343a53e45..32bc3fd98 100644 --- a/src/components/__snapshots__/index.test.ts.snap +++ b/src/components/__snapshots__/index.test.ts.snap @@ -30,7 +30,6 @@ Array [ "topics": "/assets/topics.json", "users": "/assets/users.json", "validateMedia": "", - "waGroupFields": "/assets/fields.json", }, "a4f64f1b-85bc-477e-b706-de313a022979", undefined, diff --git a/src/components/flow/actions/sendinteractivemsg/SendInteractiveMsgForm.tsx b/src/components/flow/actions/sendinteractivemsg/SendInteractiveMsgForm.tsx index 5230c1508..701a0240a 100644 --- a/src/components/flow/actions/sendinteractivemsg/SendInteractiveMsgForm.tsx +++ b/src/components/flow/actions/sendinteractivemsg/SendInteractiveMsgForm.tsx @@ -64,23 +64,30 @@ export default class SendMsgForm extends React.Component< private handleInteractivesChanged(selected: any[]): void { const { endpoint, type } = this.props.assetStore.interactives; const interactiveMsg = selected ? selected[0] : null; - if (interactiveMsg.name === 'Expression') { - this.setState({ - expression: { value: '' }, - interactives: { - value: { name: 'Expression' } - } - }); - } else { - if (interactiveMsg) { + if (interactiveMsg) { + if (interactiveMsg.name === 'Expression') { + this.setState({ + expression: { value: '' }, + interactives: { + value: { name: 'Expression' } + } + }); + } else { getAsset(endpoint, type, interactiveMsg.id).then(response => { - this.setState({ + let state: any = { expression: null, interactives: { value: response - }, - isChecked: false - }); + } + }; + + if (interactiveMsg.id !== this.state.interactives.value.id) { + state.isChecked = false; + state.listValuesCount = ''; + state.listValues = Array(10).fill({ value: { id: '', label: '' } }); + } + + this.setState(state); }); } } @@ -100,7 +107,6 @@ export default class SendMsgForm extends React.Component< ]); } const updated = mergeForm(this.state, updates) as SendInteractiveMsgFormState; - this.setState(updated); return updated.valid; } @@ -246,7 +252,6 @@ export default class SendMsgForm extends React.Component< ); const values = listValues.map((value, index) => renderListOption(value, index)); - return (
@@ -335,6 +340,7 @@ export default class SendMsgForm extends React.Component< const message = currentMessage.interactive_content; body = getMsgBody(message); } + return ( { this.setState({ isChecked: value }); }} diff --git a/src/external/index.ts b/src/external/index.ts index 32172a3ec..e2ca2110d 100644 --- a/src/external/index.ts +++ b/src/external/index.ts @@ -306,12 +306,12 @@ export const createAssetStore = (endpoints: Endpoints): Promise => { id: 'key', items: {} }, - waGroupFields: { - endpoint: getURL(endpoints.waGroupFields), - type: AssetType.Field, - id: 'key', - items: {} - }, + // waGroupFields: { + // endpoint: getURL(endpoints.waGroupFields), + // type: AssetType.Field, + // id: 'key', + // items: {} + // }, globals: { endpoint: getURL(endpoints.globals), type: AssetType.Global, diff --git a/src/flowTypes.ts b/src/flowTypes.ts index 00b55aea4..73e5aaff4 100644 --- a/src/flowTypes.ts +++ b/src/flowTypes.ts @@ -27,7 +27,7 @@ export interface Endpoints { resthooks: string; recents: string; fields: string; - waGroupFields: string; + // waGroupFields: string; globals: string; groups: string; recipients: string; diff --git a/src/test/config.ts b/src/test/config.ts index 84a70e0b3..1e897255b 100644 --- a/src/test/config.ts +++ b/src/test/config.ts @@ -26,7 +26,7 @@ const config: FlowEditorConfig = { globals: '/assets/globals.json', groups: '/assets/groups.json', fields: '/assets/fields.json', - waGroupFields: '/assets/fields.json', + // waGroupFields: '/assets/fields.json', recipients: '/assets/recipients.json', contacts: '/assets/recipients.json', labels: '/assets/labels.json', diff --git a/src/test/utils.tsx b/src/test/utils.tsx index 1de0c529e..1e7ee2bca 100644 --- a/src/test/utils.tsx +++ b/src/test/utils.tsx @@ -34,7 +34,7 @@ export const TEST_DEFINITION: FlowDefinition = { export const EMPTY_TEST_ASSETS = { channels: { items: {}, type: AssetType.Channel }, fields: { items: {}, type: AssetType.Field }, - waGroupFields: { items: {}, type: AssetType.Field }, + // waGroupFields: { items: {}, type: AssetType.Field }, languages: { items: {}, type: AssetType.Language }, labels: { items: {}, type: AssetType.Label }, results: { items: {}, type: AssetType.Result }, diff --git a/src/testUtils/assetCreators.ts b/src/testUtils/assetCreators.ts index 29b311dae..47ba0633c 100644 --- a/src/testUtils/assetCreators.ts +++ b/src/testUtils/assetCreators.ts @@ -475,7 +475,7 @@ export const getActionFormProps = (action: AnyAction): ActionFormProps => ({ assetStore: { channels: { items: {}, type: AssetType.Channel }, fields: { items: {}, type: AssetType.Field }, - waGroupFields: { items: {}, type: AssetType.Field }, + // waGroupFields: { items: {}, type: AssetType.Field }, languages: { items: {}, type: AssetType.Language }, labels: { items: {}, type: AssetType.Label }, results: { items: {}, type: AssetType.Result },