2026-07-24 07:16:23 +00:00
// Module ID: 9783
// Function ID: 76035
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 3, 6668, 3791, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-24 07:16:23 +00:00
// Module 9783 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray" ;
import result from "result" ;
import importDefaultResult from "getOrders" ;
const require = arg1 ;
function _createForOfIteratorHelperLoose ( iterable ) {
let closure_0 = iterable ;
iterable = "undefined" !== typeof Symbol ;
if ( iterable ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( iterable ) {
const iter = iterable . call ( iterable ) ;
2026-07-20 16:05:17 +00:00
const next = iter . next ;
return next . bind ( iter ) ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
let tmp = iterable ;
if ( ! Array . isArray ( iterable ) ) {
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
if ( iterable ) {
if ( "string" === typeof iterable ) {
tmp2 = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
const toString = { } . toString ;
2026-07-23 10:11:24 +00:00
const substr = toString . call ( iterable ) . slice ( 8 , - 1 ) ;
2026-07-20 16:05:17 +00:00
let name = substr ;
if ( tmp3 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr ;
}
const _Array2 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
const callResult = toString . call ( iterable ) ;
tmp3 = "Object" === substr && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2 ;
if ( ! tmp2 ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
throw typeError ;
}
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0 ;
2026-07-20 16:05:17 +00:00
return ( ) = > {
2026-07-23 10:11:24 +00:00
if ( closure_1 >= length . length ) {
2026-07-20 16:05:17 +00:00
let obj = { done : true } ;
} else {
obj = { done : false } ;
closure_1 = tmp3 + 1 ;
2026-07-23 10:11:24 +00:00
obj . value = length [ + closure_1 ] ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
}
}
function _arrayLikeToArray ( arg0 , arg1 ) {
let length ;
if ( tmp ) {
length = arg0 . length ;
}
const ArrayResult = Array ( length ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
ArrayResult [ num ] = arg0 [ num ] ;
}
return ArrayResult ;
}
importDefaultResult = new importDefaultResult ( "useSyncGiftOptionsToOrder" ) ;
2026-07-23 10:11:24 +00:00
let result = require ( "timestamp" ) . fileFinishedImporting ( "modules/checkout/native/useSyncGiftOptionsToOrder.tsx" ) ;
2026-07-20 16:05:17 +00:00
export default function useSyncGiftOptionsToOrder ( arg0 , arg1 ) {
2026-07-23 10:11:24 +00:00
let closure_11 ;
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
let closure_0 = arg0 ;
let closure_1 = arg1 ;
2026-07-20 16:05:17 +00:00
let callback = React . useRef ( null ) ;
2026-07-23 10:11:24 +00:00
React = React . useRef ( null ) ;
2026-07-20 16:05:17 +00:00
let closure_4 = React . useRef ( false ) ;
let closure_5 = React . useRef ( undefined ) ;
let closure_6 = React . useRef ( null ) ;
let closure_7 = React . useRef ( 0 ) ;
let closure_8 = React . useRef ( null ) ;
let closure_9 = React . useRef ( null ) ;
let closure_10 = React . useRef ( [ ] ) ;
[ tmp2 , closure_11 ] = callback ( React . useState ( 0 ) , 2 ) ;
callback = React . useCallback ( ( arg0 ) = > {
let done ;
ref9 . current = [ ] ;
const tmp = ref4 ( ref9 . current ) ;
let iter = tmp ( ) ;
if ( ! iter . done ) {
do {
let valueResult = iter . value ( arg0 ) ;
let iter2 = tmp ( ) ;
iter = iter2 ;
done = iter2 . done ;
} while ( ! done ) ;
}
} , [ ] ) ;
const items = [ callback ] ;
const effect = React . useEffect ( ( ) = > ( ) = > {
2026-07-23 10:11:24 +00:00
if ( null != outer1_9 . current ) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout ;
2026-07-23 10:11:24 +00:00
clearTimeout ( outer1_9 . current ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
outer1_12 ( false ) ;
2026-07-20 16:05:17 +00:00
} , items ) ;
const items1 = [ arg0 , arg1 , tmp2 , callback ] ;
2026-07-23 10:11:24 +00:00
const effect1 = React . useEffect ( ( ) = > {
if ( null != id ) {
id = id . id ;
result . current = table ;
2026-07-20 16:05:17 +00:00
if ( ref5 . current !== id ) {
ref5 . current = id ;
2026-07-23 10:11:24 +00:00
ref4 . current = id . revision ;
2026-07-20 16:05:17 +00:00
ref . current = null ;
closure_7 . current = 0 ;
}
2026-07-23 10:11:24 +00:00
if ( ref7 . current !== table ) {
2026-07-20 16:05:17 +00:00
closure_7 . current = 0 ;
}
if ( ! ref3 . current ) {
2026-07-23 10:11:24 +00:00
if ( ref . current !== table ) {
2026-07-20 16:05:17 +00:00
if ( null != ref8 . current ) {
const _clearTimeout = clearTimeout ;
clearTimeout ( ref8 . current ) ;
ref8 . current = null ;
}
ref3 . current = true ;
2026-07-23 10:11:24 +00:00
ref7 . current = table ;
let obj = callback ( table [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
obj = { orderId : id } ;
obj = { } ;
2026-07-23 10:11:24 +00:00
( { recipient_id : obj3.recipient_id , gift_style : obj3.gift_style , emoji_id : obj3.emoji_id , emoji_name : obj3.emoji_name , sound_id : obj3.sound_id , reward_sku_ids : obj3.reward_sku_ids , custom_message : obj3.custom_message_contents } = table ) ;
2026-07-20 16:05:17 +00:00
obj . giftInfo = obj ;
obj . expectedRevision = ref4 . current ;
const updateOrderResult = obj . updateOrder ( obj ) ;
const nextPromise = obj . updateOrder ( obj ) . then ( ( current ) = > {
2026-07-23 10:11:24 +00:00
outer1_5 . current = current ;
outer1_2 . current = outer1_1 ;
outer1_7 . current = 0 ;
2026-07-20 16:05:17 +00:00
} ) ;
obj . updateOrder ( obj ) . then ( ( current ) = > {
2026-07-23 10:11:24 +00:00
outer1_5 . current = current ;
outer1_2 . current = outer1_1 ;
outer1_7 . current = 0 ;
2026-07-20 16:05:17 +00:00
} ) . catch ( ( error ) = > {
2026-07-23 10:11:24 +00:00
outer1_7 . current = outer1_7 . current + 1 ;
2026-07-20 16:05:17 +00:00
let obj = { error , orderId : id } ;
2026-07-23 10:11:24 +00:00
logger . error ( "Failed to sync gift customization to order" , obj ) ;
2026-07-20 16:05:17 +00:00
obj = { orderId : id } ;
2026-07-23 10:11:24 +00:00
const result = id ( table [ 4 ] ) . captureBillingException ( error , { tags : { source : "useSyncGiftOptionsToOrder" } , extra : obj } ) ;
2026-07-20 16:05:17 +00:00
} ) . finally ( ( ) = > {
2026-07-23 10:11:24 +00:00
outer1_4 . current = false ;
if ( outer1_2 . current !== outer1_3 . current ) {
if ( 0 === outer1_7 . current ) {
outer1_11 ( ( arg0 ) = > arg0 + 1 ) ;
} else if ( outer1_7 . current < 3 ) {
2026-07-20 16:05:17 +00:00
const _setTimeout = setTimeout ;
2026-07-23 10:11:24 +00:00
outer1_9 . current = setTimeout ( ( ) = > outer2_11 ( ( arg0 ) = > arg0 + 1 ) , 500 * 2 * * ( outer1_7 . current - 1 ) ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
outer1_12 ( false ) ;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-23 10:11:24 +00:00
outer1_12 ( true ) ;
2026-07-20 16:05:17 +00:00
}
} ) ;
const catchPromise = obj . updateOrder ( obj ) . then ( ( current ) = > {
2026-07-23 10:11:24 +00:00
outer1_5 . current = current ;
outer1_2 . current = outer1_1 ;
outer1_7 . current = 0 ;
2026-07-20 16:05:17 +00:00
} ) . catch ( ( error ) = > {
2026-07-23 10:11:24 +00:00
outer1_7 . current = outer1_7 . current + 1 ;
2026-07-20 16:05:17 +00:00
let obj = { error , orderId : id } ;
2026-07-23 10:11:24 +00:00
logger . error ( "Failed to sync gift customization to order" , obj ) ;
2026-07-20 16:05:17 +00:00
obj = { orderId : id } ;
2026-07-23 10:11:24 +00:00
const result = id ( table [ 4 ] ) . captureBillingException ( error , { tags : { source : "useSyncGiftOptionsToOrder" } , extra : obj } ) ;
2026-07-20 16:05:17 +00:00
} ) ;
} else {
callback ( true ) ;
}
}
} else {
callback ( true ) ;
}
} , items1 ) ;
const items2 = [ arg0 ] ;
const callback1 = React . useCallback ( ( ) = > {
2026-07-23 10:11:24 +00:00
if ( null != closure_0 ) {
2026-07-20 16:05:17 +00:00
if ( ref . current !== ref2 . current ) {
if ( ref6 . current >= 3 ) {
ref6 . current = 0 ;
}
let resolved = new Promise ( ( arg0 ) = > {
2026-07-23 10:11:24 +00:00
let current = outer1_10 . current ;
2026-07-20 16:05:17 +00:00
current . push ( arg0 ) ;
2026-07-23 10:11:24 +00:00
current = outer1_4 . current ;
2026-07-20 16:05:17 +00:00
if ( ! current ) {
2026-07-23 10:11:24 +00:00
current = null != outer1_9 . current ;
2026-07-20 16:05:17 +00:00
}
if ( ! current ) {
2026-07-23 10:11:24 +00:00
outer1_11 ( ( arg0 ) = > arg0 + 1 ) ;
2026-07-20 16:05:17 +00:00
}
} ) ;
}
return resolved ;
}
resolved = Promise . resolve ( true ) ;
} , items2 ) ;
const items3 = [ callback1 ] ;
return React . useMemo ( ( ) = > ( { awaitSync : callback1 } ) , items3 ) ;
} ;