@commercelayer/react-components 4.5.1 → 4.5.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/lib/cjs/components/MetadataInput.d.ts +1 -0
  2. package/lib/cjs/components/addresses/Address.d.ts +1 -0
  3. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -0
  4. package/lib/cjs/components/addresses/AddressInput.d.ts +1 -0
  5. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -0
  6. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -0
  7. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +1 -0
  8. package/lib/cjs/components/auth/CommerceLayer.d.ts +1 -0
  9. package/lib/cjs/components/customers/CustomerContainer.d.ts +1 -0
  10. package/lib/cjs/components/customers/CustomerField.d.ts +1 -0
  11. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -0
  12. package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -0
  13. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
  14. package/lib/cjs/components/customers/MyAccountLink.d.ts +1 -0
  15. package/lib/cjs/components/customers/MyIdentityLink.d.ts +1 -0
  16. package/lib/cjs/components/errors/Errors.d.ts +1 -0
  17. package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -0
  18. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
  19. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -0
  20. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
  21. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
  22. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
  23. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
  24. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
  25. package/lib/cjs/components/line_items/LineItem.d.ts +1 -0
  26. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -0
  27. package/lib/cjs/components/line_items/LineItemCode.d.ts +1 -0
  28. package/lib/cjs/components/line_items/LineItemField.d.ts +1 -0
  29. package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -0
  30. package/lib/cjs/components/line_items/LineItemName.d.ts +1 -0
  31. package/lib/cjs/components/line_items/LineItemsContainer.d.ts +1 -0
  32. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -0
  33. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -0
  34. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -0
  35. package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -0
  36. package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -0
  37. package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -0
  38. package/lib/cjs/components/orders/HostedCart.d.ts +2 -0
  39. package/lib/cjs/components/orders/HostedCart.js +1 -1
  40. package/lib/cjs/components/orders/OrderContainer.d.ts +1 -0
  41. package/lib/cjs/components/orders/OrderList.d.ts +1 -0
  42. package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -0
  43. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -0
  44. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -0
  45. package/lib/cjs/components/orders/OrderListRow.d.ts +1 -0
  46. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -0
  47. package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -0
  48. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  49. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
  50. package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -0
  51. package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -0
  52. package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -0
  53. package/lib/cjs/components/orders/TotalAmount.d.ts +1 -0
  54. package/lib/cjs/components/parcels/ParcelField.d.ts +1 -0
  55. package/lib/cjs/components/parcels/ParcelLineItem.d.ts +1 -0
  56. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +1 -0
  57. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -0
  58. package/lib/cjs/components/parcels/Parcels.d.ts +1 -0
  59. package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -0
  60. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -0
  61. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -0
  62. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
  63. package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -0
  64. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -0
  65. package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -1
  66. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +1 -0
  67. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -0
  68. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -0
  69. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -0
  70. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -0
  71. package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -0
  72. package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
  73. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +2 -1
  74. package/lib/cjs/components/payment_source/BraintreePayment.js +1 -1
  75. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +1 -0
  76. package/lib/cjs/components/payment_source/ExternalPayment.d.ts +1 -0
  77. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -0
  78. package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -1
  79. package/lib/cjs/components/payment_source/PaymentSource.d.ts +1 -0
  80. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
  81. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
  82. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -0
  83. package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +1 -0
  84. package/lib/cjs/components/payment_source/StripePayment.d.ts +1 -0
  85. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +1 -0
  86. package/lib/cjs/components/prices/Price.d.ts +1 -0
  87. package/lib/cjs/components/prices/PricesContainer.d.ts +1 -0
  88. package/lib/cjs/components/shipments/Shipment.js +1 -1
  89. package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -0
  90. package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
  91. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -0
  92. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -0
  93. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
  94. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +1 -0
  95. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +1 -0
  96. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +1 -0
  97. package/lib/cjs/components/skus/SkuField.d.ts +1 -0
  98. package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +1 -0
  99. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +1 -0
  100. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -0
  101. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -0
  102. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +1 -0
  103. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -0
  104. package/lib/cjs/components/utils/getAllErrors.d.ts +1 -0
  105. package/lib/cjs/typings/globals.d.ts +1 -0
  106. package/lib/cjs/utils/filterChildren.d.ts +1 -0
  107. package/lib/cjs/utils/getCardDetails.d.ts +1 -1
  108. package/lib/cjs/utils/getCardDetails.js +1 -1
  109. package/lib/cjs/utils/getLoaderComponent.d.ts +1 -0
  110. package/lib/cjs/utils/getPrices.d.ts +1 -0
  111. package/lib/cjs/utils/shipments.js +1 -1
  112. package/lib/cjs/utils/validateFormFields.js +1 -1
  113. package/lib/esm/components/MetadataInput.d.ts +1 -0
  114. package/lib/esm/components/addresses/Address.d.ts +1 -0
  115. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -0
  116. package/lib/esm/components/addresses/AddressInput.d.ts +1 -0
  117. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -0
  118. package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -0
  119. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +1 -0
  120. package/lib/esm/components/auth/CommerceLayer.d.ts +1 -0
  121. package/lib/esm/components/customers/CustomerContainer.d.ts +1 -0
  122. package/lib/esm/components/customers/CustomerField.d.ts +1 -0
  123. package/lib/esm/components/customers/CustomerInput.d.ts +1 -0
  124. package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -0
  125. package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
  126. package/lib/esm/components/customers/MyAccountLink.d.ts +1 -0
  127. package/lib/esm/components/customers/MyIdentityLink.d.ts +1 -0
  128. package/lib/esm/components/errors/Errors.d.ts +1 -0
  129. package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -0
  130. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
  131. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -0
  132. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
  133. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
  134. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
  135. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
  136. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
  137. package/lib/esm/components/line_items/LineItem.d.ts +1 -0
  138. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -0
  139. package/lib/esm/components/line_items/LineItemCode.d.ts +1 -0
  140. package/lib/esm/components/line_items/LineItemField.d.ts +1 -0
  141. package/lib/esm/components/line_items/LineItemImage.d.ts +1 -0
  142. package/lib/esm/components/line_items/LineItemName.d.ts +1 -0
  143. package/lib/esm/components/line_items/LineItemsContainer.d.ts +1 -0
  144. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -0
  145. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -0
  146. package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -0
  147. package/lib/esm/components/orders/CheckoutLink.d.ts +1 -0
  148. package/lib/esm/components/orders/DiscountAmount.d.ts +1 -0
  149. package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -0
  150. package/lib/esm/components/orders/HostedCart.d.ts +2 -0
  151. package/lib/esm/components/orders/HostedCart.js +1 -1
  152. package/lib/esm/components/orders/OrderContainer.d.ts +1 -0
  153. package/lib/esm/components/orders/OrderList.d.ts +1 -0
  154. package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -0
  155. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -0
  156. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -0
  157. package/lib/esm/components/orders/OrderListRow.d.ts +1 -0
  158. package/lib/esm/components/orders/OrderNumber.d.ts +1 -0
  159. package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -0
  160. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  161. package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
  162. package/lib/esm/components/orders/ShippingAmount.d.ts +1 -0
  163. package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -0
  164. package/lib/esm/components/orders/TaxesAmount.d.ts +1 -0
  165. package/lib/esm/components/orders/TotalAmount.d.ts +1 -0
  166. package/lib/esm/components/parcels/ParcelField.d.ts +1 -0
  167. package/lib/esm/components/parcels/ParcelLineItem.d.ts +1 -0
  168. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +1 -0
  169. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -0
  170. package/lib/esm/components/parcels/Parcels.d.ts +1 -0
  171. package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -0
  172. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -0
  173. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -0
  174. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
  175. package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -0
  176. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -0
  177. package/lib/esm/components/payment_gateways/KlarnaGateway.js +1 -1
  178. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +1 -0
  179. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -0
  180. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -0
  181. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -0
  182. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -0
  183. package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -0
  184. package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
  185. package/lib/esm/components/payment_source/BraintreePayment.d.ts +2 -1
  186. package/lib/esm/components/payment_source/BraintreePayment.js +1 -1
  187. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +1 -0
  188. package/lib/esm/components/payment_source/ExternalPayment.d.ts +1 -0
  189. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -0
  190. package/lib/esm/components/payment_source/KlarnaPayment.js +1 -1
  191. package/lib/esm/components/payment_source/PaymentSource.d.ts +1 -0
  192. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
  193. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
  194. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -0
  195. package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +1 -0
  196. package/lib/esm/components/payment_source/StripePayment.d.ts +1 -0
  197. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +1 -0
  198. package/lib/esm/components/prices/Price.d.ts +1 -0
  199. package/lib/esm/components/prices/PricesContainer.d.ts +1 -0
  200. package/lib/esm/components/shipments/Shipment.js +1 -1
  201. package/lib/esm/components/shipments/ShipmentField.d.ts +1 -0
  202. package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
  203. package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -0
  204. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -0
  205. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
  206. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +1 -0
  207. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +1 -0
  208. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +1 -0
  209. package/lib/esm/components/skus/SkuField.d.ts +1 -0
  210. package/lib/esm/components/stock_transfers/StockTransfer.d.ts +1 -0
  211. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +1 -0
  212. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -0
  213. package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -0
  214. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +1 -0
  215. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -0
  216. package/lib/esm/components/utils/getAllErrors.d.ts +1 -0
  217. package/lib/esm/typings/globals.d.ts +1 -0
  218. package/lib/esm/utils/filterChildren.d.ts +1 -0
  219. package/lib/esm/utils/getCardDetails.d.ts +1 -1
  220. package/lib/esm/utils/getCardDetails.js +1 -1
  221. package/lib/esm/utils/getLoaderComponent.d.ts +1 -0
  222. package/lib/esm/utils/getPrices.d.ts +1 -0
  223. package/lib/esm/utils/shipments.js +1 -1
  224. package/lib/esm/utils/validateFormFields.js +1 -1
  225. package/package.json +22 -22
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  import type { StripeElementLocale } from '@stripe/stripe-js';
3
4
  import { type PaymentSourceProps } from './PaymentSource';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
