@mercurjs/vendor 2.3.7 → 2.3.8-canary.1

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 (126) hide show
  1. package/dist/{[id]-ETBVSKK3.js → [id]-A7X2XZ2K.js} +3 -3
  2. package/dist/{[id]-666YLRJF.js → [id]-BMHZLJCH.js} +3 -2
  3. package/dist/{[id]-MDSZJASE.js → [id]-FFJKPSR6.js} +6 -5
  4. package/dist/{[id]-4FS7TSTE.js → [id]-JTZEHZSR.js} +4 -3
  5. package/dist/{[id]-MJGZQFKV.js → [id]-M46TPJE5.js} +7 -6
  6. package/dist/{[id]-ZHOKCJ4T.js → [id]-NG32RHXO.js} +7 -6
  7. package/dist/{[id]-GQQXDJGU.js → [id]-P226VJ63.js} +2 -2
  8. package/dist/{[id]-D224RIUO.js → [id]-PZB5XXVO.js} +3 -2
  9. package/dist/{[id]-KYC52AAR.js → [id]-UIXWQETQ.js} +8 -7
  10. package/dist/{[id]-DJ6I7ZWW.js → [id]-UXUKBJV7.js} +2 -2
  11. package/dist/{[id]-ASQEGEPZ.js → [id]-VVGOMTEU.js} +3 -2
  12. package/dist/{[id]-XQWHZ4UU.js → [id]-ZSJXD3P3.js} +3 -2
  13. package/dist/{add-VMWDXYOJ.js → add-7LOGKVAM.js} +9 -8
  14. package/dist/{add-QJVY7JHR.js → add-INWI3TYC.js} +5 -4
  15. package/dist/{add-customer-groups-JMKG22IT.js → add-customer-groups-GM7OGAAX.js} +3 -2
  16. package/dist/{add-products-OELSCMHI.js → add-products-UWIFYV5Y.js} +7 -6
  17. package/dist/{add-promotions-453ZFOHU.js → add-promotions-QP5MHMZ3.js} +3 -3
  18. package/dist/{add-to-campaign-NOTFKGZY.js → add-to-campaign-VRF4TYPG.js} +3 -3
  19. package/dist/{address-JYUFTBRK.js → address-PAV5NXDR.js} +3 -2
  20. package/dist/{breadcrumb-G6PJ7I6I.js → breadcrumb-5CRSOET4.js} +3 -2
  21. package/dist/{breadcrumb-LCLZRWFG.js → breadcrumb-CJCOBDES.js} +3 -2
  22. package/dist/{breadcrumb-FNE5V4QU.js → breadcrumb-HWQCVD4O.js} +4 -3
  23. package/dist/{breadcrumb-55K5ZUXM.js → breadcrumb-N5DYMI7C.js} +1 -1
  24. package/dist/{breadcrumb-L5D2RZ67.js → breadcrumb-ON6CLH2A.js} +1 -1
  25. package/dist/{chunk-EXNGI5EU.js → chunk-2WB7YUWZ.js} +1 -1
  26. package/dist/{chunk-EMD7D7E6.js → chunk-4HAMH7VM.js} +2 -2
  27. package/dist/{chunk-PYLKKTXF.js → chunk-5KJZCQF5.js} +1 -1
  28. package/dist/{chunk-XAASERO6.js → chunk-5W77GKZP.js} +1 -1
  29. package/dist/{chunk-AQI5E3SK.js → chunk-6UCUPNTP.js} +1 -1
  30. package/dist/{chunk-U5U446UX.js → chunk-7MFXEOB7.js} +38 -31
  31. package/dist/{chunk-HNLII2AN.js → chunk-7TUOQ4EJ.js} +1 -1
  32. package/dist/{chunk-YMUXQFOC.js → chunk-AE3XRG4P.js} +2 -2
  33. package/dist/{chunk-LSOVGW4R.js → chunk-AFL2QWVT.js} +3 -2
  34. package/dist/{chunk-4GWGFBV5.js → chunk-AKYXDJWB.js} +1 -1
  35. package/dist/{chunk-XFR5AOON.js → chunk-BJ5NEVN4.js} +1 -1
  36. package/dist/{chunk-IDQIECSP.js → chunk-HQYV2PDP.js} +1 -1
  37. package/dist/{chunk-XLGMSDJO.js → chunk-HWEMQW76.js} +3 -3
  38. package/dist/{chunk-GT2DDPIB.js → chunk-KYZ32CY4.js} +1 -1
  39. package/dist/{chunk-Y3KLCTG3.js → chunk-LKQQJWYX.js} +10 -0
  40. package/dist/{chunk-SWZYH77J.js → chunk-MKKE5DJT.js} +1 -1
  41. package/dist/{chunk-TEGB74UF.js → chunk-MW2TTR75.js} +1 -1
  42. package/dist/{chunk-CDJVJZGQ.js → chunk-MXPO73MQ.js} +1 -1
  43. package/dist/{chunk-5ZHZVKNQ.js → chunk-PEBSUNXQ.js} +4 -0
  44. package/dist/{chunk-2ERDNBOU.js → chunk-PKFBOMPL.js} +1 -1
  45. package/dist/{chunk-BIIYZTKH.js → chunk-S3ZSIXJC.js} +2 -2
  46. package/dist/{chunk-RDN6US4B.js → chunk-SQMXR7QG.js} +2 -2
  47. package/dist/{chunk-JAOJFGII.js → chunk-VN2ZQTUW.js} +1 -1
  48. package/dist/{chunk-S6IGY77X.js → chunk-WFABIIXN.js} +1 -1
  49. package/dist/{chunk-RLPH22S3.js → chunk-WNTMS4KZ.js} +4 -4
  50. package/dist/{chunk-KKTTDJMT.js → chunk-Y2MESGBX.js} +1 -1
  51. package/dist/{chunk-ESRIX7ZH.js → chunk-YJI74L4M.js} +18 -0
  52. package/dist/{chunk-CERNIJIO.js → chunk-YNQUVE2G.js} +1 -1
  53. package/dist/chunk-ZDMCE62O.js +25 -0
  54. package/dist/{chunk-N3OUMXNV.js → chunk-ZQUYRDTM.js} +1 -1
  55. package/dist/{collections-YI345PXH.js → collections-IYJS2DHY.js} +5 -4
  56. package/dist/{create-MQFDW6CK.js → create-635IISRG.js} +3 -2
  57. package/dist/{create-MYLL6LX4.js → create-ASGFPV3G.js} +8 -7
  58. package/dist/{create-JXTADLBY.js → create-GKM3QEDM.js} +7 -6
  59. package/dist/{create-KVTRPU5I.js → create-HYB4GAWY.js} +3 -2
  60. package/dist/{create-264ONF7U.js → create-KK4UG2CK.js} +5 -4
  61. package/dist/{create-KCF62PCA.js → create-KR3HX77W.js} +3 -3
  62. package/dist/{create-FUM6N3U2.js → create-SECM5KHG.js} +4 -3
  63. package/dist/{create-5OVMJIGW.js → create-WBNN6ESF.js} +9 -8
  64. package/dist/{edit-VLKDSPFM.js → edit-7UMVMO3H.js} +6 -5
  65. package/dist/{edit-O5K6IVV2.js → edit-E2KCTXHW.js} +3 -3
  66. package/dist/{edit-NILXRC63.js → edit-JGBJGVHD.js} +3 -2
  67. package/dist/{edit-UZP7TBH2.js → edit-KO6PAAL2.js} +4 -3
  68. package/dist/{edit-VWLAKVLW.js → edit-NPHZHWTC.js} +4 -3
  69. package/dist/{edit-NVYJX3GX.js → edit-OO3U575W.js} +4 -3
  70. package/dist/{edit-SZXNN4QR.js → edit-RGJ7IID3.js} +36 -2
  71. package/dist/{edit-EKAUVJT5.js → edit-VRQLOD5E.js} +3 -3
  72. package/dist/{edit-price-DABJMEL3.js → edit-price-U4VESGJX.js} +2 -2
  73. package/dist/{edit-stock-PTXEUMBY.js → edit-stock-55GII22S.js} +1 -1
  74. package/dist/{fulfillment-EBULAIBY.js → fulfillment-CJNQSDIH.js} +3 -2
  75. package/dist/{fulfillment-providers-Q7X6EB3X.js → fulfillment-providers-ISDZHIL7.js} +5 -4
  76. package/dist/{home-G3HG42YM.js → home-IS7KHLMH.js} +4 -3
  77. package/dist/index.css +4 -0
  78. package/dist/index.js +111 -110
  79. package/dist/{inventory-WRRJWQFB.js → inventory-WPHSH2TX.js} +1 -1
  80. package/dist/{invite-IPHZFADY.js → invite-QOIJAXMP.js} +4 -3
  81. package/dist/{invite-ELEPCOPG.js → invite-VHJ4SBNB.js} +3 -2
  82. package/dist/{loader-USWXCRPF.js → loader-CDXJP5XD.js} +1 -1
  83. package/dist/{loader-KKHXERTR.js → loader-UABAR5TP.js} +1 -1
  84. package/dist/{login-W3PYWTDO.js → login-UC5HPXF5.js} +5 -4
  85. package/dist/{manage-items-VVFNTJX7.js → manage-items-63TE6TBN.js} +1 -1
  86. package/dist/{media-K6I5ZZBK.js → media-6LTNORR5.js} +7 -6
  87. package/dist/{media-5IJEFAYC.js → media-A3KYE6UF.js} +4 -3
  88. package/dist/{metadata-SIK4VNPL.js → metadata-6557WF6T.js} +3 -2
  89. package/dist/{metadata-46LW5L7T.js → metadata-73EGQ4TO.js} +3 -2
  90. package/dist/{metadata-JGLHL3FU.js → metadata-GLN7CKHN.js} +3 -2
  91. package/dist/{metadata-LEMNES27.js → metadata-ODGRHE7T.js} +3 -2
  92. package/dist/{metadata-U7K5JCLI.js → metadata-UMVNBIT7.js} +3 -2
  93. package/dist/{offer-create-page-36PYLWW4.js → offer-create-page-GXILFDX2.js} +48 -6
  94. package/dist/{offer-detail-page-KRH4TNJN.js → offer-detail-page-A5ZB76DU.js} +1 -1
  95. package/dist/{offer-variant-detail-page-SRB5J3TJ.js → offer-variant-detail-page-L3WHS5MI.js} +8 -1
  96. package/dist/{offers-OYVOW23Y.js → offers-P7NGBPPT.js} +9 -8
  97. package/dist/onboarding-GEX2RXKN.js +1085 -0
  98. package/dist/{orders-2ILL72R4.js → orders-BU5NNXMG.js} +5 -4
  99. package/dist/{organization-GKL3Z5AS.js → organization-5DJJF6ZP.js} +4 -3
  100. package/dist/pages/index.js +23 -22
  101. package/dist/{payment-details-5A7IUG5U.js → payment-details-WEYB343E.js} +3 -2
  102. package/dist/{pricing-ROKACFQV.js → pricing-C7G2MT2K.js} +2 -2
  103. package/dist/{pricing-XNTOYT2H.js → pricing-HFJ5XETU.js} +3 -2
  104. package/dist/{product-tags-G3CS5MMC.js → product-tags-R6EB7BXD.js} +8 -7
  105. package/dist/{product-variant-detail-7IMC2SAO.js → product-variant-detail-U5SIMQ23.js} +3 -2
  106. package/dist/{product-variant-edit-RWYSXW3M.js → product-variant-edit-YEJQFLO4.js} +5 -4
  107. package/dist/{products-P74QKZEO.js → products-CY7WB2JP.js} +7 -6
  108. package/dist/{products-2FUI5H5W.js → products-R3JOTGF3.js} +12 -11
  109. package/dist/{professional-details-DNDPFYGU.js → professional-details-BYOFTJOF.js} +3 -2
  110. package/dist/{profile-TFG3JE7U.js → profile-2RDAL6RW.js} +3 -2
  111. package/dist/{promotions-RXTEX2JX.js → promotions-BKO4AC7V.js} +4 -4
  112. package/dist/{register-FCTWVDWF.js → register-7EE35NGI.js} +5 -4
  113. package/dist/{reset-password-R3HXKS3J.js → reset-password-NHRLPUUH.js} +1 -1
  114. package/dist/{return-reasons-5MPNWIQK.js → return-reasons-BIMPEFVD.js} +3 -3
  115. package/dist/{settings-56LZ2QOK.js → settings-TYX5R5OR.js} +6 -5
  116. package/dist/{shipment-DNSHILRM.js → shipment-ZRFNHKPM.js} +3 -2
  117. package/dist/{shipping-FIWGNBNC.js → shipping-64I6RABH.js} +1 -1
  118. package/dist/{shipping-profiles-JJ4HH5Y7.js → shipping-profiles-EYPSBIXE.js} +3 -2
  119. package/dist/{stock-LTZBLHJW.js → stock-DH34YUOP.js} +3 -2
  120. package/dist/{store-MZRR67LA.js → store-G3S3C55J.js} +4 -3
  121. package/dist/{store-closure-TYZV2MRG.js → store-closure-X3IFCHGR.js} +3 -2
  122. package/dist/{store-select-QASXNKMO.js → store-select-CVGMGXN7.js} +9 -5
  123. package/dist/{team-CF4F6KTM.js → team-6XRNWO4M.js} +4 -3
  124. package/package.json +6 -6
  125. package/dist/onboarding-4RRUUXWQ.js +0 -957
  126. /package/dist/{chunk-PC4EJU3M.js → chunk-ZAB27HSU.js} +0 -0
