@clickaroo/checkout-ui 0.1.3-beta → 0.1.5-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.
Files changed (203) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.mjs +1 -1
  3. package/dist/storybook/storybook-static/assets/APIs.en-BZfNNuoc.js +372 -0
  4. package/dist/storybook/storybook-static/assets/APIs.en-BZzPbEJW.js +372 -0
  5. package/dist/storybook/storybook-static/assets/APIs.en-Bf5J1Ifk.js +372 -0
  6. package/dist/storybook/storybook-static/assets/APIs.en-DSVQkUt3.js +372 -0
  7. package/dist/storybook/storybook-static/assets/APIs.en-DcEWunRx.js +372 -0
  8. package/dist/storybook/storybook-static/assets/APIs.en-DfWH0fys.js +372 -0
  9. package/dist/storybook/storybook-static/assets/APIs.en-TWb_-3VC.js +372 -0
  10. package/dist/storybook/storybook-static/assets/APIs.en-m6cq4XTv.js +372 -0
  11. package/dist/storybook/storybook-static/assets/APIs.en-nicPQ5AW.js +372 -0
  12. package/dist/storybook/storybook-static/assets/CheckoutPage-BsnzMxJk.js +3 -0
  13. package/dist/storybook/storybook-static/assets/CheckoutPage-CDW7SRyI.js +3 -0
  14. package/dist/storybook/storybook-static/assets/CheckoutPage-CrHN6Fcv.js +3 -0
  15. package/dist/storybook/storybook-static/assets/CheckoutPage-DFb28rrp.js +3 -0
  16. package/dist/storybook/storybook-static/assets/CheckoutPage-DSLcTghb.js +3 -0
  17. package/dist/storybook/storybook-static/assets/CheckoutPage-DYMMhAMX.js +3 -0
  18. package/dist/storybook/storybook-static/assets/CheckoutPage-DgZ1RopD.js +3 -0
  19. package/dist/storybook/storybook-static/assets/CheckoutPage-DvHYA1Jd.js +3 -0
  20. package/dist/storybook/storybook-static/assets/CheckoutPage-d8MZfjpI.js +3 -0
  21. package/dist/storybook/storybook-static/assets/CheckoutPage.en-BeknEgWZ.js +147 -0
  22. package/dist/storybook/storybook-static/assets/CheckoutPage.en-Bsh4jm31.js +147 -0
  23. package/dist/storybook/storybook-static/assets/CheckoutPage.en-Byu6MnFF.js +147 -0
  24. package/dist/storybook/storybook-static/assets/CheckoutPage.en-C5I1UUQc.js +147 -0
  25. package/dist/storybook/storybook-static/assets/CheckoutPage.en-CNVaEQvK.js +147 -0
  26. package/dist/storybook/storybook-static/assets/CheckoutPage.en-D87qzfwm.js +147 -0
  27. package/dist/storybook/storybook-static/assets/CheckoutPage.en-DLb_7NPf.js +147 -0
  28. package/dist/storybook/storybook-static/assets/CheckoutPage.en-DQ0u0fHa.js +147 -0
  29. package/dist/storybook/storybook-static/assets/CheckoutPage.en-DiHMI_iH.js +147 -0
  30. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-B5y94bOo.js +44 -0
  31. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-B8Vyz9GJ.js +44 -0
  32. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BRP4VrvR.js +44 -0
  33. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-BahbUp4O.js +44 -0
  34. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DAo0u2QI.js +44 -0
  35. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DFK1bMdr.js +44 -0
  36. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DLD3oWo_.js +44 -0
  37. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DeC6lyzr.js +44 -0
  38. package/dist/storybook/storybook-static/assets/CheckoutPage.stories-DvaZetee.js +44 -0
  39. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-B0J9WR4k.js +1 -0
  40. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-BE_XGTCZ.js +1 -0
  41. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-B_hoSOu5.js +1 -0
  42. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-Bly_OAJP.js +1 -0
  43. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-BorkAxO4.js +1 -0
  44. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-C2GhQi7e.js +1 -0
  45. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-D3zu28Rn.js +1 -0
  46. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DI94E3AI.js +1 -0
  47. package/dist/storybook/storybook-static/assets/Color-YHDXOIA2-DVI1_7_g.js +1 -0
  48. package/dist/storybook/storybook-static/assets/CustomCheckout.en-8VNcggT9.js +211 -0
  49. package/dist/storybook/storybook-static/assets/CustomCheckout.en-BMJEFVTk.js +211 -0
  50. package/dist/storybook/storybook-static/assets/CustomCheckout.en-Bg4oz9hS.js +211 -0
  51. package/dist/storybook/storybook-static/assets/CustomCheckout.en-Bq25x8qa.js +211 -0
  52. package/dist/storybook/storybook-static/assets/CustomCheckout.en-BvF7SmOy.js +211 -0
  53. package/dist/storybook/storybook-static/assets/CustomCheckout.en-CckpRGsp.js +211 -0
  54. package/dist/storybook/storybook-static/assets/CustomCheckout.en-D80ZpldF.js +211 -0
  55. package/dist/storybook/storybook-static/assets/CustomCheckout.en-uXQeih6h.js +211 -0
  56. package/dist/storybook/storybook-static/assets/CustomCheckout.en-wshSoFMr.js +211 -0
  57. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-B8CnjGCn.js +6 -0
  58. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-BQkpNbox.js +6 -0
  59. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-BrF5j7zs.js +6 -0
  60. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-CKQKzMq0.js +6 -0
  61. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-DhCrUQc1.js +6 -0
  62. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-F2GZKkIG.js +6 -0
  63. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-V2NHLbZo.js +6 -0
  64. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-ZCeqtMGJ.js +6 -0
  65. package/dist/storybook/storybook-static/assets/CustomCheckout.stories-rMIVoUs4.js +6 -0
  66. package/dist/storybook/storybook-static/assets/CustomerInfo-BMTfZ9z3.js +1 -0
  67. package/dist/storybook/storybook-static/assets/CustomerInfo-BqCSWi4I.js +1 -0
  68. package/dist/storybook/storybook-static/assets/CustomerInfo-BwyY9803.js +1 -0
  69. package/dist/storybook/storybook-static/assets/CustomerInfo-CPNuEjrH.js +1 -0
  70. package/dist/storybook/storybook-static/assets/CustomerInfo-CTx1dFS3.js +1 -0
  71. package/dist/storybook/storybook-static/assets/CustomerInfo-Cp0u57C5.js +1 -0
  72. package/dist/storybook/storybook-static/assets/CustomerInfo-D3WHpN32.js +1 -0
  73. package/dist/storybook/storybook-static/assets/CustomerInfo-DShSrjMR.js +1 -0
  74. package/dist/storybook/storybook-static/assets/CustomerInfo-mKAI6gWW.js +1 -0
  75. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BAbhNSal.js +9 -0
  76. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BeF8Yh1A.js +9 -0
  77. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-BwCrEBgN.js +9 -0
  78. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-CYx1hKNg.js +9 -0
  79. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-D1l3Glaq.js +9 -0
  80. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-DB2C3zqQ.js +9 -0
  81. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-Dv6cHWui.js +9 -0
  82. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-jpdDC3ta.js +9 -0
  83. package/dist/storybook/storybook-static/assets/CustomerInfo.stories-tyhy9PWf.js +9 -0
  84. package/dist/storybook/storybook-static/assets/DeliveryAddress-CD42v0od.js +2 -0
  85. package/dist/storybook/storybook-static/assets/DeliveryAddress-CeuByf4d.js +2 -0
  86. package/dist/storybook/storybook-static/assets/DeliveryAddress-DOxyPw17.js +2 -0
  87. package/dist/storybook/storybook-static/assets/DeliveryAddress-DY5lFnTv.js +2 -0
  88. package/dist/storybook/storybook-static/assets/DeliveryAddress-DaRy4l-D.js +2 -0
  89. package/dist/storybook/storybook-static/assets/DeliveryAddress-Lfanl1PO.js +2 -0
  90. package/dist/storybook/storybook-static/assets/DeliveryAddress-QAGxLlLf.js +2 -0
  91. package/dist/storybook/storybook-static/assets/DeliveryAddress-TRtlNz2v.js +2 -0
  92. package/dist/storybook/storybook-static/assets/DeliveryAddress-X81XGbKD.js +2 -0
  93. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-BvAXTiNm.js +9 -0
  94. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-C1JtetLS.js +9 -0
  95. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-C8sE6JJZ.js +9 -0
  96. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CBScReyV.js +9 -0
  97. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CTyS3zFt.js +9 -0
  98. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-CqmJ_Wn7.js +9 -0
  99. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-DHyw5QNl.js +9 -0
  100. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-FMwTSh9f.js +9 -0
  101. package/dist/storybook/storybook-static/assets/DeliveryAddress.stories-vQ0cdVl6.js +9 -0
  102. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-4VFo0TRH.js +2 -0
  103. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-BKek9MhZ.js +2 -0
  104. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-C4t3f4os.js +2 -0
  105. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-CtrnOF1G.js +2 -0
  106. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-DU1kBIGp.js +2 -0
  107. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-DzgR8M-W.js +2 -0
  108. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-OiuU2wez.js +2 -0
  109. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-Q5WDl3Gp.js +2 -0
  110. package/dist/storybook/storybook-static/assets/DocsRenderer-CFRXHY34-sE6BxCwu.js +2 -0
  111. package/dist/storybook/storybook-static/assets/Guide.en-BJ4qiYIc.js +107 -0
  112. package/dist/storybook/storybook-static/assets/Guide.en-BRVwtDXj.js +107 -0
  113. package/dist/storybook/storybook-static/assets/Guide.en-Boc44Lax.js +107 -0
  114. package/dist/storybook/storybook-static/assets/Guide.en-CKA244dX.js +107 -0
  115. package/dist/storybook/storybook-static/assets/Guide.en-CiR7CrYZ.js +107 -0
  116. package/dist/storybook/storybook-static/assets/Guide.en-Citkzdg9.js +107 -0
  117. package/dist/storybook/storybook-static/assets/Guide.en-DPJzC5RR.js +107 -0
  118. package/dist/storybook/storybook-static/assets/Guide.en-Dn9xb9YI.js +107 -0
  119. package/dist/storybook/storybook-static/assets/Guide.en-XzxJQK_F.js +107 -0
  120. package/dist/storybook/storybook-static/assets/PaymentMethods-BFtlMopq.js +2 -0
  121. package/dist/storybook/storybook-static/assets/PaymentMethods-BNEEARzu.js +2 -0
  122. package/dist/storybook/storybook-static/assets/PaymentMethods-BnPZRrAs.js +2 -0
  123. package/dist/storybook/storybook-static/assets/PaymentMethods-Buladk2O.js +2 -0
  124. package/dist/storybook/storybook-static/assets/PaymentMethods-CBXk2f9N.js +2 -0
  125. package/dist/storybook/storybook-static/assets/PaymentMethods-DmV3o0ow.js +2 -0
  126. package/dist/storybook/storybook-static/assets/PaymentMethods-DxorWSOl.js +2 -0
  127. package/dist/storybook/storybook-static/assets/PaymentMethods-afz1CTO5.js +2 -0
  128. package/dist/storybook/storybook-static/assets/PaymentMethods-e9HqQtxN.js +2 -0
  129. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-6fZvfvMO.js +9 -0
  130. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-Bc4jYrum.js +9 -0
  131. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-CcjSRFbb.js +9 -0
  132. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-ChiL9TJn.js +9 -0
  133. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-D1SSfWqv.js +9 -0
  134. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-DJpOtGJg.js +9 -0
  135. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-Dyg3R8Cs.js +9 -0
  136. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-U-xbCFtF.js +9 -0
  137. package/dist/storybook/storybook-static/assets/PaymentMethods.stories-pOuLDPwE.js +9 -0
  138. package/dist/storybook/storybook-static/assets/QuickStart.en-8otT6VDx.js +136 -0
  139. package/dist/storybook/storybook-static/assets/QuickStart.en-B2goyY4Q.js +136 -0
  140. package/dist/storybook/storybook-static/assets/QuickStart.en-Bz56Z2wW.js +136 -0
  141. package/dist/storybook/storybook-static/assets/QuickStart.en-C1fKNHfm.js +136 -0
  142. package/dist/storybook/storybook-static/assets/QuickStart.en-CEFLfOWt.js +136 -0
  143. package/dist/storybook/storybook-static/assets/QuickStart.en-Ct2dMZNT.js +136 -0
  144. package/dist/storybook/storybook-static/assets/QuickStart.en-D5OiYfrB.js +136 -0
  145. package/dist/storybook/storybook-static/assets/QuickStart.en-D6K1vnx2.js +136 -0
  146. package/dist/storybook/storybook-static/assets/QuickStart.en-wgtxGAFt.js +136 -0
  147. package/dist/storybook/storybook-static/assets/ValidateInput-BKNagaQv.js +2 -0
  148. package/dist/storybook/storybook-static/assets/ValidateInput-BMZhq5zE.js +2 -0
  149. package/dist/storybook/storybook-static/assets/ValidateInput-CECRKp4c.js +2 -0
  150. package/dist/storybook/storybook-static/assets/ValidateInput-CXYuXafK.js +2 -0
  151. package/dist/storybook/storybook-static/assets/ValidateInput-Cl2O4HCX.js +2 -0
  152. package/dist/storybook/storybook-static/assets/ValidateInput-DcnOO9py.js +2 -0
  153. package/dist/storybook/storybook-static/assets/ValidateInput-LNzX4jJP.js +2 -0
  154. package/dist/storybook/storybook-static/assets/ValidateInput-np1-zwvJ.js +2 -0
  155. package/dist/storybook/storybook-static/assets/ValidateInput-sZgX3GCF.js +2 -0
  156. package/dist/storybook/storybook-static/assets/entry-preview-BAF1DioI.js +2 -0
  157. package/dist/storybook/storybook-static/assets/entry-preview-BAb-nh3P.js +2 -0
  158. package/dist/storybook/storybook-static/assets/entry-preview-BQMc41xo.js +2 -0
  159. package/dist/storybook/storybook-static/assets/entry-preview-Bnn64O7J.js +2 -0
  160. package/dist/storybook/storybook-static/assets/entry-preview-C4SPQchM.js +2 -0
  161. package/dist/storybook/storybook-static/assets/entry-preview-CAnH1TUA.js +2 -0
  162. package/dist/storybook/storybook-static/assets/entry-preview-Dbi49YCK.js +2 -0
  163. package/dist/storybook/storybook-static/assets/entry-preview-GhM6ttN0.js +2 -0
  164. package/dist/storybook/storybook-static/assets/entry-preview-hHv11-z5.js +2 -0
  165. package/dist/storybook/storybook-static/assets/iframe-CakT_Hx-.js +211 -0
  166. package/dist/storybook/storybook-static/assets/iframe-Ce3kgeV4.js +211 -0
  167. package/dist/storybook/storybook-static/assets/iframe-Crv4raYy.js +211 -0
  168. package/dist/storybook/storybook-static/assets/iframe-CueR_wS4.js +211 -0
  169. package/dist/storybook/storybook-static/assets/iframe-DWFwLXCc.js +211 -0
  170. package/dist/storybook/storybook-static/assets/iframe-DsSsblW_.js +211 -0
  171. package/dist/storybook/storybook-static/assets/iframe-PThBYPHV.js +211 -0
  172. package/dist/storybook/storybook-static/assets/iframe-SJLFWhX6.js +211 -0
  173. package/dist/storybook/storybook-static/assets/iframe-eGyOKkka.js +211 -0
  174. package/dist/storybook/storybook-static/assets/index-3vMs57rT.js +575 -0
  175. package/dist/storybook/storybook-static/assets/index-BlPVJQpb.js +575 -0
  176. package/dist/storybook/storybook-static/assets/index-Bz3Q1Yw_.js +575 -0
  177. package/dist/storybook/storybook-static/assets/index-CZFGp9Su.js +575 -0
  178. package/dist/storybook/storybook-static/assets/index-CkNSuRJg.js +575 -0
  179. package/dist/storybook/storybook-static/assets/index-D66ljFJA.js +575 -0
  180. package/dist/storybook/storybook-static/assets/index-DnrKlQ76.js +575 -0
  181. package/dist/storybook/storybook-static/assets/index-DoDFfets.js +575 -0
  182. package/dist/storybook/storybook-static/assets/index-LRKEu_dQ.js +575 -0
  183. package/dist/storybook/storybook-static/assets/preview-884UjfA3.js +2 -0
  184. package/dist/storybook/storybook-static/assets/preview-C1X5Ys-q.js +2 -0
  185. package/dist/storybook/storybook-static/assets/preview-CbAwkmzD.js +2 -0
  186. package/dist/storybook/storybook-static/assets/preview-DGJdQn9n.js +2 -0
  187. package/dist/storybook/storybook-static/assets/preview-DJkpO_nB.js +2 -0
  188. package/dist/storybook/storybook-static/assets/preview-DNROAajq.js +2 -0
  189. package/dist/storybook/storybook-static/assets/preview-De1PUXkc.js +2 -0
  190. package/dist/storybook/storybook-static/assets/preview-DyVoah3G.js +2 -0
  191. package/dist/storybook/storybook-static/assets/preview-EmPtksy2.js +2 -0
  192. package/dist/storybook/storybook-static/assets/useCheckoutContext-3YTrU8Qh.js +27 -0
  193. package/dist/storybook/storybook-static/assets/useCheckoutContext-B8tsk5b5.js +27 -0
  194. package/dist/storybook/storybook-static/assets/useCheckoutContext-BW2h13W8.js +27 -0
  195. package/dist/storybook/storybook-static/assets/useCheckoutContext-BXtGY5u3.js +27 -0
  196. package/dist/storybook/storybook-static/assets/useCheckoutContext-C6u4Rp5U.js +27 -0
  197. package/dist/storybook/storybook-static/assets/useCheckoutContext-C7KjDyWW.js +27 -0
  198. package/dist/storybook/storybook-static/assets/useCheckoutContext-CroxIBFh.js +27 -0
  199. package/dist/storybook/storybook-static/assets/useCheckoutContext-DuJ1Ep0-.js +27 -0
  200. package/dist/storybook/storybook-static/assets/useCheckoutContext-L3zhltsm.js +27 -0
  201. package/dist/storybook/storybook-static/iframe.html +1 -1
  202. package/dist/storybook/storybook-static/project.json +1 -1
  203. package/package.json +1 -1