3
  import { type PaymentSourceProps } from './PaymentSource';
3
4
  type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),useExternalScript_1=tslib_1.__importDefault(require("../../utils/hooks/useExternalScript"));function typeOfLine(lineItemType){switch(lineItemType){case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}function klarnaOrderLines(lineItems){return lineItems?lineItems?.map(item=>{const type=item.item_type?typeOfLine(item.item_type):null;return{quantity:item.quantity,total_amount:item.total_amount_cents,unit_price:item.unit_amount_cents,type}}):[]}function KlarnaPayment(_a){var _b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,{clientToken,placeOrderCallback,locale="EN"}=_a,p=tslib_1.__rest(_a,["clientToken","placeOrderCallback","locale"]);const ref=(0,react_1.useRef)(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentMethodErrors}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),loaded=(0,useExternalScript_1.default)("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=(0,react_1.useState)(),{containerClassName}=p,divProps=tslib_1.__rest(p,["containerClassName"]);(0,react_1.useEffect)(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),(0,react_1.useEffect)(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield handleClick(klarna)}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=kl=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _v,_w,_x,_y,_z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10;const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategory=first?.identifier,billingAddress={given_name:(_v=order?.billing_address)===null||_v===void 0?void 0:_v.first_name,family_name:(_w=order?.billing_address)===null||_w===void 0?void 0:_w.last_name,email:order?.customer_email,street_address:(_x=order?.billing_address)===null||_x===void 0?void 0:_x.line_1,street_address2:null,organization_name:null,postal_code:(_y=order?.billing_address)===null||_y===void 0?void 0:_y.zip_code,city:(_z=order?.billing_address)===null||_z===void 0?void 0:_z.city,region:(_0=order?.billing_address)===null||_0===void 0?void 0:_0.state_code,phone:(_1=order?.billing_address)===null||_1===void 0?void 0:_1.phone,country:(_2=order?.billing_address)===null||_2===void 0?void 0:_2.country_code},shippingAddress={given_name:(_3=order?.shipping_address)===null||_3===void 0?void 0:_3.first_name,family_name:(_4=order?.shipping_address)===null||_4===void 0?void 0:_4.last_name,email:order?.customer_email,street_address:(_5=order?.shipping_address)===null||_5===void 0?void 0:_5.line_1,street_address2:null,postal_code:(_6=order?.shipping_address)===null||_6===void 0?void 0:_6.zip_code,organization_name:null,city:(_7=order?.shipping_address)===null||_7===void 0?void 0:_7.city,region:(_8=order?.shipping_address)===null||_8===void 0?void 0:_8.state_code,phone:(_9=order?.shipping_address)===null||_9===void 0?void 0:_9.phone,country:(_10=order?.shipping_address)===null||_10===void 0?void 0:_10.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category:paymentMethodCategory},{billing_address:billingAddress,shipping_address:shippingAddress},function({show_form}){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(show_form)try{yield kl.Payments.authorize({payment_method_category:paymentMethodCategory},klarnaData,function(res){return tslib_1.__awaiter(this,void 0,void 0,function*(){console.log("res",res),console.log("paymentSource",paymentSource),console.log("order",order)})})}catch(e){console.error("e",e),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:"Authorization error"}])}})})}catch(e){console.error("Load Klarna libray",e)}});if(klarna&&clientToken){const[first]=paymentSource?.payment_methods||void 0;klarna.Payments.init({client_token:clientToken}),klarna.Payments.load({container:"#klarna-payments-container",payment_method_category:first?.identifier},{billing_address:{given_name:(_b=order?.billing_address)===null||_b===void 0?void 0:_b.first_name,family_name:(_c=order?.billing_address)===null||_c===void 0?void 0:_c.last_name,email:order?.customer_email,street_address:(_d=order?.billing_address)===null||_d===void 0?void 0:_d.line_1,street_address2:(_e=order?.billing_address)===null||_e===void 0?void 0:_e.line_2,postal_code:(_f=order?.billing_address)===null||_f===void 0?void 0:_f.zip_code,city:(_g=order?.billing_address)===null||_g===void 0?void 0:_g.city,region:(_h=order?.billing_address)===null||_h===void 0?void 0:_h.state_code,phone:(_j=order?.billing_address)===null||_j===void 0?void 0:_j.phone,country:(_k=order?.billing_address)===null||_k===void 0?void 0:_k.country_code},shipping_address:{given_name:(_l=order?.shipping_address)===null||_l===void 0?void 0:_l.first_name,family_name:(_m=order?.shipping_address)===null||_m===void 0?void 0:_m.last_name,street_address:(_o=order?.shipping_address)===null||_o===void 0?void 0:_o.line_1,street_address2:(_p=order?.shipping_address)===null||_p===void 0?void 0:_p.line_2,postal_code:(_q=order?.shipping_address)===null||_q===void 0?void 0:_q.zip_code,city:(_r=order?.shipping_address)===null||_r===void 0?void 0:_r.city,region:(_s=order?.shipping_address)===null||_s===void 0?void 0:_s.state_code,phone:(_t=order?.shipping_address)===null||_t===void 0?void 0:_t.phone,country:(_u=order?.shipping_address)===null||_u===void 0?void 0:_u.country_code}})}return(0,jsx_runtime_1.jsx)("form",{ref,children:(0,jsx_runtime_1.jsx)("div",Object.assign({className:containerClassName},divProps,{children:(0,jsx_runtime_1.jsx)("div",{id:"klarna-payments-container"})}))})}exports.default=KlarnaPayment;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),useExternalScript_1=tslib_1.__importDefault(require("../../utils/hooks/useExternalScript"));function typeOfLine(lineItemType){switch(lineItemType){case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}function klarnaOrderLines(lineItems){return lineItems?lineItems?.map(item=>{const type=item.item_type?typeOfLine(item.item_type):null;return{quantity:item.quantity,total_amount:item.total_amount_cents,unit_price:item.unit_amount_cents,type}}):[]}function KlarnaPayment(_a){var{clientToken,placeOrderCallback,locale="EN"}=_a,p=tslib_1.__rest(_a,["clientToken","placeOrderCallback","locale"]);const ref=(0,react_1.useRef)(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),loaded=(0,useExternalScript_1.default)("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=(0,react_1.useState)(),{containerClassName}=p,divProps=tslib_1.__rest(p,["containerClassName"]);(0,react_1.useEffect)(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),(0,react_1.useEffect)(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=props=>tslib_1.__awaiter(this,void 0,void 0,function*(){handleClick(klarna,props)}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=(kl,props)=>{var _a2,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r;console.log("props",props);const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategories=first?.identifier,billingAddress={given_name:(_a2=order?.billing_address)===null||_a2===void 0?void 0:_a2.first_name,family_name:(_b=order?.billing_address)===null||_b===void 0?void 0:_b.last_name,email:order?.customer_email,street_address:(_c=order?.billing_address)===null||_c===void 0?void 0:_c.line_1,street_address2:null,organization_name:null,postal_code:(_d=order?.billing_address)===null||_d===void 0?void 0:_d.zip_code,city:(_e=order?.billing_address)===null||_e===void 0?void 0:_e.city,region:(_f=order?.billing_address)===null||_f===void 0?void 0:_f.state_code,phone:(_g=order?.billing_address)===null||_g===void 0?void 0:_g.phone,country:(_h=order?.billing_address)===null||_h===void 0?void 0:_h.country_code},shippingAddress={given_name:(_j=order?.shipping_address)===null||_j===void 0?void 0:_j.first_name,family_name:(_k=order?.shipping_address)===null||_k===void 0?void 0:_k.last_name,email:order?.customer_email,street_address:(_l=order?.shipping_address)===null||_l===void 0?void 0:_l.line_1,street_address2:null,postal_code:(_m=order?.shipping_address)===null||_m===void 0?void 0:_m.zip_code,organization_name:null,city:(_o=order?.shipping_address)===null||_o===void 0?void 0:_o.city,region:(_p=order?.shipping_address)===null||_p===void 0?void 0:_p.state_code,phone:(_q=order?.shipping_address)===null||_q===void 0?void 0:_q.phone,country:(_r=order?.shipping_address)===null||_r===void 0?void 0:_r.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items),order_tax_amount:order?.total_tax_amount_cents};kl.Payments.authorize(Object.assign({payment_method_category:paymentMethodCategories},klarnaData),function(res){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(console.log("res",res),res.approved&&paymentSource&&currentPaymentMethodType){const ps=yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{auth_token:res.authorization_token}});if(props.setPlaceOrder!=null){const placed=yield props.setPlaceOrder({paymentSource:ps});placed&&props.onclickCallback!=null&&props.onclickCallback(placed)}}})})};if(klarna&&clientToken){const[first]=paymentSource?.payment_methods||void 0;klarna.Payments.init({client_token:clientToken}),klarna.Payments.load({container:"#klarna-payments-container",payment_method_category:first?.identifier})}return(0,jsx_runtime_1.jsx)("form",{ref,children:(0,jsx_runtime_1.jsx)("div",Object.assign({className:containerClassName},divProps,{children:(0,jsx_runtime_1.jsx)("div",{id:"klarna-payments-container"})}))})}exports.default=KlarnaPayment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type LoaderType } from '../../typings/index';
2
3
  import { type CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
3
4
  export interface CustomerCardsProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type IconBrand } from '../../context/PaymentSourceContext';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type IconBrand } from '../../context/PaymentSourceContext';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  interface CustomComponent extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ChildrenFunction } from '../../typings/index';
