@clickaroo/checkout-ui 0.1.5-beta → 0.1.7-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -5
- package/dist/storybook/assets/APIs.en-BZprb8nz.js +0 -372
- package/dist/storybook/assets/CheckoutPage-_q0L2I48.js +0 -3
- package/dist/storybook/assets/CheckoutPage.en-Cqm7U6Ao.js +0 -147
- package/dist/storybook/assets/CheckoutPage.stories-Biq4hwU7.js +0 -44
- package/dist/storybook/assets/Color-YHDXOIA2-CTze9lKG.js +0 -1
- package/dist/storybook/assets/CustomCheckout.en-B1POrtIr.js +0 -211
- package/dist/storybook/assets/CustomCheckout.stories-D-tPjvHt.js +0 -6
- package/dist/storybook/assets/CustomerInfo-BABvZLYn.js +0 -1
- package/dist/storybook/assets/CustomerInfo.stories-QbQKWp1d.js +0 -9
- package/dist/storybook/assets/DeliveryAddress-DwuRB6NF.js +0 -2
- package/dist/storybook/assets/DeliveryAddress.stories-DZnkYsnJ.js +0 -9
- package/dist/storybook/assets/DocsRenderer-CFRXHY34-C1sXuUXn.js +0 -2
- package/dist/storybook/assets/Guide.en-m6hCgVJU.js +0 -107
- package/dist/storybook/assets/PaymentMethods-B6OrSp4J.js +0 -2
- package/dist/storybook/assets/PaymentMethods.stories-DNO6rqG3.js +0 -9
- package/dist/storybook/assets/QuickStart.en-Dra_JcyZ.js +0 -136
- package/dist/storybook/assets/ValidateInput-Bw6PO7kr.js +0 -2
- package/dist/storybook/assets/chunk-XP5HYGXS-BpfKkqn7.js +0 -1
- package/dist/storybook/assets/entry-preview-D5W1SR96.js +0 -2
- package/dist/storybook/assets/entry-preview-docs-CS87rPOt.js +0 -46
- package/dist/storybook/assets/iframe-BBMn-SiC.js +0 -211
- package/dist/storybook/assets/index-2r-d8gn2.js +0 -575
- package/dist/storybook/assets/index-B7ki2Uzk.js +0 -24
- package/dist/storybook/assets/index-CFngt2ij.css +0 -1
- package/dist/storybook/assets/index-ChEI-nsM.js +0 -1
- package/dist/storybook/assets/index-D-Mha1DF.js +0 -11
- package/dist/storybook/assets/index-DRjF_FHU.js +0 -9
- package/dist/storybook/assets/index-DqxVLU6x.js +0 -240
- package/dist/storybook/assets/index-DrFu-skq.js +0 -6
- package/dist/storybook/assets/jsx-runtime-DiklIkkE.js +0 -9
- package/dist/storybook/assets/preview-B8lJiyuQ.js +0 -34
- package/dist/storybook/assets/preview-BBWR9nbA.js +0 -1
- package/dist/storybook/assets/preview-BCWRKXw7.js +0 -2
- package/dist/storybook/assets/preview-BWzBA1C2.js +0 -396
- package/dist/storybook/assets/preview-CvbIS5ZJ.js +0 -1
- package/dist/storybook/assets/preview-DD_OYowb.js +0 -1
- package/dist/storybook/assets/preview-DGUiP6tS.js +0 -7
- package/dist/storybook/assets/preview-DHQbi4pV.js +0 -1
- package/dist/storybook/assets/preview-DHrw3ha3.js +0 -1
- package/dist/storybook/assets/preview-NEoZ8N1F.js +0 -1
- package/dist/storybook/assets/react-18-2zMCfgG4.js +0 -1
- package/dist/storybook/assets/test-utils-Cz8Y21vI.js +0 -9
- package/dist/storybook/assets/useCheckoutContext-C6NRdjfK.js +0 -27
- package/dist/storybook/favicon.svg +0 -1
- package/dist/storybook/iframe.html +0 -666
- package/dist/storybook/index.html +0 -177
- package/dist/storybook/index.json +0 -1
- package/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/project.json +0 -1
- package/dist/storybook/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/essentials-backgrounds-4/manager-bundle.js +0 -12
- package/dist/storybook/sb-addons/essentials-controls-1/manager-bundle.js +0 -405
- package/dist/storybook/sb-addons/essentials-docs-3/manager-bundle.js +0 -245
- package/dist/storybook/sb-addons/essentials-measure-7/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/essentials-outline-8/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/essentials-toolbars-6/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/essentials-viewport-5/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/interactions-9/manager-bundle.js +0 -222
- package/dist/storybook/sb-addons/links-10/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/storybook/sb-common-assets/favicon.svg +0 -1
- package/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/sb-manager/globals-module-info.js +0 -1052
- package/dist/storybook/sb-manager/globals-runtime.js +0 -42127
- package/dist/storybook/sb-manager/globals.js +0 -48
- package/dist/storybook/sb-manager/runtime.js +0 -12048
- package/dist/storybook/storybook-static/assets/APIs.en-BZfNNuoc.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-BZzPbEJW.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-Bf5J1Ifk.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-CVdvOQs6.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-CW0wl9xW.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-Ci2xcqKC.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-DSVQkUt3.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-DcEWunRx.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-DfWH0fys.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-TWb_-3VC.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-m6cq4XTv.js +0 -372
- package/dist/storybook/storybook-static/assets/APIs.en-nicPQ5AW.js +0 -372
- package/dist/storybook/storybook-static/assets/CheckoutPage-B959BwZO.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-BsnzMxJk.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-C21Znq4d.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-CDW7SRyI.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-CrHN6Fcv.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-DFb28rrp.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-DSLcTghb.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-DYMMhAMX.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-Dbzt3i55.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-DgZ1RopD.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-DvHYA1Jd.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage-d8MZfjpI.js +0 -3
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-BeknEgWZ.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-Bsh4jm31.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-Byu6MnFF.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-C5I1UUQc.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-C5WqMErV.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-CNVaEQvK.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-D87qzfwm.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-DLb_7NPf.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-DQ0u0fHa.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-DiHMI_iH.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-omEUF-3W.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.en-wyirg_zl.js +0 -147
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-B5y94bOo.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-B8Vyz9GJ.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BFpky7Cv.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BRP4VrvR.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BahbUp4O.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DAo0u2QI.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DFK1bMdr.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DLD3oWo_.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DeC6lyzr.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DvaZetee.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-G0sHl94m.js +0 -44
- package/dist/storybook/storybook-static/assets/CheckoutPage.stories-qqNMphqC.js +0 -44
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-1Ar-cfOi.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-B0J9WR4k.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-BE_XGTCZ.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-B_hoSOu5.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-Bly_OAJP.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-BorkAxO4.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-C2GhQi7e.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-CECFFm6s.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-D3zu28Rn.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DI94E3AI.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DSQioqvs.js +0 -1
- package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DVI1_7_g.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-2QJPlCmg.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-8VNcggT9.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-BMJEFVTk.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-Bg4oz9hS.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-Bq25x8qa.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-BrabumCC.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-BvF7SmOy.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-CckpRGsp.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-D80ZpldF.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-adeOUUPd.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-uXQeih6h.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.en-wshSoFMr.js +0 -211
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-B8CnjGCn.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-BQkpNbox.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-BdACubjk.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-BrF5j7zs.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-CKQKzMq0.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-Cmt6r_Qb.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-DhCrUQc1.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-F2GZKkIG.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-OyfGgjnr.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-V2NHLbZo.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-ZCeqtMGJ.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomCheckout.stories-rMIVoUs4.js +0 -6
- package/dist/storybook/storybook-static/assets/CustomerInfo-BMTfZ9z3.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-BqCSWi4I.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-BwyY9803.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-CPNuEjrH.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-CTx1dFS3.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-CYLNdAoo.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-CdeZHMcz.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-Cp0u57C5.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-D3WHpN32.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-DShSrjMR.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo-mKAI6gWW.js +0 -1
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BAbhNSal.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BBWobZ5V.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BeF8Yh1A.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BwCrEBgN.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-CYx1hKNg.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-D1l3Glaq.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-DB2C3zqQ.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-DJEbX7ej.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-Dv6cHWui.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-jpdDC3ta.js +0 -9
- package/dist/storybook/storybook-static/assets/CustomerInfo.stories-tyhy9PWf.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress-BBT_-q56.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-CD42v0od.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-CeuByf4d.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-DOxyPw17.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-DY5lFnTv.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-DaRy4l-D.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-Lfanl1PO.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-QAGxLlLf.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-TRtlNz2v.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-X81XGbKD.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress-zAvEPauR.js +0 -2
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-B-CLgnl5.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-BvAXTiNm.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-C1JtetLS.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-C8sE6JJZ.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CBScReyV.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CTyS3zFt.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CqmJ_Wn7.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-DHyw5QNl.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-FMwTSh9f.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-ex4l-pod.js +0 -9
- package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-vQ0cdVl6.js +0 -9
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-4VFo0TRH.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-BIza5p8d.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-BKek9MhZ.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-Bb5akATV.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-C4t3f4os.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-C9sW_L8N.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-CtrnOF1G.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-DU1kBIGp.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-DzgR8M-W.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-OiuU2wez.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-Q5WDl3Gp.js +0 -2
- package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-sE6BxCwu.js +0 -2
- package/dist/storybook/storybook-static/assets/Guide.en-BJ4qiYIc.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-BRVwtDXj.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-Boc44Lax.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-C21zCMX7.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-CKA244dX.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-CNP2Y7P4.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-CiR7CrYZ.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-Citkzdg9.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-DPJzC5RR.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-Dn9xb9YI.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-VxmWTbu0.js +0 -107
- package/dist/storybook/storybook-static/assets/Guide.en-XzxJQK_F.js +0 -107
- package/dist/storybook/storybook-static/assets/PaymentMethods-B1IKDQ7d.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-BFtlMopq.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-BNEEARzu.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-BnPZRrAs.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-Buladk2O.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-CBXk2f9N.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-DOuQM2jZ.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-DmV3o0ow.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-DxorWSOl.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-afz1CTO5.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-e9HqQtxN.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods-ro6Dfmcf.js +0 -2
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-6fZvfvMO.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-BSqcqZV0.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-Bc4jYrum.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-CELadurr.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-CcjSRFbb.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-ChiL9TJn.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-D1SSfWqv.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-DJpOtGJg.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-Dyg3R8Cs.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-U-xbCFtF.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-oiT2EQiz.js +0 -9
- package/dist/storybook/storybook-static/assets/PaymentMethods.stories-pOuLDPwE.js +0 -9
- package/dist/storybook/storybook-static/assets/QuickStart.en-8otT6VDx.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-B2goyY4Q.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-Bj-7Slt2.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-Bz56Z2wW.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-C1fKNHfm.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-CEFLfOWt.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-C_8MTb_6.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-Ct2dMZNT.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-D5OiYfrB.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-D6K1vnx2.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-DEcB3LF7.js +0 -136
- package/dist/storybook/storybook-static/assets/QuickStart.en-wgtxGAFt.js +0 -136
- package/dist/storybook/storybook-static/assets/ValidateInput-BKNagaQv.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-BMZhq5zE.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-C6pnsZFe.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-C71ymd_w.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-CECRKp4c.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-CXYuXafK.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-Cl2O4HCX.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-DcnOO9py.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-LNzX4jJP.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-np1-zwvJ.js +0 -2
- package/dist/storybook/storybook-static/assets/ValidateInput-sZgX3GCF.js +0 -2
- package/dist/storybook/storybook-static/assets/chunk-XP5HYGXS-BpfKkqn7.js +0 -1
- package/dist/storybook/storybook-static/assets/entry-preview-BAF1DioI.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-BAb-nh3P.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-BM0J-x_7.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-BQMc41xo.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-Bnn64O7J.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-C4SPQchM.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-CAnH1TUA.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-Dbi49YCK.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-DuGj42Nq.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-DxIUzVUA.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-GhM6ttN0.js +0 -2
- package/dist/storybook/storybook-static/assets/entry-preview-docs-CS87rPOt.js +0 -46
- package/dist/storybook/storybook-static/assets/entry-preview-hHv11-z5.js +0 -2
- package/dist/storybook/storybook-static/assets/iframe-BZKEX9PA.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-CEK4S1D5.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-CakT_Hx-.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-Ce3kgeV4.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-Ckasx_Sg.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-Crv4raYy.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-CueR_wS4.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-DWFwLXCc.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-DsSsblW_.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-PThBYPHV.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-SJLFWhX6.js +0 -211
- package/dist/storybook/storybook-static/assets/iframe-eGyOKkka.js +0 -211
- package/dist/storybook/storybook-static/assets/index-3vMs57rT.js +0 -575
- package/dist/storybook/storybook-static/assets/index-B7ki2Uzk.js +0 -24
- package/dist/storybook/storybook-static/assets/index-BlPVJQpb.js +0 -575
- package/dist/storybook/storybook-static/assets/index-Bz3Q1Yw_.js +0 -575
- package/dist/storybook/storybook-static/assets/index-CFngt2ij.css +0 -1
- package/dist/storybook/storybook-static/assets/index-CZFGp9Su.js +0 -575
- package/dist/storybook/storybook-static/assets/index-ChEI-nsM.js +0 -1
- package/dist/storybook/storybook-static/assets/index-CkNSuRJg.js +0 -575
- package/dist/storybook/storybook-static/assets/index-Cx4362C8.js +0 -575
- package/dist/storybook/storybook-static/assets/index-Cyd9I05m.js +0 -575
- package/dist/storybook/storybook-static/assets/index-D-Mha1DF.js +0 -11
- package/dist/storybook/storybook-static/assets/index-D66ljFJA.js +0 -575
- package/dist/storybook/storybook-static/assets/index-DRjF_FHU.js +0 -9
- package/dist/storybook/storybook-static/assets/index-DnrKlQ76.js +0 -575
- package/dist/storybook/storybook-static/assets/index-DoDFfets.js +0 -575
- package/dist/storybook/storybook-static/assets/index-DqxVLU6x.js +0 -240
- package/dist/storybook/storybook-static/assets/index-DrFu-skq.js +0 -6
- package/dist/storybook/storybook-static/assets/index-LRKEu_dQ.js +0 -575
- package/dist/storybook/storybook-static/assets/index-j2F2pkp4.js +0 -575
- package/dist/storybook/storybook-static/assets/jsx-runtime-DiklIkkE.js +0 -9
- package/dist/storybook/storybook-static/assets/preview-4XW-YDzX.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-884UjfA3.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-B8lJiyuQ.js +0 -34
- package/dist/storybook/storybook-static/assets/preview-BBWR9nbA.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-BWzBA1C2.js +0 -396
- package/dist/storybook/storybook-static/assets/preview-C1X5Ys-q.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-CbAwkmzD.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-CvbIS5ZJ.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-D2t1J3cT.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-DD_OYowb.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-DGJdQn9n.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-DGUiP6tS.js +0 -7
- package/dist/storybook/storybook-static/assets/preview-DHQbi4pV.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-DHrw3ha3.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-DJkpO_nB.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-DNROAajq.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-De1PUXkc.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-DyVoah3G.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-EmPtksy2.js +0 -2
- package/dist/storybook/storybook-static/assets/preview-NEoZ8N1F.js +0 -1
- package/dist/storybook/storybook-static/assets/preview-PsKPgAxG.js +0 -2
- package/dist/storybook/storybook-static/assets/react-18-2zMCfgG4.js +0 -1
- package/dist/storybook/storybook-static/assets/test-utils-Cz8Y21vI.js +0 -9
- package/dist/storybook/storybook-static/assets/useCheckoutContext-3YTrU8Qh.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-B8tsk5b5.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-BW2h13W8.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-BXtGY5u3.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-C6u4Rp5U.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-C7KjDyWW.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-CroxIBFh.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-Cyg-MLQs.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-DuJ1Ep0-.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-L3zhltsm.js +0 -27
- package/dist/storybook/storybook-static/assets/useCheckoutContext-w0N5TNgR.js +0 -27
- package/dist/storybook/storybook-static/favicon.svg +0 -1
- package/dist/storybook/storybook-static/iframe.html +0 -666
- package/dist/storybook/storybook-static/index.html +0 -177
- package/dist/storybook/storybook-static/index.json +0 -1
- package/dist/storybook/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/storybook-static/project.json +0 -1
- package/dist/storybook/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +0 -12
- package/dist/storybook/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -405
- package/dist/storybook/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +0 -245
- package/dist/storybook/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/interactions-9/manager-bundle.js +0 -222
- package/dist/storybook/storybook-static/sb-addons/links-10/manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/storybook/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/dist/storybook/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/storybook-static/sb-manager/globals-module-info.js +0 -1052
- package/dist/storybook/storybook-static/sb-manager/globals-runtime.js +0 -42127
- package/dist/storybook/storybook-static/sb-manager/globals.js +0 -48
- package/dist/storybook/storybook-static/sb-manager/runtime.js +0 -12048
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as s}from"./index-ChEI-nsM.js";import{M as r,C as i}from"./index-BlPVJQpb.js";import{C as d,D as c}from"./CustomCheckout.stories-DhCrUQc1.js";import"./index-DRjF_FHU.js";import"./iframe-CueR_wS4.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-BXtGY5u3.js";/* empty css */import"./CheckoutPage-d8MZfjpI.js";import"./CustomerInfo-BwyY9803.js";import"./ValidateInput-LNzX4jJP.js";import"./DeliveryAddress-QAGxLlLf.js";import"./PaymentMethods-afz1CTO5.js";function o(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...s(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{of:d,title:"Components/CustomCheckout",name:"CustomCheckout (English)"}),`
|
|
2
|
-
`,e.jsx(n.h1,{id:"customcheckout",children:"CustomCheckout"}),`
|
|
3
|
-
`,e.jsxs(n.p,{children:["While the ",e.jsx(n.code,{children:"CheckoutPage"})," component provides a complete, ready-to-use checkout solution, you may need more control over the layout, styling, or user experience. This guide explains how to build a completely custom checkout flow by using the library's hooks and context, while still leveraging the core functionality."]}),`
|
|
4
|
-
`,e.jsxs(n.p,{children:["The example above demonstrates a fully customized checkout page with custom styling, where we use the library's ",e.jsx(n.code,{children:"PaymentMethods"})," component (which is required) and build custom components for customer information, delivery address, and the submit button."]}),`
|
|
5
|
-
`,e.jsx(i,{of:c}),`
|
|
6
|
-
`,e.jsx(n.h3,{id:"overview",children:"Overview"}),`
|
|
7
|
-
`,e.jsx(n.p,{children:"When building a custom checkout flow, you'll need to:"}),`
|
|
8
|
-
`,e.jsxs(n.ol,{children:[`
|
|
9
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Wrap your components"})," in ",e.jsx(n.code,{children:"CheckoutProvider"})," to access the checkout context"]}),`
|
|
10
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Use hooks"})," (",e.jsx(n.code,{children:"useCheckoutContext"}),", ",e.jsx(n.code,{children:"useOrderSubmission"}),") to access and update form data"]}),`
|
|
11
|
-
`,e.jsxs(n.li,{children:[e.jsxs(n.strong,{children:["Use the ",e.jsx(n.code,{children:"PaymentMethods"})," component"]})," from the library (required - cannot be customized)"]}),`
|
|
12
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Update form data"})," through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"})," methods"]}),`
|
|
13
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Submit orders"})," using the ",e.jsx(n.code,{children:"useOrderSubmission"})," hook"]}),`
|
|
14
|
-
`]}),`
|
|
15
|
-
`,e.jsx(n.h3,{id:"understanding-form-data-structure",children:"Understanding Form Data Structure"}),`
|
|
16
|
-
`,e.jsxs(n.p,{children:["When customizing components, you need to ensure all required fields are updated correctly. The library uses two main data structures: ",e.jsx(n.code,{children:"CustomerInfo"})," and ",e.jsx(n.code,{children:"DeliveryAddress"}),". Understanding these structures is crucial for building custom components that work seamlessly with the checkout flow."]}),`
|
|
17
|
-
`,e.jsx(n.h4,{id:"customerinfo-fields",children:"CustomerInfo Fields"}),`
|
|
18
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CustomerInfo {
|
|
19
|
-
firstName: string; // First name (required)
|
|
20
|
-
lastName: string; // Last name (required)
|
|
21
|
-
email: string; // Email (required, must be valid email format)
|
|
22
|
-
phone: string; // Phone (required, E.164 format)
|
|
23
|
-
}
|
|
24
|
-
`})}),`
|
|
25
|
-
`,e.jsx(n.h4,{id:"deliveryaddress-fields",children:"DeliveryAddress Fields"}),`
|
|
26
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface DeliveryAddress {
|
|
27
|
-
country: string; // Country (required)
|
|
28
|
-
address: string; // Street address (required)
|
|
29
|
-
address2?: string; // Address line 2 (optional)
|
|
30
|
-
city: string; // City (required)
|
|
31
|
-
state: string; // State/Province (required)
|
|
32
|
-
zipCode: string; // Postal code (required)
|
|
33
|
-
}
|
|
34
|
-
`})}),`
|
|
35
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Important:"})," When customizing components, you must update all required fields through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"}),"."]}),`
|
|
36
|
-
`,e.jsx(n.h3,{id:"using-checkoutprovider",children:"Using CheckoutProvider"}),`
|
|
37
|
-
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," is the foundation of any custom checkout flow. It provides the context and state management needed for all checkout-related functionality. All your custom components must be wrapped within ",e.jsx(n.code,{children:"CheckoutProvider"}),"."]}),`
|
|
38
|
-
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," props are identical to ",e.jsx(n.code,{children:"CheckoutPage"}),", supporting the following:"]}),`
|
|
39
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Props:"})}),`
|
|
40
|
-
`,e.jsxs(n.ul,{children:[`
|
|
41
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"cart: CartItem[]"})," - Array of cart items. Each item must include ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),". ",e.jsx(n.strong,{children:"Note:"})," Even for a single product, pass it as an array with one item."]}),`
|
|
42
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"children: ReactNode"})," - Child components to be wrapped"]}),`
|
|
43
|
-
`]}),`
|
|
44
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Props:"})}),`
|
|
45
|
-
`,e.jsxs(n.ul,{children:[`
|
|
46
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onCheckoutInit?: () => void"})," - Callback function triggered when checkout initializes (immediately after component mount)"]}),`
|
|
47
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"googleApiKey?: string"})," - Google Places API Key for enabling address autocomplete functionality"]}),`
|
|
48
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when payment information is complete"]}),`
|
|
49
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when order is submitted"]}),`
|
|
50
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSuccess?: (orderCode: string, tradeCode?: string) => void"})," - Callback triggered when order succeeds"]}),`
|
|
51
|
-
`]}),`
|
|
52
|
-
`,e.jsxs(n.p,{children:["For detailed parameter descriptions, see ",e.jsx(n.a,{href:"./?path=/docs/documentation-usage-guide-checkoutpage--docs",children:"CheckoutPage Documentation"}),"."]}),`
|
|
53
|
-
`,e.jsx(n.h3,{id:"building-custom-components",children:"Building Custom Components"}),`
|
|
54
|
-
`,e.jsx(n.p,{children:"Now let's see how to build custom components step by step. Each component uses hooks to access and update the checkout state."}),`
|
|
55
|
-
`,e.jsx(n.h4,{id:"custom-customer-info-component",children:"Custom Customer Info Component"}),`
|
|
56
|
-
`,e.jsxs(n.p,{children:["Use the ",e.jsx(n.code,{children:"useCheckoutContext"})," hook to access ",e.jsx(n.code,{children:"customerInfo"})," and ",e.jsx(n.code,{children:"updateCustomerInfo"}),":"]}),`
|
|
57
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
|
|
58
|
-
|
|
59
|
-
function CustomCustomerInfo() {
|
|
60
|
-
const { customerInfo, updateCustomerInfo } = useCheckoutContext();
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div>
|
|
64
|
-
<input
|
|
65
|
-
value={customerInfo.firstName}
|
|
66
|
-
onChange={(e) => updateCustomerInfo({ firstName: e.target.value })}
|
|
67
|
-
placeholder="First Name"
|
|
68
|
-
/>
|
|
69
|
-
<input
|
|
70
|
-
value={customerInfo.lastName}
|
|
71
|
-
onChange={(e) => updateCustomerInfo({ lastName: e.target.value })}
|
|
72
|
-
placeholder="Last Name"
|
|
73
|
-
/>
|
|
74
|
-
<input
|
|
75
|
-
type="email"
|
|
76
|
-
value={customerInfo.email}
|
|
77
|
-
onChange={(e) => updateCustomerInfo({ email: e.target.value })}
|
|
78
|
-
placeholder="Email"
|
|
79
|
-
/>
|
|
80
|
-
<input
|
|
81
|
-
type="tel"
|
|
82
|
-
value={customerInfo.phone}
|
|
83
|
-
onChange={(e) => updateCustomerInfo({ phone: e.target.value })}
|
|
84
|
-
placeholder="Phone"
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
`})}),`
|
|
90
|
-
`,e.jsx(n.h4,{id:"custom-delivery-address-component",children:"Custom Delivery Address Component"}),`
|
|
91
|
-
`,e.jsxs(n.p,{children:["Similarly, use ",e.jsx(n.code,{children:"updateDeliveryAddress"})," to update address information:"]}),`
|
|
92
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
|
|
93
|
-
|
|
94
|
-
function CustomDeliveryAddress() {
|
|
95
|
-
const { deliveryAddress, updateDeliveryAddress } = useCheckoutContext();
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<div>
|
|
99
|
-
<input
|
|
100
|
-
value={deliveryAddress.country || ''}
|
|
101
|
-
onChange={(e) => updateDeliveryAddress({ country: e.target.value })}
|
|
102
|
-
placeholder="Country"
|
|
103
|
-
/>
|
|
104
|
-
<input
|
|
105
|
-
value={deliveryAddress.address || ''}
|
|
106
|
-
onChange={(e) => updateDeliveryAddress({ address: e.target.value })}
|
|
107
|
-
placeholder="Street Address"
|
|
108
|
-
/>
|
|
109
|
-
<input
|
|
110
|
-
value={deliveryAddress.city || ''}
|
|
111
|
-
onChange={(e) => updateDeliveryAddress({ city: e.target.value })}
|
|
112
|
-
placeholder="City"
|
|
113
|
-
/>
|
|
114
|
-
<input
|
|
115
|
-
value={deliveryAddress.state || ''}
|
|
116
|
-
onChange={(e) => updateDeliveryAddress({ state: e.target.value })}
|
|
117
|
-
placeholder="State/Province"
|
|
118
|
-
/>
|
|
119
|
-
<input
|
|
120
|
-
value={deliveryAddress.zipCode || ''}
|
|
121
|
-
onChange={(e) => updateDeliveryAddress({ zipCode: e.target.value })}
|
|
122
|
-
placeholder="ZIP Code"
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
`})}),`
|
|
128
|
-
`,e.jsx(n.h4,{id:"custom-submit-button-component",children:"Custom Submit Button Component"}),`
|
|
129
|
-
`,e.jsxs(n.p,{children:["Use ",e.jsx(n.code,{children:"useOrderSubmission"})," hook to handle order submission and ",e.jsx(n.code,{children:"isFormValid()"})," to check form validity:"]}),`
|
|
130
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext, useOrderSubmission } from '@clickaroo/checkout-ui';
|
|
131
|
-
|
|
132
|
-
function CustomSubmitButton() {
|
|
133
|
-
const { isFormValid } = useCheckoutContext();
|
|
134
|
-
const { isSubmitting, submitOrder } = useOrderSubmission();
|
|
135
|
-
|
|
136
|
-
const handleSubmit = async () => {
|
|
137
|
-
// Always check form validity before submitting
|
|
138
|
-
if (!isFormValid()) {
|
|
139
|
-
alert('Please complete all required fields');
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const result = await submitOrder();
|
|
144
|
-
|
|
145
|
-
if (result.success) {
|
|
146
|
-
console.log('Order successful', result.orderCode);
|
|
147
|
-
// Handle success (e.g., redirect to success page)
|
|
148
|
-
} else {
|
|
149
|
-
console.error('Order failed', result.message);
|
|
150
|
-
// Handle error (e.g., show error message)
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<button
|
|
156
|
-
onClick={handleSubmit}
|
|
157
|
-
disabled={!isFormValid() || isSubmitting}
|
|
158
|
-
>
|
|
159
|
-
{isSubmitting ? 'Processing...' : 'Complete Order'}
|
|
160
|
-
</button>
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
`})}),`
|
|
164
|
-
`,e.jsx(n.h3,{id:"complete-example",children:"Complete Example"}),`
|
|
165
|
-
`,e.jsx(n.p,{children:"Here's a complete example putting it all together:"}),`
|
|
166
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import {
|
|
167
|
-
CheckoutProvider,
|
|
168
|
-
PaymentMethods,
|
|
169
|
-
useCheckoutContext,
|
|
170
|
-
useOrderSubmission
|
|
171
|
-
} from '@clickaroo/checkout-ui';
|
|
172
|
-
|
|
173
|
-
// ... (include the custom components above)
|
|
174
|
-
|
|
175
|
-
function CustomCheckoutPage() {
|
|
176
|
-
const cart = [
|
|
177
|
-
{
|
|
178
|
-
sku: "TEST001",
|
|
179
|
-
offerPricePoint: "OPP-XXX",
|
|
180
|
-
title: "Product 1",
|
|
181
|
-
price: 99.99,
|
|
182
|
-
},
|
|
183
|
-
];
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<CheckoutProvider
|
|
187
|
-
cart={cart}
|
|
188
|
-
googleApiKey="YOUR_GOOGLE_API_KEY"
|
|
189
|
-
onCheckoutInit={() => {
|
|
190
|
-
console.log('Checkout initialized');
|
|
191
|
-
}}
|
|
192
|
-
onPaymentInfoComplete={(products, totalAmount) => {
|
|
193
|
-
console.log('Payment info complete', products, totalAmount);
|
|
194
|
-
}}
|
|
195
|
-
onOrderSubmit={(products, totalAmount) => {
|
|
196
|
-
console.log('Order submitted', products, totalAmount);
|
|
197
|
-
}}
|
|
198
|
-
onOrderSuccess={(orderCode, tradeCode) => {
|
|
199
|
-
console.log('Order successful', orderCode, tradeCode);
|
|
200
|
-
}}
|
|
201
|
-
>
|
|
202
|
-
<CustomCustomerInfo />
|
|
203
|
-
<CustomDeliveryAddress />
|
|
204
|
-
{/* PaymentMethods is required - cannot be customized */}
|
|
205
|
-
<PaymentMethods />
|
|
206
|
-
<CustomSubmitButton />
|
|
207
|
-
</CheckoutProvider>
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
`})}),`
|
|
211
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Key Point:"})," All components must be wrapped in ",e.jsx(n.code,{children:"CheckoutProvider"})]})]})}function A(t={}){const{wrapper:n}={...s(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{A as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-BW2h13W8.js";/* empty css */import{u as S}from"./CheckoutPage-DSLcTghb.js";import"./CustomerInfo-DShSrjMR.js";import"./DeliveryAddress-DY5lFnTv.js";import{P as j}from"./PaymentMethods-DmV3o0ow.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-CroxIBFh.js";/* empty css */import{u as S}from"./CheckoutPage-DFb28rrp.js";import"./CustomerInfo-BMTfZ9z3.js";import"./DeliveryAddress-DOxyPw17.js";import{P as j}from"./PaymentMethods-DxorWSOl.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-w0N5TNgR.js";/* empty css */import{u as S}from"./CheckoutPage-Dbzt3i55.js";import"./CustomerInfo-CYLNdAoo.js";import"./DeliveryAddress-BBT_-q56.js";import{P as j}from"./PaymentMethods-ro6Dfmcf.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-C7KjDyWW.js";/* empty css */import{u as S}from"./CheckoutPage-CDW7SRyI.js";import"./CustomerInfo-CPNuEjrH.js";import"./DeliveryAddress-CeuByf4d.js";import{P as j}from"./PaymentMethods-BFtlMopq.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-B8tsk5b5.js";/* empty css */import{u as S}from"./CheckoutPage-BsnzMxJk.js";import"./CustomerInfo-CTx1dFS3.js";import"./DeliveryAddress-X81XGbKD.js";import{P as j}from"./PaymentMethods-BNEEARzu.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-Cyg-MLQs.js";/* empty css */import{u as S}from"./CheckoutPage-B959BwZO.js";import"./CustomerInfo-CdeZHMcz.js";import"./DeliveryAddress-zAvEPauR.js";import{P as j}from"./PaymentMethods-DOuQM2jZ.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-BXtGY5u3.js";/* empty css */import{u as S}from"./CheckoutPage-d8MZfjpI.js";import"./CustomerInfo-BwyY9803.js";import"./DeliveryAddress-QAGxLlLf.js";import{P as j}from"./PaymentMethods-afz1CTO5.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-DiklIkkE.js";import{C as x,S as h,u as m,a as y,c as C,D as v}from"./useCheckoutContext-DuJ1Ep0-.js";/* empty css */import{u as S}from"./CheckoutPage-CrHN6Fcv.js";import"./CustomerInfo-D3WHpN32.js";import"./DeliveryAddress-Lfanl1PO.js";import{P as j}from"./PaymentMethods-e9HqQtxN.js";import{R as w}from"./index-DRjF_FHU.js";C(v);function z(){const{customerInfo:a,updateCustomerInfo:i}=m(),[e,s]=w.useState({}),t=(r,b)=>{const c=y.safeParse({...a,[r]:b});if(c.success)s(d=>{const l={...d};return delete l[r],l});else{const d=c.error.issues.find(l=>l.path.includes(r));s(d?l=>({...l,[r]:d.message}):l=>{const u={...l};return delete u[r],u})}};return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#9333ea"},children:"✨ Custom Customer Form ✨"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #faf5ff, #fdf2f8)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #e9d5ff",overflow:"hidden"},children:o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 First Name"}),o.jsx("input",{type:"text",value:a.firstName,onChange:r=>{i({firstName:r.target.value}),t("firstName",r.target.value)},onBlur:r=>{t("firstName",r.target.value),r.target.style.borderColor=e.firstName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.firstName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.firstName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter first name"}),e.firstName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.firstName})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#f3e8ff",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#7e22ce"},children:"👤 Last Name"}),o.jsx("input",{type:"text",value:a.lastName,onChange:r=>{i({lastName:r.target.value}),t("lastName",r.target.value)},onBlur:r=>{t("lastName",r.target.value),r.target.style.borderColor=e.lastName?"#ef4444":"#d8b4fe",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.lastName?"#ef4444":"#d8b4fe"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.lastName?"#ef4444":"#a855f7",r.target.style.boxShadow="0 0 0 4px rgba(192, 132, 252, 0.2)"},placeholder:"Enter last name"}),e.lastName&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.lastName})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📧 Email"}),o.jsx("input",{type:"email",value:a.email,onChange:r=>{i({email:r.target.value}),t("email",r.target.value)},onBlur:r=>{t("email",r.target.value),r.target.style.borderColor=e.email?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.email?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.email?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"your@email.com"}),e.email&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.email})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#fce7f3",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#be185d"},children:"📱 Phone"}),o.jsx("input",{type:"tel",value:a.phone,onChange:r=>{i({phone:r.target.value}),t("phone",r.target.value)},onBlur:r=>{t("phone",r.target.value),r.target.style.borderColor=e.phone?"#ef4444":"#f9a8d4",r.target.style.boxShadow="none"},style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:`2px solid ${e.phone?"#ef4444":"#f9a8d4"}`,borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:r=>{r.target.style.borderColor=e.phone?"#ef4444":"#ec4899",r.target.style.boxShadow="0 0 0 4px rgba(249, 168, 212, 0.2)"},placeholder:"+1 234 567 8900"}),e.phone&&o.jsx("div",{style:{color:"#ef4444",fontSize:"0.875rem",marginTop:"0.25rem"},children:e.phone})]})]})]})})]})}function k(){const{deliveryAddress:a,updateDeliveryAddress:i}=m();return o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#2563eb"},children:"📍 Custom Delivery Address"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #eff6ff, #ecfeff)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #bfdbfe",overflow:"hidden"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🌍 Country"}),o.jsx("input",{type:"text",value:a.country,onChange:e=>i({country:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter country"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"🏠 Street Address"}),o.jsx("input",{type:"text",value:a.address,onChange:e=>i({address:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter street address"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"1.5rem",width:"100%"},children:[o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🏙️ City"}),o.jsx("input",{type:"text",value:a.city,onChange:e=>i({city:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter city"})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#cffafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#155e75"},children:"🗺️ State/Province"}),o.jsx("input",{type:"text",value:a.state,onChange:e=>i({state:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #5eead4",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#14b8a6",e.target.style.boxShadow="0 0 0 4px rgba(94, 234, 212, 0.2)"},onBlur:e=>{e.target.style.borderColor="#5eead4",e.target.style.boxShadow="none"},placeholder:"Enter state"})]})]}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("label",{style:{position:"absolute",top:"-1rem",left:"0.75rem",backgroundColor:"#dbeafe",padding:"0.25rem 0.5rem",fontSize:"0.875rem",fontWeight:"600",color:"#1e40af"},children:"📮 Zip Code"}),o.jsx("input",{type:"text",value:a.zipCode,onChange:e=>i({zipCode:e.target.value}),style:{width:"100%",padding:"0.75rem 1rem",backgroundColor:"white",border:"2px solid #93c5fd",borderRadius:"0.75rem",fontSize:"1.125rem",outline:"none",boxSizing:"border-box"},onFocus:e=>{e.target.style.borderColor="#3b82f6",e.target.style.boxShadow="0 0 0 4px rgba(147, 197, 253, 0.2)"},onBlur:e=>{e.target.style.borderColor="#93c5fd",e.target.style.boxShadow="none"},placeholder:"Enter zip code"})]})]})})]})}function N(){const{isFormValid:a}=m(),{isSubmitting:i,submitOrder:e}=S(),s=async()=>{if(!a()){alert("Please complete all required fields");return}const r=await e();r.success?alert(`Order successful! Order Code: ${r.orderCode}`):alert(r.message)},t=a()&&!i;return o.jsxs("div",{style:{marginTop:"1.5rem"},children:[o.jsx("button",{onClick:s,disabled:!t,style:{width:"100%",padding:"1rem 1.5rem",borderRadius:"0.75rem",fontWeight:"bold",fontSize:"1.125rem",background:t?"linear-gradient(to right, #9333ea, #db2777)":"#9ca3af",color:t?"white":"#374151",cursor:t?"pointer":"not-allowed",border:"none",boxShadow:t?"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)":"none",transition:"all 0.3s",transform:"scale(1)"},onMouseEnter:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #7e22ce, #be185d)",r.currentTarget.style.transform="scale(1.05)")},onMouseLeave:r=>{t&&(r.currentTarget.style.background="linear-gradient(to right, #9333ea, #db2777)",r.currentTarget.style.transform="scale(1)")},onMouseDown:r=>{t&&(r.currentTarget.style.transform="scale(0.95)")},onMouseUp:r=>{t&&(r.currentTarget.style.transform="scale(1.05)")},children:i?o.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},children:[o.jsxs("svg",{style:{animation:"spin 1s linear infinite",height:"1.25rem",width:"1.25rem"},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{style:{opacity:.25},cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{style:{opacity:.75},fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):"🎉 Complete Order"}),o.jsx("style",{children:`
|
|
2
|
-
@keyframes spin {
|
|
3
|
-
from { transform: rotate(0deg); }
|
|
4
|
-
to { transform: rotate(360deg); }
|
|
5
|
-
}
|
|
6
|
-
`})]})}function E(){const a=[{sku:"TEST001",offerPricePoint:h.SINGLE,title:"Product Title",price:99.99}];return o.jsx(x,{cart:a,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.5rem",maxWidth:"42rem",margin:"0 auto",padding:"1rem",width:"100%",boxSizing:"border-box"},children:[o.jsx(z,{}),o.jsx(k,{}),o.jsxs("div",{style:{marginBottom:"1.5rem"},children:[o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:"bold",marginBottom:"1.5rem",color:"#059669"},children:"💳 Payment Methods"}),o.jsx("div",{style:{background:"linear-gradient(to bottom right, #ecfdf5, #d1fae5)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"2px solid #86efac",overflow:"hidden"},children:o.jsx(j,{showText:!1})})]}),o.jsx(N,{})]})})}const R={component:E,title:"Components/CustomCheckout",parameters:{layout:"padded",docs:{description:{component:"Example of mixing library components with custom components. Demonstrates how to combine library components like CustomerInfo, DeliveryAddress, and PaymentMethods with custom components for a fully customized checkout experience."}}}},n={};var g,p,f;n.parameters={...n.parameters,docs:{...(g=n.parameters)==null?void 0:g.docs,source:{originalSource:"{}",...(f=(p=n.parameters)==null?void 0:p.docs)==null?void 0:f.source}}};const T=["Default"],M=Object.freeze(Object.defineProperty({__proto__:null,Default:n,__namedExportsOrder:T,default:R},Symbol.toStringTag,{value:"Module"}));export{M as C,n as D};
|