diff --git a/lambda/ticketers.js b/lambda/ticketers.js deleted file mode 100644 index 740ceec1d..000000000 --- a/lambda/ticketers.js +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/camelcase */ -const ticketers = [ - { - uuid: '5b8587d9-c1bd-47e4-b2ff-dfe790fcdaf2', - name: 'Email', - type: 'mailgun', - created_on: '2019-10-15T20:07:58.529130Z' - } -]; -const { getOpts } = require('./utils'); - -exports.handler = (evt, ctx, cb) => - cb(null, getOpts({ body: JSON.stringify({ results: ticketers }) })); diff --git a/src/components/__snapshots__/index.test.ts.snap b/src/components/__snapshots__/index.test.ts.snap index 5c75e8806..249530530 100644 --- a/src/components/__snapshots__/index.test.ts.snap +++ b/src/components/__snapshots__/index.test.ts.snap @@ -24,7 +24,6 @@ Array [ "simulateResume": "", "simulateStart": "", "templates": "/assets/templates.json", - "ticketers": "/assets/ticketers.json", "topics": "/assets/topics.json", "users": "/assets/users.json", }, diff --git a/src/components/flow/actions/helpers.tsx b/src/components/flow/actions/helpers.tsx index 70e53cd27..6f060b691 100644 --- a/src/components/flow/actions/helpers.tsx +++ b/src/components/flow/actions/helpers.tsx @@ -201,13 +201,6 @@ export const renderAsset = (asset: Asset, endpoints: Endpoints) => { ); break; - case AssetType.Ticketer: - assetBody = ( - - Open a new Ticket on [[name]] - - ); - break; } if (!assetBody) { diff --git a/src/components/flow/actions/openticket/OpenTicket.tsx b/src/components/flow/actions/openticket/OpenTicket.tsx index 343fdbc8a..c0cc21a4b 100644 --- a/src/components/flow/actions/openticket/OpenTicket.tsx +++ b/src/components/flow/actions/openticket/OpenTicket.tsx @@ -2,19 +2,10 @@ import * as React from 'react'; import { OpenTicket } from 'flowTypes'; import { fakePropType } from 'config/ConfigProvider'; -const OpenTicketComp: React.SFC = ( - { ticketer, subject, topic }, - context: any -): JSX.Element => { - const showTicketer = ticketer.name.indexOf(context.config.brand) === -1; +const OpenTicketComp: React.SFC = ({ subject, topic }, context: any): JSX.Element => { return (
{subject ? subject : topic ? topic.name : null}
- {showTicketer ? ( -
- Using {ticketer.name} -
- ) : null}
); }; diff --git a/src/components/flow/routers/ticket/TicketRouterForm.test.tsx b/src/components/flow/routers/ticket/TicketRouterForm.test.tsx index 4e0295108..fae6dea0c 100644 --- a/src/components/flow/routers/ticket/TicketRouterForm.test.tsx +++ b/src/components/flow/routers/ticket/TicketRouterForm.test.tsx @@ -33,7 +33,7 @@ describe(TicketRouterForm.name, () => { const okButton = getByText('Ok'); const resultName = getByTestId('Result Name'); - // our ticketer, body and result name are required + // our body and result name are required fireChangeText(resultName, ''); fireEvent.click(okButton); expect(ticketForm.updateRouter).not.toBeCalled(); diff --git a/src/components/flow/routers/ticket/TicketRouterForm.tsx b/src/components/flow/routers/ticket/TicketRouterForm.tsx index 00f26d79d..068aaaf8d 100644 --- a/src/components/flow/routers/ticket/TicketRouterForm.tsx +++ b/src/components/flow/routers/ticket/TicketRouterForm.tsx @@ -14,8 +14,6 @@ import { StartIsNonNumeric, validate } from 'store/validators'; -import AssetSelector from 'components/form/assetselector/AssetSelector'; -import { Asset } from 'store/flowContext'; import styles from './TicketRouterForm.module.scss'; import i18n from 'config/i18n'; import TextInputElement from 'components/form/textinput/TextInputElement'; @@ -26,7 +24,6 @@ import { Topic, User } from 'flowTypes'; export interface TicketRouterFormState extends FormState { assignee: FormEntry; topic: FormEntry; - ticketer: FormEntry; subject: StringEntry; body: StringEntry; resultName: StringEntry; @@ -43,10 +40,7 @@ export default class TicketRouterForm extends React.Component< constructor(props: RouterFormProps) { super(props); - // if we only have one ticketer, initialize our form with it - const ticketers = Object.values(this.props.assetStore.ticketers.items); - const ticketer = ticketers.length === 1 ? ticketers[0] : null; - this.state = nodeToState(this.props.nodeSettings, ticketer); + this.state = nodeToState(this.props.nodeSettings); bindCallbacks(this, { include: [/^handle/] @@ -56,7 +50,6 @@ export default class TicketRouterForm extends React.Component< keys: { assignee?: User; topic?: Topic; - ticketer?: Asset; subject?: string; body?: string; resultName?: string; @@ -77,12 +70,6 @@ export default class TicketRouterForm extends React.Component< ]); } - if (keys.hasOwnProperty('ticketer')) { - updates.ticketer = validate(i18n.t('forms.ticketer', 'Ticketer'), keys.ticketer, [ - shouldRequireIf(submitting) - ]); - } - if (keys.hasOwnProperty('subject')) { updates.subject = validate(i18n.t('forms.subject', 'Subject'), keys.subject, []); } @@ -106,10 +93,6 @@ export default class TicketRouterForm extends React.Component< return updated.valid; } - private handleTicketerUpdate(selected: Asset[]): void { - this.handleUpdate({ ticketer: selected[0] }); - } - private handleAssigneeUpdate(assignee: User): void { this.handleUpdate({ assignee }); } @@ -142,7 +125,6 @@ export default class TicketRouterForm extends React.Component< // validate all fields in case they haven't interacted const valid = this.handleUpdate( { - ticketer: this.state.ticketer.value, subject: this.state.subject.value, body: this.state.body.value, resultName: this.state.resultName.value @@ -169,30 +151,9 @@ export default class TicketRouterForm extends React.Component< private renderEdit(): JSX.Element { const typeConfig = this.props.typeConfig; - // if we only have one ticketer or we have issues, show the ticket chooser - const showTicketers = - Object.keys(this.props.assetStore.ticketers.items).length > 1 || this.props.issues.length > 0; - return ( - {showTicketers ? ( -
-

- Open ticket via... -

- -
- ) : ( - '' - )}
diff --git a/src/components/flow/routers/ticket/__snapshots__/TicketRouterForm.test.tsx.snap b/src/components/flow/routers/ticket/__snapshots__/TicketRouterForm.test.tsx.snap index 55331bf2b..5010448dd 100644 --- a/src/components/flow/routers/ticket/__snapshots__/TicketRouterForm.test.tsx.snap +++ b/src/components/flow/routers/ticket/__snapshots__/TicketRouterForm.test.tsx.snap @@ -47,12 +47,11 @@ exports[`TicketRouterForm render should render 1`] = ` namekey="description" searchable="true" valuekey="type" - values="[{\\"type\\":\\"open_ticket\\",\\"name\\":\\"Open Ticket\\",\\"description\\":\\"Open a ticket with a human agent\\",\\"localizeableKeys\\":[\\"exits\\"],\\"aliases\\":[\\"split_by_ticket\\"],\\"visibility\\":[\\"messaging\\",\\"messaging_background\\",\\"voice\\"],\\"filter\\":\\"ticketer\\"}]" + values="[{\\"type\\":\\"open_ticket\\",\\"name\\":\\"Open Ticket\\",\\"description\\":\\"Open a ticket with a human agent\\",\\"localizeableKeys\\":[\\"exits\\"],\\"aliases\\":[\\"split_by_ticket\\"],\\"visibility\\":[\\"messaging\\",\\"messaging_background\\",\\"voice\\"]}]" />
-
@@ -227,12 +226,11 @@ exports[`TicketRouterForm updates should save changes 1`] = ` namekey="description" searchable="true" valuekey="type" - values="[{\\"type\\":\\"open_ticket\\",\\"name\\":\\"Open Ticket\\",\\"description\\":\\"Open a ticket with a human agent\\",\\"localizeableKeys\\":[\\"exits\\"],\\"aliases\\":[\\"split_by_ticket\\"],\\"visibility\\":[\\"messaging\\",\\"messaging_background\\",\\"voice\\"],\\"filter\\":\\"ticketer\\"}]" + values="[{\\"type\\":\\"open_ticket\\",\\"name\\":\\"Open Ticket\\",\\"description\\":\\"Open a ticket with a human agent\\",\\"localizeableKeys\\":[\\"exits\\"],\\"aliases\\":[\\"split_by_ticket\\"],\\"visibility\\":[\\"messaging\\",\\"messaging_background\\",\\"voice\\"]}]" />
-
@@ -378,10 +376,6 @@ Array [ }, "body": "Where are my cookies", "result_name": "My Ticket Result", - "ticketer": Object { - "name": "Email (bob@acme.com)", - "uuid": "1165a73a-2ee0-4891-895e-768645194862", - }, "topic": Object { "value": Object { "name": "General", diff --git a/src/components/flow/routers/ticket/helpers.ts b/src/components/flow/routers/ticket/helpers.ts index 9ada50bfe..6a5156d47 100644 --- a/src/components/flow/routers/ticket/helpers.ts +++ b/src/components/flow/routers/ticket/helpers.ts @@ -17,13 +17,7 @@ export const getOriginalAction = (settings: NodeEditorSettings): OpenTicket => { } }; -export const nodeToState = ( - settings: NodeEditorSettings, - initialTicketer: any -): TicketRouterFormState => { - let ticketer: FormEntry = initialTicketer - ? { value: { uuid: initialTicketer.id, name: initialTicketer.name } } - : { value: null }; +export const nodeToState = (settings: NodeEditorSettings): TicketRouterFormState => { let subject = { value: '@run.flow.name' }; let body = { value: '@results' }; let resultName = { value: 'Result' }; @@ -32,7 +26,6 @@ export const nodeToState = ( if (getType(settings.originalNode) === Types.split_by_ticket) { const action = getOriginalAction(settings) as OpenTicket; - ticketer = { value: action.ticketer }; subject = { value: action.subject }; body = { value: action.body }; topic = { value: action.topic }; @@ -43,7 +36,6 @@ export const nodeToState = ( const state: TicketRouterFormState = { assignee, topic, - ticketer, subject, body, resultName, @@ -66,10 +58,6 @@ export const stateToNode = ( const newAction: OpenTicket = { uuid, type: Types.open_ticket, - ticketer: { - uuid: state.ticketer.value.uuid, - name: state.ticketer.value.name - }, body: state.body.value, topic: state.topic.value, assignee: state.assignee.value, diff --git a/src/components/simulator/LogEvent.test.tsx b/src/components/simulator/LogEvent.test.tsx index cb3cea06d..b77cc288c 100644 --- a/src/components/simulator/LogEvent.test.tsx +++ b/src/components/simulator/LogEvent.test.tsx @@ -202,7 +202,6 @@ describe(LogEvent.name, () => { it('should render ticket_opened event', () => { testEventRender({ type: 'ticket_opened', - ticketer: { uuid: '15892014-144c-4721-a611-c80b38481055', name: 'Email Support' }, ticket: { topic: { uuid: 'ee1e36a8-dd42-4464-b6b2-37418a26db1f', name: 'Support' }, body: 'Where are my cookies?' diff --git a/src/components/simulator/LogEvent.tsx b/src/components/simulator/LogEvent.tsx index 44872a197..fcfa035fe 100644 --- a/src/components/simulator/LogEvent.tsx +++ b/src/components/simulator/LogEvent.tsx @@ -69,7 +69,6 @@ export interface EventProps { urns?: string[]; service?: string; classifier?: { uuid: string; name: string }; - ticketer?: { uuid: string; name: string }; ticket?: { topic: Topic; body: string }; hint?: Hint; timeout_seconds?: number; diff --git a/src/config/__snapshots__/typeConfigs.test.ts.snap b/src/config/__snapshots__/typeConfigs.test.ts.snap index 158efad67..ae0557388 100644 --- a/src/config/__snapshots__/typeConfigs.test.ts.snap +++ b/src/config/__snapshots__/typeConfigs.test.ts.snap @@ -274,7 +274,6 @@ Array [ ], "component": [Function], "description": "Open a ticket with a human agent", - "filter": "ticketer", "form": [Function], "localization": [Function], "localizeableKeys": Array [ @@ -560,7 +559,6 @@ Object { ], "component": [Function], "description": "Open a ticket with a human agent", - "filter": "ticketer", "form": [Function], "localization": [Function], "localizeableKeys": Array [ @@ -888,7 +886,6 @@ Object { ], "component": [Function], "description": "Open a ticket with a human agent", - "filter": "ticketer", "form": [Function], "localization": [Function], "localizeableKeys": Array [ diff --git a/src/config/i18n/cs/resource.json b/src/config/i18n/cs/resource.json index fedf7baa1..ae7b5c0f7 100644 --- a/src/config/i18n/cs/resource.json +++ b/src/config/i18n/cs/resource.json @@ -140,8 +140,7 @@ "placeholder_plural": "Vyberte stávající [[name]] nebo zadejte nové." }, "assets": { - "classifier": "Volání klasifikátoru [[name]]", - "ticketer": "Otevřít nový tiket na [[name]]" + "classifier": "Volání klasifikátoru [[name]]" }, "body": "Tělo", "buttons": { @@ -306,7 +305,6 @@ "template": "šablona", "the_maximum": "maximum", "the_minimum": "minimum", - "ticketer": "Tiketovací služba", "timeout": "Časový limit", "timeout_1 day": "1 den", "timeout_1 hour": "1 hodina", diff --git a/src/config/i18n/defaults.json b/src/config/i18n/defaults.json index b59dd703b..9bce3bdce 100644 --- a/src/config/i18n/defaults.json +++ b/src/config/i18n/defaults.json @@ -140,8 +140,7 @@ "placeholder_plural": "Select existing [[name]] or enter a new one" }, "assets": { - "classifier": "Call [[name]] classifier", - "ticketer": "Open a new Ticket on [[name]]" + "classifier": "Call [[name]] classifier" }, "body": "Body", "buttons": { @@ -306,7 +305,6 @@ "template": "template", "the_maximum": "the maximum", "the_minimum": "the minimum", - "ticketer": "Ticketer", "timeout": "Timeout", "timeout_1 day": "1 day", "timeout_1 hour": "1 hour", diff --git a/src/config/i18n/es/resource.json b/src/config/i18n/es/resource.json index facda9070..98f58ce7c 100644 --- a/src/config/i18n/es/resource.json +++ b/src/config/i18n/es/resource.json @@ -140,8 +140,7 @@ "placeholder_plural": "Seleccione el [[name]] existente o ingrese uno nuevo" }, "assets": { - "classifier": "Llamar clasificador [[name]]", - "ticketer": "Abrir nuevo Ticket en [[name]]" + "classifier": "Llamar clasificador [[name]]" }, "body": "Cuerpo", "buttons": { @@ -306,7 +305,6 @@ "template": "plantilla", "the_maximum": "el máximo", "the_minimum": "el mínimo", - "ticketer": "Ticketer", "timeout": "Timeout", "timeout_1 day": "1 día", "timeout_1 hour": "1 hora", diff --git a/src/config/i18n/fr/resource.json b/src/config/i18n/fr/resource.json index df60afec6..d766d7158 100644 --- a/src/config/i18n/fr/resource.json +++ b/src/config/i18n/fr/resource.json @@ -140,8 +140,7 @@ "placeholder_plural": "Sélectionnez [[name]] existant ou saisissez-en un nouveau" }, "assets": { - "classifier": "Appeler le classificateur [[name]]", - "ticketer": "Open a new Ticket on [[name]]" + "classifier": "Appeler le classificateur [[name]]" }, "body": "Corps", "buttons": { @@ -306,7 +305,6 @@ "template": "modèle", "the_maximum": "le maximum", "the_minimum": "le minimum", - "ticketer": "Ticketer", "timeout": "Temps mort", "timeout_1 day": "1 jour", "timeout_1 hour": "1 heure", diff --git a/src/config/i18n/mn/resource.json b/src/config/i18n/mn/resource.json index f4ccc3c97..df7b6766f 100644 --- a/src/config/i18n/mn/resource.json +++ b/src/config/i18n/mn/resource.json @@ -140,8 +140,7 @@ "placeholder_plural": "Одоо байгаа [[name]]-г сонгох эсвэл шинээр оруулна уу" }, "assets": { - "classifier": "[[name]] ангилагч руу дуудлага хийх", - "ticketer": "[[name]] дээр шинэ тасалбар нээх" + "classifier": "[[name]] ангилагч руу дуудлага хийх" }, "body": "Их бие", "buttons": { @@ -306,7 +305,6 @@ "template": "загвар", "the_maximum": "хамгийн их", "the_minimum": "хамгийн бага", - "ticketer": "Тасалбар түгээгч", "timeout": "Завсарлага", "timeout_1 day": "1 өдөр", "timeout_1 hour": "1 цаг", diff --git a/src/config/i18n/pt-br/resource.json b/src/config/i18n/pt-br/resource.json index 6b97457b6..e0d76e443 100644 --- a/src/config/i18n/pt-br/resource.json +++ b/src/config/i18n/pt-br/resource.json @@ -140,8 +140,7 @@ "placeholder_plural": "Selecione [[name]] existente ou adicione um novo" }, "assets": { - "classifier": "Chame o classificador [[name]]", - "ticketer": "Open a new Ticket on [[name]]" + "classifier": "Chame o classificador [[name]]" }, "body": "Corpo", "buttons": { @@ -306,7 +305,6 @@ "template": "modelo", "the_maximum": "o máximo", "the_minimum": "o mínimo", - "ticketer": "Ticketer", "timeout": "Tempo de espera", "timeout_1 day": "1 dia", "timeout_1 hour": "1 hora", diff --git a/src/config/interfaces.ts b/src/config/interfaces.ts index bb47fbc00..9852dffad 100644 --- a/src/config/interfaces.ts +++ b/src/config/interfaces.ts @@ -102,7 +102,6 @@ export enum FeatureFilter { HAS_WHATSAPP = 'whatsapp', HAS_AIRTIME = 'airtime', HAS_CLASSIFIER = 'classifier', - HAS_TICKETER = 'ticketer', HAS_FACEBOOK = 'facebook', HAS_LOCATIONS = 'locations', HAS_OPTINS = 'optins' diff --git a/src/config/typeConfigs.ts b/src/config/typeConfigs.ts index ff36df919..a52fb57ba 100644 --- a/src/config/typeConfigs.ts +++ b/src/config/typeConfigs.ts @@ -408,8 +408,7 @@ export const typeConfigList: Type[] = [ localizeableKeys: ['exits'], component: OpenTicketComp, aliases: [Types.split_by_ticket], - visibility: VISIBILITY_ONLINE, - filter: FeatureFilter.HAS_TICKETER + visibility: VISIBILITY_ONLINE }, { type: Types.transfer_airtime, diff --git a/src/external/index.ts b/src/external/index.ts index 4de2be880..3205a1e23 100644 --- a/src/external/index.ts +++ b/src/external/index.ts @@ -343,11 +343,6 @@ export const createAssetStore = (endpoints: Endpoints): Promise => { type: AssetType.Template, items: {} }, - ticketers: { - endpoint: getURL(endpoints.ticketers), - type: AssetType.Ticketer, - items: {} - }, currencies: { type: AssetType.Currency, id: 'id', @@ -358,7 +353,7 @@ export const createAssetStore = (endpoints: Endpoints): Promise => { // prefetch some of our assets const fetches: any[] = []; - ['languages', 'fields', 'groups', 'labels', 'globals', 'classifiers', 'ticketers'].forEach( + ['languages', 'fields', 'groups', 'labels', 'globals', 'classifiers'].forEach( (storeId: string) => { const store = assetStore[storeId]; fetches.push( diff --git a/src/flowTypes.ts b/src/flowTypes.ts index a10802534..a710af6d0 100644 --- a/src/flowTypes.ts +++ b/src/flowTypes.ts @@ -37,7 +37,6 @@ export interface Endpoints { optins: string; channels: string; classifiers: string; - ticketers: string; users: string; topics: string; environment: string; @@ -439,11 +438,6 @@ export interface Classifier { name: string; } -export interface Ticketer { - uuid: string; - name: string; -} - export interface TransferAirtime extends Action { amounts: { [name: string]: number }; result_name: string; @@ -469,7 +463,6 @@ export interface CallWebhook extends Action { } export interface OpenTicket extends Action { - ticketer: Ticketer; subject?: string; topic?: Topic; body: string; diff --git a/src/store/flowContext.ts b/src/store/flowContext.ts index 73130eed1..a2d542296 100644 --- a/src/store/flowContext.ts +++ b/src/store/flowContext.ts @@ -79,7 +79,6 @@ export enum AssetType { Revision = 'revision', Scheme = 'scheme', Template = 'template', - Ticketer = 'ticketer', URN = 'urn' } diff --git a/src/test/assets/config.js b/src/test/assets/config.js index 5ae14a5a2..8ccc62bb1 100644 --- a/src/test/assets/config.js +++ b/src/test/assets/config.js @@ -11,7 +11,6 @@ export const merged = groups: 'groups', contacts: 'contacts', classifiers: 'classifiers', - ticketers: 'ticketers', fields: 'fields', labels: 'labels', environment: 'environment', @@ -27,7 +26,6 @@ export const merged = groups: '/assets/groups', contacts: '/assets/contacts', classifiers: '/assets/classifiers', - ticketers: '/assets/ticketers', fields: '/assets/fields', labels: '/assets/labels', environment: '/assets/environment', diff --git a/src/test/config.ts b/src/test/config.ts index 545771686..e23e1d681 100644 --- a/src/test/config.ts +++ b/src/test/config.ts @@ -15,7 +15,7 @@ const config: FlowEditorConfig = { showDownload: true, flowType: FlowTypes.MESSAGING, mutable: true, - filters: ['whatsapp', 'airtime', 'resthook', 'classifier', 'ticketer'], + filters: ['whatsapp', 'airtime', 'resthook', 'classifier'], help: {}, brand: 'RapidPro', endpoints: { @@ -33,7 +33,6 @@ const config: FlowEditorConfig = { environment: '/assets/environment.json', revisions: '/assets/revisions.json', classifiers: '/assets/classifiers.json', - ticketers: '/assets/ticketers.json', attachments: '/assets/attachments.json', recents: '/assets/recents.json', templates: '/assets/templates.json', diff --git a/src/test/utils.tsx b/src/test/utils.tsx index 5784d3784..a6ebae200 100644 --- a/src/test/utils.tsx +++ b/src/test/utils.tsx @@ -38,8 +38,7 @@ export const EMPTY_TEST_ASSETS = { labels: { items: {}, type: AssetType.Label }, results: { items: {}, type: AssetType.Result }, flows: { items: {}, type: AssetType.Flow }, - recipients: { items: {}, type: AssetType.Contact || AssetType.Group || AssetType.URN }, - ticketers: { items: {}, type: AssetType.Ticketer } + recipients: { items: {}, type: AssetType.Contact || AssetType.Group || AssetType.URN } }; const initial = initialState; diff --git a/src/testUtils/assetCreators.ts b/src/testUtils/assetCreators.ts index 07b78d6ff..c9737307f 100644 --- a/src/testUtils/assetCreators.ts +++ b/src/testUtils/assetCreators.ts @@ -435,10 +435,6 @@ export const createOpenTicketNode = (subject: string, body: string): FlowNode => const action: OpenTicket = { uuid: utils.createUUID(), type: Types.open_ticket, - ticketer: { - name: 'Email (bob@acme.com)', - uuid: '1165a73a-2ee0-4891-895e-768645194862' - }, subject: subject, body: body, result_name: 'Result'