contactstudiocstools 1.0.224
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/README.md +94 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.ts +7 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +72 -0
- package/dist/runtime/components/Atom.Alert.vue +46 -0
- package/dist/runtime/components/Atom.Auth.vue +37 -0
- package/dist/runtime/components/Atom.BannerChatEmpty.vue +18 -0
- package/dist/runtime/components/Atom.BannerPage404.vue +28 -0
- package/dist/runtime/components/Atom.BannerPageUnauthorized.vue +18 -0
- package/dist/runtime/components/Atom.Breadcrumb.vue +26 -0
- package/dist/runtime/components/Atom.ChatContact.vue +136 -0
- package/dist/runtime/components/Atom.ChatContactSchedule.vue +87 -0
- package/dist/runtime/components/Atom.ChatMessageFooter.vue +25 -0
- package/dist/runtime/components/Atom.DarkMode.vue +67 -0
- package/dist/runtime/components/Atom.DraggableWindow.vue +102 -0
- package/dist/runtime/components/Atom.Dropdown.vue +9 -0
- package/dist/runtime/components/Atom.DropdownSearchable.vue +25 -0
- package/dist/runtime/components/Atom.Fetch.vue +46 -0
- package/dist/runtime/components/Atom.Field.vue +43 -0
- package/dist/runtime/components/Atom.FieldDate.vue +19 -0
- package/dist/runtime/components/Atom.FieldNumber.vue +19 -0
- package/dist/runtime/components/Atom.FieldPhone.vue +92 -0
- package/dist/runtime/components/Atom.FieldSelect.vue +28 -0
- package/dist/runtime/components/Atom.FieldSelectMultiple.vue +49 -0
- package/dist/runtime/components/Atom.FieldText.vue +19 -0
- package/dist/runtime/components/Atom.FieldTextarea.vue +41 -0
- package/dist/runtime/components/Atom.Loading.vue +80 -0
- package/dist/runtime/components/Atom.Notification.vue +48 -0
- package/dist/runtime/components/Atom.Ringtone.vue +23 -0
- package/dist/runtime/components/Atom.SelectTreeField.vue +49 -0
- package/dist/runtime/components/Atom.Snapshot.vue +33 -0
- package/dist/runtime/components/Atom.Tabs.vue +60 -0
- package/dist/runtime/components/Molecule.ChatMessageFile.vue +102 -0
- package/dist/runtime/components/Molecule.ChatMessageOption.vue +85 -0
- package/dist/runtime/components/Molecule.ChatMessageText.vue +36 -0
- package/dist/runtime/components/Molecule.ClientHistory.vue +62 -0
- package/dist/runtime/components/Molecule.DropdownDDI.vue +333 -0
- package/dist/runtime/components/Molecule.FieldGroup.vue +73 -0
- package/dist/runtime/components/Molecule.FieldSelectMultiple.vue +19 -0
- package/dist/runtime/components/Molecule.File.vue +84 -0
- package/dist/runtime/components/Molecule.SelectTreeSearchable.vue +126 -0
- package/dist/runtime/components/Molecule.Status.vue +154 -0
- package/dist/runtime/components/Molecule.TimeDaily.vue +9 -0
- package/dist/runtime/components/Organism.Attachments.vue +139 -0
- package/dist/runtime/components/Organism.ChatMessages.vue +31 -0
- package/dist/runtime/components/Organism.ChatRoom.vue +342 -0
- package/dist/runtime/components/Organism.ChatSchedule.vue +110 -0
- package/dist/runtime/components/Organism.ClientHistoryTable.vue +85 -0
- package/dist/runtime/components/Organism.ClientHistoryTimeline.vue +77 -0
- package/dist/runtime/components/Organism.FAQ.vue +88 -0
- package/dist/runtime/components/Organism.Form.vue +67 -0
- package/dist/runtime/components/Organism.FormMailing.vue +112 -0
- package/dist/runtime/components/Organism.HeaderMain.vue +79 -0
- package/dist/runtime/components/Organism.Manifestation.vue +146 -0
- package/dist/runtime/components/Organism.Nav.vue +27 -0
- package/dist/runtime/components/Organism.NavMain.vue +187 -0
- package/dist/runtime/components/Organism.PageContainer.vue +22 -0
- package/dist/runtime/components/Organism.Schedule.vue +170 -0
- package/dist/runtime/components/Organism.Tabulation.vue +237 -0
- package/dist/runtime/components/types/dto.d.ts +16 -0
- package/dist/runtime/components/types/dto.mjs +236 -0
- package/dist/runtime/components/types/helpers.d.ts +39 -0
- package/dist/runtime/components/types/helpers.mjs +295 -0
- package/dist/runtime/components/types/index.d.ts +4 -0
- package/dist/runtime/components/types/index.mjs +4 -0
- package/dist/runtime/components/types/types.d.ts +198 -0
- package/dist/runtime/components/types/types.mjs +35 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/clickOutside.d.ts +2 -0
- package/dist/runtime/plugins/clickOutside.mjs +16 -0
- package/dist/runtime/plugins/emitter.d.ts +2 -0
- package/dist/runtime/plugins/emitter.mjs +17 -0
- package/dist/runtime/public/192x192.png +0 -0
- package/dist/runtime/public/404.svg +1 -0
- package/dist/runtime/public/512x512.png +0 -0
- package/dist/runtime/public/chat.svg +138 -0
- package/dist/runtime/public/chatbg.png +0 -0
- package/dist/runtime/public/dev-sw.d.ts +0 -0
- package/dist/runtime/public/dev-sw.mjs +0 -0
- package/dist/runtime/public/empty.svg +1 -0
- package/dist/runtime/public/loading.svg +1 -0
- package/dist/runtime/public/messages.svg +1 -0
- package/dist/runtime/public/privacy.svg +1 -0
- package/dist/runtime/public/ringtone.mp3 +0 -0
- package/dist/runtime/public/security.svg +188 -0
- package/dist/runtime/public/snapshot.d.ts +15 -0
- package/dist/runtime/public/snapshot.mjs +77 -0
- package/dist/runtime/public/unauthorized.svg +1 -0
- package/dist/types.d.ts +10 -0
- package/package.json +50 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article class="flex flex-col">
|
|
3
|
+
<!-- select -->
|
|
4
|
+
<MoleculeSelectTreeSearchable
|
|
5
|
+
:select-tree="getTree"
|
|
6
|
+
:class="{ error: !isValid }"
|
|
7
|
+
label="Tabulação"
|
|
8
|
+
@add="add"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<!-- accordion -->
|
|
12
|
+
<div class="accordion accordion-bordered mt-3">
|
|
13
|
+
<details
|
|
14
|
+
v-for="(levels, j) in tabulation"
|
|
15
|
+
:key="j"
|
|
16
|
+
class="item"
|
|
17
|
+
:open="takenote"
|
|
18
|
+
>
|
|
19
|
+
<summary class="max-h-none flex flex-wrap gap-4">
|
|
20
|
+
<!-- items -->
|
|
21
|
+
<div
|
|
22
|
+
v-for="({ label }, i) in levels"
|
|
23
|
+
:key="i"
|
|
24
|
+
class="flex"
|
|
25
|
+
>
|
|
26
|
+
<!-- label -->
|
|
27
|
+
<span
|
|
28
|
+
class="badge badge-soft-secondary mr-2"
|
|
29
|
+
v-text="getTree.labels[i]"
|
|
30
|
+
/>
|
|
31
|
+
<!-- value -->
|
|
32
|
+
<span
|
|
33
|
+
class="badge badge-solid-primary"
|
|
34
|
+
v-text="label"
|
|
35
|
+
/>
|
|
36
|
+
<!-- arrow -->
|
|
37
|
+
<i
|
|
38
|
+
v-if="!i"
|
|
39
|
+
class="bi-arrow-left-right ml-4"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</summary>
|
|
43
|
+
|
|
44
|
+
<!-- schedule -->
|
|
45
|
+
<article v-if="isSchedule">
|
|
46
|
+
<MoleculeFieldGroup
|
|
47
|
+
:rules="[
|
|
48
|
+
() => {
|
|
49
|
+
if (!additionals.SCHEDULE)
|
|
50
|
+
return 'O horário de agendamento é obrigatório';
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
]"
|
|
54
|
+
label="Horário do Agendamento"
|
|
55
|
+
:class="{ error: scheduleIsInvalid }"
|
|
56
|
+
>
|
|
57
|
+
<!-- additionals -->
|
|
58
|
+
<AtomFieldDate
|
|
59
|
+
v-model="additionals.SCHEDULE"
|
|
60
|
+
:min="new Date().toISOString().split('.')[0]"
|
|
61
|
+
type="datetime-local"
|
|
62
|
+
@change="persist"
|
|
63
|
+
/>
|
|
64
|
+
</MoleculeFieldGroup>
|
|
65
|
+
</article>
|
|
66
|
+
|
|
67
|
+
<!-- observation -->
|
|
68
|
+
<article>
|
|
69
|
+
<MoleculeFieldGroup
|
|
70
|
+
:rules="getRulesNote"
|
|
71
|
+
:class="{ error: noteIsInvalid }"
|
|
72
|
+
>
|
|
73
|
+
<AtomFieldTextarea
|
|
74
|
+
v-model="note"
|
|
75
|
+
rows="5"
|
|
76
|
+
placeholder="Observação"
|
|
77
|
+
@blur="persist"
|
|
78
|
+
/>
|
|
79
|
+
</MoleculeFieldGroup>
|
|
80
|
+
</article>
|
|
81
|
+
|
|
82
|
+
<div class="divider mx-5" />
|
|
83
|
+
|
|
84
|
+
<MoleculeFieldGroup
|
|
85
|
+
:ref="bindMoleculeFieldGroupRef"
|
|
86
|
+
class="px-5 mb-4 mt-3"
|
|
87
|
+
:rules="getRulesManifestation"
|
|
88
|
+
label="Manifestação Vinculada"
|
|
89
|
+
>
|
|
90
|
+
<label
|
|
91
|
+
class="input flex flex-wrap items-center gap-1 !px-2"
|
|
92
|
+
tooltip="Vincule na seção 'Manifestação'"
|
|
93
|
+
>
|
|
94
|
+
<span
|
|
95
|
+
v-if="manifestationIsEmpty"
|
|
96
|
+
class="text-xs py-0.5 pl-1"
|
|
97
|
+
>Nenhuma manifestação vinculada</span>
|
|
98
|
+
<i
|
|
99
|
+
v-else
|
|
100
|
+
class="bi-check-circle-fill text-success px-1"
|
|
101
|
+
/>
|
|
102
|
+
<span
|
|
103
|
+
v-for="({ label }, k) in manifestation"
|
|
104
|
+
:key="k"
|
|
105
|
+
class="badge badge-soft-secondary"
|
|
106
|
+
v-text="label"
|
|
107
|
+
/>
|
|
108
|
+
</label>
|
|
109
|
+
</MoleculeFieldGroup>
|
|
110
|
+
</details>
|
|
111
|
+
</div>
|
|
112
|
+
</article>
|
|
113
|
+
</template>
|
|
114
|
+
|
|
115
|
+
<script setup lang="ts">
|
|
116
|
+
import { ref, reactive, computed, watch } from "vue";
|
|
117
|
+
import { INodes, IRules, ISelectTree } from "./types";
|
|
118
|
+
import MoleculeFieldGroup from "./Molecule.FieldGroup.vue";
|
|
119
|
+
|
|
120
|
+
// props
|
|
121
|
+
interface IProps {
|
|
122
|
+
nodes: INodes;
|
|
123
|
+
takenote?: boolean;
|
|
124
|
+
manifestation?: INodes;
|
|
125
|
+
persist?: Function;
|
|
126
|
+
defaults?: { tabulation: INodes[]; note: string };
|
|
127
|
+
}
|
|
128
|
+
const props = defineProps<IProps>();
|
|
129
|
+
|
|
130
|
+
// computed
|
|
131
|
+
const noteIsEmpty = computed<boolean>(() => {
|
|
132
|
+
return !note.value.trim();
|
|
133
|
+
});
|
|
134
|
+
const manifestationIsEmpty = computed<boolean>(() => {
|
|
135
|
+
return !props.manifestation || props.manifestation?.length === 0;
|
|
136
|
+
});
|
|
137
|
+
const noteIsInvalid = computed<boolean>(() => {
|
|
138
|
+
return props.takenote && noteIsEmpty.value;
|
|
139
|
+
});
|
|
140
|
+
const manifestationIsInvalid = computed<boolean>(() => {
|
|
141
|
+
return takeManifestation.value && manifestationIsEmpty.value;
|
|
142
|
+
});
|
|
143
|
+
const getRulesNote = computed<IRules>(() => {
|
|
144
|
+
return [() => (noteIsInvalid.value ? "Observação Obrigatória" : true)];
|
|
145
|
+
});
|
|
146
|
+
const getRulesManifestation = computed<IRules>(() => {
|
|
147
|
+
return [() => !manifestationIsInvalid.value ?? "Manifestação Obrigatória"];
|
|
148
|
+
});
|
|
149
|
+
const isValid = computed<boolean>(() => {
|
|
150
|
+
if (noteIsInvalid.value) return false;
|
|
151
|
+
if (manifestationIsInvalid.value) return false;
|
|
152
|
+
if (scheduleIsInvalid.value) return false;
|
|
153
|
+
return !!tabulation.length;
|
|
154
|
+
});
|
|
155
|
+
const getTree = computed<ISelectTree>(() => {
|
|
156
|
+
return {
|
|
157
|
+
labels: ["GRUPO", "TABULAÇÃO"],
|
|
158
|
+
nodes: props.nodes,
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
const isSchedule = computed<boolean>(() => {
|
|
162
|
+
if (!tabulation.length) return false;
|
|
163
|
+
return tabulation[0][1].primitive.acao.tipo === "AGENDADOR";
|
|
164
|
+
});
|
|
165
|
+
const scheduleIsInvalid = computed<boolean>(() => {
|
|
166
|
+
return isSchedule.value && !additionals.SCHEDULE;
|
|
167
|
+
});
|
|
168
|
+
const takeManifestation = computed<boolean>(() => {
|
|
169
|
+
if (!tabulation[0]) return false
|
|
170
|
+
return tabulation[0][1].primitive.acao.required_manifestation ?? false
|
|
171
|
+
})
|
|
172
|
+
const getNote = computed<string>(() => {
|
|
173
|
+
if (!props.manifestation) return note.value
|
|
174
|
+
|
|
175
|
+
const levels = props.manifestation.map(level => level.label)
|
|
176
|
+
return `Manifestação: ${levels.join(" > ")}\n${note.value}`
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
// data
|
|
180
|
+
const MoleculeFieldGroupRef = ref<InstanceType<
|
|
181
|
+
typeof MoleculeFieldGroup
|
|
182
|
+
> | null>(null);
|
|
183
|
+
const tabulation = reactive<INodes[]>(props.defaults?.tabulation ?? []);
|
|
184
|
+
const note = ref<string>(props.defaults?.note ?? "");
|
|
185
|
+
const additionals = reactive<any>({});
|
|
186
|
+
|
|
187
|
+
// methods
|
|
188
|
+
function add(nodes: INodes): void {
|
|
189
|
+
tabulation[0] = nodes;
|
|
190
|
+
|
|
191
|
+
persist();
|
|
192
|
+
}
|
|
193
|
+
function persist(): void {
|
|
194
|
+
if (!props.persist) return;
|
|
195
|
+
|
|
196
|
+
props.persist({
|
|
197
|
+
tabulation: tabulation,
|
|
198
|
+
note: note.value,
|
|
199
|
+
additionals,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function append({ tabulation: tab, note: nt, add }: any): void {
|
|
203
|
+
tabulation.push(...tab);
|
|
204
|
+
note.value = nt;
|
|
205
|
+
Object.assign(additionals, add);
|
|
206
|
+
}
|
|
207
|
+
function reset(): void {
|
|
208
|
+
tabulation.length = 0;
|
|
209
|
+
}
|
|
210
|
+
function bindMoleculeFieldGroupRef(ref?: any) {
|
|
211
|
+
MoleculeFieldGroupRef.value = ref
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// watchers
|
|
215
|
+
watch(
|
|
216
|
+
() => props.manifestation,
|
|
217
|
+
() => { MoleculeFieldGroupRef.value?.validateAndSetState() },
|
|
218
|
+
{ deep: true }
|
|
219
|
+
);
|
|
220
|
+
watch(
|
|
221
|
+
() => takeManifestation.value,
|
|
222
|
+
() => { MoleculeFieldGroupRef.value?.validateAndSetState() }
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
// expose
|
|
226
|
+
defineExpose({
|
|
227
|
+
tabulation,
|
|
228
|
+
note: getNote,
|
|
229
|
+
additionals,
|
|
230
|
+
isValid,
|
|
231
|
+
isSchedule,
|
|
232
|
+
append,
|
|
233
|
+
reset,
|
|
234
|
+
});
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<style scoped></style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDoubts, IMailing, IPauses, ISchedules, IUser, IChatContacts, INodes, IChatMessage, IFlows, IClientHistories, IPortfolioSchedules } from ".";
|
|
2
|
+
export declare function IPortfolioSchedulesDTO(primitives: any[]): IPortfolioSchedules;
|
|
3
|
+
export declare function IClientHistoriesDTO(primitives: any[]): IClientHistories;
|
|
4
|
+
export declare function FlowsDTO(primitives: any[]): IFlows;
|
|
5
|
+
export declare function ChatMessageTextDTO(primitive: any): IChatMessage;
|
|
6
|
+
export declare function ChatMessageOptionDTO(primitive: any): IChatMessage;
|
|
7
|
+
export declare function ChatMessageFileDTO(primitive: any): IChatMessage;
|
|
8
|
+
export declare function NodesManifestationDTO(primitives: any[]): INodes;
|
|
9
|
+
export declare function NodesTabulationDTO(primitives: any[]): INodes;
|
|
10
|
+
export declare function ChatContactsDTO({ primitives, identifier, message, date, }: any): IChatContacts;
|
|
11
|
+
export declare function SchedulesDTO({ data }: any): ISchedules;
|
|
12
|
+
export declare function WarnsDTO(primitive: any): string[];
|
|
13
|
+
export declare function PausesDTO({ lista_pausa }: any): IPauses;
|
|
14
|
+
export declare function DoubtsDTO(primitives: any[]): IDoubts;
|
|
15
|
+
export declare function UserDTO(primitive: any): IUser;
|
|
16
|
+
export declare function MailingDTO(primitives: any[]): IMailing;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EFieldTypes,
|
|
3
|
+
EChatMessageTypes
|
|
4
|
+
} from "./index.mjs";
|
|
5
|
+
export function IPortfolioSchedulesDTO(primitives) {
|
|
6
|
+
const schedules = [];
|
|
7
|
+
if (!primitives)
|
|
8
|
+
return [];
|
|
9
|
+
for (const primitive of primitives) {
|
|
10
|
+
schedules.push({
|
|
11
|
+
identifier: primitive.telephone,
|
|
12
|
+
slots: primitive.slots,
|
|
13
|
+
date: new Date(primitive.wallet_date),
|
|
14
|
+
avatar: primitive.avatar,
|
|
15
|
+
primitive
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return schedules;
|
|
19
|
+
}
|
|
20
|
+
export function IClientHistoriesDTO(primitives) {
|
|
21
|
+
const histories = [];
|
|
22
|
+
if (!primitives)
|
|
23
|
+
return [];
|
|
24
|
+
for (const primitive of primitives) {
|
|
25
|
+
histories.push({
|
|
26
|
+
agent: primitive.nome_ultima_tabulacao || "Operador Inexistente",
|
|
27
|
+
lastMovementDate: new Date(primitive.data_ultima_tabulacao) ?? null,
|
|
28
|
+
lastTabulation: primitive.ultima_tabulacao,
|
|
29
|
+
mailing: primitive.mailing,
|
|
30
|
+
observation: primitive.observation,
|
|
31
|
+
primitive
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return histories;
|
|
35
|
+
}
|
|
36
|
+
export function FlowsDTO(primitives) {
|
|
37
|
+
const flows = [];
|
|
38
|
+
if (!primitives)
|
|
39
|
+
return [];
|
|
40
|
+
for (const primitive of primitives) {
|
|
41
|
+
flows.push({
|
|
42
|
+
name: primitive.flow_name,
|
|
43
|
+
description: primitive.description_flow,
|
|
44
|
+
slots: primitive.slots
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return flows;
|
|
48
|
+
}
|
|
49
|
+
function FieldSelectOptionsDTO(primitives) {
|
|
50
|
+
const options = [];
|
|
51
|
+
if (!primitives)
|
|
52
|
+
return [];
|
|
53
|
+
for (const { nome, label } of primitives) {
|
|
54
|
+
options.push({ value: nome, label });
|
|
55
|
+
}
|
|
56
|
+
return options;
|
|
57
|
+
}
|
|
58
|
+
function ChatMessageDTO(primitive) {
|
|
59
|
+
const { when, content, user_defined_fields } = primitive;
|
|
60
|
+
const isRobot = content.who.type === "robot";
|
|
61
|
+
return {
|
|
62
|
+
type: EChatMessageTypes.text,
|
|
63
|
+
who: content.who.label,
|
|
64
|
+
date: new Date(when),
|
|
65
|
+
primary: isRobot || !!user_defined_fields.agent,
|
|
66
|
+
primitive,
|
|
67
|
+
text: ""
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function ChatMessageTextDTO(primitive) {
|
|
71
|
+
const message = ChatMessageDTO(primitive);
|
|
72
|
+
message.type = EChatMessageTypes.text;
|
|
73
|
+
message.text = primitive.content.message.text;
|
|
74
|
+
return message;
|
|
75
|
+
}
|
|
76
|
+
export function ChatMessageOptionDTO(primitive) {
|
|
77
|
+
const message = ChatMessageDTO(primitive);
|
|
78
|
+
message.type = EChatMessageTypes.option;
|
|
79
|
+
message.selected = true;
|
|
80
|
+
message.text = primitive.content.message.caption;
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
export function ChatMessageFileDTO(primitive) {
|
|
84
|
+
const message = ChatMessageDTO(primitive);
|
|
85
|
+
message.type = EChatMessageTypes.file;
|
|
86
|
+
message.text = "\u{1F4C4} Arquivo";
|
|
87
|
+
return message;
|
|
88
|
+
}
|
|
89
|
+
export function NodesManifestationDTO(primitives) {
|
|
90
|
+
const nodes = [];
|
|
91
|
+
if (!primitives)
|
|
92
|
+
return [];
|
|
93
|
+
for (const primitive of primitives) {
|
|
94
|
+
const { children, name } = primitive;
|
|
95
|
+
if (!children) {
|
|
96
|
+
nodes.push({ value: name, label: name, primitive });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
nodes.push({
|
|
100
|
+
children: NodesManifestationDTO(children),
|
|
101
|
+
value: name,
|
|
102
|
+
label: name,
|
|
103
|
+
primitive
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return nodes;
|
|
107
|
+
}
|
|
108
|
+
export function NodesTabulationDTO(primitives) {
|
|
109
|
+
const nodes = [];
|
|
110
|
+
if (!primitives)
|
|
111
|
+
return [];
|
|
112
|
+
for (const primitive of primitives) {
|
|
113
|
+
const { label, nome, tabulacoes } = primitive;
|
|
114
|
+
if (!tabulacoes) {
|
|
115
|
+
nodes.push({ value: nome, primitive, label });
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
nodes.push({
|
|
119
|
+
children: NodesTabulationDTO(tabulacoes),
|
|
120
|
+
value: nome,
|
|
121
|
+
primitive,
|
|
122
|
+
label
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return nodes;
|
|
126
|
+
}
|
|
127
|
+
export function ChatContactsDTO({
|
|
128
|
+
primitives,
|
|
129
|
+
identifier,
|
|
130
|
+
message,
|
|
131
|
+
date
|
|
132
|
+
}) {
|
|
133
|
+
const contacts = [];
|
|
134
|
+
if (!primitives)
|
|
135
|
+
return [];
|
|
136
|
+
for (const primitive of primitives) {
|
|
137
|
+
const { contact_id, data } = primitive;
|
|
138
|
+
contacts.push({
|
|
139
|
+
id: contact_id,
|
|
140
|
+
on: true,
|
|
141
|
+
label: data[identifier],
|
|
142
|
+
avatar: primitive.avatar,
|
|
143
|
+
entrydate: new Date(primitive.creation_date * 1e3),
|
|
144
|
+
primitive,
|
|
145
|
+
date,
|
|
146
|
+
message
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return contacts;
|
|
150
|
+
}
|
|
151
|
+
export function SchedulesDTO({ data }) {
|
|
152
|
+
const schedules = [];
|
|
153
|
+
if (!data)
|
|
154
|
+
return [];
|
|
155
|
+
for (const schedule of data) {
|
|
156
|
+
schedules.push({
|
|
157
|
+
cardID: schedule.card_id,
|
|
158
|
+
priority: schedule.priority || 0,
|
|
159
|
+
contactName: schedule.contact_name,
|
|
160
|
+
customerID: schedule.customer_id,
|
|
161
|
+
scheduling: /* @__PURE__ */ new Date(),
|
|
162
|
+
lastInteraction: /* @__PURE__ */ new Date(),
|
|
163
|
+
lastTabulation: /* @__PURE__ */ new Date(),
|
|
164
|
+
mailing: schedule.mailing
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return schedules;
|
|
168
|
+
}
|
|
169
|
+
export function WarnsDTO(primitive) {
|
|
170
|
+
return primitive;
|
|
171
|
+
}
|
|
172
|
+
export function PausesDTO({ lista_pausa }) {
|
|
173
|
+
const pauses = [{ value: "available", label: "Disponivel" }];
|
|
174
|
+
for (const { nome, label } of lista_pausa) {
|
|
175
|
+
pauses.push({
|
|
176
|
+
value: nome,
|
|
177
|
+
label
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return pauses;
|
|
181
|
+
}
|
|
182
|
+
export function DoubtsDTO(primitives) {
|
|
183
|
+
if (!primitives)
|
|
184
|
+
return [];
|
|
185
|
+
return primitives[0].doubt;
|
|
186
|
+
}
|
|
187
|
+
export function UserDTO(primitive) {
|
|
188
|
+
if (!primitive.info_agente) {
|
|
189
|
+
primitive.info_agente = {};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
company: primitive.empresa,
|
|
193
|
+
campaign: primitive.info_agente.codigo_campanha ?? "",
|
|
194
|
+
nickname: primitive.nome,
|
|
195
|
+
name: primitive.short_name,
|
|
196
|
+
access: [],
|
|
197
|
+
primitive
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export function MailingDTO(primitives) {
|
|
201
|
+
const mailing = [];
|
|
202
|
+
primitives = primitives.sort(
|
|
203
|
+
(a, b) => a.config.ordem - b.config.ordem
|
|
204
|
+
);
|
|
205
|
+
for (const field of primitives) {
|
|
206
|
+
mailing.push({
|
|
207
|
+
icon: field.config.editavel ? "bi-input-cursor-text" : "bi-lock",
|
|
208
|
+
type: getFieldType(field),
|
|
209
|
+
name: field.nome,
|
|
210
|
+
label: field.config.label,
|
|
211
|
+
required: field.config.required_field,
|
|
212
|
+
disabled: !field.config.editavel,
|
|
213
|
+
regex: new RegExp(field.regex),
|
|
214
|
+
primitive: field,
|
|
215
|
+
options: FieldSelectOptionsDTO(field.values),
|
|
216
|
+
maxlength: field.tipo.max,
|
|
217
|
+
messages: {
|
|
218
|
+
error: field.config.ajuda
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return mailing;
|
|
223
|
+
}
|
|
224
|
+
function getFieldType({ combo, tipo }) {
|
|
225
|
+
if (combo)
|
|
226
|
+
return EFieldTypes.select;
|
|
227
|
+
if (tipo.large)
|
|
228
|
+
return EFieldTypes.textarea;
|
|
229
|
+
if (tipo.formato === "NUMERO")
|
|
230
|
+
return EFieldTypes.number;
|
|
231
|
+
if (tipo.formato === "TELEFONE")
|
|
232
|
+
return EFieldTypes.phone;
|
|
233
|
+
if (tipo.formato === "DATA")
|
|
234
|
+
return EFieldTypes.date;
|
|
235
|
+
return EFieldTypes.text;
|
|
236
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EUserStatus, IChatContact, IPause, IChatMessage, IDDI } from ".";
|
|
2
|
+
export declare class Persist {
|
|
3
|
+
static set(label: string, value: any): void;
|
|
4
|
+
static get(label: string): any;
|
|
5
|
+
static remove(label: string): any;
|
|
6
|
+
}
|
|
7
|
+
export declare function getDefaultDDI(): IDDI;
|
|
8
|
+
export declare function getDDI(phone: string): Promise<any>;
|
|
9
|
+
export declare function deepEqual(obj1: any, obj2: any): boolean;
|
|
10
|
+
export declare function getAccessControl(access: string[], key: string): string;
|
|
11
|
+
export declare function searchZipCode({ models, field }: any): Promise<void>;
|
|
12
|
+
export declare function logout(): Promise<void>;
|
|
13
|
+
export declare function getMinutesBetweenDates(start: Date, end: Date): number;
|
|
14
|
+
export declare function randomID(): string;
|
|
15
|
+
export declare function getTokenProgressData(token: string): Promise<any>;
|
|
16
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
17
|
+
export declare function getContactIdentifierByMailing(primitive: any[]): string;
|
|
18
|
+
export declare function newUUID(): string;
|
|
19
|
+
export declare function getTimeByDate(date: Date): string;
|
|
20
|
+
export declare function getCurrentStatus({ status, current_status, unavailable_status, }: any): EUserStatus;
|
|
21
|
+
export declare function getNextStatus({ next_status, standby_unavailable_status, }: any): EUserStatus;
|
|
22
|
+
export declare function getPauseByLabel({ primitive, pauses }: any): IPause;
|
|
23
|
+
export declare function isEquals(one: string, two: string): boolean;
|
|
24
|
+
export declare function normalize(str: string): string;
|
|
25
|
+
export declare function chatInteractionIsTemplate(primitive: any): boolean;
|
|
26
|
+
export declare function chatInteractionIsEvent(primitive: any): boolean;
|
|
27
|
+
export declare function eventTypeIsTyping(primitive: any): boolean;
|
|
28
|
+
export declare function typingIsOn(primitive: any): boolean;
|
|
29
|
+
export declare function chatInteractionIsCommand(primitive: any): boolean;
|
|
30
|
+
export declare function treatChatMessage(primitive: any): IChatMessage;
|
|
31
|
+
export declare function chatMessageIsText(primitive: any): boolean;
|
|
32
|
+
export declare function chatMessageIsReadOnly(primitive: any): boolean;
|
|
33
|
+
export declare function chatMessageIsOption(primitive: any): boolean;
|
|
34
|
+
export declare function chatMessageIsFile(primitive: any): boolean;
|
|
35
|
+
export declare function getContactByRoomID({ contacts, roomID }: any): IChatContact;
|
|
36
|
+
export declare function newChatHistoryEvent({ company, roomID, nickname, name, }: any): any;
|
|
37
|
+
export declare function newChatTextMessage({ company, roomID, nickname, name, text, }: any): any;
|
|
38
|
+
export declare function newChatFileMessage({ roomID, company, nickname, name, type, caption, url, }: any): any;
|
|
39
|
+
export declare function newChatTypingEvent({ roomID, company, nickname, name, typing, }: any): any;
|