2
3
  export type PaymentSourceDetailType = 'last4' | 'exp_year' | 'exp_month';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  clientSecret: string;
3
4
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type StripeElementLocale, type StripeElementsOptions, type StripePaymentElementOptions } from '@stripe/stripe-js';
2
3
  import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
3
4
  import { type PaymentSourceProps } from './PaymentSource';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface WireTransferConfig {
2
3
  infoMessage?: {
3
4
  text?: string | JSX.Element[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type Price as PriceType } from '@commercelayer/sdk';
2
3
  import { type ChildrenFunction, type LoaderType } from '../../typings/index';
3
4
  interface PriceChildrenProps extends Omit<PriceProps, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type LoaderType } from '../../typings/index';
2
3
  interface Props {
3
4
  children: JSX.Element | JSX.Element[];
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext"));function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=(0,react_1.useState)(!0),{shipments,deliveryLeadTimes,setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default);(0,react_1.useEffect)(()=>(shipments!=null&&(autoSelectSingleShippingMethod?tslib_1.__awaiter(this,void 0,void 0,function*(){var _a;for(const shipment of shipments){const isSingle=((_a=shipment?.available_shipping_methods)===null||_a===void 0?void 0:_a.length)===1;if(!shipment?.shipping_method&&isSingle){const[shippingMethod]=shipment?.available_shipping_methods||[];if(shippingMethod&&setShippingMethod!=null){const{success,order:order2}=yield setShippingMethod(shipment.id,shippingMethod.id);typeof autoSelectSingleShippingMethod=="function"&&success&&autoSelectSingleShippingMethod(order2)}}else setTimeout(()=>{setLoading(!1)},200)}}):setLoading(!1)),()=>{setLoading(!0)}),[shipments!=null,shipments?.length,order?.gift_card_or_coupon_code]);const components=shipments?.map((shipment,k)=>{var _a,_b;const shipmentLineItems=shipment.stock_line_items,lineItems=shipmentLineItems?.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=autoSelectSingleShippingMethod&&shippingMethods&&shippingMethods.length===1?(_a=shippingMethods[0])===null||_a===void 0?void 0:_a.id:(_b=shipment.shipping_method)===null||_b===void 0?void 0:_b.id;console.table([{shippingMethods},{shipment}]);const stockTransfers=shipment.stock_transfers,parcels=shipment.parcels,times=deliveryLeadTimes?.filter(time=>{var _a2,_b2;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b2=shipment.stock_location)===null||_b2===void 0?void 0:_b2.id)}),shipmentProps={parcels,lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:shipment?.id};return(0,jsx_runtime_1.jsx)(ShipmentChildrenContext_1.default.Provider,{value:shipmentProps,children},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Shipment=Shipment,exports.default=Shipment;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext"));function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=(0,react_1.useState)(!0),{shipments,deliveryLeadTimes,setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default);(0,react_1.useEffect)(()=>(shipments!=null&&(autoSelectSingleShippingMethod?tslib_1.__awaiter(this,void 0,void 0,function*(){var _a;for(const shipment of shipments){const isSingle=((_a=shipment?.available_shipping_methods)===null||_a===void 0?void 0:_a.length)===1;if(!shipment?.shipping_method&&isSingle){const[shippingMethod]=shipment?.available_shipping_methods||[];if(shippingMethod&&setShippingMethod!=null){const{success,order:order2}=yield setShippingMethod(shipment.id,shippingMethod.id);typeof autoSelectSingleShippingMethod=="function"&&success&&autoSelectSingleShippingMethod(order2)}}else setTimeout(()=>{setLoading(!1)},200)}}):setLoading(!1)),()=>{setLoading(!0)}),[shipments!=null,shipments?.length,order?.gift_card_or_coupon_code]);const components=shipments?.map((shipment,k)=>{var _a,_b;const shipmentLineItems=shipment.stock_line_items,lineItems=shipmentLineItems?.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=autoSelectSingleShippingMethod&&shippingMethods&&shippingMethods.length===1?(_a=shippingMethods[0])===null||_a===void 0?void 0:_a.id:(_b=shipment.shipping_method)===null||_b===void 0?void 0:_b.id,stockTransfers=shipment.stock_transfers,parcels=shipment.parcels,times=deliveryLeadTimes?.filter(time=>{var _a2,_b2;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b2=shipment.stock_location)===null||_b2===void 0?void 0:_b2.id)}),shipmentProps={parcels,lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:shipment?.id};return(0,jsx_runtime_1.jsx)(ShipmentChildrenContext_1.default.Provider,{value:shipmentProps,children},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Shipment=Shipment,exports.default=Shipment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type Shipment } from '@commercelayer/sdk';
2
3
  type ShipmentFieldChildrenProps = Omit<Props, 'children'> & {
3
4
  shipment: Shipment;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function ShipmentsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(ShipmentReducer_1.default,ShipmentReducer_1.shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default);(0,react_1.useEffect)(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),(0,react_1.useEffect)(()=>{console.log("order?.shipments",order?.shipments),order!=null&&!(0,isEmpty_1.default)(config)&&order.shipments&&(0,ShipmentReducer_1.getShipments)({order,dispatch,config})},[order?.shipments]),(0,react_1.useEffect)(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=lineItem?.quantity)}).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{(0,ShipmentReducer_1.setShipmentErrors)([],dispatch)}),[order?.shipments]);const contextValue=(0,react_1.useMemo)(()=>Object.assign(Object.assign({},state),{setShipmentErrors:errors=>{ShipmentContext_1.defaultShipmentContext.setShipmentErrors(errors,dispatch)},setShippingMethod:(shipmentId,shippingMethodId)=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield(0,ShipmentReducer_1.setShippingMethod)({shippingMethodId,shipmentId,config,getOrder,order})})}),[state]);return(0,jsx_runtime_1.jsx)(ShipmentContext_1.default.Provider,{value:contextValue,children})}exports.ShipmentsContainer=ShipmentsContainer,exports.default=ShipmentsContainer;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function ShipmentsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(ShipmentReducer_1.default,ShipmentReducer_1.shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default);(0,react_1.useEffect)(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),(0,react_1.useEffect)(()=>{order!=null&&!(0,isEmpty_1.default)(config)&&order.shipments&&(0,ShipmentReducer_1.getShipments)({order,dispatch,config})},[order?.shipments]),(0,react_1.useEffect)(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=lineItem?.quantity)}).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{(0,ShipmentReducer_1.setShipmentErrors)([],dispatch)}),[order?.shipments]);const contextValue=(0,react_1.useMemo)(()=>Object.assign(Object.assign({},state),{setShipmentErrors:errors=>{ShipmentContext_1.defaultShipmentContext.setShipmentErrors(errors,dispatch)},setShippingMethod:(shipmentId,shippingMethodId)=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield(0,ShipmentReducer_1.setShippingMethod)({shippingMethodId,shipmentId,config,getOrder,order})})}),[state]);return(0,jsx_runtime_1.jsx)(ShipmentContext_1.default.Provider,{value:contextValue,children})}exports.ShipmentsContainer=ShipmentsContainer,exports.default=ShipmentsContainer;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  import type { Shipment } from '@commercelayer/sdk';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ShippingMethod } from '@commercelayer/sdk';
