@mercurjs/vendor 2.0.2 → 2.1.0-canary.5

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 (98) hide show
  1. package/dist/{[id]-DCCF7277.js → [id]-57VYN5YF.js} +2 -3
  2. package/dist/{[id]-UAOAQVEM.js → [id]-FWI6NCSF.js} +3 -4
  3. package/dist/{[id]-6WYSWXWC.js → [id]-IQNYVYZU.js} +1 -2
  4. package/dist/{[id]-LZPT5Y55.js → [id]-KCUHMQWF.js} +1 -2
  5. package/dist/{[id]-ENTJSLN2.js → [id]-KMRB5RAW.js} +3 -3
  6. package/dist/{[id]-PHS2WYFX.js → [id]-LCMQBEOS.js} +2 -3
  7. package/dist/{[id]-OGHRZ2VY.js → [id]-LJJPLKJ6.js} +5 -4
  8. package/dist/{[id]-VKG2WEIR.js → [id]-M3PNP527.js} +1 -2
  9. package/dist/{[id]-EJAHMOOE.js → [id]-MZOT4GAO.js} +2 -3
  10. package/dist/{[id]-TLZZ53G7.js → [id]-WYIWRY5O.js} +2 -2
  11. package/dist/{[province_id]-XGA44S7P.js → [province_id]-2MRNXHKU.js} +1 -2
  12. package/dist/{add-7ZTE42IE.js → add-RDOKD6CX.js} +2 -2
  13. package/dist/{add-AKC7LTK3.js → add-W7ATBCKS.js} +2 -3
  14. package/dist/{add-customer-groups-BRC3DKQ2.js → add-customer-groups-ZZVSJJH3.js} +1 -2
  15. package/dist/{add-products-ZSULNZVI.js → add-products-PINICUAZ.js} +2 -3
  16. package/dist/{add-promotions-TNFVT5ST.js → add-promotions-W57766OG.js} +3 -3
  17. package/dist/{address-3DSJESKM.js → address-MQS4I2N6.js} +58 -71
  18. package/dist/{breadcrumb-ZMVHXCOX.js → breadcrumb-A3XUO3R2.js} +2 -3
  19. package/dist/{breadcrumb-UH7FAYU2.js → breadcrumb-MPXARU5F.js} +1 -2
  20. package/dist/{breadcrumb-D6QNYOAO.js → breadcrumb-Q5KJBAPD.js} +1 -2
  21. package/dist/{chunk-CUMY2VZ5.js → chunk-5LKZCG77.js} +1 -96
  22. package/dist/{chunk-7XC7ZRG7.js → chunk-5VBEGZ5W.js} +1 -1
  23. package/dist/{chunk-573EQEW2.js → chunk-6HPF5UZA.js} +1 -1
  24. package/dist/{chunk-RV5UTYBG.js → chunk-EQQ3BLQ3.js} +2 -2
  25. package/dist/{chunk-LA6XSPQG.js → chunk-FI2RBY7M.js} +287 -309
  26. package/dist/{chunk-RMBCBXWD.js → chunk-GQFNE5VL.js} +1 -1
  27. package/dist/chunk-HFRHHT36.js +98 -0
  28. package/dist/{chunk-O7E4KQAK.js → chunk-I4F7UYZE.js} +1 -1
  29. package/dist/chunk-JWB2HSCJ.js +30 -0
  30. package/dist/{chunk-FNG7ZA7N.js → chunk-NCQBAHWT.js} +1 -1
  31. package/dist/{chunk-T7LEJIIM.js → chunk-PT3UQCSN.js} +1 -1
  32. package/dist/chunk-TLE6YHGH.js +26 -0
  33. package/dist/{chunk-JRT2U4UI.js → chunk-TRKJKAM6.js} +130 -33
  34. package/dist/{chunk-ASEVHHCT.js → chunk-UDG47AEE.js} +1 -1
  35. package/dist/{chunk-XZG2HZYW.js → chunk-WFE6CT6M.js} +1 -1
  36. package/dist/{chunk-N2WKLVUX.js → chunk-XF3W2U3Q.js} +1 -1
  37. package/dist/{chunk-JKKRKFCS.js → chunk-YPSJN3XT.js} +29 -32
  38. package/dist/{chunk-NYRRRCJS.js → chunk-ZCJ737TR.js} +66 -21
  39. package/dist/{collections-2M4RFH4P.js → collections-NNFGWUTW.js} +2 -3
  40. package/dist/{create-D4F457BD.js → create-GCSVAMEH.js} +1 -2
  41. package/dist/{create-2TUWGQ2D.js → create-N3WNCW7U.js} +1 -2
  42. package/dist/{create-QK2SSLZK.js → create-T73PSKIV.js} +3 -4
  43. package/dist/{create-OF2OZ7EI.js → create-TXBY6W3X.js} +1 -2
  44. package/dist/{create-6IRE6AMF.js → create-V3TFI4BJ.js} +8 -7
  45. package/dist/{create-IFMEEHN4.js → create-VPG7P53M.js} +2 -3
  46. package/dist/{create-YITFTHMA.js → create-WY4KXB66.js} +1 -2
  47. package/dist/{create-3WUTLUJO.js → create-YCOR6HY3.js} +1 -2
  48. package/dist/{edit-SGEECDCR.js → edit-2QUFOE5S.js} +1 -2
  49. package/dist/{edit-UQAQVEUI.js → edit-62WJ7SBJ.js} +27 -10
  50. package/dist/{edit-QRJIWTU2.js → edit-B245OLC7.js} +1 -2
  51. package/dist/{edit-PIE7Y73J.js → edit-CPVFMQEI.js} +3 -4
  52. package/dist/{edit-ONSN756P.js → edit-F4F6EQDZ.js} +1 -1
  53. package/dist/{edit-Z7EZRPUP.js → edit-JGBH64CC.js} +1 -1
  54. package/dist/{edit-J5SC7GHQ.js → edit-KWSXWWOA.js} +1 -2
  55. package/dist/{edit-ZEIL7EQW.js → edit-QYKH2ZZA.js} +1 -2
  56. package/dist/{edit-stocks-and-prices-543AYFDJ.js → edit-stocks-and-prices-Y233WVZ3.js} +1 -2
  57. package/dist/{fulfillment-5LNFBSBS.js → fulfillment-FBF3MITY.js} +1 -2
  58. package/dist/{fulfillment-providers-U7Z7QMOQ.js → fulfillment-providers-Y2YOREHX.js} +2 -3
  59. package/dist/index.css +35 -29
  60. package/dist/index.js +86 -87
  61. package/dist/invite-G7WOO5RZ.js +368 -0
  62. package/dist/{invite-SI2KIPWI.js → invite-Y2TACGCW.js} +3 -5
  63. package/dist/{login-QDS5UXKV.js → login-3U4XGDAD.js} +3 -3
  64. package/dist/{media-RDXCLPKQ.js → media-O2GIGGFG.js} +2 -2
  65. package/dist/{metadata-7JKDCVYY.js → metadata-7RA6MXW7.js} +1 -2
  66. package/dist/{metadata-ZV5RYLKR.js → metadata-GSBDSRNM.js} +1 -2
  67. package/dist/{metadata-X4UIPNL6.js → metadata-JXRXW6UQ.js} +1 -2
  68. package/dist/{metadata-W5XIPFVU.js → metadata-QM4UGMX5.js} +1 -2
  69. package/dist/{metadata-UKBRUFH2.js → metadata-RODKLIDO.js} +1 -2
  70. package/dist/onboarding-7XHOLSKH.js +943 -0
  71. package/dist/{orders-IAL3JNPU.js → orders-HKUVFCTQ.js} +2 -3
  72. package/dist/pages/index.d.ts +140 -140
  73. package/dist/pages/index.js +16 -14
  74. package/dist/{payment-details-ATUYMVJX.js → payment-details-VWR2S32W.js} +1 -2
  75. package/dist/{pricing-RBESFX5P.js → pricing-6UZ6SXIE.js} +1 -2
  76. package/dist/{product-tags-W4BL6RWV.js → product-tags-YXVFIPGQ.js} +3 -4
  77. package/dist/{product-variant-detail-KU5OCL7E.js → product-variant-detail-O2NOUFFC.js} +1 -2
  78. package/dist/{products-3VVYJUH7.js → products-3NIIOQBB.js} +2 -3
  79. package/dist/{products-YYLVCOOY.js → products-T2EMLRXQ.js} +10 -9
  80. package/dist/{professional-details-6Y5K6GBL.js → professional-details-SJ4AF5TM.js} +1 -2
  81. package/dist/{promotions-NBJTFP6N.js → promotions-ZEH4RHL3.js} +4 -4
  82. package/dist/register-4SX23YPM.js +210 -0
  83. package/dist/{reset-password-PLCDLFL4.js → reset-password-4LWDUVMH.js} +1 -1
  84. package/dist/{sales-channels-UIDLFCX6.js → sales-channels-2OVI6RTV.js} +3 -2
  85. package/dist/{sales-channels-UWPEFKAO.js → sales-channels-BKOYQXVC.js} +3 -2
  86. package/dist/{settings-5MNWE5CR.js → settings-F6KJREHK.js} +3 -4
  87. package/dist/{shipping-profiles-O7XB2DTE.js → shipping-profiles-AQMJSXDB.js} +1 -2
  88. package/dist/{stock-VJAAYYW5.js → stock-4G4WQIR7.js} +1 -2
  89. package/dist/{stock-2CGEFBXO.js → stock-NJADHNRP.js} +1 -2
  90. package/dist/{store-ZBSMNWFT.js → store-E4JEK2CQ.js} +220 -118
  91. package/dist/{store-closure-43FK32AQ.js → store-closure-QPK4LBBZ.js} +35 -19
  92. package/dist/{store-select-Q2HE572R.js → store-select-XPC6NIV5.js} +31 -22
  93. package/dist/{team-ZLZJJWIY.js → team-DZ5CV3LG.js} +1 -2
  94. package/package.json +5 -5
  95. package/dist/chunk-STBCWNZQ.js +0 -57
  96. package/dist/invite-P6HTOEIV.js +0 -301
  97. package/dist/onboarding-DLIBZRKE.js +0 -873
  98. package/dist/register-ZLE6MNPF.js +0 -223