@@ -1,957 +0,0 @@
1
- import {
2
- CountrySelect
3
- } from "./chunk-7CAFYKKA.js";
4
- import "./chunk-JRTZWK77.js";
5
- import {
6
- HandleInput
7
- } from "./chunk-HJ56YXBU.js";
8
- import {
9
- Form
10
- } from "./chunk-3QSRE5LS.js";
11
- import {
12
- retrieveActiveStore,
13
- storeQueryKeys,
14
- useStore
15
- } from "./chunk-PC4EJU3M.js";
16
- import {
17
- useLogout
18
- } from "./chunk-3JFOBIRE.js";
19
- import "./chunk-P6UW4MKP.js";
20
- import "./chunk-37GBG5JR.js";
21
- import "./chunk-TIZRIQFH.js";
22
- import "./chunk-TBKX7EQP.js";
23
- import "./chunk-JXLOX7ZP.js";
24
- import "./chunk-ITV6SKOV.js";
25
- import "./chunk-CFUFUOLL.js";
26
- import {
27
- useCreateSellerAccount,
28
- useSellers
29
- } from "./chunk-Y3KLCTG3.js";
30
- import "./chunk-6NPALPJ6.js";
31
- import "./chunk-BDMA67RG.js";
32
- import "./chunk-DHC22IMF.js";
33
- import "./chunk-2VXV42WD.js";
34
- import "./chunk-JVQQKRAB.js";
35
- import "./chunk-ARB246D5.js";
36
- import "./chunk-CL47ZKQ3.js";
37
- import "./chunk-V7ZAQBSV.js";
38
- import "./chunk-XVVNJBC5.js";
39
- import "./chunk-WJR7CLUN.js";
40
- import "./chunk-RFOLOEUY.js";
41
- import "./chunk-SKYXU4GP.js";
42
- import "./chunk-A5DJIOHN.js";
43
- import {
44
- queryClient
45
- } from "./chunk-RHKRREUU.js";
46
- import "./chunk-ZA2KFUFR.js";
47
- import {
48
- assetUrl
49
- } from "./chunk-UKLW4VDE.js";
50
- import "./chunk-NBMM2TZK.js";
51
-
52
- // src/pages/onboarding/loader.ts
53
- var storeDetailQuery = () => ({
54
- queryKey: storeQueryKeys.details(),
55
- queryFn: async () => retrieveActiveStore()
56
- });
57
- var onboardingLoader = async () => {
58
- const query = storeDetailQuery();
59
- return queryClient.ensureQueryData(query);
60
- };
61
-
62
- // src/pages/onboarding/onboarding.tsx
63
- import { useEffect } from "react";
64
- import { Navigate, useLocation } from "react-router-dom";
65
-
66
- // src/components/onboarding-wizard/onboarding-wizard.tsx
67
- import { AnimatePresence } from "motion/react";
68
- import { useNavigate as useNavigate2 } from "react-router-dom";
69
- import { useLinkQuery } from "@mercurjs/dashboard-shared";
70
-
71
- // src/components/onboarding-wizard/wizard-sidebar.tsx
72
- import { ChevronLeft } from "@medusajs/icons";
73
- import { Text } from "@medusajs/ui";
74
- import { useTranslation } from "react-i18next";
75
-
76
- // src/components/onboarding-wizard/constants.ts
77
- var WIZARD_STEPS = [
78
- {
79
- id: "store",
80
- number: 1,
81
- labelKey: "onboarding.wizard.steps.store"
82
- },
83
- {
84
- id: "address",
85
- number: 2,
86
- labelKey: "onboarding.wizard.steps.address"
87
- },
88
- {
89
- id: "company",
90
- number: 3,
91
- labelKey: "onboarding.wizard.steps.company"
92
- },
93
- {
94
- id: "payment",
95
- number: 4,
96
- labelKey: "onboarding.wizard.steps.payment"
97
- }
98
- ];
99
- var TOTAL_STEPS = WIZARD_STEPS.length;
100
-
101
- // src/components/onboarding-wizard/wizard-sidebar.tsx
102
- import { jsx, jsxs } from "react/jsx-runtime";
103
- var WizardSidebar = ({
104
- currentStep,
105
- onBack,
106
- showBack,
107
- children
108
- }) => {
109
- const { t } = useTranslation();
110
- return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col lg:w-[584px] lg:shrink-0 h-full bg-ui-bg-base border-r border-ui-border-base overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col p-8 lg:px-14 lg:py-12", children: [
111
- showBack && onBack && /* @__PURE__ */ jsxs(
112
- "button",
113
- {
114
- type: "button",
115
- onClick: onBack,
116
- className: "txt-compact-small text-ui-fg-base flex items-center gap-x-0.5 font-medium transition-colors hover:text-ui-fg-subtle self-start mb-6",
117
- children: [
118
- /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
119
- /* @__PURE__ */ jsx("span", { children: t("actions.back") })
120
- ]
121
- }
122
- ),
123
- /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle mb-1", children: t("onboarding.wizard.stepOf", {
124
- current: currentStep + 1,
125
- total: TOTAL_STEPS
126
- }) }),
127
- children
128
- ] }) });
129
- };
130
-
131
- // src/components/onboarding-wizard/wizard-preview.tsx
132
- import { jsx as jsx2 } from "react/jsx-runtime";
133
- var WizardPreview = () => {
134
- return /* @__PURE__ */ jsx2("div", { className: "hidden lg:flex flex-1 relative overflow-hidden", children: /* @__PURE__ */ jsx2(
135
- "img",
136
- {
137
- src: assetUrl("/onboarding/illustration.svg"),
138
- alt: "",
139
- className: "h-full w-full object-cover"
140
- }
141
- ) });
142
- };
143
-
144
- // src/components/onboarding-wizard/wizard-step.tsx
145
- import { motion } from "motion/react";
146
- import { jsx as jsx3 } from "react/jsx-runtime";
147
- var stepVariants = {
148
- initial: { opacity: 0, y: 12, filter: "blur(4px)" },
149
- animate: { opacity: 1, y: 0, filter: "blur(0px)" },
150
- exit: {
151
- opacity: 0,
152
- y: -8,
153
- filter: "blur(4px)",
154
- transition: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
155
- }
156
- };
157
- var WizardStep = ({ children }) => {
158
- return /* @__PURE__ */ jsx3(
159
- motion.div,
160
- {
161
- variants: stepVariants,
162
- initial: "initial",
163
- animate: "animate",
164
- exit: "exit",
165
- transition: { duration: 0.35, ease: [0.23, 1, 0.32, 1] },
166
- className: "flex flex-col",
167
- children
168
- }
169
- );
170
- };
171
-
172
- // src/components/onboarding-wizard/hooks/use-onboarding.ts
173
- import { useState, useCallback, useRef } from "react";
174
- import { useNavigate } from "react-router-dom";
175
- import { toast } from "@medusajs/ui";
176
- var useOnboarding = (memberEmail) => {
177
- const navigate = useNavigate();
178
- const [currentStep, setCurrentStep] = useState(0);
179
- const [isSubmitting, setIsSubmitting] = useState(false);
180
- const sellerIdRef = useRef(null);
181
- const [sellerIdState, setSellerIdState] = useState(null);
182
- const setSellerId = (id) => {
183
- sellerIdRef.current = id;
184
- setSellerIdState(id);
185
- };
186
- const storeDataRef = useRef(null);
187
- const addressDataRef = useRef(null);
188
- const companyDataRef = useRef(null);
189
- const { mutateAsync: createSeller, isPending: isCreating } = useCreateSellerAccount();
190
- const { mutateAsync: logout } = useLogout();
191
- const isPending = isCreating || isSubmitting;
192
- const submitStoreStep = useCallback(async (data) => {
193
- storeDataRef.current = data;
194
- setCurrentStep(1);
195
- }, []);
196
- const submitAddressStep = useCallback(async (data) => {
197
- addressDataRef.current = data;
198
- setCurrentStep(2);
199
- }, []);
200
- const skipAddressStep = useCallback(() => {
201
- addressDataRef.current = null;
202
- setCurrentStep(2);
203
- }, []);
204
- const submitCompanyStep = useCallback(async (data) => {
205
- companyDataRef.current = data;
206
- setCurrentStep(3);
207
- }, []);
208
- const skipCompanyStep = useCallback(() => {
209
- companyDataRef.current = null;
210
- setCurrentStep(3);
211
- }, []);
212
- const createSellerWithAllData = useCallback(
213
- async (paymentData) => {
214
- const storeData = storeDataRef.current;
215
- if (!storeData) return;
216
- if (sellerIdRef.current) {
217
- navigate("/store-select", { replace: true });
218
- return;
219
- }
220
- const addressData = addressDataRef.current;
221
- const companyData = companyDataRef.current;
222
- const hasCompanyData = companyData?.corporate_name || companyData?.registration_number || companyData?.tax_id;
223
- const isUS = paymentData?.country_code === "us";
224
- let registerDraft = {};
225
- try {
226
- const raw = sessionStorage.getItem("mercur_register_draft");
227
- if (raw) {
228
- const parsed = JSON.parse(raw);
229
- registerDraft = {
230
- first_name: parsed.first_name || void 0,
231
- last_name: parsed.last_name || void 0,
232
- additional_data: parsed.additional_data || void 0
233
- };
234
- }
235
- } catch {
236
- }
237
- const additionalData = {
238
- ...registerDraft.additional_data,
239
- ...storeData.additional_data
240
- };
241
- try {
242
- setIsSubmitting(true);
243
- const result = await createSeller({
244
- name: storeData.name,
245
- handle: storeData.handle || void 0,
246
- email: storeData.email,
247
- phone: storeData.phone || void 0,
248
- member_email: memberEmail,
249
- first_name: registerDraft.first_name,
250
- last_name: registerDraft.last_name,
251
- currency_code: storeData.currency_code.toLowerCase(),
252
- description: storeData.description || void 0,
253
- ...Object.keys(additionalData).length ? { additional_data: additionalData } : {},
254
- address: addressData ? {
255
- name: addressData.name || void 0,
256
- address_1: addressData.address_1 || void 0,
257
- address_2: addressData.address_2 || void 0,
258
- postal_code: addressData.postal_code || void 0,
259
- city: addressData.city || void 0,
260
- country_code: addressData.country_code,
261
- province: addressData.province || void 0
262
- } : void 0,
263
- professional_details: hasCompanyData ? {
264
- corporate_name: companyData.corporate_name || void 0,
265
- registration_number: companyData.registration_number || void 0,
266
- tax_id: companyData.tax_id || void 0
267
- } : void 0,
268
- payment_details: paymentData ? {
269
- country_code: paymentData.country_code,
270
- holder_name: paymentData.holder_name,
271
- iban: isUS ? null : paymentData.iban || null,
272
- bic: isUS ? null : paymentData.bic || null,
273
- routing_number: isUS ? paymentData.routing_number || null : null,
274
- account_number: paymentData.account_number || null
275
- } : void 0
276
- });
277
- const newSellerId = result.seller.id;
278
- setSellerId(newSellerId);
279
- try {
280
- await logout();
281
- } catch {
282
- }
283
- queryClient.clear();
284
- sessionStorage.removeItem("mercur_onboarding_email");
285
- sessionStorage.removeItem("mercur_register_draft");
286
- navigate("/login", { replace: true });
287
- } catch (error) {
288
- toast.error(error.message);
289
- } finally {
290
- setIsSubmitting(false);
291
- }
292
- },
293
- [createSeller, logout, memberEmail, navigate]
294
- );
295
- const submitPaymentStep = useCallback(
296
- async (data) => {
297
- await createSellerWithAllData(data);
298
- },
299
- [createSellerWithAllData]
300
- );
301
- const skipPaymentStep = useCallback(async () => {
302
- await createSellerWithAllData();
303
- }, [createSellerWithAllData]);
304
- const goBack = useCallback(() => {
305
- if (currentStep > 0) {
306
- setCurrentStep((prev) => prev - 1);
307
- }
308
- }, [currentStep]);
309
- return {
310
- currentStep,
311
- totalSteps: TOTAL_STEPS,
312
- sellerId: sellerIdState,
313
- isPending,
314
- canGoBack: currentStep > 0,
315
- goBack,
316
- submitStoreStep,
317
- submitAddressStep,
318
- skipAddressStep,
319
- submitCompanyStep,
320
- skipCompanyStep,
321
- submitPaymentStep,
322
- skipPaymentStep
323
- };
324
- };
325
-
326
- // src/components/onboarding-wizard/steps/store-step.tsx
327
- import { Button, Heading, Input, Select, Textarea } from "@medusajs/ui";
328
- import i18n from "i18next";
329
- import { useTranslation as useTranslation2 } from "react-i18next";
330
- import { useLoaderData } from "react-router-dom";
331
- import * as z from "zod";
332
- import {
333
- FormExtensionZone,
334
- useExtendableForm
335
- } from "@mercurjs/dashboard-shared";
336
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
337
- var StoreStepSchema = z.object({
338
- name: z.string().min(1, i18n.t("onboarding.wizard.validation.nameRequired")),
339
- email: z.string().email(i18n.t("onboarding.wizard.validation.emailInvalid")),
340
- phone: z.string().optional(),
341
- currency_code: z.string().min(1, i18n.t("onboarding.wizard.validation.currencyRequired")),
342
- description: z.string().optional(),
343
- handle: z.string().optional()
344
- });
345
- var StoreStep = ({ onSubmit, isPending }) => {
346
- const { t } = useTranslation2();
347
- const initialData = useLoaderData();
348
- const { store } = useStore(void 0, { initialData });
349
- const form = useExtendableForm({
350
- schema: StoreStepSchema,
351
- model: "seller",
352
- zone: "onboarding",
353
- tab: "store",
354
- data: store,
355
- defaultValues: {
356
- name: "",
357
- email: "",
358
- phone: "",
359
- currency_code: "",
360
- description: "",
361
- handle: ""
362
- }
363
- });
364
- const handleSubmit = form.handleSubmit(async (data) => {
365
- await onSubmit(data);
366
- });
367
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-8", children: [
368
- /* @__PURE__ */ jsx4(Heading, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.store.title") }),
369
- /* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
370
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-4", children: [
371
- /* @__PURE__ */ jsx4(
372
- Form.Field,
373
- {
374
- control: form.control,
375
- name: "name",
376
- render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
377
- /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.name") }),
378
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { autoComplete: "organization", ...field }) }),
379
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
380
- ] })
381
- }
382
- ),
383
- /* @__PURE__ */ jsx4(
384
- Form.Field,
385
- {
386
- control: form.control,
387
- name: "email",
388
- render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
389
- /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.email") }),
390
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { type: "email", autoComplete: "email", ...field }) }),
391
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
392
- ] })
393
- }
394
- ),
395
- /* @__PURE__ */ jsx4(
396
- Form.Field,
397
- {
398
- control: form.control,
399
- name: "phone",
400
- render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
401
- /* @__PURE__ */ jsx4(Form.Label, { optional: true, children: t("fields.phone") }),
402
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { type: "tel", autoComplete: "tel", ...field }) }),
403
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
404
- ] })
405
- }
406
- ),
407
- /* @__PURE__ */ jsx4(
408
- Form.Field,
409
- {
410
- control: form.control,
411
- name: "description",
412
- render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
413
- /* @__PURE__ */ jsx4(Form.Label, { optional: true, children: t("fields.description") }),
414
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Textarea, { ...field }) }),
415
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
416
- ] })
417
- }
418
- ),
419
- /* @__PURE__ */ jsx4(
420
- Form.Field,
421
- {
422
- control: form.control,
423
- name: "handle",
424
- render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
425
- /* @__PURE__ */ jsx4(
426
- Form.Label,
427
- {
428
- optional: true,
429
- tooltip: t("onboarding.wizard.store.handleTooltip"),
430
- children: t("onboarding.wizard.store.handle")
431
- }
432
- ),
433
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(HandleInput, { ...field }) }),
434
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
435
- ] })
436
- }
437
- ),
438
- /* @__PURE__ */ jsx4(
439
- Form.Field,
440
- {
441
- control: form.control,
442
- name: "currency_code",
443
- render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
444
- /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.currency") }),
445
- /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsxs2(Select, { ...field, onValueChange: onChange, children: [
446
- /* @__PURE__ */ jsx4(Select.Trigger, { ref, children: /* @__PURE__ */ jsx4(
447
- Select.Value,
448
- {
449
- placeholder: t("onboarding.wizard.store.selectCurrency")
450
- }
451
- ) }),
452
- /* @__PURE__ */ jsx4(Select.Content, { children: store?.supported_currencies?.map((sc) => /* @__PURE__ */ jsx4(
453
- Select.Item,
454
- {
455
- value: sc.currency_code,
456
- children: sc.currency_code.toUpperCase()
457
- },
458
- sc.currency_code
459
- )) })
460
- ] }) }),
461
- /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
462
- ] })
463
- }
464
- ),
465
- /* @__PURE__ */ jsx4(
466
- FormExtensionZone,
467
- {
468
- model: "seller",
469
- zone: "onboarding",
470
- tab: "store",
471
- control: form.control,
472
- data: store
473
- }
474
- )
475
- ] }),
476
- /* @__PURE__ */ jsx4(Button, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") })
477
- ] }) })
478
- ] });
479
- };
480
-
481
- // src/components/onboarding-wizard/steps/address-step.tsx
482
- import { zodResolver } from "@hookform/resolvers/zod";
483
- import { Button as Button2, Heading as Heading2, Input as Input2 } from "@medusajs/ui";
484
- import i18n2 from "i18next";
485
- import { useForm } from "react-hook-form";
486
- import { useTranslation as useTranslation3 } from "react-i18next";
487
- import * as z2 from "zod";
488
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
489
- var AddressStepSchema = z2.object({
490
- name: z2.string().min(1, i18n2.t("onboarding.wizard.validation.nameRequired")),
491
- address_1: z2.string().optional(),
492
- address_2: z2.string().optional(),
493
- postal_code: z2.string().optional(),
494
- city: z2.string().optional(),
495
- country_code: z2.string().min(1, i18n2.t("onboarding.wizard.validation.countryRequired")),
496
- province: z2.string().optional()
497
- });
498
- var AddressStep = ({ onSubmit, onSkip, isPending }) => {
499
- const { t } = useTranslation3();
500
- const form = useForm({
501
- resolver: zodResolver(AddressStepSchema),
502
- defaultValues: {
503
- name: "",
504
- address_1: "",
505
- address_2: "",
506
- postal_code: "",
507
- city: "",
508
- country_code: "",
509
- province: ""
510
- }
511
- });
512
- const handleSubmit = form.handleSubmit(async (data) => {
513
- await onSubmit(data);
514
- });
515
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-8", children: [
516
- /* @__PURE__ */ jsx5(Heading2, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.address.title") }),
517
- /* @__PURE__ */ jsx5(Form, { ...form, children: /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
518
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-4", children: [
519
- /* @__PURE__ */ jsx5(
520
- Form.Field,
521
- {
522
- control: form.control,
523
- name: "name",
524
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
525
- /* @__PURE__ */ jsx5(Form.Label, { children: t("onboarding.wizard.address.name") }),
526
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { ...field }) }),
527
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
528
- ] })
529
- }
530
- ),
531
- /* @__PURE__ */ jsx5(
532
- Form.Field,
533
- {
534
- control: form.control,
535
- name: "address_1",
536
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
537
- /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.address") }),
538
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-line1", ...field }) }),
539
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
540
- ] })
541
- }
542
- ),
543
- /* @__PURE__ */ jsx5(
544
- Form.Field,
545
- {
546
- control: form.control,
547
- name: "address_2",
548
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
549
- /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.address2") }),
550
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-line2", ...field }) }),
551
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
552
- ] })
553
- }
554
- ),
555
- /* @__PURE__ */ jsx5(
556
- Form.Field,
557
- {
558
- control: form.control,
559
- name: "postal_code",
560
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
561
- /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.postalCode") }),
562
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "postal-code", ...field }) }),
563
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
564
- ] })
565
- }
566
- ),
567
- /* @__PURE__ */ jsx5(
568
- Form.Field,
569
- {
570
- control: form.control,
571
- name: "city",
572
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
573
- /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.city") }),
574
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-level2", ...field }) }),
575
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
576
- ] })
577
- }
578
- ),
579
- /* @__PURE__ */ jsx5(
580
- Form.Field,
581
- {
582
- control: form.control,
583
- name: "country_code",
584
- render: ({ field: { onChange, ref: _ref, ...field } }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
585
- /* @__PURE__ */ jsx5(Form.Label, { children: t("onboarding.wizard.address.country") }),
586
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(CountrySelect, { ...field, onChange }) }),
587
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
588
- ] })
589
- }
590
- ),
591
- /* @__PURE__ */ jsx5(
592
- Form.Field,
593
- {
594
- control: form.control,
595
- name: "province",
596
- render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
597
- /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.state") }),
598
- /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-level1", ...field }) }),
599
- /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
600
- ] })
601
- }
602
- )
603
- ] }),
604
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-2", children: [
605
- /* @__PURE__ */ jsx5(Button2, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
606
- /* @__PURE__ */ jsx5(
607
- Button2,
608
- {
609
- type: "button",
610
- variant: "transparent",
611
- className: "w-full",
612
- onClick: onSkip,
613
- children: t("onboarding.wizard.skip")
614
- }
615
- )
616
- ] })
617
- ] }) })
618
- ] });
619
- };
620
-
621
- // src/components/onboarding-wizard/steps/company-step.tsx
622
- import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
623
- import { Button as Button3, Heading as Heading3, Input as Input3 } from "@medusajs/ui";
624
- import { useForm as useForm2 } from "react-hook-form";
625
- import { useTranslation as useTranslation4 } from "react-i18next";
626
- import * as z3 from "zod";
627
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
628
- var CompanyStepSchema = z3.object({
629
- corporate_name: z3.string().optional(),
630
- registration_number: z3.string().optional(),
631
- tax_id: z3.string().optional()
632
- });
633
- var CompanyStep = ({ onSubmit, onSkip, isPending }) => {
634
- const { t } = useTranslation4();
635
- const form = useForm2({
636
- resolver: zodResolver2(CompanyStepSchema),
637
- defaultValues: {
638
- corporate_name: "",
639
- registration_number: "",
640
- tax_id: ""
641
- }
642
- });
643
- const handleSubmit = form.handleSubmit(async (data) => {
644
- await onSubmit(data);
645
- });
646
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-8", children: [
647
- /* @__PURE__ */ jsx6(Heading3, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.company.title") }),
648
- /* @__PURE__ */ jsx6(Form, { ...form, children: /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
649
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4", children: [
650
- /* @__PURE__ */ jsx6(
651
- Form.Field,
652
- {
653
- control: form.control,
654
- name: "corporate_name",
655
- render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
656
- /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.corporateName") }),
657
- /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
658
- /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
659
- ] })
660
- }
661
- ),
662
- /* @__PURE__ */ jsx6(
663
- Form.Field,
664
- {
665
- control: form.control,
666
- name: "registration_number",
667
- render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
668
- /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.registrationNumber") }),
669
- /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
670
- /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
671
- ] })
672
- }
673
- ),
674
- /* @__PURE__ */ jsx6(
675
- Form.Field,
676
- {
677
- control: form.control,
678
- name: "tax_id",
679
- render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
680
- /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.taxId") }),
681
- /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
682
- /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
683
- ] })
684
- }
685
- )
686
- ] }),
687
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-2", children: [
688
- /* @__PURE__ */ jsx6(Button3, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
689
- /* @__PURE__ */ jsx6(
690
- Button3,
691
- {
692
- type: "button",
693
- variant: "transparent",
694
- className: "w-full",
695
- onClick: onSkip,
696
- children: t("onboarding.wizard.skip")
697
- }
698
- )
699
- ] })
700
- ] }) })
701
- ] });
702
- };
703
-
704
- // src/components/onboarding-wizard/steps/payment-step.tsx
705
- import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
706
- import { Button as Button4, Heading as Heading4, Input as Input4 } from "@medusajs/ui";
707
- import i18n3 from "i18next";
708
- import { useForm as useForm3 } from "react-hook-form";
709
- import { useTranslation as useTranslation5 } from "react-i18next";
710
- import * as z4 from "zod";
711
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
712
- var PaymentStepSchema = z4.object({
713
- country_code: z4.string().min(1, i18n3.t("onboarding.wizard.validation.countryRequired")),
714
- holder_name: z4.string().min(1, i18n3.t("onboarding.wizard.validation.accountNameRequired")),
715
- iban: z4.string().optional(),
716
- bic: z4.string().optional(),
717
- routing_number: z4.string().optional(),
718
- account_number: z4.string().optional()
719
- });
720
- var PaymentStep = ({
721
- onSubmit,
722
- onSkip,
723
- isPending
724
- }) => {
725
- const { t } = useTranslation5();
726
- const form = useForm3({
727
- resolver: zodResolver3(PaymentStepSchema),
728
- defaultValues: {
729
- country_code: "",
730
- holder_name: "",
731
- iban: "",
732
- bic: "",
733
- routing_number: "",
734
- account_number: ""
735
- }
736
- });
737
- const selectedCountry = form.watch("country_code");
738
- const isUS = selectedCountry === "us";
739
- const handleSubmit = form.handleSubmit(async (data) => {
740
- await onSubmit(data);
741
- });
742
- return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-8", children: [
743
- /* @__PURE__ */ jsx7(Heading4, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.payment.title") }),
744
- /* @__PURE__ */ jsx7(Form, { ...form, children: /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
745
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-4", children: [
746
- /* @__PURE__ */ jsx7(
747
- Form.Field,
748
- {
749
- control: form.control,
750
- name: "country_code",
751
- render: ({ field: { onChange, ref: _ref, ...field } }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
752
- /* @__PURE__ */ jsx7(Form.Label, { children: t("onboarding.wizard.address.country") }),
753
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(CountrySelect, { ...field, onChange }) }),
754
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
755
- ] })
756
- }
757
- ),
758
- selectedCountry && /* @__PURE__ */ jsxs5(Fragment, { children: [
759
- /* @__PURE__ */ jsx7(
760
- Form.Field,
761
- {
762
- control: form.control,
763
- name: "holder_name",
764
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
765
- /* @__PURE__ */ jsx7(Form.Label, { children: t("onboarding.wizard.payment.accountName") }),
766
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
767
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
768
- ] })
769
- }
770
- ),
771
- isUS ? /* @__PURE__ */ jsxs5(Fragment, { children: [
772
- /* @__PURE__ */ jsx7(
773
- Form.Field,
774
- {
775
- control: form.control,
776
- name: "account_number",
777
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
778
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.accountNumber") }),
779
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
780
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
781
- ] })
782
- }
783
- ),
784
- /* @__PURE__ */ jsx7(
785
- Form.Field,
786
- {
787
- control: form.control,
788
- name: "routing_number",
789
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
790
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.achRoutingNumber") }),
791
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
792
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
793
- ] })
794
- }
795
- )
796
- ] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
797
- /* @__PURE__ */ jsx7(
798
- Form.Field,
799
- {
800
- control: form.control,
801
- name: "iban",
802
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
803
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.iban") }),
804
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
805
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
806
- ] })
807
- }
808
- ),
809
- /* @__PURE__ */ jsx7(
810
- Form.Field,
811
- {
812
- control: form.control,
813
- name: "account_number",
814
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
815
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.accountNumber") }),
816
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
817
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
818
- ] })
819
- }
820
- ),
821
- /* @__PURE__ */ jsx7(
822
- Form.Field,
823
- {
824
- control: form.control,
825
- name: "bic",
826
- render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
827
- /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.swiftBic") }),
828
- /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
829
- /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
830
- ] })
831
- }
832
- )
833
- ] })
834
- ] })
835
- ] }),
836
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-2", children: [
837
- /* @__PURE__ */ jsx7(Button4, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
838
- /* @__PURE__ */ jsx7(
839
- Button4,
840
- {
841
- type: "button",
842
- variant: "transparent",
843
- className: "w-full",
844
- onClick: onSkip,
845
- children: t("onboarding.wizard.skip")
846
- }
847
- )
848
- ] })
849
- ] }) })
850
- ] });
851
- };
852
-
853
- // src/components/onboarding-wizard/onboarding-wizard.tsx
854
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
855
- var OnboardingWizard = ({ memberEmail }) => {
856
- const navigate = useNavigate2();
857
- const { mutateAsync: logoutMutation } = useLogout();
858
- const { seller_members } = useSellers(useLinkQuery("seller"));
859
- const hasStores = (seller_members?.length ?? 0) > 0;
860
- const {
861
- currentStep,
862
- sellerId,
863
- isPending,
864
- goBack,
865
- submitStoreStep,
866
- submitAddressStep,
867
- skipAddressStep,
868
- submitCompanyStep,
869
- skipCompanyStep,
870
- submitPaymentStep,
871
- skipPaymentStep
872
- } = useOnboarding(memberEmail);
873
- const handleBack = async () => {
874
- if (currentStep === 0) {
875
- if (hasStores) {
876
- navigate("/store-select", { replace: true });
877
- } else {
878
- await logoutMutation(void 0, {
879
- onSuccess: () => queryClient.clear(),
880
- onSettled: () => navigate("/login")
881
- });
882
- }
883
- } else {
884
- goBack();
885
- }
886
- };
887
- const renderStep = () => {
888
- switch (currentStep) {
889
- case 0:
890
- return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(StoreStep, { onSubmit: submitStoreStep, isPending }) }, "store");
891
- case 1:
892
- return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
893
- AddressStep,
894
- {
895
- onSubmit: submitAddressStep,
896
- onSkip: skipAddressStep,
897
- isPending
898
- }
899
- ) }, "address");
900
- case 2:
901
- return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
902
- CompanyStep,
903
- {
904
- onSubmit: submitCompanyStep,
905
- onSkip: skipCompanyStep,
906
- isPending
907
- }
908
- ) }, "company");
909
- case 3:
910
- return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
911
- PaymentStep,
912
- {
913
- sellerId,
914
- onSubmit: submitPaymentStep,
915
- onSkip: skipPaymentStep,
916
- isPending
917
- }
918
- ) }, "payment");
919
- default:
920
- return null;
921
- }
922
- };
923
- return /* @__PURE__ */ jsxs6("div", { className: "flex h-dvh w-dvw overflow-hidden", children: [
924
- /* @__PURE__ */ jsx8(
925
- WizardSidebar,
926
- {
927
- currentStep,
928
- onBack: handleBack,
929
- showBack: true,
930
- children: /* @__PURE__ */ jsx8(AnimatePresence, { mode: "wait", children: renderStep() })
931
- }
932
- ),
933
- /* @__PURE__ */ jsx8(WizardPreview, {})
934
- ] });
935
- };
936
-
937
- // src/pages/onboarding/onboarding.tsx
938
- import { jsx as jsx9 } from "react/jsx-runtime";
939
- var ONBOARDING_EMAIL_KEY = "mercur_onboarding_email";
940
- var Onboarding = () => {
941
- const location = useLocation();
942
- const stateEmail = location.state?.email;
943
- useEffect(() => {
944
- if (stateEmail) {
945
- sessionStorage.setItem(ONBOARDING_EMAIL_KEY, stateEmail);
946
- }
947
- }, [stateEmail]);
948
- const email = stateEmail || sessionStorage.getItem(ONBOARDING_EMAIL_KEY) || "";
949
- if (!email) {
950
- return /* @__PURE__ */ jsx9(Navigate, { to: "/login", replace: true });
951
- }
952
- return /* @__PURE__ */ jsx9(OnboardingWizard, { memberEmail: email });
953
- };
954
- export {
955
- Onboarding as Component,
956
- onboardingLoader as loader
957
- };