@instockng/storefront-ui 1.0.15 → 1.0.17

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 (96) hide show
  1. package/dist/components/OrderConfirmation.d.ts.map +1 -1
  2. package/dist/components/ui/button.d.ts +1 -1
  3. package/dist/index10.mjs +3 -3
  4. package/dist/index100.mjs +33 -5
  5. package/dist/index101.mjs +31 -33
  6. package/dist/index102.mjs +26 -29
  7. package/dist/index103.mjs +59 -26
  8. package/dist/index104.mjs +3 -61
  9. package/dist/index105.mjs +2 -3
  10. package/dist/index106.mjs +2 -2
  11. package/dist/index107.mjs +17 -2
  12. package/dist/index108.mjs +11 -15
  13. package/dist/index109.mjs +6 -13
  14. package/dist/index11.mjs +2 -2
  15. package/dist/index110.mjs +30 -6
  16. package/dist/index13.mjs +1 -1
  17. package/dist/index17.mjs +2 -2
  18. package/dist/index18.mjs +12 -21
  19. package/dist/index20.mjs +4 -9
  20. package/dist/index21.mjs +1 -1
  21. package/dist/index28.mjs +11 -11
  22. package/dist/index29.mjs +1 -1
  23. package/dist/index30.mjs +1 -1
  24. package/dist/index31.mjs +1 -1
  25. package/dist/index32.mjs +1 -1
  26. package/dist/index33.mjs +1433 -4
  27. package/dist/index34.mjs +2 -1433
  28. package/dist/index35.mjs +57 -2
  29. package/dist/index36.mjs +48 -54
  30. package/dist/index37.mjs +33 -51
  31. package/dist/index38.mjs +15 -33
  32. package/dist/index39.mjs +2260 -12
  33. package/dist/index4.mjs +37 -37
  34. package/dist/index40.mjs +36 -2263
  35. package/dist/index41.mjs +44 -36
  36. package/dist/index42.mjs +99 -44
  37. package/dist/index43.mjs +97 -99
  38. package/dist/index44.mjs +47 -78
  39. package/dist/index45.mjs +54 -53
  40. package/dist/index46.mjs +63 -55
  41. package/dist/index47.mjs +56 -79
  42. package/dist/index48.mjs +57 -63
  43. package/dist/index49.mjs +15 -70
  44. package/dist/index50.mjs +14 -14
  45. package/dist/index51.mjs +59 -13
  46. package/dist/index52.mjs +99 -36
  47. package/dist/index53.mjs +97 -97
  48. package/dist/index54.mjs +4 -132
  49. package/dist/index58.mjs +2 -2
  50. package/dist/index59.mjs +234 -3
  51. package/dist/index60.mjs +6 -2
  52. package/dist/index61.mjs +133 -4
  53. package/dist/index62.mjs +64 -30
  54. package/dist/index63.mjs +84 -40
  55. package/dist/index64.mjs +23 -229
  56. package/dist/index65.mjs +8 -5
  57. package/dist/index66.mjs +66 -125
  58. package/dist/index67.mjs +3 -67
  59. package/dist/index68.mjs +2 -87
  60. package/dist/index69.mjs +78 -24
  61. package/dist/index70.mjs +52 -7
  62. package/dist/index71.mjs +5 -74
  63. package/dist/index72.mjs +4 -3
  64. package/dist/index73.mjs +179 -2
  65. package/dist/index74.mjs +49 -79
  66. package/dist/index75.mjs +68 -53
  67. package/dist/index76.mjs +34 -6
  68. package/dist/index77.mjs +42 -4
  69. package/dist/index78.mjs +3 -178
  70. package/dist/index79.mjs +2 -53
  71. package/dist/index80.mjs +21 -69
  72. package/dist/index81.mjs +54 -19
  73. package/dist/index82.mjs +28 -55
  74. package/dist/index83.mjs +5 -27
  75. package/dist/index84.mjs +51 -6
  76. package/dist/index85.mjs +5 -51
  77. package/dist/index86.mjs +12 -6
  78. package/dist/index87.mjs +7 -12
  79. package/dist/index88.mjs +27 -6
  80. package/dist/index89.mjs +2 -28
  81. package/dist/index90.mjs +70 -2
  82. package/dist/index91.mjs +164 -67
  83. package/dist/index92.mjs +28 -164
  84. package/dist/index93.mjs +10 -30
  85. package/dist/index94.mjs +3 -10
  86. package/dist/index95.mjs +3 -3
  87. package/dist/index96.mjs +13 -4
  88. package/dist/index97.mjs +7 -13
  89. package/dist/index98.mjs +12 -7
  90. package/dist/index99.mjs +4 -11
  91. package/dist/styles.css +1 -1
  92. package/package.json +11 -11
  93. package/src/components/OrderConfirmation.tsx +6 -1
  94. package/dist/index111.mjs +0 -33
  95. package/dist/test-utils/MockCartProvider.d.ts +0 -21
  96. package/dist/test-utils/MockCartProvider.d.ts.map +0 -1
