@commercelayer/react-components 2.49.8 → 2.50.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.
- package/lib/cjs/components/AddToCartButton.js +1 -1
- package/lib/cjs/components/Address.js +1 -1
- package/lib/cjs/components/AddressCountrySelector.js +1 -1
- package/lib/cjs/components/AddressField.js +1 -1
- package/lib/cjs/components/AddressInput.js +1 -1
- package/lib/cjs/components/AddressStateSelector.js +1 -1
- package/lib/cjs/components/AddressesContainer.js +1 -1
- package/lib/cjs/components/AdyenPayment.js +1 -1
- package/lib/cjs/components/AvailabilityContainer.js +1 -1
- package/lib/cjs/components/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/BillingAddressContainer.js +1 -1
- package/lib/cjs/components/BillingAddressForm.js +1 -1
- package/lib/cjs/components/BraintreePayment.js +1 -1
- package/lib/cjs/components/CheckoutLink.js +1 -1
- package/lib/cjs/components/CommerceLayer.js +1 -1
- package/lib/cjs/components/CustomerContainer.js +1 -1
- package/lib/cjs/components/CustomerInput.js +1 -1
- package/lib/cjs/components/DeliveryLeadTime.js +1 -1
- package/lib/cjs/components/DiscountAmount.js +1 -1
- package/lib/cjs/components/Errors.js +1 -1
- package/lib/cjs/components/ExternalFunction.js +1 -1
- package/lib/cjs/components/GiftCard.js +1 -1
- package/lib/cjs/components/GiftCardAmount.js +1 -1
- package/lib/cjs/components/GiftCardContainer.js +1 -1
- package/lib/cjs/components/GiftCardCurrencySelector.js +1 -1
- package/lib/cjs/components/GiftCardInput.js +1 -1
- package/lib/cjs/components/GiftCardOrCouponCode.js +1 -1
- package/lib/cjs/components/GiftCardOrCouponForm.js +1 -1
- package/lib/cjs/components/GiftCardOrCouponInput.js +1 -1
- package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/GiftCardOrCouponSubmit.js +1 -1
- package/lib/cjs/components/ItemContainer.js +1 -1
- package/lib/cjs/components/LineItem.js +1 -1
- package/lib/cjs/components/LineItemAmount.js +1 -1
- package/lib/cjs/components/LineItemCode.js +1 -1
- package/lib/cjs/components/LineItemImage.js +1 -1
- package/lib/cjs/components/LineItemName.js +1 -1
- package/lib/cjs/components/LineItemOption.js +1 -1
- package/lib/cjs/components/LineItemOptions.js +1 -1
- package/lib/cjs/components/LineItemQuantity.js +1 -1
- package/lib/cjs/components/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/LineItemsContainer.js +1 -1
- package/lib/cjs/components/LineItemsCount.js +1 -1
- package/lib/cjs/components/MetadataInput.js +1 -1
- package/lib/cjs/components/OrderContainer.js +1 -1
- package/lib/cjs/components/OrderNumber.js +1 -1
- package/lib/cjs/components/OrderStorage.js +1 -1
- package/lib/cjs/components/PaymentGateway.js +1 -1
- package/lib/cjs/components/PaymentMethod.js +1 -1
- package/lib/cjs/components/PaymentMethodAmount.js +1 -1
- package/lib/cjs/components/PaymentMethodName.js +1 -1
- package/lib/cjs/components/PaymentMethodPrice.js +1 -1
- package/lib/cjs/components/PaymentMethodRadioButton.js +1 -1
- package/lib/cjs/components/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/PaymentSource.js +1 -1
- package/lib/cjs/components/PaymentSourceBrandIcon.js +1 -1
- package/lib/cjs/components/PaymentSourceBrandName.js +1 -1
- package/lib/cjs/components/PaymentSourceDetail.js +1 -1
- package/lib/cjs/components/PaymentSourceEditButton.js +1 -1
- package/lib/cjs/components/PaypalPayment.js +1 -1
- package/lib/cjs/components/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/Price.js +1 -1
- package/lib/cjs/components/PricesContainer.js +1 -1
- package/lib/cjs/components/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/cjs/components/QuantitySelector.js +1 -1
- package/lib/cjs/components/SaveAddressesButton.js +1 -1
- package/lib/cjs/components/SaveCustomerButton.js +1 -1
- package/lib/cjs/components/Shipment.js +1 -1
- package/lib/cjs/components/ShipmentField.js +1 -1
- package/lib/cjs/components/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/ShippingAddressContainer.js +1 -1
- package/lib/cjs/components/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/ShippingAmount.js +1 -1
- package/lib/cjs/components/ShippingMethod.js +1 -1
- package/lib/cjs/components/ShippingMethodName.js +1 -1
- package/lib/cjs/components/ShippingMethodPrice.js +1 -1
- package/lib/cjs/components/ShippingMethodRadioButton.d.ts +8 -4
- package/lib/cjs/components/ShippingMethodRadioButton.js +1 -1
- package/lib/cjs/components/SkuList.js +1 -1
- package/lib/cjs/components/SkuListsContainer.js +1 -1
- package/lib/cjs/components/SkuOption.js +1 -1
- package/lib/cjs/components/SkuOptionInput.js +1 -1
- package/lib/cjs/components/SkuOptionsContainer.js +1 -1
- package/lib/cjs/components/StockTransfer.js +1 -1
- package/lib/cjs/components/StockTransferField.js +1 -1
- package/lib/cjs/components/StripePayment.js +1 -1
- package/lib/cjs/components/SubTotalAmount.js +1 -1
- package/lib/cjs/components/SubmitButton.js +1 -1
- package/lib/cjs/components/TaxesAmount.js +1 -1
- package/lib/cjs/components/TotalAmount.js +1 -1
- package/lib/cjs/components/VariantSelector.js +1 -1
- package/lib/cjs/components/VariantsContainer.js +1 -1
- package/lib/cjs/components/WireTransferPayment.js +1 -1
- package/lib/cjs/components/gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/gateways/StripeGateway.js +1 -1
- package/lib/cjs/components/gateways/WireTransferGateway.js +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/cjs/components/utils/BaseField.js +1 -1
- package/lib/cjs/components/utils/BaseInput.js +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
- package/lib/cjs/components/utils/BaseSelect.js +1 -1
- package/lib/cjs/components/utils/Parent.js +1 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.js +1 -1
- package/lib/cjs/components/utils/PriceTemplate.js +1 -1
- package/lib/cjs/components/utils/VariantTemplate.js +1 -1
- package/lib/cjs/components/utils/getAllErrors.js +1 -1
- package/lib/cjs/config/components.js +1 -1
- package/lib/cjs/config/currency.js +1 -1
- package/lib/cjs/context/AddressChildrenContext.js +1 -1
- package/lib/cjs/context/AddressContext.js +1 -1
- package/lib/cjs/context/AvailabilityContext.js +1 -1
- package/lib/cjs/context/BillingAddressContext.js +1 -1
- package/lib/cjs/context/BillingAddressFormContext.js +1 -1
- package/lib/cjs/context/CommerceLayerContext.js +1 -1
- package/lib/cjs/context/CouponAndGiftCardFormContext.js +1 -1
- package/lib/cjs/context/CustomerContext.js +1 -1
- package/lib/cjs/context/ExternalFunctionContext.js +1 -1
- package/lib/cjs/context/GiftCardContext.js +1 -1
- package/lib/cjs/context/ItemContext.js +1 -1
- package/lib/cjs/context/LineItemChildrenContext.js +1 -1
- package/lib/cjs/context/LineItemContext.js +1 -1
- package/lib/cjs/context/LineItemOptionChildrenContext.js +1 -1
- package/lib/cjs/context/OrderContext.js +1 -1
- package/lib/cjs/context/OrderStorageContext.js +1 -1
- package/lib/cjs/context/PaymentMethodChildrenContext.js +1 -1
- package/lib/cjs/context/PaymentMethodContext.js +1 -1
- package/lib/cjs/context/PaymentSourceContext.js +1 -1
- package/lib/cjs/context/PlaceOrderContext.js +1 -1
- package/lib/cjs/context/PricesContext.js +1 -1
- package/lib/cjs/context/ShipmentChildrenContext.js +1 -1
- package/lib/cjs/context/ShipmentContext.js +1 -1
- package/lib/cjs/context/ShippingAddressContext.js +1 -1
- package/lib/cjs/context/ShippingAddressFormContext.js +1 -1
- package/lib/cjs/context/ShippingMethodChildrenContext.js +1 -1
- package/lib/cjs/context/SkuListsContext.js +1 -1
- package/lib/cjs/context/SkuOptionChildrenContext.js +1 -1
- package/lib/cjs/context/SkuOptionsContext.js +1 -1
- package/lib/cjs/context/StockTransferChildrenContext.js +1 -1
- package/lib/cjs/context/VariantsContext.js +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/AddressReducer.js +1 -1
- package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
- package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
- package/lib/cjs/reducers/CustomerReducer.js +1 -1
- package/lib/cjs/reducers/GiftCardReducer.js +1 -1
- package/lib/cjs/reducers/ItemReducer.js +1 -1
- package/lib/cjs/reducers/LineItemReducer.js +1 -1
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
- package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
- package/lib/cjs/reducers/PriceReducer.js +1 -1
- package/lib/cjs/reducers/ShipmentReducer.js +1 -1
- package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
- package/lib/cjs/reducers/SkuListsReducer.js +1 -1
- package/lib/cjs/reducers/SkuOptionsReducer.js +1 -1
- package/lib/cjs/reducers/VariantReducer.js +1 -1
- package/lib/cjs/typings/errors.js +1 -1
- package/lib/cjs/typings/index.js +1 -1
- package/lib/cjs/utils/PropsType.js +1 -1
- package/lib/cjs/utils/addressesManager.js +1 -1
- package/lib/cjs/utils/baseReducer.js +1 -1
- package/lib/cjs/utils/browserInfo.js +1 -1
- package/lib/cjs/utils/childrenTypes.js +1 -1
- package/lib/cjs/utils/countryStateCity.js +1 -1
- package/lib/cjs/utils/customMessages.js +1 -1
- package/lib/cjs/utils/customerOrderOptions.js +1 -1
- package/lib/cjs/utils/getAmount.js +1 -1
- package/lib/cjs/utils/getCurrentItemKey.js +1 -1
- package/lib/cjs/utils/getErrors.js +1 -1
- package/lib/cjs/utils/getLineItemsCount.js +1 -1
- package/lib/cjs/utils/getLoaderComponent.js +1 -1
- package/lib/cjs/utils/getPrices.js +1 -1
- package/lib/cjs/utils/getSdk.js +1 -1
- package/lib/cjs/utils/getSkus.js +1 -1
- package/lib/cjs/utils/isEmptyStates.js +1 -1
- package/lib/cjs/utils/isJSON.js +1 -1
- package/lib/cjs/utils/jwt.js +1 -1
- package/lib/cjs/utils/localStorage.js +1 -1
- package/lib/cjs/utils/organization.js +1 -1
- package/lib/cjs/utils/paypalPayment.js +1 -1
- package/lib/cjs/utils/promisify.js +1 -1
- package/lib/cjs/utils/shipments.js +1 -1
- package/lib/cjs/utils/validateFormFields.js +1 -1
- package/lib/esm/components/AddToCartButton.js +1 -1
- package/lib/esm/components/Address.js +1 -1
- package/lib/esm/components/AddressCountrySelector.js +1 -1
- package/lib/esm/components/AddressField.js +1 -1
- package/lib/esm/components/AddressInput.js +1 -1
- package/lib/esm/components/AddressStateSelector.js +1 -1
- package/lib/esm/components/AddressesContainer.js +1 -1
- package/lib/esm/components/AdyenPayment.js +1 -1
- package/lib/esm/components/AvailabilityContainer.js +1 -1
- package/lib/esm/components/AvailabilityTemplate.js +1 -1
- package/lib/esm/components/BillingAddressContainer.js +1 -1
- package/lib/esm/components/BillingAddressForm.js +1 -1
- package/lib/esm/components/BraintreePayment.js +1 -1
- package/lib/esm/components/CheckoutLink.js +1 -1
- package/lib/esm/components/CommerceLayer.js +1 -1
- package/lib/esm/components/CustomerContainer.js +1 -1
- package/lib/esm/components/CustomerInput.js +1 -1
- package/lib/esm/components/DeliveryLeadTime.js +1 -1
- package/lib/esm/components/DiscountAmount.js +1 -1
- package/lib/esm/components/Errors.js +1 -1
- package/lib/esm/components/ExternalFunction.js +1 -1
- package/lib/esm/components/GiftCard.js +1 -1
- package/lib/esm/components/GiftCardAmount.js +1 -1
- package/lib/esm/components/GiftCardContainer.js +1 -1
- package/lib/esm/components/GiftCardCurrencySelector.js +1 -1
- package/lib/esm/components/GiftCardInput.js +1 -1
- package/lib/esm/components/GiftCardOrCouponCode.js +1 -1
- package/lib/esm/components/GiftCardOrCouponForm.js +1 -1
- package/lib/esm/components/GiftCardOrCouponInput.js +1 -1
- package/lib/esm/components/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/esm/components/GiftCardOrCouponSubmit.js +1 -1
- package/lib/esm/components/ItemContainer.js +1 -1
- package/lib/esm/components/LineItem.js +1 -1
- package/lib/esm/components/LineItemAmount.js +1 -1
- package/lib/esm/components/LineItemCode.js +1 -1
- package/lib/esm/components/LineItemImage.js +1 -1
- package/lib/esm/components/LineItemName.js +1 -1
- package/lib/esm/components/LineItemOption.js +1 -1
- package/lib/esm/components/LineItemOptions.js +1 -1
- package/lib/esm/components/LineItemQuantity.js +1 -1
- package/lib/esm/components/LineItemRemoveLink.js +1 -1
- package/lib/esm/components/LineItemsContainer.js +1 -1
- package/lib/esm/components/LineItemsCount.js +1 -1
- package/lib/esm/components/MetadataInput.js +1 -1
- package/lib/esm/components/OrderContainer.js +1 -1
- package/lib/esm/components/OrderNumber.js +1 -1
- package/lib/esm/components/OrderStorage.js +1 -1
- package/lib/esm/components/PaymentGateway.js +1 -1
- package/lib/esm/components/PaymentMethod.js +1 -1
- package/lib/esm/components/PaymentMethodAmount.js +1 -1
- package/lib/esm/components/PaymentMethodName.js +1 -1
- package/lib/esm/components/PaymentMethodPrice.js +1 -1
- package/lib/esm/components/PaymentMethodRadioButton.js +1 -1
- package/lib/esm/components/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/PaymentSource.js +1 -1
- package/lib/esm/components/PaymentSourceBrandIcon.js +1 -1
- package/lib/esm/components/PaymentSourceBrandName.js +1 -1
- package/lib/esm/components/PaymentSourceDetail.js +1 -1
- package/lib/esm/components/PaymentSourceEditButton.js +1 -1
- package/lib/esm/components/PaypalPayment.js +1 -1
- package/lib/esm/components/PlaceOrderButton.js +1 -1
- package/lib/esm/components/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/Price.js +1 -1
- package/lib/esm/components/PricesContainer.js +1 -1
- package/lib/esm/components/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/esm/components/QuantitySelector.js +1 -1
- package/lib/esm/components/SaveAddressesButton.js +1 -1
- package/lib/esm/components/SaveCustomerButton.js +1 -1
- package/lib/esm/components/Shipment.js +1 -1
- package/lib/esm/components/ShipmentField.js +1 -1
- package/lib/esm/components/ShipmentsContainer.js +1 -1
- package/lib/esm/components/ShippingAddressContainer.js +1 -1
- package/lib/esm/components/ShippingAddressForm.js +1 -1
- package/lib/esm/components/ShippingAmount.js +1 -1
- package/lib/esm/components/ShippingMethod.js +1 -1
- package/lib/esm/components/ShippingMethodName.js +1 -1
- package/lib/esm/components/ShippingMethodPrice.js +1 -1
- package/lib/esm/components/ShippingMethodRadioButton.d.ts +8 -4
- package/lib/esm/components/ShippingMethodRadioButton.js +1 -1
- package/lib/esm/components/SkuList.js +1 -1
- package/lib/esm/components/SkuListsContainer.js +1 -1
- package/lib/esm/components/SkuOption.js +1 -1
- package/lib/esm/components/SkuOptionInput.js +1 -1
- package/lib/esm/components/SkuOptionsContainer.js +1 -1
- package/lib/esm/components/StockTransfer.js +1 -1
- package/lib/esm/components/StockTransferField.js +1 -1
- package/lib/esm/components/StripePayment.js +1 -1
- package/lib/esm/components/SubTotalAmount.js +1 -1
- package/lib/esm/components/SubmitButton.js +1 -1
- package/lib/esm/components/TaxesAmount.js +1 -1
- package/lib/esm/components/TotalAmount.js +1 -1
- package/lib/esm/components/VariantSelector.js +1 -1
- package/lib/esm/components/VariantsContainer.js +1 -1
- package/lib/esm/components/WireTransferPayment.js +1 -1
- package/lib/esm/components/gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/gateways/BraintreeGateway.js +1 -1
- package/lib/esm/components/gateways/PaypalGateway.js +1 -1
- package/lib/esm/components/gateways/StripeGateway.js +1 -1
- package/lib/esm/components/gateways/WireTransferGateway.js +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/esm/components/utils/BaseField.js +1 -1
- package/lib/esm/components/utils/BaseInput.js +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
- package/lib/esm/components/utils/BaseSelect.js +1 -1
- package/lib/esm/components/utils/Parent.js +1 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.js +1 -1
- package/lib/esm/components/utils/PriceTemplate.js +1 -1
- package/lib/esm/components/utils/VariantTemplate.js +1 -1
- package/lib/esm/components/utils/getAllErrors.js +1 -1
- package/lib/esm/config/components.js +1 -1
- package/lib/esm/context/AddressChildrenContext.js +1 -1
- package/lib/esm/context/AddressContext.js +1 -1
- package/lib/esm/context/CommerceLayerContext.js +1 -1
- package/lib/esm/context/CustomerContext.js +1 -1
- package/lib/esm/context/ExternalFunctionContext.js +1 -1
- package/lib/esm/context/LineItemChildrenContext.js +1 -1
- package/lib/esm/context/LineItemContext.js +1 -1
- package/lib/esm/context/LineItemOptionChildrenContext.js +1 -1
- package/lib/esm/context/OrderContext.js +1 -1
- package/lib/esm/context/OrderStorageContext.js +1 -1
- package/lib/esm/context/PaymentMethodChildrenContext.js +1 -1
- package/lib/esm/context/PaymentMethodContext.js +1 -1
- package/lib/esm/context/PlaceOrderContext.js +1 -1
- package/lib/esm/context/ShipmentChildrenContext.js +1 -1
- package/lib/esm/context/ShipmentContext.js +1 -1
- package/lib/esm/context/ShippingMethodChildrenContext.js +1 -1
- package/lib/esm/context/SkuOptionChildrenContext.js +1 -1
- package/lib/esm/context/StockTransferChildrenContext.js +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/reducers/AddressReducer.js +1 -1
- package/lib/esm/reducers/AvailabilityReducer.js +1 -1
- package/lib/esm/reducers/BillingAddressReducer.js +1 -1
- package/lib/esm/reducers/CustomerReducer.js +1 -1
- package/lib/esm/reducers/GiftCardReducer.js +1 -1
- package/lib/esm/reducers/ItemReducer.js +1 -1
- package/lib/esm/reducers/LineItemReducer.js +1 -1
- package/lib/esm/reducers/OrderReducer.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
- package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
- package/lib/esm/reducers/PriceReducer.js +1 -1
- package/lib/esm/reducers/ShipmentReducer.js +1 -1
- package/lib/esm/reducers/ShippingAddressReducer.js +1 -1
- package/lib/esm/reducers/SkuListsReducer.js +1 -1
- package/lib/esm/reducers/SkuOptionsReducer.js +1 -1
- package/lib/esm/reducers/VariantReducer.js +1 -1
- package/lib/esm/typings/errors.js +1 -1
- package/lib/esm/typings/index.js +1 -1
- package/lib/esm/utils/addressesManager.js +1 -1
- package/lib/esm/utils/baseReducer.js +1 -1
- package/lib/esm/utils/browserInfo.js +1 -1
- package/lib/esm/utils/childrenTypes.js +1 -1
- package/lib/esm/utils/countryStateCity.js +1 -1
- package/lib/esm/utils/customMessages.js +1 -1
- package/lib/esm/utils/getAmount.js +1 -1
- package/lib/esm/utils/getCurrentItemKey.js +1 -1
- package/lib/esm/utils/getErrors.js +1 -1
- package/lib/esm/utils/getLineItemsCount.js +1 -1
- package/lib/esm/utils/getLoaderComponent.js +1 -1
- package/lib/esm/utils/getPrices.js +1 -1
- package/lib/esm/utils/getSdk.js +1 -1
- package/lib/esm/utils/getSkus.js +1 -1
- package/lib/esm/utils/isEmptyStates.js +1 -1
- package/lib/esm/utils/isJSON.js +1 -1
- package/lib/esm/utils/jwt.js +1 -1
- package/lib/esm/utils/localStorage.js +1 -1
- package/lib/esm/utils/organization.js +1 -1
- package/lib/esm/utils/paypalPayment.js +1 -1
- package/lib/esm/utils/promisify.js +1 -1
- package/lib/esm/utils/shipments.js +1 -1
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName,StockTransfer=props=>{const{children}=props,{lineItem}=useContext(LineItemChildrenContext),{stockTransfers}=useContext(ShipmentChildrenContext),components2=stockTransfers==null?void 0:stockTransfers.filter(stock=>stock.sku_code===(lineItem==null?void 0:lineItem.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:stockTransferProps},{children}),k)});return _jsx(Fragment,{children:components2},void 0)};StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.StockTransferField.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.StockTransferField.propTypes,displayName=components.StockTransferField.displayName,StockTransferField=props=>{const{type}=props,{stockTransfer}=useContext(StockTransferChildrenContext),text=stockTransfer?stockTransfer[type]:"",parentProps=Object.assign({},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("p",Object.assign({},props,{children:text}),void 0)};StockTransferField.propTypes=propTypes,StockTransferField.displayName=displayName;export default StockTransferField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{setCustomerOrderParam}from"../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{setCustomerOrderParam}from"../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:!0},StripePaymentForm=({options=defaultOptions,templateCustomerSaveToWallet})=>{const ref=useRef(null),{setPaymentSource,paymentSource,currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),stripe=useStripe(),elements=useElements();useEffect(()=>(ref.current&&stripe&&elements&&(ref.current.onsubmit=()=>onSubmit(ref.current,stripe,elements),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements]);const onSubmit=async(event,stripe2,elements2)=>{var _a,_b;if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=(_b=(_a=event==null?void 0:event.elements)===null||_a===void 0?void 0:_a.save_payment_source_to_customer_wallet)===null||_b===void 0?void 0:_b.checked;savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet);const cardElement=elements2&&elements2.getElement(CardElement);if(cardElement){const billingInfo=order==null?void 0:order.billing_address,email=order==null?void 0:order.customer_email,billing_details={name:billingInfo==null?void 0:billingInfo.full_name,email,phone:billingInfo==null?void 0:billingInfo.phone,address:{city:billingInfo==null?void 0:billingInfo.city,country:billingInfo==null?void 0:billingInfo.country_code,line1:billingInfo==null?void 0:billingInfo.line_1,postal_code:billingInfo==null?void 0:billingInfo.zip_code,state:billingInfo==null?void 0:billingInfo.state_code}},{paymentMethod}=await stripe2.createPaymentMethod({type:"card",card:cardElement,billing_details});if(paymentSource==null?void 0:paymentSource.client_secret){const{error,paymentIntent}=await stripe2.confirmCardPayment(paymentSource.client_secret,{payment_method:{card:cardElement,billing_details}});if(error)console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]);else if(paymentIntent&&paymentMethod&&paymentSource&¤tPaymentMethodType)try{return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{options:Object.assign(Object.assign({},paymentMethod),{setup_future_usage:"off_session"})}}),!0}catch{return!1}}}return!1};return _jsxs("form",Object.assign({ref,onSubmit:e=>onSubmit(e,stripe,elements)},{children:[_jsx(CardElement,{options:Object.assign(Object.assign({},defaultOptions),options)},void 0),templateCustomerSaveToWallet&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:templateCustomerSaveToWallet}),void 0)]}),void 0)},StripePayment=_a=>{var{publishableKey,show,options,locale="auto"}=_a,p=__rest(_a,["publishableKey","show","options","locale"]);const[isLoaded,setIsLoaded]=useState(!1),[stripe,setStripe]=useState(null),{containerClassName,templateCustomerSaveToWallet,fonts=[]}=p,divProps=__rest(p,["containerClassName","templateCustomerSaveToWallet","fonts"]);return useEffect(()=>{if(show&&publishableKey){const{loadStripe}=require("@stripe/stripe-js");(async()=>{const res=await loadStripe(publishableKey,{locale});setStripe(res),setIsLoaded(!0)})()}return()=>{setIsLoaded(!1)}},[show,publishableKey]),isLoaded&&stripe?_jsx("div",Object.assign({className:containerClassName},divProps,{children:_jsx(Elements,Object.assign({stripe,options:{fonts}},{children:_jsx(StripePaymentForm,{options,templateCustomerSaveToWallet},void 0)}),void 0)}),void 0):null};export default StripePayment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.SubTotalAmount.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.SubTotalAmount.propTypes,defaultProps=components.SubTotalAmount.defaultProps,displayName=components.SubTotalAmount.displayName,SubTotalAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"subtotal"},props),void 0);SubTotalAmount.propTypes=propTypes,SubTotalAmount.defaultProps=defaultProps,SubTotalAmount.displayName=displayName;export default SubTotalAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";import isFunction from"lodash/isFunction";const propTypes=components.SubmitButton.propTypes
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";import isFunction from"lodash/isFunction";const propTypes=components.SubmitButton.propTypes,defaultProps=components.SubmitButton.defaultProps,displayName=components.SubmitButton.displayName,SubmitButton=props=>{const{children,label="Submit"}=props,p=__rest(props,["children","label"]),parentProps=Object.assign(Object.assign({},p),{label});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("button",Object.assign({type:"submit"},p,{children:isFunction(label)?label():label}),void 0)};SubmitButton.propTypes=propTypes,SubmitButton.defaultProps=defaultProps,SubmitButton.displayName=displayName;export default SubmitButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TaxesAmount.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TaxesAmount.propTypes,defaultProps=components.TaxesAmount.defaultProps,displayName=components.TaxesAmount.displayName,TaxesAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"total_tax"},props),void 0);TaxesAmount.propTypes=propTypes,TaxesAmount.defaultProps=defaultProps,TaxesAmount.displayName=displayName;export default TaxesAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TotalAmount.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TotalAmount.propTypes,defaultProps=components.TotalAmount.defaultProps,displayName=components.TotalAmount.displayName,TotalAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"total_amount",type:"with_taxes"},props),void 0);TotalAmount.propTypes=propTypes,TotalAmount.defaultProps=defaultProps,TotalAmount.displayName=displayName;export default TotalAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"./utils/VariantTemplate";import Parent from"./utils/Parent";import VariantsContext from"../context/VariantsContext";import components from"../config/components";const propTypes=components.VariantSelector.propTypes
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"./utils/VariantTemplate";import Parent from"./utils/Parent";import VariantsContext from"../context/VariantsContext";import components from"../config/components";const propTypes=components.VariantSelector.propTypes,defaultProps=components.VariantSelector.defaultProps,displayName=components.VariantSelector.displayName,VariantSelector=props=>{const{children,type,placeholder,skuCode,name,options}=props,prs=__rest(props,["children","type","placeholder","skuCode","name","options"]),{setSkuCode,skuCode:variantSkuCode,loading,variants,setSkuCodes}=useContext(VariantsContext);useEffect(()=>(setSkuCodes&&setSkuCodes(options),()=>{setSkuCodes&&setSkuCodes([])}),[options]);const sCode=variantSkuCode||skuCode||"",DefaultTemplate=()=>loading?_jsx(Fragment,{children:props.loader||"Loading..."},void 0):_jsx(VariantTemplate,Object.assign({variants,type,placeholder,skuCode:sCode,options,handleChange:setSkuCode,name},prs),void 0),parentProps=Object.assign({variants,loading:!!loading,handleSelect:setSkuCode,skuCode:sCode},props);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx(Fragment,{children:_jsx(DefaultTemplate,{},void 0)},void 0)};VariantSelector.propTypes=propTypes,VariantSelector.defaultProps=defaultProps,VariantSelector.displayName=displayName;export default VariantSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../reducers/VariantReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import VariantsContext from"../context/VariantsContext";import{setVariantSkuCodes}from"../reducers/VariantReducer";import{isEmpty,isEqual}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.VariantsContainer.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../reducers/VariantReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import VariantsContext from"../context/VariantsContext";import{setVariantSkuCodes}from"../reducers/VariantReducer";import{isEmpty,isEqual}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.VariantsContainer.propTypes,defaultProps=components.VariantsContainer.defaultProps,displayName=components.VariantsContainer.displayName,VariantsContainer=props=>{const{children,skuCode="",filters={}}=props,config=useContext(CommerceLayerContext),{setItem,setItems,items,item:currentItem,setCustomLineItems,skuCode:itemSkuCode}=useContext(ItemContext),[state,dispatch]=useReducer(variantReducer,variantInitialState),sCode=getCurrentItemKey(currentItem)||skuCode||state.skuCode||itemSkuCode||"";useEffect(()=>{if(!isEmpty(items)&&!isEmpty(state.variants)&&!isEqual(items,state.variants)){const mergeItems=Object.assign(Object.assign({},items),state.variants);setItems&&setItems(mergeItems)}return state.skuCodes.length>=1&&config.accessToken&&(dispatch({type:"setLoading",payload:{loading:!0}}),getVariants({config,state,dispatch,setItem,skuCode:sCode,filters})),()=>unsetVariantState(dispatch)},[config]);const variantValue=Object.assign(Object.assign({},state),{skuCode:sCode,setSkuCode:(code,id,lineItem={})=>{isEmpty(lineItem)||setCustomLineItems&&setCustomLineItems({[code]:lineItem}),setSkuCode({code,id,config,setItem,dispatch})},setSkuCodes:skuCodes=>setVariantSkuCodes({skuCodes,dispatch,setCustomLineItems})});return _jsx(VariantsContext.Provider,Object.assign({value:variantValue},{children}),void 0)};VariantsContainer.propTypes=propTypes,VariantsContainer.defaultProps=defaultProps,VariantsContainer.displayName=displayName;export default VariantsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext from"../context/PaymentMethodContext";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef}from"react";const defaultMessage="after placing the order, you will need to manually complete the payment with your bank"
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext from"../context/PaymentMethodContext";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef}from"react";const defaultMessage="after placing the order, you will need to manually complete the payment with your bank",WireTransferPayment=_a=>{var{infoMessage}=_a,p=__rest(_a,["infoMessage"]);const ref=useRef(null),{setPaymentSource,paymentSource,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext);useEffect(()=>(ref.current&&paymentSource&¤tPaymentMethodType&&(ref.current.onsubmit=()=>handleClick(),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType]);const handleClick=async()=>{if(paymentSource&¤tPaymentMethodType)try{return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{metadata:{card:{id:paymentSource.id,brand:"wire-transfer",last4:""}}}}),!0}catch{return!1}return!1};return _jsx("form",Object.assign({ref},{children:_jsx("div",Object.assign({},p,{children:_jsx("span",Object.assign({className:infoMessage==null?void 0:infoMessage.className},{children:isFunction(infoMessage==null?void 0:infoMessage.text)?infoMessage==null?void 0:infoMessage.text():(infoMessage==null?void 0:infoMessage.text)||defaultMessage}),void 0)}),void 0)}),void 0)};export default WireTransferPayment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import AdyenPayment from"../AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import jwt from"../../utils/jwt";export default function AdyenGateway(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import AdyenPayment from"../AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import jwt from"../../utils/jwt";export default function AdyenGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{accessToken}=useContext(CommerceLayerContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="adyen_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const clientKey=paymentSource==null?void 0:paymentSource.public_key,environment=jwt(accessToken).test?"test":"live",adyenConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="adyen_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.payment_request_data)===null||_a===void 0?void 0:_a.payment_method,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?clientKey&&!loading&&(paymentSource==null?void 0:paymentSource.payment_methods)?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(AdyenPayment,{templateCustomerSaveToWallet,clientKey,locale,environment,config:adyenConfig},void 0)]},void 0):loaderComponent:clientKey&&!loading&&(paymentSource==null?void 0:paymentSource.payment_methods)?_jsx(AdyenPayment,{clientKey,locale,config:adyenConfig},void 0):loaderComponent}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import BraintreePayment from"../BraintreePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function BraintreeGateway(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import BraintreePayment from"../BraintreePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function BraintreeGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="braintree_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const authorization=paymentSource==null?void 0:paymentSource.client_token,braintreeConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="braintree_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?authorization&&!loading?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(BraintreePayment,{templateCustomerSaveToWallet,authorization,locale,config:braintreeConfig},void 0)]},void 0):loaderComponent:authorization&&!loading?_jsx(BraintreePayment,{locale,authorization,config:braintreeConfig},void 0):loaderComponent}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../PaypalPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function PaypalGateway(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../PaypalPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function PaypalGateway(props){var _a,_b;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="paypal_payments";if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;if(readonly||showCard){const card=((_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card)||((_b=paymentSource==null?void 0:paymentSource.metadata)===null||_b===void 0?void 0:_b.card),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}const paypalConfig=config&&getPaymentConfig(paymentResource,config);return _jsx(PaypalPayment,Object.assign({},p,{infoMessage:paypalConfig==null?void 0:paypalConfig.infoMessage}),void 0)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../StripePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function StripeGateway(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../StripePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function StripeGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="stripe_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const publishableKey=paymentSource==null?void 0:paymentSource.publishable_key,stripeConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="stripe_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(StripePayment,Object.assign({show,templateCustomerSaveToWallet,publishableKey,locale},stripeConfig),void 0)]},void 0):publishableKey&&!loading?_jsx(StripePayment,Object.assign({show,publishableKey,locale},stripeConfig),void 0):loaderComponent}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../WireTransferPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function WireTransferGateway(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../WireTransferPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function WireTransferGateway(props){var _a,_b;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="wire_transfers";if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;if(readonly||showCard){const card=((_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card)||((_b=paymentSource==null?void 0:paymentSource.metadata)===null||_b===void 0?void 0:_b.card),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}const wireTransferConfig=config&&paymentResource?getPaymentConfig(paymentResource,config):{};return _jsx(WireTransferPayment,Object.assign({},p,wireTransferConfig),void 0)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className} ${deselect?"":selectedClassName}`:className,finalClassName=disabled?`${className} ${disabledClassName}`:addressSelectedClass,customerAddressId=(address==null?void 0:address.reference)||"",onClick=()=>handleSelect(k,address.id,customerAddressId,disabled);return Object.assign(Object.assign({},attributes),{className:finalClassName,onClick})}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=_a=>{var{children,attribute}=_a,p=__rest(_a,["children","attribute"]);const{order}=useContext(OrderContext),[field,setField]=useState("");useEffect(()=>(order&&attribute in order&&setField(order[attribute]),()=>{setField("")}),[order]);const parentProps=Object.assign({attribute:field},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:field}),void 0)};export default BaseField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(props,ref)=>{const{children}=props,p=__rest(props,["children"]),input=props.type==="textarea"?_jsx("textarea",Object.assign({ref},p),void 0):_jsx("input",Object.assign({ref},p),void 0);return children?_jsx(Parent,Object.assign({},p,{children}),void 0):input};export default React.forwardRef(BaseInput);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import{isEmpty}from"lodash";const BaseOrderPrice=
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import{isEmpty}from"lodash";const BaseOrderPrice=props=>{const{format="formatted",base,type,children}=props,p=__rest(props,["format","base","type","children"]),{order}=useContext(OrderContext),[price,setPrice]=useState(""),[cents,setCents]=useState(0);useEffect(()=>{const p2=getAmount({base,type,format,obj:order||{}}),c=getAmount({base,type,format:"cents",obj:order||{}});return setPrice(p2),setCents(c),()=>{isEmpty(order)&&setPrice("")}},[order]);const parentProps=Object.assign({priceCents:cents,price},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:price}),void 0)};BaseOrderPrice.propTypes=baseOrderPricePropTypes;export default BaseOrderPrice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(props,ref)=>{const{options=[],children,placeholder={label:"Select an option",value:""},value=""}=props,p=__rest(props,["options","children","placeholder","value"]);findIndex(options,placeholder)===-1?options.unshift(placeholder):options[0]=placeholder;const Options=options.map((o,k)=>{const{label}=o,option=__rest(o,["label"]);return _jsx("option",Object.assign({},option,{children:label}),k)}),parentProps=Object.assign({options,ref},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("select",Object.assign({ref,defaultValue:value},p,{children:Options}),void 0)};export default React.forwardRef(BaseSelect);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PropTypes from"prop-types";const PProps={children:PropTypes.func}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PropTypes from"prop-types";const PProps={children:PropTypes.func},Parent=props=>{const Child=props.children;return Child?_jsx(Child,Object.assign({},props),void 0):null};Parent.propTypes=PProps;export default Parent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";export default function PaymentCardsTemplate({customerPayments
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";export default function PaymentCardsTemplate({customerPayments,children,paymentResource}){const{setPaymentSource}=useContext(PaymentMethodContext),value={customerPayments:customerPayments.map(customerPayment=>{var _a,_b,_c,_d,_e,_f,_g;const attributes=customerPayment,card=((_a=customerPayment==null?void 0:customerPayment.payment_source.options)===null||_a===void 0?void 0:_a.card)||((_c=(_b=customerPayment==null?void 0:customerPayment.payment_source)===null||_b===void 0?void 0:_b.payment_request_data)===null||_c===void 0?void 0:_c.paymentMethod)||((_e=(_d=customerPayment==null?void 0:customerPayment.payment_source)===null||_d===void 0?void 0:_d.payment_method)===null||_e===void 0?void 0:_e.card)||((_g=(_f=customerPayment==null?void 0:customerPayment.payment_source)===null||_f===void 0?void 0:_f.metadata)===null||_g===void 0?void 0:_g.card),handleClick=async e=>{e.stopPropagation(),await setPaymentSource({paymentResource,customerPaymentSourceId:customerPayment.id})};return Object.assign(Object.assign({},attributes),{card,handleClick})}),PaymentSourceProvider:PaymentSourceContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string}
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string},defaultProps={formattedAmount:"",formattedCompare:""},PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount,skuCode}=props,p=__rest(props,["showCompare","formattedCompare","compareClassName","className","formattedAmount","skuCode"]);return _jsxs(Fragment,{children:[_jsx("span",Object.assign({className},p,{children:formattedAmount}),void 0),showCompare&&_jsx("span",Object.assign({className:compareClassName||""},p,{children:formattedCompare}),void 0)]},void 0)};PriceTemplate.propTypes=propTypes,PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import{keys}from"lodash";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import{keys}from"lodash";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=props=>{const{id,variants,type,placeholder,options,skuCode,handleChange,handleCallback}=props,prs=__rest(props,["id","variants","type","placeholder","options","skuCode","handleChange","handleCallback"]),vars=keys(variants).map((v,k)=>{const checked=skuCode===v,label=options.length>0?options[k].label:variants[v].name;return type==="select"?_jsx("option",Object.assign({"data-sku-id":variants[v].id,"data-label":label,value:variants[v].code},{children:label}),variants[v].id):_jsxs(Fragment,{children:[_jsx("input",Object.assign({id:id&&`${id}-${k}`,defaultChecked:checked,type:"radio",value:variants[v].code,onChange:e=>{const code=e.target.value;handleChange&&handleChange(code,variants[v].id),handleCallback&&handleCallback({code,label})}},prs),void 0),label]},variants[v].id)});return type==="select"?_jsxs("select",Object.assign({id,title:"Variant selector",onChange:e=>{const v=e.target.value,i=e.target.selectedIndex,id2=e.target[i].dataset.skuId,label=e.target[i].dataset.label;handleChange&&handleChange(v,id2),handleCallback&&handleCallback({code:v,label})},value:skuCode||""},prs,{children:[_jsx("option",Object.assign({disabled:!!skuCode},{children:placeholder}),void 0),vars]}),void 0):_jsx(Fragment,{children:vars},void 0)};VariantTemplate.propTypes=propTypes;export default VariantTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=params=>{const{allErrors,messages,field,props,lineItem,resource,returnHtml=!0}=params;return allErrors.map((v,k)=>{const objMsg=customMessages(messages,v),text=(objMsg==null?void 0:objMsg.message)||v.message||`${v.title} - ${v.detail}`;if(field){if(v.resource==="line_items"&&lineItem&&v.id===lineItem.id)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text;if(field===v.field&&resource===v.resource)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text}if(resource===v.resource&&!field)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text})};export default getAllErrors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:true}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:true}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:true}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:false}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:true}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:undefined}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:true}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","expYear","expMonth"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["quantity","sku_code"]).isRequired}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
|
|
1
|
+
import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:!0}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:!1}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:!0}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:void 0}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:!0}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","expYear","expMonth"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["quantity","sku_code"]).isRequired}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={address:{}}
|
|
1
|
+
import{createContext}from"react";const initial={address:{}},AddressChildrenContext=createContext(initial);export default AddressChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{setAddress}from"../reducers/AddressReducer";export const defaultAddressContext={saveAddresses:()=>{},setCloneAddress:()=>{},setAddress
|
|
1
|
+
import{createContext}from"react";import{setAddress}from"../reducers/AddressReducer";export const defaultAddressContext={saveAddresses:()=>{},setCloneAddress:()=>{},setAddress,setAddressErrors:()=>{}};const AddressesContext=createContext(defaultAddressContext);export default AddressesContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={accessToken:"",endpoint:""}
|
|
1
|
+
import{createContext}from"react";const initial={accessToken:"",endpoint:""},CommerceLayerContext=createContext(initial);export default CommerceLayerContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setCustomerErrors,setCustomerEmail}from"../reducers/CustomerReducer";import{createContext}from"react";export const defaultCustomerContext={saveCustomerUser:async()=>{},getCustomerPaymentSources:async()=>{},setCustomerErrors
|
|
1
|
+
import{setCustomerErrors,setCustomerEmail}from"../reducers/CustomerReducer";import{createContext}from"react";export const defaultCustomerContext={saveCustomerUser:async()=>{},getCustomerPaymentSources:async()=>{},setCustomerErrors,setCustomerEmail};const CustomerContext=createContext(defaultCustomerContext);export default CustomerContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import axios from"axios";export const callExternalFunction=async({url
|
|
1
|
+
import{createContext}from"react";import axios from"axios";export const callExternalFunction=async({url,data})=>axios.post(url,data);const ExternalFunctionContext=createContext({url:null,callExternalFunction});export default ExternalFunctionContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={}
|
|
1
|
+
import{createContext}from"react";const initial={},LineItemChildrenContext=createContext(initial);export default LineItemChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={lineItems:[]}
|
|
1
|
+
import{createContext}from"react";const initial={lineItems:[]},LineItemContext=createContext(initial);export default LineItemContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={lineItemOption:{}}
|
|
1
|
+
import{createContext}from"react";const initial={lineItemOption:{}},LineItemOptionChildrenContext=createContext(initial);export default LineItemOptionChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{addToCart,setOrderErrors,createOrder,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,updateOrder}from"../reducers/OrderReducer";export const defaultOrderContext={addToCart
|
|
1
|
+
import{createContext}from"react";import{addToCart,setOrderErrors,createOrder,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,updateOrder}from"../reducers/OrderReducer";export const defaultOrderContext={addToCart,createOrder,setOrderErrors,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,getOrder:async _id=>{},updateOrder};const OrderContext=createContext(defaultOrderContext);export default OrderContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../utils/localStorage";const initial={persistKey:"",clearWhenPlaced
|
|
1
|
+
import{createContext}from"react";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../utils/localStorage";const initial={persistKey:"",clearWhenPlaced:!0,getLocalOrder,setLocalOrder,deleteLocalOrder},OrderStorageContext=createContext(initial);export default OrderStorageContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={}
|
|
1
|
+
import{createContext}from"react";const initial={},PaymentMethodChildrenContext=createContext(initial);export default PaymentMethodChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{updatePaymentSource}from"../reducers/PaymentMethodReducer";import{setPaymentMethodErrors,setPaymentSource,setPaymentMethod,destroyPaymentSource,setPaymentRef,setLoading}from"../reducers/PaymentMethodReducer";export const defaultPaymentMethodContext={setPaymentMethodErrors
|
|
1
|
+
import{createContext}from"react";import{updatePaymentSource}from"../reducers/PaymentMethodReducer";import{setPaymentMethodErrors,setPaymentSource,setPaymentMethod,destroyPaymentSource,setPaymentRef,setLoading}from"../reducers/PaymentMethodReducer";export const defaultPaymentMethodContext={setPaymentMethodErrors,setPaymentMethod,setPaymentSource,setPaymentRef,destroyPaymentSource,updatePaymentSource,setLoading};const PaymentMethodContext=createContext(defaultPaymentMethodContext);export default PaymentMethodContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{setPlaceOrderErrors}from"../reducers/PlaceOrderReducer";export const defaultPlaceOrderContext={setPlaceOrderErrors
|
|
1
|
+
import{createContext}from"react";import{setPlaceOrderErrors}from"../reducers/PlaceOrderReducer";export const defaultPlaceOrderContext={setPlaceOrderErrors};const PlaceOrderContext=createContext(defaultPlaceOrderContext);export default PlaceOrderContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={lineItems:[],shippingMethods:[],stockTransfers:[],keyNumber:0}
|
|
1
|
+
import{createContext}from"react";const initial={lineItems:[],shippingMethods:[],stockTransfers:[],keyNumber:0},ShipmentChildrenContext=createContext(initial);export default ShipmentChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{setShipmentErrors}from"../reducers/ShipmentReducer";export const defaultShipmentContext={setShipmentErrors
|
|
1
|
+
import{createContext}from"react";import{setShipmentErrors}from"../reducers/ShipmentReducer";export const defaultShipmentContext={setShipmentErrors,setShippingMethod:async()=>{}};const ShipmentContext=createContext(defaultShipmentContext);export default ShipmentContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={}
|
|
1
|
+
import{createContext}from"react";const initial={},ShippingMethodChildrenContext=createContext(initial);export default ShippingMethodChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={skuCode:""}
|
|
1
|
+
import{createContext}from"react";const initial={skuCode:""},SkuOptionChildrenContext=createContext(initial);export default SkuOptionChildrenContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";const initial={}
|
|
1
|
+
import{createContext}from"react";const initial={},StockTransferChildrenContext=createContext(initial);export default StockTransferChildrenContext;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -88,3 +88,4 @@ export { default as VariantsContainer } from './components/VariantsContainer';
|
|
|
88
88
|
export type { CustomerCardsTemplate } from './components/utils/PaymentCardsTemplate';
|
|
89
89
|
export type { AddressCardsTemplate } from './components/utils/AddressCardsTemplate';
|
|
90
90
|
export type { AddToCartButtonTemplate } from './components/AddToCartButton';
|
|
91
|
+
export type { ShippingMethodRadioButtonTemplate, ShippingMethodRadioButtonOnChange, } from './components/ShippingMethodRadioButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"]
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],addressInitialState={errors:[]},setAddressErrors=({errors,dispatch,currentErrors=[],resource})=>{const billingErrors=resource==="billing_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="billing_address"),shippingErrors=resource==="shipping_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="shipping_address"),finalErrors=[...billingErrors,...shippingErrors];dispatch&&dispatch({type:"setErrors",payload:{errors:finalErrors}})},setAddress=({values,resource,dispatch})=>{dispatch&&dispatch({type:"setAddress",payload:{[`${resource}`]:values}})},setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${camelCase(resource)}Id`]:id}})},saveAddresses=async({config,updateOrder,order,state})=>{var _a,_b,_c;const{shipToDifferentAddress,billing_address,shipping_address,billingAddressId,shippingAddressId}=state;try{const sdk=getSdk(config);if(order){const currentBillingAddressRef=(_a=order==null?void 0:order.billing_address)===null||_a===void 0?void 0:_a.reference,orderAttributes={id:order==null?void 0:order.id,_billing_address_clone_id:billingAddressId,_shipping_address_clone_id:billingAddressId};if(currentBillingAddressRef===billingAddressId&&(orderAttributes._billing_address_clone_id=(_b=order==null?void 0:order.billing_address)===null||_b===void 0?void 0:_b.id,orderAttributes._shipping_address_clone_id=(_c=order==null?void 0:order.shipping_address)===null||_c===void 0?void 0:_c.id),!isEmpty(billing_address)&&billing_address){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,orderAttributes._shipping_address_same_as_billing=!0;const address=await sdk.addresses.create(billing_address);orderAttributes.billing_address=sdk.addresses.relationship(address.id)}if(shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressId&&(orderAttributes._shipping_address_clone_id=shippingAddressId),!isEmpty(shipping_address)&&shipping_address)){delete orderAttributes._shipping_address_clone_id;const address=await sdk.addresses.create(shipping_address);orderAttributes.shipping_address=sdk.addresses.relationship(address.id)}!isEmpty(orderAttributes)&&updateOrder&&await updateOrder({id:order.id,attributes:orderAttributes})}}catch(error){console.error(error)}};const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default addressReducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const availabilityInitialState={quantity:null,min:{days:0,hours:0},max:{days:0,hours:0},errors:[]}
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const availabilityInitialState={quantity:null,min:{days:0,hours:0},max:{days:0,hours:0},errors:[]},getAvailability=async({skuCode,dispatch,config})=>{var _a;const sdk=getSdk(config);try{const[sku]=await sdk.skus.list({fields:{skus:["id"]},filters:{code_in:skuCode}}),skuInventory=await sdk.skus.retrieve(sku.id,{fields:{skus:["inventory"]}}),[level]=((_a=skuInventory.inventory)===null||_a===void 0?void 0:_a.levels)||[],[delivery]=(level==null?void 0:level.delivery_lead_times)||[];dispatch({type:"setAvailability",payload:Object.assign(Object.assign({},delivery),{quantity:skuInventory.inventory.quantity})})}catch(error){console.error("Get SKU availability",error)}};const typeAction=["setAvailability","setErrors"],availabilityReducer=(state,reducer)=>baseReducer(state,reducer,typeAction);export default availabilityReducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const billingAddressInitialState={_billing_address_clone_id:""}
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const billingAddressInitialState={_billing_address_clone_id:""},setBillingAddress=async(id,options)=>{try{if(options==null?void 0:options.order){if(options.customerAddressId){const sdk=getSdk(options.config),attributes={id,reference:options.customerAddressId};await sdk.addresses.update(attributes)}options.dispatch({type:"setBillingAddress",payload:{_billing_address_clone_id:id}})}}catch(error){console.error("Set billing address",error)}},setBillingCustomerAddressId=async({dispatch,order,setCloneAddress})=>{var _a;const customerAddressId=(_a=order==null?void 0:order.billing_address)===null||_a===void 0?void 0:_a.reference;try{customerAddressId&&(dispatch({type:"setBillingCustomerAddressId",payload:{billingCustomerAddressId:customerAddressId}}),setCloneAddress(customerAddressId,"billing_address"))}catch(error){console.error("error",error)}};const type=["setBillingAddress","setBillingCustomerAddressId","cleanup"],billingAddressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default billingAddressReducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const saveCustomerUser=async({customerEmail
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const saveCustomerUser=async({customerEmail,order,updateOrder})=>{if(order){const attributes={customer_email:customerEmail,id:order.id};await updateOrder({id:order.id,attributes})}},setCustomerErrors=(errors,dispatch)=>{dispatch&&dispatch({type:"setErrors",payload:{errors}})},setCustomerEmail=(customerEmail,dispatch)=>{dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})},getCustomerAddresses=async({config,dispatch})=>{try{const addresses=[];(await getSdk(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&addresses.push(customerAddress.address)}),dispatch({type:"setAddresses",payload:{addresses}})}catch(error){const errors=getErrors(error,"addresses");dispatch({type:"setErrors",payload:{errors}})}},getCustomerPaymentSources=async({dispatch,order})=>{(order==null?void 0:order.available_customer_payment_sources)&&dispatch({type:"setPayments",payload:{payments:order.available_customer_payment_sources}})},customerInitialState={errors:[],addresses:[],payments:[]};const type=["setErrors","setCustomerEmail","setAddresses","setPayments"],customerReducer=(state,reducer)=>baseReducer(state,reducer,type);export default customerReducer;
|