@commercelayer/react-components 4.9.0-beta.4 → 4.9.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 (245) hide show
  1. package/lib/cjs/components/MetadataInput.d.ts +0 -1
  2. package/lib/cjs/components/addresses/Address.d.ts +0 -1
  3. package/lib/cjs/components/addresses/Address.js +1 -1
  4. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +0 -1
  5. package/lib/cjs/components/addresses/AddressInput.d.ts +0 -1
  6. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +0 -1
  7. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +0 -1
  8. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +0 -1
  9. package/lib/cjs/components/auth/CommerceLayer.d.ts +0 -1
  10. package/lib/cjs/components/auth/CommerceLayer.js +1 -1
  11. package/lib/cjs/components/customers/CustomerContainer.d.ts +0 -1
  12. package/lib/cjs/components/customers/CustomerField.d.ts +0 -1
  13. package/lib/cjs/components/customers/CustomerInput.d.ts +0 -1
  14. package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +0 -1
  15. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +0 -1
  16. package/lib/cjs/components/customers/MyAccountLink.d.ts +0 -1
  17. package/lib/cjs/components/customers/MyAccountLink.js +1 -1
  18. package/lib/cjs/components/customers/MyIdentityLink.d.ts +0 -1
  19. package/lib/cjs/components/customers/SaveCustomerButton.js +1 -1
  20. package/lib/cjs/components/errors/Errors.d.ts +0 -1
  21. package/lib/cjs/components/gift_cards/GiftCard.d.ts +0 -1
  22. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
  23. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +0 -1
  24. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
  25. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -1
  26. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
  27. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +0 -1
  28. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.js +1 -1
  29. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +0 -1
  30. package/lib/cjs/components/line_items/LineItem.d.ts +0 -1
  31. package/lib/cjs/components/line_items/LineItemAmount.d.ts +0 -1
  32. package/lib/cjs/components/line_items/LineItemCode.d.ts +0 -1
  33. package/lib/cjs/components/line_items/LineItemField.d.ts +0 -1
  34. package/lib/cjs/components/line_items/LineItemImage.d.ts +0 -1
  35. package/lib/cjs/components/line_items/LineItemName.d.ts +0 -1
  36. package/lib/cjs/components/line_items/LineItemsContainer.d.ts +0 -1
  37. package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
  38. package/lib/cjs/components/line_items/LineItemsCount.d.ts +0 -1
  39. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +0 -1
  40. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +0 -1
  41. package/lib/cjs/components/orders/CheckoutLink.d.ts +0 -1
  42. package/lib/cjs/components/orders/DiscountAmount.d.ts +0 -1
  43. package/lib/cjs/components/orders/GiftCardAmount.d.ts +0 -1
  44. package/lib/cjs/components/orders/HostedCart.js +1 -1
  45. package/lib/cjs/components/orders/OrderContainer.d.ts +0 -1
  46. package/lib/cjs/components/orders/OrderList.d.ts +0 -1
  47. package/lib/cjs/components/orders/OrderListEmpty.d.ts +0 -1
  48. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +0 -1
  49. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +0 -1
  50. package/lib/cjs/components/orders/OrderListRow.d.ts +0 -1
  51. package/lib/cjs/components/orders/OrderNumber.d.ts +0 -1
  52. package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +0 -1
  53. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
  54. package/lib/cjs/components/orders/ShippingAmount.d.ts +0 -1
  55. package/lib/cjs/components/orders/SubTotalAmount.d.ts +0 -1
  56. package/lib/cjs/components/orders/TaxesAmount.d.ts +0 -1
  57. package/lib/cjs/components/orders/TotalAmount.d.ts +0 -1
  58. package/lib/cjs/components/parcels/ParcelField.d.ts +0 -1
  59. package/lib/cjs/components/parcels/ParcelLineItem.d.ts +0 -1
  60. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +0 -1
  61. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +0 -1
  62. package/lib/cjs/components/parcels/Parcels.d.ts +0 -1
  63. package/lib/cjs/components/parcels/ParcelsCount.d.ts +0 -1
  64. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +0 -1
  65. package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
  66. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +0 -1
  67. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
  68. package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +0 -1
  69. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +0 -1
  70. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +0 -1
  71. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +0 -1
  72. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +0 -1
  73. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +0 -1
  74. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +0 -1
  75. package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +0 -1
  76. package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
  77. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
  78. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +0 -1
  79. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +0 -1
  80. package/lib/cjs/components/payment_source/ExternalPayment.d.ts +0 -1
  81. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +0 -1
  82. package/lib/cjs/components/payment_source/PaymentSource.d.ts +0 -1
  83. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
  84. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
  85. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +0 -1
  86. package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +0 -1
  87. package/lib/cjs/components/payment_source/StripeExpressPayment.js +1 -1
  88. package/lib/cjs/components/payment_source/StripePayment.d.ts +0 -1
  89. package/lib/cjs/components/payment_source/StripePayment.js +1 -1
  90. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +0 -1
  91. package/lib/cjs/components/prices/Price.d.ts +0 -1
  92. package/lib/cjs/components/prices/Price.js +1 -1
  93. package/lib/cjs/components/prices/PricesContainer.d.ts +0 -1
  94. package/lib/cjs/components/shipments/ShipmentField.d.ts +0 -1
  95. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +0 -1
  96. package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
  97. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +0 -1
  98. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
  99. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
  100. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +0 -1
  101. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +0 -1
  102. package/lib/cjs/components/skus/SkuField.d.ts +0 -1
  103. package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +0 -1
  104. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +0 -1
  105. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +0 -1
  106. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +0 -1
  107. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +0 -1
  108. package/lib/cjs/components/utils/PriceTemplate.d.ts +2 -3
  109. package/lib/cjs/components/utils/getAllErrors.d.ts +0 -1
  110. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  111. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  112. package/lib/cjs/reducers/OrderReducer.js +1 -1
  113. package/lib/cjs/typings/globals.d.ts +0 -1
  114. package/lib/cjs/utils/filterChildren.d.ts +0 -1
  115. package/lib/cjs/utils/getCustomerIdByToken.js +1 -1
  116. package/lib/cjs/utils/getDomain.js +1 -1
  117. package/lib/cjs/utils/getLoaderComponent.d.ts +0 -1
  118. package/lib/cjs/utils/getPrices.d.ts +0 -1
  119. package/lib/cjs/utils/getPrices.js +1 -1
  120. package/lib/cjs/utils/isGuestToken.js +1 -1
  121. package/lib/cjs/utils/jwt.d.ts +1 -1
  122. package/lib/cjs/utils/jwt.js +1 -1
  123. package/lib/esm/components/MetadataInput.d.ts +0 -1
  124. package/lib/esm/components/addresses/Address.d.ts +0 -1
  125. package/lib/esm/components/addresses/Address.js +1 -1
  126. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +0 -1
  127. package/lib/esm/components/addresses/AddressInput.d.ts +0 -1
  128. package/lib/esm/components/addresses/AddressStateSelector.d.ts +0 -1
  129. package/lib/esm/components/addresses/AddressesEmpty.d.ts +0 -1
  130. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +0 -1
  131. package/lib/esm/components/auth/CommerceLayer.d.ts +0 -1
  132. package/lib/esm/components/auth/CommerceLayer.js +1 -1
  133. package/lib/esm/components/customers/CustomerContainer.d.ts +0 -1
  134. package/lib/esm/components/customers/CustomerField.d.ts +0 -1
  135. package/lib/esm/components/customers/CustomerInput.d.ts +0 -1
  136. package/lib/esm/components/customers/CustomerPaymentSource.d.ts +0 -1
  137. package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +0 -1
  138. package/lib/esm/components/customers/MyAccountLink.d.ts +0 -1
  139. package/lib/esm/components/customers/MyAccountLink.js +1 -1
  140. package/lib/esm/components/customers/MyIdentityLink.d.ts +0 -1
  141. package/lib/esm/components/customers/SaveCustomerButton.js +1 -1
  142. package/lib/esm/components/errors/Errors.d.ts +0 -1
  143. package/lib/esm/components/gift_cards/GiftCard.d.ts +0 -1
  144. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
  145. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +0 -1
  146. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
  147. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -1
  148. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
  149. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +0 -1
  150. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.js +1 -1
  151. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +0 -1
  152. package/lib/esm/components/line_items/LineItem.d.ts +0 -1
  153. package/lib/esm/components/line_items/LineItemAmount.d.ts +0 -1
  154. package/lib/esm/components/line_items/LineItemCode.d.ts +0 -1
  155. package/lib/esm/components/line_items/LineItemField.d.ts +0 -1
  156. package/lib/esm/components/line_items/LineItemImage.d.ts +0 -1
  157. package/lib/esm/components/line_items/LineItemName.d.ts +0 -1
  158. package/lib/esm/components/line_items/LineItemsContainer.d.ts +0 -1
  159. package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
  160. package/lib/esm/components/line_items/LineItemsCount.d.ts +0 -1
  161. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +0 -1
  162. package/lib/esm/components/orders/AdjustmentAmount.d.ts +0 -1
  163. package/lib/esm/components/orders/CheckoutLink.d.ts +0 -1
  164. package/lib/esm/components/orders/DiscountAmount.d.ts +0 -1
  165. package/lib/esm/components/orders/GiftCardAmount.d.ts +0 -1
  166. package/lib/esm/components/orders/HostedCart.js +1 -1
  167. package/lib/esm/components/orders/OrderContainer.d.ts +0 -1
  168. package/lib/esm/components/orders/OrderList.d.ts +0 -1
  169. package/lib/esm/components/orders/OrderListEmpty.d.ts +0 -1
  170. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +0 -1
  171. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +0 -1
  172. package/lib/esm/components/orders/OrderListRow.d.ts +0 -1
  173. package/lib/esm/components/orders/OrderNumber.d.ts +0 -1
  174. package/lib/esm/components/orders/PaymentMethodAmount.d.ts +0 -1
  175. package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
  176. package/lib/esm/components/orders/ShippingAmount.d.ts +0 -1
  177. package/lib/esm/components/orders/SubTotalAmount.d.ts +0 -1
  178. package/lib/esm/components/orders/TaxesAmount.d.ts +0 -1
  179. package/lib/esm/components/orders/TotalAmount.d.ts +0 -1
  180. package/lib/esm/components/parcels/ParcelField.d.ts +0 -1
  181. package/lib/esm/components/parcels/ParcelLineItem.d.ts +0 -1
  182. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +0 -1
  183. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +0 -1
  184. package/lib/esm/components/parcels/Parcels.d.ts +0 -1
  185. package/lib/esm/components/parcels/ParcelsCount.d.ts +0 -1
  186. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +0 -1
  187. package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
  188. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +0 -1
  189. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
  190. package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +0 -1
  191. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +0 -1
  192. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +0 -1
  193. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +0 -1
  194. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +0 -1
  195. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +0 -1
  196. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +0 -1
  197. package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +0 -1
  198. package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
  199. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -1
  200. package/lib/esm/components/payment_source/BraintreePayment.d.ts +0 -1
  201. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +0 -1
  202. package/lib/esm/components/payment_source/ExternalPayment.d.ts +0 -1
  203. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +0 -1
  204. package/lib/esm/components/payment_source/PaymentSource.d.ts +0 -1
  205. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
  206. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
  207. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +0 -1
  208. package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +0 -1
  209. package/lib/esm/components/payment_source/StripeExpressPayment.js +1 -1
  210. package/lib/esm/components/payment_source/StripePayment.d.ts +0 -1
  211. package/lib/esm/components/payment_source/StripePayment.js +1 -1
  212. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +0 -1
  213. package/lib/esm/components/prices/Price.d.ts +0 -1
  214. package/lib/esm/components/prices/Price.js +1 -1
  215. package/lib/esm/components/prices/PricesContainer.d.ts +0 -1
  216. package/lib/esm/components/shipments/ShipmentField.d.ts +0 -1
  217. package/lib/esm/components/shipments/ShipmentsCount.d.ts +0 -1
  218. package/lib/esm/components/shipping_methods/ShippingMethod.js +1 -1
  219. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +0 -1
  220. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
  221. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
  222. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +0 -1
  223. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +0 -1
  224. package/lib/esm/components/skus/SkuField.d.ts +0 -1
  225. package/lib/esm/components/stock_transfers/StockTransfer.d.ts +0 -1
  226. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +0 -1
  227. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +0 -1
  228. package/lib/esm/components/utils/BaseOrderPrice.d.ts +0 -1
  229. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +0 -1
  230. package/lib/esm/components/utils/PriceTemplate.d.ts +2 -3
  231. package/lib/esm/components/utils/getAllErrors.d.ts +0 -1
  232. package/lib/esm/reducers/CustomerReducer.js +1 -1
  233. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  234. package/lib/esm/reducers/OrderReducer.js +1 -1
  235. package/lib/esm/typings/globals.d.ts +0 -1
  236. package/lib/esm/utils/filterChildren.d.ts +0 -1
  237. package/lib/esm/utils/getCustomerIdByToken.js +1 -1
  238. package/lib/esm/utils/getDomain.js +1 -1
  239. package/lib/esm/utils/getLoaderComponent.d.ts +0 -1
  240. package/lib/esm/utils/getPrices.d.ts +0 -1
  241. package/lib/esm/utils/getPrices.js +1 -1
  242. package/lib/esm/utils/isGuestToken.js +1 -1
  243. package/lib/esm/utils/jwt.d.ts +1 -1
  244. package/lib/esm/utils/jwt.js +1 -1
  245. package/package.json +30 -30
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputComponentProps } from '../typings/index';
3
2
  type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
