@billgangcom/theme-lib 1.117.0 → 1.117.2

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 (46) hide show
  1. package/dist/{builder-tYS_fx1j.cjs → builder-DS9oBIXt.cjs} +13 -13
  2. package/dist/{builder-VKA664PR.js → builder-DcfIyRTw.js} +1212 -1211
  3. package/dist/builder-components-B7SAxgEM.cjs +5 -0
  4. package/dist/{builder-components-xx5QFYCm.js → builder-components-Dm-kWtxj.js} +1910 -1906
  5. package/dist/builder.cjs.js +1 -1
  6. package/dist/builder.es.js +212 -164
  7. package/dist/{charge-BTTelVH9.cjs → charge-B9XSDHYf.cjs} +37 -37
  8. package/dist/{charge-BVSghUTp.js → charge-CXy5zGzq.js} +5053 -4963
  9. package/dist/{checkout-Czl0XXKy.cjs → checkout-C4QKsh6P.cjs} +1 -1
  10. package/dist/{checkout-BvZF5GBN.js → checkout-C8pOrYnl.js} +7 -7
  11. package/dist/exports.cjs.js +1 -1
  12. package/dist/exports.es.js +7 -7
  13. package/dist/{index-EV9sIbPf.cjs → index-AhJGutkd.cjs} +1 -1
  14. package/dist/{index-D9JwIfEP.cjs → index-B60hdPLY.cjs} +1 -1
  15. package/dist/{index-BFAsDjg4.js → index-BPwoye0T.js} +10 -10
  16. package/dist/{index-YoA87E0j.cjs → index-BRTHm-r0.cjs} +1 -1
  17. package/dist/{index-WSIj7mXJ.cjs → index-BtS9bwZU.cjs} +1 -1
  18. package/dist/{index-D-Y2LPyz.js → index-CVXfHRHS.js} +5 -5
  19. package/dist/{index-Cfuai6uk.js → index-CWMP7EHj.js} +1 -1
  20. package/dist/{index-CJ3NwBR_.js → index-CgKO4Rfc.js} +5 -5
  21. package/dist/{index-CQGjV27J.cjs → index-DHDz9Z2M.cjs} +1 -1
  22. package/dist/{index-DlH7nhLu.js → index-DWwyC_5W.js} +5 -5
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.es.js +12 -12
  25. package/dist/order-BMAFH2EL.js +277 -0
  26. package/dist/order-VgDnKBla.cjs +1 -0
  27. package/dist/src/storefront/components/index.d.ts +1 -0
  28. package/dist/src/storefront/models/order.d.ts +1 -0
  29. package/dist/style.css +1 -1
  30. package/dist/{subscription-4ntHL0jJ.cjs → subscription-DaibYXfW.cjs} +1 -1
  31. package/dist/{subscription-BxRKKLjT.js → subscription-LF680WJT.js} +7 -7
  32. package/dist/{ticket-ZryFt3Gl.js → ticket-CQD0ZMj2.js} +5 -5
  33. package/dist/{ticket-BMP7CWTV.cjs → ticket-CraKfT7J.cjs} +1 -1
  34. package/dist/{top-up-DR2Qy-73.cjs → top-up-BY8uNtks.cjs} +1 -1
  35. package/dist/{top-up-CkfL0jBe.js → top-up-zL4MfdVN.js} +5 -5
  36. package/dist/ui-components-JBzZAyzL.cjs +1 -0
  37. package/dist/{ui-components-CL3XRzDd.js → ui-components-fiCrAhU8.js} +5 -5
  38. package/dist/ui.cjs.js +1 -1
  39. package/dist/ui.es.js +1 -1
  40. package/dist/{validation-8UtoT5cR.js → validation-Db2Od6AE.js} +11 -11
  41. package/dist/{validation-CZt2YZyc.cjs → validation-lxk5WFtw.cjs} +1 -1
  42. package/package.json +1 -1
  43. package/dist/builder-components-BER5mJmk.cjs +0 -5
  44. package/dist/order-Cxub8VWB.js +0 -356
  45. package/dist/order-D6bEahqA.cjs +0 -1
  46. package/dist/ui-components-Wg6-hSGe.cjs +0 -1
