@enadhq/enad-react-sdk 0.0.6

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 (167) hide show
  1. package/dist/client/cart/components/cart-drawer.d.mts +19 -0
  2. package/dist/client/cart/components/cart-drawer.mjs +180 -0
  3. package/dist/client/cart/components/cart-drawer.mjs.map +1 -0
  4. package/dist/client/cart/components/cart-trigger.d.mts +5 -0
  5. package/dist/client/cart/components/cart-trigger.mjs +18 -0
  6. package/dist/client/cart/components/cart-trigger.mjs.map +1 -0
  7. package/dist/client/cart/constants/session.d.mts +3 -0
  8. package/dist/client/cart/constants/session.mjs +5 -0
  9. package/dist/client/cart/constants/session.mjs.map +1 -0
  10. package/dist/client/cart/contexts/cart.d.mts +27 -0
  11. package/dist/client/cart/contexts/cart.mjs +22 -0
  12. package/dist/client/cart/contexts/cart.mjs.map +1 -0
  13. package/dist/client/cart/hooks/useCart.d.mts +29 -0
  14. package/dist/client/cart/hooks/useCart.mjs +26 -0
  15. package/dist/client/cart/hooks/useCart.mjs.map +1 -0
  16. package/dist/client/cart/hooks/useCartActions.d.mts +26 -0
  17. package/dist/client/cart/hooks/useCartActions.mjs +58 -0
  18. package/dist/client/cart/hooks/useCartActions.mjs.map +1 -0
  19. package/dist/client/cart/queries/addToCartQueryFn.d.mts +10 -0
  20. package/dist/client/cart/queries/addToCartQueryFn.mjs +27 -0
  21. package/dist/client/cart/queries/addToCartQueryFn.mjs.map +1 -0
  22. package/dist/client/cart/queries/getCartQueryFn.d.mts +7 -0
  23. package/dist/client/cart/queries/getCartQueryFn.mjs +34 -0
  24. package/dist/client/cart/queries/getCartQueryFn.mjs.map +1 -0
  25. package/dist/client/cart/queries/removeCartItemQueryFn.d.mts +9 -0
  26. package/dist/client/cart/queries/removeCartItemQueryFn.mjs +24 -0
  27. package/dist/client/cart/queries/removeCartItemQueryFn.mjs.map +1 -0
  28. package/dist/client/cart/queries/updateCartItemQueryFn.d.mts +10 -0
  29. package/dist/client/cart/queries/updateCartItemQueryFn.mjs +27 -0
  30. package/dist/client/cart/queries/updateCartItemQueryFn.mjs.map +1 -0
  31. package/dist/client/cart/types/cart.d.mts +36 -0
  32. package/dist/client/cart/types/cart.mjs +1 -0
  33. package/dist/client/cart/types/cart.mjs.map +1 -0
  34. package/dist/client/cart/utils/session.d.mts +6 -0
  35. package/dist/client/cart/utils/session.mjs +21 -0
  36. package/dist/client/cart/utils/session.mjs.map +1 -0
  37. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.d.mts +6 -0
  38. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.mjs +24 -0
  39. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.mjs.map +1 -0
  40. package/dist/client/cms/storyblok/preview/storyblok-preview-syncer.d.mts +22 -0
  41. package/dist/client/cms/storyblok/preview/storyblok-preview-syncer.mjs +79 -0
  42. package/dist/client/cms/storyblok/preview/storyblok-preview-syncer.mjs.map +1 -0
  43. package/dist/client/global/auth/withAuth.d.mts +6 -0
  44. package/dist/client/global/auth/withAuth.mjs +25 -0
  45. package/dist/client/global/auth/withAuth.mjs.map +1 -0
  46. package/dist/client/global/config/index.d.mts +17 -0
  47. package/dist/client/global/config/index.mjs +34 -0
  48. package/dist/client/global/config/index.mjs.map +1 -0
  49. package/dist/client/global/constants/tags.d.mts +16 -0
  50. package/dist/client/global/constants/tags.mjs +18 -0
  51. package/dist/client/global/constants/tags.mjs.map +1 -0
  52. package/dist/client/global/providers/enad-provider.d.mts +23 -0
  53. package/dist/client/global/providers/enad-provider.mjs +11 -0
  54. package/dist/client/global/providers/enad-provider.mjs.map +1 -0
  55. package/dist/client/search/actions/searchAction.d.mts +5 -0
  56. package/dist/client/search/actions/searchAction.mjs +18 -0
  57. package/dist/client/search/actions/searchAction.mjs.map +1 -0
  58. package/dist/client/search/components/search-bar.d.mts +2 -0
  59. package/dist/client/search/components/search-bar.mjs +1 -0
  60. package/dist/client/search/components/search-bar.mjs.map +1 -0
  61. package/dist/client/search/hooks/useSearch.d.mts +18 -0
  62. package/dist/client/search/hooks/useSearch.mjs +37 -0
  63. package/dist/client/search/hooks/useSearch.mjs.map +1 -0
  64. package/dist/client/user/actions/createResetPasswordLinkAction.d.mts +14 -0
  65. package/dist/client/user/actions/createResetPasswordLinkAction.mjs +30 -0
  66. package/dist/client/user/actions/createResetPasswordLinkAction.mjs.map +1 -0
  67. package/dist/client/user/actions/getUserAction.d.mts +5 -0
  68. package/dist/client/user/actions/getUserAction.mjs +19 -0
  69. package/dist/client/user/actions/getUserAction.mjs.map +1 -0
  70. package/dist/client/user/actions/logInUserAction.d.mts +15 -0
  71. package/dist/client/user/actions/logInUserAction.mjs +34 -0
  72. package/dist/client/user/actions/logInUserAction.mjs.map +1 -0
  73. package/dist/client/user/actions/logoutUserAction.d.mts +3 -0
  74. package/dist/client/user/actions/logoutUserAction.mjs +10 -0
  75. package/dist/client/user/actions/logoutUserAction.mjs.map +1 -0
  76. package/dist/client/user/actions/registerOrganisationAction.d.mts +12 -0
  77. package/dist/client/user/actions/registerOrganisationAction.mjs +18 -0
  78. package/dist/client/user/actions/registerOrganisationAction.mjs.map +1 -0
  79. package/dist/client/user/actions/registerUserAction.d.mts +18 -0
  80. package/dist/client/user/actions/registerUserAction.mjs +42 -0
  81. package/dist/client/user/actions/registerUserAction.mjs.map +1 -0
  82. package/dist/client/user/actions/registerUserWithoutRedirectAction.d.mts +44 -0
  83. package/dist/client/user/actions/registerUserWithoutRedirectAction.mjs +58 -0
  84. package/dist/client/user/actions/registerUserWithoutRedirectAction.mjs.map +1 -0
  85. package/dist/client/user/actions/updatePasswordAction.d.mts +21 -0
  86. package/dist/client/user/actions/updatePasswordAction.mjs +37 -0
  87. package/dist/client/user/actions/updatePasswordAction.mjs.map +1 -0
  88. package/dist/client/user/api/userRoute.d.mts +9 -0
  89. package/dist/client/user/api/userRoute.mjs +65 -0
  90. package/dist/client/user/api/userRoute.mjs.map +1 -0
  91. package/dist/client/user/clients/enad.d.mts +6 -0
  92. package/dist/client/user/clients/enad.mjs +19 -0
  93. package/dist/client/user/clients/enad.mjs.map +1 -0
  94. package/dist/client/user/components/login-form.d.mts +20 -0
  95. package/dist/client/user/components/login-form.mjs +113 -0
  96. package/dist/client/user/components/login-form.mjs.map +1 -0
  97. package/dist/client/user/components/reset-password-form.d.mts +15 -0
  98. package/dist/client/user/components/reset-password-form.mjs +86 -0
  99. package/dist/client/user/components/reset-password-form.mjs.map +1 -0
  100. package/dist/client/user/components/sign-out.d.mts +5 -0
  101. package/dist/client/user/components/sign-out.mjs +23 -0
  102. package/dist/client/user/components/sign-out.mjs.map +1 -0
  103. package/dist/client/user/components/signup-form.d.mts +15 -0
  104. package/dist/client/user/components/signup-form.mjs +155 -0
  105. package/dist/client/user/components/signup-form.mjs.map +1 -0
  106. package/dist/client/user/components/signup-organisation-form.d.mts +20 -0
  107. package/dist/client/user/components/signup-organisation-form.mjs +813 -0
  108. package/dist/client/user/components/signup-organisation-form.mjs.map +1 -0
  109. package/dist/client/user/components/update-password-form.d.mts +11 -0
  110. package/dist/client/user/components/update-password-form.mjs +69 -0
  111. package/dist/client/user/components/update-password-form.mjs.map +1 -0
  112. package/dist/client/user/hooks/index.d.mts +3 -0
  113. package/dist/client/user/hooks/index.mjs +2 -0
  114. package/dist/client/user/hooks/index.mjs.map +1 -0
  115. package/dist/client/user/hooks/useUser.d.mts +16 -0
  116. package/dist/client/user/hooks/useUser.mjs +32 -0
  117. package/dist/client/user/hooks/useUser.mjs.map +1 -0
  118. package/dist/client/user/types/user.d.mts +202 -0
  119. package/dist/client/user/types/user.mjs +1 -0
  120. package/dist/client/user/types/user.mjs.map +1 -0
  121. package/dist/client/user/utils/userCookieService.d.mts +20 -0
  122. package/dist/client/user/utils/userCookieService.mjs +51 -0
  123. package/dist/client/user/utils/userCookieService.mjs.map +1 -0
  124. package/dist/client/wishlist/actions/addItemsToWishlistAction.d.mts +7 -0
  125. package/dist/client/wishlist/actions/addItemsToWishlistAction.mjs +20 -0
  126. package/dist/client/wishlist/actions/addItemsToWishlistAction.mjs.map +1 -0
  127. package/dist/client/wishlist/actions/createOrGetShareTokenAction.d.mts +6 -0
  128. package/dist/client/wishlist/actions/createOrGetShareTokenAction.mjs +20 -0
  129. package/dist/client/wishlist/actions/createOrGetShareTokenAction.mjs.map +1 -0
  130. package/dist/client/wishlist/actions/createWishlistAction.d.mts +6 -0
  131. package/dist/client/wishlist/actions/createWishlistAction.mjs +16 -0
  132. package/dist/client/wishlist/actions/createWishlistAction.mjs.map +1 -0
  133. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.d.mts +7 -0
  134. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.mjs +20 -0
  135. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.mjs.map +1 -0
  136. package/dist/client/wishlist/actions/deleteWishlistAction.d.mts +5 -0
  137. package/dist/client/wishlist/actions/deleteWishlistAction.mjs +16 -0
  138. package/dist/client/wishlist/actions/deleteWishlistAction.mjs.map +1 -0
  139. package/dist/client/wishlist/actions/getSharedWishlistAction.d.mts +6 -0
  140. package/dist/client/wishlist/actions/getSharedWishlistAction.mjs +20 -0
  141. package/dist/client/wishlist/actions/getSharedWishlistAction.mjs.map +1 -0
  142. package/dist/client/wishlist/actions/getSpecificWishlistAction.d.mts +6 -0
  143. package/dist/client/wishlist/actions/getSpecificWishlistAction.mjs +20 -0
  144. package/dist/client/wishlist/actions/getSpecificWishlistAction.mjs.map +1 -0
  145. package/dist/client/wishlist/actions/getUserWishlists.d.mts +7 -0
  146. package/dist/client/wishlist/actions/getUserWishlists.mjs +25 -0
  147. package/dist/client/wishlist/actions/getUserWishlists.mjs.map +1 -0
  148. package/dist/client/wishlist/actions/revokeShareTokenAction.d.mts +5 -0
  149. package/dist/client/wishlist/actions/revokeShareTokenAction.mjs +20 -0
  150. package/dist/client/wishlist/actions/revokeShareTokenAction.mjs.map +1 -0
  151. package/dist/client/wishlist/actions/updateWishlistAction.d.mts +6 -0
  152. package/dist/client/wishlist/actions/updateWishlistAction.mjs +20 -0
  153. package/dist/client/wishlist/actions/updateWishlistAction.mjs.map +1 -0
  154. package/dist/client/wishlist/hooks/index.d.mts +3 -0
  155. package/dist/client/wishlist/hooks/index.mjs +2 -0
  156. package/dist/client/wishlist/hooks/index.mjs.map +1 -0
  157. package/dist/client/wishlist/hooks/useWishlist.d.mts +98 -0
  158. package/dist/client/wishlist/hooks/useWishlist.mjs +66 -0
  159. package/dist/client/wishlist/hooks/useWishlist.mjs.map +1 -0
  160. package/dist/client/wishlist/hooks/useWishlistActions.d.mts +48 -0
  161. package/dist/client/wishlist/hooks/useWishlistActions.mjs +101 -0
  162. package/dist/client/wishlist/hooks/useWishlistActions.mjs.map +1 -0
  163. package/dist/client/wishlist/wishlist-drawer.d.mts +19 -0
  164. package/dist/client/wishlist/wishlist-drawer.mjs +180 -0
  165. package/dist/client/wishlist/wishlist-drawer.mjs.map +1 -0
  166. package/dist/styles.css +959 -0
  167. package/package.json +64 -0