3
  export declare function MetadataInput(props: Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type Address as AddressType } from '@commercelayer/sdk';
3
2
  import { type AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate';
4
3
  import type { DefaultChildrenType } from '../../typings/globals';
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Address=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AddressChildrenContext_1=tslib_1.__importDefault(require("../../context/AddressChildrenContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),BillingAddressContext_1=tslib_1.__importDefault(require("../../context/BillingAddressContext")),ShippingAddressContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),AddressCardsTemplate_1=tslib_1.__importDefault(require("../utils/AddressCardsTemplate"));function Address(props){const{children,className,selectedClassName="",disabledClassName="",onSelect,addresses=[],deselect=!1}=props,p=tslib_1.__rest(props,["children","className","selectedClassName","disabledClassName","onSelect","addresses","deselect"]),{addresses:addressesContext}=(0,react_1.useContext)(CustomerContext_1.default),{setBillingAddress,billingCustomerAddressId}=(0,react_1.useContext)(BillingAddressContext_1.default),{setShippingAddress,shippingCustomerAddressId}=(0,react_1.useContext)(ShippingAddressContext_1.default),{shipToDifferentAddress,billingAddressId,shippingAddressId}=(0,react_1.useContext)(AddressContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),[selected,setSelected]=(0,react_1.useState)(null),items=(0,isEmpty_1.default)(addresses)?addressesContext&&addressesContext||[]:addresses;(0,react_1.useEffect)(()=>{items&&!deselect&&items.forEach((address,k)=>{billingCustomerAddressId&&address.reference===billingCustomerAddressId&&selected===null&&setSelected(k),!billingAddressId&&k===selected&&setBillingAddress&&setBillingAddress(address.id,{customerAddressId:address.reference}),shippingCustomerAddressId&&address.reference===shippingCustomerAddressId&&selected===null&&setSelected(k),!shippingAddressId&&k===selected&&setShippingAddress&&setShippingAddress(address.id,{customerAddressId:address.reference})}),deselect&&tslib_1.__awaiter(this,void 0,void 0,function*(){setBillingAddress&&(yield setBillingAddress("")),setShippingAddress&&(yield setShippingAddress(""))})},[deselect,billingCustomerAddressId,shippingCustomerAddressId,addressesContext,shipToDifferentAddress]);const handleSelect=(k,addressId,customerAddressId,disabled,address)=>tslib_1.__awaiter(this,void 0,void 0,function*(){!disabled&&setSelected(k),setBillingAddress&&(yield setBillingAddress(addressId,{customerAddressId})),!disabled&&setShippingAddress&&(yield setShippingAddress(addressId,{customerAddressId})),onSelect&&onSelect(address)}),countryLock=order?.shipping_country_code_lock,components=typeof children=="function"?[]:items.filter(address=>!(setShippingAddress&&countryLock&&countryLock!==address.country_code)).map((address,k)=>{const addressProps={address},disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className||""} ${deselect?"":selectedClassName}`:className,customerAddressId=address?.reference||"",finalClassName=disabled?`${className||""} ${disabledClassName}`:addressSelectedClass;return(0,jsx_runtime_1.jsx)(AddressChildrenContext_1.default.Provider,{value:addressProps,children:(0,jsx_runtime_1.jsx)("div",Object.assign({className:finalClassName,onClick:()=>{handleSelect(k,address.id,customerAddressId,disabled,address)},"data-disabled":disabled},p,{children}))},k)}),parentProps=Object.assign({customerAddresses:items,selected,handleSelect,countryLock},props);return typeof children=="function"?(0,jsx_runtime_1.jsx)(AddressCardsTemplate_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Address=Address,exports.default=Address;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Address=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AddressChildrenContext_1=tslib_1.__importDefault(require("../../context/AddressChildrenContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),BillingAddressContext_1=tslib_1.__importDefault(require("../../context/BillingAddressContext")),ShippingAddressContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),AddressCardsTemplate_1=tslib_1.__importDefault(require("../utils/AddressCardsTemplate"));function Address(props){const{children,className,selectedClassName="",disabledClassName="",onSelect,addresses=[],deselect=!1}=props,p=tslib_1.__rest(props,["children","className","selectedClassName","disabledClassName","onSelect","addresses","deselect"]),{addresses:addressesContext}=(0,react_1.useContext)(CustomerContext_1.default),{setBillingAddress,billingCustomerAddressId}=(0,react_1.useContext)(BillingAddressContext_1.default),{setShippingAddress,shippingCustomerAddressId}=(0,react_1.useContext)(ShippingAddressContext_1.default),{shipToDifferentAddress,billingAddressId,shippingAddressId}=(0,react_1.useContext)(AddressContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),[selected,setSelected]=(0,react_1.useState)(null),items=(0,isEmpty_1.default)(addresses)?addressesContext&&addressesContext||[]:addresses;(0,react_1.useEffect)(()=>{items&&!deselect&&items.forEach((address,k)=>{billingCustomerAddressId&&address.reference===billingCustomerAddressId&&selected===null&&setSelected(k),!billingAddressId&&k===selected&&setBillingAddress&&address.reference!=null&&setBillingAddress(address.id,{customerAddressId:address.reference}),shippingCustomerAddressId&&address.reference===shippingCustomerAddressId&&selected===null&&setSelected(k),!shippingAddressId&&k===selected&&setShippingAddress&&address.reference!=null&&setShippingAddress(address.id,{customerAddressId:address.reference})}),deselect&&tslib_1.__awaiter(this,void 0,void 0,function*(){setBillingAddress&&(yield setBillingAddress("")),setShippingAddress&&(yield setShippingAddress(""))})},[deselect,billingCustomerAddressId,shippingCustomerAddressId,addressesContext,shipToDifferentAddress]);const handleSelect=(k,addressId,customerAddressId,disabled,address)=>tslib_1.__awaiter(this,void 0,void 0,function*(){!disabled&&setSelected(k),setBillingAddress&&(yield setBillingAddress(addressId,{customerAddressId})),!disabled&&setShippingAddress&&(yield setShippingAddress(addressId,{customerAddressId})),onSelect&&onSelect(address)}),countryLock=order?.shipping_country_code_lock,components=typeof children=="function"?[]:items.filter(address=>!(setShippingAddress&&countryLock&&countryLock!==address.country_code)).map((address,k)=>{const addressProps={address},disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className||""} ${deselect?"":selectedClassName}`:className,customerAddressId=address?.reference||"",finalClassName=disabled?`${className||""} ${disabledClassName}`:addressSelectedClass;return(0,jsx_runtime_1.jsx)(AddressChildrenContext_1.default.Provider,{value:addressProps,children:(0,jsx_runtime_1.jsx)("div",Object.assign({className:finalClassName,onClick:()=>{handleSelect(k,address.id,customerAddressId,disabled,address)},"data-disabled":disabled},p,{children}))},k)}),parentProps=Object.assign({customerAddresses:items,selected,handleSelect,countryLock},props);return typeof children=="function"?(0,jsx_runtime_1.jsx)(AddressCardsTemplate_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Address=Address,exports.default=Address;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseSelectComponentProps } from '../../typings/index';
3
2
  import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
4
3
  import { type Country } from '../../utils/countryStateCity';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputComponentProps, type AddressInputName } from '../../typings/index';
3
2
  import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
4
3
  type Props = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type AddressStateSelectName, type BaseSelectComponentProps } from '../../typings/index';
3
2
  import { type States } from '../../utils/countryStateCity';
4
3
  type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  children: DefaultChildrenType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),ErrorBoundary_1=tslib_1.__importDefault(require("../utils/ErrorBoundary")),jwt_1=tslib_1.__importDefault(require("../../utils/jwt"));function CommerceLayer(props){var _a;const{children}=props,p=tslib_1.__rest(props,["children"]);if(!p.endpoint){const{organization}=(0,jwt_1.default)(p.accessToken);p.endpoint=`https://${organization.slug}.${(_a=p.domain)!==null&&_a!==void 0?_a:"commercelayer.io"}`}return(0,jsx_runtime_1.jsx)(ErrorBoundary_1.default,{children:(0,jsx_runtime_1.jsx)(CommerceLayerContext_1.default.Provider,{value:Object.assign({},p),children})})}exports.CommerceLayer=CommerceLayer,exports.default=CommerceLayer;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),ErrorBoundary_1=tslib_1.__importDefault(require("../utils/ErrorBoundary")),jwt_1=require("../../utils/jwt");function CommerceLayer(props){var _a;const{children}=props,p=tslib_1.__rest(props,["children"]);if(!p.endpoint){const{organization}=(0,jwt_1.jwt)(p.accessToken);p.endpoint=`https://${organization.slug}.${(_a=p.domain)!==null&&_a!==void 0?_a:"commercelayer.io"}`}return(0,jsx_runtime_1.jsx)(ErrorBoundary_1.default,{children:(0,jsx_runtime_1.jsx)(CommerceLayerContext_1.default.Provider,{value:Object.assign({},p),children})})}exports.CommerceLayer=CommerceLayer,exports.default=CommerceLayer;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  children: DefaultChildrenType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ConditionalElement } from '../../typings/index';
3
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
4
3
  type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputComponentProps } from '../../typings/index';
3
2
  type Props = {
4
3
  name?: 'customer_email' | string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  children?: DefaultChildrenType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface ChildrenProps extends Omit<Props, 'children'> {
4
3
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MyAccountLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),jwt_1=tslib_1.__importDefault(require("../../utils/jwt"));function MyAccountLink(props){const{label="Go to my account",children,customDomain}=props,p=tslib_1.__rest(props,["label","children","customDomain"]),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default);if(accessToken==null||endpoint==null)throw new Error("Cannot use `MyAccountLink` outside of `CommerceLayer`");const{domain,slug}=(0,getDomain_1.getDomain)(endpoint),disabled=!("owner"in(0,jwt_1.default)(accessToken)),href=(0,getApplicationLink_1.getApplicationLink)({slug,accessToken,applicationType:"my-account",domain,customDomain}),parentProps=Object.assign({disabled,label,href},p);function handleClick(e){disabled&&e.preventDefault()}return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("a",Object.assign({"aria-disabled":disabled,onClick:handleClick,href},p,{children:label}))}exports.MyAccountLink=MyAccountLink,exports.default=MyAccountLink;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MyAccountLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),jwt_1=require("../../utils/jwt");function MyAccountLink(props){const{label="Go to my account",children,customDomain}=props,p=tslib_1.__rest(props,["label","children","customDomain"]),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default);if(accessToken==null||endpoint==null)throw new Error("Cannot use `MyAccountLink` outside of `CommerceLayer`");const{domain,slug}=(0,getDomain_1.getDomain)(endpoint),disabled=!("owner"in(0,jwt_1.jwt)(accessToken)),href=(0,getApplicationLink_1.getApplicationLink)({slug,accessToken,applicationType:"my-account",domain,customDomain}),parentProps=Object.assign({disabled,label,href},p);function handleClick(e){disabled&&e.preventDefault()}return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("a",Object.assign({"aria-disabled":disabled,onClick:handleClick,href},p,{children:label}))}exports.MyAccountLink=MyAccountLink,exports.default=MyAccountLink;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface ChildrenProps extends Omit<Props, 'children'> {
4
3
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveCustomerButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext"));function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","resource","disabled","onClick"]),{errors,saveCustomerUser,customerEmail}=(0,react_1.useContext)(CustomerContext_1.default),disable=disabled||!(0,isEmpty_1.default)(errors)||(0,isEmpty_1.default)(customerEmail),handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){(0,isEmpty_1.default)(errors)&&!disable&&(saveCustomerUser&&(yield saveCustomerUser(customerEmail)),onClick&&onClick())}),parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({type:"button",disabled:disable,onClick:()=>{handleClick()}},p,{children:label}))}exports.SaveCustomerButton=SaveCustomerButton,exports.default=SaveCustomerButton;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveCustomerButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext"));function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","resource","disabled","onClick"]),{errors,saveCustomerUser,customerEmail}=(0,react_1.useContext)(CustomerContext_1.default),disable=disabled||!(0,isEmpty_1.default)(errors)||(0,isEmpty_1.default)(customerEmail),handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){(0,isEmpty_1.default)(errors)&&!disable&&customerEmail!=null&&(saveCustomerUser&&(yield saveCustomerUser(customerEmail)),onClick&&onClick())}),parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({type:"button",disabled:disable,onClick:()=>{handleClick()}},p,{children:label}))}exports.SaveCustomerButton=SaveCustomerButton,exports.default=SaveCustomerButton;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { CodeErrorType } from '../../typings/errors';
3
2
  import { type ChildrenFunction } from '../../typings/index';
