@unsource/ui 2.0.12 → 2.0.15
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 +0 -6
- package/dist/runtime/components/UnForm.vue +39 -1
- package/dist/runtime/components/UnFormItem.d.vue.ts +1 -1
- package/dist/runtime/components/UnFormItem.vue +1 -1
- package/dist/runtime/components/UnFormItem.vue.d.ts +1 -1
- package/dist/runtime/components/UnFormList.d.vue.ts +2 -2
- package/dist/runtime/components/UnFormList.vue.d.ts +2 -2
- package/dist/runtime/components/UnIRDatePicker.vue +2 -1
- package/dist/runtime/components/UnLog.d.vue.ts +2 -2
- package/dist/runtime/components/UnLog.vue.d.ts +2 -2
- package/dist/runtime/composables/fetch.d.ts +20 -10
- package/dist/runtime/composables/fetch.js +34 -42
- package/dist/runtime/composables/global.d.ts +9 -14
- package/dist/runtime/composables/global.js +1 -43
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -66,12 +66,6 @@ const module = defineNuxtModule({
|
|
|
66
66
|
});
|
|
67
67
|
addImportsDir(resolver2.resolve("runtime/composables"));
|
|
68
68
|
addPlugin(resolver2.resolve("runtime/plugins/toast.client"));
|
|
69
|
-
_nuxt.options.build.transpile.push(
|
|
70
|
-
"jalali-moment",
|
|
71
|
-
"ajv",
|
|
72
|
-
"big.js",
|
|
73
|
-
"handlebars"
|
|
74
|
-
);
|
|
75
69
|
}
|
|
76
70
|
});
|
|
77
71
|
|
|
@@ -9,7 +9,45 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup>
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
getForms,
|
|
14
|
+
formattedAddress,
|
|
15
|
+
_cloneDeep,
|
|
16
|
+
ref,
|
|
17
|
+
useAsyncData,
|
|
18
|
+
useNuxtApp,
|
|
19
|
+
watch,
|
|
20
|
+
useGet,
|
|
21
|
+
_fromPairs,
|
|
22
|
+
_toPairs,
|
|
23
|
+
_get
|
|
24
|
+
} from "#imports";
|
|
25
|
+
import Handlebars from "handlebars";
|
|
26
|
+
import Ajv from "ajv";
|
|
27
|
+
const ajv = new Ajv();
|
|
28
|
+
const setOptions = async (f, ctx2 = {}) => {
|
|
29
|
+
if (f.input?.extendedInputKey) {
|
|
30
|
+
return {
|
|
31
|
+
...f,
|
|
32
|
+
input: {
|
|
33
|
+
...f.input,
|
|
34
|
+
options: f.input?.extendInput?.options ?? []
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
} else if (f.input?.externalOptions) {
|
|
38
|
+
const template = Handlebars.compile(f.input?.externalOptions);
|
|
39
|
+
const { result } = await useGet(template(ctx2));
|
|
40
|
+
return {
|
|
41
|
+
...f,
|
|
42
|
+
input: {
|
|
43
|
+
...f.input,
|
|
44
|
+
options: (result ?? []).map((e) => _fromPairs(_toPairs(f.input?.externalOptionsKeys).map((p) => [p[0], _get(e, p[1])])))
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
return f;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
13
51
|
const { name, ctx } = defineProps({
|
|
14
52
|
name: { type: String, required: true },
|
|
15
53
|
ctx: { type: Object, required: false }
|
|
@@ -117,7 +117,7 @@ import { computed } from "#imports";
|
|
|
117
117
|
import UnLocationInput from "./UnLocationInput.vue";
|
|
118
118
|
const emit = defineEmits(["update:modelValue"]);
|
|
119
119
|
const { item, options, required, isError } = defineProps({
|
|
120
|
-
item: { type:
|
|
120
|
+
item: { type: Object, required: true },
|
|
121
121
|
options: { type: Array, required: true },
|
|
122
122
|
required: { type: Boolean, required: false },
|
|
123
123
|
isError: { type: Boolean, required: false }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Form } from '
|
|
1
|
+
import type { Form } from '../types/models.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
items: Partial<Form>[];
|
|
4
4
|
errors?: string[];
|
|
@@ -10,7 +10,7 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
10
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
11
|
schema: import("vue").ComputedRef<{
|
|
12
12
|
type: string;
|
|
13
|
-
properties: Form
|
|
13
|
+
properties: Partial<Form>;
|
|
14
14
|
required: string[];
|
|
15
15
|
}>;
|
|
16
16
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Form } from '
|
|
1
|
+
import type { Form } from '../types/models.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
items: Partial<Form>[];
|
|
4
4
|
errors?: string[];
|
|
@@ -10,7 +10,7 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
10
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
11
|
schema: import("vue").ComputedRef<{
|
|
12
12
|
type: string;
|
|
13
|
-
properties: Form
|
|
13
|
+
properties: Partial<Form>;
|
|
14
14
|
required: string[];
|
|
15
15
|
}>;
|
|
16
16
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
<script setup>
|
|
61
61
|
import { vOnClickOutside } from "@vueuse/components";
|
|
62
62
|
import DatePicker from "vue3-persian-datetime-picker";
|
|
63
|
-
import
|
|
63
|
+
import moment from "jalali-moment";
|
|
64
|
+
import { ref } from "#imports";
|
|
64
65
|
const format = {
|
|
65
66
|
datetime: "YYYY-MM-DDTHH:mm:ssZ",
|
|
66
67
|
time: "HH:mm",
|
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
fixed: boolean;
|
|
6
5
|
data: string | number | boolean | unknown[] | Record<string, any>;
|
|
6
|
+
fixed: boolean;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly fixed: boolean;
|
|
10
9
|
readonly data: string | number | boolean | unknown[] | Record<string, any>;
|
|
10
|
+
readonly fixed: boolean;
|
|
11
11
|
};
|
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
fixed: boolean;
|
|
6
5
|
data: string | number | boolean | unknown[] | Record<string, any>;
|
|
6
|
+
fixed: boolean;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly fixed: boolean;
|
|
10
9
|
readonly data: string | number | boolean | unknown[] | Record<string, any>;
|
|
10
|
+
readonly fixed: boolean;
|
|
11
11
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const fetch: <T>({ body, config, controller, URL, method }: {
|
|
3
|
+
body?: undefined;
|
|
4
|
+
config?: {} | undefined;
|
|
5
|
+
controller?: undefined;
|
|
6
|
+
URL?: string | undefined;
|
|
7
|
+
method?: string | undefined;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
error: never;
|
|
10
|
+
} | {
|
|
11
|
+
result: import("nitropack").TypedInternalResponse<NitroFetchRequest, T, NitroFetchOptions<NitroFetchRequest, "get" | "head" | "patch" | "post" | "put" | "delete" | "connect" | "options" | "trace"> extends NitroFetchOptions<R, import("nitropack").AvailableRouterMethod<R>> ? "get" : Lowercase<Exclude<import("nitropack").AvailableRouterMethod<R>, undefined>> | Lowercase<Exclude<Uppercase<import("nitropack").AvailableRouterMethod<R>>, undefined>> extends "get" | "head" | "patch" | "post" | "put" | "delete" | "connect" | "options" | "trace" ? Lowercase<Exclude<import("nitropack").AvailableRouterMethod<R>, undefined>> | Lowercase<Exclude<Uppercase<import("nitropack").AvailableRouterMethod<R>>, undefined>> : "get">;
|
|
12
|
+
}>;
|
|
3
13
|
export declare const useGet: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "get"> | {
|
|
4
|
-
headers?: Record<string,
|
|
5
|
-
}, controller?:
|
|
14
|
+
headers?: Record<string, never>;
|
|
15
|
+
}, controller?: AbortController | undefined) => Promise<{
|
|
6
16
|
result?: T;
|
|
7
|
-
error?:
|
|
17
|
+
error?: never;
|
|
8
18
|
}>;
|
|
9
|
-
export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete"
|
|
19
|
+
export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete">, controller?: AbortController | undefined) => Promise<{
|
|
10
20
|
result?: T;
|
|
11
|
-
error?:
|
|
21
|
+
error?: never;
|
|
12
22
|
}>;
|
|
13
|
-
export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post"
|
|
23
|
+
export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post">, controller?: AbortController | undefined) => Promise<{
|
|
14
24
|
result?: T;
|
|
15
|
-
error?:
|
|
25
|
+
error?: never;
|
|
16
26
|
}>;
|
|
17
|
-
export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put"
|
|
27
|
+
export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put">, controller?: AbortController | undefined) => Promise<{
|
|
18
28
|
result?: T;
|
|
19
|
-
error?:
|
|
29
|
+
error?: never;
|
|
20
30
|
}>;
|
|
@@ -2,7 +2,6 @@ import { useToken } from "./reuseable.js";
|
|
|
2
2
|
import { _get, _set, useNuxtApp, _takeRight } from "#imports";
|
|
3
3
|
const domain = location.hostname.split(".");
|
|
4
4
|
const tld = _takeRight(domain, 2).join(".");
|
|
5
|
-
export const BASE_URL = eval(process.env.BASE_URL) || "https://api.book.parand.app";
|
|
6
5
|
const setHeaders = (config) => {
|
|
7
6
|
const token = useToken();
|
|
8
7
|
_set(config, ["headers", "Authorization"], _get(config, ["headers", "Authorization"], token.value || ""));
|
|
@@ -17,15 +16,16 @@ const errorHandler = (error, config) => {
|
|
|
17
16
|
}
|
|
18
17
|
return { error };
|
|
19
18
|
};
|
|
20
|
-
export const
|
|
19
|
+
export const fetch = async ({ body = void 0, config = {}, controller = void 0, URL = "", method = "GET" }) => {
|
|
21
20
|
controller = new AbortController();
|
|
22
21
|
const signal = controller.signal;
|
|
23
22
|
config = setHeaders(config);
|
|
24
23
|
try {
|
|
25
24
|
const result = await $fetch(URL, {
|
|
26
|
-
baseURL: BASE_URL,
|
|
27
|
-
method
|
|
25
|
+
baseURL: window.BASE_URL,
|
|
26
|
+
method,
|
|
28
27
|
signal,
|
|
28
|
+
body,
|
|
29
29
|
...config
|
|
30
30
|
});
|
|
31
31
|
return { result };
|
|
@@ -33,44 +33,36 @@ export const useGet = async (URL, config = {}, controller = void 0) => {
|
|
|
33
33
|
return errorHandler(error, config);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
...config
|
|
43
|
-
});
|
|
44
|
-
return { result };
|
|
45
|
-
} catch (error) {
|
|
46
|
-
return errorHandler(error, config);
|
|
47
|
-
}
|
|
36
|
+
export const useGet = async (URL, config = {}, controller = void 0) => {
|
|
37
|
+
return fetch({
|
|
38
|
+
URL,
|
|
39
|
+
config,
|
|
40
|
+
controller
|
|
41
|
+
});
|
|
48
42
|
};
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...config
|
|
57
|
-
});
|
|
58
|
-
return { result };
|
|
59
|
-
} catch (error) {
|
|
60
|
-
return errorHandler(error, config);
|
|
61
|
-
}
|
|
43
|
+
export const useDelete = async (URL, config = {}, controller = void 0) => {
|
|
44
|
+
return fetch({
|
|
45
|
+
URL,
|
|
46
|
+
config,
|
|
47
|
+
controller,
|
|
48
|
+
method: "DELETE"
|
|
49
|
+
});
|
|
62
50
|
};
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
export const usePost = async (URL, data, config = {}, controller = void 0) => {
|
|
52
|
+
return fetch({
|
|
53
|
+
URL,
|
|
54
|
+
config,
|
|
55
|
+
controller,
|
|
56
|
+
body: data,
|
|
57
|
+
method: "POST"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export const usePut = async (URL, data, config = {}, controller = void 0) => {
|
|
61
|
+
return fetch({
|
|
62
|
+
URL,
|
|
63
|
+
body: data,
|
|
64
|
+
config,
|
|
65
|
+
controller,
|
|
66
|
+
method: "PUT"
|
|
67
|
+
});
|
|
76
68
|
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import Moment from 'jalali-moment';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
1
|
import type { CoinGateway, DiscountCode, Form, Transaction, Wallet } from '../types/models.js';
|
|
4
2
|
import type { Address, MetaData, SocketJoinObject } from '../types/app.js';
|
|
5
3
|
import type { RemovableRef } from '@vueuse/core';
|
|
6
4
|
export declare const NESHAN_API_KEY = "service.23c2db7869bd44b986353729776b338c";
|
|
7
5
|
export declare const NESHAN_WEB_KEY = "web.698da9dc73764b18a38a4c5cc4f92320";
|
|
8
6
|
export declare const logger: (...args: any) => void;
|
|
9
|
-
export declare const moment: typeof Moment;
|
|
10
7
|
export declare const s2n: (string: string | number) => string;
|
|
11
8
|
export declare const sleep: (ms: any) => Promise<unknown>;
|
|
12
9
|
export declare const geoLink: (location: Location, isIos?: boolean) => string;
|
|
13
|
-
export declare const ajv: Ajv;
|
|
14
10
|
export declare const useComputedRoute: (route: any, key: any) => import("vue").WritableComputedRef<any, any>;
|
|
15
11
|
export declare const useComputedLodash: (value: any, keys: (string | number)[] | string) => import("vue").WritableComputedRef<any, any>;
|
|
16
12
|
export declare const KMapper: (num: any) => string;
|
|
@@ -20,23 +16,23 @@ export declare const copyData: (string: string) => Promise<void>;
|
|
|
20
16
|
export declare const mapper: (data: Record<string, any>, map: Record<string, any>, keys?: string[]) => Record<string, any>;
|
|
21
17
|
export declare const deg2rad: (deg: number) => number;
|
|
22
18
|
export declare const getDistanceFromLatLonInKm: (lat1: number, lon1: number, lat2: number, lon2: number) => number;
|
|
23
|
-
export declare const isoToNormal: (time: string) =>
|
|
24
|
-
export declare const isoToMonth: (time: string) =>
|
|
25
|
-
export declare const isoToDateTime: (time: string) =>
|
|
26
|
-
export declare const isoToHumanDateTime: (time: string) =>
|
|
27
|
-
export declare const isoToTime: (time: string) =>
|
|
28
|
-
export declare const isoToDate: (time: string) =>
|
|
29
|
-
export declare const isoToStandard: (time: string) =>
|
|
19
|
+
export declare const isoToNormal: (time: string) => any;
|
|
20
|
+
export declare const isoToMonth: (time: string) => any;
|
|
21
|
+
export declare const isoToDateTime: (time: string) => any;
|
|
22
|
+
export declare const isoToHumanDateTime: (time: string) => any;
|
|
23
|
+
export declare const isoToTime: (time: string) => any;
|
|
24
|
+
export declare const isoToDate: (time: string) => any;
|
|
25
|
+
export declare const isoToStandard: (time: string) => any;
|
|
30
26
|
export declare const dataToRange: (data: any[] | undefined) => [string, string];
|
|
31
27
|
export declare const subIsoDate: (du: string) => string;
|
|
32
|
-
export declare const isExpire: (time: any) =>
|
|
28
|
+
export declare const isExpire: (time: any) => any;
|
|
33
29
|
export declare const remainToExpire: (timestamp: any, time: string) => string[];
|
|
34
30
|
export declare const timeToDurationShort: (timeString?: string) => string;
|
|
35
31
|
export declare const timeToMinutes: (timeString?: string) => number;
|
|
36
32
|
export declare const minutesToTime: (m?: number) => string;
|
|
37
33
|
export declare const useSocketIo: () => import("socket.io-client").Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
38
34
|
export declare const watchSocket: (socket: any, joinObject: SocketJoinObject, dataHandler: any, loading?: import("vue").Ref<boolean, boolean>, initHandler?: () => Promise<void>) => void;
|
|
39
|
-
export declare const lastAct: (time: string) =>
|
|
35
|
+
export declare const lastAct: (time: string) => any;
|
|
40
36
|
export declare const setMeta: (data: MetaData) => void;
|
|
41
37
|
export declare const encrypt: (text: any, passphrase: any) => any;
|
|
42
38
|
export declare const decrypt: (ciphertext: any, passphrase: any) => any;
|
|
@@ -47,7 +43,6 @@ export declare const getDiscountInfo: (code: string, shop?: {
|
|
|
47
43
|
} | null) => Promise<DiscountCode | null>;
|
|
48
44
|
export declare const submitPayment: (amount: number, details?: Partial<Transaction>, giftCode?: undefined, redirect?: boolean) => Promise<Transaction | undefined>;
|
|
49
45
|
export declare const discountedPrice: (price: any, discount?: DiscountCode) => any;
|
|
50
|
-
export declare const submitWalletPayment: (amount: any, wallet: Wallet, details?: {}, giftCode?: undefined) => Promise<any>;
|
|
51
46
|
export declare const formattedAddress: ([lng, lat]: Address) => Promise<any>;
|
|
52
47
|
export declare const geoCodingAddress: (address: string, coords: Address) => Promise<unknown>;
|
|
53
48
|
export declare const setOptions: (f: Form, ctx?: {}) => Promise<Form | {
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
_mergeWith,
|
|
6
6
|
_set,
|
|
7
7
|
_toPairs,
|
|
8
|
-
BASE_URL,
|
|
9
8
|
computed,
|
|
10
9
|
isPlainObject,
|
|
11
10
|
navigateTo,
|
|
@@ -14,24 +13,17 @@ import {
|
|
|
14
13
|
useGet,
|
|
15
14
|
useNuxtApp,
|
|
16
15
|
usePost,
|
|
17
|
-
usePut,
|
|
18
16
|
useState
|
|
19
17
|
} from "#imports";
|
|
20
|
-
import Moment from "jalali-moment";
|
|
21
|
-
import Ajv from "ajv";
|
|
22
18
|
import { io } from "socket.io-client";
|
|
23
19
|
import { digitsFaToEn, digitsArToEn } from "@persian-tools/persian-tools";
|
|
24
|
-
import Big from "big.js";
|
|
25
|
-
import Handlebars from "handlebars";
|
|
26
20
|
import { useToken, useUserId } from "./reuseable.js";
|
|
27
21
|
export const NESHAN_API_KEY = "service.23c2db7869bd44b986353729776b338c";
|
|
28
22
|
export const NESHAN_WEB_KEY = "web.698da9dc73764b18a38a4c5cc4f92320";
|
|
29
23
|
export const logger = (...args) => console.log("logger=>>>", ...args);
|
|
30
|
-
export const moment = Moment;
|
|
31
24
|
export const s2n = (string) => (string + "").replace(/[^\d.]|\.\./g, "");
|
|
32
25
|
export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
33
26
|
export const geoLink = (location2, isIos = false) => isIos ? `maps://maps.google.com/?q=${location2?.lat},${location2?.lng}` : `geo:${location2?.lat},${location2?.lng}`;
|
|
34
|
-
export const ajv = new Ajv();
|
|
35
27
|
export const useComputedRoute = (route, key) => computed({
|
|
36
28
|
get() {
|
|
37
29
|
return _get(route.query, [key]);
|
|
@@ -159,7 +151,7 @@ export const minutesToTime = (m = 0) => {
|
|
|
159
151
|
return `${hour.padStart(2, 0)}:${minute.padStart(2, 0)}`;
|
|
160
152
|
};
|
|
161
153
|
export const useSocketIo = () => {
|
|
162
|
-
const socket = io(BASE_URL, {
|
|
154
|
+
const socket = io(window.BASE_URL, {
|
|
163
155
|
extraHeaders: {
|
|
164
156
|
authorization: useToken().value || ""
|
|
165
157
|
// 'app-code': APP_CODE
|
|
@@ -328,40 +320,6 @@ export const discountedPrice = (price, discount = null) => {
|
|
|
328
320
|
const d = new Big(discount.percent).mul(price).div(100);
|
|
329
321
|
return d > discount.maxPrice ? discount.maxPrice : d;
|
|
330
322
|
};
|
|
331
|
-
export const submitWalletPayment = async (amount, wallet, details = {}, giftCode = void 0) => {
|
|
332
|
-
let discount;
|
|
333
|
-
if (giftCode) {
|
|
334
|
-
discount = await getDiscountInfo(giftCode);
|
|
335
|
-
if (!discount) throw new Error("giftCode is missing");
|
|
336
|
-
}
|
|
337
|
-
const userId = useUserId();
|
|
338
|
-
const { $toast } = useNuxtApp();
|
|
339
|
-
const price = discountedPrice(amount, discount);
|
|
340
|
-
if (wallet.balance < price) {
|
|
341
|
-
return $toast.error("\u0645\u0648\u062C\u0648\u062F\u06CC \u06A9\u0627\u0641\u06CC \u0646\u06CC\u0633\u062A");
|
|
342
|
-
} else {
|
|
343
|
-
const { result } = await usePut(`/wallet/${wallet.id}`, {
|
|
344
|
-
balance: {
|
|
345
|
-
decrement: price
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
if (result) {
|
|
349
|
-
const { result: res } = await usePost("/transaction", {
|
|
350
|
-
amount,
|
|
351
|
-
userId: userId.value || "",
|
|
352
|
-
discountCode: giftCode,
|
|
353
|
-
type: "PAYMENT",
|
|
354
|
-
status: "SUCCESS",
|
|
355
|
-
redirectUrl: "",
|
|
356
|
-
walletId: wallet.id,
|
|
357
|
-
...details
|
|
358
|
-
});
|
|
359
|
-
if (res) {
|
|
360
|
-
return await verifyPayment(res.id);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
323
|
export const formattedAddress = async ([lng, lat]) => {
|
|
366
324
|
const result = await $fetch(
|
|
367
325
|
`https://api.neshan.org/v5/reverse?lat=${lat}&lng=${lng}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unsource/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "nuxt ui kit for unsource env",
|
|
6
6
|
"repository": "https://github.com/alisa2142/unsource-ui",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@nuxt/devtools": "^2.6.5",
|
|
79
|
-
"@nuxt/vite-builder": "~3.15.4",
|
|
80
79
|
"@nuxt/eslint-config": "^1.9.0",
|
|
81
80
|
"@nuxt/icon": "1.15.0",
|
|
82
81
|
"@nuxt/module-builder": "^1.0.2",
|
|
83
82
|
"@nuxt/schema": "^3.19.3",
|
|
84
83
|
"@nuxt/test-utils": "^3.19.2",
|
|
84
|
+
"@nuxt/vite-builder": "~3.15.4",
|
|
85
85
|
"@types/node": "latest",
|
|
86
86
|
"@unhead/vue": "^1.11.20",
|
|
87
87
|
"@unocss/nuxt": "^66.5.3",
|