package/dist/index49.mjs CHANGED
@@ -1,77 +1,22 @@
1
1
  'use client';
2
- import { useQueryClient as d, useMutation as v } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as l } from "./index61.mjs";
4
- import { createAdminRpcClients as u, authHeaders as c } from "./index21.mjs";
5
- import { queryKeys as s } from "./index26.mjs";
6
- import { useApiConfig as y } from "./index19.mjs";
7
- function m(n, r) {
8
- const { baseURL: o, authToken: t } = y();
9
- return l({
10
- queryKey: s.admin.inventory.list(n),
2
+ import { useQueryUnwrapped as i } from "./index54.mjs";
3
+ import { createAdminRpcClients as n, authHeaders as u } from "./index21.mjs";
4
+ import { queryKeys as m } from "./index26.mjs";
5
+ import { useApiConfig as a } from "./index19.mjs";
6
+ function h(e, t) {
7
+ const { baseURL: s, authToken: o } = a();
8
+ return i({
9
+ queryKey: m.admin.customers.history(e),
11
10
  queryFn: async () => {
12
- const e = await u(o).inventory.index.$get({ query: n }, c(t));
13
- if (!e.ok) throw new Error(`Failed to fetch inventory: ${e.statusText}`);
14
- return e.json();
11
+ const r = await n(s).customers.history.$get({ query: { phone: e } }, u(o));
12
+ if (!r.ok)
13
+ throw new Error(`Failed to fetch customer history: ${r.statusText}`);
14
+ return r.json();
15
15
  },
16
- ...r
17
- });
18
- }
19
- function T(n) {
20
- const { baseURL: r, authToken: o } = y(), t = d();
21
- return v({
22
- mutationFn: async (a) => {
23
- const i = await u(r).inventory.adjust.$post({ json: a }, c(o));
24
- if (!i.ok) throw new Error(`Failed to adjust inventory: ${i.statusText}`);
25
- return i.json();
26
- },
27
- onSuccess: () => {
28
- t.invalidateQueries({ queryKey: s.admin.inventory.all }), t.invalidateQueries({ queryKey: s.admin.variants.all }), t.invalidateQueries({ queryKey: s.admin.warehouses.all });
29
- },
30
- ...n
31
- });
32
- }
33
- function j(n) {
34
- const { baseURL: r, authToken: o } = y(), t = d();
35
- return v({
36
- mutationFn: async (a) => {
37
- const i = await u(r).inventory.transfer.$post({ json: a }, c(o));
38
- if (!i.ok) throw new Error(`Failed to transfer inventory: ${i.statusText}`);
39
- return i.json();
40
- },
41
- onSuccess: () => {
42
- t.invalidateQueries({ queryKey: s.admin.inventory.all }), t.invalidateQueries({ queryKey: s.admin.warehouses.all });
43
- },
44
- ...n
45
- });
46
- }
47
- function F(n, r) {
48
- const { baseURL: o, authToken: t } = y();
49
- return l({
50
- queryKey: s.admin.inventory.transactions(n),
51
- queryFn: async () => {
52
- const e = await u(o).inventory.transactions.$get({ query: n }, c(t));
53
- if (!e.ok) throw new Error(`Failed to fetch inventory transactions: ${e.statusText}`);
54
- return e.json();
55
- },
56
- ...r
57
- });
58
- }
59
- function $(n, r) {
60
- const { baseURL: o, authToken: t } = y();
61
- return l({
62
- queryKey: s.admin.inventory.lowStock(n == null ? void 0 : n.brandId),
63
- queryFn: async () => {
64
- const e = await u(o).inventory["low-stock"].$get({ query: n }, c(t));
65
- if (!e.ok) throw new Error(`Failed to fetch low stock alerts: ${e.statusText}`);
66
- return e.json();
67
- },
68
- ...r
16
+ enabled: !!e,
17
+ ...t
69
18
  });
70
19
  }
71
20
  export {
72
- T as useAdjustInventory,
73
- F as useGetInventoryTransactions,
74
- $ as useGetLowStockVariants,
75
- m as useListInventory,
76
- j as useTransferInventory
21
+ h as useGetCustomerHistory
77
22
  };
package/dist/index50.mjs CHANGED
@@ -1,21 +1,21 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as i } from "./index61.mjs";
3
- import { createAdminRpcClients as n, authHeaders as u } from "./index21.mjs";
4
- import { queryKeys as m } from "./index26.mjs";
5
- import { useApiConfig as a } from "./index19.mjs";
6
- function h(e, t) {
7
- const { baseURL: s, authToken: o } = a();
8
- return i({
9
- queryKey: m.admin.customers.history(e),
2
+ import { useQueryUnwrapped as s } from "./index54.mjs";
3
+ import { createAdminRpcClients as i, authHeaders as u } from "./index21.mjs";
4
+ import { queryKeys as c } from "./index26.mjs";
5
+ import { useApiConfig as d } from "./index19.mjs";
6
+ function h(t, r) {
7
+ const { baseURL: n, authToken: o } = d();
8
+ return s({
9
+ queryKey: c.admin.stats.overview(t == null ? void 0 : t.brandId),
10
10
  queryFn: async () => {
11
- const r = await n(s).customers.history.$get({ query: { phone: e } }, u(o));
12
- if (!r.ok) throw new Error(`Failed to fetch customer history: ${r.statusText}`);
13
- return r.json();
11
+ const e = await i(n).stats.index.$get({ query: t }, u(o));
12
+ if (!e.ok)
13
+ throw new Error(`Failed to fetch statistics: ${e.statusText}`);
14
+ return e.json();
14
15
  },
15
- enabled: !!e,
16
- ...t
16
+ ...r
17
17
  });
18
18
  }
19
19
  export {
20
- h as useGetCustomerHistory
20
+ h as useGetStats
21
21
  };
package/dist/index51.mjs CHANGED
@@ -1,20 +1,66 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as s } from "./index61.mjs";
3
- import { createAdminRpcClients as i, authHeaders as u } from "./index21.mjs";
4
- import { queryKeys as c } from "./index26.mjs";
5
- import { useApiConfig as d } from "./index19.mjs";
6
- function h(t, r) {
7
- const { baseURL: n, authToken: o } = d();
8
- return s({
9
- queryKey: c.admin.stats.overview(t == null ? void 0 : t.brandId),
2
+ import { useQueryClient as l, useMutation as y } from "@tanstack/react-query";
3
+ import { useQueryUnwrapped as c } from "./index54.mjs";
4
+ import { createAdminRpcClients as s, authHeaders as o } from "./index21.mjs";
5
+ import { queryKeys as i } from "./index26.mjs";
6
+ import { useApiConfig as u } from "./index19.mjs";
7
+ function m(e, n) {
8
+ const { baseURL: a, authToken: r } = u();
9
+ return c({
10
+ queryKey: i.admin.abandonedCarts.list(e),
10
11
  queryFn: async () => {
11
- const e = await i(n).stats.index.$get({ query: t }, u(o));
12
- if (!e.ok) throw new Error(`Failed to fetch statistics: ${e.statusText}`);
13
- return e.json();
12
+ const t = await s(a).abandonedCarts.index.$get({ query: e }, o(r));
13
+ if (!t.ok)
14
+ throw new Error(`Failed to fetch abandoned carts: ${t.statusText}`);
15
+ return t.json();
14
16
  },
15
- ...r
17
+ ...n
18
+ });
19
+ }
20
+ function p(e, n) {
21
+ const { baseURL: a, authToken: r } = u();
22
+ return c({
23
+ queryKey: i.admin.abandonedCarts.stats(e == null ? void 0 : e.brandId),
24
+ queryFn: async () => {
25
+ const t = await s(a).abandonedCarts.stats.$get({ query: e }, o(r));
26
+ if (!t.ok)
27
+ throw new Error(`Failed to fetch abandoned cart stats: ${t.statusText}`);
28
+ return t.json();
29
+ },
30
+ ...n
31
+ });
32
+ }
33
+ function q(e, n) {
34
+ const { baseURL: a, authToken: r } = u();
35
+ return c({
36
+ queryKey: i.admin.abandonedCarts.detail(e),
37
+ queryFn: async () => {
38
+ const t = await s(a).abandonedCarts[":id"].$get({ param: { id: e } }, o(r));
39
+ if (!t.ok)
40
+ throw new Error(`Failed to fetch abandoned cart: ${t.statusText}`);
41
+ return t.json();
42
+ },
43
+ ...n
44
+ });
45
+ }
46
+ function k(e) {
47
+ const { baseURL: n, authToken: a } = u(), r = l();
48
+ return y({
49
+ mutationFn: async () => {
50
+ const t = await s(n).abandonedCarts.cleanup.$post({}, o(a));
51
+ if (!t.ok)
52
+ throw new Error(`Failed to cleanup expired carts: ${t.statusText}`);
53
+ return t.json();
54
+ },
55
+ onSuccess: () => {
56
+ r.invalidateQueries({ queryKey: i.admin.abandonedCarts.all });
57
+ },
58
+ ...e
16
59
  });
17
60
  }
18
61
  export {
19
- h as useGetStats
62
+ k as useCleanupExpiredCarts,
63
+ q as useGetAbandonedCart,
64
+ p as useGetAbandonedCartStats,
65
+ m as useListAbandonedCarts
20
66
  };
package/dist/index52.mjs CHANGED
@@ -1,65 +1,128 @@
1
1
  'use client';
2
2
  import { useQueryClient as l, useMutation as y } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as c } from "./index61.mjs";
4
- import { createAdminRpcClients as s, authHeaders as o } from "./index21.mjs";
5
- import { queryKeys as i } from "./index26.mjs";
6
- import { useApiConfig as u } from "./index19.mjs";
7
- function m(e, n) {
8
- const { baseURL: a, authToken: r } = u();
9
- return c({
10
- queryKey: i.admin.abandonedCarts.list(e),
3
+ import { useQueryUnwrapped as C } from "./index54.mjs";
4
+ import { createAdminRpcClients as c, authHeaders as a } from "./index21.mjs";
5
+ import { queryKeys as r } from "./index26.mjs";
6
+ import { useApiConfig as d } from "./index19.mjs";
7
+ function p(e, n) {
8
+ const { baseURL: s, authToken: i } = d();
9
+ return C({
10
+ queryKey: r.admin.discountCodes.list(e),
11
11
  queryFn: async () => {
12
- const t = await s(a).abandonedCarts.index.$get({ query: e }, o(r));
13
- if (!t.ok) throw new Error(`Failed to fetch abandoned carts: ${t.statusText}`);
12
+ const t = await c(s).discountCodes.index.$get({ query: e }, a(i));
13
+ if (!t.ok)
14
+ throw new Error(`Failed to fetch discount codes: ${t.statusText}`);
14
15
  return t.json();
15
16
  },
16
17
  ...n
17
18
  });
18
19
  }
19
- function p(e, n) {
20
- const { baseURL: a, authToken: r } = u();
21
- return c({
22
- queryKey: i.admin.abandonedCarts.stats(e == null ? void 0 : e.brandId),
20
+ function F(e, n) {
21
+ const { baseURL: s, authToken: i } = d();
22
+ return C({
23
+ queryKey: r.admin.discountCodes.detail(e),
23
24
  queryFn: async () => {
24
- const t = await s(a).abandonedCarts.stats.$get({ query: e }, o(r));
25
- if (!t.ok) throw new Error(`Failed to fetch abandoned cart stats: ${t.statusText}`);
25
+ const t = await c(s).discountCodes[":id"].$get({ param: { id: e } }, a(i));
26
+ if (!t.ok)
27
+ throw new Error(`Failed to fetch discount code: ${t.statusText}`);
26
28
  return t.json();
27
29
  },
28
30
  ...n
29
31
  });
30
32
  }
31
- function q(e, n) {
32
- const { baseURL: a, authToken: r } = u();
33
- return c({
34
- queryKey: i.admin.abandonedCarts.detail(e),
35
- queryFn: async () => {
36
- const t = await s(a).abandonedCarts[":id"].$get(
37
- { param: { id: e } },
38
- o(r)
39
- );
40
- if (!t.ok) throw new Error(`Failed to fetch abandoned cart: ${t.statusText}`);
41
- return t.json();
33
+ function T(e) {
34
+ const { baseURL: n, authToken: s } = d(), i = l();
35
+ return y({
36
+ mutationFn: async (o) => {
37
+ const u = await c(n).discountCodes.index.$post({ json: o }, a(s));
38
+ if (!u.ok)
39
+ throw new Error(`Failed to create discount code: ${u.statusText}`);
40
+ return u.json();
41
+ },
42
+ onSuccess: () => {
43
+ i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
44
+ },
45
+ ...e
46
+ });
47
+ }
48
+ function $(e, n) {
49
+ const { baseURL: s, authToken: i } = d(), o = l();
50
+ return y({
51
+ mutationFn: async (t) => {
52
+ const w = await c(s).discountCodes[":id"].$patch({ json: t, param: { id: e } }, a(i));
53
+ if (!w.ok)
54
+ throw new Error(`Failed to update discount code: ${w.statusText}`);
55
+ return w.json();
56
+ },
57
+ onSuccess: () => {
58
+ o.invalidateQueries({ queryKey: r.admin.discountCodes.detail(e) }), o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
42
59
  },
43
60
  ...n
44
61
  });
45
62
  }
46
- function k(e) {
47
- const { baseURL: n, authToken: a } = u(), r = l();
63
+ function v(e, n) {
64
+ const { baseURL: s, authToken: i } = d(), o = l();
48
65
  return y({
49
66
  mutationFn: async () => {
50
- const t = await s(n).abandonedCarts.cleanup.$post({}, o(a));
51
- if (!t.ok) throw new Error(`Failed to cleanup expired carts: ${t.statusText}`);
67
+ const u = await c(s).discountCodes[":id"].$delete({ param: { id: e } }, a(i));
68
+ if (!u.ok)
69
+ throw new Error(`Failed to delete discount code: ${u.statusText}`);
70
+ return u.json();
71
+ },
72
+ onSuccess: () => {
73
+ o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
74
+ },
75
+ ...n
76
+ });
77
+ }
78
+ function j(e, n) {
79
+ const { baseURL: s, authToken: i } = d();
80
+ return C({
81
+ queryKey: r.admin.discountCodes.analytics(e),
82
+ queryFn: async () => {
83
+ const t = await c(s).discountCodes[":id"].analytics.$get({ param: { id: e } }, a(i));
84
+ if (!t.ok)
85
+ throw new Error(`Failed to fetch discount code analytics: ${t.statusText}`);
52
86
  return t.json();
53
87
  },
88
+ ...n
89
+ });
90
+ }
91
+ function x(e) {
92
+ const { baseURL: n, authToken: s } = d(), i = l();
93
+ return y({
94
+ mutationFn: async (o) => {
95
+ const u = await c(n).discountCodes["bulk-generate"].$post({ json: o }, a(s));
96
+ if (!u.ok)
97
+ throw new Error(`Failed to bulk generate discount codes: ${u.statusText}`);
98
+ return u.json();
99
+ },
54
100
  onSuccess: () => {
55
- r.invalidateQueries({ queryKey: i.admin.abandonedCarts.all });
101
+ i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
102
+ },
103
+ ...e
104
+ });
105
+ }
106
+ function b(e) {
107
+ const { baseURL: n, authToken: s } = d();
108
+ return C({
109
+ queryKey: r.admin.discountCodes.overviewStats(),
110
+ queryFn: async () => {
111
+ const o = await c(n).discountCodes.stats.overview.$get({}, a(s));
112
+ if (!o.ok)
113
+ throw new Error(`Failed to fetch discount code overview stats: ${o.statusText}`);
114
+ return o.json();
56
115
  },
57
116
  ...e
58
117
  });
59
118
  }
60
119
  export {
61
- k as useCleanupExpiredCarts,
62
- q as useGetAbandonedCart,
63
- p as useGetAbandonedCartStats,
64
- m as useListAbandonedCarts
120
+ x as useBulkGenerateDiscountCodes,
121
+ T as useCreateDiscountCode,
122
+ v as useDeleteDiscountCode,
123
+ F as useGetDiscountCode,
124
+ j as useGetDiscountCodeAnalytics,
125
+ b as useGetDiscountCodeOverviewStats,
126
+ p as useListDiscountCodes,
127
+ $ as useUpdateDiscountCode
65
128
  };
package/dist/index53.mjs CHANGED
@@ -1,132 +1,132 @@
1
1
  'use client';
2
- import { useQueryClient as l, useMutation as y } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as C } from "./index61.mjs";
4
- import { createAdminRpcClients as c, authHeaders as a } from "./index21.mjs";
5
- import { queryKeys as r } from "./index26.mjs";
6
- import { useApiConfig as d } from "./index19.mjs";
7
- function p(e, n) {
8
- const { baseURL: s, authToken: i } = d();
9
- return C({
10
- queryKey: r.admin.discountCodes.list(e),
2
+ import { useQueryClient as y, useMutation as v } from "@tanstack/react-query";
3
+ import { useQueryUnwrapped as m } from "./index54.mjs";
4
+ import { createAdminRpcClients as u, authHeaders as l } from "./index21.mjs";
5
+ import { queryKeys as o } from "./index26.mjs";
6
+ import { useApiConfig as c } from "./index19.mjs";
7
+ function p(t) {
8
+ const { baseURL: s, authToken: i } = c();
9
+ return m({
10
+ queryKey: o.admin.deliveryZones.states.list(),
11
11
  queryFn: async () => {
12
- const t = await c(s).discountCodes.index.$get({ query: e }, a(i));
13
- if (!t.ok) throw new Error(`Failed to fetch discount codes: ${t.statusText}`);
14
- return t.json();
12
+ const e = await u(s).deliveryZones.states.$get({}, l(i));
13
+ if (!e.ok)
14
+ throw new Error(`Failed to fetch states: ${e.statusText}`);
15
+ return e.json();
15
16
  },
16
- ...n
17
+ ...t
17
18
  });
18
19
  }
19
- function F(e, n) {
20
- const { baseURL: s, authToken: i } = d();
21
- return C({
22
- queryKey: r.admin.discountCodes.detail(e),
23
- queryFn: async () => {
24
- const t = await c(s).discountCodes[":id"].$get(
25
- { param: { id: e } },
26
- a(i)
27
- );
28
- if (!t.ok) throw new Error(`Failed to fetch discount code: ${t.statusText}`);
29
- return t.json();
30
- },
31
- ...n
32
- });
33
- }
34
- function T(e) {
35
- const { baseURL: n, authToken: s } = d(), i = l();
36
- return y({
37
- mutationFn: async (o) => {
38
- const u = await c(n).discountCodes.index.$post({ json: o }, a(s));
39
- if (!u.ok) throw new Error(`Failed to create discount code: ${u.statusText}`);
40
- return u.json();
20
+ function k(t) {
21
+ const { baseURL: s, authToken: i } = c(), r = y();
22
+ return v({
23
+ mutationFn: async (e) => {
24
+ const n = await u(s).deliveryZones.states.$post({ json: e }, l(i));
25
+ if (!n.ok)
26
+ throw new Error(`Failed to create state: ${n.statusText}`);
27
+ return n.json();
41
28
  },
42
29
  onSuccess: () => {
43
- i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
30
+ r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
44
31
  },
45
- ...e
32
+ ...t
46
33
  });
47
34
  }
48
- function $(e, n) {
49
- const { baseURL: s, authToken: i } = d(), o = l();
50
- return y({
51
- mutationFn: async (t) => {
52
- const w = await c(s).discountCodes[":id"].$patch(
53
- { json: t, param: { id: e } },
54
- a(i)
55
- );
56
- if (!w.ok) throw new Error(`Failed to update discount code: ${w.statusText}`);
57
- return w.json();
35
+ function F(t, s) {
36
+ const { baseURL: i, authToken: r } = c(), e = y();
37
+ return v({
38
+ mutationFn: async (a) => {
39
+ const d = await u(i).deliveryZones.states[":id"].$patch({ json: a, param: { id: t } }, l(r));
40
+ if (!d.ok)
41
+ throw new Error(`Failed to update state: ${d.statusText}`);
42
+ return d.json();
58
43
  },
59
44
  onSuccess: () => {
60
- o.invalidateQueries({ queryKey: r.admin.discountCodes.detail(e) }), o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
45
+ e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
61
46
  },
62
- ...n
47
+ ...s
63
48
  });
64
49
  }
65
- function v(e, n) {
66
- const { baseURL: s, authToken: i } = d(), o = l();
67
- return y({
50
+ function T(t, s) {
51
+ const { baseURL: i, authToken: r } = c(), e = y();
52
+ return v({
68
53
  mutationFn: async () => {
69
- const u = await c(s).discountCodes[":id"].$delete(
70
- { param: { id: e } },
71
- a(i)
72
- );
73
- if (!u.ok) throw new Error(`Failed to delete discount code: ${u.statusText}`);
74
- return u.json();
54
+ const n = await u(i).deliveryZones.states[":id"].$delete({ param: { id: t } }, l(r));
55
+ if (!n.ok)
56
+ throw new Error(`Failed to delete state: ${n.statusText}`);
57
+ return n.json();
75
58
  },
76
59
  onSuccess: () => {
77
- o.invalidateQueries({ queryKey: r.admin.discountCodes.all });
60
+ e.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
78
61
  },
79
- ...n
62
+ ...s
80
63
  });
81
64
  }
82
- function j(e, n) {
83
- const { baseURL: s, authToken: i } = d();
84
- return C({
85
- queryKey: r.admin.discountCodes.analytics(e),
65
+ function $(t, s) {
66
+ const { baseURL: i, authToken: r } = c();
67
+ return m({
68
+ queryKey: o.admin.deliveryZones.zones.list(t),
86
69
  queryFn: async () => {
87
- const t = await c(s).discountCodes[":id"].analytics.$get(
88
- { param: { id: e } },
89
- a(i)
90
- );
91
- if (!t.ok) throw new Error(`Failed to fetch discount code analytics: ${t.statusText}`);
92
- return t.json();
70
+ const a = await u(i).deliveryZones.zones.$get({ query: t }, l(r));
71
+ if (!a.ok)
72
+ throw new Error(`Failed to fetch delivery zones: ${a.statusText}`);
73
+ return a.json();
93
74
  },
94
- ...n
75
+ ...s
95
76
  });
96
77
  }
97
- function x(e) {
98
- const { baseURL: n, authToken: s } = d(), i = l();
99
- return y({
100
- mutationFn: async (o) => {
101
- const u = await c(n).discountCodes["bulk-generate"].$post({ json: o }, a(s));
102
- if (!u.ok) throw new Error(`Failed to bulk generate discount codes: ${u.statusText}`);
103
- return u.json();
78
+ function z(t) {
79
+ const { baseURL: s, authToken: i } = c(), r = y();
80
+ return v({
81
+ mutationFn: async (e) => {
82
+ const n = await u(s).deliveryZones.zones.$post({ json: e }, l(i));
83
+ if (!n.ok)
84
+ throw new Error(`Failed to create delivery zone: ${n.statusText}`);
85
+ return n.json();
104
86
  },
105
87
  onSuccess: () => {
106
- i.invalidateQueries({ queryKey: r.admin.discountCodes.all });
88
+ r.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all }), r.invalidateQueries({ queryKey: o.admin.deliveryZones.states.all });
107
89
  },
108
- ...e
90
+ ...t
109
91
  });
110
92
  }
111
- function b(e) {
112
- const { baseURL: n, authToken: s } = d();
113
- return C({
114
- queryKey: r.admin.discountCodes.overviewStats(),
115
- queryFn: async () => {
116
- const o = await c(n).discountCodes.stats.overview.$get({}, a(s));
117
- if (!o.ok) throw new Error(`Failed to fetch discount code overview stats: ${o.statusText}`);
118
- return o.json();
93
+ function K(t, s) {
94
+ const { baseURL: i, authToken: r } = c(), e = y();
95
+ return v({
96
+ mutationFn: async (a) => {
97
+ const d = await u(i).deliveryZones.zones[":id"].$patch({ json: a, param: { id: t } }, l(r));
98
+ if (!d.ok)
99
+ throw new Error(`Failed to update delivery zone: ${d.statusText}`);
100
+ return d.json();
101
+ },
102
+ onSuccess: () => {
103
+ e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.detail(t) }), e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
104
+ },
105
+ ...s
106
+ });
107
+ }
108
+ function j(t, s) {
109
+ const { baseURL: i, authToken: r } = c(), e = y();
110
+ return v({
111
+ mutationFn: async () => {
112
+ const n = await u(i).deliveryZones.zones[":id"].$delete({ param: { id: t } }, l(r));
113
+ if (!n.ok)
114
+ throw new Error(`Failed to delete delivery zone: ${n.statusText}`);
115
+ return n.json();
116
+ },
117
+ onSuccess: () => {
118
+ e.invalidateQueries({ queryKey: o.admin.deliveryZones.zones.all });
119
119
  },
120
- ...e
120
+ ...s
121
121
  });
122
122
  }
123
123
  export {
124
- x as useBulkGenerateDiscountCodes,
125
- T as useCreateDiscountCode,
126
- v as useDeleteDiscountCode,
127
- F as useGetDiscountCode,
128
- j as useGetDiscountCodeAnalytics,
129
- b as useGetDiscountCodeOverviewStats,
130
- p as useListDiscountCodes,
131
- $ as useUpdateDiscountCode
124
+ z as useCreateDeliveryZone,
125
+ k as useCreateState,
126
+ j as useDeleteDeliveryZone,
127
+ T as useDeleteState,
128
+ $ as useListDeliveryZones,
129
+ p as useListStates,
130
+ K as useUpdateDeliveryZone,
131
+ F as useUpdateState
132
132
  };