4
3
  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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseState } from '../../typings/index';
3
2
  import type { DefaultChildrenType } from '../../typings/globals';
4
3
  interface Props extends Omit<JSX.IntrinsicElements['form'], 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseSelectComponentProps } from '../../typings/index';
3
2
  type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
4
3
  required?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputComponentProps, type GiftCardInputName } from '../../typings/index';
3
2
  type Props = {
4
3
  name: GiftCardInputName;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  import type { CodeType } from '../../reducers/OrderReducer';
4
3
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Order } from '@commercelayer/sdk';
3
2
  import type { DefaultChildrenType } from '../../typings/globals';
4
3
  interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputComponentProps } from '../../typings/index';
3
2
  import { type OrderCodeType } from '../../reducers/OrderReducer';
4
3
  type Props = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface Props extends Omit<JSX.IntrinsicElements['button'], 'children' | 'onClick'> {
4
3
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InStockSubscriptionButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),InStockSubscriptionContext_1=tslib_1.__importDefault(require("../../context/InStockSubscriptionContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),jwt_1=tslib_1.__importDefault(require("../../utils/jwt")),react_1=require("react");function InStockSubscriptionButton(_a){var{skuCode,customerEmail,children,onClick,show=!1,label="Subscribe",loadingLabel="Loading..."}=_a,props=tslib_1.__rest(_a,["skuCode","customerEmail","children","onClick","show","label","loadingLabel"]);const{setInStockSubscription}=(0,useCustomContext_1.default)({context:InStockSubscriptionContext_1.default,contextComponentName:"InStockSubscriptionsContainer",currentComponentName:"InStockSubscriptionButton",key:"setInStockSubscription"}),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),[loading,setLoading]=(0,react_1.useState)(!1),handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(accessToken!=null&&customerEmail==null){const get=(0,jwt_1.default)(accessToken);if(get?.owner==null){console.error("Missing customerEmail");return}}if(setInStockSubscription==null){console.error("Missing <InStockSubscriptionsContainer>");return}setLoading(!0);const res=yield setInStockSubscription({customerEmail,skuCode});onClick?.(res),setLoading(!1)});if(children!=null){const parentProps=Object.assign({skuCode,customerEmail,onClick,show,label,loadingLabel},props);return(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children}))}return show?(0,jsx_runtime_1.jsx)("button",Object.assign({onClick:()=>{handleClick()},disabled:loading},props,{children:loading?loadingLabel:label})):null}exports.InStockSubscriptionButton=InStockSubscriptionButton,exports.default=InStockSubscriptionButton;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InStockSubscriptionButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),InStockSubscriptionContext_1=tslib_1.__importDefault(require("../../context/InStockSubscriptionContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),jwt_1=require("../../utils/jwt"),react_1=require("react");function InStockSubscriptionButton(_a){var{skuCode,customerEmail,children,onClick,show=!1,label="Subscribe",loadingLabel="Loading..."}=_a,props=tslib_1.__rest(_a,["skuCode","customerEmail","children","onClick","show","label","loadingLabel"]);const{setInStockSubscription}=(0,useCustomContext_1.default)({context:InStockSubscriptionContext_1.default,contextComponentName:"InStockSubscriptionsContainer",currentComponentName:"InStockSubscriptionButton",key:"setInStockSubscription"}),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),[loading,setLoading]=(0,react_1.useState)(!1),handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(accessToken!=null&&customerEmail==null){const get=(0,jwt_1.jwt)(accessToken);if(get?.owner==null){console.error("Missing customerEmail");return}}if(setInStockSubscription==null){console.error("Missing <InStockSubscriptionsContainer>");return}setLoading(!0);const res=yield setInStockSubscription({customerEmail,skuCode});onClick?.(res),setLoading(!1)});if(children!=null){const parentProps=Object.assign({skuCode,customerEmail,onClick,show,label,loadingLabel},props);return(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children}))}return show?(0,jsx_runtime_1.jsx)("button",Object.assign({onClick:()=>{handleClick()},disabled:loading},props,{children:loading?loadingLabel:label})):null}exports.InStockSubscriptionButton=InStockSubscriptionButton,exports.default=InStockSubscriptionButton;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type TLineItem = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
3
2
  interface Props {
4
3
  children: JSX.Element | JSX.Element[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent, type BasePriceType } from '../../typings/index';
3
2
  type Props = BaseAmountComponent & {
4
3
  type?: BasePriceType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type LineItem } from '@commercelayer/sdk';
3
2
  import { type ChildrenFunction } from '../../typings/index';
4
3
  export interface TLineItemCode extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ConditionalElement } from '../../typings/index';
