@unsource/ui 2.8.8 → 2.8.10

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.
Files changed (68) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +24 -9
  3. package/dist/runtime/assets/main.css +1 -1
  4. package/dist/runtime/components/UnAuth.d.vue.ts +2 -2
  5. package/dist/runtime/components/UnAuth.vue +2 -2
  6. package/dist/runtime/components/UnAuth.vue.d.ts +2 -2
  7. package/dist/runtime/components/UnCard.d.vue.ts +16 -14
  8. package/dist/runtime/components/UnCard.vue +26 -2
  9. package/dist/runtime/components/UnCard.vue.d.ts +16 -14
  10. package/dist/runtime/components/UnCheckboxItem.d.vue.ts +1 -5
  11. package/dist/runtime/components/UnCheckboxItem.vue +4 -5
  12. package/dist/runtime/components/UnCheckboxItem.vue.d.ts +1 -5
  13. package/dist/runtime/components/UnCollapsible.d.vue.ts +2 -2
  14. package/dist/runtime/components/UnCollapsible.vue.d.ts +2 -2
  15. package/dist/runtime/components/UnFormItem.vue +2 -2
  16. package/dist/runtime/components/UnFormList.d.vue.ts +1 -1
  17. package/dist/runtime/components/UnFormList.vue.d.ts +1 -1
  18. package/dist/runtime/components/UnIRDatePicker.d.vue.ts +1 -1
  19. package/dist/runtime/components/UnIRDatePicker.vue +1 -2
  20. package/dist/runtime/components/UnIRDatePicker.vue.d.ts +1 -1
  21. package/dist/runtime/components/UnInput.d.vue.ts +1 -1
  22. package/dist/runtime/components/UnInput.vue +1 -1
  23. package/dist/runtime/components/UnInput.vue.d.ts +1 -1
  24. package/dist/runtime/components/UnLabel.d.vue.ts +13 -13
  25. package/dist/runtime/components/UnLabel.vue +5 -5
  26. package/dist/runtime/components/UnLabel.vue.d.ts +13 -13
  27. package/dist/runtime/components/UnMap.vue +1 -1
  28. package/dist/runtime/components/UnMobileHeader.vue +0 -1
  29. package/dist/runtime/components/UnModal.vue +1 -1
  30. package/dist/runtime/components/UnMultiUploader.vue +0 -1
  31. package/dist/runtime/components/UnNavbar.vue +1 -1
  32. package/dist/runtime/components/UnNormalInput.d.vue.ts +1 -21
  33. package/dist/runtime/components/UnNormalInput.vue.d.ts +1 -21
  34. package/dist/runtime/components/UnNumberInput.vue +0 -1
  35. package/dist/runtime/components/UnNuxtIcon.d.vue.ts +0 -1
  36. package/dist/runtime/components/UnNuxtIcon.vue +1 -3
  37. package/dist/runtime/components/UnNuxtIcon.vue.d.ts +0 -1
  38. package/dist/runtime/components/UnProfile.d.vue.ts +2 -2
  39. package/dist/runtime/components/UnProfile.vue.d.ts +2 -2
  40. package/dist/runtime/components/UnRadioItem.d.vue.ts +1 -0
  41. package/dist/runtime/components/UnRadioItem.vue +8 -7
  42. package/dist/runtime/components/UnRadioItem.vue.d.ts +1 -0
  43. package/dist/runtime/components/UnSelect.d.vue.ts +0 -2
  44. package/dist/runtime/components/UnSelect.vue +2 -4
  45. package/dist/runtime/components/UnSelect.vue.d.ts +0 -2
  46. package/dist/runtime/components/UnSwiperControl.vue +0 -4
  47. package/dist/runtime/components/UnSwiperSlider.d.vue.ts +2 -2
  48. package/dist/runtime/components/UnSwiperSlider.vue.d.ts +2 -2
  49. package/dist/runtime/components/UnTransaction.vue +1 -0
  50. package/dist/runtime/components/UnUploadFile.d.vue.ts +4 -4
  51. package/dist/runtime/components/UnUploadFile.vue +1 -1
  52. package/dist/runtime/components/UnUploadFile.vue.d.ts +4 -4
  53. package/dist/runtime/components/UnWallet.vue +1 -0
  54. package/dist/runtime/composables/fetch.d.ts +38 -17
  55. package/dist/runtime/composables/fetch.js +20 -11
  56. package/dist/runtime/composables/global.d.ts +58 -15
  57. package/dist/runtime/composables/global.js +11 -30
  58. package/dist/runtime/composables/reuseable.d.ts +6 -19
  59. package/dist/runtime/composables/reuseable.js +7 -24
  60. package/dist/runtime/composables/services.d.ts +2 -2
  61. package/dist/runtime/composables/services.js +3 -2
  62. package/dist/runtime/plugins/floating.client.d.ts +3 -0
  63. package/dist/runtime/plugins/floating.client.js +6 -0
  64. package/dist/runtime/plugins/toast.client.d.ts +30 -30
  65. package/dist/runtime/types/models.d.ts +401 -110
  66. package/package.json +6 -5
  67. package/dist/runtime/uno.config.d.ts +0 -2
  68. package/dist/runtime/uno.config.js +0 -60