@@ -0,0 +1,813 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { zodResolver } from "@hookform/resolvers/zod";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { useForm } from "react-hook-form";
6
+ import * as z from "zod";
7
+ import { registerOrganisationAction } from "../actions/registerOrganisationAction";
8
+ import { registerUserWithoutRedirectAction } from "../actions/registerUserWithoutRedirectAction";
9
+ const addressSchema = z.object({
10
+ street_address: z.string().min(1, "Street address is required"),
11
+ house_number: z.string().optional(),
12
+ city: z.string().min(1, "City is required"),
13
+ postal_code: z.string().min(1, "Postal code is required"),
14
+ country: z.string().min(1, "Country is required"),
15
+ state_province: z.string().optional(),
16
+ phone: z.string().optional(),
17
+ co_address: z.string().optional(),
18
+ name: z.string().optional(),
19
+ is_default: z.boolean().default(true),
20
+ shipping_type: z.string().default("standard")
21
+ });
22
+ const userSchema = z.object({
23
+ first_name: z.string().trim().min(1, "First name is required"),
24
+ last_name: z.string().trim().min(1, "Last name is required"),
25
+ email: z.string().email("Invalid email address").min(1, "Email is required"),
26
+ password: z.string().min(10, "Password must be at least 10 characters").regex(/\d/, "Password must contain a number"),
27
+ confirmPassword: z.string(),
28
+ phone_number: z.string().optional(),
29
+ language: z.string().default("SV"),
30
+ country_code: z.string().default("SE"),
31
+ market: z.string().default("SE"),
32
+ store_group: z.string().default("default"),
33
+ allow_email_notifications: z.boolean().default(false),
34
+ allow_phone_notifications: z.boolean().default(false),
35
+ allow_postal_notifications: z.boolean().default(false)
36
+ }).refine((data) => data.password === data.confirmPassword, {
37
+ message: "Passwords do not match",
38
+ path: ["confirmPassword"]
39
+ });
40
+ const organizationSchema = z.object({
41
+ name: z.string().min(1, "Organization name is required"),
42
+ organisation_number: z.string().min(1, "Organization number is required"),
43
+ tax_id_vat_number: z.string().min(1, "Tax ID/VAT number is required"),
44
+ contact_name: z.string().optional(),
45
+ email: z.string().email("Invalid email address").min(1, "Email is required"),
46
+ invoice_email: z.string().email("Invalid email address").optional(),
47
+ phone: z.string().optional(),
48
+ external_ref: z.string().optional(),
49
+ attribute: z.string().optional(),
50
+ credit_check: z.boolean().default(false),
51
+ custom_fields: z.record(z.string(), z.any()).optional(),
52
+ billing_address: z.array(addressSchema).min(1)
53
+ });
54
+ const formSchema = z.object({
55
+ user: userSchema,
56
+ organization: organizationSchema,
57
+ shipping_address: z.array(addressSchema).min(1),
58
+ use_billing_as_shipping: z.boolean().default(false),
59
+ terms_accepted: z.boolean().refine((val) => val === true, {
60
+ message: "You must accept the terms and conditions"
61
+ })
62
+ });
63
+ const SignupOrganisationForm = ({
64
+ title = "Create your organisation account",
65
+ subtitle = "Sign up to get started",
66
+ submitText = "Sign Up",
67
+ extraLink = { href: "/login", text: "Already have an account? Sign in" },
68
+ organisationStatus = "active",
69
+ defaultMarket = "SE",
70
+ defaultLanguage = "SV",
71
+ defaultCountry = "SE",
72
+ defaultStoreGroup = "default"
73
+ }) => {
74
+ const [errors, setErrors] = useState({});
75
+ const [isPending, setIsPending] = useState(false);
76
+ const [showPassword, setShowPassword] = useState(false);
77
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
78
+ const [confirmMode, setConfirmMode] = useState(false);
79
+ const form = useForm({
80
+ resolver: zodResolver(formSchema),
81
+ defaultValues: {
82
+ user: {
83
+ first_name: "",
84
+ last_name: "",
85
+ email: "",
86
+ password: "",
87
+ confirmPassword: "",
88
+ phone_number: "",
89
+ language: defaultLanguage,
90
+ market: defaultMarket,
91
+ country_code: defaultCountry,
92
+ store_group: defaultStoreGroup,
93
+ allow_email_notifications: false,
94
+ allow_phone_notifications: false,
95
+ allow_postal_notifications: false
96
+ },
97
+ organization: {
98
+ name: "",
99
+ organisation_number: "",
100
+ tax_id_vat_number: "",
101
+ contact_name: "",
102
+ email: "",
103
+ invoice_email: "",
104
+ phone: "",
105
+ external_ref: "",
106
+ attribute: "",
107
+ credit_check: false,
108
+ custom_fields: {},
109
+ billing_address: [
110
+ {
111
+ street_address: "",
112
+ house_number: "",
113
+ city: "",
114
+ postal_code: "",
115
+ country: defaultCountry,
116
+ state_province: "",
117
+ phone: "",
118
+ co_address: "",
119
+ name: "",
120
+ is_default: true,
121
+ shipping_type: "standard"
122
+ }
123
+ ]
124
+ },
125
+ shipping_address: [
126
+ {
127
+ street_address: "",
128
+ house_number: "",
129
+ city: "",
130
+ postal_code: "",
131
+ country: defaultCountry,
132
+ state_province: "",
133
+ phone: "",
134
+ co_address: "",
135
+ name: "",
136
+ is_default: true,
137
+ shipping_type: "standard"
138
+ }
139
+ ],
140
+ use_billing_as_shipping: false,
141
+ terms_accepted: false
142
+ }
143
+ });
144
+ const { watch, setValue } = form;
145
+ const useBillingAsShipping = watch("use_billing_as_shipping");
146
+ const billingAddress = watch("organization.billing_address.0");
147
+ const contactEmail = watch("user.email");
148
+ const contactPhone = watch("user.phone_number");
149
+ const orgNumber = watch("organization.organisation_number");
150
+ const invoiceCountry = watch("organization.billing_address.0.country");
151
+ const lastAutoOrgEmail = useRef(null);
152
+ const lastAutoInvoiceEmail = useRef(null);
153
+ const lastAutoOrgPhone = useRef(null);
154
+ const lastAutoVat = useRef(null);
155
+ useEffect(() => {
156
+ if (useBillingAsShipping && billingAddress) {
157
+ setValue("shipping_address.0", billingAddress);
158
+ }
159
+ }, [useBillingAsShipping, billingAddress, setValue]);
160
+ useEffect(() => {
161
+ if (!contactEmail) return;
162
+ const currentOrgEmail = form.getValues("organization.email");
163
+ if (!currentOrgEmail || currentOrgEmail === lastAutoOrgEmail.current) {
164
+ setValue("organization.email", contactEmail);
165
+ lastAutoOrgEmail.current = contactEmail;
166
+ }
167
+ const currentInvoiceEmail = form.getValues("organization.invoice_email");
168
+ if (!currentInvoiceEmail || currentInvoiceEmail === lastAutoInvoiceEmail.current) {
169
+ setValue("organization.invoice_email", contactEmail);
170
+ lastAutoInvoiceEmail.current = contactEmail;
171
+ }
172
+ }, [contactEmail, setValue, form]);
173
+ useEffect(() => {
174
+ if (!contactPhone) return;
175
+ const currentOrgPhone = form.getValues("organization.phone");
176
+ if (!currentOrgPhone || currentOrgPhone === lastAutoOrgPhone.current) {
177
+ setValue("organization.phone", contactPhone);
178
+ lastAutoOrgPhone.current = contactPhone;
179
+ }
180
+ }, [contactPhone, setValue, form]);
181
+ useEffect(() => {
182
+ const currentOrgNumber = form.getValues("organization.organisation_number");
183
+ const currentCountry = (form.getValues("organization.billing_address.0.country") || "").toString().toUpperCase();
184
+ const currentVat = form.getValues("organization.tax_id_vat_number");
185
+ if (!currentOrgNumber) {
186
+ if (!currentVat || currentVat === lastAutoVat.current) {
187
+ setValue("organization.tax_id_vat_number", "");
188
+ lastAutoVat.current = "";
189
+ }
190
+ return;
191
+ }
192
+ const computedVat = currentCountry === "SE" ? `SE${currentOrgNumber}01` : currentOrgNumber;
193
+ if (!currentVat || currentVat === lastAutoVat.current) {
194
+ setValue("organization.tax_id_vat_number", computedVat);
195
+ lastAutoVat.current = computedVat;
196
+ }
197
+ }, [orgNumber, invoiceCountry, setValue, form]);
198
+ const onSubmit = async (values) => {
199
+ setIsPending(true);
200
+ setErrors({});
201
+ try {
202
+ const userResult = await registerUserWithoutRedirectAction({
203
+ firstName: values.user.first_name,
204
+ lastName: values.user.last_name,
205
+ email: values.user.email,
206
+ password: values.user.password,
207
+ phone_number: values.user.phone_number,
208
+ language: values.user.language,
209
+ country_code: values.user.country_code,
210
+ market: values.user.market,
211
+ store_group: values.user.store_group,
212
+ allow_email_notifications: values.user.allow_email_notifications,
213
+ allow_phone_notifications: values.user.allow_phone_notifications,
214
+ allow_postal_notifications: values.user.allow_postal_notifications,
215
+ status: organisationStatus
216
+ });
217
+ if (userResult?.errors) {
218
+ setErrors(userResult.errors);
219
+ setIsPending(false);
220
+ return;
221
+ }
222
+ const userId = userResult?.data.id;
223
+ if (!userId) {
224
+ setErrors({ general: ["User registration failed. Please try again."] });
225
+ setIsPending(false);
226
+ return;
227
+ }
228
+ const organisationData = {
229
+ billing_address: values.organization.billing_address,
230
+ shipping_address: values.shipping_address,
231
+ contact_name: values.organization.contact_name,
232
+ credit_check: values.organization.credit_check,
233
+ custom_fields: values.organization.custom_fields,
234
+ email: values.organization.email.toLowerCase(),
235
+ external_ref: values.organization.external_ref,
236
+ invoice_email: values.organization.invoice_email?.toLowerCase(),
237
+ name: values.organization.name,
238
+ organisation_number: values.organization.organisation_number,
239
+ phone: values.organization.phone,
240
+ tax_id_vat_number: values.organization.tax_id_vat_number,
241
+ user_id: userId,
242
+ attribute_ids: values.organization.attribute ? [values.organization.attribute] : [],
243
+ status: organisationStatus
244
+ };
245
+ const orgResult = await registerOrganisationAction(organisationData);
246
+ if (orgResult?.error) {
247
+ setErrors({ general: [orgResult.error] });
248
+ setIsPending(false);
249
+ return;
250
+ }
251
+ setConfirmMode(true);
252
+ } catch (error) {
253
+ console.error("Registration error:", error);
254
+ setErrors({ general: ["Failed to register. Please try again."] });
255
+ } finally {
256
+ setIsPending(false);
257
+ }
258
+ };
259
+ const inputBaseClasses = `
260
+ w-full px-4 py-2.5
261
+ border border-(--enad-border-color)
262
+ rounded-(--enad-border-radius)
263
+ focus:ring-2 focus:ring-(--enad-button-bg)
264
+ focus:border-(--enad-button-bg)
265
+ outline-none transition
266
+ bg-(--enad-background)
267
+ text-(--enad-text-primary-color)
268
+ `;
269
+ const buttonBaseClasses = `
270
+ w-full py-2.5
271
+ bg-(--enad-button-bg)
272
+ hover:bg-(--enad-button-hover-bg)
273
+ text-(--enad-button-color)
274
+ font-medium rounded-(--enad-border-radius)
275
+ transition shadow-sm hover:shadow
276
+ disabled:opacity-50 disabled:cursor-not-allowed
277
+ `;
278
+ const labelClasses = `block text-sm font-medium text-(--enad-text-primary-color) mb-1`;
279
+ const errorClasses = `text-(--enad-error-color) text-sm mt-1`;
280
+ const sectionTitleClasses = `text-xl font-semibold mb-4 pb-2 border-b border-(--enad-border-color)`;
281
+ if (confirmMode) {
282
+ return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-border-radius)", children: [
283
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: "Verify your email" }),
284
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-center text-(--enad-text-muted-color)", children: "Please check your email to verify your account." })
285
+ ] }) });
286
+ }
287
+ return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-4xl bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-border-radius)", children: [
288
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: title }),
289
+ /* @__PURE__ */ jsx("p", { className: "text-sm mb-8 text-center text-(--enad-text-muted-color)", children: subtitle }),
290
+ /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-8", children: [
291
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
292
+ /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Contact Person" }),
293
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
294
+ /* @__PURE__ */ jsxs("div", { children: [
295
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
296
+ "First Name ",
297
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
298
+ ] }),
299
+ /* @__PURE__ */ jsx(
300
+ "input",
301
+ {
302
+ ...form.register("user.first_name"),
303
+ className: inputBaseClasses,
304
+ placeholder: "John"
305
+ }
306
+ ),
307
+ form.formState.errors.user?.first_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.first_name.message })
308
+ ] }),
309
+ /* @__PURE__ */ jsxs("div", { children: [
310
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
311
+ "Last Name ",
312
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
313
+ ] }),
314
+ /* @__PURE__ */ jsx(
315
+ "input",
316
+ {
317
+ ...form.register("user.last_name"),
318
+ className: inputBaseClasses,
319
+ placeholder: "Doe"
320
+ }
321
+ ),
322
+ form.formState.errors.user?.last_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.last_name.message })
323
+ ] })
324
+ ] }),
325
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
326
+ /* @__PURE__ */ jsxs("div", { children: [
327
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
328
+ "Email ",
329
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
330
+ ] }),
331
+ /* @__PURE__ */ jsx(
332
+ "input",
333
+ {
334
+ type: "email",
335
+ ...form.register("user.email"),
336
+ className: inputBaseClasses,
337
+ placeholder: "you@example.com"
338
+ }
339
+ ),
340
+ form.formState.errors.user?.email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.email.message })
341
+ ] }),
342
+ /* @__PURE__ */ jsxs("div", { children: [
343
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Phone Number" }),
344
+ /* @__PURE__ */ jsx(
345
+ "input",
346
+ {
347
+ type: "tel",
348
+ ...form.register("user.phone_number"),
349
+ className: inputBaseClasses,
350
+ placeholder: "+46 123 456 789"
351
+ }
352
+ ),
353
+ form.formState.errors.user?.phone_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.phone_number.message })
354
+ ] })
355
+ ] }),
356
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
357
+ /* @__PURE__ */ jsxs("div", { children: [
358
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
359
+ "Password ",
360
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
361
+ ] }),
362
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
363
+ /* @__PURE__ */ jsx(
364
+ "input",
365
+ {
366
+ type: showPassword ? "text" : "password",
367
+ ...form.register("user.password"),
368
+ className: inputBaseClasses + " pr-10",
369
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
370
+ }
371
+ ),
372
+ /* @__PURE__ */ jsx(
373
+ "button",
374
+ {
375
+ type: "button",
376
+ onClick: () => setShowPassword(!showPassword),
377
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
378
+ children: showPassword ? "Hide" : "Show"
379
+ }
380
+ )
381
+ ] }),
382
+ form.formState.errors.user?.password && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.password.message })
383
+ ] }),
384
+ /* @__PURE__ */ jsxs("div", { children: [
385
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
386
+ "Confirm Password ",
387
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
388
+ ] }),
389
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
390
+ /* @__PURE__ */ jsx(
391
+ "input",
392
+ {
393
+ type: showConfirmPassword ? "text" : "password",
394
+ ...form.register("user.confirmPassword"),
395
+ className: inputBaseClasses + " pr-10",
396
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
397
+ }
398
+ ),
399
+ /* @__PURE__ */ jsx(
400
+ "button",
401
+ {
402
+ type: "button",
403
+ onClick: () => setShowConfirmPassword(!showConfirmPassword),
404
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
405
+ children: showConfirmPassword ? "Hide" : "Show"
406
+ }
407
+ )
408
+ ] }),
409
+ form.formState.errors.user?.confirmPassword && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.confirmPassword.message })
410
+ ] })
411
+ ] }),
412
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
413
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: "Communication Preferences" }),
414
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
415
+ /* @__PURE__ */ jsx(
416
+ "input",
417
+ {
418
+ type: "checkbox",
419
+ ...form.register("user.allow_email_notifications"),
420
+ className: "h-4 w-4"
421
+ }
422
+ ),
423
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept email notifications" })
424
+ ] }),
425
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
426
+ /* @__PURE__ */ jsx(
427
+ "input",
428
+ {
429
+ type: "checkbox",
430
+ ...form.register("user.allow_phone_notifications"),
431
+ className: "h-4 w-4"
432
+ }
433
+ ),
434
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept SMS notifications" })
435
+ ] }),
436
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
437
+ /* @__PURE__ */ jsx(
438
+ "input",
439
+ {
440
+ type: "checkbox",
441
+ ...form.register("user.allow_postal_notifications"),
442
+ className: "h-4 w-4"
443
+ }
444
+ ),
445
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept postal notifications" })
446
+ ] })
447
+ ] })
448
+ ] }),
449
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
450
+ /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Company Information" }),
451
+ /* @__PURE__ */ jsxs("div", { children: [
452
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
453
+ "Company Name ",
454
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
455
+ ] }),
456
+ /* @__PURE__ */ jsx(
457
+ "input",
458
+ {
459
+ ...form.register("organization.name"),
460
+ className: inputBaseClasses,
461
+ placeholder: "Company Name"
462
+ }
463
+ ),
464
+ form.formState.errors.organization?.name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.name.message })
465
+ ] }),
466
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
467
+ /* @__PURE__ */ jsxs("div", { children: [
468
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
469
+ "Organisation Number ",
470
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
471
+ ] }),
472
+ /* @__PURE__ */ jsx(
473
+ "input",
474
+ {
475
+ ...form.register("organization.organisation_number"),
476
+ className: inputBaseClasses,
477
+ placeholder: "1234567890",
478
+ onChange: (e) => {
479
+ form.setValue(
480
+ "organization.organisation_number",
481
+ e.target.value.replace(/\D/g, "")
482
+ );
483
+ }
484
+ }
485
+ ),
486
+ form.formState.errors.organization?.organisation_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.organisation_number.message })
487
+ ] }),
488
+ /* @__PURE__ */ jsxs("div", { children: [
489
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
490
+ "Tax ID/VAT Number ",
491
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
492
+ ] }),
493
+ /* @__PURE__ */ jsx(
494
+ "input",
495
+ {
496
+ ...form.register("organization.tax_id_vat_number"),
497
+ className: inputBaseClasses,
498
+ placeholder: "SE123456789001"
499
+ }
500
+ ),
501
+ form.formState.errors.organization?.tax_id_vat_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.tax_id_vat_number.message })
502
+ ] })
503
+ ] }),
504
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
505
+ /* @__PURE__ */ jsxs("div", { children: [
506
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
507
+ "Company Email ",
508
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
509
+ ] }),
510
+ /* @__PURE__ */ jsx(
511
+ "input",
512
+ {
513
+ type: "email",
514
+ ...form.register("organization.email"),
515
+ className: inputBaseClasses,
516
+ placeholder: "company@example.com"
517
+ }
518
+ ),
519
+ form.formState.errors.organization?.email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.email.message })
520
+ ] }),
521
+ /* @__PURE__ */ jsxs("div", { children: [
522
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Company Phone" }),
523
+ /* @__PURE__ */ jsx(
524
+ "input",
525
+ {
526
+ type: "tel",
527
+ ...form.register("organization.phone"),
528
+ className: inputBaseClasses,
529
+ placeholder: "+46 123 456 789"
530
+ }
531
+ ),
532
+ form.formState.errors.organization?.phone && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.phone.message })
533
+ ] })
534
+ ] }),
535
+ /* @__PURE__ */ jsxs("div", { children: [
536
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Invoice Email" }),
537
+ /* @__PURE__ */ jsx(
538
+ "input",
539
+ {
540
+ type: "email",
541
+ ...form.register("organization.invoice_email"),
542
+ className: inputBaseClasses,
543
+ placeholder: "invoices@example.com"
544
+ }
545
+ ),
546
+ form.formState.errors.organization?.invoice_email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.invoice_email.message })
547
+ ] }),
548
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
549
+ /* @__PURE__ */ jsxs("div", { children: [
550
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Contact Name" }),
551
+ /* @__PURE__ */ jsx(
552
+ "input",
553
+ {
554
+ ...form.register("organization.contact_name"),
555
+ className: inputBaseClasses,
556
+ placeholder: "Contact Person"
557
+ }
558
+ ),
559
+ form.formState.errors.organization?.contact_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.contact_name.message })
560
+ ] }),
561
+ /* @__PURE__ */ jsxs("div", { children: [
562
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "External Reference" }),
563
+ /* @__PURE__ */ jsx(
564
+ "input",
565
+ {
566
+ ...form.register("organization.external_ref"),
567
+ className: inputBaseClasses,
568
+ placeholder: "External Ref"
569
+ }
570
+ ),
571
+ form.formState.errors.organization?.external_ref && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.external_ref.message })
572
+ ] })
573
+ ] })
574
+ ] }),
575
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
576
+ /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Billing Address" }),
577
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
578
+ /* @__PURE__ */ jsxs("div", { children: [
579
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
580
+ "Street Address ",
581
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
582
+ ] }),
583
+ /* @__PURE__ */ jsx(
584
+ "input",
585
+ {
586
+ ...form.register("organization.billing_address.0.street_address"),
587
+ className: inputBaseClasses,
588
+ placeholder: "Street Address"
589
+ }
590
+ ),
591
+ form.formState.errors.organization?.billing_address?.[0]?.street_address && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.street_address?.message })
592
+ ] }),
593
+ /* @__PURE__ */ jsxs("div", { children: [
594
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "House Number" }),
595
+ /* @__PURE__ */ jsx(
596
+ "input",
597
+ {
598
+ ...form.register("organization.billing_address.0.house_number"),
599
+ className: inputBaseClasses,
600
+ placeholder: "123"
601
+ }
602
+ )
603
+ ] })
604
+ ] }),
605
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
606
+ /* @__PURE__ */ jsxs("div", { children: [
607
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Co Address" }),
608
+ /* @__PURE__ */ jsx(
609
+ "input",
610
+ {
611
+ ...form.register("organization.billing_address.0.co_address"),
612
+ className: inputBaseClasses,
613
+ placeholder: "Co Address"
614
+ }
615
+ )
616
+ ] }),
617
+ /* @__PURE__ */ jsxs("div", { children: [
618
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
619
+ "Postal Code ",
620
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
621
+ ] }),
622
+ /* @__PURE__ */ jsx(
623
+ "input",
624
+ {
625
+ ...form.register("organization.billing_address.0.postal_code"),
626
+ className: inputBaseClasses,
627
+ placeholder: "12345"
628
+ }
629
+ ),
630
+ form.formState.errors.organization?.billing_address?.[0]?.postal_code && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.postal_code?.message })
631
+ ] })
632
+ ] }),
633
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
634
+ /* @__PURE__ */ jsxs("div", { children: [
635
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
636
+ "City ",
637
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
638
+ ] }),
639
+ /* @__PURE__ */ jsx(
640
+ "input",
641
+ {
642
+ ...form.register("organization.billing_address.0.city"),
643
+ className: inputBaseClasses,
644
+ placeholder: "City"
645
+ }
646
+ ),
647
+ form.formState.errors.organization?.billing_address?.[0]?.city && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.city?.message })
648
+ ] }),
649
+ /* @__PURE__ */ jsxs("div", { children: [
650
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
651
+ "Country ",
652
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
653
+ ] }),
654
+ /* @__PURE__ */ jsxs(
655
+ "select",
656
+ {
657
+ ...form.register("organization.billing_address.0.country"),
658
+ className: inputBaseClasses,
659
+ children: [
660
+ /* @__PURE__ */ jsx("option", { value: "SE", children: "Sweden" }),
661
+ /* @__PURE__ */ jsx("option", { value: "NO", children: "Norway" }),
662
+ /* @__PURE__ */ jsx("option", { value: "DK", children: "Denmark" }),
663
+ /* @__PURE__ */ jsx("option", { value: "FI", children: "Finland" })
664
+ ]
665
+ }
666
+ ),
667
+ form.formState.errors.organization?.billing_address?.[0]?.country && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.country?.message })
668
+ ] })
669
+ ] })
670
+ ] }),
671
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
672
+ /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Shipping Address" }),
673
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
674
+ /* @__PURE__ */ jsx(
675
+ "input",
676
+ {
677
+ type: "checkbox",
678
+ ...form.register("use_billing_as_shipping"),
679
+ className: "h-4 w-4"
680
+ }
681
+ ),
682
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: "Same address as billing address" })
683
+ ] }),
684
+ !useBillingAsShipping && /* @__PURE__ */ jsxs(Fragment, { children: [
685
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
686
+ /* @__PURE__ */ jsxs("div", { children: [
687
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
688
+ "Street Address ",
689
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
690
+ ] }),
691
+ /* @__PURE__ */ jsx(
692
+ "input",
693
+ {
694
+ ...form.register("shipping_address.0.street_address"),
695
+ className: inputBaseClasses,
696
+ placeholder: "Street Address"
697
+ }
698
+ ),
699
+ form.formState.errors.shipping_address?.[0]?.street_address && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.street_address?.message })
700
+ ] }),
701
+ /* @__PURE__ */ jsxs("div", { children: [
702
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "House Number" }),
703
+ /* @__PURE__ */ jsx(
704
+ "input",
705
+ {
706
+ ...form.register("shipping_address.0.house_number"),
707
+ className: inputBaseClasses,
708
+ placeholder: "123"
709
+ }
710
+ )
711
+ ] })
712
+ ] }),
713
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
714
+ /* @__PURE__ */ jsxs("div", { children: [
715
+ /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Co Address" }),
716
+ /* @__PURE__ */ jsx(
717
+ "input",
718
+ {
719
+ ...form.register("shipping_address.0.co_address"),
720
+ className: inputBaseClasses,
721
+ placeholder: "Co Address"
722
+ }
723
+ )
724
+ ] }),
725
+ /* @__PURE__ */ jsxs("div", { children: [
726
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
727
+ "Postal Code ",
728
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
729
+ ] }),
730
+ /* @__PURE__ */ jsx(
731
+ "input",
732
+ {
733
+ ...form.register("shipping_address.0.postal_code"),
734
+ className: inputBaseClasses,
735
+ placeholder: "12345"
736
+ }
737
+ ),
738
+ form.formState.errors.shipping_address?.[0]?.postal_code && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.postal_code?.message })
739
+ ] })
740
+ ] }),
741
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
742
+ /* @__PURE__ */ jsxs("div", { children: [
743
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
744
+ "City ",
745
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
746
+ ] }),
747
+ /* @__PURE__ */ jsx(
748
+ "input",
749
+ {
750
+ ...form.register("shipping_address.0.city"),
751
+ className: inputBaseClasses,
752
+ placeholder: "City"
753
+ }
754
+ ),
755
+ form.formState.errors.shipping_address?.[0]?.city && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.city?.message })
756
+ ] }),
757
+ /* @__PURE__ */ jsxs("div", { children: [
758
+ /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
759
+ "Country ",
760
+ /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
761
+ ] }),
762
+ /* @__PURE__ */ jsxs(
763
+ "select",
764
+ {
765
+ ...form.register("shipping_address.0.country"),
766
+ className: inputBaseClasses,
767
+ children: [
768
+ /* @__PURE__ */ jsx("option", { value: "SE", children: "Sweden" }),
769
+ /* @__PURE__ */ jsx("option", { value: "NO", children: "Norway" }),
770
+ /* @__PURE__ */ jsx("option", { value: "DK", children: "Denmark" }),
771
+ /* @__PURE__ */ jsx("option", { value: "FI", children: "Finland" })
772
+ ]
773
+ }
774
+ ),
775
+ form.formState.errors.shipping_address?.[0]?.country && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.country?.message })
776
+ ] })
777
+ ] })
778
+ ] })
779
+ ] }),
780
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
781
+ /* @__PURE__ */ jsx("input", { type: "checkbox", ...form.register("terms_accepted"), className: "h-4 w-4" }),
782
+ /* @__PURE__ */ jsxs("label", { className: "text-sm text-(--enad-text-primary-color)", children: [
783
+ "I accept the",
784
+ " ",
785
+ /* @__PURE__ */ jsx(
786
+ "a",
787
+ {
788
+ href: "/terms",
789
+ target: "_blank",
790
+ className: "text-(--enad-link-color) hover:text-(--enad-link-hover-color) hover:underline",
791
+ children: "terms and conditions"
792
+ }
793
+ )
794
+ ] })
795
+ ] }),
796
+ form.formState.errors.terms_accepted && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.terms_accepted.message }),
797
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: isPending, className: buttonBaseClasses, children: isPending ? "Signing up..." : submitText }),
798
+ errors.general && /* @__PURE__ */ jsx("p", { className: errorClasses + " mt-2 text-center", children: errors.general.join(", ") })
799
+ ] }),
800
+ extraLink && /* @__PURE__ */ jsx("p", { className: "text-sm text-(--enad-text-muted-color) text-center mt-6", children: /* @__PURE__ */ jsx(
801
+ "a",
802
+ {
803
+ href: extraLink.href,
804
+ className: "text-(--enad-link-color) hover:text-(--enad-link-hover-color) font-medium",
805
+ children: extraLink.text
806
+ }
807
+ ) })
808
+ ] }) });
809
+ };
810
+ export {
811
+ SignupOrganisationForm
812
+ };
813
+ //# sourceMappingURL=signup-organisation-form.mjs.map