@phonghq/go-chat 1.0.14 β†’ 1.0.16

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.
@@ -1,270 +0,0 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { ref } from 'vue';
3
- import CSpin from '../components/common/spin/CSpin.vue';
4
- import { dataProfile, submitTenantPhone } from '../utils/chat/auth';
5
- import router from '../router';
6
- const open = ref(false);
7
- const phoneValue = ref('');
8
- const countries = [
9
- // { code: 'VN', name: 'Vietnam', dial: 84, flag: 'πŸ‡»πŸ‡³' },
10
- { code: 'US', name: 'United States', dial: 1, flag: 'πŸ‡ΊπŸ‡Έ' }
11
- // { code: 'KR', name: 'Korea', dial: 82, flag: 'πŸ‡°πŸ‡·' },
12
- // { code: 'JP', name: 'Japan', dial: 81, flag: 'πŸ‡―πŸ‡΅' },
13
- // { code: 'TH', name: 'Thailand', dial: 66, flag: 'πŸ‡ΉπŸ‡­' },
14
- ];
15
- const selected = ref(countries[0]);
16
- const error = ref('');
17
- const loading = ref(false);
18
- const select = (c) => {
19
- selected.value = c;
20
- open.value = false;
21
- };
22
- const isPhoneMatchDial = (countryDial, phone) => {
23
- const dial = phone.replace('+', '');
24
- return phone.startsWith(countryDial.toString());
25
- };
26
- const keepOnlyNumbers = (str) => {
27
- return str.replace(/\D/g, '');
28
- };
29
- const handleInput = () => {
30
- error.value = '';
31
- phoneValue.value = keepOnlyNumbers(phoneValue.value);
32
- };
33
- const onSubmit = async () => {
34
- try {
35
- if (isPhoneMatchDial(selected.value.dial, phoneValue.value)) {
36
- error.value = `Phone number does not match country code ${selected.value.name}`;
37
- return;
38
- }
39
- loading.value = true;
40
- const param = {
41
- phone: selected.value.dial + phoneValue.value,
42
- tenant_id: dataProfile.value?.tenant_id ?? ''
43
- };
44
- await submitTenantPhone(param);
45
- router.push({ name: 'home' });
46
- }
47
- catch (e) {
48
- console.log(e);
49
- }
50
- loading.value = false;
51
- };
52
- debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
53
- const __VLS_ctx = {
54
- ...{},
55
- ...{},
56
- };
57
- let __VLS_elements;
58
- let __VLS_components;
59
- let __VLS_directives;
60
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
61
- ...{ class: "flex flex-col w-[700px] h-full mx-auto justify-center pb-40" },
62
- });
63
- __VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
64
- ...{ class: "text-[28px] font-medium text-chat-haze-700 mb-1 block mb-2" },
65
- });
66
- __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
67
- ...{ class: "text-xl text-chat-haze-600 mb-4" },
68
- });
69
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
70
- ...{ class: "flex items-center gap-2 chat-input border border-chat-haze-200 p-2 bg-white shadow-md" },
71
- });
72
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
73
- ...{ class: "relative" },
74
- });
75
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
76
- ...{ onClick: (...[$event]) => {
77
- __VLS_ctx.open = !__VLS_ctx.open;
78
- // @ts-ignore
79
- [open, open,];
80
- } },
81
- ...{ class: "flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-gray-100" },
82
- });
83
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
84
- (__VLS_ctx.selected.flag);
85
- // @ts-ignore
86
- [selected,];
87
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
88
- ...{ class: "text-sm text-chat-haze-700" },
89
- });
90
- (__VLS_ctx.selected.dial);
91
- // @ts-ignore
92
- [selected,];
93
- __VLS_asFunctionalElement(__VLS_elements.svg, __VLS_elements.svg)({
94
- ...{ class: "w-4 h-4 text-chat-haze-500" },
95
- fill: "none",
96
- stroke: "currentColor",
97
- viewBox: "0 0 20 20",
98
- });
99
- __VLS_asFunctionalElement(__VLS_elements.path)({
100
- 'stroke-linecap': "round",
101
- 'stroke-linejoin': "round",
102
- 'stroke-width': "2",
103
- d: "M5 7l5 5 5-5",
104
- });
105
- if (__VLS_ctx.open) {
106
- // @ts-ignore
107
- [open,];
108
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
109
- ...{ class: "absolute z-10 bg-white border shadow-lg rounded-xl mt-4 w-40 max-h-52 overflow-auto border border-chat-haze-200" },
110
- });
111
- for (const [c] of __VLS_getVForSourceType((__VLS_ctx.countries))) {
112
- // @ts-ignore
113
- [countries,];
114
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
115
- ...{ onClick: (...[$event]) => {
116
- if (!(__VLS_ctx.open))
117
- return;
118
- __VLS_ctx.select(c);
119
- // @ts-ignore
120
- [select,];
121
- } },
122
- key: (c.code),
123
- ...{ class: "flex items-center gap-2 px-3 py-2 hover:bg-gray-100 cursor-pointer" },
124
- });
125
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
126
- (c.flag);
127
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
128
- ...{ class: "text-sm" },
129
- });
130
- (c.dial);
131
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({
132
- ...{ class: "text-xs text-chat-haze-500 ml-auto" },
133
- });
134
- (c.code);
135
- }
136
- }
137
- __VLS_asFunctionalElement(__VLS_elements.input)({
138
- ...{ onInput: (__VLS_ctx.handleInput) },
139
- ...{ onKeyup: (__VLS_ctx.onSubmit) },
140
- ...{ class: "!outline-none" },
141
- type: "tel",
142
- maxlength: (10),
143
- placeholder: "Enter phone number",
144
- });
145
- (__VLS_ctx.phoneValue);
146
- // @ts-ignore
147
- [handleInput, onSubmit, phoneValue,];
148
- if (__VLS_ctx.error) {
149
- // @ts-ignore
150
- [error,];
151
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
152
- ...{ class: "mt-2 ml-1 text-sm text-chat-error flex items-center gap-1" },
153
- });
154
- __VLS_asFunctionalElement(__VLS_elements.svg, __VLS_elements.svg)({
155
- ...{ class: "w-4 h-4" },
156
- fill: "none",
157
- stroke: "currentColor",
158
- viewBox: "0 0 24 24",
159
- });
160
- __VLS_asFunctionalElement(__VLS_elements.path)({
161
- 'stroke-linecap': "round",
162
- 'stroke-linejoin': "round",
163
- 'stroke-width': "2",
164
- d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.662 1.732-3L13.732 4c-.77-1.338-2.694-1.338-3.464 0L4.34 16c-.77 1.338.192 3 1.732 3z",
165
- });
166
- (__VLS_ctx.error);
167
- // @ts-ignore
168
- [error,];
169
- }
170
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
171
- ...{ onClick: (__VLS_ctx.onSubmit) },
172
- ...{ class: "mt-4 w-full bg-chat-primary text-white p-2 rounded-lg hover:bg-blue-700" },
173
- });
174
- // @ts-ignore
175
- [onSubmit,];
176
- if (__VLS_ctx.loading) {
177
- // @ts-ignore
178
- [loading,];
179
- /** @type {[typeof CSpin, typeof CSpin, ]} */ ;
180
- // @ts-ignore
181
- const __VLS_0 = __VLS_asFunctionalComponent(CSpin, new CSpin({
182
- size: (30),
183
- }));
184
- const __VLS_1 = __VLS_0({
185
- size: (30),
186
- }, ...__VLS_functionalComponentArgsRest(__VLS_0));
187
- }
188
- else {
189
- __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
190
- }
191
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
192
- /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
193
- /** @type {__VLS_StyleScopedClasses['w-[700px]']} */ ;
194
- /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
195
- /** @type {__VLS_StyleScopedClasses['mx-auto']} */ ;
196
- /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
197
- /** @type {__VLS_StyleScopedClasses['pb-40']} */ ;
198
- /** @type {__VLS_StyleScopedClasses['text-[28px]']} */ ;
199
- /** @type {__VLS_StyleScopedClasses['font-medium']} */ ;
200
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-700']} */ ;
201
- /** @type {__VLS_StyleScopedClasses['mb-1']} */ ;
202
- /** @type {__VLS_StyleScopedClasses['block']} */ ;
203
- /** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
204
- /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
205
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
206
- /** @type {__VLS_StyleScopedClasses['mb-4']} */ ;
207
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
208
- /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
209
- /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
210
- /** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
211
- /** @type {__VLS_StyleScopedClasses['border']} */ ;
212
- /** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
213
- /** @type {__VLS_StyleScopedClasses['p-2']} */ ;
214
- /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
215
- /** @type {__VLS_StyleScopedClasses['shadow-md']} */ ;
216
- /** @type {__VLS_StyleScopedClasses['relative']} */ ;
217
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
218
- /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
219
- /** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
220
- /** @type {__VLS_StyleScopedClasses['px-2']} */ ;
221
- /** @type {__VLS_StyleScopedClasses['py-1']} */ ;
222
- /** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
223
- /** @type {__VLS_StyleScopedClasses['hover:bg-gray-100']} */ ;
224
- /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
225
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-700']} */ ;
226
- /** @type {__VLS_StyleScopedClasses['w-4']} */ ;
227
- /** @type {__VLS_StyleScopedClasses['h-4']} */ ;
228
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-500']} */ ;
229
- /** @type {__VLS_StyleScopedClasses['absolute']} */ ;
230
- /** @type {__VLS_StyleScopedClasses['z-10']} */ ;
231
- /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
232
- /** @type {__VLS_StyleScopedClasses['border']} */ ;
233
- /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
234
- /** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
235
- /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
236
- /** @type {__VLS_StyleScopedClasses['w-40']} */ ;
237
- /** @type {__VLS_StyleScopedClasses['max-h-52']} */ ;
238
- /** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
239
- /** @type {__VLS_StyleScopedClasses['border']} */ ;
240
- /** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
241
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
242
- /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
243
- /** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
244
- /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
245
- /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
246
- /** @type {__VLS_StyleScopedClasses['hover:bg-gray-100']} */ ;
247
- /** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
248
- /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
249
- /** @type {__VLS_StyleScopedClasses['text-xs']} */ ;
250
- /** @type {__VLS_StyleScopedClasses['text-chat-haze-500']} */ ;
251
- /** @type {__VLS_StyleScopedClasses['ml-auto']} */ ;
252
- /** @type {__VLS_StyleScopedClasses['!outline-none']} */ ;
253
- /** @type {__VLS_StyleScopedClasses['mt-2']} */ ;
254
- /** @type {__VLS_StyleScopedClasses['ml-1']} */ ;
255
- /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
256
- /** @type {__VLS_StyleScopedClasses['text-chat-error']} */ ;
257
- /** @type {__VLS_StyleScopedClasses['flex']} */ ;
258
- /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
259
- /** @type {__VLS_StyleScopedClasses['gap-1']} */ ;
260
- /** @type {__VLS_StyleScopedClasses['w-4']} */ ;
261
- /** @type {__VLS_StyleScopedClasses['h-4']} */ ;
262
- /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
263
- /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
264
- /** @type {__VLS_StyleScopedClasses['bg-chat-primary']} */ ;
265
- /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
266
- /** @type {__VLS_StyleScopedClasses['p-2']} */ ;
267
- /** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
268
- /** @type {__VLS_StyleScopedClasses['hover:bg-blue-700']} */ ;
269
- const __VLS_export = (await import('vue')).defineComponent({});
270
- export default {};
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;