2026-07-25 08:10:48 +00:00
// Module ID: 4458
2026-07-27 11:26:19 +00:00
// Function ID: 39303
2026-07-20 16:05:17 +00:00
// Name: getStripe
2026-07-25 08:10:48 +00:00
// Dependencies: [5, 57, 1922, 653, 3, 4459, 507, 566, 2]
2026-07-20 16:05:17 +00:00
// Exports: authenticatePaymentIntentForPaymentId, getStripeClientMode, parseBillingAddressInfoToStripeBillingDetails, parseStripePaymentMethod, useStripeLocale, validateExpiry
2026-07-25 08:10:48 +00:00
// Module 4458 (getStripe)
2026-07-23 10:11:24 +00:00
import _typeof from "_typeof" ;
import _slicedToArray from "_slicedToArray" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import ME from "ME" ;
import importDefaultResult from "ME" ;
let closure_6 ;
let closure_7 ;
const require = arg1 ;
2026-07-20 16:05:17 +00:00
function getStripe() {
if ( null != closure_2 ) {
let resolved = Promise . resolve ( closure_2 ) ;
} else {
2026-07-25 08:10:48 +00:00
const stripe = require ( 4459 ) /* _typeof */ . loadStripe ( constants . STRIPE . KEY ) ;
2026-07-23 10:11:24 +00:00
resolved = stripe . then ( ( arg0 ) = > {
const outer1_2 = arg0 ;
return arg0 ;
} ) ;
2026-07-25 08:10:48 +00:00
const obj = require ( 4459 ) /* _typeof */ ;
2026-07-20 16:05:17 +00:00
}
return resolved ;
}
2026-07-23 10:11:24 +00:00
async function _authenticatePaymentIntentForPaymentId ( arg0 , arg1 ) {
const HTTP = outer2_0 ( outer2_1 [ 6 ] ) . HTTP ;
let obj = { url : outer2_6.BILLING_STRIPE_PAYMENT_INTENTS ( arg0 ) , oldFormErrors : true , rejectWithError : false } ;
2026-07-20 16:05:17 +00:00
const stripe_payment_intent_client_secret = yield HTTP . get ( obj ) . body . stripe_payment_intent_client_secret ;
2026-07-23 10:11:24 +00:00
const tmp = yield outer2_11 ( ) ;
2026-07-20 16:05:17 +00:00
let obj1 = tmp ;
if ( null == tmp ) {
obj = { error : "unable to load stripe" } ;
return obj ;
} else {
const tmp21 = yield obj1 . retrievePaymentIntent ( stripe_payment_intent_client_secret ) ;
const error = tmp21 . error ;
const paymentIntent = tmp21 . paymentIntent ;
if ( null != error ) {
obj = { error : error.message } ;
return obj ;
} else if ( null == paymentIntent ) {
obj1 = { error : "payment intent does not exist" } ;
return obj1 ;
} else {
const obj2 = { } ;
let tmp4 = tmp25 ;
2026-07-23 10:11:24 +00:00
if ( paymentIntent . status === outer2_9 . REQUIRES_PAYMENT_METHOD ) {
2026-07-20 16:05:17 +00:00
tmp4 = null != paymentIntent . last_payment_error ;
}
let tmp5 = tmp4 ;
if ( tmp4 ) {
tmp5 = null != paymentIntent . last_payment_error . payment_method ;
}
if ( tmp5 ) {
obj2 . payment_method = paymentIntent . last_payment_error . payment_method . id ;
}
const status = paymentIntent . status ;
2026-07-23 10:11:24 +00:00
if ( outer2_9 . REQUIRES_PAYMENT_METHOD !== status ) {
if ( outer2_9 . REQUIRES_CONFIRMATION !== status ) {
if ( outer2_9 . REQUIRES_ACTION !== status ) {
if ( outer2_9 . SUCCEEDED !== status ) {
if ( outer2_9 . PROCESSING !== status ) {
const CANCELED = outer2_9 . CANCELED ;
2026-07-20 16:05:17 +00:00
const obj3 = { } ;
const _HermesInternal = HermesInternal ;
obj3 . error = "Invalid Payment Intent status: " + paymentIntent . status ;
return obj3 ;
}
}
return { } ;
}
}
}
const error2 = yield obj1 . confirmCardPayment ( stripe_payment_intent_client_secret , obj2 ) . error ;
if ( null != error2 ) {
const obj4 = { error : error2.message } ;
let obj5 = obj4 ;
} else {
obj5 = { } ;
}
return obj5 ;
}
}
}
function getStripeElementLocale ( arg0 ) {
let tmp = arg0 ;
2026-07-23 10:11:24 +00:00
if ( null != table [ arg0 ] ) {
2026-07-20 16:05:17 +00:00
tmp = tmp2 ;
}
return tmp ;
}
2026-07-23 10:11:24 +00:00
( { Endpoints : closure_6 , PaymentSettings : closure_7 } = ME ) ;
2026-07-20 16:05:17 +00:00
importDefaultResult = new importDefaultResult ( "StripeUtils" ) ;
let closure_9 = { REQUIRES_PAYMENT_METHOD : "requires_payment_method" , REQUIRES_CONFIRMATION : "requires_confirmation" , REQUIRES_ACTION : "requires_action" , PROCESSING : "processing" , CANCELED : "canceled" , SUCCEEDED : "succeeded" } ;
2026-07-23 10:11:24 +00:00
let closure_10 = { "en-US" : "en" , "zh-CN" : "zh" , "sv-SE" : "sv" } ;
const result = require ( "_isNativeReflectConstruct" ) . fileFinishedImporting ( "utils/StripeUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const validateExpiry = function validateExpiry ( arg0 ) {
2026-07-23 10:11:24 +00:00
const tmp = callback2 ( ( function parseExpString ( str ) {
let closure_0 = str ;
2026-07-20 16:05:17 +00:00
function throwErr ( arg0 ) {
let str = "" ;
if ( null != arg0 ) {
str = arg0 ;
}
2026-07-23 10:11:24 +00:00
return "You passed an invalid expiration date " + closure_0 + str + "Please pass a string containing a numeric month and year such as `01-17` or `2015 / 05`" ;
2026-07-20 16:05:17 +00:00
}
const parts = str . split ( /[.\-/\s]+/g ) ;
if ( 2 !== parts . length ) {
throwErr ( ) ;
}
const mapped = parts . map ( ( replaced ) = > {
const parsed = parseInt ( replaced ) ;
if ( isNaN ( parsed ) ) {
const _HermesInternal = HermesInternal ;
throwErr ( "" + parts + " is not a number." ) ;
}
if ( parsed < 1 ) {
const _HermesInternal2 = HermesInternal ;
throwErr ( "" + parsed + " is less than one." ) ;
}
return parsed ;
} ) ;
if ( mapped [ 0 ] > 12 ) {
const items = [ , ] ;
[ arr3 [ 1 ] , arr3 [ 0 ] ] = mapped ;
let items1 = items ;
} else {
items1 = [ mapped [ 0 ] , mapped [ 1 ] ] ;
}
2026-07-23 10:11:24 +00:00
const tmp3 = outer1_4 ( items1 , 2 ) ;
2026-07-20 16:05:17 +00:00
const first = tmp3 [ 0 ] ;
if ( first > 12 ) {
2026-07-23 10:11:24 +00:00
let _HermesInternal = HermesInternal ;
2026-07-20 16:05:17 +00:00
throwErr ( "Month must be a number 1-12, not " + first + "." ) ;
}
let sum = tmp5 ;
if ( tmp3 [ 1 ] < 100 ) {
sum = tmp5 + 2000 ;
}
const items2 = [ first , sum ] ;
return items2 ;
2026-07-23 10:11:24 +00:00
} ) ( arg0 ) , 2 ) ;
2026-07-20 16:05:17 +00:00
const date = new Date ( tmp [ 1 ] , tmp [ 0 ] ) ;
date . setMonth ( date . getMonth ( ) - 1 ) ;
date . setMonth ( date . getMonth ( ) + 1 , 1 ) ;
return date > new Date ( ) ;
} ;
export { getStripe } ;
export const getStripeClientMode = function getStripeClientMode() {
if ( null == constants . STRIPE . KEY ) {
importDefaultResult . warn ( "getStripeClientMode() called before PaymentSettings.STRIPE.KEY initialized: " , constants . STRIPE . KEY ) ;
let str4 = "unknown" ;
} else {
const KEY2 = constants . STRIPE . KEY ;
str4 = "live" ;
if ( ! KEY2 . startsWith ( "pk_live" ) ) {
const KEY = constants . STRIPE . KEY ;
let str2 = "test" ;
if ( ! KEY . startsWith ( "pk_test" ) ) {
importDefaultResult . warn ( "Unexpected value for Stripe public key: " , constants . STRIPE . KEY ) ;
str2 = "unknown" ;
}
str4 = str2 ;
}
}
return str4 ;
} ;
export const parseStripePaymentMethod = function parseStripePaymentMethod ( billing_details ) {
billing_details = billing_details . billing_details ;
let address = billing_details . address ;
if ( null == address ) {
address = { } ;
}
let obj = { } ;
const name = billing_details . name ;
let str = "" ;
let str2 = "" ;
if ( null != name ) {
str2 = name ;
}
obj . name = str2 ;
const line1 = address . line1 ;
let tmp = str ;
if ( null != line1 ) {
tmp = line1 ;
}
obj . line1 = tmp ;
const line2 = address . line2 ;
let tmp2 = str ;
if ( null != line2 ) {
tmp2 = line2 ;
}
obj . line2 = tmp2 ;
const city = address . city ;
let tmp3 = str ;
if ( null != city ) {
tmp3 = city ;
}
obj . city = tmp3 ;
const state = address . state ;
let tmp4 = str ;
if ( null != state ) {
tmp4 = state ;
}
obj . state = tmp4 ;
const country = address . country ;
let tmp5 = str ;
if ( null != country ) {
tmp5 = country ;
}
obj . country = tmp5 ;
const postal_code = address . postal_code ;
if ( null != postal_code ) {
str = postal_code ;
}
obj . postalCode = str ;
obj = { token : billing_details.id , billingAddressInfo : obj } ;
return obj ;
} ;
export const parseBillingAddressInfoToStripeBillingDetails = function parseBillingAddressInfoToStripeBillingDetails ( name ) {
2026-07-23 10:11:24 +00:00
obj = { name : name.name , address : obj } ;
2026-07-20 16:05:17 +00:00
obj = { line1 : name.line1 , line2 : name.line2 , city : name.city , state : name.state , postal_code : name.postalCode , country : name.country } ;
return obj ;
} ;
export const authenticatePaymentIntentForPaymentId = function authenticatePaymentIntentForPaymentId() {
return _authenticatePaymentIntentForPaymentId ( . . . arguments ) ;
} ;
export { getStripeElementLocale } ;
export const useStripeLocale = function useStripeLocale() {
2026-07-23 10:11:24 +00:00
const items = [ _isNativeReflectConstruct ] ;
return require ( 566 ) /* initialize */ . useStateFromStores ( items , ( ) = > outer1_13 ( outer1_5 . locale ) ) ;
2026-07-20 16:05:17 +00:00
} ;