@ecomiq/storefront 2.1.3 → 3.0.0

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 (317) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -123
  3. package/dist/account-Dx4e3syi.js +258 -0
  4. package/dist/account-forms-AVk71ko7.js +39 -0
  5. package/dist/account-forms.d.ts +13 -0
  6. package/dist/account.d.ts +240 -0
  7. package/dist/address-defaults-BqjRhS82.js +14 -0
  8. package/dist/address-defaults.d.ts +11 -0
  9. package/dist/analytics/analytics-CG1Qagwl.js +148 -0
  10. package/dist/analytics/analytics.d.ts +1 -0
  11. package/dist/analytics/config-DJr-GRhs.js +62 -0
  12. package/dist/analytics/config.d.ts +22 -0
  13. package/dist/analytics/consent-B13rBpBs.js +57 -0
  14. package/dist/analytics/consent-banner-9QvRRy8v.js +239 -0
  15. package/dist/analytics/consent-banner.d.ts +20 -0
  16. package/dist/analytics/cookies-pLozllyB.js +100 -0
  17. package/dist/analytics/cookies.d.ts +6 -0
  18. package/dist/analytics/destinations-iECrlLIr.js +144 -0
  19. package/dist/analytics/events-Dt81tIp1.js +102 -0
  20. package/dist/analytics/events.d.ts +51 -0
  21. package/dist/analytics/tracker-p4yaoOyk.js +51 -0
  22. package/dist/api-cache-DsuIn5hX.js +159 -0
  23. package/dist/bank-accounts-DlEczQQ5.js +81 -0
  24. package/dist/bank-accounts.d.ts +4 -0
  25. package/dist/captcha-DAqaIx8m.js +117 -0
  26. package/dist/captcha.d.ts +34 -0
  27. package/dist/cart-D7DxZ2lD.js +30 -0
  28. package/dist/cart-actions-Bsub_FFG.js +116 -0
  29. package/dist/cart-actions.d.ts +15 -0
  30. package/dist/cart-drawer-B7PPsR69.js +22 -0
  31. package/dist/cart-drawer.d.ts +9 -0
  32. package/dist/cart-form-y9P1r_EX.js +81 -0
  33. package/dist/cart-form.d.ts +24 -0
  34. package/dist/cart-summary-ur2VWKr-.js +89 -0
  35. package/dist/cart-summary.d.ts +31 -0
  36. package/dist/cart.d.ts +4 -0
  37. package/dist/catalog-7gJ-l5hW.js +67 -0
  38. package/dist/catalog-hooks-B7ZP4wYY.js +312 -0
  39. package/dist/catalog-hooks.d.ts +111 -0
  40. package/dist/catalog.d.ts +5 -0
  41. package/dist/checkout-DVWSXANi.js +474 -0
  42. package/dist/checkout-form-CbOIdENC.js +131 -0
  43. package/dist/checkout-form.d.ts +20 -0
  44. package/dist/checkout.d.ts +86 -0
  45. package/dist/complaint-book-BvwLvfx0.js +117 -0
  46. package/dist/complaint-book.d.ts +62 -0
  47. package/dist/culqi-authentication-BGr20vAJ.js +204 -0
  48. package/dist/culqi-authentication.d.ts +15 -0
  49. package/dist/culqi-checkout-CTXpKgp_.js +55 -0
  50. package/dist/culqi-three-ds-HP3mfrvV.js +33 -0
  51. package/dist/culqi-three-ds.d.ts +29 -0
  52. package/dist/customer-avatar-CJXSDroK.js +12 -0
  53. package/dist/customer-avatar.d.ts +5 -0
  54. package/dist/customer-cookies-DHOgFAMV.js +45 -0
  55. package/dist/customer-csrf-C1oDX-Py.js +17 -0
  56. package/dist/customer-csrf.d.ts +3 -0
  57. package/dist/customer-document-fields-C1K-_DAD.js +70 -0
  58. package/dist/customer-document-fields.d.ts +9 -0
  59. package/dist/customer-login-form-C7AC6vXd.js +144 -0
  60. package/dist/customer-login-form.d.ts +17 -0
  61. package/dist/customer-registration-form-BEm_NEfP.js +93 -0
  62. package/dist/customer-registration-form.d.ts +8 -0
  63. package/dist/document-url-CGsAl5Tf.js +9 -0
  64. package/dist/documents-T1mzc_j8.js +38 -0
  65. package/dist/documents.d.ts +16 -0
  66. package/dist/entries/account.d.ts +11 -0
  67. package/dist/entries/account.js +10 -0
  68. package/dist/entries/analytics.d.ts +6 -0
  69. package/dist/entries/analytics.js +5 -0
  70. package/dist/entries/cart.d.ts +8 -0
  71. package/dist/entries/cart.js +7 -0
  72. package/dist/entries/checkout.d.ts +12 -0
  73. package/dist/entries/checkout.js +11 -0
  74. package/dist/entries/order.d.ts +11 -0
  75. package/dist/entries/order.js +11 -0
  76. package/dist/favicon-YpyhVJ9H.js +28 -0
  77. package/dist/favicon.d.ts +4 -0
  78. package/dist/form-BtQcbXlJ.js +18 -0
  79. package/dist/form-contracts-BNpHaTGJ.js +166 -0
  80. package/dist/form-contracts.d.ts +42 -0
  81. package/dist/form.d.ts +3 -0
  82. package/dist/hidden-CCWtOWKR.js +3 -0
  83. package/dist/hidden.d.ts +4 -0
  84. package/dist/index.d.ts +50 -0
  85. package/dist/index.js +50 -0
  86. package/dist/invoice-fields-BG0HjL6T.js +103 -0
  87. package/dist/invoice-fields.d.ts +39 -0
  88. package/dist/links-kFxBZfdb.js +96 -0
  89. package/dist/links.d.ts +21 -0
  90. package/dist/mercadopago-checkout-DC7RXa8k.js +27 -0
  91. package/dist/mercadopago-dialog-UTQev0MG.js +180 -0
  92. package/dist/mercadopago-dialog.d.ts +21 -0
  93. package/dist/money-DtGOtDri.js +32 -0
  94. package/dist/money.d.ts +1 -0
  95. package/dist/optimistic-cart-BveVOHuh.js +53 -0
  96. package/dist/optimistic-cart.d.ts +16 -0
  97. package/dist/order-display-DTt5WBbc.js +112 -0
  98. package/dist/order-display.d.ts +20 -0
  99. package/dist/order-draft-DxV1Uhm3.js +38 -0
  100. package/dist/order-draft.d.ts +16 -0
  101. package/dist/order-pages-Dm6l5m0m.js +38 -0
  102. package/dist/order-pages.d.ts +12 -0
  103. package/dist/order-payment-continuation-D_d5PGA4.js +212 -0
  104. package/dist/order-payment-continuation.d.ts +10 -0
  105. package/dist/order-payment-in-review-x4gdLFHZ.js +65 -0
  106. package/dist/order-payment-in-review.d.ts +5 -0
  107. package/dist/order-status-BJXLJwxq.js +162 -0
  108. package/dist/order-status.d.ts +89 -0
  109. package/dist/order-view-9IlBg5AF.js +62 -0
  110. package/dist/order-view.d.ts +12 -0
  111. package/dist/page-action-Ctkf4xC6.js +7 -0
  112. package/dist/page-seo-a5FJl8x5.js +262 -0
  113. package/dist/page-seo.d.ts +34 -0
  114. package/dist/pages-Ca_Gt6mq.js +150 -0
  115. package/dist/pages.d.ts +45 -0
  116. package/dist/payment-dialog-frame-B-Q_xQ94.js +57 -0
  117. package/dist/payment-logo-BoPaGJc_.js +46 -0
  118. package/dist/payment-logo-svgs-By9lDTLK.js +20 -0
  119. package/dist/payment-logo.d.ts +11 -0
  120. package/dist/payment-logos-BYvdwYyJ.js +23 -0
  121. package/dist/payment-methods-B8ocTgFZ.js +73 -0
  122. package/dist/payment-methods.d.ts +58 -0
  123. package/dist/payment-return-5cjypwIw.js +7 -0
  124. package/dist/place-CmW4hBWY.js +13 -0
  125. package/dist/place.d.ts +4 -0
  126. package/dist/preview-BiIBif3C.js +427 -0
  127. package/dist/preview-address-Cf0sJ-9p.js +21 -0
  128. package/dist/preview-cart-Dg2CVktS.js +376 -0
  129. package/dist/product-preview-BspMAecJ.js +51 -0
  130. package/dist/product-preview.d.ts +5 -0
  131. package/dist/product-variants-BNDHvs1y.js +46 -0
  132. package/dist/product-variants.d.ts +12 -0
  133. package/dist/public-pages-XtwlaLwt.js +194 -0
  134. package/dist/public-pages.d.ts +67 -0
  135. package/dist/registration-CpDcv8ql.js +91 -0
  136. package/dist/registration.d.ts +12 -0
  137. package/dist/request-security-CRsRMgwj.js +76 -0
  138. package/dist/rich-text-M-Ju8RL4.js +9 -0
  139. package/dist/rich-text.d.ts +5 -0
  140. package/dist/route-text-DcJw2SsK.js +9 -0
  141. package/dist/route-text.d.ts +4 -0
  142. package/dist/section-preview-CmsMl3yu.js +83 -0
  143. package/dist/section-preview.d.ts +12 -0
  144. package/dist/sections/account-addresses.d.ts +18 -0
  145. package/dist/sections/account-addresses.js +375 -0
  146. package/dist/sections/account-order.d.ts +12 -0
  147. package/dist/sections/account-order.js +592 -0
  148. package/dist/sections/account-orders.d.ts +8 -0
  149. package/dist/sections/account-orders.js +359 -0
  150. package/dist/sections/account-profile.d.ts +16 -0
  151. package/dist/sections/account-profile.js +123 -0
  152. package/dist/sections/checkout.d.ts +24 -0
  153. package/dist/sections/checkout.js +963 -0
  154. package/dist/sections/complaint-book.d.ts +8 -0
  155. package/dist/sections/complaint-book.js +538 -0
  156. package/dist/sections/design-system.d.ts +1 -0
  157. package/dist/sections/design-system.js +310 -0
  158. package/dist/sections/draft-invoice.d.ts +20 -0
  159. package/dist/sections/draft-invoice.js +158 -0
  160. package/dist/sections/order-tracking.d.ts +19 -0
  161. package/dist/sections/order-tracking.js +141 -0
  162. package/dist/sections-CNUMWTF_.js +77 -0
  163. package/dist/sections.d.ts +19 -0
  164. package/dist/seo-GpDRhAAA.js +78 -0
  165. package/dist/session-CKvmFJyg.js +379 -0
  166. package/dist/session.d.ts +24 -0
  167. package/dist/settings-B0NO2A6Y.js +78 -0
  168. package/dist/settings.d.ts +51 -0
  169. package/dist/source-marker-DhqSkW7n.js +4 -0
  170. package/dist/sources-B-3JFJfb.js +46 -0
  171. package/dist/sources.d.ts +7 -0
  172. package/dist/store-8Q-_LFrQ.js +152 -0
  173. package/dist/store-contact--hY6CoFb.js +19 -0
  174. package/dist/store-contact.d.ts +6 -0
  175. package/dist/store.d.ts +17 -0
  176. package/dist/storefront-language-DrMjVbmk.js +29 -0
  177. package/dist/storefront-language.d.ts +14 -0
  178. package/dist/storefront-text-D25ae1qf.js +11 -0
  179. package/dist/storefront-text-en-ljjjSS4q.js +1030 -0
  180. package/dist/storefront-text-pt-BtHaJLcp.js +1030 -0
  181. package/dist/storefront-text.d.ts +4 -0
  182. package/dist/stripe-dialog-Ev9s3Z62.js +396 -0
  183. package/dist/stripe-dialog.d.ts +30 -0
  184. package/dist/telemetry-HuZXWBPi.js +114 -0
  185. package/dist/telemetry.d.ts +10 -0
  186. package/dist/templates-CAqoNyTW.js +40 -0
  187. package/dist/templates.d.ts +15 -0
  188. package/dist/urls-CpGQPxvf.js +71 -0
  189. package/dist/urls.d.ts +18 -0
  190. package/dist/use-checkout-CZcxXJXi.js +42 -0
  191. package/dist/use-checkout-payment-9R-zacrJ.js +80 -0
  192. package/dist/use-checkout-payment.d.ts +18 -0
  193. package/dist/use-checkout.d.ts +36 -0
  194. package/dist/use-culqi-checkout-CrjLAipU.js +109 -0
  195. package/dist/use-order-payment-BKIz_IO0.js +45 -0
  196. package/dist/use-order-payment.d.ts +18 -0
  197. package/dist/use-payment-token-CErx-tN-.js +105 -0
  198. package/dist/vite-payment-logos-kziu7wKb.js +27 -0
  199. package/dist/vite-payment-logos.d.ts +24 -0
  200. package/dist/vite-public-assets-DW2fgtVb.js +209 -0
  201. package/dist/vite-public-assets.d.ts +29 -0
  202. package/dist/vite-sections-DTBr0-Kg.js +464 -0
  203. package/dist/vite-sections.d.ts +21 -0
  204. package/dist/vite-theme-ui-BMO-CDi3.js +41 -0
  205. package/dist/vite-theme-ui.d.ts +10 -0
  206. package/dist/vite.d.ts +36 -0
  207. package/dist/vite.js +127 -0
  208. package/dist/voucher-payment-CVFDZ1L8.js +66 -0
  209. package/dist/worker-CNi-gzCu.js +86 -0
  210. package/dist/worker.d.ts +27 -0
  211. package/package.json +100 -81
  212. package/src/sections/account-addresses.tsx +215 -0
  213. package/src/sections/account-order.tsx +424 -0
  214. package/src/sections/account-orders.tsx +259 -0
  215. package/src/sections/account-profile.tsx +70 -0
  216. package/src/sections/checkout.tsx +586 -0
  217. package/src/sections/complaint-book.tsx +325 -0
  218. package/src/sections/design-system.tsx +146 -0
  219. package/src/sections/draft-invoice.tsx +105 -0
  220. package/src/sections/order-tracking.tsx +81 -0
  221. package/src/vite-client.d.ts +4 -0
  222. package/bin/ecomiq.mjs +0 -179
  223. package/public/design-bridge.js +0 -318
  224. package/src/api-proxy.ts +0 -194
  225. package/src/auth/create-storefront-auth.ts +0 -94
  226. package/src/auth/ecomiq-oauth-password-client.ts +0 -26
  227. package/src/auth/ecomiq-oauth-password-constants.ts +0 -24
  228. package/src/auth/ecomiq-oauth-password-plugin.ts +0 -294
  229. package/src/auth/ecomiq-oauth-password-types.ts +0 -24
  230. package/src/auth/ecomiq-storefront-sign-in.ts +0 -44
  231. package/src/auth/env.ts +0 -7
  232. package/src/auth/secure-cookies.ts +0 -23
  233. package/src/auth/storefront-auth-base-url.ts +0 -117
  234. package/src/auth/storefront-auth.ts +0 -7
  235. package/src/cart-session.ts +0 -239
  236. package/src/client.ts +0 -48
  237. package/src/cloud-runtime-client.ts +0 -378
  238. package/src/codegen.mjs +0 -789
  239. package/src/components/account/customer-addresses-panel.tsx +0 -678
  240. package/src/components/account/customer-order-detail-panel.tsx +0 -285
  241. package/src/components/account/customer-orders-panel.tsx +0 -192
  242. package/src/components/account/customer-profile-panel.tsx +0 -379
  243. package/src/components/checkout/cart-sync.ts +0 -143
  244. package/src/components/checkout/checkout-contact-section.tsx +0 -76
  245. package/src/components/checkout/checkout-external-update-banner.tsx +0 -15
  246. package/src/components/checkout/checkout-form-controls.tsx +0 -139
  247. package/src/components/checkout/checkout-line-items.tsx +0 -43
  248. package/src/components/checkout/checkout-order-summary.tsx +0 -165
  249. package/src/components/checkout/checkout-payment-section.tsx +0 -212
  250. package/src/components/checkout/checkout-session-view.tsx +0 -564
  251. package/src/components/checkout/checkout-shipping-address-section.tsx +0 -400
  252. package/src/components/checkout/checkout-shipping-section.tsx +0 -98
  253. package/src/components/checkout/checkout-states.tsx +0 -73
  254. package/src/components/checkout/checkout-step-card.tsx +0 -101
  255. package/src/components/checkout/checkout-steps.ts +0 -111
  256. package/src/components/checkout/form-schema.ts +0 -281
  257. package/src/components/checkout/format.ts +0 -15
  258. package/src/components/checkout/index.ts +0 -5
  259. package/src/components/checkout/map-customer-to-checkout.ts +0 -188
  260. package/src/components/checkout/types.ts +0 -41
  261. package/src/components/checkout/use-checkout-customer-prefill.ts +0 -409
  262. package/src/components/checkout/use-checkout-geo.ts +0 -50
  263. package/src/components/checkout/use-checkout-session.ts +0 -640
  264. package/src/components/hero.tsx +0 -291
  265. package/src/config.d.ts +0 -94
  266. package/src/config.mjs +0 -146
  267. package/src/format-money.ts +0 -31
  268. package/src/health.ts +0 -90
  269. package/src/hooks/index.ts +0 -9
  270. package/src/hooks/recently-viewed.ts +0 -125
  271. package/src/index.ts +0 -354
  272. package/src/link.tsx +0 -2
  273. package/src/pages/account/account-page-skeleton.tsx +0 -69
  274. package/src/pages/account/account-page-view.tsx +0 -270
  275. package/src/pages/account/account-shell.tsx +0 -101
  276. package/src/pages/account/parse-account-route.ts +0 -36
  277. package/src/pages/account.tsx +0 -16
  278. package/src/pages/api.$.ts +0 -20
  279. package/src/pages/api.auth.$.ts +0 -16
  280. package/src/pages/checkout.$checkoutId.tsx +0 -60
  281. package/src/pages/checkout.tsx +0 -31
  282. package/src/pages/pages.$pageSlug.tsx +0 -111
  283. package/src/pages/thank-you.tsx +0 -53
  284. package/src/providers/auth.tsx +0 -96
  285. package/src/providers/cart.tsx +0 -275
  286. package/src/providers/ecomiq.ts +0 -137
  287. package/src/providers/index.ts +0 -26
  288. package/src/proxy-api.ts +0 -20
  289. package/src/public-config.ts +0 -24
  290. package/src/review-submission.ts +0 -89
  291. package/src/runtime/context.ts +0 -2
  292. package/src/runtime/default-layout.tsx +0 -64
  293. package/src/runtime/head.ts +0 -149
  294. package/src/runtime/page.tsx +0 -143
  295. package/src/runtime/postcss-browser-stub.mjs +0 -5
  296. package/src/server-config-store.ts +0 -35
  297. package/src/server.ts +0 -301
  298. package/src/storefront-definition/contract.ts +0 -1
  299. package/src/storefront-definition/data.ts +0 -188
  300. package/src/storefront-definition/index.ts +0 -2
  301. package/src/storefront-definition/renderer.tsx +0 -1481
  302. package/src/storefront-layout.ts +0 -59
  303. package/src/storefront-runtime.ts +0 -173
  304. package/src/styles.css +0 -97
  305. package/src/ui/badge.tsx +0 -32
  306. package/src/ui/button.tsx +0 -31
  307. package/src/ui/card.tsx +0 -31
  308. package/src/ui/carousel.tsx +0 -218
  309. package/src/ui/cn.ts +0 -6
  310. package/src/ui/index.ts +0 -8
  311. package/src/ui/separator.tsx +0 -6
  312. package/src/ui/skeleton.tsx +0 -6
  313. package/src/ui/storefront-error.tsx +0 -49
  314. package/src/utils.ts +0 -36
  315. package/src/vite-inline.mjs +0 -263
  316. package/templates/__root.tsx +0 -83
  317. package/templates/router.tsx +0 -19
