@phonghq/go-chat 1.0.49 → 1.0.51

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.
@@ -73,8 +73,8 @@ const handleFileUpload = () => {
73
73
  };
74
74
  const onSelectEmoji = (value) => {
75
75
  keyword.value = (keyword.value ?? '') + (value?.i?.replace('undefined', '') ?? '');
76
- emojiOpen.value = false;
77
- chatInputRef.value?.focus?.();
76
+ // emojiOpen.value = false
77
+ // chatInputRef.value?.focus?.()
78
78
  };
79
79
  const handleActivePlivoSmsChange = async (is_active) => {
80
80
  try {
@@ -149,7 +149,7 @@ __VLS_asFunctionalElement(__VLS_elements.textarea)({
149
149
  // @ts-ignore
150
150
  [setInputHeight,];
151
151
  } },
152
- ...{ class: "text-[14px] sm:text-base w-full min-h-11 overflow-hidden chat-input !rounded-xl pl-4 py-2 pr-[96px] border border-chat-haze-200" },
152
+ ...{ class: "text-[14px] sm:text-base w-full min-h-11 overflow-hidden chat-input !rounded-xl px-4 py-2 border border-chat-haze-200" },
153
153
  ref: "chatInputRef",
154
154
  rows: "1",
155
155
  placeholder: "Send Message",
@@ -161,82 +161,92 @@ __VLS_asFunctionalElement(__VLS_elements.textarea)({
161
161
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
162
162
  ...{ class: "flex gap-2 -translate-y-2" },
163
163
  });
164
- /** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
165
- // @ts-ignore
166
- const __VLS_0 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
167
- open: (__VLS_ctx.emojiOpen),
168
- align: "end",
169
- side: "top",
170
- }));
171
- const __VLS_1 = __VLS_0({
172
- open: (__VLS_ctx.emojiOpen),
173
- align: "end",
174
- side: "top",
175
- }, ...__VLS_functionalComponentArgsRest(__VLS_0));
176
- const { default: __VLS_3 } = __VLS_2.slots;
177
- // @ts-ignore
178
- [emojiOpen,];
179
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
180
- ...{ onClick: (...[$event]) => {
181
- __VLS_ctx.emojiOpen = !__VLS_ctx.emojiOpen;
182
- // @ts-ignore
183
- [emojiOpen, emojiOpen,];
184
- } },
185
- ...{ class: "h-11 w-8" },
186
- });
187
- {
188
- const { content: __VLS_4 } = __VLS_2.slots;
189
- const __VLS_5 = {}.EmojiPicker;
164
+ if (!__VLS_ctx.dataProfile?.is_sms_active) {
165
+ // @ts-ignore
166
+ [dataProfile,];
167
+ /** @type {[typeof PopoverBase, typeof PopoverBase, ]} */ ;
168
+ // @ts-ignore
169
+ const __VLS_0 = __VLS_asFunctionalComponent(PopoverBase, new PopoverBase({
170
+ open: (__VLS_ctx.emojiOpen),
171
+ align: "end",
172
+ side: "top",
173
+ }));
174
+ const __VLS_1 = __VLS_0({
175
+ open: (__VLS_ctx.emojiOpen),
176
+ align: "end",
177
+ side: "top",
178
+ }, ...__VLS_functionalComponentArgsRest(__VLS_0));
179
+ const { default: __VLS_3 } = __VLS_2.slots;
180
+ // @ts-ignore
181
+ [emojiOpen,];
182
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
183
+ ...{ onClick: (...[$event]) => {
184
+ if (!(!__VLS_ctx.dataProfile?.is_sms_active))
185
+ return;
186
+ __VLS_ctx.emojiOpen = !__VLS_ctx.emojiOpen;
187
+ // @ts-ignore
188
+ [emojiOpen, emojiOpen,];
189
+ } },
190
+ ...{ class: "h-11 w-8" },
191
+ });
192
+ {
193
+ const { content: __VLS_4 } = __VLS_2.slots;
194
+ const __VLS_5 = {}.EmojiPicker;
195
+ /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
196
+ // @ts-ignore
197
+ EmojiPicker;
198
+ // @ts-ignore
199
+ const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
200
+ ...{ 'onSelect': {} },
201
+ ...{ class: "!w-[300px]" },
202
+ native: (true),
203
+ offset: (2),
204
+ hideSearch: true,
205
+ }));
206
+ const __VLS_7 = __VLS_6({
207
+ ...{ 'onSelect': {} },
208
+ ...{ class: "!w-[300px]" },
209
+ native: (true),
210
+ offset: (2),
211
+ hideSearch: true,
212
+ }, ...__VLS_functionalComponentArgsRest(__VLS_6));
213
+ let __VLS_9;
214
+ let __VLS_10;
215
+ const __VLS_11 = ({ select: {} },
216
+ { onSelect: (__VLS_ctx.onSelectEmoji) });
217
+ // @ts-ignore
218
+ [onSelectEmoji,];
219
+ var __VLS_8;
220
+ }
221
+ var __VLS_2;
222
+ }
223
+ if (!__VLS_ctx.dataProfile?.is_sms_active) {
224
+ // @ts-ignore
225
+ [dataProfile,];
226
+ const __VLS_13 = {}.EmojiPicker;
190
227
  /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
191
228
  // @ts-ignore
192
229
  EmojiPicker;
193
230
  // @ts-ignore
194
- const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
195
- ...{ 'onSelect': {} },
196
- ...{ class: "!w-[300px]" },
231
+ const __VLS_14 = __VLS_asFunctionalComponent(__VLS_13, new __VLS_13({
232
+ ...{ class: "opacity-0 pointer-events-none absolute" },
197
233
  native: (true),
198
234
  offset: (2),
199
235
  hideSearch: true,
200
236
  }));
201
- const __VLS_7 = __VLS_6({
202
- ...{ 'onSelect': {} },
203
- ...{ class: "!w-[300px]" },
237
+ const __VLS_15 = __VLS_14({
238
+ ...{ class: "opacity-0 pointer-events-none absolute" },
204
239
  native: (true),
205
240
  offset: (2),
206
241
  hideSearch: true,
207
- }, ...__VLS_functionalComponentArgsRest(__VLS_6));
208
- let __VLS_9;
209
- let __VLS_10;
210
- const __VLS_11 = ({ select: {} },
211
- { onSelect: (__VLS_ctx.onSelectEmoji) });
212
- // @ts-ignore
213
- [onSelectEmoji,];
214
- var __VLS_8;
242
+ }, ...__VLS_functionalComponentArgsRest(__VLS_14));
215
243
  }