@@ -0,0 +1,943 @@
1
+ import {
2
+ HandleInput
3
+ } from "./chunk-TLE6YHGH.js";
4
+ import {
5
+ CountrySelect
6
+ } from "./chunk-V74Y5NIV.js";
7
+ import {
8
+ Form
9
+ } from "./chunk-3QSRE5LS.js";
10
+ import "./chunk-JRTZWK77.js";
11
+ import {
12
+ useCreateSellerAccount,
13
+ useSellers
14
+ } from "./chunk-ZCJ737TR.js";
15
+ import {
16
+ useLogout
17
+ } from "./chunk-F4OJN2F2.js";
18
+ import "./chunk-LRARA622.js";
19
+ import "./chunk-M6N4ISXL.js";
20
+ import "./chunk-S7EKBD2C.js";
21
+ import "./chunk-VXMOPVRH.js";
22
+ import "./chunk-IQWK723D.js";
23
+ import "./chunk-VV6IKGCN.js";
24
+ import "./chunk-PCMNEUMV.js";
25
+ import "./chunk-BOZJOOGW.js";
26
+ import "./chunk-RL7SFZOF.js";
27
+ import "./chunk-LWJF63JW.js";
28
+ import "./chunk-NBPMNUKZ.js";
29
+ import "./chunk-GCSQEJMD.js";
30
+ import "./chunk-VXWN37PT.js";
31
+ import "./chunk-UL4O5M4S.js";
32
+ import {
33
+ retrieveActiveStore,
34
+ storeQueryKeys,
35
+ useStore
36
+ } from "./chunk-FX4V5JCF.js";
37
+ import "./chunk-3B34B2M2.js";
38
+ import "./chunk-RUE5BPC2.js";
39
+ import "./chunk-ZEVYT6IX.js";
40
+ import "./chunk-A5DJIOHN.js";
41
+ import {
42
+ queryClient
43
+ } from "./chunk-RHKRREUU.js";
44
+ import "./chunk-ZA2KFUFR.js";
45
+ import "./chunk-RIN4CBRB.js";
46
+ import "./chunk-NBMM2TZK.js";
47
+
48
+ // src/pages/onboarding/loader.ts
49
+ var storeDetailQuery = () => ({
50
+ queryKey: storeQueryKeys.details(),
51
+ queryFn: async () => retrieveActiveStore()
52
+ });
53
+ var onboardingLoader = async () => {
54
+ const query = storeDetailQuery();
55
+ return queryClient.ensureQueryData(query);
56
+ };
57
+
58
+ // src/pages/onboarding/onboarding.tsx
59
+ import { useEffect as useEffect2 } from "react";
60
+ import { Navigate, useLocation } from "react-router-dom";
61
+
62
+ // src/components/onboarding-wizard/onboarding-wizard.tsx
63
+ import { AnimatePresence } from "motion/react";
64
+ import { useNavigate as useNavigate2 } from "react-router-dom";
65
+
66
+ // src/components/onboarding-wizard/wizard-sidebar.tsx
67
+ import { ChevronLeft } from "@medusajs/icons";
68
+ import { Text } from "@medusajs/ui";
69
+ import { useTranslation } from "react-i18next";
70
+
71
+ // src/components/onboarding-wizard/constants.ts
72
+ var WIZARD_STEPS = [
73
+ {
74
+ id: "store",
75
+ number: 1,
76
+ labelKey: "onboarding.wizard.steps.store"
77
+ },
78
+ {
79
+ id: "address",
80
+ number: 2,
81
+ labelKey: "onboarding.wizard.steps.address"
82
+ },
83
+ {
84
+ id: "company",
85
+ number: 3,
86
+ labelKey: "onboarding.wizard.steps.company"
87
+ },
88
+ {
89
+ id: "payment",
90
+ number: 4,
91
+ labelKey: "onboarding.wizard.steps.payment"
92
+ }
93
+ ];
94
+ var TOTAL_STEPS = WIZARD_STEPS.length;
95
+
96
+ // src/components/onboarding-wizard/wizard-sidebar.tsx
97
+ import { jsx, jsxs } from "react/jsx-runtime";
98
+ var WizardSidebar = ({
99
+ currentStep,
100
+ onBack,
101
+ showBack,
102
+ children
103
+ }) => {
104
+ const { t } = useTranslation();
105
+ 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: [
106
+ showBack && onBack && /* @__PURE__ */ jsxs(
107
+ "button",
108
+ {
109
+ type: "button",
110
+ onClick: onBack,
111
+ 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",
112
+ children: [
113
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
114
+ /* @__PURE__ */ jsx("span", { children: t("actions.back") })
115
+ ]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle mb-1", children: t("onboarding.wizard.stepOf", {
119
+ current: currentStep + 1,
120
+ total: TOTAL_STEPS
121
+ }) }),
122
+ children
123
+ ] }) });
124
+ };
125
+
126
+ // src/components/onboarding-wizard/wizard-preview.tsx
127
+ import { useEffect } from "react";
128
+ import { jsx as jsx2 } from "react/jsx-runtime";
129
+ var STEP_IMAGES = {
130
+ 0: "/onboarding/1.png",
131
+ 1: "/onboarding/2.png",
132
+ 2: "/onboarding/3.png",
133
+ 3: "/onboarding/4.png"
134
+ };
135
+ var preloadImages = () => {
136
+ Object.values(STEP_IMAGES).forEach((src) => {
137
+ const img = new Image();
138
+ img.src = src;
139
+ });
140
+ };
141
+ var WizardPreview = ({ currentStep }) => {
142
+ useEffect(preloadImages, []);
143
+ const image = STEP_IMAGES[currentStep];
144
+ return /* @__PURE__ */ jsx2(
145
+ "div",
146
+ {
147
+ className: "hidden lg:flex flex-1 relative overflow-hidden items-center justify-center",
148
+ style: { backgroundImage: "url(/onboarding/bg.svg)", backgroundSize: "cover", backgroundPosition: "center" },
149
+ children: /* @__PURE__ */ jsx2(
150
+ "img",
151
+ {
152
+ src: image,
153
+ alt: "",
154
+ className: "w-[75%] max-h-[75%] object-contain"
155
+ }
156
+ )
157
+ }
158
+ );
159
+ };
160
+
161
+ // src/components/onboarding-wizard/wizard-step.tsx
162
+ import { motion } from "motion/react";
163
+ import { jsx as jsx3 } from "react/jsx-runtime";
164
+ var stepVariants = {
165
+ initial: { opacity: 0, y: 12, filter: "blur(4px)" },
166
+ animate: { opacity: 1, y: 0, filter: "blur(0px)" },
167
+ exit: {
168
+ opacity: 0,
169
+ y: -8,
170
+ filter: "blur(4px)",
171
+ transition: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
172
+ }
173
+ };
174
+ var WizardStep = ({ children }) => {
175
+ return /* @__PURE__ */ jsx3(
176
+ motion.div,
177
+ {
178
+ variants: stepVariants,
179
+ initial: "initial",
180
+ animate: "animate",
181
+ exit: "exit",
182
+ transition: { duration: 0.35, ease: [0.23, 1, 0.32, 1] },
183
+ className: "flex flex-col",
184
+ children
185
+ }
186
+ );
187
+ };
188
+
189
+ // src/components/onboarding-wizard/hooks/use-onboarding.ts
190
+ import { useState, useCallback, useRef } from "react";
191
+ import { useNavigate } from "react-router-dom";
192
+ import { toast } from "@medusajs/ui";
193
+ var useOnboarding = (memberEmail) => {
194
+ const navigate = useNavigate();
195
+ const [currentStep, setCurrentStep] = useState(0);
196
+ const [isSubmitting, setIsSubmitting] = useState(false);
197
+ const sellerIdRef = useRef(null);
198
+ const [sellerIdState, setSellerIdState] = useState(null);
199
+ const setSellerId = (id) => {
200
+ sellerIdRef.current = id;
201
+ setSellerIdState(id);
202
+ };
203
+ const storeDataRef = useRef(null);
204
+ const addressDataRef = useRef(null);
205
+ const companyDataRef = useRef(null);
206
+ const { mutateAsync: createSeller, isPending: isCreating } = useCreateSellerAccount();
207
+ const { mutateAsync: logout } = useLogout();
208
+ const isPending = isCreating || isSubmitting;
209
+ const submitStoreStep = useCallback(async (data) => {
210
+ storeDataRef.current = data;
211
+ setCurrentStep(1);
212
+ }, []);
213
+ const submitAddressStep = useCallback(async (data) => {
214
+ addressDataRef.current = data;
215
+ setCurrentStep(2);
216
+ }, []);
217
+ const skipAddressStep = useCallback(() => {
218
+ addressDataRef.current = null;
219
+ setCurrentStep(2);
220
+ }, []);
221
+ const submitCompanyStep = useCallback(async (data) => {
222
+ companyDataRef.current = data;
223
+ setCurrentStep(3);
224
+ }, []);
225
+ const skipCompanyStep = useCallback(() => {
226
+ companyDataRef.current = null;
227
+ setCurrentStep(3);
228
+ }, []);
229
+ const createSellerWithAllData = useCallback(
230
+ async (paymentData) => {
231
+ const storeData = storeDataRef.current;
232
+ if (!storeData) return;
233
+ if (sellerIdRef.current) {
234
+ navigate("/store-select", { replace: true });
235
+ return;
236
+ }
237
+ const addressData = addressDataRef.current;
238
+ const companyData = companyDataRef.current;
239
+ const hasCompanyData = companyData?.corporate_name || companyData?.registration_number || companyData?.tax_id;
240
+ const isUS = paymentData?.country_code === "us";
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
+ currency_code: storeData.currency_code.toLowerCase(),
250
+ description: storeData.description || void 0,
251
+ address: addressData ? {
252
+ name: addressData.name || void 0,
253
+ address_1: addressData.address_1 || void 0,
254
+ address_2: addressData.address_2 || void 0,
255
+ postal_code: addressData.postal_code || void 0,
256
+ city: addressData.city || void 0,
257
+ country_code: addressData.country_code,
258
+ province: addressData.province || void 0
259
+ } : void 0,
260
+ professional_details: hasCompanyData ? {
261
+ corporate_name: companyData.corporate_name || void 0,
262
+ registration_number: companyData.registration_number || void 0,
263
+ tax_id: companyData.tax_id || void 0
264
+ } : void 0,
265
+ payment_details: paymentData ? {
266
+ country_code: paymentData.country_code,
267
+ holder_name: paymentData.holder_name,
268
+ iban: isUS ? null : paymentData.iban || null,
269
+ bic: isUS ? null : paymentData.bic || null,
270
+ routing_number: isUS ? paymentData.routing_number || null : null,
271
+ account_number: paymentData.account_number || null
272
+ } : void 0
273
+ });
274
+ const newSellerId = result.seller.id;
275
+ setSellerId(newSellerId);
276
+ try {
277
+ await logout();
278
+ } catch {
279
+ }
280
+ queryClient.clear();
281
+ sessionStorage.removeItem("mercur_onboarding_email");
282
+ navigate("/login", { replace: true });
283
+ } catch (error) {
284
+ toast.error(error.message);
285
+ } finally {
286
+ setIsSubmitting(false);
287
+ }
288
+ },
289
+ [createSeller, logout, memberEmail, navigate]
290
+ );
291
+ const submitPaymentStep = useCallback(
292
+ async (data) => {
293
+ await createSellerWithAllData(data);
294
+ },
295
+ [createSellerWithAllData]
296
+ );
297
+ const skipPaymentStep = useCallback(async () => {
298
+ await createSellerWithAllData();
299
+ }, [createSellerWithAllData]);
300
+ const goBack = useCallback(() => {
301
+ if (currentStep > 0) {
302
+ setCurrentStep((prev) => prev - 1);
303
+ }
304
+ }, [currentStep]);
305
+ return {
306
+ currentStep,
307
+ totalSteps: TOTAL_STEPS,
308
+ sellerId: sellerIdState,
309
+ isPending,
310
+ canGoBack: currentStep > 0,
311
+ goBack,
312
+ submitStoreStep,
313
+ submitAddressStep,
314
+ skipAddressStep,
315
+ submitCompanyStep,
316
+ skipCompanyStep,
317
+ submitPaymentStep,
318
+ skipPaymentStep
319
+ };
320
+ };
321
+
322
+ // src/components/onboarding-wizard/steps/store-step.tsx
323
+ import { zodResolver } from "@hookform/resolvers/zod";
324
+ import { Button, Heading, Input, Select, Textarea } from "@medusajs/ui";
325
+ import i18n from "i18next";
326
+ import { useForm } from "react-hook-form";
327
+ import { useTranslation as useTranslation2 } from "react-i18next";
328
+ import { useLoaderData } from "react-router-dom";
329
+ import * as z from "zod";
330
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
331
+ var StoreStepSchema = z.object({
332
+ name: z.string().min(1, i18n.t("onboarding.wizard.validation.nameRequired")),
333
+ email: z.string().email(i18n.t("onboarding.wizard.validation.emailInvalid")),
334
+ phone: z.string().optional(),
335
+ currency_code: z.string().min(1, i18n.t("onboarding.wizard.validation.currencyRequired")),
336
+ description: z.string().optional(),
337
+ handle: z.string().optional()
338
+ });
339
+ var StoreStep = ({ onSubmit, isPending }) => {
340
+ const { t } = useTranslation2();
341
+ const initialData = useLoaderData();
342
+ const { store } = useStore(void 0, { initialData });
343
+ const form = useForm({
344
+ resolver: zodResolver(StoreStepSchema),
345
+ defaultValues: {
346
+ name: "",
347
+ email: "",
348
+ phone: "",
349
+ currency_code: "",
350
+ description: "",
351
+ handle: ""
352
+ }
353
+ });
354
+ const handleSubmit = form.handleSubmit(async (data) => {
355
+ await onSubmit(data);
356
+ });
357
+ return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-8", children: [
358
+ /* @__PURE__ */ jsx4(Heading, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.store.title") }),
359
+ /* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
360
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-4", children: [
361
+ /* @__PURE__ */ jsx4(
362
+ Form.Field,
363
+ {
364
+ control: form.control,
365
+ name: "name",
366
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
367
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.name") }),
368
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { autoComplete: "organization", ...field }) }),
369
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
370
+ ] })
371
+ }
372
+ ),
373
+ /* @__PURE__ */ jsx4(
374
+ Form.Field,
375
+ {
376
+ control: form.control,
377
+ name: "email",
378
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
379
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.email") }),
380
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { type: "email", autoComplete: "email", ...field }) }),
381
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
382
+ ] })
383
+ }
384
+ ),
385
+ /* @__PURE__ */ jsx4(
386
+ Form.Field,
387
+ {
388
+ control: form.control,
389
+ name: "phone",
390
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
391
+ /* @__PURE__ */ jsx4(Form.Label, { optional: true, children: t("fields.phone") }),
392
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Input, { type: "tel", autoComplete: "tel", ...field }) }),
393
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
394
+ ] })
395
+ }
396
+ ),
397
+ /* @__PURE__ */ jsx4(
398
+ Form.Field,
399
+ {
400
+ control: form.control,
401
+ name: "description",
402
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
403
+ /* @__PURE__ */ jsx4(Form.Label, { optional: true, children: t("fields.description") }),
404
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(Textarea, { ...field }) }),
405
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
406
+ ] })
407
+ }
408
+ ),
409
+ /* @__PURE__ */ jsx4(
410
+ Form.Field,
411
+ {
412
+ control: form.control,
413
+ name: "handle",
414
+ render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
415
+ /* @__PURE__ */ jsx4(
416
+ Form.Label,
417
+ {
418
+ optional: true,
419
+ tooltip: t("onboarding.wizard.store.handleTooltip"),
420
+ children: t("onboarding.wizard.store.handle")
421
+ }
422
+ ),
423
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(HandleInput, { ...field }) }),
424
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
425
+ ] })
426
+ }
427
+ ),
428
+ /* @__PURE__ */ jsx4(
429
+ Form.Field,
430
+ {
431
+ control: form.control,
432
+ name: "currency_code",
433
+ render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
434
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("onboarding.wizard.store.currency") }),
435
+ /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsxs2(Select, { ...field, onValueChange: onChange, children: [
436
+ /* @__PURE__ */ jsx4(Select.Trigger, { ref, children: /* @__PURE__ */ jsx4(
437
+ Select.Value,
438
+ {
439
+ placeholder: t("onboarding.wizard.store.selectCurrency")
440
+ }
441
+ ) }),
442
+ /* @__PURE__ */ jsx4(Select.Content, { children: store?.supported_currencies?.map((sc) => /* @__PURE__ */ jsx4(
443
+ Select.Item,
444
+ {
445
+ value: sc.currency_code,
446
+ children: sc.currency_code.toUpperCase()
447
+ },
448
+ sc.currency_code
449
+ )) })
450
+ ] }) }),
451
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
452
+ ] })
453
+ }
454
+ )
455
+ ] }),
456
+ /* @__PURE__ */ jsx4(Button, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") })
457
+ ] }) })
458
+ ] });
459
+ };
460
+
461
+ // src/components/onboarding-wizard/steps/address-step.tsx
462
+ import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
463
+ import { Button as Button2, Heading as Heading2, Input as Input2 } from "@medusajs/ui";
464
+ import i18n2 from "i18next";
465
+ import { useForm as useForm2 } from "react-hook-form";
466
+ import { useTranslation as useTranslation3 } from "react-i18next";
467
+ import * as z2 from "zod";
468
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
469
+ var AddressStepSchema = z2.object({
470
+ name: z2.string().min(1, i18n2.t("onboarding.wizard.validation.nameRequired")),
471
+ address_1: z2.string().optional(),
472
+ address_2: z2.string().optional(),
473
+ postal_code: z2.string().optional(),
474
+ city: z2.string().optional(),
475
+ country_code: z2.string().min(1, i18n2.t("onboarding.wizard.validation.countryRequired")),
476
+ province: z2.string().optional()
477
+ });
478
+ var AddressStep = ({ onSubmit, onSkip, isPending }) => {
479
+ const { t } = useTranslation3();
480
+ const form = useForm2({
481
+ resolver: zodResolver2(AddressStepSchema),
482
+ defaultValues: {
483
+ name: "",
484
+ address_1: "",
485
+ address_2: "",
486
+ postal_code: "",
487
+ city: "",
488
+ country_code: "",
489
+ province: ""
490
+ }
491
+ });
492
+ const handleSubmit = form.handleSubmit(async (data) => {
493
+ await onSubmit(data);
494
+ });
495
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-8", children: [
496
+ /* @__PURE__ */ jsx5(Heading2, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.address.title") }),
497
+ /* @__PURE__ */ jsx5(Form, { ...form, children: /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
498
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-4", children: [
499
+ /* @__PURE__ */ jsx5(
500
+ Form.Field,
501
+ {
502
+ control: form.control,
503
+ name: "name",
504
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
505
+ /* @__PURE__ */ jsx5(Form.Label, { children: t("onboarding.wizard.address.name") }),
506
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(
507
+ Input2,
508
+ {
509
+ placeholder: t("onboarding.wizard.address.namePlaceholder"),
510
+ ...field
511
+ }
512
+ ) }),
513
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
514
+ ] })
515
+ }
516
+ ),
517
+ /* @__PURE__ */ jsx5(
518
+ Form.Field,
519
+ {
520
+ control: form.control,
521
+ name: "address_1",
522
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
523
+ /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.address") }),
524
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-line1", ...field }) }),
525
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
526
+ ] })
527
+ }
528
+ ),
529
+ /* @__PURE__ */ jsx5(
530
+ Form.Field,
531
+ {
532
+ control: form.control,
533
+ name: "address_2",
534
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
535
+ /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.address2") }),
536
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-line2", ...field }) }),
537
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
538
+ ] })
539
+ }
540
+ ),
541
+ /* @__PURE__ */ jsx5(
542
+ Form.Field,
543
+ {
544
+ control: form.control,
545
+ name: "postal_code",
546
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
547
+ /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.postalCode") }),
548
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "postal-code", ...field }) }),
549
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
550
+ ] })
551
+ }
552
+ ),
553
+ /* @__PURE__ */ jsx5(
554
+ Form.Field,
555
+ {
556
+ control: form.control,
557
+ name: "city",
558
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
559
+ /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.city") }),
560
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-level2", ...field }) }),
561
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
562
+ ] })
563
+ }
564
+ ),
565
+ /* @__PURE__ */ jsx5(
566
+ Form.Field,
567
+ {
568
+ control: form.control,
569
+ name: "country_code",
570
+ render: ({ field: { onChange, ref: _ref, ...field } }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
571
+ /* @__PURE__ */ jsx5(Form.Label, { children: t("onboarding.wizard.address.country") }),
572
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(CountrySelect, { ...field, onChange }) }),
573
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
574
+ ] })
575
+ }
576
+ ),
577
+ /* @__PURE__ */ jsx5(
578
+ Form.Field,
579
+ {
580
+ control: form.control,
581
+ name: "province",
582
+ render: ({ field }) => /* @__PURE__ */ jsxs3(Form.Item, { children: [
583
+ /* @__PURE__ */ jsx5(Form.Label, { optional: true, children: t("onboarding.wizard.address.state") }),
584
+ /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(Input2, { autoComplete: "address-level1", ...field }) }),
585
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
586
+ ] })
587
+ }
588
+ )
589
+ ] }),
590
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-2", children: [
591
+ /* @__PURE__ */ jsx5(Button2, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
592
+ /* @__PURE__ */ jsx5(
593
+ Button2,
594
+ {
595
+ type: "button",
596
+ variant: "transparent",
597
+ className: "w-full",
598
+ onClick: onSkip,
599
+ children: t("onboarding.wizard.skip")
600
+ }
601
+ )
602
+ ] })
603
+ ] }) })
604
+ ] });
605
+ };
606
+
607
+ // src/components/onboarding-wizard/steps/company-step.tsx
608
+ import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
609
+ import { Button as Button3, Heading as Heading3, Input as Input3 } from "@medusajs/ui";
610
+ import { useForm as useForm3 } from "react-hook-form";
611
+ import { useTranslation as useTranslation4 } from "react-i18next";
612
+ import * as z3 from "zod";
613
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
614
+ var CompanyStepSchema = z3.object({
615
+ corporate_name: z3.string().optional(),
616
+ registration_number: z3.string().optional(),
617
+ tax_id: z3.string().optional()
618
+ });
619
+ var CompanyStep = ({ onSubmit, onSkip, isPending }) => {
620
+ const { t } = useTranslation4();
621
+ const form = useForm3({
622
+ resolver: zodResolver3(CompanyStepSchema),
623
+ defaultValues: {
624
+ corporate_name: "",
625
+ registration_number: "",
626
+ tax_id: ""
627
+ }
628
+ });
629
+ const handleSubmit = form.handleSubmit(async (data) => {
630
+ await onSubmit(data);
631
+ });
632
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-8", children: [
633
+ /* @__PURE__ */ jsx6(Heading3, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.company.title") }),
634
+ /* @__PURE__ */ jsx6(Form, { ...form, children: /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
635
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4", children: [
636
+ /* @__PURE__ */ jsx6(
637
+ Form.Field,
638
+ {
639
+ control: form.control,
640
+ name: "corporate_name",
641
+ render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
642
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.corporateName") }),
643
+ /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
644
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
645
+ ] })
646
+ }
647
+ ),
648
+ /* @__PURE__ */ jsx6(
649
+ Form.Field,
650
+ {
651
+ control: form.control,
652
+ name: "registration_number",
653
+ render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
654
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.registrationNumber") }),
655
+ /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
656
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
657
+ ] })
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsx6(
661
+ Form.Field,
662
+ {
663
+ control: form.control,
664
+ name: "tax_id",
665
+ render: ({ field }) => /* @__PURE__ */ jsxs4(Form.Item, { children: [
666
+ /* @__PURE__ */ jsx6(Form.Label, { optional: true, children: t("onboarding.wizard.company.taxId") }),
667
+ /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(Input3, { ...field }) }),
668
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
669
+ ] })
670
+ }
671
+ )
672
+ ] }),
673
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-2", children: [
674
+ /* @__PURE__ */ jsx6(Button3, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
675
+ /* @__PURE__ */ jsx6(
676
+ Button3,
677
+ {
678
+ type: "button",
679
+ variant: "transparent",
680
+ className: "w-full",
681
+ onClick: onSkip,
682
+ children: t("onboarding.wizard.skip")
683
+ }
684
+ )
685
+ ] })
686
+ ] }) })
687
+ ] });
688
+ };
689
+
690
+ // src/components/onboarding-wizard/steps/payment-step.tsx
691
+ import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
692
+ import { Button as Button4, Heading as Heading4, Input as Input4 } from "@medusajs/ui";
693
+ import i18n3 from "i18next";
694
+ import { useForm as useForm4 } from "react-hook-form";
695
+ import { useTranslation as useTranslation5 } from "react-i18next";
696
+ import * as z4 from "zod";
697
+ import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
698
+ var PaymentStepSchema = z4.object({
699
+ country_code: z4.string().min(1, i18n3.t("onboarding.wizard.validation.countryRequired")),
700
+ holder_name: z4.string().min(1, i18n3.t("onboarding.wizard.validation.accountNameRequired")),
701
+ iban: z4.string().optional(),
702
+ bic: z4.string().optional(),
703
+ routing_number: z4.string().optional(),
704
+ account_number: z4.string().optional()
705
+ });
706
+ var PaymentStep = ({
707
+ onSubmit,
708
+ onSkip,
709
+ isPending
710
+ }) => {
711
+ const { t } = useTranslation5();
712
+ const form = useForm4({
713
+ resolver: zodResolver4(PaymentStepSchema),
714
+ defaultValues: {
715
+ country_code: "",
716
+ holder_name: "",
717
+ iban: "",
718
+ bic: "",
719
+ routing_number: "",
720
+ account_number: ""
721
+ }
722
+ });
723
+ const selectedCountry = form.watch("country_code");
724
+ const isUS = selectedCountry === "us";
725
+ const handleSubmit = form.handleSubmit(async (data) => {
726
+ await onSubmit(data);
727
+ });
728
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-8", children: [
729
+ /* @__PURE__ */ jsx7(Heading4, { level: "h2", className: "text-ui-fg-base text-lg", children: t("onboarding.wizard.payment.title") }),
730
+ /* @__PURE__ */ jsx7(Form, { ...form, children: /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-6", children: [
731
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-4", children: [
732
+ /* @__PURE__ */ jsx7(
733
+ Form.Field,
734
+ {
735
+ control: form.control,
736
+ name: "country_code",
737
+ render: ({ field: { onChange, ref: _ref, ...field } }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
738
+ /* @__PURE__ */ jsx7(Form.Label, { children: t("onboarding.wizard.address.country") }),
739
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(CountrySelect, { ...field, onChange }) }),
740
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
741
+ ] })
742
+ }
743
+ ),
744
+ selectedCountry && /* @__PURE__ */ jsxs5(Fragment, { children: [
745
+ /* @__PURE__ */ jsx7(
746
+ Form.Field,
747
+ {
748
+ control: form.control,
749
+ name: "holder_name",
750
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
751
+ /* @__PURE__ */ jsx7(Form.Label, { children: t("onboarding.wizard.payment.accountName") }),
752
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
753
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
754
+ ] })
755
+ }
756
+ ),
757
+ isUS ? /* @__PURE__ */ jsxs5(Fragment, { children: [
758
+ /* @__PURE__ */ jsx7(
759
+ Form.Field,
760
+ {
761
+ control: form.control,
762
+ name: "account_number",
763
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
764
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.accountNumber") }),
765
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
766
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
767
+ ] })
768
+ }
769
+ ),
770
+ /* @__PURE__ */ jsx7(
771
+ Form.Field,
772
+ {
773
+ control: form.control,
774
+ name: "routing_number",
775
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
776
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.achRoutingNumber") }),
777
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
778
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
779
+ ] })
780
+ }
781
+ )
782
+ ] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
783
+ /* @__PURE__ */ jsx7(
784
+ Form.Field,
785
+ {
786
+ control: form.control,
787
+ name: "iban",
788
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
789
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.iban") }),
790
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
791
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
792
+ ] })
793
+ }
794
+ ),
795
+ /* @__PURE__ */ jsx7(
796
+ Form.Field,
797
+ {
798
+ control: form.control,
799
+ name: "account_number",
800
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
801
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.accountNumber") }),
802
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
803
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
804
+ ] })
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsx7(
808
+ Form.Field,
809
+ {
810
+ control: form.control,
811
+ name: "bic",
812
+ render: ({ field }) => /* @__PURE__ */ jsxs5(Form.Item, { children: [
813
+ /* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("onboarding.wizard.payment.swiftBic") }),
814
+ /* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(Input4, { ...field }) }),
815
+ /* @__PURE__ */ jsx7(Form.ErrorMessage, {})
816
+ ] })
817
+ }
818
+ )
819
+ ] })
820
+ ] })
821
+ ] }),
822
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-2", children: [
823
+ /* @__PURE__ */ jsx7(Button4, { type: "submit", className: "w-full", isLoading: isPending, children: t("actions.continue") }),
824
+ /* @__PURE__ */ jsx7(
825
+ Button4,
826
+ {
827
+ type: "button",
828
+ variant: "transparent",
829
+ className: "w-full",
830
+ onClick: onSkip,
831
+ children: t("onboarding.wizard.skip")
832
+ }
833
+ )
834
+ ] })
835
+ ] }) })
836
+ ] });
837
+ };
838
+
839
+ // src/components/onboarding-wizard/onboarding-wizard.tsx
840
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
841
+ var OnboardingWizard = ({ memberEmail }) => {
842
+ const navigate = useNavigate2();
843
+ const { mutateAsync: logoutMutation } = useLogout();
844
+ const { seller_members } = useSellers();
845
+ const hasStores = (seller_members?.length ?? 0) > 0;
846
+ const {
847
+ currentStep,
848
+ sellerId,
849
+ isPending,
850
+ goBack,
851
+ submitStoreStep,
852
+ submitAddressStep,
853
+ skipAddressStep,
854
+ submitCompanyStep,
855
+ skipCompanyStep,
856
+ submitPaymentStep,
857
+ skipPaymentStep
858
+ } = useOnboarding(memberEmail);
859
+ const handleBack = async () => {
860
+ if (currentStep === 0) {
861
+ if (hasStores) {
862
+ navigate("/store-select", { replace: true });
863
+ } else {
864
+ await logoutMutation(void 0, {
865
+ onSuccess: () => queryClient.clear(),
866
+ onSettled: () => navigate("/login")
867
+ });
868
+ }
869
+ } else {
870
+ goBack();
871
+ }
872
+ };
873
+ const renderStep = () => {
874
+ switch (currentStep) {
875
+ case 0:
876
+ return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(StoreStep, { onSubmit: submitStoreStep, isPending }) }, "store");
877
+ case 1:
878
+ return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
879
+ AddressStep,
880
+ {
881
+ onSubmit: submitAddressStep,
882
+ onSkip: skipAddressStep,
883
+ isPending
884
+ }
885
+ ) }, "address");
886
+ case 2:
887
+ return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
888
+ CompanyStep,
889
+ {
890
+ onSubmit: submitCompanyStep,
891
+ onSkip: skipCompanyStep,
892
+ isPending
893
+ }
894
+ ) }, "company");
895
+ case 3:
896
+ return /* @__PURE__ */ jsx8(WizardStep, { children: /* @__PURE__ */ jsx8(
897
+ PaymentStep,
898
+ {
899
+ sellerId,
900
+ onSubmit: submitPaymentStep,
901
+ onSkip: skipPaymentStep,
902
+ isPending
903
+ }
904
+ ) }, "payment");
905
+ default:
906
+ return null;
907
+ }
908
+ };
909
+ return /* @__PURE__ */ jsxs6("div", { className: "flex h-dvh w-dvw overflow-hidden", children: [
910
+ /* @__PURE__ */ jsx8(
911
+ WizardSidebar,
912
+ {
913
+ currentStep,
914
+ onBack: handleBack,
915
+ showBack: true,
916
+ children: /* @__PURE__ */ jsx8(AnimatePresence, { mode: "wait", children: renderStep() })
917
+ }
918
+ ),
919
+ /* @__PURE__ */ jsx8(WizardPreview, { currentStep })
920
+ ] });
921
+ };
922
+
923
+ // src/pages/onboarding/onboarding.tsx
924
+ import { jsx as jsx9 } from "react/jsx-runtime";
925
+ var ONBOARDING_EMAIL_KEY = "mercur_onboarding_email";
926
+ var Onboarding = () => {
927
+ const location = useLocation();
928
+ const stateEmail = location.state?.email;
929
+ useEffect2(() => {
930
+ if (stateEmail) {
931
+ sessionStorage.setItem(ONBOARDING_EMAIL_KEY, stateEmail);
932
+ }
933
+ }, [stateEmail]);
934
+ const email = stateEmail || sessionStorage.getItem(ONBOARDING_EMAIL_KEY) || "";
935
+ if (!email) {
936
+ return /* @__PURE__ */ jsx9(Navigate, { to: "/login", replace: true });
937
+ }
938
+ return /* @__PURE__ */ jsx9(OnboardingWizard, { memberEmail: email });
939
+ };
940
+ export {
941
+ Onboarding as Component,
942
+ onboardingLoader as loader
943
+ };