1(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[2914],{ 2 3/***/ 579340: 4/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 5 6"use strict"; 7/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8/* harmony export */ g: function() { return /* binding */ getBillingAddressTranslationProps; }, 9/* harmony export */ t: function() { return /* binding */ CONSTANTS; } 10/* harmony export */ }); 11/* harmony import */ var _Lib_utils_locale__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(225220); 12 13// Constants for UpdateMembershipPaymentForm 14const CONSTANTS = { 15 DOM_SELECTORS: { 16 DROPIN_CONTAINER: "dropin-container" 17 }, 18 PAYMENT_TYPES: { 19 SCHEME: "scheme", 20 PAYPAL: "paypal", 21 APPLEPAY: "applepay" 22 }, 23 CARD_NAMES: { 24 CREDIT_CARD: "Credit Card", 25 MEMBERSHIP_TRIAL: "3 Month Membership Trial" 26 }, 27 LOG_MESSAGES: { 28 ADYEN_ERROR: "Adyen dropin error", 29 CONTAINER_NOT_FOUND: "Dropin container not found in DOM", 30 NO_CREDIT_CARDS: "No credit card payment methods available" 31 } 32}; 33// Translation properties for billing address 34const getBillingAddressTranslationProps = (isAccountSection)=>{ 35 const baseTranslations = { 36 firstNameLabelText: "First Name", 37 lastNameLabelText: "Last Name", 38 address1LabelText: "Address", 39 address2LabelText: "Apartment, suite, etc. (Optional)", 40 cityLabelText: "City", 41 stateLabelText: "State", 42 countryLabelText: "Country/region", 43 defaultAddressLabelText: "Set as default address", 44 zipCodeLabelText: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_0__.t)("customer.membership.update_membership_payment_form.zip_code_label_text"), 45 phoneLabelText: "Phone", 46 firstNamePlaceholder: "Please enter your first name", 47 lastNamePlaceholder: "Please enter your last name", 48 address1Placeholder: "Please enter your address", 49 address2Placeholder: "Apartment, suite, etc. (Optional)", 50 cityPlaceholder: "Please enter your city", 51 statePlaceholder: "Please select your state", 52 countryPlaceholder: "Please select your country", 53 validPhonePlaceholder: "Please enter your phone number", 54 invalidPhonePlaceholder: "Please enter a valid phone number", 55 zipCodePlaceholder: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_0__.t)("customer.membership.update_membership_payment_form.zip_code_place_holder") 56 }; 57 return { 58 submitButtonLabel: isAccountSection ? "Update Payment" : "Submit", 59 ...baseTranslations 60 }; 61}; 62 63 64/***/ }), 65 66/***/ 127502: 67/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 68 69"use strict"; 70/* harmony export */ __webpack_require__.d(__webpack_exports__, { 71/* harmony export */ H9: function() { return /* binding */ validateAdyenConfig; }, 72/* harmony export */ Mc: function() { return /* binding */ validatePaymentMethods; }, 73/* harmony export */ Ud: function() { return /* binding */ createAdyenDropinConfig; }, 74/* harmony export */ ts: function() { return /* binding */ mountAdyenDropin; } 75/* harmony export */ }); 76/* unused harmony exports filterCreditCardMethods, createCardConfig, getDropinContainer */ 77/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(101914); 78/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_0__); 79/* harmony import */ var _Lib_adyen__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(942092); 80/* harmony import */ var _Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(680811); 81/* harmony import */ var _UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(579340); 82 83 84 85 86// Utility: Payment Methods Filter 87const filterCreditCardMethods = (paymentMethods)=>
87paymentMethods.filter((method)=>method.type === _UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.PAYMENT_TYPES.SCHEME); 88// Utility: Config Validation 89const validateAdyenConfig = (config)=>{ 90 const typedConfig = config; 91 return !!(typedConfig && typedConfig.paymentMethodsResponse && typedConfig.paymentMethodsResponse.paymentMethods && typedConfig.paymentMethodsResponse.paymentMethods.length > 0 && typedConfig.clientKey); 92}; 93// Function to create card configuration based on Adyen Web standards 94const createCardConfig = (existingCardConfig, isAccountSection)=>({ 95 ...existingCardConfig, 96 name: isAccountSection ? _UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.CARD_NAMES.CREDIT_CARD : _UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.CARD_NAMES.MEMBERSHIP_TRIAL, 97 hasHolderName: true, 98 holderNameRequired: true, 99 enableStoreDetails: isAccountSection 100 }); 101// Function to create Adyen dropin configuration using official types 102const createAdyenDropinConfig = (config, dispatch, isAccountSection, onUserInteraction)=>{ 103 try { 104 var _dropinConfig_paymentMethodsResponse, _dropinConfig_paymentMethodsConfiguration; 105 // Clone the config to avoid mutations 106 const dropinConfig = JSON.parse(JSON.stringify(config)); 107 // Filter to show only credit card payment methods 108 if ((_dropinConfig_paymentMethodsResponse = dropinConfig.paymentMethodsResponse) === null || _dropinConfig_paymentMethodsResponse === void 0 ? void 0 : _dropinConfig_paymentMethodsResponse.paymentMethods) { 109 dropinConfig.paymentMethodsResponse.paymentMethods = filterCreditCardMethods(dropinConfig.paymentMethodsResponse.paymentMethods); 110 } 111 // Create card configuration 112 const cardConfig = createCardConfig((_dropinConfig_paymentMethodsConfiguration = dropinConfig.paymentMethodsConfiguration) === null || _dropinConfig_paymentMethodsConfiguration === void 0 ? void 0 : _dropinConfig_paymentMethodsConfiguration.card, isAccountSection); 113 // Remove unnecessary properties for clean config 114 const { paymentMethodsConfiguration, paymentMethodsResponsePaypal, ...cleanedConfig } = dropinConfig; 115 return { 116 ...cleanedConfig, 117 card: cardConfig, 118 onChange: (state)=>{ 119 if (state.data.paymentMethod.encryptedCardNumber || state.data.paymentMethod.encryptedExpiryMonth || state.data.paymentMethod.encryptedExpiryYear || state.data.paymentMethod.encryptedSecurityCode) { 120 // Use callback if provided (for local state tracking) 121 // Note: Membership payment form doesn't need interaction tracking, 122 // but corporate gifts uses this callback for local state management 123 if (onUserInteraction) { 124 onUserInteraction(true); 125 } 126 } 127 if (state.isValid) { 128 dispatch((0,_Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_2__/* .saveAdyenFormData */ .By)(state.data)); 129 } 130 dispatch((0,_Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_2__/* .saveIsValidPaymentMethod */ .dU)(state.isValid)); 131 }, 132 onError: (error)=>{ 133 _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_0___default().error(_UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.LOG_MESSAGES.ADYEN_ERROR, { 134 name: (error === null || error === void 0 ? void 0 : error.name) || "Unknown error", 135 message: (error === null || error === void 0 ? void 0 : error.message) || "No error message", 136 stack: error === null || error === void 0 ? void 0 : error.stack, 137 cause: error === null || error === void 0 ? void 0 : error.cause 138 }); 139 }, 140 showPayButton: false 141 }; 142 } catch (error) { 143 throw new Error("Configuration creation failed"); 144 } 145}; 146// Function to get DOM container safely 147const getDropinContainer = ()=>{ 148 return document.getElementById(_UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.DOM_SELECTORS.DROPIN_CONTAINER); 149}; 150// Function to mount Adyen dropin using official API 151const mountAdyenDropin = async (paymentFormConfiguration, isAccountSection)=>{ 152 try { 153 // Check if dropin container exists in DOM 154 const dropinContainer = getDropinContainer(); 155 if (!dropinContainer) { 156 throw new Error(_UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.LOG_MESSAGES.CONTAINER_NOT_FOUND); 157 } 158 // Clear any existing dropin content 159 dropinContainer.innerHTML = ""; 160 // Create Adyen instance and mount dropin using official API 161 const adyenInstance = await (0,_Lib_adyen__WEBPACK_IMPORTED_MODULE_1__/* .initCheckout */ .j0)(paymentFormConfiguration); 162 if (!adyenInstance) { 163 throw new Error("Failed to create Adyen checkout instance"); 164 } 165 // Use official dropin configuration options from Adyen Web 166 const dropinConfig = { 167 showStoredPaymentMethods: isAccountSection, 168 openFirstPaymentMethod: true 169 }; 170 const dropin = adyenInstance.createDropin(dropinConfig); 171 if (!dropin) { 172 throw new Error("Failed to create Adyen dropin"); 173 } 174 dropin.mount("#".concat(_UpdateMembershipPaymentForm_constants__WEBPACK_IMPORTED_MODULE_3__/* .CONSTANTS */ .t.DOM_SELECTORS.DROPIN_CONTAINER)); 175 } catch (error) { 176 throw new Error("Dropin mounting failed"); 177 } 178}; 179// Function to validate payment methods availability 180const validatePaymentMethods = (config)=>{ 181 try { 182 var _config_paymentMethodsResponse; 183 const paymentMethods = ((_config_paymentMethodsResponse = config.paymentMethodsResponse) === null || _config_paymentMethodsResponse === void 0 ? void 0 : _config_paymentMethodsResponse.paymentMethods) || []; 184 const creditCardMethods = filterCreditCardMethods(paymentMethods); 185 if (creditCardMethods.length === 0) { 186 return false;
187 } 188 return true; 189 } catch (error) { 190 return false; 191 } 192}; 193 194 195/***/ }), 196 197/***/ 896212: 198/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 199 200"use strict"; 201/* harmony export */ __webpack_require__.d(__webpack_exports__, { 202/* harmony export */ P: function() { return /* binding */ useCustomerOrders; } 203/* harmony export */ }); 204/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(667294); 205/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_constants_locale__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(808439); 206/* harmony import */ var _Lib_account__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(278128); 207/* harmony import */ var _Lib_corporateGifts_handlers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(398736); 208/* harmony import */ var _Lib_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(130414); 209/* harmony import */ var _Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(221473); 210/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(267097); 211/* harmony import */ var _Lib_store_orderHistorySlice__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(310100); 212/* harmony import */ var _Lib_tracking_trackingEvents__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(538933); 213/* harmony import */ var _Lib_types_environment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(552877); 214/* harmony import */ var _Lib_utils_customerUtils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(307946); 215/* harmony import */ var _Lib_utils_membership__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(469521); 216/* harmony import */ var _Lib_utils_orderEligibilityUtils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(458550); 217/* harmony import */ var _Lib_utils_snackbarHandlers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(921134); 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232const CORPORATE_GIFTING_ROLES = { 233 CG_ADMIN: "cgadmin", 234 CG_USER: "cguser" 235}; 236const accountHandlers = (0,_Lib_account__WEBPACK_IMPORTED_MODULE_2__/* .createAccountHandlers */ .K)(); 237const campaignHandlers = (0,_Lib_corporateGifts_handlers__WEBPACK_IMPORTED_MODULE_3__/* .createCampaignHandlers */ .xR)(); 238const useCustomerOrders = ()=>{ 239 const dispatch = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__/* .useAppDispatch */ .T)(); 240 const { isLoggedIn, customerInfo } = (0,_Lib_hooks__WEBPACK_IMPORTED_MODULE_4__/* .useCustomer */ .ON)(); 241 const [meetsOrderCriteriaForOfferModal, setMeetsOrderCriteriaForOfferModal] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined); 242 const orders = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__/* .useAppSelector */ .C)((state)=>{ 243 var _state_orderHistory; 244 return ((_state_orderHistory = state.orderHistory) === null || _state_orderHistory === void 0 ? void 0 : _state_orderHistory.data) || []; 245 }); 246 const getMyOrders = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((setGTMIsReturningEvent)=>{ 247 if (!isLoggedIn) return; 248 // Check if user is corporate gifting admin 249 // Note: corporateAccountRoles may exist at runtime but not in type definition 250 const isCorporateGiftingAdmin = (customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.corporateAccountRoles) === CORPORATE_GIFTING_ROLES.CG_ADMIN; 251 // Prepare promises array 252 const promises = [ 253 accountHandlers.getOrderHistory() 254 ]; 255 // Conditionally add campaign history API call 256 if (isCorporateGiftingAdmin) { 257 var _campaignHandlers_getCampaignHistory; 258 promises.push(campaignHandlers === null || campaignHandlers === void 0 ? void 0 : (_campaignHandlers_getCampaignHistory = campaignHandlers.getCampaignHistory) === null || _campaignHandlers_getCampaignHistory === void 0 ? void 0 : _campaignHandlers_getCampaignHistory.call(campaignHandlers)); 259 } 260 // Call APIs in parallel and merge results 261 Promise.all(promises).then((responses)=>{ 262 var _responses_, _responses_1; 263 // First response is always order history 264 const orderHistoryData = responses[0].success ? responses[0].data : [];
265 // Second response (if exists) is campaign history 266 const campaignHistoryData = isCorporateGiftingAdmin && ((_responses_ = responses[1]) === null || _responses_ === void 0 ? void 0 : _responses_.success) ? (_responses_1 = responses[1]) === null || _responses_1 === void 0 ? void 0 : _responses_1.data : []; 267 /** 268 * Merges the order history and campaign history arrays, 269 * then sorts the resulting array in descending order by createdAt date. 270 * 271 * @type {Array} 272 */ const mergedData = [ 273 ...orderHistoryData, 274 ...campaignHistoryData 275 ].sort((a, b)=>new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); 276 dispatch((0,_Lib_store_orderHistorySlice__WEBPACK_IMPORTED_MODULE_7__/* .setOrderHistoryResponse */ .av)(mergedData)); 277 if (setGTMIsReturningEvent && mergedData.length >= 1) { 278 (0,_Lib_tracking_trackingEvents__WEBPACK_IMPORTED_MODULE_8__/* .GTMIsReturning */ .Wt)(); 279 } 280 }).catch((err)=>{ 281 (0,_Lib_utils_snackbarHandlers__WEBPACK_IMPORTED_MODULE_10__/* .axiosErrorHandler */ .ri)({ 282 error: err 283 }); 284 }).finally(()=>{ 285 dispatch((0,_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_5__/* .setInitStatus */ .M6)({ 286 initStep: _Lib_types_environment__WEBPACK_IMPORTED_MODULE_9__/* .InitStatus */ .qX.ORDER_HISTORY 287 })); 288 }); 289 }, [ 290 dispatch, 291 isLoggedIn, 292 customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.corporateAccountRoles 293 ]); 294 // Utility to expose previous purchased products amongst orders, 295 // identified by sku (no duplicates). 296 const purchasedSkus = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_Lib_utils_orderEligibilityUtils__WEBPACK_IMPORTED_MODULE_11__/* .extractPurchasedSkus */ .KV)(orders), [ 297 orders 298 ]); 299 // Utility to expose previous purchased products amongst orders, 300 // identified by sku (no duplicates) and with order date (newest to oldest). 301 const purchasedSkusByDate = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_Lib_utils_orderEligibilityUtils__WEBPACK_IMPORTED_MODULE_11__/* .extractPurchasedSkusByDate */ .wV)(orders), [ 302 orders 303 ]); 304 const hasOrderCriteria = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_Lib_utils_orderEligibilityUtils__WEBPACK_IMPORTED_MODULE_11__/* .calculateEligibility */ .uX)(orders), [ 305 orders 306 ]); 307 const isPosOnlyEligible = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_Lib_utils_membership__WEBPACK_IMPORTED_MODULE_12__/* .isPosOnlyCustomer */ .MD)(orders), [ 308 orders 309 ]); 310 const meetsAnyEligibilityCriteria = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>hasOrderCriteria || isPosOnlyEligible, [ 311 hasOrderCriteria, 312 isPosOnlyEligible 313 ]); 314 const hasOrdersInPastTwoYears = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(0,_Lib_utils_customerUtils__WEBPACK_IMPORTED_MODULE_13__.calculateHasOrdersInPast2Years)(orders), [ 315 orders 316 ]); 317 const isNotShowReferral = _wildfork_commercetools_core_ui_dist_src_lib_constants_locale__WEBPACK_IMPORTED_MODULE_1__.isCALocale && !hasOrdersInPastTwoYears; 318 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{ 319 setMeetsOrderCriteriaForOfferModal(meetsAnyEligibilityCriteria); 320 }, [ 321 meetsAnyEligibilityCriteria, 322 orders 323 ]); 324 return { 325 getMyOrders, 326 meetsOrderCriteriaForOfferModal, 327 orders, 328 purchasedSkus, 329 purchasedSkusByDate, 330 // Individual eligibility flags for more granular control 331 hasOrderCriteria, 332 isPosOnlyEligible, 333 isNotShowReferral 334 }; 335}; 336 337 338/***/ }), 339 340/***/ 474282: 341/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 342 343"use strict"; 344/* harmony export */ __webpack_require__.d(__webpack_exports__, { 345/* harmony export */ Pf: function() { return /* binding */ useFastlane; }, 346/* harmony export */ RW: function() { return /* binding */ FastlaneAuthStatus; } 347/* harmony export */ }); 348/* unused harmony export FASTLANE_ENV */ 349/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(667294); 350/* harmony import */ var _adyen_adyen_web__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(912943); 351/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(692521); 352/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(208891); 353/* harmony import */ var _Lib_hooks_useZipCode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(455489); 354/* harmony import */ var _Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(484725); 355/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(267097); 356/* harmony import */ var _Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(680811); 357/* harmony import */ var _Lib_utils_browserStorage__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(873043); 358/* harmony import */ var _Lib_utils_fastlane__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(903256); 359/* harmony import */ var _lib_constants_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(339114); 360/* harmony import */ var _providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(98385); 361 362 363 364 365 366 367 368 369 370 371 372 373const ENV = [ 374 "prod", 375 "production" 376]; 377const FASTLANE_ENV = { 378 LIVE: "live", 379 TEST: "test", 380 LIVE_US: "live-us", 381 LIVE_AU: "live-au", 382 LIVE_APSE: "live-apse", 383 LIVE_IN: "live-in" 384}; 385var FastlaneAuthStatus; 386(function(FastlaneAuthStatus) { 387 FastlaneAuthStatus["SUCCEEDED"] = "succeeded"; 388 FastlaneAuthStatus["NOT_FOUND"] = "not_found"; 389 FastlaneAuthStatus["CANCELED"] = "canceled"; 390 FastlaneAuthStatus["FAILED"] = "failed"; 391})(FastlaneAuthStatus || (FastlaneAuthStatus = {})); 392const useFastlane = ()=>{ 393 const [fastlaneObj, setFastlaneObj] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(); 394 const dispatch = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppDispatch */ .T)(); 395 const [status, setStatus] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({ 396 isLoading: false, 397 isInitialized: false 398 }); 399 const shippingAddress = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)((state)=>state.cart.shippingAddress); 400 const IS_FASTLANE_ENABLED = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_2__.nextAppEnv.feature_toggle.US.isPaypalFastlaneCheckoutEnabled; 401 const { handleSubmitZipcode } = (0,_Lib_hooks_useZipCode__WEBPACK_IMPORTED_MODULE_3__/* .useZipCode */ .lH)(); 402 const { setUserContactHandler } = (0,_providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_9__/* .useCheckout */ .Mg)(); 403 /** 404 * Initializes the Fastlane SDK instance. 405 * 406 * This function sets the loading status, determines the environment (live or test), 407 * and calls the initializeFastlane function with the appropriate configuration. 408 * It updates the status state to reflect loading and initialization progress. 409 * If initialization is successful, it returns the Fastlane SDK instance. 410 * If an error occurs, it logs the error, updates the status, and returns null. 411 * 412 * @returns {Promise<FastlaneSDK | null>} A promise that resolves to the Fastlane SDK instance or null if initialization fails. 413 */ const initFastlane = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(async ()=>{ 414 setStatus((prev)=>({ 415 ...prev, 416 isLoading: true 417 })); 418 try { 419 var _process_env_NEXT_PUBLIC_NODE_ENV; 420 const nodeEnv = (_process_env_NEXT_PUBLIC_NODE_ENV = "prod") !== null && _process_env_NEXT_PUBLIC_NODE_ENV !== void 0 ? _process_env_NEXT_PUBLIC_NODE_ENV : ""; 421 const isLiveEnvironment = ENV.includes(nodeEnv); 422 const fastlane = await (0,_adyen_adyen_web__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)({ 423 clientKey: _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_2__.nextAppEnv.adyen.clientKey, 424 environment: isLiveEnvironment ? FASTLANE_ENV.LIVE : FASTLANE_ENV.TEST, 425 // Force signup form display for testing (remove when going live) 426 forceConsentDetails: !isLiveEnvironment 427 }); 428 setStatus((prev)=>({ 429 ...prev, 430 isLoading: false, 431 isInitialized: true 432 })); 433 return fastlane; 434 } catch (error) { 435 setStatus((prev)=>({ 436 ...prev, 437 isLoading: false 438 })); 439 console.error("Error initializing Fastlane:", error); 440 return null; 441 } 442 }, []); 443 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{ 444 const setupFastlane = async ()=>{ 445 if (!IS_FASTLANE_ENABLED) return; 446 const fastlane = await initFastlane(); 447 if (fastlane) { 448 try { 449 if (Object.keys(fastlane).length > 0) { 450 dispatch((0,_Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_6__/* .setFastlaneData */ .oD)(fastlane)); 451 // await fastlane.mountWatermark('#watermark-container'); //NOTE: Uncomment if want to enable Fastlane brand water-mark below the email Field 452 setFastlaneObj(fastlane); 453 } else { 454 setFastlaneObj(null); 455 } 456 } catch (error) { 457 console.error("Error in Fastlane setup:", error); 458 setFastlaneObj(null); 459 } 460 } 461 }; 462 setupFastlane(); 463 }, [ 464 initFastlane, 465 dispatch, 466 IS_FASTLANE_ENABLED 467 ]); 468 /** 469 * Validates the provided email address with the Fastlane service and updates the application state accordingly. 470 * 471 * This function attempts to authenticate the user via Fastlane using the provided email address. 472 * - If authentication succeeds or the user is not found, it fetches the Fastlane component configuration,
473 * updates the telephone number if available, stores the Fastlane configuration, and updates the Redux store. 474 * - If authentication is canceled or fails, it stores the failed Fastlane configuration. 475 * - If authentication succeeds, it maps the Fastlane shipping address to billing and shipping addresses, 476 * updates the zipcode, and dispatches the new addresses to the Redux store. 477 * - If authentication fails for any other reason, it falls back to setting a default shipping address. 478 * 479 * @param {string} email - The email address to validate with Fastlane. 480 * @returns {Promise<void>} A promise that resolves when the validation and state updates are complete. 481 */ const validateFastLaneEmail = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(async (email)=>{ 482 if (!fastlaneObj || !email) { 483 console.warn("Fastlane object or email is missing"); 484 return; 485 } 486 /** 487 * Fallback handler for Fastlane authentication failure. 488 * Sets the default shipping address with the provided email and resets the billing address. 489 * 490 * @param {Object} params 491 * @param {string} params.email - The email address to use for the default shipping address. 492 */ const handleFastlaneFallback = (param)=>{ 493 let { email } = param; 494 const defaultShippingAddress = { 495 ..._Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .initialShippingAddress */ ._7, 496 email 497 }; 498 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setShippingAddress */ .nc)(defaultShippingAddress)); 499 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .resetBillingAddress */ .Q)()); 500 }; 501 try { 502 const authResult = await fastlaneObj.authenticate(email); 503 dispatch((0,_Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_6__/* .setFastlaneAuthData */ .Aq)(authResult)); 504 if (authResult.authenticationState === "succeeded" || authResult.authenticationState === "not_found") { 505 const { paymentType, configuration } = await fastlaneObj.getComponentConfiguration(authResult); 506 // Add telephone number if available from shipping address 507 if ((shippingAddress === null || shippingAddress === void 0 ? void 0 : shippingAddress.phone) && configuration && "fastlaneConfiguration" in configuration && configuration.fastlaneConfiguration) { 508 configuration.fastlaneConfiguration.telephoneNumber = String(shippingAddress.phone); 509 } 510 const fastlaneConfig = { 511 fastlaneInstance: fastlaneObj, 512 fastlaneAuthData: authResult, 513 guestUserEmail: email, 514 fastlaneCardsConfig: { 515 paymentType: paymentType, 516 configuration: configuration 517 } 518 }; 519 setUserFastlaneConfig(fastlaneConfig); 520 dispatch((0,_Lib_store_paymentSlice__WEBPACK_IMPORTED_MODULE_6__/* .setFastlaneUserData */ .Fe)({ 521 email, 522 paymentType, 523 configuration 524 })); 525 } else if (authResult.authenticationState === "canceled" || authResult.authenticationState === "failed") { 526 setUserFastlaneConfig({ 527 fastlaneAuthData: authResult, 528 guestUserEmail: email 529 }); 530 } 531 if (authResult.authenticationState === "succeeded") { 532 var _authResult_profileData; 533 const billingAddress = (0,_Lib_utils_fastlane__WEBPACK_IMPORTED_MODULE_11__/* .mapFastlaneToAddress */ .v)(authResult === null || authResult === void 0 ? void 0 : (_authResult_profileData = authResult.profileData) === null || _authResult_profileData === void 0 ? void 0 : _authResult_profileData.shippingAddress); 534 const shippingAddress = { 535 ...billingAddress, 536 email 537 }; 538 handleSubmitZipcode(billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.postalCode); //NOTE: Update zipcode ahead of delivery methods so if user selects pickup we should fetch updated stores. 539 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setShippingAddress */ .nc)(shippingAddress)); 540 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setBillingAddress */ .wC)(billingAddress)); 541 } else { 542 handleFastlaneFallback({ 543 email 544 }); 545 console.log("Authentication failed: ", authResult); 546 } 547 } catch (error) { 548 handleFastlaneFallback({ 549 email 550 }); 551 console.error("Error during Fastlane authentication:", error); 552 } 553 }, [ 554 fastlaneObj, 555 dispatch, 556 shippingAddress, 557 handleSubmitZipcode 558 ]); 559 /** 560 * Stores the provided Fastlane configuration in session storage. 561 * 562 * @param {FastlaneConfig} fastlaneConfig - The Fastlane configuration object to be saved. 563 */ const setUserFastlaneConfig = (fastlaneConfig)=>{ 564 const fastlaneConfigData = JSON.stringify(fastlaneConfig); 565 (0,_Lib_utils_browserStorage__WEBPACK_IMPORTED_MODULE_7__/* .setItem */ .LS)(_wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG, fastlaneConfigData, _wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_TYPES.SESSION); 566 }; 567 /** 568 * Retrieves the Fastlane configuration object from session storage. 569 * 570 * This function attempts to fetch and parse the Fastlane configuration 571 * stored under the STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG key in session storage. 572 * If the item does not exist or cannot be parsed, it returns null. 573 * 574 * @returns {FastlaneConfig | null} The parsed Fastlane configuration object, or null if not found or parsing fails. 575 */ const getUserFastlaneConfig = ()=>{ 576 const deserializeData = (0,_Lib_utils_browserStorage__WEBPACK_IMPORTED_MODULE_7__/* .getItem */ .rV)(_wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG, _wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_TYPES.SESSION); 577 if (!deserializeData) { 578 console.warn('Item with key "'.concat(_wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG, '" does not exist in storage.')); 579 return null; 580 } 581 try { 582 // Assuming the stored item is JSON-stringified and needs to be parsed 583 return JSON.parse(deserializeData); 584 } catch (error) { 585 console.error('Error parsing item with key "'.concat(_wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG, '" from storage.'), error); 586 return null; 587 } 588 }; 589 /** 590 * Removes the Fastlane configuration object from session storage. 591 * 592 * This function deletes the Fastlane configuration stored under the 593 * STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG key in session storage. 594 */ const removeUserFastlaneConfig = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(()=>{ 595 (0,_Lib_utils_browserStorage__WEBPACK_IMPORTED_MODULE_7__/* .removeItem */ .cl)(_wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_KEYS.CUSTOMER_FASTLANE_CONFIG, _wildfork_commercetools_core_ui_dist_src_lib_constants_storage__WEBPACK_IMPORTED_MODULE_1__.STORAGE_TYPES.SESSION); 596 }, []); 597 /** 598 * Handles the Fastlane address change process. 599 * 600 * This function initializes the Fastlane instance and prompts the user to select a shipping address 601 * using the Fastlane address selector. If a valid address is selected, it maps the selected address 602 * to the application's billing and shipping address formats, updates the Redux store with the new 603 * addresses, and sets the user contact handler for shipping. It also updates the Fastlane configuration 604 * in session storage if the address selection has changed. 605 * 606 * Steps: 607 * 1. Initializes Fastlane and ensures it is available. 608 * 2. Retrieves the current Fastlane configuration from session storage. 609 * 3. Prompts the user to select a shipping address via Fastlane. 610 * 4. Validates the selected address. 611 * 5. Maps the selected address to billing and shipping address formats. 612 * 6. Submits the postal code for validation or further processing. 613 * 7. Updates the Redux store with the new shipping and billing addresses. 614 * 8. Sets the user contact handler for the shipping address. 615 * 9. If the address selection has changed, updates the Fastlane configuration in session storage. 616 * 617 * @async 618 * @returns {Promise<void>} Resolves when the address change process is complete. 619 */ const handleFastlaneAddressChange = async ()=>{ 620 try { 621 var _existingConfig_fastlaneAuthData; 622 const fastlane = await initFastlane(); 623 if (!fastlane || Object.keys(fastlane).length === 0) return; 624 const existingConfig = getUserFastlaneConfig(); 625 const { selectedAddress, selectionChanged } = await fastlane.showShippingAddressSelector(); 626 if (!selectedAddress || Object.keys(selectedAddress).length === 0) { 627 console.error("No address selected"); 628 return; 629 } 630 const billingAddress = (0,_Lib_utils_fastlane__WEBPACK_IMPORTED_MODULE_11__/* .mapFastlaneToAddress */ .v)(selectedAddress); 631 const shippingAddress = { 632 ...billingAddress, 633 email: (existingConfig === null || existingConfig === void 0 ? void 0 : existingConfig.guestUserEmail) || "" 634 }; 635 handleSubmitZipcode(billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.postalCode); 636 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setShippingAddress */ .nc)(shippingAddress)); 637 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setBillingAddress */ .wC)(billingAddress)); 638 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .addShippingAddress */ .VE)({ 639 data: shippingAddress, 640 defaultAddress: true 641 })); // NOTE: Update shipping address to the Cart API 642 setUserContactHandler(shippingAddress, _lib_constants_common__WEBPACK_IMPORTED_MODULE_8__/* .USER_CONTACT_FORM_TYPE */ .Hh.SHIPPING); //NOTE: Instantly set address to shipping address form 643 if (selectionChanged && (existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig_fastlaneAuthData = existingConfig.fastlaneAuthData) === null || _existingConfig_fastlaneAuthData === void 0 ? void 0 : _existingConfig_fastlaneAuthData.profileData)) { 644 existingConfig.fastlaneAuthData.profileData.shippingAddress = selectedAddress; 645 existingConfig.selectionChanged = selectionChanged; 646 setUserFastlaneConfig(existingConfig); 647 } 648 } catch (error) { 649 await authenticateFastlaneEmail(); 650 console.error(error); 651 } 652 }; 653 /** 654 * Authenticates the user with Fastlane using the guest user's email. 655 * 656 * This function initializes the Fastlane instance and attempts to authenticate 657 * the user based on the email stored in the Fastlane user configuration. 658 * If the email is present, it calls the Fastlane authenticate method and logs the result. 659 * If the email is missing, it logs a warning. 660 * Any errors encountered during the process are caught and logged as errors. 661 * 662 * @async 663 * @returns {Promise<void>} Resolves when the authentication process is complete. 664 */ const authenticateFastlaneEmail = async ()=>{ 665 try { 666 const fastlane = await initFastlane(); 667 const { guestUserEmail: email } = getUserFastlaneConfig() || {}; // Destructure with fallback 668 if (email) { 669 await (fastlane === null || fastlane === void 0 ? void 0 : fastlane.authenticate(email)); 670 } else { 671 console.warn("No guestUserEmail found for Fastlane authentication."); 672 } 673 } catch (error) { 674 console.error("Error during Fastlane authentication:", error); 675 } 676 }; 677 return { 678 fastlaneObj, 679 validateFastLaneEmail, 680 IS_FASTLANE_ENABLED, 681 setUserFastlaneConfig, 682 getUserFastlaneConfig, 683 removeUserFastlaneConfig, 684 initFastlane, 685 status, 686 handleFastlaneAddressChange, 687 authenticateFastlaneEmail 688 }; 689}; 690 691 692/***/ }), 693 694/***/ 453659: 695/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 696 697"use strict"; 698 699// EXPORTS 700__webpack_require__.d(__webpack_exports__, { 701 V: function() { return /* binding */ NextUSApp; } 702}); 703 704// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js 705var jsx_runtime = __webpack_require__(785893); 706// EXTERNAL MODULE: ./node_modules/next/dynamic.js 707var dynamic = __webpack_require__(505152); 708var dynamic_default = /*#__PURE__*/__webpack_require__.n(dynamic); 709// EXTERNAL MODULE: ./node_modules/react/index.js 710var react = __webpack_require__(667294); 711// EXTERNAL MODULE: ./node_modules/next/navigation.js 712var navigation = __webpack_require__(339332); 713// EXTERNAL MODULE: ./src/lib/hooks/index.ts + 13 modules 714var hooks = __webpack_require__(130414); 715;
715// CONCATENATED MODULE: ./src/components/account/hooks/useRedirect.ts 716 717 718 719/** 720 * Custom hook to handle redirecting a logged-in user to a specific page after login. 721 */ const useRedirect = ()=>{ 722 const { isLoggedIn } = (0,hooks/* useCustomer */.ON)(); 723 const router = (0,navigation.useRouter)(); 724 (0,react.useEffect)(()=>{ 725 if (!isLoggedIn) return; 726 const redirectParam = new URLSearchParams(window.location.search).get("redirect"); 727 if (redirectParam === "/account/?tab=orders") { 728 router.replace(redirectParam); 729 } 730 }, [ 731 isLoggedIn, 732 router 733 ]); 734}; 735 736// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/constants/storage.js 737var storage = __webpack_require__(692521); 738// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/hooks/useRouteChange.js 739var useRouteChange = __webpack_require__(723484); 740// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/Logger.js 741var Logger = __webpack_require__(101914); 742var Logger_default = /*#__PURE__*/__webpack_require__.n(Logger); 743// EXTERNAL MODULE: ./src/api/dynamicYield/dynamicYieldApi.ts 744var dynamicYieldApi = __webpack_require__(59111); 745// EXTERNAL MODULE: ./src/lib/dynamic-yield/dynamicYield.ts + 1 modules 746var dynamicYield = __webpack_require__(85325); 747// EXTERNAL MODULE: ./src/lib/store/cartSlice.ts + 1 modules 748var cartSlice = __webpack_require__(484725); 749// EXTERNAL MODULE: ./src/components/account/hooks/useCustomerOrders.ts 750var useCustomerOrders = __webpack_require__(896212); 751// EXTERNAL MODULE: ./src/lib/hooks/useActionBasedOnStorage.ts 752var useActionBasedOnStorage = __webpack_require__(170077); 753// EXTERNAL MODULE: ./src/lib/hooks/useExclusiveOfferModal.ts 754var useExclusiveOfferModal = __webpack_require__(71037); 755// EXTERNAL MODULE: ./src/lib/hooks/useGTMConsentAndUserId.ts 756var useGTMConsentAndUserId = __webpack_require__(926265); 757// EXTERNAL MODULE: ./src/lib/hooks/useMobileViewFromQueryParam.ts 758var useMobileViewFromQueryParam = __webpack_require__(196767); 759// EXTERNAL MODULE: ./src/lib/hooks/useUserAnalytics.ts 760var useUserAnalytics = __webpack_require__(173959); 761// EXTERNAL MODULE: ./src/lib/hooks/useZipCode.ts 762var useZipCode = __webpack_require__(455489); 763// EXTERNAL MODULE: ./src/lib/store/asyncStorageSlice.ts 764var asyncStorageSlice = __webpack_require__(202579); 765// EXTERNAL MODULE: ./src/lib/store/hooks.ts 766var store_hooks = __webpack_require__(267097); 767// EXTERNAL MODULE: ./src/lib/utils/cookies.ts 768var cookies = __webpack_require__(701636); 769// EXTERNAL MODULE: ./src/lib/utils/dynamic-yield.ts 770var dynamic_yield = __webpack_require__(804546); 771;// CONCATENATED MODULE: ./src/components/AppGate/index.tsx 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792const AppGate = (props)=>{ 793 const dispatch = (0,store_hooks/* useAppDispatch */.T)(); 794 const { storeId } = (0,store_hooks/* useAppSelector */.C)(cartSlice/* cartSliceSelector */.Ew); 795 const { getCustomerDetailsIfLoggedIn, customerInfo: { customerInfoRequested } } = (0,hooks/* useCustomer */.ON)(); 796 const { getMyOrders } = (0,useCustomerOrders/* useCustomerOrders */.P)(); 797 (0,react.useEffect)(()=>{ 798 var _window_DY, _window; 799 if (!storeId) return; 800 const currentPageDYContext = (_window = window) === null || _window === void 0 ? void 0 : (_window_DY = _window.DY) === null || _window_DY === void 0 ? void 0 : _window_DY.recommendationContext; 801 if (currentPageDYContext === null || currentPageDYContext === void 0 ? void 0 : currentPageDYContext.type) { 802 (0,dynamicYield/* setDYContext */.al)(currentPageDYContext.type, currentPageDYContext.data); 803 } 804 }, [ 805 storeId 806 ]); 807 (0,useGTMConsentAndUserId/* default */.Z)(); 808 (0,useMobileViewFromQueryParam/* default */.Z)(); 809 (0,useUserAnalytics/* useUserAnalytics */.i)(); 810 const { pagesVisitedCounter } = (0,useExclusiveOfferModal/* useExclusiveOfferModal */.y)(); 811 (0,react.useEffect)(()=>{ 812 getCustomerDetailsIfLoggedIn(); 813 }, [ 814 dispatch, 815 getCustomerDetailsIfLoggedIn 816 ]); 817 (0,react.useEffect)(()=>{ 818 if (customerInfoRequested) { 819 getMyOrders(true); 820 } 821 }, [ 822 customerInfoRequested, 823 getMyOrders 824 ]); 825 (0,useRouteChange.useRouteChange)({ 826 callback: pagesVisitedCounter, 827 routeEvent: "routeChangeStart" 828 }); 829 (0,hooks/* useCallbackFromQueryParam */.a5)({ 830 queryParamKey: "dyid", 831 callback: dynamic_yield/* dyCreateDyidServerCookie */.jK 832 }); 833 (0,hooks/* useCallbackFromQueryParamConditional */.Mu)({ 834 queryParamKey: storage.COOKIE_KEYS.DY_MEMBER_REDIRECT, 835 queryParamRequiredValue: "true", 836 callback: (0,react.useCallback)((val)=>{ 837 (0,dynamicYieldApi/* getDyMemberRedirectCookie */.iM)().then(()=>{ 838 const memberRedirectCookie = (0,cookies/* getCookie */.ej)(storage.COOKIE_KEYS.DY_MEMBER_REDIRECT); 839 if (memberRedirectCookie) { 840 // if the cookie merely exists, then set it in redux 841 dispatch((0,asyncStorageSlice/* setCookieDyMemberRedirect */.pR)(val)); 842 } 843 }).catch((err)=>{ 844 Logger_default().error("There was an error generating the member-redirect cookie on the server", err); 845 }); 846 }, [ 847 dispatch 848 ]) 849 }); 850 (0,hooks/* useFreshChat */.Uj)(); 851 (0,hooks/* useDomain */.ay)(); 852 (0,hooks/* useLocale */.bU)(); 853 (0,hooks/* useRouteRedirect */.C2)(); 854 // Must run before useStoreFulfillment: it dispatches the boot cart fetch,
855 // which reads the region from Redux with no cookie fallback. If Redux 856 // isn't hydrated from the region cookie yet, that fetch goes out with no 857 // region header and the cart is priced at the default region. 858 (0,useZipCode/* useSetRegionIdFromCookie */.Gd)(); 859 (0,hooks/* useStoreFulfillment */.uN)(); 860 (0,hooks/* useMembership */.e7)(); 861 (0,hooks/* useCookieFromQueryParam */.Gi)({ 862 queryParamKey: "Welcome" 863 }); 864 (0,hooks/* useCookieFromQueryParamConditional */.Jd)({ 865 queryParamKey: "password", 866 queryParamRequiredValue: "wildfork123", 867 cookieName: "darksite", 868 requiredCookieValue: "true" 869 }); 870 (0,hooks/* useCookieFromQueryParamConditional */.Jd)({ 871 queryParamKey: "app", 872 queryParamRequiredValue: "ios", 873 cookieName: storage.COOKIE_KEYS.APP, 874 requiredCookieValue: "ios", 875 cookieOptions: { 876 expires: 400 877 }, 878 isQueryParamCaseInsensitive: true 879 }); 880 (0,hooks/* useCookieFromQueryParamConditional */.Jd)({ 881 queryParamKey: "app", 882 queryParamRequiredValue: "android", 883 cookieName: storage.COOKIE_KEYS.APP, 884 requiredCookieValue: "android", 885 cookieOptions: { 886 expires: 400 887 }, 888 isQueryParamCaseInsensitive: true 889 }); 890 (0,useActionBasedOnStorage/* useCallbackFromCookie */.Bl)({ 891 cookieName: storage.COOKIE_KEYS.DY_MEMBER_REDIRECT, 892 callback: (0,react.useCallback)((val)=>{ 893 dispatch((0,asyncStorageSlice/* setCookieDyMemberRedirect */.pR)(val)); 894 }, [ 895 dispatch 896 ]) 897 }); 898 (0,useActionBasedOnStorage/* useDispatchStoreIdFromStorage */.YI)(); 899 return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, { 900 children: props.children 901 }); 902}; 903/* harmony default export */ var components_AppGate = (AppGate); 904 905// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs 906var clsx = __webpack_require__(490512); 907// EXTERNAL MODULE: ./src/lib/store/environmentSlice.ts 908var environmentSlice = __webpack_require__(221473); 909// EXTERNAL MODULE: ./src/components/AppVersion/AppVersion.module.scss 910var AppVersion_module = __webpack_require__(981083); 911var AppVersion_module_default = /*#__PURE__*/__webpack_require__.n(AppVersion_module); 912// EXTERNAL MODULE: ./package.json 913var package_0 = __webpack_require__(204147); 914;// CONCATENATED MODULE: ./src/components/AppVersion/index.tsx 915 916 917 918 919 920 921 922const AppVersion = ()=>{ 923 const { localDevOrQaDomain } = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* environmentSelector */.uv); 924 const pathname = (0,navigation.usePathname)(); 925 return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { 926 className: (0,clsx/* default */.Z)(localDevOrQaDomain ? (AppVersion_module_default()).app__container__dev : (AppVersion_module_default()).app__container, (pathname === null || pathname === void 0 ? void 0 : pathname.startsWith("/products")) ? (AppVersion_module_default()).mb__76px : ""), 927 "data-testid": "app-version-container", 928 children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", { 929 className: (AppVersion_module_default()).app__version, 930 "data-testid": "app-version-container__number", 931 children: [ 932 /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { 933 children: "next-us: ".concat(package_0/* version */.i8) 934 }), 935 /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { 936 children: "core-ui: ".concat(package_0/* devDependencies.@wildfork/commercetools-core-ui */.v6.g) 937 }) 938 ] 939 }) 940 }); 941}; 942/* harmony default export */ var components_AppVersion = (AppVersion); 943 944// EXTERNAL MODULE: ./src/components/providers/context/app/PreviousPathContextProvider.tsx 945var PreviousPathContextProvider = __webpack_require__(713402); 946// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/constants/locale.js 947var locale = __webpack_require__(808439); 948// EXTERNAL MODULE: ./node_modules/next/script.js 949var script = __webpack_require__(304298); 950var script_default = /*#__PURE__*/__webpack_require__.n(script); 951// EXTERNAL MODULE: ./src/lib/constants/common.ts 952var common = __webpack_require__(339114); 953// EXTERNAL MODULE: ./src/lib/configs/environment.ts 954var environment = __webpack_require__(208891); 955// EXTERNAL MODULE: ./src/api/constants/RestEndpoints.ts 956var RestEndpoints = __webpack_require__(179901); 957;// CONCATENATED MODULE: ./src/components/scripts/AppScripts.tsx 958 959 960 961 962 963 964 965 966const AppScripts = ()=>{ 967 var _nextAppEnv_freshDesk_token; 968 const chatBotToken = (_nextAppEnv_freshDesk_token = environment.nextAppEnv.freshDesk.token) !== null && _nextAppEnv_freshDesk_token !== void 0 ? _nextAppEnv_freshDesk_token : ""; 969 /** 970 * GTM Scripts removed from QA and DEV for CA only 971 * GTM Script availability solely depends on the key 972 */ const isGTMScriptsDisabledInDEVAndQAForUS = environment.nextAppEnv.feature_toggle.US.gtm_scripts === "true" ? true : false;
973 const hotjarId = environment.nextAppEnv.hotjar.hjid || ""; 974 const googleMapsApiKey = environment.nextAppEnv.googleMaps.apiKey || ""; 975 const googleMapsApiJs = RestEndpoints/* default */.Z.GOOGLE_MAPS || ""; 976 return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { 977 children: [ 978 /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 979 id: "google-maps", 980 src: "".concat(googleMapsApiJs, "?key=").concat(googleMapsApiKey, "&libraries=places&v=weekly&loading=async"), 981 onLoad: ()=>{ 982 window.initGoogleMapsLoaded = true; 983 window.dispatchEvent(new Event(common/* GOOGLE_MAPS_LOADED_EVENT */.I9)); 984 }, 985 strategy: "afterInteractive" 986 }), 987 /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 988 id: "freshchat-js-sdk", 989 src: "https://wchat.freshchat.com/js/widget.js", 990 strategy: "afterInteractive", 991 onLoad: ()=>{ 992 window.fcWidget.init({ 993 token: chatBotToken, 994 host: "https://wchat.freshchat.com" 995 }); 996 } 997 }), 998 !isGTMScriptsDisabledInDEVAndQAForUS && /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, { 999 children: /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 1000 id: "google-analytics", 1001 strategy: "afterInteractive", 1002 children: "\n (function(w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({\n 'gtm.start': new Date().getTime(),\n event: 'gtm.js'\n });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s);\n j.async = true;\n j.src = \"https://load.growth.wildforkfoods.com/dhfabcgcuhttl.js?\" + i;\n f.parentNode.insertBefore(j, f);\n })(window, document, 'script', 'dataLayer', '4hhcj=BRBJLyEuSjc9IiM4IylBFVFGWllTBwleGx0YDBMMFQgKGxsMBk0EDAE%3D');\n " 1003 }) 1004 }), 1005 !!hotjarId && /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 1006 id: "hotjar", 1007 strategy: "afterInteractive", 1008 dangerouslySetInnerHTML: { 1009 __html: "\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:".concat(hotjarId, ",hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=true;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n ") 1010 } 1011 }), 1012 locale.isCALocale && /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 1013 async: true, 1014 type: "text/javascript", 1015 src: "".concat(RestEndpoints/* default */.Z.KLAVIYO.SCRIPT_URL, "?company_id=").concat(environment.nextAppEnv.klaviyo.token), 1016 onError: (error)=>{ 1017 Logger_default().error("Failed to load Klaviyo script", error); 1018 throw new Error("Failed to load Klaviyo script"); 1019 } 1020 }), 1021 /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 1022 src: "https://cdn-widgetsrepository.yotpo.com/v1/loader/u6R1BT7uuR7gM71VstsTHB1tUm0eKn8vJpEvAAp3", 1023 strategy: "lazyOnload" 1024 }) 1025 ] 1026 }); 1027}; 1028 1029;// CONCATENATED MODULE: ./src/components/scripts/KioskGoogleTranslate.tsx 1030 1031 1032 1033 1034 1035const { apiKey } = environment.nextAppEnv.weglot; 1036const KioskGoogleTranslate = ()=>{ 1037 const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_); 1038 if (!isKioskVisitor) return null; 1039 return /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 1040 src: "https://cdn.weglot.com/weglot.min.js", 1041 onLoad: ()=>{ 1042 var _window_Weglot, _window; 1043 return (_window = window) === null || _window === void 0 ? void 0 : (_window_Weglot = _window.Weglot) === null || _window_Weglot === void 0 ? void 0 : _window_Weglot.initialize({ 1044 api_key: apiKey 1045 }); 1046 }, 1047 strategy: "lazyOnload" 1048 }); 1049}; 1050 1051// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/
1051atoms/Snackbar/Snackbar.js 1052var Snackbar = __webpack_require__(990598); 1053// EXTERNAL MODULE: ./src/lib/hooks/useSnackbar.ts 1054var useSnackbar = __webpack_require__(986328); 1055;// CONCATENATED MODULE: ./src/components/ui/snackbarContainer/SnackbarContainer.tsx 1056 1057 1058 1059const SnackBarContainer = ()=>{ 1060 const props = (0,useSnackbar/* useSnackbar */.D)(); 1061 return /*#__PURE__*/ (0,jsx_runtime.jsx)(Snackbar.Snackbar, { 1062 ...props 1063 }); 1064}; 1065 1066// EXTERNAL MODULE: ./src/lib/hooks/useContentfulLivePreview.ts 1067var useContentfulLivePreview = __webpack_require__(835656); 1068// EXTERNAL MODULE: ./src/lib/store/uiStateSlice.ts 1069var uiStateSlice = __webpack_require__(647771); 1070;// CONCATENATED MODULE: ./src/components/app/NextUSApp.tsx 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084const ProductInventoryValidation = dynamic_default()(()=>__webpack_require__.e(/* import() */ 1798).then(__webpack_require__.bind(__webpack_require__, 831798)), { 1085 loadableGenerated: { 1086 webpack: ()=>[ 1087 /*require.resolve*/(831798) 1088 ] 1089 }, 1090 ssr: false 1091}); 1092const ModalSessionExpiredContainer = dynamic_default()(()=>Promise.all(/* import() */[__webpack_require__.e(7987), __webpack_require__.e(6855)]).then(__webpack_require__.bind(__webpack_require__, 663784)).then((mod)=>mod.ModalSessionExpiredContainer), { 1093 loadableGenerated: { 1094 webpack: ()=>[ 1095 /*require.resolve*/(663784) 1096 ] 1097 }, 1098 ssr: false 1099}); 1100const VerificationSuccessModalContainer = dynamic_default()(()=>Promise.all(/* import() */[__webpack_require__.e(8075), __webpack_require__.e(8867), __webpack_require__.e(3153), __webpack_require__.e(3949), __webpack_require__.e(3326), __webpack_require__.e(6382), __webpack_require__.e(68), __webpack_require__.e(4772), __webpack_require__.e(3804)]).then(__webpack_require__.bind(__webpack_require__, 123804)).then((mod)=>mod.VerificationSuccessModalContainer), { 1101 loadableGenerated: { 1102 webpack: ()=>[ 1103 /*require.resolve*/(123804) 1104 ] 1105 }, 1106 ssr: false 1107}); 1108const ContentfulLivePreviewAppWrapper = dynamic_default()(()=>Promise.all(/* import() */[__webpack_require__.e(3590), __webpack_require__.e(7479)]).then(__webpack_require__.bind(__webpack_require__, 647479)).then((mod)=>mod.ContentfulLivePreviewAppWrapper), { 1109 loadableGenerated: { 1110 webpack: ()=>[ 1111 /*require.resolve*/(647479) 1112 ] 1113 }, 1114 ssr: false 1115}); 1116const NextUSApp = (appProps)=>{ 1117 var _appProps_pageProps_data, _appProps_pageProps; 1118 useRedirect(); //NOTE: This is to redirect user If user logins and send back to the origin URI 1119 const enableLivePreview = (0,useContentfulLivePreview/* useContentfulLivePreview */.c)({ 1120 isLivePreviewEnabled: appProps === null || appProps === void 0 ? void 0 : (_appProps_pageProps = appProps.pageProps) === null || _appProps_pageProps === void 0 ? void 0 : (_appProps_pageProps_data = _appProps_pageProps.data) === null || _appProps_pageProps_data === void 0 ? void 0 : _appProps_pageProps_data.isLivePreviewEnabled 1121 }); 1122 if (enableLivePreview) { 1123 return /*#__PURE__*/ (0,jsx_runtime.jsx)(ContentfulLivePreviewAppWrapper, { 1124 children: /*#__PURE__*/ (0,jsx_runtime.jsx)(App, { 1125 ...appProps 1126 }) 1127 }); 1128 } 1129 return /*#__PURE__*/ (0,jsx_runtime.jsx)(App, { 1130 ...appProps 1131 }); 1132}; 1133const App = (param)=>{ 1134 let { Component, pageProps } = param; 1135 const isMobileViewFromQueryParamOrCookie = (0,store_hooks/* useAppSelector */.C)(uiStateSlice/* isMobileViewFromQueryParamOrCookieSelector */.$k); 1136 return /*#__PURE__*/ (0,jsx_runtime.jsxs)(components_AppGate, { 1137 children: [ 1138 /*#__PURE__*/ (0,jsx_runtime.jsx)(PreviousPathContextProvider/* PreviousPathProvider */.x, { 1139 children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Component, { 1140 ...pageProps 1141 }) 1142 }), 1143 /*#__PURE__*/ (0,jsx_runtime.jsx)(AppScripts, {}), 1144 /*#__PURE__*/ (0,jsx_runtime.jsx)(KioskGoogleTranslate, {}), 1145 /*#__PURE__*/ (0,jsx_runtime.jsx)(components_AppVersion, {}), 1146 /*#__PURE__*/ (0,jsx_runtime.jsx)(SnackBarContainer, {}), 1147 !isMobileViewFromQueryParamOrCookie && environment.nextAppEnv.feature_toggle.US.isSessionExpiredModalEnabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(ModalSessionExpiredContainer, {}), 1148 /*#__PURE__*/ (0,jsx_runtime.jsx)(ProductInventoryValidation, {}), 1149 environment.nextAppEnv.feature_toggle.US.isEmailVerificationModalEnabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(VerificationSuccessModalContainer, {}) 1150 ] 1151 }); 1152}; 1153 1154 1155/***/ }), 1156 1157/***/ 672311: 1158/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1159 1160"use strict"; 1161/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1162/* harmony export */ AJ: function() { return /* binding */ FULFILLMENT_TYPES; }, 1163/* harmony export */ C1: function() { return /* binding */ doesFulfillmentTypeExcludeTimeOptions; }, 1164/* harmony export */ Cw: function() { return /* binding */ transformDbResponseForDeliveryPresentation; }, 1165/* harmony export */ xW: function() { return /* binding */ isWindowExpired; } 1166/* harmony export */ }); 1167/* unused harmony export sortDeliveryDates */ 1168/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(940024); 1169/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__); 1170/* harmony import */ var _Constants_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(339114); 1171/* harmony import */ var _Lib_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(367760); 1172/* harmony import */ var _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(512085); 1173 1174 1175 1176 1177const FULFILLMENT_TYPES = { 1178 AIR: "air", 1179 LOCAL: "local", 1180 IN_STORE: "in-store", 1181 GROUND: "ground", 1182 ZOAD: "ZOAD", 1183 ZOAS: "ZOAS" 1184}; 1185const sortDeliveryDates = (deliveryDates)=>{ 1186 const unsorted = [ 1187 ...deliveryDates 1188 ]; 1189 return (unsorted || []).sort((left, right)=>{ 1190 const leftStart = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(left.startTime).toDate().getTime(); 1191 const rightStart = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(right.startTime).toDate().getTime(); 1192 return leftStart - rightStart; 1193 }); 1194}; 1195const doesFulfillmentTypeExcludeTimeOptions = (fulfillmentType)=>{ 1196 let fulfillmentTypeExcludesTimeOptions; 1197 switch(fulfillmentType){ 1198 case FULFILLMENT_TYPES.IN_STORE: 1199 case FULFILLMENT_TYPES.LOCAL: 1200 case FULFILLMENT_TYPES.ZOAD: 1201 case FULFILLMENT_TYPES.ZOAS: 1202 fulfillmentTypeExcludesTimeOptions = false;
1203 break; 1204 case FULFILLMENT_TYPES.GROUND: 1205 case FULFILLMENT_TYPES.AIR: 1206 default: 1207 fulfillmentTypeExcludesTimeOptions = true; 1208 break; 1209 } 1210 return fulfillmentTypeExcludesTimeOptions; 1211}; 1212const dataRenderControllerForTime = (param, languageCode)=>{ 1213 let { Id, deliveryDate, startDate, isAvailable, isExpired, endDate, todaysDate, expiration, isSelected } = param; 1214 const differenceInHours = endDate.diff(startDate, "hours"); 1215 // we only care about rendering the time window if it is within a 24 hour timespan 1216 const localTimeZone = _Lib_store__WEBPACK_IMPORTED_MODULE_2__/* .store */ .h === null || _Lib_store__WEBPACK_IMPORTED_MODULE_2__/* .store */ .h === void 0 ? void 0 : _Lib_store__WEBPACK_IMPORTED_MODULE_2__/* .store */ .h.getState().cart.storeTimeZone; 1217 if (differenceInHours < 24) { 1218 const isFutureDay = (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__.isDayInTheFuture)(todaysDate, startDate); 1219 if (!isExpired && (isAvailable || !isAvailable && !isFutureDay)) { 1220 // the (!isAvailable && !isFutureDay) mean its ok to render it cuz we will disable it 1221 const newWindow = { 1222 id: Id, 1223 from: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__.formatTimeByLocale)(startDate, localTimeZone, languageCode), 1224 to: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__.formatTimeByLocale)(endDate, localTimeZone, languageCode), 1225 expiration, 1226 disabled: !isAvailable, 1227 isSelected: isSelected 1228 }; 1229 deliveryDate.availableTimes.push(newWindow); 1230 } 1231 } 1232}; 1233const dataRenderControllerForDate = (param, languageCode)=>{ 1234 let { Id, deliveryDate, startDate, isAvailable, isExpired } = param; 1235 deliveryDate.id = Id; 1236 deliveryDate.day = (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__.getWeekOrMonthByLocale)(languageCode, startDate.day(), "day"); 1237 deliveryDate.month = (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_0__.getWeekOrMonthByLocale)(languageCode, startDate.month(), "month"); 1238 deliveryDate.date = startDate.date().toString().replace(/^0+/, ""); // remove leading zero 1239 deliveryDate.year = (0,_Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(startDate).get("year"); 1240 deliveryDate.availableTimes = []; 1241 // after the data generation process, if render is false and there are also no availableTimes then we exclude the day from the final result 1242 deliveryDate.render = isAvailable && !isExpired; 1243}; 1244// assumes data is pre-sorted 1245const transformDbResponseForDeliveryPresentation = function(availableWindowsFromDb) { 1246 let languageCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "en-US"; 1247 const sortedDeliveryDates = sortDeliveryDates(availableWindowsFromDb); 1248 const availableDates = []; 1249 if (sortedDeliveryDates.length) { 1250 const DEFAULT_DELIVERY_DATE = { 1251 id: _Constants_common__WEBPACK_IMPORTED_MODULE_1__/* .NEG_1_STR */ .Nn, 1252 day: "", 1253 month: "", 1254 date: "", 1255 year: 0, 1256 render: true, 1257 fulfillmentType: sortedDeliveryDates[0].fulfillmentType, 1258 availableTimes: [] 1259 }; 1260 const todaysDate = (0,_Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(); 1261 let deliveryDate = { 1262 ...DEFAULT_DELIVERY_DATE 1263 }; 1264 // dateInFocus represents the Day we are working with currently 1265 let dateInFocus = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(sortedDeliveryDates[0].startTime); 1266 sortedDeliveryDates.forEach((availableWindowFromDb)=>{ 1267 const Id = availableWindowFromDb.id; 1268 const fulfillmentType = availableWindowFromDb.fulfillmentType; 1269 const startDate = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(availableWindowFromDb.startTime); 1270 const endDate = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(availableWindowFromDb.endTime); 1271 const expirationDate = _Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.unix(availableWindowFromDb.expiration); 1272 const isAvailable = availableWindowFromDb.available; 1273 const isExpired = isWindowExpired(expirationDate, todaysDate); 1274 var _availableWindowFromDb_selectedWindow; 1275 const isSelected = (_availableWindowFromDb_selectedWindow = availableWindowFromDb.selectedWindow) !== null && _availableWindowFromDb_selectedWindow !== void 0 ? _availableWindowFromDb_selectedWindow : false;
1276 // const isExpired = moment(expirationDate).isBefore(todaysDate); // TODO: eventually we can replace above isExpired statement with this one 1277 // if it is a new weekday then this should be a new structure, and we can possibly add the previous structure to the list 1278 // && if there is Day data in the previous structure, then we know that it is relevant so we add it to to the list as a new day 1279 if (!startDate.isSame(dateInFocus, "day") && Boolean(deliveryDate.day)) { 1280 availableDates.push(deliveryDate); // add previously generated data structure to the list 1281 deliveryDate = { 1282 ...DEFAULT_DELIVERY_DATE 1283 }; 1284 dateInFocus = startDate; // new Day we will be focusing on 1285 } 1286 // progress to the stage of adding data to the structure 1287 // first we check if we will be adding "Day" Data or "Time" Data 1288 // if there's not a day yet then its a new structure and we will be adding "Day" data to start 1289 if (!Boolean(deliveryDate.day)) { 1290 dataRenderControllerForDate({ 1291 Id, 1292 deliveryDate, 1293 startDate, 1294 isAvailable, 1295 isExpired 1296 }, languageCode); 1297 } 1298 // now we determine if we will be adding "Time" data (if so, 1st element of time data will be calculated from the same deliveryDate used to start that particular day) 1299 if (!doesFulfillmentTypeExcludeTimeOptions(fulfillmentType)) { 1300 dataRenderControllerForTime({ 1301 Id, 1302 deliveryDate, 1303 startDate, 1304 endDate, 1305 isAvailable, 1306 isExpired, 1307 todaysDate, 1308 expiration: availableWindowFromDb.expiration, 1309 isSelected 1310 }, languageCode); 1311 } 1312 }); 1313 // we are mostly finished but we still need to check if we should add this last structure 1314 // if there is Day data in the last structure we were working with, then it might be relevant to add to the list 1315 // we check if (there are no items in the availableDates list || the item is not a duplicate Day) 1316 if (Boolean(deliveryDate.day) && (!availableDates.length || availableDates[availableDates.length - 1].day !== deliveryDate.day)) { 1317 availableDates.push(deliveryDate); 1318 } 1319 } 1320 return availableDates.filter((availableDate)=>{ 1321 // this particular filter exists because of the way we are setting the render flag 1322 // it is unknown how many elements [from the backend] will be grouped with other elements for an identical day - 1323 // so because there could potentially be multiple available time slots available on one single day with various render flag values 1324 // we only exclude a [deliveryDate with render: false] AFTER the calculation loop is complete; And Only IF it did not collect any availableTimes to go with it 1325 // Because a day that didn't pass our render check (without any availableTimes) => is redundant and can thus be excluded 1326 // conclusion: we exclude dates without availableTimes if that day's render flag was set to false during the data transformation process 1327 return !availableDate.availableTimes.length && availableDate.render === false ? false : true; 1328 }).filter((availableDate)=>{ 1329 var _availableDate_availableTimes, _availableDate_availableTimes1; 1330 // if availableTimes exist (then it is local/pickup), AND if they are all disabled, then exclude that day (emphasis: only when local/pickup), otherwise we render it 1331 return !((_availableDate_availableTimes = availableDate.availableTimes) === null || _availableDate_availableTimes === void 0 ? void 0 : _availableDate_availableTimes.length) || ((_availableDate_availableTimes1 = availableDate.availableTimes) === null || _availableDate_availableTimes1 === void 0 ? void 0 : _availableDate_availableTimes1.length) && !availableDate.availableTimes.every((availableTime)=>{ 1332 return availableTime.disabled === true; 1333 }); 1334 }).map((availableDate)=>{ 1335 var _availableDate_availableTimes; 1336 // remove render field which is no longer needed 1337 delete availableDate.render; 1338 // we also remove an availableTimes element for that day (if it's the only one && it's disabled) so it can't be auto selected 1339 if ((availableDate === null || availableDate === void 0 ? void 0 : (_availableDate_availableTimes = availableDate.availableTimes) === null || _availableDate_availableTimes === void 0 ? void 0 : _availableDate_availableTimes.length) === 1 && availableDate.availableTimes[0].disabled === true) { 1340 availableDate.availableTimes = []; 1341 } 1342 return availableDate; 1343 }); 1344}; 1345const isWindowExpired = function(expirationDate) { 1346 let todaysDate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (0,_Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(); 1347 return true ? (0,_Lib_utils_moment__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(expirationDate).isBefore(todaysDate) : 0; 1348}; 1349 1350 1351/***/ }), 1352 1353/***/ 543467: 1354/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1355 1356"use strict"; 1357/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1358/* harmony export */ LM: function() { return /* binding */ PAYMENT_METHODS; }, 1359/* harmony export */ Vf: function() { return /* binding */ FASTLANE_PAYMENT_METHODS; }, 1360/* harmony export */ mu: function() { return /* binding */ paymentMethodIcons; } 1361/* harmony export */ }); 1362const paymentMethodIcons = { 1363 amex: "amex", 1364 discover: "discover", 1365 diners: "diners", 1366 giftcard: "giftcard", 1367 mc: "mc", 1368 paypal: "paypal", 1369 visa: "visa", 1370 mc_applepay: "applepay", 1371 mc_fastlane: "mc", 1372 visa_fastlane: "visa", 1373 corporate_gift: "corporate_gift", 1374 ebt: "EBT" 1375}; 1376const PAYMENT_METHODS = { 1377 SCHEME: "scheme", 1378 PAYPAL: "paypal", 1379 APPLE_PAY: "applepay", 1380 FASTLANE: "fastlane", 1381 GIFT_CARD: "giftcard", 1382 VENMO: "venmo", 1383 GOOGLE_PAY: "googlepay", 1384 CORPORATE_GIFT: "corporate_gift", 1385 EBT_CARD: "EBT" 1386}; 1387const FASTLANE_PAYMENT_METHODS = [ 1388 "visa_fastlane", 1389 "mc_fastlane" 1390]; 1391 1392 1393/***/ }), 1394 1395/***/ 701119: 1396/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1397 1398"use strict"; 1399/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1400/* harmony export */ C: function() { return /* reexport safe */ _payment__WEBPACK_IMPORTED_MODULE_0__.C; }, 1401/* harmony export */ K: function() { return /* reexport safe */ _payment__WEBPACK_IMPORTED_MODULE_0__.K; } 1402/* harmony export */ }); 1403/* harmony import */ var _payment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11166); 1404 1405 1406 1407/***/ }), 1408 1409/***/ 11166:
1410/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1411 1412"use strict"; 1413/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1414/* harmony export */ C: function() { return /* binding */ GIFT_CARD_STATE; }, 1415/* harmony export */ K: function() { return /* binding */ PaymentState; } 1416/* harmony export */ }); 1417const PaymentState = { 1418 ERROR: "error", 1419 PAYMENT_SUBMITTED: "paymentSubmitted", 1420 INITIAL: "initial", 1421 SUCCESS: "success", 1422 PENDING: "pending" 1423}; 1424const GIFT_CARD_STATE = { 1425 IDLE: "idle", 1426 SUFFICIENT: "sufficient", 1427 INSUFFICIENT: "insufficient" 1428}; 1429 1430 1431/***/ }), 1432 1433/***/ 754513: 1434/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1435 1436"use strict"; 1437/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1438/* harmony export */ JG: function() { return /* binding */ Paypal_Error_Name_Cancel; }, 1439/* harmony export */ JX: function() { return /* binding */ AllowedEnviornments; }, 1440/* harmony export */ Lm: function() { return /* binding */ NEW_CARD_OPTION_VALUE; }, 1441/* harmony export */ Ms: function() { return /* binding */ FASTLANE_OPTION_VALUE; }, 1442/* harmony export */ Xv: function() { return /* binding */ Order_Accepted_Order_States; }, 1443/* harmony export */ _2: function() { return /* binding */ isPaypalFastlaneCheckoutEnabled; }, 1444/* harmony export */ cD: function() { return /* binding */ Confirmation_Page_Route; }, 1445/* harmony export */ pI: function() { return /* binding */ Paypal_Config_Style; } 1446/* harmony export */ }); 1447/* unused harmony export Paypal_Order_state */ 1448/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(208891); 1449 1450const AllowedEnviornments = [ 1451 "test", 1452 "live", 1453 "live-us", 1454 "live-au", 1455 "live-apse", 1456 "live-in" 1457]; 1458const Paypal_Config_Style = { 1459 layout: "vertical", 1460 color: "gold", 1461 shape: "rect", 1462 label: "paypal", 1463 height: 44, 1464 "min-width": "unset" 1465}; 1466const Paypal_Order_state = { 1467 COMPLETE: "Complete", 1468 OPEN: "Open", 1469 CONFIRMED: "Confirmed" 1470}; 1471const Order_Accepted_Order_States = [ 1472 Paypal_Order_state.COMPLETE, 1473 Paypal_Order_state.OPEN, 1474 Paypal_Order_state.CONFIRMED 1475]; 1476const Confirmation_Page_Route = "/one-page-checkout/confirmation"; 1477const Paypal_Error_Name_Cancel = "CANCEL"; 1478const { isPaypalFastlaneCheckoutEnabled } = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_0__.nextAppEnv.feature_toggle.US; 1479const NEW_CARD_OPTION_VALUE = "new"; 1480const FASTLANE_OPTION_VALUE = "fastlane"; 1481 1482 1483/***/ }), 1484 1485/***/ 279533: 1486/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1487 1488"use strict"; 1489/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1490/* harmony export */ P: function() { return /* binding */ FastlaneAuthStatusOPC; } 1491/* harmony export */ }); 1492const FastlaneAuthStatusOPC = { 1493 SUCCEEDED: "succeeded", 1494 NOT_FOUND: "not_found", 1495 CANCELED: "canceled", 1496 FAILED: "failed" 1497}; 1498 1499 1500/***/ }), 1501 1502/***/ 713402: 1503/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1504 1505"use strict"; 1506/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1507/* harmony export */ T: function() { return /* binding */ usePreviousPath; }, 1508/* harmony export */ x: function() { return /* binding */ PreviousPathProvider; } 1509/* harmony export */ }); 1510/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893); 1511/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294); 1512/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(811163); 1513/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_2__); 1514/* harmony import */ var _helpers_contextFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(151815); 1515 1516 1517 1518 1519const [usePreviousPath, PreviousPathContext] = (0,_helpers_contextFactory__WEBPACK_IMPORTED_MODULE_3__/* .contextFactory */ .b)(); 1520 1521const PreviousPathProvider = (param)=>{ 1522 let { children } = param; 1523 const router = (0,next_router__WEBPACK_IMPORTED_MODULE_2__.useRouter)(); 1524 const previousPathRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(""); 1525 (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{ 1526 const handleRouteChange = ()=>{ 1527 previousPathRef.current = router.asPath; 1528 }; 1529 router.events.on("routeChangeStart", handleRouteChange); 1530 return ()=>{ 1531 router.events.off("routeChangeStart", handleRouteChange); 1532 }; 1533 }, [ 1534 router 1535 ]); 1536 return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(PreviousPathContext.Provider, { 1537 value: { 1538 previousPath: previousPathRef.current 1539 }, 1540 children: children 1541 }); 1542}; 1543 1544 1545/***/ }), 1546 1547/***/ 98385: 1548/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1549 1550"use strict"; 1551/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1552/* harmony export */ JS: function() { return /* binding */ ADDRESS_SELECTED; }, 1553/* harmony export */ Mg: function() { return /* binding */ useCheckout; }, 1554/* harmony export */ P5: function() { return /* binding */ defaultUserContact; }, 1555/* harmony export */ bN: function() { return /* reexport safe */ _Lib_interfaces__WEBPACK_IMPORTED_MODULE_5__.bN; }, 1556/* harmony export */ oo: function() { return /* binding */ CheckoutProvider; } 1557/* harmony export */ }); 1558/* unused harmony exports CheckoutContext, defaultIsPhoneAuthentic */ 1559/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893); 1560/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294); 1561/* harmony import */ var _Api_phoneLookupApi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(867576); 1562/* harmony import */ var _Constants_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(339114); 1563/* harmony import */ var _Lib_helpers_forms_FormValidator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(809029); 1564/* harmony import */ var _Lib_interfaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(308825); 1565/* harmony import */ var _Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(484725); 1566/* harmony import */ var _Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(221473); 1567/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(267097); 1568/* harmony import */ var _Lib_utils_formUtils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(574166); 1569/* harmony import */ var _Lib_utils_patterns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(711091); 1570/* harmony import */ var _Utils_fieldCleaners__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(780118); 1571/* harmony import */ var _Utils_locale__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(225220); 1572/* harmony import */ var _helpers_contextFactory__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(151815); 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588const ADDRESS_SELECTED = { 1589 NO_ADDRESS_SELECTED: "NO_ADDRESS_SELECTED", 1590 ADDRESS_SELECTED_FOR_DELIVERY: "ADDRESS_SELECTED_FOR_DELIVERY", 1591 ADDRESS_SELECTED_FOR_PICKUP: "ADDRESS_SELECTED_FOR_PICKUP" 1592}; 1593const [useCheckout, CheckoutContext] = (0,_helpers_contextFactory__WEBPACK_IMPORTED_MODULE_13__/* .contextFactory */ .b)(); 1594 1595const defaultIsPhoneAuthentic = { 1596 [_Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.BILLING]: true, 1597 [_Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.SHIPPING]: true 1598}; 1599const defaultUserContact = ()=>{ 1600 // const countryAbbrev = countryShort 1601 // ? countryShort 1602 // : getAlternativeCountryShort(); 1603 // const countryAbbrev = countryShort 1604 // ? countryShort 1605 // : getAlternativeCountryShort(); 1606 const selectedCountry = (0,_Utils_locale__WEBPACK_IMPORTED_MODULE_12__/* .forceCountryAbbreviation */ .v0)(); 1607 var _selectedCountry_value, _selectedCountry_value1; 1608 // const selectedCountry = forceCountryAbbreviation(countryAbbrev); // in case backend sends us the full country name 1609 return { 1610 email: "", 1611 firstName: "", 1612 lastName: "", 1613 address1: "", 1614 address2: "", 1615 city: "", 1616 state: "", 1617 postalCode: "", 1618 country: (_selectedCountry_value = selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.value) !== null && _selectedCountry_value !== void 0 ? _selectedCountry_value : "", 1619 dialCode: (_selectedCountry_value1 = selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.value) !== null && _selectedCountry_value1 !== void 0 ? _selectedCountry_value1 : "", 1620 phone: "" 1621 }; 1622}; 1623const CheckoutProvider = (param)=>{ 1624 let { children, initialStep, initialAddressSelected = ADDRESS_SELECTED.NO_ADDRESS_SELECTED } = param; 1625 const dispatch = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__/* .useAppDispatch */ .T)(); 1626 const locale = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__/* .useAppSelector */ .C)((state)=>state.locale); 1627 const customerInfo = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__/* .useAppSelector */ .C)((state)=>state.customerInfo); 1628 const isKioskVisitor = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_7__/* .isKioskVisitorSelector */ .V_); 1629 const plantAddress = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_8__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_7__/* .plantAddressSelector */ .Yz); 1630 const isLoggedInUser = !!(customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.email); 1631 const [currentStep, setCurrentStep] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(initialStep || _Lib_interfaces__WEBPACK_IMPORTED_MODULE_5__/* .CheckoutSteps */ .bN.auth); 1632 const [showFooterActionButton, setShowFooterActionButton] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); 1633 const [membershipAgreementChecked, setMembershipAgreementChecked] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); 1634 const [posMembershipSaveCardAgreementChecked, setPosMembershipSaveCardAgreementChecked] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); 1635 const setCurrentStepHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((value, crashOverride)=>{ 1636 if (crashOverride === "DO NOT CALL THIS FUNCTION ANYWHERE ELSE. Use the checkout?step query param process") { 1637 setCurrentStep(value); 1638 } 1639 }, []); 1640 const [billingAddressForm, setBillingAddressForm] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({ 1641 ...defaultUserContact(locale.countryShort) 1642 }); 1643 const [shippingAddressForm, setShippingAddressForm] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({ 1644 ...defaultUserContact(locale.countryShort) 1645 }); 1646 const [deliveryInstructions, setDeliveryInstructions] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); 1647 const [isAGift, setIsAGift] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
1648 const [giftMessage, setGiftMessage] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); 1649 const [isMilitaryAddress, setIsMilitaryAddress] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); 1650 const [isPhoneAuthentic, setIsPhoneAuthentic] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(defaultIsPhoneAuthentic); 1651 const [addressSelected, setAddressSelected] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(initialAddressSelected); 1652 const [showBillingAddressForms, setShowBillingAddressForms] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(true); 1653 const setUserContactHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((values, formType)=>{ 1654 const cleanedValues = (0,_Utils_fieldCleaners__WEBPACK_IMPORTED_MODULE_11__/* .cleanFormFields */ .s7)(values); 1655 switch(formType){ 1656 case _Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.BILLING: 1657 setBillingAddressForm((currentBillingAddressState)=>{ 1658 return { 1659 ...currentBillingAddressState, 1660 ...cleanedValues 1661 }; 1662 }); 1663 break; 1664 case _Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.SHIPPING: 1665 default: 1666 setShippingAddressForm((currentShippingAddressState)=>{ 1667 return { 1668 ...currentShippingAddressState, 1669 ...cleanedValues 1670 }; 1671 }); 1672 break; 1673 } 1674 }, []); 1675 const setAddressFieldHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((value, fieldKey, formType)=>{ 1676 setUserContactHandler({ 1677 [fieldKey]: value !== null && value !== void 0 ? value : "" 1678 }, formType); 1679 }, [ 1680 setUserContactHandler 1681 ]); 1682 const setAddressSelectedHandler = function(value) { 1683 let type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "delivery"; 1684 if (!value) { 1685 setAddressSelected(ADDRESS_SELECTED.NO_ADDRESS_SELECTED); 1686 return; 1687 } 1688 const nextValue = type === "delivery" ? ADDRESS_SELECTED.ADDRESS_SELECTED_FOR_DELIVERY : ADDRESS_SELECTED.ADDRESS_SELECTED_FOR_PICKUP; 1689 setAddressSelected(nextValue); 1690 }; 1691 const resetAddressSelected = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(()=>{ 1692 setAddressSelected(ADDRESS_SELECTED.NO_ADDRESS_SELECTED); 1693 }, [ 1694 setAddressSelected 1695 ]); 1696 const resetLoggedUserAddress = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(()=>{ 1697 setCurrentStep(initialStep || _Lib_interfaces__WEBPACK_IMPORTED_MODULE_5__/* .CheckoutSteps */ .bN.auth); 1698 setShowFooterActionButton(false); 1699 setDeliveryInstructions(""); 1700 setIsAGift(false);
1701 setGiftMessage(""); 1702 setIsPhoneAuthentic(defaultIsPhoneAuthentic); 1703 resetAddressSelected(); 1704 setUserContactHandler({ 1705 ...defaultUserContact(locale.countryShort) 1706 }, _Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.BILLING); 1707 setUserContactHandler({ 1708 ...defaultUserContact(locale.countryShort) 1709 }, _Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.SHIPPING); 1710 setShowBillingAddressForms(true); 1711 }, [ 1712 initialStep, 1713 locale.countryShort, 1714 resetAddressSelected, 1715 setUserContactHandler 1716 ]); 1717 const clearReduxAddressState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(()=>{ 1718 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_6__/* .resetShippingAddress */ .VF)()); 1719 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_6__/* .resetBillingAddress */ .Q)()); 1720 }, [ 1721 dispatch 1722 ]); 1723 const resetCheckoutContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(()=>{ 1724 // Note: we are currently Not resetting billingAddress or shippingAddress 1725 setCurrentStep(initialStep || _Lib_interfaces__WEBPACK_IMPORTED_MODULE_5__/* .CheckoutSteps */ .bN.auth); 1726 setShowFooterActionButton(false); 1727 setDeliveryInstructions(""); 1728 setIsAGift(false);
1729 setGiftMessage(""); 1730 setIsPhoneAuthentic(defaultIsPhoneAuthentic); 1731 resetAddressSelected(); 1732 setShowBillingAddressForms(true); 1733 }, [ 1734 initialStep, 1735 setCurrentStep, 1736 setShowFooterActionButton, 1737 setDeliveryInstructions, 1738 setIsAGift, 1739 setGiftMessage, 1740 setIsPhoneAuthentic, 1741 resetAddressSelected, 1742 setShowBillingAddressForms 1743 ]); 1744 const phoneNumberValidationHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(async function(phone) { 1745 let formType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "shipping"; 1746 setIsPhoneAuthentic((prev)=>({ 1747 ...prev, 1748 [formType]: false 1749 })); 1750 if (!phone || phone.length < _Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .MIN_PHONE_LENGTH */ .FZ) { 1751 setIsPhoneAuthentic((prev)=>({ 1752 ...prev, 1753 [formType]: false 1754 })); 1755 return false; 1756 } 1757 const res = await (0,_Api_phoneLookupApi__WEBPACK_IMPORTED_MODULE_2__/* .defaultPhoneNumberValidationHandler */ .t)(phone); 1758 if (res) { 1759 setIsPhoneAuthentic((prev)=>({ 1760 ...prev, 1761 [formType]: true 1762 })); 1763 return true; 1764 } else { 1765 setIsPhoneAuthentic((prev)=>({ 1766 ...prev, 1767 [formType]: false 1768 })); 1769 return false; 1770 } 1771 }, []); 1772 const setPhoneHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((value, formType)=>{ 1773 const phone = (0,_Lib_utils_formUtils__WEBPACK_IMPORTED_MODULE_9__/* .sanitizePhoneNumber */ .jc)(value) || ""; 1774 setUserContactHandler({ 1775 phone 1776 }, formType); 1777 }, [ 1778 setUserContactHandler 1779 ]); 1780 const setShowFooterActionButtonToggler = ()=>{ 1781 setShowFooterActionButton(!showFooterActionButton); 1782 }; 1783 const isShippingAddressPOBox = [ 1784 shippingAddressForm.address1, 1785 shippingAddressForm.address2 1786 ].some((field)=>_Lib_utils_patterns__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.PO_BOX_ADDRESS.test(field)); 1787 // TODO: due to temporary CORS issue, I removed && isPhoneAuthentic[USER_CONTACT_FORM_TYPE.SHIPPING] from the tail end of the shippingAddressFormIsValid block below 1788 return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(CheckoutContext.Provider, { 1789 value: { 1790 setAddressFieldHandler, 1791 setPhoneHandler, 1792 billingAddressForm, 1793 shippingAddressForm: { 1794 ...shippingAddressForm, 1795 ...isKioskVisitor && { 1796 ...plantAddress 1797 } 1798 }, 1799 billingAddressFormIsValid: (0,_Lib_helpers_forms_FormValidator__WEBPACK_IMPORTED_MODULE_4__/* .validateBillingAddressFields */ .e)(billingAddressForm, { 1800 ignoreKeys: [ 1801 "email" 1802 ], 1803 countryShortOverride: billingAddressForm.country || (0,_Utils_locale__WEBPACK_IMPORTED_MODULE_12__/* .getAlternativeCountryShort */ .Vj)() 1804 }) && isPhoneAuthentic[_Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.BILLING], 1805 shippingAddressFormIsValid: (0,_Lib_helpers_forms_FormValidator__WEBPACK_IMPORTED_MODULE_4__/* .validateBillingAddressFields */ .e)(shippingAddressForm, { 1806 ignoreKeys: isKioskVisitor ? [ 1807 "email", 1808 "address1", 1809 "address2", 1810 "postalCode", 1811 "city", 1812 "state" 1813 ] : isLoggedInUser ? [ 1814 "email" 1815 ] : [], 1816 countryShortOverride: shippingAddressForm.country || (0,_Utils_locale__WEBPACK_IMPORTED_MODULE_12__/* .getAlternativeCountryShort */ .Vj)() 1817 }) && isPhoneAuthentic[_Constants_common__WEBPACK_IMPORTED_MODULE_3__/* .USER_CONTACT_FORM_TYPE */ .Hh.SHIPPING] && !isShippingAddressPOBox, 1818 currentStep, 1819 setUserContactHandler, 1820 setCurrentStepHandler, 1821 showFooterActionButton, 1822 setShowFooterActionButton, 1823 setShowFooterActionButtonToggler, 1824 isPhoneAuthentic, 1825 addressSelected, 1826 setAddressSelected, 1827 setAddressSelectedHandler, 1828 resetAddressSelected, 1829 phoneNumberValidationHandler, 1830 setIsPhoneAuthentic, 1831 deliveryInstructions, 1832 isAGift, 1833 isShippingAddressPOBox, 1834 giftMessage,
1835 isMilitaryAddress, 1836 setIsMilitaryAddress, 1837 setDeliveryInstructions, 1838 setIsAGift, 1839 setGiftMessage, 1840 resetCheckoutContext, 1841 resetLoggedUserAddress, 1842 clearReduxAddressState, 1843 showBillingAddressForms, 1844 setShowBillingAddressForms, 1845 membershipAgreementChecked, 1846 setMembershipAgreementChecked, 1847 posMembershipSaveCardAgreementChecked, 1848 setPosMembershipSaveCardAgreementChecked 1849 }, 1850 children: children 1851 }); 1852}; 1853 1854 1855/***/ }), 1856 1857/***/ 630807: 1858/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1859 1860"use strict"; 1861/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1862/* harmony export */ U: function() { return /* binding */ EnvironmentContextContextProvider; } 1863/* harmony export */ }); 1864/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893); 1865/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294); 1866/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93050); 1867/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_context__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_lib_context__WEBPACK_IMPORTED_MODULE_2__); 1868/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(208891); 1869/* harmony import */ var _Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(221473); 1870/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(267097); 1871 1872 1873 1874 1875 1876 1877const REAL_TIME_INVENTORY_CHECK = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_3__.nextAppEnv.feature_toggle.US.realTimeInventoryCheck; 1878const CONSENT_POPUP_ENABLED = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_3__.nextAppEnv.feature_toggle.US.isConsentPopupEnabled; 1879const EnvironmentContextContextProvider = (param)=>{ 1880 let { children } = param; 1881 const isKioskVisitor = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__/* .isKioskVisitorSelector */ .V_); 1882 const appHasInitialized = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__/* .selectAppHasInitialized */ .nb); 1883 const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>({ 1884 appHasInitialized, 1885 isKioskVisitor, 1886 realTimeInventoryCheck: REAL_TIME_INVENTORY_CHECK, 1887 isConsentPopupEnabled: CONSENT_POPUP_ENABLED 1888 }), [ 1889 appHasInitialized, 1890 isKioskVisitor 1891 ]); 1892 return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_lib_context__WEBPACK_IMPORTED_MODULE_2__.EnvironmentContext.Provider, { 1893 value: contextValue, 1894 children: children 1895 }); 1896}; 1897 1898 1899/***/ }), 1900 1901/***/ 427115: 1902/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1903 1904"use strict"; 1905/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1906/* harmony export */ HZ: function() { return /* binding */ DeliveryProvider; }, 1907/* harmony export */ qk: function() { return /* binding */ useDelivery; } 1908/* harmony export */ }); 1909/* unused harmony exports DeliveryContext, userContactSourceSwitcher */ 1910/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893); 1911/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294); 1912/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(940024); 1913/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_2__); 1914/* harmony import */ var _Constants_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(339114); 1915/* harmony import */ var _Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(484725); 1916/* harmony import */ var _Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(221473); 1917/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(267097); 1918/* harmony import */ var _Lib_utils_checkout__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(615114); 1919/* harmony import */ var _Utils_sanitization__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(698335); 1920/* harmony import */ var _core_ui_EnvironmentContextProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(630807); 1921/* harmony import */ var _helpers_contextFactory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(151815); 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933const [useDelivery, DeliveryContext] = (0,_helpers_contextFactory__WEBPACK_IMPORTED_MODULE_9__/* .contextFactory */ .b)(); 1934 1935const userContactSourceSwitcher = (param)=>{ 1936 let { billingAddressForm, shippingAddressForm, formType } = param; 1937 let userContact; 1938 switch(formType){ 1939 case USER_CONTACT_FORM_TYPE.BILLING: 1940 userContact = { 1941 ...billingAddressForm 1942 }; 1943 break; 1944 case USER_CONTACT_FORM_TYPE.SHIPPING: 1945 default: 1946 userContact = { 1947 ...shippingAddressForm 1948 }; 1949 break; 1950 } 1951 userContact.state = getStateAbbreviation(userContact === null || userContact === void 0 ? void 0 : userContact.state); 1952 return userContact; 1953}; 1954const DeliveryProvider = (param)=>{ 1955 let { children, initialSelectedAvailableDate, initialSelectedAvailableTime, initialAvailableWindows = [] } = param; 1956 const dispatch = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__/* .useAppDispatch */ .T)(); 1957 const isKioskVisitor = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_6__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_5__/* .isKioskVisitorSelector */ .V_); 1958 const [availableWindows, setAvailableWindows] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(initialAvailableWindows); 1959 const [selectedAvailableDate, setSelectedAvailableDate] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((0,_Utils_sanitization__WEBPACK_IMPORTED_MODULE_10__/* .numberOrZero */ .T)(initialSelectedAvailableDate)); 1960 const [selectedAvailableTime, setSelectedAvailableTime] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((0,_Utils_sanitization__WEBPACK_IMPORTED_MODULE_10__/* .numberOrZero */ .T)(initialSelectedAvailableTime)); 1961 const [selectedStore, setSelectedStore] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(); 1962 const setSelectedAvailableDateHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((value)=>{
1963 // note: setSelectedAvailableTimeHandler is called independently in DeliveryTimeSlider 1964 // keeping this as a Handler to be consistent with setSelectedAvailableTimeHandler 1965 // and also in case any additional logic needs to be added 1966 setSelectedAvailableDate(value); 1967 }, []); 1968 const setSelectedAvailableTimeHandler = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((dateIndex, timeIndex, availableWindows)=>{ 1969 let selectionIndex = null; 1970 if (availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) { 1971 var _getAvailableWindowObject_availableTimes; 1972 // get available window object based on selected date window 1973 const getAvailableWindowObject = availableWindows[dateIndex]; 1974 if (isKioskVisitor) { 1975 dispatch((0,_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_4__/* .setSelectedKioskWindow */ .jH)(getAvailableWindowObject)); 1976 } 1977 // if the first delivery-time window in the list is disabled, we have to choose an available time window 1978 if ((getAvailableWindowObject === null || getAvailableWindowObject === void 0 ? void 0 : (_getAvailableWindowObject_availableTimes = getAvailableWindowObject.availableTimes) === null || _getAvailableWindowObject_availableTimes === void 0 ? void 0 : _getAvailableWindowObject_availableTimes.length) && (getAvailableWindowObject === null || getAvailableWindowObject === void 0 ? void 0 : getAvailableWindowObject.availableTimes[timeIndex].disabled)) { 1979 // find first non-disabled element 1980 const indexOfNonDisabledElement = getAvailableWindowObject === null || getAvailableWindowObject === void 0 ? void 0 : getAvailableWindowObject.availableTimes.findIndex((el)=>{ 1981 return el.disabled !== true; 1982 }); 1983 // there should always be at least one element that is not disabled 1984 // since we are excluding days from the list when all of its availableTimes elements are disabled 1985 if (indexOfNonDisabledElement >= 0) { 1986 selectionIndex = indexOfNonDisabledElement; 1987 } 1988 } else { 1989 selectionIndex = timeIndex; 1990 } 1991 if (selectionIndex !== null) { 1992 setSelectedAvailableTime(selectionIndex); 1993 } 1994 } else { 1995 setSelectedAvailableTime(0); 1996 } 1997 }, [ 1998 dispatch, 1999 isKioskVisitor 2000 ]); 2001 const resetSelectedAvailableDateAndTime = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((availableWindows)=>{ 2002 setSelectedAvailableDateHandler(0); 2003 setSelectedAvailableTimeHandler(0, 0, availableWindows); 2004 }, [ 2005 setSelectedAvailableDateHandler, 2006 setSelectedAvailableTimeHandler 2007 ]); 2008 const resetDeliveryContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(()=>{ 2009 setAvailableWindows([]); 2010 setSelectedAvailableDate(0); 2011 setSelectedAvailableTime(0); 2012 }, [ 2013 setAvailableWindows, 2014 setSelectedAvailableDate, 2015 setSelectedAvailableTime 2016 ]); 2017 const checkIfWindowHasExpire = ()=>{ 2018 var _availableWindows_selectedAvailableDate_availableTimes, _availableWindows_selectedAvailableDate; 2019 const selectedWindow = availableWindows === null || availableWindows === void 0 ? void 0 : (_availableWindows_selectedAvailableDate = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate === void 0 ? void 0 : (_availableWindows_selectedAvailableDate_availableTimes = _availableWindows_selectedAvailableDate.availableTimes) === null || _availableWindows_selectedAvailableDate_availableTimes === void 0 ? void 0 : _availableWindows_selectedAvailableDate_availableTimes[selectedAvailableTime]; 2020 const expiration = selectedWindow === null || selectedWindow === void 0 ? void 0 : selectedWindow.expiration; 2021 if (!expiration) return false; 2022 return (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_time__WEBPACK_IMPORTED_MODULE_2__.isExpired)({ 2023 expiration 2024 }); 2025 }; 2026 const selectedWindowHasExpired = checkIfWindowHasExpire(); 2027 return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(DeliveryContext.Provider, { 2028 value: { 2029 availableWindows, 2030 selectedStore, 2031 setSelectedStore, 2032 setAvailableWindows, 2033 selectedAvailableDate, 2034 setSelectedAvailableDateHandler, 2035 selectedAvailableTime, 2036 setSelectedAvailableTimeHandler, 2037 resetSelectedAvailableDateAndTime, 2038 initialSelectedAvailableDate: (0,_Utils_sanitization__WEBPACK_IMPORTED_MODULE_10__/* .numberOrZero */ .T)(initialSelectedAvailableDate), 2039 initialSelectedAvailableTime: (0,_Utils_sanitization__WEBPACK_IMPORTED_MODULE_10__/* .numberOrZero */ .T)(initialSelectedAvailableTime), 2040 resetDeliveryContext, 2041 selectedWindowHasExpired 2042 }, 2043 children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_core_ui_EnvironmentContextProvider__WEBPACK_IMPORTED_MODULE_8__/* .EnvironmentContextContextProvider */ .U, { 2044 children: children 2045 }) 2046 }); 2047}; 2048 2049 2050/***/ }), 2051 2052/***/ 151815: 2053/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 2054 2055"use strict"; 2056/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2057/* harmony export */ b: function() { return /* binding */ contextFactory; } 2058/* harmony export */ }); 2059/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(667294); 2060 2061const contextFactory = ()=>{ 2062 const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); 2063 const useCtx = ()=>{ 2064 const ctx = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(context); 2065 if (ctx === undefined) { 2066 throw new Error("useContext must be used inside of a Provider with a value."); 2067 } 2068 return ctx; 2069 }; 2070 return [ 2071 useCtx, 2072 context 2073 ]; 2074}; 2075 2076 2077/***/ }), 2078 2079/***/ 499387: 2080/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 2081 2082"use strict"; 2083/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893); 2084/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294); 2085 2086 2087const GTMScript = (param)=>{ 2088 let { gtmId } = param; 2089 { 2090 /* <!-- Google Tag Manager (noscript) --> */ } 2091 return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("noscript", { 2092 id: "wf_gtm_noscr", 2093 children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("iframe", { 2094 src: "https://load.growth.wildforkfoods.com/ns.html?id=".concat(gtmId), 2095 height: "0", 2096 width: "0", 2097 style: { 2098 display: "none", 2099 visibility: "hidden" 2100 }, 2101 "aria-hidden": "true" // Adds accessibility support 2102 , 2103 title: "Google Tag Manager" 2104 }) 2105 }); 2106}; 2107/* harmony default export */ __webpack_exports__.Z = (GTMScript); 2108 2109 2110/***/ }), 2111 2112/***/ 42634: 2113/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 2114 2115"use strict"; 2116 2117// EXPORTS 2118__webpack_require__.d(__webpack_exports__, { 2119 Z: function() { return /* binding */ scripts_SmartBannerScript; } 2120}); 2121 2122// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js 2123var jsx_runtime = __webpack_require__(785893); 2124// EXTERNAL MODULE: ./node_modules/next/script.js 2125var script = __webpack_require__(304298); 2126var script_default = /*#__PURE__*/__webpack_require__.n(script); 2127;// CONCATENATED MODULE: ./src/components/meta-head/MetaMobileAppBanner.tsx 2128 2129const MetaMobileAppBanner = ()=>{ 2130 return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { 2131 children: [ 2132 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2133 name: "smartbanner:title", 2134 content: "Get the app" 2135 }), 2136 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2137 name: "smartbanner:author", 2138 content: "The fastest, easiest way to shop." 2139 }), 2140 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2141 name: "smartbanner:price", 2142 content: "FREE" 2143 }), 2144 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2145 name: "smartbanner:price-suffix-apple", 2146 content: " - On the App Store" 2147 }), 2148 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2149 name: "smartbanner:price-suffix-google", 2150 content: " - In Google Play" 2151 }), 2152 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2153 name: "smartbanner:icon-apple", 2154 content: "/small_wf_logo.webp" 2155 }), 2156 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2157 name: "smartbanner:icon-google", 2158 content: "/small_wf_logo.webp" 2159 }), 2160 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2161 name: "smartbanner:button", 2162 content: "VIEW" 2163 }), 2164 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2165 name: "smartbanner:button-url-apple", 2166 content: "https://app.wildfork.com/gakG/app" 2167 }), 2168 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2169 name: "smartbanner:button-url-google", 2170 content: "https://app.wildfork.com/gakG/app" 2171 }), 2172 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2173 name: "smartbanner:enabled-platforms", 2174 content: "android,ios" 2175 }), 2176 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2177 name: "smartbanner:close-label", 2178 content: "Close " 2179 }), 2180 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2181 name: "smartbanner:custom-design-modifier", 2182 content: "ios" 2183 }), 2184 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2185 name: "smartbanner:disable-positioning", 2186 content: "true" 2187 }), 2188 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2189 name: "smartbanner:hide-ttl", 2190 content: "604800000" 2191 }), 2192 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2193 name: "smartbanner:button", 2194 content: "Open" 2195 }), 2196 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2197 name: "smartbanner:api", 2198 content: "yes" 2199 }), 2200 /*#__PURE__*/ (0,jsx_runtime.jsx)("meta", { 2201 name: "smartbanner:include-user-agent-regex", 2202 content: ".*" 2203 }) 2204 ] 2205 }); 2206}; 2207/* harmony default export */ var meta_head_MetaMobileAppBanner = (MetaMobileAppBanner); 2208 2209;// CONCATENATED MODULE: ./src/components/scripts/SmartBannerScript.tsx 2210 2211 2212 2213const SmartBannerScript = ()=>{ 2214 return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { 2215 children: [ 2216 /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 2217 id: "smartbanner-customization", 2218 strategy: "afterInteractive", 2219 dangerouslySetInnerHTML: { 2220 __html: '\n\n document.addEventListener(\'smartbanner.init\', () => {\n const smartbannerInitTimeoutId = setTimeout(() =>
2220 {\n \n const parseCookies = () => {\n const cookies = {};\n document.cookie.split(\';\').forEach(cookieString => {\n const parts = cookieString.split(\'=\');\n if (parts.length > 1) {\n const name = decodeURIComponent(parts[0].trim());\n const value = decodeURIComponent(parts.slice(1).join(\'=\')).trim();\n cookies[name] = value;\n }\n });\n return cookies;\n }\n\n const checkIfMobileviewFromCookies = () => {\n const cookies = parseCookies();\n return cookies.mobileview === "true";\n };\n\n const isMobileviewFromQueryParam = window.location.search.includes("mobileview=true");\n \n const isMobileView = checkIfMobileviewFromCookies() || isMobileviewFromQueryParam;\n\n if(!isMobileView){\n window.smartbanner.publish();\n }\n clearTimeout(smartbannerInitTimeoutId);\n }, 1000);\n });\n\n document.addEventListener(\'smartbanner.view\', () => {\n const smartBannerViewTimeoutId = setTimeout(() => {\n const platform = window.smartbanner.platform;\n const isMac = navigator.userAgent.indexOf(\'Macintosh\') !== -1;\n const smartBannerOpenBtn = document.querySelector(".smartbanner__button.js_smartbanner__button");\n\n if(platform === "android" || isMac ) {\n smartBannerOpenBtn.text = "Install"\n }\n\n if(isMac){\n smartBannerOpenBtn.onclick = (event) => {\n event.preventDefault();\n window.location = "https://app.wildfork.com/gakG/app";\n }\n }\n else if(platform === "ios" ) {\n smartBannerOpenBtn.onclick = (event) => {\n event.preventDefault();\n window.location = "https://app.wildfork.com/gakG/app";\n }\n } else if(platform !== "android") {\n smartBannerOpenBtn.text = "Learn More"\n smartBannerOpenBtn.onclick = (event) => {\n event.preventDefault();\n window.location = \'https://app.wildfork.com/gakG/app\';\n }\n }\n }, 1000);\n });\n ' 2221 } 2222 }), 2223 /*#__PURE__*/ (0,jsx_runtime.jsx)(meta_head_MetaMobileAppBanner, {}), 2224 /*#__PURE__*/ (0,jsx_runtime.jsx)((script_default()), { 2225 id: "smartbanner", 2226 src: "/js/smartbanner.min.js", 2227 strategy: "afterInteractive" 2228 }) 2229 ] 2230 }); 2231}; 2232/* harmony default export */ var scripts_SmartBannerScript = (SmartBannerScript); 2233 2234 2235/***/ }), 2236 2237/***/ 77532: 2238/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 2239 2240"use strict"; 2241/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2242/* harmony export */ l: function() { return /* binding */ EXCLUDED_PAGES_FOR_EXCLUSIVE_OFFER; } 2243/* harmony export */ }); 2244const EXCLUDED_PAGES_FOR_EXCLUSIVE_OFFER = { 2245 TERMS_AND_CONDITIONS: "/wild-fork-unlimited-terms-and-conditions/", 2246 DELIVERY_AND_PICKUP_OPTIONS: "/delivery-and-pickup-options/", 2247 MEMBERSHIP_OFFER: "/membership-offer/" 2248}; 2249 2250 2251/***/ }), 2252 2253/***/ 981083: 2254/***/ (function(module) { 2255 2256// extracted by mini-css-extract-plugin 2257module.exports = {"app__container":"AppVersion_app__container__tskGS","app__version":"AppVersion_app__version__PJAUU","app__container__dev":"AppVersion_app__container__dev__3xpzA","mb__76px":"AppVersion_mb__76px__d2nvv"}; 2258 2259/***/ }) 2260 2261}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.