216
- var __VLS_2;
217
- const __VLS_13 = {}.EmojiPicker;
218
- /** @type {[typeof __VLS_components.EmojiPicker, typeof __VLS_components.emojiPicker, ]} */ ;
219
- // @ts-ignore
220
- EmojiPicker;
221
- // @ts-ignore
222
- const __VLS_14 = __VLS_asFunctionalComponent(__VLS_13, new __VLS_13({
223
- ...{ class: "opacity-0 pointer-events-none absolute" },
224
- native: (true),
225
- offset: (2),
226
- hideSearch: true,
227
- }));
228
- const __VLS_15 = __VLS_14({
229
- ...{ class: "opacity-0 pointer-events-none absolute" },
230
- native: (true),
231
- offset: (2),
232
- hideSearch: true,
233
- }, ...__VLS_functionalComponentArgsRest(__VLS_14));
234
244
  __VLS_asFunctionalElement(__VLS_elements.label, __VLS_elements.label)({
235
245
  ...{ class: "cursor-pointer relative" },
236
246
  });
237
- __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (!(__VLS_ctx.keyword != '' && __VLS_ctx.responsive == 'mobile')) }, null, null);
247
+ __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (!(__VLS_ctx.keyword != '' && __VLS_ctx.responsive == 'mobile') && !__VLS_ctx.dataProfile?.is_sms_active) }, null, null);
238
248
  // @ts-ignore