2
3
  type ChildrenProps = Omit<Props, 'children'> & {
3
4
  label: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseAmountComponent } from '../../typings/index';
2
3
  type Props = BaseAmountComponent & {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Order, ShippingMethod } from '@commercelayer/sdk';
2
3
  interface ShippingMethodRadioButtonType extends Omit<Props, 'children'> {
3
4
  shippingMethod: ShippingMethod;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type TimeFormat, type ChildrenFunction } from '../../typings/index';
2
3
  import { type DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
3
4
  interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, DeliveryLeadTime {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type DeliveryLeadTimeField = 'min_hours' | 'max_hours' | 'min_days' | 'max_days';
2
3
  export type DeliveryLeadTimeComponentChildren = Omit<Props, 'children'>;
3
4
  type Props = Partial<JSX.IntrinsicElements['span']> & {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ConditionalElement } from '../../typings/index';
2
3
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
4
  type SkuFieldChildrenProps = TGenericChildrenProps<TResources['Sku']>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ConditionalElement } from '../../typings/index';
2
3
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
4
  type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Address } from '@commercelayer/sdk';
2
3
  import AddressChildrenContext from '../../context/AddressChildrenContext';
3
4
  import { type ChildrenFunction } from '../../typings/index';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type PropsType } from '../../utils/PropsType';
