@phonghq/go-chat 1.0.46 → 1.0.48

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.
@@ -0,0 +1,275 @@
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 IconBackspace from '../../../assets/icons/global/IconBackspace.vue';
4
+ import IconPhoneBase from '../../../assets/icons/call/IconPhoneBase.vue';
5
+ import { phoneNumberFormat, phoneNumberFormatInput } from '../../../utils/string-helper';
6
+ import { useDebounce } from '../../../utils/debounce';
7
+ import ConversationList from '../../../views/home/phone-numpad/ConvercationList.vue';
8
+ import { dataProfile } from '../../../utils/chat/store/auth';
9
+ import IconArrowLeft from '../../../assets/icons/global/IconArrowLeft.vue';
10
+ const props = withDefaults(defineProps(), {});
11
+ const emit = defineEmits();
12
+ const phone = defineModel();
13
+ const keys = [
14
+ { label: '1', value: '1' },
15
+ { label: '2', value: '2' },
16
+ { label: '3', value: '3' },
17
+ { label: '4', value: '4' },
18
+ { label: '5', value: '5' },
19
+ { label: '6', value: '6' },
20
+ { label: '7', value: '7' },
21
+ { label: '8', value: '8' },
22
+ { label: '9', value: '9' },
23
+ { label: 'C', value: 'Delete' },
24
+ { label: '0', value: '0' },
25
+ { label: 'X', value: 'Backspace' }
26
+ ];
27
+ const activeKey = ref(null);
28
+ const activeUser = ref(null);
29
+ const conversationListRef = ref();
30
+ const handleKey = (key) => {
31
+ if (props.disabled)
32
+ return;
33
+ if (dataProfile.value?.user_type != 'tenant')
34
+ return;
35
+ activeKey.value = key.value == 'Backspace' ? null : key.value;
36
+ setTimeout(() => {
37
+ activeKey.value = null;
38
+ }, 80);
39
+ let newValue = keepOnlyNumber(phone.value ?? '');
40
+ if (key.value === 'Backspace') {
41
+ newValue = newValue.slice(0, -1);
42
+ }
43
+ else if (key.value === 'Delete') {
44
+ newValue = '';
45
+ }
46
+ else {
47
+ newValue += key.value;
48
+ }
49
+ phone.value = phoneNumberFormatInput(newValue);
50
+ handleGetListKeyPad();
51
+ emit('change', newValue);
52
+ };
53
+ const handleInput = () => {
54
+ phone.value = phoneNumberFormatInput(phone.value ?? '');
55
+ handleGetListInput();
56
+ };
57
+ function keepOnlyNumber(value) {
58
+ return value.replace(/\D+/g, '');
59
+ }
60
+ const handleGetListKeyPad = useDebounce(() => conversationListRef.value?.getUserList(keepOnlyNumber(phone.value ?? ''), { reset: true }), 800);
61
+ const handleGetListInput = useDebounce(() => conversationListRef.value?.getUserList(keepOnlyNumber(phone.value ?? ''), { reset: true }), 300);
62
+ const call = () => {
63
+ if (phone)
64
+ conversationListRef.value?.checkActiveUserList();
65
+ let value = keepOnlyNumber(phone.value ?? '');
66
+ let user = {
67
+ phone: activeUser.value?.phone || '1' + value,
68
+ username: activeUser.value?.username ?? '',
69
+ avatar: activeUser.value?.avatar ?? '',
70
+ color: activeUser.value?.color ?? '',
71
+ is_unknown: activeUser.value?.is_unknown
72
+ };
73
+ if (value.length == 10) {
74
+ emit('call', user);
75
+ }
76
+ else {
77
+ // if (phone.value) Snackbar.error({ message: 'Phone number is invalid!' })
78
+ }
79
+ };
80
+ const reset = () => {
81
+ phone.value = '';
82
+ };
83
+ const handleSelectConversation = (item) => {
84
+ phone.value = phoneNumberFormat(item.phone ?? '');
85
+ };
86
+ const __VLS_exposed = { reset };
87
+ defineExpose(__VLS_exposed);
88
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
89
+ const __VLS_modelEmit = defineEmits();
90
+ const __VLS_defaults = {};
91
+ const __VLS_ctx = {
92
+ ...{},
93
+ ...{},
94
+ ...{},
95
+ ...{},
96
+ ...{},
97
+ };
98
+ let __VLS_elements;
99
+ let __VLS_components;
100
+ let __VLS_directives;
101
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
102
+ ...{ class: "w-[480px] h-full flex flex-col" },
103
+ });
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" },
106
+ });
107
+ if (__VLS_ctx.responsive != 'window') {
108
+ // @ts-ignore
109
+ [responsive,];
110
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
111
+ ...{ onClick: (...[$event]) => {
112
+ if (!(__VLS_ctx.responsive != 'window'))
113
+ return;
114
+ __VLS_ctx.emit('back');
115
+ // @ts-ignore
116
+ [emit,];
117
+ } },
118
+ ...{ class: "flex justify-center w-14" },
119
+ });
120
+ /** @type {[typeof IconArrowLeft, ]} */ ;
121
+ // @ts-ignore
122
+ const __VLS_0 = __VLS_asFunctionalComponent(IconArrowLeft, new IconArrowLeft({}));
123
+ const __VLS_1 = __VLS_0({}, ...__VLS_functionalComponentArgsRest(__VLS_0));
124
+ }
125
+ __VLS_asFunctionalElement(__VLS_elements.input)({
126
+ ...{ onInput: (__VLS_ctx.handleInput) },
127
+ ...{ class: "py-2 h-[80px] sm:h-[96px] text-xl grow" },
128
+ placeholder: "Enter your phone number",
129
+ disabled: (__VLS_ctx.dataProfile?.user_type != 'tenant'),
130
+ });
131
+ (__VLS_ctx.phone);
132
+ // @ts-ignore
133
+ [handleInput, dataProfile, phone,];
134
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
135
+ ...{ onClick: (...[$event]) => {
136
+ __VLS_ctx.call();
137
+ // @ts-ignore
138
+ [call,];
139
+ } },
140
+ ...{ 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 }) },
142
+ });
143
+ // @ts-ignore
144
+ [phone, keepOnlyNumber,];
145
+ /** @type {[typeof IconPhoneBase, ]} */ ;
146
+ // @ts-ignore
147
+ const __VLS_4 = __VLS_asFunctionalComponent(IconPhoneBase, new IconPhoneBase({}));
148
+ const __VLS_5 = __VLS_4({}, ...__VLS_functionalComponentArgsRest(__VLS_4));
149
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
150
+ ...{ class: "grow overflow-hidden relative" },
151
+ });
152
+ /** @type {[typeof ConversationList, ]} */ ;
153
+ // @ts-ignore
154
+ const __VLS_8 = __VLS_asFunctionalComponent(ConversationList, new ConversationList({
155
+ ...{ 'onSelectConversation': {} },
156
+ ref: "conversationListRef",
157
+ active: (__VLS_ctx.activeUser),
158
+ }));
159
+ const __VLS_9 = __VLS_8({
160
+ ...{ 'onSelectConversation': {} },
161
+ ref: "conversationListRef",
162
+ active: (__VLS_ctx.activeUser),
163
+ }, ...__VLS_functionalComponentArgsRest(__VLS_8));
164
+ let __VLS_11;
165
+ let __VLS_12;
166
+ const __VLS_13 = ({ selectConversation: {} },
167
+ { onSelectConversation: (__VLS_ctx.handleSelectConversation) });
168
+ /** @type {typeof __VLS_ctx.conversationListRef} */ ;
169
+ var __VLS_14 = {};
170
+ // @ts-ignore
171
+ [activeUser, handleSelectConversation, conversationListRef,];
172
+ var __VLS_10;
173
+ if (!__VLS_ctx.hideNumpad) {
174
+ // @ts-ignore
175
+ [hideNumpad,];
176
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
177
+ ...{ class: "shrink-0 grid grid-cols-3 w-full h-[400px] sm:h-[500px] px-6 border-chat-gray-5 layout-shadow border-t" },
178
+ });
179
+ for (const [item] of __VLS_getVForSourceType((__VLS_ctx.keys))) {
180
+ // @ts-ignore
181
+ [keys,];
182
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
183
+ ...{ onClick: (...[$event]) => {
184
+ if (!(!__VLS_ctx.hideNumpad))
185
+ return;
186
+ __VLS_ctx.handleKey(item);
187
+ // @ts-ignore
188
+ [handleKey,];
189
+ } },
190
+ ...{ class: "text-3xl sm:text-[40px] flex-center rounded-lg" },
191
+ ...{ class: ({
192
+ 'bg-chat-haze-200': false,
193
+ 'opacity-[0.6] cursor-not-allowed': __VLS_ctx.dataProfile?.user_type != 'tenant'
194
+ }) },
195
+ key: (item.value),
196
+ });
197
+ // @ts-ignore
198
+ [dataProfile,];
199
+ if (item.label !== 'X') {
200
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
201
+ (item.label);
202
+ }
203
+ else {
204
+ __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
205
+ /** @type {[typeof IconBackspace, ]} */ ;
206
+ // @ts-ignore
207
+ const __VLS_17 = __VLS_asFunctionalComponent(IconBackspace, new IconBackspace({
208
+ ...{ class: "w-14" },
209
+ }));
210
+ const __VLS_18 = __VLS_17({
211
+ ...{ class: "w-14" },
212
+ }, ...__VLS_functionalComponentArgsRest(__VLS_17));
213
+ }
214
+ }
215
+ }
216
+ /** @type {__VLS_StyleScopedClasses['w-[480px]']} */ ;
217
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
218
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
219
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
220
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
221
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
222
+ /** @type {__VLS_StyleScopedClasses['justify-between']} */ ;
223
+ /** @type {__VLS_StyleScopedClasses['border-chat-gray-5']} */ ;
224
+ /** @type {__VLS_StyleScopedClasses['layout-shadow']} */ ;
225
+ /** @type {__VLS_StyleScopedClasses['border-b']} */ ;
226
+ /** @type {__VLS_StyleScopedClasses['px-2']} */ ;
227
+ /** @type {__VLS_StyleScopedClasses['sm:px-6']} */ ;
228
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
229
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
230
+ /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
231
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
232
+ /** @type {__VLS_StyleScopedClasses['h-[80px]']} */ ;
233
+ /** @type {__VLS_StyleScopedClasses['sm:h-[96px]']} */ ;
234
+ /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
235
+ /** @type {__VLS_StyleScopedClasses['grow']} */ ;
236
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
237
+ /** @type {__VLS_StyleScopedClasses['h-14']} */ ;
238
+ /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
239
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
240
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
241
+ /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
242
+ /** @type {__VLS_StyleScopedClasses['text-chat-primary']} */ ;
243
+ /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
244
+ /** @type {__VLS_StyleScopedClasses['opacity-[0.3]']} */ ;
245
+ /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
246
+ /** @type {__VLS_StyleScopedClasses['grow']} */ ;
247
+ /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
248
+ /** @type {__VLS_StyleScopedClasses['relative']} */ ;
249
+ /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
250
+ /** @type {__VLS_StyleScopedClasses['grid']} */ ;
251
+ /** @type {__VLS_StyleScopedClasses['grid-cols-3']} */ ;
252
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
253
+ /** @type {__VLS_StyleScopedClasses['h-[400px]']} */ ;
254
+ /** @type {__VLS_StyleScopedClasses['sm:h-[500px]']} */ ;
255
+ /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
256
+ /** @type {__VLS_StyleScopedClasses['border-chat-gray-5']} */ ;
257
+ /** @type {__VLS_StyleScopedClasses['layout-shadow']} */ ;
258
+ /** @type {__VLS_StyleScopedClasses['border-t']} */ ;
259
+ /** @type {__VLS_StyleScopedClasses['text-3xl']} */ ;
260
+ /** @type {__VLS_StyleScopedClasses['sm:text-[40px]']} */ ;
261
+ /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
262
+ /** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
263
+ /** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
264
+ /** @type {__VLS_StyleScopedClasses['opacity-[0.6]']} */ ;
265
+ /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
266
+ /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
267
+ // @ts-ignore
268
+ var __VLS_15 = __VLS_14;
269
+ const __VLS_export = (await import('vue')).defineComponent({
270
+ setup: () => (__VLS_exposed),
271
+ __typeEmits: {},
272
+ __typeProps: {},
273
+ props: {},
274
+ });
275
+ export default {};
@@ -9,6 +9,12 @@ export declare const getDetailReceiver: (receiverId: string) => Promise<IResUser
9
9
  export declare const getDetailUser: (id: any) => Promise<IResUser | null>;