@@ -1,356 +0,0 @@
1
- import { jsx as o, Fragment as G, jsxs as l } from "react/jsx-runtime";
2
- import r, { useState as Q, useMemo as O } from "react";
3
- import { X as Z, p as H, M as ee, V as J, a7 as te } from "./builder-VKA664PR.js";
4
- import { f as oe, N as ne, P as ae, O as se, g as ce, b as ie, c as C, d as re, e as le, h as ue, i as de, j as me, V as he, k as pe, L as fe, T as _e, l as z, m as ge, n as ye, o as we } from "./charge-BVSghUTp.js";
5
- import { M as ke, I as X, g as A, e as Se } from "./ui-components-CL3XRzDd.js";
6
- import "./builder-components-xx5QFYCm.js";
7
- import "./ticket-ZryFt3Gl.js";
8
- import "react-dom";
9
- const ve = async (n = 1) => await oe({ PageNumber: n }), ct = () => {
10
- const [n, c] = r.useState(null), [d, e] = Q(null), [_, N] = r.useState(0), { page: g } = Z(), [S, u] = r.useState(!0);
11
- async function v() {
12
- u(!0);
13
- const { list: y, totalCount: i } = await ve(g);
14
- c(y), N(i), e(null), u(!1);
15
- }
16
- async function m() {
17
- const y = (n == null ? void 0 : n.map((a) => a.gatewayName)) || [], i = await ce(y);
18
- e(i);
19
- }
20
- return r.useEffect(() => {
21
- !d && n && m();
22
- }, [n, d]), r.useEffect(() => {
23
- v();
24
- }, [g]), /* @__PURE__ */ o(G, { children: n != null && n.length && n.length === 0 ? /* @__PURE__ */ o(
25
- ne,
26
- {
27
- title: "No Orders",
28
- description: "When you purchase products from our website, you'll see a history of orders here."
29
- }
30
- ) : /* @__PURE__ */ l(G, { children: [
31
- /* @__PURE__ */ o(ae, { title: "Orders" }),
32
- /* @__PURE__ */ o(
33
- se,
34
- {
35
- orders: n,
36
- gatewaysDetail: d,
37
- totalCount: _,
38
- isLoading: S
39
- }
40
- )
41
- ] }) });
42
- }, Ce = "_orderPage_gc87l_1", Ne = "_leftSection_gc87l_15", be = "_content_gc87l_35", Pe = "_main_gc87l_42", De = "_mainAntistock_gc87l_56", Oe = "_orderMainDataAntistock_gc87l_69", Ae = "_timelineBlockAntistock_gc87l_81", Re = "_footerAntistock_gc87l_92", Me = "_statusBlock_gc87l_104", Ie = "_timelineBlock_gc87l_81", Ve = "_footer_gc87l_92", Be = "_rightSection_gc87l_121", Le = "_header_gc87l_142", $e = "_productList_gc87l_150", Fe = "_mobileFooter_gc87l_157", Te = "_loaderContainer_gc87l_166", Ee = "_orderMainData_gc87l_69", We = "_prices_gc87l_181", xe = "_headerTitle_gc87l_185", qe = "_headerDescription_gc87l_189", s = {
43
- orderPage: Ce,
44
- leftSection: Ne,
45
- content: be,
46
- main: Pe,
47
- mainAntistock: De,
48
- orderMainDataAntistock: Oe,
49
- timelineBlockAntistock: Ae,
50
- footerAntistock: Re,
51
- statusBlock: Me,
52
- timelineBlock: Ie,
53
- footer: Ve,
54
- rightSection: Be,
55
- header: Le,
56
- productList: $e,
57
- mobileFooter: Fe,
58
- loaderContainer: Te,
59
- orderMainData: Ee,
60
- prices: We,
61
- headerTitle: xe,
62
- headerDescription: qe
63
- }, Ue = "_modalContent_1a05n_1", je = "_iconContainer_1a05n_16", Ge = "_warningIcon_1a05n_20", ze = "_title_1a05n_25", He = "_description_1a05n_33", Je = "_buttonContainer_1a05n_40", Xe = "_button_1a05n_40", h = {
64
- modalContent: Ue,
65
- iconContainer: je,
66
- warningIcon: Ge,
67
- title: ze,
68
- description: He,
69
- buttonContainer: Je,
70
- button: Xe
71
- }, Ye = ({
72
- isOpen: n,
73
- onClose: c,
74
- refundedAmount: d,
75
- currency: e
76
- }) => {
77
- var b, w;
78
- const _ = H(), { token: N, shopDomain: g } = ee(), { isAntistock: S, general: u } = J(), v = !!((b = u == null ? void 0 : u.info) != null && b.disableSupport), m = (w = u == null ? void 0 : u.info) == null ? void 0 : w.thirdPartySupportUrl, y = !(v && !m), i = new Intl.NumberFormat("en-US", {
79
- style: "currency",
80
- currency: e
81
- }), a = () => {
82
- _(S ? "/account" : "/customer-dash");
83
- }, R = async () => {
84
- if (v && m) {
85
- window.open(m);
86
- return;
87
- }
88
- S ? window.open(`https://${g}/support`) : _("/contact");
89
- }, M = () => {
90
- c();
91
- };
92
- return n ? /* @__PURE__ */ o(ke, { close: c, children: /* @__PURE__ */ l(
93
- "div",
94
- {
95
- className: h.modalContent,
96
- onClick: (I) => I.stopPropagation(),
97
- children: [
98
- /* @__PURE__ */ o("div", { className: h.iconContainer, children: /* @__PURE__ */ o(
99
- X,
100
- {
101
- name: "WarningDiamond",
102
- fill: "var(--text-warning)",
103
- className: h.warningIcon
104
- }
105
- ) }),
106
- /* @__PURE__ */ o("h2", { className: h.title, children: "Partial Delivery Failure Refund" }),
107
- /* @__PURE__ */ l("p", { className: h.description, children: [
108
- "Your payment was successful but a few products were out of stock. We've automatically refunded the products that were out of stock, with a total of",
109
- " ",
110
- i.format(d),
111
- ", to your account balance."
112
- ] }),
113
- /* @__PURE__ */ l("div", { className: h.buttonContainer, children: [
114
- !N && /* @__PURE__ */ o(
115
- A,
116
- {
117
- type: "Secondary",
118
- onClick: a,
119
- className: h.button,
120
- children: "Login"
121
- }
122
- ),
123
- y && /* @__PURE__ */ o(
124
- A,
125
- {
126
- type: "Secondary",
127
- onClick: R,
128
- className: h.button,
129
- children: "Contact Support"
130
- }
131
- ),
132
- /* @__PURE__ */ o(
133
- A,
134
- {
135
- type: "Primary",
136
- onClick: M,
137
- className: h.button,
138
- children: "Continue"
139
- }
140
- )
141
- ] })
142
- ]
143
- }
144
- ) }) : null;
145
- }, Ke = () => {
146
- var B, L, $, F, T, E, W, x, q;
147
- const { id: n, accessToken: c } = te(), d = H(), [e, _] = r.useState(), [N, g] = r.useState(!1), [S, u] = r.useState(!1), [v, m] = r.useState(!1), y = ie(), { isAntistock: i, general: a } = J(), R = ((B = e == null ? void 0 : e.rawPrice) == null ? void 0 : B.currency) || "USD", M = new Intl.NumberFormat("en-US", {
148
- style: "currency",
149
- currency: R
150
- }), b = r.useMemo(() => (e == null ? void 0 : e.partOrders.map((t) => {
151
- var P, D, k;
152
- return {
153
- id: Number((P = t.productWithVariant) == null ? void 0 : P.id) || 0,
154
- partOrderId: Number(t == null ? void 0 : t.id) || 0,
155
- image: t.productWithVariant.image,
156
- name: (() => {
157
- var U, j;
158
- const p = ((U = t.productWithVariant) == null ? void 0 : U.name) || "", f = ((j = t.productWithVariant) == null ? void 0 : j.variantName) || "";
159
- return !p && !f ? "" : !f || p === f ? p : p ? `${p} (${f})` : f;
160
- })(),
161
- description: "",
162
- price: {
163
- quantity: t.quantity,
164
- amount: ((D = t.productWithVariant) == null ? void 0 : D.price.amount) || 0,
165
- currency: (k = t.productWithVariant) == null ? void 0 : k.price.currency
166
- },
167
- deliveryCategories: "deliveryCategories" in t ? t.deliveryCategories : void 0,
168
- customerNote: t.customerNote,
169
- chargeType: t.chargeType || "ONE_TIME",
170
- replacementRequests: "replacementRequests" in t ? t.replacementRequests : void 0,
171
- allowedReplacementReasons: "allowedReplacementReasons" in t ? t.allowedReplacementReasons : void 0
172
- };
173
- })) || [], [e]);
174
- r.useEffect(() => {
175
- e && (e.status === C.FullDeliveryFailure || e.status === C.PartiallyDelivered) && e.refundedPrice && e.refundedPrice.amount > 0 && u(!0);
176
- }, [e == null ? void 0 : e.status]);
177
- const w = r.useCallback(async (t, P, D = !1) => {
178
- var p, f;
179
- D || g(!0);
180
- const { data: k } = await (P ? re(`${t}/${P}`) : le(t));
181
- g(!1), k.status !== C.Completed && ((p = k.charge) == null ? void 0 : p.status) === ue.NotPaid && d(`/charges/${(f = k.charge) == null ? void 0 : f.id}`, {
182
- replace: !0
183
- }), _(k);
184
- }, [d]);
185
- r.useLayoutEffect(() => {
186
- if (n && !c) {
187
- const t = JSON.parse(localStorage.getItem("orders") || "{}");
188
- t[n] && d(`/orders/${n}/${t[n].fullAccessToken}`);
189
- }
190
- }, [n, c, d]), r.useEffect(() => {
191
- n && w(n, c, !0);
192
- const t = setInterval(() => {
193
- n && w(n, c, !0);
194
- }, 5e3);
195
- return () => {
196
- clearInterval(t);
197
- };
198
- }, [n, c, w]);
199
- const I = O(() => !!(e != null && e.isApplicableForReplacement && (e.status === C.Completed || e.status === C.PartiallyDelivered || e.status === C.FullDeliveryFailure)), [e]), V = O(() => {
200
- var t;
201
- return !!((t = a == null ? void 0 : a.info) != null && t.isVouchesEnabled && c);
202
- }, [(L = a == null ? void 0 : a.info) == null ? void 0 : L.isVouchesEnabled, c]), Y = O(() => {
203
- var t;
204
- return !!(!((t = a == null ? void 0 : a.info) != null && t.isVouchesEnabled) && (e != null && e.review) && "accessToken" in e.review && !i);
205
- }, [($ = a == null ? void 0 : a.info) == null ? void 0 : $.isVouchesEnabled, e == null ? void 0 : e.review, i]), K = O(() => {
206
- var t;
207
- return ((t = a == null ? void 0 : a.info) == null ? void 0 : t.domain) || window.location.hostname;
208
- }, [(F = a == null ? void 0 : a.info) == null ? void 0 : F.domain]);
209
- return N ? /* @__PURE__ */ o("div", { className: s.loaderContainer, children: /* @__PURE__ */ o(Se, {}) }) : /* @__PURE__ */ l("div", { className: s.orderPage, children: [
210
- /* @__PURE__ */ o("div", { className: s.leftSection, children: /* @__PURE__ */ l("div", { className: s.content, children: [
211
- /* @__PURE__ */ o(de, {}),
212
- e && /* @__PURE__ */ l("div", { className: `${s.main} ${i ? s.mainAntistock : ""}`, children: [
213
- /* @__PURE__ */ o(
214
- me,
215
- {
216
- className: s.statusBlock,
217
- orderStatus: e.status
218
- }
219
- ),
220
- /* @__PURE__ */ l(
221
- "div",
222
- {
223
- className: `${s.orderMainData} ${i ? s.orderMainDataAntistock : ""}`,
224
- children: [
225
- V && /* @__PURE__ */ o(
226
- he,
227
- {
228
- onAddMessage: () => m(!0),
229
- isVouchLeft: e.isVouchLeft
230
- }
231
- ),
232
- /* @__PURE__ */ o(
233
- pe,
234
- {
235
- lastUpdate: e.createdAt,
236
- paymentType: (T = e.charge) == null ? void 0 : T.gateway,
237
- email: e.customer ? e.customer.email : ((E = e.charge) == null ? void 0 : E.customerForCharge.email) || "",
238
- orderId: e.id
239
- }
240
- ),
241
- Y && e.review && /* @__PURE__ */ o(
242
- fe,
243
- {
244
- orderId: e.id,
245
- review: e.review
246
- }
247
- )
248
- ]
249
- }
250
- ),
251
- e.charge && e.charge.timeline && /* @__PURE__ */ o(
252
- _e,
253
- {
254
- className: `${s.timelineBlock} ${i ? s.timelineBlockAntistock : ""}`,
255
- timeline: e.charge.timeline
256
- }
257
- ),
258
- /* @__PURE__ */ o(
259
- z,
260
- {
261
- className: `${s.footer} ${i ? s.footerAntistock : ""}`
262
- }
263
- )
264
- ] })
265
- ] }) }),
266
- /* @__PURE__ */ o(
267
- "div",
268
- {
269
- className: s.rightSection,
270
- style: i ? { borderLeft: "1px solid var(--border-secondary)" } : void 0,
271
- children: /* @__PURE__ */ l("div", { className: s.content, children: [
272
- ((W = e == null ? void 0 : e.charge) == null ? void 0 : W.name) && /* @__PURE__ */ l("header", { className: s.header, children: [
273
- /* @__PURE__ */ l("div", { children: [
274
- /* @__PURE__ */ o("h1", { className: s.headerTitle, children: e.charge.name }),
275
- e.charge.description && /* @__PURE__ */ o("p", { className: s.headerDescription, children: e.charge.description })
276
- ] }),
277
- i ? null : /* @__PURE__ */ l(
278
- A,
279
- {
280
- type: "Secondary",
281
- onClick: () => y((e == null ? void 0 : e.id) || ""),
282
- style: {
283
- whiteSpace: "nowrap",
284
- display: "flex",
285
- alignItems: "center",
286
- gap: "4px"
287
- },
288
- children: [
289
- /* @__PURE__ */ o(X, { name: "Copy" }),
290
- /* @__PURE__ */ o("span", { children: "Copy ID" })
291
- ]
292
- }
293
- )
294
- ] }),
295
- /* @__PURE__ */ l("div", { children: [
296
- /* @__PURE__ */ o("div", { className: s.productList, children: b.map((t) => /* @__PURE__ */ o(
297
- ge,
298
- {
299
- product: t,
300
- isOrder: !0,
301
- isApplicableForReplacement: I,
302
- orderId: n,
303
- accessToken: c,
304
- allowedReplacementReasons: e == null ? void 0 : e.allowedReplacementReasons
305
- },
306
- t.id
307
- )) }),
308
- i ? null : /* @__PURE__ */ o(
309
- ye,
310
- {
311
- formatter: M,
312
- coupon: null,
313
- total: ((x = e == null ? void 0 : e.endPrice) == null ? void 0 : x.amount) || 0,
314
- discount: 0,
315
- totalWithDiscount: ((q = e == null ? void 0 : e.endPrice) == null ? void 0 : q.amount) || 0,
316
- className: s.prices,
317
- isShowSubtotal: !1
318
- }
319
- ),
320
- /* @__PURE__ */ o(z, { className: s.mobileFooter })
321
- ] })
322
- ] })
323
- }
324
- ),
325
- (e == null ? void 0 : e.refundedPrice) && /* @__PURE__ */ o(
326
- Ye,
327
- {
328
- isOpen: S,
329
- onClose: () => u(!1),
330
- refundedAmount: e.refundedPrice.amount,
331
- currency: e.refundedPrice.currency
332
- }
333
- ),
334
- V && /* @__PURE__ */ o(
335
- we,
336
- {
337
- isOpen: v,
338
- onClose: () => m(!1),
339
- products: b,
340
- orderId: n,
341
- accessToken: c,
342
- shopDomain: K,
343
- onSuccess: () => {
344
- m(!1), n && w(n, c, !0);
345
- }
346
- }
347
- )
348
- ] });
349
- }, it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
350
- __proto__: null,
351
- OrderPage: Ke
352
- }, Symbol.toStringTag, { value: "Module" }));
353
- export {
354
- ct as O,
355
- it as i
356
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("react/jsx-runtime"),i=require("react"),k=require("./builder-tYS_fx1j.cjs"),o=require("./charge-BTTelVH9.cjs"),_=require("./ui-components-Wg6-hSGe.cjs");require("./builder-components-BER5mJmk.cjs");require("./ticket-BMP7CWTV.cjs");require("react-dom");const z=async(n=1)=>await o.fetchOrders({PageNumber:n}),H=()=>{const[n,r]=i.useState(null),[d,e]=i.useState(null),[g,v]=i.useState(0),{page:y}=k.usePaginationPagesStore(),[C,u]=i.useState(!0);async function j(){u(!0);const{list:w,totalCount:l}=await z(y);r(w),v(l),e(null),u(!1)}async function m(){const w=(n==null?void 0:n.map(a=>a.gatewayName))||[],l=await o.getGatewaysDetail(w);e(l)}return i.useEffect(()=>{!d&&n&&m()},[n,d]),i.useEffect(()=>{j()},[y]),t.jsx(t.Fragment,{children:n!=null&&n.length&&n.length===0?t.jsx(o.NoItemsBlock,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):t.jsxs(t.Fragment,{children:[t.jsx(o.PageTitle,{title:"Orders"}),t.jsx(o.OrdersTable,{orders:n,gatewaysDetail:d,totalCount:g,isLoading:C})]})})},J="_orderPage_gc87l_1",Y="_leftSection_gc87l_15",K="_content_gc87l_35",Q="_main_gc87l_42",X="_mainAntistock_gc87l_56",Z="_orderMainDataAntistock_gc87l_69",ee="_timelineBlockAntistock_gc87l_81",te="_footerAntistock_gc87l_92",se="_statusBlock_gc87l_104",ne="_timelineBlock_gc87l_81",oe="_footer_gc87l_92",ae="_rightSection_gc87l_121",ce="_header_gc87l_142",ie="_productList_gc87l_150",re="_mobileFooter_gc87l_157",le="_loaderContainer_gc87l_166",ue="_orderMainData_gc87l_69",de="_prices_gc87l_181",me="_headerTitle_gc87l_185",he="_headerDescription_gc87l_189",c={orderPage:J,leftSection:Y,content:K,main:Q,mainAntistock:X,orderMainDataAntistock:Z,timelineBlockAntistock:ee,footerAntistock:te,statusBlock:se,timelineBlock:ne,footer:oe,rightSection:ae,header:ce,productList:ie,mobileFooter:re,loaderContainer:le,orderMainData:ue,prices:de,headerTitle:me,headerDescription:he},fe="_modalContent_1a05n_1",pe="_iconContainer_1a05n_16",_e="_warningIcon_1a05n_20",ge="_title_1a05n_25",ye="_description_1a05n_33",we="_buttonContainer_1a05n_40",Se="_button_1a05n_40",h={modalContent:fe,iconContainer:pe,warningIcon:_e,title:ge,description:ye,buttonContainer:we,button:Se},xe=({isOpen:n,onClose:r,refundedAmount:d,currency:e})=>{var N,S;const g=k.useNavigate(),{token:v,shopDomain:y}=k.useStorefrontStore(),{isAntistock:C,general:u}=k.useGeneralStore(),j=!!((N=u==null?void 0:u.info)!=null&&N.disableSupport),m=(S=u==null?void 0:u.info)==null?void 0:S.thirdPartySupportUrl,w=!(j&&!m),l=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),a=()=>{g(C?"/account":"/customer-dash")},D=async()=>{if(j&&m){window.open(m);return}C?window.open(`https://${y}/support`):g("/contact")},P=()=>{r()};return n?t.jsx(_.Modal,{close:r,children:t.jsxs("div",{className:h.modalContent,onClick:A=>A.stopPropagation(),children:[t.jsx("div",{className:h.iconContainer,children:t.jsx(_.Icon,{name:"WarningDiamond",fill:"var(--text-warning)",className:h.warningIcon})}),t.jsx("h2",{className:h.title,children:"Partial Delivery Failure Refund"}),t.jsxs("p",{className:h.description,children:["Your payment was successful but a few products were out of stock. We've automatically refunded the products that were out of stock, with a total of"," ",l.format(d),", to your account balance."]}),t.jsxs("div",{className:h.buttonContainer,children:[!v&&t.jsx(_.Button,{type:"Secondary",onClick:a,className:h.button,children:"Login"}),w&&t.jsx(_.Button,{type:"Secondary",onClick:D,className:h.button,children:"Contact Support"}),t.jsx(_.Button,{type:"Primary",onClick:P,className:h.button,children:"Continue"})]})]})}):null},ke=()=>{var M,I,B,F,V,$,L,T,q;const{id:n,accessToken:r}=k.useParams(),d=k.useNavigate(),[e,g]=i.useState(),[v,y]=i.useState(!1),[C,u]=i.useState(!1),[j,m]=i.useState(!1),w=o.useCopy(),{isAntistock:l,general:a}=k.useGeneralStore(),D=((M=e==null?void 0:e.rawPrice)==null?void 0:M.currency)||"USD",P=new Intl.NumberFormat("en-US",{style:"currency",currency:D}),N=i.useMemo(()=>(e==null?void 0:e.partOrders.map(s=>{var b,O,x;return{id:Number((b=s.productWithVariant)==null?void 0:b.id)||0,partOrderId:Number(s==null?void 0:s.id)||0,image:s.productWithVariant.image,name:(()=>{var E,W;const f=((E=s.productWithVariant)==null?void 0:E.name)||"",p=((W=s.productWithVariant)==null?void 0:W.variantName)||"";return!f&&!p?"":!p||f===p?f:f?`${f} (${p})`:p})(),description:"",price:{quantity:s.quantity,amount:((O=s.productWithVariant)==null?void 0:O.price.amount)||0,currency:(x=s.productWithVariant)==null?void 0:x.price.currency},deliveryCategories:"deliveryCategories"in s?s.deliveryCategories:void 0,customerNote:s.customerNote,chargeType:s.chargeType||"ONE_TIME",replacementRequests:"replacementRequests"in s?s.replacementRequests:void 0,allowedReplacementReasons:"allowedReplacementReasons"in s?s.allowedReplacementReasons:void 0}}))||[],[e]);i.useEffect(()=>{e&&(e.status===o.OrderStatus.FullDeliveryFailure||e.status===o.OrderStatus.PartiallyDelivered)&&e.refundedPrice&&e.refundedPrice.amount>0&&u(!0)},[e==null?void 0:e.status]);const S=i.useCallback(async(s,b,O=!1)=>{var f,p;O||y(!0);const{data:x}=await(b?o.fetchAuthorizedOrder(`${s}/${b}`):o.fetchOrder(s));y(!1),x.status!==o.OrderStatus.Completed&&((f=x.charge)==null?void 0:f.status)===o.ChargeStatus.NotPaid&&d(`/charges/${(p=x.charge)==null?void 0:p.id}`,{replace:!0}),g(x)},[d]);i.useLayoutEffect(()=>{if(n&&!r){const s=JSON.parse(localStorage.getItem("orders")||"{}");s[n]&&d(`/orders/${n}/${s[n].fullAccessToken}`)}},[n,r,d]),i.useEffect(()=>{n&&S(n,r,!0);const s=setInterval(()=>{n&&S(n,r,!0)},5e3);return()=>{clearInterval(s)}},[n,r,S]);const A=i.useMemo(()=>!!(e!=null&&e.isApplicableForReplacement&&(e.status===o.OrderStatus.Completed||e.status===o.OrderStatus.PartiallyDelivered||e.status===o.OrderStatus.FullDeliveryFailure)),[e]),R=i.useMemo(()=>{var s;return!!((s=a==null?void 0:a.info)!=null&&s.isVouchesEnabled&&r)},[(I=a==null?void 0:a.info)==null?void 0:I.isVouchesEnabled,r]),U=i.useMemo(()=>{var s;return!!(!((s=a==null?void 0:a.info)!=null&&s.isVouchesEnabled)&&(e!=null&&e.review)&&"accessToken"in e.review&&!l)},[(B=a==null?void 0:a.info)==null?void 0:B.isVouchesEnabled,e==null?void 0:e.review,l]),G=i.useMemo(()=>{var s;return((s=a==null?void 0:a.info)==null?void 0:s.domain)||window.location.hostname},[(F=a==null?void 0:a.info)==null?void 0:F.domain]);return v?t.jsx("div",{className:c.loaderContainer,children:t.jsx(_.Loader,{})}):t.jsxs("div",{className:c.orderPage,children:[t.jsx("div",{className:c.leftSection,children:t.jsxs("div",{className:c.content,children:[t.jsx(o.CheckoutHeader,{}),e&&t.jsxs("div",{className:`${c.main} ${l?c.mainAntistock:""}`,children:[t.jsx(o.OrderStatusBlock,{className:c.statusBlock,orderStatus:e.status}),t.jsxs("div",{className:`${c.orderMainData} ${l?c.orderMainDataAntistock:""}`,children:[R&&t.jsx(o.VouchCard,{onAddMessage:()=>m(!0),isVouchLeft:e.isVouchLeft}),t.jsx(o.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:(V=e.charge)==null?void 0:V.gateway,email:e.customer?e.customer.email:(($=e.charge)==null?void 0:$.customerForCharge.email)||"",orderId:e.id}),U&&e.review&&t.jsx(o.LeaveAReview,{orderId:e.id,review:e.review})]}),e.charge&&e.charge.timeline&&t.jsx(o.TrackPayment,{className:`${c.timelineBlock} ${l?c.timelineBlockAntistock:""}`,timeline:e.charge.timeline}),t.jsx(o.CheckoutFooter,{className:`${c.footer} ${l?c.footerAntistock:""}`})]})]})}),t.jsx("div",{className:c.rightSection,style:l?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:t.jsxs("div",{className:c.content,children:[((L=e==null?void 0:e.charge)==null?void 0:L.name)&&t.jsxs("header",{className:c.header,children:[t.jsxs("div",{children:[t.jsx("h1",{className:c.headerTitle,children:e.charge.name}),e.charge.description&&t.jsx("p",{className:c.headerDescription,children:e.charge.description})]}),l?null:t.jsxs(_.Button,{type:"Secondary",onClick:()=>w((e==null?void 0:e.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx(_.Icon,{name:"Copy"}),t.jsx("span",{children:"Copy ID"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:c.productList,children:N.map(s=>t.jsx(o.CheckoutProduct,{product:s,isOrder:!0,isApplicableForReplacement:A,orderId:n,accessToken:r,allowedReplacementReasons:e==null?void 0:e.allowedReplacementReasons},s.id))}),l?null:t.jsx(o.CheckoutPrices,{formatter:P,coupon:null,total:((T=e==null?void 0:e.endPrice)==null?void 0:T.amount)||0,discount:0,totalWithDiscount:((q=e==null?void 0:e.endPrice)==null?void 0:q.amount)||0,className:c.prices,isShowSubtotal:!1}),t.jsx(o.CheckoutFooter,{className:c.mobileFooter})]})]})}),(e==null?void 0:e.refundedPrice)&&t.jsx(xe,{isOpen:C,onClose:()=>u(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency}),R&&t.jsx(o.VouchModal,{isOpen:j,onClose:()=>m(!1),products:N,orderId:n,accessToken:r,shopDomain:G,onSuccess:()=>{m(!1),n&&S(n,r,!0)}})]})},Ce=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:ke},Symbol.toStringTag,{value:"Module"}));exports.Orders=H;exports.index=Ce;