2
3
  import { type baseOrderPricePropTypes } from '../../typings/index';
3
4
  export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes, unknown> & Omit<JSX.IntrinsicElements['span'], 'children'>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type PaymentResource } from '../../reducers/PaymentMethodReducer';
2
3
  import PaymentSourceContext, { type IconBrand } from '../../context/PaymentSourceContext';
3
4
  import { type ChildrenFunction } from '../../typings/index';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type PriceProps } from '../prices/Price';
2
3
  export type PTemplateProps = {
3
4
  formattedAmount?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type LineItem } from '@commercelayer/sdk';
2
3
  import { type BaseError } from '../../typings/errors';
3
4
  import { type TResourceError } from '../errors/Errors';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type DefaultChildrenType = JSX.Element[] | JSX.Element | null;
2
3
  type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
3
4
  export type TRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type DefaultChildrenType } from '../typings/globals';
2
3
  interface Props<T> {
3
4
  children: DefaultChildrenType;
@@ -10,7 +10,7 @@ interface CardDetails {
10
10
  }
11
11
  interface Args {
12
12
  paymentType: PaymentResource;
13
- customerPayment: Partial<CustomerPaymentSource>;
13
+ customerPayment: CustomerPaymentSource;
14
14
  }
15
15
  export default function getCardDetails({ paymentType, customerPayment }: Args): CardDetails;
16
16
  export {};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});function getCardDetails({paymentType,customerPayment}){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v;switch(paymentType){case"checkout_com_payments":{const ps=customerPayment.payment_source,source=(_a=ps?.payment_response)===null||_a===void 0?void 0:_a.source;if(source)return{brand:source.scheme.toLowerCase(),exp_month:source.expiry_month,exp_year:source.expiry_year,last4:source.last4};break}case"stripe_payments":{const ps=customerPayment.payment_source,source=((_e=(_c=(_b=ps?.options)===null||_b===void 0?void 0:_b.card)!==null&&_c!==void 0?_c:(_d=ps?.payment_method)===null||_d===void 0?void 0:_d.card)!==null&&_e!==void 0?_e:ps?.payment_instrument)?{brand:(_f=ps?.payment_instrument)===null||_f===void 0?void 0:_f.card_type,exp_month:(_g=ps?.payment_instrument)===null||_g===void 0?void 0:_g.card_expiry_month,exp_year:(_h=ps?.payment_instrument)===null||_h===void 0?void 0:_h.card_expiry_year,last4:(_j=ps?.payment_instrument)===null||_j===void 0?void 0:_j.card_last_digits,issuer_type:(_k=ps?.payment_instrument)===null||_k===void 0?void 0:_k.issuer_type}:void 0;if(source)return Object.assign({},source);break}case"braintree_payments":{const ps=customerPayment.payment_source,source=(_l=ps?.options)===null||_l===void 0?void 0:_l.card;if(source)return Object.assign({},source);break}case"adyen_payments":{const ps=customerPayment.payment_source,source=(_m=ps?.payment_request_data)===null||_m===void 0?void 0:_m.payment_method,authorized=((_o=ps?.payment_response)===null||_o===void 0?void 0:_o.resultCode)==="Authorised",last4=(_t=(_r=(_q=(_p=ps?.payment_response)===null||_p===void 0?void 0:_p.additionalData)===null||_q===void 0?void 0:_q.cardSummary)!==null&&_r!==void 0?_r:(_s=ps?.payment_instrument)===null||_s===void 0?void 0:_s.card_last_digits)!==null&&_t!==void 0?_t:"****";if(source&&authorized){const brand=source.type==="scheme"?(_u=source.brand)!==null&&_u!==void 0?_u:"credit-card":source.type.replace("_account","");return Object.assign(Object.assign({},source),{last4,brand})}break}default:{const ps=customerPayment.payment_source,source=(_v=ps?.metadata)===null||_v===void 0?void 0:_v.card;if(source)return Object.assign({},source);break}}return{brand:"",exp_month:"**",exp_year:"**",last4:"****",issuer_type:""}}exports.default=getCardDetails;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});function getCardDetails({paymentType,customerPayment}){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w;switch(paymentType){case"checkout_com_payments":{const ps=customerPayment.payment_source,source=(_a=ps?.payment_response)===null||_a===void 0?void 0:_a.source;if(source)return{brand:source.scheme.toLowerCase(),exp_month:source.expiry_month,exp_year:source.expiry_year,last4:source.last4};break}case"stripe_payments":{const ps=customerPayment.payment_source,source=((_e=(_c=(_b=ps?.options)===null||_b===void 0?void 0:_b.card)!==null&&_c!==void 0?_c:(_d=ps?.payment_method)===null||_d===void 0?void 0:_d.card)!==null&&_e!==void 0?_e:ps?.payment_instrument)?{brand:(_f=ps?.payment_instrument)===null||_f===void 0?void 0:_f.card_type,exp_month:(_g=ps?.payment_instrument)===null||_g===void 0?void 0:_g.card_expiry_month,exp_year:(_h=ps?.payment_instrument)===null||_h===void 0?void 0:_h.card_expiry_year,last4:(_j=ps?.payment_instrument)===null||_j===void 0?void 0:_j.card_last_digits,issuer_type:(_k=ps?.payment_instrument)===null||_k===void 0?void 0:_k.issuer_type}:void 0;if(source)return Object.assign({},source);break}case"klarna_payments":{const ps=customerPayment.payment_source,source=ps?.payment_instrument?{brand:"klarna",exp_month:"",exp_year:"",last4:"",issuer_type:(_l=ps?.payment_instrument)===null||_l===void 0?void 0:_l.issuer_type}:void 0;if(source)return Object.assign({},source);break}case"braintree_payments":{const ps=customerPayment.payment_source,source=(_m=ps?.options)===null||_m===void 0?void 0:_m.card;if(source)return Object.assign({},source);break}case"adyen_payments":{const ps=customerPayment.payment_source,source=(_o=ps?.payment_request_data)===null||_o===void 0?void 0:_o.payment_method,authorized=((_p=ps?.payment_response)===null||_p===void 0?void 0:_p.resultCode)==="Authorised",last4=(_u=(_s=(_r=(_q=ps?.payment_response)===null||_q===void 0?void 0:_q.additionalData)===null||_r===void 0?void 0:_r.cardSummary)!==null&&_s!==void 0?_s:(_t=ps?.payment_instrument)===null||_t===void 0?void 0:_t.card_last_digits)!==null&&_u!==void 0?_u:"****";if(source&&authorized){const brand=source.type==="scheme"?(_v=source.brand)!==null&&_v!==void 0?_v:"credit-card":source.type.replace("_account","");return Object.assign(Object.assign({},source),{last4,brand})}break}default:{const ps=customerPayment.payment_source,source=(_w=ps?.metadata)===null||_w===void 0?void 0:_w.card;if(source)return Object.assign({},source);break}}return{brand:"",exp_month:"**",exp_year:"**",last4:"****",issuer_type:""}}exports.default=getCardDetails;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { type LoaderType } from '../typings/index';