@@ -0,0 +1,211 @@
1
+ import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as s}from"./index-ChEI-nsM.js";import{M as r,C as i}from"./index-DnrKlQ76.js";import{C as d,D as c}from"./CustomCheckout.stories-BQkpNbox.js";import"./index-DRjF_FHU.js";import"./iframe-SJLFWhX6.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-CroxIBFh.js";/* empty css */import"./CheckoutPage-DFb28rrp.js";import"./CustomerInfo-BMTfZ9z3.js";import"./ValidateInput-BMZhq5zE.js";import"./DeliveryAddress-DOxyPw17.js";import"./PaymentMethods-DxorWSOl.js";function o(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...s(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{of:d,title:"Components/CustomCheckout",name:"CustomCheckout (English)"}),`
2
+ `,e.jsx(n.h1,{id:"customcheckout",children:"CustomCheckout"}),`
3
+ `,e.jsxs(n.p,{children:["While the ",e.jsx(n.code,{children:"CheckoutPage"})," component provides a complete, ready-to-use checkout solution, you may need more control over the layout, styling, or user experience. This guide explains how to build a completely custom checkout flow by using the library's hooks and context, while still leveraging the core functionality."]}),`
4
+ `,e.jsxs(n.p,{children:["The example above demonstrates a fully customized checkout page with custom styling, where we use the library's ",e.jsx(n.code,{children:"PaymentMethods"})," component (which is required) and build custom components for customer information, delivery address, and the submit button."]}),`
5
+ `,e.jsx(i,{of:c}),`
6
+ `,e.jsx(n.h3,{id:"overview",children:"Overview"}),`
7
+ `,e.jsx(n.p,{children:"When building a custom checkout flow, you'll need to:"}),`
8
+ `,e.jsxs(n.ol,{children:[`
9
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Wrap your components"})," in ",e.jsx(n.code,{children:"CheckoutProvider"})," to access the checkout context"]}),`
10
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Use hooks"})," (",e.jsx(n.code,{children:"useCheckoutContext"}),", ",e.jsx(n.code,{children:"useOrderSubmission"}),") to access and update form data"]}),`
11
+ `,e.jsxs(n.li,{children:[e.jsxs(n.strong,{children:["Use the ",e.jsx(n.code,{children:"PaymentMethods"})," component"]})," from the library (required - cannot be customized)"]}),`
12
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Update form data"})," through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"})," methods"]}),`
13
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Submit orders"})," using the ",e.jsx(n.code,{children:"useOrderSubmission"})," hook"]}),`
14
+ `]}),`
15
+ `,e.jsx(n.h3,{id:"understanding-form-data-structure",children:"Understanding Form Data Structure"}),`
16
+ `,e.jsxs(n.p,{children:["When customizing components, you need to ensure all required fields are updated correctly. The library uses two main data structures: ",e.jsx(n.code,{children:"CustomerInfo"})," and ",e.jsx(n.code,{children:"DeliveryAddress"}),". Understanding these structures is crucial for building custom components that work seamlessly with the checkout flow."]}),`
17
+ `,e.jsx(n.h4,{id:"customerinfo-fields",children:"CustomerInfo Fields"}),`
18
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CustomerInfo {
19
+ firstName: string; // First name (required)
20
+ lastName: string; // Last name (required)
21
+ email: string; // Email (required, must be valid email format)
22
+ phone: string; // Phone (required, E.164 format)
23
+ }
24
+ `})}),`
25
+ `,e.jsx(n.h4,{id:"deliveryaddress-fields",children:"DeliveryAddress Fields"}),`
26
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface DeliveryAddress {
27
+ country: string; // Country (required)
28
+ address: string; // Street address (required)
29
+ address2?: string; // Address line 2 (optional)
30
+ city: string; // City (required)
31
+ state: string; // State/Province (required)
32
+ zipCode: string; // Postal code (required)
33
+ }
34
+ `})}),`
35
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Important:"})," When customizing components, you must update all required fields through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"}),"."]}),`
36
+ `,e.jsx(n.h3,{id:"using-checkoutprovider",children:"Using CheckoutProvider"}),`
37
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," is the foundation of any custom checkout flow. It provides the context and state management needed for all checkout-related functionality. All your custom components must be wrapped within ",e.jsx(n.code,{children:"CheckoutProvider"}),"."]}),`
38
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," props are identical to ",e.jsx(n.code,{children:"CheckoutPage"}),", supporting the following:"]}),`
39
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Props:"})}),`
40
+ `,e.jsxs(n.ul,{children:[`
41
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"cart: CartItem[]"})," - Array of cart items. Each item must include ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),". ",e.jsx(n.strong,{children:"Note:"})," Even for a single product, pass it as an array with one item."]}),`
42
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"children: ReactNode"})," - Child components to be wrapped"]}),`
43
+ `]}),`
44
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Props:"})}),`
45
+ `,e.jsxs(n.ul,{children:[`
46
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onCheckoutInit?: () => void"})," - Callback function triggered when checkout initializes (immediately after component mount)"]}),`
47
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"googleApiKey?: string"})," - Google Places API Key for enabling address autocomplete functionality"]}),`
48
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when payment information is complete"]}),`
49
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when order is submitted"]}),`
50
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSuccess?: (orderCode: string, tradeCode?: string) => void"})," - Callback triggered when order succeeds"]}),`
51
+ `]}),`
52
+ `,e.jsxs(n.p,{children:["For detailed parameter descriptions, see ",e.jsx(n.a,{href:"./?path=/docs/documentation-usage-guide-checkoutpage--docs",children:"CheckoutPage Documentation"}),"."]}),`
53
+ `,e.jsx(n.h3,{id:"building-custom-components",children:"Building Custom Components"}),`
54
+ `,e.jsx(n.p,{children:"Now let's see how to build custom components step by step. Each component uses hooks to access and update the checkout state."}),`
55
+ `,e.jsx(n.h4,{id:"custom-customer-info-component",children:"Custom Customer Info Component"}),`
56
+ `,e.jsxs(n.p,{children:["Use the ",e.jsx(n.code,{children:"useCheckoutContext"})," hook to access ",e.jsx(n.code,{children:"customerInfo"})," and ",e.jsx(n.code,{children:"updateCustomerInfo"}),":"]}),`
57
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
58
+
59
+ function CustomCustomerInfo() {
60
+ const { customerInfo, updateCustomerInfo } = useCheckoutContext();
61
+
62
+ return (
63
+ <div>
64
+ <input
65
+ value={customerInfo.firstName}
66
+ onChange={(e) => updateCustomerInfo({ firstName: e.target.value })}
67
+ placeholder="First Name"
68
+ />
69
+ <input
70
+ value={customerInfo.lastName}
71
+ onChange={(e) => updateCustomerInfo({ lastName: e.target.value })}
72
+ placeholder="Last Name"
73
+ />
74
+ <input
75
+ type="email"
76
+ value={customerInfo.email}
77
+ onChange={(e) => updateCustomerInfo({ email: e.target.value })}
78
+ placeholder="Email"
79
+ />
80
+ <input
81
+ type="tel"
82
+ value={customerInfo.phone}
83
+ onChange={(e) => updateCustomerInfo({ phone: e.target.value })}
84
+ placeholder="Phone"
85
+ />
86
+ </div>
87
+ );
88
+ }
89
+ `})}),`
90
+ `,e.jsx(n.h4,{id:"custom-delivery-address-component",children:"Custom Delivery Address Component"}),`
91
+ `,e.jsxs(n.p,{children:["Similarly, use ",e.jsx(n.code,{children:"updateDeliveryAddress"})," to update address information:"]}),`
92
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
93
+
94
+ function CustomDeliveryAddress() {
95
+ const { deliveryAddress, updateDeliveryAddress } = useCheckoutContext();
96
+
97
+ return (
98
+ <div>
99
+ <input
100
+ value={deliveryAddress.country || ''}
101
+ onChange={(e) => updateDeliveryAddress({ country: e.target.value })}
102
+ placeholder="Country"
103
+ />
104
+ <input
105
+ value={deliveryAddress.address || ''}
106
+ onChange={(e) => updateDeliveryAddress({ address: e.target.value })}
107
+ placeholder="Street Address"
108
+ />
109
+ <input
110
+ value={deliveryAddress.city || ''}
111
+ onChange={(e) => updateDeliveryAddress({ city: e.target.value })}
112
+ placeholder="City"
113
+ />
114
+ <input
115
+ value={deliveryAddress.state || ''}
116
+ onChange={(e) => updateDeliveryAddress({ state: e.target.value })}
117
+ placeholder="State/Province"
118
+ />
119
+ <input
120
+ value={deliveryAddress.zipCode || ''}
121
+ onChange={(e) => updateDeliveryAddress({ zipCode: e.target.value })}
122
+ placeholder="ZIP Code"
123
+ />
124
+ </div>
125
+ );
126
+ }
127
+ `})}),`
128
+ `,e.jsx(n.h4,{id:"custom-submit-button-component",children:"Custom Submit Button Component"}),`
129
+ `,e.jsxs(n.p,{children:["Use ",e.jsx(n.code,{children:"useOrderSubmission"})," hook to handle order submission and ",e.jsx(n.code,{children:"isFormValid()"})," to check form validity:"]}),`
130
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext, useOrderSubmission } from '@clickaroo/checkout-ui';
131
+
132
+ function CustomSubmitButton() {
133
+ const { isFormValid } = useCheckoutContext();
134
+ const { isSubmitting, submitOrder } = useOrderSubmission();
135
+
136
+ const handleSubmit = async () => {
137
+ // Always check form validity before submitting
138
+ if (!isFormValid()) {
139
+ alert('Please complete all required fields');
140
+ return;
141
+ }
142
+
143
+ const result = await submitOrder();
144
+
145
+ if (result.success) {
146
+ console.log('Order successful', result.orderCode);
147
+ // Handle success (e.g., redirect to success page)
148
+ } else {
149
+ console.error('Order failed', result.message);
150
+ // Handle error (e.g., show error message)
151
+ }
152
+ };
153
+
154
+ return (
155
+ <button
156
+ onClick={handleSubmit}
157
+ disabled={!isFormValid() || isSubmitting}
158
+ >
159
+ {isSubmitting ? 'Processing...' : 'Complete Order'}
160
+ </button>
161
+ );
162
+ }
163
+ `})}),`
164
+ `,e.jsx(n.h3,{id:"complete-example",children:"Complete Example"}),`
165
+ `,e.jsx(n.p,{children:"Here's a complete example putting it all together:"}),`
166
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import {
167
+ CheckoutProvider,
168
+ PaymentMethods,
169
+ useCheckoutContext,
170
+ useOrderSubmission
171
+ } from '@clickaroo/checkout-ui';
172
+
173
+ // ... (include the custom components above)
174
+
175
+ function CustomCheckoutPage() {
176
+ const cart = [
177
+ {
178
+ sku: "TEST001",
179
+ offerPricePoint: "OPP-XXX",
180
+ title: "Product 1",
181
+ price: 99.99,
182
+ },
183
+ ];
184
+
185
+ return (
186
+ <CheckoutProvider
187
+ cart={cart}
188
+ googleApiKey="YOUR_GOOGLE_API_KEY"
189
+ onCheckoutInit={() => {
190
+ console.log('Checkout initialized');
191
+ }}
192
+ onPaymentInfoComplete={(products, totalAmount) => {
193
+ console.log('Payment info complete', products, totalAmount);
194
+ }}
195
+ onOrderSubmit={(products, totalAmount) => {
196
+ console.log('Order submitted', products, totalAmount);
197
+ }}
198
+ onOrderSuccess={(orderCode, tradeCode) => {
199
+ console.log('Order successful', orderCode, tradeCode);
200
+ }}
201
+ >
202
+ <CustomCustomerInfo />
203
+ <CustomDeliveryAddress />
204
+ {/* PaymentMethods is required - cannot be customized */}
205
+ <PaymentMethods />
206
+ <CustomSubmitButton />
207
+ </CheckoutProvider>
208
+ );
209
+ }
210
+ `})}),`
211
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Key Point:"})," All components must be wrapped in ",e.jsx(n.code,{children:"CheckoutProvider"})]})]})}function A(t={}){const{wrapper:n}={...s(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{A as default};
@@ -0,0 +1,211 @@
1
+ import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as s}from"./index-ChEI-nsM.js";import{M as r,C as i}from"./index-CkNSuRJg.js";import{C as d,D as c}from"./CustomCheckout.stories-V2NHLbZo.js";import"./index-DRjF_FHU.js";import"./iframe-DsSsblW_.js";import"./index-B7ki2Uzk.js";import"./index-D-Mha1DF.js";import"./index-DrFu-skq.js";import"./useCheckoutContext-C6u4Rp5U.js";/* empty css */import"./CheckoutPage-DYMMhAMX.js";import"./CustomerInfo-Cp0u57C5.js";import"./ValidateInput-sZgX3GCF.js";import"./DeliveryAddress-CD42v0od.js";import"./PaymentMethods-BnPZRrAs.js";function o(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...s(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{of:d,title:"Components/CustomCheckout",name:"CustomCheckout (English)"}),`
2
+ `,e.jsx(n.h1,{id:"customcheckout",children:"CustomCheckout"}),`
3
+ `,e.jsxs(n.p,{children:["While the ",e.jsx(n.code,{children:"CheckoutPage"})," component provides a complete, ready-to-use checkout solution, you may need more control over the layout, styling, or user experience. This guide explains how to build a completely custom checkout flow by using the library's hooks and context, while still leveraging the core functionality."]}),`
4
+ `,e.jsxs(n.p,{children:["The example above demonstrates a fully customized checkout page with custom styling, where we use the library's ",e.jsx(n.code,{children:"PaymentMethods"})," component (which is required) and build custom components for customer information, delivery address, and the submit button."]}),`
5
+ `,e.jsx(i,{of:c}),`
6
+ `,e.jsx(n.h3,{id:"overview",children:"Overview"}),`
7
+ `,e.jsx(n.p,{children:"When building a custom checkout flow, you'll need to:"}),`
8
+ `,e.jsxs(n.ol,{children:[`
9
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Wrap your components"})," in ",e.jsx(n.code,{children:"CheckoutProvider"})," to access the checkout context"]}),`
10
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Use hooks"})," (",e.jsx(n.code,{children:"useCheckoutContext"}),", ",e.jsx(n.code,{children:"useOrderSubmission"}),") to access and update form data"]}),`
11
+ `,e.jsxs(n.li,{children:[e.jsxs(n.strong,{children:["Use the ",e.jsx(n.code,{children:"PaymentMethods"})," component"]})," from the library (required - cannot be customized)"]}),`
12
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Update form data"})," through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"})," methods"]}),`
13
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Submit orders"})," using the ",e.jsx(n.code,{children:"useOrderSubmission"})," hook"]}),`
14
+ `]}),`
15
+ `,e.jsx(n.h3,{id:"understanding-form-data-structure",children:"Understanding Form Data Structure"}),`
16
+ `,e.jsxs(n.p,{children:["When customizing components, you need to ensure all required fields are updated correctly. The library uses two main data structures: ",e.jsx(n.code,{children:"CustomerInfo"})," and ",e.jsx(n.code,{children:"DeliveryAddress"}),". Understanding these structures is crucial for building custom components that work seamlessly with the checkout flow."]}),`
17
+ `,e.jsx(n.h4,{id:"customerinfo-fields",children:"CustomerInfo Fields"}),`
18
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CustomerInfo {
19
+ firstName: string; // First name (required)
20
+ lastName: string; // Last name (required)
21
+ email: string; // Email (required, must be valid email format)
22
+ phone: string; // Phone (required, E.164 format)
23
+ }
24
+ `})}),`
25
+ `,e.jsx(n.h4,{id:"deliveryaddress-fields",children:"DeliveryAddress Fields"}),`
26
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface DeliveryAddress {
27
+ country: string; // Country (required)
28
+ address: string; // Street address (required)
29
+ address2?: string; // Address line 2 (optional)
30
+ city: string; // City (required)
31
+ state: string; // State/Province (required)
32
+ zipCode: string; // Postal code (required)
33
+ }
34
+ `})}),`
35
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Important:"})," When customizing components, you must update all required fields through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"}),"."]}),`
36
+ `,e.jsx(n.h3,{id:"using-checkoutprovider",children:"Using CheckoutProvider"}),`
37
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," is the foundation of any custom checkout flow. It provides the context and state management needed for all checkout-related functionality. All your custom components must be wrapped within ",e.jsx(n.code,{children:"CheckoutProvider"}),"."]}),`
38
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," props are identical to ",e.jsx(n.code,{children:"CheckoutPage"}),", supporting the following:"]}),`
39
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Props:"})}),`
40
+ `,e.jsxs(n.ul,{children:[`
41
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"cart: CartItem[]"})," - Array of cart items. Each item must include ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),". ",e.jsx(n.strong,{children:"Note:"})," Even for a single product, pass it as an array with one item."]}),`
42
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"children: ReactNode"})," - Child components to be wrapped"]}),`
43
+ `]}),`
44
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Props:"})}),`
45
+ `,e.jsxs(n.ul,{children:[`
46
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onCheckoutInit?: () => void"})," - Callback function triggered when checkout initializes (immediately after component mount)"]}),`
47
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"googleApiKey?: string"})," - Google Places API Key for enabling address autocomplete functionality"]}),`
48
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when payment information is complete"]}),`
49
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when order is submitted"]}),`
50
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSuccess?: (orderCode: string, tradeCode?: string) => void"})," - Callback triggered when order succeeds"]}),`
51
+ `]}),`
52
+ `,e.jsxs(n.p,{children:["For detailed parameter descriptions, see ",e.jsx(n.a,{href:"./?path=/docs/documentation-usage-guide-checkoutpage--docs",children:"CheckoutPage Documentation"}),"."]}),`
53
+ `,e.jsx(n.h3,{id:"building-custom-components",children:"Building Custom Components"}),`
54
+ `,e.jsx(n.p,{children:"Now let's see how to build custom components step by step. Each component uses hooks to access and update the checkout state."}),`
55
+ `,e.jsx(n.h4,{id:"custom-customer-info-component",children:"Custom Customer Info Component"}),`
56
+ `,e.jsxs(n.p,{children:["Use the ",e.jsx(n.code,{children:"useCheckoutContext"})," hook to access ",e.jsx(n.code,{children:"customerInfo"})," and ",e.jsx(n.code,{children:"updateCustomerInfo"}),":"]}),`
57
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
58
+
59
+ function CustomCustomerInfo() {
60
+ const { customerInfo, updateCustomerInfo } = useCheckoutContext();
61
+
62
+ return (
63
+ <div>
64
+ <input
65
+ value={customerInfo.firstName}
66
+ onChange={(e) => updateCustomerInfo({ firstName: e.target.value })}
67
+ placeholder="First Name"
68
+ />
69
+ <input
70
+ value={customerInfo.lastName}
71
+ onChange={(e) => updateCustomerInfo({ lastName: e.target.value })}
72
+ placeholder="Last Name"
73
+ />
74
+ <input
75
+ type="email"
76
+ value={customerInfo.email}
77
+ onChange={(e) => updateCustomerInfo({ email: e.target.value })}
78
+ placeholder="Email"
79
+ />
80
+ <input
81
+ type="tel"
82
+ value={customerInfo.phone}
83
+ onChange={(e) => updateCustomerInfo({ phone: e.target.value })}
84
+ placeholder="Phone"
85
+ />
86
+ </div>
87
+ );
88
+ }
89
+ `})}),`
90
+ `,e.jsx(n.h4,{id:"custom-delivery-address-component",children:"Custom Delivery Address Component"}),`
91
+ `,e.jsxs(n.p,{children:["Similarly, use ",e.jsx(n.code,{children:"updateDeliveryAddress"})," to update address information:"]}),`
92
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
93
+
94
+ function CustomDeliveryAddress() {
95
+ const { deliveryAddress, updateDeliveryAddress } = useCheckoutContext();
96
+
97
+ return (
98
+ <div>
99
+ <input
100
+ value={deliveryAddress.country || ''}
101
+ onChange={(e) => updateDeliveryAddress({ country: e.target.value })}
102
+ placeholder="Country"
103
+ />
104
+ <input
105
+ value={deliveryAddress.address || ''}
106
+ onChange={(e) => updateDeliveryAddress({ address: e.target.value })}
107
+ placeholder="Street Address"
108
+ />
109
+ <input
110
+ value={deliveryAddress.city || ''}
111
+ onChange={(e) => updateDeliveryAddress({ city: e.target.value })}
112
+ placeholder="City"
113
+ />
114
+ <input
115
+ value={deliveryAddress.state || ''}
116
+ onChange={(e) => updateDeliveryAddress({ state: e.target.value })}
117
+ placeholder="State/Province"
118
+ />
119
+ <input
120
+ value={deliveryAddress.zipCode || ''}
121
+ onChange={(e) => updateDeliveryAddress({ zipCode: e.target.value })}
122
+ placeholder="ZIP Code"
123
+ />
124
+ </div>
125
+ );
126
+ }
127
+ `})}),`
128
+ `,e.jsx(n.h4,{id:"custom-submit-button-component",children:"Custom Submit Button Component"}),`
129
+ `,e.jsxs(n.p,{children:["Use ",e.jsx(n.code,{children:"useOrderSubmission"})," hook to handle order submission and ",e.jsx(n.code,{children:"isFormValid()"})," to check form validity:"]}),`
130
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext, useOrderSubmission } from '@clickaroo/checkout-ui';
131
+
132
+ function CustomSubmitButton() {
133
+ const { isFormValid } = useCheckoutContext();
134
+ const { isSubmitting, submitOrder } = useOrderSubmission();
135
+
136
+ const handleSubmit = async () => {
137
+ // Always check form validity before submitting
138
+ if (!isFormValid()) {
139
+ alert('Please complete all required fields');
140
+ return;
141
+ }
142
+
143
+ const result = await submitOrder();
144
+
145
+ if (result.success) {
146
+ console.log('Order successful', result.orderCode);
147
+ // Handle success (e.g., redirect to success page)
148
+ } else {
149
+ console.error('Order failed', result.message);
150
+ // Handle error (e.g., show error message)
151
+ }
152
+ };
153
+
154
+ return (
155
+ <button
156
+ onClick={handleSubmit}
157
+ disabled={!isFormValid() || isSubmitting}
158
+ >
159
+ {isSubmitting ? 'Processing...' : 'Complete Order'}
160
+ </button>
161
+ );
162
+ }
163
+ `})}),`
164
+ `,e.jsx(n.h3,{id:"complete-example",children:"Complete Example"}),`
165
+ `,e.jsx(n.p,{children:"Here's a complete example putting it all together:"}),`
166
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import {
167
+ CheckoutProvider,
168
+ PaymentMethods,
169
+ useCheckoutContext,
170
+ useOrderSubmission
171
+ } from '@clickaroo/checkout-ui';
172
+
173
+ // ... (include the custom components above)
174
+
175
+ function CustomCheckoutPage() {
176
+ const cart = [
177
+ {
178
+ sku: "TEST001",
179
+ offerPricePoint: "OPP-XXX",
180
+ title: "Product 1",
181
+ price: 99.99,
182
+ },
183
+ ];
184
+
185
+ return (
186
+ <CheckoutProvider
187
+ cart={cart}
188
+ googleApiKey="YOUR_GOOGLE_API_KEY"
189
+ onCheckoutInit={() => {
190
+ console.log('Checkout initialized');
191
+ }}
192
+ onPaymentInfoComplete={(products, totalAmount) => {
193
+ console.log('Payment info complete', products, totalAmount);
194
+ }}
195
+ onOrderSubmit={(products, totalAmount) => {
196
+ console.log('Order submitted', products, totalAmount);
197
+ }}
198
+ onOrderSuccess={(orderCode, tradeCode) => {
199
+ console.log('Order successful', orderCode, tradeCode);
200
+ }}
201
+ >
202
+ <CustomCustomerInfo />
203
+ <CustomDeliveryAddress />
204
+ {/* PaymentMethods is required - cannot be customized */}
205
+ <PaymentMethods />
206
+ <CustomSubmitButton />
207
+ </CheckoutProvider>
208
+ );
209
+ }
210
+ `})}),`
211
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Key Point:"})," All components must be wrapped in ",e.jsx(n.code,{children:"CheckoutProvider"})]})]})}function A(t={}){const{wrapper:n}={...s(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{A as default};
@@ -0,0 +1,211 @@
1
+ import{j as e}from"./jsx-runtime-DiklIkkE.js";import{useMDXComponents as s}from"./index-ChEI-nsM.js";import{M as r,C as i}from"./index-CZFGp9Su.js";import{C as d,D as c}from"./CustomCheckout.stories-F2GZKkIG.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";/* empty css */import"./CheckoutPage-CrHN6Fcv.js";import"./CustomerInfo-D3WHpN32.js";import"./ValidateInput-DcnOO9py.js";import"./DeliveryAddress-Lfanl1PO.js";import"./PaymentMethods-e9HqQtxN.js";function o(t){const n={a:"a",code:"code",h1:"h1",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...s(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{of:d,title:"Components/CustomCheckout",name:"CustomCheckout (English)"}),`
2
+ `,e.jsx(n.h1,{id:"customcheckout",children:"CustomCheckout"}),`
3
+ `,e.jsxs(n.p,{children:["While the ",e.jsx(n.code,{children:"CheckoutPage"})," component provides a complete, ready-to-use checkout solution, you may need more control over the layout, styling, or user experience. This guide explains how to build a completely custom checkout flow by using the library's hooks and context, while still leveraging the core functionality."]}),`
4
+ `,e.jsxs(n.p,{children:["The example above demonstrates a fully customized checkout page with custom styling, where we use the library's ",e.jsx(n.code,{children:"PaymentMethods"})," component (which is required) and build custom components for customer information, delivery address, and the submit button."]}),`
5
+ `,e.jsx(i,{of:c}),`
6
+ `,e.jsx(n.h3,{id:"overview",children:"Overview"}),`
7
+ `,e.jsx(n.p,{children:"When building a custom checkout flow, you'll need to:"}),`
8
+ `,e.jsxs(n.ol,{children:[`
9
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Wrap your components"})," in ",e.jsx(n.code,{children:"CheckoutProvider"})," to access the checkout context"]}),`
10
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Use hooks"})," (",e.jsx(n.code,{children:"useCheckoutContext"}),", ",e.jsx(n.code,{children:"useOrderSubmission"}),") to access and update form data"]}),`
11
+ `,e.jsxs(n.li,{children:[e.jsxs(n.strong,{children:["Use the ",e.jsx(n.code,{children:"PaymentMethods"})," component"]})," from the library (required - cannot be customized)"]}),`
12
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Update form data"})," through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"})," methods"]}),`
13
+ `,e.jsxs(n.li,{children:[e.jsx(n.strong,{children:"Submit orders"})," using the ",e.jsx(n.code,{children:"useOrderSubmission"})," hook"]}),`
14
+ `]}),`
15
+ `,e.jsx(n.h3,{id:"understanding-form-data-structure",children:"Understanding Form Data Structure"}),`
16
+ `,e.jsxs(n.p,{children:["When customizing components, you need to ensure all required fields are updated correctly. The library uses two main data structures: ",e.jsx(n.code,{children:"CustomerInfo"})," and ",e.jsx(n.code,{children:"DeliveryAddress"}),". Understanding these structures is crucial for building custom components that work seamlessly with the checkout flow."]}),`
17
+ `,e.jsx(n.h4,{id:"customerinfo-fields",children:"CustomerInfo Fields"}),`
18
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface CustomerInfo {
19
+ firstName: string; // First name (required)
20
+ lastName: string; // Last name (required)
21
+ email: string; // Email (required, must be valid email format)
22
+ phone: string; // Phone (required, E.164 format)
23
+ }
24
+ `})}),`
25
+ `,e.jsx(n.h4,{id:"deliveryaddress-fields",children:"DeliveryAddress Fields"}),`
26
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`interface DeliveryAddress {
27
+ country: string; // Country (required)
28
+ address: string; // Street address (required)
29
+ address2?: string; // Address line 2 (optional)
30
+ city: string; // City (required)
31
+ state: string; // State/Province (required)
32
+ zipCode: string; // Postal code (required)
33
+ }
34
+ `})}),`
35
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Important:"})," When customizing components, you must update all required fields through ",e.jsx(n.code,{children:"updateCustomerInfo"})," and ",e.jsx(n.code,{children:"updateDeliveryAddress"}),"."]}),`
36
+ `,e.jsx(n.h3,{id:"using-checkoutprovider",children:"Using CheckoutProvider"}),`
37
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," is the foundation of any custom checkout flow. It provides the context and state management needed for all checkout-related functionality. All your custom components must be wrapped within ",e.jsx(n.code,{children:"CheckoutProvider"}),"."]}),`
38
+ `,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"CheckoutProvider"})," props are identical to ",e.jsx(n.code,{children:"CheckoutPage"}),", supporting the following:"]}),`
39
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Required Props:"})}),`
40
+ `,e.jsxs(n.ul,{children:[`
41
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"cart: CartItem[]"})," - Array of cart items. Each item must include ",e.jsx(n.code,{children:"sku"})," and ",e.jsx(n.code,{children:"offerPricePoint"}),". ",e.jsx(n.strong,{children:"Note:"})," Even for a single product, pass it as an array with one item."]}),`
42
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"children: ReactNode"})," - Child components to be wrapped"]}),`
43
+ `]}),`
44
+ `,e.jsx(n.p,{children:e.jsx(n.strong,{children:"Optional Props:"})}),`
45
+ `,e.jsxs(n.ul,{children:[`
46
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onCheckoutInit?: () => void"})," - Callback function triggered when checkout initializes (immediately after component mount)"]}),`
47
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"googleApiKey?: string"})," - Google Places API Key for enabling address autocomplete functionality"]}),`
48
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onPaymentInfoComplete?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when payment information is complete"]}),`
49
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSubmit?: (products: CheckoutCartItem[], totalAmount: number) => void"})," - Callback triggered when order is submitted"]}),`
50
+ `,e.jsxs(n.li,{children:[e.jsx(n.code,{children:"onOrderSuccess?: (orderCode: string, tradeCode?: string) => void"})," - Callback triggered when order succeeds"]}),`
51
+ `]}),`
52
+ `,e.jsxs(n.p,{children:["For detailed parameter descriptions, see ",e.jsx(n.a,{href:"./?path=/docs/documentation-usage-guide-checkoutpage--docs",children:"CheckoutPage Documentation"}),"."]}),`
53
+ `,e.jsx(n.h3,{id:"building-custom-components",children:"Building Custom Components"}),`
54
+ `,e.jsx(n.p,{children:"Now let's see how to build custom components step by step. Each component uses hooks to access and update the checkout state."}),`
55
+ `,e.jsx(n.h4,{id:"custom-customer-info-component",children:"Custom Customer Info Component"}),`
56
+ `,e.jsxs(n.p,{children:["Use the ",e.jsx(n.code,{children:"useCheckoutContext"})," hook to access ",e.jsx(n.code,{children:"customerInfo"})," and ",e.jsx(n.code,{children:"updateCustomerInfo"}),":"]}),`
57
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
58
+
59
+ function CustomCustomerInfo() {
60
+ const { customerInfo, updateCustomerInfo } = useCheckoutContext();
61
+
62
+ return (
63
+ <div>
64
+ <input
65
+ value={customerInfo.firstName}
66
+ onChange={(e) => updateCustomerInfo({ firstName: e.target.value })}
67
+ placeholder="First Name"
68
+ />
69
+ <input
70
+ value={customerInfo.lastName}
71
+ onChange={(e) => updateCustomerInfo({ lastName: e.target.value })}
72
+ placeholder="Last Name"
73
+ />
74
+ <input
75
+ type="email"
76
+ value={customerInfo.email}
77
+ onChange={(e) => updateCustomerInfo({ email: e.target.value })}
78
+ placeholder="Email"
79
+ />
80
+ <input
81
+ type="tel"
82
+ value={customerInfo.phone}
83
+ onChange={(e) => updateCustomerInfo({ phone: e.target.value })}
84
+ placeholder="Phone"
85
+ />
86
+ </div>
87
+ );
88
+ }
89
+ `})}),`
90
+ `,e.jsx(n.h4,{id:"custom-delivery-address-component",children:"Custom Delivery Address Component"}),`
91
+ `,e.jsxs(n.p,{children:["Similarly, use ",e.jsx(n.code,{children:"updateDeliveryAddress"})," to update address information:"]}),`
92
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext } from '@clickaroo/checkout-ui';
93
+
94
+ function CustomDeliveryAddress() {
95
+ const { deliveryAddress, updateDeliveryAddress } = useCheckoutContext();
96
+
97
+ return (
98
+ <div>
99
+ <input
100
+ value={deliveryAddress.country || ''}
101
+ onChange={(e) => updateDeliveryAddress({ country: e.target.value })}
102
+ placeholder="Country"
103
+ />
104
+ <input
105
+ value={deliveryAddress.address || ''}
106
+ onChange={(e) => updateDeliveryAddress({ address: e.target.value })}
107
+ placeholder="Street Address"
108
+ />
109
+ <input
110
+ value={deliveryAddress.city || ''}
111
+ onChange={(e) => updateDeliveryAddress({ city: e.target.value })}
112
+ placeholder="City"
113
+ />
114
+ <input
115
+ value={deliveryAddress.state || ''}
116
+ onChange={(e) => updateDeliveryAddress({ state: e.target.value })}
117
+ placeholder="State/Province"
118
+ />
119
+ <input
120
+ value={deliveryAddress.zipCode || ''}
121
+ onChange={(e) => updateDeliveryAddress({ zipCode: e.target.value })}
122
+ placeholder="ZIP Code"
123
+ />
124
+ </div>
125
+ );
126
+ }
127
+ `})}),`
128
+ `,e.jsx(n.h4,{id:"custom-submit-button-component",children:"Custom Submit Button Component"}),`
129
+ `,e.jsxs(n.p,{children:["Use ",e.jsx(n.code,{children:"useOrderSubmission"})," hook to handle order submission and ",e.jsx(n.code,{children:"isFormValid()"})," to check form validity:"]}),`
130
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import { useCheckoutContext, useOrderSubmission } from '@clickaroo/checkout-ui';
131
+
132
+ function CustomSubmitButton() {
133
+ const { isFormValid } = useCheckoutContext();
134
+ const { isSubmitting, submitOrder } = useOrderSubmission();
135
+
136
+ const handleSubmit = async () => {
137
+ // Always check form validity before submitting
138
+ if (!isFormValid()) {
139
+ alert('Please complete all required fields');
140
+ return;
141
+ }
142
+
143
+ const result = await submitOrder();
144
+
145
+ if (result.success) {
146
+ console.log('Order successful', result.orderCode);
147
+ // Handle success (e.g., redirect to success page)
148
+ } else {
149
+ console.error('Order failed', result.message);
150
+ // Handle error (e.g., show error message)
151
+ }
152
+ };
153
+
154
+ return (
155
+ <button
156
+ onClick={handleSubmit}
157
+ disabled={!isFormValid() || isSubmitting}
158
+ >
159
+ {isSubmitting ? 'Processing...' : 'Complete Order'}
160
+ </button>
161
+ );
162
+ }
163
+ `})}),`
164
+ `,e.jsx(n.h3,{id:"complete-example",children:"Complete Example"}),`
165
+ `,e.jsx(n.p,{children:"Here's a complete example putting it all together:"}),`
166
+ `,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-tsx",children:`import {
167
+ CheckoutProvider,
168
+ PaymentMethods,
169
+ useCheckoutContext,
170
+ useOrderSubmission
171
+ } from '@clickaroo/checkout-ui';
172
+
173
+ // ... (include the custom components above)
174
+
175
+ function CustomCheckoutPage() {
176
+ const cart = [
177
+ {
178
+ sku: "TEST001",
179
+ offerPricePoint: "OPP-XXX",
180
+ title: "Product 1",
181
+ price: 99.99,
182
+ },
183
+ ];
184
+
185
+ return (
186
+ <CheckoutProvider
187
+ cart={cart}
188
+ googleApiKey="YOUR_GOOGLE_API_KEY"
189
+ onCheckoutInit={() => {
190
+ console.log('Checkout initialized');
191
+ }}
192
+ onPaymentInfoComplete={(products, totalAmount) => {
193
+ console.log('Payment info complete', products, totalAmount);
194
+ }}
195
+ onOrderSubmit={(products, totalAmount) => {
196
+ console.log('Order submitted', products, totalAmount);
197
+ }}
198
+ onOrderSuccess={(orderCode, tradeCode) => {
199
+ console.log('Order successful', orderCode, tradeCode);
200
+ }}
201
+ >
202
+ <CustomCustomerInfo />
203
+ <CustomDeliveryAddress />
204
+ {/* PaymentMethods is required - cannot be customized */}
205
+ <PaymentMethods />
206
+ <CustomSubmitButton />
207
+ </CheckoutProvider>
208
+ );
209
+ }
210
+ `})}),`
211
+ `,e.jsxs(n.p,{children:[e.jsx(n.strong,{children:"Key Point:"})," All components must be wrapped in ",e.jsx(n.code,{children:"CheckoutProvider"})]})]})}function A(t={}){const{wrapper:n}={...s(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{A as default};