@mixd-id/web-scaffold 0.2.240702 → 0.2.240704

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.
Files changed (95) hide show
  1. package/docs/schema/user-action.json +266 -0
  2. package/package.json +6 -2
  3. package/public/assets/dashboard/bar.png +0 -0
  4. package/public/assets/dashboard/doughnut.png +0 -0
  5. package/public/assets/dashboard/metric.png +0 -0
  6. package/public/assets/dashboard/pie.png +0 -0
  7. package/public/assets/dashboard/polar-area.png +0 -0
  8. package/public/assets/dashboard/virtual-table.png +0 -0
  9. package/public/static/dashboard/bar.png +0 -0
  10. package/public/static/dashboard/doughnut.png +0 -0
  11. package/public/static/dashboard/metric.png +0 -0
  12. package/public/static/dashboard/pie.png +0 -0
  13. package/public/static/dashboard/polar-area.png +0 -0
  14. package/public/static/dashboard/virtual-table.png +0 -0
  15. package/src/components/Button.vue +179 -160
  16. package/src/components/Checkbox.vue +0 -1
  17. package/src/components/Datepicker.vue +8 -6
  18. package/src/components/GHeatMaps.vue +317 -0
  19. package/src/components/GmapsDirection.vue +191 -0
  20. package/src/components/Grid.vue +2 -0
  21. package/src/components/HTMLEditor.vue +2 -2
  22. package/src/components/List.vue +384 -308
  23. package/src/components/Modal.vue +2 -3
  24. package/src/components/PresetSelectorFilterItem.vue +15 -2
  25. package/src/components/Switch.vue +3 -0
  26. package/src/components/Tabs.vue +1 -1
  27. package/src/components/TextWithTag.vue +67 -25
  28. package/src/components/Textbox.vue +5 -0
  29. package/src/components/VirtualGrid.vue +224 -228
  30. package/src/components/VirtualTable.vue +46 -28
  31. package/src/configs/dashboard/bar.js +10 -0
  32. package/src/configs/dashboard/collection-1.js +5 -0
  33. package/src/configs/dashboard/doughnut.js +7 -0
  34. package/src/configs/dashboard/gheatmaps.js +9 -0
  35. package/src/configs/dashboard/grid-2.js +34 -0
  36. package/src/configs/dashboard/grid-3.js +34 -0
  37. package/src/configs/dashboard/grid-4.js +34 -0
  38. package/src/configs/dashboard/grid.js +15 -0
  39. package/src/configs/dashboard/metric.js +10 -0
  40. package/src/configs/dashboard/pie.js +7 -0
  41. package/src/configs/dashboard/polar-area.js +7 -0
  42. package/src/configs/dashboard/virtual-table.js +9 -0
  43. package/src/defs/dashboard-preset.js +22 -0
  44. package/src/index.js +37 -23
  45. package/src/mixin/ready-state.js +37 -0
  46. package/src/stores/datasource.js +11 -0
  47. package/src/themes/default/index.js +1 -1
  48. package/src/utils/dashboard.js +1080 -0
  49. package/src/utils/event-bus.js +8 -0
  50. package/src/utils/helpers.js +56 -8
  51. package/src/utils/helpers.mjs +35 -1
  52. package/src/utils/preset-selector.js +5 -2
  53. package/src/utils/preset-selector.mjs +23 -13
  54. package/src/widgets/BotEditor/BotEditorActions.vue +162 -0
  55. package/src/widgets/BotEditor.vue +228 -0
  56. package/src/widgets/Dashboard/BarChart.vue +330 -0
  57. package/src/widgets/Dashboard/BarChartSetting.vue +317 -0
  58. package/src/widgets/Dashboard/DatasourceFilterSharing.vue +93 -0
  59. package/src/widgets/Dashboard/DatasourcePreview.vue +93 -0
  60. package/src/widgets/Dashboard/DatasourceSelector.vue +122 -0
  61. package/src/widgets/Dashboard/Doughnut.vue +157 -0
  62. package/src/widgets/Dashboard/DoughnutSetting.vue +196 -0
  63. package/src/widgets/Dashboard/GHeatMapsSetting.vue +108 -0
  64. package/src/widgets/Dashboard/InteractionEdit.vue +228 -0
  65. package/src/widgets/Dashboard/Metric.vue +76 -0
  66. package/src/widgets/Dashboard/MetricSetting.vue +174 -0
  67. package/src/widgets/Dashboard/Pie.vue +139 -0
  68. package/src/widgets/Dashboard/PieSetting.vue +247 -0
  69. package/src/widgets/Dashboard/PolarArea.vue +159 -0
  70. package/src/widgets/Dashboard/PolarAreaSetting.vue +195 -0
  71. package/src/widgets/Dashboard/SharingModal.vue +116 -0
  72. package/src/widgets/Dashboard/ViewSelector.vue +183 -0
  73. package/src/widgets/Dashboard/VirtualColumnEdit.vue +97 -0
  74. package/src/widgets/Dashboard/VirtualTableSetting.vue +234 -0
  75. package/src/widgets/Dashboard.vue +1773 -0
  76. package/src/widgets/PresetBar.vue +136 -175
  77. package/src/widgets/PresetBarPivot.vue +186 -0
  78. package/src/widgets/PresetSelector.vue +2 -2
  79. package/src/widgets/UserActionBuilder/UserActionCondition.vue +99 -0
  80. package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
  81. package/src/widgets/UserActionBuilder/UserActionItem.vue +166 -58
  82. package/src/widgets/UserActionBuilder/UserActionOutput.vue +35 -9
  83. package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
  84. package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
  85. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +135 -0
  86. package/src/widgets/UserActionBuilder/UserActionProps.vue +213 -0
  87. package/src/widgets/UserActionBuilder.vue +68 -199
  88. package/src/widgets/WebPageBuilder4/GridSetting.vue +123 -73
  89. package/src/widgets/WebPageBuilder4/HeightSetting.vue +14 -11
  90. package/src/widgets/WebPageBuilder4/MarginSetting.vue +4 -1
  91. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +12 -4
  92. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +4 -0
  93. package/src/widgets/WebPageBuilder4/TreeView.vue +6 -3
  94. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +32 -58
  95. package/tailwind.config.js +2 -2
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div class="p-6 pt-0 flex flex-col gap-5">
3
+
4
+ <div class="flex flex-col gap-4">
5
+ <div>
6
+ <div class="flex flex-row">
7
+ <Checkbox v-model="output.params.useTemplate">
8
+ Use Template
9
+ </Checkbox>
10
+ </div>
11
+ <Dropdown v-model="output.params.templateName" class="mt-2">
12
+ <option v-for="template in whatsappTemplates" :value="template.name">{{ template.name }}</option>
13
+ </Dropdown>
14
+ </div>
15
+
16
+ <div v-if="!output.params.useTemplate" class="flex flex-col gap-4">
17
+
18
+ <div>
19
+ <label class="text-text-400">Image</label>
20
+ <Image :src="output.params.imageUrl"
21
+ :editable="true"
22
+ @change="(base64, file) => output.params.imageUrl = file"
23
+ ref="image"
24
+ class="w-full min-h-[100px] border-[1px] border-text-200 bg-base-500 rounded-lg flex">
25
+ <template #empty>
26
+ <div class="flex-1 flex items-center justify-center">
27
+ <button type="button" @click="$refs.image.edit()">
28
+ <svg width="24" height="24" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M630.8 469.1l-55.95-43.85C575.3 422.2 575.1 419.2 575.1 416l.0034-320c0-35.35-28.65-64-64-64H127.1C113.6 32 100.4 36.98 89.78 45.06L38.81 5.113C28.34-3.058 13.31-1.246 5.109 9.192C-3.063 19.63-1.235 34.72 9.187 42.89L601.2 506.9C605.6 510.3 610.8 512 615.1 512c7.125 0 14.17-3.156 18.91-9.188C643.1 492.4 641.2 477.3 630.8 469.1zM223.1 149.6l-64.29-50.39C164.2 97.15 169.9 96 175.1 96c26.51 0 48 21.49 48 48C223.1 145.9 223.4 147.7 223.1 149.6zM331.2 234.3l23.45-35.18C357.7 194.7 362.7 192 368 192s10.35 2.672 13.31 7.125l103.9 155.9L331.2 234.3zM145.1 416c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C206.1 290.4 210.9 288 216 288s9.916 2.441 12.93 6.574l32.46 44.51l16.43-24.65L63.99 146.8L63.99 416c0 35.35 28.65 64 64 64h361.1l-81.66-64H145.1z"/></svg>
29
+ </button>
30
+ </div>
31
+ </template>
32
+ </Image>
33
+ </div>
34
+
35
+ <div>
36
+ <label class="text-text-400">Text</label>
37
+ <TextWithTag rows="5" v-model="output.params.text" :items="replyTextItems" />
38
+ </div>
39
+
40
+ <div>
41
+ <label class="text-text-400">Footer</label>
42
+ <Textbox v-model="output.params.footer" maxlength="50" />
43
+ </div>
44
+
45
+ <div>
46
+ <div class="flex flex-row gap-2 items-center">
47
+ <label class="flex-1 text-text-400">Buttons</label>
48
+ <button type="button" class="text-primary" @click="$array(output.params, 'buttons').push({})">
49
+ {{ $t('Add Button') }}
50
+ </button>
51
+ </div>
52
+ <ListItem :items="output.params.buttons"
53
+ @reorder="(from, to) => { output.params.buttons.splice(to, 0, output.params.buttons.splice(from, 1)[0]); }">
54
+ <template v-slot="{ item, index }">
55
+ <div class="flex flex-row items-center gap-3">
56
+ <div data-reorder>
57
+ <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
58
+ </div>
59
+ <div class="flex-1 flex flex-row gap-2 items-center">
60
+ <Textbox class="w-[100px]" placeholder="Text" v-model="item.text" />
61
+ </div>
62
+ <div>
63
+ <button type="button" @click="output.params.buttons.splice(index, 1)">
64
+ <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
65
+ </button>
66
+ </div>
67
+ </div>
68
+ </template>
69
+ </ListItem>
70
+ </div>
71
+
72
+ </div>
73
+ </div>
74
+
75
+ </div>
76
+ </template>
77
+
78
+ <script>
79
+
80
+ export default{
81
+
82
+ computed: {
83
+
84
+ replyTextItems(){
85
+ return [
86
+ { text:"Mobile Number", value:"{mobileNumber}" },
87
+ { text:"Name", value:"{name}" },
88
+ { text:"Created At", value:"{createdAt}" },
89
+ ]
90
+ },
91
+
92
+ tabItems(){
93
+ return [
94
+ { text:"Text", value:1 },
95
+ this.getWhatsappTemplateSrc() ? { text:"Template", value:2 } : null,
96
+ ]
97
+ .filter(_ => _)
98
+ }
99
+
100
+ },
101
+
102
+ data(){
103
+ return {
104
+ whatsappTemplates: null
105
+ }
106
+ },
107
+
108
+ inject: [ 'getWhatsappTemplateSrc', 'socket' ],
109
+
110
+ methods: {
111
+
112
+ loadWhatsappTemplate(){
113
+ const src = this.getWhatsappTemplateSrc()
114
+
115
+ if(src){
116
+ this.socket.send(src, {})
117
+ .then(templates => this.whatsappTemplates = templates)
118
+ }
119
+ }
120
+
121
+ },
122
+
123
+ mounted() {
124
+ this.loadWhatsappTemplate()
125
+ },
126
+
127
+ props: {
128
+
129
+ output: Object
130
+
131
+ }
132
+
133
+ }
134
+
135
+ </script>
@@ -0,0 +1,213 @@
1
+ <template>
2
+ <div v-if="instance" class="p-6 flex flex-col gap-6" @dblclick="log(instance)">
3
+
4
+ <div class="flex flex-row gap-5">
5
+ <div class="flex-1">
6
+ <label>Name</label>
7
+ <Textbox v-model="instance.name" class="mt-2"/>
8
+ </div>
9
+ <div v-if="instance.parentId > 0">
10
+ <label>Enabled</label>
11
+ <Switch v-model="instance.enabled" class="mt-2"/>
12
+ </div>
13
+ </div>
14
+
15
+ <div>
16
+ <label>Type</label>
17
+ <div class="flex flex-row gap-3 mt-2">
18
+ <Dropdown v-model.number="instance.type" class="w-full">
19
+ <option :value="1">Event</option>
20
+ <option :value="2">Time Based</option>
21
+ <option :value="3">Fallback</option>
22
+ </Dropdown>
23
+ </div>
24
+ </div>
25
+
26
+ <div v-if="instance.type === 1">
27
+ <label>Event</label>
28
+ <div class="flex flex-row gap-3 mt-2">
29
+ <Dropdown v-model.number="instance.key" class="w-full">
30
+ <option value="onNewMessage">On New Message</option>
31
+ </Dropdown>
32
+ </div>
33
+ </div>
34
+
35
+ <div v-if="instance.type === 1" class="flex flex-col gap-6">
36
+
37
+ <div>
38
+ <div class="flex flex-row items-center gap-2">
39
+ <label class="flex-1">Condition</label>
40
+ <button type="button" class="text-primary"
41
+ @click="$refs.userActionCondition.open({}, addCondition)">
42
+ Add Condition
43
+ </button>
44
+ </div>
45
+ <ListItem :items="instance.conditions"
46
+ class="mt-2 bg-transparent border-[1px] border-text-200 rounded-xl overflow-hidden"
47
+ container-class="flex flex-col gap-2"
48
+ @reorder="(from, to) => { instance.conditions.splice(to, 0, instance.conditions.splice(from, 1)[0]); }">
49
+ <template v-slot="{ item, index }">
50
+ <div class="flex flex-row items-center gap-2 px-3 bg-base-500 p-2">
51
+ <div data-reorder>
52
+ <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
53
+ </div>
54
+
55
+ <div class="flex-1 flex flex-row gap-2" @click="$refs.userActionCondition.open(item, _ => Object.assign(item, _))">
56
+ <label>{{ item.key }}</label>
57
+ <p class="text-text-400 flex-1 text-ellipsis whitespace-nowrap overflow-hidden">{{ item.op }}</p>
58
+ <p class="text-text-400 flex-1 text-ellipsis whitespace-nowrap overflow-hidden">{{ item.value }}</p>
59
+ </div>
60
+
61
+ <div>
62
+ <button type="button" @click="instance.conditions.splice(index, 1)">
63
+ <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
64
+ </button>
65
+ </div>
66
+ </div>
67
+ </template>
68
+
69
+ <template #empty>
70
+ <div class="flex justify-center p-2 bg-base-300 rounded-xl border-[1px] rounded-xl border-text-200">
71
+ <p class="text-text-400">{{ $t('All conditions') }}</p>
72
+ </div>
73
+ </template>
74
+ </ListItem>
75
+ </div>
76
+
77
+ </div>
78
+
79
+ <div>
80
+ <div class="flex flex-row items-center gap-2">
81
+ <label class="flex-1">Output</label>
82
+ <button type="button" class="text-primary" @click="$refs.userActionOutput.create()">Add Output</button>
83
+ </div>
84
+ <ListItem :items="instance.outputs"
85
+ class="mt-2 border-[1px] rounded-xl border-text-200"
86
+ container-class="divide-y divide-text-200"
87
+ @reorder="(from, to) => { instance.outputs.splice(to, 0, instance.outputs.splice(from, 1)[0]); }">
88
+ <template v-slot="{ item, index }">
89
+ <div class="flex flex-row items-center gap-3 px-3">
90
+ <div data-reorder>
91
+ <svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
92
+ </div>
93
+ <div class="flex-1 p-2 flex flex-row items-center gap-2" @click="$refs.userActionOutput.open(item, index)">
94
+ <p>{{ item.text }}</p>
95
+ <p class="flex-1 text-text-300 text-ellipsis whitespace-nowrap overflow-hidden"></p>
96
+ </div>
97
+ <button type="button" @click="instance.outputs.splice(index, 1)">
98
+ <svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
99
+ </button>
100
+ </div>
101
+ </template>
102
+
103
+ <template #empty>
104
+ <div class="flex justify-center p-2 bg-base-300 rounded-xl">
105
+ <p class="text-text-400">{{ $t('No actions') }}</p>
106
+ </div>
107
+ </template>
108
+ </ListItem>
109
+
110
+ <UserActionOutput ref="userActionOutput"
111
+ :outputs="outputs"
112
+ @apply="(instance, index) => addOutput(instance, index)" />
113
+
114
+ <UserActionCondition ref="userActionCondition" />
115
+ </div>
116
+
117
+ </div>
118
+ </template>
119
+
120
+ <script>
121
+
122
+ import UserActionOutput from "./UserActionOutput.vue";
123
+ import UserActionCondition from "./UserActionCondition.vue";
124
+
125
+ export default{
126
+
127
+ components: {UserActionCondition, UserActionOutput},
128
+
129
+ computed: {
130
+
131
+ conditions(){
132
+ return (this.eventOpt[this.instance.event]?.conditions ?? [])
133
+ .reduce((acc, cur) => {
134
+ acc[cur.key] = cur
135
+ return acc
136
+ }, {})
137
+ },
138
+
139
+ outputs(){
140
+ return [
141
+ { type: "log", text:"Log" },
142
+ { type: "reply", text:"Reply" },
143
+ { type: "delay", text:"Delay" },
144
+ { type: "reset", text:"Reset" },
145
+ { type: "endChat", text:"End Chat" },
146
+ { type: "startChat", text:"Start Chat" },
147
+ { type: "endConversation", text:"End Conversation" },
148
+ ]
149
+ return this.eventOpt[this.instance.key]?.outputs ?? []
150
+ },
151
+
152
+ },
153
+
154
+ data(){
155
+ return {
156
+ }
157
+ },
158
+
159
+ methods: {
160
+
161
+ addCondition(condition){
162
+ this.$util.push(this.instance.conditions, condition)
163
+ },
164
+
165
+ addOutput(output, idx){
166
+ if(!this.instance) return
167
+
168
+ if(!Array.isArray(this.instance.outputs))
169
+ this.instance.outputs = []
170
+
171
+ typeof idx === 'number' ?
172
+ Object.assign(this.instance.outputs[idx], output) :
173
+ this.instance.outputs.push(output)
174
+ },
175
+
176
+ },
177
+
178
+ props: {
179
+ instance: Object,
180
+
181
+ eventOpt: {
182
+ type: Object,
183
+ default: () => ({
184
+
185
+ 'onNewMessage': {
186
+ text: 'On message create',
187
+ conditions: [
188
+ { key:"{message.body}", text:"Text", type:"string", operators:[ [ 'contains', 'Contains' ], [ 'startsWith', 'Starts With' ] ] },
189
+ { key:"{message.direction}", text:"Direction", type:"enum", enum:[ [ 1, 'In' ], [ 2, 'Out' ] ] },
190
+ { key:"{message.channelId}", text:"Channel", type:"enum", enum:[ [ 1, 'Whatsapp' ] ] },
191
+ { key:"{message.inbox.mobileNumber}", text:"Mobile Number" }
192
+ ],
193
+ outputs: [
194
+ { type: "log", text:"Log" },
195
+ { type: "reply", text:"Reply" },
196
+ { type: "delay", text:"Delay" },
197
+ ]
198
+ }
199
+
200
+ })
201
+ },
202
+ }
203
+ }
204
+
205
+ </script>
206
+
207
+ <style module>
208
+
209
+ .comp{
210
+
211
+ }
212
+
213
+ </style>