2
3
  export default function getLoaderComponent(loader: LoaderType): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type Price } from '@commercelayer/sdk';
2
3
  import { type PTemplateProps } from '../components/utils/PriceTemplate';
3
4
  export declare function getPriceByCode(skuPrices: Price[], code?: string): Price | undefined;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isDoNotShip=exports.shipmentsFilled=void 0;const tslib_1=require("tslib"),compact_1=tslib_1.__importDefault(require("lodash/compact")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function shipmentsFilled(shipments){const filled=(0,compact_1.default)(shipments.filter(shipment=>!(0,isEmpty_1.default)(shipment.shipping_method)));return!(0,isEmpty_1.default)(filled)}exports.shipmentsFilled=shipmentsFilled;function isDoNotShip(lineItems){const itemDoNotShip=[],items=lineItems?lineItems.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a;return lineItem.item&&(!((_a=lineItem?.item)===null||_a===void 0)&&_a.do_not_ship)&&itemDoNotShip.push(!0),lineItem}):[];return itemDoNotShip.length>0&&itemDoNotShip.length===items.length}exports.isDoNotShip=isDoNotShip;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isDoNotShip=exports.shipmentsFilled=void 0;const tslib_1=require("tslib"),compact_1=tslib_1.__importDefault(require("lodash/compact")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function shipmentsFilled(shipments){const filled=(0,compact_1.default)(shipments.filter(shipment=>!(0,isEmpty_1.default)(shipment.shipping_method)));return!(0,isEmpty_1.default)(filled)}exports.shipmentsFilled=shipmentsFilled;function isDoNotShip(lineItems){const itemDoNotShip=[],items=lineItems?lineItems.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a;return!((_a=lineItem.item)===null||_a===void 0)&&_a.do_not_ship&&itemDoNotShip.push(!0),lineItem}):[];return itemDoNotShip.length>0&&itemDoNotShip.length===items.length}exports.isDoNotShip=isDoNotShip;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.businessMandatoryField=exports.fieldsExist=exports.validateValue=void 0;const tslib_1=require("tslib"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),isString_1=tslib_1.__importDefault(require("lodash/isString")),without_1=tslib_1.__importDefault(require("lodash/without")),keys_1=tslib_1.__importDefault(require("lodash/keys")),map_1=tslib_1.__importDefault(require("lodash/map")),AddressReducer_1=require("../reducers/AddressReducer"),EMAIL_PATTERN=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/,validateValue=(val,name,type,resourceType)=>val?type==="email"&&(0,isString_1.default)(val)&&!val.match(EMAIL_PATTERN)?{field:name,code:"VALIDATION_ERROR",message:`${name} - is not valid`,resourceType}:{}:{field:name,code:"VALIDATION_ERROR",message:`${name} - is required`,resourceType};exports.validateValue=validateValue;const validateFormFields=(fields,required,resourceType)=>{const errors=[];let values={metadata:{}};return(0,map_1.default)(fields,v=>{const val="checked"in v||(v.value==="on"?!1:v.value),attrName=v.getAttribute("name");if(attrName&&required.includes(attrName)||v.required){const error=(0,exports.validateValue)(val,v.name,v.type,resourceType);(0,isEmpty_1.default)(error)||errors.push(error),values=Object.assign(Object.assign({},values),{[`${v.name}`]:val})}v.getAttribute("name")&&(values=!!v.getAttribute("data-metadata")?Object.assign(Object.assign({},values),{metadata:Object.assign(Object.assign({},values.metadata),{[`${v.name}`]:val})}):Object.assign(Object.assign({},values),{[`${v.name}`]:val}))}),{errors,values}},fieldsExist=(address,schema=AddressReducer_1.addressFields)=>{if(address.business){const required=(0,without_1.default)(schema,"first_name","last_name"),validAddress=(0,keys_1.default)(address).filter(k=>required.includes(k));return required.length>validAddress.length}else{const required=(0,without_1.default)(schema,"line_2","company"),validAddress=(0,keys_1.default)(address).filter(k=>required.includes(k));return required.length>validAddress.length}};exports.fieldsExist=fieldsExist;const businessOptionalFields=["billing_address_first_name","billing_address_last_name","shipping_address_first_name","shipping_address_last_name","first_name","last_name"],customerOptionalFields=["billing_address_company","shipping_address_company","company"];function businessMandatoryField(fieldName,isBusiness){return!(isBusiness&&businessOptionalFields.includes(fieldName)||!isBusiness&&customerOptionalFields.includes(fieldName))}exports.businessMandatoryField=businessMandatoryField,exports.default=validateFormFields;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.businessMandatoryField=exports.fieldsExist=exports.validateValue=void 0;const tslib_1=require("tslib"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),isString_1=tslib_1.__importDefault(require("lodash/isString")),without_1=tslib_1.__importDefault(require("lodash/without")),keys_1=tslib_1.__importDefault(require("lodash/keys")),map_1=tslib_1.__importDefault(require("lodash/map")),AddressReducer_1=require("../reducers/AddressReducer"),EMAIL_PATTERN=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,validateValue=(val,name,type,resourceType)=>val?type==="email"&&(0,isString_1.default)(val)&&!val.match(EMAIL_PATTERN)?{field:name,code:"VALIDATION_ERROR",message:`${name} - is not valid`,resourceType}:{}:{field:name,code:"VALIDATION_ERROR",message:`${name} - is required`,resourceType};exports.validateValue=validateValue;const validateFormFields=(fields,required,resourceType)=>{const errors=[];let values={metadata:{}};return(0,map_1.default)(fields,v=>{const val="checked"in v||(v.value==="on"?!1:v.value),attrName=v.getAttribute("name");if(attrName&&required.includes(attrName)||v.required){const error=(0,exports.validateValue)(val,v.name,v.type,resourceType);(0,isEmpty_1.default)(error)||errors.push(error),values=Object.assign(Object.assign({},values),{[`${v.name}`]:val})}v.getAttribute("name")&&(values=!!v.getAttribute("data-metadata")?Object.assign(Object.assign({},values),{metadata:Object.assign(Object.assign({},values.metadata),{[`${v.name}`]:val})}):Object.assign(Object.assign({},values),{[`${v.name}`]:val}))}),{errors,values}},fieldsExist=(address,schema=AddressReducer_1.addressFields)=>{if(address.business){const required=(0,without_1.default)(schema,"first_name","last_name","line_2"),validAddress=(0,keys_1.default)(address).filter(k=>required.includes(k));return required.length>validAddress.length}else{const required=(0,without_1.default)(schema,"line_2","company"),validAddress=(0,keys_1.default)(address).filter(k=>required.includes(k));return required.length>validAddress.length}};exports.fieldsExist=fieldsExist;const businessOptionalFields=["billing_address_first_name","billing_address_last_name","shipping_address_first_name","shipping_address_last_name","first_name","last_name"],customerOptionalFields=["billing_address_company","shipping_address_company","company"];function businessMandatoryField(fieldName,isBusiness){return!(isBusiness&&businessOptionalFields.includes(fieldName)||!isBusiness&&customerOptionalFields.includes(fieldName))}exports.businessMandatoryField=businessMandatoryField,exports.default=validateFormFields;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseInputComponentProps } from '../typings/index';