239
- [keyword, responsive,];
249
+ [keyword, dataProfile, responsive,];
240
250
  __VLS_asFunctionalElement(__VLS_elements.input)({
241
251
  ...{ onChange: (__VLS_ctx.handleFileUpload) },
242
252
  type: "file",
@@ -296,9 +306,8 @@ const __VLS_19 = __VLS_18({
296
306
  /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
297
307
  /** @type {__VLS_StyleScopedClasses['chat-input']} */ ;
298
308
  /** @type {__VLS_StyleScopedClasses['!rounded-xl']} */ ;
299
- /** @type {__VLS_StyleScopedClasses['pl-4']} */ ;
309
+ /** @type {__VLS_StyleScopedClasses['px-4']} */ ;
300
310
  /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
301
- /** @type {__VLS_StyleScopedClasses['pr-[96px]']} */ ;
302
311
  /** @type {__VLS_StyleScopedClasses['border']} */ ;
303
312
  /** @type {__VLS_StyleScopedClasses['border-chat-haze-200']} */ ;
304
313
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -61,17 +61,17 @@ if (__VLS_ctx.responsive != 'window') {
61
61
  // @ts-ignore
62
62
  const __VLS_7 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCustom({
63
63
  ref: "drawerVisibleRef",
64
- width: (500),
64
+ responsive: (__VLS_ctx.responsive),
65
65
  }));
66
66
  const __VLS_8 = __VLS_7({
67
67
  ref: "drawerVisibleRef",
68
- width: (500),
68
+ responsive: (__VLS_ctx.responsive),
69
69
  }, ...__VLS_functionalComponentArgsRest(__VLS_7));
70
70
  /** @type {typeof __VLS_ctx.drawerVisibleRef} */ ;
71
71
  var __VLS_10 = {};
72
72
  const { default: __VLS_12 } = __VLS_9.slots;
73
73
  // @ts-ignore
74
- [drawerVisibleRef,];
74
+ [responsive, drawerVisibleRef,];
75
75
  {
76
76
  const { content: __VLS_13 } = __VLS_9.slots;
77
77
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
@@ -111,9 +111,7 @@ function endCall(option) {
111
111
  drawerVisible.value = false;
112
112
  drawerVisibleRef.value?.close();
113
113
  }
114
- else {
115
- handleEmitEndCall(userRemoter.value, callType);
116
- }
114
+ handleEmitEndCall(userRemoter.value, callType);
117
115
  plivoEndCall(callStatus.value);
118
116
  callStatus.value = PLIVO_CALL_STATUS.CALL_END;
119
117
  clearInterval(timer);
@@ -131,7 +129,6 @@ const handleEmitEndCall = useDebounce((data, type) => {
131
129
  }, 500);
132
130
  const refreshToken = async () => {
133
131
  try {
134
- console.log('refreshToken: ');
135
132
  if (refreshTokenTimeOut) {
136
133
  clearTimeout(refreshTokenTimeOut);
137
134
  refreshTokenTimeOut = null;
@@ -144,7 +141,6 @@ const refreshToken = async () => {
144
141
  catch (e) {
145
142
  console.log(e);
146
143
  refreshTokenCount = refreshTokenCount + 1;
147
- console.log(refreshTokenCount);
148
144
  if (refreshTokenCount < 3) {
149
145
  setTimeout(() => refreshToken(), 60 * 1000);
150
146
  }
@@ -198,11 +194,11 @@ const getUserOffer = async (phone) => {
198
194
  let res = null;
199
195
  try {
200
196
  userRemoter.value = { phone, username: '' };
197
+ emit('userCalling', userRemoter.value);
201
198
  let data = {
202
199
  phone: formatPhone10number(phone, '1'),
203
200
  client_id: dataProfile.value?.tenant_id ?? ''
204
201
  };
205
- console.log(data);
206
202
  res = await getUserDetailChat(data);
207
203
  }
208
204
  catch (e) {
@@ -213,7 +209,9 @@ const getUserOffer = async (phone) => {
213
209
  phone: res?.phone ? '1' + res?.phone : phone
214
210
  };
215
211
  userRemoter.value = user;
216
- emit('userCalling', userRemoter.value);
212
+ if (callStatus.value !== PLIVO_CALL_STATUS.CALL_END) {
213
+ emit('userCalling', userRemoter.value);
214
+ }
217
215
  };
218
216
  // const handleMqttMessage = async (message: any) => {
219
217
  // console.log(message)
@@ -296,6 +294,7 @@ const __VLS_0 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCust
296
294
  width: (500),
297
295
  disabledClose: (__VLS_ctx.disable),
298
296
  responsive: (__VLS_ctx.responsive),
297
+ index: (1501),
299
298
  absolute: true,
300
299
  }));
301
300
  const __VLS_1 = __VLS_0({
@@ -304,6 +303,7 @@ const __VLS_1 = __VLS_0({
304
303
  width: (500),
305
304
  disabledClose: (__VLS_ctx.disable),
306
305
  responsive: (__VLS_ctx.responsive),
306
+ index: (1501),
307
307
  absolute: true,
308
308
  }, ...__VLS_functionalComponentArgsRest(__VLS_0));
309
309
  let __VLS_3;
@@ -3,7 +3,8 @@ import { computed, ref } from 'vue';
3
3
  const props = withDefaults(defineProps(), {
4
4
  position: 'right',
5
5
  showTitle: true,
6
- width: 550
6
+ width: 550,
7
+ index: 1500
7
8
  });
8
9
  const emits = defineEmits();
9
10
  const show = ref(false);
@@ -38,7 +39,8 @@ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
38
39
  const __VLS_defaults = {
39
40
  position: 'right',
40
41
  showTitle: true,
41
- width: 550
42
+ width: 550,
43
+ index: 1500
42
44
  };
43
45
  const __VLS_ctx = {
44
46
  ...{},
@@ -52,11 +54,12 @@ let __VLS_components;
52
54
  let __VLS_directives;
53
55
  /** @type {__VLS_StyleScopedClasses['drawer-box']} */ ;
54
56
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
55
- ...{ class: "top-0 bottom-0 right-0 left-0 z-[1500] drawer" },
57
+ ...{ class: "top-0 bottom-0 right-0 left-0 drawer" },
56
58
  ...{ class: ({ 'opacity-1': __VLS_ctx.show, 'pointer-events-none opacity-0 delay-300': !__VLS_ctx.show, 'absolute': __VLS_ctx.absolute, 'fixed': !__VLS_ctx.absolute }) },
59
+ ...{ style: ({ zIndex: __VLS_ctx.index }) },
57
60
  });
58
61
  // @ts-ignore
59
- [show, show, absolute, absolute,];
62
+ [show, show, absolute, absolute, index,];
60
63
  if (!__VLS_ctx.disabledClose) {
61
64
  // @ts-ignore
62
65
  [disabledClose,];
@@ -89,7 +92,6 @@ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({});
89
92
  /** @type {__VLS_StyleScopedClasses['bottom-0']} */ ;
90
93
  /** @type {__VLS_StyleScopedClasses['right-0']} */ ;
91
94
  /** @type {__VLS_StyleScopedClasses['left-0']} */ ;
92
- /** @type {__VLS_StyleScopedClasses['z-[1500]']} */ ;
93
95
  /** @type {__VLS_StyleScopedClasses['drawer']} */ ;
94
96
  /** @type {__VLS_StyleScopedClasses['opacity-1']} */ ;
95
97
  /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
@@ -102,7 +102,7 @@ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
102
102
  ...{ class: "w-[480px] h-full flex flex-col" },
103
103
  });
104
104
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
105
- ...{ class: "flex items-center justify-between border-chat-gray-5 layout-shadow border-b px-2 sm:px-6" },
105
+ ...{ class: "w-full flex items-center justify-between border-chat-gray-5 layout-shadow border-b px-2 sm:px-6" },
106
106
  });
107
107
  if (__VLS_ctx.responsive != 'window') {
108
108
  // @ts-ignore
@@ -115,16 +115,19 @@ if (__VLS_ctx.responsive != 'window') {
115
115
  // @ts-ignore
116
116
  [emit,];
117
117
  } },
118
- ...{ class: "flex justify-center w-14" },
118
+ ...{ class: "shrink-0 flex justify-center w-14" },
119
119
  });
120
120
  /** @type {[typeof IconArrowLeft, ]} */ ;
121
121
  // @ts-ignore
122
122
  const __VLS_0 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
123
123
  const __VLS_1 = __VLS_0({}, ...__VLS_functionalComponentArgsRest(__VLS_0));
124
124
  }
125
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
126
+ ...{ class: "h-[80px] sm:h-[96px] grow" },
127
+ });
125
128
  __VLS_asFunctionalElement(__VLS_elements.input)({
126
129
  ...{ onInput: (__VLS_ctx.handleInput) },
127
- ...{ class: "py-2 h-[80px] sm:h-[96px] text-xl grow" },
130
+ ...{ class: "py-2 w-full h-full text-xl" },
128
131
  placeholder: "Enter your phone number",
129
132
  disabled: (__VLS_ctx.dataProfile?.user_type != 'tenant'),
130
133
  });
@@ -138,7 +141,9 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
138
141
  [call,];
139
142
  } },