@@ -0,0 +1,8 @@
1
+ import { readCart } from "../cart.js";
2
+ import { CartActionData, CartData, cartAction, loadCart } from "../cart-actions.js";
3
+ import { CartControls, CartForm, CartFormProps, useCart } from "../cart-form.js";
4
+ import { CartLineLike, OptimisticCart, OptimisticCartLine, useOptimisticCart } from "../optimistic-cart.js";
5
+ import { CartDrawer, CartDrawerProvider, useCartDrawer } from "../cart-drawer.js";
6
+ import { SellerGroup, SellerLine, SummaryCart, SummaryLabels, SummaryLine, SummaryLineKey, groupBySeller, summaryLines } from "../cart-summary.js";
7
+ import { CartIntent } from "../form-contracts.js";
8
+ export { type CartActionData, type CartControls, type CartData, type CartDrawer, CartDrawerProvider, CartForm, type CartFormProps, type CartIntent, type CartLineLike, type OptimisticCart, type OptimisticCartLine, type SellerGroup, type SellerLine, type SummaryCart, type SummaryLabels, type SummaryLine, type SummaryLineKey, cartAction, groupBySeller, loadCart, readCart, summaryLines, useCart, useCartDrawer, useOptimisticCart };
@@ -0,0 +1,7 @@
1
+ import { readCart } from "../cart-D7DxZ2lD.js";
2
+ import { cartAction, loadCart } from "../cart-actions-Bsub_FFG.js";
3
+ import { CartForm, useCart } from "../cart-form-y9P1r_EX.js";
4
+ import { useOptimisticCart } from "../optimistic-cart-BveVOHuh.js";
5
+ import { CartDrawerProvider, useCartDrawer } from "../cart-drawer-B7PPsR69.js";
6
+ import { groupBySeller, summaryLines } from "../cart-summary-ur2VWKr-.js";
7
+ export { CartDrawerProvider, CartForm, cartAction, groupBySeller, loadCart, readCart, summaryLines, useCart, useCartDrawer, useOptimisticCart };
@@ -0,0 +1,12 @@
1
+ import { CheckoutActionData, CheckoutAddressDefaults, CheckoutData, CheckoutPaymentMethod, CheckoutRate, CheckoutShippingGroup, CheckoutStep, checkoutAction, loadCheckout, shouldRevalidateCheckout } from "../checkout.js";
2
+ import { useCheckout } from "../use-checkout.js";
3
+ import { CheckoutPaymentControls, useCheckoutPayment } from "../use-checkout-payment.js";
4
+ import { MercadoPagoDialog, MercadoPagoDialogState } from "../mercadopago-dialog.js";
5
+ import { StripeAuthentication, StripeDialog, StripeDialogState, StripeWallet, findStripeWallet, useAvailableStripeWallets } from "../stripe-dialog.js";
6
+ import { CheckoutForm, CheckoutFormProps, OrderBumpForm, OrderBumpFormProps, PromoCodeForm, PromoCodeFormProps } from "../checkout-form.js";
7
+ import { InvoiceCart, InvoiceFields, InvoiceFieldsProps, InvoiceFieldsState, InvoiceInputProps, InvoiceType } from "../invoice-fields.js";
8
+ import { ManualPaymentDetails, PaymentInputProps, PaymentMethodLike, PaymentMethodOption, PaymentMethodSaving, PaymentMethods, PaymentMethodsProps } from "../payment-methods.js";
9
+ import { SummaryLabels, SummaryLine, summaryLines } from "../cart-summary.js";
10
+ import { CheckoutIntent } from "../form-contracts.js";
11
+ import { CulqiAuthentication } from "../culqi-authentication.js";
12
+ export { type CheckoutActionData, type CheckoutAddressDefaults, type CheckoutData, CheckoutForm, type CheckoutFormProps, type CheckoutIntent, type CheckoutPaymentControls, type CheckoutPaymentMethod, type CheckoutRate, type CheckoutShippingGroup, type CheckoutStep, CulqiAuthentication, type InvoiceCart, InvoiceFields, type InvoiceFieldsProps, type InvoiceFieldsState, type InvoiceInputProps, type InvoiceType, type ManualPaymentDetails, MercadoPagoDialog, type MercadoPagoDialogState, OrderBumpForm, type OrderBumpFormProps, type PaymentInputProps, type PaymentMethodLike, type PaymentMethodOption, type PaymentMethodSaving, PaymentMethods, type PaymentMethodsProps, PromoCodeForm, type PromoCodeFormProps, StripeAuthentication, StripeDialog, type StripeDialogState, type StripeWallet, type SummaryLabels, type SummaryLine, checkoutAction, findStripeWallet, loadCheckout, shouldRevalidateCheckout, summaryLines, useAvailableStripeWallets, useCheckout, useCheckoutPayment };
@@ -0,0 +1,11 @@
1
+ import { checkoutAction, loadCheckout, shouldRevalidateCheckout } from "../checkout-DVWSXANi.js";
2
+ import { useCheckout } from "../use-checkout-CZcxXJXi.js";
3
+ import { useCheckoutPayment } from "../use-checkout-payment-9R-zacrJ.js";
4
+ import { MercadoPagoDialog } from "../mercadopago-dialog-UTQev0MG.js";
5
+ import { StripeAuthentication, StripeDialog, findStripeWallet, useAvailableStripeWallets } from "../stripe-dialog-Ev9s3Z62.js";
6
+ import { CheckoutForm, OrderBumpForm, PromoCodeForm } from "../checkout-form-CbOIdENC.js";
7
+ import { InvoiceFields } from "../invoice-fields-BG0HjL6T.js";
8
+ import { PaymentMethods } from "../payment-methods-B8ocTgFZ.js";
9
+ import { summaryLines } from "../cart-summary-ur2VWKr-.js";
10
+ import { CulqiAuthentication } from "../culqi-authentication-BGr20vAJ.js";
11
+ export { CheckoutForm, CulqiAuthentication, InvoiceFields, MercadoPagoDialog, OrderBumpForm, PaymentMethods, PromoCodeForm, StripeAuthentication, StripeDialog, checkoutAction, findStripeWallet, loadCheckout, shouldRevalidateCheckout, summaryLines, useAvailableStripeWallets, useCheckout, useCheckoutPayment };
@@ -0,0 +1,11 @@
1
+ import { OrderPaymentActionData, OrderProgressStep, OrderStatusData, hasOrderPaymentContinuation, loadOrderStatus, orderPaymentAction, orderProgress, orderStepTitle } from "../order-status.js";
2
+ import { OrderDraftActionData, OrderDraftData, loadOrderDraft, orderDraftAction } from "../order-draft.js";
3
+ import { OrderPaymentControls, useOrderPayment } from "../use-order-payment.js";
4
+ import { OrderPaymentContinuation } from "../order-payment-continuation.js";
5
+ import { OrderPaymentInReview } from "../order-payment-in-review.js";
6
+ import { BankAccountList } from "../bank-accounts.js";
7
+ import { PaymentInputProps, PaymentMethodOption, PaymentMethods, PaymentMethodsProps } from "../payment-methods.js";
8
+ import { SummaryLabels, SummaryLine, SummaryOrder, orderSummaryLines } from "../cart-summary.js";
9
+ import { MercadoPagoDialog } from "../mercadopago-dialog.js";
10
+ import { useOrderAuthentication } from "../culqi-authentication.js";
11
+ export { BankAccountList, MercadoPagoDialog, type OrderDraftActionData, type OrderDraftData, type OrderPaymentActionData, OrderPaymentContinuation, type OrderPaymentControls, OrderPaymentInReview, type OrderProgressStep, type OrderStatusData, type PaymentInputProps, type PaymentMethodOption, PaymentMethods, type PaymentMethodsProps, type SummaryLabels, type SummaryLine, type SummaryOrder, hasOrderPaymentContinuation, loadOrderDraft, loadOrderStatus, orderDraftAction, orderPaymentAction, orderProgress, orderStepTitle, orderSummaryLines, useOrderAuthentication, useOrderPayment };
@@ -0,0 +1,11 @@
1
+ import { hasOrderPaymentContinuation, loadOrderStatus, orderPaymentAction, orderProgress, orderStepTitle } from "../order-status-BJXLJwxq.js";
2
+ import { loadOrderDraft, orderDraftAction } from "../order-draft-DxV1Uhm3.js";
3
+ import { useOrderPayment } from "../use-order-payment-BKIz_IO0.js";
4
+ import { OrderPaymentContinuation } from "../order-payment-continuation-D_d5PGA4.js";
5
+ import { OrderPaymentInReview } from "../order-payment-in-review-x4gdLFHZ.js";
6
+ import { BankAccountList } from "../bank-accounts-DlEczQQ5.js";
7
+ import { PaymentMethods } from "../payment-methods-B8ocTgFZ.js";
8
+ import { orderSummaryLines } from "../cart-summary-ur2VWKr-.js";
9
+ import { MercadoPagoDialog } from "../mercadopago-dialog-UTQev0MG.js";
10
+ import { useOrderAuthentication } from "../culqi-authentication-BGr20vAJ.js";
11
+ export { BankAccountList, MercadoPagoDialog, OrderPaymentContinuation, OrderPaymentInReview, PaymentMethods, hasOrderPaymentContinuation, loadOrderDraft, loadOrderStatus, orderDraftAction, orderPaymentAction, orderProgress, orderStepTitle, orderSummaryLines, useOrderAuthentication, useOrderPayment };
@@ -0,0 +1,28 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ // src/favicon.tsx
3
+ function Favicon({ href }) {
4
+ if (href !== null && href !== "") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("link", {
5
+ rel: "icon",
6
+ href
7
+ }), /* @__PURE__ */ jsx("link", {
8
+ rel: "apple-touch-icon",
9
+ href
10
+ })] });
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx("link", {
13
+ rel: "icon",
14
+ href: "/favicon.ico",
15
+ sizes: "48x48"
16
+ }),
17
+ /* @__PURE__ */ jsx("link", {
18
+ rel: "icon",
19
+ href: "/favicon.svg",
20
+ type: "image/svg+xml"
21
+ }),
22
+ /* @__PURE__ */ jsx("link", {
23
+ rel: "apple-touch-icon",
24
+ href: "/apple-touch-icon.png"
25
+ })
26
+ ] });
27
+ }
28
+ export { Favicon };
@@ -0,0 +1,4 @@
1
+ import { ReactElement } from "react";
2
+ export declare function Favicon({ href }: {
3
+ href: string | null;
4
+ }): ReactElement;
@@ -0,0 +1,18 @@
1
+ import { documentUrl } from "./document-url-CGsAl5Tf.js";
2
+ // src/form.ts
3
+ function text(form, name) {
4
+ const value = form.get(name);
5
+ return typeof value === "string" ? value.trim() : "";
6
+ }
7
+ function optional(form, name) {
8
+ const value = text(form, name);
9
+ return value === "" ? null : value;
10
+ }
11
+ function safeNext(value) {
12
+ if (!value || !value.startsWith("/") || /[\\\u0000-\u0020]/.test(value)) return "/account";
13
+ const base = "https://storefront.invalid";
14
+ const next = documentUrl(new URL(value, base));
15
+ if (next.origin !== base || /^\/account\/(login|callback|logout|register)(\/|$)/.test(next.pathname)) return "/account";
16
+ return `${next.pathname}${next.search}${next.hash}`;
17
+ }
18
+ export { optional, safeNext, text };
@@ -0,0 +1,166 @@
1
+ // src/form-contracts.ts
2
+ const CUSTOMER_CSRF_FIELD = "__customer_csrf";
3
+ const CART_INTENTS = {
4
+ add: [
5
+ "variantId",
6
+ "product",
7
+ "quantity",
8
+ "next"
9
+ ],
10
+ buy: [
11
+ "variantId",
12
+ "product",
13
+ "quantity",
14
+ "next"
15
+ ],
16
+ quick: [
17
+ "variantId",
18
+ "product",
19
+ "next"
20
+ ],
21
+ update: ["itemId", "quantity"],
22
+ remove: ["itemId"],
23
+ reorder: ["variantId", "quantity"]
24
+ };
25
+ const SHIPPING_RATE_FIELD_PREFIX = "rate-";
26
+ const CHECKOUT_INTENTS = {
27
+ contact: [
28
+ "email",
29
+ "firstName",
30
+ "lastName",
31
+ "phone",
32
+ "identificationType",
33
+ "identificationNumber",
34
+ "identificationCountryCode",
35
+ "invoiceType",
36
+ "entityTaxId",
37
+ "entityName"
38
+ ],
39
+ delivery: [
40
+ "country",
41
+ "department",
42
+ "province",
43
+ "district",
44
+ "line",
45
+ "reference",
46
+ "phone",
47
+ "postalCode"
48
+ ],
49
+ shipping: [`${SHIPPING_RATE_FIELD_PREFIX}*`],
50
+ "payment-method": ["method"],
51
+ pay: [
52
+ "method",
53
+ "payerIdentificationNumber",
54
+ "receipt",
55
+ "token",
56
+ "providerPaymentMethodId",
57
+ "deviceSessionId"
58
+ ],
59
+ checkout: [
60
+ "email",
61
+ "firstName",
62
+ "lastName",
63
+ "phone",
64
+ "identificationType",
65
+ "identificationNumber",
66
+ "identificationCountryCode",
67
+ "invoiceType",
68
+ "entityTaxId",
69
+ "entityName",
70
+ "country",
71
+ "department",
72
+ "province",
73
+ "district",
74
+ "line",
75
+ "reference",
76
+ "postalCode",
77
+ `${SHIPPING_RATE_FIELD_PREFIX}*`,
78
+ "method",
79
+ "payerIdentificationNumber",
80
+ "receipt",
81
+ "token",
82
+ "providerPaymentMethodId",
83
+ "deviceSessionId"
84
+ ],
85
+ promo: ["code"],
86
+ "promo-remove": ["code"],
87
+ bump: ["bumpId", "variantId"]
88
+ };
89
+ const ADDRESS_INTENTS = {
90
+ save: [
91
+ "id",
92
+ "label",
93
+ "country",
94
+ "department",
95
+ "province",
96
+ "district",
97
+ "line",
98
+ "reference",
99
+ "phone",
100
+ "default"
101
+ ],
102
+ default: ["id"],
103
+ delete: ["id"]
104
+ };
105
+ const ORDER_REQUEST_INTENTS = {
106
+ return: [
107
+ "reason",
108
+ "comment",
109
+ "itemId",
110
+ "quantity",
111
+ "photos"
112
+ ],
113
+ cancel: ["reason", "comment"]
114
+ };
115
+ const PROFILE_FIELDS = [
116
+ "firstName",
117
+ "lastName",
118
+ "phone",
119
+ "document",
120
+ "identificationType",
121
+ "identificationCountryCode"
122
+ ];
123
+ const ORDER_PAYMENT_FIELDS = [
124
+ "intent",
125
+ "method",
126
+ "receipt",
127
+ "token",
128
+ "providerPaymentMethodId",
129
+ "deviceSessionId",
130
+ "transactionId",
131
+ "authentication3DS"
132
+ ];
133
+ const FORM_CONTRACTS = [
134
+ {
135
+ action: "/cart",
136
+ intents: CART_INTENTS
137
+ },
138
+ {
139
+ action: "/checkout",
140
+ intents: CHECKOUT_INTENTS
141
+ },
142
+ {
143
+ action: "/account/addresses",
144
+ intents: ADDRESS_INTENTS
145
+ },
146
+ {
147
+ action: "/account/profile",
148
+ fields: PROFILE_FIELDS
149
+ },
150
+ {
151
+ action: "/account/orders/:id",
152
+ intents: ORDER_REQUEST_INTENTS
153
+ },
154
+ {
155
+ action: "/account/logout",
156
+ fields: []
157
+ },
158
+ {
159
+ action: "/orders/:token",
160
+ fields: ORDER_PAYMENT_FIELDS
161
+ }
162
+ ];
163
+ function isIntent(intents, value) {
164
+ return Object.hasOwn(intents, value);
165
+ }
166
+ export { ADDRESS_INTENTS, CART_INTENTS, CHECKOUT_INTENTS, CUSTOMER_CSRF_FIELD, FORM_CONTRACTS, ORDER_PAYMENT_FIELDS, ORDER_REQUEST_INTENTS, PROFILE_FIELDS, SHIPPING_RATE_FIELD_PREFIX, isIntent };
@@ -0,0 +1,42 @@
1
+ export type IntentFields = Readonly<Record<string, readonly string[]>>;
2
+ export type FormContract = {
3
+ action: string;
4
+ intents: IntentFields;
5
+ } | {
6
+ action: string;
7
+ fields: readonly string[];
8
+ };
9
+ export declare const CUSTOMER_CSRF_FIELD = "__customer_csrf";
10
+ export declare const CART_INTENTS: {
11
+ readonly add: readonly ["variantId", "product", "quantity", "next"];
12
+ readonly buy: readonly ["variantId", "product", "quantity", "next"];
13
+ readonly quick: readonly ["variantId", "product", "next"];
14
+ readonly update: readonly ["itemId", "quantity"];
15
+ readonly remove: readonly ["itemId"];
16
+ readonly reorder: readonly ["variantId", "quantity"];
17
+ };
18
+ export declare const CHECKOUT_INTENTS: {
19
+ readonly contact: readonly ["email", "firstName", "lastName", "phone", "identificationType", "identificationNumber", "identificationCountryCode", "invoiceType", "entityTaxId", "entityName"];
20
+ readonly delivery: readonly ["country", "department", "province", "district", "line", "reference", "phone", "postalCode"];
21
+ readonly shipping: readonly ["rate-*"];
22
+ readonly "payment-method": readonly ["method"];
23
+ readonly pay: readonly ["method", "payerIdentificationNumber", "receipt", "token", "providerPaymentMethodId", "deviceSessionId"];
24
+ readonly checkout: readonly ["email", "firstName", "lastName", "phone", "identificationType", "identificationNumber", "identificationCountryCode", "invoiceType", "entityTaxId", "entityName", "country", "department", "province", "district", "line", "reference", "postalCode", "rate-*", "method", "payerIdentificationNumber", "receipt", "token", "providerPaymentMethodId", "deviceSessionId"];
25
+ readonly promo: readonly ["code"];
26
+ readonly "promo-remove": readonly ["code"];
27
+ readonly bump: readonly ["bumpId", "variantId"];
28
+ };
29
+ export declare const ADDRESS_INTENTS: {
30
+ readonly save: readonly ["id", "label", "country", "department", "province", "district", "line", "reference", "phone", "default"];
31
+ readonly default: readonly ["id"];
32
+ readonly delete: readonly ["id"];
33
+ };
34
+ export declare const ORDER_REQUEST_INTENTS: {
35
+ readonly return: readonly ["reason", "comment", "itemId", "quantity", "photos"];
36
+ readonly cancel: readonly ["reason", "comment"];
37
+ };
38
+ export declare const FORM_CONTRACTS: readonly FormContract[];
39
+ export type CartIntent = keyof typeof CART_INTENTS;
40
+ export type CheckoutIntent = keyof typeof CHECKOUT_INTENTS;
41
+ export type AddressIntent = keyof typeof ADDRESS_INTENTS;
42
+ export type OrderRequestIntent = keyof typeof ORDER_REQUEST_INTENTS;
package/dist/form.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function text(form: FormData, name: string): string;
2
+ export declare function optional(form: FormData, name: string): string | null;
3
+ export declare function safeNext(value: string | null): string;
@@ -0,0 +1,3 @@
1
+ // src/hidden.tsx
2
+ const Hidden = () => null;
3
+ export { Hidden };
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from "react";
2
+ export declare const Hidden: (props: {
3
+ children?: ReactNode;
4
+ }) => null;
@@ -0,0 +1,50 @@
1
+ import { StorefrontEnv, WorkerContext, createRequestHandler, worker } from "./worker.js";
2
+ import { collectionImageCandidates, found, readCountries, store, withImages } from "./store.js";
3
+ import { cartCookie, cartToken, readCart } from "./cart.js";
4
+ import { CartActionData, CartData, MAX_CART_QUANTITY, cartAction, loadCart } from "./cart-actions.js";
5
+ import { CheckoutActionData, CheckoutAddressDefaults, CheckoutData, CheckoutPaymentMethod, CheckoutRate, CheckoutShippingGroup, CheckoutStep, checkoutAction, checkoutAddressDefaults, checkoutProgress, checkoutStep, defaultPaymentMethod, loadCheckout, needsShipping } from "./checkout.js";
6
+ import { PaymentMethodSaving, paymentMethodSaving } from "./payment-methods.js";
7
+ import { useCheckout } from "./use-checkout.js";
8
+ import { AddressActionData, ProfileActionData, addressAction, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, profileAction, readCustomerAddress } from "./account.js";
9
+ import { GeoPlace, ReviewActionData, StorefrontPageData, TrackingData, loadGeo, loadPage, loadReview, loadSearchSuggestions, loadTracking, productReviewAction, readPage, reviewAction } from "./public-pages.js";
10
+ import { OrderPaymentActionData, OrderProgressStep, OrderStatusData, hasOrderPaymentContinuation, loadOrderStatus, orderPaymentAction, orderProgress, orderStepTitle } from "./order-status.js";
11
+ import { OrderDraftActionData, OrderDraftData, isOrderDraftPayable, loadOrderDraft, orderDraftAction } from "./order-draft.js";
12
+ import { OrderPaymentControls, useOrderPayment } from "./use-order-payment.js";
13
+ import { OrderPaymentContinuation } from "./order-payment-continuation.js";
14
+ import { OrderPaymentInReview } from "./order-payment-in-review.js";
15
+ import { ProductVariant, VariantOption, discountPercent, isVariantAvailable, pickVariant, variantOptions, variantSwatches } from "./product-variants.js";
16
+ import { ActiveFilterChip, FilterChipText, FilterLabels, PageItem, SORT_OPTIONS, SortLabels, SortValue, activeFilterChips, activeFilterCount, clearedFiltersHref, filterLabel, filterValueLabel, isSingleChoiceFilter, pageItems, selectedFacetCount, useFacets, useGeoCascade, usePagination, useSearchSuggestions, useSort } from "./catalog-hooks.js";
17
+ import { Customer, CustomerLoginData, completeCustomerLogin, customer, customerCsrfToken, customerHeaders, logout, requireCustomer, requireCustomerRegistration, startCustomerLogin, submitCustomerLogin } from "./session.js";
18
+ import { CustomerCsrfField, useCustomerCsrfToken } from "./customer-csrf.js";
19
+ import { CUSTOMER_CSRF_FIELD, FORM_CONTRACTS, FormContract } from "./form-contracts.js";
20
+ import { culqiSourceKey } from "./culqi-three-ds.js";
21
+ import { readCatalog, shouldRevalidateCatalogRoot } from "./catalog.js";
22
+ import { PageSeo, PageSeoInput, categorySeo, collectionSeo, homeSeo, pageSeo, productSeo, seoMeta } from "./page-seo.js";
23
+ import { CategoryData, ResolvedUrl, canonicalUrl, loadCategory, loadProduct, requireCanonical, resolveUrl } from "./urls.js";
24
+ import { CategoryPage, CollectionPage, PageOptions, ProductPage, ProductReviews, ResolvedPage, ReviewSummary, collectionPage, productPage, productReviews, resolvePage } from "./pages.js";
25
+ import { money } from "./money.js";
26
+ import { readPlace } from "./place.js";
27
+ import { optional, safeNext, text } from "./form.js";
28
+ import { ProductSource, SectionCatalog, SectionGroup, SectionProps, SectionRoot, pickProducts, section, setting } from "./settings.js";
29
+ import { Favicon } from "./favicon.js";
30
+ import { Hidden } from "./hidden.js";
31
+ import { SourceProvider, source, sourceValue } from "./sources.js";
32
+ import { RichText } from "./rich-text.js";
33
+ import { SectionData, SectionEntry, SectionLoadArgs, loadSections, sectionKey, useSection, withSectionBoundary, withSections } from "./sections.js";
34
+ import { TemplateKind, TemplateModule, TemplateModules, templateComponent, templateName, templatePath, templated } from "./templates.js";
35
+ import { SectionModules, SectionPreview, SectionPreviewData, sectionPreview, sectionPreviewMeta } from "./section-preview.js";
36
+ import { StorefrontAnchor, StorefrontAnchorProps, StorefrontLink, StorefrontLinkProps, StorefrontLinks, readStorefrontLayout, readStorefrontLinks, storefrontHref, useStorefrontLinkPublished } from "./links.js";
37
+ import { PaymentLogo, paymentLogoCodes } from "./payment-logo.js";
38
+ import { BankAccountList } from "./bank-accounts.js";
39
+ import { CustomerAvatar } from "./customer-avatar.js";
40
+ import { CustomerLoginForm, CustomerLoginFormProps } from "./customer-login-form.js";
41
+ import { Captcha, CaptchaProps } from "./captcha.js";
42
+ import { COMPLAINT_DOCUMENT_TYPES, DocumentRule, IDENTITY_DOCUMENT_TYPES, IdentityDocumentType, identityDocumentRule } from "./documents.js";
43
+ import { ComplaintBookActionData, ComplaintBookData, ComplaintBookLink, complaintBookAction, complaintBookAttachmentError, complaintBookLinks, complaintBookNumber, loadComplaintBook } from "./complaint-book.js";
44
+ import { CustomerRegistrationData, loadCustomerRegistration, submitCustomerRegistration } from "./registration.js";
45
+ import { CustomerRegistrationForm, CustomerRegistrationFormProps } from "./customer-registration-form.js";
46
+ import { storefrontContact } from "./store-contact.js";
47
+ import { loadStorefrontTranslations, storefrontText } from "./storefront-text.js";
48
+ import { StorefrontLanguageProvider, useStorefrontLocale, useStorefrontText } from "./storefront-language.js";
49
+ import { storefrontRouteText } from "./route-text.js";
50
+ export { type ActiveFilterChip, type AddressActionData, BankAccountList, COMPLAINT_DOCUMENT_TYPES, CUSTOMER_CSRF_FIELD, Captcha, type CaptchaProps, type CartActionData, type CartData, type CategoryData, type CategoryPage, type CheckoutActionData, type CheckoutAddressDefaults, type CheckoutData, type CheckoutPaymentMethod, type CheckoutRate, type CheckoutShippingGroup, type CheckoutStep, type CollectionPage, type ComplaintBookActionData, type ComplaintBookData, type ComplaintBookLink, type Customer, CustomerAvatar, CustomerCsrfField, type CustomerLoginData, CustomerLoginForm, type CustomerLoginFormProps, type CustomerRegistrationData, CustomerRegistrationForm, type CustomerRegistrationFormProps, type DocumentRule, FORM_CONTRACTS, Favicon, type FilterChipText, type FilterLabels, type FormContract, type GeoPlace, Hidden, IDENTITY_DOCUMENT_TYPES, type IdentityDocumentType, MAX_CART_QUANTITY, type OrderDraftActionData, type OrderDraftData, type OrderPaymentActionData, OrderPaymentContinuation, type OrderPaymentControls, OrderPaymentInReview, type OrderProgressStep, type OrderStatusData, type PageItem, type PageOptions, type PageSeo, type PageSeoInput, PaymentLogo, type PaymentMethodSaving, type ProductPage, type ProductReviews, type ProductSource, type ProductVariant, type ProfileActionData, type ResolvedPage, type ResolvedUrl, type ReviewActionData, type ReviewSummary, RichText, SORT_OPTIONS, type SectionCatalog, type SectionData, type SectionEntry, type SectionGroup, type SectionLoadArgs, type SectionModules, SectionPreview, type SectionPreviewData, type SectionProps, type SectionRoot, type SortLabels, type SortValue, SourceProvider, StorefrontAnchor, type StorefrontAnchorProps, type StorefrontEnv, StorefrontLanguageProvider, StorefrontLink, type StorefrontLinkProps, type StorefrontLinks, type StorefrontPageData, type TemplateKind, type TemplateModule, type TemplateModules, type TrackingData, type VariantOption, type WorkerContext, activeFilterChips, activeFilterCount, addressAction, canonicalUrl, cartAction, cartCookie, cartToken, categorySeo, checkoutAction, checkoutAddressDefaults, checkoutProgress, checkoutStep, clearedFiltersHref, collectionImageCandidates, collectionPage, collectionSeo, complaintBookAction, complaintBookAttachmentError, complaintBookLinks, complaintBookNumber, completeCustomerLogin, createRequestHandler, culqiSourceKey, customer, customerCsrfToken, customerHeaders, defaultPaymentMethod, discountPercent, filterLabel, filterValueLabel, found, hasOrderPaymentContinuation, homeSeo, identityDocumentRule, isOrderDraftPayable, isSingleChoiceFilter, isVariantAvailable, loadAccount, loadAddresses, loadCart, loadCategory, loadCheckout, loadComplaintBook, loadCustomerRegistration, loadGeo, loadOrder, loadOrderDraft, loadOrderStatus, loadOrders, loadPage, loadProduct, loadProfile, loadReview, loadSearchSuggestions, loadSections, loadStorefrontTranslations, loadTracking, logout, money, needsShipping, optional, orderDraftAction, orderPaymentAction, orderProgress, orderStepTitle, pageItems, pageSeo, paymentLogoCodes, paymentMethodSaving, pickProducts, pickVariant, productPage, productReviewAction, productReviews, productSeo, profileAction, readCart, readCatalog, readCountries, readCustomerAddress, readPage, readPlace, readStorefrontLayout, readStorefrontLinks, requireCanonical, requireCustomer, requireCustomerRegistration, resolvePage, resolveUrl, reviewAction, safeNext, section, sectionKey, sectionPreview, sectionPreviewMeta, selectedFacetCount, seoMeta, setting, shouldRevalidateCatalogRoot, source, sourceValue, startCustomerLogin, store, storefrontContact, storefrontHref, storefrontRouteText, storefrontText, submitCustomerLogin, submitCustomerRegistration, templateComponent, templateName, templatePath, templated, text, useCheckout, useCustomerCsrfToken, useFacets, useGeoCascade, useOrderPayment, usePagination, useSearchSuggestions, useSection, useSort, useStorefrontLinkPublished, useStorefrontLocale, useStorefrontText, variantOptions, variantSwatches, withImages, withSectionBoundary, withSections, worker };
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ import { createRequestHandler, worker } from "./worker-CNi-gzCu.js";
2
+ import { collectionImageCandidates, found, readCountries, store, withImages } from "./store-8Q-_LFrQ.js";
3
+ import { cartCookie, cartToken, readCart } from "./cart-D7DxZ2lD.js";
4
+ import { MAX_CART_QUANTITY, cartAction, loadCart } from "./cart-actions-Bsub_FFG.js";
5
+ import { checkoutAction, checkoutAddressDefaults, checkoutProgress, checkoutStep, defaultPaymentMethod, loadCheckout, needsShipping } from "./checkout-DVWSXANi.js";
6
+ import { paymentMethodSaving } from "./payment-methods-B8ocTgFZ.js";
7
+ import { useCheckout } from "./use-checkout-CZcxXJXi.js";
8
+ import { addressAction, loadAccount, loadAddresses, loadOrder, loadOrders, loadProfile, profileAction, readCustomerAddress } from "./account-Dx4e3syi.js";
9
+ import { loadGeo, loadPage, loadReview, loadSearchSuggestions, loadTracking, productReviewAction, readPage, reviewAction } from "./public-pages-XtwlaLwt.js";
10
+ import { hasOrderPaymentContinuation, loadOrderStatus, orderPaymentAction, orderProgress, orderStepTitle } from "./order-status-BJXLJwxq.js";
11
+ import { isOrderDraftPayable, loadOrderDraft, orderDraftAction } from "./order-draft-DxV1Uhm3.js";
12
+ import { useOrderPayment } from "./use-order-payment-BKIz_IO0.js";
13
+ import { OrderPaymentContinuation } from "./order-payment-continuation-D_d5PGA4.js";
14
+ import { OrderPaymentInReview } from "./order-payment-in-review-x4gdLFHZ.js";
15
+ import { discountPercent, isVariantAvailable, pickVariant, variantOptions, variantSwatches } from "./product-variants-BNDHvs1y.js";
16
+ import { SORT_OPTIONS, activeFilterChips, activeFilterCount, clearedFiltersHref, filterLabel, filterValueLabel, isSingleChoiceFilter, pageItems, selectedFacetCount, useFacets, useGeoCascade, usePagination, useSearchSuggestions, useSort } from "./catalog-hooks-B7ZP4wYY.js";
17
+ import { completeCustomerLogin, customer, customerCsrfToken, customerHeaders, logout, requireCustomer, requireCustomerRegistration, startCustomerLogin, submitCustomerLogin } from "./session-CKvmFJyg.js";
18
+ import { CustomerCsrfField, useCustomerCsrfToken } from "./customer-csrf-C1oDX-Py.js";
19
+ import { CUSTOMER_CSRF_FIELD, FORM_CONTRACTS } from "./form-contracts-BNpHaTGJ.js";
20
+ import { culqiSourceKey } from "./culqi-three-ds-HP3mfrvV.js";
21
+ import { readCatalog, shouldRevalidateCatalogRoot } from "./catalog-7gJ-l5hW.js";
22
+ import { categorySeo, collectionSeo, homeSeo, pageSeo, productSeo, seoMeta } from "./page-seo-a5FJl8x5.js";
23
+ import { canonicalUrl, loadCategory, loadProduct, requireCanonical, resolveUrl } from "./urls-CpGQPxvf.js";
24
+ import { collectionPage, productPage, productReviews, resolvePage } from "./pages-Ca_Gt6mq.js";
25
+ import { money } from "./money-DtGOtDri.js";
26
+ import { readPlace } from "./place-CmW4hBWY.js";
27
+ import { optional, safeNext, text } from "./form-BtQcbXlJ.js";
28
+ import { pickProducts, section, setting } from "./settings-B0NO2A6Y.js";
29
+ import { Favicon } from "./favicon-YpyhVJ9H.js";
30
+ import { Hidden } from "./hidden-CCWtOWKR.js";
31
+ import { SourceProvider, source, sourceValue } from "./sources-B-3JFJfb.js";
32
+ import { RichText } from "./rich-text-M-Ju8RL4.js";
33
+ import { loadSections, sectionKey, useSection, withSectionBoundary, withSections } from "./sections-CNUMWTF_.js";
34
+ import { templateComponent, templateName, templatePath, templated } from "./templates-CAqoNyTW.js";
35
+ import { SectionPreview, sectionPreview, sectionPreviewMeta } from "./section-preview-CmsMl3yu.js";
36
+ import { StorefrontAnchor, StorefrontLink, readStorefrontLayout, readStorefrontLinks, storefrontHref, useStorefrontLinkPublished } from "./links-kFxBZfdb.js";
37
+ import { PaymentLogo, paymentLogoCodes } from "./payment-logo-BoPaGJc_.js";
38
+ import { BankAccountList } from "./bank-accounts-DlEczQQ5.js";
39
+ import { CustomerAvatar } from "./customer-avatar-CJXSDroK.js";
40
+ import { CustomerLoginForm } from "./customer-login-form-C7AC6vXd.js";
41
+ import { Captcha } from "./captcha-DAqaIx8m.js";
42
+ import { COMPLAINT_DOCUMENT_TYPES, IDENTITY_DOCUMENT_TYPES, identityDocumentRule } from "./documents-T1mzc_j8.js";
43
+ import { complaintBookAction, complaintBookAttachmentError, complaintBookLinks, complaintBookNumber, loadComplaintBook } from "./complaint-book-BvwLvfx0.js";
44
+ import { loadCustomerRegistration, submitCustomerRegistration } from "./registration-CpDcv8ql.js";
45
+ import { CustomerRegistrationForm } from "./customer-registration-form-BEm_NEfP.js";
46
+ import { storefrontContact } from "./store-contact--hY6CoFb.js";
47
+ import { loadStorefrontTranslations, storefrontText } from "./storefront-text-D25ae1qf.js";
48
+ import { StorefrontLanguageProvider, useStorefrontLocale, useStorefrontText } from "./storefront-language-DrMjVbmk.js";
49
+ import { storefrontRouteText } from "./route-text-DcJw2SsK.js";
50
+ export { BankAccountList, COMPLAINT_DOCUMENT_TYPES, CUSTOMER_CSRF_FIELD, Captcha, CustomerAvatar, CustomerCsrfField, CustomerLoginForm, CustomerRegistrationForm, FORM_CONTRACTS, Favicon, Hidden, IDENTITY_DOCUMENT_TYPES, MAX_CART_QUANTITY, OrderPaymentContinuation, OrderPaymentInReview, PaymentLogo, RichText, SORT_OPTIONS, SectionPreview, SourceProvider, StorefrontAnchor, StorefrontLanguageProvider, StorefrontLink, activeFilterChips, activeFilterCount, addressAction, canonicalUrl, cartAction, cartCookie, cartToken, categorySeo, checkoutAction, checkoutAddressDefaults, checkoutProgress, checkoutStep, clearedFiltersHref, collectionImageCandidates, collectionPage, collectionSeo, complaintBookAction, complaintBookAttachmentError, complaintBookLinks, complaintBookNumber, completeCustomerLogin, createRequestHandler, culqiSourceKey, customer, customerCsrfToken, customerHeaders, defaultPaymentMethod, discountPercent, filterLabel, filterValueLabel, found, hasOrderPaymentContinuation, homeSeo, identityDocumentRule, isOrderDraftPayable, isSingleChoiceFilter, isVariantAvailable, loadAccount, loadAddresses, loadCart, loadCategory, loadCheckout, loadComplaintBook, loadCustomerRegistration, loadGeo, loadOrder, loadOrderDraft, loadOrderStatus, loadOrders, loadPage, loadProduct, loadProfile, loadReview, loadSearchSuggestions, loadSections, loadStorefrontTranslations, loadTracking, logout, money, needsShipping, optional, orderDraftAction, orderPaymentAction, orderProgress, orderStepTitle, pageItems, pageSeo, paymentLogoCodes, paymentMethodSaving, pickProducts, pickVariant, productPage, productReviewAction, productReviews, productSeo, profileAction, readCart, readCatalog, readCountries, readCustomerAddress, readPage, readPlace, readStorefrontLayout, readStorefrontLinks, requireCanonical, requireCustomer, requireCustomerRegistration, resolvePage, resolveUrl, reviewAction, safeNext, section, sectionKey, sectionPreview, sectionPreviewMeta, selectedFacetCount, seoMeta, setting, shouldRevalidateCatalogRoot, source, sourceValue, startCustomerLogin, store, storefrontContact, storefrontHref, storefrontRouteText, storefrontText, submitCustomerLogin, submitCustomerRegistration, templateComponent, templateName, templatePath, templated, text, useCheckout, useCustomerCsrfToken, useFacets, useGeoCascade, useOrderPayment, usePagination, useSearchSuggestions, useSection, useSort, useStorefrontLinkPublished, useStorefrontLocale, useStorefrontText, variantOptions, variantSwatches, withImages, withSectionBoundary, withSections, worker };
@@ -0,0 +1,103 @@
1
+ import { useStorefrontText } from "./storefront-language-DrMjVbmk.js";
2
+ import { IDENTITY_DOCUMENT_TYPES, identityDocumentError, identityDocumentRule, isIdentityDocumentType } from "./documents-T1mzc_j8.js";
3
+ import { useState } from "react";
4
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/invoice-fields.tsx
6
+ const INVOICE_OPTIONS = [{
7
+ value: "receipt",
8
+ label: "Recibo"
9
+ }, {
10
+ value: "invoice",
11
+ label: "Factura"
12
+ }];
13
+ function useDocumentInput(type, countryCode, initial) {
14
+ const [value, setValue] = useState(initial);
15
+ const [checked, setChecked] = useState(false);
16
+ const translate = useStorefrontText();
17
+ const failure = identityDocumentError(type, countryCode, value);
18
+ const error = failure === null ? null : translate(failure);
19
+ const rule = identityDocumentRule(type);
20
+ return {
21
+ error: checked ? error : null,
22
+ props: {
23
+ ref: (input) => input?.setCustomValidity(error ?? ""),
24
+ inputMode: rule.inputMode,
25
+ autoComplete: "off",
26
+ maxLength: rule.maxLength,
27
+ pattern: rule.pattern,
28
+ value,
29
+ "aria-invalid": checked && error !== null,
30
+ onChange: (event) => {
31
+ const next = event.currentTarget.value.slice(0, rule.maxLength);
32
+ setValue(next);
33
+ event.currentTarget.value = next;
34
+ },
35
+ onBlur: () => setChecked(true)
36
+ }
37
+ };
38
+ }
39
+ function InvoiceFields({ cart, children }) {
40
+ const storefrontTranslate = useStorefrontText();
41
+ const saved = isIdentityDocumentType(cart.identificationType) ? cart.identificationType : null;
42
+ const [type, setInvoiceType] = useState(cart.invoiceType === "invoice" ? "invoice" : "receipt");
43
+ const [documentType, setDocumentType] = useState(saved ?? "NationalId");
44
+ const [documentCountry, setDocumentCountry] = useState(cart.identificationCountryCode ?? "");
45
+ const taxId = useDocumentInput("TaxId", documentCountry, cart.entityTaxId ?? "");
46
+ const receiptDocument = useDocumentInput(documentType, documentCountry, saved === null ? "" : cart.identificationNumber ?? "");
47
+ function setType(value) {
48
+ if (value === "receipt" || value === "invoice") setInvoiceType(value);
49
+ }
50
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("input", {
51
+ type: "hidden",
52
+ name: "invoiceType",
53
+ value: type
54
+ }), children({
55
+ type,
56
+ setType,
57
+ options: INVOICE_OPTIONS,
58
+ taxId: {
59
+ ...taxId.props,
60
+ id: "entityTaxId",
61
+ name: "entityTaxId",
62
+ required: true
63
+ },
64
+ entityName: {
65
+ id: "entityName",
66
+ name: "entityName",
67
+ autoComplete: "organization",
68
+ maxLength: 200,
69
+ required: true,
70
+ defaultValue: cart.entityName ?? ""
71
+ },
72
+ taxIdError: taxId.error,
73
+ documentTypes: IDENTITY_DOCUMENT_TYPES.map((value) => ({
74
+ value,
75
+ label: identityDocumentRule(value).label
76
+ })),
77
+ documentType: {
78
+ id: "identificationType",
79
+ name: "identificationType",
80
+ value: documentType,
81
+ onChange: (event) => {
82
+ const value = event.currentTarget.value;
83
+ if (isIdentityDocumentType(value)) setDocumentType(value);
84
+ }
85
+ },
86
+ documentCountry: {
87
+ id: "identificationCountryCode",
88
+ name: "identificationCountryCode",
89
+ value: documentCountry,
90
+ required: type === "invoice" || receiptDocument.props.value !== "",
91
+ onChange: (event) => setDocumentCountry(event.currentTarget.value.toUpperCase())
92
+ },
93
+ document: {
94
+ ...receiptDocument.props,
95
+ id: "identificationNumber",
96
+ name: "identificationNumber",
97
+ required: false
98
+ },
99
+ documentLabel: storefrontTranslate("Documento (opcional)"),
100
+ documentError: receiptDocument.error
101
+ })] });
102
+ }
103
+ export { INVOICE_OPTIONS, InvoiceFields };
@@ -0,0 +1,39 @@
1
+ import { StorefrontCart } from "@ecomiq/core";
2
+ import { ComponentProps, ReactNode, SelectHTMLAttributes } from "react";
3
+ export type InvoiceType = "receipt" | "invoice";
4
+ export type InvoiceCart = Pick<StorefrontCart, "currencyCode" | "invoiceType" | "entityTaxId" | "entityName" | "identificationType" | "identificationNumber" | "identificationCountryCode"> & {
5
+ totals: Pick<StorefrontCart["totals"], "total">;
6
+ };
7
+ export type InvoiceInputProps = ComponentProps<"input"> & {
8
+ id: string;
9
+ name: string;
10
+ };
11
+ export type InvoiceSelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
12
+ id: string;
13
+ name: string;
14
+ };
15
+ export type InvoiceFieldsState = {
16
+ type: InvoiceType;
17
+ setType: (type: string) => void;
18
+ options: readonly {
19
+ value: InvoiceType;
20
+ label: string;
21
+ }[];
22
+ taxId: InvoiceInputProps;
23
+ entityName: InvoiceInputProps;
24
+ taxIdError: string | null;
25
+ documentTypes: readonly {
26
+ value: string;
27
+ label: string;
28
+ }[];
29
+ documentType: InvoiceSelectProps;
30
+ documentCountry: InvoiceSelectProps;
31
+ document: InvoiceInputProps;
32
+ documentLabel: string;
33
+ documentError: string | null;
34
+ };
35
+ export type InvoiceFieldsProps = {
36
+ cart: InvoiceCart;
37
+ children: (invoice: InvoiceFieldsState) => ReactNode;
38
+ };
39
+ export declare function InvoiceFields({ cart, children }: InvoiceFieldsProps): import("react").JSX.Element;