@nyaruka/temba-components 0.126.0 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/demo/chart/example.html +18 -1
- package/demo/data/flows/sample-flow.json +127 -100
- package/demo/data/server/opened-tickets-long.json +53 -0
- package/demo/sticky-note-demo.html +152 -0
- package/dist/locales/es.js +5 -5
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +5 -5
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/locale-codes.js +11 -2
- package/dist/locales/locale-codes.js.map +1 -1
- package/dist/locales/pt.js +5 -5
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +346 -86
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/chart/TembaChart.js +44 -5
- package/out-tsc/src/chart/TembaChart.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +210 -1
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/EditorNode.js +98 -142
- package/out-tsc/src/flow/EditorNode.js.map +1 -1
- package/out-tsc/src/flow/StickyNote.js +272 -0
- package/out-tsc/src/flow/StickyNote.js.map +1 -0
- package/out-tsc/src/list/RunList.js +2 -1
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +9 -0
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/locales/es.js +5 -5
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +5 -5
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/locale-codes.js +11 -2
- package/out-tsc/src/locales/locale-codes.js.map +1 -1
- package/out-tsc/src/locales/pt.js +5 -5
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/store/AppState.js +33 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/vectoricon/index.js +2 -1
- package/out-tsc/src/vectoricon/index.js.map +1 -1
- package/out-tsc/temba-modules.js +2 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +249 -5
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-select.test.js +9 -14
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +62 -0
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/sticky-note/blue.png +0 -0
- package/screenshots/truth/sticky-note/gray.png +0 -0
- package/screenshots/truth/sticky-note/green.png +0 -0
- package/screenshots/truth/sticky-note/pink.png +0 -0
- package/screenshots/truth/sticky-note/yellow.png +0 -0
- package/src/chart/TembaChart.ts +47 -5
- package/src/flow/Editor.ts +252 -2
- package/src/flow/EditorNode.ts +98 -160
- package/src/flow/StickyNote.ts +284 -0
- package/src/list/RunList.ts +2 -1
- package/src/list/SortableList.ts +11 -0
- package/src/locales/es.ts +18 -13
- package/src/locales/fr.ts +18 -13
- package/src/locales/locale-codes.ts +11 -2
- package/src/locales/pt.ts +18 -13
- package/src/store/AppState.ts +51 -1
- package/src/store/flow-definition.d.ts +8 -0
- package/src/vectoricon/index.ts +2 -1
- package/static/svg/index.pdf +137 -0
- package/temba-modules.ts +2 -0
- package/test/temba-flow-editor-node.test.ts +322 -6
- package/test/temba-select.test.ts +10 -17
- package/test/utils.test.ts +98 -0
- package/web-dev-server.config.mjs +30 -22
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
/* eslint-disable no-irregular-whitespace */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
export const templates = {
|
|
6
|
-
s73b4d70c02f4b4e0: `No options`,
|
|
7
|
-
scf1453991c986b25: `Tab to complete, enter to select`,
|
|
8
|
-
s8f02e3a18ffc083a: `Are not currently in a flow`,
|
|
9
|
-
s638236250662c6b3: `Have sent a message in the last`,
|
|
10
|
-
s4788ee206c4570c7: `Have not started this flow in the last 90 days
|
|
6
|
+
's73b4d70c02f4b4e0': `No options`,
|
|
7
|
+
'scf1453991c986b25': `Tab to complete, enter to select`,
|
|
8
|
+
's8f02e3a18ffc083a': `Are not currently in a flow`,
|
|
9
|
+
's638236250662c6b3': `Have sent a message in the last`,
|
|
10
|
+
's4788ee206c4570c7': `Have not started this flow in the last 90 days`,
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=pt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pt.js","sourceRoot":"","sources":["../../../src/locales/pt.ts"],"names":[],"mappings":"AACI,mCAAmC;AACnC,gDAAgD;AAKhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,mBAAmB,EAAE,YAAY;IACvC,mBAAmB,EAAE,kCAAkC;IACvD,mBAAmB,EAAE,6BAA6B;IAClD,mBAAmB,EAAE,iCAAiC;IACtD,mBAAmB,EAAE,gDAAgD;CAChE,CAAC","sourcesContent":["\n // Do not modify this file by hand!\n // Re-generate this file by running lit-localize\n\n \n \n\n /* eslint-disable no-irregular-whitespace */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n\n export const templates = {\n 's73b4d70c02f4b4e0': `No options`,\n'scf1453991c986b25': `Tab to complete, enter to select`,\n's8f02e3a18ffc083a': `Are not currently in a flow`,\n's638236250662c6b3': `Have sent a message in the last`,\n's4788ee206c4570c7': `Have not started this flow in the last 90 days`,\n };\n "]}
|
|
@@ -125,6 +125,39 @@ export const zustand = createStore()(subscribeWithSelector(immer((set, get) => (
|
|
|
125
125
|
}
|
|
126
126
|
state.flowDefinition.nodes = state.flowDefinition.nodes.filter((node) => !uuids.includes(node.uuid));
|
|
127
127
|
});
|
|
128
|
+
},
|
|
129
|
+
updateStickyPosition: (uuid, newPosition) => {
|
|
130
|
+
set((state) => {
|
|
131
|
+
if (!state.flowDefinition._ui.stickies) {
|
|
132
|
+
state.flowDefinition._ui.stickies = {};
|
|
133
|
+
}
|
|
134
|
+
if (state.flowDefinition._ui.stickies[uuid]) {
|
|
135
|
+
state.flowDefinition._ui.stickies[uuid].position = newPosition;
|
|
136
|
+
state.dirtyDate = new Date();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
updateNode: (uuid, newNode) => {
|
|
141
|
+
set((state) => {
|
|
142
|
+
var _a;
|
|
143
|
+
const node = (_a = state.flowDefinition) === null || _a === void 0 ? void 0 : _a.nodes.find((n) => n.uuid === uuid);
|
|
144
|
+
if (node) {
|
|
145
|
+
node.actions = newNode.actions;
|
|
146
|
+
node.uuid = newNode.uuid;
|
|
147
|
+
node.exits = newNode.exits;
|
|
148
|
+
node.router = newNode.router;
|
|
149
|
+
}
|
|
150
|
+
state.dirtyDate = new Date();
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
updateStickyNote: (uuid, sticky) => {
|
|
154
|
+
set((state) => {
|
|
155
|
+
if (!state.flowDefinition._ui.stickies) {
|
|
156
|
+
state.flowDefinition._ui.stickies = {};
|
|
157
|
+
}
|
|
158
|
+
state.flowDefinition._ui.stickies[uuid] = sticky;
|
|
159
|
+
state.dirtyDate = new Date();
|
|
160
|
+
});
|
|
128
161
|
}
|
|
129
162
|
}))));
|
|
130
163
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppState.js","sourceRoot":"","sources":["../../../src/store/AppState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE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AAC,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,KAAK,CAAC,eAAe,CAAC,GAAG;;YACvB,MAAA,MAAA,IAAI,CAAC,mBAAmB,0CAAG,IAAI,CAAC,kDAAI,CAAC;YACrC,IAAI,gBAAgB;gBAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createStore, StoreApi } from 'zustand/vanilla';\nimport { fetchResults } from '../utils';\nimport { FlowDefinition, FlowPosition } from './flow-definition';\nimport { immer } from 'zustand/middleware/immer';\nimport { subscribeWithSelector } from 'zustand/middleware';\nimport { property } from 'lit/decorators.js';\n\nexport const FLOW_SPEC_VERSION = '14.3';\nconst CANVAS_PADDING = 800;\n\nexport interface InfoResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface ObjectRef {\n uuid: string;\n name: string;\n}\n\nexport interface TypedObjectRef extends ObjectRef {\n type: string;\n}\n\nexport interface Language {\n code: string;\n name: string;\n}\n\nexport interface FlowInfo {\n results: InfoResult[];\n dependencies: TypedObjectRef[];\n counts: { nodes: number; languages: number };\n locals: string[];\n}\n\nexport interface FlowContents {\n definition: FlowDefinition;\n info: FlowInfo;\n}\n\nexport interface Workspace {\n anon: boolean;\n country: string;\n date_style: string;\n languages: string[];\n name: string;\n primary_language: string;\n timezone: string;\n uuid: string;\n}\n\nexport interface CanvasPositions {\n [uuid: string]: FlowPosition;\n}\n\nexport interface AppState {\n flowDefinition: FlowDefinition;\n flowInfo: FlowInfo;\n\n languageCode: string;\n languageNames: { [code: string]: Language };\n workspace: Workspace;\n isTranslating: boolean;\n\n dirtyDate: Date | null;\n\n canvasSize: { width: number; height: number };\n\n fetchRevision: (endpoint: string, id?: string) => void;\n fetchWorkspace: (endpoint: string) => Promise<void>;\n fetchAllLanguages: (endpoint: string) => Promise<void>;\n\n getFlowResults: () => InfoResult[];\n getResultByKey(id: any): InfoResult;\n\n setFlowContents: (flow: FlowContents) => void;\n setFlowInfo: (info: FlowInfo) => void;\n setLanguageCode: (languageCode: string) => void;\n setDirtyDate: (date: Date) => void;\n expandCanvas: (width: number, height: number) => void;\n\n updateCanvasPositions: (positions: CanvasPositions) => void;\n updateNodePosition(uuid: string, newPosition: FlowPosition): void;\n removeNodes: (uuids: string[]) => void;\n}\n\nexport const zustand = createStore<AppState>()(\n subscribeWithSelector(\n immer((set, get) => ({\n languageNames: {},\n canvasSize: { width: 0, height: 0 },\n languageCode: '',\n workspace: null,\n flowDefinition: null,\n flowInfo: null,\n isTranslating: false,\n dirtyDate: null,\n\n setDirtyDate: (date: Date) => {\n set((state: AppState) => {\n state.dirtyDate = date;\n });\n },\n\n fetchRevision: async (endpoint: string, id: string = null) => {\n if (!id) {\n id = 'latest';\n }\n const response = await fetch(\n `${endpoint}/${id}/?version=${FLOW_SPEC_VERSION}`\n );\n\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = (await response.json()) as FlowContents;\n set({ flowInfo: data.info, flowDefinition: data.definition });\n },\n\n fetchWorkspace: async (endpoint) => {\n const response = await fetch(endpoint);\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = await response.json();\n set({ workspace: data });\n },\n\n fetchAllLanguages: async (endpoint) => {\n const results = await fetchResults(endpoint);\n\n // convert array to map for easier lookup\n const allLanguages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n\n set({ languageNames: allLanguages });\n },\n\n getFlowResults: () => {\n const state = get();\n return state.flowInfo.results;\n },\n\n getResultByKey: (id: any) => {\n const state = get();\n const results = state.flowInfo.results;\n return results.find((result) => result.key === id);\n },\n\n getLanguage: () => {\n const state = get();\n const languageCode = state.languageCode;\n const languageNames = state.languageNames;\n return { name: languageNames[languageCode], code: languageCode };\n },\n\n // todo: eventually we should be doing the fetching\n setFlowContents: (flow: FlowContents) => {\n set((state: AppState) => {\n const flowLang = flow.definition.language;\n state.flowDefinition = flow.definition;\n state.flowInfo = flow.info;\n // Reset to the flow's default language when loading a new flow\n state.languageCode = flowLang;\n state.isTranslating = false;\n });\n },\n\n setFlowInfo: (info: FlowInfo) => {\n set((state: AppState) => {\n state.flowInfo = info;\n });\n },\n\n setLanguageCode: (languageCode: string) => {\n set((state: AppState) => {\n state.languageCode = languageCode;\n state.isTranslating = state.flowDefinition.language !== languageCode;\n });\n },\n\n expandCanvas: (width: number, height: number) => {\n set((state: AppState) => {\n const minWidth = Math.max(\n state.canvasSize.width,\n width + CANVAS_PADDING\n );\n const minHeight = Math.max(\n state.canvasSize.height,\n height + CANVAS_PADDING\n );\n\n state.canvasSize.width = minWidth;\n state.canvasSize.height = minHeight;\n });\n },\n\n updateCanvasPositions: (positions: CanvasPositions) => {\n set((state: AppState) => {\n for (const uuid in positions) {\n // todo: add nodes that are created and then moved, for now ignore\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = positions[uuid];\n }\n }\n });\n },\n\n updateNodePosition: (uuid: string, newPosition: FlowPosition) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = newPosition;\n } else {\n // If the node doesn't exist in _ui, we can add it\n state.flowDefinition._ui.nodes[uuid] = {\n position: newPosition,\n type: null,\n config: {}\n };\n }\n\n state.dirtyDate = new Date();\n });\n },\n\n removeNodes: (uuids: string[]) => {\n set((state: AppState) => {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.nodes[uuid];\n }\n\n state.flowDefinition.nodes = state.flowDefinition.nodes.filter(\n (node) => !uuids.includes(node.uuid)\n );\n });\n }\n }))\n )\n);\n\ntype SelectorAwareStoreApi<S extends object> = StoreApi<S> & {\n subscribe: <U>(\n selector: (state: S) => U,\n listener: (value: U, previous: U) => void\n ) => () => void;\n};\n\n/**\n * Custom Lit property decorator that binds a property to a Zustand store subscription.\n *\n * @param store - The Zustand store to subscribe to.\n * @param selector - A function selecting the slice of state to bind to the property.\n */\nexport function fromStore<S extends object, V = unknown>(\n store: SelectorAwareStoreApi<S>,\n selector: (state: S) => V\n): PropertyDecorator {\n return (proto: any, name: string | symbol) => {\n property()(proto, name as string);\n\n const connectedKey = 'connectedCallback';\n const disconnectedKey = 'disconnectedCallback';\n\n const userConnected = proto[connectedKey];\n const userDisconnected = proto[disconnectedKey];\n\n proto[connectedKey] = function () {\n this._zustandUnsubscribe ??= {};\n this[name] = selector(store.getState());\n\n this._zustandUnsubscribe[name] = store.subscribe(selector, (val: V) => {\n this[name] = val;\n });\n\n if (userConnected) userConnected.call(this);\n };\n\n proto[disconnectedKey] = function () {\n this._zustandUnsubscribe?.[name]?.();\n if (userDisconnected) userDisconnected.call(this);\n };\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AppState.js","sourceRoot":"","sources":["../../../src/store/AppState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAUxC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,cAAc,GAAG,GAAG,CAAC;AAwF3B,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,EAAY,CAC5C,qBAAqB,CACnB,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACnB,aAAa,EAAE,EAAE;IACjB,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IACnC,YAAY,EAAE,EAAE;IAChB,SAAS,EAAE,IAAI;IACf,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,IAAI;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AC,GAAG;;YACvB,MAAA,MAAA,IAAI,CAAC,mBAAmB,0CAAG,IAAI,CAAC,kDAAI,CAAC;YACrC,IAAI,gBAAgB;gBAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createStore, StoreApi } from 'zustand/vanilla';\nimport { fetchResults } from '../utils';\nimport {\n Action,\n Exit,\n FlowDefinition,\n FlowPosition,\n Node,\n Router,\n StickyNote\n} from './flow-definition';\nimport { immer } from 'zustand/middleware/immer';\nimport { subscribeWithSelector } from 'zustand/middleware';\nimport { property } from 'lit/decorators.js';\n\nexport const FLOW_SPEC_VERSION = '14.3';\nconst CANVAS_PADDING = 800;\n\nexport interface InfoResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface ObjectRef {\n uuid: string;\n name: string;\n}\n\nexport interface TypedObjectRef extends ObjectRef {\n type: string;\n}\n\nexport interface Language {\n code: string;\n name: string;\n}\n\nexport interface FlowInfo {\n results: InfoResult[];\n dependencies: TypedObjectRef[];\n counts: { nodes: number; languages: number };\n locals: string[];\n}\n\nexport interface FlowContents {\n definition: FlowDefinition;\n info: FlowInfo;\n}\n\nexport interface Workspace {\n anon: boolean;\n country: string;\n date_style: string;\n languages: string[];\n name: string;\n primary_language: string;\n timezone: string;\n uuid: string;\n}\n\nexport interface CanvasPositions {\n [uuid: string]: FlowPosition;\n}\n\nexport interface AppState {\n flowDefinition: FlowDefinition;\n flowInfo: FlowInfo;\n\n languageCode: string;\n languageNames: { [code: string]: Language };\n workspace: Workspace;\n isTranslating: boolean;\n\n dirtyDate: Date | null;\n\n canvasSize: { width: number; height: number };\n\n fetchRevision: (endpoint: string, id?: string) => void;\n fetchWorkspace: (endpoint: string) => Promise<void>;\n fetchAllLanguages: (endpoint: string) => Promise<void>;\n\n getFlowResults: () => InfoResult[];\n getResultByKey(id: any): InfoResult;\n\n setFlowContents: (flow: FlowContents) => void;\n setFlowInfo: (info: FlowInfo) => void;\n setLanguageCode: (languageCode: string) => void;\n setDirtyDate: (date: Date) => void;\n expandCanvas: (width: number, height: number) => void;\n\n updateNode(\n uuid: string,\n node: { actions: Action[]; uuid: string; exits: Exit[]; router?: Router }\n ): unknown;\n updateCanvasPositions: (positions: CanvasPositions) => void;\n updateNodePosition(uuid: string, newPosition: FlowPosition): void;\n removeNodes: (uuids: string[]) => void;\n\n updateStickyPosition(uuid: string, newPosition: FlowPosition): void;\n updateStickyNote(uuid: string, sticky: StickyNote): void;\n}\n\nexport const zustand = createStore<AppState>()(\n subscribeWithSelector(\n immer((set, get) => ({\n languageNames: {},\n canvasSize: { width: 0, height: 0 },\n languageCode: '',\n workspace: null,\n flowDefinition: null,\n flowInfo: null,\n isTranslating: false,\n dirtyDate: null,\n\n setDirtyDate: (date: Date) => {\n set((state: AppState) => {\n state.dirtyDate = date;\n });\n },\n\n fetchRevision: async (endpoint: string, id: string = null) => {\n if (!id) {\n id = 'latest';\n }\n const response = await fetch(\n `${endpoint}/${id}/?version=${FLOW_SPEC_VERSION}`\n );\n\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = (await response.json()) as FlowContents;\n set({ flowInfo: data.info, flowDefinition: data.definition });\n },\n\n fetchWorkspace: async (endpoint) => {\n const response = await fetch(endpoint);\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = await response.json();\n set({ workspace: data });\n },\n\n fetchAllLanguages: async (endpoint) => {\n const results = await fetchResults(endpoint);\n\n // convert array to map for easier lookup\n const allLanguages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n\n set({ languageNames: allLanguages });\n },\n\n getFlowResults: () => {\n const state = get();\n return state.flowInfo.results;\n },\n\n getResultByKey: (id: any) => {\n const state = get();\n const results = state.flowInfo.results;\n return results.find((result) => result.key === id);\n },\n\n getLanguage: () => {\n const state = get();\n const languageCode = state.languageCode;\n const languageNames = state.languageNames;\n return { name: languageNames[languageCode], code: languageCode };\n },\n\n // todo: eventually we should be doing the fetching\n setFlowContents: (flow: FlowContents) => {\n set((state: AppState) => {\n const flowLang = flow.definition.language;\n state.flowDefinition = flow.definition;\n state.flowInfo = flow.info;\n // Reset to the flow's default language when loading a new flow\n state.languageCode = flowLang;\n state.isTranslating = false;\n });\n },\n\n setFlowInfo: (info: FlowInfo) => {\n set((state: AppState) => {\n state.flowInfo = info;\n });\n },\n\n setLanguageCode: (languageCode: string) => {\n set((state: AppState) => {\n state.languageCode = languageCode;\n state.isTranslating = state.flowDefinition.language !== languageCode;\n });\n },\n\n expandCanvas: (width: number, height: number) => {\n set((state: AppState) => {\n const minWidth = Math.max(\n state.canvasSize.width,\n width + CANVAS_PADDING\n );\n const minHeight = Math.max(\n state.canvasSize.height,\n height + CANVAS_PADDING\n );\n\n state.canvasSize.width = minWidth;\n state.canvasSize.height = minHeight;\n });\n },\n\n updateCanvasPositions: (positions: CanvasPositions) => {\n set((state: AppState) => {\n for (const uuid in positions) {\n // todo: add nodes that are created and then moved, for now ignore\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = positions[uuid];\n }\n }\n });\n },\n\n updateNodePosition: (uuid: string, newPosition: FlowPosition) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = newPosition;\n } else {\n // If the node doesn't exist in _ui, we can add it\n state.flowDefinition._ui.nodes[uuid] = {\n position: newPosition,\n type: null,\n config: {}\n };\n }\n\n state.dirtyDate = new Date();\n });\n },\n\n removeNodes: (uuids: string[]) => {\n set((state: AppState) => {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.nodes[uuid];\n }\n\n state.flowDefinition.nodes = state.flowDefinition.nodes.filter(\n (node) => !uuids.includes(node.uuid)\n );\n });\n },\n\n updateStickyPosition: (uuid: string, newPosition: FlowPosition) => {\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n if (state.flowDefinition._ui.stickies[uuid]) {\n state.flowDefinition._ui.stickies[uuid].position = newPosition;\n state.dirtyDate = new Date();\n }\n });\n },\n\n updateNode: (uuid: string, newNode: Node) => {\n set((state: AppState) => {\n const node = state.flowDefinition?.nodes.find((n) => n.uuid === uuid);\n if (node) {\n node.actions = newNode.actions;\n node.uuid = newNode.uuid;\n node.exits = newNode.exits;\n node.router = newNode.router;\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateStickyNote: (uuid: string, sticky: StickyNote) => {\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n state.flowDefinition._ui.stickies[uuid] = sticky;\n state.dirtyDate = new Date();\n });\n }\n }))\n )\n);\n\ntype SelectorAwareStoreApi<S extends object> = StoreApi<S> & {\n subscribe: <U>(\n selector: (state: S) => U,\n listener: (value: U, previous: U) => void\n ) => () => void;\n};\n\n/**\n * Custom Lit property decorator that binds a property to a Zustand store subscription.\n *\n * @param store - The Zustand store to subscribe to.\n * @param selector - A function selecting the slice of state to bind to the property.\n */\nexport function fromStore<S extends object, V = unknown>(\n store: SelectorAwareStoreApi<S>,\n selector: (state: S) => V\n): PropertyDecorator {\n return (proto: any, name: string | symbol) => {\n property()(proto, name as string);\n\n const connectedKey = 'connectedCallback';\n const disconnectedKey = 'disconnectedCallback';\n\n const userConnected = proto[connectedKey];\n const userDisconnected = proto[disconnectedKey];\n\n proto[connectedKey] = function () {\n this._zustandUnsubscribe ??= {};\n this[name] = selector(store.getState());\n\n this._zustandUnsubscribe[name] = store.subscribe(selector, (val: V) => {\n this[name] = val;\n });\n\n if (userConnected) userConnected.call(this);\n };\n\n proto[disconnectedKey] = function () {\n this._zustandUnsubscribe?.[name]?.();\n if (userDisconnected) userDisconnected.call(this);\n };\n };\n}\n"]}
|
|
@@ -58,7 +58,8 @@ export var Icon;
|
|
|
58
58
|
Icon["delete_small"] = "x";
|
|
59
59
|
Icon["down"] = "chevron-down";
|
|
60
60
|
Icon["download"] = "download-01";
|
|
61
|
-
Icon["
|
|
61
|
+
Icon["drag"] = "dots-grid";
|
|
62
|
+
Icon["edit"] = "edit-02";
|
|
62
63
|
Icon["email"] = "mail-01";
|
|
63
64
|
Icon["error"] = "alert-circle";
|
|
64
65
|
Icon["event"] = "zap";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vectoricon/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAElE,oDAAoD;AACpD,MAAM,CAAN,IAAY,IAoQX;AApQD,WAAY,IAAI;IACd,wBAAgB,CAAA;IAChB,sCAA8B,CAAA;IAC9B,2BAAmB,CAAA;IACnB,uBAAe,CAAA;IACf,oBAAY,CAAA;IACZ,4BAAoB,CAAA;IACpB,gCAAwB,CAAA;IACxB,kCAA0B,CAAA;IAC1B,2BAAmB,CAAA;IACnB,+BAAuB,CAAA;IACvB,mCAA2B,CAAA;IAC3B,mCAA2B,CAAA;IAC3B,qCAA6B,CAAA;IAC7B,gCAAwB,CAAA;IACxB,uCAA+B,CAAA;IAC/B,uCAA+B,CAAA;IAC/B,qCAA6B,CAAA;IAC7B,6CAAqC,CAAA;IACrC,2CAAmC,CAAA;IACnC,6BAAqB,CAAA;IACrB,uCAA+B,CAAA;IAC/B,0CAAkC,CAAA;IAClC,oCAA4B,CAAA;IAC5B,kCAA0B,CAAA;IAC1B,qCAA6B,CAAA;IAC7B,8BAAsB,CAAA;IACtB,qCAA6B,CAAA;IAC7B,kCAA0B,CAAA;IAC1B,gCAAwB,CAAA;IACxB,qCAA6B,CAAA;IAC7B,mCAA2B,CAAA;IAC3B,uBAAe,CAAA;IACf,kCAA0B,CAAA;IAC1B,uBAAe,CAAA;IACf,2BAAmB,CAAA;IACnB,yCAAiC,CAAA;IACjC,wCAAgC,CAAA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;IAC7B,oCAA4B,CAAA;IAC5B,yCAAiC,CAAA;IACjC,oCAA4B,CAAA;IAC5B,0BAAkB,CAAA;IAClB,0BAAkB,CAAA;IAClB,yCAAiC,CAAA;IACjC,oCAA4B,CAAA;IAC5B,uCAA+B,CAAA;IAC/B,sCAA8B,CAAA;IAC9B,oCAA4B,CAAA;IAC5B,0BAAkB,CAAA;IAClB,wCAAgC,CAAA;IAChC,2BAAmB,CAAA;IACnB,uCAA+B,CAAA;IAC/B,iCAAyB,CAAA;IACzB,oCAA4B,CAAA;IAC5B,uCAA+B,CAAA;IAC/B,wCAAgC,CAAA;IAChC,qCAA6B,CAAA;IAC7B,0BAAkB,CAAA;IAClB,wCAAgC,CAAA;IAEhC,KAAK;IACL,4BAAoB,CAAA;IACpB,kCAA0B,CAAA;IAC1B,4BAAoB,CAAA;IACpB,8BAAsB,CAAA;IACtB,gCAAwB,CAAA;IAExB,cAAc;IACd,yCAAiC,CAAA;IAEjC,eAAe;IACf,uBAAe,CAAA;IACf,yBAAiB,CAAA;IAEjB,OAAO;IACP,wBAAgB,CAAA;IAChB,+BAAuB,CAAA;IACvB,6BAAqB,CAAA;IACrB,0BAAkB,CAAA;IAClB,yBAAiB,CAAA;AACnB,CAAC,EApQW,IAAI,KAAJ,IAAI,QAoQf","sourcesContent":["/* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n// for cache busting we dynamically generate a fingerprint, use yarn svg to update\nexport const SVG_FINGERPRINT = '6ba60d8c1832b26e5dab7ba5c4cb6b74';\n\n// only icons below are included in the sprite sheet\nexport enum Icon {\n ai = 'beaker-02',\n alert_warning = 'alert-square',\n account = 'user-01',\n active = 'play',\n add = 'plus',\n add_note = 'file-02',\n airtime = 'bank-note-01',\n analytics = 'bar-chart-01',\n archive = 'archive',\n arrow_up = 'chevron-up',\n arrow_down = 'chevron-down',\n arrow_left = 'chevron-left',\n arrow_right = 'chevron-right',\n attachment = 'paperclip',\n attachment_audio = 'volume-min',\n attachment_document = 'file-06',\n attachment_image = 'image-01',\n attachment_location = 'marker-pin-01',\n attachment_video = 'video-recorder',\n branding = 'brush-02',\n branding_hostname = 'server-05',\n branding_notifications = 'mail-01',\n branding_styling = 'palette',\n branding_raw = 'pencil-01',\n broadcast = 'announcement-01',\n call = 'phone-call-01',\n call_missed = 'phone-call-02',\n campaign = 'clock-refresh',\n campaign_active = 'play',\n campaign_archived = 'archive',\n campaigns = 'clock-refresh',\n channel = 'zap',\n children = 'git-branch-01',\n check = 'check',\n checkbox = 'square',\n checkbox_checked = 'check-square',\n checkbox_partial = 'stop-square',\n close = 'x',\n compose = 'send-01',\n contact = 'user-01',\n contact_archived = 'archive',\n contact_blocked = 'message-x-square',\n contact_export = 'download-cloud-01',\n contact_import = 'upload-cloud-01',\n contact_stopped = 'slash-octagon',\n contact_updated = 'user-edit',\n contacts = 'user-01',\n copy = 'copy-04',\n dashboard = 'pie-chart-01',\n definitions_export = 'download-cloud-01',\n delete = 'trash-03',\n delete_small = 'x',\n down = 'chevron-down',\n download = 'download-01',\n edit = 'edit-03',\n email = 'mail-01',\n error = 'alert-circle',\n event = 'zap',\n export = 'download-cloud-01',\n expressions = 'at-sign',\n fields = 'user-edit',\n filter = 'filter-funnel-01',\n flow = 'flow',\n flow_background = 'layers-two-01',\n flow_interrupted = 'x-close',\n flow_ivr = 'phone',\n flow_message = 'message-square-02',\n flow_surveyor = 'tablet-01',\n flow_user = 'hard-drive',\n flows = 'flow',\n global = 'at-sign',\n grid = 'dots-grid',\n group = 'users-01',\n group_exclude = 'users-x',\n group_include = 'users-check',\n group_smart = 'atom-01',\n help = 'help-circle',\n hide = 'eye-off',\n home = 'settings-02',\n image = 'image-01',\n import = 'upload-cloud-01',\n inbox = 'inbox-01',\n incidents = 'alert-square',\n incoming_call = 'phone-incoming-01',\n info = 'user-square',\n integrations = 'layers-three-01',\n invitations = 'user-plus-01',\n issue = 'alert-square',\n label = 'tag-01',\n language = 'translate-01',\n link = 'link-external-01',\n location = 'marker-pin-01',\n log = 'file-02',\n logout = 'log-out-04',\n menu = 'menu-01',\n menu_collapse = 'chevron-left-double',\n message = 'message-square-02',\n message_export = 'download-cloud-01',\n messages = 'message-square-02',\n missing = 'maximize-02',\n missed_call = 'phone-x',\n new = 'plus',\n next_schedule = 'alarm-clock',\n notes = 'edit-03',\n notification = 'bell-01',\n number = 'hash-01',\n optin_requested = 'message-notification-circle',\n optin = 'message-check-circle',\n optout = 'message-x-circle',\n org_active = 'credit-card-02',\n org_anonymous = 'glasses-01',\n org_bulk = 'credit-card-plus',\n org_flagged = 'flag-01',\n org_new = 'stars-02',\n org_suspended = 'slash-circle-01',\n org_verified = 'check-verified-02',\n overview = 'pie-chart-01',\n prometheus = 'prometheus',\n progress_spinner = 'refresh-cw-04',\n featured = 'star-01',\n quick_replies = 'dotpoints-01',\n recording = 'microphone-01',\n resend = 'refresh-cw-05',\n reset = 'flip-backward',\n resthooks = 'share-07',\n restore = 'play',\n results_export = 'download-cloud-01',\n retry = 'refresh-cw-05',\n revisions = 'clock-rewind',\n rocketchat = 'rocketchat',\n runs = 'rows-03',\n schedule = 'calendar',\n search = 'search-refraction',\n select_open = 'chevron-down',\n select_clear = 'x',\n send = 'send-03',\n service = 'magic-wand-01',\n service_end = 'log-out-04',\n settings = 'settings-02',\n shortcut = 'zap-fast',\n show = 'eye',\n simulator = 'phone-02',\n sort = 'chevron-selector-vertical',\n sort_down = 'sort-arrow-down',\n sort_up = 'sort-arrow-up',\n staff = 'hard-drive',\n submit = 'check',\n success = 'check',\n template_approved = 'check-circle',\n template_pending = 'hourglass-01',\n template_rejected = 'alert-circle',\n tickets = 'agent',\n tickets_all = 'archive',\n tickets_closed = 'check',\n tickets_mine = 'coffee',\n tickets_mine_done = 'coffee-empty',\n tickets_open = 'inbox-01',\n tickets_export = 'download-cloud-01',\n tickets_unassigned = 'inbox-01',\n topic = 'message-text-circle-02',\n two_factor_enabled = 'shield-02',\n two_factor_disabled = 'shield-01',\n trigger = 'signal-01',\n trigger_active = 'play',\n trigger_archived = 'archive',\n trigger_new = 'plus',\n trigger_keyword = 'message-check-square',\n trigger_catch_all = 'message-question-square',\n trigger_inbound_call = 'phone-incoming-01',\n trigger_missed_call = 'phone-hang-up',\n trigger_schedule = 'calendar',\n trigger_new_conversation = 'message-chat-square',\n trigger_referral = 'user-right-01',\n trigger_closed_ticket = 'agent',\n trigger_opt_in = 'message-check-circle',\n trigger_opt_out = 'message-x-circle',\n triggers = 'signal-01',\n updated = 'edit-02',\n up = 'chevron-up',\n upload = 'upload-cloud-01',\n upload_image = 'camera-01',\n usages = 'link-04',\n user = 'users-01',\n user_beta = 'shield-zap',\n user_token = 'key-01',\n users = 'users-01',\n video = 'video-recorder',\n webhook = 'link-external-01',\n workspace = 'folder',\n\n // channel types\n channel_a = 'channel-android',\n channel_ac = 'zap', // TODO https://www.arabiacell.com/\n channel_at = 'zap', // TODO https://africastalking.com/\n channel_bs = 'zap', // TODO https://burstsms.com/\n channel_bw = 'zap', // TODO https://www.bandwidth.com/\n channel_cs = 'zap', // TODO https://www.clicksend.com/\n channel_ct = 'channel-clickatell',\n channel_d3 = 'channel-whatsapp',\n channel_d3c = 'channel-whatsapp',\n channel_da = 'zap', // TODO https://dartmedia.co.id/\n channel_ds = 'channel-discord',\n channel_ex = 'zap',\n channel_fb = 'channel-facebook',\n channel_fba = 'channel-facebook',\n channel_fc = 'channel-freshchat',\n channel_fcm = 'channel-firebase',\n channel_hm = 'zap', // TODO https://hormuud.com/\n channel_ib = 'zap', // TODO https://www.infobip.com/\n channel_ig = 'channel-instagram',\n channel_jc = 'channel-jiochat',\n channel_kn = 'channel-kannel',\n channel_kwa = 'channel-whatsapp',\n channel_ln = 'channel-line',\n channel_mt = 'channel-mtarget',\n channel_mtn = 'zap', // TODO https://mtn.com/\n channel_nx = 'channel-vonage',\n channel_pl = 'channel-plivo',\n channel_rc = 'channel-rocketchat',\n channel_sl = 'channel-slack',\n channel_sq = 'zap', // TODO https://shaqodoon.org/\n channel_st = 'zap', // TODO https://bulk.startmobile.ua\n channel_sw = 'channel-signalwire',\n channel_t = 'channel-twilio',\n channel_tg = 'channel-telegram',\n channel_tms = 'channel-twilio',\n channel_tq = 'channel-thinq',\n channel_tw = 'zap', // TODO https://www.somleng.org/\n channel_twa = 'channel-whatsapp',\n channel_twc = 'zap', // TODO\n channel_twt = 'channel-twitter',\n channel_vk = 'channel-vk',\n channel_vp = 'channel-viber',\n channel_wa = 'channel-whatsapp',\n channel_wac = 'channel-whatsapp',\n channel_wc = 'channel-wechat',\n channel_yo = 'zap', // TODO https://www.yo.co.ug/\n channel_zvw = 'channel-whatsapp',\n\n // ai\n ai_openai = 'openai',\n ai_anthropic = 'anthropic',\n ai_google = 'gemini',\n ai_microsoft = 'azure',\n ai_deepseek = 'deepseek',\n\n // classifiers\n classifier_wit = 'classifier-wit',\n\n // other brands\n dtone = 'dtone',\n zapier = 'zapier',\n\n // demo\n default = 'list',\n datepicker = 'calendar',\n slider = 'sliders-02',\n select = 'browser',\n input = 'edit-05'\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vectoricon/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAElE,oDAAoD;AACpD,MAAM,CAAN,IAAY,IAqQX;AArQD,WAAY,IAAI;IACd,wBAAgB,CAAA;IAChB,sCAA8B,CAAA;IAC9B,2BAAmB,CAAA;IACnB,uBAAe,CAAA;IACf,oBAAY,CAAA;IACZ,4BAAoB,CAAA;IACpB,gCAAwB,CAAA;IACxB,kCAA0B,CAAA;IAC1B,2BAAmB,CAAA;IACnB,+BAAuB,CAAA;IACvB,mCAA2B,CAAA;IAC3B,mCAA2B,CAAA;IAC3B,qCAA6B,CAAA;IAC7B,gCAAwB,CAAA;IACxB,uCAA+B,CAAA;IAC/B,uCAA+B,CAAA;IAC/B,qCAA6B,CAAA;IAC7B,6CAAqC,CAAA;IACrC,2CAAm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no-duplicate-enum-values */\n// for cache busting we dynamically generate a fingerprint, use yarn svg to update\nexport const SVG_FINGERPRINT = '6ba60d8c1832b26e5dab7ba5c4cb6b74';\n\n// only icons below are included in the sprite sheet\nexport enum Icon {\n ai = 'beaker-02',\n alert_warning = 'alert-square',\n account = 'user-01',\n active = 'play',\n add = 'plus',\n add_note = 'file-02',\n airtime = 'bank-note-01',\n analytics = 'bar-chart-01',\n archive = 'archive',\n arrow_up = 'chevron-up',\n arrow_down = 'chevron-down',\n arrow_left = 'chevron-left',\n arrow_right = 'chevron-right',\n attachment = 'paperclip',\n attachment_audio = 'volume-min',\n attachment_document = 'file-06',\n attachment_image = 'image-01',\n attachment_location = 'marker-pin-01',\n attachment_video = 'video-recorder',\n branding = 'brush-02',\n branding_hostname = 'server-05',\n branding_notifications = 'mail-01',\n branding_styling = 'palette',\n branding_raw = 'pencil-01',\n broadcast = 'announcement-01',\n call = 'phone-call-01',\n call_missed = 'phone-call-02',\n campaign = 'clock-refresh',\n campaign_active = 'play',\n campaign_archived = 'archive',\n campaigns = 'clock-refresh',\n channel = 'zap',\n children = 'git-branch-01',\n check = 'check',\n checkbox = 'square',\n checkbox_checked = 'check-square',\n checkbox_partial = 'stop-square',\n close = 'x',\n compose = 'send-01',\n contact = 'user-01',\n contact_archived = 'archive',\n contact_blocked = 'message-x-square',\n contact_export = 'download-cloud-01',\n contact_import = 'upload-cloud-01',\n contact_stopped = 'slash-octagon',\n contact_updated = 'user-edit',\n contacts = 'user-01',\n copy = 'copy-04',\n dashboard = 'pie-chart-01',\n definitions_export = 'download-cloud-01',\n delete = 'trash-03',\n delete_small = 'x',\n down = 'chevron-down',\n download = 'download-01',\n drag = 'dots-grid',\n edit = 'edit-02',\n email = 'mail-01',\n error = 'alert-circle',\n event = 'zap',\n export = 'download-cloud-01',\n expressions = 'at-sign',\n fields = 'user-edit',\n filter = 'filter-funnel-01',\n flow = 'flow',\n flow_background = 'layers-two-01',\n flow_interrupted = 'x-close',\n flow_ivr = 'phone',\n flow_message = 'message-square-02',\n flow_surveyor = 'tablet-01',\n flow_user = 'hard-drive',\n flows = 'flow',\n global = 'at-sign',\n grid = 'dots-grid',\n group = 'users-01',\n group_exclude = 'users-x',\n group_include = 'users-check',\n group_smart = 'atom-01',\n help = 'help-circle',\n hide = 'eye-off',\n home = 'settings-02',\n image = 'image-01',\n import = 'upload-cloud-01',\n inbox = 'inbox-01',\n incidents = 'alert-square',\n incoming_call = 'phone-incoming-01',\n info = 'user-square',\n integrations = 'layers-three-01',\n invitations = 'user-plus-01',\n issue = 'alert-square',\n label = 'tag-01',\n language = 'translate-01',\n link = 'link-external-01',\n location = 'marker-pin-01',\n log = 'file-02',\n logout = 'log-out-04',\n menu = 'menu-01',\n menu_collapse = 'chevron-left-double',\n message = 'message-square-02',\n message_export = 'download-cloud-01',\n messages = 'message-square-02',\n missing = 'maximize-02',\n missed_call = 'phone-x',\n new = 'plus',\n next_schedule = 'alarm-clock',\n notes = 'edit-03',\n notification = 'bell-01',\n number = 'hash-01',\n optin_requested = 'message-notification-circle',\n optin = 'message-check-circle',\n optout = 'message-x-circle',\n org_active = 'credit-card-02',\n org_anonymous = 'glasses-01',\n org_bulk = 'credit-card-plus',\n org_flagged = 'flag-01',\n org_new = 'stars-02',\n org_suspended = 'slash-circle-01',\n org_verified = 'check-verified-02',\n overview = 'pie-chart-01',\n prometheus = 'prometheus',\n progress_spinner = 'refresh-cw-04',\n featured = 'star-01',\n quick_replies = 'dotpoints-01',\n recording = 'microphone-01',\n resend = 'refresh-cw-05',\n reset = 'flip-backward',\n resthooks = 'share-07',\n restore = 'play',\n results_export = 'download-cloud-01',\n retry = 'refresh-cw-05',\n revisions = 'clock-rewind',\n rocketchat = 'rocketchat',\n runs = 'rows-03',\n schedule = 'calendar',\n search = 'search-refraction',\n select_open = 'chevron-down',\n select_clear = 'x',\n send = 'send-03',\n service = 'magic-wand-01',\n service_end = 'log-out-04',\n settings = 'settings-02',\n shortcut = 'zap-fast',\n show = 'eye',\n simulator = 'phone-02',\n sort = 'chevron-selector-vertical',\n sort_down = 'sort-arrow-down',\n sort_up = 'sort-arrow-up',\n staff = 'hard-drive',\n submit = 'check',\n success = 'check',\n template_approved = 'check-circle',\n template_pending = 'hourglass-01',\n template_rejected = 'alert-circle',\n tickets = 'agent',\n tickets_all = 'archive',\n tickets_closed = 'check',\n tickets_mine = 'coffee',\n tickets_mine_done = 'coffee-empty',\n tickets_open = 'inbox-01',\n tickets_export = 'download-cloud-01',\n tickets_unassigned = 'inbox-01',\n topic = 'message-text-circle-02',\n two_factor_enabled = 'shield-02',\n two_factor_disabled = 'shield-01',\n trigger = 'signal-01',\n trigger_active = 'play',\n trigger_archived = 'archive',\n trigger_new = 'plus',\n trigger_keyword = 'message-check-square',\n trigger_catch_all = 'message-question-square',\n trigger_inbound_call = 'phone-incoming-01',\n trigger_missed_call = 'phone-hang-up',\n trigger_schedule = 'calendar',\n trigger_new_conversation = 'message-chat-square',\n trigger_referral = 'user-right-01',\n trigger_closed_ticket = 'agent',\n trigger_opt_in = 'message-check-circle',\n trigger_opt_out = 'message-x-circle',\n triggers = 'signal-01',\n updated = 'edit-02',\n up = 'chevron-up',\n upload = 'upload-cloud-01',\n upload_image = 'camera-01',\n usages = 'link-04',\n user = 'users-01',\n user_beta = 'shield-zap',\n user_token = 'key-01',\n users = 'users-01',\n video = 'video-recorder',\n webhook = 'link-external-01',\n workspace = 'folder',\n\n // channel types\n channel_a = 'channel-android',\n channel_ac = 'zap', // TODO https://www.arabiacell.com/\n channel_at = 'zap', // TODO https://africastalking.com/\n channel_bs = 'zap', // TODO https://burstsms.com/\n channel_bw = 'zap', // TODO https://www.bandwidth.com/\n channel_cs = 'zap', // TODO https://www.clicksend.com/\n channel_ct = 'channel-clickatell',\n channel_d3 = 'channel-whatsapp',\n channel_d3c = 'channel-whatsapp',\n channel_da = 'zap', // TODO https://dartmedia.co.id/\n channel_ds = 'channel-discord',\n channel_ex = 'zap',\n channel_fb = 'channel-facebook',\n channel_fba = 'channel-facebook',\n channel_fc = 'channel-freshchat',\n channel_fcm = 'channel-firebase',\n channel_hm = 'zap', // TODO https://hormuud.com/\n channel_ib = 'zap', // TODO https://www.infobip.com/\n channel_ig = 'channel-instagram',\n channel_jc = 'channel-jiochat',\n channel_kn = 'channel-kannel',\n channel_kwa = 'channel-whatsapp',\n channel_ln = 'channel-line',\n channel_mt = 'channel-mtarget',\n channel_mtn = 'zap', // TODO https://mtn.com/\n channel_nx = 'channel-vonage',\n channel_pl = 'channel-plivo',\n channel_rc = 'channel-rocketchat',\n channel_sl = 'channel-slack',\n channel_sq = 'zap', // TODO https://shaqodoon.org/\n channel_st = 'zap', // TODO https://bulk.startmobile.ua\n channel_sw = 'channel-signalwire',\n channel_t = 'channel-twilio',\n channel_tg = 'channel-telegram',\n channel_tms = 'channel-twilio',\n channel_tq = 'channel-thinq',\n channel_tw = 'zap', // TODO https://www.somleng.org/\n channel_twa = 'channel-whatsapp',\n channel_twc = 'zap', // TODO\n channel_twt = 'channel-twitter',\n channel_vk = 'channel-vk',\n channel_vp = 'channel-viber',\n channel_wa = 'channel-whatsapp',\n channel_wac = 'channel-whatsapp',\n channel_wc = 'channel-wechat',\n channel_yo = 'zap', // TODO https://www.yo.co.ug/\n channel_zvw = 'channel-whatsapp',\n\n // ai\n ai_openai = 'openai',\n ai_anthropic = 'anthropic',\n ai_google = 'gemini',\n ai_microsoft = 'azure',\n ai_deepseek = 'deepseek',\n\n // classifiers\n classifier_wit = 'classifier-wit',\n\n // other brands\n dtone = 'dtone',\n zapier = 'zapier',\n\n // demo\n default = 'list',\n datepicker = 'calendar',\n slider = 'sliders-02',\n select = 'browser',\n input = 'edit-05'\n}\n"]}
|
package/out-tsc/temba-modules.js
CHANGED
|
@@ -56,6 +56,7 @@ import { Chat } from './src/chat/Chat';
|
|
|
56
56
|
import { MediaPicker } from './src/mediapicker/MediaPicker';
|
|
57
57
|
import { Editor } from './src/flow/Editor';
|
|
58
58
|
import { EditorNode } from './src/flow/EditorNode';
|
|
59
|
+
import { StickyNote } from './src/flow/StickyNote';
|
|
59
60
|
import { ContactNotepad } from './src/contacts/ContactNotepad';
|
|
60
61
|
import { ProgressBar } from './src/progress/ProgressBar';
|
|
61
62
|
import { StartProgress } from './src/progress/StartProgress';
|
|
@@ -128,6 +129,7 @@ addCustomElement('temba-chat', Chat);
|
|
|
128
129
|
addCustomElement('temba-media-picker', MediaPicker);
|
|
129
130
|
addCustomElement('temba-flow-editor', Editor);
|
|
130
131
|
addCustomElement('temba-flow-node', EditorNode);
|
|
132
|
+
addCustomElement('temba-sticky-note', StickyNote);
|
|
131
133
|
addCustomElement('temba-contact-notepad', ContactNotepad);
|
|
132
134
|
addCustomElement('temba-progress', ProgressBar);
|
|
133
135
|
addCustomElement('temba-start-progress', StartProgress);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-modules.js","sourceRoot":"","sources":["../temba-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAA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AAsB,EAAE,aAAa,CAAC,CAAC;AACxD,gBAAgB,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;AAClD,gBAAgB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AACpD,gBAAgB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAClD,gBAAgB,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;AAC5D,gBAAgB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Checkbox } from './src/checkbox/Checkbox';\nimport { TextInput } from './src/textinput/TextInput';\nimport { Store } from './src/store/Store';\nimport { Select } from './src/select/Select';\nimport { Completion } from './src/completion/Completion';\nimport { Modax } from './src/dialog/Modax';\nimport { Dialog } from './src/dialog/Dialog';\nimport { Button } from './src/button/Button';\nimport { FormField } from './src/formfield/FormField';\nimport { Loading } from './src/loading/Loading';\nimport { CharCount } from './src/charcount/CharCount';\nimport { Options } from './src/options/Options';\nimport { ContactChat } from './src/contacts/ContactChat';\nimport { TicketList } from './src/list/TicketList';\nimport { ContactDetails } from './src/contacts/ContactDetails';\nimport { TembaList } from './src/list/TembaList';\nimport { ContactSearch } from './src/contactsearch/ContactSearch';\nimport { VectorIcon } from './src/vectoricon/VectorIcon';\nimport { Alert } from './src/alert/Alert';\nimport { Omnibox } from './src/omnibox/Omnibox';\nimport { Tip } from './src/tip/Tip';\nimport { TembaMenu } from './src/list/TembaMenu';\nimport { Anchor } from './src/anchor/Anchor';\nimport { Dropdown } from './src/dropdown/Dropdown';\nimport { TabPane } from './src/tabpane/TabPane';\nimport { Tab } from './src/tabpane/Tab';\nimport Label from './src/label/Label';\nimport { ContactName } from './src/contacts/ContactName';\nimport { ContactUrn } from './src/contacts/ContactUrn';\nimport { ContactFields } from './src/contacts/ContactFields';\nimport { ContactFieldEditor } from './src/contacts/ContactFieldEditor';\n\nimport { ContactBadges } from './src/contacts/ContactBadges';\nimport { ContactPending } from './src/contacts/ContactPending';\nimport { TembaSlider } from './src/slider/TembaSlider';\nimport { RunList } from './src/list/RunList';\nimport { FlowStoreElement } from './src/store/FlowStoreElement';\nimport { ContactNameFetch } from './src/contacts/ContactNameFetch';\nimport DatePicker from './src/datepicker/DatePicker';\nimport { FieldManager } from './src/fields/FieldManager';\nimport { SortableList } from './src/list/SortableList';\nimport { ContentMenu } from './src/list/ContentMenu';\nimport { TembaDate } from './src/date/TembaDate';\nimport { Compose } from './src/compose/Compose';\nimport { Lightbox } from './src/lightbox/Lightbox';\nimport { ColorPicker } from './src/colorpicker/ColorPicker';\nimport { Resizer } from './src/resizer/Resizer';\nimport { Thumbnail } from './src/thumbnail/Thumbnail';\nimport { NotificationList } from './src/list/NotificationList';\nimport { WebChat } from './src/webchat/WebChat';\nimport { ImagePicker } from './src/imagepicker/ImagePicker';\nimport { Mask } from './src/mask/Mask';\nimport { TembaUser } from './src/user/TembaUser';\nimport { TemplateEditor } from './src/templates/TemplateEditor';\nimport { Toast } from './src/toast/Toast';\nimport { Chat } from './src/chat/Chat';\nimport { MediaPicker } from './src/mediapicker/MediaPicker';\nimport { Editor } from './src/flow/Editor';\nimport { EditorNode } from './src/flow/EditorNode';\nimport { ContactNotepad } from './src/contacts/ContactNotepad';\nimport { ProgressBar } from './src/progress/ProgressBar';\nimport { StartProgress } from './src/progress/StartProgress';\nimport { ShortcutList } from './src/list/ShortcutList';\nimport { PopupSelect } from './src/select/PopupSelect';\nimport { UserSelect } from './src/select/UserSelect';\nimport { WorkspaceSelect } from './src/select/WorkspaceSelect';\nimport { TembaChart } from './src/chart/TembaChart';\n\nexport function addCustomElement(name: string, comp: any) {\n if (!window.customElements.get(name)) {\n window.customElements.define(name, comp);\n }\n}\n\naddCustomElement('temba-anchor', Anchor);\naddCustomElement('temba-alert', Alert);\naddCustomElement('temba-store', Store);\naddCustomElement('temba-textinput', TextInput);\naddCustomElement('temba-datepicker', DatePicker);\naddCustomElement('temba-date', TembaDate);\naddCustomElement('temba-completion', Completion);\naddCustomElement('temba-checkbox', Checkbox);\naddCustomElement('temba-select', Select);\naddCustomElement('temba-options', Options);\naddCustomElement('temba-loading', Loading);\naddCustomElement('temba-lightbox', Lightbox);\naddCustomElement('temba-button', Button);\naddCustomElement('temba-omnibox', Omnibox);\naddCustomElement('temba-tip', Tip);\naddCustomElement('temba-contact-name', ContactName);\naddCustomElement('temba-contact-name-fetch', ContactNameFetch);\naddCustomElement('temba-contact-field', ContactFieldEditor);\naddCustomElement('temba-contact-fields', ContactFields);\naddCustomElement('temba-field-manager', FieldManager);\naddCustomElement('temba-urn', ContactUrn);\naddCustomElement('temba-content-menu', ContentMenu);\n\naddCustomElement('temba-field', FormField);\naddCustomElement('temba-dialog', Dialog);\naddCustomElement('temba-modax', Modax);\naddCustomElement('temba-charcount', CharCount);\naddCustomElement('temba-contact-chat', ContactChat);\naddCustomElement('temba-contact-details', ContactDetails);\naddCustomElement('temba-ticket-list', TicketList);\naddCustomElement('temba-notification-list', NotificationList);\naddCustomElement('temba-list', TembaList);\naddCustomElement('temba-sortable-list', SortableList);\naddCustomElement('temba-run-list', RunList);\naddCustomElement('temba-flow-details', FlowStoreElement);\naddCustomElement('temba-label', Label);\naddCustomElement('temba-menu', TembaMenu);\naddCustomElement('temba-contact-search', ContactSearch);\naddCustomElement('temba-icon', VectorIcon);\naddCustomElement('temba-dropdown', Dropdown);\naddCustomElement('temba-tabs', TabPane);\naddCustomElement('temba-tab', Tab);\naddCustomElement('temba-contact-badges', ContactBadges);\naddCustomElement('temba-contact-pending', ContactPending);\naddCustomElement('temba-slider', TembaSlider);\naddCustomElement('temba-content-menu', ContentMenu);\naddCustomElement('temba-compose', Compose);\naddCustomElement('temba-color-picker', ColorPicker);\naddCustomElement('temba-resizer', Resizer);\naddCustomElement('temba-thumbnail', Thumbnail);\naddCustomElement('temba-webchat', WebChat);\naddCustomElement('temba-image-picker', ImagePicker);\naddCustomElement('temba-mask', Mask);\naddCustomElement('temba-user', TembaUser);\naddCustomElement('temba-template-editor', TemplateEditor);\naddCustomElement('temba-toast', Toast);\naddCustomElement('temba-chat', Chat);\naddCustomElement('temba-media-picker', MediaPicker);\naddCustomElement('temba-flow-editor', Editor);\naddCustomElement('temba-flow-node', EditorNode);\naddCustomElement('temba-contact-notepad', ContactNotepad);\naddCustomElement('temba-progress', ProgressBar);\naddCustomElement('temba-start-progress', StartProgress);\naddCustomElement('temba-shortcuts', ShortcutList);\naddCustomElement('temba-popup-select', PopupSelect);\naddCustomElement('temba-user-select', UserSelect);\naddCustomElement('temba-workspace-select', WorkspaceSelect);\naddCustomElement('temba-chart', TembaChart);\n"]}
|
|
1
|
+
{"version":3,"file":"temba-modules.js","sourceRoot":"","sources":["../temba-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM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iBAAiB,EAAE,YAAY,CAAC,CAAC;AAClD,gBAAgB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AACpD,gBAAgB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAClD,gBAAgB,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;AAC5D,gBAAgB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Checkbox } from './src/checkbox/Checkbox';\nimport { TextInput } from './src/textinput/TextInput';\nimport { Store } from './src/store/Store';\nimport { Select } from './src/select/Select';\nimport { Completion } from './src/completion/Completion';\nimport { Modax } from './src/dialog/Modax';\nimport { Dialog } from './src/dialog/Dialog';\nimport { Button } from './src/button/Button';\nimport { FormField } from './src/formfield/FormField';\nimport { Loading } from './src/loading/Loading';\nimport { CharCount } from './src/charcount/CharCount';\nimport { Options } from './src/options/Options';\nimport { ContactChat } from './src/contacts/ContactChat';\nimport { TicketList } from './src/list/TicketList';\nimport { ContactDetails } from './src/contacts/ContactDetails';\nimport { TembaList } from './src/list/TembaList';\nimport { ContactSearch } from './src/contactsearch/ContactSearch';\nimport { VectorIcon } from './src/vectoricon/VectorIcon';\nimport { Alert } from './src/alert/Alert';\nimport { Omnibox } from './src/omnibox/Omnibox';\nimport { Tip } from './src/tip/Tip';\nimport { TembaMenu } from './src/list/TembaMenu';\nimport { Anchor } from './src/anchor/Anchor';\nimport { Dropdown } from './src/dropdown/Dropdown';\nimport { TabPane } from './src/tabpane/TabPane';\nimport { Tab } from './src/tabpane/Tab';\nimport Label from './src/label/Label';\nimport { ContactName } from './src/contacts/ContactName';\nimport { ContactUrn } from './src/contacts/ContactUrn';\nimport { ContactFields } from './src/contacts/ContactFields';\nimport { ContactFieldEditor } from './src/contacts/ContactFieldEditor';\n\nimport { ContactBadges } from './src/contacts/ContactBadges';\nimport { ContactPending } from './src/contacts/ContactPending';\nimport { TembaSlider } from './src/slider/TembaSlider';\nimport { RunList } from './src/list/RunList';\nimport { FlowStoreElement } from './src/store/FlowStoreElement';\nimport { ContactNameFetch } from './src/contacts/ContactNameFetch';\nimport DatePicker from './src/datepicker/DatePicker';\nimport { FieldManager } from './src/fields/FieldManager';\nimport { SortableList } from './src/list/SortableList';\nimport { ContentMenu } from './src/list/ContentMenu';\nimport { TembaDate } from './src/date/TembaDate';\nimport { Compose } from './src/compose/Compose';\nimport { Lightbox } from './src/lightbox/Lightbox';\nimport { ColorPicker } from './src/colorpicker/ColorPicker';\nimport { Resizer } from './src/resizer/Resizer';\nimport { Thumbnail } from './src/thumbnail/Thumbnail';\nimport { NotificationList } from './src/list/NotificationList';\nimport { WebChat } from './src/webchat/WebChat';\nimport { ImagePicker } from './src/imagepicker/ImagePicker';\nimport { Mask } from './src/mask/Mask';\nimport { TembaUser } from './src/user/TembaUser';\nimport { TemplateEditor } from './src/templates/TemplateEditor';\nimport { Toast } from './src/toast/Toast';\nimport { Chat } from './src/chat/Chat';\nimport { MediaPicker } from './src/mediapicker/MediaPicker';\nimport { Editor } from './src/flow/Editor';\nimport { EditorNode } from './src/flow/EditorNode';\nimport { StickyNote } from './src/flow/StickyNote';\nimport { ContactNotepad } from './src/contacts/ContactNotepad';\nimport { ProgressBar } from './src/progress/ProgressBar';\nimport { StartProgress } from './src/progress/StartProgress';\nimport { ShortcutList } from './src/list/ShortcutList';\nimport { PopupSelect } from './src/select/PopupSelect';\nimport { UserSelect } from './src/select/UserSelect';\nimport { WorkspaceSelect } from './src/select/WorkspaceSelect';\nimport { TembaChart } from './src/chart/TembaChart';\n\nexport function addCustomElement(name: string, comp: any) {\n if (!window.customElements.get(name)) {\n window.customElements.define(name, comp);\n }\n}\n\naddCustomElement('temba-anchor', Anchor);\naddCustomElement('temba-alert', Alert);\naddCustomElement('temba-store', Store);\naddCustomElement('temba-textinput', TextInput);\naddCustomElement('temba-datepicker', DatePicker);\naddCustomElement('temba-date', TembaDate);\naddCustomElement('temba-completion', Completion);\naddCustomElement('temba-checkbox', Checkbox);\naddCustomElement('temba-select', Select);\naddCustomElement('temba-options', Options);\naddCustomElement('temba-loading', Loading);\naddCustomElement('temba-lightbox', Lightbox);\naddCustomElement('temba-button', Button);\naddCustomElement('temba-omnibox', Omnibox);\naddCustomElement('temba-tip', Tip);\naddCustomElement('temba-contact-name', ContactName);\naddCustomElement('temba-contact-name-fetch', ContactNameFetch);\naddCustomElement('temba-contact-field', ContactFieldEditor);\naddCustomElement('temba-contact-fields', ContactFields);\naddCustomElement('temba-field-manager', FieldManager);\naddCustomElement('temba-urn', ContactUrn);\naddCustomElement('temba-content-menu', ContentMenu);\n\naddCustomElement('temba-field', FormField);\naddCustomElement('temba-dialog', Dialog);\naddCustomElement('temba-modax', Modax);\naddCustomElement('temba-charcount', CharCount);\naddCustomElement('temba-contact-chat', ContactChat);\naddCustomElement('temba-contact-details', ContactDetails);\naddCustomElement('temba-ticket-list', TicketList);\naddCustomElement('temba-notification-list', NotificationList);\naddCustomElement('temba-list', TembaList);\naddCustomElement('temba-sortable-list', SortableList);\naddCustomElement('temba-run-list', RunList);\naddCustomElement('temba-flow-details', FlowStoreElement);\naddCustomElement('temba-label', Label);\naddCustomElement('temba-menu', TembaMenu);\naddCustomElement('temba-contact-search', ContactSearch);\naddCustomElement('temba-icon', VectorIcon);\naddCustomElement('temba-dropdown', Dropdown);\naddCustomElement('temba-tabs', TabPane);\naddCustomElement('temba-tab', Tab);\naddCustomElement('temba-contact-badges', ContactBadges);\naddCustomElement('temba-contact-pending', ContactPending);\naddCustomElement('temba-slider', TembaSlider);\naddCustomElement('temba-content-menu', ContentMenu);\naddCustomElement('temba-compose', Compose);\naddCustomElement('temba-color-picker', ColorPicker);\naddCustomElement('temba-resizer', Resizer);\naddCustomElement('temba-thumbnail', Thumbnail);\naddCustomElement('temba-webchat', WebChat);\naddCustomElement('temba-image-picker', ImagePicker);\naddCustomElement('temba-mask', Mask);\naddCustomElement('temba-user', TembaUser);\naddCustomElement('temba-template-editor', TemplateEditor);\naddCustomElement('temba-toast', Toast);\naddCustomElement('temba-chat', Chat);\naddCustomElement('temba-media-picker', MediaPicker);\naddCustomElement('temba-flow-editor', Editor);\naddCustomElement('temba-flow-node', EditorNode);\naddCustomElement('temba-sticky-note', StickyNote);\naddCustomElement('temba-contact-notepad', ContactNotepad);\naddCustomElement('temba-progress', ProgressBar);\naddCustomElement('temba-start-progress', StartProgress);\naddCustomElement('temba-shortcuts', ShortcutList);\naddCustomElement('temba-popup-select', PopupSelect);\naddCustomElement('temba-user-select', UserSelect);\naddCustomElement('temba-workspace-select', WorkspaceSelect);\naddCustomElement('temba-chart', TembaChart);\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import '../temba-modules';
|
|
1
2
|
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
3
|
import { EditorNode } from '../src/flow/EditorNode';
|
|
3
4
|
import { stub, restore } from 'sinon';
|
|
4
|
-
|
|
5
|
-
customElements.define('temba-editor-node', EditorNode);
|
|
5
|
+
import { CustomEventType } from '../src/interfaces';
|
|
6
6
|
describe('EditorNode', () => {
|
|
7
7
|
let editorNode;
|
|
8
8
|
let mockPlumber;
|
|
@@ -39,7 +39,7 @@ describe('EditorNode', () => {
|
|
|
39
39
|
text: 'Test message',
|
|
40
40
|
quick_replies: []
|
|
41
41
|
};
|
|
42
|
-
const result = editorNode.renderAction(mockNode, action);
|
|
42
|
+
const result = editorNode.renderAction(mockNode, action, 0);
|
|
43
43
|
expect(result).to.exist;
|
|
44
44
|
});
|
|
45
45
|
it('renders action with unknown config', () => {
|
|
@@ -52,7 +52,7 @@ describe('EditorNode', () => {
|
|
|
52
52
|
type: 'unknown_action',
|
|
53
53
|
uuid: 'action-1'
|
|
54
54
|
};
|
|
55
|
-
const result = editorNode.renderAction(mockNode, action);
|
|
55
|
+
const result = editorNode.renderAction(mockNode, action, 1);
|
|
56
56
|
expect(result).to.exist;
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -258,7 +258,7 @@ describe('EditorNode', () => {
|
|
|
258
258
|
// Test individual render methods work
|
|
259
259
|
editorNode = new EditorNode();
|
|
260
260
|
// Test renderAction
|
|
261
|
-
const actionResult = editorNode.renderAction(mockNode, mockNode.actions[0]);
|
|
261
|
+
const actionResult = editorNode.renderAction(mockNode, mockNode.actions[0], 0);
|
|
262
262
|
expect(actionResult).to.exist;
|
|
263
263
|
// Test renderExit
|
|
264
264
|
const exitResult = editorNode.renderExit(mockNode.exits[0]);
|
|
@@ -269,5 +269,249 @@ describe('EditorNode', () => {
|
|
|
269
269
|
expect(mockNode.exits).to.have.length(1);
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
|
+
describe('drag and drop functionality', () => {
|
|
273
|
+
let editorNode;
|
|
274
|
+
beforeEach(() => {
|
|
275
|
+
editorNode = new EditorNode();
|
|
276
|
+
});
|
|
277
|
+
it('renders actions with sortable class and proper IDs', async () => {
|
|
278
|
+
const mockNode = {
|
|
279
|
+
uuid: 'sortable-test-node',
|
|
280
|
+
actions: [
|
|
281
|
+
{
|
|
282
|
+
type: 'send_msg',
|
|
283
|
+
uuid: 'action-1',
|
|
284
|
+
text: 'Hello',
|
|
285
|
+
quick_replies: []
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
type: 'send_msg',
|
|
289
|
+
uuid: 'action-2',
|
|
290
|
+
text: 'World',
|
|
291
|
+
quick_replies: []
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
exits: []
|
|
295
|
+
};
|
|
296
|
+
// Test that renderAction includes sortable class and proper ID
|
|
297
|
+
const result1 = editorNode.renderAction(mockNode, mockNode.actions[0], 0);
|
|
298
|
+
const result2 = editorNode.renderAction(mockNode, mockNode.actions[1], 1);
|
|
299
|
+
expect(result1).to.exist;
|
|
300
|
+
expect(result2).to.exist;
|
|
301
|
+
// Render the template to check the actual DOM
|
|
302
|
+
const container1 = await fixture(html `<div>${result1}</div>`);
|
|
303
|
+
const container2 = await fixture(html `<div>${result2}</div>`);
|
|
304
|
+
const actionElement1 = container1.querySelector('.action');
|
|
305
|
+
const actionElement2 = container2.querySelector('.action');
|
|
306
|
+
expect(actionElement1).to.exist;
|
|
307
|
+
expect(actionElement1 === null || actionElement1 === void 0 ? void 0 : actionElement1.classList.contains('sortable')).to.be.true;
|
|
308
|
+
expect(actionElement1 === null || actionElement1 === void 0 ? void 0 : actionElement1.id).to.equal('action-0');
|
|
309
|
+
expect(actionElement2).to.exist;
|
|
310
|
+
expect(actionElement2 === null || actionElement2 === void 0 ? void 0 : actionElement2.classList.contains('sortable')).to.be.true;
|
|
311
|
+
expect(actionElement2 === null || actionElement2 === void 0 ? void 0 : actionElement2.id).to.equal('action-1');
|
|
312
|
+
});
|
|
313
|
+
it('includes drag handle in rendered actions', async () => {
|
|
314
|
+
const mockNode = {
|
|
315
|
+
uuid: 'drag-handle-test',
|
|
316
|
+
actions: [
|
|
317
|
+
{
|
|
318
|
+
type: 'send_msg',
|
|
319
|
+
uuid: 'action-1',
|
|
320
|
+
text: 'Hello',
|
|
321
|
+
quick_replies: []
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
exits: []
|
|
325
|
+
};
|
|
326
|
+
let editorNode = await fixture(html `<temba-flow-node
|
|
327
|
+
.node=${mockNode}
|
|
328
|
+
.ui=${{ position: { left: 0, top: 0 } }}
|
|
329
|
+
></temba-flow-node>`);
|
|
330
|
+
// No drag handle should be present if only one action
|
|
331
|
+
let dragHandle = editorNode.querySelector('.drag-handle');
|
|
332
|
+
expect(dragHandle).to.not.exist;
|
|
333
|
+
// Now add a second action to verify drag handle appears
|
|
334
|
+
mockNode.actions.push({
|
|
335
|
+
type: 'send_msg',
|
|
336
|
+
uuid: 'action-2',
|
|
337
|
+
text: 'World',
|
|
338
|
+
quick_replies: []
|
|
339
|
+
});
|
|
340
|
+
editorNode = await fixture(html `<temba-flow-node
|
|
341
|
+
.node=${mockNode}
|
|
342
|
+
.ui=${{ position: { left: 0, top: 0 } }}
|
|
343
|
+
></temba-flow-node>`);
|
|
344
|
+
dragHandle = editorNode.querySelector('.drag-handle');
|
|
345
|
+
expect(dragHandle).to.exist;
|
|
346
|
+
});
|
|
347
|
+
it('renders SortableList when actions are present', async () => {
|
|
348
|
+
const mockNode = {
|
|
349
|
+
uuid: 'sortable-list-test',
|
|
350
|
+
actions: [
|
|
351
|
+
{
|
|
352
|
+
type: 'send_msg',
|
|
353
|
+
uuid: 'action-1',
|
|
354
|
+
text: 'Hello',
|
|
355
|
+
quick_replies: []
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: 'send_msg',
|
|
359
|
+
uuid: 'action-2',
|
|
360
|
+
text: 'World',
|
|
361
|
+
quick_replies: []
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
exits: []
|
|
365
|
+
};
|
|
366
|
+
const mockUI = {
|
|
367
|
+
position: { left: 100, top: 200 },
|
|
368
|
+
type: 'execute_actions'
|
|
369
|
+
};
|
|
370
|
+
// Set properties on the component
|
|
371
|
+
editorNode.node = mockNode;
|
|
372
|
+
editorNode.ui = mockUI;
|
|
373
|
+
const renderResult = editorNode.render();
|
|
374
|
+
// Render the template to check the actual DOM
|
|
375
|
+
const container = await fixture(html `<div>${renderResult}</div>`);
|
|
376
|
+
const sortableList = container.querySelector('temba-sortable-list');
|
|
377
|
+
expect(sortableList).to.exist;
|
|
378
|
+
});
|
|
379
|
+
it('does not render SortableList when no actions', async () => {
|
|
380
|
+
const mockNode = {
|
|
381
|
+
uuid: 'no-actions-test',
|
|
382
|
+
actions: [],
|
|
383
|
+
exits: [{ uuid: 'exit-1' }]
|
|
384
|
+
};
|
|
385
|
+
const mockUI = {
|
|
386
|
+
position: { left: 100, top: 200 },
|
|
387
|
+
type: 'execute_actions'
|
|
388
|
+
};
|
|
389
|
+
// Set properties on the component
|
|
390
|
+
editorNode.node = mockNode;
|
|
391
|
+
editorNode.ui = mockUI;
|
|
392
|
+
const renderResult = editorNode.render();
|
|
393
|
+
// Check that template does not include temba-sortable-list
|
|
394
|
+
expect(renderResult.strings.join('')).to.not.contain('temba-sortable-list');
|
|
395
|
+
});
|
|
396
|
+
it('handles order changed events correctly', async () => {
|
|
397
|
+
const mockNode = {
|
|
398
|
+
uuid: 'order-test',
|
|
399
|
+
actions: [
|
|
400
|
+
{
|
|
401
|
+
type: 'send_msg',
|
|
402
|
+
uuid: 'action-1',
|
|
403
|
+
text: 'First',
|
|
404
|
+
quick_replies: []
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
type: 'send_msg',
|
|
408
|
+
uuid: 'action-2',
|
|
409
|
+
text: 'Second',
|
|
410
|
+
quick_replies: []
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
type: 'send_msg',
|
|
414
|
+
uuid: 'action-3',
|
|
415
|
+
text: 'Third',
|
|
416
|
+
quick_replies: []
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
exits: []
|
|
420
|
+
};
|
|
421
|
+
editorNode.node = mockNode;
|
|
422
|
+
// Create a mock order changed event (swap first and last actions)
|
|
423
|
+
const orderChangedEvent = new CustomEvent(CustomEventType.OrderChanged, {
|
|
424
|
+
detail: { swap: [0, 2] }
|
|
425
|
+
});
|
|
426
|
+
// Call the handler directly
|
|
427
|
+
editorNode.handleActionOrderChanged(orderChangedEvent);
|
|
428
|
+
// Verify the actions were reordered correctly
|
|
429
|
+
expect(editorNode.node.actions).to.have.length(3);
|
|
430
|
+
expect(editorNode.node.actions[0].text).to.equal('Second');
|
|
431
|
+
expect(editorNode.node.actions[1].text).to.equal('Third');
|
|
432
|
+
expect(editorNode.node.actions[2].text).to.equal('First');
|
|
433
|
+
});
|
|
434
|
+
it('preserves action data during reordering', () => {
|
|
435
|
+
const mockNode = {
|
|
436
|
+
uuid: 'preserve-test',
|
|
437
|
+
actions: [
|
|
438
|
+
{
|
|
439
|
+
type: 'send_msg',
|
|
440
|
+
uuid: 'action-1',
|
|
441
|
+
text: 'Message 1',
|
|
442
|
+
quick_replies: ['Yes', 'No']
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
type: 'send_msg',
|
|
446
|
+
uuid: 'action-2',
|
|
447
|
+
text: 'Message 2',
|
|
448
|
+
quick_replies: []
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
exits: []
|
|
452
|
+
};
|
|
453
|
+
editorNode.node = mockNode;
|
|
454
|
+
// Swap the two actions
|
|
455
|
+
const orderChangedEvent = new CustomEvent(CustomEventType.OrderChanged, {
|
|
456
|
+
detail: { swap: [0, 1] }
|
|
457
|
+
});
|
|
458
|
+
editorNode.handleActionOrderChanged(orderChangedEvent);
|
|
459
|
+
// Verify all action data is preserved
|
|
460
|
+
expect(editorNode.node.actions).to.have.length(2);
|
|
461
|
+
expect(editorNode.node.actions[0].text).to.equal('Message 2');
|
|
462
|
+
expect(editorNode.node.actions[0].quick_replies).to.deep.equal([]);
|
|
463
|
+
expect(editorNode.node.actions[1].text).to.equal('Message 1');
|
|
464
|
+
expect(editorNode.node.actions[1].quick_replies).to.deep.equal(['Yes', 'No']);
|
|
465
|
+
});
|
|
466
|
+
it('integrates with SortableList for full drag functionality', async () => {
|
|
467
|
+
const mockNode = {
|
|
468
|
+
uuid: 'integration-drag-test',
|
|
469
|
+
actions: [
|
|
470
|
+
{
|
|
471
|
+
type: 'send_msg',
|
|
472
|
+
uuid: 'action-1',
|
|
473
|
+
text: 'First Action',
|
|
474
|
+
quick_replies: []
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
type: 'send_msg',
|
|
478
|
+
uuid: 'action-2',
|
|
479
|
+
text: 'Second Action',
|
|
480
|
+
quick_replies: []
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
type: 'send_msg',
|
|
484
|
+
uuid: 'action-3',
|
|
485
|
+
text: 'Third Action',
|
|
486
|
+
quick_replies: []
|
|
487
|
+
}
|
|
488
|
+
],
|
|
489
|
+
exits: []
|
|
490
|
+
};
|
|
491
|
+
const mockUI = {
|
|
492
|
+
position: { left: 100, top: 200 },
|
|
493
|
+
type: 'execute_actions'
|
|
494
|
+
};
|
|
495
|
+
// Set properties on the component
|
|
496
|
+
editorNode.node = mockNode;
|
|
497
|
+
editorNode.ui = mockUI;
|
|
498
|
+
// Render the full component
|
|
499
|
+
const renderResult = editorNode.render();
|
|
500
|
+
const container = await fixture(html `<div>${renderResult}</div>`);
|
|
501
|
+
// Find the sortable list
|
|
502
|
+
const sortableList = container.querySelector('temba-sortable-list');
|
|
503
|
+
expect(sortableList).to.exist;
|
|
504
|
+
// Verify all actions are rendered as sortable items
|
|
505
|
+
const sortableItems = container.querySelectorAll('.sortable');
|
|
506
|
+
expect(sortableItems).to.have.length(3);
|
|
507
|
+
// Verify each action has correct ID and structure
|
|
508
|
+
expect(sortableItems[0].id).to.equal('action-0');
|
|
509
|
+
expect(sortableItems[1].id).to.equal('action-1');
|
|
510
|
+
expect(sortableItems[2].id).to.equal('action-2');
|
|
511
|
+
// Verify drag handles are present
|
|
512
|
+
const dragHandles = container.querySelectorAll('.drag-handle');
|
|
513
|
+
expect(dragHandles).to.have.length(3);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
272
516
|
});
|
|
273
517
|
//# sourceMappingURL=temba-flow-editor-node.test.js.map
|