@mercurjs/vendor 2.0.2 → 2.1.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{[id]-TLZZ53G7.js → [id]-2HRWUMSJ.js} +2 -2
- package/dist/{[id]-DCCF7277.js → [id]-57VYN5YF.js} +2 -3
- package/dist/{[id]-UAOAQVEM.js → [id]-FWI6NCSF.js} +3 -4
- package/dist/{[id]-6WYSWXWC.js → [id]-IQNYVYZU.js} +1 -2
- package/dist/{[id]-LZPT5Y55.js → [id]-KCUHMQWF.js} +1 -2
- package/dist/{[id]-PHS2WYFX.js → [id]-LCMQBEOS.js} +2 -3
- package/dist/{[id]-OGHRZ2VY.js → [id]-LJJPLKJ6.js} +5 -4
- package/dist/{[id]-VKG2WEIR.js → [id]-M3PNP527.js} +1 -2
- package/dist/{[id]-EJAHMOOE.js → [id]-MZOT4GAO.js} +2 -3
- package/dist/{[id]-ENTJSLN2.js → [id]-RKEN7EEY.js} +3 -3
- package/dist/{[province_id]-XGA44S7P.js → [province_id]-2MRNXHKU.js} +1 -2
- package/dist/{add-7ZTE42IE.js → add-BVR3LDPH.js} +2 -2
- package/dist/{add-AKC7LTK3.js → add-W7ATBCKS.js} +2 -3
- package/dist/{add-customer-groups-BRC3DKQ2.js → add-customer-groups-ZZVSJJH3.js} +1 -2
- package/dist/{add-products-ZSULNZVI.js → add-products-PINICUAZ.js} +2 -3
- package/dist/{add-promotions-TNFVT5ST.js → add-promotions-2DFXTDEJ.js} +3 -3
- package/dist/{address-3DSJESKM.js → address-RNB2WQPM.js} +1 -2
- package/dist/{breadcrumb-ZMVHXCOX.js → breadcrumb-A3XUO3R2.js} +2 -3
- package/dist/{breadcrumb-UH7FAYU2.js → breadcrumb-MPXARU5F.js} +1 -2
- package/dist/{breadcrumb-D6QNYOAO.js → breadcrumb-Q5KJBAPD.js} +1 -2
- package/dist/{chunk-JRT2U4UI.js → chunk-2DUMXTKS.js} +107 -18
- package/dist/{chunk-CUMY2VZ5.js → chunk-5LKZCG77.js} +1 -96
- package/dist/{chunk-RV5UTYBG.js → chunk-EQQ3BLQ3.js} +2 -2
- package/dist/{chunk-RMBCBXWD.js → chunk-GQFNE5VL.js} +1 -1
- package/dist/chunk-HFRHHT36.js +98 -0
- package/dist/{chunk-O7E4KQAK.js → chunk-HFW7IIO2.js} +1 -1
- package/dist/{chunk-T7LEJIIM.js → chunk-PT3UQCSN.js} +1 -1
- package/dist/{chunk-LA6XSPQG.js → chunk-QDSNLU6X.js} +287 -309
- package/dist/chunk-TLE6YHGH.js +26 -0
- package/dist/{chunk-ASEVHHCT.js → chunk-UDG47AEE.js} +1 -1
- package/dist/{chunk-573EQEW2.js → chunk-V4SZIX7Q.js} +1 -1
- package/dist/{chunk-7XC7ZRG7.js → chunk-VTHSHOX4.js} +1 -1
- package/dist/{chunk-XZG2HZYW.js → chunk-WFE6CT6M.js} +1 -1
- package/dist/{chunk-N2WKLVUX.js → chunk-XF3W2U3Q.js} +1 -1
- package/dist/{chunk-NYRRRCJS.js → chunk-ZCJ737TR.js} +66 -21
- package/dist/{chunk-FNG7ZA7N.js → chunk-ZCUUV464.js} +1 -1
- package/dist/{collections-2M4RFH4P.js → collections-NNFGWUTW.js} +2 -3
- package/dist/{create-6IRE6AMF.js → create-2BPTTXLB.js} +8 -7
- package/dist/{create-D4F457BD.js → create-GCSVAMEH.js} +1 -2
- package/dist/{create-2TUWGQ2D.js → create-N3WNCW7U.js} +1 -2
- package/dist/{create-QK2SSLZK.js → create-T73PSKIV.js} +3 -4
- package/dist/{create-OF2OZ7EI.js → create-TXBY6W3X.js} +1 -2
- package/dist/{create-IFMEEHN4.js → create-VPG7P53M.js} +2 -3
- package/dist/{create-YITFTHMA.js → create-WY4KXB66.js} +1 -2
- package/dist/{create-3WUTLUJO.js → create-YCOR6HY3.js} +1 -2
- package/dist/{edit-SGEECDCR.js → edit-2QUFOE5S.js} +1 -2
- package/dist/{edit-Z7EZRPUP.js → edit-A5ZBINLU.js} +1 -1
- package/dist/{edit-QRJIWTU2.js → edit-B245OLC7.js} +1 -2
- package/dist/{edit-PIE7Y73J.js → edit-CPVFMQEI.js} +3 -4
- package/dist/{edit-ONSN756P.js → edit-CZOV6HBW.js} +1 -1
- package/dist/{edit-J5SC7GHQ.js → edit-KWSXWWOA.js} +1 -2
- package/dist/{edit-ZEIL7EQW.js → edit-QYKH2ZZA.js} +1 -2
- package/dist/{edit-UQAQVEUI.js → edit-U5VL2UQY.js} +4 -5
- package/dist/{edit-stocks-and-prices-543AYFDJ.js → edit-stocks-and-prices-Y233WVZ3.js} +1 -2
- package/dist/{fulfillment-5LNFBSBS.js → fulfillment-FBF3MITY.js} +1 -2
- package/dist/{fulfillment-providers-U7Z7QMOQ.js → fulfillment-providers-Y2YOREHX.js} +2 -3
- package/dist/index.css +32 -26
- package/dist/index.js +86 -87
- package/dist/invite-G7WOO5RZ.js +368 -0
- package/dist/{invite-SI2KIPWI.js → invite-Y2TACGCW.js} +3 -5
- package/dist/{login-QDS5UXKV.js → login-JU7R2RNN.js} +1 -2
- package/dist/{media-RDXCLPKQ.js → media-TXY3WBR3.js} +2 -2
- package/dist/{metadata-7JKDCVYY.js → metadata-7RA6MXW7.js} +1 -2
- package/dist/{metadata-ZV5RYLKR.js → metadata-GSBDSRNM.js} +1 -2
- package/dist/{metadata-X4UIPNL6.js → metadata-JXRXW6UQ.js} +1 -2
- package/dist/{metadata-W5XIPFVU.js → metadata-QM4UGMX5.js} +1 -2
- package/dist/{metadata-UKBRUFH2.js → metadata-RODKLIDO.js} +1 -2
- package/dist/onboarding-VF7EQAAA.js +893 -0
- package/dist/{orders-IAL3JNPU.js → orders-HKUVFCTQ.js} +2 -3
- package/dist/pages/index.d.ts +140 -140
- package/dist/pages/index.js +14 -13
- package/dist/{payment-details-ATUYMVJX.js → payment-details-VWR2S32W.js} +1 -2
- package/dist/{pricing-RBESFX5P.js → pricing-6UZ6SXIE.js} +1 -2
- package/dist/{product-tags-W4BL6RWV.js → product-tags-YXVFIPGQ.js} +3 -4
- package/dist/{product-variant-detail-KU5OCL7E.js → product-variant-detail-O2NOUFFC.js} +1 -2
- package/dist/{products-3VVYJUH7.js → products-3NIIOQBB.js} +2 -3
- package/dist/{products-YYLVCOOY.js → products-Z6MD665K.js} +10 -9
- package/dist/{professional-details-6Y5K6GBL.js → professional-details-SJ4AF5TM.js} +1 -2
- package/dist/{promotions-NBJTFP6N.js → promotions-PJABWGCP.js} +4 -4
- package/dist/{register-ZLE6MNPF.js → register-PSBM4NCS.js} +3 -4
- package/dist/{reset-password-PLCDLFL4.js → reset-password-4RE5TXQ5.js} +1 -1
- package/dist/{sales-channels-UIDLFCX6.js → sales-channels-2OVI6RTV.js} +3 -2
- package/dist/{sales-channels-UWPEFKAO.js → sales-channels-BKOYQXVC.js} +3 -2
- package/dist/{settings-5MNWE5CR.js → settings-F6KJREHK.js} +3 -4
- package/dist/{shipping-profiles-O7XB2DTE.js → shipping-profiles-AQMJSXDB.js} +1 -2
- package/dist/{stock-VJAAYYW5.js → stock-4G4WQIR7.js} +1 -2
- package/dist/{stock-2CGEFBXO.js → stock-NJADHNRP.js} +1 -2
- package/dist/{store-ZBSMNWFT.js → store-HJGETE33.js} +225 -105
- package/dist/{store-closure-43FK32AQ.js → store-closure-QPK4LBBZ.js} +35 -19
- package/dist/{store-select-Q2HE572R.js → store-select-XS2APMBI.js} +1 -2
- package/dist/{team-ZLZJJWIY.js → team-DZ5CV3LG.js} +1 -2
- package/package.json +5 -5
- package/dist/chunk-STBCWNZQ.js +0 -57
- package/dist/invite-P6HTOEIV.js +0 -301
- package/dist/onboarding-DLIBZRKE.js +0 -873
|
@@ -34,8 +34,7 @@ import {
|
|
|
34
34
|
useMe,
|
|
35
35
|
useRemoveSellerMember,
|
|
36
36
|
useSellerMembers
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-STBCWNZQ.js";
|
|
37
|
+
} from "./chunk-ZCJ737TR.js";
|
|
39
38
|
import "./chunk-F4OJN2F2.js";
|
|
40
39
|
import "./chunk-LRARA622.js";
|
|
41
40
|
import "./chunk-M6N4ISXL.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercurjs/vendor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-canary.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@mercurjs/dashboard-shared": "2.
|
|
33
|
-
"@mercurjs/client": "2.
|
|
32
|
+
"@mercurjs/dashboard-shared": "2.1.0-canary.4",
|
|
33
|
+
"@mercurjs/client": "2.1.0-canary.4",
|
|
34
34
|
"@ariakit/react": "^0.4.15",
|
|
35
35
|
"@babel/runtime": "^7.26.10",
|
|
36
36
|
"@dnd-kit/core": "^6.1.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"tsup": "^8.0.2",
|
|
84
84
|
"typescript": "5.9.3",
|
|
85
85
|
"@medusajs/types": "2.13.4",
|
|
86
|
-
"@mercurjs/core
|
|
86
|
+
"@mercurjs/core": "workspace:*",
|
|
87
87
|
"@mercurjs/dashboard-sdk": "workspace:*",
|
|
88
88
|
"@mercurjs/types": "workspace:*"
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}
|
package/dist/chunk-STBCWNZQ.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
queryClient
|
|
3
|
-
} from "./chunk-RHKRREUU.js";
|
|
4
|
-
import {
|
|
5
|
-
queryKeysFactory
|
|
6
|
-
} from "./chunk-ZA2KFUFR.js";
|
|
7
|
-
import {
|
|
8
|
-
sdk
|
|
9
|
-
} from "./chunk-RIN4CBRB.js";
|
|
10
|
-
|
|
11
|
-
// src/hooks/api/invites.tsx
|
|
12
|
-
import {
|
|
13
|
-
useMutation,
|
|
14
|
-
useQuery
|
|
15
|
-
} from "@tanstack/react-query";
|
|
16
|
-
var INVITES_QUERY_KEY = "invites";
|
|
17
|
-
var invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY);
|
|
18
|
-
var useInvites = (sellerId, query, options) => {
|
|
19
|
-
const { data, ...rest } = useQuery({
|
|
20
|
-
queryFn: () => sdk.vendor.sellers.$id.members.invites.query({
|
|
21
|
-
$id: sellerId,
|
|
22
|
-
...query
|
|
23
|
-
}),
|
|
24
|
-
queryKey: invitesQueryKeys.list({ sellerId, ...query }),
|
|
25
|
-
...options
|
|
26
|
-
});
|
|
27
|
-
return { ...data, ...rest };
|
|
28
|
-
};
|
|
29
|
-
var useAcceptInvite = (options) => {
|
|
30
|
-
return useMutation({
|
|
31
|
-
mutationFn: (payload) => sdk.vendor.members.invites.accept.mutate({
|
|
32
|
-
invite_token: payload.invite_token,
|
|
33
|
-
fetchOptions: {
|
|
34
|
-
headers: {
|
|
35
|
-
Authorization: `Bearer ${payload.auth_token}`
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
...options
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
var useCreateInvite = (sellerId, options) => {
|
|
43
|
-
return useMutation({
|
|
44
|
-
mutationFn: (payload) => sdk.vendor.sellers.$id.members.mutate({ $id: sellerId, ...payload }),
|
|
45
|
-
onSuccess: (data, variables, context) => {
|
|
46
|
-
queryClient.invalidateQueries({ queryKey: invitesQueryKeys.lists() });
|
|
47
|
-
options?.onSuccess?.(data, variables, context);
|
|
48
|
-
},
|
|
49
|
-
...options
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
useInvites,
|
|
55
|
-
useAcceptInvite,
|
|
56
|
-
useCreateInvite
|
|
57
|
-
};
|
package/dist/invite-P6HTOEIV.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AvatarBox
|
|
3
|
-
} from "./chunk-CP5IL4P6.js";
|
|
4
|
-
import {
|
|
5
|
-
isFetchError
|
|
6
|
-
} from "./chunk-C6SUTRP2.js";
|
|
7
|
-
import {
|
|
8
|
-
Form
|
|
9
|
-
} from "./chunk-3QSRE5LS.js";
|
|
10
|
-
import "./chunk-U2EI2ZLM.js";
|
|
11
|
-
import {
|
|
12
|
-
useAcceptInvite
|
|
13
|
-
} from "./chunk-STBCWNZQ.js";
|
|
14
|
-
import {
|
|
15
|
-
useSignInForInvite,
|
|
16
|
-
useSignUpForInvite
|
|
17
|
-
} from "./chunk-F4OJN2F2.js";
|
|
18
|
-
import "./chunk-RHKRREUU.js";
|
|
19
|
-
import "./chunk-ZA2KFUFR.js";
|
|
20
|
-
import "./chunk-RIN4CBRB.js";
|
|
21
|
-
import "./chunk-NBMM2TZK.js";
|
|
22
|
-
|
|
23
|
-
// src/pages/invite/invite.tsx
|
|
24
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
25
|
-
import { Alert, Button, Heading, Hint, Input, Text, toast } from "@medusajs/ui";
|
|
26
|
-
import i18n from "i18next";
|
|
27
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
28
|
-
import { useState } from "react";
|
|
29
|
-
import { useForm } from "react-hook-form";
|
|
30
|
-
import { useTranslation } from "react-i18next";
|
|
31
|
-
import { decodeToken } from "react-jwt";
|
|
32
|
-
import { Link, useSearchParams } from "react-router-dom";
|
|
33
|
-
import * as z from "zod";
|
|
34
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
-
var CreateAccountSchema = z.object({
|
|
36
|
-
email: z.string().email(),
|
|
37
|
-
password: z.string().min(1),
|
|
38
|
-
repeat_password: z.string().optional(),
|
|
39
|
-
existing_member: z.boolean()
|
|
40
|
-
}).superRefine(({ password, repeat_password, existing_member }, ctx) => {
|
|
41
|
-
if (!existing_member && (!repeat_password || password !== repeat_password)) {
|
|
42
|
-
ctx.addIssue({
|
|
43
|
-
code: z.ZodIssueCode.custom,
|
|
44
|
-
message: i18n.t("invite.passwordMismatch"),
|
|
45
|
-
path: ["repeat_password"]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
var Invite = () => {
|
|
50
|
-
const [searchParams] = useSearchParams();
|
|
51
|
-
const [success, setSuccess] = useState(false);
|
|
52
|
-
const token = searchParams.get("token");
|
|
53
|
-
const invite = token ? decodeToken(token) : null;
|
|
54
|
-
const isValidInvite = invite && validateDecodedInvite(invite);
|
|
55
|
-
return /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle relative flex min-h-dvh w-dvw items-center justify-center p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[360px] flex-col items-center", children: [
|
|
56
|
-
/* @__PURE__ */ jsx(AvatarBox, { checked: success }),
|
|
57
|
-
/* @__PURE__ */ jsx("div", { className: "w-full will-change-contents", children: isValidInvite ? /* @__PURE__ */ jsx(AnimatePresence, { children: !success ? /* @__PURE__ */ jsx(
|
|
58
|
-
motion.div,
|
|
59
|
-
{
|
|
60
|
-
initial: false,
|
|
61
|
-
animate: { y: 0 },
|
|
62
|
-
exit: { height: 0, y: 40 },
|
|
63
|
-
transition: {
|
|
64
|
-
duration: 0.8,
|
|
65
|
-
delay: 0.6,
|
|
66
|
-
ease: [0, 0.71, 0.2, 1.01]
|
|
67
|
-
},
|
|
68
|
-
className: "w-full will-change-transform",
|
|
69
|
-
children: /* @__PURE__ */ jsx(
|
|
70
|
-
motion.div,
|
|
71
|
-
{
|
|
72
|
-
initial: false,
|
|
73
|
-
animate: { opacity: 1, scale: 1 },
|
|
74
|
-
exit: { opacity: 0, scale: 0.7 },
|
|
75
|
-
transition: {
|
|
76
|
-
duration: 0.6,
|
|
77
|
-
delay: 0,
|
|
78
|
-
ease: [0, 0.71, 0.2, 1.01]
|
|
79
|
-
},
|
|
80
|
-
children: /* @__PURE__ */ jsx(
|
|
81
|
-
CreateView,
|
|
82
|
-
{
|
|
83
|
-
onSuccess: () => setSuccess(true),
|
|
84
|
-
token,
|
|
85
|
-
invite
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
},
|
|
89
|
-
"inner-create-account"
|
|
90
|
-
)
|
|
91
|
-
},
|
|
92
|
-
"create-account"
|
|
93
|
-
) : /* @__PURE__ */ jsx(
|
|
94
|
-
motion.div,
|
|
95
|
-
{
|
|
96
|
-
initial: { opacity: 0, scale: 0.4 },
|
|
97
|
-
animate: { opacity: 1, scale: 1 },
|
|
98
|
-
transition: {
|
|
99
|
-
duration: 1,
|
|
100
|
-
delay: 0.6,
|
|
101
|
-
ease: [0, 0.71, 0.2, 1.01]
|
|
102
|
-
},
|
|
103
|
-
className: "w-full",
|
|
104
|
-
children: /* @__PURE__ */ jsx(SuccessView, { sellerName: invite.seller_name })
|
|
105
|
-
},
|
|
106
|
-
"success-view"
|
|
107
|
-
) }) : /* @__PURE__ */ jsx(InvalidView, {}) })
|
|
108
|
-
] }) });
|
|
109
|
-
};
|
|
110
|
-
var LoginLink = () => {
|
|
111
|
-
const { t } = useTranslation();
|
|
112
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center", children: [
|
|
113
|
-
/* @__PURE__ */ jsx("div", { className: "my-6 h-px w-full border-b border-dotted" }),
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
Link,
|
|
116
|
-
{
|
|
117
|
-
to: "/login",
|
|
118
|
-
className: "txt-small text-ui-fg-base transition-fg hover:text-ui-fg-base-hover focus-visible:text-ui-fg-base-hover font-medium outline-none",
|
|
119
|
-
children: t("invite.backToLogin")
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
] });
|
|
123
|
-
};
|
|
124
|
-
var InvalidView = () => {
|
|
125
|
-
const { t } = useTranslation();
|
|
126
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
127
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-y-1", children: [
|
|
128
|
-
/* @__PURE__ */ jsx(Heading, { children: t("invite.invalidTokenTitle") }),
|
|
129
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle text-center", children: t("invite.invalidTokenHint") })
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ jsx(LoginLink, {})
|
|
132
|
-
] });
|
|
133
|
-
};
|
|
134
|
-
var CreateView = ({
|
|
135
|
-
onSuccess,
|
|
136
|
-
token,
|
|
137
|
-
invite
|
|
138
|
-
}) => {
|
|
139
|
-
const { t } = useTranslation();
|
|
140
|
-
const [invalid, setInvalid] = useState(false);
|
|
141
|
-
const isExistingMember = invite.existing_member;
|
|
142
|
-
const form = useForm({
|
|
143
|
-
resolver: zodResolver(CreateAccountSchema),
|
|
144
|
-
defaultValues: {
|
|
145
|
-
email: invite.email || "",
|
|
146
|
-
password: "",
|
|
147
|
-
repeat_password: "",
|
|
148
|
-
existing_member: isExistingMember
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const { mutateAsync: signUp, isPending: isCreatingAuthUser } = useSignUpForInvite();
|
|
152
|
-
const { mutateAsync: signIn, isPending: isSigningIn } = useSignInForInvite();
|
|
153
|
-
const { mutateAsync: acceptInvite, isPending: isAcceptingInvite } = useAcceptInvite();
|
|
154
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
155
|
-
try {
|
|
156
|
-
const { token: authToken } = isExistingMember ? await signIn({
|
|
157
|
-
email: data.email,
|
|
158
|
-
password: data.password
|
|
159
|
-
}) : await signUp({
|
|
160
|
-
email: data.email,
|
|
161
|
-
password: data.password
|
|
162
|
-
});
|
|
163
|
-
await acceptInvite({
|
|
164
|
-
invite_token: token,
|
|
165
|
-
auth_token: authToken
|
|
166
|
-
});
|
|
167
|
-
toast.success(t("invite.toast.accepted"));
|
|
168
|
-
onSuccess();
|
|
169
|
-
} catch (error) {
|
|
170
|
-
if (isFetchError(error)) {
|
|
171
|
-
if (error.status === 401) {
|
|
172
|
-
form.setError("root", {
|
|
173
|
-
type: "manual",
|
|
174
|
-
message: t("errors.invalidCredentials")
|
|
175
|
-
});
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (error.status === 400) {
|
|
179
|
-
form.setError("root", {
|
|
180
|
-
type: "manual",
|
|
181
|
-
message: t("invite.invalidInvite")
|
|
182
|
-
});
|
|
183
|
-
setInvalid(true);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
form.setError("root", {
|
|
188
|
-
type: "manual",
|
|
189
|
-
message: t("errors.serverError")
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
const serverError = form.formState.errors.root?.message;
|
|
194
|
-
const validationError = form.formState.errors.email?.message || form.formState.errors.password?.message || form.formState.errors.repeat_password?.message;
|
|
195
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center", children: [
|
|
196
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col items-center", children: [
|
|
197
|
-
/* @__PURE__ */ jsx(Heading, { children: t("invite.title", {
|
|
198
|
-
name: invite.seller_name
|
|
199
|
-
}) }),
|
|
200
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle text-center", children: isExistingMember ? t("invite.existingMemberHint") : t("invite.hint") })
|
|
201
|
-
] }),
|
|
202
|
-
/* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex w-full flex-col gap-y-6", children: [
|
|
203
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
204
|
-
/* @__PURE__ */ jsx(
|
|
205
|
-
Form.Field,
|
|
206
|
-
{
|
|
207
|
-
control: form.control,
|
|
208
|
-
name: "email",
|
|
209
|
-
render: ({ field }) => /* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
210
|
-
Input,
|
|
211
|
-
{
|
|
212
|
-
autoComplete: "off",
|
|
213
|
-
...field,
|
|
214
|
-
className: "bg-ui-bg-field-component",
|
|
215
|
-
placeholder: t("fields.email"),
|
|
216
|
-
disabled: true
|
|
217
|
-
}
|
|
218
|
-
) }) })
|
|
219
|
-
}
|
|
220
|
-
),
|
|
221
|
-
/* @__PURE__ */ jsx(
|
|
222
|
-
Form.Field,
|
|
223
|
-
{
|
|
224
|
-
control: form.control,
|
|
225
|
-
name: "password",
|
|
226
|
-
render: ({ field }) => /* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
227
|
-
Input,
|
|
228
|
-
{
|
|
229
|
-
autoComplete: "new-password",
|
|
230
|
-
type: "password",
|
|
231
|
-
...field,
|
|
232
|
-
className: "bg-ui-bg-field-component",
|
|
233
|
-
placeholder: t("fields.password")
|
|
234
|
-
}
|
|
235
|
-
) }) })
|
|
236
|
-
}
|
|
237
|
-
),
|
|
238
|
-
!isExistingMember && /* @__PURE__ */ jsx(
|
|
239
|
-
Form.Field,
|
|
240
|
-
{
|
|
241
|
-
control: form.control,
|
|
242
|
-
name: "repeat_password",
|
|
243
|
-
render: ({ field }) => /* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
244
|
-
Input,
|
|
245
|
-
{
|
|
246
|
-
autoComplete: "off",
|
|
247
|
-
type: "password",
|
|
248
|
-
...field,
|
|
249
|
-
className: "bg-ui-bg-field-component",
|
|
250
|
-
placeholder: t("fields.repeatPassword")
|
|
251
|
-
}
|
|
252
|
-
) }) })
|
|
253
|
-
}
|
|
254
|
-
),
|
|
255
|
-
validationError && /* @__PURE__ */ jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsx(Hint, { className: "inline-flex", variant: "error", children: validationError }) }),
|
|
256
|
-
serverError && /* @__PURE__ */ jsx(
|
|
257
|
-
Alert,
|
|
258
|
-
{
|
|
259
|
-
className: "bg-ui-bg-base items-center p-2",
|
|
260
|
-
dismissible: true,
|
|
261
|
-
variant: "error",
|
|
262
|
-
children: serverError
|
|
263
|
-
}
|
|
264
|
-
)
|
|
265
|
-
] }),
|
|
266
|
-
/* @__PURE__ */ jsx(
|
|
267
|
-
Button,
|
|
268
|
-
{
|
|
269
|
-
className: "w-full",
|
|
270
|
-
type: "submit",
|
|
271
|
-
isLoading: isCreatingAuthUser || isSigningIn || isAcceptingInvite,
|
|
272
|
-
disabled: invalid,
|
|
273
|
-
children: isExistingMember ? t("invite.signIn") : t("invite.createAccount")
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
] }) }),
|
|
277
|
-
/* @__PURE__ */ jsx(LoginLink, {})
|
|
278
|
-
] });
|
|
279
|
-
};
|
|
280
|
-
var SuccessView = ({ sellerName }) => {
|
|
281
|
-
const { t } = useTranslation();
|
|
282
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center gap-y-6", children: [
|
|
283
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-y-1", children: [
|
|
284
|
-
/* @__PURE__ */ jsx(Heading, { className: "text-center", children: t("invite.successTitle", { name: sellerName }) }),
|
|
285
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle text-center", children: t("invite.successHint") })
|
|
286
|
-
] }),
|
|
287
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(Link, { to: "/login", replace: true, children: t("invite.backToLogin") }) })
|
|
288
|
-
] });
|
|
289
|
-
};
|
|
290
|
-
var InviteSchema = z.object({
|
|
291
|
-
id: z.string(),
|
|
292
|
-
jti: z.string(),
|
|
293
|
-
exp: z.number(),
|
|
294
|
-
iat: z.number()
|
|
295
|
-
});
|
|
296
|
-
var validateDecodedInvite = (decoded) => {
|
|
297
|
-
return InviteSchema.safeParse(decoded).success;
|
|
298
|
-
};
|
|
299
|
-
export {
|
|
300
|
-
Invite as Component
|
|
301
|
-
};
|