2
3
  type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
3
4
  export declare function MetadataInput(props: Props): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type Address as AddressType } from '@commercelayer/sdk';
2
3
  import { type AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate';
3
4
  import type { DefaultChildrenType } from '../../typings/globals';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseSelectComponentProps } from '../../typings/index';
2
3
  import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
3
4
  type TCountryFieldName = 'billing_address_country_code' | 'shipping_address_country_code' | 'customer_address_country_code';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseInputComponentProps, type AddressInputName } from '../../typings/index';
2
3
  import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
3
4
  type Props = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type AddressStateSelectName, type BaseSelectComponentProps } from '../../typings/index';
2
3
  type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
3
4
  name: AddressStateSelectName;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ConditionalElement } from '../../typings/index';
2
3
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
4
  type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseInputComponentProps } from '../../typings/index';
2
3
  type Props = {
3
4
  name?: 'customer_email' | string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children?: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CodeErrorType } from '../../typings/errors';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  export type TResourceError = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant' | 'in_stock_subscriptions';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseState } from '../../typings/index';
2
3
  import type { DefaultChildrenType } from '../../typings/globals';
3
4
  interface Props extends Omit<JSX.IntrinsicElements['form'], 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseSelectComponentProps } from '../../typings/index';
2
3
  type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
