Skip to content

Commit

Permalink
Merge pull request #1211 from nyaruka/no_more_ticketers
Browse files Browse the repository at this point in the history
Remove support for ticketers
  • Loading branch information
rowanseymour authored Jan 2, 2024
2 parents 3bc7def + 4b7a4eb commit ba0c5c7
Show file tree
Hide file tree
Showing 26 changed files with 16 additions and 143 deletions.
13 changes: 0 additions & 13 deletions lambda/ticketers.js

This file was deleted.

1 change: 0 additions & 1 deletion src/components/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Array [
"simulateResume": "",
"simulateStart": "",
"templates": "/assets/templates.json",
"ticketers": "/assets/ticketers.json",
"topics": "/assets/topics.json",
"users": "/assets/users.json",
},
Expand Down
7 changes: 0 additions & 7 deletions src/components/flow/actions/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,6 @@ export const renderAsset = (asset: Asset, endpoints: Endpoints) => {
</div>
);
break;
case AssetType.Ticketer:
assetBody = (
<Trans i18nKey="assets.ticketer" values={{ name: asset.name }}>
Open a new Ticket on [[name]]
</Trans>
);
break;
}

if (!assetBody) {
Expand Down
11 changes: 1 addition & 10 deletions src/components/flow/actions/openticket/OpenTicket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@ import * as React from 'react';
import { OpenTicket } from 'flowTypes';
import { fakePropType } from 'config/ConfigProvider';

const OpenTicketComp: React.SFC<OpenTicket> = (
{ ticketer, subject, topic },
context: any
): JSX.Element => {
const showTicketer = ticketer.name.indexOf(context.config.brand) === -1;
const OpenTicketComp: React.SFC<OpenTicket> = ({ subject, topic }, context: any): JSX.Element => {
return (
<div>
<div>{subject ? subject : topic ? topic.name : null}</div>
{showTicketer ? (
<div style={{ fontSize: '80%' }}>
Using <span style={{ fontWeight: 400 }}>{ticketer.name}</span>
</div>
) : null}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
41 changes: 1 addition & 40 deletions src/components/flow/routers/ticket/TicketRouterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand All @@ -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/]
Expand All @@ -56,7 +50,6 @@ export default class TicketRouterForm extends React.Component<
keys: {
assignee?: User;
topic?: Topic;
ticketer?: Asset;
subject?: string;
body?: string;
resultName?: string;
Expand All @@ -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, []);
}
Expand All @@ -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 });
}
Expand Down Expand Up @@ -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
Expand All @@ -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 (
<Dialog title={typeConfig.name} headerClass={typeConfig.type} buttons={this.getButtons()}>
<TypeList __className="" initialType={typeConfig} onChange={this.props.onTypeChange} />
{showTicketers ? (
<div>
<p>
<span>Open ticket via... </span>
</p>
<AssetSelector
key="select_ticketer"
name={i18n.t('forms.ticketer', 'Ticketer')}
placeholder="Select the ticketing service to use"
assets={this.props.assetStore.ticketers}
onChange={this.handleTicketerUpdate}
entry={this.state.ticketer}
/>
</div>
) : (
''
)}

<div style={{ display: 'flex', width: '100%', marginTop: '0.5em' }}>
<div style={{ flexBasis: 250 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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\\"]}]"
/>
</div>
</div>
</div>
<div
style="display: flex; width: 100%; margin-top: 0.5em;"
>
Expand Down Expand Up @@ -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\\"]}]"
/>
</div>
</div>
</div>
<div
style="display: flex; width: 100%; margin-top: 0.5em;"
>
Expand Down Expand Up @@ -378,10 +376,6 @@ Array [
},
"body": "Where are my cookies",
"result_name": "My Ticket Result",
"ticketer": Object {
"name": "Email ([email protected])",
"uuid": "1165a73a-2ee0-4891-895e-768645194862",
},
"topic": Object {
"value": Object {
"name": "General",
Expand Down
14 changes: 1 addition & 13 deletions src/components/flow/routers/ticket/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' };
Expand All @@ -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 };
Expand All @@ -43,7 +36,6 @@ export const nodeToState = (
const state: TicketRouterFormState = {
assignee,
topic,
ticketer,
subject,
body,
resultName,
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/components/simulator/LogEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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?'
Expand Down
1 change: 0 additions & 1 deletion src/components/simulator/LogEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/config/__snapshots__/typeConfigs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ Array [
],
"component": [Function],
"description": "Open a ticket with a human agent",
"filter": "ticketer",
"form": [Function],
"localization": [Function],
"localizeableKeys": Array [
Expand Down Expand Up @@ -560,7 +559,6 @@ Object {
],
"component": [Function],
"description": "Open a ticket with a human agent",
"filter": "ticketer",
"form": [Function],
"localization": [Function],
"localizeableKeys": Array [
Expand Down Expand Up @@ -888,7 +886,6 @@ Object {
],
"component": [Function],
"description": "Open a ticket with a human agent",
"filter": "ticketer",
"form": [Function],
"localization": [Function],
"localizeableKeys": Array [
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/cs/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/es/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/fr/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/mn/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@
"placeholder_plural": "Одоо байгаа [[name]]-г сонгох эсвэл шинээр оруулна уу"
},
"assets": {
"classifier": "[[name]] ангилагч руу дуудлага хийх",
"ticketer": "[[name]] дээр шинэ тасалбар нээх"
"classifier": "[[name]] ангилагч руу дуудлага хийх"
},
"body": "Их бие",
"buttons": {
Expand Down Expand Up @@ -306,7 +305,6 @@
"template": "загвар",
"the_maximum": "хамгийн их",
"the_minimum": "хамгийн бага",
"ticketer": "Тасалбар түгээгч",
"timeout": "Завсарлага",
"timeout_1 day": "1 өдөр",
"timeout_1 hour": "1 цаг",
Expand Down
4 changes: 1 addition & 3 deletions src/config/i18n/pt-br/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
Loading

0 comments on commit ba0c5c7

Please sign in to comment.