@@ -26,26 +26,6 @@ type __VLS_ModelProps = {
26
26
  modelValue?: any;
27
27
  };
28
28
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
30
- password: boolean;
31
- appendIcon: string;
32
- label: string;
33
- disabled: boolean;
34
- inputType: string;
35
- placeholder: string;
36
- date: boolean;
37
- focusable: boolean;
38
- className: string;
39
- valueClassName: string;
40
- focusClassName: string;
41
- labelClass: string;
42
- prependIcon: string;
43
- appendIconType: string;
44
- appendIconClass: string;
45
- appendText: string;
46
- inputMode: string;
47
- iconColor: string;
48
- bgStyle: string;
49
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
30
  declare const _default: typeof __VLS_export;
51
31
  export default _default;
@@ -26,26 +26,6 @@ type __VLS_ModelProps = {
26
26
  modelValue?: any;
27
27
  };
28
28
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {
30
- password: boolean;
31
- appendIcon: string;
32
- label: string;
33
- disabled: boolean;
34
- inputType: string;
35
- placeholder: string;
36
- date: boolean;
37
- focusable: boolean;
38
- className: string;
39
- valueClassName: string;
40
- focusClassName: string;
41
- labelClass: string;
42
- prependIcon: string;
43
- appendIconType: string;
44
- appendIconClass: string;
45
- appendText: string;
46
- inputMode: string;
47
- iconColor: string;
48
- bgStyle: string;
49
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
30
  declare const _default: typeof __VLS_export;
51
31
  export default _default;
@@ -36,7 +36,6 @@ const { max = 999999999, min = 0, step = 1e3 } = defineProps({
36
36
  const amount = defineModel({ type: [String, Number] });
37
37
  const remain = computed(() => max - Number(s2n(amount.value)));
38
38
  const increment = (e) => {
39
- console.log(e);
40
39
  if (e < 0 && Number(s2n(amount.value)) <= Math.abs(e)) {
41
40
  amount.value = "0";
42
41
  } else {
@@ -1,6 +1,5 @@
1
1
  type __VLS_Props = {
2
2
  name?: string | null;
3
- iconType?: string;
4
3
  filled?: boolean;
5
4
  alt?: string;
6
5
  };
@@ -25,12 +25,10 @@
25
25
 
26
26
  <script setup>
27
27
  import { ref } from "#imports";
28
- const props = defineProps({
28
+ defineProps({
29
29
  name: { type: [String, null], required: false },
30
- iconType: { type: String, required: false },
31
30
  filled: { type: Boolean, required: false },
32
31
  alt: { type: String, required: false }
33
32
  });
34
- const iconType = props.iconType || "icon";
35
33
  const loaded = ref(true);
36
34
  </script>
@@ -1,6 +1,5 @@
1
1
  type __VLS_Props = {
2
2
  name?: string | null;
3
- iconType?: string;
4
3
  filled?: boolean;
5
4
  alt?: string;
6
5
  };
@@ -26,9 +26,9 @@ type __VLS_Props = {
26
26
  owner?: string;
27
27
  customClass?: ProfileCustomClass;
28
28
  };
29
- declare var __VLS_15: {};
29
+ declare var __VLS_16: {};
30
30
  type __VLS_Slots = {} & {
31
- default?: (props: typeof __VLS_15) => any;
31
+ default?: (props: typeof __VLS_16) => any;
32
32
  };
33
33
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -26,9 +26,9 @@ type __VLS_Props = {
26
26
  owner?: string;
27
27
  customClass?: ProfileCustomClass;
28
28
  };
29
- declare var __VLS_15: {};
29
+ declare var __VLS_16: {};
30
30
  type __VLS_Slots = {} & {
31
- default?: (props: typeof __VLS_15) => any;
31
+ default?: (props: typeof __VLS_16) => any;
32
32
  };
33
33
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -12,6 +12,7 @@ type __VLS_Props = {
12
12
  selected?: boolean;
13
13
  customClass?: RadioCustomClass;
14
14
  disabled?: boolean;
15
+ infoIcon?: string;
15
16
  };
16
17
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
18
  declare const _default: typeof __VLS_export;
@@ -1,38 +1,39 @@
1
1
  <template>
2
2
  <div
3
- class="select-none group px-4 py-3 flex flex-row items-center gap-3 transition duration-300 hover:bg-primary-500/10 border-0 min-w-fit"
3
+ class="relative select-none group px-4 py-3 flex flex-row items-center gap-3 transition duration-300 hover:bg-primary-500/10 border-0 min-w-fit"
4
4
  :class="{ 'opacity-50 grayscale': disabled, 'disable': disabled, 'selected': selected }"
5
5
  @click.prevent.stop="toggle"
6
6
  >
7
7
  <div
8
8
  name="radio"
9
- :class="[customClass.radio, customClass[selected ? 'selected' : 'notSelected']?.radio]"
9
+ :class="customClass.radio"
10
10
  class="group-[.disable]:border-secondary border-(1 solid primary) rounded-1/2 w-4 h-4 flex justify-center items-center"
11
11
  >
12
12
  <div
13
13
  name="radioInside"
14
14
  class="bg-primary-500 rounded-1/2 h-10px w-10px transition-opacity duration-200"
15
- :class="[customClass.radioInside, customClass[selected ? 'selected' : 'notSelected']?.radioInside, selected ? 'opacity-full' : 'opacity-0']"
15
+ :class="[customClass.radioInside, selected ? 'opacity-full' : 'opacity-0']"
16
16
  />
17
17
  </div>
18
18
  <UnCard
19
19
  :item="item"
20
20
  class="!bg-transparent grow-1"
21
- :class="[customClass.card, customClass[selected ? 'selected' : 'notSelected']?.card]"
22
- :custom-class="_mergeWith(customClass.item, customClass[selected ? 'selected' : 'notSelected']?.item, merge)"
21
+ :class="customClass.card"
22
+ :custom-class="customClass.item"
23
+ :info-icon="infoIcon"
23
24
  />
24
25
  </div>
25
26
  </template>
26
27
 
27
28
  <script setup>
28
- import { _mergeWith, merge } from "#imports";
29
29
  const emit = defineEmits(["input"]);
30
30
  const { customClass = {}, disabled } = defineProps({
31
31
  value: { type: null, required: true },
32
32
  item: { type: Object, required: true },
33
33
  selected: { type: Boolean, required: false },
34
34
  customClass: { type: Object, required: false },
35
- disabled: { type: Boolean, required: false }
35
+ disabled: { type: Boolean, required: false },
36
+ infoIcon: { type: String, required: false }
36
37
  });
37
38
  const toggle = () => {
38
39
  if (disabled) return;
@@ -12,6 +12,7 @@ type __VLS_Props = {
12
12
  selected?: boolean;
13
13
  customClass?: RadioCustomClass;
14
14
  disabled?: boolean;
15
+ infoIcon?: string;
15
16
  };
16
17
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
18
  declare const _default: typeof __VLS_export;
@@ -16,8 +16,6 @@ type __VLS_Props = {
16
16
  customClass?: Partial<Record<'header' | 'icon' | 'label' | 'arrowIcon' | 'wrapper' | 'innerWrapper' | 'search' | 'list' | 'radio' | 'checkbox' | 'checkboxButton', unknown>> & {
17
17
  radioItem?: RadioCustomClass;
18
18
  checkboxItem?: CheckboxCustomClass;
19
- selected: Partial<Record<'radio' | 'checkbox', string>>;
20
- notSelected: Partial<Record<'radio' | 'checkbox', string>>;
21
19
  };
22
20
  };
23
21
  type __VLS_ModelProps = {
@@ -73,7 +73,7 @@
73
73
  :key="Value(option)"
74
74
  :value="Value(option)"
75
75
  :item="Label(option)"
76
- :class="[customClass.checkbox, customClass[value?.includes?.(Value(option)) ? 'selected' : 'notSelected']?.checkbox]"
76
+ :class="customClass.checkbox"
77
77
  :custom-class="customClass.checkboxItem"
78
78
  :selected="value?.includes?.(Value(option))"
79
79
  :disabled="option.disable"
@@ -94,7 +94,7 @@
94
94
  :key="Value(option)"
95
95
  :value="Value(option)"
96
96
  :item="Label(option)"
97
- :class="[customClass.radio, customClass[isEqual(Value(option), value) ? 'selected' : 'notSelected']?.radio]"
97
+ :class="customClass.radio"
98
98
  :custom-class="customClass.radioItem"
99
99
  :selected="isEqual(Value(option), value)"
100
100
  :disabled="option.disable"
@@ -138,12 +138,10 @@ const close = (e = {}) => {
138
138
  const name = e?.target?.id;
139
139
  const pname = e?.target?.parentElement?.id;
140
140
  const ppname = e?.target?.parentElement?.parentElement?.id;
141
- console.log(e);
142
141
  if ([name, pname, ppname].includes(id)) return;
143
142
  show.value = false;
144
143
  };
145
144
  const toggle = () => {
146
- console.log("aaa");
147
145
  show.value = !show.value;
148
146
  };
149
147
  const dropdownStyles = ref({});
@@ -16,8 +16,6 @@ type __VLS_Props = {
16
16
  customClass?: Partial<Record<'header' | 'icon' | 'label' | 'arrowIcon' | 'wrapper' | 'innerWrapper' | 'search' | 'list' | 'radio' | 'checkbox' | 'checkboxButton', unknown>> & {
17
17
  radioItem?: RadioCustomClass;
18
18
  checkboxItem?: CheckboxCustomClass;
19
- selected: Partial<Record<'radio' | 'checkbox', string>>;
20
- notSelected: Partial<Record<'radio' | 'checkbox', string>>;
21
19
  };
22
20
  };
23
21
  type __VLS_ModelProps = {
@@ -1,7 +1,3 @@
1
- <template>
2
-
3
- </template>
4
-
5
1
  <script setup>
6
2
  const props = defineProps({
7
3
  name: { type: String, required: false }
@@ -9,11 +9,11 @@ type __VLS_Props = {
9
9
  pagination?: boolean;
10
10
  initialSlide?: number;
11
11
  };
12
- declare var __VLS_11: {
12
+ declare var __VLS_13: {
13
13
  item: any;
14
14
  };
15
15
  type __VLS_Slots = {} & {
16
- default?: (props: typeof __VLS_11) => any;
16
+ default?: (props: typeof __VLS_13) => any;
17
17
  };
18
18
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -9,11 +9,11 @@ type __VLS_Props = {
9
9
  pagination?: boolean;
10
10
  initialSlide?: number;
11
11
  };
12
- declare var __VLS_11: {
12
+ declare var __VLS_13: {
13
13
  item: any;
14
14
  };
15
15
  type __VLS_Slots = {} & {
16
- default?: (props: typeof __VLS_11) => any;
16
+ default?: (props: typeof __VLS_13) => any;
17
17
  };
18
18
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -77,6 +77,7 @@ const Title = computed(() => {
77
77
  if (transaction.type === "TRANSFER" && transaction.toWallet?.userId !== userId.value) {
78
78
  return `\u0627\u0631\u0633\u0627\u0644 \u0634\u0627\u0631\u0698 ${transaction.wallet?.coin?.name} \u0628\u0647 ${transaction.toWallet?.user?.profile?.firstName || ""} ${transaction.toWallet?.user?.profile?.lastName || ""}`;
79
79
  }
80
+ return "";
80
81
  });
81
82
  const statusVariant = computed(() => ["REJECTED", "FAILED"].includes(transaction.status) ? "text-danger" : transaction.type === "DEPOSIT" || transaction.type === "TRANSFER" && transaction.toWallet?.userId === userId.value ? "text-success" : "text-danger");
82
83
  const statusIcon = computed(() => ["REJECTED", "FAILED"].includes(transaction.status) ? "solar:danger-circle-bold-duotone" : transaction.type === "DEPOSIT" || transaction.type === "TRANSFER" && transaction.toWallet?.userId === userId.value ? "solar:import-bold-duotone" : "solar:export-bold-duotone");
@@ -5,9 +5,9 @@ type __VLS_WithSlots<T, S> = T & (new () => {
5
5
  $slots: S;
6
6
  });
7
7
  declare const __VLS_base: import("vue").DefineComponent<{}, {
8
- $props: Partial<typeof props>;
9
- label: string;
8
+ $props: Partial<typeof __VLS_props>;
10
9
  icon: string;
10
+ label: string;
11
11
  disabled: boolean;
12
12
  accept: string;
13
13
  edit: boolean;
@@ -15,9 +15,9 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
15
15
  type __VLS_Slots = {
16
16
  icon?: ((props: {}) => any) | undefined;
17
17
  };
18
- declare const props: {
19
- readonly label: string;
18
+ declare const __VLS_props: {
20
19
  readonly icon: string;
20
+ readonly label: string;
21
21
  readonly disabled: boolean;
22
22
  readonly accept: string;
23
23
  readonly edit: boolean;
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
 
53
53
  <script setup>
54
- const props = defineProps({
54
+ defineProps({
55
55
  edit: {
56
56
  type: Boolean,
57
57
  default: true
@@ -5,9 +5,9 @@ type __VLS_WithSlots<T, S> = T & (new () => {
5
5
  $slots: S;
6
6
  });
7
7
  declare const __VLS_base: import("vue").DefineComponent<{}, {
8
- $props: Partial<typeof props>;
9
- label: string;
8
+ $props: Partial<typeof __VLS_props>;
10
9
  icon: string;
10
+ label: string;
11
11
  disabled: boolean;
12
12
  accept: string;
13
13
  edit: boolean;
@@ -15,9 +15,9 @@ declare const __VLS_base: import("vue").DefineComponent<{}, {
15
15
  type __VLS_Slots = {
16
16
  icon?: ((props: {}) => any) | undefined;
17
17
  };
18
- declare const props: {
19
- readonly label: string;
18
+ declare const __VLS_props: {
20
19
  readonly icon: string;
20
+ readonly label: string;
21
21
  readonly disabled: boolean;
22
22
  readonly accept: string;
23
23
  readonly edit: boolean;
@@ -124,6 +124,7 @@ const mappedWallet = computed(() => wallets.value.map((e) => ({
124
124
  icon: e.coin?.icon,
125
125
  title: e.coin?.name,
126
126
  unit: e.coin?.unit,
127
+ info: e.coin?.info,
127
128
  description: ["\u0645\u0627\u0646\u062F\u0647:", _ceil(e.balance || 0, e.coin?.precision || 0)?.toLocaleString("en"), e.coin?.isFiat ? "\u062A\u0648\u0645\u0627\u0646" : e.coin?.unit].join(" "),
128
129
  type: "wallet"
129
130
  })));
@@ -1,30 +1,51 @@
1
1
  import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
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;
2
+ declare global {
3
+ interface Window {
4
+ BASE_URL?: string;
5
+ APP_CODE?: string;
6
+ NESHAN_API_KEY?: string;
7
+ NESHAN_WEB_KEY?: string;
8
+ urlPrefix?: string;
9
+ }
10
+ }
11
+ type Config = NitroFetchOptions<NitroFetchRequest, 'get' | 'post' | 'put' | 'delete'> & {
12
+ headers?: Record<string, unknown>;
13
+ };
14
+ export declare const fetch: <T>({ body, config, controller, URL, method, }: {
15
+ body?: Record<string, unknown>;
16
+ config?: Config;
17
+ controller?: AbortController;
18
+ URL?: string;
19
+ method?: "GET" | "POST" | "PUT" | "DELETE";
8
20
  }) => Promise<{
9
- error: never;
21
+ result: undefined;
22
+ error: Record<string, Record<string, unknown>>;
10
23
  } | {
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">;
24
+ result: T;
25
+ error: undefined;
12
26
  }>;
13
- export declare const useGet: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "get"> | {
14
- headers?: Record<string, never>;
27
+ export declare const useGet: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "get"> & {
28
+ headers?: Record<string, unknown>;
15
29
  }, controller?: AbortController | undefined) => Promise<{
16
30
  result?: T;
17
- error?: never;
31
+ error?: unknown;
18
32
  }>;
19
- export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete">, controller?: AbortController | undefined) => Promise<{
33
+ export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete"> & {
34
+ headers?: Record<string, unknown>;
35
+ }, controller?: AbortController | undefined) => Promise<{
20
36
  result?: T;
21
- error?: never;
37
+ error?: unknown;
22
38
  }>;
23
- export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post">, controller?: AbortController | undefined) => Promise<{
39
+ export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post"> & {
40
+ headers?: Record<string, unknown>;
41
+ }, controller?: AbortController | undefined) => Promise<{
24
42
  result?: T;
25
- error?: never;
43
+ error?: unknown;
26
44
  }>;
27
- export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put">, controller?: AbortController | undefined) => Promise<{
45
+ export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put"> & {
46
+ headers?: Record<string, unknown>;
47
+ }, controller?: AbortController | undefined) => Promise<{
28
48
  result?: T;
29
- error?: never;
49
+ error?: unknown;
30
50
  }>;
51
+ export {};
@@ -1,7 +1,5 @@
1
1
  import { useModuleConfig, useToken } from "./reuseable.js";
2
- import { _get, _set, useNuxtApp, _takeRight } from "#imports";
3
- const domain = location.hostname.split(".");
4
- const tld = _takeRight(domain, 2).join(".");
2
+ import { _get, _set, useNuxtApp, isArray } from "#imports";
5
3
  const setHeaders = (config) => {
6
4
  const token = useToken();
7
5
  _set(config, ["headers", "Authorization"], _get(config, ["headers", "Authorization"], token.value || ""));
@@ -9,18 +7,29 @@ const setHeaders = (config) => {
9
7
  return config;
10
8
  };
11
9
  const errorHandler = (error, config) => {
12
- const msg = error?.data?.errors?.map((e) => e.field + ":" + e.message).join(" , ");
13
- if (!config?.headers?.["no-error"]) {
14
- const { $toast } = useNuxtApp();
15
- $toast?.error(msg || JSON.stringify(error?.data));
10
+ if ("data" in error) {
11
+ let msg = "";
12
+ if ("errors" in error.data && isArray(error.data.errors)) {
13
+ msg = error?.data?.errors?.map?.((e) => e.field + ":" + e.message).join(" , ");
14
+ }
15
+ if (!config?.headers?.["no-error"]) {
16
+ const { $toast } = useNuxtApp();
17
+ $toast?.error(msg || JSON.stringify(error?.data));
18
+ }
16
19
  }
17
- return { error };
20
+ return { result: void 0, error };
18
21
  };
19
- export const fetch = async ({ body = void 0, config = {}, controller = void 0, URL = "", method = "GET" }) => {
22
+ export const fetch = async ({
23
+ body = void 0,
24
+ config = {},
25
+ controller = void 0,
26
+ URL = "",
27
+ method = "GET"
28
+ }) => {
20
29
  const moduleConfig = useModuleConfig();
21
30
  controller = new AbortController();
22
31
  const signal = controller.signal;
23
- config = setHeaders(config);
32
+ config = setHeaders(config || {});
24
33
  try {
25
34
  const result = await $fetch(URL, {
26
35
  baseURL: window.BASE_URL || moduleConfig?.BASE_URL,
@@ -29,7 +38,7 @@ export const fetch = async ({ body = void 0, config = {}, controller = void 0, U
29
38
  body,
30
39
  ...config
31
40
  });
32
- return { result };
41
+ return { result, error: void 0 };
33
42
  } catch (error) {
34
43
  return errorHandler(error, config);
35
44
  }
@@ -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: any) => Promise<unknown>;
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: any, key: any) => import("vue").WritableComputedRef<any, any>;
13
- export declare const useComputedLodash: (value: any, keys: (string | number)[] | string) => import("vue").WritableComputedRef<any, any>;
14
- export declare const KMapper: (num: any) => string;
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: any) => boolean;
31
- export declare const remainToExpire: (timestamp: any, time: string) => string[];
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: () => import("socket.io-client").Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
36
- export declare const watchSocket: (socket: any, joinObject: SocketJoinObject, dataHandler: any, loading?: import("vue").Ref<boolean, boolean>, initHandler?: () => Promise<void>) => void;
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 encrypt: (text: any, passphrase: any) => any;
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: any, discount?: DiscountCode) => any;
48
- export declare const formattedAddress: ([lng, lat]: Address) => Promise<any>;
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<any>;
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;