3
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
4
3
  type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type LineItem } from '@commercelayer/sdk';
3
2
  import type { ChildrenFunction } from '../../typings/index';
4
3
  import { type TLineItem } from './LineItem';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { LineItem } from '@commercelayer/sdk';
3
2
  import { type ChildrenFunction } from '../../typings/index';
4
3
  export interface TLineItemName extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  children: DefaultChildrenType;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemReducer_1=tslib_1.__importStar(require("../../reducers/LineItemReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext"));function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(LineItemReducer_1.default,LineItemReducer_1.lineItemInitialState);(0,react_1.useEffect)(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),(0,react_1.useEffect)(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue=Object.assign(Object.assign({},state),{loader,updateLineItem:(lineItemId,quantity=1,hasExternalPrice)=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield(0,LineItemReducer_1.updateLineItem)({lineItemId,quantity,hasExternalPrice,dispatch,config,getOrder,orderId,errors:state.errors})}),deleteLineItem:lineItemId=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield(0,LineItemReducer_1.deleteLineItem)({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})})});return(0,jsx_runtime_1.jsx)(LineItemContext_1.default.Provider,{value:lineItemValue,children:state.loading?loader:children})}exports.LineItemsContainer=LineItemsContainer,exports.default=LineItemsContainer;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemReducer_1=tslib_1.__importStar(require("../../reducers/LineItemReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext"));function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(LineItemReducer_1.default,LineItemReducer_1.lineItemInitialState);(0,react_1.useEffect)(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),(0,react_1.useEffect)(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue=Object.assign(Object.assign({},state),{loader,updateLineItem:(lineItemId,quantity=1,hasExternalPrice)=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield(0,LineItemReducer_1.updateLineItem)({lineItemId,quantity,hasExternalPrice,dispatch,config,getOrder,orderId:orderId??"",errors:state.errors})}),deleteLineItem:lineItemId=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield(0,LineItemReducer_1.deleteLineItem)({lineItemId,dispatch,config,getOrder,orderId:orderId??"",errors:state.errors})})});return(0,jsx_runtime_1.jsx)(LineItemContext_1.default.Provider,{value:lineItemValue,children:state.loading?loader:children})}exports.LineItemsContainer=LineItemsContainer,exports.default=LineItemsContainer;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TypeAccepted } from '../../utils/getLineItemsCount';
