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A,CAAoB,CAACC,EAkBtDiD,CAAAA,EAAAC,CAAA,CARoB,WAC+B,IAAAvW,EAIjD,MAAO,CAAEoQ,aAJwBoG,CAAKC,EAAAA,EAAAA,EAAAA,GAAWzW,EAAA4C,CAAAA,EAAAA,EAAAA,CAAAA,EAAAC,IAAAA,IAAA,CAAC,SAAAe,EAAO0N,CAAyB,SAAAzO,IAAAA,IAAA,UAAAkB,CAAA,gBAAAA,EAAAd,IAAA,CAAAc,EAAAb,IAAA,gBAAAa,EAAAb,IAAA,GAC1EmT,EAAqBjG,YAAY,CAACkB,EAAK,yBAAAvN,EAAAS,IAAA,KAAAZ,EAAA,IAC9C,SAAAa,CAAA,SAAAzE,EAAA0E,KAAA,MAAAC,UAAA,IAFO+R,WAAW,CAKrB,qBCvBAC,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/../../packages/services/src/DigitalWalletsBase/types.ts","webpack://_N_E/./src/__components/ApplePayButton/index.tsx","webpack://_N_E/../../packages/core/src/payment/PayPalPayment/PayPalPaymentInteractor.ts","webpack://_N_E/./src/__components/PayPalButton/index.tsx","webpack://_N_E/../../packages/core/src/orderSetUp/OrderSetUpApiService.ts","webpack://_N_E/../../packages/core/src/orderSetUp/OrderSetUpInteractor.ts","webpack://_N_E/../../packages/core/src/payment/PayPalPayment/PayPalPaymentApiService.ts","webpack://_N_E/../../packages/core/src/appConfig/types.ts","webpack://_N_E/../../packages/core/src/appConfig/AppConfigApiService.ts","webpack://_N_E/../../packages/core/src/appConfig/AppConfigInteractor.ts","webpack://_N_E/../../packages/hooks/src/useAppConfig/types.ts","webpack://_N_E/../../packages/hooks/src/useAppConfig/index.ts","webpack://_N_E/../../packages/core/src/needleAnalytics/NeedleAnalyticsApiService.ts","webpack://_N_E/../../packages/core/src/needleAnalytics/NeedleAnalyticsInteractor.ts","webpack://_N_E/../../packages/hooks/src/useCheckoutNeedle/index.ts","webpack://_N_E/../../packages/hooks/src/useDonation/index.ts","webpack://_N_E/./src/__components/ApplePayButton/ApplePayButton.module.css"],"sourcesContent":["import { CheckoutOrderSummary } from '@package/core/src/checkout/types';\n\nexport type SelectedShippingOption = {\n  subOrderId: number;\n  methodId: number;\n  amount: number;\n  name: string;\n};\n\nexport type AuthorizeTransactionRequest = {\n  authorizationToken: {\n    token: string;\n    descriptor: DigitalWalletType;\n  };\n  customerContactInfo: {\n    email: string;\n    phone: string;\n  };\n  billingAddress: {\n    firstName: string;\n    lastName: string;\n    address1: string;\n    country: string;\n    state: string;\n    city: string;\n    zipcode: string;\n  };\n  shippingAddress?: {\n    firstName: string;\n    lastName: string;\n    address1: string;\n    country: string;\n    state: string;\n    city: string;\n    zipcode: string;\n  };\n  shipments?: Pick<SelectedShippingOption, 'subOrderId' | 'methodId'>[];\n};\n\nexport enum DigitalWalletType {\n  APPLE = 'COMMON.APPLE.INAPP.PAYMENT',\n  GOOGLE = 'COMMON.GOOGLE.INAPP.PAYMENT',\n}\n\nexport type DigitalWalletShippingMethod = {\n  methodId: number;\n  label: string;\n  deliveryDate: string | null;\n  amount: number;\n};\n\nexport type DigitalWalletSuborderShippings = {\n  subOrderId: number;\n  shippingOptions: DigitalWalletShippingMethod[];\n};\n\nexport type DigitalWalletsShippingMethods = {\n  shipments: DigitalWalletSuborderShippings[];\n  orderSummary: CheckoutOrderSummary;\n};\n","import { FC, useEffect, useRef, useState } from 'react';\nimport styles from './ApplePayButton.module.css';\nimport { ApplePayButtonProps } from './types';\nimport clsx from 'clsx';\n\nimport { ApiError } from '@package/services/src/ApiClient';\nimport {\n  AuthorizeTransactionRequest,\n  DigitalWalletShippingMethod,\n  DigitalWalletSuborderShippings,\n  DigitalWalletType,\n  SelectedShippingOption,\n} from '@package/services/src/DigitalWalletsBase/types';\nimport { applePayService } from '../../services';\nimport { FormErrorCode, isASCII } from '@package/utils/src/formValidation';\nimport { ErrorCodeType } from '@package/utils/src/types/errorCode';\nimport config from 'config-base';\n\ndeclare global {\n  interface Window {\n    ApplePaySession: typeof ApplePaySession;\n  }\n}\n\n/**\n * apple pay `country` is free text from the wallet (e.g. \"united states\"),\n * so we send the ISO 3166 `countryCode`; backend resolves 2-letter codes to our country name.\n * Fallback to `country` when apple pay doesn't return a code.\n */\nconst getApplePayContactCountry = (contact?: ApplePayJS.ApplePayPaymentContact) =>\n  contact?.countryCode || contact?.country || '';\n\nconst ApplePayButton: FC<ApplePayButtonProps> = ({ className, id, summary, paymentSessionProps }) => {\n  const {\n    disabled = false,\n    paymentRequest,\n    lineItems = [],\n    shippingAddress,\n    totalLabel = '',\n    page,\n    onAuthorizePaymentRequest,\n    onCompleteMerchantValidation,\n    onCompletePayment,\n    onPaymentError,\n    onGetCombinedShippingOptions,\n  } = paymentSessionProps;\n  const [canMakePayments, setCanMakePayments] = useState(false);\n  const [summaryState, setSummaryState] = useState(summary);\n  const applePayState = useRef<{\n    summary: number;\n    canMakePayments: boolean;\n    shippingOptions: DigitalWalletSuborderShippings[];\n    selectedShippingOptions: SelectedShippingOption[];\n    paymentInfo: {\n      lineItems: ApplePayJS.ApplePayLineItem[];\n      total: ApplePayJS.ApplePayLineItem;\n    };\n  }>({\n    summary,\n    canMakePayments: false,\n    shippingOptions: [],\n    selectedShippingOptions: [],\n    paymentInfo: {\n      lineItems,\n      total: {\n        label: '',\n        type: 'final',\n        amount: `${summary}`,\n      },\n    },\n  });\n  const [activeSession, setActiveSession] = useState<ApplePaySession | null>(null);\n\n  const resetApplePayState = () => {\n    applePayState.current = {\n      summary,\n      canMakePayments: true,\n      shippingOptions: [],\n      selectedShippingOptions: [],\n      paymentInfo: {\n        lineItems,\n        total: {\n          ...applePayState.current.paymentInfo.total,\n          type: 'final',\n          amount: `${summary}`,\n        },\n      },\n    };\n  };\n\n  const onClickApplePayButton = async () => {\n    if (!applePayState.current.canMakePayments) {\n      console.error('Apple Pay is currently unavailable. Please try again or use another payment method.');\n      // onPaymentError('Apple Pay is currently unavailable. Please try again or use another payment method.');\n      // return;\n    }\n\n    if (activeSession) {\n      console.error('An Apple Pay session is already in progress');\n      return;\n    }\n\n    try {\n      const initialPaymentRequest = {\n        countryCode: 'US',\n        currencyCode: 'USD',\n        supportedNetworks: ['visa', 'masterCard', 'amex', 'discover'],\n        merchantCapabilities: ['supports3DS'],\n        ...applePayState.current.paymentInfo,\n        ...paymentRequest,\n      } as ApplePayJS.ApplePayPaymentRequest;\n\n      const session = new ApplePaySession(3, initialPaymentRequest);\n      setActiveSession(session);\n\n      /**\n       * After creating session we need to validate merchant\n       * this is the first callback in the apple pay flow\n       */\n      session.onvalidatemerchant = async (event) => {\n        try {\n          const merchantSession = await onCompleteMerchantValidation(event.validationURL);\n          //update apple pay modal window\n          session.completeMerchantValidation(merchantSession);\n        } catch (err) {\n          console.error('Merchant validation failed:', err);\n          //close apple pay window\n          session.abort();\n          resetApplePayState();\n          onPaymentError(\n            new ApiError(\n              new Response('Apple Pay is currently unavailable. Please use another payment method.', {\n                status: 400,\n              }),\n              '400',\n              'Apple Pay is currently unavailable. Please use another payment method.',\n            ),\n          );\n        }\n      };\n      /**\n       * This is the second callback in the apple pay flow\n       * this callback is called when a user changes shipping address\n       * and when we pass requiredShippingContactFields to initialPaymentRequest\n       */\n      session.onshippingcontactselected = async ({ shippingContact }) => {\n        try {\n          let errors: ApplePayError[] = [];\n          // Validate shipping contact fields\n          if (shippingContact.givenName && !isASCII(shippingContact.givenName)) {\n            errors.push(new ApplePayError('shippingContactInvalid', 'name', FormErrorCode.EnglishAlphabet));\n          }\n          if (shippingContact.familyName && !isASCII(shippingContact.familyName)) {\n            errors.push(new ApplePayError('shippingContactInvalid', 'name', FormErrorCode.EnglishAlphabet));\n          }\n          if (shippingContact.addressLines?.some((line) => !isASCII(line))) {\n            errors.push(new ApplePayError('shippingContactInvalid', 'addressLines', FormErrorCode.EnglishAlphabet));\n          }\n          if (shippingContact.locality && !isASCII(shippingContact.locality)) {\n            errors.push(new ApplePayError('shippingContactInvalid', 'locality', FormErrorCode.EnglishAlphabet));\n          }\n          if (shippingContact.country && !isASCII(shippingContact.country)) {\n            errors.push(new ApplePayError('shippingContactInvalid', 'country', FormErrorCode.EnglishAlphabet));\n          }\n          if (errors.length > 0) {\n            //don't proceed with call to backend etc if we don't have a valid shipping address\n            // update apple pay ui with validation erros\n            session.completeShippingContactSelection({\n              errors,\n              newTotal: { ...applePayState.current.paymentInfo.total },\n              newLineItems: [...applePayState.current.paymentInfo.lineItems],\n            });\n            return;\n          }\n          let newTotal = {\n            ...applePayState.current.paymentInfo.total,\n          };\n          let newShippingMethods = [] as ApplePayJS.ApplePayShippingMethod[];\n          /**\n           * based on shipping address we get and set shipping options here\n           * at this step we have a restricted user's info because apple pay shows full info after\n           * user's auth by touch/face id (session.onpaymentauthorized)\n           */\n          if (onGetCombinedShippingOptions) {\n            try {\n              const combinedShippingOptions = await onGetCombinedShippingOptions(\n                //our backend supports USA, apple pay returns US\n                shippingContact.countryCode === 'US' ? 'USA' : (shippingContact.countryCode as string),\n                shippingContact.administrativeArea as string,\n                shippingContact.locality as string,\n                shippingContact.postalCode as string,\n              );\n\n              // update orderDetails based on new orderSummary (new taxes and shippings)\n              const updatedLineItems = applePayService.getLineItems(combinedShippingOptions.orderSummary, page);\n\n              //shipping options that will be displayed in the apple pay window\n              newShippingMethods = combinedShippingOptions.applePayShippingMethods;\n\n              /**\n               * add current selected shipping options amount to order total from backend\n               * because after setting shipping options onshippingmethodselected will be fired\n               * and in this method we calculate total on removing old shipping options and price\n               * and selecting new\n               */\n              let orderSummaryTotal = combinedShippingOptions.orderSummary.total;\n              applePayState.current.selectedShippingOptions.forEach((selectedOption) => {\n                orderSummaryTotal = Number(orderSummaryTotal) + Number(selectedOption.amount);\n              });\n              newTotal = {\n                ...newTotal,\n                amount: `${orderSummaryTotal}`,\n              };\n\n              applePayState.current = {\n                ...applePayState.current,\n                shippingOptions: [...combinedShippingOptions.shipments],\n                paymentInfo: {\n                  ...applePayState.current.paymentInfo,\n                  lineItems: [...updatedLineItems],\n                  total: { ...(newTotal as ApplePayJS.ApplePayLineItem) },\n                },\n                summary: Number(newTotal.amount),\n              };\n            } catch (error: any) {\n              console.error('error getting combined shipping options', error);\n              if (error instanceof ApiError && error.status === 400) {\n                if (error.code === ErrorCodeType.GroundOnlyProduct) {\n                  session.abort();\n                  error.message =\n                    'We are unable to ship your order to you; shipping regulations do not allow us to send the following product(s) via air service ';\n                }\n                onPaymentError(error);\n              }\n            }\n          }\n          session.completeShippingContactSelection({\n            newShippingMethods,\n            newTotal: { ...applePayState.current.paymentInfo.total },\n            newLineItems: [...applePayState.current.paymentInfo.lineItems],\n          });\n        } catch (error) {\n          console.error(\"can't change apple pay address\", error);\n          session.abort();\n        }\n      };\n\n      /**\n       * This is the third callback in the apple pay flow\n       * this callback is called when a user changes shipping method (shipping methods must be set)\n       * or when we set shippingOptions (newShippingMethods in complete callbacks)\n       */\n      session.onshippingmethodselected = async ({ shippingMethod }) => {\n        try {\n          let newShippingMethodTotal: ApplePayJS.ApplePayLineItem = {\n            ...applePayState.current.paymentInfo.total,\n            amount: `${applePayState.current.summary}`,\n          };\n          // Clear previous shipping costs from total\n          applePayState.current.selectedShippingOptions.forEach((selectedOption) => {\n            newShippingMethodTotal.amount = String(\n              Math.round((Number(newShippingMethodTotal.amount) - selectedOption.amount) * 100) / 100,\n            );\n          });\n          let totalShippingAmount = 0;\n          /**\n           * Handle both single and combined identifiers\n           * combined identifiers are like this: subOrderId-methodId_subOrderId-methodId\n           * single identifier is like this: subOrderId-methodId\n           */\n          const selectedShippingIds = shippingMethod.identifier.split('_').map((id) => {\n            const [subOrderId, methodId] = id.split('-').map(Number);\n            return { subOrderId, methodId };\n          });\n\n          const selectedShippingOption: SelectedShippingOption[] = [];\n          // Apply shipping methods to corresponding suborders\n          selectedShippingIds.forEach(({ subOrderId, methodId }) => {\n            const option = applePayState.current.shippingOptions.find(\n              (opt: DigitalWalletSuborderShippings) => opt.subOrderId === subOrderId,\n            );\n\n            if (option) {\n              const newShipping = option.shippingOptions.find(\n                (shippingOption: DigitalWalletShippingMethod) => shippingOption.methodId === methodId,\n              );\n\n              if (newShipping) {\n                selectedShippingOption.push({\n                  subOrderId,\n                  methodId,\n                  amount: newShipping.amount,\n                  name: newShipping.label,\n                });\n                totalShippingAmount = Math.round((totalShippingAmount + newShipping.amount) * 100) / 100;\n\n                newShippingMethodTotal.amount = String(\n                  Math.round((Number(newShippingMethodTotal.amount) + newShipping.amount) * 100) / 100,\n                );\n              }\n            }\n          });\n          const updatedLineItems = [...applePayState.current.paymentInfo.lineItems];\n\n          //add Shipping line item to order details based on new selected shipping option\n          const shippingLineItemIndex = updatedLineItems.findIndex((item) => item.label === 'Shipping');\n          if (shippingLineItemIndex !== -1) {\n            // Update existing shipping line item\n            updatedLineItems[shippingLineItemIndex] = {\n              label: 'Shipping',\n              amount: String(totalShippingAmount),\n            };\n          } else {\n            // Add new shipping line item\n            updatedLineItems.push({\n              label: 'Shipping',\n              amount: String(totalShippingAmount),\n            });\n          }\n          // Update the total label the new shipping costs\n          newShippingMethodTotal.label = `${config.brandCode === '2' ? 'Airgun Depot' : 'Pyramyd Air'} $${\n            newShippingMethodTotal.amount\n          }`;\n          applePayState.current = {\n            ...applePayState.current,\n            paymentInfo: {\n              ...applePayState.current.paymentInfo,\n              lineItems: [...updatedLineItems],\n              total: { ...newShippingMethodTotal },\n            },\n            selectedShippingOptions: [...selectedShippingOption],\n            summary: Number(newShippingMethodTotal.amount), // Update summary based on new total\n          };\n          //update apple pay modal window with new total with selected options and shipping options to select\n          session.completeShippingMethodSelection({\n            newTotal: { ...applePayState.current.paymentInfo.total },\n            newLineItems: [...applePayState.current.paymentInfo.lineItems],\n          });\n        } catch (error) {\n          console.error(\"Can't change shipping method\", error);\n        }\n      };\n\n      /**\n       * this callback is called when a user authorizes payment by a touch/face id\n       * at this step we receive all user's data and can send it to the backend\n       */\n      session.onpaymentauthorized = async ({ payment }) => {\n        //apple pay errors on apple pay modal window\n        const errors: ApplePayError[] = [];\n        try {\n          //payment token and billing data must be encoded to base64\n          const base64DataPaymentToken = btoa(JSON.stringify(payment.token.paymentData));\n          // Use shipping address from props if available, otherwise from payment event data\n          const shippingContactToUse = shippingAddress || payment.shippingContact;\n\n          const authorizePaymentRequest: AuthorizeTransactionRequest = {\n            authorizationToken: {\n              token: base64DataPaymentToken,\n              descriptor: DigitalWalletType.APPLE,\n            },\n            customerContactInfo: {\n              /**\n               * when we need to take data not from cart summary but from apple pay sdk\n               * we take from apple pay\n               * example: payment step for not deliverable items\n               */\n              email: shippingAddress?.emailAddress || payment.shippingContact?.emailAddress || '',\n              phone: shippingAddress?.phoneNumber || payment.shippingContact?.phoneNumber || '',\n            },\n            billingAddress: {\n              firstName: payment.billingContact?.givenName || '',\n              lastName: payment.billingContact?.familyName || '',\n              address1: payment.billingContact?.addressLines?.join(',') || '',\n              country: getApplePayContactCountry(payment.billingContact),\n              state: payment.billingContact?.administrativeArea || '',\n              city: payment.billingContact?.locality || '',\n              zipcode: String(payment.billingContact?.postalCode) || '',\n            },\n            shippingAddress: {\n              firstName: shippingContactToUse?.givenName || '',\n              lastName: shippingContactToUse?.familyName || '',\n              address1: shippingContactToUse?.addressLines?.join(',') || '',\n              // props address comes from the cart and already holds our country name (e.g. USA), send it as is\n              country: shippingAddress?.country || getApplePayContactCountry(payment.shippingContact),\n              state: shippingContactToUse?.administrativeArea || '',\n              city: shippingContactToUse?.locality || '',\n              zipcode: String(shippingContactToUse?.postalCode) || '',\n            },\n          };\n          if (payment.billingContact) {\n            if (payment.billingContact.givenName && !isASCII(payment.billingContact.givenName)) {\n              errors.push(new ApplePayError('billingContactInvalid', 'name', FormErrorCode.EnglishAlphabet));\n            }\n            if (payment.billingContact.familyName && !isASCII(payment.billingContact.familyName)) {\n              errors.push(new ApplePayError('billingContactInvalid', 'name', FormErrorCode.EnglishAlphabet));\n            }\n            if (payment.billingContact.addressLines?.some((line) => !isASCII(line))) {\n              errors.push(new ApplePayError('billingContactInvalid', 'addressLines', FormErrorCode.EnglishAlphabet));\n            }\n            if (payment.billingContact.locality && !isASCII(payment.billingContact.locality)) {\n              errors.push(new ApplePayError('billingContactInvalid', 'locality', FormErrorCode.EnglishAlphabet));\n            }\n            if (payment.billingContact.country && !isASCII(payment.billingContact.country)) {\n              errors.push(new ApplePayError('billingContactInvalid', 'country', FormErrorCode.EnglishAlphabet));\n            }\n            if (errors.length > 0) {\n              session.completePayment({ status: ApplePaySession.STATUS_FAILURE, errors });\n              return;\n            }\n          }\n\n          if (applePayState.current.selectedShippingOptions.length > 0) {\n            authorizePaymentRequest.shipments = applePayState.current.selectedShippingOptions.map(\n              ({ subOrderId, methodId }) => ({\n                subOrderId,\n                methodId,\n              }),\n            );\n          }\n          //send data to authorize.net\n          await onAuthorizePaymentRequest(authorizePaymentRequest);\n          //after success payment we have to run useReview endpoint and redirect to the order-set-up page\n          await onCompletePayment({\n            firstName: payment.shippingContact?.givenName || '',\n            lastName: payment.shippingContact?.familyName || '',\n            email: payment.shippingContact?.emailAddress || '',\n          });\n          //update apple pay modal window\n          session.completePayment({\n            status: ApplePaySession.STATUS_SUCCESS,\n          });\n        } catch (error) {\n          console.error(\"can't complete payment\", error);\n          if (error instanceof ApiError && error.status === 400) {\n            //close apple pay window and throw error if our api returns bad request\n            onPaymentError(error as any);\n            session.abort();\n          }\n          throw error;\n        }\n      };\n\n      /**\n       * this callback is called when a user cancels payment (close manualy modal window)\n       * at this step we have to reset apple pay state\n       */\n      session.oncancel = () => {\n        resetApplePayState();\n      };\n\n      //open apple pay modal window\n      session.begin();\n    } catch (err) {\n      if (err instanceof Error && err.message.startsWith('Page already has')) {\n        return;\n      }\n      console.error('Error creating Apple Pay session:', err);\n      onPaymentError(err as any);\n    }\n  };\n\n  const initApplePayButton = () => {\n    try {\n      const applePayButton = document.getElementById(id);\n      if (applePayButton) {\n        applePayButton.addEventListener('click', onClickApplePayButton);\n      }\n    } catch (err) {\n      console.error('Error initializing Apple Pay button:', err);\n    }\n  };\n\n  const getApplePaySession = () => {\n    try {\n      if (window?.ApplePaySession?.canMakePayments()) {\n        /**\n         * ref for closure\n         * state for rerendering\n         */\n        applePayState.current = { ...applePayState.current, canMakePayments: true };\n        setCanMakePayments(true);\n      }\n    } catch (error) {\n      //console.log('Error checking Apple Pay availability:', error);\n    }\n  };\n\n  useEffect(() => {\n    getApplePaySession();\n  });\n\n  useEffect(() => {\n    initApplePayButton();\n    return () => {\n      const applePayButton = document.getElementById(id);\n      if (applePayButton) {\n        applePayButton.removeEventListener('click', onClickApplePayButton);\n      }\n    };\n  }, []);\n\n  useEffect(() => {\n    /**\n     * we have to use ref because of pure javascript callback in the apple pay button\n     * the apple pay button has a closure and since ref is an object it will be updated (because of reference value)\n     * state always return new value and won't updated in closure so we can't pass it to pure js callback\n     * but we need state to rerender the component and update value in the closure (ref)\n     */\n    applePayState.current = {\n      ...applePayState.current,\n      /**\n       * update line items (order details) when they are changed from props\n         ex: shipping options and payment pages\n         at this step we don't trigger onshippingcontactselected\n       */\n      paymentInfo: {\n        ...applePayState.current.paymentInfo,\n        total: {\n          ...applePayState.current.paymentInfo.total,\n          amount: `${summary}`,\n          label: totalLabel,\n        },\n        lineItems: [...lineItems],\n      },\n      summary,\n    };\n    setSummaryState(summary);\n  }, [summary, totalLabel, lineItems]);\n\n  return (\n    <div\n      data-testid={'apple-pay-btn-container'}\n      className={clsx(styles.applePayContainer, className, {\n        [styles.applePayContainerAGD]: config.brandCode === '2',\n        [styles.disabled]: disabled,\n      })}\n    >\n      <div\n        dangerouslySetInnerHTML={{\n          __html: `<apple-pay-button id=\"${id}\" buttonstyle=\"black\" type=\"plain\" locale=\"en-US\"></apple-pay-button>`,\n        }}\n      />\n    </div>\n  );\n};\n\nexport default ApplePayButton;\n","import Result, { EmptyResult } from '@package/services/src/Result';\n\nimport { PayPalPaymentService } from './services';\nimport { PayPalAuthorizeRequest, PayPalCheckoutRequest, PayPalCheckoutResponse } from './types';\n\nexport default class PayPalPaymentInteractor {\n  public constructor(private readonly paypalPaymentService: PayPalPaymentService) {}\n\n  public paypalCheckout(\n    request: PayPalCheckoutRequest = { skipShippingVerification: false },\n  ): Promise<Result<PayPalCheckoutResponse>> {\n\n    return this.paypalPaymentService.paypalCheckout(request);\n  }\n\n  public paypalAuthorize(request: PayPalAuthorizeRequest): Promise<EmptyResult> {\n    return this.paypalPaymentService.paypalAuthorize(request);\n  }\n}\n","import PayPalPaymentApiService from '@package/core/src/payment/PayPalPayment/PayPalPaymentApiService';\nimport PayPalPaymentInteractor from '@package/core/src/payment/PayPalPayment/PayPalPaymentInteractor';\nimport { CHEKOUT_SUMMARY_DATA_QUERY_KEY } from '@package/hooks/src/useCheckoutSummary/types';\nimport { useQueryClient } from '@package/hooks/src/useCustomQuery';\nimport useDonation from '@package/hooks/src/useDonation';\nimport useAppConfig from '@package/hooks/src/useAppConfig';\nimport { ApiError } from '@package/services/src/ApiClient';\nimport { PayPalButtons, FUNDING } from '@paypal/react-paypal-js';\nimport { useRouter } from 'next/router';\nimport config from 'config-base';\nimport { apiClient, storageManager } from '../../services';\n\nimport { PayPalButtonProps } from './types';\n\nconst paypalService = new PayPalPaymentApiService(apiClient);\nconst paypalInteractor = new PayPalPaymentInteractor(paypalService);\n\nexport default function PayPalButton(props: PayPalButtonProps) {\n  const {\n    page,\n    notDeliverable,\n    onCallback,\n    onError,\n    handlePaypalApprove,\n    fundingSource = FUNDING.PAYPAL,\n    hide = false,\n    skipShippingVerification = false,\n    label = 'pay',\n    height = 50,\n  } = props;\n  const queryClient = useQueryClient();\n  const router = useRouter();\n  const { makeDonation } = useDonation();\n  const { ccAuthorizeEnabled } = useAppConfig();\n\n  if (hide) return null;\n\n  return (\n    <div data-testid={'paypal-btn'} style={{ height }}>\n      <PayPalButtons\n        fundingSource={fundingSource}\n        style={\n          {\n            label,\n            shape: 'rect',\n            color: 'gold',\n            layout: 'vertical',\n            height,\n            borderRadius: config.brandCode === '0' ? 1 : 3,\n          } as any\n        }\n        forceReRender={[notDeliverable, skipShippingVerification, page, label]}\n        createOrder={async (_, actions) => {\n          const { data: checkoutObj } = await paypalInteractor.paypalCheckout({\n            skipShippingVerification,\n          });\n          return actions.order.create(checkoutObj);\n        }}\n        onApprove={async (data) => {\n          try {\n            await paypalInteractor.paypalAuthorize({\n              orderId: data.orderID,\n              page,\n              skipShippingVerification,\n            });\n\n            // PayPal authorizes the donation-excluded total and never itemizes a donation in its sheet, so\n            // the placed order must not carry one. Clear here — the shared approve callback every PayPal\n            // payment flows through — after authorize and before the redirect to placement. Clearing a\n            // nonexistent donation (e.g. cart popup / login, pre-checkout) is a backend no-op. Best-effort:\n            // a failed clear must not block the sale. Skipped with the switch off: no donation can exist.\n            if (ccAuthorizeEnabled) {\n              try {\n                await makeDonation({ donation: null });\n              } catch (donationError) {\n                console.error('donation clear failed', donationError);\n              }\n            }\n\n            await queryClient.invalidateQueries([CHEKOUT_SUMMARY_DATA_QUERY_KEY]);\n\n            if (handlePaypalApprove) handlePaypalApprove();\n            if (onCallback) return await onCallback();\n\n            await storageManager.put('disablePaymentStep', 'true');\n            if (notDeliverable) {\n              void router.push(config.reviewPath);\n            } else if (label === 'checkout' || label === 'paypal') {\n              void router.push(config.shippingAddressPath);\n            } else {\n              /* we're handling a corner case here, when a user changes\n                shipping address on review step he should be redirected to\n                shipping address page, but this callback fires faster than we get\n                data from the backend, so we need to handle payment paypal redirection\n                in PaymentStep component.\n              */\n              if (router.pathname !== config.paymentsPath) {\n                void router.push(config.reviewPath);\n              }\n            }\n          } catch (error) {\n            if (error instanceof Error) {\n              throw new Error(error.message);\n            }\n          }\n        }}\n        onError={(error) => {\n          if (onError) onError(error as unknown as ApiError);\n        }}\n      />\n    </div>\n  );\n}\n","import ApiClient from '@package/services/src/ApiClient';\nimport Result, { EmptyResult } from '@package/services/src/Result';\n\nimport { OrderSetUpService } from './services';\nimport { LastPageContent, MakeDonationRequest, OrderSetUp, OrderSetUpRequest } from './types';\n\nexport default class OrderSetUpApiService implements OrderSetUpService {\n  public constructor(private apiClient: ApiClient) {}\n\n  public async getSubordersKeys(request?: OrderSetUpRequest): Promise<Result<OrderSetUp | null>> {\n    try {\n      const res = await this.apiClient.get('/shoppingCart/ordersDetail', {\n        credentials: request?.cookie ? 'include' : undefined,\n        headers: {\n          ...request?.headers,\n          ...(request?.cookie ? { Cookie: request.cookie } : {}),\n        },\n      });\n      const json = await res.json();\n\n      return new Result(json);\n    } catch (error) {\n      console.error('Can`t get suborders key', error);\n      return new Result(null);\n    }\n  }\n\n  public async makeDonation(request: MakeDonationRequest): Promise<EmptyResult | undefined> {\n    try {\n      // Backend treats <= 0 as a no-op, not a clear — only null deletes an existing donation.\n      const donation = request.donation != null && request.donation > 0 ? request.donation : null;\n      await this.apiClient.post('/shoppingCart/donations', {\n        body: { donation },\n      });\n\n      return new EmptyResult();\n    } catch (error) {\n      // Rethrow rather than returning EmptyResult: a swallowed failure is indistinguishable from a\n      // saved donation, which made every caller's catch dead code and let the order-set-up page\n      // redirect to /donation-confirmation for a donation that was never persisted. Callers decide\n      // what a failure means — all of them already wrap this call.\n      console.error('Can`t make a donation', error);\n      throw error;\n    }\n  }\n\n  public async getLastPageContent(request?: OrderSetUpRequest): Promise<Result<LastPageContent | null>> {\n    try {\n      const res = await this.apiClient.get('/shoppingCart/lastPageContent', {\n        credentials: request?.cookie ? 'include' : undefined,\n        headers: {\n          ...request?.headers,\n          ...(request?.cookie ? { Cookie: request.cookie } : {}),\n        },\n      });\n      const json = await res.json();\n\n      return new Result(json);\n    } catch (error) {\n      console.error('Can`t get last page content', error);\n      return new Result(null);\n    }\n  }\n}\n","import Result, { EmptyResult } from '@package/services/src/Result';\n\nimport { OrderSetUpService } from './services';\nimport { LastPageContent, MakeDonationRequest, OrderSetUp, OrderSetUpRequest } from './types';\n\nexport default class OrderSetUpInteractor {\n  public constructor(private orderSetUpService: OrderSetUpService) {}\n\n  public getSubordersKeys(request?: OrderSetUpRequest): Promise<Result<OrderSetUp | null>> {\n    return this.orderSetUpService.getSubordersKeys(request);\n  }\n\n  public makeDonation(request: MakeDonationRequest): Promise<EmptyResult | undefined> {\n    return this.orderSetUpService.makeDonation(request);\n  }\n\n  public getLastPageContent(request?: OrderSetUpRequest): Promise<Result<LastPageContent | null>> {\n    return this.orderSetUpService.getLastPageContent(request);\n  }\n}\n","import ApiClient from '@package/services/src/ApiClient';\nimport Result, { EmptyResult } from '@package/services/src/Result';\n\nimport { PayPalPaymentService } from './services';\nimport { PayPalAuthorizeRequest, PayPalCheckoutRequest, PayPalCheckoutResponse } from './types';\n\nexport default class PayPalPaymentApiService implements PayPalPaymentService {\n  constructor(private readonly apiClient: ApiClient) {}\n\n  public async paypalCheckout(\n    request: PayPalCheckoutRequest = { skipShippingVerification: false },\n  ): Promise<Result<PayPalCheckoutResponse>> {\n    /**\n     * login-true\n     * shipping-options/payment=false\n     */\n    const url = `/shoppingCart/paymentMethod/payPal/checkout?skipShippingVerification=${request.skipShippingVerification}`;\n\n    const res = await this.apiClient.put(url);\n    const json = await res.json();\n\n\n    return new Result(json);\n  }\n\n  public async paypalAuthorize(request: PayPalAuthorizeRequest): Promise<EmptyResult> {\n    /**\n     * login-true\n     * shipping-options/payment=false\n     */\n    const url = `/shoppingCart/paymentMethod/payPal/authorize?orderId=${encodeURIComponent(\n      request.orderId,\n    )}&skipShippingVerification=${request.skipShippingVerification}`;\n\n    const { skipShippingVerification, ...body } = request;\n\n    await this.apiClient.put(url, {\n      body,\n    });\n\n\n    return new EmptyResult();\n  }\n}\n","/** Captcha the backend wants on the payment screen; `null` means no captcha at all. */\nexport type CaptchaOption = 'recaptcha' | 'turnstile';\n\nexport type AppConfig = {\n  /**\n   * Backend authorizes the full order amount on the credit card. The donation is charged through\n   * that authorization, so it is also the switch for the donation UI across checkout.\n   */\n  ccAuthorizeEnabled: boolean;\n  /**\n   * Which captcha guards the credit card call, from SystemCode `cc_payment_captcha_option`. Payment\n   * screen only — no other page carries a captcha.\n   */\n  paymentCaptchaOption: CaptchaOption | null;\n};\n\n/** Every switch off — the fallback whenever the config endpoint cannot be read. */\nexport const DEFAULT_APP_CONFIG: AppConfig = {\n  ccAuthorizeEnabled: false,\n  paymentCaptchaOption: null,\n};\n\nconst CAPTCHA_OPTIONS: Array<CaptchaOption> = ['recaptcha', 'turnstile'];\n\n/** Anything the backend sends that is not a captcha we can render reads as no captcha. */\nexport const parseCaptchaOption = (value: unknown): CaptchaOption | null =>\n  CAPTCHA_OPTIONS.find((option) => option === value) ?? null;\n","import ApiClient from '@package/services/src/ApiClient';\nimport Result from '@package/services/src/Result';\n\nimport { AppConfigService, GetAppConfigRequest } from './services';\nimport { AppConfig, DEFAULT_APP_CONFIG, parseCaptchaOption } from './types';\n\nexport default class AppConfigApiService implements AppConfigService {\n  // eslint-disable-next-line prettier/prettier\n  public constructor(private readonly apiClient: ApiClient) {}\n\n  public async getAppConfig(request?: GetAppConfigRequest): Promise<Result<AppConfig>> {\n    try {\n      const res = await this.apiClient.get('/config', {\n        headers: {\n          ...request?.headers,\n          ...(request?.cookie ? { Cookie: request.cookie } : {}),\n        },\n      });\n\n      const json: Partial<AppConfig> = await res.json();\n\n      // Strict `true` only. The backend field is a primitive boolean so it always arrives as JSON\n      // `true`/`false`, but anything else reaching here — a string, a missing key — must read as off.\n      return new Result({\n        ccAuthorizeEnabled: json?.ccAuthorizeEnabled === true,\n        paymentCaptchaOption: parseCaptchaOption(json?.paymentCaptchaOption),\n      });\n    } catch (error) {\n      // Switches stay off when the endpoint is unreachable: the donation must never be offered\n      // without the full-amount card authorization that charges it.\n      console.error('cant get app config', error);\n      return new Result(DEFAULT_APP_CONFIG);\n    }\n  }\n}\n","import Result from '@package/services/src/Result';\n\nimport { AppConfigService, GetAppConfigRequest } from './services';\nimport { AppConfig } from './types';\n\nexport default class AppConfigInteractor {\n  public constructor(private appConfigService: AppConfigService) {}\n\n  public getAppConfig(request?: GetAppConfigRequest): Promise<Result<AppConfig>> {\n    return this.appConfigService.getAppConfig(request);\n  }\n}\n","export const APP_CONFIG_QUERY_KEY = 'APP_CONFIG_QUERY_KEY';\n","import AppConfigApiService from '@package/core/src/appConfig/AppConfigApiService';\nimport AppConfigInteractor from '@package/core/src/appConfig/AppConfigInteractor';\nimport { DEFAULT_APP_CONFIG } from '@package/core/src/appConfig/types';\n\nimport { apiClient } from '../services';\nimport { useQuery } from '../useCustomQuery';\n\nimport { APP_CONFIG_QUERY_KEY } from './types';\n\nconst appConfigService = new AppConfigApiService(apiClient);\nconst appConfigInteractor = new AppConfigInteractor(appConfigService);\n\n/**\n * Backend feature switches. Checkout pages prefetch them into the query cache server-side under\n * APP_CONFIG_QUERY_KEY, so they are known on first render — a client-only fetch would let the\n * donation UI pop in after hydration.\n *\n * Plain useQuery rather than useStrictQuery on purpose: a config failure must never take checkout\n * down. The service already falls back to every switch off.\n */\nconst useAppConfig = () => {\n  const { data: appConfig } = useQuery(\n    [APP_CONFIG_QUERY_KEY],\n    async () => {\n      const res = await appConfigInteractor.getAppConfig();\n\n      return res.data ?? DEFAULT_APP_CONFIG;\n    },\n    {\n      refetchOnWindowFocus: false,\n      refetchOnMount: false,\n    },\n  );\n\n  return {\n    ccAuthorizeEnabled: appConfig?.ccAuthorizeEnabled ?? DEFAULT_APP_CONFIG.ccAuthorizeEnabled,\n    paymentCaptchaOption: appConfig?.paymentCaptchaOption ?? DEFAULT_APP_CONFIG.paymentCaptchaOption,\n  };\n};\n\nexport default useAppConfig;\n","/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport NeedleAnalytic from \"@package/services/src/Needle\"\nimport { EmptyResult } from \"@package/services/src/Result\"\n\nimport { NeedleAnalyticsService } from \"./services\"\n\nexport default class NeedleAnalyticsApiService implements NeedleAnalyticsService {\n  constructor(private needle: NeedleAnalytic) { }\n\n  public async removeNeedleScript(): Promise<any> {\n    try {\n      if (this.needle) {\n        await this.needle.removeNeedle()\n      }\n      return new EmptyResult()\n    } catch (error) {\n      console.warn('Needle was not provided')\n    }\n  }\n\n  public async reloadNeedleScript(): Promise<any> {\n    try {\n      if (this.needle) {\n        await this.needle.reloadNeedle()\n      }\n      return new EmptyResult()\n    } catch (error) {\n      console.warn('Needle was not provided')\n    }\n  }\n}\n","import { EmptyResult } from \"@package/services/src/Result\"\n\nimport { NeedleAnalyticsService } from \"./services\"\n\nexport default class NeedleAnalyticsInteractor {\n  constructor(\n    private needleService: NeedleAnalyticsService,\n  ) { }\n\n  public removeNeedleScript(): Promise<EmptyResult> {\n    return this.needleService.removeNeedleScript()\n  }\n\n  public reloadNeedleScript(): Promise<EmptyResult> {\n    return this.needleService.reloadNeedleScript()\n  }\n}\n","/* eslint-disable @typescript-eslint/no-misused-promises */\nimport NeedleAnalyticsApiService from '@package/core/src/needleAnalytics/NeedleAnalyticsApiService';\nimport NeedleAnalyticsInteractor from '@package/core/src/needleAnalytics/NeedleAnalyticsInteractor';\nimport { useRouter } from 'next/router';\nimport { useEffect } from 'react';\n\nimport {needleAnalytic } from '../services';\n\nconst needleService = new NeedleAnalyticsApiService(needleAnalytic);\nconst needleInteractor = new NeedleAnalyticsInteractor(needleService);\n\nexport default function useCheckoutNeedle() {\n  const router = useRouter();\n\n  const handleStartLoading = async () => {\n    await needleInteractor.removeNeedleScript();\n  };\n\n  const handleEndLoading = async () => {\n    await needleInteractor.reloadNeedleScript();\n  };\n\n  useEffect(() => {\n    router.events.on('routeChangeStart', handleStartLoading);\n    router.events.on('routeChangeComplete', handleEndLoading);\n  }, []);\n\n  return {};\n}\n","import OrderSetUpApiService from '@package/core/src/orderSetUp/OrderSetUpApiService';\nimport OrderSetUpInteractor from '@package/core/src/orderSetUp/OrderSetUpInteractor';\nimport { MakeDonationRequest } from '@package/core/src/orderSetUp/types';\n\nimport { apiClient } from '../services';\nimport { useMutation } from '../useCustomQuery';\n\nconst orderSetUpService = new OrderSetUpApiService(apiClient);\nconst orderSetUpInteractor = new OrderSetUpInteractor(orderSetUpService);\n\n/**\n * Redirect-free donation mutation for the checkout flow. Unlike useOrderSetUp, it does NOT navigate\n * to /donation-confirmation, so it can be awaited inline during order submission.\n *\n * Uses plain useMutation rather than useStrictMutation on purpose: the strict wrapper rethrows\n * critical errors, which would break the order. The donation is best-effort and must never block it.\n * Exposes the async mutate so callers can `await` it before the rest of the checkout endpoints.\n */\nconst useDonation = () => {\n  const { mutateAsync: makeDonation } = useMutation(async (data: MakeDonationRequest) => {\n    await orderSetUpInteractor.makeDonation(data);\n  });\n\n  return { makeDonation };\n};\n\nexport default useDonation;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"applePayContainer\":\"ApplePayButton_applePayContainer__AXCsj\",\"applePayContainerAGD\":\"ApplePayButton_applePayContainerAGD__8jZ4T\",\"hiddenApplePay\":\"ApplePayButton_hiddenApplePay__guFQS\",\"disabled\":\"ApplePayButton_disabled__F_G0z\"};"],"names":["DigitalWalletType","getApplePayContactCountry","contact","countryCode","country","_components_ApplePayButton","_ref","_ref2","_clsx","className","id","summary","paymentSessionProps","_paymentSessionProps$","disabled","paymentRequest","_paymentSessionProps$2","lineItems","shippingAddress","_paymentSessionProps$3","totalLabel","page","onAuthorizePaymentRequest","onCompleteMerchantValidation","onCompletePayment","onPaymentError","onGetCombinedShippingOptions","_useState","useState","setCanMakePayments","_useState2","setSummaryState","applePayState","useRef","canMakePayments","shippingOptions","selectedShippingOptions","paymentInfo","total","label","type","amount","concat","_useState3","activeSession","setActiveSession","resetApplePayState","current","_objectSpread","onClickApplePayButton","_asyncToGenerator","_regeneratorRuntime","_callee5","session","_context5","prev","next","console","error","abrupt","ApplePaySession","currencyCode","supportedNetworks","merchantCapabilities","onvalidatemerchant","_ref3","_callee","event","merchantSession","_context","validationURL","sent","completeMerchantValidation","t0","abort","ApiError","Response","status","stop","_x","apply","arguments","onshippingcontactselected","_ref5","_callee2","_ref4","shippingContact","_shippingContact$addr","errors","newTotal","newShippingMethods","combinedShippingOptions","updatedLineItems","orderSummaryTotal","_context2","givenName","isASCII","push","ApplePayError","FormErrorCode","EnglishAlphabet","familyName","addressLines","some","line","locality","length","completeShippingContactSelection","newLineItems","_toConsumableArray","administrativeArea","postalCode","applePayService","getLineItems","orderSummary","applePayShippingMethods","forEach","selectedOption","Number","shipments","code","ErrorCodeType","GroundOnlyProduct","message","t1","_x2","onshippingmethodselected","_ref7","_callee3","_ref6","shippingMethod","newShippingMethodTotal","totalShippingAmount","selectedShippingIds","selectedShippingOption","shippingLineItemIndex","_context3","String","Math","round","identifier","split","map","_id$split$map","_id$split$map2","_slicedToArray","subOrderId","methodId","_ref8","option","find","opt","newShipping","shippingOption","name","findIndex","item","config","brandCode","completeShippingMethodSelection","_x3","onpaymentauthorized","_ref10","_callee4","_ref9","payment","_payment$shippingCont","_payment$shippingCont2","_payment$billingConta","_payment$billingConta2","_payment$billingConta3","_payment$billingConta4","_payment$billingConta5","_payment$billingConta6","_shippingContactToUse","_payment$shippingCont3","_payment$shippingCont4","_payment$shippingCont5","base64DataPaymentToken","shippingContactToUse","authorizePaymentRequest","_payment$billingConta7","_context4","btoa","JSON","stringify","token","paymentData","authorizationToken","descriptor","APPLE","customerContactInfo","email","emailAddress","phone","phoneNumber","billingAddress","firstName","billingContact","lastName","address1","join","state","city","zipcode","completePayment","STATUS_FAILURE","_ref11","STATUS_SUCCESS","_x4","oncancel","begin","Error","startsWith","initApplePayButton","applePayButton","document","getElementById","addEventListener","err","getApplePaySession","_window","window","useEffect","removeEventListener","_jsx","clsx","styles","_defineProperty","children","dangerouslySetInnerHTML","__html","PayPalPaymentInteractor","paypalPaymentService","_classCallCheck","_createClass","key","value","request","undefined","skipShippingVerification","paypalCheckout","paypalAuthorize","paypalInteractor","PayPalPaymentApiService","apiClient","PayPalButton","props","notDeliverable","onCallback","onError","handlePaypalApprove","_props$fundingSource","fundingSource","FUNDING","PAYPAL","_props$hide","hide","_props$skipShippingVe","_props$label","_props$height","height","queryClient","useQueryClient","router","useRouter","makeDonation","_useDonation","useDonation","ccAuthorizeEnabled","_useAppConfig","useAppConfig","style","PayPalButtons","shape","color","layout","borderRadius","forceReRender","createOrder","_","actions","checkoutObj","_yield$paypalInteract","data","order","create","onApprove","orderId","orderID","donation","invalidateQueries","CHEKOUT_SUMMARY_DATA_QUERY_KEY","storageManager","put","reviewPath","shippingAddressPath","pathname","paymentsPath","OrderSetUpApiService","_getSubordersKeys","_makeDonation","_getLastPageContent","res","json","get","credentials","cookie","headers","Cookie","Result","post","body","EmptyResult","OrderSetUpInteractor","orderSetUpService","getSubordersKeys","getLastPageContent","_paypalCheckout","_paypalAuthorize","url","_args","encodeURIComponent","_objectWithoutProperties","_excluded","DEFAULT_APP_CONFIG","paymentCaptchaOption","CAPTCHA_OPTIONS","parseCaptchaOption","_CAPTCHA_OPTIONS$find","AppConfigApiService","_getAppConfig","AppConfigInteractor","appConfigService","getAppConfig","appConfigInteractor","src_useAppConfig","_appConfig$ccAuthoriz","_appConfig$paymentCap","appConfig","_useQuery","useQuery","_res$data","refetchOnWindowFocus","refetchOnMount","NeedleAnalyticsApiService","_removeNeedleScript","_reloadNeedleScript","needle","removeNeedle","warn","reloadNeedle","NeedleAnalyticsInteractor","needleService","removeNeedleScript","reloadNeedleScript","needleInteractor","needleAnalytic","useCheckoutNeedle","handleStartLoading","handleEndLoading","events","on","orderSetUpInteractor","__webpack_exports__","Z","_useMutation","useMutation","mutateAsync","module","exports"],"sourceRoot":""}