@clickaroo/checkout-ui 0.1.5-beta → 0.1.6-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.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,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{g as w,b as C,C as v}from"./useCheckoutContext-C6u4Rp5U.js";import{C as N}from"./CustomerInfo-Cp0u57C5.js";import{D as P}from"./DeliveryAddress-CD42v0od.js";import{u as _,P as O}from"./PaymentMethods-BnPZRrAs.js";import{r as g}from"./index-DRjF_FHU.js";const k=({message:r="Processing...",show:o})=>o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center p-8 bg-white rounded-2xl shadow-2xl max-w-sm mx-4",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 rounded-full"}),e.jsx("div",{className:"absolute top-0 left-0 w-16 h-16 border-4 border-solid border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-2 h-2 bg-blue-500 rounded-full transform -translate-x-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please wait while we process your request..."})]}),e.jsxs("div",{className:"flex space-x-1 mt-6",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]}):null;k.__docgenInfo={description:"",methods:[],displayName:"FullScreenLoading",props:{message:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Processing..."',computed:!1}},show:{required:!0,tsType:{name:"boolean"},description:""}}};const I=async r=>{try{console.log("Creating order with data:",r);const o=await fetch(`${w()}/orders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await o.json();return o.ok?(console.log("Order created successfully:",l),{success:!0,data:l}):(console.error("Order creation failed:",l),{success:!1,error:{message:l.message||`HTTP ${o.status}: ${o.statusText}`,code:l.code,details:l}})}catch(o){return console.error("Network error creating order:",o),{success:!1,error:{message:o instanceof Error?o.message:"Network error occurred",details:{originalError:o}}}}};var b=(r=>(r.PENDING="pending",r.PAID="paid",r.PARTIALLY_PAID="partially_paid",r.FAILED="failed",r))(b||{});const S=()=>{const[r,o]=g.useState(!1),l=C(),x=g.useCallback(async(u,c,t)=>{console.log("Creating confirmation token with:",{stripeExists:!!u,elementsExists:!!c});try{console.log("Calling elements.submit()...");const{error:i}=await c.submit();if(i)return console.error("Elements submit error:",i),{error:i.message};console.log("Elements submitted successfully, creating confirmation token...");const{confirmationToken:d,error:n}=await u.createConfirmationToken({elements:c,params:{payment_method_data:{billing_details:{name:`${t.firstName} ${t.lastName}`,email:t.email,phone:t.phone}}}});return n?(console.error("Confirmation token creation error:",n),{error:n.message}):d?(console.log("Confirmation token created successfully:",d.id),{token:d.id}):{error:"Failed to create confirmation token"}}catch(i){return console.error("Error creating confirmation token:",i),{error:"Failed to create confirmation token"}}},[]),h=g.useCallback(u=>{const{customerInfo:c,deliveryAddress:t,clickarooToken:i,cart:d}=l,n=typeof window<"u"?window.location.href:"",f=`${c.firstName} ${c.lastName}`.trim(),p=i&&i.trim()!==""?i:null,a={country:t.country,state:t.state,city:t.city,address1:t.address,zip:t.zipCode};t.address2&&t.address2.trim()!==""&&(a.address2=t.address2);const s={clickaroo_token:p,customer_info:{name:f,email:c.email,phone:c.phone},shipping_address:a,source_url:n,remark:"",metadata:{sub4:typeof window<"u"&&new URLSearchParams(window.location.search).get("sub4")||""},payment:{type:"stripe",data:{confirmation_token_id:u,payment_method_types:["card"]}}};return s.items=d.map(y=>({sku:y.sku,price_point_code:y.offerPricePoint})),s.metadata.products=d,console.log("Built order data:",s),s},[l]),m=g.useCallback(async()=>{var d;const{stripeState:u,customerInfo:c}=l,{stripe:t,elements:i}=u;if(!t||!i)return{success:!1,message:"Payment system not ready"};o(!0);try{console.log("Creating confirmation token...");const{token:n,error:f}=await x(t,i,c);if(f)return console.error("Failed to create confirmation token:",f),{success:!1,message:`Payment processing failed: ${f}`};if(!n)return{success:!1,message:"Failed to get payment token, please try again."};console.log("Confirmation token created successfully:",n);const p=h(n);console.log("Submitting order...");const a=await I(p);if(!a.success)return console.error("Order submission failed:",a.error),{success:!1,message:`Order submission failed: ${((d=a.error)==null?void 0:d.message)||"Unknown error"}`};const{data:s}=a;return console.log("Order submitted successfully:",s),(s==null?void 0:s.payment_status)===b.PAID?{success:!0,message:"🎉 Payment successful!",orderCode:s.order_code,tradeCode:s.order_trade_code}:(s==null?void 0:s.payment_status)===b.PENDING?{success:!1,message:"Payment was not successful. Please try a different payment method or card.",orderCode:s.order_code}:{success:!1,message:`Payment failed, status: ${(s==null?void 0:s.payment_status)||"Unknown"}. Please try again.`,orderCode:s==null?void 0:s.order_code}}catch(n){return console.error("Error occurred during order process:",n),{success:!1,message:"An error occurred during the order process, please try again."}}finally{o(!1)}},[l,x,h]);return{isSubmitting:r,submitOrder:m}},j=()=>{const{isFormValid:r,onOrderSubmit:o,onOrderSuccess:l}=C(),{checkoutProducts:x,totalAmount:h}=_(),{isSubmitting:m,submitOrder:u}=S(),[c,t]=g.useState(""),[i,d]=g.useState(""),[n,f]=g.useState(!1),p=async()=>{if(t(""),d(""),!r()){t("Please fill in all information and make sure it is valid!");return}o==null||o(x,h);const a=await u();if(a.success){f(!0);let s=a.message;a.orderCode&&(s+=`
|
|
2
|
-
Order Number: ${a.orderCode}`),a.tradeCode&&(s+=`
|
|
3
|
-
Transaction ID: ${a.tradeCode}`),d(s),a.orderCode&&(l==null||l(a.orderCode,a.tradeCode))}else t(a.message)};return e.jsxs("div",{className:"clickaroo-checkout-ui w-full flex flex-col items-center",children:[e.jsxs("button",{type:"button",onClick:p,className:`w-full outline-none border-none text-white font-bold text-center text-lg py-5 rounded-md mb-4 transition-all duration-300 relative overflow-hidden ${r()&&!m&&!n?"bg-black hover:opacity-70":n?"bg-green-500 cursor-not-allowed":m?"bg-blue-600 cursor-not-allowed":"bg-gray-400 cursor-not-allowed"}`,disabled:!r()||m||n,children:[m&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 via-blue-500 to-blue-600 bg-[length:200%_100%] animate-[shimmer_2s_ease-in-out_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center justify-center",children:n?"✓ Order Complete - Redirecting...":m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"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"})]}),i&&e.jsx("div",{className:"w-full mb-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-green-700 whitespace-pre-line m-0",children:i})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>d(""),className:"border-none inline-flex bg-green-50 rounded-md p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-green-50 focus:ring-green-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),c&&e.jsx("div",{className:"w-full mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 whitespace-pre-line",children:c})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>t(""),className:"inline-flex bg-red-50 rounded-md p-1.5 text-[#df1b41] hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),e.jsx("div",{className:"flex items-center text-grey text-sm md:text-base",children:e.jsx("span",{className:"text-center",children:"All transactions are SSL secure and encrypted"})}),e.jsx(k,{show:m,message:"Processing Your Order"})]})};j.__docgenInfo={description:"",methods:[],displayName:"SubmitButton"};const L=r=>e.jsx(v,{cart:r.cart,onCheckoutInit:r.onCheckoutInit,onPaymentInfoComplete:r.onPaymentInfoComplete,onOrderSubmit:r.onOrderSubmit,onOrderSuccess:r.onOrderSuccess,googleApiKey:r.googleApiKey,children:e.jsxs("div",{className:"clickaroo-checkout-ui flex flex-col gap-5",children:[e.jsx(O,{}),e.jsx(N,{}),e.jsx(P,{}),e.jsx(j,{})]})});L.__docgenInfo={description:"",methods:[],displayName:"CheckoutPage",props:{cart:{required:!0,tsType:{name:"Array",elements:[{name:"CartItem"}],raw:"CartItem[]"},description:""},onCheckoutInit:{required:!1,tsType:{name:"OnCheckoutInitCallback"},description:""},onPaymentInfoComplete:{required:!1,tsType:{name:"OnPaymentInfoCompleteCallback"},description:""},onOrderSubmit:{required:!1,tsType:{name:"OnOrderSubmitCallback"},description:""},onOrderSuccess:{required:!1,tsType:{name:"OnOrderSuccessCallback"},description:""},googleApiKey:{required:!1,tsType:{name:"string"},description:""}}};export{L as C,S as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{g as w,b as C,C as v}from"./useCheckoutContext-w0N5TNgR.js";import{C as N}from"./CustomerInfo-CYLNdAoo.js";import{D as P}from"./DeliveryAddress-BBT_-q56.js";import{u as _,P as O}from"./PaymentMethods-ro6Dfmcf.js";import{r as g}from"./index-DRjF_FHU.js";const k=({message:r="Processing...",show:o})=>o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center p-8 bg-white rounded-2xl shadow-2xl max-w-sm mx-4",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 rounded-full"}),e.jsx("div",{className:"absolute top-0 left-0 w-16 h-16 border-4 border-solid border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-2 h-2 bg-blue-500 rounded-full transform -translate-x-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please wait while we process your request..."})]}),e.jsxs("div",{className:"flex space-x-1 mt-6",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]}):null;k.__docgenInfo={description:"",methods:[],displayName:"FullScreenLoading",props:{message:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Processing..."',computed:!1}},show:{required:!0,tsType:{name:"boolean"},description:""}}};const I=async r=>{try{console.log("Creating order with data:",r);const o=await fetch(`${w()}/orders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await o.json();return o.ok?(console.log("Order created successfully:",l),{success:!0,data:l}):(console.error("Order creation failed:",l),{success:!1,error:{message:l.message||`HTTP ${o.status}: ${o.statusText}`,code:l.code,details:l}})}catch(o){return console.error("Network error creating order:",o),{success:!1,error:{message:o instanceof Error?o.message:"Network error occurred",details:{originalError:o}}}}};var b=(r=>(r.PENDING="pending",r.PAID="paid",r.PARTIALLY_PAID="partially_paid",r.FAILED="failed",r))(b||{});const S=()=>{const[r,o]=g.useState(!1),l=C(),x=g.useCallback(async(u,c,t)=>{console.log("Creating confirmation token with:",{stripeExists:!!u,elementsExists:!!c});try{console.log("Calling elements.submit()...");const{error:i}=await c.submit();if(i)return console.error("Elements submit error:",i),{error:i.message};console.log("Elements submitted successfully, creating confirmation token...");const{confirmationToken:d,error:n}=await u.createConfirmationToken({elements:c,params:{payment_method_data:{billing_details:{name:`${t.firstName} ${t.lastName}`,email:t.email,phone:t.phone}}}});return n?(console.error("Confirmation token creation error:",n),{error:n.message}):d?(console.log("Confirmation token created successfully:",d.id),{token:d.id}):{error:"Failed to create confirmation token"}}catch(i){return console.error("Error creating confirmation token:",i),{error:"Failed to create confirmation token"}}},[]),h=g.useCallback(u=>{const{customerInfo:c,deliveryAddress:t,clickarooToken:i,cart:d}=l,n=typeof window<"u"?window.location.href:"",f=`${c.firstName} ${c.lastName}`.trim(),p=i&&i.trim()!==""?i:null,a={country:t.country,state:t.state,city:t.city,address1:t.address,zip:t.zipCode};t.address2&&t.address2.trim()!==""&&(a.address2=t.address2);const s={clickaroo_token:p,customer_info:{name:f,email:c.email,phone:c.phone},shipping_address:a,source_url:n,remark:"",metadata:{sub4:typeof window<"u"&&new URLSearchParams(window.location.search).get("sub4")||""},payment:{type:"stripe",data:{confirmation_token_id:u,payment_method_types:["card"]}}};return s.items=d.map(y=>({sku:y.sku,price_point_code:y.offerPricePoint})),s.metadata.products=d,console.log("Built order data:",s),s},[l]),m=g.useCallback(async()=>{var d;const{stripeState:u,customerInfo:c}=l,{stripe:t,elements:i}=u;if(!t||!i)return{success:!1,message:"Payment system not ready"};o(!0);try{console.log("Creating confirmation token...");const{token:n,error:f}=await x(t,i,c);if(f)return console.error("Failed to create confirmation token:",f),{success:!1,message:`Payment processing failed: ${f}`};if(!n)return{success:!1,message:"Failed to get payment token, please try again."};console.log("Confirmation token created successfully:",n);const p=h(n);console.log("Submitting order...");const a=await I(p);if(!a.success)return console.error("Order submission failed:",a.error),{success:!1,message:`Order submission failed: ${((d=a.error)==null?void 0:d.message)||"Unknown error"}`};const{data:s}=a;return console.log("Order submitted successfully:",s),(s==null?void 0:s.payment_status)===b.PAID?{success:!0,message:"🎉 Payment successful!",orderCode:s.order_code,tradeCode:s.order_trade_code}:(s==null?void 0:s.payment_status)===b.PENDING?{success:!1,message:"Payment was not successful. Please try a different payment method or card.",orderCode:s.order_code}:{success:!1,message:`Payment failed, status: ${(s==null?void 0:s.payment_status)||"Unknown"}. Please try again.`,orderCode:s==null?void 0:s.order_code}}catch(n){return console.error("Error occurred during order process:",n),{success:!1,message:"An error occurred during the order process, please try again."}}finally{o(!1)}},[l,x,h]);return{isSubmitting:r,submitOrder:m}},j=()=>{const{isFormValid:r,onOrderSubmit:o,onOrderSuccess:l}=C(),{checkoutProducts:x,totalAmount:h}=_(),{isSubmitting:m,submitOrder:u}=S(),[c,t]=g.useState(""),[i,d]=g.useState(""),[n,f]=g.useState(!1),p=async()=>{if(t(""),d(""),!r()){t("Please fill in all information and make sure it is valid!");return}o==null||o(x,h);const a=await u();if(a.success){f(!0);let s=a.message;a.orderCode&&(s+=`
|
|
2
|
-
Order Number: ${a.orderCode}`),a.tradeCode&&(s+=`
|
|
3
|
-
Transaction ID: ${a.tradeCode}`),d(s),a.orderCode&&(l==null||l(a.orderCode,a.tradeCode))}else t(a.message)};return e.jsxs("div",{className:"clickaroo-checkout-ui w-full flex flex-col items-center",children:[e.jsxs("button",{type:"button",onClick:p,className:`w-full outline-none border-none text-white font-bold text-center text-lg py-5 rounded-md mb-4 transition-all duration-300 relative overflow-hidden ${r()&&!m&&!n?"bg-black hover:opacity-70":n?"bg-green-500 cursor-not-allowed":m?"bg-blue-600 cursor-not-allowed":"bg-gray-400 cursor-not-allowed"}`,disabled:!r()||m||n,children:[m&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 via-blue-500 to-blue-600 bg-[length:200%_100%] animate-[shimmer_2s_ease-in-out_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center justify-center",children:n?"✓ Order Complete - Redirecting...":m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"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"})]}),i&&e.jsx("div",{className:"w-full mb-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-green-700 whitespace-pre-line m-0",children:i})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>d(""),className:"border-none inline-flex bg-green-50 rounded-md p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-green-50 focus:ring-green-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),c&&e.jsx("div",{className:"w-full mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 whitespace-pre-line",children:c})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>t(""),className:"inline-flex bg-red-50 rounded-md p-1.5 text-[#df1b41] hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),e.jsx("div",{className:"flex items-center text-grey text-sm md:text-base",children:e.jsx("span",{className:"text-center",children:"All transactions are SSL secure and encrypted"})}),e.jsx(k,{show:m,message:"Processing Your Order"})]})};j.__docgenInfo={description:"",methods:[],displayName:"SubmitButton"};const L=r=>e.jsx(v,{cart:r.cart,onCheckoutInit:r.onCheckoutInit,onPaymentInfoComplete:r.onPaymentInfoComplete,onOrderSubmit:r.onOrderSubmit,onOrderSuccess:r.onOrderSuccess,googleApiKey:r.googleApiKey,children:e.jsxs("div",{className:"clickaroo-checkout-ui flex flex-col gap-5",children:[e.jsx(O,{}),e.jsx(N,{}),e.jsx(P,{}),e.jsx(j,{})]})});L.__docgenInfo={description:"",methods:[],displayName:"CheckoutPage",props:{cart:{required:!0,tsType:{name:"Array",elements:[{name:"CartItem"}],raw:"CartItem[]"},description:""},onCheckoutInit:{required:!1,tsType:{name:"OnCheckoutInitCallback"},description:""},onPaymentInfoComplete:{required:!1,tsType:{name:"OnPaymentInfoCompleteCallback"},description:""},onOrderSubmit:{required:!1,tsType:{name:"OnOrderSubmitCallback"},description:""},onOrderSuccess:{required:!1,tsType:{name:"OnOrderSuccessCallback"},description:""},googleApiKey:{required:!1,tsType:{name:"string"},description:""}}};export{L as C,S as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{g as w,b as C,C as v}from"./useCheckoutContext-3YTrU8Qh.js";import{C as N}from"./CustomerInfo-mKAI6gWW.js";import{D as P}from"./DeliveryAddress-DaRy4l-D.js";import{u as _,P as O}from"./PaymentMethods-Buladk2O.js";import{r as g}from"./index-DRjF_FHU.js";const k=({message:r="Processing...",show:o})=>o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center p-8 bg-white rounded-2xl shadow-2xl max-w-sm mx-4",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 rounded-full"}),e.jsx("div",{className:"absolute top-0 left-0 w-16 h-16 border-4 border-solid border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-2 h-2 bg-blue-500 rounded-full transform -translate-x-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please wait while we process your request..."})]}),e.jsxs("div",{className:"flex space-x-1 mt-6",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]}):null;k.__docgenInfo={description:"",methods:[],displayName:"FullScreenLoading",props:{message:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Processing..."',computed:!1}},show:{required:!0,tsType:{name:"boolean"},description:""}}};const I=async r=>{try{console.log("Creating order with data:",r);const o=await fetch(`${w()}/orders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await o.json();return o.ok?(console.log("Order created successfully:",l),{success:!0,data:l}):(console.error("Order creation failed:",l),{success:!1,error:{message:l.message||`HTTP ${o.status}: ${o.statusText}`,code:l.code,details:l}})}catch(o){return console.error("Network error creating order:",o),{success:!1,error:{message:o instanceof Error?o.message:"Network error occurred",details:{originalError:o}}}}};var b=(r=>(r.PENDING="pending",r.PAID="paid",r.PARTIALLY_PAID="partially_paid",r.FAILED="failed",r))(b||{});const S=()=>{const[r,o]=g.useState(!1),l=C(),x=g.useCallback(async(u,c,t)=>{console.log("Creating confirmation token with:",{stripeExists:!!u,elementsExists:!!c});try{console.log("Calling elements.submit()...");const{error:i}=await c.submit();if(i)return console.error("Elements submit error:",i),{error:i.message};console.log("Elements submitted successfully, creating confirmation token...");const{confirmationToken:d,error:n}=await u.createConfirmationToken({elements:c,params:{payment_method_data:{billing_details:{name:`${t.firstName} ${t.lastName}`,email:t.email,phone:t.phone}}}});return n?(console.error("Confirmation token creation error:",n),{error:n.message}):d?(console.log("Confirmation token created successfully:",d.id),{token:d.id}):{error:"Failed to create confirmation token"}}catch(i){return console.error("Error creating confirmation token:",i),{error:"Failed to create confirmation token"}}},[]),h=g.useCallback(u=>{const{customerInfo:c,deliveryAddress:t,clickarooToken:i,cart:d}=l,n=typeof window<"u"?window.location.href:"",f=`${c.firstName} ${c.lastName}`.trim(),p=i&&i.trim()!==""?i:null,a={country:t.country,state:t.state,city:t.city,address1:t.address,zip:t.zipCode};t.address2&&t.address2.trim()!==""&&(a.address2=t.address2);const s={clickaroo_token:p,customer_info:{name:f,email:c.email,phone:c.phone},shipping_address:a,source_url:n,remark:"",metadata:{sub4:typeof window<"u"&&new URLSearchParams(window.location.search).get("sub4")||""},payment:{type:"stripe",data:{confirmation_token_id:u,payment_method_types:["card"]}}};return s.items=d.map(y=>({sku:y.sku,price_point_code:y.offerPricePoint})),s.metadata.products=d,console.log("Built order data:",s),s},[l]),m=g.useCallback(async()=>{var d;const{stripeState:u,customerInfo:c}=l,{stripe:t,elements:i}=u;if(!t||!i)return{success:!1,message:"Payment system not ready"};o(!0);try{console.log("Creating confirmation token...");const{token:n,error:f}=await x(t,i,c);if(f)return console.error("Failed to create confirmation token:",f),{success:!1,message:`Payment processing failed: ${f}`};if(!n)return{success:!1,message:"Failed to get payment token, please try again."};console.log("Confirmation token created successfully:",n);const p=h(n);console.log("Submitting order...");const a=await I(p);if(!a.success)return console.error("Order submission failed:",a.error),{success:!1,message:`Order submission failed: ${((d=a.error)==null?void 0:d.message)||"Unknown error"}`};const{data:s}=a;return console.log("Order submitted successfully:",s),(s==null?void 0:s.payment_status)===b.PAID?{success:!0,message:"🎉 Payment successful!",orderCode:s.order_code,tradeCode:s.order_trade_code}:(s==null?void 0:s.payment_status)===b.PENDING?{success:!1,message:"Payment was not successful. Please try a different payment method or card.",orderCode:s.order_code}:{success:!1,message:`Payment failed, status: ${(s==null?void 0:s.payment_status)||"Unknown"}. Please try again.`,orderCode:s==null?void 0:s.order_code}}catch(n){return console.error("Error occurred during order process:",n),{success:!1,message:"An error occurred during the order process, please try again."}}finally{o(!1)}},[l,x,h]);return{isSubmitting:r,submitOrder:m}},j=()=>{const{isFormValid:r,onOrderSubmit:o,onOrderSuccess:l}=C(),{checkoutProducts:x,totalAmount:h}=_(),{isSubmitting:m,submitOrder:u}=S(),[c,t]=g.useState(""),[i,d]=g.useState(""),[n,f]=g.useState(!1),p=async()=>{if(t(""),d(""),!r()){t("Please fill in all information and make sure it is valid!");return}o==null||o(x,h);const a=await u();if(a.success){f(!0);let s=a.message;a.orderCode&&(s+=`
|
|
2
|
-
Order Number: ${a.orderCode}`),a.tradeCode&&(s+=`
|
|
3
|
-
Transaction ID: ${a.tradeCode}`),d(s),a.orderCode&&(l==null||l(a.orderCode,a.tradeCode))}else t(a.message)};return e.jsxs("div",{className:"clickaroo-checkout-ui w-full flex flex-col items-center",children:[e.jsxs("button",{type:"button",onClick:p,className:`w-full outline-none border-none text-white font-bold text-center text-lg py-5 rounded-md mb-4 transition-all duration-300 relative overflow-hidden ${r()&&!m&&!n?"bg-black hover:opacity-70":n?"bg-green-500 cursor-not-allowed":m?"bg-blue-600 cursor-not-allowed":"bg-gray-400 cursor-not-allowed"}`,disabled:!r()||m||n,children:[m&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 via-blue-500 to-blue-600 bg-[length:200%_100%] animate-[shimmer_2s_ease-in-out_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center justify-center",children:n?"✓ Order Complete - Redirecting...":m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"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"})]}),i&&e.jsx("div",{className:"w-full mb-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-green-700 whitespace-pre-line m-0",children:i})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>d(""),className:"border-none inline-flex bg-green-50 rounded-md p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-green-50 focus:ring-green-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),c&&e.jsx("div",{className:"w-full mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 whitespace-pre-line",children:c})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>t(""),className:"inline-flex bg-red-50 rounded-md p-1.5 text-[#df1b41] hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),e.jsx("div",{className:"flex items-center text-grey text-sm md:text-base",children:e.jsx("span",{className:"text-center",children:"All transactions are SSL secure and encrypted"})}),e.jsx(k,{show:m,message:"Processing Your Order"})]})};j.__docgenInfo={description:"",methods:[],displayName:"SubmitButton"};const L=r=>e.jsx(v,{cart:r.cart,onCheckoutInit:r.onCheckoutInit,onPaymentInfoComplete:r.onPaymentInfoComplete,onOrderSubmit:r.onOrderSubmit,onOrderSuccess:r.onOrderSuccess,googleApiKey:r.googleApiKey,children:e.jsxs("div",{className:"clickaroo-checkout-ui flex flex-col gap-5",children:[e.jsx(O,{}),e.jsx(N,{}),e.jsx(P,{}),e.jsx(j,{})]})});L.__docgenInfo={description:"",methods:[],displayName:"CheckoutPage",props:{cart:{required:!0,tsType:{name:"Array",elements:[{name:"CartItem"}],raw:"CartItem[]"},description:""},onCheckoutInit:{required:!1,tsType:{name:"OnCheckoutInitCallback"},description:""},onPaymentInfoComplete:{required:!1,tsType:{name:"OnPaymentInfoCompleteCallback"},description:""},onOrderSubmit:{required:!1,tsType:{name:"OnOrderSubmitCallback"},description:""},onOrderSuccess:{required:!1,tsType:{name:"OnOrderSuccessCallback"},description:""},googleApiKey:{required:!1,tsType:{name:"string"},description:""}}};export{L as C,S as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{g as w,b as C,C as v}from"./useCheckoutContext-L3zhltsm.js";import{C as N}from"./CustomerInfo-BqCSWi4I.js";import{D as P}from"./DeliveryAddress-TRtlNz2v.js";import{u as _,P as O}from"./PaymentMethods-CBXk2f9N.js";import{r as g}from"./index-DRjF_FHU.js";const k=({message:r="Processing...",show:o})=>o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center p-8 bg-white rounded-2xl shadow-2xl max-w-sm mx-4",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 rounded-full"}),e.jsx("div",{className:"absolute top-0 left-0 w-16 h-16 border-4 border-solid border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-2 h-2 bg-blue-500 rounded-full transform -translate-x-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please wait while we process your request..."})]}),e.jsxs("div",{className:"flex space-x-1 mt-6",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]}):null;k.__docgenInfo={description:"",methods:[],displayName:"FullScreenLoading",props:{message:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Processing..."',computed:!1}},show:{required:!0,tsType:{name:"boolean"},description:""}}};const I=async r=>{try{console.log("Creating order with data:",r);const o=await fetch(`${w()}/orders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await o.json();return o.ok?(console.log("Order created successfully:",l),{success:!0,data:l}):(console.error("Order creation failed:",l),{success:!1,error:{message:l.message||`HTTP ${o.status}: ${o.statusText}`,code:l.code,details:l}})}catch(o){return console.error("Network error creating order:",o),{success:!1,error:{message:o instanceof Error?o.message:"Network error occurred",details:{originalError:o}}}}};var b=(r=>(r.PENDING="pending",r.PAID="paid",r.PARTIALLY_PAID="partially_paid",r.FAILED="failed",r))(b||{});const S=()=>{const[r,o]=g.useState(!1),l=C(),x=g.useCallback(async(u,c,t)=>{console.log("Creating confirmation token with:",{stripeExists:!!u,elementsExists:!!c});try{console.log("Calling elements.submit()...");const{error:i}=await c.submit();if(i)return console.error("Elements submit error:",i),{error:i.message};console.log("Elements submitted successfully, creating confirmation token...");const{confirmationToken:d,error:n}=await u.createConfirmationToken({elements:c,params:{payment_method_data:{billing_details:{name:`${t.firstName} ${t.lastName}`,email:t.email,phone:t.phone}}}});return n?(console.error("Confirmation token creation error:",n),{error:n.message}):d?(console.log("Confirmation token created successfully:",d.id),{token:d.id}):{error:"Failed to create confirmation token"}}catch(i){return console.error("Error creating confirmation token:",i),{error:"Failed to create confirmation token"}}},[]),h=g.useCallback(u=>{const{customerInfo:c,deliveryAddress:t,clickarooToken:i,cart:d}=l,n=typeof window<"u"?window.location.href:"",f=`${c.firstName} ${c.lastName}`.trim(),p=i&&i.trim()!==""?i:null,a={country:t.country,state:t.state,city:t.city,address1:t.address,zip:t.zipCode};t.address2&&t.address2.trim()!==""&&(a.address2=t.address2);const s={clickaroo_token:p,customer_info:{name:f,email:c.email,phone:c.phone},shipping_address:a,source_url:n,remark:"",metadata:{sub4:typeof window<"u"&&new URLSearchParams(window.location.search).get("sub4")||""},payment:{type:"stripe",data:{confirmation_token_id:u,payment_method_types:["card"]}}};return s.items=d.map(y=>({sku:y.sku,price_point_code:y.offerPricePoint})),s.metadata.products=d,console.log("Built order data:",s),s},[l]),m=g.useCallback(async()=>{var d;const{stripeState:u,customerInfo:c}=l,{stripe:t,elements:i}=u;if(!t||!i)return{success:!1,message:"Payment system not ready"};o(!0);try{console.log("Creating confirmation token...");const{token:n,error:f}=await x(t,i,c);if(f)return console.error("Failed to create confirmation token:",f),{success:!1,message:`Payment processing failed: ${f}`};if(!n)return{success:!1,message:"Failed to get payment token, please try again."};console.log("Confirmation token created successfully:",n);const p=h(n);console.log("Submitting order...");const a=await I(p);if(!a.success)return console.error("Order submission failed:",a.error),{success:!1,message:`Order submission failed: ${((d=a.error)==null?void 0:d.message)||"Unknown error"}`};const{data:s}=a;return console.log("Order submitted successfully:",s),(s==null?void 0:s.payment_status)===b.PAID?{success:!0,message:"🎉 Payment successful!",orderCode:s.order_code,tradeCode:s.order_trade_code}:(s==null?void 0:s.payment_status)===b.PENDING?{success:!1,message:"Payment was not successful. Please try a different payment method or card.",orderCode:s.order_code}:{success:!1,message:`Payment failed, status: ${(s==null?void 0:s.payment_status)||"Unknown"}. Please try again.`,orderCode:s==null?void 0:s.order_code}}catch(n){return console.error("Error occurred during order process:",n),{success:!1,message:"An error occurred during the order process, please try again."}}finally{o(!1)}},[l,x,h]);return{isSubmitting:r,submitOrder:m}},j=()=>{const{isFormValid:r,onOrderSubmit:o,onOrderSuccess:l}=C(),{checkoutProducts:x,totalAmount:h}=_(),{isSubmitting:m,submitOrder:u}=S(),[c,t]=g.useState(""),[i,d]=g.useState(""),[n,f]=g.useState(!1),p=async()=>{if(t(""),d(""),!r()){t("Please fill in all information and make sure it is valid!");return}o==null||o(x,h);const a=await u();if(a.success){f(!0);let s=a.message;a.orderCode&&(s+=`
|
|
2
|
-
Order Number: ${a.orderCode}`),a.tradeCode&&(s+=`
|
|
3
|
-
Transaction ID: ${a.tradeCode}`),d(s),a.orderCode&&(l==null||l(a.orderCode,a.tradeCode))}else t(a.message)};return e.jsxs("div",{className:"clickaroo-checkout-ui w-full flex flex-col items-center",children:[e.jsxs("button",{type:"button",onClick:p,className:`w-full outline-none border-none text-white font-bold text-center text-lg py-5 rounded-md mb-4 transition-all duration-300 relative overflow-hidden ${r()&&!m&&!n?"bg-black hover:opacity-70":n?"bg-green-500 cursor-not-allowed":m?"bg-blue-600 cursor-not-allowed":"bg-gray-400 cursor-not-allowed"}`,disabled:!r()||m||n,children:[m&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 via-blue-500 to-blue-600 bg-[length:200%_100%] animate-[shimmer_2s_ease-in-out_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center justify-center",children:n?"✓ Order Complete - Redirecting...":m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"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"})]}),i&&e.jsx("div",{className:"w-full mb-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-green-700 whitespace-pre-line m-0",children:i})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>d(""),className:"border-none inline-flex bg-green-50 rounded-md p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-green-50 focus:ring-green-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),c&&e.jsx("div",{className:"w-full mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 whitespace-pre-line",children:c})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>t(""),className:"inline-flex bg-red-50 rounded-md p-1.5 text-[#df1b41] hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),e.jsx("div",{className:"flex items-center text-grey text-sm md:text-base",children:e.jsx("span",{className:"text-center",children:"All transactions are SSL secure and encrypted"})}),e.jsx(k,{show:m,message:"Processing Your Order"})]})};j.__docgenInfo={description:"",methods:[],displayName:"SubmitButton"};const L=r=>e.jsx(v,{cart:r.cart,onCheckoutInit:r.onCheckoutInit,onPaymentInfoComplete:r.onPaymentInfoComplete,onOrderSubmit:r.onOrderSubmit,onOrderSuccess:r.onOrderSuccess,googleApiKey:r.googleApiKey,children:e.jsxs("div",{className:"clickaroo-checkout-ui flex flex-col gap-5",children:[e.jsx(O,{}),e.jsx(N,{}),e.jsx(P,{}),e.jsx(j,{})]})});L.__docgenInfo={description:"",methods:[],displayName:"CheckoutPage",props:{cart:{required:!0,tsType:{name:"Array",elements:[{name:"CartItem"}],raw:"CartItem[]"},description:""},onCheckoutInit:{required:!1,tsType:{name:"OnCheckoutInitCallback"},description:""},onPaymentInfoComplete:{required:!1,tsType:{name:"OnPaymentInfoCompleteCallback"},description:""},onOrderSubmit:{required:!1,tsType:{name:"OnOrderSubmitCallback"},description:""},onOrderSuccess:{required:!1,tsType:{name:"OnOrderSuccessCallback"},description:""},googleApiKey:{required:!1,tsType:{name:"string"},description:""}}};export{L as C,S as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{g as w,b as C,C as v}from"./useCheckoutContext-BXtGY5u3.js";import{C as N}from"./CustomerInfo-BwyY9803.js";import{D as P}from"./DeliveryAddress-QAGxLlLf.js";import{u as _,P as O}from"./PaymentMethods-afz1CTO5.js";import{r as g}from"./index-DRjF_FHU.js";const k=({message:r="Processing...",show:o})=>o?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center p-8 bg-white rounded-2xl shadow-2xl max-w-sm mx-4",children:[e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 rounded-full"}),e.jsx("div",{className:"absolute top-0 left-0 w-16 h-16 border-4 border-solid border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-2 h-2 bg-blue-500 rounded-full transform -translate-x-1/2 -translate-y-1/2"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please wait while we process your request..."})]}),e.jsxs("div",{className:"flex space-x-1 mt-6",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})]})]}):null;k.__docgenInfo={description:"",methods:[],displayName:"FullScreenLoading",props:{message:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:'"Processing..."',computed:!1}},show:{required:!0,tsType:{name:"boolean"},description:""}}};const I=async r=>{try{console.log("Creating order with data:",r);const o=await fetch(`${w()}/orders`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await o.json();return o.ok?(console.log("Order created successfully:",l),{success:!0,data:l}):(console.error("Order creation failed:",l),{success:!1,error:{message:l.message||`HTTP ${o.status}: ${o.statusText}`,code:l.code,details:l}})}catch(o){return console.error("Network error creating order:",o),{success:!1,error:{message:o instanceof Error?o.message:"Network error occurred",details:{originalError:o}}}}};var b=(r=>(r.PENDING="pending",r.PAID="paid",r.PARTIALLY_PAID="partially_paid",r.FAILED="failed",r))(b||{});const S=()=>{const[r,o]=g.useState(!1),l=C(),x=g.useCallback(async(u,c,t)=>{console.log("Creating confirmation token with:",{stripeExists:!!u,elementsExists:!!c});try{console.log("Calling elements.submit()...");const{error:i}=await c.submit();if(i)return console.error("Elements submit error:",i),{error:i.message};console.log("Elements submitted successfully, creating confirmation token...");const{confirmationToken:d,error:n}=await u.createConfirmationToken({elements:c,params:{payment_method_data:{billing_details:{name:`${t.firstName} ${t.lastName}`,email:t.email,phone:t.phone}}}});return n?(console.error("Confirmation token creation error:",n),{error:n.message}):d?(console.log("Confirmation token created successfully:",d.id),{token:d.id}):{error:"Failed to create confirmation token"}}catch(i){return console.error("Error creating confirmation token:",i),{error:"Failed to create confirmation token"}}},[]),h=g.useCallback(u=>{const{customerInfo:c,deliveryAddress:t,clickarooToken:i,cart:d}=l,n=typeof window<"u"?window.location.href:"",f=`${c.firstName} ${c.lastName}`.trim(),p=i&&i.trim()!==""?i:null,a={country:t.country,state:t.state,city:t.city,address1:t.address,zip:t.zipCode};t.address2&&t.address2.trim()!==""&&(a.address2=t.address2);const s={clickaroo_token:p,customer_info:{name:f,email:c.email,phone:c.phone},shipping_address:a,source_url:n,remark:"",metadata:{sub4:typeof window<"u"&&new URLSearchParams(window.location.search).get("sub4")||""},payment:{type:"stripe",data:{confirmation_token_id:u,payment_method_types:["card"]}}};return s.items=d.map(y=>({sku:y.sku,price_point_code:y.offerPricePoint})),s.metadata.products=d,console.log("Built order data:",s),s},[l]),m=g.useCallback(async()=>{var d;const{stripeState:u,customerInfo:c}=l,{stripe:t,elements:i}=u;if(!t||!i)return{success:!1,message:"Payment system not ready"};o(!0);try{console.log("Creating confirmation token...");const{token:n,error:f}=await x(t,i,c);if(f)return console.error("Failed to create confirmation token:",f),{success:!1,message:`Payment processing failed: ${f}`};if(!n)return{success:!1,message:"Failed to get payment token, please try again."};console.log("Confirmation token created successfully:",n);const p=h(n);console.log("Submitting order...");const a=await I(p);if(!a.success)return console.error("Order submission failed:",a.error),{success:!1,message:`Order submission failed: ${((d=a.error)==null?void 0:d.message)||"Unknown error"}`};const{data:s}=a;return console.log("Order submitted successfully:",s),(s==null?void 0:s.payment_status)===b.PAID?{success:!0,message:"🎉 Payment successful!",orderCode:s.order_code,tradeCode:s.order_trade_code}:(s==null?void 0:s.payment_status)===b.PENDING?{success:!1,message:"Payment was not successful. Please try a different payment method or card.",orderCode:s.order_code}:{success:!1,message:`Payment failed, status: ${(s==null?void 0:s.payment_status)||"Unknown"}. Please try again.`,orderCode:s==null?void 0:s.order_code}}catch(n){return console.error("Error occurred during order process:",n),{success:!1,message:"An error occurred during the order process, please try again."}}finally{o(!1)}},[l,x,h]);return{isSubmitting:r,submitOrder:m}},j=()=>{const{isFormValid:r,onOrderSubmit:o,onOrderSuccess:l}=C(),{checkoutProducts:x,totalAmount:h}=_(),{isSubmitting:m,submitOrder:u}=S(),[c,t]=g.useState(""),[i,d]=g.useState(""),[n,f]=g.useState(!1),p=async()=>{if(t(""),d(""),!r()){t("Please fill in all information and make sure it is valid!");return}o==null||o(x,h);const a=await u();if(a.success){f(!0);let s=a.message;a.orderCode&&(s+=`
|
|
2
|
-
Order Number: ${a.orderCode}`),a.tradeCode&&(s+=`
|
|
3
|
-
Transaction ID: ${a.tradeCode}`),d(s),a.orderCode&&(l==null||l(a.orderCode,a.tradeCode))}else t(a.message)};return e.jsxs("div",{className:"clickaroo-checkout-ui w-full flex flex-col items-center",children:[e.jsxs("button",{type:"button",onClick:p,className:`w-full outline-none border-none text-white font-bold text-center text-lg py-5 rounded-md mb-4 transition-all duration-300 relative overflow-hidden ${r()&&!m&&!n?"bg-black hover:opacity-70":n?"bg-green-500 cursor-not-allowed":m?"bg-blue-600 cursor-not-allowed":"bg-gray-400 cursor-not-allowed"}`,disabled:!r()||m||n,children:[m&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 via-blue-500 to-blue-600 bg-[length:200%_100%] animate-[shimmer_2s_ease-in-out_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center justify-center",children:n?"✓ Order Complete - Redirecting...":m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"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"})]}),i&&e.jsx("div",{className:"w-full mb-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-green-700 whitespace-pre-line m-0",children:i})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>d(""),className:"border-none inline-flex bg-green-50 rounded-md p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-green-50 focus:ring-green-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),c&&e.jsx("div",{className:"w-full mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("div",{className:"ml-3",children:e.jsx("p",{className:"text-sm text-red-700 whitespace-pre-line",children:c})}),e.jsx("div",{className:"ml-auto pl-3",children:e.jsx("div",{className:"-mx-1.5 -my-1.5",children:e.jsxs("button",{type:"button",onClick:()=>t(""),className:"inline-flex bg-red-50 rounded-md p-1.5 text-[#df1b41] hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600",children:[e.jsx("span",{className:"sr-only",children:"Close"}),e.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),e.jsx("div",{className:"flex items-center text-grey text-sm md:text-base",children:e.jsx("span",{className:"text-center",children:"All transactions are SSL secure and encrypted"})}),e.jsx(k,{show:m,message:"Processing Your Order"})]})};j.__docgenInfo={description:"",methods:[],displayName:"SubmitButton"};const L=r=>e.jsx(v,{cart:r.cart,onCheckoutInit:r.onCheckoutInit,onPaymentInfoComplete:r.onPaymentInfoComplete,onOrderSubmit:r.onOrderSubmit,onOrderSuccess:r.onOrderSuccess,googleApiKey:r.googleApiKey,children:e.jsxs("div",{className:"clickaroo-checkout-ui flex flex-col gap-5",children:[e.jsx(O,{}),e.jsx(N,{}),e.jsx(P,{}),e.jsx(j,{})]})});L.__docgenInfo={description:"",methods:[],displayName:"CheckoutPage",props:{cart:{required:!0,tsType:{name:"Array",elements:[{name:"CartItem"}],raw:"CartItem[]"},description:""},onCheckoutInit:{required:!1,tsType:{name:"OnCheckoutInitCallback"},description:""},onPaymentInfoComplete:{required:!1,tsType:{name:"OnPaymentInfoCompleteCallback"},description:""},onOrderSubmit:{required:!1,tsType:{name:"OnOrderSubmitCallback"},description:""},onOrderSuccess:{required:!1,tsType:{name:"OnOrderSuccessCallback"},description:""},googleApiKey:{required:!1,tsType:{name:"string"},description:""}}};export{L as C,S as u};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as c}from"./index-ChEI-nsM.js";import{M as s,C as o,a as d}from"./index-CZFGp9Su.js";import{C as l,D as r}from"./CheckoutPage.stories-DeC6lyzr.js";import"./index-DRjF_FHU.js";import"./iframe-PThBYPHV.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-DuJ1Ep0-.js";import"./CheckoutPage-CrHN6Fcv.js";import"./CustomerInfo-D3WHpN32.js";import"./ValidateInput-DcnOO9py.js";import"./DeliveryAddress-Lfanl1PO.js";import"./PaymentMethods-e9HqQtxN.js";function i(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...c(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(s,{of:l,title:"Documentation/Usage Guide/CheckoutPage",name:"CheckoutPage (English)"}),`
|
|
2
|
-
`,e.jsx(n.h1,{id:"checkoutpage",children:"CheckoutPage"}),`
|
|
3
|
-
`,e.jsx(n.p,{children:"A complete checkout page component that integrates customer information, delivery address, payment methods, and order submission functionality."}),`
|
|
4
|
-
`,e.jsx(n.h3,{id:"basic-usage",children:"Basic Usage"}),`
|
|
5
|
-
`,e.jsx(o,{of:r}),`
|
|
6
|
-
`,e.jsx(n.h3,{id:"props",children:"Props"}),`
|
|
7
|
-
`,e.jsx(d,{of:r}),`
|
|
8
|
-
`,e.jsx(n.h4,{id:"cart",children:"cart"}),`
|
|
9
|
-
`,e.jsx(n.p,{children:"Array of cart items. Each item represents a product in the checkout."}),`
|
|
10
|
-
`,e.jsxs(n.p,{children:["Type: ",e.jsx(n.code,{children:"CartItem[]"}),". See ",e.jsx(n.a,{href:"#cartitem",children:"CartItem Type Definition"})," for details."]}),`
|
|
11
|
-
`,e.jsx(n.p,{children:"Each cart item contains the following fields:"}),`
|
|
12
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Fields:"})}),`
|
|
13
|
-
`,e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Field"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Required"}),e.jsx("th",{children:"Description"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:"sku"})}),e.jsx("td",{children:e.jsx("code",{children:"string"})}),e.jsx("td",{children:"✅"}),e.jsx("td",{children:"Product SKU"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:"offerPricePoint"})}),e.jsx("td",{children:e.jsx("code",{children:"string"})}),e.jsx("td",{children:"✅"}),e.jsx("td",{children:"Price Point ID"})]})]})]}),`
|
|
14
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Fields:"})}),`
|
|
15
|
-
`,e.jsxs(n.p,{children:["In addition to the two required fields ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),", you can pass any other fields to each cart item. These additional fields will be saved to the order's ",e.jsx(n.code,{children:"metadata"})," and can be accessed later when retrieving order details through the ",e.jsx(n.code,{children:"useOrderDetail"})," hook."]}),`
|
|
16
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`const cart = [
|
|
17
|
-
{
|
|
18
|
-
sku: "TEST001",
|
|
19
|
-
offerPricePoint: "OPP-TEST001",
|
|
20
|
-
// Any other fields are allowed
|
|
21
|
-
title: "Product Title",
|
|
22
|
-
price: 99.99,
|
|
23
|
-
image: "https://example.com/product.jpg",
|
|
24
|
-
category: "Electronics",
|
|
25
|
-
// ... more fields
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const { orderDetail } = useOrderDetail(orderCode)
|
|
30
|
-
console.log(orderDetail.metadata.products)
|
|
31
|
-
/** [
|
|
32
|
-
{
|
|
33
|
-
sku: "TEST001",
|
|
34
|
-
offerPricePoint: "OPP-TEST001",
|
|
35
|
-
title: "Product Title",
|
|
36
|
-
price: 99.99,
|
|
37
|
-
image: "https://example.com/product.jpg",
|
|
38
|
-
category: "Electronics",
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
**/
|
|
42
|
-
`})}),`
|
|
43
|
-
`,e.jsx(n.h4,{id:"oncheckoutinit",children:"onCheckoutInit"}),`
|
|
44
|
-
`,e.jsxs(n.p,{children:["Callback function when checkout initializes, triggered immediately after the ",e.jsx(n.code,{children:"CheckoutPage"})," component mounts, used to track the start of the checkout flow."]}),`
|
|
45
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onCheckoutInit?: () => void
|
|
46
|
-
`})}),`
|
|
47
|
-
`,e.jsx(n.h4,{id:"onpaymentinfocomplete",children:"onPaymentInfoComplete"}),`
|
|
48
|
-
`,e.jsx(n.p,{children:"Callback function when payment information is complete, triggered when the user completes the payment form and payment element validation passes."}),`
|
|
49
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void
|
|
50
|
-
`})}),`
|
|
51
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
52
|
-
`,e.jsxs(n.ul,{children:[`
|
|
53
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"products"})," - Cart items array, type ",e.jsx(n.code,{children:"CheckoutCartItem[]"}),". Returns an array of cart items. See ",e.jsx(n.a,{href:"#checkoutcartitem",children:"CheckoutCartItem Type Definition"})," for details"]}),`
|
|
54
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"totalAmount"})," - Total payment amount in cents (e.g., 9999 represents $99.99). For multiple items, this is the sum of all items"]}),`
|
|
55
|
-
`]}),`
|
|
56
|
-
`,e.jsx(n.h4,{id:"onordersubmit",children:"onOrderSubmit"}),`
|
|
57
|
-
`,e.jsx(n.p,{children:"Callback function when order is submitted, triggered after the user clicks the submit button and before order processing begins."}),`
|
|
58
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void
|
|
59
|
-
`})}),`
|
|
60
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
61
|
-
`,e.jsxs(n.ul,{children:[`
|
|
62
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"products"})," - Submitted cart items array, type ",e.jsx(n.code,{children:"CheckoutCartItem[]"}),". See ",e.jsx(n.a,{href:"#checkoutcartitem",children:"CheckoutCartItem Type Definition"})," for details"]}),`
|
|
63
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"totalAmount"})," - Total amount at submission time in cents (e.g., 9999 represents $99.99)"]}),`
|
|
64
|
-
`]}),`
|
|
65
|
-
`,e.jsx(n.h4,{id:"onordersuccess",children:"onOrderSuccess"}),`
|
|
66
|
-
`,e.jsx(n.p,{children:"Callback function when order succeeds, triggered after the order is successfully created."}),`
|
|
67
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onOrderSuccess?: (orderCode: string, tradeCode?: string) => void
|
|
68
|
-
`})}),`
|
|
69
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
70
|
-
`,e.jsxs(n.ul,{children:[`
|
|
71
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"orderCode"})," - Order code"]}),`
|
|
72
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"tradeCode"})," - Trade code (optional)"]}),`
|
|
73
|
-
`]}),`
|
|
74
|
-
`,e.jsx(n.h3,{id:"usage-examples",children:"Usage Examples"}),`
|
|
75
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { CheckoutPage } from '@clickaroo/checkout-ui';
|
|
76
|
-
|
|
77
|
-
function App() {
|
|
78
|
-
const cart = [
|
|
79
|
-
{
|
|
80
|
-
sku: "TEST001",
|
|
81
|
-
offerPricePoint: "OPP-TEST001",
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<CheckoutPage
|
|
87
|
-
cart={cart}
|
|
88
|
-
onCheckoutInit={() => {
|
|
89
|
-
console.log('Checkout initialized');
|
|
90
|
-
}}
|
|
91
|
-
onPaymentInfoComplete={(products, totalAmount) => {
|
|
92
|
-
console.log('Payment info complete');
|
|
93
|
-
console.log('Total amount:', totalAmount / 100);
|
|
94
|
-
products.forEach((product) => {
|
|
95
|
-
console.log('Product SKU:', product.sku);
|
|
96
|
-
console.log('Unit price:', product.priceInCents / 100, product.currency);
|
|
97
|
-
console.log('Quantity:', product.quantity);
|
|
98
|
-
console.log('Payment type:', product.paymentType);
|
|
99
|
-
});
|
|
100
|
-
}}
|
|
101
|
-
onOrderSubmit={(products, totalAmount) => {
|
|
102
|
-
console.log('Order submitted');
|
|
103
|
-
console.log('Total amount:', totalAmount / 100);
|
|
104
|
-
}}
|
|
105
|
-
onOrderSuccess={(orderCode, tradeCode) => {
|
|
106
|
-
console.log('Order successful', orderCode, tradeCode);
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
`})}),`
|
|
112
|
-
`,e.jsx(n.h3,{id:"key-types",children:"Key Types"}),`
|
|
113
|
-
`,e.jsx(n.h4,{id:"cartitem",children:"CartItem"}),`
|
|
114
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.code,{children:"CartItem"})," is the basic cart item type passed to the ",e.jsx(n.code,{children:"CheckoutPage"})," component:"]}),`
|
|
115
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CartItem {
|
|
116
|
-
// Required fields
|
|
117
|
-
sku: string; // Product SKU
|
|
118
|
-
offerPricePoint: string; // Price Point ID
|
|
119
|
-
|
|
120
|
-
// Optional fields - allows any custom fields, which will be saved to order metadata
|
|
121
|
-
[key: string]: unknown;
|
|
122
|
-
}
|
|
123
|
-
`})}),`
|
|
124
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Field Description:"})}),`
|
|
125
|
-
`,e.jsxs(n.ul,{children:[`
|
|
126
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"sku"})," - Product SKU, required field"]}),`
|
|
127
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"offerPricePoint"})," - Price Point ID, required field"]}),`
|
|
128
|
-
`,e.jsxs(n.li,{children:["Other fields - You can pass any additional fields (such as ",e.jsx(n.code,{children:"title"}),", ",e.jsx(n.code,{children:"price"}),", ",e.jsx(n.code,{children:"image"}),", etc.), which will be saved to the order's ",e.jsx(n.code,{children:"metadata"})," and can be retrieved through ",e.jsx(n.code,{children:"useOrderDetail"})]}),`
|
|
129
|
-
`]}),`
|
|
130
|
-
`,e.jsx(n.h4,{id:"checkoutcartitem",children:"CheckoutCartItem"}),`
|
|
131
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.code,{children:"CheckoutCartItem"})," is the cart item type returned in callback functions, extending ",e.jsx(n.code,{children:"CartItem"})," and including price details:"]}),`
|
|
132
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CheckoutCartItem extends CartItem {
|
|
133
|
-
// Inherits all fields from CartItem (sku, offerPricePoint, etc.)
|
|
134
|
-
priceInCents: number; // Unit price in cents (e.g., 9999 represents $99.99)
|
|
135
|
-
currency: string; // Currency type (e.g., "USD", "EUR")
|
|
136
|
-
quantity: number; // Quantity
|
|
137
|
-
paymentType: "one-time" | "subscription"; // Payment type
|
|
138
|
-
}
|
|
139
|
-
`})}),`
|
|
140
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Field Description:"})}),`
|
|
141
|
-
`,e.jsxs(n.ul,{children:[`
|
|
142
|
-
`,e.jsxs(n.li,{children:["Inherits all fields from ",e.jsx(n.code,{children:"CartItem"})," (such as ",e.jsx(n.code,{children:"sku"}),", ",e.jsx(n.code,{children:"offerPricePoint"}),", etc.)"]}),`
|
|
143
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"priceInCents"})," - Unit price in cents"]}),`
|
|
144
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"currency"})," - Currency type"]}),`
|
|
145
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"quantity"})," - Quantity"]}),`
|
|
146
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"paymentType"})," - Payment type: ",e.jsx(n.code,{children:'"one-time"'})," for one-time payment, ",e.jsx(n.code,{children:'"subscription"'})," for subscription payment"]}),`
|
|
147
|
-
`]})]})}function T(t={}){const{wrapper:n}={...c(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(i,{...t})}):i(t)}export{T as default};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as c}from"./index-ChEI-nsM.js";import{M as s,C as o,a as d}from"./index-Bz3Q1Yw_.js";import{C as l,D as r}from"./CheckoutPage.stories-B5y94bOo.js";import"./index-DRjF_FHU.js";import"./iframe-eGyOKkka.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-L3zhltsm.js";import"./CheckoutPage-DvHYA1Jd.js";import"./CustomerInfo-BqCSWi4I.js";import"./ValidateInput-np1-zwvJ.js";import"./DeliveryAddress-TRtlNz2v.js";import"./PaymentMethods-CBXk2f9N.js";function i(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...c(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(s,{of:l,title:"Documentation/Usage Guide/CheckoutPage",name:"CheckoutPage (English)"}),`
|
|
2
|
-
`,e.jsx(n.h1,{id:"checkoutpage",children:"CheckoutPage"}),`
|
|
3
|
-
`,e.jsx(n.p,{children:"A complete checkout page component that integrates customer information, delivery address, payment methods, and order submission functionality."}),`
|
|
4
|
-
`,e.jsx(n.h3,{id:"basic-usage",children:"Basic Usage"}),`
|
|
5
|
-
`,e.jsx(o,{of:r}),`
|
|
6
|
-
`,e.jsx(n.h3,{id:"props",children:"Props"}),`
|
|
7
|
-
`,e.jsx(d,{of:r}),`
|
|
8
|
-
`,e.jsx(n.h4,{id:"cart",children:"cart"}),`
|
|
9
|
-
`,e.jsx(n.p,{children:"Array of cart items. Each item represents a product in the checkout."}),`
|
|
10
|
-
`,e.jsxs(n.p,{children:["Type: ",e.jsx(n.code,{children:"CartItem[]"}),". See ",e.jsx(n.a,{href:"#cartitem",children:"CartItem Type Definition"})," for details."]}),`
|
|
11
|
-
`,e.jsx(n.p,{children:"Each cart item contains the following fields:"}),`
|
|
12
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Fields:"})}),`
|
|
13
|
-
`,e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Field"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Required"}),e.jsx("th",{children:"Description"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:"sku"})}),e.jsx("td",{children:e.jsx("code",{children:"string"})}),e.jsx("td",{children:"✅"}),e.jsx("td",{children:"Product SKU"})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:"offerPricePoint"})}),e.jsx("td",{children:e.jsx("code",{children:"string"})}),e.jsx("td",{children:"✅"}),e.jsx("td",{children:"Price Point ID"})]})]})]}),`
|
|
14
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Fields:"})}),`
|
|
15
|
-
`,e.jsxs(n.p,{children:["In addition to the two required fields ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),", you can pass any other fields to each cart item. These additional fields will be saved to the order's ",e.jsx(n.code,{children:"metadata"})," and can be accessed later when retrieving order details through the ",e.jsx(n.code,{children:"useOrderDetail"})," hook."]}),`
|
|
16
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`const cart = [
|
|
17
|
-
{
|
|
18
|
-
sku: "TEST001",
|
|
19
|
-
offerPricePoint: "OPP-TEST001",
|
|
20
|
-
// Any other fields are allowed
|
|
21
|
-
title: "Product Title",
|
|
22
|
-
price: 99.99,
|
|
23
|
-
image: "https://example.com/product.jpg",
|
|
24
|
-
category: "Electronics",
|
|
25
|
-
// ... more fields
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const { orderDetail } = useOrderDetail(orderCode)
|
|
30
|
-
console.log(orderDetail.metadata.products)
|
|
31
|
-
/** [
|
|
32
|
-
{
|
|
33
|
-
sku: "TEST001",
|
|
34
|
-
offerPricePoint: "OPP-TEST001",
|
|
35
|
-
title: "Product Title",
|
|
36
|
-
price: 99.99,
|
|
37
|
-
image: "https://example.com/product.jpg",
|
|
38
|
-
category: "Electronics",
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
**/
|
|
42
|
-
`})}),`
|
|
43
|
-
`,e.jsx(n.h4,{id:"oncheckoutinit",children:"onCheckoutInit"}),`
|
|
44
|
-
`,e.jsxs(n.p,{children:["Callback function when checkout initializes, triggered immediately after the ",e.jsx(n.code,{children:"CheckoutPage"})," component mounts, used to track the start of the checkout flow."]}),`
|
|
45
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onCheckoutInit?: () => void
|
|
46
|
-
`})}),`
|
|
47
|
-
`,e.jsx(n.h4,{id:"onpaymentinfocomplete",children:"onPaymentInfoComplete"}),`
|
|
48
|
-
`,e.jsx(n.p,{children:"Callback function when payment information is complete, triggered when the user completes the payment form and payment element validation passes."}),`
|
|
49
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void
|
|
50
|
-
`})}),`
|
|
51
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
52
|
-
`,e.jsxs(n.ul,{children:[`
|
|
53
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"products"})," - Cart items array, type ",e.jsx(n.code,{children:"CheckoutCartItem[]"}),". Returns an array of cart items. See ",e.jsx(n.a,{href:"#checkoutcartitem",children:"CheckoutCartItem Type Definition"})," for details"]}),`
|
|
54
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"totalAmount"})," - Total payment amount in cents (e.g., 9999 represents $99.99). For multiple items, this is the sum of all items"]}),`
|
|
55
|
-
`]}),`
|
|
56
|
-
`,e.jsx(n.h4,{id:"onordersubmit",children:"onOrderSubmit"}),`
|
|
57
|
-
`,e.jsx(n.p,{children:"Callback function when order is submitted, triggered after the user clicks the submit button and before order processing begins."}),`
|
|
58
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void
|
|
59
|
-
`})}),`
|
|
60
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
61
|
-
`,e.jsxs(n.ul,{children:[`
|
|
62
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"products"})," - Submitted cart items array, type ",e.jsx(n.code,{children:"CheckoutCartItem[]"}),". See ",e.jsx(n.a,{href:"#checkoutcartitem",children:"CheckoutCartItem Type Definition"})," for details"]}),`
|
|
63
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"totalAmount"})," - Total amount at submission time in cents (e.g., 9999 represents $99.99)"]}),`
|
|
64
|
-
`]}),`
|
|
65
|
-
`,e.jsx(n.h4,{id:"onordersuccess",children:"onOrderSuccess"}),`
|
|
66
|
-
`,e.jsx(n.p,{children:"Callback function when order succeeds, triggered after the order is successfully created."}),`
|
|
67
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`onOrderSuccess?: (orderCode: string, tradeCode?: string) => void
|
|
68
|
-
`})}),`
|
|
69
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Parameter Description:"})}),`
|
|
70
|
-
`,e.jsxs(n.ul,{children:[`
|
|
71
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"orderCode"})," - Order code"]}),`
|
|
72
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"tradeCode"})," - Trade code (optional)"]}),`
|
|
73
|
-
`]}),`
|
|
74
|
-
`,e.jsx(n.h3,{id:"usage-examples",children:"Usage Examples"}),`
|
|
75
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { CheckoutPage } from '@clickaroo/checkout-ui';
|
|
76
|
-
|
|
77
|
-
function App() {
|
|
78
|
-
const cart = [
|
|
79
|
-
{
|
|
80
|
-
sku: "TEST001",
|
|
81
|
-
offerPricePoint: "OPP-TEST001",
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<CheckoutPage
|
|
87
|
-
cart={cart}
|
|
88
|
-
onCheckoutInit={() => {
|
|
89
|
-
console.log('Checkout initialized');
|
|
90
|
-
}}
|
|
91
|
-
onPaymentInfoComplete={(products, totalAmount) => {
|
|
92
|
-
console.log('Payment info complete');
|
|
93
|
-
console.log('Total amount:', totalAmount / 100);
|
|
94
|
-
products.forEach((product) => {
|
|
95
|
-
console.log('Product SKU:', product.sku);
|
|
96
|
-
console.log('Unit price:', product.priceInCents / 100, product.currency);
|
|
97
|
-
console.log('Quantity:', product.quantity);
|
|
98
|
-
console.log('Payment type:', product.paymentType);
|
|
99
|
-
});
|
|
100
|
-
}}
|
|
101
|
-
onOrderSubmit={(products, totalAmount) => {
|
|
102
|
-
console.log('Order submitted');
|
|
103
|
-
console.log('Total amount:', totalAmount / 100);
|
|
104
|
-
}}
|
|
105
|
-
onOrderSuccess={(orderCode, tradeCode) => {
|
|
106
|
-
console.log('Order successful', orderCode, tradeCode);
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
`})}),`
|
|
112
|
-
`,e.jsx(n.h3,{id:"key-types",children:"Key Types"}),`
|
|
113
|
-
`,e.jsx(n.h4,{id:"cartitem",children:"CartItem"}),`
|
|
114
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.code,{children:"CartItem"})," is the basic cart item type passed to the ",e.jsx(n.code,{children:"CheckoutPage"})," component:"]}),`
|
|
115
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CartItem {
|
|
116
|
-
// Required fields
|
|
117
|
-
sku: string; // Product SKU
|
|
118
|
-
offerPricePoint: string; // Price Point ID
|
|
119
|
-
|
|
120
|
-
// Optional fields - allows any custom fields, which will be saved to order metadata
|
|
121
|
-
[key: string]: unknown;
|
|
122
|
-
}
|
|
123
|
-
`})}),`
|
|
124
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Field Description:"})}),`
|
|
125
|
-
`,e.jsxs(n.ul,{children:[`
|
|
126
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"sku"})," - Product SKU, required field"]}),`
|
|
127
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"offerPricePoint"})," - Price Point ID, required field"]}),`
|
|
128
|
-
`,e.jsxs(n.li,{children:["Other fields - You can pass any additional fields (such as ",e.jsx(n.code,{children:"title"}),", ",e.jsx(n.code,{children:"price"}),", ",e.jsx(n.code,{children:"image"}),", etc.), which will be saved to the order's ",e.jsx(n.code,{children:"metadata"})," and can be retrieved through ",e.jsx(n.code,{children:"useOrderDetail"})]}),`
|
|
129
|
-
`]}),`
|
|
130
|
-
`,e.jsx(n.h4,{id:"checkoutcartitem",children:"CheckoutCartItem"}),`
|
|
131
|
-
`,e.jsxs(n.p,{children:[e.jsx(n.code,{children:"CheckoutCartItem"})," is the cart item type returned in callback functions, extending ",e.jsx(n.code,{children:"CartItem"})," and including price details:"]}),`
|
|
132
|
-
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CheckoutCartItem extends CartItem {
|
|
133
|
-
// Inherits all fields from CartItem (sku, offerPricePoint, etc.)
|
|
134
|
-
priceInCents: number; // Unit price in cents (e.g., 9999 represents $99.99)
|
|
135
|
-
currency: string; // Currency type (e.g., "USD", "EUR")
|
|
136
|
-
quantity: number; // Quantity
|
|
137
|
-
paymentType: "one-time" | "subscription"; // Payment type
|
|
138
|
-
}
|
|
139
|
-
`})}),`
|
|
140
|
-
`,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Field Description:"})}),`
|
|
141
|
-
`,e.jsxs(n.ul,{children:[`
|
|
142
|
-
`,e.jsxs(n.li,{children:["Inherits all fields from ",e.jsx(n.code,{children:"CartItem"})," (such as ",e.jsx(n.code,{children:"sku"}),", ",e.jsx(n.code,{children:"offerPricePoint"}),", etc.)"]}),`
|
|
143
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"priceInCents"})," - Unit price in cents"]}),`
|
|
144
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"currency"})," - Currency type"]}),`
|
|
145
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"quantity"})," - Quantity"]}),`
|
|
146
|
-
`,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"paymentType"})," - Payment type: ",e.jsx(n.code,{children:'"one-time"'})," for one-time payment, ",e.jsx(n.code,{children:'"subscription"'})," for subscription payment"]}),`
|
|
147
|
-
`]})]})}function T(t={}){const{wrapper:n}={...c(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(i,{...t})}):i(t)}export{T as default};
|