@unsource/ui 2.0.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "2.0.13",
4
+ "version": "2.0.15",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
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
 
@@ -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 BASE_URL: any;
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, any>;
5
- }, controller?: any) => Promise<{
14
+ headers?: Record<string, never>;
15
+ }, controller?: AbortController | undefined) => Promise<{
6
16
  result?: T;
7
- error?: any;
17
+ error?: never;
8
18
  }>;
9
- export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete">) => Promise<{
19
+ export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete">, controller?: AbortController | undefined) => Promise<{
10
20
  result?: T;
11
- error?: any;
21
+ error?: never;
12
22
  }>;
13
- export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post">) => Promise<{
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?: any;
25
+ error?: never;
16
26
  }>;
17
- export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put">) => Promise<{
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?: any;
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 useGet = async (URL, config = {}, controller = void 0) => {
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: "GET",
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 useDelete = async (URL, config = {}) => {
37
- config = setHeaders(config);
38
- try {
39
- const result = await $fetch(URL, {
40
- baseURL: BASE_URL,
41
- method: "DELETE",
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 usePost = async (URL, data, config = {}) => {
50
- config = setHeaders(config);
51
- try {
52
- const result = await $fetch(URL, {
53
- baseURL: BASE_URL,
54
- method: "POST",
55
- body: data,
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 usePut = async (URL, data, config = {}) => {
64
- config = setHeaders(config);
65
- try {
66
- const result = await $fetch(URL, {
67
- baseURL: BASE_URL,
68
- method: "PUT",
69
- body: data,
70
- ...config
71
- });
72
- return { result };
73
- } catch (error) {
74
- return errorHandler(error, config);
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
  };
@@ -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,
@@ -152,7 +151,7 @@ export const minutesToTime = (m = 0) => {
152
151
  return `${hour.padStart(2, 0)}:${minute.padStart(2, 0)}`;
153
152
  };
154
153
  export const useSocketIo = () => {
155
- const socket = io(BASE_URL, {
154
+ const socket = io(window.BASE_URL, {
156
155
  extraHeaders: {
157
156
  authorization: useToken().value || ""
158
157
  // 'app-code': APP_CODE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "2.0.13",
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",