3
2
  import { type ChildrenFunction } from '../../typings/index';
4
3
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface ChildrenProps extends Omit<Props, 'children'> {
4
3
  quantity: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function AdjustmentAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default AdjustmentAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface ChildrenProps extends Omit<Props, 'children'> {
4
3
  checkoutUrl: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function DiscountAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default DiscountAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default GiftCardAmount;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HostedCart=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),OrderStorageContext_1=tslib_1.__importDefault(require("../../context/OrderStorageContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),react_1=require("react"),iframe_resizer_1=require("iframe-resizer"),events_1=require("../../utils/events"),defaultIframeStyle={width:"1px",minWidth:"100%",minHeight:"100%",border:"none"},defaultContainerStyle={position:"fixed",top:"0",right:"-25rem",height:"100%",width:"23rem",transition:"right 0.5s ease-in-out",pointerEvents:"none",overflow:"auto"},defaultBackgroundStyle={opacity:"0",position:"fixed",top:"0",left:"0",height:"100%",width:"100vw",transition:"opacity 0.5s ease-in-out",pointerEvents:"none",backgroundColor:"black"},defaultIconStyle={width:"1.25rem",height:"1.25rem"},defaultIconContainer={textAlign:"left",paddingLeft:"20px",paddingTop:"20px",background:"#ffffff",color:"#686E6E"},defaultStyle={cart:defaultIframeStyle,container:defaultContainerStyle,background:defaultBackgroundStyle,icon:defaultIconStyle,iconContainer:defaultIconContainer};function HostedCart(_a){var _b,_c,_d,_e,{type,openAdd=!1,style,open=!1,handleOpen,customDomain}=_a,props=tslib_1.__rest(_a,["type","openAdd","style","open","handleOpen","customDomain"]);const[isOpen,setOpen]=(0,react_1.useState)(!1),ref=(0,react_1.useRef)(null),{accessToken,endpoint}=(0,useCustomContext_1.default)({context:CommerceLayerContext_1.default,contextComponentName:"CommerceLayer",currentComponentName:"HostedCart",key:"accessToken"}),[src,setSrc]=(0,react_1.useState)();if(accessToken==null||endpoint==null)return null;const{order,createOrder,getOrder}=(0,react_1.useContext)(OrderContext_1.default),{persistKey}=(0,react_1.useContext)(OrderStorageContext_1.default),{domain,slug}=(0,getDomain_1.getDomain)(endpoint);function setOrder(openCart){var _a2;return tslib_1.__awaiter(this,void 0,void 0,function*(){const orderId=(_a2=localStorage.getItem(persistKey))!==null&&_a2!==void 0?_a2:yield createOrder({});orderId!=null&&accessToken&&(setSrc((0,getApplicationLink_1.getApplicationLink)({slug,orderId,accessToken,domain,applicationType:"cart",customDomain})),openCart&&setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))})}function onMessage(data){var _a2;switch(data.message.type){case"update":data.message.payload!=null&&getOrder(data.message.payload.id);break;case"close":type==="mini"&&(handleOpen!=null?handleOpen():setOpen(!1));break;case"blur":type==="mini"&&isOpen&&((_a2=ref.current)===null||_a2===void 0||_a2.focus());break}}(0,react_1.useEffect)(()=>{var _a2;const orderId=localStorage.getItem(persistKey);let ignore=!1;return open!=null&&open!==isOpen&&setOpen(open),openAdd&&type==="mini"&&(0,events_1.subscribe)("open-cart",()=>{window.document.body.style.overflow="hidden",src==null&&order?.id==null&&orderId==null?setOrder(!0):(src!=null&&ref.current!=null&&(ref.current.src=src),setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))}),src==null&&order?.id==null&&orderId==null&&accessToken!=null&&!ignore&&isOpen?setOrder():src==null&&(order?.id!=null||orderId!=null)&&accessToken&&setSrc((0,getApplicationLink_1.getApplicationLink)({slug,orderId:(_a2=order?.id)!==null&&_a2!==void 0?_a2:orderId,accessToken,domain,applicationType:"cart"})),src!=null&&ref.current!=null&&(ref.current.src=src),()=>{ignore=!0,openAdd&&type==="mini"&&(0,events_1.unsubscribe)("open-cart",()=>{})}},[src,open,order?.id,accessToken]),(0,react_1.useEffect)(()=>{ref.current!=null&&(0,iframe_resizer_1.iframeResizer)({checkOrigin:!1,bodyPadding:"20px",onMessage},ref.current)},[ref.current!=null]);function onCloseCart(){window.document.body.style.removeProperty("overflow"),handleOpen!=null?handleOpen():setOpen(!1)}return src==null?null:type==="mini"?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)("div",{"aria-hidden":"true",style:Object.assign(Object.assign(Object.assign({},defaultStyle.background),style?.background),{opacity:isOpen?"0.5":(_b=defaultStyle.background)===null||_b===void 0?void 0:_b.opacity,pointerEvents:isOpen?"initial":(_c=defaultStyle.background)===null||_c===void 0?void 0:_c.pointerEvents}),onClick:onCloseCart}),(0,jsx_runtime_1.jsxs)("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},defaultStyle.container),style?.container),{right:isOpen?"0":(_d=defaultStyle.container)===null||_d===void 0?void 0:_d.right,pointerEvents:isOpen?"initial":(_e=defaultStyle.container)===null||_e===void 0?void 0:_e.pointerEvents})},props,{children:[(0,jsx_runtime_1.jsx)("div",{style:Object.assign(Object.assign({},defaultStyle.iconContainer),style?.iconContainer),children:(0,jsx_runtime_1.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:Object.assign(Object.assign({},defaultStyle.icon),style?.icon),onClick:onCloseCart,children:(0,jsx_runtime_1.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),(0,jsx_runtime_1.jsx)("iframe",{title:"Cart",ref,style:Object.assign(Object.assign({},defaultStyle.cart),style?.cart),src,width:"100%",height:"100%"})]}))]}):(0,jsx_runtime_1.jsx)("iframe",{title:"Cart",ref,style:Object.assign(Object.assign({},defaultStyle.cart),style?.cart),src,width:"100%",height:"100%"})}exports.HostedCart=HostedCart;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HostedCart=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),OrderStorageContext_1=tslib_1.__importDefault(require("../../context/OrderStorageContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),react_1=require("react"),iframe_resizer_1=require("iframe-resizer"),events_1=require("../../utils/events"),defaultIframeStyle={width:"1px",minWidth:"100%",minHeight:"100%",border:"none"},defaultContainerStyle={position:"fixed",top:"0",right:"-25rem",height:"100%",width:"23rem",transition:"right 0.5s ease-in-out",pointerEvents:"none",overflow:"auto"},defaultBackgroundStyle={opacity:"0",position:"fixed",top:"0",left:"0",height:"100%",width:"100vw",transition:"opacity 0.5s ease-in-out",pointerEvents:"none",backgroundColor:"black"},defaultIconStyle={width:"1.25rem",height:"1.25rem"},defaultIconContainer={textAlign:"left",paddingLeft:"20px",paddingTop:"20px",background:"#ffffff",color:"#686E6E"},defaultStyle={cart:defaultIframeStyle,container:defaultContainerStyle,background:defaultBackgroundStyle,icon:defaultIconStyle,iconContainer:defaultIconContainer};function HostedCart(_a){var _b,_c,_d,_e,{type,openAdd=!1,style,open=!1,handleOpen,customDomain}=_a,props=tslib_1.__rest(_a,["type","openAdd","style","open","handleOpen","customDomain"]);const[isOpen,setOpen]=(0,react_1.useState)(!1),ref=(0,react_1.useRef)(null),{accessToken,endpoint}=(0,useCustomContext_1.default)({context:CommerceLayerContext_1.default,contextComponentName:"CommerceLayer",currentComponentName:"HostedCart",key:"accessToken"}),[src,setSrc]=(0,react_1.useState)();if(accessToken==null||endpoint==null)return null;const{order,createOrder,getOrder}=(0,react_1.useContext)(OrderContext_1.default),{persistKey}=(0,react_1.useContext)(OrderStorageContext_1.default),{domain,slug}=(0,getDomain_1.getDomain)(endpoint);function setOrder(openCart){var _a2;return tslib_1.__awaiter(this,void 0,void 0,function*(){const orderId=(_a2=localStorage.getItem(persistKey))!==null&&_a2!==void 0?_a2:yield createOrder({});orderId!=null&&accessToken&&(setSrc((0,getApplicationLink_1.getApplicationLink)({slug,orderId,accessToken,domain,applicationType:"cart",customDomain})),openCart&&setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))})}function onMessage(data){var _a2;switch(data.message.type){case"update":data.message.payload!=null&&getOrder(data.message.payload.id);break;case"close":type==="mini"&&(handleOpen!=null?handleOpen():setOpen(!1));break;case"blur":type==="mini"&&isOpen&&((_a2=ref.current)===null||_a2===void 0||_a2.focus());break}}(0,react_1.useEffect)(()=>{var _a2,_b2;const orderId=localStorage.getItem(persistKey);let ignore=!1;return open!=null&&open!==isOpen&&setOpen(open),openAdd&&type==="mini"&&(0,events_1.subscribe)("open-cart",()=>{window.document.body.style.overflow="hidden",src==null&&order?.id==null&&orderId==null?setOrder(!0):(src!=null&&ref.current!=null&&(ref.current.src=src),setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))}),src==null&&order?.id==null&&orderId==null&&accessToken!=null&&!ignore&&isOpen?setOrder():src==null&&(order?.id!=null||orderId!=null)&&accessToken&&setSrc((0,getApplicationLink_1.getApplicationLink)({slug,orderId:(_b2=(_a2=order?.id)!==null&&_a2!==void 0?_a2:orderId)!==null&&_b2!==void 0?_b2:"",accessToken,domain,applicationType:"cart"})),src!=null&&ref.current!=null&&(ref.current.src=src),()=>{ignore=!0,openAdd&&type==="mini"&&(0,events_1.unsubscribe)("open-cart",()=>{})}},[src,open,order?.id,accessToken]),(0,react_1.useEffect)(()=>{ref.current!=null&&(0,iframe_resizer_1.iframeResizer)({checkOrigin:!1,bodyPadding:"20px",onMessage},ref.current)},[ref.current!=null]);function onCloseCart(){window.document.body.style.removeProperty("overflow"),handleOpen!=null?handleOpen():setOpen(!1)}return src==null?null:type==="mini"?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)("div",{"aria-hidden":"true",style:Object.assign(Object.assign(Object.assign({},defaultStyle.background),style?.background),{opacity:isOpen?"0.5":(_b=defaultStyle.background)===null||_b===void 0?void 0:_b.opacity,pointerEvents:isOpen?"initial":(_c=defaultStyle.background)===null||_c===void 0?void 0:_c.pointerEvents}),onClick:onCloseCart}),(0,jsx_runtime_1.jsxs)("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},defaultStyle.container),style?.container),{right:isOpen?"0":(_d=defaultStyle.container)===null||_d===void 0?void 0:_d.right,pointerEvents:isOpen?"initial":(_e=defaultStyle.container)===null||_e===void 0?void 0:_e.pointerEvents})},props,{children:[(0,jsx_runtime_1.jsx)("div",{style:Object.assign(Object.assign({},defaultStyle.iconContainer),style?.iconContainer),children:(0,jsx_runtime_1.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:Object.assign(Object.assign({},defaultStyle.icon),style?.icon),onClick:onCloseCart,children:(0,jsx_runtime_1.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),(0,jsx_runtime_1.jsx)("iframe",{title:"Cart",ref,style:Object.assign(Object.assign({},defaultStyle.cart),style?.cart),src,width:"100%",height:"100%"})]}))]}):(0,jsx_runtime_1.jsx)("iframe",{title:"Cart",ref,style:Object.assign(Object.assign({},defaultStyle.cart),style?.cart),src,width:"100%",height:"100%"})}exports.HostedCart=HostedCart;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseMetadataObject } from '../../typings/index';
3
2
  import type { OrderCreate, Order } from '@commercelayer/sdk';
4
3
  import type { DefaultChildrenType } from '../../typings/globals';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TOrderList, type InitialOrderListContext, type OrderListContent } from '../../context/OrderListChildrenContext';
3
2
  import { type ColumnDef, type SortingState } from '@tanstack/react-table';
4
3
  import type { DefaultChildrenType, TRange } from '../../typings/globals';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
3
2
  import { type ChildrenFunction } from '../../typings/index';
4
3
  interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  type TAsComponent = keyof Pick<JSX.IntrinsicElements, 'p' | 'span' | 'div'>;
4
3
  type ChildrenProps<A extends TAsComponent> = Omit<Props<A>, 'children'> & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TOrderList, type OrderListContent, type TableAccessor } from '../../context/OrderListChildrenContext';
3
2
  import { type Row } from '@tanstack/react-table';
4
3
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseFieldProps } from '../utils/BaseField';
3
2
  type Props = Omit<BaseFieldProps, 'attribute'>;