3
4
  required?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseInputComponentProps, type GiftCardInputName } from '../../typings/index';
2
3
  type Props = {
3
4
  name: GiftCardInputName;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  import type { CodeType } from '../../reducers/OrderReducer';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Order } from '@commercelayer/sdk';
2
3
  import type { DefaultChildrenType } from '../../typings/globals';
3
4
  interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseInputComponentProps } from '../../typings/index';
2
3
  import { type OrderCodeType } from '../../reducers/OrderReducer';
3
4
  type Props = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface Props extends Omit<JSX.IntrinsicElements['button'], 'children' | 'onClick'> {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type TLineItem = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
2
3
  interface Props {
3
4
  children: JSX.Element | JSX.Element[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseAmountComponent, type BasePriceType } from '../../typings/index';
2
3
  type Props = BaseAmountComponent & {
3
4
  type?: BasePriceType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type LineItem } from '@commercelayer/sdk';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  export interface TLineItemCode extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ConditionalElement } from '../../typings/index';
2
3
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
4
  type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type LineItem } from '@commercelayer/sdk';
2
3
  import type { ChildrenFunction } from '../../typings/index';
3
4
  import { type TLineItem } from './LineItem';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { LineItem } from '@commercelayer/sdk';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  export interface TLineItemName extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type TypeAccepted } from '../../utils/getLineItemsCount';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  quantity: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseAmountComponent } from '../../typings/index';
2
3
  export declare function AdjustmentAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default AdjustmentAmount;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  checkoutUrl: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseAmountComponent } from '../../typings/index';
2
3
  export declare function DiscountAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default DiscountAmount;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type BaseAmountComponent } from '../../typings/index';
2
3
  export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default GiftCardAmount;
@@ -3,6 +3,8 @@ interface Styles {
3
3
  cart?: CSSProperties;
4
4
  container?: CSSProperties;
5
5
  background?: CSSProperties;
6
+ icon?: CSSProperties;
7
+ iconContainer?: CSSProperties;
6
8
  }
7
9
  interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'style'> {
8
10
  /**