@commercelayer/react-components 4.13.1-beta.5 → 4.13.1-beta.6
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/MetadataInput.d.ts +0 -1
- package/lib/cjs/components/addresses/Address.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressInput.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressInputSelect.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +0 -1
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +0 -1
- package/lib/cjs/components/auth/CommerceLayer.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerContainer.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerInput.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +0 -1
- package/lib/cjs/components/customers/MyAccountLink.d.ts +0 -1
- package/lib/cjs/components/customers/MyIdentityLink.d.ts +0 -1
- package/lib/cjs/components/errors/Errors.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +0 -1
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItem.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemField.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemName.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +0 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +0 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +0 -1
- package/lib/cjs/components/orders/DiscountAmount.d.ts +0 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +0 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +0 -1
- package/lib/cjs/components/orders/OrderList.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListRow.d.ts +0 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +0 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +0 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +0 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +0 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +0 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelField.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelLineItem.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +0 -1
- package/lib/cjs/components/parcels/Parcels.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +0 -1
- package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/StripePayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +0 -1
- package/lib/cjs/components/prices/Price.d.ts +0 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +0 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +0 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +0 -1
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +0 -1
- package/lib/cjs/components/skus/SkuField.d.ts +0 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +0 -1
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +0 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +0 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/PriceTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +0 -1
- package/lib/cjs/typings/globals.d.ts +0 -1
- package/lib/cjs/utils/filterChildren.d.ts +0 -1
- package/lib/cjs/utils/getLoaderComponent.d.ts +0 -1
- package/lib/cjs/utils/getPrices.d.ts +0 -1
- package/lib/esm/components/MetadataInput.d.ts +0 -1
- package/lib/esm/components/addresses/Address.d.ts +0 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +0 -1
- package/lib/esm/components/addresses/AddressInput.d.ts +0 -1
- package/lib/esm/components/addresses/AddressInputSelect.d.ts +0 -1
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +0 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +0 -1
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +0 -1
- package/lib/esm/components/auth/CommerceLayer.d.ts +0 -1
- package/lib/esm/components/customers/CustomerContainer.d.ts +0 -1
- package/lib/esm/components/customers/CustomerField.d.ts +0 -1
- package/lib/esm/components/customers/CustomerInput.d.ts +0 -1
- package/lib/esm/components/customers/CustomerPaymentSource.d.ts +0 -1
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +0 -1
- package/lib/esm/components/customers/MyAccountLink.d.ts +0 -1
- package/lib/esm/components/customers/MyIdentityLink.d.ts +0 -1
- package/lib/esm/components/errors/Errors.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCard.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +0 -1
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +0 -1
- package/lib/esm/components/line_items/LineItem.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemField.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemName.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +0 -1
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +0 -1
- package/lib/esm/components/orders/CheckoutLink.d.ts +0 -1
- package/lib/esm/components/orders/DiscountAmount.d.ts +0 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +0 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +0 -1
- package/lib/esm/components/orders/OrderList.d.ts +0 -1
- package/lib/esm/components/orders/OrderListEmpty.d.ts +0 -1
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +0 -1
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +0 -1
- package/lib/esm/components/orders/OrderListRow.d.ts +0 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +0 -1
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +0 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +0 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +0 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +0 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelField.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelLineItem.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +0 -1
- package/lib/esm/components/parcels/Parcels.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelsCount.d.ts +0 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +0 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +0 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +0 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +0 -1
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSource.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +0 -1
- package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/StripePayment.d.ts +0 -1
- package/lib/esm/components/payment_source/WireTransferPayment.d.ts +0 -1
- package/lib/esm/components/prices/Price.d.ts +0 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +0 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +0 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +0 -1
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +0 -1
- package/lib/esm/components/skus/SkuField.d.ts +0 -1
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +0 -1
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +0 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +0 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +0 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +0 -1
- package/lib/esm/components/utils/PriceTemplate.d.ts +0 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +0 -1
- package/lib/esm/typings/globals.d.ts +0 -1
- package/lib/esm/utils/filterChildren.d.ts +0 -1
- package/lib/esm/utils/getLoaderComponent.d.ts +0 -1
- package/lib/esm/utils/getPrices.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type ConditionalElement } from '../../typings/index';
|
|
3
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
4
3
|
type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type PropsType } from '../../utils/PropsType';
|
|
3
2
|
import { type baseOrderPricePropTypes } from '../../typings/index';
|
|
4
3
|
export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes, unknown> & Omit<JSX.IntrinsicElements['span'], 'children'>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export type DefaultChildrenType = JSX.Element[] | JSX.Element | null;
|
|
3
2
|
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
|
|
4
3
|
export type TRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type BaseInputComponentProps } from '../typings/index';
|
|
3
2
|
type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
4
3
|
export declare function MetadataInput(props: Props): JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type BaseSelectComponentProps } from '../../typings/index';
|
|
3
2
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
3
|
type SelectFieldName = `billing_address_${`metadata_${string}`}` | `shipping_address_${`metadata_${string}`}`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type ConditionalElement } from '../../typings/index';
|
|
3
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
4
3
|
type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { CodeErrorType } from '../../typings/errors';
|
|
3
2
|
import { type ChildrenFunction } from '../../typings/index';
|
|
4
3
|
export type TResourceError = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant' | 'in_stock_subscriptions';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type ConditionalElement } from '../../typings/index';
|
|
3
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
4
3
|
type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type TOrderList, type InitialOrderListContext, type OrderListContent } from '../../context/OrderListChildrenContext';
|
|
3
2
|
import { type ColumnDef, type SortingState } from '@tanstack/react-table';
|
|
4
3
|
import type { DefaultChildrenType, TRange } from '../../typings/globals';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
|
|
3
2
|
import { type ChildrenFunction } from '../../typings/index';
|
|
4
3
|
interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type ConditionalElement } from '../../typings/index';
|
|
3
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
4
3
|
type ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../payment_source/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 getCardDetails from"../../utils/getCardDetails";import isEmpty from"lodash/isEmpty";import{useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export function StripeGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=useContext(OrderContext),{payment,expressPayments}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="stripe_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const publishableKey=paymentSource?.publishable_key,clientSecret=paymentSource?.client_secret,stripeConfig=config?getPaymentConfig(paymentResource,config).stripePayment:{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(readonly||showCard){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return
|
|
2
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../payment_source/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 getCardDetails from"../../utils/getCardDetails";import isEmpty from"lodash/isEmpty";import{useContext,useEffect}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export function StripeGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order,getOrder}=useContext(OrderContext),{payment,expressPayments}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="stripe_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const publishableKey=paymentSource?.publishable_key,clientSecret=paymentSource?.client_secret,stripeConfig=config?getPaymentConfig(paymentResource,config).stripePayment:{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(useEffect(()=>{const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource});order?.status==="placed"&&order?.payment_status==="unpaid"&&card.brand==null&&getOrder(order?.id)},[order?.status]),readonly||showCard){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),showLoader=order?.status==="placed"&&order?.payment_status==="unpaid"&&card?.brand==null,value={...card,showCard,handleEditClick,readonly};return showLoader?loaderComponent:card?.brand==null?null:_jsx(PaymentSourceContext.Provider,{value,children})}return!isGuest&&templateCustomerCards?_jsxs(_Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",{className:p.className,children:_jsx(PaymentCardsTemplate,{paymentResource,customerPayments,children:templateCustomerCards})}),_jsx(StripePayment,{show,templateCustomerSaveToWallet,publishableKey,clientSecret,expressPayments,locale,...stripeConfig})]}):_jsx(StripePayment,{show,publishableKey,clientSecret,locale,expressPayments,...stripeConfig})}export default StripeGateway;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
2
|
import { type PaymentSourceProps } from './PaymentSource';
|
|
4
3
|
type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type StripeElementLocale, type StripeElementsOptions, type StripePaymentElementOptions } from '@stripe/stripe-js';
|
|
3
2
|
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
4
3
|
import { type PaymentSourceProps } from './PaymentSource';
|