@unsource/ui 2.8.8 → 2.8.11
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/dist/module.json +1 -1
- package/dist/module.mjs +24 -9
- package/dist/runtime/assets/main.css +1 -1
- package/dist/runtime/components/UnAuth.d.vue.ts +2 -2
- package/dist/runtime/components/UnAuth.vue +2 -2
- package/dist/runtime/components/UnAuth.vue.d.ts +2 -2
- package/dist/runtime/components/UnCard.d.vue.ts +16 -14
- package/dist/runtime/components/UnCard.vue +26 -2
- package/dist/runtime/components/UnCard.vue.d.ts +16 -14
- package/dist/runtime/components/UnCheckboxItem.d.vue.ts +1 -5
- package/dist/runtime/components/UnCheckboxItem.vue +4 -5
- package/dist/runtime/components/UnCheckboxItem.vue.d.ts +1 -5
- package/dist/runtime/components/UnCollapsible.d.vue.ts +2 -2
- package/dist/runtime/components/UnCollapsible.vue.d.ts +2 -2
- package/dist/runtime/components/UnFormItem.vue +2 -2
- package/dist/runtime/components/UnFormList.d.vue.ts +1 -1
- package/dist/runtime/components/UnFormList.vue.d.ts +1 -1
- package/dist/runtime/components/UnIRDatePicker.d.vue.ts +1 -1
- package/dist/runtime/components/UnIRDatePicker.vue +1 -2
- package/dist/runtime/components/UnIRDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/UnInput.d.vue.ts +1 -1
- package/dist/runtime/components/UnInput.vue +1 -1
- package/dist/runtime/components/UnInput.vue.d.ts +1 -1
- package/dist/runtime/components/UnLabel.d.vue.ts +13 -13
- package/dist/runtime/components/UnLabel.vue +5 -5
- package/dist/runtime/components/UnLabel.vue.d.ts +13 -13
- package/dist/runtime/components/UnLocationInput.vue +1 -0
- package/dist/runtime/components/UnMap.vue +1 -1
- package/dist/runtime/components/UnMobileHeader.vue +0 -1
- package/dist/runtime/components/UnModal.vue +1 -1
- package/dist/runtime/components/UnMultiUploader.vue +0 -1
- package/dist/runtime/components/UnNavbar.vue +1 -1
- package/dist/runtime/components/UnNormalInput.d.vue.ts +1 -21
- package/dist/runtime/components/UnNormalInput.vue.d.ts +1 -21
- package/dist/runtime/components/UnNumberInput.vue +0 -1
- package/dist/runtime/components/UnNuxtIcon.d.vue.ts +0 -1
- package/dist/runtime/components/UnNuxtIcon.vue +1 -3
- package/dist/runtime/components/UnNuxtIcon.vue.d.ts +0 -1
- package/dist/runtime/components/UnProfile.d.vue.ts +2 -2
- package/dist/runtime/components/UnProfile.vue.d.ts +2 -2
- package/dist/runtime/components/UnRadioItem.d.vue.ts +1 -0
- package/dist/runtime/components/UnRadioItem.vue +8 -7
- package/dist/runtime/components/UnRadioItem.vue.d.ts +1 -0
- package/dist/runtime/components/UnSelect.d.vue.ts +0 -2
- package/dist/runtime/components/UnSelect.vue +2 -4
- package/dist/runtime/components/UnSelect.vue.d.ts +0 -2
- package/dist/runtime/components/UnSwiperControl.vue +0 -4
- package/dist/runtime/components/UnSwiperSlider.d.vue.ts +2 -2
- package/dist/runtime/components/UnSwiperSlider.vue.d.ts +2 -2
- package/dist/runtime/components/UnTransaction.vue +1 -0
- package/dist/runtime/components/UnUploadFile.d.vue.ts +60 -19
- package/dist/runtime/components/UnUploadFile.vue +5 -4
- package/dist/runtime/components/UnUploadFile.vue.d.ts +60 -19
- package/dist/runtime/components/UnWallet.vue +1 -0
- package/dist/runtime/composables/fetch.d.ts +38 -17
- package/dist/runtime/composables/fetch.js +20 -11
- package/dist/runtime/composables/global.d.ts +58 -15
- package/dist/runtime/composables/global.js +11 -30
- package/dist/runtime/composables/reuseable.d.ts +6 -19
- package/dist/runtime/composables/reuseable.js +7 -24
- package/dist/runtime/composables/services.d.ts +2 -2
- package/dist/runtime/composables/services.js +3 -2
- package/dist/runtime/plugins/floating.client.d.ts +3 -0
- package/dist/runtime/plugins/floating.client.js +6 -0
- package/dist/runtime/plugins/toast.client.d.ts +30 -30
- package/dist/runtime/types/models.d.ts +401 -110
- package/package.json +6 -5
- package/dist/runtime/uno.config.d.ts +0 -2
- package/dist/runtime/uno.config.js +0 -60
|
@@ -1,21 +1,25 @@
|
|
|
1
|
+
import type { Socket } from 'socket.io-client';
|
|
1
2
|
import type { CoinGateway, DiscountCode, Form, Transaction, Wallet } from '../types/models.js';
|
|
2
3
|
import type { Address, MetaData, SocketJoinObject } from '../types/app.js';
|
|
3
4
|
import type { RemovableRef } from '@vueuse/core';
|
|
4
5
|
import Moment from 'jalali-moment';
|
|
5
6
|
import Ajv from 'ajv';
|
|
7
|
+
import type { Ref } from '@vue/reactivity';
|
|
8
|
+
import type { DefaultEventsMap } from '@socket.io/component-emitter';
|
|
6
9
|
export declare const moment: typeof Moment;
|
|
7
10
|
export declare const ajv: Ajv;
|
|
8
11
|
export declare const logger: (...args: any) => void;
|
|
9
12
|
export declare const s2n: (string: string | number) => string;
|
|
10
|
-
export declare const sleep: (ms:
|
|
13
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
11
14
|
export declare const geoLink: (location: Location, isIos?: boolean) => string;
|
|
12
|
-
export declare const useComputedRoute: (route:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
export declare const useComputedRoute: (route: {
|
|
16
|
+
query: Record<string, any>;
|
|
17
|
+
}, key: string) => import("vue").WritableComputedRef<any, any>;
|
|
18
|
+
export declare const useComputedLodash: (value: Ref, keys: (string | number)[] | string) => import("vue").WritableComputedRef<any, any>;
|
|
19
|
+
export declare const KMapper: (num: number) => string;
|
|
15
20
|
export declare const p2e: (string: string | number) => string;
|
|
16
21
|
export declare const toLocal: (number: number | string, decimal?: number) => string | number;
|
|
17
22
|
export declare const copyData: (string: string) => Promise<void>;
|
|
18
|
-
export declare const mapper: (data: Record<string, any>, map: Record<string, any>, keys?: string[]) => Record<string, any>;
|
|
19
23
|
export declare const deg2rad: (deg: number) => number;
|
|
20
24
|
export declare const getDistanceFromLatLonInKm: (lat1: number, lon1: number, lat2: number, lon2: number) => number;
|
|
21
25
|
export declare const isoToNormal: (time: string) => string;
|
|
@@ -27,27 +31,66 @@ export declare const isoToDate: (time: string) => string;
|
|
|
27
31
|
export declare const isoToStandard: (time: string) => string;
|
|
28
32
|
export declare const dataToRange: (data: any[] | undefined) => [string, string];
|
|
29
33
|
export declare const subIsoDate: (du: string) => string;
|
|
30
|
-
export declare const isExpire: (time:
|
|
31
|
-
export declare const remainToExpire: (timestamp:
|
|
34
|
+
export declare const isExpire: (time: string) => boolean;
|
|
35
|
+
export declare const remainToExpire: (timestamp: number, time: string) => string[];
|
|
32
36
|
export declare const timeToDurationShort: (timeString?: string) => string;
|
|
33
37
|
export declare const timeToMinutes: (timeString?: string) => number;
|
|
34
38
|
export declare const minutesToTime: (m?: number) => string;
|
|
35
|
-
export declare const useSocketIo: () =>
|
|
36
|
-
export declare const watchSocket: (socket:
|
|
39
|
+
export declare const useSocketIo: () => Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
40
|
+
export declare const watchSocket: (socket: Socket<DefaultEventsMap, DefaultEventsMap>, joinObject: SocketJoinObject, dataHandler: (...args: any[]) => void, loading?: Ref<boolean, boolean>, initHandler?: () => Promise<void>) => void;
|
|
37
41
|
export declare const lastAct: (time: string) => string;
|
|
38
42
|
export declare const setMeta: (data: MetaData) => void;
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const decrypt: (ciphertext: any, passphrase: any) => any;
|
|
41
|
-
export declare const useWallets: (isActive?: boolean | undefined, id?: string) => Promise<RemovableRef<Wallet[]>>;
|
|
43
|
+
export declare const useWallets: (isActive?: boolean | undefined, id?: string | undefined) => Promise<RemovableRef<Wallet[]>>;
|
|
42
44
|
export declare const useGateways: (isActive?: boolean | undefined) => Promise<CoinGateway[]>;
|
|
43
45
|
export declare const getDiscountInfo: (code: string, shop?: {
|
|
44
46
|
categoryKey: string;
|
|
45
47
|
} | null) => Promise<DiscountCode | null>;
|
|
46
48
|
export declare const submitPayment: (amount: number, details?: Partial<Transaction>, giftCode?: undefined, redirect?: boolean) => Promise<Transaction | undefined>;
|
|
47
|
-
export declare const discountedPrice: (price:
|
|
48
|
-
export declare const formattedAddress: ([lng, lat]: Address) => Promise<
|
|
49
|
+
export declare const discountedPrice: (price: number, discount?: DiscountCode | null) => number | object | null | undefined;
|
|
50
|
+
export declare const formattedAddress: ([lng, lat]: Address) => Promise<string>;
|
|
49
51
|
export declare const geoCodingAddress: (address: string, coords: Address) => Promise<unknown>;
|
|
50
|
-
export declare const setOptions: (f: Form, ctx?: {}) => Promise<
|
|
52
|
+
export declare const setOptions: (f: Form, ctx?: {}) => Promise<Form | {
|
|
53
|
+
input: {
|
|
54
|
+
options: any;
|
|
55
|
+
id?: string;
|
|
56
|
+
key: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description?: string | null;
|
|
59
|
+
hint?: string | null;
|
|
60
|
+
type?: "text" | "description" | "switch" | "select" | "number" | "dateTime" | "date" | "time" | "location" | "image" | "file" | "none";
|
|
61
|
+
placeholder?: string | null;
|
|
62
|
+
icon?: string | null;
|
|
63
|
+
append?: string | null;
|
|
64
|
+
extendInput?: import("../types/models.js").Input | null;
|
|
65
|
+
externalOptions?: string | null;
|
|
66
|
+
externalOptionsKeys?: import("../types/models.js").ExternalOptionsKeys | null;
|
|
67
|
+
multiSelect?: boolean | null;
|
|
68
|
+
keyboadType?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url" | null;
|
|
69
|
+
min?: number | object | null;
|
|
70
|
+
max?: number | object | null;
|
|
71
|
+
extendedInputKey?: string | null;
|
|
72
|
+
createdAt?: string | null;
|
|
73
|
+
updatedAt?: string | null;
|
|
74
|
+
forms?: Form[] | object;
|
|
75
|
+
requiredForms?: Form[] | object;
|
|
76
|
+
activatedForms?: Form[] | object;
|
|
77
|
+
filterOptions?: import("../types/models.js").InputOption[] | object;
|
|
78
|
+
extendedInputs?: import("../types/models.js").Input[] | object;
|
|
79
|
+
};
|
|
80
|
+
id?: string;
|
|
81
|
+
name: string;
|
|
82
|
+
priority?: number | object | null;
|
|
83
|
+
required?: boolean;
|
|
84
|
+
requiredby?: string | null;
|
|
85
|
+
activatedByInput?: import("../types/models.js").Input | null;
|
|
86
|
+
activatedByValues?: string[] | object;
|
|
87
|
+
requiredByInput?: import("../types/models.js").Input | null;
|
|
88
|
+
requiredByValues?: string[] | object;
|
|
89
|
+
createdAt?: string | null;
|
|
90
|
+
updatedAt?: string | null;
|
|
91
|
+
activatedBy?: string | null;
|
|
92
|
+
inputId: string;
|
|
93
|
+
}>;
|
|
51
94
|
export declare const merge: (v: string | Record<string, unknown>, s: string | Record<string, unknown>) => string | Record<string, unknown> | undefined;
|
|
52
95
|
export declare const variants: {
|
|
53
96
|
success: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_fromPairs,
|
|
3
3
|
_get,
|
|
4
|
-
_has,
|
|
5
4
|
_mergeWith,
|
|
6
5
|
_set,
|
|
7
6
|
_toPairs,
|
|
@@ -23,6 +22,7 @@ import { useModuleConfig, useToken, useUserId } from "./reuseable.js";
|
|
|
23
22
|
import Moment from "jalali-moment";
|
|
24
23
|
import Handlebars from "handlebars";
|
|
25
24
|
import Ajv from "ajv";
|
|
25
|
+
import Big from "big.js";
|
|
26
26
|
export const moment = Moment;
|
|
27
27
|
export const ajv = new Ajv();
|
|
28
28
|
export const logger = (...args) => console.log("logger=>>>", ...args);
|
|
@@ -83,21 +83,9 @@ export const toLocal = (number, decimal = 8) => {
|
|
|
83
83
|
};
|
|
84
84
|
export const copyData = async (string) => {
|
|
85
85
|
const { $toast } = useNuxtApp();
|
|
86
|
+
const { t } = useI18n();
|
|
86
87
|
await navigator.clipboard.writeText(string);
|
|
87
|
-
$toast.success("Copied :)");
|
|
88
|
-
};
|
|
89
|
-
export const mapper = (data, map, keys = _keys(map)) => {
|
|
90
|
-
const value = {};
|
|
91
|
-
const mapKeys = Object.keys(map);
|
|
92
|
-
for (const key of keys) {
|
|
93
|
-
const v = _get(data, key);
|
|
94
|
-
_set(value, key, v);
|
|
95
|
-
}
|
|
96
|
-
for (const key of mapKeys) {
|
|
97
|
-
const v = _has(data, key) && _get(map, [key, "handler"])?.(data[key]) || _get(data, key);
|
|
98
|
-
_set(value, map[key]?.label || key, v);
|
|
99
|
-
}
|
|
100
|
-
return value;
|
|
88
|
+
$toast.success(t("Copied :)"));
|
|
101
89
|
};
|
|
102
90
|
export const deg2rad = (deg) => {
|
|
103
91
|
return deg * (Math.PI / 180);
|
|
@@ -153,7 +141,7 @@ export const timeToMinutes = (timeString = "") => {
|
|
|
153
141
|
export const minutesToTime = (m = 0) => {
|
|
154
142
|
const hour = Math.floor(m / 60) + "";
|
|
155
143
|
const minute = Math.round(m % 60) + "";
|
|
156
|
-
return `${hour.padStart(2, 0)}:${minute.padStart(2, 0)}`;
|
|
144
|
+
return `${hour.padStart(2, "0")}:${minute.padStart(2, "0")}`;
|
|
157
145
|
};
|
|
158
146
|
export const useSocketIo = () => {
|
|
159
147
|
const moduleConfig = useModuleConfig();
|
|
@@ -199,17 +187,6 @@ export const setMeta = (data) => {
|
|
|
199
187
|
const metaData = useState("meta-data");
|
|
200
188
|
metaData.value = data;
|
|
201
189
|
};
|
|
202
|
-
export const encrypt = (text, passphrase) => {
|
|
203
|
-
return AES.encrypt(text, passphrase).toString();
|
|
204
|
-
};
|
|
205
|
-
export const decrypt = (ciphertext, passphrase) => {
|
|
206
|
-
const bytes = AES.decrypt(ciphertext, passphrase);
|
|
207
|
-
try {
|
|
208
|
-
return bytes.toString(enc);
|
|
209
|
-
} catch (e) {
|
|
210
|
-
return "";
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
190
|
export const useWallets = async (isActive = void 0, id = void 0) => {
|
|
214
191
|
const userId = id ? { value: id } : useUserId();
|
|
215
192
|
const wallet = id ? ref([]) : useState("wallet", () => []);
|
|
@@ -223,12 +200,12 @@ export const useWallets = async (isActive = void 0, id = void 0) => {
|
|
|
223
200
|
}
|
|
224
201
|
});
|
|
225
202
|
const { result: coins } = await useGet("/coin", { params: { "$w.walletable": true } });
|
|
226
|
-
wallet.value = currentWallets
|
|
203
|
+
wallet.value = currentWallets?.filter((e) => !e.coin?.platforms?.length || e.coin?.platforms?.includes(window.APP_CODE || moduleConfig?.APP_CODE)) || [];
|
|
227
204
|
const wallets = coins?.map((e) => ({
|
|
228
205
|
balance: 0,
|
|
229
206
|
coinId: e.id,
|
|
230
207
|
userId: userId.value
|
|
231
|
-
})).filter((c) => !
|
|
208
|
+
})).filter((c) => !currentWallets?.find((w) => w.coinId === c.coinId));
|
|
232
209
|
if (wallets?.length) {
|
|
233
210
|
await usePost("/wallet", wallets);
|
|
234
211
|
const { result: w } = await useGet("/wallet", {
|
|
@@ -260,6 +237,7 @@ export const getDiscountInfo = async (code, shop = null) => {
|
|
|
260
237
|
params: {
|
|
261
238
|
"$i.transactions": true
|
|
262
239
|
},
|
|
240
|
+
// @ts-ignore
|
|
263
241
|
headers: {
|
|
264
242
|
"no-error": true
|
|
265
243
|
}
|
|
@@ -332,13 +310,14 @@ export const discountedPrice = (price, discount = null) => {
|
|
|
332
310
|
return price;
|
|
333
311
|
}
|
|
334
312
|
const d = new Big(discount.percent).mul(price).div(100);
|
|
335
|
-
return d > discount.maxPrice ? discount.maxPrice : d;
|
|
313
|
+
return d > (discount.maxPrice || Infinity) ? discount.maxPrice : d;
|
|
336
314
|
};
|
|
337
315
|
export const formattedAddress = async ([lng, lat]) => {
|
|
338
316
|
const result = await $fetch(
|
|
339
317
|
`https://api.neshan.org/v5/reverse?lat=${lat}&lng=${lng}`,
|
|
340
318
|
{
|
|
341
319
|
method: "GET",
|
|
320
|
+
// @ts-ignore
|
|
342
321
|
headers: {
|
|
343
322
|
"Api-Key": window.NESHAN_API_KEY
|
|
344
323
|
}
|
|
@@ -351,6 +330,7 @@ export const geoCodingAddress = async (address, coords) => {
|
|
|
351
330
|
`https://api.neshan.org/v1/search?term=${address}&lat=${coords[1]}&lng=${coords[0]}`,
|
|
352
331
|
{
|
|
353
332
|
method: "GET",
|
|
333
|
+
// @ts-ignore
|
|
354
334
|
headers: {
|
|
355
335
|
"Api-Key": window.NESHAN_API_KEY
|
|
356
336
|
}
|
|
@@ -373,6 +353,7 @@ export const setOptions = async (f, ctx = {}) => {
|
|
|
373
353
|
...f,
|
|
374
354
|
input: {
|
|
375
355
|
...f.input,
|
|
356
|
+
// @ts-ignore
|
|
376
357
|
options: (result ?? []).map((e) => _fromPairs(_toPairs(f.input?.externalOptionsKeys).map((p) => [p[0], _get(e, p[1])])))
|
|
377
358
|
}
|
|
378
359
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Booking, BookingSetting,
|
|
1
|
+
import type { AppSetting, Booking, BookingSetting, InputOption, Provider, ServiceSettingType, ServiceSetting, User } from '../types/models.js';
|
|
2
2
|
export declare const useUser: () => import("@vueuse/shared").RemovableRef<User>;
|
|
3
|
-
export declare const useProvider: () => import("@vueuse/shared").RemovableRef<Provider
|
|
3
|
+
export declare const useProvider: () => import("@vueuse/shared").RemovableRef<Partial<Provider>>;
|
|
4
4
|
export declare const useActiveBookings: () => import("@vueuse/shared").RemovableRef<Booking[]>;
|
|
5
5
|
export declare const useCurrentOrderIndex: (providerId: string, activeBookings: Booking[]) => number;
|
|
6
|
-
export declare const useSettings: () => import("@vueuse/shared").RemovableRef<AppSetting
|
|
6
|
+
export declare const useSettings: () => import("@vueuse/shared").RemovableRef<Partial<AppSetting>>;
|
|
7
7
|
export declare const useHaveLocation: () => import("vue").Ref<boolean, boolean>;
|
|
8
8
|
export declare const useCatInView: () => import("vue").Ref<[InputOption, ServiceSetting[]], [InputOption, ServiceSetting[]]>;
|
|
9
|
-
export declare const useToppingModal: () => import("vue").Ref<
|
|
9
|
+
export declare const useToppingModal: () => import("vue").Ref<ServiceSetting | null, ServiceSetting | null>;
|
|
10
10
|
export declare const useMeta: (v?: {
|
|
11
11
|
backward?: any;
|
|
12
12
|
title?: string;
|
|
@@ -30,21 +30,8 @@ export declare const useProviderId: () => import("#app").CookieRef<string | null
|
|
|
30
30
|
export declare const useCurrentProductIndex: (products: ServiceSetting[], p: Partial<ServiceSetting>) => number;
|
|
31
31
|
export declare const SettingToType: (setting: ServiceSetting) => ServiceSettingType;
|
|
32
32
|
export declare const NotInProcessBooking: (e: Booking["status"]) => boolean;
|
|
33
|
-
export declare const MinPrice: (bookingSetting: BookingSetting) =>
|
|
33
|
+
export declare const MinPrice: (bookingSetting: BookingSetting) => number | object | null | undefined;
|
|
34
34
|
export declare const PriceDiscount: (product: ServiceSettingType | ServiceSetting) => number;
|
|
35
|
-
export declare const BookingServicesPrice: (booking: Booking) => number;
|
|
36
|
-
export declare const BookingServicesDiscountPrice: (booking: Booking) => number;
|
|
37
|
-
export declare const BookingItems: (booking: Booking, discount?: DiscountCode | undefined) => ({
|
|
38
|
-
label: string;
|
|
39
|
-
value: number;
|
|
40
|
-
bold?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
label: string;
|
|
43
|
-
value: number;
|
|
44
|
-
bold: boolean;
|
|
45
|
-
} | null)[];
|
|
46
|
-
export declare const BookingTotalPrice: (items: any[]) => number;
|
|
47
|
-
export declare const BookingPrice: (booking: Booking) => number;
|
|
48
35
|
export declare const authenticate: () => Promise<void>;
|
|
49
36
|
export declare const authenticateProvider: () => Promise<void>;
|
|
50
37
|
export declare const useConfig: () => import("@nuxt/schema").PublicRuntimeConfig;
|
|
@@ -52,7 +39,7 @@ export declare const useModuleConfig: () => unknown;
|
|
|
52
39
|
export declare const isProviderSide: (config: {
|
|
53
40
|
userType: string;
|
|
54
41
|
}) => boolean;
|
|
55
|
-
export declare const
|
|
42
|
+
export declare const isCoSide: (config: {
|
|
56
43
|
userType: string;
|
|
57
44
|
}) => boolean;
|
|
58
45
|
export declare const isUserSide: (config: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Big from "big.js";
|
|
2
|
-
import { _pick, _round,
|
|
2
|
+
import { _pick, _round, navigateTo, useCookie, useLocalStorage, useRuntimeConfig, useState } from "#imports";
|
|
3
3
|
export const useUser = () => useLocalStorage("user", {});
|
|
4
4
|
export const useProvider = () => useLocalStorage("provider", {});
|
|
5
5
|
export const useActiveBookings = () => useLocalStorage("activeBookings", []);
|
|
@@ -10,7 +10,9 @@ export const useCatInView = () => useState("catView");
|
|
|
10
10
|
export const useToppingModal = () => useState("services");
|
|
11
11
|
export const useMeta = (v = null) => {
|
|
12
12
|
const meta = useState("meta", () => ({}));
|
|
13
|
-
|
|
13
|
+
if (v) {
|
|
14
|
+
meta.value = v;
|
|
15
|
+
}
|
|
14
16
|
return meta;
|
|
15
17
|
};
|
|
16
18
|
export const useReload = () => useState("reload", () => 0);
|
|
@@ -32,25 +34,6 @@ export const SettingToType = (setting) => ({
|
|
|
32
34
|
export const NotInProcessBooking = (e) => ["PENDING", "REJECTED", "COMPLETED", "CANCELLED"].includes(e || "");
|
|
33
35
|
export const MinPrice = (bookingSetting) => bookingSetting?.minPrice;
|
|
34
36
|
export const PriceDiscount = (product) => _round(new Big(product.price || 0).mul((product.discount || 0) / 100).toNumber());
|
|
35
|
-
export const BookingServicesPrice = (booking) => _sumBy(booking?.services, "price");
|
|
36
|
-
export const BookingServicesDiscountPrice = (booking) => _sum(booking.services?.map(PriceDiscount)) || 0;
|
|
37
|
-
export const BookingItems = (booking, discount = void 0) => booking ? [
|
|
38
|
-
{
|
|
39
|
-
label: "\u0645\u062C\u0645\u0648\u0639",
|
|
40
|
-
value: BookingServicesPrice(booking)
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "\u0647\u0632\u06CC\u0646\u0647 \u0627\u0648\u0644\u06CC\u0647",
|
|
44
|
-
value: MinPrice(booking.booking) || 0
|
|
45
|
-
},
|
|
46
|
-
BookingServicesDiscountPrice(booking) || discount ? {
|
|
47
|
-
label: "\u062A\u062E\u0641\u06CC\u0641",
|
|
48
|
-
value: -1 * BookingServicesDiscountPrice(booking) - Math.min(discount?.maxPrice || 0, new Big(discount?.percent || 0).div(100).times(BookingServicesPrice(booking)).toNumber()),
|
|
49
|
-
bold: true
|
|
50
|
-
} : null
|
|
51
|
-
] : [];
|
|
52
|
-
export const BookingTotalPrice = (items) => _sumBy(items, "value");
|
|
53
|
-
export const BookingPrice = (booking) => BookingTotalPrice(BookingItems(booking));
|
|
54
37
|
export const authenticate = async () => {
|
|
55
38
|
const userId = useUserId();
|
|
56
39
|
if (!userId.value) {
|
|
@@ -72,10 +55,10 @@ export const useModuleConfig = () => {
|
|
|
72
55
|
return config.unsourceUi;
|
|
73
56
|
};
|
|
74
57
|
export const isProviderSide = (config) => {
|
|
75
|
-
return config?.userType
|
|
58
|
+
return ["PROVIDER", "SHOP"].includes(config?.userType);
|
|
76
59
|
};
|
|
77
|
-
export const
|
|
78
|
-
return
|
|
60
|
+
export const isCoSide = (config) => {
|
|
61
|
+
return ["COURIER", "PLACE"].includes(config?.userType);
|
|
79
62
|
};
|
|
80
63
|
export const isUserSide = (config) => {
|
|
81
64
|
return config?.userType === "USER";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Section, Profile, Transaction, Slider, User, Banner, Coin } from '../types/models.js';
|
|
1
|
+
import type { Form, InputOption, Section, Profile, Transaction, Slider, User, Banner, Coin } from '../types/models.js';
|
|
2
2
|
export declare const getForms: (name: string) => Promise<Form[] | undefined>;
|
|
3
3
|
export declare const getUserInfo: () => Promise<User | null>;
|
|
4
4
|
export declare const getCoin: (id?: string | null) => Promise<Coin | undefined>;
|
|
5
5
|
export declare const getBanner: (cat: string) => Promise<Banner | null | undefined>;
|
|
6
6
|
export declare const getSections: () => Promise<Section | never[]>;
|
|
7
7
|
export declare const getCategorySection: (data: Slider) => Promise<InputOption[]>;
|
|
8
|
-
export declare const getOption: (key: string, params?: {}) => Promise<
|
|
8
|
+
export declare const getOption: (key: string, params?: {}) => Promise<InputOption | null>;
|
|
9
9
|
export declare const getOptions: (key: string) => Promise<InputOption[]>;
|
|
10
10
|
export declare const getMyTransactions: (q?: {}) => Promise<Transaction[] | undefined>;
|
|
11
11
|
export declare const getTransactions: (q?: {}) => Promise<Transaction[] | undefined>;
|
|
@@ -45,6 +45,7 @@ export const getCoin = async (id = null) => {
|
|
|
45
45
|
export const getBanner = async (cat) => {
|
|
46
46
|
if (!cat) return null;
|
|
47
47
|
const { result } = await useGet(`/Banner/categoryKey/${cat}`, {
|
|
48
|
+
// @ts-ignore
|
|
48
49
|
headers: {
|
|
49
50
|
"no-error": true
|
|
50
51
|
}
|
|
@@ -75,6 +76,7 @@ export const getCategorySection = async (data) => {
|
|
|
75
76
|
export const getOption = async (key, params = {}) => {
|
|
76
77
|
const { result } = await useGet(`/InputOption/key/${key}`, {
|
|
77
78
|
params,
|
|
79
|
+
// @ts-ignore
|
|
78
80
|
headers: {
|
|
79
81
|
"no-error": true
|
|
80
82
|
}
|
|
@@ -128,9 +130,8 @@ export const getTransactions = async (q = {}) => {
|
|
|
128
130
|
return result;
|
|
129
131
|
};
|
|
130
132
|
export const saveUser = async (user) => {
|
|
131
|
-
let res;
|
|
132
133
|
const userId = useUserId();
|
|
133
|
-
res = await usePut(`/user/${userId.value}`, user, { headers: { "no-error": true } });
|
|
134
|
+
const res = await usePut(`/user/${userId.value}`, user, { headers: { "no-error": true } });
|
|
134
135
|
await getUserInfo();
|
|
135
136
|
return res.result;
|
|
136
137
|
};
|