10
10
  export declare const readMessages: (conversationId: any) => Promise<import("axios").AxiosResponse<any, any> | undefined>;
11
11
  export declare const sendMessage: (body: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
12
+ export declare const sendMessageSmsTest: (body: {
13
+ from: string;
14
+ to: string;
15
+ host_id: string;
16
+ text: string;
17
+ }) => Promise<import("axios").AxiosResponse<any, any> | undefined>;
12
18
  export declare const getCountUnread: (params: {
13
19
  conversation_id: number;
14
20
  receiver_id: number;
@@ -0,0 +1,18 @@
1
+ import type { IConversation } from '../../../types/conversation';
2
+ type __VLS_ModelProps = {
3
+ 'active'?: IConversation | null;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_ModelProps, {
6
+ getUserList: (phone?: string | undefined, option?: {
7
+ reset?: boolean | undefined;
8
+ } | undefined) => Promise<never[] | undefined>;
9
+ checkActiveUserList: () => void;
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:active": (value: IConversation | null | undefined) => any;
12
+ } & {
13
+ selectConversation: (val: any) => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
15
+ "onUpdate:active"?: ((value: IConversation | null | undefined) => any) | undefined;
16
+ onSelectConversation?: ((val: any) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import type { IResUser } from '../../../types/message';
2
+ import type { PAGE_RESPONSIVE } from '../../../types/chat/global';
3
+ type KeyPadProps = {
4
+ disabled?: boolean;
5
+ hideNumpad?: boolean;
6
+ responsive?: PAGE_RESPONSIVE;
7
+ };
8
+ type __VLS_Props = KeyPadProps;
9
+ type __VLS_ModelProps = {
10
+ modelValue?: string;
11
+ };
12
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
13
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
14
+ reset: () => void;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ "update:modelValue": (value: string | undefined) => any;
17
+ } & {
18
+ change: (value: string) => any;
19
+ "update:modelValue": (value: string) => any;
20
+ call: (value: IResUser) => any;
21
+ back: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ onChange?: ((value: string) => any) | undefined;
24
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
25
+ onCall?: ((value: IResUser) => any) | undefined;
26
+ onBack?: (() => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"