140
143
  ...{ class: "shrink-0 h-14 w-14 rounded-full flex-center bg-[#C7DEFF] text-chat-primary" },
141
- ...{ class: ({ 'cursor-not-allowed opacity-[0.3] pointer-events-none': __VLS_ctx.keepOnlyNumber(__VLS_ctx.phone ?? '').length < 10 }) },
144
+ ...{ class: ({
145
+ 'cursor-not-allowed opacity-[0.3] pointer-events-none': __VLS_ctx.keepOnlyNumber(__VLS_ctx.phone ?? '').length < 10
146
+ }) },
142
147
  });
143
148
  // @ts-ignore
144
149
  [phone, keepOnlyNumber,];
@@ -217,6 +222,7 @@ if (!__VLS_ctx.hideNumpad) {
217
222
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
218
223
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
219
224
  /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
225
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
220
226
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
221
227
  /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
222
228
  /** @type {__VLS_StyleScopedClasses['justify-between']} */ ;
@@ -225,14 +231,17 @@ if (!__VLS_ctx.hideNumpad) {
225
231
  /** @type {__VLS_StyleScopedClasses['border-b']} */ ;
226
232
  /** @type {__VLS_StyleScopedClasses['px-2']} */ ;
227
233
  /** @type {__VLS_StyleScopedClasses['sm:px-6']} */ ;
234
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
228
235
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
229
236
  /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
230
237
  /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
231
- /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
232
238
  /** @type {__VLS_StyleScopedClasses['h-[80px]']} */ ;
233
239
  /** @type {__VLS_StyleScopedClasses['sm:h-[96px]']} */ ;
234
- /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
235
240
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
241
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
242
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
243
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
244
+ /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
236
245
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
237
246
  /** @type {__VLS_StyleScopedClasses['h-14']} */ ;
238
247
  /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
@@ -46,5 +46,7 @@ export type IUploadFile = {
46
46
  path: string;
47
47
  url: string;
48
48
  delete_url: string;
49
+ error: boolean;
50
+ errors: string;
49
51
  };
50
52
  export type MessageStateType = typeof MessageState[keyof typeof MessageState];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"
package/.env.example DELETED
@@ -1,7 +0,0 @@
1
- VITE_API_KEY=
2
- VITE_API_SECRET_KEY=
3
- VITE_DOMAIN=
4
- VITE_GCLIENT_ID=
5
- VITE_TOKEN=
6
- VITE_VERSION=
7
- VITE_BUILD=