4
3
  export declare function OrderNumber(props: Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function PaymentMethodAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default PaymentMethodAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseInputProps } from '../utils/BaseInput';
3
2
  export declare function PrivacyAndTermsCheckbox(props: Partial<BaseInputProps>): JSX.Element;
4
3
  export default PrivacyAndTermsCheckbox;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default ShippingAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function SubTotalAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default SubTotalAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function TaxesAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default TaxesAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  export declare function TotalAmount(props: BaseAmountComponent): JSX.Element;
4
3
  export default TotalAmount;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ConditionalElement } from '../../typings/index';
3
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
4
3
  type ParcelFieldChildrenProps = TGenericChildrenProps<TResources['Parcel']>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DefaultChildrenType } from '../../typings/globals';
3
2
  interface Props {
4
3
  children: DefaultChildrenType;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ConditionalElement } from '../../typings/index';
3
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
4
3
  type ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  import type { Parcel } from '@commercelayer/sdk';
4
3
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface Props {
3
2
  children: JSX.Element | JSX.Element[];
4
3
  filterBy?: string[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  import type { Parcel } from '@commercelayer/sdk';
4
3
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function AdyenGateway(props: Props): JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../payment_source/AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=tslib_1.__importDefault(require("../../utils/jwt")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes");function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","loading","loaderComponent","templateCustomerSaveToWallet"]),{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="adyen_payments",locale=order?.language_code,paymentMethods=paymentSource?.payment_methods;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&(0,jwt_1.default)(accessToken).test?"test":"live",adyenConfig=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["adyen_payments"]}),paymentConfig=adyenConfig?.adyenPayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>{var _a;return((_a=customerPayment.payment_source)===null||_a===void 0?void 0:_a.type)==="adyen_payments"||customerPayment.payment_method!=null}):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):loaderComponent:clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{clientKey,locale,config:paymentConfig,environment}):loaderComponent}exports.AdyenGateway=AdyenGateway,exports.default=AdyenGateway;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../payment_source/AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=require("../../utils/jwt"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes");function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","loading","loaderComponent","templateCustomerSaveToWallet"]),{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="adyen_payments",locale=order?.language_code,paymentMethods=paymentSource?.payment_methods;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&(0,jwt_1.jwt)(accessToken).test?"test":"live",adyenConfig=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["adyen_payments"]}),paymentConfig=adyenConfig?.adyenPayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>{var _a;return((_a=customerPayment.payment_source)===null||_a===void 0?void 0:_a.type)==="adyen_payments"||customerPayment.payment_method!=null}):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):loaderComponent:clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{clientKey,locale,config:paymentConfig,environment}):loaderComponent}exports.AdyenGateway=AdyenGateway,exports.default=AdyenGateway;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function BraintreeGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function CheckoutComGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function ExternalGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function KlarnaGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type LoaderType } from '../../typings/index';
3
2
  import { type PaymentSourceProps } from '../payment_source/PaymentSource';
4
3
  export type GatewayBaseType = Props & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = Partial<GatewayBaseType>;
4
3
  export declare function PaypalGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function StripeGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
2
  type Props = GatewayBaseType;
4
3
  export declare function WireTransferGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { LoaderType } from '../../typings/index';
3
2
  import type { Order, PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
4
3
  import type { PaymentResource } from '../../reducers/PaymentMethodReducer';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenFunction } from '../../typings/index';
3
2
  interface ChildrenProps extends Omit<Props, 'children'> {
4
3
  labelName: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type BaseAmountComponent } from '../../typings/index';
3
2
  interface Props extends BaseAmountComponent {
4
3
  type?: 'amount';