PageSourceSearch

https://wildforkfoods.com/_next/static/chunks/pages/checkout-f3956634-0b82feec82c2c14a.js

js wildforkfoods.com collected 2026-10-01 11:33:32 UTC 555,636 bytes, 9,732 lines download raw bytes

1(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[7473],{
2
3/***/ 402548:
4/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5
6"use strict";
7var __webpack_unused_export__;
8
9"use client";
10
11var _interopRequireDefault = __webpack_require__(564836);
12__webpack_unused_export__ = ({
13  value: true
14});
15exports.Z = void 0;
16var _createSvgIcon = _interopRequireDefault(__webpack_require__(864938));
17var _jsxRuntime = __webpack_require__(785893);
18var _default = exports.Z = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
19  d: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
20}), 'InfoOutlined');
21
22/***/ }),
23
24/***/ 386482:
25/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
26
27"use strict";
28
29Object.defineProperty(exports, "__esModule", ({ value: true }));
30exports.AutoshipForm = void 0;
31const jsx_runtime_1 = __webpack_require__(785893);
32const AutoshipFormIcon_1 = __webpack_require__(200376);
33const AutoshipForm = ({ parent, title, description, label, warningLabel = '', autoship = false, handleAutoship = () => null, }) => {
34    const isCartDrawer = parent === 'cart-drawer';
35    const isDelivery = parent === 'delivery';
36    const isPayment = parent === 'payment';
37    const showIcon = !isCartDrawer && !isPayment;
38    return ((0, jsx_runtime_1.jsxs)("div", { className: !isPayment ? 'autoship-form' : '', children: [(isCartDrawer && autoship) || isPayment ? null : ((0, jsx_runtime_1.jsxs)("div", { className: "content", children: [isCartDrawer ? null : ((0, jsx_runtime_1.jsx)("div", { className: isDelivery ? 'content__deliveryIcon' : 'content__icon', children: showIcon && (0, jsx_runtime_1.jsx)(AutoshipFormIcon_1.AutoshipFormIcon, {}) })), (0, jsx_runtime_1.jsxs)("div", { className: "content__container", children: [(0, jsx_runtime_1.jsx)("div", { className: isDelivery ? 'content__deliveryContainer' : 'content__title', children: title }), (0, jsx_runtime_1.jsx)("div", { className: "content__description", children: (0, jsx_runtime_1.jsx)("p", { children: description }) })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: isCartDrawer || isPayment ? 'checkbox-cart-drawer' : 'checkbox', children: [(0, jsx_runtime_1.jsx)("input", { id: "autoship-checkbox", name: "autoship-checkbox", type: "checkbox", checked: autoship, onChange: handleAutoship }), (0, jsx_runtime_1.jsx)("label", { htmlFor: "autoship-checkbox", children: label }), autoship === false && ((0, jsx_runtime_1.jsx)("span", { className: "warning-label", children: warningLabel }))] })] }));
39};
40exports.AutoshipForm = AutoshipForm;
41
42
43/***/ }),
44
45/***/ 804258:
46/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
47
48"use strict";
49
50var __importDefault = (this && this.__importDefault) || function (mod) {
51    return (mod && mod.__esModule) ? mod : { "default": mod };
52};
53Object.defineProperty(exports, "__esModule", ({ value: true }));
54exports.ModalConfirm = void 0;
55const jsx_runtime_1 = __webpack_require__(785893);
56const Dialog_1 = __importDefault(__webpack_require__(791777));
57const DialogActions_1 = __importDefault(__webpack_require__(854969));
58const DialogContent_1 = __importDefault(__webpack_require__(410259));
59const DialogTitle_1 = __importDefault(__webpack_require__(798115));
60const defaultContentTranslation = {
61    continue: 'Continue',
62    cancel: 'Cancel',
63};
64const ModalConfirm = ({ open, title, content, contentTranslation = defaultContentTranslation, onConfirm, onCancel, }) => {
65    return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: open, onClose: onCancel, children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, { children: (0, jsx_runtime_1.jsx)("h4", { className: "text-h3", children: title }) }), (0, jsx_runtime_1.jsx)(DialogContent_1.default, { children: (0, jsx_runtime_1.jsx)("p", { children: content }) }), (0, jsx_runtime_1.jsxs)(DialogActions_1.default, { children: [(0, jsx_runtime_1.jsx)("button", { onClick: onCancel, className: "action action--secondary", children: contentTranslation.cancel }), (0, jsx_runtime_1.jsx)("button", { onClick: onConfirm, className: "action", children: contentTranslation.continue })] })] }));
66};
67exports.ModalConfirm = ModalConfirm;
68
69
70/***/ }),
71
72/***/ 910434:
73/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
74
75"use strict";
76
77var __importDefault = (this && this.__importDefault) || function (mod) {
78    return (mod && mod.__esModule) ? mod : { "default": mod };
79};
80Object.defineProperty(exports, "__esModule", ({ value: true }));
81exports.ModalBasic = void 0;
82const jsx_runtime_1 = __webpack_require__(785893);
83const clsx_1 = __importDefault(__webpack_require__(557966));
84const Button_1 = __webpack_require__(646252);
85const ModalRenderer_1 = __webpack_require__(547994);
86const ModalBasic = ({ open, heading, message, onClose, className, contentClassName, withCloseIcon, actionConfirmLabel = 'Ok', actionCancelLabel, onActionConfirmClick, onActionCancelClick, actionConfirmClass, actionCancelClass, }) => {
87    const modalAttributes = {
88        // TODO from Jared: I tried different varieties of Parti
88al<IModalProps> and couldn't get it to work
89        show: open,
90        onClose,
91        className: (0, clsx_1.default)('modal-basic', className),
92    };
93    if (heading) {
94        modalAttributes.title = heading;
95    }
96    if (contentClassName) {
97        modalAttributes.contentClassName = contentClassName;
98    }
99    if (withCloseIcon) {
100        modalAttributes.withCloseIcon = withCloseIcon;
101    }
102    return ((0, jsx_runtime_1.jsx)(ModalRenderer_1.ModalRenderer, { ...modalAttributes, children: (0, jsx_runtime_1.jsxs)("div", { className: 'modal-basic__content', children: [(0, jsx_runtime_1.jsx)("span", { id: "modal-modal-description", className: 'modal-basic__content__message', children: message }), (0, jsx_runtime_1.jsxs)("div", { className: 'modal-basic__content__actions', children: [actionCancelLabel && ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onActionCancelClick ?? onClose, className: (0, clsx_1.default)(actionCancelClass), children: actionCancelLabel })), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onActionConfirmClick ?? onClose, className: (0, clsx_1.default)(actionConfirmClass), children: actionConfirmLabel })] })] }) }));
103};
104exports.ModalBasic = ModalBasic;
105
106
107/***/ }),
108
109/***/ 618446:
110/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
111
112var baseIsEqual = __webpack_require__(690939);
113
114/**
115 * Performs a deep comparison between two values to determine if they are
116 * equivalent.
117 *
118 * **Note:** This method supports comparing arrays, array buffers, booleans,
119 * date objects, error objects, maps, numbers, `Object` objects, regexes,
120 * sets, strings, symbols, and typed arrays. `Object` objects are compared
121 * by their own, not inherited, enumerable properties. Functions and DOM
122 * nodes are compared by strict equality, i.e. `===`.
123 *
124 * @static
125 * @memberOf _
126 * @since 0.1.0
127 * @category Lang
128 * @param {*} value The value to compare.
129 * @param {*} other The other value to compare.
130 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
131 * @example
132 *
133 * var object = { 'a': 1 };
134 * var other = { 'a': 1 };
135 *
136 * _.isEqual(object, other);
137 * // => true
138 *
139 * object === other;
140 * // => false
141 */
142function isEqual(value, other) {
143  return baseIsEqual(value, other);
144}
145
146module.exports = isEqual;
147
148
149/***/ }),
150
151/***/ 562013:
152/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
153
154
155    (window.__NEXT_P = window.__NEXT_P || []).push([
156      "/checkout",
157      function () {
158        return __webpack_require__(389568);
159      }
160    ]);
161    if(false) {}
162  
163
164/***/ }),
165
166/***/ 94569:
167/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
168
169"use strict";
170/* harmony export */ __webpack_require__.d(__webpack_exports__, {
171/* harmony export */   P: function() { return /* binding */ twilioPhoneLookup; }
172/* harmony export */ });
173/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(409669);
174/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__);
175/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(208891);
176/* harmony import */ var _Lib_constants_countriesDialCode_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(770757);
177/* provided dependency */ var Buffer = __webpack_require__(348764)["lW"];
178
179
180
181const getBasicAuthentication = ()=>{
182    const username = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_1__.nextAppEnv.twilio.accountSid;
183    const password = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_1__.nextAppEnv.twilio.token;
184    const encodeBase64 = Buffer.from("".concat(username, ":").concat(password)).toString("base64");
185    return "Basic ".concat(encodeBase64);
186};
187const buildEndpoint = (data)=>{
188    const country = _Lib_constants_countriesDialCode_json__WEBPACK_IMPORTED_MODULE_2__.find((param)=>{
189        let { value } = param;
190        return value === data.countryCode;
191    });
192    if (!country) {
193        return "";
194    }
195    const baseUrl = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_1__.nextAppEnv.twilio.baseUrl;
196    if (!baseUrl || !baseUrl.startsWith("http")) {
197        return "";
198    }
199    try {
200        const url = new URL(baseUrl);
201        if (!data.phoneNumber) {
202            throw new Error("Phone number is required.");
203        }
204        url.pathname = "".concat(url.pathname).concat(data.phoneNumber);
205        url.searchParams.append("phoneNumber", data.phoneNumber);
206        url.searchParams.append("countryCode", country.value);
207        return url.toString();
208    } catch (e) {
209        return "";
210    }
211};
212const twilioPhoneLookup = (data)=>{
213    if (!_Lib_configs_environment__WEBPACK_IMPORTED_MODULE_1__.nextAppEnv.feature_toggle.US.twilioPhoneLookup) {
214        return Promise.resolve();
215    }
216    const url = buildEndpoint(data);
217    if (!url) return Promise.reject();
218    return axios__WEBPACK_IMPORTED_MODULE_0___default().get(url, {
219        headers: {
220            Authorization: getBasicAuthentication()
221        }
222    });
223};
224
225
226/***/ }),
227
228/***/ 399038:
229/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
230
231"use strict";
232
233// EXPORTS
234__webpack_require__.d(__webpack_exports__, {
235  A: function() { return /* binding */ CheckoutLayout; }
236});
237
238// UNUSED EXPORTS: MainContentComponent
239
240// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
241var jsx_runtime = __webpack_require__(785893);
242// EXTERNAL MODULE: ./node_modules/react/index.js
243var react = __webpack_require__(667294);
244// EXTERNAL MODULE: ./node_modules/next/router.js
245var next_router = __webpack_require__(811163);
246// EXTERNAL MODULE: ./src/components/providers/context/checkout/CheckoutProvider.tsx
247var CheckoutProvider = __webpack_require__(98385);
248// EXTERNAL MODULE: ./src/lib/hooks/index.ts + 13 modules
249var hooks = __webpack_require__(130414);
250// EXTERNAL MODULE: ./src/lib/hooks/useKlaviyo.ts
251var useKlaviyo = __webpack_require__(84861);
252// EXTERNAL MODULE: ./src/lib/hooks/useSetCartFromQueryParam.ts
253var useSetCartFromQueryParam = __webpack_require__(311642);
254// EXTERNAL MODULE: ./src/lib/store/cartSlice.ts + 1 modules
255var store_cartSlice = __webpack_require__(484725);
256// EXTERNAL MODULE: ./src/lib/store/hooks.ts
257var store_hooks = __webpack_require__(267097);
258// EXTERNAL MODULE: ./src/lib/store/zipcodeSlice.tsx
259var zipcodeSlice = __webpack_require__(480326);
260// EXTERNAL MODULE: ./src/lib/tracking/trackingEvents.ts + 1 modules
261var trackingEvents = __webpack_require__(538933);
262// EXTERNAL MODULE: ./src/lib/types/tracking.ts
263var tracking = __webpack_require__(637938);
264// EXTERNAL MODULE: ./src/components/checkout/auth/index.ts + 13 modules
265var auth = __webpack_require__(678325);
266// EXTERNAL MODULE: ./src/components/checkout/CheckoutLayout.module.scss
267var CheckoutLayout_module = __webpack_require__(44138);
268var CheckoutLayout_module_default = /*#__PURE__*/__webpack_require__.n(CheckoutLayout_module);
269// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/constants/storage.js
270var storage = __webpack_require__(692521);
271// EXTERNAL MODULE: ./src/api/cart/index.ts
272var api_cart = __webpack_require__(797325);
273// EXTERNAL MODULE: ./src/components/providers/context/delivery/DeliveryProvider.tsx
274var DeliveryProvider = __webpack_require__(427115);
275// EXTERNAL MODULE: ./src/lib/hooks/useCartFulfillmentType.ts
276var useCartFulfillmentType = __webpack_require__(381627);
277// EXTERNAL MODULE: ./src/lib/hooks/useCartSubscription.ts + 1 modules
278var useCartSubscription = __webpack_require__(65353);
279// EXTERNAL MODULE: ./src/lib/hooks/useCustomer.ts
280var useCustomer = __webpack_require__(643525);
281// EXTERNAL MODULE: ./src/lib/store/customerInfoSlice.ts
282var customerInfoSlice = __webpack_require__(680921);
283// EXTERNAL MODULE: ./src/lib/store/environmentSlice.ts
284var environmentSlice = __webpack_require__(221473);
285// EXTERNAL MODULE: ./src/lib/utils/browserStorage.ts
286var browserStorage = __webpack_require__(873043);
287// EXTERNAL MODULE: ./src/components/ui/index.ts + 7 modules
288var ui = __webpack_require__(836455);
289// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/atoms/Autoship/AutoshipForm.js
290var AutoshipForm = __webpack_require__(386482);
291// EXTERNAL MODULE: ./src/lib/utils/locale.ts + 2 modules
292var utils_locale = __webpack_require__(225220);
293// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/Modals/ModalConfirm/ModalConfirm.js
294var ModalConfirm = __webpack_require__(804258);
295// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/classNames.js
296var classNames = __webpack_require__(221504);
297// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/Logger.js
298var Logger = __webpack_require__(101914);
299var Logger_default = /*#__PURE__*/__webpack_require__.n(Logger);
300// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/productUtils.js
301var productUtils = __webpack_require__(574909);
302// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/typeUtils.js
303var typeUtils = __webpack_require__(681063);
304// EXTERNAL MODULE: ./src/api/cart/getCartItemApi.ts
305var getCartItemApi = __webpack_require__(543854);
306// EXTERNAL MODULE: ./src/api/checkoutApi.ts
307var checkoutApi = __webpack_require__(451881);
308// EXTERNAL MODULE: ./src/api/customerApi.ts
309var customerApi = __webpack_require__(164535);
310// EXTERNAL MODULE: ./src/api/withAsync.ts
311var withAsync = __webpack_require__(715904);
312// EXTERNAL MODULE: ./src/components/account/hooks/useFastlane.ts
313var useFastlane = __webpack_require__(474282);
314// EXTERNAL MODULE: ./src/components/checkout/delivery/dbDeliveryDataTransformer.ts
315var dbDeliveryDataTransformer = __webpack_require__(672311);
316// EXTERNAL MODULE: ./src/components/checkout/delivery/hooks/index.ts
317var delivery_hooks = __webpack_require__(734103);
318// EXTERNAL MODULE: ./src/components/checkout/forms/address-form-container/NoWindowsAvailableMessage.tsx
319var NoWindowsAvailableMessage = __webpack_require__(971973);
320// EXTERNAL MODULE: ./src/components/checkout/modals/AddressVerificationModal.tsx
321var AddressVerificationModal = __webpack_require__(722857);
322// EXTERNAL MODULE: ./src/components/checkout/modals/ProductInventoryModal.tsx
323var ProductInventoryModal = __webpack_require__(214413);
324// EXTERNAL MODULE: ./src/lib/configs/environment.ts
325var environment = __webpack_require__(208891);
326// EXTERNAL MODULE: ./src/lib/hooks/useInventory.ts
327var useInventory = __webpack_require__(529511);
328// EXTERNAL MODULE: ./src/lib/hooks/useZipCode.ts
329var useZipCode = __webpack_require__(455489);
330// EXTERNAL MODULE: ./src/lib/checkoutErrors/resolveCheckoutError.ts
331var resolveCheckoutError = __webpack_require__(622112);
332// EXTERNAL MODULE: ./src/lib/store/TaxDelayedCardSlice.ts
333var TaxDelayedCardSlice = __webpack_require__(701406);
334// EXTERNAL MODULE: ./src/lib/types/common.ts
335var common = __webpack_require__(592947);
336// EXTERNAL MODULE: ./src/lib/utils/index.ts + 1 modules
337var utils = __webpack_require__(71486);
338// EXTERNAL MODULE: ./src/lib/utils/addressUtils.ts
339var addressUtils = __webpack_require__(960568);
340// EXTERNAL MODULE: ./src/lib/utils/cookies.ts
341var cookies = __webpack_require__(701636);
342// EXTERNAL MODULE: ./src/lib/utils/fulfillmentUtils.ts
343var fulfillmentUtils = __webpack_require__(889034);
344// EXTERNAL MODULE: ./src/lib/utils/reduxCommon.ts
345var reduxCommon = __webpack_require__(675121);
346// EXTERNAL MODULE: ./src/lib/utils/snackbarHandlers.ts
347var snackbarHandlers = __webpack_require__(921134);
348// EXTERNAL MODULE: ./src/lib/utils/typeUtils.ts
349var utils_typeUtils = __webpack_require__(726373);
350// EXTERNAL MODULE: ./src/components/checkout/forms/address-form-container/AddressFormContainer.module.scss
351var AddressFormContainer_module = __webpack_require__(299417);
352var AddressFormContainer_module_default = /*#__PURE__*/__webpack_require__.n(AddressFormContainer_module);
353// EXTERNAL MODULE: ./node_modules/@mui/material/Grid/Grid.js + 1 modules
354var Grid = __webpack_require__(448263);
355// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/forms/helpers/FieldValidator.js
356var FieldValidator = __webpack_require__(784870);
357// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/constants/commons.js
358var commons = __webpack_require__(820523);
359// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/constants/locale.js
360var locale = __webpack_require__(808439);
361// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/checkout.js
362var checkout = __webpack_require__(916382);
363// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/formUtils.js
364var formUtils = __webpack_require__(503499);
365// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/locale.js
366var lib_utils_locale = __webpack_require__(100372);
367// EXTERNAL MODULE: ./node_modules/lodash/noop.js
368var noop = __webpack_require__(850308);
369var noop_default = /*#__PURE__*/__webpack_require__.n(noop);
370// EXTERNAL MODULE: ./node_modules/react-final-form/dist/react-final-form.es.js
371var react_final_form_es = __webpack_require__(166688);
372// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/atoms/Icon/Icon.js
373var Icon = __webpack_require__(882074);
374// EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
375var v4 = __webpack_require__(825934);
376// EXTERNAL MODULE: ./node_modules/axios/index.js
377var axios = __webpack_require__(409669);
378var axios_default = /*#__PURE__*/__webpack_require__.n(axios);
379// EXTERNAL MODULE: ./src/api/constants/RestEndpoints.ts
380var RestEndpoints = __webpack_require__(179901);
381;// CONCATENATED MODULE: ./src/api/postgridApi.ts
382
383
384
385const POSTGRID_API_KEY = environment.nextAppEnv.postgrid.apiKey;
386const POSTGRID_COMPLETIONS_URL = RestEndpoints/* default */.Z.POSTGRID.BASE_URL;
387const COUNTRY_FILTER = "US";
388const postgridApi = axios_default().create({
389    baseURL: POSTGRID_COMPLETIONS_URL,
390    headers: {
391        "x-api-key": POSTGRID_API_KEY || ""
392    },
393    params: {
394        countryFilter: COUNTRY_FILTER,
395        properCase: true
396    }
397});
398const getPostGridSuggestions = (partialStreet)=>{
399    return postgridApi.get("/completions", {
400        params: {
401            partialStreet
402        }
403    });
404};
405const getPostGridFullAddress = (partialStreet, index)=>{
406    return postgridApi.post("/completions", {
407        partialStreet
408    }, {
409        params: {
410            index
411        }
412    });
413};
414
415// EXTERNAL MODULE: ./src/lib/constants/common.ts
416var constants_common = __webpack_require__(339114);
417// EXTERNAL MODULE: ./src/lib/helpers/forms/FieldValidator.ts
418var forms_FieldValidator = __webpack_require__(348833);
419;// CONCATENATED MODULE: ./src/components/forms/formFields/PostGridAutocomplete/HighlightedText.tsx
420
421const escapeRegExp = (text)=>{
422    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
423};
424const HighlightedText = (param)=>{
425    let { text, searchQuery, className = "" } = param;
426    if (!searchQuery) return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
427        children: text
428    });
429    const searchWords = searchQuery.split(" ").map((word)=>escapeRegExp(word.trim())).filter((word)=>word.length > 0);
430    const regex = new RegExp("(".concat(searchWords.join("|"), ")"), "gi");
431    const parts = text.split(regex);
432    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
433        className: className,
434        children: parts.map((part, i)=>{
435            const isMatch = regex.test(part);
436            return isMatch ? /*#__PURE__*/ (0,jsx_runtime.jsx)("strong", {
437                children: part
438            }, i) : /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
439                children: part
440            }, i);
441        })
442    });
443};
444
445// EXTERNAL MODULE: ./src/components/forms/formFields/PostGridAutocomplete/PostGridAutocomplete.module.scss
446var PostGridAutocomplete_module = __webpack_require__(66837);
447var PostGridAutocomplete_module_default = /*#__PURE__*/__webpack_require__.n(PostGridAutocomplete_module);
448;// CONCATENATED MODULE: ./src/components/forms/formFields/PostGridAutocomplete/PostGridAutocomplete.tsx
449
450
451
452
453
454
455
456
457
458
459
460
461const MIN_SEARCH_LENGTH = 3;
462const MAX_SUGGESTIONS = 5;
463const POSTAL_CODE_LENGTH = 5;
464const ADDRESS_KEY_MAP = {
465    line1: "address1"
466};
467const PostGridAutoComplete = (param)=>{
468    let { formRef, formType, onAddressChange, setExternalValidationErrors } = param;
469    const [addressInput, setAddressInput] = (0,react.useState)("");
470    const [suggestions, setSuggestions] = (0,react.useState)([]);
471    const [showSuggestions, setShowSuggestions] = (0,react.useState)(false);
472    const [selectedIndex, setSelectedIndex] = (0,react.useState)(-1);
473    // Generate unique IDs for the input and error message
474    const { inputId, errorId } = (0,react.useMemo)(()=>{
475        const baseId = "postgrid-".concat((0,v4/* default */.Z)());
476        return {
477            inputId: baseId,
478            errorId: "".concat(baseId, "-error")
479        };
480    }, []);
481    const getSuggestions = async (partialStreet)=>{
482        var _response_data;
483        const { response, error } = await (0,withAsync/* withAsync */.j)(()=>getPostGridSuggestions(partialStreet));
484        if (!(response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.data) || error) {
485            return [];
486        }
487        return response.data.data.map((item)=>{
488            const { address = "", city = "", pc = "" } = item.preview;
489            const fullAddress = "".concat(address, " ").concat(city, " ").concat(pc);
490            return fullAddress;
491        });
492    };
493    const handleInputChange = async (partialStreet)=>{
494        setAddressInput(partialStreet);
495        if (partialStreet.length >= MIN_SEARCH_LENGTH) {
496            const suggestions = await getSuggestions(partialStreet);
497            setSuggestions(()=>suggestions);
498            setShowSuggestions(true);
499        } else {
500            setSuggestions([]);
501        }
502    };
503    const handleSelectSuggestion = async (index)=>{
504        var _response_data_data, _response_data;
505        const { response, error } = await (0,withAsync/* withAsync */.j)(()=>getPostGridFullAddress(addressInput, index));
506        if (!response || error) {
507            return;
508        }
509        const addressDetails = (_response_data = response.data) === null || _response_data === void 0 ? void 0 : (_response_data_data = _response_data.data) === null || _response_data_data === void 0 ? void 0 : _response_data_data.address;
510        updateFormFields(addressDetails);
511        setSuggestions([]);
512        handleErrors(response.data.data.errors);
513    };
514    const handleErrors = (errors)=>{
515        if (formType !== constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING || !errors) return;
516        if (Object.keys(errors).length > 0) {
517            setExternalValidationErrors(Object.entries(errors).reduce((acc, param)=>{
518                let [key, value] = param;
519                acc[ADDRESS_KEY_MAP[key] || key] = (value === null || value === void 0 ? void 0 : value[0]) || "";
520                return acc;
521            }, {}));
522        }
523    };
524    const updateFormFields = (addressDetails)=>{
525        const formattedAddress = addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.address;
526        const addressFields = {
527            address1: formattedAddress,
528            city: addressDetails.city,
529            postalCode: addressDetails.pc.slice(0, POSTAL_CODE_LENGTH),
530            state: addressDetails.prov
531        };
532        formRef.current.change("address1", formattedAddress);
533        formRef.current.change("city", addressDetails.city);
534        formRef.current.change("postalCode", addressDetails.pc.slice(0, POSTAL_CODE_LENGTH));
535        formRef.current.change("state", addressDetails.prov);
536        onAddressChange(addressFields);
537    };
538    const handleFocus = ()=>{
539        setShowSuggestions(true);
540    };
541    const handleBlur = ()=>setTimeout(()=>setShowSuggestions(false), 100);
542    const handleKeyDown = (e)=>{
543        const calculateNewIndex = (change)=>{
544            return Math.max(0, Math.min(selectedIndex + change, Math.min(suggestions.length, MAX_SUGGESTIONS) - 1));
545        };
546        switch(e.key){
547            case "Escape":
548                setShowSuggestions(false);
549                setSelectedIndex(-1);
550                break;
551            case "ArrowDown":
552                e.preventDefault();
553                setSelectedIndex(calculateNewIndex(1));
554                break;
555            case "ArrowUp":
556                e.preventDefault();
557                setSelectedIndex(calculateNewIndex(-1));
558                break;
559            case "Enter":
560                if (selectedIndex >= 0) {
561                    e.preventDefault();
562                    handleSelectSuggestion(selectedIndex);
563                    setSelectedIndex(-1);
564                    setShowSuggestions(false);
565                }
566                break;
567        }
568    };
569    const validateAddressForPOBox = ()=>formType === constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING && (0,forms_FieldValidator/* validatePOBoxAddress */.Ny)();
570    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
571        className: (PostGridAutocomplete_module_default())["postgrid-address-search"],
572        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
573            className: (PostGridAutocomplete_module_default())["search-field-container"],
574            children: [
575                /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
576                    name: "address1",
577                    value: addressInput,
578                    validate: (0,forms_FieldValidator/* default */.ZP)([
579                        (0,forms_FieldValidator/* required */.C1)("Please enter a valid address"),
580                        validateAddressForPOBox()
581                    ]),
582                    parse: (value)=>value.replace(/[^\w\s]/g, ""),
583                    render: (param)=>{
584                        let { input, meta } = param;
585                        return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
586                            children: [
587                                /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
588                                    htmlFor: inputId,
589                                    className: (PostGridAutocomplete_module_default()).required,
590                                    children: "Address"
591                                }),
592                                /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
593                                    ...input,
594                                    id: inputId,
595                                    autoComplete: "off",
596                                    placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.address"),
597                                    onChange: (e)=>{
598                                        const address = e.target.value;
599                                        input.onChange(e);
600                                        onAddressChange({
601                                            address1: address
602                                        });
603                                        handleInputChange(address);
604                                    },
605                                    onBlur: handleBlur,
606                                    onFocus: handleFocus,
607                                    onKeyDown: handleKeyDown,
608                                    onClick: ()=>setShowSuggestions(true),
609                                    "aria-describedby": meta.dirty && meta.error ? errorId : undefined
610                                }),
611                                meta.dirty && meta.error && /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
612                                    id: errorId,
613                                    className: (PostGridAutocomplete_module_default())["error-text"],
614                                    children: meta.error
615                                })
616                            ]
617                        });
618                    }
619                }),
620                suggestions.length > 0 && showSuggestions && /*#__PURE__*/ (0,jsx_runtime.jsx)("ul", {
621                    className: (PostGridAutocomplete_module_default())["suggestions-dropdown"],
622                    children: suggestions === null || suggestions === void 0 ? void 0 : suggestions.slice(0, MAX_SUGGESTIONS).map((address, index)=>{
623                        return /*#__PURE__*/ (0,jsx_runtime.jsxs)("li", {
624                            onClick: ()=>handleSelectSuggestion(index),
625                            className: "".concat((PostGridAutocomplete_module_default())["suggestion-option"], " ").concat(selectedIndex === index ? (PostGridAutocomplete_module_default()).selected : ""),
626                            children: [
627                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
628                                    iconName: "location-dark",
629                                    className: (PostGridAutocomplete_module_default()).icon
630                                }),
631                                /*#__PURE__*/ (0,jsx_runtime.jsx)(HighlightedText, {
632                                    text: address,
633                                    searchQuery: addressInput,
634                                    className: (PostGridAutocomplete_module_default())["suggestion-text"]
635                                })
636                            ]
637                        }, address);
638                    })
639                })
640            ]
641        })
642    });
643};
644
645// EXTERNAL MODULE: ./src/components/forms/formFields/searchLocationInput/SearchLocationInput.tsx
646var SearchLocationInput = __webpack_require__(392330);
647// EXTERNAL MODULE: ./src/components/forms/formFields/textField/FormTextField.tsx
648var FormTextField = __webpack_require__(833936);
649// EXTERNAL MODULE: ./src/lib/constants/user.ts
650var user = __webpack_require__(466968);
651// EXTERNAL MODULE: ./src/lib/constants/Country.json
652var Country = __webpack_require__(951710);
653// EXTERNAL MODULE: ./node_modules/@mui/icons-material/Close.js
654var Close = __webpack_require__(450594);
655// EXTERNAL MODULE: ./node_modules/@mui/material/IconButton/IconButton.js
656var IconButton = __webpack_require__(554799);
657// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/message/components/index.js
658var components = __webpack_require__(737827);
659// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/message/Message.js
660var Message = __webpack_require__(626135);
661;// CONCATENATED MODULE: ./src/components/checkout/forms/GenericErrorMessage.tsx
662
663
664
665
666
667
668const GenericErrorMessage = (param)=>{
669    let { errorMessage, onClose } = param;
670    if (!errorMessage) return null;
671    return /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
672        item: true,
673        xs: 12,
674        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Message.Message, {
675            show: true,
676            variant: "error",
677            children: [
678                /*#__PURE__*/ (0,jsx_runtime.jsx)(components.MessageIcon, {}),
679                /*#__PURE__*/ (0,jsx_runtime.jsx)(components.MessageContent, {
680                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(components.MessageHeading, {
681                        children: errorMessage
682                    })
683                }),
684                onClose && /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, {
685                    onClick: onClose,
686                    size: "small",
687                    sx: {
688                        ml: "auto"
689                    },
690                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Close["default"], {
691                        fontSize: "small"
692                    })
693                })
694            ]
695        })
696    });
697};
698
699// EXTERNAL MODULE: ./src/components/checkout/forms/shared/PhoneFieldWrapper.tsx + 1 modules
700var PhoneFieldWrapper = __webpack_require__(95469);
701// EXTERNAL MODULE: ./src/lib/utils/checkout.ts
702var utils_checkout = __webpack_require__(615114);
703;// CONCATENATED MODULE: ./src/components/checkout/hooks/useCheckoutAddressForm.ts
704
705
706
707
708
709const useCheckoutAddressForm = (props)=>{
710    var _formRef_current_getFieldState, _formRef_current_getFieldState1, _formRef_current;
711    const { formType, formRef } = props;
712    const { shippingAddressForm, billingAddressForm, setPhoneHandler, setUserContactHandler, phoneNumberValidationHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
713    const storedShippingAddress = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.shippingAddress);
714    const isShippingAddressEmpty = checkIfAddressIsEmpty(shippingAddressForm);
715    const isShippingForm = formType === constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING;
716    const shouldResetShipping = isShippingAddressEmpty && isShippingForm;
717    // On form mount, if the user has a stored address, we want to prefill the
718    // form with it only if the form is empty
719    (0,react.useEffect)(()=>{
720        const userContact = storedShippingAddress;
721        // Don't restore data if there's no meaningful data in Redux store
722        // This prevents data restoration after resets
723        if (!(userContact === null || userContact === void 0 ? void 0 : userContact.email)) {
724            return;
725        }
726        if (shouldResetShipping) {
727            var _formRef_current_reset, _formRef_current;
728            setUserContactHandler(userContact, formType);
729            (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_reset = _formRef_current.reset) === null || _formRef_current_reset === void 0 ? void 0 : _formRef_current_reset.call(_formRef_current, userContact);
730        }
731    }, [
732        formRef,
733        storedShippingAddress,
734        setUserContactHandler,
735        formType,
736        shouldResetShipping
737    ]);
738    const hasFormBeenValidated = (0,react.useRef)(false);
739    const addressForm = formType === constants_common/* USER_CONTACT_FORM_TYPE */.Hh.BILLING ? billingAddressForm : shippingAddressForm;
740    addressForm.state = (0,utils_checkout/* getStateAbbreviation */.a7)(addressForm.state);
741    const initialFormValues = (0,react.useMemo)(()=>addressForm, [
742        addressForm
743    ]);
744    const phoneNumber = formRef === null || formRef === void 0 ? void 0 : (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_getFieldState1 = _formRef_current.getFieldState) === null || _formRef_current_getFieldState1 === void 0 ? void 0 : (_formRef_current_getFieldState = _formRef_current_getFieldState1.call(_formRef_current, constants_common/* CHECKOUT_FORM_FIELD_KEYS */.yp.PHONE)) === null || _formRef_current_getFieldState === void 0 ? void 0 : _formRef_current_getFieldState.value;
745    const forcePhoneValidation = (0,react.useCallback)(()=>{
746        var _formRef_current_blur, _formRef_current;
747        formRef === null || formRef === void 0 ? void 0 : (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_blur = _formRef_current.blur) === null || _formRef_current_blur === void 0 ? void 0 : _formRef_current_blur.call(_formRef_current, constants_common/* CHECKOUT_FORM_FIELD_KEYS */.yp.PHONE);
748    }, [
749        formRef
750    ]);
751    const forceFormValidation = (0,react.useCallback)(()=>{
752        var _formRef_current_submit, _formRef_current;
753        formRef === null || formRef === void 0 ? void 0 : (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_submit = _formRef_current.submit) === null || _formRef_current_submit === void 0 ? void 0 : _formRef_current_submit.call(_formRef_current);
754    }, [
755        formRef
756    ]);
757    // The phone field is the last field in the form so at this point we want to
758    // let the user know if some fields are invalid
759    (0,react.useEffect)(()=>{
760        if (phoneNumber && !hasFormBeenValidated.current) {
761            hasFormBeenValidated.current = true;
762            forcePhoneValidation();
763            forceFormValidation();
764        }
765    }, [
766        forcePhoneValidation,
767        forceFormValidation,
768        formRef,
769        phoneNumber
770    ]);
771    const twilioLookupHandler = (0,react.useCallback)(async (phone)=>{
772        return await phoneNumberValidationHandler(phone, formType);
773    }, [
774        formType,
775        phoneNumberValidationHandler
776    ]);
777    const onPhoneFieldChange = (0,react.useCallback)((phone)=>{
778        setPhoneHandler(phone, formType);
779    }, [
780        formType,
781        setPhoneHandler
782    ]);
783    const result = (0,react.useMemo)(()=>({
784            initialFormValues,
785            twilioLookupHandler,
786            onPhoneFieldChange
787        }), [
788        twilioLookupHandler,
789        onPhoneFieldChange,
790        initialFormValues
791    ]);
792    return result;
793};
794const checkIfAddressIsEmpty = (formValues)=>{
795    const { country, dialCode, ...rest } = formValues;
796    return Object.values(rest).every((value)=>!value);
797};
798
799// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/hooks/corporate-gift/useRecipientData.js
800var useRecipientData = __webpack_require__(173273);
801;// CONCATENATED MODULE: ./src/components/checkout/hooks/useRecipientFormV
801alues.ts
802
803
804/**
805 * Deep equality check for form values to prevent unnecessary updates
806 */ const areValuesEqual = (a, b)=>{
807    const fieldsToCheck = [
808        "firstName",
809        "lastName",
810        "email",
811        "address1",
812        "address2",
813        "city",
814        "state",
815        "postalCode",
816        "phone"
817    ];
818    return fieldsToCheck.every((field)=>a[field] === b[field]);
819};
820/**
821 * Custom hook that merges recipient data into form initial values and updates
822 * the form when recipient data becomes available or when initialFormValues changes.
823 *
824 * react-final-form only uses initialValues on mount, so this hook manually
825 * updates the form when recipient data is loaded (e.g., from session storage)
826 * or when initialFormValues changes.
827 *
828 * This hook prevents hydration mismatches by ensuring recipient data is only
829 * loaded client-side after mount, matching the server-rendered initial state.
830 *
831 * @param formRef - Reference to the react-final-form FormApi instance
832 * @param initialFormValues - Base initial values for the form
833 * @param formType - Type of form (SHIPPING, BILLING, etc.)
834 * @param setUserContactHandler - Handler to sync form values with checkout context
835 * @returns Memoized initial form values with recipient data merged in
836 *
837 * @example
838 * ```tsx
839 * const initialFormValuesRef = useRecipientFormValues({
840 *   formRef,
841 *   initialFormValues,
842 *   formType: USER_CONTACT_FORM_TYPE.SHIPPING,
843 *   setUserContactHandler,
844 * });
845 * ```
846 */ const useRecipientFormValues = (param)=>{
847    let { formRef, initialFormValues, formType, setUserContactHandler } = param;
848    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
849    const previousInitialValuesRef = (0,react.useRef)({});
850    const recipientDataAppliedRef = (0,react.useRef)(false);
851    const [isMounted, setIsMounted] = (0,react.useState)(false);
852    const [recipientData, setRecipientData] = (0,react.useState)(null);
853    // Load recipient data client-side only to prevent hydration mismatch
854    // Both server and client will render with initialFormValues initially
855    (0,react.useEffect)(()=>{
856        setIsMounted(true);
857        const data = getRecipientData();
858        setRecipientData(data);
859    }, [
860        getRecipientData
861    ]);
862    /**
863   * Memoized computation of initial form values.
864   *
865   * IMPORTANT: Always returns initialFormValues to ensure hydration consistency.
866   * Recipient data is never included in initialValues to prevent server/client mismatch.
867   * Instead, recipient data is applied via useEffect after mount.
868   *
869   * Uses deep comparison to prevent unnecessary re-renders when object reference changes
870   * but values remain the same.
871   *
872   * @returns {Object} The initial values for the form (always initialFormValues for hydration safety).
873   */ const initialFormValuesRef = (0,react.useMemo)(()=>{
874        // Always return initialFormValues to ensure server and client render the same
875        // Recipient data will be applied via useEffect after mount
876        return {
877            ...initialFormValues
878        };
879    // eslint-disable-next-line react-hooks/exhaustive-deps
880    }, [
881        // Use deep comparison by stringifying key fields to prevent infinite loops
882        initialFormValues.firstName,
883        initialFormValues.lastName,
884        initialFormValues.email,
885        initialFormValues.address1,
886        initialFormValues.address2,
887        initialFormValues.city,
888        initialFormValues.state,
889        initialFormValues.postalCode,
890        initialFormValues.phone
891    ]);
892    /**
893   * Update form values when recipient data becomes available or when initialFormValues changes.
894   * react-final-form only uses initialValues on mount, so we need to manually update the form.
895   *
896   * This effect runs after mount to apply recipient data, ensuring hydration consistency.
897   */ (0,react.useEffect)(()=>{
898        // Only update form after mount to prevent hydration mismatches
899        if (!isMounted) return;
900        if (!formRef.current) return;
901        // Ensure form is initialized before accessing state
902        const formState = formRef.current.getState();
903        if (!formState) return;
904        // Use recipientData from state (loaded client-side only) instead of calling getRecipientData()
905        const currentValues = formState.values || {};
906        const previousInitialValues = previousInitialValuesRef.current;
907        // Check if initialFormValues has actually changed using deep comparison
908        const initialValuesChanged = !areValuesEqual(initialFormValues, previousInitialValues);
909        // Build merged values starting from initialFormValues
910        const mergedValues = {
911            ...initialFormValues
912        };
913        // Determine which fields should be updated
914        let shouldUpdate = false;
915        // First, merge recipient data into mergedValues if available and not already applied
916        if (recipientData && !recipientDataAppliedRef.current) {
917            if (recipientData.firstName) {
918                mergedValues.firstName = recipientData.firstName;
919                shouldUpdate = true;
920            }
921            if (recipientData.lastName) {
922                mergedValues.lastName = recipientData.lastName;
923                shouldUpdate = true;
924            }
925            if (recipientData.email) {
926                mergedValues.email = recipientData.email;
927                shouldUpdate = true;
928            }
929            // Mark recipient data as applied to prevent re-applying on every render
930            if (shouldUpdate) {
931                recipientDataAppliedRef.current = true;
932            }
933        }
934        // Then, check if we need to update from initialFormValues changes
935        // Only update fields that haven't been changed by the user
936        if (initialValuesChanged) {
937            const fieldsToCheck = [
938                "address1",
939                "address2",
940                "city",
941                "state",
942                "postalCode",
943                "phone"
944            ];
945            fieldsToCheck.forEach((field)=>{
946                const newValue = initialFormValues[field];
947                const previousValue = previousInitialValues[field];
948                const currentValue = currentValues[field];
949                // Update if:
950                // 1. Field is empty in current form, OR
951                // 2. Field matches previous initial value (meaning user hasn't changed it), OR
952                // 3. New initial value is different from current value and current matches previous initial
953                if (newValue !== undefined && (!currentValue || currentValue === previousValue || newValue !== previousValue && currentValue === previousValue)) {
954                    mergedValues[field] = newValue;
955                    shouldUpdate = true;
956                }
957            });
958        }
959        // Only update if values actually changed to prevent infinite loops
960        if (shouldUpdate && !areValuesEqual(mergedValues, currentValues)) {
961            // Use initialize to update form values without resetting validation state
962            formRef.current.initialize(mergedValues);
963            // Also update the checkout context to keep state in sync
964            setUserContactHandler({
965                firstName: mergedValues.firstName,
966                lastName: mergedValues.lastName,
967                email: mergedValues.email,
968                address1: mergedValues.address1,
969                address2: mergedValues.address2,
970                city: mergedValues.city,
971                state: mergedValues.state,
972                postalCode: mergedValues.postalCode,
973                phone: mergedValues.phone
974            }, formType);
975        }
976        // Always update the ref to track current initial values for next comparison
977        // Use deep copy to prevent reference equality issues
978        previousInitialValuesRef.current = {
979            ...initialFormValues
980        };
981    // eslint-disable-next-line react-hooks/exhaustive-deps
982    }, [
983        formRef,
984        recipientData,
985        setUserContactHandler,
986        formType,
987        isMounted,
988        // Use individual fields instead of the whole object to prevent infinite loops
989        // This is intentional - we need deep comparison, not reference equality
990        initialFormValues.firstName,
991        initialFormValues.lastName,
992        initialFormValues.email,
993        initialFormValues.address1,
994        initialFormValues.address2,
995        initialFormValues.city,
996        initialFormValues.state,
997        initialFormValues.postalCode,
998        initialFormValues.phone
999    ]);
1000    return {
1001        initialFormValuesRef,
1002        recipientData
1003    };
1004};
1005
1006;// CONCATENATED MODULE: ./src/components/checkout/forms/AddressForm.tsx
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036const phoneFieldValidators = [
1037    (0,forms_FieldValidator/* required */.C1)(),
1038    (0,forms_FieldValidator/* phoneNumber */.jM)(),
1039    (0,forms_FieldValidator/* minLength */.Ei)(constants_common/* MIN_PHONE_LENGTH */.FZ)
1040];
1041const ADDRESS_AUTOCOMPLETE_PROVIDER = environment.nextAppEnv.addressAutocompleteProvider;
1042const AddressForm = (param)=>{
1043    let { isLoggedInUser = false, formType = constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING, hideAddressFields = false, isDefaultAddress, setIsDefaultAddress } = param;
1044    var _selectedStore_address;
1045    const formRef = (0,react.useRef)(null);
1046    const [externalValidationErrors, setExternalValidationErrors] = (0,react.useState)({});
1047    const { countryShort } = (0,store_hooks/* useAppSelector */.C)((state)=>state.locale);
1048    const { selectedStore } = (0,DeliveryProvider/* useDelivery */.qk)();
1049    const stateList = (0,lib_utils_locale.getStateList)(countryShort);
1050    const { currentStep, shippingAddressForm, setAddressFieldHandler, setUserContactHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
1051    const { initialFormValues, onPhoneFieldChange, twilioLookupHandler } = useCheckoutAddressForm({
1052        formType,
1053        formRef
1054    });
1055    const isDeliveryForm = currentStep === CheckoutProvider/* CheckoutSteps */.bN.delivery;
1056    const selectedStoreAddress = selectedStore === null || selectedStore === void 0 ? void 0 : (_selectedStore_address = selectedStore.address) === null || _selectedStore_address === void 0 ? void 0 : _selectedStore_address.address1;
1057    /** If shippingAddress is ever equal to the address of the selected store on the pickupform, we do not want that - so reset it */ (0,react.useEffect)(()=>{
1058        const userContact = {
1059            ...(0,CheckoutProvider/* defaultUserContact */.P5)(countryShort),
1060            firstName: shippingAddressForm.firstName,
1061            lastName: shippingAddressForm.lastName,
1062            email: shippingAddressForm.email,
1063            phone: shippingAddressForm.phone
1064        };
1065        if (isDeliveryForm && selectedStoreAddress === shippingAddressForm.address1) {
1066            var _formRef_current;
1067            setUserContactHandler(userContact, constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING);
1068            formRef === null || formRef === void 0 ? void 0 : (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : _formRef_current.reset({
1069                ...userContact
1070            });
1071        }
1072    }, [
1073        selectedStoreAddress,
1074        isDeliveryForm,
1075        countryShort,
1076        setUserContactHandler,
1077        shippingAddressForm.address1,
1078        shippingAddressForm.firstName,
1079        shippingAddressForm.lastName,
1080        shippingAddressForm.email,
1081        shippingAddressForm.phone
1082    ]);
1083    let updateFieldValue = null;
1084    const getFormatAddress1 = (street_number, route)=>{
1085        let address1 = "";
1086        if (street_number && route) {
1087            address1 = "".concat(street_number, " ").concat(route);
1088        } else if (street_number && !route) {
1089            address1 = street_number;
1090        } else if (!street_number && route) {
1091            address1 = route;
1092        }
1093        return address1;
1094    };
1095    const onAddressChange = (0,react.useCallback)((address)=>{
1096        var _formRef_current;
1097        const change = formRef === null || formRef === void 0 ? void 0 : (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : _formRef_current.change;
1098        if (change) {
1099            var _address_street_number, _address_route, _address_locality, _address_administrative_area_level_1, _address_postal_code, _address_country, _address_country1;
1100            const formattedAddress = {
1101                address1: getFormatAddress1(address === null || address === void 0 ? void 0 : (_address_street_number = address.street_number) === null || _address_street_number === void 0 ? void 0 : _address_street_number.long_name, address === null || address === void 0 ? void 0 : (_address_route = address.route) === null || _address_route === void 0 ? void 0 : _address_route.long_name),
1102                city: address === null || address === void 0 ? void 0 : (_address_locality = address.locality) === null || _address_locality === void 0 ? void 0 : _address_locality.long_name,
1103                state: address === null || address === void 0 ? void 0 : (_address_administrative_area_level_1 = address.administrative_area_level_1
1103) === null || _address_administrative_area_level_1 === void 0 ? void 0 : _address_administrative_area_level_1.short_name,
1104                postalCode: address === null || address === void 0 ? void 0 : (_address_postal_code = address.postal_code) === null || _address_postal_code === void 0 ? void 0 : _address_postal_code.long_name,
1105                country: address === null || address === void 0 ? void 0 : (_address_country = address.country) === null || _address_country === void 0 ? void 0 : _address_country.short_name,
1106                dialCode: address === null || address === void 0 ? void 0 : (_address_country1 = address.country) === null || _address_country1 === void 0 ? void 0 : _address_country1.short_name
1107            };
1108            setUserContactHandler({
1109                ...formattedAddress
1110            }, formType);
1111            change("city", formattedAddress.city);
1112            change("postalCode", formattedAddress.postalCode);
1113            Object.entries(formattedAddress).map((param)=>{
1114                let [key, value] = param;
1115                updateFieldValue(key, value);
1116            });
1117        }
1118    }, [
1119        formType,
1120        setUserContactHandler,
1121        updateFieldValue
1122    ]);
1123    const validateAddressForPOBox = ()=>formType === constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING && (0,forms_FieldValidator/* validatePOBoxAddress */.Ny)();
1124    const columnSizes = {
1125        email: {
1126            md: 6
1127        },
1128        firstName: {
1129            md: 6
1130        },
1131        lastName: {
1132            md: 6
1133        },
1134        address: {
1135            md: 6
1136        },
1137        apartment: {
1138            md: 6
1139        },
1140        phone: {
1141            md: 6
1142        },
1143        dialCode: {
1144            md: 6
1145        },
1146        city: {
1147            md: isDeliveryForm ? 6 : 12
1148        },
1149        country: {
1150            md: isDeliveryForm ? 6 : 4
1151        },
1152        state: {
1153            md: isDeliveryForm ? 6 : 4
1154        },
1155        postalCode: {
1156            md: isDeliveryForm ? 6 : 4
1157        },
1158        defaultAddress: {
1159            md: 6
1160        }
1161    };
1162    const fieldValidators = {
1163        city: [
1164            (0,forms_FieldValidator/* required */.C1)(),
1165            (0,forms_FieldValidator/* isValidCity */.m0)(),
1166            ()=>externalValidationErrors.city
1167        ],
1168        address1: [
1169            (0,forms_FieldValidator/* required */.C1)(),
1170            validateAddressForPOBox(),
1171            ()=>externalValidationErrors.address1
1172        ],
1173        postalCode: [
1174            (0,forms_FieldValidator/* required */.C1)(),
1175            (0,FieldValidator.isValidZip)(undefined, {
1176                langCode: locale.LANGUAGE_CODE
1177            }),
1178            (0,forms_FieldValidator/* minLength */.Ei)(5),
1179            ,
1180            ()=>externalValidationErrors.postalCode
1181        ]
1182    };
1183    const validate = (0,react.useCallback)(()=>{
1184        if (Object.keys(externalValidationErrors).length > 0) {
1185            return externalValidationErrors;
1186        }
1187        return {};
1188    }, [
1189        externalValidationErrors
1190    ]);
1191    const handleFieldChange = (0,react.useCallback)((value, fieldName)=>{
1192        setAddressFieldHandler(value, fieldName, formType);
1193        setExternalValidationErrors((prev)=>({
1194                ...prev,
1195                [fieldName]: "",
1196                generic: ""
1197            }));
1198    }, [
1199        formType,
1200        setAddressFieldHandler
1201    ]);
1202    const handleZipChange = (e)=>{
1203        const zipValue = (0,checkout.formatZipcode)(e.target.value.trim(), countryShort).trim();
1204        handleFieldChange(zipValue, user/* USER_CONTACT */.A.ZIP);
1205    };
1206    /**
1207   * Merge recipient data into form initial values and update form when recipient data becomes available.
1208   */ const { initialFormValuesRef, recipientData } = useRecipientFormValues({
1209        formRef,
1210        initialFormValues,
1211        formType,
1212        setUserContactHandler
1213    });
1214    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
1215        children: [
1216            /*#__PURE__*/ (0,jsx_runtime.jsx)(GenericErrorMessage, {
1217                errorMessage: externalValidationErrors.generic
1218            }),
1219            /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Form, {
1220                onSubmit: (noop_default()),
1221                initialValues: initialFormValuesRef,
1222                validate: validate,
1223                mutators: {
1224                    setValue: (param, state, param1)=>{
1225                        let [name, newValue] = param, { changeValue } = param1;
1226                        changeValue(state, name, ()=>newValue);
1227                    }
1228                },
1229                render: (param)=>{
1230                    let { form } = param;
1231                    var _form_mutators;
1232                    formRef.current = form;
1233                    updateFieldValue = form === null || form === void 0 ? void 0 : (_form_mutators = form.mutators) === null || _form_mutators === void 0 ? void 0 : _form_mutators.setValue;
1234                    return /*#__PURE__*/ (0,jsx_runtime.jsx)("form", {
1235                        id: "address_form",
1236                        "aria-label": "address form",
1237                        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.ZP, {
1238                            container: true,
1239                            spacing: 2,
1240                            children: [
1241                                formType !== constants_common/* USER_CONTACT_FORM_TYPE */.Hh.BILLING && !isLoggedInUser && /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1242                                    item: true,
1243                                    xs: 12,
1244                                    md: columnSizes.email.md,
1245                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1246                                        name: "email",
1247                                        autoComplete: "email",
1248                                        formatOnBlur: false,
1249                                        onChange: (e)=>handleFieldChange(e.target.value, user/* USER_CONTACT */.A.EMAIL),
1250                                        "data-testid": "form_field-email",
1251                                        label: (0,utils_locale.t)("checkout.address_form.email"),
1252                                        validate: (0,forms_FieldValidator/* default */.ZP)([
1253                                            (0,forms_FieldValidator/* required */.C1)(),
1254                                            (0,forms_FieldValidator/* email */.Do)(),
1255                                            (0,forms_FieldValidator/* minLength */.Ei)(2)
1256                                        ], "email"),
1257                                        showToolTip: false,
1258                                        inputProps: {
1259                                            maxLength: forms_FieldValidator/* EMAIL_MAX_LENGTH */.bV
1260                                        },
1261                                        required: true,
1262                                        placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.email"),
1263                                        isDisabled: !!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.email)
1264                                    })
1265                                }),
1266                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1267                                    item: true,
1268                                    xs: 12,
1269                                    md: columnSizes.firstName.md,
1270                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1271                                        name: "firstName",
1272                                        autoComplete: "given-name",
1273                                        onChange: (e)=>handleFieldChange(e.target.value, user/* USER_CONTACT */.A.FIRST_NAME),
1274                                        "data-testid": "form_field-firstName",
1275                                        label: (0,utils_locale.t)("checkout.address_form.first_name"),
1276                                        validate: (0,forms_FieldValidator/* default */.ZP)([
1277                                            (0,forms_FieldValidator/* required */.C1)(),
1278                                            (0,forms_FieldValidator/* name */.u2)(),
1279                                            (0,forms_FieldValidator/* minLength */.Ei)(2)
1280                                        ], "First Name"),
1281                                        showToolTip: false,
1282                                        required: true,
1283                                        placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.first_name")
1284                                    })
1285                                }),
1286                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1287                                    item: true,
1288                                    xs: 12,
1289                                    md: columnSizes.lastName.md,
1290                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1291                                        name: "lastName",
1292                                        autoComplete: "family-name",
1293                                        onChange: (e)=>handleFieldChange(e.target.value, user/* USER_CONTACT */.A.LAST_NAME),
1294                                        "data-testid": "form_field-lastName",
1295                                        type: "text",
1296                                        label: (0,utils_locale.t)("checkout.address_form.last_name"),
1297                                        validate: (0,forms_FieldValidator/* default */.ZP)([
1298                                            (0,forms_FieldValidator/* required */.C1)(),
1299                                            (0,forms_FieldValidator/* name */.u2)(),
1300                                            (0,forms_FieldValidator/* minLength */.Ei)(2)
1301                                        ], "Last Name"),
1302                                        showToolTip: false,
1303                                        required: true,
1304                                        placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.last_name")
1305                                    })
1306                                }),
1307                                !hideAddressFields && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
1308                                    children: [
1309                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1310                                            item: true,
1311                                            xs: 12,
1312                                            md: columnSizes.address.md,
1313                                            children: ADDRESS_AUTOCOMPLETE_PROVIDER === "postgrid" ? /*#__PURE__*/ (0,jsx_runtime.jsx)(PostGridAutoComplete, {
1314                                                formRef: formRef,
1315                                                formType: formType,
1316                                                onAddressChange: (addressFields)=>{
1317                                                    if (!addressFields) return;
1318                                                    Object.entries(addressFields).map((param)=>{
1319                                                        let [key, value] = param;
1320                                                        handleFieldChange(value, key);
1321                                                    });
1322                                                },
1323                                                setExternalValidationErrors: setExternalValidationErrors
1324                                            }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
1325                                                name: "address1",
1326                                                render: (param)=>{
1327                                                    let { input, meta } = param;
1328                                                    return /*#__PURE__*/ (0,jsx_runtime.jsx)(SearchLocationInput/* default */.Z, {
1329                                                        autoComplete: "address-line1",
1330                                                        onAddressChange: onAddressChange,
1331                                                        ...input,
1332                                                        meta: meta,
1333                                                        onChange: (e)=>{
1334                                                            input.onChange(e);
1335                                                            handleFieldChange(e.target.value, user/* USER_CONTACT */.A.ADDRESS_LINE1);
1336                                                        },
1337                                                        validate: (0,forms_FieldValidator/* default */.ZP)([
1338                                                            (0,forms_FieldValidator/* required */.C1)((0,utils_locale.t)("checkout.address_form.error_messages.required_field")),
1339                                                            validateAddressForPOBox()
1340                                                        ]),
1341                                                        name: "address1"
1342                                                    });
1343                                                }
1344                                            })
1345                                        }),
1346                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1347                                            item: true,
1348                                            xs: 12,
1349                                            md: columnSizes.apartment.md,
1350                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1351                                                name: "address2",
1352                                                autoComplete: "address-line2",
1353                                                onChange: (e)=>handleFieldChange(e.target.value, user/* USER_CONTACT */.A.ADDRESS_LINE2),
1354                                                validate: (0,forms_FieldValidator/* default */.ZP)([
1355                                                    validateAddressForPOBox()
1356                                                ]),
1357                                                validateOnDirty: true,
1358                                                "data-testid": "form_field-address2",
1359                                                type: "text",
1360                                                label: (0,utils_locale.t)("checkout.address_form.complement"),
1361                                                showToolTip: false,
1362                                                inputProps: {
1363                                                    maxLength: 150
1364                                                },
1365                                                placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.address2")
1366                                            })
1367                                        }),
1368                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1369                                            item: true,
1370                                            xs: 12,
1371                                            md: columnSizes.city.md,
1372                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1373                                                name: "city",
1374                                                autoComplete: "address-level2",
1375                                                onChange: (e)=>handleFieldChange(e.target.value, user/* USER_CONTACT */.A.CITY),
1376                                                "data-testid": "form_field-city",
1377                                                type: "text",
1378                                                label: (0,utils_locale.t)("checkout.address_form.city"),
1379                                                validateOnDirty: true,
1380                                                validate: (0,forms_FieldValidator/* default */.ZP)(fieldValidators.city),
1381                                                showToolTip: false,
1382                                                required: true,
1383                                                placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.city")
1384                                            })
1385                                        }),
1386                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1387                                            item: true,
1388                                            xs: 12,
1389                                            md: columnSizes.state.md,
1390                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
1391                                                name: "state",
1392                                                validate: (0,forms_FieldValidator/* default */.ZP)([
1393                                                    (0,forms_FieldValidator/* required */.C1)()
1394                                                ]),
1395                                                render: (param)=>{
1396                                                    let { input, meta } = param;
1397                                                    return /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Select */.Ph, {
1398                                                        id: "state",
1399                                                        autoComplete: "address-level1",
1400                                                        selected: input === null || input === void 0 ? void 0 : input.value,
1401                                                        label: (0,utils_locale.t)("checkout.address_form.state"),
1402                                                        "data-testid": "form_field-state",
1403                                                        options: stateList,
1404                                                        error: (meta === null || meta === void 0 ? void 0 : meta.touched) && meta.error && (0,utils_locale.t)("customer.form_errors.state_required") || externalValidationErrors.state,
1405                                                        ...input,
1406                                                        onChange: (e)=>{
1407                                                            input.onChange(e);
1408                                                            handleFieldChange(e.target.value, user/* USER_CONTACT */.A.STATE);
1409                                                        },
1410                                                        required: true
1411                                                    });
1412                                                }
1413                                            })
1414                                        }),
1415                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1416                                            item: true,
1417                                            xs: 12,
1418                                            md: columnSizes.country.md,
1419                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
1420                                                name: "country",
1421                                                render: (param)=>{
1422                                                    let { input } = param;
1423                                                    return /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Select */.Ph, {
1424                                                        autoComplete: "country",
1425                                                        selected: countryShort,
1426                                                        label: (0,utils_locale.t)("checkout.address_form.country"),
1427                                                        "data-testid": "form_field-country",
1428                                                        options: Country,
1429                                                        ...input,
1430                                                        onChange: (e)=>{
1431                                                            handleFieldChange(e.target.value, user/* USER_CONTACT */.A.COUNTRY_REGION);
1432                                                        },
1433                                                        disabled: true
1434                                                    });
1435                                                }
1436                                            })
1437                                        }),
1438                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1439                                            item: true,
1440                                            xs: 12,
1441                                            md: columnSizes.postalCode.md,
1442                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
1443                                                name: "postalCode",
1444                                                autoComplete: "postal-code",
1445                                                onChange: handleZipChange,
1446                                                "data-testid": "form_field-zip",
1447                                                type: "text",
1448                                                maxLength: commons.ZIP_CODE_MAX_LENGTH,
1449                                                label: (0,utils_locale.t)("checkout.address_form.zip_code"),
1450                                                validate: (0,forms_FieldValidator/* default */.ZP)(fieldValidators.postalCode),
1451                                                required: true,
1452                                                placeholder: (0,utils_locale.t)("checkout.address_form.place_holders.zipcode"),
1453                                                ...locale.isUSLocale && {
1454                                                    customFormat: (value)=>(0,formUtils.sanitizeZipcodeUS)(value)
1455                                                }
1456                                            })
1457                                        })
1458                                    ]
1459                                }),
1460                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
1461                                    item: true,
1462                                    xs: 12,
1463                                    md: columnSizes.phone.md,
1464                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PhoneFieldWrapper/* PhoneFieldWrapper */.u, {
1465                                        autoComplete: "tel",
1466                                        twilioPhoneLookupHandler: twilioLookupHandler,
1467                                        onChange: onPhoneFieldChange,
1468                                        formType: formType,
1469                                        required: true
1470                                    })
1471                                }),
1472                                formType === constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING && isLoggedInUser && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
1473                                    className: (AddressFormContainer_module_default())["address-form__default-address__field-set"],
1474                                    children: [
1475                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
1476                                            type: "checkbox",
1477                                            name: "defaultAddress",
1478                                            render: (param)=>{
1479                                                let { input } = param;
1480                                                return /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
1481                                                    type: "checkbox",
1482                                                    id: "SetDefaultAddress",
1483                                                    ...input,
1484                                                    checked: isDefaultAddress,
1485                                                    onChange: (e)=>{
1486                                                        setIsDefaultAddress && setIsDefaultAddress(e.target.checked);
1487                                                    }
1488                                                });
1489                                            }
1490                                        }),
1491                                        /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
1492                                            htmlFor: "SetDefaultAddress",
1493                                            className: (AddressFormContainer_module_default())["address-form__default-address__field-set__label"],
1494                                            children: (0,utils_locale.t)("customer.addresses.set_default")
1495                                        })
1496                                    ]
1497                                })
1498                            ]
1499                        })
1500                    });
1501                }
1502            })
1503        ]
1504    });
1505};
1506
1507;// CONCATENATED MODULE: ./src/components/checkout/forms/address-form-container/AddressFormContainer.tsx
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555const ADDRESS_FORM_CONTAINER_TEST_ID = "address-form-container";
1556/**
1557 * Even when the shipping zip matches the top-of-funnel zip, the stored
1558 * region can be unresolved or stale (e.g. a session hydrated with a zip
1559 * but no region), so it must be re-resolved before the cart is refetched
1560 * or the displayed prices won't match the region the order is charged
1561 * with. A failed lookup resolves to '' and must not clear a valid stored
1562 * region. `getStoredRegionId` is read at call time (not a render-time
1563 * value) so a region set while this was in flight isn't overwritten with
1564 * a stale comparison. Persisted via `syncRegionId` so the correction
1565 * (cookie + mapped flag) survives a reload, matching the zip-changed path.
1566 */ async function resolveRegionForUnchangedZip(param) {
1567    let { dispatch, getStoredRegionId, fetchRegionId } = param;
1568    const regionId = await fetchRegionId();
1569    if (regionId !== "" && regionId !== getStoredRegionId()) {
1570        (0,useZipCode/* syncRegionId */.NU)({
1571            dispatch,
1572            regionId,
1573            isRegionIdMapped: true
1574        });
1575    }
1576}
1577const ADDRESS_VALIDATION_ENABLED = environment.nextAppEnv.feature_toggle.US.addressValidation;
1578const AddressFormContainer = (param)=>{
1579    let { className, setShowMultiDeliverySection, setAddressSelectedHandler, addingNewAddress } = param;
1580    const { shippingAddressFormIsValid, shippingAddressForm, setUserContactHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
1581    const { getCustomerDetails } = (0,hooks/* useCustomer */.ON)();
1582    const cartSlice = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
1583    const { getInventoryList } = (0,useInventory/* useInventory */.m)();
1584    const isWebViewVisitor = (0,store_hooks/* useAppSelector */.C)((state)=>state.environment.isWebViewVisitor);
1585    // Top of funnel storeId
1586    const tofStoreId = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.storeId);
1587    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
1588    const [areWindowsAvailable, setAreWindowsAvailable] = (0,react.useState)(true);
1589    const [addressZipVerificationError, setAddressZipVerificationError] = (0,react.useState)("");
1590    const membershipLineItemAddedToTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* membershipLineItemInTheCartSelector */.fg);
1591    const { cartFulfillmentTypeHandler } = (0,useCartFulfillmentType/* useCartFulfillmentType */.c)();
1592    const sessionEmail = (0,store_hooks/* useAppSelector */.C)(customerInfoSlice/* customerEmailSelector */.qL);
1593    const { customerInfo } = (0,store_hooks/* useAppSelector */.C)((state)=>state);
1594    const isLoggedInUser = !!(customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.email);
1595    const { fetchWindows } = (0,delivery_hooks/* useApiWindows */.n)();
1596    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
1597    const [submitting, setSubmitting] = (0,react.useState)(false);
1598    const [addressModalIsOpen, setAddressModalIsOpen] = (0,react.useState)(false);
1599    const [verifiedAddress, setVerifiedAddress] = (0,react.useState)();
1600    const [isEnteredAddrVerificationStatusFailed, setIsEnteredAddrVerificationStatusFailed] = (0,react.useState)(false);
1601    const [useVerifiedAddress, setUseVerifiedAddress] = (0,react.useState)(true);
1602    const [isPriceVariationModalOpen, setIsPriceVariationModalOpen] = (0,react.useState)(false);
1603    const [isDefaultAddress, setIsDefaultAddress] = (0,react.useState)(false);
1604    const storeIdToSubmit = (0,react.useRef)(tofStoreId);
1605    // Top of funnel zipcode
1606    const { zipcode: tofZipcode } = (0,useZipCode/* useZipCode */.lH)();
1607    const shippingZipcode = shippingAddressForm.postalCode;
1608    (0,react.useEffect)(()=>{
1609        setAddressZipVerificationError("");
1610    }, [
1611        shippingZipcode
1612    ]);
1613    const initialRegionIdRef = (0,react.useRef)((0,cookies/* getRegionIdStoredInCookie */.SC)());
1614    const newRegionIdRef = (0,react.useRef)("");
1615    const storeFulfillmentResponse = (0,react.useRef)();
1616    const validationTranslation = {
1617        addressNotServed: (0,utils_locale.t)("checkout.delivery.address_not_served")
1618    };
1619    const { findOutOfStockItems, setRestrictedStateItems, restrictedStateItems, unavailableItems, removeRestrictedStateItemsFromCart, removeItemsOutOfStockFromCart, showModal: showUnavailableItemsModal, loading, resetRestrictedStateItems, resetUnavailableItems, continueToCheckoutWithRestrictedStateItems, keepShoppingWithRestrictedStateItems } = (0,hooks/* useUnavailableItems */.Eu)();
1620    const { IS_FASTLANE_ENABLED, handleFastlaneAddressChange, getUserFastlaneConfig, authenticateFastlaneEmail } = (0,useFastlane/* useFastlane */.Pf)();
1621    const fastlaneUserConfig = getUserFastlaneConfig();
1622    const isFastlaneEnabledWithConfig = IS_FASTLANE_ENABLED && fastlaneUserConfig !== null && fastlaneUserConfig.fastlaneAuthData.authenticationState === useFastlane/* FastlaneAuthStatus */.RW.SUCCEEDED;
1623    const shouldShowFastlaneAddressChangeButton = isFastlaneEnabledWithConfig;
1624    const shouldFastlaneAuthenticationRun = isFastlaneEnabledWithConfig;
1625    (0,react.useEffect)(()=>{
1626        const triggerFastlaneAuthentication = async ()=>{
1627            await authenticateFastlaneEmail();
1628        };
1629        if (shouldFastlaneAuthenticationRun) {
1630            triggerFastlaneAuthentication();
1631        }
1632    }, []); //NOTE: Keeping intentionally, want to call email lookup on reload/refresh
1633    const handlePriceVariationModalClose = ()=>{
1634        try {
1635            // This logic sets the initial regionId stored in the cookie
1636            // back to its original value if the user cancels the price variation modal.
1637            (0,customerApi/* getCustomerRegion */.Xd)(tofZipcode);
1638        } finally{
1639            setIsPriceVariationModalOpen(false);
1640            setSubmitting(false);
1641        }
1642    };
1643    const handlePriceVariationModalConfirm = async ()=>{
1644        setIsPriceVariationModalOpen(false);
1645        const unavailableItems = await getUnavailableItems(storeFulfillmentResponse.current);
1646        if (unavailableItems === null || unavailableItems === void 0 ? void 0 : unavailableItems.length) return;
1647        handleCart();
1648    };
1649    // Verify address prior to submission
1650    const onAddressFormContinue = async ()=>{
1651        try {
1652            const isExactMatchWithPreviouslyVerifiedAddress = (0,addressUtils/* isExactAddressMatch */.WL)(shippingAddressForm, verifiedAddress);
1653            if (!useVerifiedAddress && isExactMatchWithPreviouslyVerifiedAddress) {
1654                onAddressFormSubmitted();
1655                return;
1656            }
1657            const verifiedAddressResponse = await getVerifiedAddress();
1658            if (!verifiedAddressResponse || (0,addressUtils/* isCityStatePostalCodeEmpty */.PE)(verifiedAddressResponse)) {
1659                onAddressFormSubmitted();
1660                return;
1661            }
1662            handleVerificationStatus(verifiedAddressResponse);
1663        } catch (error) {
1664            console.error(error);
1665            onAddressFormSubmitted();
1666        }
1667    };
1668    const handleVerificationStatus = (verifiedAddressResponse)=>{
1669        setVerifiedAddress(verifiedAddressResponse);
1670        switch(verifiedAddressResponse.status){
1671            case common/* EAddressVerificationStatus */.m.CORRECTED:
1672                setAddressModalIsOpen(true);
1673                break;
1674            case common/* EAddressVerificationStatus */.m.FAILED:
1675                handleFailedVerification();
1676                break;
1677            default:
1678                onAddressFormSubmitted();
1679        }
1680    };
1681    //NOTE: Incase of hiding popup while matching city and do not want to show popup and submit the form
1682    //const handleCorrectedAddress = (verifiedAddressResponse: IUserContact) => {
1683    // const isCityMatched = isExactCityMatch(
1684    //   shippingAddressForm,
1685    //   verifiedAddressResponse
1686    // );
1687    // if (!isCityMatched) {
1688    //   setAddressModalIsOpen(false);
1689    //   setVerifiedAddress(shippingAddressForm as any);
1690    //   onAddressFormSubmitted();
1691    // } else {
1692    //   setAddressModalIsOpen(true);
1693    // }
1694    // setAddressModalIsOpen(true);
1695    // };
1696    const getVerifiedAddress = async ()=>{
1697        var _response_data;
1698        const response = await (0,api_cart/* verifyShippingAddress */.R8)(shippingAddressForm);
1699        const address = response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.address;
1700        return address;
1701    };
1702    const handleFailedVerification = ()=>{
1703        setUseVerifiedAddress(false);
1704        setIsEnteredAddrVerificationStatusFailed(true);
1705        setAddressModalIsOpen(true);
1706    };
1707    const onAddressFormSubmitted = async ()=>{
1708        try {
1709            setAddressZipVerificationError("");
1710            if (!shippingAddressFormIsValid) return;
1711            setAreWindowsAvailable(true);
1712            setSubmitting(true);
1713            const zipcodeHasChanged = tofZipcode !== shippingZipcode;
1714            if (zipcodeHasChanged || membershipLineItemAddedToTheCart) {
1715                var _cartResponse_data_restrictedStateLineItems, _cartResponse_data;
1716                const { response, error } = await (0,withAsync/* withAsync */.j)(()=>(0,checkoutApi/* submitZipcode */.s_)(shippingZipcode, {
1717                        omitHeaders: true
1718                    }));
1719                if (error) {
1720                    throw error;
1721                }
1722                dispatch((0,zipcodeSlice/* setStoreDetails */.Gi)(response === null || response === void 0 ? void 0 : response.data));
1723                storeFulfillmentResponse.current = response === null || response === void 0 ? void 0 : response.data;
1724                storeIdToSubmit.current = utils/* store.getFirstStoreId */.h.getFirstStoreId(storeFulfillmentResponse.current);
1725                const regionIdHasChanged = await checkIfRegionIdHasChanged();
1726                if (false) {}
1727                const unavailableItems = await getUnavailableItems(storeFulfillmentResponse.current);
1728                const stateFromShippingZip = (0,productUtils.getStateFromZip)(shippingZipcode);
1729                // check for items the BE removed that were State Restricted
1730                const cartResponse = await (0,getCartItemApi/* getCart */.d)({
1731                    checkInventory: false,
1732                    checkStateRestrictions: true,
1733                    state: stateFromShippingZip
1734                });
1735                if (cartResponse === null || cartResponse === void 0 ? void 0 : (_cartResponse_data = cartResponse.data) === null || _cartResponse_data === void 0 ? void 0 : (_cartResponse_data_restrictedStateLineItems = _cartResponse_data.restrictedStateLineItems) === null || _cartResponse_data_restrictedStateLineItems === void 0 ? void 0 : _cartResponse_data_restrictedStateLineItems.length) {
1736                    var _cartResponse_data1;
1737                    setRestrictedStateItems([
1738                        ...cartResponse === null || cartResponse === void 0 ? void 0 : (_cartResponse_data1 = cartResponse.data) === null || _cartResponse_data1 === void 0 ? void 0 : _cartResponse_data1.restrictedStateLineItems
1739                    ]);
1740                    return;
1741                }
1742                if (unavailableItems === null || unavailableItems === void 0 ? void 0 : unavailableItems.length) return;
1743            }
1744            handleCart();
1745        } catch (error) {
1746            errorHandler(error);
1747        }
1748    };
1749    const onFormSubmit = async (isLoggedInUser)=>{
1750        if (!isLoggedInUser) {
1751            (0,trackingEvents/* emarsysProceedToCheckout */.xt)(cartSlice.lineItems, shippingAddressForm.email);
1752        }
1753        if (ADDRESS_VALIDATION_ENABLED) {
1754            onAddressFormContinue();
1755        } else {
1756            onAddressFormSubmitted();
1757        }
1758    };
1759    const getRegionId = async ()=>{
1760        let regionId;
1761        try {
1762            var _data, _this;
1763            regionId = (_this = await (0,customerApi/* getCustomerRegion */.Xd)(shippingZipcode)) === null || _this === void 0 ? void 0 : (_data = _this.data) === null || _data === void 0 ? void 0 : _data.regionCode;
1764        } catch (error) {
1765            // Zipcode with no regionId
1766            regionId = "";
1767        }
1768        return (0,typeUtils.isRegionIdValue)(regionId) ? regionId : "";
1769    };
1770    const checkIfRegionIdHasChanged = async ()=>{
1771        const newRegionId = await getRegionId();
1772        const regionIdHasChanged = newRegionId !== initialRegionIdRef.current;
1773        if (regionIdHasChanged) {
1774            newRegionIdRef.current = newRegionId;
1775        }
1776        return true;
1777    };
1778    const getUnavailableItems = async (storeFulfillmentResponse)=>{
1779        var _storeFulfillmentResponse_stores;
1780        const { membershipEligible } = storeFulfillmentResponse || {};
1781        const { id: storeId, shippingTypes = [] } = (storeFulfillmentResponse === null || storeFulfillmentResponse === void 0 ? void 0 : (_storeFulfillmentResponse_stores = storeFulfillmentResponse.stores) === null || _storeFulfillmentResponse_stores === void 0 ? void 0 : _storeFulfillmentResponse_stores[0]) || {};
1782        const isAirFulfillmentType = (0,fulfillmentUtils/* checkFulfillmentType */.MQ)(dbDeliveryDataTransformer/* FULFILLMENT_TYPES */.AJ.AIR, shippingTypes === null || shippingTypes === void 0 ? void 0 : shippingTypes.filter(Boolean));
1783        const isMembershipEligible = membershipEligible && !isAirFulfillmentType;
1784        return await getItemsOutOfStock(storeId, isMembershipEligible);
1785    };
1786    const getItemsOutOfStock = async function() {
1787        let storeId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", isMemberEligible = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1788        return await findOutOfStockItems({
1789            storeIdProp: storeId,
1790            isMemberEligible
1791        });
1792    };
1793    const submitShippingAddress = async (param)=>{
1794        let { isDefaultAddress } = param;
1795        const selectedShippingAddress = // If shipping address verification FF is disabled, addressResponseUSPS will always be undefined
1796        // and shippingAddressForm used by cart slice.
1797        useVerifiedAddress && verifiedAddress ? verifiedAddress : shippingAddressForm;
1798        return await dispatch((0,store_cartSlice/* addShippingAddress */.VE)({
1799            data: selectedShippingAddress,
1800            validationTranslation,
1801            defaultAddress: isDefaultAddress !== null && isDefaultAddress !== void 0 ? isDefaultAddress : false,
1802            // ErrorHandler render the message from the real error code
1803            useResolvedMessages: true
1804        })).unwrap();
1805    };
1806    const fetchAndSetStoreId = async ()=>{
1807        const { response, error } = await (0,withAsync/* withAsync */.j)(()=>(0,checkoutApi/* submitZipcode */.s_)(shippingZipcode));
1808        if (error) {
1809            throw error;
1810        }
1811        const storeId = utils/* store.getFirstStoreId */.h.getFirstStoreId(response === null || response === void 0 ? void 0 : response.data);
1812        if (!storeId) return;
1813        storeIdToSubmit.current = storeId;
1814        dispatch((0,store_cartSlice/* setStoreIdHandler */.sW)(storeId));
1815    };
1816    const handleCart = async ()=>{
1817        try {
1818            var _shippingAddressResponse_address;
1819            await fetchAndSetStoreId();
1820            const cartFulfillmentResponse = await cartFulfillmentTypeHandler({
1821                fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.DELIVERY,
1822                storeId: storeIdToSubmit.current,
1823                zipcode: shippingZipcode,
1824                pickupDetails: {
1825                    firstName: shippingAddressForm.firstName,
1826                    lastName: shippingAddressForm.lastName,
1827                    phone: shippingAddressForm.phone,
1828                    email: sessionEmail || shippingAddressForm.email
1829                }
1830            });
1831            const shippingAddressResponse = await submitShippingAddress({
1832                isDefaultAddress
1833            });
1834            const availableWindows = await fetchWindows();
1835            const areWindowsAvailable = !!(availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length);
1836            if (!areWindowsAvailable) {
1837                setAreWindowsAvailable(areWindowsAvailable);
1838                setSubmitting(false);
1839                return;
1840            }
1841            const zipcodeHasChanged = (shippingAddressResponse === null || shippingAddressResponse === void 0 ? void 0 : (_shippingAddressResponse_address = shippingAddressResponse.address) === null || _shippingAddressResponse_address === void 0 ? void 0 : _shippingAddressResponse_address.postalCode) !== tofZipcode;
1842            if (zipcodeHasChanged) {
1843                var _shippingAddressResponse_address1;
1844                await syncStoreZipAndRegionState({
1845                    storeId: cartFulfillmentResponse === null || cartFulfillmentResponse === void 0 ? void 0 : cartFulfillmentResponse.store.id,
1846                    zipcode: shippingAddressResponse === null || shippingAddressResponse === void 0 ? void 0 : (_shippingAddressResponse_address1 = shippingAddressResponse.address) === null || _shippingAddressResponse_address1 === void 0 ? void 0 : _shippingAddressResponse_address1.postalCode
1847                });
1848            } else {
1849                await resolveRegionForUnchangedZip({
1850                    dispatch,
1851                    getStoredRegionId: reduxCommon/* getRegionIdStoredInRedux */.bS,
1852                    fetchRegionId: getRegionId
1853                });
1854            }
1855            const response = await fetchCartItemsWithInventoryCheck();
1856            if (response) {
1857                var _response_addresses;
1858                setAddressSelectedHandler(true, "delivery");
1859                setShowMultiDeliverySection((response === null || response === void 0 ? void 0 : (_response_addresses = response.addresses) === null || _response_addresses === void 0 ? void 0 : _response_addresses.length) > 0);
1860            }
1861            if (isLoggedInUser) {
1862                getCustomerDetails();
1863            }
1864        } catch (error) {
1865            errorHandler(error);
1866        }
1867    };
1868    const syncStoreZipAndRegionState = async (param)=>{
1869        let { storeId, zipcode } = param;
1870        if (!storeId || !zipcode) return;
1871        dispatch((0,zipcodeSlice/* setZipCode */.ZC)(zipcode));
1872        (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.CUSTOMER_ZIP, zipcode, storage.STORAGE_TYPES.LOCAL);
1873        if (storeIdToSubmit.current !== tofStoreId) {
1874            var _storeFulfillmentResponse_current_stores_, _storeFulfillmentResponse_current_stores, _storeFulfillmentResponse_current;
1875            const storeShippingTypes = ((_storeFulfillmentResponse_current = storeFulfillmentResponse.current) === null || _storeFulfillmentResponse_current === void 0 ? void 0 : (_storeFulfillmentResponse_current_stores = _storeFulfillmentResponse_current.stores) === null || _storeFulfillmentResponse_current_stores === void 0 ? void 0 : (_storeFulfillmentResponse_current_stores_ = _storeFulfillmentResponse_current_stores[0]) === null || _storeFulfillmentResponse_current_stores_ === void 0 ? void 0 : _storeFulfillmentResponse_current_stores_.shippingTypes.filter(utils_typeUtils/* notEmpty */.Dw)) || [];
1876            dispatch((0,zipcodeSlice/* setShippingTypes */.$z)(storeShippingTypes));
1877            getInventoryList(storeId);
1878        }
1879        // TODO: Need to refactor in case we turn the price variation modal on
1880        const regionId = await getRegionId();
1881        dispatch((0,zipcodeSlice/* setRegionId */.i)(regionId));
1882        notifyAppOfZipcodeChange(zipcode);
1883    };
1884    const notifyAppOfZipcodeChange = async (zipcode)=>{
1885        if (isWebViewVisitor && window.flutter_inappwebview) {
1886            var _window_flutter_inappwebview_callHandler, _window_flutter_inappwebview;
1887            const dataToSend = {
1888                updateZip: {
1889                    zip: zipcode
1890                }
1891            };
1892            (_window_flutter_inappwebview = window.flutter_inappwebview) === null || _window_flutter_inappwebview === void 0 ? void 0 : (_window_flutter_inappwebview_callHandler = _window_flutter_inappwebview.callHandler) === null || _window_flutter_inappwebview_callHandler === void 0 ? void 0 : _window_flutter_inappwebview_callHandler.call(_window_flutter_inappwebview, "updateZip", dataToSend);
1893        }
1894    };
1895    const fetchCartItemsWithInventoryCheck = async ()=>{
1896        dispatch((0,TaxDelayedCardSlice/* setShowTaxDelayedCard */.Fl)(true));
1897        try {
1898            const response = await dispatch((0,store_cartSlice/* getCartItems */.fq)({
1899                checkInventory: true,
1900                setUserContactHandler,
1901                errorCodeTranslation: {},
1902                isLoggedInUser: isLoggedInUser,
1903                // ErrorHandler render the message from the real error code
1904                useResolvedMessages: true
1905            })).unwrap();
1906            dispatch((0,TaxDelayedCardSlice/* setShowTaxDelayedCard */.Fl)(false));
1907            return response;
1908        } catch (error) {
1909            Logger_default().error("handleCart", error);
1910            dispatch((0,TaxDelayedCardSlice/* setShowTaxDelayedCard */.Fl)(false));
1911            throw error;
1912        }
1913    };
1914    const handleAddressModalClose = (isUseUnverifiedAddr)=>{
1915        if (!isUseUnverifiedAddr) {
1916            setUseVerifiedAddress(true);
1917            setVerifiedAddress(undefined);
1918        }
1919        setAddressModalIsOpen(false);
1920        setIsEnteredAddrVerificationStatusFailed(false);
1921    };
1922    const handleUseADifferentZipCode = ()=>{
1923        if (unavailableItems === null || unavailableItems === void 0 ? void 0 : unavailableItems.length) resetUnavailableItems();
1924        if (restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) resetRestrictedStateItems();
1925        setAddressSelectedHandler(false, "delivery");
1926        setSubmitting(false);
1927    };
1928    const handleRemoveItemsOutOfStock = async ()=>{
1929        try {
1930            await removeItemsOutOfStockFromCart();
1931            if (restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) {
1932                await removeRestrictedStateItemsFromCart(restrictedStateItems);
1933            }
1934            handleCart();
1935        } catch (error) {
1936            errorHandler(error);
1937            throw error;
1938        }
1939    };
1940    const errorHandler = (error)=>{
1941        setSubmitting(false);
1942        Logger_default().error("AddressFormContainer", error);
1943        const resolved = (0,resolveCheckoutError/* resolveCheckoutError */.h)(error);
1944        const INLINE_ADDRESS_ERROR_CODES = [
1945            "WF_CART_006",
1946            "WF_CART_011",
1947            "WF_STORE_001"
1948        ];
1949        if (resolved.code && INLINE_ADDRESS_ERROR_CODES.includes(resolved.code)) {
1950            setAddressZipVerificationError(resolved.message);
1951            return;
1952        }
1953        (0,snackbarHandlers/* axiosErrorHandler */.ri)({
1954            error,
1955            dispatch,
1956            useResolvedMessages: true
1957        });
1958    };
1959    if (!areWindowsAvailable) {
1960        return /*#__PURE__*/ (0,jsx_runtime.jsx)(NoWindowsAvailableMessage/* NoWindowsAvailableMessage */.$, {
1961            isKioskVisitor: isKioskVisitor,
1962            onChangeAddress: ()=>setAreWindowsAvailable(true)
1963        });
1964    }
1965    // TODO from Jared: for ModalBasic, the locale languageCode in the heading (GENERIC_EVENT_ERR_HEADING) and error message (GENERIC_ERR_MSG) should come from state/redux
1966    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
1967        children: [
1968            ADDRESS_VALIDATION_ENABLED && /*#__PURE__*/ (0,jsx_runtime.jsx)(AddressVerificationModal/* default */.Z, {
1969                onClose: handleAddressModalClose,
1970                onSubmit: onAddressFormSubmitted,
1971                verifiedAddress: verifiedAddress,
1972                isOpen: addressModalIsOpen,
1973                isEnteredAddrVerificationStatusFailed: isEnteredAddrVerificationStatusFailed,
1974                isSubmitting: submitting,
1975                setUseVerifiedAddress: setUseVerifiedAddress,
1976                isCheckout: true,
1977                userEnteredAddress: shippingAddressForm,
1978                isUserEnteredAddressValid: shippingAddressFormIsValid
1979            }),
1980            /*#__PURE__*/ (0,jsx_runtime.jsx)(ModalConfirm.ModalConfirm, {
1981                open: isPriceVariationModalOpen,
1982                title: (0,utils_locale.t)("checkout.price_variation_modal.title"),
1983                content: (0,utils_locale.t)("checkout.price_variation_modal.content"),
1984                onConfirm: handlePriceVariationModalConfirm,
1985                onCancel: handlePriceVariationModalClose
1986            }),
1987            /*#__PURE__*/ (0,jsx_runtime.jsx)(ProductInventoryModal/* default */.Z, {
1988                modalTitle: "".concat(!(restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) ? (0,utils_locale.t)("checkout.payment.product_inventory.title") : (0,utils_locale.t)("checkout.payment.product_inventory.items_removed_title"), " ").concat(shippingZipcode),
1989                modalDescription: (restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) ? (0,utils_locale.t)("checkout.payment.product_inventory.items_removed_description") : (0,utils_locale.t)("checkout.payment.product_inventory.description"),
1990                itemsWereAlreadyRemoved: false,
1991                restrictedStateItems: restrictedStateItems,
1992                unavailableItems: unavailableItems,
1993                showModal: showUnavailableItemsModal,
1994                removeUnavailableItems: handleRemoveItemsOutOfStock,
1995                onCancel: handleUseADifferentZipCode,
1996                areButtonsDisabled: loading,
1997                onCancelButtonLabel: (0,utils_locale.t)("checkout.payment.product_inventory.add_zip_code"),
1998                onConfirmButtonLabel: (0,utils_locale.t)("checkout.payment.product_inventory.remove_button"),
1999                continueCheckoutRestrictedStates: continueToCheckoutWithRestrictedStateItems,
2000                keepShoppingRestrictedStates: keepShoppingWithRestrictedStateItems
2001            }),
2002            /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2003                className: (AddressFormContainer_module_default())["address-form-container"],
2004                "data-testid": ADDRESS_FORM_CONTAINER_TEST_ID,
2005                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2006                    className: (0,classNames["default"])("checkout-fulfillment__addresses", (AddressFormContainer_module_default())["address-form-container-addresses"]),
2007                    children: [
2008                        /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
2009                            className: "checkout-fulfillment__title",
2010                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
2011                                children: (0,utils_locale.t)("checkout.delivery.deliver_to")
2012                            })
2013                        }),
2014                        /*#__PURE__*/ (0,jsx_runtime.jsx)(GenericErrorMessage, {
2015                            errorMessage: addressZipVerificationError,
2016                            onClose: ()=>setAddressZipVerificationError("")
2017                        }),
2018                        /*#__PURE__*/ (0,jsx_runtime.jsx)(AddressForm, {
2019                            isLoggedInUser: isLoggedInUser,
2020                            hideAddressFields: isKioskVisitor,
2021                            isDefaultAddress: isDefaultAddress,
2022                            setIsDefaultAddress: setIsDefaultAddress
2023                        }),
2024                        /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2025                            className: className,
2026                            children: [
2027                                shouldShowFastlaneAddressChangeButton && /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Button */.zx, {
2028                                    onClick: ()=>handleFastlaneAddressChange(),
2029                                    children: (0,utils_locale.t)("checkout.delivery_address.change_address")
2030                                }),
2031                                /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Button */.zx, {
2032                                    className: (AddressFormContainer_module_default())["address-form-container-footer-submit"],
2033                                    onClick: ()=>onFormSubmit(isLoggedInUser),
2034                                    disabled: !shippingAddressFormIsValid || submitting,
2035                                    children: (0,utils_locale.t)("checkout.delivery_address.proceed_to_payment")
2036                                }),
2037                                addingNewAddress && /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Button */.zx, {
2038                                    className: (AddressFormContainer_module_default())["address-form-container-footer-cancel"],
2039                                    onClick: ()=>setShowMultiDeliverySection(true),
2040                                    children: (0,utils_locale.t)("checkout.delivery_address.cancel")
2041                                })
2042                            ]
2043                        })
2044                    ]
2045                })
2046            })
2047        ]
2048    });
2049};
2050
2051// EXTERNAL MODULE: ./node_modules/@mui/icons-material/InfoOutlined.js
2052var InfoOutlined = __webpack_require__(402548);
2053// EXTERNAL MODULE: ./src/components/checkout/delivery/DeliveryDatesSlider.module.scss
2054var DeliveryDatesSlider_module = __webpack_require__(161192);
2055var DeliveryDatesSlider_module_default = /*#__PURE__*/__webpack_require__.n(DeliveryDatesSlider_module);
2056;// CONCATENATED MODULE: ./src/components/checkout/delivery/DeliveryDatesSlider.tsx
2057
2058
2059
2060
2061const DELIVERY_DATE_ITEM_ID = "delivery-date-item";
2062function DeliveryDatesSlider(param) {
2063    let { dates } = param;
2064    const { availableWindows, selectedAvailableDate, setSelectedAvailableDateHandler, setSelectedAvailableTimeHandler } = (0,DeliveryProvider/* useDelivery */.qk)();
2065    const dateSlotRefs = (0,react.useRef)({});
2066    const selectDate = (dateIndex)=>{
2067        var _availableWindows_dateIndex;
2068        setSelectedAvailableDateHandler(dateIndex);
2069        if ((_availableWindows_dateIndex = availableWindows[dateIndex]) === null || _availableWindows_dateIndex === void 0 ? void 0 : _availableWindows_dateIndex.availableTimes) {
2070            setSelectedAvailableTimeHandler(dateIndex, 0, availableWindows);
2071        }
2072    };
2073    const handleDateKeyDown = (event, dateIndex)=>{
2074        if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
2075            var _dateSlotRefs_current_newIndex;
2076            event.preventDefault();
2077            const direction = event.key === "ArrowRight" ? 1 : -1;
2078            let newIndex = dateIndex + direction;
2079            if (newIndex >= dates.length) {
2080                newIndex = 0;
2081            } else if (newIndex < 0) {
2082                newIndex = dates.length - 1;
2083            }
2084            selectDate(newIndex);
2085            (_dateSlotRefs_current_newIndex = dateSlotRefs.current[newIndex]) === null || _dateSlotRefs_current_newIndex === void 0 ? void 0 : _dateSlotRefs_current_newIndex.focus();
2086        }
2087    };
2088    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2089        role: "radiogroup",
2090        "aria-label": "Delivery dates",
2091        className: (DeliveryDatesSlider_module_default())["dates-grid"],
2092        style: {
2093            gridTemplateColumns: "repeat(".concat(dates.length || 1, ", 1fr)")
2094        },
2095        children: dates.map((date, dateIndex)=>/*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2096                ref: (el)=>{
2097                    dateSlotRefs.current[dateIndex] = el;
2098                },
2099                className: "".concat((DeliveryDatesSlider_module_default())["date-chip"], " ").concat(dateIndex === selectedAvailableDate ? (DeliveryDatesSlider_module_default())["date-chip--selected"] : ""),
2100                onClick: ()=>selectDate(dateIndex),
2101                onKeyDown: (event)=>handleDateKeyDown(event, dateIndex),
2102                "data-testid": DELIVERY_DATE_ITEM_ID,
2103                role: "radio",
2104                "aria-checked": dateIndex === selectedAvailableDate,
2105                tabIndex: dateIndex === selectedAvailableDate ? 0 : -1,
2106                children: [
2107                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
2108                        className: (DeliveryDatesSlider_module_default())["date-chip__day"],
2109                        children: [
2110                            date.day.slice(0, 1),
2111                            date.day.slice(1, 3).toLowerCase()
2112                        ]
2113                    }),
2114                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
2115                        className: (DeliveryDatesSlider_module_default())["date-chip__date"],
2116                        children: [
2117                            date.month.slice(0, 3),
2118                            " ",
2119                            date.date
2120                        ]
2121                    })
2122                ]
2123            }, date.id))
2124    });
2125}
2126
2127// EXTERNAL MODULE: ./src/lib/hooks/useMemoize.ts
2128var useMemoize = __webpack_require__(67270);
2129// EXTERNAL MODULE: ./src/components/checkout/delivery/DeliveryTimesSlider.module.scss
2130var DeliveryTimesSlider_module = __webpack_require__(576628);
2131var DeliveryTimesSlider_module_default = /*#__PURE__*/__webpack_require__.n(DeliveryTimesSlider_module);
2132;// CONCATENATED MODULE: ./src/components/checkout/delivery/DeliveryTimesSlider.tsx
2133
2134
2135
2136
2137
2138const AVAILABLE_TIME_ITEM_ID = "available-time-item";
2139const DeliveryTimesSlider = (param)=>{
2140    let { availableTimes, availableWindows, selectedAvailableDate, labelledby } = param;
2141    const { selectedAvailableTime, setSelectedAvailableTimeHandler, initialSelectedAvailableTime } = (0,DeliveryProvider/* useDelivery */.qk)();
2142    const timeSlotRefs = (0,react.useRef)({});
2143    const memoizedAvailableWindows = (0,useMemoize/* useMemoizeStruct */.p)(availableWindows);
2144    (0,react.useEffect)(()=>{
2145        setSelectedAvailableTimeHandler(selectedAvailableDate, initialSelectedAvailableTime, memoizedAvailableWindows);
2146    }, [
2147        selectedAvailableDate,
2148        setSelectedAvailableTimeHandler,
2149        initialSelectedAvailableTime,
2150        memoizedAvailableWindows
2151    ]);
2152    const selectTime = (index)=>{
2153        setSelectedAvailableTimeHandler(selectedAvailableDate, index, availableWindows);
2154    };
2155    const handleTimeKeyDown = (event, index)=>{
2156        if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
2157            event.preventDefault();
2158            const direction = event.key === "ArrowRight" ? 1 : -1;
2159            let newIndex = index;
2160            for(let i = 0; i < availableTimes.length; i++){
2161                var _availableTimes_newIndex;
2162                newIndex = newIndex + direction;
2163                if (newIndex >= availableTimes.length) {
2164                    newIndex = 0;
2165                } else if (newIndex < 0) {
2166                    newIndex = availableTimes.length - 1;
2167                }
2168                if (!((_availableTimes_newIndex = availableTimes[newIndex]) === null || _availableTimes_newIndex === void 0 ? void 0 : _availableTimes_newIndex.disabled)) {
2169                    var _timeSlotRefs_current_newIndex;
2170                    selectTime(newIndex);
2171                    (_timeSlotRefs_current_newIndex = timeSlotRefs.current[newIndex]) === null || _timeSlotRefs_current_newIndex === void 0 ? void 0 : _timeSlotRefs_current_newIndex.focus();
2172                    break;
2173                }
2174            }
2175        }
2176    };
2177    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2178        role: "radiogroup",
2179        "aria-labelledby": labelledby,
2180        className: (DeliveryTimesSlider_module_default())["times-grid"],
2181        children: availableTimes === null || availableTimes === void 0 ? void 0 : availableTimes.map((item, index)=>/*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2182                ref: (el)=>{
2183                    timeSlotRefs.current[index] = el;
2184                },
2185                className: "".concat((DeliveryTimesSlider_module_default())["time-chip"], " ").concat(index === selectedAvailableTime ? (DeliveryTimesSlider_module_default())["time-chip--selected"] : "", " ").concat(item.disabled ? (DeliveryTimesSlider_module_default())["time-chip--disabled"] : ""),
2186                "data-testid": AVAILABLE_TIME_ITEM_ID,
2187                onClick: ()=>{
2188                    !item.disabled && selectTime(index);
2189                },
2190                onKeyDown: (event)=>handleTimeKeyDown(event, index),
2191                tabIndex: index === selectedAvailableTime ? 0 : -1,
2192                role: "radio",
2193                "aria-checked": index === selectedAvailableTime,
2194                "aria-disabled": item.disabled,
2195                children: [
2196                    item.from,
2197                    " - ",
2198                    item.to
2199                ]
2200            }, "".concat(index).concat(item.from).concat(item.to)))
2201    });
2202};
2203
2204// EXTERNAL MODULE: ./src/lib/constants/checkout.ts
2205var constants_checkout = __webpack_require__(195971);
2206// EXTERNAL MODULE: ./src/lib/hooks/useCartHooks.tsx
2207var useCartHooks = __webpack_require__(213979);
2208// EXTERNAL MODULE: ./src/lib/utils/patterns.ts
2209var patterns = __webpack_require__(711091);
2210// EXTERNAL MODULE: ./src/components/checkout/forms/delivery-form/DeliveryForm.module.scss
2211var DeliveryForm_module = __webpack_require__(669653);
2212var DeliveryForm_module_default = /*#__PURE__*/__webpack_require__.n(DeliveryForm_module);
2213// EXTERNAL MODULE: ./src/components/checkout/forms/shared/CharacterLimit.tsx
2214var CharacterLimit = __webpack_require__(904510);
2215;// CONCATENATED MODULE: ./src/components/checkout/forms/delivery-form/DeliveryForm.tsx
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236const { DELIVERY_INSTRUCTIONS_MAX_LENGTH } = constants_checkout.FORM_CONSTRAINTS;
2237const DELIVERY_INSTRUCTIONS_FOR_GROUND_AND_AIR_ENABLED = environment.nextAppEnv.feature_toggle.US.isDeliveryInstructionsForGroundAndAirEnabled;
2238const DELIVERY_CONTAINER = "delivery-container";
2239const DeliveryForm = (param)=>{
2240    let { onChangeAddressClick } = param;
2241    const { selectedAvailableDate, setSelectedAvailableDateHandler, availableWindows } = (0,DeliveryProvider/* useDelivery */.qk)();
2242    const { shippingAddress } = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
2243    const shippingTypes = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* selectShippingTypes */.Mb);
2244    let showDeliveryInstructions = shippingTypes === null || shippingTypes === void 0 ? void 0 : shippingTypes.includes(constants_checkout/* SHIPPING_TYPES */.R.LOCAL);
2245    if (DELIVERY_INSTRUCTIONS_FOR_GROUND_AND_AIR_ENABLED) {
2246        showDeliveryInstructions = (shippingTypes === null || shippingTypes === void 0 ? void 0 : shippingTypes.includes(constants_checkout/* SHIPPING_TYPES */.R.LOCAL)) || (shippingTypes === null || shippingTypes === void 0 ? void 0 : shippingTypes.includes(constants_checkout/* SHIPPING_TYPES */.R.GROUND)) || (shippingTypes === null || shippingTypes === void 0 ? void 0 : shippingTypes.includes(constants_checkout/* SHIPPING_TYPES */.R.AIR));
2247    }
2248    /** on page load by default 1st one should be auto selected */ (0,react.useEffect)(()=>{
2249        if (availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) {
2250            setSelectedAvailableDateHandler(0); // TODO from Jared: this could be abstracted into a custom hook (possibly in DeliveryProvider?) as this same logic is also applied in PickUpForm.tsx
2251        }
2252    }, [
2253        availableWindows,
2254        setSelectedAvailableDateHandler
2255    ]);
2256    const { deliveryInstructions, isAGift, giftMessage, setDeliveryInstructions, setIsAGift, setGiftMessage, shippingAddressForm, isMilitaryAddress, setIsMilitaryAddress } = (0,CheckoutProvider/* useCheckout */.Mg)();
2257    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
2258    const userContact = {
2259        ...shippingAddressForm
2260    };
2261    // should default to shippingAddress from previous api response if it exists
2262    const addressOrigin = shippingAddress && shippingAddress.firstName ? {
2263        ...shippingAddress
2264    } : {
2265        ...userContact
2266    };
2267    const { firstName, lastName, address1, address2, city, state, postalCode } = addressOrigin;
2268    (0,useCartHooks/* useReassociateCartAddress */.O)(); // TODO from Jared: we should add a ticket to remove everything associated with this, including the redux param
2269    return /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Form, {
2270        initialValues: {
2271            ...addressOrigin
2272        },
2273        onSubmit: (noop_default()),
2274        render: ()=>{
2275            var _availableWindows_selectedAvailableDate, _availableWindows_selectedAvailableDate_availableTimes, _availableWindows_selectedAvailableDate1, _availableWindows_selectedAvailableDate2;
2276            return /*#__PURE__*/ (0,jsx_runtime.jsx)("form", {
2277                "aria-label": "delivery form",
2278                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2279                    className: "checkout-fulfillment checkout-fulfillment--delivery",
2280                    children: [
2281                        /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2282                            className: "checkout-fulfillment__details",
2283                            children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2284                                className: "checkout-fulfillment__address",
2285                                children: [
2286                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
2287                                        className: "checkout-fulfillment__title",
2288                                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
2289                                            children: (0,utils_locale.t)("checkout.delivery.deliver_to")
2290                                        })
2291                                    }),
2292                                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2293                                        className: "shipping-address",
2294                                        children: [
2295                                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
2296                                                className: "shipping-address__name",
2297                                                children: [
2298                                                    firstName,
2299                                                    "\xa0",
2300                                                    lastName
2301                                                ]
2302                                            }),
2303                                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
2304                                                className: "shipping-address__address",
2305                                                children: [
2306                                                    address1,
2307                                                    "\xa0",
2308                                                    address2,
2309                                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("br", {}),
2310                                                    city,
2311                                                    ", ",
2312                                                    state,
2313                                                    ", ",
2314                                                    postalCode
2315                                                ]
2316                                            })
2317                                        ]
2318                                    }),
2319                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2320                                        className: "shipping-address__link",
2321                                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
2322                                            type: "button",
2323                                            className: "link",
2324                                            onClick: onChangeAddressCl
2324ick,
2325                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
2326                                                children: !isKioskVisitor ? (0,utils_locale.t)("checkout.delivery.change_address") : (0,utils_locale.t)("checkout.delivery.change_name")
2327                                            })
2328                                        })
2329                                    })
2330                                ]
2331                            })
2332                        }),
2333                        /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2334                            className: (DeliveryForm_module_default())["slider-container"],
2335                            children: [
2336                                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2337                                    children: (0,utils_locale.t)("checkout.delivery.select_date")
2338                                }),
2339                                /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryDatesSlider, {
2340                                    dates: availableWindows || []
2341                                })
2342                            ]
2343                        }),
2344                        !isKioskVisitor && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2345                            children: [
2346                                ((_availableWindows_selectedAvailableDate = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate === void 0 ? void 0 : _availableWindows_selectedAvailableDate.availableTimes) && ((_availableWindows_selectedAvailableDate1 = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate1 === void 0 ? void 0 : (_availableWindows_selectedAvailableDate_availableTimes = _availableWindows_selectedAvailableDate1.availableTimes) === null || _availableWindows_selectedAvailableDate_availableTimes === void 0 ? void 0 : _availableWindows_selectedAvailableDate_availableTimes.length) !== 0 && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2347                                    className: (DeliveryForm_module_default())["slider-container"],
2348                                    children: [
2349                                        /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2350                                            id: "delivery-time-label",
2351                                            children: (0,utils_locale.t)("checkout.delivery.select_time")
2352                                        }),
2353                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryTimesSlider, {
2354                                            availableTimes: ((_availableWindows_selectedAvailableDate2 = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate2 === void 0 ? void 0 : _availableWindows_selectedAvailableDate2.availableTimes) || [],
2355                                            availableWindows: availableWindows,
2356                                            selectedAvailableDate: selectedAvailableDate,
2357                                            labelledby: "delivery-time-label"
2358                                        }, selectedAvailableDate)
2359                                    ]
2360                                }),
2361                                showDeliveryInstructions && !isMilitaryAddress && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2362                                    children: [
2363                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
2364                                            name: "deliveryInstructions",
2365                                            render: (param)=>{
2366                                                let { input } = param;
2367                                                return /*#__PURE__*/ (0,jsx_runtime.jsx)("textarea", {
2368                                                    id: "Note",
2369                                                    placeholder: (0,utils_locale.t)("checkout.delivery.instructions_placeholder"),
2370                                                    rows: 2,
2371                                                    className: (DeliveryForm_module_default())["delivery-instru
2371ctions-textarea"],
2372                                                    maxLength: DELIVERY_INSTRUCTIONS_MAX_LENGTH,
2373                                                    ...input,
2374                                                    "data-testid": "".concat(DELIVERY_CONTAINER, "-delivery-instructions"),
2375                                                    style: {
2376                                                        resize: "none"
2377                                                    },
2378                                                    value: deliveryInstructions,
2379                                                    onChange: (e)=>{
2380                                                        setDeliveryInstructions(e.target.value);
2381                                                    }
2382                                                });
2383                                            }
2384                                        }),
2385                                        deliveryInstructions.length > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)(CharacterLimit/* CharacterCounter */.G, {
2386                                            current: deliveryInstructions.length,
2387                                            max: DELIVERY_INSTRUCTIONS_MAX_LENGTH
2388                                        })
2389                                    ]
2390                                })
2391                            ]
2392                        }),
2393                        showDeliveryInstructions && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2394                            children: [
2395                                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2396                                    className: (DeliveryForm_module_default())["gift-option"],
2397                                    children: [
2398                                        /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2399                                            children: (0,utils_locale.t)("checkout.delivery.is_military_address")
2400                                        }),
2401                                        /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2402                                            className: "gift-option__fieldset",
2403                                            children: [
2404                                                /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
2405                                                    type: "checkbox",
2406                                                    name: "isMilitaryAddress",
2407                                                    render: (param)=>{
2408                                                        let { input } = param;
2409                                                        return /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
2410                                                            type: "checkbox",
2411                                                            id: "MilitaryAddressActive",
2412                                                            className: "gift-option__checkbox",
2413                                                            ...input,
2414                                                            "data-testid": "".concat(DELIVERY_CONTAINER, "-is-a-gift-checkbox"),
2415                                                            checked: isMilitaryAddress,
2416                                                            onChange: (e)=>{
2417                                                                setIsMilitaryAddress(e.target.checked);
2418                                                            }
2419                                                        });
2420                                                    }
2421                                                }),
2422                                                /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
2423                                                    htmlFor: "GiftActive",
2424                                                    children: (0,utils_locale.t)("checkout.delivery.military_address_order")
2425                                                })
2426                                            ]
2427                                        })
2428                                    ]
2429                                }),
2430                                /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
2431                                    children: isMilitaryAddress && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2432                                        className: (DeliveryForm_module_default())["military-instru
2432ctions-wrapper-open"],
2433                                        children: [
2434                                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2435                                                className: (DeliveryForm_module_default())["military-instructions-disclaimer"],
2436                                                children: [
2437                                                    /*#__PURE__*/ (0,jsx_runtime.jsx)(InfoOutlined/* default */.Z, {
2438                                                        sx: {
2439                                                            color: "#d14124"
2440                                                        }
2441                                                    }),
2442                                                    (0,utils_locale.t)("checkout.delivery.military_addess_disclaimer")
2443                                                ]
2444                                            }),
2445                                            /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
2446                                                name: "deliveryInstructions",
2447                                                required: true,
2448                                                render: (param)=>{
2449                                                    let { input } = param;
2450                                                    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2451                                                        children: [
2452                                                            isMilitaryAddress && /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
2453                                                                className: (DeliveryForm_module_default())["military-instructions-label"],
2454                                                                children: (0,utils_locale.t)("checkout.delivery.military_addess_label")
2455                                                            }),
2456                                                            /*#__PURE__*/ (0,jsx_runtime.jsx)("textarea", {
2457                                                                id: "Note",
2458                                                                placeholder: (0,utils_locale.t)("checkout.delivery.instructions_placeholder_military"),
2459                                                                className: (DeliveryForm_module_default())["delivery-instructions-textarea"],
2460                                                                rows: 2,
2461                                                                maxLength: DELIVERY_INSTRUCTIONS_MAX_LENGTH,
2462                                                                ...input,
2463                                                                "data-testid": "".concat(DELIVERY_CONTAINER, "-delivery-instructions"),
2464                                                                style: {
2465                                                                    resize: "none"
2466                                                                },
2467                                                                value: deliveryInstructions,
2468                                                                onChange: (e)=>{
2469                                                                    setDeliveryInstructions(e.target.value);
2470                                                                }
2471                                                            }),
2472                                                            deliveryInstructions.length > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)(CharacterLimit/* CharacterCounter */.G, {
2473                                                                current: deliveryInstructions.length,
2474                                                                max: DELIVERY_INSTRUCTIONS_MAX_LENGTH
2475                                                            })
2476                                                        ]
2477                                                    });
2478                                                }
2479                                            })
2480                                        ]
2481                                    })
2482                                })
2483                            ]
2484                        }),
2485                        !isKioskVisitor && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2486                            className: (DeliveryForm_module_default())["gift-option"],
2487                            children: [
2488                                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2489                                    children: (0,utils_locale.t)("checkout.delivery.is_gift")
2490                                }),
2491                                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2492                                    className: "gift-option__fieldset",
2493                                    children: [
2494                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
2495                                            type: "checkbox",
2496                                            name: "isAGift",
2497                                            render: (param)=>{
2498                                                let { input } = param;
2499                                                return /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
2500                                                    type: "checkbox",
2501                                                    id: "GiftActive",
2502                                                    className: "gift-option__checkbox",
2503                                                    ...input,
2504                                                    "data-testid": "".concat(DELIVERY_CONTAINER, "-is-a-gift-checkbox"),
2505                                                    checked: isAGift,
2506                                                    onChange: (e)=>{
2507                                                        setIsAGift(e.target.checked);
2508                                                    }
2509                                                });
2510                                            }
2511                                        }),
2512                                        /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
2513                                            htmlFor: "GiftActive",
2514                                            children: (0,utils_locale.t)("checkout.delivery.gift_order")
2515                                        }),
2516                                        isAGift && /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
2517                                            name: "giftMessage",
2518                                            render: (param)=>{
2519                                                let { input } = param;
2520                                                return /*#__PURE__*/ (0,jsx_runtime.jsx)("textarea", {
2521                                                    id: "gift",
2522                                                    placeholder: (0,utils_locale.t)("checkout.delivery.message_placeholder"),
2523                                                    maxLength: 340,
2524                                                    ...input,
2525                                                    "data-testid": "".concat(DELIVERY_CONTAINER, "-gift-message-text-area"),
2526                                                    style: {
2527                                                        resize: "none"
2528                                                    },
2529                                                    value: giftMessage,
2530                                                    onChange: (e)=>{
2531                                                        const value = e.target.value;
2532                                                        // Filter out emojis
2533                                                        if (!patterns/* default */.Z.EMOJI.test(value)) {
2534                                                            setGiftMessage(value);
2535                                                        }
2536                                                    }
2537                                                });
2538                                            }
2539                                        })
2540                                    ]
2541                                })
2542                            ]
2543                        })
2544                    ]
2545                })
2546            });
2547        }
2548    });
2549};
2550
2551// EXTERNAL MODULE: ./src/components/ui/buttons/button/index.ts
2552var buttons_button = __webpack_require__(336930);
2553// EXTERNAL MODULE: ./src/components/checkout/delivery/DeliveryAddressSelect.module.scss
2554var DeliveryAddressSelect_module = __webpack_require__(19375);
2555var DeliveryAddressSelect_module_default = /*#__PURE__*/__webpack_require__.n(DeliveryAddressSelect_module);
2556;// CONCATENATED MODULE: ./src/components/checkout/delivery/DeliveryAddressSelect.tsx
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569const sortDeliveryAddresses = (addresses)=>{
2570    if (!addresses) {
2571        return addresses; // return falsey value as it arrived
2572    }
2573    const sortedAddresses = [
2574        ...addresses
2575    ];
2576    // eslint-disable-next-line @typescript-eslint/no-unused-vars
2577    sortedAddresses.sort((a, _b)=>{
2578        if (a.defaultAddress) {
2579            return -1;
2580        } else {
2581            return 1;
2582        }
2583    });
2584    return sortedAddresses;
2585};
2586const DeliveryAddressSelect = (param)=>{
2587    let { setShowMultiDeliverySection, footerClassName } = param;
2588    var _sortedDeliveryAddressInfo_filter;
2589    const deliveryAddressInfo = (0,store_hooks/* useAppSelector */.C)(customerInfoSlice/* getAddresses */.ZK);
2590    const sortedDeliveryAddressInfo = sortDeliveryAddresses(deliveryAddressInfo);
2591    const lengthOfDeliveryAddressInfo = (sortedDeliveryAddressInfo === null || sortedDeliveryAddressInfo === void 0 ? void 0 : sortedDeliveryAddressInfo.length) || 0;
2592    const [loadMore, setLoadMore] = (0,react.useState)(false);
2593    const { locale } = (0,store_hooks/* useAppSelector */.C)((state)=>state);
2594    const { setUserContactHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
2595    const addNewAddress = (address)=>{
2596        var _Object_keys;
2597        const valuesOnLoad = !address || ((_Object_keys = Object.keys(address)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length) ? {
2598            ...address
2599        } : {
2600            ...(0,CheckoutProvider/* defaultUserContact */.P5)(locale.countryShort)
2601        };
2602        const countryAbbrev = (0,utils_locale/* forceCountryAbbreviation */.v0)();
2603        setUserContactHandler({
2604            ...valuesOnLoad,
2605            country: countryAbbrev === null || countryAbbrev === void 0 ? void 0 : countryAbbrev.value
2606        }, constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING);
2607        setShowMultiDeliverySection(false);
2608    };
2609    const calculateSelectionsVisible = ()=>{
2610        let quantityOfSelectionsVisible = 0;
2611        if (lengthOfDeliveryAddressInfo) {
2612            quantityOfSelectionsVisible = lengthOfDeliveryAddressInfo < INITIAL_SELECTIONS_VISIBLE || loadMore ? lengthOfDeliveryAddressInfo : INITIAL_SELECTIONS_VISIBLE;
2613        }
2614        return quantityOfSelectionsVisible;
2615    };
2616    const selectionsVisible = calculateSelectionsVisible();
2617    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2618        children: [
2619            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2620                className: (DeliveryAddressSelect_module_default())["delivery-content"],
2621                children: [
2622                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
2623                        className: (DeliveryAddressSelect_module_default())["delivery-content-title"],
2624                        children: (0,utils_locale.t)("checkout.delivery_address.delivery_to")
2625                    }),
2626                    sortedDeliveryAddressInfo && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2627                        className: (DeliveryAddressSelect_module_default())["delivery-content-address-list"],
2628                        children: sortedDeliveryAddressInfo === null || sortedDeliveryAddressInfo === void 0 ? void 0 : (_sortedDeliveryAddressInfo_filter = sortedDeliveryAddressInfo.filter((_el, i)=>{
2629                            return i <= selectionsVisible - 1;
2630                        })) === null || _sortedDeliveryAddressInfo_filter === void 0 ? void 0 : _sortedDeliveryAddressInfo_filter.map((address, index)=>/*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2631                                className: (0,classNames["default"])((DeliveryAddressSelect_module_default())["delivery-content-address-list-address"], ((address === null || address === void 0 ? void 0 : address.defaultAddress) || lengthOfDeliveryAddressInfo === 1) && (DeliveryAddressSelect_module_default())["delivery-content-address-list-address--default"]),
2632                                children: [
2633                                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2634                                        className: (DeliveryAddressSelect_module_default())["delivery-content-address-list-address-name"],
2635                                        children: [
2636                                            address === null || address === void 0 ? void 0 : address.firstName,
2637                                            " ",
2638                                            address === null || address === void 0 ? void 0 : address.lastName
2639                                        ]
2640                                    }),
2641                                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2642                                        className: (DeliveryAddressSelect_module_default())["delivery-content-address-list-address-detail
2642s"],
2643                                        children: [
2644                                            address === null || address === void 0 ? void 0 : address.address1,
2645                                            /*#__PURE__*/ (0,jsx_runtime.jsx)("br", {}),
2646                                            address === null || address === void 0 ? void 0 : address.city,
2647                                            ", ",
2648                                            address === null || address === void 0 ? void 0 : address.state,
2649                                            ", ",
2650                                            address === null || address === void 0 ? void 0 : address.postalCode
2651                                        ]
2652                                    }),
2653                                    /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
2654                                        className: (DeliveryAddressSelect_module_default())["delivery-content-address-list-address-button"],
2655                                        onClick: ()=>addNewAddress(address),
2656                                        "data-testid": "deliver-content-deliver-here-button-".concat(address.id),
2657                                        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
2658                                            children: [
2659                                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
2660                                                    iconName: "truck"
2661                                                }),
2662                                                (0,utils_locale.t)("checkout.delivery_address.delivery_here")
2663                                            ]
2664                                        })
2665                                    })
2666                                ]
2667                            }, address.id || index))
2668                    })
2669                ]
2670            }),
2671            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2672                className: footerClassName,
2673                children: [
2674                    !loadMore && lengthOfDeliveryAddressInfo > INITIAL_SELECTIONS_VISIBLE && /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
2675                        type: "submit",
2676                        className: (DeliveryAddressSelect_module_default())["delivery-footer-submit"],
2677                        onClick: ()=>setLoadMore(true),
2678                        "data-testid": "delivery-content-load-more-button",
2679                        children: (0,utils_locale.t)("checkout.delivery_address.load_more")
2680                    }),
2681                    /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
2682                        type: "submit",
2683                        className: (DeliveryAddressSelect_module_default())["delivery-footer-submit"],
2684                        onClick: ()=>addNewAddress(),
2685                        "data-testid": "delivery-content-add-new-address-button",
2686                        children: (0,utils_locale.t)("checkout.delivery_address.add_new_address")
2687                    })
2688                ]
2689            })
2690        ]
2691    });
2692};
2693/* harmony default export */ var delivery_DeliveryAddressSelect = (DeliveryAddressSelect);
2694
2695// EXTERNAL MODULE: ./src/components/checkout/delivery/DeliveryContainer.module.scss
2696var DeliveryContainer_module = __webpack_require__(940670);
2697var DeliveryContainer_module_default = /*#__PURE__*/__webpack_require__.n(DeliveryContainer_module);
2698;// CONCATENATED MODULE: ./src/components/checkout/delivery/components/DeliveryContent.tsx
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710const DeliveryContent = (param)=>{
2711    let { deliveryAddressInfo } = param;
2712    const lengthOfDeliveryAddressInfo = (deliveryAddressInfo === null || deliveryAddressInfo === void 0 ? void 0 : deliveryAddressInfo.length) || 0;
2713    const [showMultiDeliverySection, setShowMultiDeliverySection] = (0,react.useState)(!!lengthOfDeliveryAddressInfo);
2714    const { availableWindows } = (0,DeliveryProvider/* useDelivery */.qk)();
2715    const { addressSelected, setAddressSelectedHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
2716    const { isOrderMinimumUnmet }
2716 = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* orderMinimumSelector */.Id);
2717    const { isDeliveryHandlingFeeEnabled } = (0,hooks/* useEnvironmentFlags */.R6)();
2718    /*
2719      for deliveryChangeAddressClick
2720       we are skipping the updateCartfulfillmentType() call since the backend should still be in sync
2721       with the fulfillment type "DELIVERY" unless and until the user selects a Pickup store
2722  */ const deliveryChangeAddressClick = ()=>{
2723        setAddressSelectedHandler(false, "delivery");
2724    };
2725    if (!isDeliveryHandlingFeeEnabled && isOrderMinimumUnmet) {
2726        return null;
2727    }
2728    if ((availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) && addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_DELIVERY) {
2729        return /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryForm, {
2730            onChangeAddressClick: deliveryChangeAddressClick
2731        });
2732    }
2733    // selectionsVisible should show no more than INITIAL_SELECTIONS_VISIBLE selections until load_more button is clicked
2734    // DeliveryAddressSelect should never render if deliveryAddressInfo do not exist
2735    if (showMultiDeliverySection && deliveryAddressInfo.length > 0) {
2736        return /*#__PURE__*/ (0,jsx_runtime.jsx)(delivery_DeliveryAddressSelect, {
2737            setShowMultiDeliverySection: setShowMultiDeliverySection,
2738            footerClassName: (DeliveryContainer_module_default())["delivery-footer"]
2739        });
2740    }
2741    return /*#__PURE__*/ (0,jsx_runtime.jsx)(AddressFormContainer, {
2742        className: (DeliveryContainer_module_default())["delivery-footer"],
2743        setAddressSelectedHandler: setAddressSelectedHandler,
2744        setShowMultiDeliverySection: setShowMultiDeliverySection,
2745        addingNewAddress: !!lengthOfDeliveryAddressInfo
2746    });
2747};
2748
2749// EXTERNAL MODULE: ./node_modules/next/link.js
2750var next_link = __webpack_require__(741664);
2751var link_default = /*#__PURE__*/__webpack_require__.n(next_link);
2752;// CONCATENATED MODULE: ./src/components/checkout/delivery/components/DeliveryHeader.tsx
2753
2754
2755
2756
2757
2758
2759
2760
2761const DeliveryHeader = ()=>{
2762    const { isMember } = (0,useCustomer/* useCustomer */.O)();
2763    const isMembershipItemInCart = !!(0,store_hooks/* useAppSelector */.C)(store_cartSlice/* membershipLineItemInTheCartSelector */.fg);
2764    const membershipEligible = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* membershipEligibleSelector */.mq);
2765    const showBecomeAMemberContent = !isMember && !isMembershipItemInCart && membershipEligible;
2766    const href = isMember ? "/members-table" : "/become-a-member";
2767    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2768        className: (DeliveryContainer_module_default())["delivery-header"],
2769        children: [
2770            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2771                children: [
2772                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2773                        className: (DeliveryContainer_module_default())["delivery-header-title"],
2774                        children: (0,utils_locale.t)("checkout.delivery_address.delivery")
2775                    }),
2776                    showBecomeAMemberContent && /*#__PURE__*/ (0,jsx_runtime.jsx)("h4", {
2777                        className: (DeliveryContainer_module_default())["delivery-header-become-member-text"],
2778                        children: (0,utils_locale.t)("checkout.delivery_address.delivery_text")
2779                    })
2780                ]
2781            }),
2782            showBecomeAMemberContent && /*#__PURE__*/ (0,jsx_runtime.jsx)((link_default()), {
2783                href: href,
2784                className: (DeliveryContainer_module_default())["delivery-header-button"],
2785                children: (0,utils_locale.t)("checkout.delivery_address.subscription_button_text")
2786            })
2787        ]
2788    });
2789};
2790
2791// EXTERNAL MODULE: ./src/components/checkout/delivery/OrderMinimumUnmet.tsx
2792var OrderMinimumUnmet = __webpack_require__(762664);
2793;// CONCATENATED MODULE: ./src/components/checkout/delivery/components/DeliveryAccordtionItem.tsx
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803const DeliveryAccordionItem = (props)=>{
2804    var _cart_lineItems;
2805    const { disableDelivery, showDeliveryOrderMinimumUnmet, showUIComponents, isMember, 
2805cart, deliveryAddressInfo, AutoshipFormProps } = props;
2806    return /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* AccordionItem */.Qd, {
2807        disabled: disableDelivery,
2808        header: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2809            className: (DeliveryContainer_module_default())["delivery-header-wrapper"],
2810            children: [
2811                /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryHeader, {}),
2812                !disableDelivery && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2813                    className: (DeliveryContainer_module_default())["po-box-message"],
2814                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
2815                        className: (DeliveryContainer_module_default())["delivery-header-desc"],
2816                        children: (0,utils_locale.t)("checkout.delivery_address.po_box_message")
2817                    })
2818                }),
2819                showDeliveryOrderMinimumUnmet && /*#__PURE__*/ (0,jsx_runtime.jsx)(OrderMinimumUnmet/* default */.Z, {})
2820            ]
2821        }),
2822        content: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2823            children: [
2824                /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryContent, {
2825                    deliveryAddressInfo: deliveryAddressInfo
2826                }),
2827                showUIComponents && isMember && (cart === null || cart === void 0 ? void 0 : (_cart_lineItems = cart.lineItems) === null || _cart_lineItems === void 0 ? void 0 : _cart_lineItems.length) > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2828                    className: (DeliveryContainer_module_default())["autoship-form-container"],
2829                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(AutoshipForm.AutoshipForm, {
2830                        ...AutoshipFormProps
2831                    })
2832                })
2833            ]
2834        }),
2835        value: store_cartSlice/* DeliveryMethods */.tI.Local,
2836        theme: (deliveryAddressInfo === null || deliveryAddressInfo === void 0 ? void 0 : deliveryAddressInfo.length) ? "black" : "red",
2837        className: (deliveryAddressInfo === null || deliveryAddressInfo === void 0 ? void 0 : deliveryAddressInfo.length) ? (DeliveryContainer_module_default())["delivery-content-background"] : ""
2838    });
2839};
2840
2841// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/modal-basic/ModalBasic.js
2842var ModalBasic = __webpack_require__(910434);
2843// EXTERNAL MODULE: ./src/lib/utils/moment.ts
2844var moment = __webpack_require__(512085);
2845// EXTERNAL MODULE: ./src/components/checkout/cards/StoreCard.module.scss
2846var StoreCard_module = __webpack_require__(780243);
2847var StoreCard_module_default = /*#__PURE__*/__webpack_require__.n(StoreCard_module);
2848;// CONCATENATED MODULE: ./src/components/checkout/cards/StoreCard.tsx
2849
2850
2851
2852
2853
2854
2855
2856const formatTimeForStoreCardUS = (militaryTime)=>{
2857    const timeString = militaryTime ? "".concat((0,moment/* default */.Z)(militaryTime, "HH:mm").format("h:mma")) // TODO: there is familiary with this function and the one in core-ui formatTimeForStoreHoursUS - we should be able to simply reuse that but add an additional flag to ignore the top-of-the-hour functionality as desired
2858     : ""; // default to empty string if argument is undefined
2859    return timeString;
2860};
2861const StoreCard = (param)=>{
2862    let { index, store, startTime, endTime, miles, disableButton, handleSelectedStore } = param;
2863    var _store_address, _store_address1;
2864    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2865        className: (StoreCard_module_default())["delivery-pickup-card"],
2866        children: [
2867            locale.isUSLocale && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2868                className: (StoreCard_module_default())["delivery-pickup-card-left"],
2869                children: [
2870                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2871                        className: (StoreCard_module_default())["delivery-pickup-card-left-container"],
2872                        children: [
2873                            /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
2874                                role: "presentation",
2875                                tabIndex: -1,
2876                                className: (StoreCard_module_default())["delivery-pickup-card-left-location"]
2877                            }),
2878                            /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
2879                                className: (StoreCard_module_default())["delivery-pickup-card-left-textlocation"],
2880                                children: index + 1
2881                            })
2882                        ]
2883                    }),
2884                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
2885                        className: (StoreCard_module_default())["delivery-pickup-subtitles-miles"],
2886                        children: miles
2887                    })
2888                ]
2889            }),
2890            /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
2891                className: (StoreCard_module_default())["delivery-pickup-card-sep"]
2892            }),
2893            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
2894                className: (StoreCard_module_default())["delivery-pickup-card-right"],
2895                children: [
2896                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
2897                        className: (StoreCard_module_default())["delivery-pickup-title"],
2898                        children: store === null || store === void 0 ? void 0 : store.name
2899                    }),
2900                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
2901                        className: (StoreCard_module_default())["delivery-pickup-subtitles-address"],
2902                        children: store === null || store === void 0 ? void 0 : (_store_address = store.address) === null || _store_address === void 0 ? void 0 : _store_address.address1
2903                    }),
2904                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
2905                        className: (StoreCard_module_default())["delivery-pickup-subtitles-city"],
2906                        children: store === null || store === void 0 ? void 0 : (_store_address1 = store.address) === null || _store_address1 === void 0 ? void 0 : _store_address1.city
2907                    }),
2908                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("p", {
2909                        className: (StoreCard_module_default())["delivery-pickup-subtitles-opentime"],
2910                        children: [
2911                            "Open today: ",
2912                            formatTimeForStoreCardUS(startTime),
2913                            " -",
2914                            " ",
2915                            formatTimeForStoreCardUS(endTime)
2916                        ]
2917                    }),
2918                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("button", {
2919                        onClick: ()=>{
2920                            handleSelectedStore(store);
2921                        },
2922                        "data-testid": "button-pick-store",
2923                        className: "".concat((StoreCard_module_default())["delivery-pickup-buttonPU"], " ").concat(disableButton ? "disabled" : ""),
2924                        disabled: disableButton,
2925                        children: [
2926                            /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
2927                                className: (StoreCard_module_default())["delivery-pickup-buttonPU-icon"],
2928                                iconName: "location"
2929                            }),
2930                            /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
2931                                className: (StoreCard_module_default())["delivery-pickup-buttonPU-text"],
2932                                children: (0,utils_locale.t)("checkout.pickup.pickup_here")
2933                            })
2934                        ]
2935                    })
2936                ]
2937            })
2938        ]
2939    });
2940};
2941
2942// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/one-page-checkout/AddressSection/utils/index.js
2943var AddressSection_utils = __webpack_require__(782330);
2944// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/ui/index.js
2945var components_ui = __webpack_require__(670029);
2946// EXTERNAL MODULE: ./node_modules/lodash/pickBy.js
2947var pickBy = __webpack_require__(535937);
2948var pickBy_default = /*#__PURE__*/__webpack_require__.n(pickBy);
2949// EXTERNAL MODULE: ./src/components/ui/Link/Link.tsx
2950var Link = __webpack_require__(317641);
2951// EXTERNAL MODULE: ./src/lib/utils/formUtils.ts
2952var utils_formUtils = __webpack_require__(574166);
2953// EXTERNAL MODULE: ./src/components/checkout/forms/pickup-form/PickUpForm.module.scss
2954var PickUpForm_module = __webpack_require__(859058);
2955var PickUpForm_module_default = /*#__PURE__*/__webpack_require__.n(PickUpForm_module);
2956;// CONCATENATED MODULE: ./src/components/checkout/forms/pickup-form/PickUpForm.tsx
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981const PickUpForm_DELIVERY_CONTAINER = "delivery-container";
2982const PickUpForm = (param)=>{
2983    let { store, onChangeStoreClick } = param;
2984    const { selectedAvailableDate, setSelectedAvailableDateHandler, availableWindows } = (0,DeliveryProvider/* useDelivery */.qk)();
2985    const formRef = (0,react.useRef)(null);
2986    /** on page load by default 1st one should be auto selected */ (0,react.useEffect)(()=>{
2987        if (availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) {
2988            setSelectedAvailableDateHandler(0); // TODO from Jared: this could be abstracted into a custom hook (possibly in DeliveryProvider?) as this same logic is also applied in DeliveryForm.tsx
2989        }
2990    }, [
2991        availableWindows,
2992        setSelectedAvailableDateHandler
2993    ]);
2994    const { setAddressFieldHandler, setUserContactHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
2995    const formType = constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING;
2996    const { initialFormValues, twilioLookupHandler, onPhoneFieldChange } = useCheckoutAddressForm({
2997        formRef,
2998        formType
2999    });
3000    /**
3001   * Merge recipient data into form initial values and update form when recipient data becomes available.
3002   */ const { initialFormValuesRef, recipientData }
3002 = useRecipientFormValues({
3003        formRef,
3004        initialFormValues,
3005        formType,
3006        setUserContactHandler
3007    });
3008    const { isLoggedIn, customerInfo } = (0,useCustomer/* useCustomer */.O)();
3009    var _customerInfo_address, _getDefaultAddressPhoneNumber;
3010    const savedPhone = (0,utils_formUtils/* sanitizePhoneNumber */.jc)((_getDefaultAddressPhoneNumber = (0,AddressSection_utils.getDefaultAddressPhoneNumber)((_customerInfo_address = customerInfo.address) !== null && _customerInfo_address !== void 0 ? _customerInfo_address : [])) !== null && _getDefaultAddressPhoneNumber !== void 0 ? _getDefaultAddressPhoneNumber : "");
3011    // Only a complete number is worth filling: a value in the phone field
3012    // triggers the form's validation pass, and a short one would fail it.
3013    const accountPhone = savedPhone.length === constants_common/* MIN_PHONE_LENGTH */.FZ ? savedPhone : "";
3014    // Blank pickup contact fields come from the account, names as a pair, and
3015    // the phone only once both names are in, because that validation pass would
3016    // flag a blank name. Form values stay out of the deps so a cleared field is
3017    // not refilled mid-typing.
3018    (0,react.useEffect)(()=>{
3019        var _formRef_current;
3020        if (!isLoggedIn) return;
3021        var _formRef_current_getState_values;
3022        const values = (_formRef_current_getState_values = (_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : _formRef_current.getState().values) !== null && _formRef_current_getState_values !== void 0 ? _formRef_current_getState_values : {};
3023        const hasName = values.firstName || values.lastName;
3024        const firstName = hasName ? "" : customerInfo.firstName;
3025        const lastName = hasName ? "" : customerInfo.lastName;
3026        const isNameComplete = (values.firstName || firstName) && (values.lastName || lastName);
3027        const accountPrefill = pickBy_default()({
3028            email: values.email ? "" : customerInfo.email,
3029            firstName,
3030            lastName,
3031            phone: values.phone || !isNameComplete ? "" : accountPhone
3032        });
3033        if (Object.keys(accountPrefill).length) {
3034            setUserContactHandler(accountPrefill, formType);
3035        }
3036    }, [
3037        isLoggedIn,
3038        customerInfo.email,
3039        customerInfo.firstName,
3040        customerInfo.lastName,
3041        accountPhone,
3042        formType,
3043        setUserContactHandler
3044    ]);
3045    return /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Form, {
3046        initialValues: {
3047            ...initialFormValuesRef
3048        },
3049        onSubmit: ()=>({}),
3050        render: (param)=>{
3051            let { form } = param;
3052            var _store_address, _store_address1, _store_address2, _store_address3, _availableWindows_selectedAvailableDate, _availableWindows_selectedAvailableDate_availableTimes, _availableWindows_selectedAvailableDate1, _availableWindows_selectedAvailableDate2;
3053            formRef.current = form;
3054            return /*#__PURE__*/ (0,jsx_runtime.jsx)("form", {
3055                className: "pickup-form",
3056                "aria-label": "pickup form",
3057                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3058                    className: "checkout-fulfillment checkout-fulfillment--delivery",
3059                    children: [
3060                        /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
3061                            className: "checkout-fulfillment__details",
3062                            children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3063                                className: "checkout-fulfillment__address",
3064                                children: [
3065                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
3066                                        className: "checkout-fulfillment__title",
3067                                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
3068                                            children: (0,utils_locale.t)("checkout.pickup.your_pickup_store")
3069                                        })
3070                                    }),
3071                                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3072                                        className: "shipping-address",
3073                                        children: [
3074                                            /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
3075                                                className: "shipping-address__name",
3076                                                children: store === null || store === void 0 ? void 0 : store.name
3077                                            }),
3078                                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
3079                                                className: "shipping-address__address",
3080                                                children: [
3081                                                    store === null || store === void 0 ? void 0 : (_store_address = store.address) === null || _store_address === void 0 ? void 0 : _store_address.address1,
3082                                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("br", {}),
3083                                                    store === null || store === void 0 ? void 0 : (_store_address1 = store.address) === null || _store_address1 === void 0 ? void 0 : _store_address1.city,
3084                                                    ", ",
3085                                                    store === null || store === void 0 ? void 0 : (_store_address2 = store.address) === null || _store_address2 === void 0 ? void 0 : _store_address2.state,
3086                                                    ",",
3087                                                    " ",
3088                                                    store === null || store === void 0 ? void 0 : (_store_address3 = store.address) === null || _store_address3 === void 0 ? void 0 : _store_address3.postalCode
3089                                                ]
3090                                            })
3091                                        ]
3092                                    }),
3093                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
3094                                        className: "shipping-address__link",
3095                                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
3096                                            type: "button",
3097                                            className: "link",
3098                                            "data-testid": "change-store",
3099                                            onClick: onChangeStoreClick,
3100                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
3101                                                children: (0,utils_locale.t)("checkout.pickup.change_store")
3102                                            })
3103                                        })
3104                                    })
3105                                ]
3106                            })
3107                        }),
3108                        /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3109                            className: (PickUpForm_module_default())["slider-container"],
3110                            children: [
3111                                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
3112                                    className: (PickUpForm_module_default())["slider-container-title"],
3113                                    children: (0,utils_locale.t)("checkout.pickup.who_is_picking_up")
3114                                }),
3115                                /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
3116                                    className: (PickUpForm_module_default())["slider-container-subtitle"],
3117                                    children: (0,utils_locale.t)("checkout.pickup.form_instructions")
3118                                }),
3119                                /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.ZP, {
3120                                    container: true,
3121                                    spacing: 2,
3122                                    children: [
3123                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
3124                                            item: true,
3125                                            xs: 12,
3126                                            md: 6,
3127                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
3128                                                name: "email",
3129                                                onChange: (e)=>{
3130                                                    setAddressFieldHandler(e.target.value, user/* USER_CONTACT */.A.EMAIL, constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING);
3131                                                },
3132                                                formatOnBlur: false,
3133                                                "data-testid": "form_field-email",
3134                                                label: (0,utils_locale.t)("checkout.address_form.email"),
3135                                                validate: (0,forms_FieldValidator/* default */.ZP)([
3136                                                    (0,forms_FieldValidator/* required */.C1)(),
3137                                                    (0,forms_FieldValidator/* email */.Do)(),
3138                                                    (0,forms_FieldValidator/* minLength */.Ei)(2)
3139                                                ], "email"),
3140                                                showToolTip: false,
3141                                                inputProps: {
3142                                                    maxLength: forms_FieldValidator/* EMAIL_MAX_LENGTH */.bV
3143                                                },
3144                                                required: true,
3145                                                isDisabled: !!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.email)
3146                                            })
3147                                        }),
3148                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
3149                                            item: true,
3150                                            xs: 12,
3151                                            md: 6,
3152                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
3153                                                name: "firstName",
3154                                                onChange: (e)=>{
3155                                                    setAddressFieldHandler(e.target.value, user/* USER_CONTACT */.A.FIRST_NAME, constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING);
3156                                                },
3157                                                "data-testid": "form_field-firstName",
3158                                                label: (0,utils_locale.t)("checkout.address_form.first_name"),
3159                                                validate: (0,forms_FieldValidator/* default */.ZP)([
3160                                                    (0,forms_FieldValidator/* required */.C1)(),
3161                                                    (0,forms_FieldValidator/* name */.u2)(),
3162                                                    (0,forms_FieldValidator/* minLength */.Ei)(2)
3163                                                ], "firstName"),
3164                                                showToolTip: false,
3165                                                required: true
3166                                            })
3167                                        }),
3168                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
3169                                            item: true,
3170                                            xs: 12,
3171                                            md: 6,
3172                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
3173                                                name: "lastName",
3174                                                onChange: (e)=>{
3175                                                    setAddressFieldHandler(e.target.value, user/* USER_CONTACT */.A.LAST_NAME, constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING);
3176                                                },
3177                                                "data-testid": "form_field-lastName",
3178                                                type: "text",
3179                                                label: (0,utils_locale.t)("checkout.address_form.last_name"),
3180                                                validate: (0,forms_FieldValidator/* default */.ZP)([
3181                                                    (0,forms_FieldValidator/* required */.C1)(),
3182                                                    (0,forms_FieldValidator/* name */.u2)(),
3183                                                    (0,forms_FieldValidator/* minLength */.Ei)(2)
3184                                                ], "lastName"),
3185                                                showToolTip: false,
3186                                                required: true
3187                                            })
3188                                        }),
3189                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
3190                                            item: true,
3191                                            xs: 12,
3192                                            md: 6,
3193                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PhoneFieldWrapper/* PhoneFieldWrapper */.u, {
3194                                                twilioPhoneLookupHandler: twilioLookupHandler,
3195                                                onChange: onPhoneFieldChange,
3196                                                placeholder: "",
3197                                                required: true
3198                                            })
3199                                        })
3200                                    ]
3201                                })
3202                            ]
3203                        }),
3204                        /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3205                            className: (PickUpForm_module_default())["slider-container"],
3206                            children: [
3207                                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
3208                                    className: (PickUpForm_module_default())["slider-container-title"],
3209                                    children: (0,utils_locale.t)("checkout.pickup.select_pickup_date")
3210                                }),
3211                                /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryDatesSlider, {
3212                                    dates: availableWindows || []
3213                                })
3214                            ]
3215                        }),
3216                        ((_availableWindows_selectedAvailableDate = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate === void 0 ? void 0 : _availableWindows_selectedAvailableDate.availableTimes) && ((_availableWindows_selectedAvailableDate1 = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate1 === void 0 ? void 0 : (_availableWindows_selectedAvailableDate_availableTimes = _availableWindows_selectedAvailableDate1.availableTimes) === null || _availableWindows_selectedAvailableDate_availableTimes === void 0 ? void 0 : _availableWindows_selectedAvailableDate_availableTimes.length) !== 0 && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3217                            className: (PickUpForm_module_default())["slider-container"],
3218                            children: [
3219                                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
3220                                    className: (PickUpForm_module_default())["slider-container-title"],
3221                                    id: "pickup-time-label",
3222                                    children: (0,utils_locale.t)("checkout.pickup.select_pickup_time")
3223           
3223                     }),
3224                                /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryTimesSlider, {
3225                                    availableTimes: ((_availableWindows_selectedAvailableDate2 = availableWindows[selectedAvailableDate]) === null || _availableWindows_selectedAvailableDate2 === void 0 ? void 0 : _availableWindows_selectedAvailableDate2.availableTimes) || [],
3226                                    availableWindows: availableWindows,
3227                                    selectedAvailableDate: selectedAvailableDate,
3228                                    labelledby: "pickup-time-label"
3229                                }, selectedAvailableDate)
3230                            ]
3231                        }),
3232                        !availableWindows.length ? /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
3233                            className: (PickUpForm_module_default())["no-availability"],
3234                            children: [
3235                                "Looks like there’s no availability at the moment, please check back soon or",
3236                                " ",
3237                                /*#__PURE__*/ (0,jsx_runtime.jsx)((link_default()), {
3238                                    href: "/contact-us",
3239                                    className: (PickUpForm_module_default()).link,
3240                                    children: "Contact Us"
3241                                })
3242                            ]
3243                        }) : /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3244                            className: (PickUpForm_module_default())["slider-container-middle"],
3245                            children: [
3246                                /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
3247                                    className: (PickUpForm_module_default())["slider-container-middle-text"],
3248                                    children: (0,utils_locale.t)("checkout.pick_up.pickup_delay")
3249                                }),
3250                                /*#__PURE__*/ (0,jsx_runtime.jsx)(components_ui.PickupVerificationMessage, {
3251                                    "data-testid": "pickup-id-verification",
3252                                    children: (0,utils_locale.t)("checkout.pick_up.id_verification")
3253                                }),
3254                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Link/* default */.Z, {
3255                                    href: "https://wildfork.com/delivery-and-pickup-options/",
3256                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
3257                                        className: (PickUpForm_module_default())["slider-container-middle-link"],
3258                                        children: (0,utils_locale.t)("checkout.pick_up.learn_more")
3259                                    })
3260                                })
3261                            ]
3262                        })
3263                    ]
3264                })
3265            });
3266        }
3267    });
3268};
3269
3270// EXTERNAL MODULE: ./src/lib/constants/snackbar.ts
3271var snackbar = __webpack_require__(380254);
3272// EXTERNAL MODULE: ./src/lib/hooks/useGetStores.ts
3273var useGetStores = __webpack_require__(672634);
3274// EXTERNAL MODULE: ./src/lib/hooks/useUnavailableItems.ts
3275var useUnavailableItems = __webpack_require__(674244);
3276// EXTERNAL MODULE: ./node_modules/@react-google-maps/api/dist/esm.js
3277var esm = __webpack_require__(337054);
3278// EXTERNAL MODULE: ./src/components/checkout/delivery/PickUpGoogleMap.module.scss
3279var PickUpGoogleMap_module = __webpack_require__(179077);
3280var PickUpGoogleMap_module_default = /*#__PURE__*/__webpack_require__.n(PickUpGoogleMap_module);
3281;// CONCATENATED MODULE: ./src/components/checkout/delivery/PickUpGoogleMap.tsx
3282
3283
3284
3285
3286
3287const MarkerTP = (param)=>{
3288    let { lat, lng } = param;
3289    return /*#__PURE__*/ (0,jsx_runtime.jsx)(esm.Marker, {
3290        position: {
3291            lat,
3292            lng
3293        }
3294    });
3295};
3296const PickUpGoogleMap = (param)=>{
3297    let { locations } = param;
3298    var _nextAppEnv_googleMaps_apiKey;
3299    const { isLoaded } = (0,esm.useJsApiLoader)({
3300        id: "google-map-script",
3301        googleMapsApiKey: (_nextAppEnv_googleMaps_apiKey = environment.nextAppEnv.googleMaps.apiKey) !== null && _nextAppEnv_googleMaps_apiKey !== void 0 ? _nextAppEnv_googleMaps_apiKey : ""
3302    });
3303    const containerStyle = {
3304        height: "208px",
3305        width: "100%"
3306    };
3307    const center = locations[0];
3308    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
3309        className: (PickUpGoogleMap_module_default())["google-map"],
3310        children: isLoaded ? /*#__PURE__*/ (0,jsx_runtime.jsxs)(esm.GoogleMap, {
3311            mapContainerStyle: containerStyle,
3312            center: center,
3313            zoom: 19,
3314            options: {
3315                minZoom: 9,
3316                maxZoom: 19,
3317                zoomControl: false
3318            },
3319            children: [
3320                locations.map((param)=>{
3321                    let { id, lat, lng } = param;
3322                    return /*#__PURE__*/ (0,jsx_runtime.jsx)(MarkerTP, {
3323                        id: id,
3324                        lat: lat,
3325                        lng: lng
3326                    }, id);
3327                }),
3328                /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {})
3329            ]
3330        }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {})
3331    });
3332};
3333/* harmony default export */ var delivery_PickUpGoogleMap = (/*#__PURE__*/react.memo(PickUpGoogleMap));
3334
3335;// CONCATENATED MODULE: ./src/components/checkout/delivery/components/PickUpContent.tsx
3336
3337
3338// import { useCheckout, useDelivery } from 'context';
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364const LIMIT_PER_RENDER = 3;
3365const PickUpContent = ()=>{
3366    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
3367    const { zipcode } = (0,useZipCode/* useZipCode */.lH)();
3368    const { setAddressSelectedHandler, shippingAddressForm } = (0,CheckoutProvider/* useCheckout */.Mg)();
3369    const { selectedStore, setSelectedStore } = (0,DeliveryProvider/* useDelivery */.qk)();
3370    const [modalIsOpen, setModalIsOpen] = (0,react.useState)(false);
3371    // Message shown in the failure modal. Resolved from the error rather than
3372    // hardcoded
3373    const [modalMessage, setModalMessage] = (0,react.useState)("");
3374    const [disablePickUpBtn, setDisablePickUpBtn] = (0,react.useState)(false);
3375    const { reload } = (0,next_router.useRouter)();
3376    const { loading, showModal: showUnavailableItemsModal, unavailableItems, findOutOfStockItems, removeItemsOutOfStockFromCart, resetUnavailableItems } = (0,useUnavailableItems/* useUnavailableItems */.E)();
3377    const userContact = {
3378        ...shippingAddressForm
3379    };
3380    const { cartFulfillmentTypeHandler } = (0,useCartFulfillmentType/* useCartFulfillmentType */.c)();
3381    const { storeList } = (0,useGetStores/* useGetStores */.KX)(zipcode || userContact.postalCode); // note: userContact provides a fallback for development purposes
3382    const inStorePickupStores = storeList === null || storeList === void 0 ? void 0 : storeList.filter((store)=>(0,utils_checkout/* fulfillmentIncludesPickup */.Nt)(store === null || store === void 0 ? void 0 : store.shippingTypes));
3383    const [loadMore, setLoadMore] = (0,react.useState)(false);
3384    const [isShown, setIsShown] = (0,react.useState)(false);
3385    const locations = [];
3386    const stores = loadMore ? inStorePickupStores.slice(0, LIMIT_PER_RENDER * 2) : inStorePickupStores.slice(0, LIMIT_PER_RENDER);
3387    const showLoadMore = inStorePickupStores.length > LIMIT_PER_RENDER;
3388    inStorePickupStores === null || inStorePickupStores === void 0 ? void 0 : inStorePickupStores.map((store)=>{
3389        locations.push({
3390            id: Number(store["id"]),
3391            lat: Number(store["location"]["latitude"]),
3392            lng: Number(store["location"]["longitude"])
3393        });
3394    });
3395    let day = new Date().getDay();
3396    day === 0 ? day = 7 : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {});
3397    const manageStateMap = ()=>{
3398        isShown === false ? setIsShown(true) : setIsShown(false);
3399    };
3400    const { fetchWindows } = (0,delivery_hooks/* useApiWindows */.n)();
3401    const handleSelectedStore = async (store)=>{
3402        // Reset per attempt so a stale specific message from a previous failure
3403        // never lingers into a different kind of failure this time around.
3404        setModalMessage("");
3405        try {
3406            var _Object_keys;
3407            setDisablePickUpBtn(true);
3408            if (!(store === null || store === void 0 ? void 0 : store.id)) {
3409                setIsShown(true);
3410                setSelectedStore(undefined);
3411                dispatch((0,store_cartSlice/* setSelectedStore */.rp)(null)); // syncing state with local selectedStore state; in the future we should attempt to resolve these both to one state variable in redux only - we would have to test the whole app though
3412                return;
3413            }
3414            const itemsOutOfStock = await findOutOfStockItems({
3415                storeIdProp: store.id.toString()
3416            });
3417            if (itemsOutOfStock.length > 0) {
3418                return;
3419            }
3420            dispatch((0,store_cartSlice/* setStoreIdHandler */.sW)((store === null || store === void 0 ? void 0 : store.id) ? String(store.id) : store_cartSlice/* initialCartState */.Rt.storeId));
3421            try {
3422                await cartFulfillmentTypeHandler({
3423                    fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.PICKUP,
3424                    storeId: store.id
3425                });
3426            } catch (error) {
3427                // This modal is about choosing a store, so if the cart fails to update with the store,
3428                //  we should show a modal about that failure.
3429                setModalMessage((0,resolveCheckoutError/* resolve
3429CheckoutError */.h)(error).message);
3430                setModalIsOpen(true);
3431                Logger_default().error("handleSelectedStore", error);
3432                return;
3433            }
3434            await dispatch((0,store_cartSlice/* getCartItems */.fq)({
3435                checkInventory: true,
3436                errorCodeTranslation: {}
3437            })).unwrap();
3438            const value = ((_Object_keys = Object.keys(store)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length) > 0;
3439            setSelectedStore(store);
3440            dispatch((0,store_cartSlice/* setSelectedStore */.rp)(store)); // syncing state with local selectedStore state; in the future we should attempt to resolve these both to one state variable in redux only - we would have to test the whole app though
3441            setAddressSelectedHandler(value, "pickup");
3442            if (store === null || store === void 0 ? void 0 : store.id) {
3443                await fetchWindows({
3444                    storeId: String(store === null || store === void 0 ? void 0 : store.id)
3445                });
3446            }
3447        } catch (error) {
3448            setModalIsOpen(true);
3449            Logger_default().error("handleSelectedStore", error);
3450        } finally{
3451            setDisablePickUpBtn(false);
3452        }
3453    };
3454    const handleCloseModal = ()=>{
3455        setModalIsOpen(false); // TODO from Jared: this logic is probably identical to the logic in PickUpContent and may benefit from a custom hook (perhaps exluding setModalIsOpen which might be redefined in both for simplicity)
3456        setAddressSelectedHandler(false, "delivery");
3457        reload();
3458    };
3459    if (selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id) {
3460        return /*#__PURE__*/ (0,jsx_runtime.jsx)(PickUpForm, {
3461            store: selectedStore,
3462            onChangeStoreClick: ()=>handleSelectedStore()
3463        });
3464    }
3465    // TODO from Jared: for ModalBasic, the locale languageCode in the heading (GENERIC_EVENT_ERR_HEADING) and error message (GENERIC_ERR_MSG) should come from state/redux
3466    return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
3467        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3468            className: (DeliveryContainer_module_default())["delivery-footer"],
3469            children: [
3470                /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
3471                    className: (DeliveryContainer_module_default())["delivery-footer-pickup-title"],
3472                    children: (0,utils_locale.t)("checkout.pickup.choose_title")
3473                }),
3474                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3475                    "data-testid": "delivery-pickup-map",
3476                    className: (DeliveryContainer_module_default())["delivery-footer-pickup-map"],
3477                    children: [
3478                        /*#__PURE__*/ (0,jsx_runtime.jsx)("a", {
3479                            href: "javascript:void(0);",
3480                            onClick: manageStateMap,
3481                            className: (DeliveryContainer_module_default())["delivery-footer-pickup-subtitle"],
3482                            children: isShown ? (0,utils_locale.t)("checkout.pickup.hide_map") : (0,utils_locale.t)("checkout.pickup.show_map")
3483                        }),
3484                        /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
3485                            onClick: manageStateMap,
3486                            className: (DeliveryContainer_module_default())["delivery-footer-pickup-icon"],
3487                            children: isShown ? /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
3488                                className: (DeliveryContainer_module_default())["delivery-pickup-map-icon"],
3489                                iconName: "arrowsimpleb"
3490                            }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
3491                                className: (DeliveryContainer_module_default())["delivery-pickup-map-icon"],
3492                                iconName: "arrowsimplea"
3493                            })
3494                        })
3495                    ]
3496                }),
3497                isShown ? /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3498                    className: (DeliveryContainer_module_default())["delivery-pickup-GoogleMapCont"],
3499                    children: [
3500                        " ",
3501                        /*#__PURE__*/ (0,jsx_runtime.jsx)(delivery_PickUpGoogleMap, {
3502                            locations: locations
3503                        }),
3504                        " "
3505                    ]
3506                }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {}),
3507                /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
3508                    className: (DeliveryContainer_module_default())["delivery-pickup-cards"],
3509                    children: stores === null || stores === void 0 ? void 0 : stores.map((el, i)=>{
3510                        return /*#__PURE__*/ (0,jsx_runtime.jsx)(StoreCard, {
3511                            index: i,
3512                            store: el,
3513                            startTime: el.hours[day - 1].startTime,
3514                            endTime: el.hours[day - 1].endTime,
3515                            miles: el.distance + " MI",
3516                            disableButton: disablePickUpBtn,
3517                            handleSelectedStore: function() {
3518                                let store = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3519                                return handleSelectedStore({
3520                                    ...store
3521                                });
3522                            }
3523                        }, el.id);
3524                    })
3525                }),
3526                showLoadMore && /*#__PURE__*/ (0,jsx_runtime.jsx)(MoreLessButton, {
3527                    loadMore: loadMore,
3528                    setLoadMore: setLoadMore
3529                }),
3530                /*#__PURE__*/ (0,jsx_runtime.jsx)(ModalBasic.ModalBasic, {
3531                    open: modalIsOpen,
3532                    heading: snackbar/* GENERIC_EVENT_ERR_HEADING */.U3.ERROR(locale.LOCALE.EN_US),
3533                    message: modalMessage || snackbar/* GENERIC_ERR_MSG */.I_.ERROR_ACTION(locale.LOCALE.EN_US),
3534                    onClose: handleCloseModal,
3535                    className: "modal-basic-generic"
3536                }),
3537                /*#__PURE__*/ (0,jsx_runtime.jsx)(ProductInventoryModal/* default */.Z, {
3538                    modalTitle: (0,utils_locale.t)("checkout.payment.product_inventory.title_pick_up"),
3539                    modalDescription: (0,utils_locale.t)("checkout.payment.product_inventory.description_pick_up"),
3540                    itemsWereAlreadyRemoved: false,
3541                    unavailableItems: unavailableItems,
3542                    showModal: showUnavailableItemsModal,
3543                    removeUnavailableItems: removeItemsOutOfStockFromCart,
3544                    onCancel: resetUnavailableItems,
3545                    areButtonsDisabled: loading,
3546                    onCancelButtonLabel: (0,utils_locale.t)("checkout.payment.product_inventory.change_store"),
3547                    onConfirmButtonLabel: (0,utils_locale.t)("checkout.payment.product_inventory.remove_button_pick_up")
3548                })
3549            ]
3550        })
3551    });
3552};
3553const MoreLessButton = (param)=>{
3554    let { loadMore, setLoadMore } = param;
3555    const buttonText = loadMore ? (0,utils_locale.t)("checkout.pickup.load_less") : (0,utils_locale.t)("checkout.pickup.load_more");
3556    const handleClick = ()=>{
3557        setLoadMore(!loadMore);
3558    };
3559    return /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
3560        className: (DeliveryContainer_module_default())["delivery-pickup-loadbutton"],
3561        onClick: handleClick,
3562        children: buttonText
3563    });
3564};
3565
3566;// CONCATENATED MODULE: ./src/components/checkout/delivery/components/PickUpHeader.tsx
3567
3568
3569
3570const PickUpHeader = ()=>{
3571    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
3572        className: (DeliveryContainer_module_default())["delivery-header-wrapper"],
3573        "data-testid": "delivery-container__pickup-accordion-wrapper",
3574        children: [
3575            /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
3576                className: (DeliveryContainer_module_default())["delivery-header-title"],
3577                children: (0,utils_locale.t)("checkout.pickup.address_title")
3578            }),
3579            /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
3580                className: (DeliveryContainer_module_default())["delivery-header-desc"],
3581                children: (0,utils_locale.t)("checkout.pickup.detail")
3582            })
3583        ]
3584    });
3585};
3586
3587// EXTERNAL MODULE: ./src/components/checkout/delivery/hooks/useApiWindows.ts
3588var useApiWindows = __webpack_require__(541502);
3589// EXTERNAL MODULE: ./src/components/ui/accordion/AccordionItem.tsx + 2 modules
3590var AccordionItem = __webpack_require__(312843);
3591// EXTERNAL MODULE: ./node_modules/@mui/material/Link/Link.js + 1 modules
3592var Link_Link = __webpack_require__(837786);
3593// EXTERNAL MODULE: ./node_modules/@mui/material/Modal/Modal.js + 1 modules
3594var Modal = __webpack_require__(979957);
3595// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/interfaces/error.js
3596var error = __webpack_require__(527899);
3597// EXTERNAL MODULE: ./src/lib/emarsys/emarsys.ts
3598var emarsys = __webpack_require__(920937);
3599// EXTERNAL MODULE: ./src/lib/hooks/useHandleExpiredWindow.ts
3600var useHandleExpiredWindow = __webpack_require__(374506);
3601// EXTERNAL MODULE: ./src/lib/store/asyncStorageSlice.ts
3602var asyncStorageSlice = __webpack_require__(202579);
3603// EXTERNAL MODULE: ./src/lib/store/paymentSlice.ts
3604var paymentSlice = __webpack_require__(680811);
3605// EXTERNAL MODULE: ./src/lib/store/uiStateSlice.ts
3606var uiStateSlice = __webpack_require__(647771);
3607// EXTERNAL MODULE: ./src/lib/utils/validation.ts
3608var validation = __webpack_require__(928692);
3609// EXTERNAL MODULE: ./src/lib/utils/routing.ts
3610var routing = __webpack_require__(449825);
3611// EXTERNAL MODULE: ./src/components/checkout/FooterStepActions.module.scss
3612var FooterStepActions_module = __webpack_require__(770115);
3613var FooterStepActions_module_default = /*#__PURE__*/__webpack_require__.n(FooterStepActions_module);
3614// EXTERNAL MODULE: ./node_modules/lodash/debounce.js
3615var debounce = __webpack_require__(23279);
3616var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
3617// EXTERNAL MODULE: ./src/lib/helpers/forms/FormValidator.ts
3618var FormValidator = __webpack_require__(809029);
3619// EXTERNAL MODULE: ./src/lib/store/foragePaymentSlice.ts
3620var foragePaymentSlice = __webpack_require__(131544);
3621// EXTERNAL MODULE: ./src/lib/types/adyen-giftcard.types.ts
3622var adyen_giftcard_types = __webpack_require__(939549);
3623;// CONCATENATED MODULE: ./src/components/checkout/FooterStepButton.tsx
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641const ON_PAY_NOW_DEBOUNCE_TIME = 2000;
3642const FooterStepButton = (param)=>{
3643    let { text, dataTestId, onClick = ()=>null } = param;
3644    var _nextAppEnv_feature_toggle;
3645    const { availableWindows } = (0,DeliveryProvider/* useDelivery */.qk)();
3646    const { addressSelected, billingAddressFormIsValid, currentStep, isPhoneAuthentic, membershipAgreementChecked, shippingAddressForm, isMilitaryAddress, deliveryInstructions } = (0,CheckoutProvider/* useCheckout */.Mg)();
3647    const { isValidPaymentMethod } = (0,store_hooks/* useAppSelector */.C)((state)=>state.payment);
3648    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
3649    const { state: giftCardState, remainingPaymentDue, isGiftCardApplied } = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectGiftCardDetail
3649s */.O4);
3650    const isGiftCardSufficient = giftCardState === adyen_giftcard_types/* GiftCardState */.s.SUFFICIENT;
3651    const isPaymentMethodValidOrGiftCardSufficient = isValidPaymentMethod || isGiftCardSufficient;
3652    const isFullDiscountApplied = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* isFullDiscountAppliedSelector */.nm);
3653    const billingAddressOption = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.billingAddressOption);
3654    const { isOrderMinimumUnmet } = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* orderMinimumSelector */.Id);
3655    const isPickUpFulfillmentType = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* isPickupFulfillmentTypeSelector */.m7);
3656    const membershipLineItemInTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* membershipLineItemInTheCartSelector */.fg);
3657    const onlyMembershipItemInTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* onlyMembershipItemInTheCartSelector */.AA);
3658    const isPaymentProcessing = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* isPaymentProcessingSelector */.J1);
3659    const foragePayment = (0,store_hooks/* useAppSelector */.C)(foragePaymentSlice/* selectForagePayment */.fE);
3660    const cartSlice = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
3661    const isEbtCoveringFullOrder = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectIsEbtCoveringFullOrder */.pS);
3662    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
3663    const recipientData = getRecipientData();
3664    const { isDeliveryHandlingFeeEnabled } = environment.nextAppEnv === null || environment.nextAppEnv === void 0 ? void 0 : (_nextAppEnv_feature_toggle = environment.nextAppEnv.feature_toggle) === null || _nextAppEnv_feature_toggle === void 0 ? void 0 : _nextAppEnv_feature_toggle.US;
3665    // Despite handling the disabled button status using custom biz logic for each checkout step,
3666    // we further add this debounced version for the onClick function to be triggered on submit,
3667    // ONLY for the payment checkout step and in order to prevent any race condition or async
3668    // flow that might allow a double order submit.
3669    const debounceOnClick = debounce_default()(onClick, ON_PAY_NOW_DEBOUNCE_TIME, {
3670        leading: true,
3671        trailing: false
3672    });
3673    const isAddressSelected = addressSelected !== CheckoutProvider/* ADDRESS_SELECTED */.JS.NO_ADDRESS_SELECTED;
3674    if (!text || currentStep === CheckoutProvider/* CheckoutSteps */.bN.delivery && !isAddressSelected || currentStep === CheckoutProvider/* CheckoutSteps */.bN.delivery && !availableWindows.length || !isDeliveryHandlingFeeEnabled && addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_DELIVERY && isOrderMinimumUnmet) {
3675        return null;
3676    }
3677    let disabled = false;
3678    if (currentStep === CheckoutProvider/* CheckoutSteps */.bN.payment && !recipientData) {
3679        // TODO: Implement this
3680        if (isFullDiscountApplied) {
3681            if (billingAddressOption && !billingAddressFormIsValid) {
3682                disabled = true;
3683            }
3684        } else if (isOrderMinimumUnmet && !isPickUpFulfillmentType && !isDeliveryHandlingFeeEnabled) {
3685            disabled = true;
3686        } else if (isKioskVisitor) {
3687            disabled = !billingAddressFormIsValid || !isPaymentMethodValidOrGiftCardSufficient;
3688        } else if (isPaymentProcessing) {
3689            disabled = true;
3690        } else if (locale.isUSLocale && membershipLineItemInTheCart && !membershipAgreementChecked) {
3691            disabled = true;
3692        } else if (!isPickUpFulfillmentType && !isPaymentMethodValidOrGiftCardSufficient) {
3693            disabled = true;
3694        } else if (onlyMembershipItemInTheCart && !billingAddressFormIsValid) {
3695            disabled = true;
3696        } else if (!isPickUpFulfillmentType && billingAddressOption && !billingAddressFormIsValid) {
3697            disabled = true;
3698        } else if (isPickUpFulfillmentType && (!billingAddressFormIsValid || !isPaymentMethodValidOrGiftCardSufficient)) {
3699            disabled = true;
3700        // ebt payment is active, amount is set but the payment method is not val
3700id
3701        } else if (environment.nextAppEnv.feature_toggle.US.isEbtSnapPaymentEnabled && foragePayment.isExpanded && foragePayment.ebtPaymentAmount && !foragePayment.currentPaymentMethod) {
3702            disabled = true;
3703        // ebt payment is active, the payment method is set but the amount is zero
3704        } else if (environment.nextAppEnv.feature_toggle.US.isEbtSnapPaymentEnabled && foragePayment.isExpanded && foragePayment.currentPaymentMethod && !foragePayment.ebtPaymentAmount) {
3705            disabled = true;
3706        // ebt payment is active, but the amount is bigger than max
3707        } else if (environment.nextAppEnv.feature_toggle.US.isEbtSnapPaymentEnabled && foragePayment.isExpanded && foragePayment.ebtPaymentAmount > cartSlice.subTotal) {
3708            disabled = true;
3709        }
3710        // EBT fully covers the order (max amount, EBT-only-possible cart, no tip).
3711        // The selector encapsulates the full predicate; only the billing-address
3712        // gate is button-specific and kept here.
3713        if (isEbtCoveringFullOrder && (!isPickUpFulfillmentType || billingAddressFormIsValid)) {
3714            disabled = false;
3715        }
3716        // Gift Card + EBT cover the temporary hold (no CC needed). Adyen still
3717        // reports the GC as INSUFFICIENT because it compares against the full
3718        // authAmountWithTip without knowing about the EBT lock — remainingPaymentDue
3719        // (from selectGiftCardDetails) is the EBT-aware source of truth and matches
3720        // the "Remaining payment due: $0.00" line already shown in the UI.
3721        // !isPaymentProcessing prevents re-enabling the button while a submit is
3722        // already in flight (double-submit risk).
3723        if (environment.nextAppEnv.feature_toggle.US.isEbtSnapPaymentEnabled && foragePayment.isLocked && isGiftCardApplied && remainingPaymentDue === 0 && !isPaymentProcessing && (!isPickUpFulfillmentType || billingAddressFormIsValid)) {
3724            disabled = false;
3725        }
3726        // Hard gate: an empty cart must always disable the button, regardless of
3727        // any payment-state overrides above.
3728        if (cartSlice.lineItems.length === 0) {
3729            disabled = true;
3730        }
3731    } else if (currentStep === CheckoutProvider/* CheckoutSteps */.bN.delivery) {
3732        if (addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_PICKUP && !((0,FormValidator/* pickupFormIsValid */.yi)(shippingAddressForm) && isPhoneAuthentic[constants_common/* USER_CONTACT_FORM_TYPE */.Hh.SHIPPING]) || // Force delivery instructions completion for Military Address orders.
3733        isMilitaryAddress && deliveryInstructions.length === 0) {
3734            disabled = true;
3735        } else if (cartSlice.lineItems.length === 0) {
3736            disabled = true;
3737        }
3738    }
3739    return /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
3740        item: true,
3741        children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Button */.zx, {
3742            className: "btn",
3743            "data-testid": dataTestId,
3744            onClick: currentStep === CheckoutProvider/* CheckoutSteps */.bN.payment ? debounceOnClick : onClick,
3745            disabled: disabled,
3746            children: text
3747        })
3748    });
3749};
3750
3751// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/index.js
3752var lib_utils = __webpack_require__(305208);
3753// EXTERNAL MODULE: ./src/lib/events.ts
3754var events = __webpack_require__(866067);
3755// EXTERNAL MODULE: ./src/lib/forage/isEbtWrongPinSubmitError.ts + 1 modules
3756var isEbtWrongPinSubmitError = __webpack_require__(80734);
3757// EXTERNAL MODULE: ./src/lib/hooks/useEbtPinGate.ts
3758var useEbtPinGate = __webpack_require__(445443);
3759// EXTERNAL MODULE: ./src/lib/store/autoShipSlice.ts
3760var autoShipSlice = __webpack_require__(455405);
3761// EXTERNAL MODULE: ./src/lib/store/orderSubmit.slice.ts
3762var orderSubmit_slice = __webpack_require__(564449);
3763// EXTERNAL MODULE: ./src/lib/utils/orderErrorHandler.ts
3764var orderErrorHandler = __webpack_require__(239879);
3765// EXTERNAL MODULE: ./src/lib/utils/storeUtils.ts
3766var storeUtils = __webpack_require__(560260);
3767;// CONCATENATED MODULE: ./src/components/checkout/hooks/usePaymentStepActions.ts
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802const ERROR_HANDLER_TIMEOUT = 10000;
3803const usePaymentStepActions = ()=>{
3804    var _cart_subscription;
3805    const { push } = (0,next_router.useRouter)();
3806    const isFullDiscountApplied = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* isFullDiscountAppliedSelector */.nm);
3807    const { isGiftCardSufficient, state: giftCardState, encryptedData, remainingPaymentDue } = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectGiftCardDetail
3807s */.O4);
3808    const hasShippingDiscount = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* hasShippingDiscountSelector */.om);
3809    // forage payment confirmation setup
3810    const { ebtPaymentAmount, isLocked: isEbtPaymentInUse } = (0,store_hooks/* useAppSelector */.C)(foragePaymentSlice/* selectForagePayment */.fE);
3811    const { autoship, showUIComponents } = (0,useCartSubscription/* useCartSubscription */.r)();
3812    const { subscriptionConfirmation } = (0,store_hooks/* useAppSelector */.C)(autoShipSlice/* autoShipSelector */.WU);
3813    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
3814    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
3815    const onlyMembershipItemInTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* onlyMembershipItemInTheCartSelector */.AA);
3816    const cart = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart);
3817    const { billingAddressOption, taxTotal } = cart;
3818    const driverTip = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectDriverTip */.dv);
3819    const isEbtCoveringFullOrder = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectIsEbtCoveringFullOrder */.pS);
3820    const driverTipRef = (0,react.useRef)(driverTip || 0);
3821    const isProcessingOrderRef = (0,react.useRef)(false);
3822    const isMountedRef = (0,react.useRef)(true); // Track if component is mounted
3823    const redirectTimeoutRef = (0,react.useRef)(null); // Track redirect timeout
3824    const isShippingUsedAsBillingAddress = onlyMembershipItemInTheCart || isKioskVisitor ? false : !billingAddressOption;
3825    const { billingAddressForm, shippingAddressForm, isAGift, giftMessage, posMembershipSaveCardAgreementChecked } = (0,CheckoutProvider/* useCheckout */.Mg)();
3826    const { cartFulfillmentTypeHandler } = (0,useCartFulfillmentType/* useCartFulfillmentType */.c)();
3827    const { customerInfo, isLoggedIn, isMember, isLocalMembershipGroup, hasMembershipRenewalToken } = (0,hooks/* useCustomer */.ON)();
3828    const userContactForm = isShippingUsedAsBillingAddress ? {
3829        ...shippingAddressForm
3830    } : {
3831        ...billingAddressForm
3832    };
3833    const userContactFormMemoized = (0,useMemoize/* useMemoizeStruct */.p)(userContactForm);
3834    const billingAddressPayload = {
3835        sameAsShipping: isShippingUsedAsBillingAddress,
3836        ...userContactFormMemoized
3837    };
3838    const scrollToPasswordFor3ds = (0,react.useCallback)(()=>{
3839        if (typeof document !== "undefined") {
3840            requestAnimationFrame(()=>{
3841                const cardPaymentFormContainer = document.querySelector('[data-testid="cardpaymentform-test-id"]');
3842                if (!cardPaymentFormContainer) return;
3843                const targetTop = cardPaymentFormContainer.getBoundingClientRect().top + window.scrollY - 150;
3844                window.scrollTo({
3845                    top: Math.max(0, targetTop),
3846                    behavior: "smooth"
3847                });
3848            });
3849        }
3850    }, []);
3851    const handleServerResponse = (0,react.useCallback)((res, dropin, actions)=>{
3852        if (res.action) {
3853            const jsonAdyenResponseUnescaped = typeof res.action === "string" ? JSON.parse(res.action) : res.action; //convert to JSON and unescape those escaped special characters like from \" to "
3854            if (jsonAdyenResponseUnescaped.action) {
3855                // For redirect-type actions (3DS), call dropin.handleAction directly.
3856                if (typeof (dropin === null || dropin === void 0 ? void 0 : dropin.handleAction) === "function") {
3857                    dropin.handleAction(jsonAdyenResponseUnescaped.action);
3858                    scrollToPasswordFor3ds();
3859                } else {
3860                    actions.resolve({
3861                        action: jsonAdyenResponseUnescaped.action,
3862                        resultCode: jsonAdyenResponseUnescaped.resultCode
3863                    });
3864                }
3865            }
3866        }
3867    }, [
3868        scrollToPasswordFor3ds
3869    ]);
3870    const payment = (0,store_hooks/* useAppSelector */.C)((state)=>state.payment);
3871    const { adyenFormData, adyenFormInstance, fastlaneComponentInstance, isValidPaymentMethod, paymentState, adyenDropinInstance, adyenActions } = payment;
3872    const isAdyenFormDataEmpty = (obj)=>!obj || Object.keys(obj).length === 0;
3873    const memoizedAdyenFormData = (0,useMemoize/* useMemoizeStruct */.p)(isAdyenFormDataEmpty(adyenFormData === null || adyenFormData === void 0 ? void 0 : adyenFormData.paymentMethod) ? null : adyenFormData);
3874    const { resetDeliveryContext, selectedWindowHasExpired } = (0,DeliveryProvider/* useDelivery */.qk)();
3875    const { resetAddressSelected } = (0,CheckoutProvider/* useCheckout */.Mg)();
3876    const [handleExpiredWindow] = (0,useHandleExpiredWindow/* useHandleExpiredWindow */.$)();
3877    const { getUserFastlaneConfig } = (0,useFastlane/* useFastlane */.Pf)();
3878    const handleExpiredWindowAction = (0,react.useCallback)(()=>{
3879        handleExpiredWindow();
3880        push("/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.delivery));
3881    }, [
3882        handleExpiredWindow,
3883        push
3884    ]);
3885    const handleOrderRedirectReset = (0,react.useCallback)(()=>{
3886        resetDeliveryContext();
3887        resetAddressSelected();
3888        (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.DELIVERY_WINDOW, JSON.stringify(defaultDeliveryWindowState), storage.STORAGE_TYPES.SESSION);
3889    }, [
3890        resetDeliveryContext,
3891        resetAddressSelected
3892    ]);
3893    // TODO from Jared: the errors on this page should probably be the error code structure we expect from the api, I think an array of { code: string, message: string }
3894    // TODO from Jared: and we should do the same for all the cat
3894ch blocks
3895    const axiosErrorHandlerOrderSubmit = (0,react.useCallback)((error)=>{
3896        var _error_response_data_errors_, _error_response_data_errors, _error_response_data, _error_response, _error_response_data1, _error_response1;
3897        dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
3898        const cartHasExpired = lib_utils.AxiosErrorUtils.checkIfCartHasExpired(error);
3899        if (cartHasExpired) {
3900            handleExpiredWindowAction();
3901            return;
3902        }
3903        // EBT wrong-PIN: the backend returns a single code for every EBT user
3904        // error, so the wrong-PIN case is detected by message. On a wrong PIN we
3905        // auto-remove the EBT card (handled in useSnapPaymentV2 via the Redux
3906        // flag) so the user is returned to the card-entry screen to re-enter.
3907        // We deliberately do NOT return early — the existing snackbar path below
3908        // shows the backend wrong-PIN message so the user knows why the card was
3909        // cleared. Other EBT user errors fall through to that same snackbar.
3910        const ebtErrorCode = error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : (_error_response_data = _error_response.data) === null || _error_response_data === void 0 ? void 0 : (_error_response_data_errors = _error_response_data.errors) === null || _error_response_data_errors === void 0 ? void 0 : (_error_response_data_errors_ = _error_response_data_errors[0]) === null || _error_response_data_errors_ === void 0 ? void 0 : _error_response_data_errors_.code;
3911        if ((0,isEbtWrongPinSubmitError/* isEbtWrongPinSubmitError */.KH)({
3912            error,
3913            isEbtPaymentInUse
3914        })) {
3915            dispatch((0,foragePaymentSlice/* setEbtAutoUnlockRequested */.PS)(true));
3916        }
3917        dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)(error === null || error === void 0 ? void 0 : (_error_response1 = error.response) === null || _error_response1 === void 0 ? void 0 : (_error_response_data1 = _error_response1.data) === null || _error_response_data1 === void 0 ? void 0 : _error_response_data1.errors));
3918        const { errorMessage } = (0,orderErrorHandler/* submitOrderErrorHandler */.w)({
3919            error,
3920            isMountedRef,
3921            redirectTimeoutRef,
3922            push,
3923            onRedirectScheduled: handleOrderRedirectReset
3924        });
3925        if (!errorMessage) {
3926            return;
3927        }
3928        // An EBT decline tells the customer to do something (re-enter the PIN,
3929        // call the number on the back of the card), so it waits for them instead
3930        // of timing out. Every other submit error keeps its unchanged timeout.
3931        const isEbtSubmitError = isEbtPaymentInUse && isEbtWrongPinSubmitError/* EBT_SUBMIT_ERROR_CODES */.uR.includes(ebtErrorCode);
3932        var _error_message;
3933        (0,snackbarHandlers/* axiosErrorHandler */.ri)({
3934            error,
3935            dispatch,
3936            useResolvedMessages: true,
3937            timeout: ERROR_HANDLER_TIMEOUT,
3938            persistUntilDismissed: isEbtSubmitError,
3939            fallbackSnackbar: {
3940                heading: (0,utils_locale.t)("checkout.problems.order_submit_problem.title_error"),
3941                message: errorMessage
3942            },
3943            customLogger: {
3944                heading: "Order submit error",
3945                details: (_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : ""
3946            }
3947        });
3948    }, [
3949        dispatch,
3950        handleExpiredWindowAction,
3951        handleOrderRedirectReset,
3952        push,
3953        isEbtPaymentInUse
3954    ]);
3955    const processOrderSequence = (0,react.useCallback)(async ()=>{
3956        try {
3957            var _cart_paymentAuth;
3958            const submitOrderPayload = {
3959                paymentData: memoizedAdyenFormData ? JSON.stringify(memoizedAdyenFormData) : null,
3960                tipReceived: driverTipRef.current,
3961                paymentAuth: (_cart_paymentAuth = cart.paymentAuth) !== null && _cart_paymentAuth !== void 0 ? _cart_paymentAuth : "",
3962                // The amount is written to Redux on every keystroke in the EBT field,
3963                // so it is non-zero even when the customer never applied EBT. Only send
3964                // it once EBT is actually applied, matching every other submit payload.
3965                ebtPaymentAmount: isEbtPaymentInUse && ebtPaymentAmount ? ebtPaymentAmount : undefined
3966            };
3967            if (showUIComponents && subscriptionConfirmation) {
3968                var _cart_subscription;
3969                submitOrderPayload["subscription"] = {
3970                    cadence: cart === null || cart === void 0 ? void 0 : (_cart_subscription = cart.subscription) === null || _cart_subscription === void 0 ? void 0 : _cart_subscription.interval
3971                };
3972            }
3973            if (isMember && isLocalMembershipGroup && !hasMembershipRenewalToken && !isGiftCardSufficient && !isEbtPaymentInUse) {
3974                submitOrderPayload["posMembershipSaveCard"] = posMembershipSaveCardAgreementChecked;
3975            }
3976            // EBT + GC INSUFFICIENT where the combined balance covers the temp hold:
3977            // skip GC_AUTH entirely. The backend processes the order during GC_AUTH
3978            // when nothing is left to pay, which invalidates the cart before the
3979            // final submit runs.
3980            const isEbtCoversRemainder = isEbtPaymentInUse && giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && !!encryptedData && remainingPaymentDue === 0;
3981            if (giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && encryptedData && !isEbtCoversRemainder) {
3982                var _cart_paymentAuth1;
3983                const submitOrderGCPayload = {
3984                    paymentData: JSON.stringify(encryptedData),
3985                    tipReceived: 0,
3986                    paymentAuth: (_cart_paymentAuth1 = cart.paymentAuth) !== null && _cart_paymentAuth1 !== void 0 ? _cart_paymentAuth1 : "",
3987                    ebtPaymentAmount: isEbtPaymentInUse && ebtPaymentAmount ? ebtPaymentAmount : undefined
3988                };
3989                const { error } = await (0,withAsync/* withAsync */.j)(()=>(0,checkoutApi/* submitOrderGC */.FL)(submitOrderGCPayload));
3990                if (error) {
3991                    events/* default */.Z.emit(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED);
3992                    throw error;
3993                }
3994            }
3995            submitOrderPayload["storeId"] = (0,browserStorage/* getItem */.rV)(storage.STORAGE_KEYS.CART_FULFILLMENT_STORE_ID, storage.STORAGE_TYPES.SESSION);
3996            if (isEbtCoversRemainder) {
3997                // GC + EBT together cover the temp hold (no CC). The single submit
3998                // carries the GC encrypted data so the backend can apply it.
3999                submitOrderPayload.paymentData = JSON.stringify(encryptedData);
4000            } else if (// EBT + CG and if amount is remaining on the order after GC is applied,
4001            // pass the Adyen data so the backend can process the payment with the correct amount and risk data.
4002            isEbtPaymentInUse && encryptedData && giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && remainingPaymentDue !== 0) {
4003                submitOrderPayload.paymentData = JSON.stringify(memoizedAdyenFormData);
4004            } else if (isEbtPaymentInUse && (isEbtCoveringFullOrder || giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && encryptedData)) {
4005                // For EBT-only or EBT + partial GC, the main submitOrder is the EBT
4006                // capture step — paymentData must be null (no Adyen CC data to send).
4007                submitOrderPayload.paymentData = null;
4008            }
4009            const { response, error } = await (0,withAsync/* withAsync */.j)(()=>(0,checkoutApi/* submitOrder */.pm)(submitOrderPayload));
4010            if (error) {
4011                events/* default */.Z.emit(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED);
4012                throw error;
4013            }
4014            const submitOrderResponse = response === null || response === void 0 ? void 0 : response.data;
4015            if (submitOrderResponse) {
4016                dispatch((0,orderSubmit_slice/* setOrderSubmitResponse */.VN)(submitOrderResponse));
4017            }
4018            if ((submitOrderResponse === null || submitOrderResponse === void 0 ? void 0 : submitOrderResponse.orderNumber) && adyenActions && adyenDropinInstance && submitOrderResponse.action) {
4019                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PENDING));
4020                (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.ADYEN_REDIRECT_CONTEXT, JSON.stringify({
4021                    isAGift,
4022                    giftMessage,
4023                    tipReceived: driverTipRef.current,
4024                    selectedStore: cart.selectedStore
4025                }), storage.STORAGE_TYPES.SESSION);
4026                dispatch((0,paymentSlice/* resetPaymentMethods */.pq)());
4027                handleServerResponse(submitOrderResponse, adyenDropinInstance, adyenActions);
4028                return;
4029            }
4030            if (submitOrderResponse === null || submitOrderResponse === void 0 ? void 0 : submitOrderResponse.orderNumber) {
4031                (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.DELIVERY_WINDOW, JSON.stringify({
4032                    ...submitOrderResponse === null || submitOrderResponse === void 0 ? void 0 : submitOrderResponse.deliveryWindow,
4033                    isAGift,
4034                    giftMessage
4035                }), storage.STORAGE_TYPES.SESSION);
4036                dispatch((0,paymentSlice/* resetPaymentMethods */.pq)());
4037                // Handle both legacy and modern Adyen API.
4038                // adyenFormInstance may be null in EBT-only checkout (triggerReInit
4039                // sets it to null at APPLY and recreation is async).
4040                if (adyenFormInstance) {
4041                    const adyenInstance = adyenFormInstance;
4042                    if (adyenInstance.dropinRef) {
4043                        // adyen 6.5.1: unmount the dropin reference
4044                        adyenInstance.dropinRef.unmount();
4045                    } else if (!adyenInstance.createDropin) {
4046                        // Legacy API fallback
4047                        const typedAFI = adyenFormInstance;
4048                        const dropin = typedAFI.getComponent("dropin");
4049                        if (dropin && typeof dropin.unmount === "function") {
4050                            dropin.unmount();
4051                        }
4052                    }
4053                }
4054                dispatch((0,paymentSlice/* saveAdyenDropinInstance */.ct)(null));
4055                dispatch((0,paymentSlice/* saveAdyenFormInstance */.hm)(null));
4056                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.SUCCESS));
4057                push("/checkout/confirmation");
4058            }
4059        } catch (err) {
4060            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4061            axiosErrorHandlerOrderSubmit(err);
4062        }
4063    }, [
4064        memoizedAdyenFormData,
4065        cart.paymentAuth,
4066        cart.selectedStore,
4067        cart === null || cart === void 0 ? void 0 : (_cart_subscription = cart.subscription) === null || _cart_subscription === void 0 ? void 0 : _cart_subscription.interval,
4068        ebtPaymentAmount,
4069        isEbtCoveringFullOrder,
4070        showUIComponents,
4071        subscriptionConfirmation,
4072        isMember,
4073        isLocalMembershipGroup,
4074        hasMembershipRenewalToken,
4075        isGiftCardSufficient,
4076        giftCardState,
4077        encryptedData,
4078        remainingPaymentDue,
4079        isEbtPaymentInUse,
4080        posMembershipSaveCardAgreementChecked,
4081        dispatch,
4082        isAGift,
4083        giftMessage,
4084        adyenFormInstance,
4085        push,
4086        axiosErrorHandlerOrderSubmit,
4087        adyenDropinInstance,
4088        handleServerResponse,
4089        adyenActions
4090    ]);
4091    const executeSubmitFlow = async ()=>{
4092        driverTipRef.current = driverTip || 0;
4093        //User will pay the entire cart with EBT
4094        if (isEbtCoveringFullOrder) {
4095            try {
4096                var _addBillingAddressResponse_data;
4097                if (onlyMembershipItemInTheCart) {
4098                    await handleMembershipStandAlone();
4099                }
4100                const addBillingAddressResponse = await handleBillingAddress();
4101                if (!(addBillingAddressResponse === null || addBillingAddressResponse === void 0 ? void 0 : (_addBillingAddressResponse_data = addBillingAddressResponse.data) === null || _addBillingAddressResponse_data === void 0 ? void 0 : _addBillingAddressResponse_data.address)) return;
4102                dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([])); // clear error code state prior to making a new call
4103                await processOrderSequence();
4104            } catch (err) {
4105                axiosErrorHandlerOrderSubmit(err);
4106            }
4107            return;
4108        }
4109        if (isFullDiscountApplied) {
4110            try {
4111                var _addBillingAddressResponse_data1;
4112                if (onlyMembershipItemInTheCart) {
4113                    await handleMembershipStandAlone();
4114                }
4115                const addBillingAddressResponse = await handleBillingAddress();
4116                if (!(addBillingAddressResponse === null || addBillingAddressResponse === void 0 ? void 0 : (_addBillingAddressResponse_data1 = addBillingAddressResponse.data) === null || _addBillingAddressResponse_data1 === void 0 ? void 0 : _addBillingAddressResponse_data1.address)) return;
4117                dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([])); // clear error code state prior to making a new call
4118                await processOrderSequence();
4119            } catch (err) {
4120                axiosErrorHandlerOrderSubmit(err);
4121            }
4122            return;
4123        }
4124        if (onlyMembershipItemInTheCart) {
4125            try {
4126                await handleMembershipStandAlone();
4127            } catch (error) {
4128                axiosErrorHandlerOrderSubmit(error);
4129                return;
4130            }
4131        }
4132        if (showUIComponents && autoship && !subscriptionConfirmation) {
4133            dispatch((0,autoShipSlice/* setSubscriptionError */.be)(true));
4134            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.INITIAL));
4135            return;
4136        }
4137        // EBT + Gift Card (INSUFFICIENT): GC covers part of the cart, EBT covers
4138        // the remaining balance. Route through processOrderSequence which submits
4139        // submitOrderGC first (with ebtPaymentAmount), then the main submitOrder.
4140        if (isEbtPaymentInUse && (giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && encryptedData || hasShippingDiscount && remainingPaymentDue === taxTotal)) {
4141            try {
4142                var _addBillingAddressResponse_data2;
4143                const addBillingAddressResponse = await handleBillingAddress();
4144                if (!(addBillingAddressResponse === null || addBillingAddressResponse === void 0 ? void 0 : (_addBillingAddressResponse_data2 = addBillingAddressResponse.data) === null || _addBillingAddressResponse_data2 === void 0 ? void 0 : _addBillingAddressResponse_data2.address)) return;
4145                dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([]));
4146                await processOrderSequence();
4147            } catch (err) {
4148                axiosErrorHandlerOrderSubmit(err);
4149            }
4150            return;
4151        }
4152        if (!isValidPaymentMethod && !isGiftCardSufficient) {
4153            var // Surface Adyen's inline field errors (invalid/missing card fields) and
4154            // release the button from PENDING so the user can correct and retry.
4155            _adyenDropinInstance_showValidation;
4156            adyenDropinInstance === null || adyenDropinInstance === void 0 ? void 0 : (_adyenDropinInstance_showValidation = adyenDropinInstance.showValidation) === null || _adyenDropinInstance_showValidation === void 0 ? void 0 : _adyenDropinInstance_showValidation.call(adyenDropinInstance);
4157            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.INITIAL));
4158            return;
4159        }
4160        try {
4161            var _addBillingAddressResponse_data3;
4162            const addBillingAddressResponse = await handleBillingAddress();
4163            if (addBillingAddressResponse === null || addBillingAddressResponse === void 0 ? void 0 : (_addBillingAddressResponse_data3 = addBillingAddressResponse.data) === null || _addBillingAddressResponse_data3 === void 0 ? void 0 : _addBillingAddressResponse_data3.address) {
4164                handlePayment();
4165            }
4166        } catch (error) {
4167            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4168            var _error_message;
4169            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
4170                error,
4171                dispatch,
4172                useResolvedMessages: true,
4173                fallbackSnackbar: {
4174                    heading: (0,utils_locale.t)("checkout.problems.billing_address_problem.title_error"),
4175                    message: (0,utils_locale.t)("checkout.problems.billing_address_problem.error_message")
4176                },
4177                customLogger: {
4178                    heading: "Billing address error",
4179                    details: (_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : ""
4180                }
4181            });
4182        }
4183    };
4184    const { requestPinIfNeeded } = (0,useEbtPinGate/* useEbtPinGate */.M)({
4185        onPinVerified: ()=>void executeSubmitFlow(),
4186        // PIN modal dismissed before the PIN was verified, so release PAY NOW.
4187        onDismissed: ()=>
4187dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.INITIAL))
4188    });
4189    const onPayNowClick = async ()=>{
4190        dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PENDING));
4191        if (selectedWindowHasExpired && !onlyMembershipItemInTheCart) {
4192            handleExpiredWindowAction();
4193            return;
4194        }
4195        try {
4196            const hasAnyRemovedLineItems = await checkInventory();
4197            if (hasAnyRemovedLineItems) {
4198                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.INITIAL));
4199                return;
4200            }
4201        } catch (error) {
4202            axiosErrorHandlerOrderSubmit(error);
4203            return;
4204        }
4205        // EBT PIN gate: when EBT is applied at APPLY but PIN has not been verified
4206        // yet, the gate opens the PIN modal and pauses submit until it resumes.
4207        if (requestPinIfNeeded()) return;
4208        await executeSubmitFlow();
4209    };
4210    const handleMembershipStandAlone = async ()=>{
4211        try {
4212            await cartFulfillmentTypeHandler({
4213                fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.PICKUP,
4214                ...isLoggedIn && {
4215                    pickupDetails: customerInfo
4216                }
4217            });
4218            // Store fulfillment with the billing zip so the backend reprices the membership against the billing region
4219            // instead of the header zipcode. Throws on failure so the order is not
4220            // submitted with the wrong pricing.
4221            await (0,storeUtils.submitZipcodeHandler)(billingAddressPayload.postalCode);
4222            await dispatch((0,store_cartSlice/* addShippingAddress */.VE)({
4223                data: billingAddressPayload
4224            })).unwrap();
4225        } catch (error) {
4226            throw error;
4227        }
4228    };
4229    const checkInventory = async ()=>{
4230        var _response_data_removedLineItems, _response_data;
4231        const { response, error } = await (0,withAsync/* withAsync */.j)(()=>(0,getCartItemApi/* getCart */.d)({
4232                checkInventory: true
4233            }));
4234        if (error) {
4235            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4236            refreshAdyenDropIn();
4237            throw error;
4238        }
4239        const hasAnyRemovedLineItems = !!(response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : (_response_data_removedLineItems = _response_data.removedLineItems) === null || _response_data_removedLineItems === void 0 ? void 0 : _response_data_removedLineItems.length);
4240        if (hasAnyRemovedLineItems) {
4241            dispatch((0,store_cartSlice/* setCartFromApiResponse */.Ds)(response.data));
4242        }
4243        return hasAnyRemovedLineItems;
4244    };
4245    const refreshAdyenDropIn = (0,react.useCallback)(()=>{
4246        if (!adyenFormInstance) return;
4247        const adyenInstance = adyenFormInstance;
4248        if (adyenInstance.dropinRef) {
4249            // adyen 6.5.1 with stored dropin reference
4250            adyenInstance.dropinRef.update({});
4251        } else if (adyenInstance.createDropin) {
4252            // adyen 6.5.1 without stored reference
4253            // We cannot create and mount a new dropin here because we don't have the container reference
4254            // Instead, just dispatch an event to trigger payment through the existing instance
4255            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PAYMENT_SUBMITTED));
4256        } else {
4257            // Legacy API fallback
4258            const typedAFI = adyenFormInstance;
4259            const dropin = typedAFI.getComponent("dropin");
4260            if (dropin) {
4261                // @ts-ignore - TODO: Update types when Adyen provides proper type definitions
4262                dropin.update({});
4263            }
4264        }
4265    }, [
4266        adyenFormInstance,
4267        dispatch
4268    ]);
4269    const handleBillingAddress = async ()=>{
4270        try {
4271            const addBillingAddressResponse = await (0,api_cart/* addBillingAddress */.Y_)(billingAddressPayload);
4272            return addBillingAddressResponse;
4273        } catch (error) {
4274            throw error;
4275        }
4276    };
4277    const handleGiftCardFullPayment = async ()=>{
4278        try {
4279            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PENDING));
4280            const submitOrderPayload = {
4281                paymentData: JSON.stringify(encryptedData),
4282                tipReceived: driverTipRef.current,
4283                paymentAuth: "",
4284                ebtPaymentAmount: isEbtPaymentInUse && ebtPaymentAmount ? ebtPaymentAmount : undefined
4285            };
4286            submitOrderPayload["storeId"] = (0,browserStorage/* getItem */.rV)(storage.STORAGE_KEYS.CART_FULFILLMENT_STORE_ID, storage.STORAGE_TYPES.SESSION);
4287            const submitOrderResponse = await (0,checkoutApi/* submitOrder */.pm)(submitOrderPayload);
4288            dispatch((0,orderSubmit_slice/* setOrderSubmitResponse */.VN)(submitOrderResponse.data));
4289            push(commons.PATHS.CHECKOUT_CONFIRMATION);
4290        } catch (error) {
4291            events/* default */.Z.emit(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED);
4292            axiosErrorHandlerOrderSubmit(error);
4293        }
4294    };
4295    const handlePayment = async ()=>{
4296        if (isGiftCardSufficient) {
4297            return handleGiftCardFullPayment();
4298        }
4299        if (!adyenFormInstance) {
4300            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4301            return;
4302        }
4303        try {
4304            var _fastLaneUserConfig_fastlaneAuthData;
4305            const fastlaneInstance = fastlaneComponentInstance;
4306            /**
4307       * Determine the submit path based on Fastlane component availability:
4308       * - If fastlaneComponentInstance exists (set when Fastlane is selected, cleared when switching away):
4309       *   Use the Fastlane component's submit() directly
4310       * - Otherwise: Use the dropin's submit() which handles scheme, PayPal, Apple Pay, etc.
4311       */ const fastLaneUserConfig = getUserFastlaneConfig();
4312            const isFastlaneAuthSucceeded = fastLaneUserConfig !== null && (fastLaneUserConfig === null || fastLaneUserConfig === void 0 ? void 0 : (_fastLaneUserConfig_fastlaneAuthData = fastLaneUserConfig.fastlaneAuthData) === null || _fastLaneUserConfig_fastlaneAuthData === void 0 ? void 0 : _fastLaneUserConfig_fastlaneAuthData.authenticationState) === useFastlane/* FastlaneAuthStatus */.RW.SUCCEEDED;
4313            if (isFastlaneAuthSucceeded && fastlaneInstance && typeof fastlaneInstance.submit === "function") {
4314                // Use Fastlane component's submit for Fastlane payments
4315                fastlaneInstance.submit();
4316            } else {
4317                if (adyenDropinInstance && typeof adyenDropinInstance.submit === "function") {
4318                    adyenDropinInstance.submit();
4319                    dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PAYMENT_SUBMITTED));
4320                } else {
4321                    // Legacy API fallback
4322                    const typedAFI = adyenFormInstance;
4323                    const dropin = typedAFI.getComponent("dropin");
4324                    if (dropin) {
4325                        // @ts-ignore - Adyen API type mismatch
4326                        dropin.submit();
4327                    } else {
4328                        throw new Error("Mounted Adyen Drop-in instance is not available");
4329                    }
4330                }
4331            }
4332        } catch (error) {
4333            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4334            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
4335                error,
4336                dispatch,
4337                useResolvedMessages: true,
4338                leadingSnackbar: {
4339                    heading: (0,utils_locale.t)("checkout.payment.result.title_error"),
4340                    message: (0,utils_locale.t)("checkout.payment.result.error")
4341                },
4342                customLogger: {
4343                    heading: "adyen payment error",
4344                    details: error
4345                }
4346            });
4347        }
4348    };
4349    (0,react.useEffect)(()=>{
4350        if (paymentState === paymentSlice/* PaymentState */.Ky.PAYMENT_SUBMITTED && adyenFormInstance && !isProcessingOrderRef.current) {
4351            isProcessingOrderRef.current = true;
4352            const handleOrderSubmit = async ()=>{
4353                try {
4354                    dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([])); // clear error code state prior to making a new call
4355                    await processOrderSequence();
4356                } catch (error) {
4357                    dispatch((0,store_cartSlice/* getCartItems */.fq)({
4358                        checkInventory: false
4359                    }));
4360                    refreshAdyenDropIn();
4361                    // dispatch(paymentMethods(resetPaymentMethods()));
4362                    axiosErrorHandlerOrderSubmit(error);
4363                } finally{
4364                    isProcessingOrderRef.current = false;
4365                }
4366            };
4367            handleOrderSubmit();
4368        }
4369    }, [
4370        paymentState,
4371        adyenFormInstance,
4372        dispatch,
4373        processOrderSequence,
4374        axiosErrorHandlerOrderSubmit,
4375        refreshAdyenDropIn
4376    ]);
4377    const backLinkText = onlyMembershipItemInTheCart ? (0,utils_locale.t)("checkout.back_to_cart") : (0,utils_locale.t)("checkout.footer.back_link.payment");
4378    const onBackLinkClick = ()=>onlyMembershipItemInTheCart ? push("/cart") : push("/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.delivery));
4379    // Cleanup on hook unmount
4380    (0,react.useEffect)(()=>{
4381        isMountedRef.current = true;
4382        return ()=>{
4383            isMountedRef.current = false;
4384            var _redirectTimeoutRef_current;
4385            // Reading .current at cleanup time is intentional — we want the timeout
4386            // that is active at unmount, not the one captured at mount (likely null).
4387            // eslint-disable-next-line react-hooks/exhaustive-deps
4388            clearTimeout((_redirectTimeoutRef_current = redirectTimeoutRef.current) !== null && _redirectTimeoutRef_current !== void 0 ? _redirectTimeoutRef_current : undefined);
4389        };
4390    }, []);
4391    return {
4392        backLinkText,
4393        onBackLinkClick,
4394        buttonText: (0,utils_locale.t)("checkout.footer.action_button.payment"),
4395        onButtonClick: onPayNowClick,
4396        dataTestId: "checkout-step-payment",
4397        axiosErrorHandlerOrderSubmit,
4398        processOrderSequence
4399    };
4400};
4401
4402// EXTERNAL MODULE: ./src/lib/corporateGifts/handlers/index.ts + 8 modules
4403var handlers = __webpack_require__(398736);
4404;// CONCATENATED MODULE: ./src/components/checkout/FooterStepActions.tsx
4405
4406
4407//import TagManager from "react-gtm-module";
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448const defaultDeliveryWindowState = {
4449    id: constants_common/* NEG_1_STR */.Nn,
4450    deliveryInstructions: "",
4451    giftMessage: "",
4452    isGift: false
4453};
4454const defaultFooterStepActionsContentTranslation = {
4455    paymentFailedModal: {
4456        heading: "We were unable to process your payment",
4457        callToAction1: "Please contact your bank. If the issue persists,",
4458        callToAction2: "Contact us"
4459    }
4460};
4461const FooterStepActions = (param)=>{
4462    let { contentTranslation = defaultFooterStepActionsContentTranslation } = param;
4463    var _actions_currentStep, _actions_currentStep1, _actions_currentStep2, _contentTranslation_paymentFailedModal, _contentTranslation_paymentFailedModal1, _contentTranslation_paymentFailedModal2, _actions_currentStep3, _actions_currentStep4, _actions_currentStep5;
4464    const { cookieDyMemberRedirect } = (0,store_hooks/* useAppSelector */.C)(asyncStorageSlice/* asyncStorageSelector */.KS);
4465    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
4466    const { push } = (0,next_router.useRouter)();
4467    const { availableWindows, selectedAvailableDate, selectedAvailableTime, selectedStore, selectedWindowHasExpired } = (0,DeliveryProvider/* useDelivery */.qk)();
4468    const { currentStep, deliveryInstructions, isAGift, giftMessage, setUserContactHandler, shippingAddressForm } = (0,CheckoutProvider/* useCheckout */.Mg)();
4469    const { cartFulfillmentTypeHandler } = (0,useCartFulfillmentType/* useCartFulfillmentType */.c)();
4470    const [handleExpiredWindow] = (0,useHandleExpiredWindow/* useHandleExpiredWindow */.$)();
4471    const cart = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart);
4472    const { paymentErrorCodes } = (0,store_hooks/* useAppSelector */.C)((state)=>state.payment);
4473    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
4474    const { resetDeliveryContext } = (0,DeliveryProvider/* useDelivery */.qk)();
4475    const { isLoggedIn, customerInfo } = (0,useCustomer/* useCustomer */.O)();
4476    const { resetCheckoutContext, resetLoggedUserAddress, clearReduxAddressState } = (0,CheckoutProvider/* useCheckout */.Mg)();
4477    const clearPaymentErrorCodes = (0,react.useCallback)(()=>{
4478        dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([])); // clear error code state prior to making a new call
4479    }, [
4480        dispatch
4481    ]);
4482    const reserveAvailabilityWindowHandler = async ()=>{
4483        const deliveryWindowFromStorage = (0,browserStorage/* getItem */.rV)(storage.STORAGE_KEYS.DELIVERY_WINDOW, storage.STORAGE_TYPES.SESSION);
4484        const deliveryWindow = deliveryWindowFromStorage ? JSON.parse(deliveryWindowFromStorage) : defaultDeliveryWindowState;
4485        const { error } = await (0,withAsync/* withAsync */.j)(()=>{
4486            return (0,checkoutApi/* reserveAvailabilityWindow */.R4)(deliveryWindow);
4487        });
4488        if (error) {
4489            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
4490                error,
4491                dispatch,
4492                useResolvedMessages: true,
4493                leadingSnackbar: {
4494                    heading: snackbar/* GENERIC_EVENT_ERR_HEADING */.U3.REQUEST_FAILED(),
4495                    message: snackbar/* GENERIC_EVENT_ERR_MSG */.vf.RESERVE_WINDOWS()
4496                }
4497            });
4498        } else {
4499            const response = await dispatch((0,store_cartSlice/* getCartItems */.fq)({
4500                checkInventory: false,
4501                setUserContactHandler,
4502                errorCodeTranslation: {}
4503            }));
4504            if (response === null || response === void 0 ? void 0 : response.payload) {
4505                const customerEmail = (customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.email) || (shippingAddressForm === null || shippingAddressForm === void 0 ? void 0 : shippingAddressForm.email);
4506                if (!isLoggedIn && cart.selectedDeliveryMethod === store_cartSlice/* DeliveryMethods */.tI.PickUp) {
4507                    await (0,trackingEvents/* emarsysProceedToCheckout */.xt)(cart.lineItems, customerEmail);
4508                }
4509                const emarsysShippingDetails = (0,emarsys/* structureEmarsysShippingDetails */.yb)(response.payload);
4510                (0,trackingEvents/* emarsysDeliverySelection */.v8)(cart.lineItems, emarsysShippingDetails, customerEmail);
4511                push("/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.payment));
4512            }
4513        }
4514    };
4515    const onDeliveryFormUpdate = ()=>{
4516        var _availableWindows_selectedAvailableDate_availableTimes, _availableWindows_selectedAvailableDate;
4517        var _fulfillmentType, _ref;
4518        const deliveryWindowData = {
4519            id: (0,dbDeliveryDataTransformer/* doesFulfillmentTypeExcludeTimeOptions */.C1)((_fulfillmentType = (availableWindows[0] || {}).fulfillmentType) !== null && _fulfillmentType !== void 0 ? _fulfillmentType : "") ? (availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) && availableWindows[selectedAvailableDate].id || constants_common/* NEG_1_STR */.Nn : (_ref = (availableWindows === null || availableWindows === void 0 ? void 0 : availableWindows.length) && ((_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.length) && availableWindows[selectedAvailableDate].availableTimes[selectedAvailableTime].id) !== null && _ref !== void 0 ? _ref : constants_common/* NEG_1_STR */.Nn,
4520            deliveryInstructions: deliveryInstructions || "",
4521            giftMessage: giftMessage || "",
4522            isGift: isAGift || false
4523        };
4524        (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.DELIVERY_WINDOW, JSON.stringify(deliveryWindowData), storage.STORAGE_TYPES.SESSION);
4525    };
4526    const paymentStepActions = usePaymentStepActions();
4527    const { axiosErrorHandlerOrderSubmit } = paymentStepActions;
4528    const actions = {
4529        [CheckoutProvider/* CheckoutSteps */.bN.auth]: {
4530            backLinkText: (0,utils_locale.t)("checkout.footer.back_link.auth"),
4531            onBackLinkClick: ()=>{
4532                push("/cart");
4533            },
4534            dataTestId: "checkout-step-auth"
4535        },
4536        [CheckoutProvider/* CheckoutSteps */.bN.delivery]: {
4537            backLinkText: isLoggedIn || isKioskVisitor ? (0,utils_locale.t)("checkout.footer.back_link.auth") : cookieDyMemberRedirect ? (0,utils_locale.t)("checkout.footer.back_link.delivery") : "Checkout",
4538            onBackLinkClick: ()=>{
4539                if (isLoggedIn || isKioskVisitor) {
4540                    push("/cart");
4541                } else {
4542                    push("/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.auth));
4543                    resetLoggedUserAddress();
4544                    resetDeliveryContext();
4545                    resetCheckoutContext();
4546                    clearReduxAddressState();
4547                }
4548            },
4549            buttonText: (0,utils_locale.t)("checkout.footer.action_button.delivery"),
4550            onButtonClick: async ()=>{
4551                if (selectedWindowHasExpired) {
4552                    handleExpiredWindow();
4553                    return;
4554                }
4555                (0,trackingEvents/* GTMAddShippingInfo */.o6)();
4556                onDeliveryFormUpdate();
4557                if (cart.selectedDeliveryMethod === store_cartSlice/* DeliveryMethods */.tI.PickUp) {
4558                    try {
4559                        var _selectedStore_id;
4560                        await cartFulfillmentTypeHandler({
4561                            fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.PICKUP,
4562                            storeId: (_selectedStore_id = selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id) !== null && _selectedStore_id !== void 0 ? _selectedStore_id : cart.storeId
4563                        });
4564                    } catch (error) {
4565                        (0,snackbarHandlers/* axiosErrorHandler */.ri)({
4566                            error,
4567                            dispatch,
4568                            useResolvedMessages: true
4569                        });
4570                    }
4571                }
4572                reserveAvailabilityWindowHandler();
4573            },
4574            dataTestId: "checkout-step-delivery"
4575        },
4576        [CheckoutProvider/* CheckoutSteps */.bN.payment]: paymentStepActions
4577    };
4578    const isMobileViewFromQueryParamOrCookie = (0,store_hooks/* useAppSelector */.C)(uiStateSlice/* isMobileViewFromQueryParamOrCookieSelector */.$k);
4579    const isMobileViewAndBackToCartText = (actions === null || actions === void 0 ? void 0 : (_actions_currentStep = actions[currentStep]) === null || _actions_currentStep === void 0 ? void 0 : _actions_currentStep.backLinkText) === (0,utils_locale.t)("checkout.footer.back_link.auth") && isMobileViewFromQueryParamOrCookie;
4580    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
4581    const recipientData = getRecipientData();
4582    var _actions_currentStep_buttonText;
4583    /**
4584   * Determines the footer action button text based on checkout context
4585   *
4586   * @description
4587   * Conditionally sets the button text for the footer action button:
4588   * - If on payment step AND no recipient data exists: displays "Corporate Gift" button text
4589   * - Otherwise: uses the default button text for the current checkout step
4590   *
4591   * This allows the payment step to show a specialized button label for corporate gifting
4592   * orders when a voucher code flow is active, distinguishing it from standard payment processing.
4593   *
4594   * @example
4595   * // On payment step without recipient data:
4596   * // buttonText = "Submit Corporate Gift Order"
4597   *
4598   * // On payment step with recipient data (standard checkout):
4599   * // buttonText = "Complete Payment"
4600   *
4601   * // On delivery step:
4602   * // buttonText = "Continue to Payment"
4603   */ const buttonText = currentStep === CheckoutProvider/* CheckoutSteps */.bN.payment && recipientData ? (0,utils_locale.t)("checkout.footer.action_button.corporate_gift") : (_actions_currentStep_buttonText = (_actions_currentStep1 = actions[currentStep]) === null || _actions_currentStep1 === void 0 ? void 0 : _actions_currentStep1.buttonText) !== null && _actions_currentStep_buttonText !== void 0 ? _actions_currentStep_buttonText : null;
4604    /**
4605   * Handles corporate gifting order submission with voucher code
4606   *
4607   * @description
4608   * Submits a corporate gifting order using the voucher code from recipient data.
4609   * This handler:
4610   * 1. Calls createOrderSubmitHandlers to submit the order with voucher code
4611   * 2. Navigates to order confirmation page on success
4612   * 3. Displays error snackbar notification on failure
4613   *
4614   * The order submission includes:
4615   * - Tip amount (defaults to 0)
4616   * - Store ID (from selected store or cart fallback)
4617   * - Voucher code (from recipient data)
4618   *
4619   * @returns Promise that resolves when order submission completes
4620   *
4621   * @example
4622   * await handleSubmitOrder();
4623   * // On success: navigates to /checkout?step=orderConfirmation
4624   * // On error: displays error snackbar via axiosErrorHandler
4625   */ const handleSubmitOrder = async ()=>{
4626        try {
4627            const hasAnyRemovedLineItems = await checkInventory();
4628            if (hasAnyRemovedLineItems) {
4629                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.INITIAL));
4630                return;
4631            }
4632        } catch (error) {
4633            axiosErrorHandlerOrderSubmit(error);
4634            return;
4635        }
4636        var _selectedStore_id;
4637        const { success, error, response } = await (0,handlers/* createOrderSubmitHandlers */.xZ)().submitOrder({
4638            tipReceived: 0,
4639            storeId: (_selectedStore_id = selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id) !== null && _selectedStore_id !== void 0 ? _selectedStore_id : cart.storeId,
4640            voucherCode: (recipientData === null || recipientData === void 0 ? void 0 : recipientData.voucherCode) || "",
4641            customerEmail: (recipientData === null || recipientData === void 0 ? void 0 : recipientData.email) || ""
4642        });
4643        if (success) {
4644            dispatch((0,orderSubmit_slice/* setOrderSubmitResponse */.VN)(response));
4645            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.SUCCESS));
4646            push("/checkout/confirmation");
4647        } else {
4648            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
4649                error: error,
4650                dispatch,
4651                useResolvedMessages: true
4652            });
4653        }
4654    };
4655    const checkInventory = async ()=>{
4656        var _response_data_removedLineItems, _response_data;
4657        const { response, error } = await (0,withAsync/* withAsync */.j)(()=>(0,getCartItemApi/* getCart */.d)({
4658                checkInventory: true
4659            }));
4660        if (error) {
4661            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
4662            throw error;
4663        }
4664        const hasAnyRemovedLineItems = !!(response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : (_response_data_removedLineItems = _response_data.removedLineItems) === null || _response_data_removedLineItems === void 0 ? void 0 : _response_data_removedLineItems.length);
4665        if (hasAnyRemovedLineItems) {
4666            dispatch((0,store_cartSlice/* setCartFromApiResponse */.Ds)(response.data));
4667        }
4668        return hasAnyRemovedLineItems;
4669    };
4670    /**
4671   * Conditionally determines button click handler based on checkout context
4672   *
4673   * @description
4674   * Determines the appropriate button click handler for the footer action button:
4675   * - If on payment step AND no recipient data exists: uses corporate gift order submission
4676   * - Otherwise: uses the default action handler for the current checkout step
4677   *
4678   * This allows the payment step button to handle corporate gifting orders differently
4679   * from standard payment processing when a voucher code is present.
4680   *
4681   * @returns Function to handle button click, either handleSubmitOrder or step-specific action
4682   */ const onButtonClick = currentStep === CheckoutProvider/* CheckoutSteps */.bN.payment && recipientData ? async ()=>{
4683        await handleSubmitOrder();
4684    } : (_actions_currentStep2 = actions[currentStep]) === null || _actions_currentStep2 === void 0 ? void 0 : _actions_currentStep2.onButtonClick;
4685    var _actions_currentStep_dataTestId;
4686    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(Grid/* default */.ZP, {
4687        container: true,
4688        alignItems: "center",
4689        justifyContent: "space-between",
4690        sx: {
4691            my: 2
4692        },
4693        className: (FooterStepActions_module_default())["footer-step-actions"],
4694        children: [
4695            /*#__PURE__*/ (0,jsx_runtime.jsx)(Modal/* default */.Z, {
4696                open: (0,validation/* isAtLeastOneStringInArray */.gP)([
4697                    error.ERROR_CODES.WF_ORDER_001,
4698                    error.ERROR_CODES.WF_ORDER_025,
4699                    error.ERROR_CODES.WF_ORDER_026,
4700                    error.ERROR_CODES.WF_ORDER_027,
4701                    error.ERROR_CODES.WF_ORDER_028
4702                ], paymentErrorCodes),
4703                onClose: clearPaymentErrorCodes,
4704                "aria-labelledby": "modal-modal-title",
4705                "aria-describedby": "modal-modal-description",
4706                children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4707                    className: "modal-notify--container",
4708                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4709                        className: "modal-notify--overlay",
4710                        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
4711                            className: "modal-notify--content",
4712                            children: [
4713                                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
4714                                    className: "modal-notify--bis-form__title",
4715                                    children: [
4716                                        /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4717                                            children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
4718                                                className: (FooterStepActions_module_default())["footer-step-actions__heading-container"],
4719                                                children: [
4720                                                    /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
4721                                                        iconName: "error-icon",
4722                                                        className: (FooterStepActions_module_default())["footer-step-actions__error-icon-container"]
4723                                                    }),
4724                                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h4", {
4725                                                        children: contentTranslation === null || contentTranslation === void 0 ? void 0 : (_contentTranslation_paymentFailedModal = contentTranslation.paymentFailedModal) === null || _contentTranslation_paymentFailedModal === void 0 ? void 0 : _contentTranslation_paymentFailedModal.heading
4726                                                    })
4727                                                ]
4728                                            })
4729                                        }),
4730                                        /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, {
4731                                            "aria-label": "close",
4732                                            color: "inherit",
4733                                            onClick: clearPaymentErrorCodes,
4734                                            className: "modal-notify--bis-form__close",
4735                                            sx: {
4736                                                padding: 0
4737                                            },
4738                                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Close["default"], {})
4739                                        })
4740                                    ]
4741                                }),
4742                                /*#__PURE__*/ (0,jsx_runtime.jsx)("section", {
4743                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4744                                        className: "modal-notify--bis-form-wide",
4745                                        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("p", {
4746                                            children: [
4747                                                contentTranslation === null || contentTranslation === void 0 ? void 0 : (_contentTranslation_paymentFailedModal1 = contentTranslation.paymentFailedModal) === null || _contentTranslation_paymentFailedModal1 === void 0 ? void 0 : _contentTranslation_paymentFailedModal1.callToAction1,
4748                                                "\xa0",
4749                                                /*#__PURE__*/ (0,jsx_runtime.jsx)(Link_Link/* default */.Z, {
4750                                                    href: "/contact-us",
4751                                                    children: contentTranslation === null || contentTranslation === void 0 ? void 0 : (_contentTranslation_paymentFailedModal2 = contentTranslation.paymentFailedModal) === null || _contentTranslation_paymentFailedModal2 === void 0 ? void 0 : _contentTranslation_paymentFailedModal2.callToAction2
4752                                                }),
4753                                                "."
4754                                            ]
4755                                        })
4756                                    })
4757                                })
4758                            ]
4759                        })
4760                    })
4761                })
4762            }),
4763            !isMobileViewAndBackToCartText && /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
4764                item: true,
4765                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Link_Link/* default */.Z, {
4766                    underline: "none",
4767                    onClick: actions === null || actions === void 0 ? void 0 : (_actions_currentStep3 = actions[currentStep]) === null || _actions_currentStep3 === void 0 ? void 0 : _actions_currentStep3.onBackLinkClick,
4768                    component: "button",
4769                    disabled: (0,routing/* tempRouteIsDisabledForUSLoginAndSignup */.P)() && currentStep !== CheckoutProvider/* CheckoutSteps */.bN.payment,
4770                    children: [
4771                        /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
4772                            className: "red--text",
4773                            children: "< "
4774                        }),
4775                        /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
4776                            children: actions === null || actions === void 0 ? void 0 : (_actions_currentStep4 = actions[currentStep]) === null || _actions_currentStep4 === void 0 ? void 0 : _actions_currentStep4.backLinkText
4777                        })
4778                    ]
4779                })
4780            }),
4781            /*#__PURE__*/ (0,jsx_runtime.jsx)(FooterStepButton, {
4782                text: buttonText,
4783                onClick: onButtonClick,
4784                dataTestId: (_actions_currentStep_dataTestId = (_actions_currentStep5 = actions[currentStep]) === null || _actions_currentStep5 === void 0 ? void 0 : _actions_currentStep5.dataTestId) !== null && _actions_currentStep_dataTestId !== void 0 ? _actions_currentStep_dataTestId : "checkout-step-unknown"
4785            })
4786        ]
4787    });
4788};
4789
4790;// CONCATENATED MODULE: ./src/components/checkout/delivery/DeliveryContainer.tsx
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815const INITIAL_SELECTIONS_VISIBLE = 3;
4816const DeliveryContainer = ()=>{
4817    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
4818    const deliveryAddressInfo = (0,store_hooks/* useAppSelector */.C)(customerInfoSlice/* getAddresses */.ZK);
4819    const [availablePickUp] = (0,react.useState)(true);
4820    const cart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
4821    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
4822    const { resetAddressSelected, addressSelected, setAddressSelected, setIsAGift, setGiftMe
4822ssage } = (0,CheckoutProvider/* useCheckout */.Mg)();
4823    const { fetchWindows } = (0,useApiWindows/* useApiWindows */.n)();
4824    const { resetSelectedAvailableDateAndTime, setAvailableWindows } = (0,DeliveryProvider/* useDelivery */.qk)();
4825    const { selectedStore } = (0,DeliveryProvider/* useDelivery */.qk)();
4826    const { autoship, handleAutoship, showUIComponents } = (0,useCartSubscription/* useCartSubscription */.r)();
4827    const AutoshipTitle = ()=>/*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4828            className: (DeliveryContainer_module_default())["autoship-form-title"],
4829            children: "Autoship Subscription"
4830        });
4831    const AutoshipFormProps = {
4832        parent: "delivery",
4833        title: /*#__PURE__*/ (0,jsx_runtime.jsx)(AutoshipTitle, {}),
4834        description: "We are offering members a chance to try our new Autoship feature that allows you to set your entire order to be delivered on a regular shipping cadence.",
4835        label: "Set up this order as a recurring shipment using Autoship",
4836        autoship: autoship,
4837        handleAutoship: handleAutoship,
4838        showUIComponents
4839    };
4840    const { zipcode } = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* ZipCodeSelector */.pz);
4841    const { cartFulfillmentTypeHandler } = (0,useCartFulfillmentType/* useCartFulfillmentType */.c)();
4842    const { isMember } = (0,useCustomer/* useCustomer */.O)();
4843    const { isDeliveryHandlingFeeEnabled } = (0,hooks/* useEnvironmentFlags */.R6)();
4844    const refreshCartAfterFulfillmentChange = (0,react.useCallback)(async ()=>{
4845        dispatch((0,store_cartSlice/* setFulfillmentFetching */.KJ)(true));
4846        await dispatch((0,store_cartSlice/* getCartItems */.fq)({
4847            checkInventory: false
4848        }));
4849        dispatch((0,store_cartSlice/* setFulfillmentFetching */.KJ)(false));
4850    }, [
4851        dispatch
4852    ]);
4853    /**
4854   * Accordion `onActiveItemChange`. The guard below only skips redundant *side effects*
4855   * (reset windows, pickup fulfillment) when the user clicks the tab that already matches
4856   * `addressSelected` — it must NOT block `setSelectedDeliveryMethod`, or Redux can stay
4857   * on PickUp while the user clicks Delivery (e.g. `ADDRESS_SELECTED_FOR_DELIVERY` + Local).
4858   */ const auxiliaryOnChange = (0,react.useCallback)(async (val)=>{
4859        dispatch((0,store_cartSlice/* setSelectedDeliveryMethod */.iC)(val));
4860        if (!(val === store_cartSlice/* DeliveryMethods */.tI.Local && addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_DELIVERY) && !(val === store_cartSlice/* DeliveryMethods */.tI.PickUp && addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_PICKUP)) {
4861            if (val === store_cartSlice/* DeliveryMethods */.tI.PickUp && (selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id)) {
4862                // if PickUp accordion is selected and a store has already been selected, then we modify addressSelected state tracker accordingly and call fetchWindows
4863                setAddressSelected(CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_PICKUP);
4864                await cartFulfillmentTypeHandler({
4865                    fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.PICKUP,
4866                    storeId: selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id
4867                });
4868                await refreshCartAfterFulfillmentChange();
4869                fetchWindows({
4870                    storeId: (selectedStore === null || selectedStore === void 0 ? void 0 : selectedStore.id) + ""
4871                });
4872            } else if (val === store_cartSlice/* DeliveryMethods */.tI.Local) {
4873                try {
4874                    if (zipcode) {
4875                        const { store: zipStore } = await dispatch((0,zipcodeSlice/* submitZipcodeThunk */.dA)(zipcode)).unwrap();
4876                        const deliveryStoreId = (zipStore === null || zipStore === void 0 ? void 0 : zipStore.id) ? String(zipStore.id) : undefined;
4877                        await cartFulfillmentTypeHandler({
4878                            fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.DELIVERY,
4879                            ...deliveryStoreId && {
4880                                storeId: deliveryStoreId
4881                            },
4882                            zipcode
4883                        });
4884                    } else {
4885                        await cartFulfillmentTypeHandler({
4886                            fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.DELIVERY
4887                        });
4888                    }
4889                } catch (e) {
4890                    await cartFulfillmentTypeHandler({
4891                        fulfillmentType: api_cart/* CART_FULFILLMENT */.AP.DELIVERY,
4892                        ...zipcode && {
4893                            zipcode
4894                        }
4895                    });
4896                }
4897                await refreshCartAfterFulfillmentChange();
4898                resetAddressSelected();
4899            } else {
4900                resetAddressSelected(); // otherwise, we reset addressSelected state tracker every time the accordion item changes
4901            }
4902            setAvailableWindows([]);
4903            resetSelectedAvailableDateAndTime([]);
4904            setIsAGift(false);
4905            setGiftMessage("");
4906            (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.DELIVERY_WINDOW, JSON.stringify(defaultDeliveryWindowState), storage.STORAGE_TYPES.SESSION);
4907        }
4908    }, [
4909        dispatch,
4910        resetAddressSelected,
4911        resetSelectedAvailableDateAndTime,
4912        setAvailableWindows,
4913        addressSelected,
4914        selectedStore,
4915        setAddressSelected,
4916        cartFulfillmentTypeHandler,
4917        fetchWindows,
4918        refreshCartAfterFulfillmentChange,
4919        setIsAGift,
4920        setGiftMessage,
4921        zipcode
4922    ]);
4923    const { deliveryAvailability, pickUpAvailability } = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* shippingAvailabilitySelector */.Do);
4924    const { isOrderMinimumUnmet } = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* orderMinimumSelector */.Id);
4925    const showDeliveryOrderMinimumUnmet = deliveryAvailability && !isDeliveryHandlingFeeEnabled && isOrderMinimumUnmet;
4926    const disableDelivery = !deliveryAvailability || showDeliveryOrderMinimumUnmet;
4927    const deliveryAndPickupBothAvailable = deliveryAvailability && pickUpAvailability;
4928    const suggestPickUp = !isDeliveryHandlingFeeEnabled && isOrderMinimumUnmet;
4929    let initialActiveItem;
4930    if (deliveryAndPickupBothAvailable) {
4931        initialActiveItem = suggestPickUp ? store_cartSlice/* DeliveryMethods */.tI.PickUp : cart === null || cart === void 0 ? void 0 : cart.selectedDeliveryMethod;
4932    } else if (disableDelivery) {
4933        initialActiveItem = store_cartSlice/* DeliveryMethods */.tI.PickUp;
4934    } else {
4935        initialActiveItem = cart === null || cart === void 0 ? void 0 : cart.selectedDeliveryMethod;
4936    }
4937    if (isKioskVisitor) {
4938        return /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Accordion */.UQ, {
4939            initialActiveItem: store_cartSlice/* DeliveryMethods */.tI.Local,
4940            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryAccordionItem, {
4941                disableDelivery: false,
4942                showDeliveryOrderMinimumUnmet: showDeliveryOrderMinimumUnmet,
4943                showUIComponents: showUIComponents,
4944                isMember: false,
4945                cart: cart,
4946                deliveryAddressInfo: deliveryAddressInfo,
4947                AutoshipFormProps: AutoshipFormProps
4948            })
4949        });
4950    }
4951    return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
4952        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
4953            className: (DeliveryContainer_module_default()).delivery,
4954            children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(ui/* Accordion */.UQ, {
4955                initialActiveItem: initialActiveItem,
4956                onActiveItemChange: auxiliaryOnChange,
4957                children: [
4958                    pickUpAvailability && /*#__PURE__*/ (0,jsx_runtime.jsx)(AccordionItem/* AccordionItem */.Q, {
4959                        disabled: !pickUpAvailability,
4960                        header: /*#__PURE__*/ (0,jsx_runtime.jsx)(PickUpHeader, {}),
4961                        content: availablePickUp === true ? /*#__PURE__*/ (0,jsx_runtime.jsx)(PickUpContent, {}) : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {}),
4962                        value: store_cartSlice/* DeliveryMethods */.tI.PickUp,
4963                        theme: "black",
4964                        className: (DeliveryContainer_module_default())["pickup-content-background"]
4965                    }),
4966                    /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryAccordionItem, {
4967                        disableDelivery: disableDelivery,
4968                        showDeliveryOrderMinimumUnmet: showDeliveryOrderMinimumUnmet,
4969                        showUIComponents: showUIComponents,
4970                        isMember: isMember,
4971                        cart: cart,
4972                        deliveryAddressInfo: deliveryAddressInfo,
4973                        AutoshipFormProps: AutoshipFormProps
4974                    })
4975                ]
4976            }, initialActiveItem)
4977        })
4978    });
4979};
4980
4981// EXTERNAL MODULE: ./src/components/checkout/Footer.module.scss
4982var Footer_module = __webpack_require__(641719);
4983var Footer_module_default = /*#__PURE__*/__webpack_require__.n(Footer_module);
4984// EXTERNAL MODULE: ./src/components/checkout/FooterPolicyTerms.tsx + 1 modules
4985var FooterPolicyTerms = __webpack_require__(643118);
4986;// CONCATENATED MODULE: ./src/components/checkout/Footer.tsx
4987
4988
4989
4990
4991
4992
4993
4994
4995const FOOTER_DEFAULT_CONTENT_TRANSLATION = {
4996    paymentProcessingMessage: "Processing, please wait"
4997};
4998const Footer = (param)=>{
4999    let { contentTranslation } = param;
5000    const { currentStep } = (0,CheckoutProvider/* useCheckout */.Mg)();
5001    const isPaymentProcessing = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* isPaymentProcessingSelector */.J1);
5002    const isMobileViewFromQueryParamOrCookie = (0,store_hooks/* useAppSelector */.C)(uiStateSlice/* isMobileViewFromQueryParamOrCookieSelector */.$k);
5003    const showFooterPolicyTerm = currentStep === CheckoutProvider/* CheckoutSteps */.bN.payment && !isMobileViewFromQueryParamOrCookie;
5004    var _contentTranslation_paymentProcessingMessage;
5005    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5006        className: "".concat((Footer_module_default()).footer, " main__footer st-current"),
5007        children: [
5008            isPaymentProcessing && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5009                className: (Footer_module_default())["footer__processing-message"],
5010                children: [
5011                    /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
5012                        className: (Footer_module_default())["footer__processing-message--blink"],
5013                        children: "..."
5014                    }),
5015                    /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
5016                        children: (_contentTranslation_paymentProcessingMessage = contentTranslation === null || contentTranslation === void 0 ? void 0 : contentTranslation.paymentProcessingMessage) !== null && _contentTranslation_paymentProcessingMessage !== void 0 ? _contentTranslation_paymentProcessingMessage : FOOTER_DEFAULT_CONTENT_TRANSLATION.paymentProcessingMessage
5017                    })
5018                ]
5019            }),
5020            /*#__PURE__*/ (0,jsx_runtime.jsx)(FooterStepActions, {}),
5021            showFooterPolicyTerm && /*#__PURE__*/ (0,jsx_runtime.jsx)(FooterPolicyTerms/* FooterPolicyTerms */.e, {})
5022        ]
5023    });
5024};
5025
5026// EXTERNAL MODULE: ./src/components/checkout/Header.tsx + 1 modules
5027var Header = __webpack_require__(610600);
5028// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/page-sections/cart/CartSummary/DeliveryHandlingFees.js
5029var DeliveryHandlingFees = __webpack_require__(60218);
5030// EXTERNAL MODULE: ./src/components/checkout/hooks/useCheckoutAudienceFlags.ts
5031var useCheckoutAudienceFlags = __webpack_require__(730759);
5032// EXTERNAL MODULE: ./src/lib/utils/currency.ts
5033var currency = __webpack_require__(444685);
5034// EXTERNAL MODULE: ./src/components/checkout/orderSummary/miniOrderSummary/MiniOrderSummary.module.scss
5035var MiniOrderSummary_module = __webpack_require__(946069);
5036var MiniOrderSummary_module_default = /*#__PURE__*/__webpack_require__.n(MiniOrderSummary_module);
5037// EXTERNAL MODULE: ./src/components/checkout/orderSummary/OrderSummary.tsx + 4 modules
5038var OrderSummary = __webpack_require__(417986);
5039// EXTERNAL MODULE: ./src/components/checkout/orderSummary/useOrderSummary.ts
5040var useOrderSummary = __webpack_require__(891184);
5041;// CONCATENATED MODULE: ./src/components/checkout/orderSummary/miniOrderSummary/MiniOrderSummary.tsx
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056const MiniOrderSummary = ()=>{
5057    const [showToggle, setShowToggle] = (0,react.useState)(false);
5058    const { currentStep, totalPrice } = (0,useOrderSummary/* useOrderSummary */.Y)();
5059    const cart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
5060    const { onlyMembershipItemInTheCart, isKioskVisitor, isDeliveryContextApplicable } = (0,useCheckoutAudienceFlags/* useCheckoutAudienceFlags */.M)(currentStep);
5061    const isPickup = (0,fulfillmentUtils/* isPickupFulfillmentType */._W)(cart === null || cart === void 0 ? void 0 : cart.fulfillmentType);
5062    const showHandlingFeeBanner = !onlyMembershipItemInTheCart && !isKioskVisitor && isDeliveryContextApplicable && !isPickup;
5063    const changeToggle = ()=>{
5064        setShowToggle(!showToggle);
5065    };
5066    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
5067        children: [
5068            showHandlingFeeBanner && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5069                className: (MiniOrderSummary_module_default())["handling-fee-banner"],
5070                children: /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryHandlingFees["default"], {
5071                    shippingEligibility: cart === null || cart === void 0 ? void 0 : cart.shippingEligibility
5072                })
5073            }),
5074            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5075                className: "".concat((MiniOrderSummary_module_default())["order-summary-toggle"], "  ").concat(showToggle ? (MiniOrderSummary_module_default())["order-summary-toggle-active"] : ""),
5076                onClick: changeToggle,
5077                children: [
5078                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5079                        className: (MiniOrderSummary_module_default())["order-summary-toggle-text"],
5080                        children: [
5081                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
5082                                children: [
5083                                    showToggle ? "".concat((0,utils_locale.t)("checkout.order_summary.hide")) : "".concat((0,utils_locale.t)("checkout.order_summary.show")),
5084                                    " ",
5085                                    (0,utils_locale.t)("checkout.order_summary.order_summary")
5086                                ]
5087                            }),
5088                            /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
5089                                iconName: showToggle ? "arrow-up" : "arrow-down"
5090                            })
5091                        ]
5092                    }),
5093                    /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
5094                        className: (MiniOrderSummary_module_default())["order-summary-toggle-price"],
5095                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5096                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
5097                                className: (MiniOrderSummary_module_default())["order-summary-section-footer-price"],
5098                                children: utils/* currency.format */.Aq.format((0,currency.convertToDollar)(totalPrice))
5099                            })
5100                        })
5101                    })
5102                ]
5103            }),
5104            showToggle && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5105                className: (MiniOrderSummary_module_default())["order-summary-mobile"],
5106                children: /*#__PURE__*/ (0,jsx_runtime.jsx)(OrderSummary/* default */.Z, {})
5107            })
5108        ]
5109    });
5110};
5111/* harmony default export */ var miniOrderSummary_MiniOrderSummary = (MiniOrderSummary);
5112
5113// EXTERNAL MODULE: ./src/components/checkout/payment/MembershipTermsConsent.tsx
5114var MembershipTermsConsent = __webpack_require__(556986);
5115// EXTERNAL MODULE: ./src/lib/constants/stateMgmt.ts
5116var stateMgmt = __webpack_require__(1788);
5117// EXTERNAL MODULE: ./src/lib/types/checkout.ts
5118var types_checkout = __webpack_require__(365605);
5119// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentBillingAddress.module.scss
5120var PaymentBillingAddress_module = __webpack_require__(32691);
5121var PaymentBillingAddress_module_default = /*#__PURE__*/__webpack_require__.n(PaymentBillingAddress_module);
5122// EXTERNAL MODULE: ./src/components/ui/accordion/Accordion.tsx
5123var Accordion = __webpack_require__(471691);
5124;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentBillingAddress.tsx
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140const AccordionContent = ()=>{
5141    return /*#__PURE__*/ (0,jsx_runtime.jsx)(AddressForm, {
5142        formType: constants_common/* USER_CONTACT_FORM_TYPE */.Hh.BILLING
5143    });
5144};
5145function PaymentBillingAddress() {
5146    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
5147    const { addressSelected } = (0,CheckoutProvider/* useCheckout */.Mg)();
5148    const onActiveItemChange = (activeItem)=>{
5149        dispatch((0,store_cartSlice/* setBillingAddressOption */.ov)(activeItem));
5150    };
5151    const { showBillingAddressForms } = (0,CheckoutProvider/* useCheckout */.Mg)();
5152    const fulfillmentType = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.fulfillmentType);
5153    const status = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.status);
5154    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
5155    const isPickup = (0,fulfillmentUtils/* isPickupFulfillmentType */._W)(fulfillmentType);
5156    const onlyMembershipItemInTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* onlyMembershipItemInTheCartSelector */.AA);
5157    const showOnlyBillingAddressForm = (0,react.useMemo)(()=>{
5158        return isKioskVisitor || addressSelected === CheckoutProvider/* ADDRESS_SELECTED */.JS.ADDRESS_SELECTED_FOR_PICKUP || isPickup || !!onlyMembershipItemInTheCart;
5159    }, [
5160        addressSelected,
5161        isKioskVisitor,
5162        isPickup,
5163        onlyMembershipItemInTheCart
5164    ]);
5165    return /*#__PURE__*/ (0,jsx_runtime.jsx)("section", {
5166        className: (PaymentBillingAddress_module_default())["billing-address"],
5167        children: showBillingAddressForms && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
5168            children: [
5169                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5170                    className: "section__header",
5171                    children: [
5172                        /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
5173                            className: "section__title__summary",
5174                            children: (0,utils_locale.t)("checkout.billing_address.title")
5175                        }),
5176                        /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
5177                            className: "section__text",
5178                            children: (0,utils_locale.t)("checkout.billing_address.subtitle")
5179                        })
5180                    ]
5181                }),
5182                showOnlyBillingAddressForm && /*#__PURE__*/ (0,jsx_runtime.jsx)(AccordionContent, {}),
5183                status !== stateMgmt/* ThunkStatus */.h.Idle && !showOnlyBillingAddressForm && /*#__PURE__*/ (0,jsx_runtime.jsxs)(Accordion/* Accordion */.UQ, {
5184                    initialActiveItem: types_checkout/* BillingAddressOptions */.o.sameAsShippingAddress,
5185                    onActiveItemChange: onActiveItemChange,
5186                    children: [
5187                        /*#__PURE__*/ (0,jsx_runtime.jsx)(AccordionItem/* AccordionItem */.Q, {
5188                            header: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5189                                className: (PaymentBillingAddress_module_default())["billing-address-options"],
5190                                children: (0,utils_locale.t)("checkout.billing_address.same_as_shipping")
5191                            }),
5192                            value: types_checkout/* BillingAddressOptions */.o.sameAsShippingAddress
5193                        }),
5194                        /*#__PURE__*/ (0,jsx_runtime.jsx)(AccordionItem/* AccordionItem */.Q, {
5195                            header: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5196                                className: (PaymentBillingAddress_module_default())["billing-address-options"],
5197                                children: (0,utils_locale.t)("checkout.billing_address.add_billing_address")
5198                            }),
5199                            content: /*#__PURE__*/ (0,jsx_runtime.jsx)(AccordionContent, {}),
5200                            value: types_checkout/* BillingAddressOptions */.o.differentAddress
5201                        })
5202                    ]
5203                })
5204            ]
5205        })
5206    });
5207}
5208
5209// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentContainer.module.scss
5210var PaymentContainer_module = __webpack_require__(718769);
5211var PaymentContainer_module_default = /*#__PURE__*/__webpack_require__.n(PaymentContainer_module);
5212// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentDiscount.module.scss
5213var PaymentDiscount_module = __webpack_require__(461021);
5214var PaymentDiscount_module_default = /*#__PURE__*/__webpack_require__.n(PaymentDiscount_module);
5215// EXTERNAL MODULE: ./node_modules/@fortawesome/free-solid-svg-icons/index.mjs
5216var free_solid_svg_icons = __webpack_require__(259417);
5217// EXTERNAL MODULE: ./node_modules/@fortawesome/react-fontawesome/index.es.js + 1 modules
5218var index_es = __webpack_require__(799603);
5219// EXTERNAL MODULE: ./node_modules/@mui/material/Chip/Chip.js
5220var Chip = __webpack_require__(58308);
5221// EXTERNAL MODULE: ./node_modules/@mui/material/CircularProgress/CircularProgress.js
5222var CircularProgress = __webpack_require__(466489);
5223// EXTERNAL MODULE: ./node_modules/@mui/material/Stack/Stack.js
5224var Stack = __webpack_require__(26447);
5225// EXTERNAL MODULE: ./src/lib/checkoutErrors/messages.ts
5226var messages = __webpack_require__(955154);
5227// EXTERNAL MODULE: ./src/components/checkout/forms/payment-discount-form/PaymentDiscountCodeForm.module.scss
5228var PaymentDiscountCodeForm_module = __webpack_require__(933093);
5229var PaymentDiscountCodeForm_module_default = /*#__PURE__*/__webpack_require__.n(PaymentDiscountCodeForm_module);
5230;// CONCATENATED MODULE: ./src/components/checkout/forms/payment-discount-form/PaymentDiscountForm.tsx
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249const PAYMENT_DISCOUNT_FORM = "payment-discount-form";
5250const PAYMENT_DISCOUNT_FORM_CHIP = "".concat(PAYMENT_DISCOUNT_FORM, "/chip");
5251const PAYMENT_DISCOUNT_FORM_TEXT_FIELD = "".concat(PAYMENT_DISCOUNT_FORM, "/text-field");
5252const PAYMENT_DISCOUNT_FORM_APPLY_BUTTON = "".concat(PAYMENT_DISCOUNT_FORM, "/apply-button");
5253const PAYMENT_DISCOUNT_FORM_CLOSE_ICON = "CloseIcon";
5254/**
5255 * Only WF_CART_030 needs the backend's own text (a minimum-spend amount FE
5256 * can't store statically). WF_CART_032/033 are also in discount.ts's
5257 * ERR_CODES_WITH_DISPLAY_MESSAGE_FROM_RESPONSE (kept for the other two
5258 * checkouts, which still show raw backend text), but here they deliberately
5259 * resolve from messages.ts's table instead - their approved copy is fixed,
5260 * not backend-filled.
5261 */ const CODES_WITH_DYNAMIC_MESSAGE = [
5262    "WF_CART_030"
5263];
5264const PaymentDiscountForm = ()=>{
5265    var _appliedDiscount_error, _appliedDiscount_error1;
5266    const [couponFieldValue, setCouponFieldValue] = (0,react.useState)("");
5267    const [isLoading, setIsLoading] = (0,react.useState)(false);
5268    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
5269    const appliedDiscount = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.discount);
5270    const errorCodeTranslation = {
5271        WF_CART_008: (0,utils_locale.t)("checkout.payment.tax_calculation_error_message"),
5272        WF_CART_009: (0,utils_locale.t)("checkout.payment.payment_discount_error_message"),
5273        WF_CART_010: (0,utils_locale.t)("checkout.payment.generic_cart_error"),
5274        WF_CART_029: (0,utils_locale.t)("checkout.payment.payment_discount_no_longer_valid_error_message"),
5275        WF_CART_031: (0,utils_locale.t)("checkout.payment.payment_discount_not_valid_on_this_order_error_message")
5276    };
5277    const couponCodeIsValid = (0,FormValidator/* couponCodeFieldValidator */.Er)(couponFieldValue);
5278    // Blocks on `code` as well, so an error that renders can't leave APPLY live.
5279    const couponCodeCanBeApplied = couponFieldValue && couponCodeIsValid && !(appliedDiscount === null || appliedDiscount === void 0 ? void 0 : (_appliedDiscount_error = appliedDiscount.error) === null || _appliedDiscount_error === void 0 ? void 0 : _appliedDiscount_error.code) && !(appliedDiscount === null || appliedDiscount === void 0 ? void 0 : (_appliedDiscount_error1 = appliedDiscount.error) === null || _appliedDiscount_error1 === void 0 ? void 0 : _appliedDiscount_error1.message); // note: user must remove any applied discount before applying a different discount code
5280    // Gated on `code`, not `message` - table lookup doesn't need a backend message.
5281    const discountError = appliedDiscount === null || appliedDiscount === void 0 ? void 0 : appliedDiscount.error;
5282    const discountErrorMessage = !(discountError === null || discountError === void 0 ? void 0 : discountError.code) ? "" : CODES_WITH_DYNAMIC_MESSAGE.includes(discountError.code) ? discountError.message || messages/* FALLBACK_MESSAGE */.yM : (0,resolveCheckoutError/* resolveCheckoutError */.h)({
5283        response: {
5284            data: {
5285                errors: [
5286                    discountError
5287                ]
5288            }
5289        }
5290    }).message;
5291    const onSubmit = async ()=>{
5292        setIsLoading(true);
5293        await dispatch((0,store_cartSlice/* applyDiscountCode */.iY)({
5294            discountCode: couponFieldValue,
5295            errorCodeTranslation
5296        }));
5297        setIsLoading(false);
5298    };
5299    const handleDelete = async ()=>{
5300        setIsLoading(true);
5301        setCouponFieldValue("");
5302        await dispatch((0,store_cartSlice/* removeDiscountCode */.vK)({
5303            discountCode: appliedDiscount === null || appliedDiscount === void 0 ? void 0 : appliedDiscount.code,
5304            errorCodeTranslation
5305        }));
5306        setIsLoading(false);
5307    };
5308    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5309        className: (PaymentDiscountCodeForm_module_default())["payment-discount-form"],
5310        children: [
5311            /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Form, {
5312                onSubmit: onSubmit,
5313                render: (param)=>{
5314                    let { handleSubmit } = param;
5315                    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("form", {
5316                        onSubmit: handleSubmit,
5317                        className: (PaymentDiscountCodeForm_module_default()).form,
5318                        "data-testid": PAYMENT_DISCOUNT_FORM,
5319                        children: [
5320                            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5321                                className: "".concat((PaymentDiscountCodeForm_module_default())["discount-input-container"]),
5322                                children: [
5323                                    /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Field, {
5324                                        name: "discountCode",
5325                                        render: (param)=>{
5326                                            let { input } = param;
5327                                            return /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* TextField */.nv, {
5328                                                ...input,
5329                                                className: (PaymentDiscountCodeForm_module_default())["discount-input"],
5330                                                label: (0,utils_locale.t)("checkout.payment.payment_discount"),
5331                                                size: "30",
5332                                                maxLength: "30",
5333                                                disabled: false,
5334                                                validate: couponCodeIsValid,
5335                                                value: couponFieldValue,
5336                                                onChange: (e)=>{
5337                                                    dispatch((0,store_cartSlice/* resetDiscountCode */.Lg)());
5338                                                    setCouponFieldValue(e.target.value);
5339                                                },
5340                                                "data-testid": PAYMENT_DISCOUNT_FORM_TEXT_FIELD,
5341                                                placeholder: (0,utils_locale.t)("checkout.payment.place_holders.discount_code")
5342                                            });
5343                                        }
5344                                    }),
5345                                    /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
5346                                        type: "submit",
5347                                        disabled: !couponCodeCanBeApplied,
5348                                        className: (PaymentDiscountCodeForm_module_default())["apply-button"],
5349                                        children: isLoading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(CircularProgress/* default */.Z, {
5350                                            size: "1.1em",
5351                                            color: "inherit"
5352                                        }) : (0,utils_locale.t)("checkout.payment.apply")
5353                                    })
5354                                ]
5355                            }),
5356                            (appliedDiscount === null || appliedDiscount === void 0 ? void 0 : appliedDiscount.code) && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5357                                children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Stack/* default */.Z, {
5358                                    direction: "row",
5359                                    spacing: 1,
5360                                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Chip/* default */.Z, {
5361                                        label: appliedDiscount === null || appliedDiscount === void 0 ? void 0 : appliedDiscount.code,
5362                                        onDelete: handleDelete,
5363                                        variant: "filled",
5364                                        deleteIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(Close["default"], {
5365                                            style: {
5366                                                color: "red"
5367                                            }
5368                                        }),
5369                                        style: {
5370                                            borderRadius: 0,
5371                                            color: "green"
5372                                        },
5373                                        icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(index_es/* FontAwesomeIcon */.G, {
5374                                            style: {
5375                                                color: "green"
5376                                            },
5377                                            className: "fa-rotate-90",
5378                                            icon: free_solid_svg_icons/* faTags */.tho,
5379                                            size: "1x",
5380                                            "data-testid": PAYMENT_DISCOUNT_FORM_CHIP
5381                                        })
5382                                    })
5383                                })
5384                            })
5385                        ]
5386                    });
5387                }
5388            }),
5389            discountErrorMessage && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
5390                className: (PaymentDiscountCodeForm_module_default()).discount__error,
5391                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("p", {
5392                    className: (PaymentDiscountCodeForm_module_default()).discount__error_message,
5393                    children: [
5394                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
5395                            iconName: "warning-vector",
5396                            className: (PaymentDiscountCodeForm_module_default()).discount__error_img
5397                        }),
5398                        discountErrorMessage
5399                    ]
5400                })
5401            })
5402        ]
5403    });
5404};
5405
5406;// CONCATENATED MODULE: ./src/components/checkout/forms/payment-discount-form/index.ts
5407
5408
5409;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentDiscount.tsx
5410
5411
5412
5413const PaymentDiscount = (param)=>{
5414    let { className = "", desktopOnly = false, mobileOnly = false } = param;
5415    const defaultClassName = mobileOnly ? (PaymentDiscount_module_default())["mobile-only"] : desktopOnly ? (PaymentDiscount_module_default())["desktop-only"] : "";
5416    return /*#__PURE__*/ (0,jsx_runtime.jsx)("section", {
5417        className: "".concat((PaymentDiscount_module_default()).discount__container, " ").concat(defaultClassName, " ").concat(className),
5418        children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentDiscountForm, {})
5419    });
5420};
5421
5422// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentDriverTip.module.scss
5423var PaymentDriverTip_module = __webpack_require__(109137);
5424var PaymentDriverTip_module_default = /*#__PURE__*/__webpack_require__.n(PaymentDriverTip_module);
5425;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentDriverTip.tsx
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435const TIP_OPTIONS = [
5436    0,
5437    5,
5438    7,
5439    10
5440];
5441const MAX_DRIVER_TIP_AMOUNT = 99.99;
5442const TIP_EXCEEDED_WARNING = (0,utils_locale.t1)("checkout.payment.custom_tip_error_msg", "{{max_driver_tip_amount}}", MAX_DRIVER_TIP_AMOUNT);
5443function PaymentDriverTip(param) {
5444    let { driverTipRef } = param;
5445    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
5446    const tipReceived = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.tipReceived);
5447    const isDriverTipApplicable = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectIsDriverTipApplicable */.nj);
5448    const paymentAuth = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.paymentAuth);
5449    const initialDriverTip = (0,currency.convertToDollar)(tipReceived !== null && tipReceived !== void 0 ? tipReceived : 0);
5450    const [tip, setTip] = (0,react.useState)(initialDriverTip);
5451    const [isCustomTip, setIsCustomTip] = (0,react.useState)(!TIP_OPTIONS.includes(tip !== null && tip !== void 0 ? tip : 0));
5452    var _tip_toString;
5453    const [customTip, setCustomTip] = (0,react.useState)((_tip_toString = tip === null || tip === void 0 ? void 0 : tip.toString()) !== null && _tip_toString !== void 0 ? _tip_toString : "");
5454    const [showTip, setShowTip] = (0,react.useState)(tip !== null && tip !== void 0 ? tip : 0);
5455    const isTipLimitExceeded = +customTip > MAX_DRIVER_TIP_AMOUNT;
5456    const isTipApplied = tip !== null && tip !== void 0 ? tip : 0 > 0;
5457    (0,react.useEffect)(()=>{
5458        const newTip = tip ? (0,currency.convertToCents)(tip) : 0;
5459        dispatch((0,store_cartSlice/* setDriverTip */.NY)(newTip));
5460        driverTipRef.current = newTip;
5461    }, [
5462        dispatch,
5463        tip,
5464        driverTipRef
5465    ]);
5466    const handleTip = (isCustom, tipAmount)=>{
5467        setIsCustomTip(isCustom);
5468        setTip(tipAmount);
5469        if (!tipAmount) {
5470            setCustomTip("-1");
5471        }
5472    };
5473    const applyCustomTip = ()=>{
5474        const floatCustomTip = parseFloat(customTip.replace(",", "."));
5475        if (isNaN(floatCustomTip)) return null;
5476        setTip(formatTip(floatCustomTip));
5477        setShowTip(floatCustomTip);
5478        if (TIP_OPTIONS.includes(floatCustomTip)) {
5479            setIsCustomTip(false);
5480        }
5481    };
5482    if (!isDriverTipApplicable) return null;
5483    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("form", {
5484        className: (PaymentDriverTip_module_default())["payment-driver-tip"],
5485        onSubmit: (e)=>e.preventDefault(),
5486        children: [
5487            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5488                className: "section__header",
5489                children: [
5490                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
5491                        className: "section__title__summary",
5492                        children: (0,utils_locale.t)("checkout.payment.tip_to_driver")
5493                    }),
5494                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
5495                        className: "section__text",
5496                        children: (0,utils_locale.t)("checkout.payment.tip_to_driver_info")
5497                    })
5498                ]
5499            }),
5500            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5501                className: "section__content checkout-tip__content",
5502                children: [
5503                    /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
5504                        type: "text",
5505                        name: "paymentAuth",
5506                        id: "paymentauth",
5507                        autoComplete: "off",
5508                        className: (PaymentDriverTip_module_default())["payment-auth"],
5509                        value: paymentAuth,
5510                        onChange: (e)=>
5510dispatch((0,store_cartSlice/* setPaymentAuth */.Gr)(e.target.value)),
5511                        tabIndex: -1
5512                    }),
5513                    TIP_OPTIONS.map((option)=>/*#__PURE__*/ (0,jsx_runtime.jsx)(TipButton, {
5514                            value: option,
5515                            selectedTip: tip,
5516                            onClick: handleTip
5517                        }, option)),
5518                    /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
5519                        type: "button",
5520                        value: "custom",
5521                        className: "checkout-tip__button ".concat(isCustomTip ? "selected" : ""),
5522                        onClick: ()=>handleTip(true, null),
5523                        children: (0,utils_locale.t)("checkout.payment.custom_tip")
5524                    }),
5525                    " "
5526                ]
5527            }),
5528            isCustomTip && (!isTipApplied ? /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5529                children: [
5530                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5531                        className: "checkout-tip__custom",
5532                        children: [
5533                            /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
5534                                type: "number",
5535                                placeholder: (0,utils_locale.t)("checkout.payment.tip_to_driver_place_holder"),
5536                                min: 1,
5537                                max: 99.99,
5538                                step: "1",
5539                                value: parseFloat(customTip) > -1 ? customTip : "",
5540                                className: "checkout-tip__custom-input ".concat(isTipLimitExceeded ? (PaymentDriverTip_module_default()).field_error : (PaymentDriverTip_module_default()).field_default),
5541                                onChange: (e)=>{
5542                                    return setCustomTip(e.target.value);
5543                                }
5544                            }),
5545                            /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
5546                                type: "button",
5547                                value: "",
5548                                disabled: parseFloat(customTip) < 0 || isNaN(parseFloat(customTip.replace(",", "."))) || isTipLimitExceeded,
5549                                className: "btn checkout-tip__custom-submit",
5550                                onClick: ()=>applyCustomTip(),
5551                                children: (0,utils_locale.t)("checkout.payment.apply")
5552                            })
5553                        ]
5554                    }),
5555                    isTipLimitExceeded && /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
5556                        className: (PaymentDriverTip_module_default()).error,
5557                        children: TIP_EXCEEDED_WARNING
5558                    })
5559                ]
5560            }) : /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5561                className: "checkout-tip__custom-choice",
5562                children: [
5563                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
5564                        className: "checkout-tip__current",
5565                        children: [
5566                            (0,utils_locale.t)("checkout.payment.your_tip"),
5567                            " ",
5568                            utils/* currency.format */.Aq.format(showTip || 0)
5569                        ]
5570                    }),
5571                    /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
5572                        type: "button",
5573                        className: "btn checkout-tip__custom-submit",
5574                        onClick: ()=>handleTip(true, null),
5575                        children: (0,utils_locale.t)("checkout.payment.change")
5576                    })
5577                ]
5578            }))
5579        ]
5580    });
5581}
5582const TipButton = (param)=>{
5583    let { value, selectedTip, onClick } = param;
5584    return /*#__PURE__*/ (0,jsx_runtime.jsx)(buttons_button/* Button */.z, {
5585        type: "button",
5586        value: value.toString(),
5587        className: "checkout-tip__button ".concat(selectedTip === value ? "selected" : ""),
5588        onClick: ()=>onClick(false, value),
5589        children: utils/* currency.format */.Aq.format(value, {
5590            minimumFractionDigits: 0,
5591            maximumFractionDigits: 0
5592        })
5593    });
5594};
5595const formatTip = function() {
5596    let tip = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
5597    return tip - Math.floor(tip) !== 0 ? parseFloat(tip === null || tip === void 0 ? void 0 : tip.toFixed(2)) : tip;
5598};
5599
5600// EXTERNAL MODULE: ./src/lib/hooks/useEbtSnapStoreEligibility.ts
5601var useEbtSnapStoreEligibility = __webpack_require__(175818);
5602// EXTERNAL MODULE: ./node_modules/@adyen/adyen-web/dist/es/adyen.css
5603var adyen = __webpack_require__(201640);
5604// EXTERNAL MODULE: ./node_modules/@adyen/adyen-web/dist/es/components/PayPal/Pay
5604pal.js + 10 modules
5605var Paypal = __webpack_require__(291011);
5606// EXTERNAL MODULE: ./node_modules/@adyen/adyen-web/dist/es/components/ApplePay/ApplePay.js + 9 modules
5607var ApplePay = __webpack_require__(364071);
5608// EXTERNAL MODULE: ./src/lib/adyen/index.ts
5609var lib_adyen = __webpack_require__(942092);
5610// EXTERNAL MODULE: ./src/lib/adyen/adyenCleanupUtils.ts
5611var adyenCleanupUtils = __webpack_require__(650458);
5612// EXTERNAL MODULE: ./src/lib/adyen/fastlaneUtils.ts
5613var fastlaneUtils = __webpack_require__(18524);
5614// EXTERNAL MODULE: ./src/lib/hooks/useAdyenGiftCardReInit.ts
5615var useAdyenGiftCardReInit = __webpack_require__(464624);
5616// EXTERNAL MODULE: ./src/lib/utils/cardPaymentUtils.ts + 1 modules
5617var cardPaymentUtils = __webpack_require__(54917);
5618// EXTERNAL MODULE: ./src/lib/utils/localeTransformer.ts
5619var localeTransformer = __webpack_require__(243116);
5620// EXTERNAL MODULE: ./src/components/checkout/payment/adyen/CardForm/CardPaymentForm.module.scss
5621var CardPaymentForm_module = __webpack_require__(513041);
5622var CardPaymentForm_module_default = /*#__PURE__*/__webpack_require__.n(CardPaymentForm_module);
5623// EXTERNAL MODULE: ./src/components/checkout/payment/paymentMethodConstants.ts
5624var paymentMethodConstants = __webpack_require__(543467);
5625;// CONCATENATED MODULE: ./src/components/checkout/payment/adyen/CardForm/CardPaymentForm.tsx
5626// @ts-nocheck
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666const CC_PLACEHOLDERS = {
5667    CARD_NUMBER: "1234 5678 9012 3456",
5668    EXPIRY_DATE: "MM/YY",
5669    SECURITY_CODE_THREE_DIGITS: "3 digits",
5670    HOLDER_NAME: "J. Smith"
5671};
5672var PAYPAL_FUNDING_SOURCE;
5673(function(PAYPAL_FUNDING_SOURCE) {
5674    PAYPAL_FUNDING_SOURCE[PAYPAL_FUNDING_SOURCE["PAYPAL"] = paymentMethodConstants/* PAYMENT_METHODS */.LM.PAYPAL] = "PAYPAL";
5675    PAYPAL_FUNDING_SOURCE[PAYPAL_FUNDING_SOURCE["VENMO"] = paymentMethodConstants/* PAYMENT_METHODS */.LM.VENMO] = "VENMO";
5676    PAYPAL_FUNDING_SOURCE[PAYPAL_FUNDING_SOURCE["GOOGLE_PAY"] = paymentMethodConstants/* PAYMENT_METHODS */.LM.GOOGLE_PAY] = "GOOGLE_PAY";
5677})(PAYPAL_FUNDING_SOURCE || (PAYPAL_FUNDING_SOURCE = {}));
5678const isGooglePayEnabled = environment.nextAppEnv.googlePay.isEnabled === "enabled";
5679function filterPaymentMethods(paymentMethods, isLocked, isCartEmpty) {
5680    const allowed = [
5681        paymentMethodConstants/* PAYMENT_METHODS */.LM.SCHEME,
5682        paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE,
5683        ...isLocked || isCartEmpty ? [] : [
5684            paymentMethodConstants/* PAYMENT_METHODS */.LM.PAYPAL,
5685            paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY,
5686            paymentMethodConstants/* PAYMENT_METHODS */.LM.GOOGLE_PAY
5687        ]
5688    ];
5689    return paymentMethods.filter((m)=>allowed.includes(m.type));
5690}
5691function CardPaymentForm(param) {
5692    let { driverTipRef } = param;
5693    var _payment_config, _cart_storeLocation;
5694    // React and external libraries/hooks
5695    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
5696    const { push } = (0,next_router.useRouter)();
5697    const navigate = (0,next_router.useRouter)();
5698    const paypalFundingSource = (0,react.useRef)(""); // Useful for PayPal-specific logic
5699    const paymentContainer = (0,react.useRef)(null);
5700    const checkoutFormRef = (0,react.useRef)(null); // Store checkout form for cleanup
5701    const isMountedRef = (0,react.useRef)(true); // Track if component is mounted
5702    const redirectTimeoutRef = (0,react.useRef)(null); // Track redirect timeout
5703    // Context and providers/hooks
5704    const { setShowBillingAddressForms, membershipAgreementChecked, isAGift, giftMessage } = (0,CheckoutProvider/* useCheckout */.Mg)();
5705    const currentLocale = locale.CURRENT_LOCALE; // Constants related to locale
5706    const { getUserFastlaneConfig, removeUserFastlaneConfig } = (0,useFastlane/* useFastlane */.Pf)(); // Fastlane hooks
5707    // Redux state selectors
5708    const cart = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart);
5709    const { ebtPaymentAmount, isLocked } = (0,store_hooks/* useAppSelector */.C)(foragePaymentSlice/* selectForagePayment */.fE);
5710    const payment = (0,store_hooks/* useAppSelector */.C)((state)=>state.payment);
5711    const driverTip = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectDriverTip */.dv);
5712    const { customerInfo } = (0,useCustomer/* useCustomer */.O)();
5713    const { isWebViewVisitor } = (0,store_hooks/* useAppSelector */.C)((state)=>state.environment);
5714    const onlyMembershipItemInTheCart = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* onlyMembershipItemInTheCartSelector */.AA);
5715    const isMembershipItemInCart = !!(0,store_hooks/* useAppSelector */.C)(store_cartSlice/* membershipLineItemInTheCartSelector */.fg);
5716    const paymentMethodsResponse = payment === null || payment === void 0 ? void 0 : (_payment_config = payment.config) === null || _payment_config === void 0 ? void 0 : _payment_config.paymentMethodsResponse;
5717    // Extracted variables for convenience
5718    const { discountAmount, cartId } = cart;
5719    const { languageCode, currency, countryShort } = currentLocale;
5720    const amount = cart === null || cart === void 0 ? void 0 : cart.totalAmount;
5721    const prevDiscount = (0,useMemoize/* usePreviousWF */.D)(discountAmount);
5722    const isLoggedInUser = (0,useCustomer/* useCustomer */.O)().isLoggedIn;
5723    // Gift card ReInit hook - handles cleanup and ReInit when gift card state changes
5724    // This ensures Apple Pay/Google Pay/PayPal always display the correct remaining amount
5725    const { giftCardState, paymentMethodAmount, cleanupAdyen: cleanupAdyenInstances, dropinRef, pendingReInitRef } = (0,useAdyenGiftCardReInit/* useAdyenGiftCardReInit */.n)({
5726        adyenFormInstance: payment.adyenFormInstance,
5727        paymentContainerRef: paymentContainer
5728    });
5729    const isMobileViewFromQueryParamOrCookie = (0,store_hooks/* useAppSelector */.C)(uiStateSlice/* isMobileViewFromQueryParamOrCookieSelector */.$k);
5730    // Derived variables
5731    const membershipAgreementNotChecked = locale.isUSLocale && isMembershipItemInCart && !membershipAgreementChecked;
5732    const handleRemovePaymentMethod = async (storedPaymentMethodId)=>{
5733        try {
5734            const response = await (0,checkoutApi/* postRemovePaymentMethodsAPI */.FR)({
5735                recurringDetailReference: storedPaymentMethodId
5736            }).then((res)=>{
5737                return res;
5738            });
5739            if (response) {
5740                return true;
5741            }
5742        } catch (error) {
5743            return false;
5744        }
5745        return false;
5746    };
5747    (0,react.useEffect)(()=>{
5748        // Inject CSS to hide required fields message
5749        const head = document.head || document.getElementsByTagName("head")[0];
5750        const style = document.createElement("style");
5751        style.type = "text/css";
5752        style.appendChild(document.createTextNode("\n      .adyen-checkout__label__text-required-notice {\n        display: none !important;\n      }\n    "));
5753        head.appendChild(style);
5754        const country = languageCode === null || languageCode === void 0 ? void 0 : languageCode.substring(3, 5);
5755        const language = languageCode === null || languageCode === void 0 ? void 0 : languageCode.substring(0, 2);
5756        // Use paymentMethodAmount for the API call so Google Pay/Apple Pay
5757        // receive the correct amount (remaining after gift card is applied)
5758        const amountForPaymentMethods = paymentMethodAmount > 0 ? paymentMethodAmount : amount;
5759        if (amountForPaymentMethods > 0) {
5760            dispatch((0,paymentSlice/* saveCurrentLocale */.Ru)((0,localeTransformer/* localeTransformer */.w)(languageCode)));
5761            dispatch((0,paymentSlice/* getPaymentMethods */.Q8)(currency, country, amountForPaymentMethods, language));
5762        }
5763        return ()=>{
5764            //  dispatch(getClearPaymentSession()); //NOTE: Commenting as totalAmount updates this will run and when unmount current payment session gets empty but we dont want that to be empty
5765            style.remove(); // Clean up the style when component unmounts
5766        };
5767    }, [
5768        dispatch,
5769        amount,
5770        paymentMethodAmount,
5771        giftCardState,
5772        languageCode,
5773        currency,
5774        cartId
5775    ]);
5776    const createCheckout = (0,react.useCallback)(async ()=>{
5777        // Shared by both failure branches below so a fix can't miss one of them.
5778        const handleOrderSubmitFailure = (data, dropin, logMessage, customLoggerHeading)=>{
5779            Logger_default().error(logMessage, data.orderstate);
5780            dropin.update({});
5781            dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
5782            events/* default */.Z.emit(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED);
5783            var _data_orderstate;
5784            // An order body carries no `errors` array, so this always resolves to the
5785            // generic sentence, which is the intended copy for an unusable response.
5786            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
5787                error: data,
5788                dispatch,
5789                useResolvedMessages: true,
5790                customLogger: {
5791                    heading: customLoggerHeading,
5792                    details: (_data_orderstate = data.orderstate) !== null && _data_orderstate !== void 0 ? _data_orderstate : ""
5793                }
5794            });
5795        };
5796        const handleConfirmedResponse = (data, dropin)=>{
5797            if (!data) return; // Early exit to reduce nesting if `data` is undefined
5798            // Dispatch necessary actions
5799            dispatch((0,orderSubmit_slice/* setOrderSubmitResponse */.VN)(data));
5800            dispatch((0,paymentSlice/* saveIsValidPaymentMethod */.dU)(false));
5801            // Handle order confirmation logic if an order number exists
5802            const { orderNumber, deliveryWindow } = data;
5803            if (orderNumber) {
5804                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.SUCCESS));
5805                // Save delivery window and gift details in session storage
5806                (0,browserStorage/* setItem */.LS)(storage.STORAGE_KEYS.DELIVERY_WINDOW, JSON.stringify({
5807                    ...deliveryWindow,
5808                    isAGift,
5809                    giftMessage
5810                }), storage.STORAGE_TYPES.SESSION);
5811                // Clean up Fastlane config and refresh drop-in UI
5812                removeUserFastlaneConfig(); // Removes user Fastlane config after order success
5813                dropin.update();
5814                // Navigate to the order confirmation page
5815                push("/checkout/confirmation");
5816            } else {
5817                // The charge went through, so this follows the success path: the
5818                // confirmation page already covers a missing order number, and it keeps
5819                // the shopper off a form they could submit a second time.
5820                Logger_default().error("order/submit response missing orderNumber for a resolved orderstate", data.orderstate);
5821                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.SUCCESS));
5822                removeUserFastlaneConfig();
5823                dropin.update();
5824                push("/checkout/confirmation");
5825            }
5826        };
5827        const handleServerResponse = (res, dropin, actions)=>{
5828            // Handles order/submit response to validate if additional action is required or proceed to confirmation
5829            let hasAction = false;
5830            if (res.action) {
5831                const jsonAdyenResponseUnescaped = JSON.parse(res.action); //convert to JSON and unescape those escaped special characters like from \" to "
5832                if (jsonAdyenResponseUnescaped.action) {
5833                    // If first call to order/submit was successful and additional action is required
5834                    hasAction = true; // we mark additional action is required
5835                    //In adyen version 6, there's no longer a need to call dropin.handleAction, action.resolve this action internally
5836                    // dropin.handleAction(jsonAdyenResponseUnescaped.action); // triggers PayPal's payment window
5837                    actions.resolve({
5838                        action: jsonAdyenResponseUnescaped.action
5839                    });
5840                }
5841            }
5842            if (hasAction === false) {
5843                // if no additional action is required
5844                switch(res.orderstate // Validate the response of the order state
5845                ){
5846                    case "Complete":
5847                    case "Open":
5848                    case "Confirmed":
5849                        // resolve onSubmit/onAdditionalDetails event based on the backend API response
5850                        actions.resolve({
5851                            resultCode: res.orderstate
5852                        });
5853                        handleConfirmedResponse(res, dropin); // do final steps and proceed to order confirmation
5854                        break;
5855                    default:
5856                        // Treat it as a system error so the customer is told
5857                        //  something and can retry.
5858                        actions.reject();
5859                        handleOrderSubmitFailure(res, dropin, "Unrecognised orderstate from order/submit", "Unrecognised orderstate");
5860                        break;
5861                }
5862            }
5863        };
5864        const updateShippingAddressWithStoreInfo = async ()=>{
5865            try {
5866                var _cart_storeLocation;
5867                const storeAddress = cart === null || cart === void 0 ? void 0 : (_cart_storeLocation = cart.storeLocation) === null || _cart_storeLocation === void 0 ? void 0 : _cart_storeLocation.address;
5868                if (!storeAddress) {
5869                    throw new Error("Store address is not available");
5870                }
5871                var _storeAddress_address1, _storeAddress_address2, _storeAddress_city, _storeAddress_state, _storeAddress_postalCode, _storeAddress_phone, _storeAddress_country;
5872                // adds shipping address to satisfy BE Validation
5873                const addressInfo = {
5874                    firstName: customerInfo.firstName,
5875                    lastName: customerInfo.lastName,
5876                    address1: (_storeAddress_address1 = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.address1) !== null && _storeAddress_address1 !== void 0 ? _storeAddress_address1 : "",
5877                    address2: (_storeAddress_address2 = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.address2) !== null && _storeAddress_address2 !== void 0 ? _storeAddress_address2 : "",
5878                    city: (_storeAddress_city = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.city) !== null && _storeAddress_city !== void 0 ? _storeAddress_city : "",
5879                    state: (_storeAddress_state = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.state) !== null && _storeAddress_state !== void 0 ? _storeAddress_state : "",
5880                    postalCode: (_storeAddress_postalCode = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.postalCode) !== null && _storeAddress_postalCode !== void 0 ? _storeAddress_postalCode : "",
5881                    phone: (_storeAddress_phone = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.phone) !== null && _storeAddress_phone !== void 0 ? _storeAddress_phone : "",
5882                    country: (_storeAddress_country = storeAddress === null || storeAddress === void 0 ? void 0 : storeAddress.country) !== null && _storeAddress_country !== void 0 ? _storeAddress_country : ""
5883                };
5884                await dispatch((0,store_cartSlice/* addShippingAddress */.VE)({
5885                    data: addressInfo
5886                })).unwrap();
5887            } catch (error) {
5888                throw error;
5889            }
5890        };
5891        const handleSubmit = async (mode, state, dropin, actions)=>{
5892            // if it is CC submit
5893            if (mode === paymentMethodConstants/* PAYMENT_METHODS */.LM.SCHEME || mode === paymentMethodConstants/* PAYMENT_METHODS */.LM.GIFT_CARD) {
5894                dispatch((0,paymentSlice/* setAdyenActions */.YX)(actions));
5895                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.PAYMENT_SUBMITTED));
5896                dispatch((0,paymentSlice/* saveIsValidPaymentMethod */.dU)(false));
5897            } else if ([
5898                paymentMethodConstants/* PAYMENT_METHODS */.LM.PAYPAL,
5899                paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY,
5900                paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE,
5901                paymentMethodConstants/* PAYMENT_METHODS */.LM.GOOGLE_PAY
5902            ].includes(mode) && state.isValid) {
5903                // if it is Paypal or Apple Pay and has valid state.. submit
5904                try {
5905                    if (onlyMembershipItemInTheCart && mode !== paymentMethodConstants/* PAYMENT_METHODS */.LM.GOOGLE_PAY) {
5906                        // in this scenario, we first must update the shipping address to satisfy BE Validation
5907                        await updateShippingAddressWithStoreInfo();
5908                    }
5909                    dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)([])); // clear error code state prior to making a new call
5910                    await handleGiftCardPayment();
5911                    const { adyenOrderResponse } = (0,reduxCommon/* getReduxStore */.vI)().payment.giftCard || {};
5912                    var _cart_paymentAuth;
5913                    const submitOrderPayload = {
5914                        // makes first call to order/submit
5915                        paymentData: JSON.stringify({
5916                            ...state.data,
5917                            ...(adyenOrderResponse === null || adyenOrderResponse === void 0 ? void 0 : adyenOrderResponse.orderData) && {
5918                                order: adyenOrderResponse
5919                            }
5920                        }),
5921                        tipReceived: driverTipRef.current,
5922                        paymentAuth: (_cart_paymentAuth = cart === null || cart === void 0 ? void 0 : cart.paymentAuth) !== null && _cart_paymentAuth !== void 0 ? _cart_paymentAuth : "",
5923                        ebtPaymentAmount: !!ebtPaymentAmount && isLocked ? ebtPaymentAmount : undefined
5924                    };
5925                    submitOrderPayload["storeId"] = (0,browserStorage/* getItem */.rV)(storage.STORAGE_KEYS.CART_FULFILLMENT_STORE_ID, storage.STORAGE_TYPES.SESSION);
5926                    const submitOrderResponse = await (0,checkoutApi/* submitOrder */.pm)(submitOrderPayload);
5927                    handleServerResponse(submitOrderResponse.data, dropin, actions);
5928                } catch (error) {
5929                    var _error_response_data, _error_response;
5930                    // reject onSubmit event to stop the payment flow in case of any payment error
5931                    actions.reject();
5932                    dropin.update();
5933                    dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
5934                    dispatch((0,paymentSlice/* setPaymentErrorCodes */.uz)(error === null || error === void 0 ? void 0 : (_error_response = error.response) === null || _error_response === void 0 ? void 0 : (_error_response_data = _error_response.data) === null || _error_response_data === void 0 ? void 0 : _error_response_data.errors));
5935                    events/* default */.Z.emit(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED);
5936                    const { errorMessage } = (0,orderErrorHandler/* submitOrderErrorHandler */.w)({
5937                        error,
5938                        isMountedRef,
5939                        redirectTimeoutRef,
5940                        push
5941                    });
5942                    if (!errorMessage) {
5943                        return;
5944                    }
5945                    var _error_message;
5946                    (0,snackbarHandlers/* axiosErrorHandler */.ri)({
5947                        error,
5948                        dispatch,
5949                        useResolvedMessages: true,
5950                        fallbackSnackbar: {
5951                            heading: (0,utils_locale.t)("checkout.problems.order_submit_problem.title_error"),
5952                            message: errorMessage
5953                        },
5954                        customLogger: {
5955                            heading: "Payment submit error",
5956                            details: (_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : ""
5957                        }
5958                    });
5959                }
5960            }
5961        };
5962        const handleGiftCardPayment = async ()=>{
5963            const { giftCard } = (0,reduxCommon/* getReduxStore */.vI)().payment;
5964            const { state: giftCardState, encryptedData } = giftCard;
5965            if (giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT && encryptedData) {
5966                var _cart_paymentAuth;
5967                const submitOrderGCPayload = {
5968                    paymentData: JSON.stringify(encryptedData),
5969                    tipReceived: 0,
5970                    paymentAuth: (_cart_paymentAuth = cart.paymentAuth) !== null && _cart_paymentAuth !== void 0 ? _cart_paymentAuth : "",
5971                    ebtPaymentAmount: !!ebtPaymentAmount && isLocked ? ebtPaymentAmount : undefined
5972                };
5973                await (0,checkoutApi/* submitOrderGC */.FL)(submitOrderGCPayload);
5974            }
5975        };
5976        const handleSubmitAdditionalDetails = async (state, dropin, actions)=>{
5977            try {
5978                const additionalDetailsResponse = await (0,checkoutApi/* submitAdditionalDetails */.b6)({
5979                    paymentData: JSON.stringify(state.data),
5980                    tipReceived: driverTipRef.current
5981                });
5982                handleServerResponse(additionalDetailsResponse.data, dropin, actions);
5983            } catch (error) {
5984                // reject onAdditionalDetails event to stop the payment flow in case of any payment error
5985                actions.reject();
5986                dropin.update({});
5987                dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
5988                const { errorMessage } = (0,orderErrorHandler/* submitOrderErrorHandler */.w)({
5989                    error,
5990                    isMountedRef,
5991                    redirectTimeoutRef,
5992                    push
5993                });
5994                if (!errorMessage) {
5995                    return;
5996                }
5997                var _error_message;
5998                (0,snackbarHandlers/* axiosErrorHandler */.ri)({
5999                    error,
6000                    dispatch,
6001                    useResolvedMessages: true,
6002                    fallbackSnackbar: {
6003                        heading: (0,utils_locale.t)("checkout.problems.order_submit_problem.title_error"),
6004                        message: errorMessage
6005                    },
6006                    customLogger: {
6007                        heading: "Order submit error",
6008                        details: (_error_message = error === null || error === void 0 ? void 0 : error.message) !== null && _error_message !== void 0 ? _error_message : ""
6009                    }
6010                });
6011            }
6012        };
6013        // creates the payment Dropin
6014        const { config } = payment;
6015        const fastlaneConfigData = getUserFastlaneConfig();
6016        if (fastlaneConfigData === null) {
6017            console.warn("Fastlane data does not exist in storage.");
6018        }
6019        const country = languageCode === null || languageCode === void 0 ? void 0 : languageCode.substring(3, 5);
6020        // Create an instance of AdyenCheckout using the configuration object from store.
6021        if (!payment.adyenFormInstance || payment.adyenFormInstance === null) {
6022            var _config_paymentMethodsConfiguration, _fastlaneConfigData_fastlaneAuthData;
6023            // validates we haven't created a Dropin instance yet
6024            /*istanbul ignore next */ // Create a cleaned config without invalid properties
6025            const { paymentMethodsResponsePaypal, ...cleanedConfig } = config;
6026            // Create a modified paymentMethodsResponse that excludes Givex and any other unwanted methods
6027            const filteredPaymentMethods = filterPaymentMethods(config.paymentMethodsResponse.paymentMethods, isLocked, cart.lineItems.length === 0);
6028            // Define card configuration in one place
6029            const cardConfig = {
6030                ...(_config_paymentMethodsConfiguration = config.paymentMethodsConfiguration) === null || _config_paymentMethodsConfiguration === void 0 ? void 0 : _config_paymentMethodsConfiguration.card,
6031                name: (0,utils_locale.t)("checkout.payment.credit_card"),
6032                hasHolderName: true,
6033                holderNameRequired: true,
6034                showCvcForStoredCard: true,
6035                enableStoreDetails: isLoggedInUser,
6036                placeholders: {
6037                    cardNumber: CC_PLACEHOLDERS.CARD_NUMBER,
6038                    expiryDate: CC_PLACEHOLDERS.EXPIRY_DATE,
6039                    securityCodeThreeDigits: CC_PLACEHOLDERS.SECURITY_CODE_THREE_DIGITS,
6040                    holderName: CC_PLACEHOLDERS.HOLDER_NAME
6041                }
6042            };
6043            const fastlaneAuthStatus = fastlaneConfigData === null || fastlaneConfigData === void 0 ? void 0 : (_fastlaneConfigData_fastlaneAuthData = fastlaneConfigData.fastlaneAuthData) === null || _fastlaneConfigData_fastlaneAuthData === void 0 ? void 0 : _fastlaneConfigData_fastlaneAuthData.authenticationState;
6044            // Configure payment methods according to Adyen documentation
6045            const paymentMethodsConfig = {
6046                ...config.paymentMethodsConfiguration,
6047                ...config.paymentMethodsConfiguration.givex && {
6048                    givex: {
6049                        disabled: true
6050                    }
6051                }
6052            };
6053            if (isGooglePayEnabled) {
6054                const googlePayConfig = (0,lib_adyen/* getGooglePayConfig */.RF)(config, paymentMethodAmount, currency, countryShort, isGooglePayEnabled);
6055                paymentMethodsConfig.googlepay = googlePayConfig;
6056            }
6057            // Configure payment methods based on Fastlane authentication status
6058            if (fastlaneAuthStatus === useFastlane/* FastlaneAuthStatus */.RW.SUCCEEDED) {
6059                paymentMethodsConfig.card = cardConfig;
6060                paymentMethodsConfig.fastlane = (0,lib_adyen/* getFastlaneConfig */.Tx)(fastlaneConfigData, paymentMethodAmount, currency, country);
6061            } else if (fastlaneAuthStatus === useFastlane/* FastlaneAuthStatus */.RW.NOT_FOUND) {
6062                const fastlaneConfig = (0,lib_adyen/* getFastlaneConfig */.Tx)(fastlaneConfigData, paymentMethodAmount, currency, country);
6063                paymentMethodsConfig.card = {
6064                    ...cardConfig,
6065                    ...fastlaneConfig
6066                };
6067            } else {
6068                // Default case: standard card configuration (when no auth status yet or other status)
6069                paymentMethodsConfig.card = cardConfig;
6070            }
6071            const checkoutForm = await (0,lib_adyen/* initCheckout */.j0)({
6072                // instantiates and configures the Dropin
6073                ...cleanedConfig,
6074                // Set the global amount for payment methods (important for Google Pay)
6075                // This should be the remaining amount after gift card is applied
6076                amount: {
6077                    value: paymentMethodAmount,
6078                    currency: currency
6079                },
6080                // Use the filtered payment methods
6081                paymentMethodsResponse: {
6082                    ...config.paymentMethodsResponse,
6083                    paymentMethods: filteredPaymentMethods
6084                },
6085                allowPaymentMethods: filteredPaymentMethods.map((m)=>m.type),
6086                // Block Givex and any other unwanted payment methods
6087                paymentMethodsConfiguration: paymentMethodsConfig,
6088                // Payment method configurations (for Drop-in components)
6089                paypal: (0,lib_adyen/* getPayPalConfig */.dP)(config, paymentMethodAmount, currency, country),
6090                applepay: (0,lib_adyen/* getApplePayConfig */._4)(config, paymentMethodAmount, currency, country),
6091                isMobileView: isMobileViewFromQueryParamOrCookie,
6092                // instantPaymentTypes: [PAYMENT_METHODS.GOOGLE_PAY], //NOTE: To display the Google Pay payment button at the top of the list of available payment methods
6093                // Add beforeSubmit handler for Fastlane signup flow
6094                beforeSubmit: (0,fastlaneUtils/* createFastlaneBeforeSubmitHandler */.G)(()=>(0,reduxCommon/* getReduxStore */.vI)()),
6095                onSubmit: (state, dropin, actions)=>{
6096                    var _state_data;
6097                    const paymentMethod = ((_state_data = state.data) === null || _state_data === void 0 ? void 0 : _state_data.paymentMethod) || state.paymentMethod;
6098                    (0,trackingEvents/* GTMAddPaymentInfo */.Kw)((0,cardPaymentUtils/* formatPaymentMethod */.s)({
6099                        type: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.type,
6100                        brand: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.brand,
6101                        options: {
6102                            paypalFundingSource: paypalFundingSource.current
6103                        }
6104                    }));
6105                    // triggers automatically on Paypal button click
6106                    if (state.data) {
6107                        // paypal data object has a "data" attrib internally
6108                        handleSubmit(state.data.paymentMethod.type, state, dropin, actions);
6109                    } else {
6110                        handleSubmit(state.paymentMethod.type, state, dropin, actions);
6111                    }
6112                },
6113                onChange: (state)=>{
6114                    var _fastlaneConfigData_fastlaneAuthData, _state_data_paymentMethod, _state_data;
6115                    const fastlaneAuthStatus = fastlaneConfigData === null || fastlaneConfigData === void 0 ? void 0 : (_fastlaneConfigData_fastlaneAuthData = fastlaneConfigData.fastlaneAuthData) === null || _fastlaneConfigData_fastlaneAuthData === void 0 ? void 0 : _fastlaneConfigData_fastlaneAuthData.authenticationState;
6116                    let enhancedData = state.data;
6117                    // Enhance data for Fastlane NOT_FOUND users only
6118                    const shouldEnhance = (fastlaneAuthStatus === useFastlane/* FastlaneAuthStatus */.RW.NOT_FOUND || locale.isUSLocale) && ((_state_data = state.data) === null || _state_data === void 0 ? void 0 : (_state_data_paymentMethod = _state_data.paymentMethod) === null || _state_data_paymentMethod === void 0 ? void 0 : _state_data_paymentMethod.type) === paymentMethodConstants/* PAYMENT_METHODS */.LM.SCHEME && state.isValid === true;
6119                    if (shouldEnhance) {
6120                        var _cart_shippingAddress, _cart_billingAddress;
6121                        const { billingAddress } = cart;
6122                        const customerEmail = ((_cart_shippingAddress = cart.shippingAddress) === null || _cart_shippingAddress === void 0 ? void 0 : _cart_shippingAddress.email) || ((_cart_billingAddress = cart.billingAddress) === null || _cart_billingAddress === void 0 ? void 0 : _cart_billingAddress.email) || customerInfo.email;
6123                        const { paymentMethod } = state.data;
6124                        const merchantAccount = environment.nextAppEnv.adyen.accountName;
6125                        //Updated amount to be the remaining amount after gift card 
6125is applied so that it can be used in risk rules and for Apple Pay/Google Pay display
6126                        const value = paymentMethodAmount;
6127                        enhancedData = {
6128                            amount: {
6129                                value,
6130                                currency
6131                            },
6132                            ...cart.id && {
6133                                reference: cart.id
6134                            },
6135                            ...paymentMethod && {
6136                                paymentMethod
6137                            },
6138                            ...billingAddress && {
6139                                billingAddress: {
6140                                    city: billingAddress.city,
6141                                    country: billingAddress.country,
6142                                    houseNumberOrName: billingAddress.address2,
6143                                    postalCode: billingAddress.postalCode,
6144                                    stateOrProvince: billingAddress.state,
6145                                    street: billingAddress.address1
6146                                },
6147                                shopperName: {
6148                                    firstName: billingAddress.firstName,
6149                                    lastName: billingAddress.lastName
6150                                }
6151                            },
6152                            ...customerEmail && {
6153                                shopperEmail: customerEmail
6154                            },
6155                            returnUrl: "".concat(window.location.origin, "/checkout/confirmation/?orderRef="),
6156                            ...merchantAccount && {
6157                                merchantAccount
6158                            },
6159                            ...enhancedData
6160                        };
6161                    }
6162                    // Update store with enhanced or original data
6163                    if (state.isValid) {
6164                        dispatch((0,paymentSlice/* saveAdyenFormData */.By)(enhancedData));
6165                    }
6166                    dispatch((0,paymentSlice/* saveIsValidPaymentMethod */.dU)(state.isValid));
6167                },
6168                onAdditionalDetails: async (state, dropin, actions)=>{
6169                    // required for 2nd step of Paypal payment
6170                    try {
6171                        handleSubmitAdditionalDetails(state, dropin, actions);
6172                    } catch (error) {
6173                        dropin.update();
6174                    }
6175                },
6176                onError: (error, component)=>{
6177                    if (error.name === "CANCEL") return;
6178                    Logger_default().error("payment Dropin Error", error + "component: " + component);
6179                    const typedAFI = component;
6180                    if (typedAFI) typedAFI.update({});
6181                    dispatch((0,paymentSlice/* savePaymentState */.RV)(paymentSlice/* PaymentState */.Ky.ERROR));
6182                }
6183            });
6184            // Create an instance of Drop-in and mount it.
6185            if (checkoutForm && paymentContainer.current) {
6186                // Create Adyen-managed containers (outside React tree) for PayPal and Apple Pay
6187                // These use the createAdyenContainer utility which marks them as safe for direct DOM manipulation
6188                (0,adyenCleanupUtils/* createAdyenContainer */.nA)(adyenCleanupUtils/* ADYEN_CONTAINER_IDS */.J2.PAYPAL, true);
6189                (0,adyenCleanupUtils/* createAdyenContainer */.nA)(adyenCleanupUtils/* ADYEN_CONTAINER_IDS */.J2.APPLE_PAY, true);
6190                // Mount the existing PayPal implementation
6191                try {
6192                    // Use the imported PayPal component instead of requiring it again
6193                    new Paypal/* default */.Z(checkoutForm.checkout).mount("#".concat(adyenCleanupUtils/* ADYEN_CONTAINER_IDS */.J2.PAYPAL));
6194                } catch (error) {
6195                    console.error("Error mounting PayPal:", error);
6196                }
6197                // Create and mount the Apple Pay implementation
6198                try {
6199                    // Create and mount the Apple Pay component
6200                    console.info("Attempting to mount Apple Pay");
6201                    const applePay = new ApplePay/* default */.Z(checkoutForm.checkout, (0,lib_adyen/* getApplePayConfig */._4)(config, paymentMethodAmount, currency, country));
6202                    // Check availability and log result with more detailed debugging
6203                    console.info("Checking Apple Pay availability on this device/browser...");
6204                    // Add a timeout to ensure the check completes
6205                    const timeoutPromise = new Promise((_, reject)=>{
6206                        setTimeout(()=>reject(new Error("Apple Pay availability check timed out")), 5000);
6207                    });
6208                    Promise.race([
6209                        applePay.isAvailable(),
6210                        timeoutPromise
6211                    ]).then(()=>{
6212                        console.info("Apple Pay IS available - mounting component");
6213                        applePay.mount("#".concat(adyenCleanupUtils/* ADYEN_CONTAINER_IDS */.J2.APPLE_PAY));
6214                    }).catch((error)=>{
6215                        console.error("Apple Pay is NOT available - detailed error:", {
6216                            error,
6217                            browser: navigator.userAgent,
6218                            isHTTPS: window.location.protocol === "https:",
6219                            applePayConfig: (0,lib_adyen/* getApplePayConfig */._4)(config, paymentMethodAmount, currency, country),
6220                            paymentMethodsContainApplePay: filteredPaymentMethods.some((method
6220)=>method.type === paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY)
6221                        });
6222                    });
6223                } catch (error) {
6224                    console.error("Error creating Apple Pay instance:", error);
6225                }
6226                const dropin = checkoutForm.createDropin({
6227                    paymentMethodOrder: [
6228                        paymentMethodConstants/* PAYMENT_METHODS */.LM.SCHEME,
6229                        paymentMethodConstants/* PAYMENT_METHODS */.LM.PAYPAL,
6230                        paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY,
6231                        paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE,
6232                        paymentMethodConstants/* PAYMENT_METHODS */.LM.GOOGLE_PAY
6233                    ],
6234                    paymentMethodsConfiguration: paymentMethodsConfig,
6235                    showStoredPaymentMethods: true,
6236                    openFirstPaymentMethod: true,
6237                    openFirstStoredPaymentMethod: isLoggedInUser,
6238                    showRemovePaymentMethodButton: true,
6239                    showRadioButton: true,
6240                    onDisableStoredPaymentMethod: async (storedPaymentMethodId, resolve, reject)=>{
6241                        const res = await handleRemovePaymentMethod(storedPaymentMethodId);
6242                        if (res) {
6243                            resolve();
6244                        } else {
6245                            reject();
6246                        }
6247                    },
6248                    onReady: (dropin)=>{
6249                        // For Fastlane SUCCEEDED users, the Fastlane payment method is auto-selected
6250                        // but onSelect is not triggered for the default selection.
6251                        // Set isValidPaymentMethod to true so PAY NOW button is enabled,
6252                        // and store the Fastlane component for direct submission.
6253                        if (fastlaneAuthStatus === useFastlane/* FastlaneAuthStatus */.RW.SUCCEEDED) {
6254                            var _activeComponent_props, _activeComponent_props1;
6255                            dispatch((0,paymentSlice/* saveIsValidPaymentMethod */.dU)(true));
6256                            // Get the active payment method component from dropin
6257                            const activeComponent = dropin === null || dropin === void 0 ? void 0 : dropin.activePaymentMethod;
6258                            if ((activeComponent === null || activeComponent === void 0 ? void 0 : (_activeComponent_props = activeComponent.props) === null || _activeComponent_props === void 0 ? void 0 : _activeComponent_props.name) === "Cards" && (activeComponent === null || activeComponent === void 0 ? void 0 : (_activeComponent_props1 = activeComponent.props) === null || _activeComponent_props1 === void 0 ? void 0 : _activeComponent_props1.type) === paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE) {
6259                                dispatch((0,paymentSlice/* setFastlaneComponentInstance */.GF)(activeComponent));
6260                            }
6261                        }
6262                    },
6263                    onSelect: (component)=>{
6264                        var _component_props, _component_props1, _component_props2, _component_props3, _component_props4, _component_props5, _component_props6, _component_props7;
6265                        if (pendingReInitRef.current) {
6266                            // Auto-select fired by Adyen after a programmatic re-init.
6267                            // Do not collapse EBT — the user did not click a payment method.
6268                            pendingReInitRef.current = false;
6269                        } else if (!(0,reduxCommon/* getReduxStore */.vI)().foragePayment.isLocked) {
6270                            dispatch((0,foragePaymentSlice/* setIsExpanded */.Q7)(false));
6271                        }
6272                        const showBillingAddressFormsValue = !(component === null || component === void 0 ? void 0 : (_component_props = component.props) === null || _component_props === void 0 ? void 0 : _component_props.showPayButton) && (component === null || component === void 0 ? void 0 : (_component_props1 = component.props) === null || _component_props1 === void 0 ? void 0 : _component_props1.name) !== "PayPal";
6273                        setShowBillingAddressForms(showBillingAddressFormsValue);
6274                        // Clear Fastlane component when switching to a different payment method
6275                        // This ensures handlePayment uses dropin.submit() instead of fastlane.submit()
6276                        const isFastlaneComponent = (component === null || component === void 0 ? void 0 : (_component_props2 = component.props) === null || _component_props2 === void 0 ? void 0 : _component_props2.name) === "Cards" && (component === null || component === void 0 ? void 0 : (_component_props3 = component.props) === null || _component_props3 === void 0 ? void 0 : _component_props3.type) === paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE;
6277                        if (!isFastlaneComponent) {
6278                            dispatch((0,paymentSlice/* setFastlaneComponentInstance */.GF)(null));
6279                        }
6280                        //   If PayPal is selected, mount the PayPal component directly inside the payment method
6281                        if ((component === null || component === void 0 ? void 0 : (_component_props4 = component.props) === null || _component_props4 === void 0 ? void 0 : _component_props4.name) === "PayPal" && checkoutForm) {
6282                            try {
6283                                // Immediately hide any loader that might be shown
6284                                const paypalLoader = document.querySelector(".adyen-checkout__loading");
6285                                if (paypalLoader) {
6286                                    paypalLoader.style.display = "none";
6287                                }
6288                                // Find and properly expand the PayPal payment method immediately
6289                                const paypalMethod = document.querySelector(".adyen-checkout__payment-method--paypal");
6290                                if (paypalMethod) {
6291                                    // Add classes to expand the PayPal section
6292                                    paypalMethod.classList.add("adyen-checkout__payment-method--selected");
6293                                    paypalMethod.classList.add("adyen-checkout__payment-method--expanded");
6294                                    // Ensure the details wrapper is visible
6295                                    const detailsWrapper = paypalMethod.querySelector(".adyen-checkout-pm-details-wrapper");
6296                                    //dynamically checking if payment method applepay div has child with payment wrapper element and set display:block in order to collapse applepay method
6297                                    const paymentMethodsContainerApplePay = document.querySelector(".adyen-checkout__payment-method--applepay");
6298                                    if (paymentMethodsContainerApplePay) {
6299                                        paymentMethodsContainerApplePay.querySelector(".adyen-checkout-pm-details-wrapper").style.display = "none";
6300                                    }
6301                                    if (detailsWrapper) {
6302                                        detailsWrapper.style.display = "block";
6303                                        // Clear existing content if any
6304                                        detailsWrapper.innerHTML = "";
6305                                        // Create a container for PayPal buttons
6306                                        const paypalButtonsContainer = document.createElement("div");
6307                                        paypalButtonsContainer.id = "paypal-buttons-container";
6308                                        paypalButtonsContainer.style.padding = "8px 16px";
6309                                        detailsWrapper.appendChild(paypalButtonsContainer);
6310                                        // Use the shared PayPal configuration
6311                                        const paypalConfig = (0,lib_adyen/* getPayPalConfig */.dP)(config, paymentMethodAmount, currency, country, {
6312                                            fundingSource: "".concat((PAYPAL_FUNDING_SOURCE.PAYPAL, PAYPAL_FUNDING_SOURCE.VENMO)),
6313                                            onClick: (data)=>{
6314                                                if (data === null || data === void 0 ? void 0 : data.fundingSource) {
6315                                                    paypalFundingSource.current = data.fundingSource;
6316                                                }
6317                                            },
6318                                            onSubmit: (state, dropin, actions)=>{
6319                                                (0,trackingEvents/* GTMAddPaymentInfo */.Kw)((0,cardPaymentUtils/* formatPaymentMethod */.s)({
6320                                                    type: paymentMethodConstants/* PAYMENT_METHODS */.LM.PAYPAL,
6321                                                    options: {
6322                                                        paypalFundingSource: paypalFundingSource.current
6323                                                    }
6324                                                }));
6325                                                handleSubmit("paypal", state, dropin, actions);
6326                                            },
6327                                            // Add additional styling after buttons are rendered
6328                                            onComplete: ()=>{
6329                                                // Hide any loaders that might still be visible
6330                                                const loaders = document.querySelectorAll(".adyen-checkout__loading");
6331                                                loaders.forEach((loader)=>{
6332                                                    loader.style.display = "none";
6333                                                });
6334                                                // Target each button to add additional spacing
6335                                                const buttons = document.querySelectorAll("#paypal-buttons-container .paypal-button");
6336                                                if (buttons.length) {
6337                                                    buttons.forEach((button)=>{
6338                                                        if (button.style) {
6339                                                            button.style.marginBottom = "12px";
6340                                                        }
6341                                                    });
6342                                                }
6343                                            }
6344                                        });
6345                                        // Store reference to PayPal component to prevent unmounting
6346                                        let paypalComponent = component.paypalComponent;
6347                                        // Only create new component if one doesn't exist
6348                                        if (!paypalComponent) {
6349                                            paypalComponent = new Paypal/* default */.Z(checkoutForm.checkout, paypalConfig);
6350                                            component.paypalComponent = paypalComponent;
6351                                        }
6352                                        // Mount the component
6353                                        paypalComponent.mount(paypalButtonsContainer);
6354                                    }
6355                                }
6356                                // Remove any remaining setTimeout calls to avoid flicker
6357                                setTimeout(()=>{
6358                                    // Hide any loaders that might have appeared
6359                                    const loaders = document.querySelectorAll(".adyen-checkout__loading");
6360                                    loaders.forEach((loader)=>{
6361                                        loader.style.display = "none";
6362                                    });
6363                                }, 50);
6364                            } catch (error) {
6365                                console.error("Error mounting PayPal component:", error);
6366                            }
6367                        } else if ((component === null || component === void 0 ? void 0 : (_component_props5 = component.props) === null || _component_props5 === void 0 ? void 0 : _component_props5.name) === "Apple Pay" && checkoutForm) {
6368                            try {
6369                                console.info("Apple Pay selected, attempting to configure component");
6370                                // Immediately hide any loader that might be shown
6371                                const applePayLoader = document.querySelector(".adyen-checkout__loading");
6372                                if (applePayLoader) {
6373                                    applePayLoader.style.display = "none";
6374                                }
6375                                // Find and properly expand the Apple Pay payment method immediately
6376                                const applePayMethod = document.querySelector(".adyen-checkout__payment-method--applepay");
6377                                if (applePayMethod) {
6378                                    console.info("Found Apple Pay payment method element");
6379                                    // Add classes to expand the Apple Pay section
6380                                    applePayMethod.classList.add("adyen-checkout__payment-method--selected");
6381                                    applePayMethod.classList.add("adyen-checkout__payment-method--expanded");
6382                                    // Ensure the details wrapper is visible
6383                                    const detailsWrapper = applePayMethod.querySelector(".adyen-checkout-pm-details-wrapper");
6384                                    //dynamically checking if payment method paypal div has child with payment wrapper element and set display:block in order to collapse paypal method
6385                                    const paymentMethodsContainerPaypal = document.querySelector(".adyen-checkout__payment-method--paypal");
6386                                    if (paymentMethodsContainerPaypal) {
6387                                        paymentMethodsContainerPaypal.querySelector(".adyen-checkout-pm-details-wrapper").style.display = "none";
6388                                    }
6389                                    if (detailsWrapper) {
6390                                        detailsWrapper.style.display = "block";
6391                                        if (detailsWrapper.querySelector(".paypal-buttons-container")) {
6392                                            detailsWrapper.style.display = "none";
6393                                        }
6394                                        // Clear existing content if any
6395                                        detailsWrapper.innerHTML = "";
6396                                        // Create a container for Apple Pay button
6397                                        const applePayButtonContainer = document.createElement("div");
6398                                        applePayButtonContainer.id = "applepay-button-container";
6399                                        applePayButtonContainer.style.padding = "8px 16px";
6400                                        detailsWrapper.appendChild(applePayButtonContainer);
6401                                        // Create Apple Pay config
6402                                        const applePayConfig = (0,lib_adyen/* getApplePayConfig */._4)(config, paymentMethodAmount, currency, country, {
6403                                            onSubmit: (state, dropin, actions)=>{
6404                                                (0,trackingEvents/* GTMAddPaymentInfo */.Kw)((0,cardPaymentUtils/* formatPaymentMethod */.s)({
6405                                                    type: paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY
6406                                                }));
6407                                                handleSubmit(paymentMethodConstants/* PAYMENT_METHODS */.LM.APPLE_PAY, state, dropin, actions);
6408                                            }
6409                                        });
6410                                        // Create and mount Apple Pay component
6411                                        const applePayComponent = new ApplePay/* default */.Z(checkoutForm.checkout, applePayConfig);
6412                                        // Check if Apple Pay is available before mounting
6413                                        applePayComponent.isAvailable().then(()=>{
6414                                            console.info("Apple Pay isAvailable() returned true, mounting component");
6415                                            applePayComponent.mount(applePayButtonContainer);
6416                                        }).catch((error)=>{
6417                                            console.error("Apple Pay is not available:", error);
6418                                            // Show message that Apple Pay is not available
6419                                            const unavailableMessage = document.createElement("div");
6420                                            unavailableMessage.className = "apple-pay-unavailable";
6421                                            unavailableMessage.innerHTML = "Apple Pay is not available on this device/browser. Please make sure you have a card added to your Ap
6421ple Wallet and are using Safari.";
6422                                            unavailableMessage.style.padding = "16px";
6423                                            unavailableMessage.style.textAlign = "center";
6424                                            detailsWrapper.appendChild(unavailableMessage);
6425                                        });
6426                                    } else {
6427                                        console.error("Could not find Apple Pay details wrapper");
6428                                    }
6429                                } else {
6430                                    console.error("Could not find Apple Pay payment method element");
6431                                }
6432                                // Remove any remaining setTimeout calls to avoid flicker
6433                                setTimeout(()=>{
6434                                    // Hide any loaders that might have appeared
6435                                    const loaders = document.querySelectorAll(".adyen-checkout__loading");
6436                                    loaders.forEach((loader)=>{
6437                                        loader.style.display = "none";
6438                                    });
6439                                }, 50);
6440                            } catch (error) {
6441                                console.error("Error mounting Apple Pay component:", error);
6442                            }
6443                        } else if ((component === null || component === void 0 ? void 0 : (_component_props6 = component.props) === null || _component_props6 === void 0 ? void 0 : _component_props6.name) === "Cards" && (component === null || component === void 0 ? void 0 : (_component_props7 = component.props) === null || _component_props7 === void 0 ? void 0 : _component_props7.type) === paymentMethodConstants/* PAYMENT_METHODS */.LM.FASTLANE && checkoutForm) {
6444                            // For Fastlane, mark payment as valid and store the Fastlane component
6445                            // for direct submission in handlePayment
6446                            dispatch((0,paymentSlice/* saveIsValidPaymentMethod */.dU)(true));
6447                            dispatch((0,paymentSlice/* setFastlaneComponentInstance */.GF)(component));
6448                        } else {
6449                            // If any other payment method is selected, ensure PayPal and Apple Pay are collapsed
6450                            setTimeout(()=>{
6451                                // Find PayPal payment method element
6452                                const paypalMethod = document.querySelector(".adyen-checkout__payment-method--paypal");
6453                                if (paypalMethod) {
6454                                    // Remove any existing expanded/selected classes
6455                                    paypalMethod.classList.remove("adyen-checkout__payment-method--selected");
6456                                    paypalMethod.classList.remove("adyen-checkout__payment-method--expanded");
6457                                    // Find any open details container and hide it
6458                                    const detailsWrapper = paypalMethod.querySelector(".adyen-checkout-pm-details-wrapper");
6459                                    if (detailsWrapper) {
6460                                        detailsWrapper.style.display = "none";
6461                                    }
6462                                }
6463                                // Find Apple Pay payment method element
6464                                const applePayMethod = document.querySelector(".adyen-checkout__payment-method--applepay");
6465                                if (applePayMethod) {
6466                                    // Remove any existing expanded/selected classes
6467                                    applePayMethod.classList.remove("adyen-checkout__payment-method--selected");
6468                                    applePayMethod.classList.remove("adyen-checkout__payment-method--expanded");
6469                                    // Find any open details container and hide it
6470                                    const detailsWrapper = applePayMethod.querySelector(".adyen-checkout-pm-details-wrapper");
6471                                    if (detailsWrapper) {
6472                                        detailsWrapper.style.display = "none";
6473                                    }
6474                                }
6475                            }, 50);
6476                        }
6477                    }
6478                });
6479                dropin.mount(paymentContainer.current);
6480                dispatch((0,paymentSlice/* saveAdyenDropinInstance */.ct)(dropin));
6481                // Store references for proper cleanup
6482                dropinRef.current = dropin;
6483                checkoutFormRef.current = checkoutForm;
6484                // Always save the checkout form with dropin reference to Redux
6485                // This ensures the dropin can be submitted even when user switches from Fastlane to another payment method
6486                dispatch((0,paymentSlice/* saveAdyenFormInstance */.hm)({
6487                    ...checkoutForm,
6488                    dropinRef: dropin
6489                }));
6490            }
6491        }
6492    }, [
6493        payment,
6494        languageCode,
6495        dispatch,
6496        isAGift,
6497        giftMessage,
6498        push,
6499        cart === null || cart === void 0 ? void 0 : (_cart_storeLocation = cart.storeLocation) === null || _cart_storeLocation === void 0 ? void 0 : _cart_storeLocation.address,
6500        cart.paymentAuth,
6501        customerInfo.firstName,
6502        customerInfo.lastName,
6503        onlyMembershipItemInTheCart,
6504        driverTipRef,
6505        isLoggedInUser,
6506        amount,
6507        currency,
6508        setShowBillingAddressForms,
6509        paymentMethodsResponse,
6510        paymentMethodAmount,
6511        giftCardState,
6512        ebtPaymentAmount,
6513        isLocked
6514    ]);
6515    (0,react.useEffect)(()=>{
6516        var _paymentMethodsResponse_paymentMethods;
6517        const { config } = payment;
6518        if (!(paymentMethodsResponse === null || paymentMethodsResponse === void 0 ? void 0 : (_paymentMethodsResponse_paymentMethods = paymentMethodsResponse.paymentMethods) === null || _paymentMethodsResponse_paymentMethods === void 0 ? void 0 : _paymentMethodsResponse_paymentMethods.length) || !config.clientKey || !paymentContainer.current) {
6519            // initiateCheckout is not finished yet.
6520            return;
6521        }
6522        createCheckout();
6523    }, [
6524        dispatch,
6525        payment,
6526        navigate,
6527        paymentMethodsResponse,
6528        createCheckout
6529    ]);
6530    // Effect to detect discount changes and ReInitialize Adyen with the new amount
6531    (0,react.useEffect)(()=>{
6532        // Only act if:
6533        // 1. Not the first load (prevDiscount !== undefined)
6534        // 2. The discount actually changed
6535        // 3. There is an Adyen instance to ReInitialize
6536        if (prevDiscount !== undefined && prevDiscount !== discountAmount && payment.adyenFormInstance) {
6537            (0,paymentSlice/* setAdyenFormInstance */.Hv)(payment.adyenFormInstance);
6538        }
6539    }, [
6540        discountAmount,
6541        prevDiscount,
6542        payment,
6543        dispatch,
6544        driverTip,
6545        getUserFastlaneConfig,
6546        createCheckout
6547    ]);
6548    // Cleanup Adyen instances on route change
6549    (0,react.useEffect)(()=>{
6550        cleanupAdyenInstances();
6551        checkoutFormRef.current = null;
6552        dispatch((0,paymentSlice/* saveAdyenFormInstance */.hm)(null));
6553        dispatch((0,paymentSlice/* saveAdyenDropinInstance */.ct)(null));
6554    }, [
6555        navigate.asPath,
6556        dispatch,
6557        cleanupAdyenInstances
6558    ]);
6559    // Cleanup on component unmount
6560    (0,react.useEffect)(()=>{
6561        isMountedRef.current = true;
6562        return ()=>{
6563            isMountedRef.current = false;
6564            if (redirectTimeoutRef.current) {
6565                clearTimeout(redirectTimeoutRef.current);
6566            }
6567        };
6568    }, []);
6569    return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
6570        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6571            ref: paymentContainer,
6572            className: (0,classNames["default"])((CardPaymentForm_module_default())["content-box"], isWebViewVisitor && (CardPaymentForm_module_default())["content-box--webview-visitor"], membershipAgreementNotChecked && (CardPaymentForm_module_default())["content-box--membership-agreement-not-checked"], (CardPaymentForm_module_default())["paypal-wrapper"], (CardPaymentForm_module_default())["loader-overrides"], (CardPaymentForm_module_default())["checkbox-styling"]),
6573            "data-testid": "cardpaymentform-test-id"
6574        })
6575    });
6576}
6577
6578// EXTERNAL MODULE: ./node_modules/@adyen/adyen-web/dist/es/components/Giftcard/Giftcard.js + 6 modules
6579var Giftcard = __webpack_require__(304835);
6580// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/atoms/ButtonCartAddOrUpdate/LoadingIndicator.js
6581var LoadingIndicator = __webpack_require__(38708);
6582// EXTERNAL MODULE: ./src/api/paymentApi.ts
6583var paymentApi = __webpack_require__(677674);
6584// EXTERNAL MODULE: ./src/lib/types/payment.types.ts
6585var payment_types = __webpack_require__(108204);
6586// EXTERNAL MODULE: ./src/components/checkout/payment/adyen/GiftCardForm/giftcard.utils.ts
6587var giftcard_utils = __webpack_require__(981496);
6588// EXTERNAL MODULE: ./src/components/checkout/payment/adyen/GiftCardForm/GiftCardForm.module.scss
6589var GiftCardForm_module = __webpack_require__(759380);
6590var GiftCardForm_module_default = /*#__PURE__*/__webpack_require__.n(GiftCardForm_module);
6591;// CONCATENATED MODULE: ./src/components/checkout/payment/adyen/GiftCardForm/GiftCardErrorMessages.tsx
6592
6593
6594
6595const GiftCardErrorMessages = (param)=>{
6596    let { errorMessages, className } = param;
6597    if (!errorMessages.length) return null;
6598    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6599        className: (0,classNames["default"])((GiftCardForm_module_default())["error-messages"], className),
6600        children: errorMessages.length === 1 ? /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
6601            children: errorMessages[0]
6602        }) : /*#__PURE__*/ (0,jsx_runtime.jsx)("ul", {
6603            children: errorMessages.map((msg, index)=>/*#__PURE__*/ (0,jsx_runtime.jsx)("li", {
6604                    children: msg
6605                }, index))
6606        })
6607    });
6608};
6609
6610;// CONCATENATED MODULE: ./src/components/checkout/payment/adyen/GiftCardForm/GiftCardInfo.tsx
6611
6612
6613
6614
6615
6616const GiftCardInfo = (param)=>{
6617    let { appliedAmount, remainingBalance, remainingPaymentDue, onRemove } = param;
6618    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6619        className: (GiftCardForm_module_default())["gift-card-info"],
6620        children: [
6621            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6622                className: (GiftCardForm_module_default())["details-wrapper"],
6623                children: [
6624                    /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6625                        className: (GiftCardForm_module_default())["icon-number-wrapper"],
6626                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6627                            className: (GiftCardForm_module_default())["icon-wrapper"],
6628                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
6629                                iconName: "giftcard"
6630                            })
6631                        })
6632                    }),
6633                    /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
6634                        className: (GiftCardForm_module_default())["remove-button"],
6635                        onClick: onRemove,
6636                        children: "Remove"
6637                    })
6638                ]
6639            }),
6640            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6641                className: (GiftCardForm_module_default())["info-detail
6641s"],
6642                children: [
6643                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6644                        className: (GiftCardForm_module_default())["applied-amount"],
6645                        children: [
6646                            (0,currency.formatCentsAsDollars)(appliedAmount),
6647                            " applied"
6648                        ]
6649                    }),
6650                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6651                        className: (GiftCardForm_module_default())["remaining-balance"],
6652                        children: [
6653                            (0,currency.formatCentsAsDollars)(remainingBalance),
6654                            " remaining on gift card"
6655                        ]
6656                    })
6657                ]
6658            }),
6659            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6660                className: (GiftCardForm_module_default())["payment-due "],
6661                children: [
6662                    "Remaining payment due: \xa0",
6663                    /*#__PURE__*/ (0,jsx_runtime.jsx)("b", {
6664                        children: (0,currency.formatCentsAsDollars)(remainingPaymentDue)
6665                    })
6666                ]
6667            })
6668        ]
6669    });
6670};
6671
6672;// CONCATENATED MODULE: ./src/components/checkout/payment/adyen/GiftCardForm/GiftCardForm.tsx
6673// @ts-nocheck
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697const GIFT_CARD_NAME = "Gift Card";
6698const GIFT_CARD_BRAND = "givex";
6699const GiftCardForm = ()=>{
6700    const [errorMessages, setErrorMessages] = (0,react.useState)([]);
6701    const [loading, setLoading] = (0,react.useState)(false);
6702    const giftCardDivRef = (0,react.useRef)(null);
6703    const giftCardComponentRef = (0,react.useRef)(null);
6704    const checkoutRef = (0,react.useRef)(null);
6705    const isAdyenGiftFormSubmitted = (0,react.useRef)(false);
6706    const balanceRef = (0,react.useRef)(0);
6707    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
6708    const cart = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart);
6709    const authAmountWithTip = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* selectAuthAmountWithTipAdjustment */.eo);
6710    const isCartFetching = (0,store_hooks/* useAppSelector */.C)((state)=>state.cart.isCartFetching);
6711    const payment = (0,store_hooks/* useAppSelector */.C)((state)=>state.payment);
6712    const paymentMethodsResponse = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectPaymentMethods */.VS);
6713    const { remainingAmount, appliedAmount, remainingPaymentDue, checkedAuthAmount, state: giftCardState, showForm, isGiftCardApplied } = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectGiftCardDetails */.O4);
6714    const { config } = payment;
6715    const resetFormState = (0,react.useCallback)(()=>{
6716        dispatch((0,paymentSlice/* resetGiftCardDetails */.ws)());
6717        setErrorMessages([]);
6718        setLoading(false);
6719        // To avoid bounce effect when closing the form
6720        setTimeout(()=>{
6721            var _giftCardComponentRef_current;
6722            (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : _giftCardComponentRef_current.update({});
6723        }, 500);
6724    }, [
6725        dispatch
6726    ]);
6727    const handleCloseForm = ()=>{
6728        dispatch((0,paymentSlice/* setGiftCardShowForm */.Bd)(false));
6729        resetFormState();
6730    };
6731    const handleRemoveGiftCard = (0,react.useCallback)(async ()=>{
6732        // Reentrancy guard: ignore repeat clicks while a delete is in flight to
6733        // avoid duplicate DELETE calls before the loading state hides the button.
6734        if (loading) return;
6735        try {
6736            setLoading(true);
6737            await (0,paymentApi/* deletePaymentFromCart */.Y$)({
6738                paymentMethodType: payment_types/* DeletePaymentMethodType */.z.GIFT_CARD
6739            });
6740            resetFormState();
6741            isAdyenGiftFormSubmitted.current = false;
6742        } catch (error) {
6743            // Cart mutation failure: surface via snackbar and keep the gift card
6744            // applied so the UI does not desync from the cart.
6745            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
6746                error,
6747                dispatch,
6748                useResolvedMessages: true,
6749                fallbackSnackbar: {
6750                    heading: snackbar/* GENERIC_EVENT_ERR_HEADING */.U3.REQUEST_FAILED(),
6751                    message: snackbar/* GENERIC_ERR_MSG */.I_.ERROR()
6752                }
6753            });
6754            setLoading(false);
6755        }
6756    }, [
6757        dispatch,
6758        loading,
6759        resetFormState
6760    ]);
6761    const triggerBalanceCheckWithLatestAmount = (0,react.useCallback)(()=>{
6762        var _giftCardComponentRef_current_props_amount, _giftCardComponentRef_current_props, _giftCardComponentRef_current, _giftCardComponentRef_current1;
6763        if ((_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : (_giftCardComponentRef_current_props = _giftCardComponentRef_current.props) === null || _giftCardComponentRef_current_props === void 0 ? void 0 : (_giftCardComponentRef_current_props_amount = _giftCardComponentRef_current_props.amount) === null || _giftCardComponentRef_current_props_amount === void 0 ? void 0 : _giftCardComponentRef_current_props_amount.value) {
6764            giftCardComponentRef.current.props.amount.value = authAmountWithTip;
6765        }
6766        (_giftCardComponentRef_current1 = giftCardComponentRef.current) === null || _giftCardComponentRef_current1 === void 0 ? void 0 : _giftCardComponentRef_current1.onBalanceCheck();
6767    }, [
6768        authAmountWithTip
6769    ]);
6770    // True when the card number and PIN fields still hold valid data.
6771    const hasFreshFieldData = (0,react.useCallback)(()=>{
6772        var _giftCardComponentRef_current;
6773        return Boolean((_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : _giftCardComponentRef_current.isValid);
6774    }, []);
6775    const loadAdyen = (0,react.useCallback)(async ()=>{
6776        const configuration = {
6777            environment: config.environment,
6778            clientKey: config.clientKey,
6779            analytics: {
6780                enabled: true
6781            },
6782            showPayButton: true,
6783            amount: {
6784                value: authAmountWithTip,
6785                currency: locale.CURRENT_LOCALE.currency
6786            },
6787            // Pass giftcard configuration directly to checkout
6788            giftcard: {
6789                name: GIFT_CARD_NAME,
6790                brand: GIFT_CARD_BRAND,
6791                autoFocus: false,
6792                onBalanceCheck: async function(resolve, _, data) {
6793                    try {
6794                        var _giftCardComponentRef_current_props_amount, _giftCardComponentRef_current_props, _giftCardComponentRef_current, _this, _giftCardComponentRef_current_props_amount1, _giftCardComponentRef_current_props1, _giftCardComponentRef_current1;
6795                        setErrorMessages([]);
6796                        setLoading(true);
6797                        dispatch((0,paymentSlice/* resetGiftCardDetails */.ws)());
6798                        const checkBalancePayload = {
6799                            paymentMethod: data.paymentMethod,
6800                            amount: {
6801                                currency: locale.CURRENT_LOCALE.currency,
6802                                value: (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : (_giftCardComponentRef_current_props = _giftCardComponentRef_current.props) === null || _giftCardComponentRef_current_props === void 0 ? void 0 : (_giftCardComponentRef_current_props_amount = _giftCardComponentRef_current_props.amount) === null || _giftCardComponentRef_current_props_amount === void 0 ? void 0 : _giftCardComponentRef_current_props_amount.value
6803                            }
6804                        };
6805                        const balanceResponse = (_this = await (0,paymentApi/* checkGiftCardBalance */.Mh)(checkBalancePayload)) === null || _this === void 0 ? void 0 : _this.data;
6806                        dispatch((0,paymentSlice/* setGiftCardDetails */.XQ)({
6807                            balance: balanceResponse.balance.value,
6808                            checkedAuthAmount: (_giftCardComponentRef_current1 = giftCardComponentRef.current) === null || _giftCardComponentRef_current1 === void 0 ? void 0 : (_giftCardComponentRef_current_props1 = _giftCardComponentRef_current1.props) === null || _giftCardComponentRef_current_props1 === void 0 ? void 0 : (_giftCardComponentRef_current_props_amount1 = _giftCardComponentRef_current_props1.amount) === null || _giftCardComponentRef_current_props_amount1 === void 0 ? void 0 : _giftCardComponentRef_current_props_amount1.value
6809                        }));
6810                        balanceRef.current = balanceResponse.balance.value;
6811                        resolve(balanceResponse);
6812                        if (balanceResponse.resultCode === adyen_giftcard_types/* BalanceResultCode */.V.NOT_ENOUGH_BALANCE) {
6813                            setLoading(false);
6814                        }
6815                    } catch (error) {
6816                        const errors = (0,giftcard_utils/* resolveGiftCardErrors */.FP)(error);
6817                        setErrorMessages(errors);
6818                        setLoading(false);
6819                    }
6820                },
6821                onOrderRequest: async (_, __, data)=>{
6822                    //	Called when the gift card balance is less than the transaction amount.
6823                    try {
6824                        var _giftCardComponentRef_current_props_amount, _giftCardComponentRef_current_props, _giftCardComponentRef_current;
6825                        const createAdyenOrderPayload = {
6826                            cartId: cart.id,
6827                            amount: (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : (_giftCardComponentRef_current_props = _giftCardComponentRef_current.props) === null || _giftCardComponentRef_current_props === void 0 ? void 0 : (_giftCardComponentRef_current_props_amount = _giftCardComponentRef_current_props.amount) === null || _giftCardComponentRef_current_props_amount === void 0 ? void 0 : _giftCardComponentRef_current_props_amount.value,
6828                            amountPaidByGC: balanceRef.current
6829                        };
6830                        const orderResponse = await (0,paymentApi/* createAdyenOrder */.sm)(createAdyenOrderPayload);
6831                        var _orderResponse_data;
6832                        const { pspReference, orderData } = (_orderResponse_data = orderResponse.data) !== null && _orderResponse_data !== void 0 ? _orderResponse_data : {};
6833                        dispatch((0,paymentSlice/* setGiftCardDetails */.XQ)({
6834                            state: adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT,
6835                            encryptedData: data,
6836                            ...!!orderData && {
6837                                adyenOrderResponse: {
6838                                    pspReference,
6839                                    orderData
6840                                }
6841                            }
6842                        }));
6843                        isAdyenGiftFormSubmitted.current = true;
6844                    } catch (error) {
6845                        resetFormState();
6846                        const errors = (0,giftcard_utils/* resolveGiftCardErrors */.FP)(error);
6847                        setErrorMessages(errors);
6848                    } finally{
6849                        setLoading(false);
6850                    }
6851                },
6852                onRequiringConfirmation: ()=>{
6853                    var _giftCardComponentRef_current;
6854                    // 	Called when the gift card balance is enough to pay the full payment amount. The shopper must then confirm that they want to make the payment with the gift card.
6855                    dispatch((0,paymentSlice/* setGiftCardDetails */.XQ)({
6856                        state: adyen_giftcard_types/* GiftCardState */.s.SUFFICIENT,
6857                        encryptedData: (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : _giftCardComponentRef_current.data
6858                    }));
6859                    isAdyenGiftFormSubmitted.current = true;
6860                    setLoading(false);
6861                },
6862                showPayButton: false
6863            }
6864        };
6865        const { checkout } = await (0,lib_adyen/* initCheckout */.j0)(configuration);
6866        checkoutRef.current = checkout;
6867        // Create the giftcard component with type assertion
6868        const giftcard = new Giftcard/* GiftcardElement */.b(checkout, {
6869            name: GIFT_CARD_NAME,
6870            brand: GIFT_CARD_BRAND,
6871            showPayButton: false,
6872            // @ts-expect-error - Type definitions in Adyen 6.5.1 are incomplete
6873            onBalanceCheck: configuration.giftcard.onBalanceCheck,
6874            // @ts-expect-error - Type definitions in Adyen 6.5.1 are incomplete
6875            onOrderRequest: configuration.giftcard.onOrderRequest,
6876            // @ts-expect-error - Type definitions in Adyen 6.5.1 are incomplete
6877            onRequiringConfirmation: configuration.giftcard.onRequiringConfirmation
6878        });
6879        giftCardComponentRef.current = giftcard;
6880        giftcard === null || giftcard === void 0 ? void 0 : giftcard.mount(giftCardDivRef.current);
6881    }, [
6882        config.clientKey,
6883        authAmountWithTip,
6884        dispatch,
6885        cart.id,
6886        resetFormState
6887    ]);
6888    (0,react.useEffect)(()=>{
6889        if (!isAdyenGiftFormSubmitted.current && paymentMethodsResponse && authAmountWithTip) {
6890            void loadAdyen();
6891        }
6892    }, [
6893        loadAdyen,
6894        authAmountWithTip,
6895        paymentMethodsResponse
6896    ]);
6897    (0,react.useEffect)(()=>{
6898        // When the checked amount changes, reset the gift card details
6899        // and prompt the user to recheck the balance.
6900        // Skipped while a cart refetch is in flight (totals are stale during EBT
6901        // apply/unlock) and when the Adyen fields no longer hold usable data — a
6902        // re-check then posts a payload with no encrypted card data and fails a
6903        // valid card.
6904        if (isAdyenGiftFormSubmitted.current && !isCartFetching && checkedAuthAmount > 0 && authAmountWithTip !== checkedAuthAmount && giftCardState !== adyen_giftcard_types/* GiftCardState */.s.IDLE && hasFreshFieldData()) {
6905            triggerBalanceCheckWithLatestAmount();
6906        }
6907    }, [
6908        authAmountWithTip,
6909        checkedAuthAmount,
6910        giftCardState,
6911        isCartFetching,
6912        hasFreshFieldData,
6913        triggerBalanceCheckWithLatestAmount
6914    ]);
6915    (0,react.useEffect)(()=>{
6916        const handleOrderSubmitFailed = ()=>{
6917            if (isGiftCardApplied) {
6918                var _giftCardComponentRef_current;
6919                (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : _giftCardComponentRef_current.onBalanceCheck();
6920            }
6921        };
6922        events/* default */.Z.on(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED, handleOrderSubmitFailed);
6923        return ()=>{
6924            events/* default */.Z.off(events/* OrderEventType */.v.ORDER_SUBMIT_FAILED, handleOrderSubmitFailed);
6925        };
6926    }, [
6927        isGiftCardApplied
6928    ]);
6929    if (authAmountWithTip === 0) return null;
6930    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6931        className: (0,classNames["default"])((GiftCardForm_module_default())["gift-card-container"], errorMessages.length > 0 && (GiftCardForm_module_default())["gift-card-container--error"]),
6932        children: [
6933            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6934                className: (GiftCardForm_module_default()).header,
6935                children: [
6936                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
6937                        children: "Gift Card"
6938                    }),
6939                    !showForm ? /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
6940                        className: (GiftCardForm_module_default())["add-button"],
6941                        onClick: ()=>
6941dispatch((0,paymentSlice/* setGiftCardShowForm */.Bd)(true)),
6942                        children: "Add"
6943                    }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
6944                        children: !isGiftCardApplied && /*#__PURE__*/ (0,jsx_runtime.jsx)(IconButton/* default */.Z, {
6945                            "aria-label": "close",
6946                            color: "inherit",
6947                            onClick: handleCloseForm,
6948                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Close["default"], {})
6949                        })
6950                    })
6951                ]
6952            }),
6953            /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6954                className: (0,classNames["default"])((GiftCardForm_module_default())["gift-card-component-wrapper"], showForm && (GiftCardForm_module_default())["gift-card-component-wrapper--show"]),
6955                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
6956                    className: (GiftCardForm_module_default())["gift-card-content"],
6957                    children: [
6958                        /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6959                            ref: giftCardDivRef,
6960                            className: (0,classNames["default"])((GiftCardForm_module_default())["gift-card-component"], isGiftCardApplied && (GiftCardForm_module_default())["gift-card-component--hide"])
6961                        }),
6962                        /*#__PURE__*/ (0,jsx_runtime.jsx)(GiftCardErrorMessages, {
6963                            errorMessages: errorMessages
6964                        }),
6965                        giftCardState === adyen_giftcard_types/* GiftCardState */.s.IDLE && /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
6966                            className: (GiftCardForm_module_default())["apply-button-wrapper"],
6967                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)("button", {
6968                                type: "button",
6969                                className: (0,classNames["default"])("action", (GiftCardForm_module_default())["apply-button"]),
6970                                disabled: loading,
6971                                onClick: ()=>{
6972                                    var _giftCardComponentRef_current;
6973                                    return (_giftCardComponentRef_current = giftCardComponentRef.current) === null || _giftCardComponentRef_current === void 0 ? void 0 : _giftCardComponentRef_current.onBalanceCheck();
6974                                },
6975                                children: loading ? /*#__PURE__*/ (0,jsx_runtime.jsx)(LoadingIndicator.LoadingIndicator, {}) : "Apply"
6976                            })
6977                        }),
6978                        isGiftCardApplied && !loading && /*#__PURE__*/ (0,jsx_runtime.jsx)(GiftCardInfo, {
6979                            appliedAmount: appliedAmount,
6980                            remainingBalance: remainingAmount,
6981                            remainingPaymentDue: remainingPaymentDue,
6982                            onRemove: handleRemoveGiftCard
6983                        })
6984                    ]
6985                })
6986            })
6987        ]
6988    });
6989};
6990
6991// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/EbtSnapPayment/modals/EbtSnapPaymentModal/index.js
6992var EbtSnapPaymentModal = __webpack_require__(903541);
6993// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/EbtSnapPayment/modals/PromptPinModalContent/index.js
6994var PromptPinModalContent = __webpack_require__(63417);
6995// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/EbtSnapPayment/molecules/EbtSnapPaymentV2Form/index.js
6996var EbtSnapPaymentV2Form = __webpack_require__(921209);
6997var EbtSnapPaymentV2Form_default = /*#__PURE__*/__webpack_require__.n(EbtSnapPaymentV2Form);
6998// EXTERNAL MODULE: ./src/lib/hooks/useSnapPaymentV2.tsx + 4 modules
6999var useSnapPaymentV2 = __webpack_require__(619608);
7000;// CONCATENATED MODULE: ./src/components/checkout/payment/forage/SnapPaymentV2.tsx
7001/* __next_internal_client_entry_do_not_use__ default auto */ 
7002
7003
7004
7005
7006function SnapPaymentV2(param) {
7007    let { maxEbtAmount } = param;
7008    const { isExpanded, setIsExpanded, isLocked, amount, setAmount, currentPaymentMethod, cardNumberErrorMessage, pinErrorMessage, isPinModalVisible, setIsPinModalVisible, handleConfirmClick, handlePinSubmit, isPinSubmitting, handleUnlock, isAmountExceedMaxEbtAmount } = (0,useSnapPaymentV2/* useSnapPaymentV2 */.o0)({
7009        maxEbtAmount
7010    });
7011    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
7012        children: [
7013            /*#__PURE__*/ (0,jsx_runtime.jsx)((EbtSnapPaymentV2Form_default()), {
7014                isExpanded: isExpanded,
7015                setIsExpanded: setIsExpanded,
7016                isLocked: isLocked,
7017                amount: amount,
7018                setAmount: setAmount,
7019                cardContainerId: useSnapPaymentV2/* SNAP_V2_CARD_CONTAINER_ID */.KP,
7020                cardLast4: (currentPaymentMethod === null || currentPaymentMethod === void 0 ? void 0 : currentPaymentMethod.type) === "ebt" ? currentPaymentMethod.card.last4 : undefined,
7021                cardNumberErrorMessage: cardNumberErrorMessage,
7022                onApplyClick: handleConfirmClick,
7023                onUnlock: handleUnlock,
7024                isCardNumberComplete: Boolean(currentPaymentMethod),
7025                maxEbtAmount: maxEbtAmount,
7026                isAmountExceedMaxEbtAmount: isAmountExceedMaxEbtAmount
7027            }),
7028            /*#__PURE__*/ (0,jsx_runtime.jsx)(EbtSnapPaymentModal["default"], {
7029                isOpen: isPinModalVisible,
7030                onOpenChange: setIsPinModalVisible,
7031                children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PromptPinModalContent["default"], {
7032                    onSubmitPin: handlePinSubmit,
7033                    promptPinInputId: useSnapPaymentV2/* SNAP_V2_PIN_CONTAINER_ID */.w5,
7034                    pinErrorMessage: pinErrorMessage,
7035                    isPaymentConfirmation: true,
7036                    isSubmitting: isPinSubmitting
7037                })
7038            })
7039        ]
7040    });
7041}
7042
7043// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentMethod.module.scss
7044var PaymentMethod_module = __webpack_require__(301099);
7045var PaymentMethod_module_default = /*#__PURE__*/__webpack_require__.n(PaymentMethod_module);
7046;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentMethod.tsx
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061const giftCardPaymentToggle = environment.nextAppEnv.feature_toggle.US.isGiftCardPaymentEnabled;
7062function PaymentMethod(param) {
7063    let { driverTipRef, maxEbtAmount } = param;
7064    const giftCardState = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectGiftCardDetail
7064s */.O4).state;
7065    const [isGiftCardPaymentEnabled, setIsGiftCardPaymentEnabled] = (0,react.useState)(false);
7066    (0,react.useEffect)(()=>{
7067        const giftCardCookie = (0,cookies/* getCookie */.ej)(storage.COOKIE_KEYS.GIFT_CARD_PAYMENT_AVAILABLE);
7068        setIsGiftCardPaymentEnabled(giftCardPaymentToggle === "enabled" || giftCardPaymentToggle === "cookie" && !!giftCardCookie);
7069    }, []);
7070    const { shouldShowEbtEligibility } = (0,useEbtSnapStoreEligibility/* useEbtSnapStoreEligibility */._)(true);
7071    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("section", {
7072        className: (PaymentMethod_module_default())["payment-method"],
7073        children: [
7074            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7075                className: "section__header",
7076                children: [
7077                    /*#__PURE__*/ (0,jsx_runtime.jsx)("h2", {
7078                        className: "section__title__summary",
7079                        children: (0,utils_locale.t)("checkout.payment.title")
7080                    }),
7081                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
7082                        className: "section__text",
7083                        children: (0,utils_locale.t)("checkout.payment.subtitle")
7084                    })
7085                ]
7086            }),
7087            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7088                className: (PaymentMethod_module_default())["payment-methods-container"],
7089                children: [
7090                    isGiftCardPaymentEnabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(GiftCardForm, {}),
7091                    shouldShowEbtEligibility ? /*#__PURE__*/ (0,jsx_runtime.jsx)(SnapPaymentV2, {
7092                        maxEbtAmount: maxEbtAmount
7093                    }) : null,
7094                    (giftCardState === adyen_giftcard_types/* GiftCardState */.s.IDLE || giftCardState === adyen_giftcard_types/* GiftCardState */.s.INSUFFICIENT) && /*#__PURE__*/ (0,jsx_runtime.jsx)(CardPaymentForm, {
7095                        driverTipRef: driverTipRef
7096                    })
7097                ]
7098            })
7099        ]
7100    });
7101}
7102
7103// EXTERNAL MODULE: ./src/lib/hooks/useFastlaneWatermark.tsx
7104var useFastlaneWatermark = __webpack_require__(357987);
7105// EXTERNAL MODULE: ./src/lib/interfaces/index.ts + 2 modules
7106var interfaces = __webpack_require__(308825);
7107// EXTERNAL MODULE: ./src/components/checkout/payment/PaymentReview.module.scss
7108var PaymentReview_module = __webpack_require__(247648);
7109var PaymentReview_module_default = /*#__PURE__*/__webpack_require__.n(PaymentReview_module);
7110;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentReview.tsx
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127const PAYMENT_REVIEW_COMP = "PaymentReviewComponent";
7128const dataIdChangeEmail = "".concat(PAYMENT_REVIEW_COMP, "/change-email");
7129const dataIdChangeAddress = "".concat(PAYMENT_REVIEW_COMP, "/change-address");
7130const dataIdChangeMethod = "".concat(PAYMENT_REVIEW_COMP, "/change-method");
7131const REVIEW_BLOCK_TYPE = {
7132    ADDRESS_CHANGE: "addressChange"
7133};
7134function PaymentReview() {
7135    const cartSlice = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
7136    const shippingAddress = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* getShippingAddress */.ep);
7137    const cartType = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartTypeSelector */.$R);
7138    const { fetchWindows } = (0,delivery_hooks/* useApiWindows */.n)();
7139    const onlyMembershipItemInTheCart = cartType == interfaces/* CartType */.EI.MembershipStandalone;
7140    const cartWithMembership = cartType === interfaces/* CartType */.EI.WithMembership;
7141    const { isMember, customerInfo } = (0,useCustomer/* useCustomer */.O)();
7142    const { resetAddressSelected } = (0,CheckoutProvider/* useCheckout */.Mg)();
7143    const { getUserFastlaneConfig, handleFastlaneAddressChange, IS_FASTLANE_ENABLED, authenticateFastlaneEmail } = (0,useFastlane/* useFastlane */.Pf)();
7144    const fastLaneUserConfig = getUserFastlaneConfig();
7145    const country_shippingAddress = (0,utils_locale/* getFullCountryObject */.dF)();
7146    const { deliveryMethod: deliveryMethodInStore, fulfillmentType, rawShippingTotal = 0, shippingTotal = 0, storeId } = cartSlice;
7147    const isFreeShipping = !shippingTotal && rawShippingTotal > 0;
7148    const inStorePickUp = (0,fulfillmentUtils/* isPickupFulfillmentType */._W)(fulfillmentType);
7149    // Hook for the watermark
7150    const { watermarkElement } = (0,useFastlaneWatermark/* useFastlaneWatermark */.y)();
7151    const fastlaneUserConfig = getUserFastlaneConfig();
7152    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
7153    const recipientData = getRecipientData();
7154    const shouldFastlaneAuthenticationRun = IS_FASTLANE_ENABLED && fastlaneUserConfig !== null;
7155    (0,react.useEffect)(()=>{
7156        const triggerFastlaneAuthentication = async ()=>{
7157            await authenticateFastlaneEmail();
7158        };
7159        if (shouldFastlaneAuthenticationRun) {
7160            triggerFastlaneAuthentication();
7161        }
7162    }, []); //NOTE: Keeping intentionally, want to call email lookup on reload/refresh
7163    const changeAddressHandler = async function(event) {
7164        let reviewBlockType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
7165        var _fastLaneUserConfig_fastlaneAuthData;
7166        const isFastlaneAuthenticated = fastLaneUserConfig !== null && (fastLaneUserConfig === null || fastLaneUserConfig === void 0 ? void 0 : (_fastLaneUserConfig_fastlaneAuthData = fastLaneUserConfig.fastlaneAuthData) === null || _fastLaneUserConfig_fastlaneAuthData === void 0 ? void 0 : _fastLaneUserConfig_fastlaneAuthData.authenticationState) === useFastlane/* FastlaneAuthStatus */.RW.SUCCEEDED;
7167        if (reviewBlockType === REVIEW_BLOCK_TYPE.ADDRESS_CHANGE && isFastlaneAuthenticated && !inStorePickUp) {
7168            event.preventDefault();
7169            await handleFastlaneAddressChange();
7170        }
7171        if (!inStorePickUp) {
7172            return resetAddressSelected();
7173        }
7174        if (storeId) {
7175            await fetchWindows({
7176                storeId
7177            });
7178        }
7179    };
7180    const { address1, address2, city, state, postalCode } = shippingAddress || {};
7181    const countryText = (country_shippingAddress === null || country_shippingAddress === void 0 ? void 0 : country_shippingAddress.text) || "";
7182    const shipToValue = [
7183        address1,
7184        address2,
7185        city,
7186        state,
7187        postalCode,
7188        countryText
7189    ].filter(Boolean).join(", ");
7190    const isFreeShippingWithMembership = isFreeShipping && cartWithMembership;
7191    const deliveryMethod = isFreeShippingWithMembership ? "" : deliveryMethodInStore;
7192    // Determine shipping cost display text
7193    const getShippingCostDisplay = ()=>{
7194        if (isFreeShipping) {
7195            return cartWithMembership ? (0,utils_locale.t)("checkout.payment.member_delivery") : (0,utils_locale.t)("checkout.payment.free");
7196        }
7197        return utils/* currency.format */.Aq.format(utils/* currency.convertToDollar */.Aq.convertToDollar(shippingTotal));
7198    };
7199    // Render method value based on fulfillment type and shipping status
7200    const renderMethodValue = ()=>{
7201        // Case 1: Corporate gift - shows "Corporate Gift" only (highest priority)
7202        if (recipientData) {
7203            return /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
7204                children: [
7205                    (0,utils_locale.t)("checkout.payment.method_corporate_gift"),
7206                    " \xa0"
7207                ]
7208            });
7209        }
7210        // Case 2: In-store pickup - always shows "Pickup · Free"
7211        if (inStorePickUp) {
7212            return /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
7213                children: [
7214                    (0,utils_locale.t)("checkout.payment.method_pickup"),
7215                    " \xa0",
7216                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("strong", {
7217                        children: [
7218                            "\xb7 \xa0",
7219                            (0,utils_locale.t)("checkout.payment.free")
7220                        ]
7221                    })
7222                ]
7223            });
7224        }
7225        // Case 3: Member with free shipping - shows "Member Delivery" only
7226        if (isMember && isFreeShipping) {
7227            return (0,utils_locale.t)("checkout.payment.member_delivery");
7228        }
7229        // Case 4: Delivery method with shipping cost/free status
7230        const shippingCostDisplay = getShippingCostDisplay();
7231        const showSeparator = !isFreeShippingWithMembership;
7232        return /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", {
7233            children: [
7234                deliveryMethod,
7235                " ",
7236                /*#__PURE__*/ (0,jsx_runtime.jsxs)("strong", {
7237                    children: [
7238                        showSeparator && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
7239                            children: [
7240                                "\xb7 ",
7241                                ""
7242                            ]
7243                        }),
7244                        shippingCostDisplay
7245                    ]
7246                })
7247            ]
7248        });
7249    };
7250    const methodValue = renderMethodValue();
7251    if (onlyMembershipItemInTheCart) {
7252        return /*#__PURE__*/ (0,jsx_runtime.jsx)("section", {
7253            className: (PaymentReview_module_default()).section,
7254            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ReviewBlock, {
7255                label: (0,utils_locale.t)("checkout.payment.contact"),
7256                value: (customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.email) || ""
7257            })
7258        });
7259    }
7260    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("section", {
7261        className: (PaymentReview_module_default()).section,
7262        children: [
7263            /*#__PURE__*/ (0,jsx_runtime.jsx)(ReviewBlock, {
7264                label: (0,utils_locale.t)("checkout.payment.contact"),
7265                value: shippingAddress.email || (customerInfo === null || customerInfo === void 0 ? void 0 : customerInfo.email) || "",
7266                linkHref: "/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.auth),
7267                linkTestId: dataIdChangeEmail,
7268                linkText: (0,utils_locale.t)("checkout.payment.change"),
7269                changeHandler: (e)=>{
7270                    changeAddressHandler(e, "");
7271                }
7272            }),
7273            /*#__PURE__*/ (0,jsx_runtime.jsx)(Divider, {
7274                className: (PaymentReview_module_default()).divider
7275            }),
7276            /*#__PURE__*/ (0,jsx_runtime.jsx)(ReviewBlock, {
7277                label: inStorePickUp ? (0,utils_locale.t)("checkout.payment.pickup") : (0,utils_locale.t)("checkout.payment.ship_to"),
7278                value: shipToValue,
7279                linkHref: "/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.delivery),
7280                linkTestId: dataIdChangeAddress,
7281                linkText: (0,utils_locale.t)("checkout.payment.change"),
7282                changeHandler: (e)=>{
7283                    changeAddressHandler(e, REVIEW_BLOCK_TYPE.ADDRESS_CHANGE);
7284                },
7285                watermarkElement: !inStorePickUp ? watermarkElement : null
7286            }),
7287            /*#__PURE__*/ (0,jsx_runtime.jsx)(Divider, {
7288                className: (PaymentReview_module_default()).divider
7289            }),
7290            /*#__PURE__*/ (0,jsx_runtime.jsx)(ReviewBlock, {
7291                label: (0,utils_locale.t)("checkout.payment.method"),
7292                value: methodValue,
7293                linkHref: "/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.delivery),
7294                linkTestId: dataIdChangeMethod,
7295                linkText: (0,utils_locale.t)("checkout.payment.change"),
7296                shouldShowChangeHandler: !recipientData
7297            })
7298        ]
7299    });
7300}
7301const ReviewBlock = (param)=>{
7302    let { label, value, linkHref = "", linkTestId = "", linkText = "", shouldShowChangeHandler = true, changeHandler, watermarkElement } = param;
7303    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7304        className: (PaymentReview_module_default())["review-block"],
7305        children: [
7306            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7307                className: (PaymentReview_module_default())["review-block__inner"],
7308                children: [
7309                    /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7310                        className: (PaymentReview_module_default())["review-block__label"],
7311                        children: label
7312                    }),
7313                    /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7314                        className: (PaymentReview_module_default())["review-block__value"],
7315                        children: [
7316                            value,
7317                            watermarkElement
7318                        ]
7319                    })
7320                ]
7321            }),
7322            shouldShowChangeHandler ? /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7323                className: (PaymentReview_module_default())["review-block__link"],
7324                children: !!linkText && /*#__PURE__*/ (0,jsx_runtime.jsx)(Link/* default */.Z, {
7325                    href: linkHref,
7326                    passHref: true,
7327                    legacyBehavior: true,
7328                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)("a", {
7329                        "data-testid": linkTestId,
7330                        onClick: changeHandler,
7331                        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
7332                            children: linkText
7333                        })
7334                    })
7335                })
7336            }) : null
7337        ]
7338    });
7339};
7340const Divider = (param)=>{
7341    let { className } = param;
7342    return /*#__PURE__*/ (0,jsx_runtime.jsx)("hr", {
7343        className: className
7344    });
7345};
7346
7347// EXTERNAL MODULE: ./src/components/checkout/payment/PosMembershipSaveCardConsent.module.scss
7348var PosMembershipSaveCardConsent_module = __webpack_require__(409357);
7349var PosMembershipSaveCardConsent_module_default = /*#__PURE__*/__webpack_require__.n(PosMembershipSaveCardConsent_module);
7350;// CONCATENATED MODULE: ./src/components/checkout/payment/PosMembershipSaveCardConsent.tsx
7351
7352
7353
7354
7355
7356
7357
7358
7359const PosMembershipSaveCardConsent = (param)=>{
7360    let { contentTranslation = {
7361        importantLabel: "IMPORTANT: ",
7362        acknowledgment: "By checking this box, you are consenting to save and for Wild Fork to use this payment method for your membership subscription renewal. Payment method can be changed at any time."
7363    } } = param;
7364    const { isMember, isLocalMembershipGroup, hasMembershipRenewalToken } = (0,useCustomer/* useCustomer */.O)();
7365    const { isExpanded, isLocked } = (0,store_hooks/* useAppSelector */.C)(foragePaymentSlice/* selectForagePayment */.fE);
7366    const { isGiftCardSufficient } = (0,store_hooks/* useAppSelector */.C)(paymentSlice/* selectGiftCardDetail
7366s */.O4);
7367    // EBT cards cannot be tokenized. `isExpanded` is the radio; `isLocked` keeps
7368    // it hidden through Change, which unlocks but stays expanded.
7369    const isEbtSelected = isExpanded || isLocked;
7370    const { posMembershipSaveCardAgreementChecked, setPosMembershipSaveCardAgreementChecked } = (0,CheckoutProvider/* useCheckout */.Mg)();
7371    (0,react.useEffect)(()=>{
7372        return ()=>{
7373            setPosMembershipSaveCardAgreementChecked(false);
7374        };
7375    }, [
7376        setPosMembershipSaveCardAgreementChecked
7377    ]);
7378    // The gate below only stops rendering, so the unmount cleanup never fires and
7379    // an earlier consent would still reach the payload.
7380    (0,react.useEffect)(()=>{
7381        if (isEbtSelected) {
7382            setPosMembershipSaveCardAgreementChecked(false);
7383        }
7384    }, [
7385        isEbtSelected,
7386        setPosMembershipSaveCardAgreementChecked
7387    ]);
7388    const handleCheckboxChange = ()=>{
7389        setPosMembershipSaveCardAgreementChecked((prevState)=>!prevState);
7390    };
7391    return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
7392        children: isMember && isLocalMembershipGroup && !hasMembershipRenewalToken && !isGiftCardSufficient && !isEbtSelected && /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7393            className: "".concat((PosMembershipSaveCardConsent_module_default())["pos-membership-save-card-consent"]),
7394            children: [
7395                /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
7396                    type: "checkbox",
7397                    id: "pos-membership-save-card-agreement",
7398                    name: "pos-membership-save-card-agreement",
7399                    checked: posMembershipSaveCardAgreementChecked,
7400                    onChange: handleCheckboxChange
7401                }),
7402                /*#__PURE__*/ (0,jsx_runtime.jsxs)("label", {
7403                    htmlFor: "pos-membership-save-card-agreement",
7404                    children: [
7405                        /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
7406                            className: "".concat((PosMembershipSaveCardConsent_module_default())["important-label"]),
7407                            children: contentTranslation.importantLabel
7408                        }),
7409                        contentTranslation.acknowledgment
7410                    ]
7411                })
7412            ]
7413        })
7414    });
7415};
7416
7417// EXTERNAL MODULE: ./src/components/checkout/payment/SubscriptionConfirmation.module.scss
7418var SubscriptionConfirmation_module = __webpack_require__(744723);
7419var SubscriptionConfirmation_module_default = /*#__PURE__*/__webpack_require__.n(SubscriptionConfirmation_module);
7420;// CONCATENATED MODULE: ./src/components/checkout/payment/SubscriptionConfirmation.tsx
7421
7422
7423
7424
7425
7426const SubscriptionConfirmation = ()=>{
7427    const { subscriptionError, subscriptionConfirmation } = (0,store_hooks/* useAppSelector */.C)(autoShipSlice/* autoShipSelector */.WU);
7428    const dispatch = (0,store_hooks/* useAppDispatch */.T)();
7429    const autoshipPayemtCheckboxLabel = "I understand that I'm agreeing to a subscription. It will renew at the price and frequency listed until it ends or is cancelled*.";
7430    const subscriptionErrorLabel = "Please accept the renewal agreement";
7431    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7432        children: [
7433            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7434                className: (SubscriptionConfirmation_module_default())["autoship-payment-checkbox"],
7435                children: [
7436                    /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
7437                        id: "autoship-payment-checkbox",
7438                        name: "autoship-payment-checkbox",
7439                        type: "checkbox",
7440                        checked: subscriptionConfirmation,
7441                        onChange: (e)=>{
7442                            dispatch((0,autoShipSlice/* setSubscriptionConfirmation */.GN)(e.target.checked));
7443                            dispatch((0,autoShipSlice/* setSubscriptionError */.be)(!e.target.checked));
7444                        }
7445                    }),
7446                    /*#__PURE__*/ (0,jsx_runtime.jsx)("label", {
7447                        htmlFor: "autoship-payment-checkbox",
7448                        children: autoshipPayemtCheckboxLabel
7449                    })
7450                ]
7451            }),
7452            subscriptionError ? /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7453                className: (SubscriptionConfirmation_module_default())["autoship-subscription-error"],
7454                children: /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
7455                    children: subscriptionErrorLabel
7456                })
7457            }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {})
7458        ]
7459    });
7460};
7461
7462;// CONCATENATED MODULE: ./src/components/checkout/payment/PaymentContainer.tsx
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483function PaymentContainer() {
7484    var _nextAppEnv_feature_toggle, _cartSlice_lineItems;
7485    const cartSlice = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
7486    const { autoship } = (0,useCartSubscription/* useCartSubscription */.r)();
7487    const driverTipRef = (0,react.useRef)(0);
7488    const isKioskVisitor = (0,store_hooks/* useAppSelector */.C)(environmentSlice/* isKioskVisitorSelector */.V_);
7489    const { isOrderMinimumUnmet }
7489 = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* orderMinimumSelector */.Id);
7490    const isPickUpFulfillmentType = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* isPickupFulfillmentTypeSelector */.m7);
7491    const cartHasDiscountCode = !!(0,store_hooks/* useAppSelector */.C)((state)=>{
7492        var _state_cart_discount;
7493        return (_state_cart_discount = state.cart.discount) === null || _state_cart_discount === void 0 ? void 0 : _state_cart_discount.code;
7494    });
7495    const { pickUpAvailability } = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* shippingAvailabilitySelector */.Do);
7496    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
7497    const recipientData = getRecipientData();
7498    const { isDeliveryHandlingFeeEnabled } = environment.nextAppEnv === null || environment.nextAppEnv === void 0 ? void 0 : (_nextAppEnv_feature_toggle = environment.nextAppEnv.feature_toggle) === null || _nextAppEnv_feature_toggle === void 0 ? void 0 : _nextAppEnv_feature_toggle.US;
7499    var _cartSlice_ebtEligibleAmount;
7500    return !recipientData ? /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7501        className: (PaymentContainer_module_default())["payment-container"],
7502        children: [
7503            !isKioskVisitor && /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
7504                children: [
7505                    /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentReview, {}),
7506                    /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentDriverTip, {
7507                        driverTipRef: driverTipRef
7508                    }, cartSlice.tipReceived)
7509                ]
7510            }),
7511            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7512                children: [
7513                    /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentMethod, {
7514                        driverTipRef: driverTipRef,
7515                        maxEbtAmount: (_cartSlice_ebtEligibleAmount = cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.ebtEligibleAmount) !== null && _cartSlice_ebtEligibleAmount !== void 0 ? _cartSlice_ebtEligibleAmount : 0
7516                    }),
7517                    /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentDiscount, {})
7518                ]
7519            }),
7520            isOrderMinimumUnmet && !isPickUpFulfillmentType && !isDeliveryHandlingFeeEnabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(OrderMinimumUnmet/* default */.Z, {
7521                reason: cartHasDiscountCode ? "discount" : "default",
7522                isPickupAvailable: pickUpAvailability
7523            }),
7524            !isKioskVisitor && !!autoship && (cartSlice === null || cartSlice === void 0 ? void 0 : (_cartSlice_lineItems = cartSlice.lineItems) === null || _cartSlice_lineItems === void 0 ? void 0 : _cartSlice_lineItems.length) > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)(SubscriptionConfirmation, {}),
7525            /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7526                children: [
7527                    /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentBillingAddress, {}),
7528                    locale.isUSLocale && /*#__PURE__*/ (0,jsx_runtime.jsx)(MembershipTermsConsent/* MembershipTermsConsent */.F, {}),
7529                    (locale.isUSLocale || locale.isCALocale) && /*#__PURE__*/ (0,jsx_runtime.jsx)(PosMembershipSaveCardConsent, {})
7530                ]
7531            })
7532        ]
7533    }) : /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7534        className: (PaymentContainer_module_default())["payment-container"],
7535        children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentReview, {})
7536    });
7537}
7538
7539;// CONCATENATED MODULE: ./src/components/checkout/payment/index.ts
7540
7541
7542// EXTERNAL MODULE: ./node_modules/@mui/material/Card/Card.js
7543var Card = __webpack_require__(162623);
7544// EXTERNAL MODULE: ./node_modules/@mui/material/CardContent/CardContent.js
7545var CardContent = __webpack_require__(528492);
7546// EXTERNAL MODULE: ./node_modules/@mui/material/Typography/Typography.js
7547var Typography = __webpack_require__(923972);
7548// EXTERNAL MODULE: ./src/components/checkout/taxDelayedCard/TaxDelayedCard.module.scss
7549var TaxDelayedCard_module = __webpack_require__(460634);
7550var TaxDelayedCard_module_default = /*#__PURE__*/__webpack_require__.n(TaxDelayedCard_module);
7551;// CONCATENATED MODULE: ./src/components/checkout/taxDelayedCard/TaxDelayedCard.tsx
7552
7553
7554
7555
7556
7557
7558
7559
7560function TaxDelayedCard() {
7561    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(Card/* default */.Z, {
7562        className: (TaxDelayedCard_module_default()).container,
7563        children: [
7564            /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon.Icon, {
7565                iconName: "loader"
7566            }),
7567            /*#__PURE__*/ (0,jsx_runtime.jsxs)(CardContent/* default */.Z, {
7568                children: [
7569                    /*#__PURE__*/ (0,jsx_runtime.jsx)(Typography/* default */.Z, {
7570                        component: "div",
7571                        variant: "h5",
7572                        gutterBottom: true,
7573                        className: (TaxDelayedCard_module_default())["card--title"],
7574                        children: (0,utils_locale.t)("checkout.problems.tax_delayed.title")
7575                    }),
7576                    /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
7577                        children: (0,utils_locale.t)("checkout.problems.tax_delayed.message")
7578                    })
7579                ]
7580            })
7581        ]
7582    });
7583}
7584
7585;// CONCATENATED MODULE: ./src/components/checkout/CheckoutLayout.tsx
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607function MainContentComponent(param) {
7608    let { currentStep } = param;
7609    switch(currentStep){
7610        case CheckoutProvider/* CheckoutSteps */.bN.auth:
7611            return /*#__PURE__*/ (0,jsx_runtime.jsx)(auth/* AuthContainer */.P0, {});
7612        case CheckoutProvider/* CheckoutSteps */.bN.delivery:
7613            return /*#__PURE__*/ (0,jsx_runtime.jsx)(DeliveryContainer, {});
7614        case CheckoutProvider/* CheckoutSteps */.bN.payment:
7615            return /*#__PURE__*/ (0,jsx_runtime.jsx)(PaymentContainer, {});
7616        default:
7617            return /*#__PURE__*/ (0,jsx_runtime.jsx)(auth/* AuthContainer */.P0, {});
7618    }
7619}
7620const CheckoutLayout = ()=>{
7621    var _router_query;
7622    const router = (0,next_router.useRouter)();
7623    const { regionId } = (0,store_hooks/* useAppSelector */.C)(zipcodeSlice/* ZipCodeSelector */.pz);
7624    const queryParamStep = ((_router_query = router.query) === null || _router_query === void 0 ? void 0 : _router_query.step) ? router.query.step : "";
7625    const showTaxCard = (0,store_hooks/* useAppSelector */.C)((state)=>{
7626        var _state_taxDelayedCard;
7627        return (_state_taxDelayedCard = state.taxDelayedCard) === null || _state_taxDelayedCard === void 0 ? void 0 : _state_taxDelayedCard.show;
7628    });
7629    const cartSlice = (0,store_hooks/* useAppSelector */.C)(store_cartSlice/* cartSliceSelector */.Ew);
7630    const wasGTMinitiateCheckoutCalled = (0,react.useRef)(false);
7631    const { isLoggedIn } = (0,hooks/* useCustomer */.ON)();
7632    const { currentStep, setCurrentStepHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
7633    (0,useKlaviyo/* useStartedCheckoutProduct */.h)(cartSlice);
7634    (0,react.useEffect)(()=>{
7635        if (!wasGTMinitiateCheckoutCalled.current) {
7636            wasGTMinitiateCheckoutCalled.current = true;
7637            const GTMinitiateCheckoutPayload = {
7638                lineItems: cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.lineItems,
7639                currencyType: cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.currencyType,
7640                totalPrice: cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.totalPrice
7641            };
7642            (0,trackingEvents/* GTMinitiateCheckout */.RC)({
7643                data: GTMinitiateCheckoutPayload,
7644                regionId
7645            });
7646            if (isLoggedIn) {
7647                (0,trackingEvents/* GTMCheckoutAccountType */.Jj)(tracking/* CheckoutAccountType */.O.LOGIN);
7648            }
7649        }
7650    }, [
7651        cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.currencyType,
7652        cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.lineItems,
7653        cartSlice === null || cartSlice === void 0 ? void 0 : cartSlice.totalPrice,
7654        regionId,
7655        isLoggedIn
7656    ]);
7657    (0,hooks/* useCheckoutRedirect */.eo)();
7658    (0,useSetCartFromQueryParam/* useSetCartFromQueryParam */.q)();
7659    (0,react.useEffect)(()=>{
7660        if (queryParamStep && parseInt(queryParamStep, 10) !== currentStep) {
7661            // TODO from Jared: conditions will have to validate if moving to the specified step is valid
7662            setCurrentStepHandler(parseInt(queryParamStep, 10), "DO NOT CALL THIS FUNCTION ANYWHERE ELSE. Use the checkout?step query param process");
7663        }
7664    }, [
7665        queryParamStep,
7666        currentStep,
7667        setCurrentStepHandler
7668    ]);
7669    const shownContent = showTaxCard ? /*#__PURE__*/ (0,jsx_runtime.jsx)(TaxDelayedCard, {}) : /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
7670        children: [
7671            /*#__PURE__*/ (0,jsx_runtime.jsx)(miniOrderSummary_MiniOrderSummary, {}),
7672            /*#__PURE__*/ (0,jsx_runtime.jsx)(MainContentComponent, {
7673                currentStep: currentStep
7674            })
7675        ]
7676    });
7677    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7678        className: "".concat((CheckoutLayout_module_default()).content, " "),
7679        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7680            className: "".concat((CheckoutLayout_module_default())["checkout-layout"], " layout--checkout"),
7681            children: [
7682                /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
7683                    className: (CheckoutLayout_module_default())["main-content-wrapper"],
7684                    children: [
7685                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Header/* Header */.h, {}),
7686                        shownContent,
7687                        /*#__PURE__*/ (0,jsx_runtime.jsx)(Footer, {})
7688                    ]
7689                }),
7690                /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7691                    className: (CheckoutLayout_module_default())["checkout-summary-desktop"],
7692                    children: /*#__PURE__*/ (0,jsx_runtime.jsx)(OrderSummary/* default */.Z, {})
7693                })
7694            ]
7695        })
7696    });
7697};
7698
7699
7700/***/ }),
7701
7702/***/ 678325:
7703/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7704
7705"use strict";
7706
7707// EXPORTS
7708__webpack_require__.d(__webpack_exports__, {
7709  P0: function() { return /* reexport */ AuthContainer; },
7710  hu: function() { return /* reexport */ AuthGuestContent; },
7711  hD: function() { return /* reexport */ AuthGuestHeader; },
7712  is: function() { return /* reexport */ AuthLoginContent; },
7713  _Y: function() { return /* reexport */ AuthLoginHeader; },
7714  jb: function() { return /* reexport */ AuthRegisterContent; },
7715  ui: function() { return /* reexport */ AuthRegisterHeader; }
7716});
7717
7718// UNUSED EXPORTS: authOptions
7719
7720// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
7721var jsx_runtime = __webpack_require__(785893);
7722// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/hooks/corporate-gift/useRecipientData.js
7723var useRecipientData = __webpack_require__(173273);
7724// EXTERNAL MODULE: ./node_modules/js-cookie/dist/js.cookie.mjs
7725var js_cookie = __webpack_require__(131955);
7726// EXTERNAL MODULE: ./src/components/ui/index.ts + 7 modules
7727var ui = __webpack_require__(836455);
7728// EXTERNAL MODULE: ./src/components/checkout/auth/AuthContainer.module.scss
7729var AuthContainer_module = __webpack_require__(317193);
7730var AuthContainer_module_default = /*#__PURE__*/__webpack_require__.n(AuthContainer_module);
7731;// CONCATENATED MODULE: ./src/components/checkout/auth/AuthContainer.tsx
7732
7733
7734
7735
7736
7737
7738var authOptions;
7739(function(authOptions) {
7740    authOptions[authOptions["login"] = 0] = "login";
7741    authOptions[authOptions["register"] = 1] = "register";
7742    authOptions[authOptions["guest"] = 2] = "guest";
7743})(authOptions || (authOptions = {}));
7744const AuthContainer = (param)=>{
7745    let { onGuestFormSubmit, isOnePageCheckout = false } = param;
7746    const redirectCookie = js_cookie/* default */.Z.get("redirect_path_after_password_reset");
7747    const { isCampaignExpired, getGiftAmount } = (0,useRecipientData.useRecipientData)();
7748    const getBalanceLimit = getGiftAmount();
7749    const shouldShowGiftBalanceTracker = getBalanceLimit > 0 || !isCampaignExpired();
7750    let initialActiveItem = 2;
7751    if (redirectCookie) {
7752        initialActiveItem = 0;
7753    }
7754    // If the conditions are met to show the gift balance tracker (i.e.,
7755    // getBalanceLimit > 0 or the campaign has not expired), automatically
7756    // set the initial active accordion to "Register". This prioritizes
7757    // the "Register" tab for users involved in a gift campaign, so that
7758    // they register to claim their gift.
7759    if (shouldShowGiftBalanceTracker) {
7760        initialActiveItem = 1;
7761    }
7762    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7763        className: (AuthContainer_module_default())["auth-container"],
7764        children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(ui/* Accordion */.UQ, {
7765            initialActiveItem: initialActiveItem,
7766            children: [
7767                /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* AccordionItem */.Qd, {
7768                    header: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthLoginHeader, {
7769                        isOnePageCheckout: isOnePageCheckout
7770                    }),
7771                    content: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthLoginContent, {}),
7772                    value: 0
7773                }),
7774                /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* AccordionItem */.Qd, {
7775                    header: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthRegisterHeader, {
7776                        isOnePageCheckout: isOnePageCheckout
7777                    }),
7778                    content: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthRegisterContent, {}),
7779                    value: 1
7780                }),
7781                /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* AccordionItem */.Qd, {
7782                    header: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthGuestHeader, {}),
7783                    content: /*#__PURE__*/ (0,jsx_runtime.jsx)(AuthGuestContent, {
7784                        onGuestFormSubmit: onGuestFormSubmit,
7785                        isOnePageCheckout: isOnePageCheckout
7786                    }),
7787                    value: 2
7788                })
7789            ]
7790        })
7791    });
7792};
7793
7794// EXTERNAL MODULE: ./node_modules/react/index.js
7795var react = __webpack_require__(667294);
7796// EXTERNAL MODULE: ./node_modules/next/router.js
7797var router = __webpack_require__(811163);
7798// EXTERNAL MODULE: ./node_modules/@mui/material/Grid/Grid.js + 1 modules
7799var Grid = __webpack_require__(448263);
7800// EXTERNAL MODULE: ./node_modules/react-final-form/dist/react-final-form.es.js
7801var react_final_form_es = __webpack_require__(166688);
7802// EXTERNAL MODULE: ./src/components/forms/formFields/textField/FormTextField.tsx
7803var FormTextField = __webpack_require__(833936);
7804// EXTERNAL MODULE: ./src/components/one-page-checkout/hooks/payment/paymentContants.ts
7805var paymentContants = __webpack_require__(754513);
7806// EXTERNAL MODULE: ./node_modules/lodash/debounce.js
7807var debounce = __webpack_require__(23279);
7808var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
7809// EXTERNAL MODULE: ./src/components/account/hooks/useFastlane.ts
7810var useFastlane = __webpack_require__(474282);
7811// EXTERNAL MODULE: ./src/components/one-page-checkout/hooks/payment/index.ts + 32 modules
7812var payment = __webpack_require__(879165);
7813// EXTERNAL MODULE: ./src/lib/store/hooks.ts
7814var hooks = __webpack_require__(267097);
7815// EXTERNAL MODULE: ./src/lib/store/onePageCheckoutPaymentSlice.ts
7816var onePageCheckoutPaymentSlice = __webpack_require__(412512);
7817;// CONCATENATED MODULE: ./src/components/checkout/forms/guest/useGuest.ts
7818
7819
7820
7821
7822
7823
7824
7825const useGuest = (param)=>{
7826    let { isOnePageCheckout } = param;
7827    var _fastlaneConfig_fastlaneAuthData;
7828    const multiStepFastlane = (0,useFastlane/* useFastlane */.Pf)();
7829    const { validateFastlaneEmailOPC, status: { isInitialized: isInitializedOPC } } = (0,payment/* useFastlaneInitializationOPC */.d)();
7830    const validateEmail = isOnePageCheckout ? validateFastlaneEmailOPC : multiStepFastlane.validateFastLaneEmail;
7831    const isInitialized = isOnePageCheckout ? isInitializedOPC : multiStepFastlane.status.isInitialized;
7832    const [isLoading, setIsLoading] = (0,react.useState)(false);
7833    const fastlaneConfigOPC = (0,hooks/* useAppSelector */.C)(onePageCheckoutPaymentSlice/* selectOnePageCheckoutFastlaneConfig */.EA);
7834    const { fastlaneConfig: fastlaneConfigMultiStep } = (0,hooks/* useAppSelector */.C)((state)=>state.payment);
7835    const fastlaneConfig = isOnePageCheckout ? fastlaneConfigOPC : fastlaneConfigMultiStep;
7836    // Get the authentication state
7837    const authenticationState = fastlaneConfig === null || fastlaneConfig === void 0 ? void 0 : (_fastlaneConfig_fastlaneAuthData = fastlaneConfig.fastlaneAuthData) === null || _fastlaneConfig_fastlaneAuthData === void 0 ? void 0 : _fastlaneConfig_fastlaneAuthData.authenticationState;
7838    const handleOnChange = debounce_default()(async (value)=>{
7839        if (!paymentContants/* isPaypalFastlaneCheckoutEnabled */._2) {
7840            setIsLoading(false);
7841            return;
7842        }
7843        const trimmedValue = value.trim();
7844        if (trimmedValue) {
7845            setIsLoading(true);
7846            try {
7847                await validateEmail(trimmedValue);
7848            } catch (error) {
7849                console.warn("Email validation failed:", error);
7850            } finally{
7851                setIsLoading(false);
7852            }
7853        } else {
7854            setIsLoading(false);
7855        }
7856    }, 500);
7857    (0,react.useEffect)(()=>{
7858        if (isInitialized || authenticationState || (fastlaneConfig === null || fastlaneConfig === void 0 ? void 0 : fastlaneConfig.guestUserEmail) || !paymentContants/* isPaypalFastlaneCheckoutEnabled */._2) {
7859            setIsLoading(false);
7860        } else {
7861            setIsLoading(true);
7862        }
7863    }, [
7864        authenticationState,
7865        isInitialized,
7866        fastlaneConfig === null || fastlaneConfig === void 0 ? void 0 : fastlaneConfig.guestUserEmail
7867    ]);
7868    return {
7869        isLoading,
7870        handleOnChange
7871    };
7872};
7873
7874;// CONCATENATED MODULE: ./src/components/checkout/forms/guest/Guest.tsx
7875
7876
7877
7878
7879
7880
7881
7882
7883const Guest = (param)=>{
7884    let { onSubmit, isOnePageCheckout } = param;
7885    const { isLoading, handleOnChange } = useGuest({
7886        isOnePageCheckout
7887    });
7888    const { getRecipientData } = (0,useRecipientData.useRecipientData)();
7889    const recipientData = getRecipientData();
7890    return /*#__PURE__*/ (0,jsx_runtime.jsx)(react_final_form_es.Form, {
7891        initialValues: recipientData ? {
7892            email: recipientData.email
7893        } : {},
7894        onSubmit: onSubmit,
7895        render: (param)=>{
7896            let { handleSubmit } = param;
7897            return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
7898                className: "form-container",
7899                children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("form", {
7900                    onSubmit: handleSubmit,
7901                    className: "form form--customer-login",
7902                    "aria-label": "checkout login form",
7903                    children: [
7904                        paymentContants/* isPaypalFastlaneCheckoutEnabled */._2 && /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
7905                            container: true,
7906                            spacing: 2,
7907                            marginBottom: 2,
7908                            children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Grid/* default */.ZP, {
7909                                item: true,
7910                                xs: 12,
7911                                children: /*#__PURE__*/ (0,jsx_runtime.jsx)(FormTextField/* default */.Z, {
7912                                    name: "email",
7913                                    type: "email",
7914                                    autoComplete: "email",
7915                                    formatOnBlur: false,
7916                                    label: "Email",
7917                                    showToolTip: false,
7918                                    placeholder: "Email",
7919                                    onChange: (e)=>handleOnChange(e.target.value),
7920                                    isDisabled: (recipientData === null || recipientData === void 0 ? void 0 : recipientData.email) ? true : false
7921                                })
7922                            })
7923                        }),
7924                        /*#__PURE__*/ (0,jsx_runtime.jsx)(ui/* Button */.zx, {
7925                            className: "action",
7926                            type: "submit",
7927                            disabled: isLoading,
7928                            children: isLoading ? "Loading" : "Continue"
7929                        })
7930                    ]
7931                })
7932            });
7933        }
7934    }, recipientData ? "with-recipient-data" : "default");
7935};
7936
7937;// CONCATENATED MODULE: ./src/components/checkout/forms/guest/index.ts
7938
7939
7940
7941// EXTERNAL MODULE: ./src/components/checkout/modals/ProductInventoryModal.tsx
7942var ProductInventoryModal = __webpack_require__(214413);
7943// EXTERNAL MODULE: ./src/components/providers/context/checkout/CheckoutProvider.tsx
7944var CheckoutProvider = __webpack_require__(98385);
7945// EXTERNAL MODULE: ./src/lib/hooks/index.ts + 13 modules
7946var lib_hooks = __webpack_require__(130414);
7947// EXTERNAL MODULE: ./src/lib/store/cartSlice.ts + 1 modules
7948var cartSlice = __webpack_require__(484725);
7949// EXTERNAL MODULE: ./src/lib/tracking/trackingEvents.ts + 1 modules
7950var trackingEvents = __webpack_require__(538933);
7951// EXTERNAL MODULE: ./src/lib/types/tracking.ts
7952var tracking = __webpack_require__(637938);
7953// EXTERNAL MODULE: ./src/lib/utils/cartUtils.tsx
7954var cartUtils = __webpack_require__(729890);
7955// EXTERNAL MODULE: ./src/lib/utils/snackbarHandlers.ts
7956var snackbarHandlers = __webpack_require__(921134);
7957;// CONCATENATED MODULE: ./src/components/checkout/auth/guest/AuthGuestContent.tsx
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971const AuthGuestContent = (param)=>{
7972    let { onGuestFormSubmit, isOnePageCheckout = false } = param;
7973    const { push } = (0,router.useRouter)();
7974    const { isLoggedIn } = (0,lib_hooks/* useCustomer */.ON)();
7975    const [showModal, setShowModal] = (0,react.useState)(false);
7976    const [disableButtons, setDisableButtons] = (0,react.useState)(false);
7977    const [guestEmail, setGuestEmail] = (0,react.useState)();
7978    const membershipLineItemAddedToTheCart = (0,hooks/* useAppSelector */.C)(cartSlice/* membershipLineItemInTheCartSelector */.fg);
7979    const goToDeliveryStep = ()=>{
7980        push("/checkout?step=".concat(CheckoutProvider/* CheckoutSteps */.bN.delivery));
7981    };
7982    const onSubmit = (param)=>{
7983        let { email: guestEmail } = param;
7984        if (membershipLineItemAddedToTheCart && !isLoggedIn) {
7985            setGuestEmail(guestEmail);
7986            setShowModal(true);
7987            return;
7988        }
7989        (0,trackingEvents/* GTMCheckoutAccountType */.Jj)(tracking/* CheckoutAccountType */.O.GUEST_CHECKOUT);
7990        // Conditional behavior: callback for one-page checkout, navigation for existing checkout
7991        if (isOnePageCheckout && onGuestFormSubmit) {
7992            onGuestFormSubmit({
7993                guestEmail
7994            });
7995        } else {
7996            goToDeliveryStep();
7997        }
7998    };
7999    const deleteMembershipItemAndContinueAsGuest = async ()=>{
8000        if (!membershipLineItemAddedToTheCart) return;
8001        const { sku } = membershipLineItemAddedToTheCart;
8002        setDisableButtons(true);
8003        try {
8004            await (0,cartUtils/* cartRemoveItem */.qH)(sku);
8005        } catch (error) {
8006            (0,snackbarHandlers/* axiosErrorHandler */.ri)({
8007                error,
8008                useResolvedMessages: true
8009            });
8010            throw error;
8011        } finally{
8012            setDisableButtons(false);
8013            setShowModal(false);
8014        }
8015        // Conditional behavior: callback for one-page checkout, navigation for existing checkout
8016        if (isOnePageCheckout && onGuestFormSubmit) {
8017            onGuestFormSubmit({
8018                guestEmail
8019            });
8020        } else {
8021            goToDeliveryStep();
8022        }
8023    };
8024    const modalTitle = "Membership Checkout";
8025    const modalDescription = "You have a membership item in your cart. Please log in to proceed with the checkout or delete the item to continue as a guest.";
8026    const unavailableItems = membershipLineItemAddedToTheCart && [
8027        membershipLineItemAddedToTheCart
8028    ];
8029    const onCancelButtonText = "Go back & Log In";
8030    const onConfirmButtonText = "Delete Memberhip Item & Continue as Guest";
8031    return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
8032        children: [
8033            /*#__PURE__*/ (0,jsx_runtime.jsx)(Guest, {
8034                onSubmit: onSubmit,
8035                isOnePageCheckout: isOnePageCheckout
8036            }),
8037            /*#__PURE__*/ (0,jsx_runtime.jsx)(ProductInventoryModal/* default */.Z, {
8038                areButtonsDisabled: disableButtons,
8039                itemsWereAlreadyRemoved: false,
8040                modalDescription: modalDescription,
8041                modalTitle: modalTitle,
8042                onCancelButtonLabel: onCancelButtonText,
8043                onConfirmButtonLabel: onConfirmButtonText,
8044                showModal: showModal,
8045                unavailableItems: unavailableItems,
8046                removeUnavailableItems: deleteMembershipItemAndContinueAsGuest,
8047                onCancel: ()=>setShowModal(false)
8048            })
8049        ]
8050    });
8051};
8052
8053;// CONCATENATED MODULE: ./src/components/checkout/auth/guest/AuthGuestHeader.tsx
8054
8055function AuthGuestHeader() {
8056    return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
8057        children: /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
8058            children: "Checkout as guest"
8059        })
8060    });
8061}
8062
8063;// CONCATENATED MODULE: ./src/components/checkout/auth/guest/index.ts
8064
8065
8066
8067// EXTERNAL MODULE: ./src/components/forms/forgotPasswordForm/ForgotPasswordForm.tsx
8068var ForgotPasswordForm = __webpack_require__(333573);
8069// EXTERNAL MODULE: ./src/components/forms/loginForm/LoginForm.tsx
8070var LoginForm = __webpack_require__(534696);
8071;// CONCATENATED MODULE: ./src/components/checkout/auth/login/AuthLoginContent.tsx
8072
8073
8074
8075
8076function AuthLoginContent() {
8077    const [showForgotPassword, setShowForgotPassword] = (0,react.useState)(false);
8078    const handleClickOnForgotPassword = ()=>{
8079        setShowForgotPassword(true);
8080    };
8081    const handleClickCancelForgotPassword = ()=>setShowForgotPassword(false);
8082    return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
8083        children: showForgotPassword ? /*#__PURE__*/ (0,jsx_runtime.jsx)(ForgotPasswordForm/* default */.Z, {
8084            onClickCancel: handleClickCancelForgotPassword,
8085            isCheckout: true
8086        }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(LoginForm/* default */.Z, {
8087            onClickForgotPassword: handleClickOnForgotPassword,
8088            isCheckout: true
8089        })
8090    });
8091}
8092
8093;// CONCATENATED MODULE: ./src/components/checkout/auth/login/AuthLoginHeader.tsx
8094
8095
8096function AuthLoginHeader(param) {
8097    let { isOnePageCheckout = false } = param;
8098    const title = "Login to wild fork";
8099    // const title = !isCan
8100    //   ? 'Login to wild fork'
8101    //   : isForgotPasswordFormActive
8102    //   ? t('checkout.auth.login.header.forgot_password_title')
8103    //   : t('checkout.auth.login.header.title');
8104    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
8105        className: isOnePageCheckout ? (AuthContainer_module_default())["login-header-one-page"] : undefined,
8106        children: [
8107            /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
8108                children: title
8109            }),
8110            /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
8111                children: "Login for a faster checkout."
8112            })
8113        ]
8114    });
8115}
8116
8117;// CONCATENATED MODULE: ./src/components/checkout/auth/login/index.ts
8118
8119
8120
8121// EXTERNAL MODULE: ./src/components/forms/registerForm/RegisterForm.tsx
8122var RegisterForm = __webpack_require__(375409);
8123;// CONCATENATED MODULE: ./src/components/checkout/auth/register/AuthRegisterContent.tsx
8124
8125
8126function AuthRegisterContent() {
8127    return /*#__PURE__*/ (0,jsx_runtime.jsx)(RegisterForm/* default */.Z, {
8128        isCheckout: true
8129    });
8130}
8131
8132;// CONCATENATED MODULE: ./src/components/checkout/auth/register/AuthRegisterHeader.tsx
8133
8134
8135function AuthRegisterHeader(param) {
8136    let { isOnePageCheckout = false } = param;
8137    return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
8138        className: isOnePageCheckout ? (AuthContainer_module_default())["login-header-one-page"] : undefined,
8139        children: [
8140            /*#__PURE__*/ (0,jsx_runtime.jsx)("h3", {
8141                children: "Sign up"
8142            }),
8143            /*#__PURE__*/ (0,jsx_runtime.jsx)("p", {
8144                children: "Get exclusive offers, recipes and more!"
8145            })
8146        ]
8147    });
8148}
8149
8150;// CONCATENATED MODULE: ./src/components/checkout/auth/register/index.ts
8151
8152
8153
8154;// CONCATENATED MODULE: ./src/components/checkout/auth/index.ts
8155
8156
8157
8158
8159
8160
8161/***/ }),
8162
8163/***/ 762664:
8164/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8165
8166"use strict";
8167/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
8168/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294);
8169/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(737827);
8170/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2__);
8171/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(626135);
8172/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_3__);
8173/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_hooks_useHomePath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(160073);
8174/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(221504);
8175/* harmony import */ var _Components_providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(98385);
8176/* harmony import */ var _Components_ui_Link_Link__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(317641);
8177/* harmony import */ var _Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(484725);
8178/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(267097);
8179/* harmony import */ var _Lib_store_uiStateSlice__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(647771);
8180/* harmony import */ var _OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(724614);
8181/* harmony import */ var _OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11__);
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194const OrderMinimumUnmet = (props)=>{
8195    const { isPickupAvailable, reason = "" } = props;
8196    const isMobileViewFromQueryParam = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__/* .useAppSelector */ .C)(_Lib_store_uiStateSlice__WEBPACK_IMPORTED_MODULE_10__/* .isMobileViewFromQueryParamOrCookieSelector */ .$k);
8197    const { amountToReachOrderMinimumFormatted, orderMinimumAmountFormatted } = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__/* .useAppSelector */ .C)(_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_8__/* .orderMinimumSelector */ .Id);
8198    const [homePath] = (0,_wildfork_commercetools_core_ui_dist_src_lib_hooks_useHomePath__WEBPACK_IMPORTED_MODULE_4__.useHomePath)();
8199    if ([
8200        "discount",
8201        "default"
8202    ].includes(reason)) {
8203        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_3__.Message, {
8204            show: true,
8205            variant: "error",
8206            className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default().message),
8207            children: [
8208                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8209                    className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default().message__header),
8210                    children: [
8211                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2__.MessageIcon, {
8212                            className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default().message__icon)
8213                        }),
8214                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2__.MessageContent, {
8215                            className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default().message__content),
8216                            children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_2__.MessageHeading, {
8217                                children: [
8218                                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
8219                                        children: [
8220                                            reason === "discount" ? "Uh-oh! The discount dropped your total below the ".concat(orderMinimumAmountFormatted, " minimum for delivery.") : "Uh-oh! Your order total is below the ".concat(orderMinimumAmountFormatted, " minimum for delivery."),
8221                                            "\xa0"
8222                                        ]
8223                                    }),
8224                                    "Add\xa0",
8225                                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8226                                        className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default()["message__content--bold"]),
8227                                        children: amountToReachOrderMinimumFormatted
8228                                    }),
8229                                    " ",
8230                                    "more",
8231                                    " ",
8232                                    isPickupAvailable ? "or switch to in-store pickup." : "to checkout."
8233                                ]
8234                            })
8235                        })
8236                    ]
8237                }),
8238                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8239                    className: (_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default()["message__content--links"]),
8240                    children: [
8241                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_Link_Link__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
8242                            href: homePath,
8243                            children: "Continue Shopping"
8244                        }),
8245                        isPickupAvailable && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_Link_Link__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
8246                            href: "/checkout?step=".concat(_Components_providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_6__/* .CheckoutSteps */ .bN.delivery),
8247                            children: "switch to pickup"
8248                        })
8249                    ]
8250                })
8251            ]
8252        });
8253    }
8254    // Default message for order minimum unmet that appears in the delivery accordion on the delivery page
8255    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8256        className: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_5__["default"])((_OrderMinimumUnmet_module_scss__WEBPACK_IMPORTED_MODULE_11___default()["order-minimum-unmet"])),
8257        children: [
8258            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
8259                children: [
8260                    "Add",
8261                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8262                        className: "red--text",
8263                        children: amountToReachOrderMinimumFormatted
8264                    }),
8265                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8266                        children: "to reach the order minimum of"
8267                    }),
8268                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8269                        className: "red--text",
8270                        children: orderMinimumAmountFormatted
8271                    })
8272                ]
8273            }),
8274            !isMobileViewFromQueryParam && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_Link_Link__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
8275                href: homePath,
8276                children: "Continue Shopping"
8277            })
8278        ]
8279    });
8280};
8281/* harmony default export */ __webpack_exports__.Z = (OrderMinimumUnmet);
8282
8283
8284/***/ }),
8285
8286/***/ 734103:
8287/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8288
8289"use strict";
8290/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8291/* harmony export */   n: function() { return /* reexport safe */ _useApiWindows__WEBPACK_IMPORTED_MODULE_0__.n; }
8292/* harmony export */ });
8293/* harmony import */ var _useApiWindows__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(541502);
8294
8295
8296
8297/***/ }),
8298
8299/***/ 541502:
8300/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8301
8302"use strict";
8303/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8304/* harmony export */   n: function() { return /* binding */ useApiWindows; }
8305/* harmony export */ });
8306/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(667294);
8307/* harmony import */ var _Api_checkoutApi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(451881);
8308/* harmony import */ var _Api_withAsync__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(715904);
8309/* harmony import */ var _Components_providers_context_delivery_DeliveryProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(427115);
8310/* harmony import */ var _Constants_snackbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(380254);
8311/* harmony import */ var _Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(221473);
8312/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(267097);
8313/* harmony import */ var _Lib_utils_kiosk__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(110845);
8314/* harmony import */ var _Utils_snackbarHandlers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(921134);
8315/* harmony import */ var _dbDeliveryDataTransformer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(672311);
8316
8317
8318
8319
8320// import AddShippingAddressService from "@Services/addShippingAddressService/AddShippingAddressService";
8321
8322
8323
8324
8325
8326
8327const useApiWindows = ()=>{
8328    const dispatch = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppDispatch */ .T)();
8329    const { resetSelectedAvailableDateAndTime, setAvailableWindows } = (0,_Components_providers_context_delivery_DeliveryProvider__WEBPACK_IMPORTED_MODULE_2__/* .useDelivery */ .qk)();
8330    const locale = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)((state)=>state.locale);
8331    const isKioskVisitor = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__/* .isKioskVisitorSelector */ .V_);
8332    const kioskLocationName = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_5__/* .useAppSelector */ .C)(_Lib_store_environmentSlice__WEBPACK_IMPORTED_MODULE_4__/* .selectKioskLocationName */ .L4);
8333    const deliveryWindowsRespIdTransformer = (availableDates)=>{
8334        var _availableDates_windows;
8335        const transformedResponse = availableDates === null || availableDates === void 0 ? void 0 : (_availableDates_windows = availableDates.windows) === null || _availableDates_windows === void 0 ? void 0 : _availableDates_windows.map((item)=>({
8336                ...item
8337            }));
8338        return transformedResponse !== null && transformedResponse !== void 0 ? transformedResponse : [];
8339    };
8340    const fetchWindows = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(async function() {
8341        let { storeId } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8342        const { response, error } = await (0,_Api_withAsync__WEBPACK_IMPORTED_MODULE_9__/* .withAsync */ .j)(()=>(0,_Api_checkoutApi__WEBPACK_IMPORTED_MODULE_1__/* .getAvailableWindows */ .hA)({
8343                storeId
8344            }));
8345        if (error) {
8346            (0,_Utils_snackbarHandlers__WEBPACK_IMPORTED_MODULE_7__/* .axiosErrorHandler */ .ri)({
8347                error,
8348                dispatch,
8349                useResolvedMessages: true,
8350                leadingSnackbar: {
8351                    heading: _Constants_snackbar__WEBPACK_IMPORTED_MODULE_3__/* .GENERIC_EVENT_ERR_HEADING */ .U3.REQUEST_FAILED(),
8352                    message: _Constants_snackbar__WEBPACK_IMPORTED_MODULE_3__/* .GENERIC_EVENT_ERR_MSG */ .vf.GET_WINDOWS()
8353                }
8354            });
8355            setAvailableWindows([]);
8356        } else {
8357            const transformedDeliveryWindows = deliveryWindowsRespIdTransformer(response === null || response === void 0 ? void 0 : response.data);
8358            const deliveryWindows = (0,_dbDeliveryDataTransformer__WEBPACK_IMPORTED_MODULE_8__/* .transformDbResponseForDeliveryPresentation */ .Cw)(transformedDeliveryWindows !== null && transformedDeliveryWindows !== void 0 ? transformedDeliveryWindows : [], locale === null || locale === void 0 ? void 0 : locale.languageCode);
8359            const filteredDeliveryWindows = !isKioskVisitor ? deliveryWindows : _Lib_utils_kiosk__WEBPACK_IMPORTED_MODULE_6__/* .filterDeliveryWindows */ .M(deliveryWindows, {
8360                kioskLocationName
8361            });
8362            setAvailableWindows(filteredDeliveryWindows);
8363            resetSelectedAvailableDateAndTime(filteredDeliveryWindows);
8364            return filteredDeliveryWindows;
8365        }
8366    }, [
8367        dispatch,
8368        setAvailableWindows,
8369        locale === null || locale === void 0 ? void 0 : locale.languageCode,
8370        isKioskVisitor,
8371        kioskLocationName,
8372        resetSelectedAvailableDateAndTime
8373    ]);
8374    return {
8375        fetchWindows
8376    };
8377};
8378
8379
8380/***/ }),
8381
8382/***/ 971973:
8383/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8384
8385"use strict";
8386/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8387/* harmony export */   $: function() { return /* binding */ NoWindowsAvailableMessage; }
8388/* harmony export */ });
8389/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
8390/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(737827);
8391/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1__);
8392/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(626135);
8393/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_2__);
8394/* harmony import */ var _Lib_utils_locale__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(225220);
8395
8396
8397
8398
8399const NoWindowsAvailableMessage = (param)=>{
8400    let { isKioskVisitor } = param;
8401    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_Message__WEBPACK_IMPORTED_MODULE_2__.Message, {
8402        show: true,
8403        variant: "error",
8404        children: [
8405            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1__.MessageIcon, {}),
8406            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1__.MessageContent, {
8407                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_ui_message_components__WEBPACK_IMPORTED_MODULE_1__.MessageHeading, {
8408                    children: isKioskVisitor ? (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_3__.t)("checkout.delivery_address.no_windows_available_kiosk") : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8409                        children: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_3__.t)("checkout.delivery_address.delivery_unavailable_message")
8410                    })
8411                })
8412            })
8413        ]
8414    });
8415};
8416
8417
8418/***/ }),
8419
8420/***/ 904510:
8421/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8422
8423"use strict";
8424/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8425/* harmony export */   G: function() { return /* binding */ CharacterCounter; }
8426/* harmony export */ });
8427/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
8428/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(221504);
8429/* harmony import */ var _CharacterLimit_module_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(578902);
8430/* harmony import */ var _CharacterLimit_module_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_CharacterLimit_module_scss__WEBPACK_IMPORTED_MODULE_2__);
8431
8432
8433
8434const CharacterCounter = (param)=>{
8435    let { current, max, className } = param;
8436    const isAtLimit = current === max;
8437    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8438        className: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_1__["default"])((_CharacterLimit_module_scss__WEBPACK_IMPORTED_MODULE_2___default()["character-count"]), className),
8439        children: [
8440            current,
8441            "/",
8442            max,
8443            isAtLimit && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8444                className: (_CharacterLimit_module_scss__WEBPACK_IMPORTED_MODULE_2___default()["limit-warning"]),
8445                children: "Maximum length reached"
8446            })
8447        ]
8448    });
8449};
8450
8451
8452/***/ }),
8453
8454/***/ 95469:
8455/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8456
8457"use strict";
8458
8459// EXPORTS
8460__webpack_require__.d(__webpack_exports__, {
8461  i: function() { return /* binding */ NewPhoneFieldWrapper; },
8462  u: function() { return /* binding */ PhoneFieldWrapper; }
8463});
8464
8465// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
8466var jsx_runtime = __webpack_require__(785893);
8467// EXTERNAL MODULE: ./node_modules/react/index.js
8468var react = __webpack_require__(667294);
8469// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/components/templates/FormContainer/formElements/PhoneField.js
8470var PhoneField = __webpack_require__(766444);
8471// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/utils/classNames.js
8472var classNames = __webpack_require__(221504);
8473// EXTERNAL MODULE: ./node_modules/react-final-form/dist/react-final-form.es.js
8474var react_final_form_es = __webpack_require__(166688);
8475// EXTERNAL MODULE: ./src/components/providers/context/core-ui/index.ts + 1 modules
8476var core_ui = __webpack_require__(737339);
8477// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/context/index.js
8478var context = __webpack_require__(93050);
8479// EXTERNAL MODULE: ./src/api/phoneLookupApi.ts
8480var phoneLookupApi = __webpack_require__(867576);
8481// EXTERNAL MODULE: ./src/api/twilio.ts
8482var twilio = __webpack_require__(94569);
8483// EXTERNAL MODULE: ./src/lib/configs/environment.ts
8484var environment = __webpack_require__(208891);
8485;// CONCATENATED MODULE: ./src/components/providers/context/core-ui/NewServiceContextProvider.tsx
8486
8487
8488
8489
8490
8491const defaultTwilioPhoneLookupHandler = async (phone)=>{
8492    if (!isTwilioPhoneLookupEnabled) return true;
8493    try {
8494        await (0,twilio/* twilioPhoneLookup */.P)({
8495            phoneNumber: phone,
8496            countryCode: "US"
8497        });
8498        return true;
8499    } catch (error) {
8500        return false;
8501    }
8502};
8503const defaultPhoneNumberValidationHandler = async (phone)=>{
8504    if (!environment.nextAppEnv.feature_toggle.US.twilioPhoneLookupProxy) return true;
8505    try {
8506        await (0,phoneLookupApi/* phoneNumberValidator */.x)({
8507            phoneNumber: phone,
8508            countryCode: "US"
8509        });
8510        return true;
8511    } catch (error) {
8512        return false;
8513    }
8514};
8515const NewServiceContextProvider = (param)=>{
8516    let { children, twilioPhoneLookupHandler = defaultTwilioPhoneLookupHandler } = param;
8517    const phoneNumberValidationHandler = defaultPhoneNumberValidationHandler;
8518    const contextValue = {
8519        twilioPhoneLookup: twilioPhoneLookupHandler,
8520        phoneNumberValidator: phoneNumberValidationHandler
8521    };
8522    return /*#__PURE__*/ (0,jsx_runtime.jsx)(context.ServiceContext.Provider, {
8523        value: contextValue,
8524        children: children
8525    });
8526};
8527const isTwilioPhoneLookupEnabled = environment.nextAppEnv.feature_toggle.US.twilioPhoneLookup;
8528
8529// EXTERNAL MODULE: ./src/lib/utils/locale.ts + 2 modules
8530var locale = __webpack_require__(225220);
8531// EXTERNAL MODULE: ./src/components/checkout/forms/shared/PhoneField.module.scss
8532var PhoneField_module = __webpack_require__(348736);
8533var PhoneField_module_default = /*#__PURE__*/__webpack_require__.n(PhoneField_module);
8534;// CONCATENATED MODULE: ./src/components/checkout/forms/shared/PhoneFieldWrapper.tsx
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544const PhoneFieldWrapper = (props)=>{
8545    const { placeholder, required, onChange, twilioPhoneLookupHandler, autoComplete, skipValidate, formType = "shipping" } = props;
8546    return /*#__PURE__*/ (0,jsx_runtime.jsx)(core_ui/* ServiceContextProvider */.E3, {
8547        twilioPhoneLookupHandler: twilioPhoneLookupHandler,
8548        children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PhoneField.PhoneField, {
8549            className: (0,classNames["default"])((PhoneField_module_default())["phone-field"], required && (PhoneField_module_default())["phone-field--required"]),
8550            name: "phone",
8551            autoComplete: autoComplete || "on",
8552            label: "Phone",
8553            Field: react_final_form_es.Field,
8554            skipValidate: skipValidate,
8555            onChange: (phone)=>{
8556                onChange === null || onChange === void 0 ? void 0 : onChange(phone);
8557            },
8558            contentTranslation: {
8559                placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,locale.t)("checkout.address_form.place_holders.phone"),
8560                invalidPhone: (0,locale.t)("customer.form_errors.invalid_phone")
8561            },
8562            formType: formType
8563        })
8564    });
8565};
8566const NewPhoneFieldWrapper = (props)=>{
8567    const { placeholder, required, onChange, twilioPhoneLookupHandler, autoComplete, skipValidate } = props;
8568    return /*#__PURE__*/ (0,jsx_runtime.jsx)(NewServiceContextProvider, {
8569        twilioPhoneLookupHandler: twilioPhoneLookupHandler,
8570        children: /*#__PURE__*/ (0,jsx_runtime.jsx)(PhoneField.PhoneField, {
8571            className: (0,classNames["default"])((PhoneField_module_default())["phone-field"], required && (PhoneField_module_default())["phone-field--required"]),
8572            name: "phone",
8573            autoComplete: autoComplete || "on",
8574            label: "Phone",
8575            Field: react_final_form_es.Field,
8576            skipValidate: skipValidate,
8577            onChange: (phone)=>{
8578                onChange === null || onChange === void 0 ? void 0 : onChange(phone);
8579            },
8580            contentTranslation: {
8581                placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,locale.t)("checkout.address_form.place_holders.phone"),
8582                invalidPhone: (0,locale.t)("customer.form_errors.invalid_phone")
8583            }
8584        })
8585    });
8586};
8587
8588
8589/***/ }),
8590
8591/***/ 722857:
8592/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8593
8594"use strict";
8595/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
8596/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294);
8597/* harmony import */ var _mui_icons_material_InfoOutlined__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(402548);
8598/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(221504);
8599/* harmony import */ var _Components_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(836455);
8600/* harmony import */ var _Components_ui_modal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(589863);
8601/* harmony import */ var _AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(242124);
8602/* harmony import */ var _AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5__);
8603
8604
8605
8606
8607
8608
8609
8610const AddressVerificationModal = (param)=>{
8611    let { isOpen, onSubmit, isSubmitting, onClose, verifiedAddress, isEnteredAddrVerificationStatusFailed, setUseVerifiedAddress, userEnteredAddress, isUserEnteredAddressValid = true, contentTranslation = {
8612        verifyAddress: "VERIFY ADDRESS",
8613        selectSuggestions: " Select one of the following:",
8614        recommended: "RECOMMENDED",
8615        entered: "YOU ENTERED",
8616        couldNotVerifyError: "We could not verify your address. Check for any errors or missing information, such as apartment number.",
8617        edit: "Edit",
8618        useUnverifiedAddress: "Use unverified address",
8619        editAddress: "Edit Address",
8620        continue: "Continue"
8621    }, isCheckout } = param;
8622    var _userEnteredAddress_address2, _userEnteredAddress_address21;
8623    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_modal__WEBPACK_IMPORTED_MODULE_4__/* .Modal */ .u, {
8624        show: isOpen,
8625        onClose: onClose,
8626        contentClassName: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-ver
8626ification-modal__content"]),
8627        onCloseOuterClick: false,
8628        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8629            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__body"]),
8630            children: [
8631                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
8632                    children: [
8633                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h2", {
8634                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__title"]),
8635                            children: contentTranslation.verifyAddress
8636                        }),
8637                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
8638                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__subtitle"]),
8639                            children: [
8640                                "Using an unverified address may cause delivery issues.",
8641                                !isEnteredAddrVerificationStatusFailed && contentTranslation.selectSuggestions
8642                            ]
8643                        })
8644                    ]
8645                }),
8646                verifiedAddress && !isEnteredAddrVerificationStatusFailed ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("label", {
8647                    htmlFor: "recommended-address",
8648                    children: [
8649                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", {
8650                            id: "recommended-address",
8651                            name: "verified-addresses",
8652                            type: "radio",
8653                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["input-radio"]),
8654                            onChange: ()=>setUseVerifiedAddress(true),
8655                            defaultChecked: true
8656                        }),
8657                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8658                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__card"]),
8659                            children: [
8660                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8661                                    className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__card-title"]),
8662                                    children: contentTranslation.recommended
8663                                }),
8664                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8665                                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8666                                        children: highlightWordDifferences(userEnteredAddress.address1, verifiedAddress.address1.toLowerCase().replace(((_userEnteredAddress_address2 = userEnteredAddress.address2) === null || _userEnteredAddress_address2 === void 0 ? void 0 : _userEnteredAddress_address2.toLowerCase()) || "", ""))
8667                                    })
8668                                }),
8669                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8670                                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8671                                        children: highlightWordDifferences(//NOTE: Extracting address2 from the API address1
8672                                        findExtraSubstring(verifiedAddress.address1.toLowerCase().replace(((_userEnteredAddress_address21 = userEnteredAddress.address2) === null || _userEnteredAddress_address21 === void 0 ? void 0 : _userEnteredAddress_address21.toLowerCase()) || "", ""), verifiedAddress.address1.toLowerCase()), userEnteredAddress.address2)
8673                                    })
8674                                }),
8675                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8676                                    children: [
8677                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8678                                            children: highlightWordDifferences(userEnteredAddress.city, verifiedAddress.city)
8679                                        }),
8680                                        ",",
8681                                        " ",
8682                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8683                                            children: highlightWordDifferences(userEnteredAddress.state, verifiedAddress.state)
8684                                        })
8685                                    ]
8686                                }),
8687                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8688                                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8689                                        children: highlightWordDifferences(userEnteredAddress.postalCode, verifiedAddress.postalCode)
8690                                    })
8691                                })
8692                            ]
8693                        })
8694                    ]
8695                }) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8696                    className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-ver
8696ification-modal__error-card"]),
8697                    children: [
8698                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mui_icons_material_InfoOutlined__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {}),
8699                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8700                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__error-card__message"]),
8701                            children: contentTranslation.couldNotVerifyError
8702                        })
8703                    ]
8704                }),
8705                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("label", {
8706                    htmlFor: "entered-address",
8707                    children: [
8708                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", {
8709                            id: "entered-address",
8710                            name: "verified-addresses",
8711                            type: "radio",
8712                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["input-radio"]),
8713                            onChange: ()=>setUseVerifiedAddress(false),
8714                            defaultChecked: isEnteredAddrVerificationStatusFailed
8715                        }),
8716                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8717                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__card"]),
8718                            children: [
8719                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8720                                    className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__card-title"]),
8721                                    children: [
8722                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
8723                                            children: [
8724                                                " ",
8725                                                contentTranslation.entered
8726                                            ]
8727                                        }),
8728                                        !isEnteredAddrVerificationStatusFailed && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8729                                            className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__card-edit-text-button"]),
8730                                            onClick: ()=>onClose(),
8731                                            children: contentTranslation.edit
8732                                        })
8733                                    ]
8734                                }),
8735                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8736                                    children: userEnteredAddress.address1
8737                                }),
8738                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8739                                    children: userEnteredAddress.address2
8740                                }),
8741                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
8742                                    children: [
8743                                        userEnteredAddress.city,
8744                                        ", ",
8745                                        userEnteredAddress.state
8746                                    ]
8747                                }),
8748                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8749                                    children: userEnteredAddress.postalCode
8750                                })
8751                            ]
8752                        })
8753                    ]
8754                }),
8755                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
8756                    className: (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-ver
8756ification-modal__footer"]),
8757                    children: isEnteredAddrVerificationStatusFailed ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
8758                        children: [
8759                            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .zx, {
8760                                type: "button",
8761                                className: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_2__["default"])((_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__button"]), "action action--secondary"),
8762                                onClick: isCheckout ? ()=>onClose(true) : ()=>onSubmit(),
8763                                disabled: !isUserEnteredAddressValid || isSubmitting,
8764                                children: contentTranslation.useUnverifiedAddress
8765                            }),
8766                            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .zx, {
8767                                type: "button",
8768                                className: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_2__["default"])("action action--primary", (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__button"])),
8769                                onClick: ()=>onClose(),
8770                                disabled: !isUserEnteredAddressValid || isSubmitting,
8771                                children: contentTranslation.editAddress
8772                            })
8773                        ]
8774                    }) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .zx, {
8775                        type: "button",
8776                        className: (0,_wildfork_commercetools_core_ui_dist_src_lib_utils_classNames__WEBPACK_IMPORTED_MODULE_2__["default"])("action action--primary", (_AddressVerificationModal_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["address-verification-modal__button"])),
8777                        onClick: ()=>onSubmit(),
8778                        disabled: !isUserEnteredAddressValid || isSubmitting,
8779                        children: contentTranslation.continue
8780                    })
8781                })
8782            ]
8783        })
8784    });
8785};
8786/* harmony default export */ __webpack_exports__.Z = (AddressVerificationModal);
8787const highlightWordDifferences = function() {
8788    let originalString = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", comparisonString = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
8789    const originalWords = originalString.split(" ");
8790    const comparisonWords = comparisonString.split(" ");
8791    return comparisonWords.map(function() {
8792        let word = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", index = arguments.length > 1 ? arguments[1] : void 0;
8793        var _originalWords_index;
8794        const originalWord = originalWords === null || originalWords === void 0 ? void 0 : (_originalWords_index = originalWords[index]) === null || _originalWords_index === void 0 ? void 0 : _originalWords_index.toLocaleLowerCase();
8795        const comparisonWord = word.toLocaleLowerCase();
8796        if (index >= originalWords.length || originalWord !== comparisonWord) {
8797            return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("b", {
8798                children: [
8799                    " ",
8800                    word
8801                ]
8802            }, index);
8803        }
8804        return " ".concat(word);
8805    });
8806};
8807// const highlightCityDifferences = (
8808//   userEnteredCity: string,
8809//   verifiedCity: string
8810// ) => {
8811//   const correctedCity =
8812//     userEnteredCity.toLowerCase() !== verifiedCity.toLowerCase()
8813//       ? userEnteredCity
8814//       : verifiedCity;
8815//   return <b>{correctedCity.toUpperCase()}</b>;
8816// };
8817/**
8818 * The function `findExtraSubstring` compares two strings and returns the extra substring present in
8819 * @param {string} [baseString] - The `baseString` parameter is a string that serves as the base for
8820 * @param {string} [compareString] - The `compareString` parameter is a string that will be compared to
8821 * @returns {string}
8822 */ const findExtraSubstring = function() {
8823    let baseString = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", compareString = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
8824    if (compareString.startsWith(baseString)) {
8825        return compareString.slice(baseString.length);
8826    } else {
8827        return compareString === compareString.toUpperCase() ? compareString.toUpperCase() : compareString;
8828    }
8829};
8830
8831
8832/***/ }),
8833
8834/***/ 214413:
8835/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8836
8837"use strict";
8838/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
8839/* harmony import */ var _mui_icons_material_Close__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(450594);
8840/* harmony import */ var _mui_material_IconButton__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(554799);
8841/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_atoms_buttons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143862);
8842/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_components_atoms_buttons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_components_atoms_buttons__WEBPACK_IMPORTED_MODULE_1__);
8843/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_constants_commons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(820523);
8844/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(101914);
8845/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_3__);
8846/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(741664);
8847/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_link__WEBPACK_IMPORTED_MODULE_4__);
8848/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(811163);
8849/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_5__);
8850/* harmony import */ var _Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(336930);
8851/* harmony import */ var _Components_ui_modal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(589863);
8852/* harmony import */ var _Lib_utils_cartUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(729890);
8853/* harmony import */ var _Lib_utils_locale__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(225220);
8854/* harmony import */ var _Lib_utils_routerUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(664169);
8855/* harmony import */ var _ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(79539);
8856/* harmony import */ var _ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12__);
8857/* harmony import */ var _cartLineItem_CartLineItemImage__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(3197);
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873const ProductInventoryModal = (param)=>{
8874    let { areButtonsDisabled = false, restrictedStateItems, unavailableItems: itemsOutOfStock, itemsWereAlreadyRemoved = false, modalTitle, modalDe
8874scription, showModal, onCancelButtonLabel, onConfirmButtonLabel, removeUnavailableItems, onCancel, continueCheckoutRestrictedStates, keepShoppingRestrictedStates, defunctItemDescription } = param;
8875    const router = (0,next_router__WEBPACK_IMPORTED_MODULE_5__.useRouter)();
8876    const { asPath, push } = router;
8877    const joinClass = [
8878        "inventory-problems__controls-action",
8879        (_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-btn"])
8880    ].join(" ").trim();
8881    let ActionButtons;
8882    // ACTION BUTTONS - ONLY FOR CHECKOUT SECTION
8883    if ((itemsOutOfStock === null || itemsOutOfStock === void 0 ? void 0 : itemsOutOfStock.length) && !(restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length)) {
8884        if (itemsWereAlreadyRemoved) {
8885            ActionButtons = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__/* .Button */ .z, {
8886                disabled: areButtonsDisabled,
8887                type: "button",
8888                className: "".concat(joinClass),
8889                onClick: onCancel,
8890                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8891                    children: onCancelButtonLabel
8892                })
8893            });
8894        } else {
8895            ActionButtons = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
8896                children: [
8897                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__/* .Button */ .z, {
8898                        disabled: areButtonsDisabled,
8899                        type: "button",
8900                        className: "".concat(joinClass, " ").concat((_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-btn-remove"])),
8901                        onClick: removeUnavailableItems,
8902                        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8903                            children: onConfirmButtonLabel
8904                        })
8905                    }),
8906                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__/* .Button */ .z, {
8907                        disabled: areButtonsDisabled,
8908                        type: "button",
8909                        className: joinClass,
8910                        onClick: onCancel,
8911                        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8912                            children: onCancelButtonLabel
8913                        })
8914                    })
8915                ]
8916            });
8917        }
8918    // restricted state scenario
8919    } else {
8920        ActionButtons = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
8921            children: [
8922                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__/* .Button */ .z, {
8923                    disabled: areButtonsDisabled,
8924                    type: "button",
8925                    className: joinClass,
8926                    onClick: async ()=>{
8927                        try {
8928                            await (removeUnavailableItems ? removeUnavailableItems() : handleRestrictedItemsRemoval(restrictedStateItems));
8929                        } catch (error) {
8930                            _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_3___default().error("Error removing items from cart", error);
8931                        }
8932                        continueCheckoutRestrictedStates === null || continueCheckoutRestrictedStates === void 0 ? void 0 : continueCheckoutRestrictedStates();
8933                    },
8934                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8935                        children: "".concat((0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_9__.t)("checkout.payment.product_inventory.continue_checkout"))
8936                    })
8937                }),
8938                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wildfork_commercetools_core_ui_dist_src_components_atoms_buttons__WEBPACK_IMPORTED_MODULE_1__.WFButton, {
8939                    variant: "text",
8940                    onClick: async ()=>{
8941                        try {
8942                            await (removeUnavailableItems ? removeUnavailableItems() : handleRestrictedItemsRemoval(restr
8942ictedStateItems));
8943                        } catch (error) {
8944                            _wildfork_commercetools_core_ui_dist_src_lib_utils_Logger__WEBPACK_IMPORTED_MODULE_3___default().error("Error removing items from cart", error);
8945                        }
8946                        keepShoppingRestrictedStates ? keepShoppingRestrictedStates() : push(_wildfork_commercetools_core_ui_dist_src_lib_constants_commons__WEBPACK_IMPORTED_MODULE_2__.PATHS.HOME);
8947                    },
8948                    className: "".concat((_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-secondary-button"])),
8949                    children: "".concat((0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_9__.t)("checkout.payment.product_inventory.keep_shopping"))
8950                })
8951            ]
8952        });
8953    }
8954    // ACTION BUTTONS - OUTSIDE CHECKOUT SECTION
8955    const handleRestrictedItemsRemoval = async function() {
8956        let restrictedItems = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
8957        try {
8958            // For restristed state items, remove them from cart.
8959            // important to remove them one by one to ensure the cart is updated correctly.
8960            if (restrictedItems === null || restrictedItems === void 0 ? void 0 : restrictedItems.length) {
8961                for (const restrictedItem of restrictedItems){
8962                    await (0,_Lib_utils_cartUtils__WEBPACK_IMPORTED_MODULE_8__/* .cartRemoveItem */ .qH)(restrictedItem.sku);
8963                }
8964            }
8965            // For already OOS removed items, dispatch actions to clear the array in Redux.
8966            onCancel === null || onCancel === void 0 ? void 0 : onCancel();
8967        } catch (error) {
8968            throw error;
8969        }
8970    };
8971    if (((itemsOutOfStock === null || itemsOutOfStock === void 0 ? void 0 : itemsOutOfStock.length) || (restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length)) && !asPath.includes("checkout")) {
8972        ActionButtons = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_buttons_button__WEBPACK_IMPORTED_MODULE_6__/* .Button */ .z, {
8973            disabled: areButtonsDisabled,
8974            type: "button",
8975            className: "".concat(joinClass, " ").concat((_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-btn"])),
8976            onClick: ()=>handleRestrictedItemsRemoval(restrictedStateItems),
8977            children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
8978                children: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_9__.t)("checkout.payment.product_inventory.keep_shopping")
8979            })
8980        });
8981    }
8982    const isAccountOrderPageWithItems = ((itemsOutOfStock === null || itemsOutOfStock === void 0 ? void 0 : itemsOutOfStock.length) || (restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length)) && (0,_Lib_utils_routerUtils__WEBPACK_IMPORTED_MODULE_10__/* .isAccountOrdersPage */ .em)(router);
8983    const isAccountOrderPageWithOnlyDefunctItems = !(itemsOutOfStock === null || itemsOutOfStock === void 0 ? void 0 : itemsOutOfStock.length) && !(restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) && defunctItemDescription && (0,_Lib_utils_routerUtils__WEBPACK_IMPORTED_MODULE_10__/* .isAccountOrdersPage */ .em)(router);
8984    if (isAccountOrderPageWithItems || isAccountOrderPageWithOnlyDefunctItems) {
8985        ActionButtons = null;
8986    }
8987    const allRemovedItems = [
8988        ...(restrictedStateItems === null || restrictedStateItems === void 0 ? void 0 : restrictedStateItems.length) ? restrictedStateItems : [],
8989        ...(itemsOutOfStock === null || itemsOutOfStock === void 0 ? void 0 : itemsOutOfStock.length) ? itemsOutOfStock : []
8990    ];
8991    // ActionButtons =
8992    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Components_ui_modal__WEBPACK_IMPORTED_MODULE_7__/* .Modal */ .u, {
8993        show: showModal,
8994        onClose: ()=>onCancel === null || onCancel === void 0 ? void 0 : onCancel(),
8995        contentClassName: "".concat((_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-modal"]), " inventory-problems"),
8996        withCloseIcon: false,
8997        onCloseOuterClick: false,
8998        className: (_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-modal-layout"]),
8999        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
9000            className: "inventory-problems",
9001            children: [
9002                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
9003                    children: [
9004                        (isAccountOrderPageWithItems || isAccountOrderPageWithOnlyDefunctItems) && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
9005                            className: "close-icon-button",
9006                            children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mui_material_IconButton__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
9007                                onClick: onCancel,
9008                                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mui_icons_material_Close__WEBPACK_IMPORTED_MODULE_14__["default"], {
9009                                    fontSize: "small"
9010                                })
9011                            })
9012                        }),
9013                        !isAccountOrderPageWithOnlyDefunctItems && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
9014                            children: [
9015                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
9016                                    children: [
9017                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h2", {
9018                                            className: "inventory-problems__heading",
9019                                            children: modalTitle
9020                                        }),
9021                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", {
9022                                            className: (_ProductInventoryModal_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["product-inventory-desc"]),
9023                                            children: modalDescription
9024                                        })
9025                                    ]
9026                                }),
9027                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
9028                                    className: "inventory-problems__items",
9029                                    children: allRemovedItems === null || allRemovedItems === void 0 ? void 0 : allRemovedItems.map((item)=>{
9030                                        const linkToSlug = (0,_Lib_utils_cartUtils__WEBPACK_IMPORTED_MODULE_8__/* .generateLinkToLineItem */ .D4)(item);
9031                                        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
9032                                            className: "inventory-problems__items-item",
9033                                            children: [
9034                                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
9035                                                    className: "inventory-problems__items-item-image",
9036                                                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_cartLineItem_CartLineItemImage__WEBPACK_IMPORTED_MODULE_11__/* .CartLineItemImage */ .K, {
9037                                                        joinClass: "checkout",
9038                                                        item: item,
9039                                                        isReadOnly: false,
9040                                                        linkToSlug: linkToSlug,
9041                                                        imageStyle: {
9042                                                            width: 72,
9043                                                            height: 72
9044                                                        }
9045                                                    })
9046                                                }),
9047                                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_link__WEBPACK_IMPORTED_MODULE_4___default()), {
9048                                                    href: linkToSlug,
9049                                                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h1", {
9050                                                        className: "inventory-problems__items-item-title",
9051                                                        children: item === null || item === void 0 ? void 0 : item.name
9052                                                    })
9053                                                })
9054                                            ]
9055                                        }, item.sku);
9056                                    })
9057                                })
9058                            ]
9059                        }),
9060                        defunctItemDescription && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h2", {
9061                            className: "inventory-problems__heading defunct_description",
9062                            children: defunctItemDescription
9063                        })
9064                    ]
9065                }),
9066                ActionButtons && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
9067                    className: "inventory-problems__controls",
9068                    children: ActionButtons
9069                })
9070            ]
9071        })
9072    });
9073};
9074/* harmony default export */ __webpack_exports__.Z = (ProductInventoryModal);
9075
9076
9077/***/ }),
9078
9079/***/ 556986:
9080/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9081
9082"use strict";
9083/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9084/* harmony export */   F: function() { return /* binding */ MembershipTermsConsent; }
9085/* harmony export */ });
9086/* unused harmony export UserAcceptanceTerms */
9087/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
9088/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294);
9089/* harmony import */ var _wildfork_commercetools_core_ui_dist_src_lib_constants_commons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(820523);
9090/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(741664);
9091/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_link__WEBPACK_IMPORTED_MODULE_3__);
9092/* harmony import */ var _Components_providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98385);
9093/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(208891);
9094/* harmony import */ var _Lib_hooks_useMonthlyMembershipRate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(950169);
9095/* harmony import */ var _Lib_hooks_useYearlyMembershipRate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(239610);
9096/* harmony import */ var _Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(484725);
9097/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(267097);
9098/* harmony import */ var _Lib_store_zipcodeSlice__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(480326);
9099/* harmony import */ var _Lib_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(71486);
9100/* harmony import */ var _MembershipTermsConsent_module_scss__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(136119);
9101/* harmony import */ var _MembershipTermsConsent_module_scss__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_MembershipTermsConsent_module_scss__WEBPACK_IMPORTED_MODULE_12__);
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115const MembershipTermsConsent = (param)=>{
9116    let { acceptTerms, textOnly = false, highlightClassName } = param;
9117    const membershipItem = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__/* .useAppSelector */ .C)(_Lib_store_cartSlice__WEBPACK_IMPORTED_MODULE_8__/* .membershipLineItemInTheCartSelector */ .fg);
9118    const { regionId } = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_9__/* .useAppSelector */ .C)(_Lib_store_zipcodeSlice__WEBPACK_IMPORTED_MODULE_10__/* .ZipCodeSelector */ .pz);
9119    const { rate: monthlyMembershipRateFromHook } = (0,_Lib_hooks_useMonthlyMembershipRate__WEBPACK_IMPORTED_MODULE_6__/* .useMonthlyMembershipRate */ .W)(regionId);
9120    const { rate: yearlyMembershipRateFromHook } = (0,_Lib_hooks_useYearlyMembershipRate__WEBPACK_IMPORTED_MODULE_7__/* .useYearlyMembershipRate */ .b)(regionId);
9121    const { membershipAgreementChecked, setMembershipAgreementChecked } = (0,_Components_providers_context_checkout_CheckoutProvider__WEBPACK_IMPORTED_MODULE_4__/* .useCheckout */ .Mg)();
9122    (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
9123        if (textOnly) return undefined;
9124        return ()=>{
9125            setMembershipAgreementChecked(false);
9126        };
9127    }, [
9128        textOnly,
9129        setMembershipAgreementChecked
9130    ]);
9131    const { monthlyMembershipRate, yearlyMembershipRate } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>{
9132        var _ref;
9133        const defaultMonthly = (_ref = monthlyMembershipRateFromHook !== null && monthlyMembershipRateFromHook !== void 0 ? monthlyMembershipRateFromHook : _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_5__.nextAppEnv.application.monthlyMembershipRate) !== null && _ref !== void 0 ? _ref : "";
9134        var _ref1;
9135        const defaultYearly = (_ref1 = yearlyMembershipRateFromHook !== null && yearlyMembershipRateFromHook !== void 0 ? yearlyMembershipRateFromHook : _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_5__.nextAppEnv.application.annualMembershipRate) !== null && _ref1 !== void 0 ? _ref1 : "—";
9136        const isMonthlySku = (membershipItem === null || membershipItem === void 0 ? void 0 : membershipItem.sku) === _wildfork_commercetools_core_ui_dist_src_lib_constants_commons__WEBPACK_IMPORTED_MODULE_2__.MEMBERSHIP_CONSTANTS.SKU.MONTHLY;
9137        const cartPriceDollars = membershipItem && typeof membershipItem.totalPrice === "number" ? _Lib_utils__WEBPACK_IMPORTED_MODULE_11__/* .currency.convertToDollar */ .Aq.convertToDollar(membershipItem.totalPrice) : null;
9138        const cartRateFormatted = typeof cartPriceDollars === "number" && !Number.isNaN(cartPriceDollars) ? cartPriceDollars.toFixed(2) : "";
9139        if (isMonthlySku && cartRateFormatted) {
9140            return {
9141                monthlyMembershipRate: cartRateFormatted,
9142                yearlyMembershipRate: defaultYearly
9143            };
9144        }
9145        if (!isMonthlySku && cartRateFormatted) {
9146            return {
9147                monthlyMembershipRate: defaultMonthly,
9148                yearlyMembershipRate: cartRateFormatted
9149            };
9150        }
9151        return {
9152            monthlyMembershipRate: defaultMonthly,
9153            yearlyMembershipRate: defaultYearly
9154        };
9155    }, [
9156        membershipItem,
9157        monthlyMembershipRateFromHook,
9158        yearlyMembershipRateFromHook
9159    ]);
9160    const termsContent = acceptTerms !== null && acceptTerms !== void 0 ? acceptTerms : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(UserAcceptanceTerms, {
9161        monthlyMembershipRate: monthlyMembershipRate,
9162        yearlyMembershipRate: yearlyMembershipRate,
9163        highlightClassName: highlightClassName,
9164        omitPriceInSubscriptionDetails: textOnly
9165    });
9166    if (textOnly) return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
9167        children: termsContent
9168    });
9169    if (!membershipItem) return null;
9170    const handleCheckboxChange = ()=>{
9171        setMembershipAgreementChecked((prevState)=>!prevState);
9172    };
9173    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
9174        className: "".concat((_MembershipTermsConsent_module_scss__WEBPACK_IMPORTED_MODULE_12___default()["membership-terms-consent"]), " form__field form__field--checkbox"),
9175        children: [
9176            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", {
9177                type: "checkbox",
9178                id: "membership-agreement",
9179                name: "membership-agreement",
9180                checked: membershipAgreementChecked,
9181                onChange: handleCheckboxChange
9182            }),
9183            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("label", {
9184                htmlFor: "membership-agreement",
9185                children: termsContent
9186            })
9187        ]
9188    });
9189};
9190const SUBSCRIPTION_DETAILS_WITHOUT_PRICE = "I understand that: (1) my subscription will automatically renew at the same price and in the same frequency as my current subscription; (2) my subscription will continue until I cancel it; (3) the renewal charges will be charged to the same debit or credit card I am using now; and (4) I may cancel my subscription at any time, subject to the cancellation policy set forth in the";
9191var _nextAppEnv_application_monthlyMembershipRate, _nextAppEnv_application_annualMembershipRate;
9192const UserAcceptanceTerms = (param)=>{
9193    let { contentTranslation, monthlyMembershipRate = (_nextAppEnv_application_monthlyMembershipRate = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_5__.nextAppEnv.application.monthlyMembershipRate) !== null && _nextAppEnv_application_monthlyMembershipRate !== void 0 ? _nextAppEnv_application_monthlyMembershipRate : "", yearlyMembershipRate = (_nextAppEnv_application_annualMembershipRate = _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_5__.nextAppEnv.application.annualMembershipRate) !== null && _nextAppEnv_application_annualMembershipRate !== void 0 ? _nextAppEnv_application_annualMembershipRate : "", omitPriceInSubscriptionDetails = false, highlightClassName } = param;
9194    const yearlyRateForDisplay = yearlyMembershipRate != null && String(yearlyMembershipRate).trim() !== "" ? String(yearlyMembershipRate) : "";
9195    const subscriptionDetailsWithPrice = "I understand that: (1) my subscription will automatically renew at the same price and in the same frequency as my current subscription (either $".concat(monthlyMembershipRate, " per month for monthly subscriptions or $").concat(yearlyRateForDisplay || "—", " per annum for annual subscriptions); (2) my subscription will continue until I cancel it; (3) the renewal charges will be charged to the same debit or credit card I am using now; and (4) I may cancel my subscription at any time, subject to the cancellation policy set forth in the");
9196    const subscriptionDetails = omitPriceInSubscriptionDetails ? SUBSCRIPTION_DETAILS_WITHOUT_PRICE : subscriptionDetailsWithPrice;
9197    const defaultContentTranslation = {
9198        acknowledgment: "By checking this box, I acknowledge and agree that I am signing up for an automatically renewing subscription.",
9199        subscriptionDetails,
9200        link: "Wild Fork Unlimited Terms and Conditions – Wild Fork Foods",
9201        ariaLabel: "Open Wild Fork Unlimited Terms and Conditions in a new tab"
9202    };
9203    const resolvedContentTranslation = contentTranslation !== null && contentTranslation !== void 0 ? contentTranslation : defaultContentTranslation;
9204    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
9205        children: [
9206            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
9207                children: [
9208                    resolvedContentTranslation.acknowledgment,
9209                    " "
9210                ]
9211            }),
9212            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
9213                className: highlightClassName !== null && highlightClassName !== void 0 ? highlightClassName : (_MembershipTermsConsent_module_scss__WEBPACK_IMPORTED_MODULE_12___default().highlight),
9214                children: [
9215                    resolvedContentTranslation.subscriptionDetails,
9216                    " ",
9217                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_link__WEBPACK_IMPORTED_MODULE_3___default()), {
9218                        href: "/wild-fork-unlimited-terms-and-conditions/",
9219                        target: "_blank",
9220                        "aria-label": resolvedContentTranslation.ariaLabel,
9221                        children: resolvedContentTranslation.link
9222                    }),
9223                    '."'
9224                ]
9225            })
9226        ]
9227    });
9228};
9229
9230
9231/***/ }),
9232
9233/***/ 392330:
9234/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9235
9236"use strict";
9237/* unused harmony export extractAddress */
9238/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785893);
9239/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(667294);
9240/* harmony import */ var _Constants_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(339114);
9241/* harmony import */ var _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(208891);
9242/* harmony import */ var _Lib_store_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(267097);
9243/* harmony import */ var _Lib_utils_locale__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(225220);
9244/* harmony import */ var components_ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(836455);
9245
9246
9247
9248
9249
9250
9251
9252const extractAddress = (place)=>{
9253    var _place_address_components;
9254    if (!Array.isArray(place === null || place === void 0 ? void 0 : place.address_components)) {
9255        return null;
9256    }
9257    return place === null || place === void 0 ? void 0 : (_place_address_components = place.address_components) === null || _place_address_components === void 0 ? void 0 : _place_address_components.reduce((seed, param)=>{
9258        let { long_name, short_name, types } = param;
9259        types.forEach((t)=>{
9260            seed[t] = {
9261                long_name,
9262                short_name
9263            };
9264        });
9265        return seed;
9266    }, {});
9267};
9268const SearchLocationInput = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.memo)((param)=>{
9269    let { onAddressChange, value, onChange, name, autoComplete, meta, validate } = param;
9270    const searchInput = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
9271    const { locale } = (0,_Lib_store_hooks__WEBPACK_IMPORTED_MODULE_4__/* .useAppSelector */ .C)((state)=>state);
9272    const [, setAddress] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({});
9273    const modified = (meta === null || meta === void 0 ? void 0 : meta.modified) || (meta === null || meta === void 0 ? void 0 : meta.touched);
9274    const [googleMapsLoaded, setGoogleMapsLoaded] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(()=>{
9275        var _window_google;
9276        return  true && !!((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.maps);
9277    });
9278    const onPlaceChanged = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((autocomplete)=>{
9279        const place = autocomplete.getPlace();
9280        const address = extractAddress(place);
9281        if (address) {
9282            var _address_country;
9283            const modifiedAddress = {
9284                ...address
9285            };
9286            if ((locale === null || locale === void 0 ? void 0 : locale.countryShort) !== (address === null || address === void 0 ? void 0 : (_address_country = address.country) === null || _address_country === void 0 ? void 0 : _address_country.short_name)) {
9287                var // do not modify country or state/province if locale is inconsistent with address
9288                _modifiedAddress_administrative_area_level_1, _modifiedAddress_administrative_area_level_11;
9289                var _modifiedAddress_administrative_area_level_1_short_name;
9290                (_modifiedAddress_administrative_area_level_1_short_name = modifiedAddress === null || modifiedAddress === void 0 ? void 0 : (_modifiedAddress_administrative_area_level_1 = modifiedAddress.administrative_area_level_1
9290) === null || _modifiedAddress_administrative_area_level_1 === void 0 ? void 0 : _modifiedAddress_administrative_area_level_1.short_name) !== null && _modifiedAddress_administrative_area_level_1_short_name !== void 0 ? _modifiedAddress_administrative_area_level_1_short_name : "";
9291                var _modifiedAddress_administrative_area_level_1_long_name;
9292                (_modifiedAddress_administrative_area_level_1_long_name = modifiedAddress === null || modifiedAddress === void 0 ? void 0 : (_modifiedAddress_administrative_area_level_11 = modifiedAddress.administrative_area_level_1) === null || _modifiedAddress_administrative_area_level_11 === void 0 ? void 0 : _modifiedAddress_administrative_area_level_11.long_name) !== null && _modifiedAddress_administrative_area_level_1_long_name !== void 0 ? _modifiedAddress_administrative_area_level_1_long_name : "";
9293                modifiedAddress.country.short_name = locale.countryShort;
9294                modifiedAddress.country.long_name = locale.countryLong;
9295                modifiedAddress.political.short_name = locale.countryShort;
9296                modifiedAddress.political.long_name = locale.countryLong;
9297            }
9298            setAddress(modifiedAddress);
9299            onAddressChange(modifiedAddress);
9300        }
9301    }, [
9302        onAddressChange,
9303        locale === null || locale === void 0 ? void 0 : locale.countryLong,
9304        locale === null || locale === void 0 ? void 0 : locale.countryShort
9305    ]);
9306    // init autocomplete
9307    const initAutocomplete = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(async ()=>{
9308        var _window_google;
9309        if (!searchInput.current) return;
9310        const options = {
9311            componentRestrictions: {
9312                country: [
9313                    locale === null || locale === void 0 ? void 0 : locale.countryShort
9314                ]
9315            }
9316        };
9317        // The Maps bootstrap is loaded with `loading=async` (see AppScripts), so
9318        // `window.google.maps` is defined before the `places` library has been
9319        // fetched. Wait for the library instead of reading `Autocomplete` off a
9320        // namespace that may still be empty.
9321        const maps = (_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.maps;
9322        let places = maps === null || maps === void 0 ? void 0 : maps.places;
9323        if (!places) {
9324            try {
9325                var _maps_importLibrary;
9326                places = await (maps === null || maps === void 0 ? void 0 : (_maps_importLibrary = maps.importLibrary) === null || _maps_importLibrary === void 0 ? void 0 : _maps_importLibrary.call(maps, "places"));
9327            } catch (e) {
9328                // Blocked script, offline, or a rejected key/quota. Keep the field a
9329                // plain text input instead of raising an unhandled rejection.
9330                return;
9331            }
9332        }
9333        if (!(places === null || places === void 0 ? void 0 : places.Autocomplete) || !searchInput.current) return;
9334        const autocomplete = new places.Autocomplete(searchInput.current, options);
9335        autocomplete.setFields([
9336            "address_component",
9337            "geometry"
9338        ]);
9339        autocomplete.addListener("place_changed", ()=>onPlaceChanged(autocomplete));
9340    }, [
9341        onPlaceChanged
9342    ]);
9343    // The bootstrap is `afterInteractive`, so it is often still in flight when
9344    // this field mounts. Without this listener the effect below would only
9345    // re-run on the next render of a memoised component - in practice the
9346    // user's first keystroke - and that keystroke would get no suggestions.
9347    (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
9348        var _window_google;
9349        if (googleMapsLoaded) return;
9350        if ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.maps) {
9351            setGoogleMapsLoaded(true);
9352            return;
9353        }
9354        const onGoogleMapsLoaded = ()=>setGoogleMapsLoaded(true);
9355        window.addEventListener(_Constants_common__WEBPACK_IMPORTED_MODULE_2__/* .GOOGLE_MAPS_LOADED_EVENT */ .I9, onGoogleMapsLoaded);
9356        return ()=>window.removeEventListener(_Constants_common__WEBPACK_IMPORTED_MODULE_2__/* .GOOGLE_MAPS_LOADED_EVENT */ .I9, onGoogleMapsLoaded);
9357    }, [
9358        googleMapsLoaded
9359    ]);
9360    (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
9361        if (googleMapsLoaded && _Lib_configs_environment__WEBPACK_IMPORTED_MODULE_3__.nextAppEnv.addressAutocompleteProvider === "google") {
9362            initAutocomplete();
9363        }
9364    }, [
9365        initAutocomplete,
9366        googleMapsLoaded
9367    ]);
9368    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(components_ui__WEBPACK_IMPORTED_MODULE_6__/* .TextField */ .nv, {
9369        label: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_5__.t)("checkout.address_form.address"),
9370        name: name,
9371        "data-testid": "search-location-input",
9372        type: "text",
9373        color: "blue",
9374        ref: searchInput,
9375        value: value,
9376        onChange: function(e) {
9377            onChange(e);
9378        },
9379        validate: validate,
9380        touched: modified,
9381        supressErrorStylesOnFocus: true,
9382        required: true,
9383        placeholder: (0,_Lib_utils_locale__WEBPACK_IMPORTED_MODULE_5__.t)("checkout.address_form.place_holders.address"),
9384        autoComplete: autoComplete
9385    });
9386});
9387SearchLocationInput.displayName = "SearchLocationInput";
9388/* harmony default export */ __webpack_exports__.Z = (SearchLocationInput);
9389
9390
9391/***/ }),
9392
9393/***/ 737339:
9394/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9395
9396"use strict";
9397
9398// EXPORTS
9399__webpack_require__.d(__webpack_exports__, {
9400  tq: function() { return /* reexport */ CustomerContextProvider/* CustomerContextProvider */.t; },
9401  ri: function() { return /* reexport */ LocationContextProvider/* LocationContextProvider */.r; },
9402  E3: function() { return /* reexport */ ServiceContextProvider; },
9403  a4: function() { return /* reexport */ UIActionsContextProvider/* UIActionsContextProvider */.a; }
9404});
9405
9406// UNUSED EXPORTS: OpcContextProvider
9407
9408// EXTERNAL MODULE: ./src/components/providers/context/core-ui/CustomerContextProvider.tsx
9409var CustomerContextProvider = __webpack_require__(733972);
9410// EXTERNAL MODULE: ./src/components/providers/context/core-ui/LocationContextProvider.tsx
9411var LocationContextProvider = __webpack_require__(792421);
9412// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
9413var jsx_runtime = __webpack_require__(785893);
9414// EXTERNAL MODULE: ./node_modules/@wildfork/commercetools-core-ui/dist/src/lib/context/index.js
9415var context = __webpack_require__(93050);
9416// EXTERNAL MODULE: ./src/api/twilio.ts
9417var twilio = __webpack_require__(94569);
9418// EXTERNAL MODULE: ./src/lib/configs/environment.ts
9419var environment = __webpack_require__(208891);
9420// EXTERNAL MODULE: ./src/components/providers/context/checkout/CheckoutProvider.tsx
9421var CheckoutProvider = __webpack_require__(98385);
9422;// CONCATENATED MODULE: ./src/components/providers/context/core-ui/ServiceContextProvider.tsx
9423
9424
9425
9426
9427
9428const defaultTwilioPhoneLookupHandler = async (phoneNumber)=>{
9429    if (!isTwilioPhoneLookupEnabled) return true;
9430    try {
9431        await (0,twilio/* twilioPhoneLookup */.P)({
9432            phoneNumber: phoneNumber,
9433            countryCode: "US"
9434        });
9435        return true;
9436    } catch (error) {
9437        return false;
9438    }
9439};
9440const ServiceContextProvider = (param)=>{
9441    let { children, twilioPhoneLookupHandler = defaultTwilioPhoneLookupHandler } = param;
9442    const { phoneNumberValidationHandler } = (0,CheckoutProvider/* useCheckout */.Mg)();
9443    const contextValue = {
9444        twilioPhoneLookup: twilioPhoneLookupHandler,
9445        phoneNumberValidator: phoneNumberValidationHandler
9446    };
9447    return /*#__PURE__*/ (0,jsx_runtime.jsx)(context.ServiceContext.Provider, {
9448        value: contextValue,
9449        children: children
9450    });
9451};
9452const isTwilioPhoneLookupEnabled = environment.nextAppEnv.feature_toggle.US.twilioPhoneLookup;
9453
9454// EXTERNAL MODULE: ./src/components/providers/context/core-ui/UIActionsContextProvider.tsx
9455var UIActionsContextProvider = __webpack_require__(877456);
9456// EXTERNAL MODULE: ./src/components/providers/context/core-ui/OpcContextProvider.tsx + 24 modules
9457var OpcContextProvider = __webpack_require__(809563);
9458;// CONCATENATED MODULE: ./src/components/providers/context/core-ui/index.ts
9459
9460
9461
9462
9463
9464
9465
9466/***/ }),
9467
9468/***/ 44138:
9469/***/ (function(module) {
9470
9471// extracted by mini-css-extract-plugin
9472module.exports = {"checkout-layout":"CheckoutLayout_checkout-layout__4Ioe8","main-content-wrapper":"CheckoutLayout_main-content-wrapper__70jor","content":"CheckoutLayout_content__wnoq_","checkout-summary-mobile":"CheckoutLayout_checkout-summary-mobile__0ToAn","checkout-summary-desktop":"CheckoutLayout_checkout-summary-desktop__UI5_e","checkout-summary-toggle":"CheckoutLayout_checkout-summary-toggle__0pLap","checkout-summary-toggle-text":"CheckoutLayout_checkout-summary-toggle-text__U3BqY","checkout-summary-toggle-active":"CheckoutLayout_checkout-summary-toggle-active__RjHtZ","checkout-summary-toggle-price":"CheckoutLayout_checkout-summary-toggle-price__75Ris"};
9473
9474/***/ }),
9475
9476/***/ 641719:
9477/***/ (function(module) {
9478
9479// extracted by mini-css-extract-plugin
9480module.exports = {"footer":"Footer_footer__DFIy4","step-actions":"Footer_step-actions__CeIYx","modal-content":"Footer_modal-content__fQ_67","footer__processing-message":"Footer_footer__processing-message__OWUn4","footer__processing-message--blink":"Footer_footer__processing-message--blink__9xeG7","blinkingText":"Footer_blinkingText__ft9rL"};
9481
9482/***/ }),
9483
9484/***/ 770115:
9485/***/ (function(module) {
9486
9487// extracted by mini-css-extract-plugin
9488module.exports = {"footer-step-actions":"FooterStepActions_footer-step-actions__rko5X","footer-step-actions__heading-container":"FooterStepActions_footer-step-actions__heading-container__oQPBj","footer-step-actions__error-icon-container":"FooterStepActions_footer-step-actions__error-icon-container__AuEYF"};
9489
9490/***/ }),
9491
9492/***/ 317193:
9493/***/ (function(module) {
9494
9495// extracted by mini-css-extract-plugin
9496module.exports = {"auth-container":"AuthContainer_auth-container__6N3i4","login-header-one-page":"AuthContainer_login-header-one-page__eRGWr"};
9497
9498/***/ }),
9499
9500/***/ 780243:
9501/***/ (function(module) {
9502
9503// extracted by mini-css-extract-plugin
9504module.exports = {"delivery-pickup-card":"StoreCard_delivery-pickup-card__xUOkB","delivery-pickup-card-right":"StoreCard_delivery-pickup-card-right__MEpBZ","delivery-pickup-card-sep":"StoreCard_delivery-pickup-card-sep__PK8Ga","delivery-pickup-card-left":"StoreCard_delivery-pickup-card-left__g6XA6","delivery-pickup-card-left-container":"StoreCard_delivery-pickup-card-left-container__anUoA","delivery-pickup-card-left-textlocation":"StoreCard_delivery-pickup-card-left-textlocation__GFYn9","delivery-pickup-card-left-location":"StoreCard_delivery-pickup-card-left-location__rTqjR","delivery-pickup-subtitle":"StoreCard_delivery-pickup-subtitle__mkBMk","delivery-pickup-title":"StoreCard_delivery-pickup-title__dQcZv","delivery-pickup-buttonPU":"StoreCard_delivery-pickup-buttonPU__yIUyv","delivery-pickup-buttonPU-icon":"StoreCard_delivery-pickup-buttonPU-icon__q19GR","delivery-pickup-buttonPU-text":"StoreCard_delivery-pickup-buttonPU-text__gGxvq","delivery-pickup-subtitles":"StoreCard_delivery-pickup-subtitles__VY34P","delivery-pickup-subtitles-miles":"StoreCard_delivery-pickup-subtitles-miles__gWm6v","delivery-pickup-subtitles-address":"StoreCard_delivery-pickup-subtitles-address__4xslb","delivery-pickup-subtitles-city":"StoreCard_delivery-pickup-subtitles-city__UvdPZ","delivery-pickup-subtitles-opentime":"StoreCard_delivery-pickup-subtitles-opentime__w4_Tj"};
9505
9506/***/ }),
9507
9508/***/ 19375:
9509/***/ (function(module) {
9510
9511// extracted by mini-css-extract-plugin
9512module.exports = {"delivery-content":"DeliveryAddressSelect_delivery-content__X6gXx","delivery-content-title":"DeliveryAddressSelect_delivery-content-title__mtOVX","delivery-content-address-list":"DeliveryAddressSelect_delivery-content-address-list__G8GmH","delivery-content-address-list-address":"DeliveryAddressSelect_delivery-content-address-list-address__12ImZ","delivery-content-address-list-address--default":"DeliveryAddressSelect_delivery-content-address-list-address--default__m_IMB","delivery-content-address-list-address-name":"DeliveryAddressSelect_delivery-content-address-list-address-name__VsWO8","delivery-content-address-list-address-detail
9512s":"DeliveryAddressSelect_delivery-content-address-list-address-details__gdzUJ","delivery-content-address-list-address-button":"DeliveryAddressSelect_delivery-content-address-list-address-button__kszJB","delivery-footer-submit":"DeliveryAddressSelect_delivery-footer-submit__bV9Bb"};
9513
9514/***/ }),
9515
9516/***/ 940670:
9517/***/ (function(module) {
9518
9519// extracted by mini-css-extract-plugin
9520module.exports = {"delivery":"DeliveryContainer_delivery__3aWVf","delivery-header-wrapper":"DeliveryContainer_delivery-header-wrapper__FZaN2","delivery-title":"DeliveryContainer_delivery-title__LBWFP","slide-wrapper":"DeliveryContainer_slide-wrapper__sg348","slide-item":"DeliveryContainer_slide-item__euFPG","slide-item__selected":"DeliveryContainer_slide-item__selected__6PmEj","slide-item__day":"DeliveryContainer_slide-item__day__O95g7","slide-item__month":"DeliveryContainer_slide-item__month__JVKLu","slide-item__date":"DeliveryContainer_slide-item__date__5IZl0","slider-container":"DeliveryContainer_slider-container__P73Yv","delivery-background":"DeliveryContainer_delivery-background__K3RkH","delivery-pickup-loadbutton":"DeliveryContainer_delivery-pickup-loadbutton__8Rcb8","delivery-pickup-GoogleMapCont":"DeliveryContainer_delivery-pickup-GoogleMapCont__adhzq","delivery-header":"DeliveryContainer_delivery-header___X6kq","delivery-header-title":"DeliveryContainer_delivery-header-title__vjqQd","delivery-header-desc":"DeliveryContainer_delivery-header-desc__cEAXd","delivery-header-become-member-text":"DeliveryContainer_delivery-header-become-member-text__SeQKl","delivery-header-button":"DeliveryContainer_delivery-header-button__adASb","delivery-footer":"DeliveryContainer_delivery-footer__cdQLE","delivery-footer-pickup-subtitle":"DeliveryContainer_delivery-footer-pickup-subtitle__EQKfO","delivery-footer-pickup-title":"DeliveryContainer_delivery-footer-pickup-title__e74Qb","delivery-footer-pickup-map":"DeliveryContainer_delivery-footer-pickup-map__pxZsL","delivery-footer-pickup-icon":"DeliveryContainer_delivery-footer-pickup-icon__xi398","delivery-footer-submit":"DeliveryContainer_delivery-footer-submit__2EZ1W","autoship-form-container":"DeliveryContainer_autoship-form-container__uRRiA","autoship-form-title":"DeliveryContainer_autoship-form-title__d87k3"};
9521
9522/***/ }),
9523
9524/***/ 161192:
9525/***/ (function(module) {
9526
9527// extracted by mini-css-extract-plugin
9528module.exports = {"dates-grid":"DeliveryDatesSlider_dates-grid__UAMN2","date-chip":"DeliveryDatesSlider_date-chip__1Vl8U","date-chip--selected":"DeliveryDatesSlider_date-chip--selected__FJfJq","date-chip__day":"DeliveryDatesSlider_date-chip__day__XaZrF","date-chip__date":"DeliveryDatesSlider_date-chip__date__4R82N"};
9529
9530/***/ }),
9531
9532/***/ 576628:
9533/***/ (function(module) {
9534
9535// extracted by mini-css-extract-plugin
9536module.exports = {"times-grid":"DeliveryTimesSlider_times-grid__8Dbqu","time-chip":"DeliveryTimesSlider_time-chip__a79KP","time-chip--selected":"DeliveryTimesSlider_time-chip--selected__XsHbJ","time-chip--disabled":"DeliveryTimesSlider_time-chip--disabled__5Mpyo"};
9537
9538/***/ }),
9539
9540/***/ 724614:
9541/***/ (function(module) {
9542
9543// extracted by mini-css-extract-plugin
9544module.exports = {"order-minimum-unmet":"OrderMinimumUnmet_order-minimum-unmet__o8Sqa","message":"OrderMinimumUnmet_message__qj0FN","message__header":"OrderMinimumUnmet_message__header___GVny","message__content":"OrderMinimumUnmet_message__content__pBab5","message__content--bold":"OrderMinimumUnmet_message__content--bold__4QGWY","message__content--links":"OrderMinimumUnmet_message__content--links__qJoQs"};
9545
9546/***/ }),
9547
9548/***/ 179077:
9549/***/ (function(module) {
9550
9551// extracted by mini-css-extract-plugin
9552module.exports = {"google-map":"PickUpGoogleMap_google-map__U4XN8","google-map-tag":"PickUpGoogleMap_google-map-tag__GLT6J"};
9553
9554/***/ }),
9555
9556/***/ 299417:
9557/***/ (function(module) {
9558
9559// extracted by mini-css-extract-plugin
9560module.exports = {"address-form-container-addresses":"AddressFormContainer_address-form-container-addresses__wYMLy","address-form-container-footer-submit":"AddressFormContainer_address-form-container-footer-submit__NGOTe","address-form-container-footer-cancel":"AddressFormContainer_address-form-container-footer-cancel__UTLLt","address-form__default-address__field-set":"AddressFormContainer_address-form__default-address__field-set__0AM1r","address-form__default-address__field-set__label":"AddressFormContainer_address-form__default-address__field-set__label__YBEE3"};
9561
9562/***/ }),
9563
9564/***/ 669653:
9565/***/ (function(module) {
9566
9567// extracted by mini-css-extract-plugin
9568module.exports = {"slider-container":"DeliveryForm_slider-container__Xj_eV","gift-option":"DeliveryForm_gift-option__y2cIj","military-instru
9568ctions-wrapper-open":"DeliveryForm_military-instructions-wrapper-open__13QdT","fade-in":"DeliveryForm_fade-in__kpNt_","military-instructions-wrapper-close":"DeliveryForm_military-instructions-wrapper-close__HXEyv","fade-out":"DeliveryForm_fade-out__JmFYy","military-instructions-label":"DeliveryForm_military-instructions-label__D_Ggd","military-instructions-disclaimer":"DeliveryForm_military-instructions-disclaimer___pgfx","diclaimer-icon":"DeliveryForm_diclaimer-icon__7REbx","delivery-instructions-textarea":"DeliveryForm_delivery-instructions-textarea__LeeaZ"};
9569
9570/***/ }),
9571
9572/***/ 933093:
9573/***/ (function(module) {
9574
9575// extracted by mini-css-extract-plugin
9576module.exports = {"root":"PaymentDiscountCodeForm_root___YW5_","payment-discount-form":"PaymentDiscountCodeForm_payment-discount-form__jt2yy","discount__error":"PaymentDiscountCodeForm_discount__error__7wnZg","discount__error_message":"PaymentDiscountCodeForm_discount__error_message__OLAgr","discount__error_code":"PaymentDiscountCodeForm_discount__error_code__yBP27","discount__error_img":"PaymentDiscountCodeForm_discount__error_img__4ooEC","form":"PaymentDiscountCodeForm_form__XhPm3","discount-input-container":"PaymentDiscountCodeForm_discount-input-container__s9c8U","apply-button":"PaymentDiscountCodeForm_apply-button__5J5l7","discount-error-container":"PaymentDiscountCodeForm_discount-error-container__9JMWA","fadeout":"PaymentDiscountCodeForm_fadeout__p2AGi","ellipsis":"PaymentDiscountCodeForm_ellipsis__LLNth"};
9577
9578/***/ }),
9579
9580/***/ 859058:
9581/***/ (function(module) {
9582
9583// extracted by mini-css-extract-plugin
9584module.exports = {"slider-container":"PickUpForm_slider-container__UTkCz","slider-container-title":"PickUpForm_slider-container-title__ETCRe","slider-container-subtitle":"PickUpForm_slider-container-subtitle__2gUwD","slider-container-middle":"PickUpForm_slider-container-middle__Lgnjj","slider-container-middle-text":"PickUpForm_slider-container-middle-text__Uahpx","slider-container-middle-link":"PickUpForm_slider-container-middle-link__vTXJE","gift-option":"PickUpForm_gift-option__AWU2l","link":"PickUpForm_link__DCQHA","no-availability":"PickUpForm_no-availability__ilE8T"};
9585
9586/***/ }),
9587
9588/***/ 578902:
9589/***/ (function(module) {
9590
9591// extracted by mini-css-extract-plugin
9592module.exports = {"root":"CharacterLimit_root__lJnvc","character-count":"CharacterLimit_character-count__stve3","limit-warning":"CharacterLimit_limit-warning__Qr3Et","fadeout":"CharacterLimit_fadeout__VVcp_","ellipsis":"CharacterLimit_ellipsis__tHtr_"};
9593
9594/***/ }),
9595
9596/***/ 348736:
9597/***/ (function(module) {
9598
9599// extracted by mini-css-extract-plugin
9600module.exports = {"phone-field":"PhoneField_phone-field__25tRM","required":"PhoneField_required__EOLRa","error-message":"PhoneField_error-message__aKsWV","phone-field--required":"PhoneField_phone-field--required__gyfUT","phone-field--error":"PhoneField_phone-field--error__C7uQq","phone-field__icon":"PhoneField_phone-field__icon____vSF"};
9601
9602/***/ }),
9603
9604/***/ 242124:
9605/***/ (function(module) {
9606
9607// extracted by mini-css-extract-plugin
9608module.exports = {"address-verification-modal":"AddressVerificationModal_address-verification-modal__4oC16","address-verification-modal__wrapper":"AddressVerificationModal_address-verification-modal__wrapper__RN4qg","address-verification-modal-modal__overlay":"AddressVerificationModal_address-verification-modal-modal__overlay__JRB_F","address-verification-modal__content":"AddressVerificationModal_address-verification-modal__content__e_4Zv","address-verification-modal__title":"AddressVerificationModal_address-verification-modal__title__l5Qtr","address-verification-modal__subtitle":"AddressVerificationModal_address-verification-modal__subtitle__yb6NP","address-verification-modal__body":"AddressVerificationModal_address-verification-modal__body__WVDpH","address-verification-modal__card":"AddressVerificationModal_address-verification-modal__card__QzmMd","address-verification-modal__card-title":"AddressVerificationModal_address-verification-modal__card-title__NRmbb","address-verification-modal__card-edit-text-button":"AddressVerificationModal_address-ver
9608ification-modal__card-edit-text-button__qunpj","address-verification-modal__error-card":"AddressVerificationModal_address-verification-modal__error-card__j2579","address-verification-modal__error-card__message":"AddressVerificationModal_address-verification-modal__error-card__message__mXhl8","address-verification-modal__footer":"AddressVerificationModal_address-verification-modal__footer__XmhI7","address-verification-modal__close":"AddressVerificationModal_address-verification-modal__close__mFVI3","address-verification-modal__button":"AddressVerificationModal_address-verification-modal__button__k3ZOe"};
9609
9610/***/ }),
9611
9612/***/ 79539:
9613/***/ (function(module) {
9614
9615// extracted by mini-css-extract-plugin
9616module.exports = {"product-inventory-modal":"ProductInventoryModal_product-inventory-modal__dtXv_","product-inventory-modal-layout":"ProductInventoryModal_product-inventory-modal-layout__qx6Zr","product-inventory-desc":"ProductInventoryModal_product-inventory-desc__sCvNZ","product-inventory-btn":"ProductInventoryModal_product-inventory-btn__ZjXGx","product-inventory-btn-remove":"ProductInventoryModal_product-inventory-btn-remove__ht_l_","product-inventory-secondary-button":"ProductInventoryModal_product-inventory-secondary-button__tDiH4"};
9617
9618/***/ }),
9619
9620/***/ 946069:
9621/***/ (function(module) {
9622
9623// extracted by mini-css-extract-plugin
9624module.exports = {"handling-fee-banner":"MiniOrderSummary_handling-fee-banner__mksYT","order-summary-mobile":"MiniOrderSummary_order-summary-mobile__sqt4o","order-summary-desktop":"MiniOrderSummary_order-summary-desktop__EmN6o","order-summary-toggle":"MiniOrderSummary_order-summary-toggle__iFiUP","order-summary-toggle-text":"MiniOrderSummary_order-summary-toggle-text__QEY2g","order-summary-toggle-active":"MiniOrderSummary_order-summary-toggle-active__ktrm7","order-summary-toggle-price":"MiniOrderSummary_order-summary-toggle-price__ISgW3"};
9625
9626/***/ }),
9627
9628/***/ 136119:
9629/***/ (function(module) {
9630
9631// extracted by mini-css-extract-plugin
9632module.exports = {"membership-terms-consent":"MembershipTermsConsent_membership-terms-consent__sq2CE","highlight":"MembershipTermsConsent_highlight___SOd8"};
9633
9634/***/ }),
9635
9636/***/ 32691:
9637/***/ (function(module) {
9638
9639// extracted by mini-css-extract-plugin
9640module.exports = {"billing-address-options":"PaymentBillingAddress_billing-address-options__1Piak"};
9641
9642/***/ }),
9643
9644/***/ 718769:
9645/***/ (function(module) {
9646
9647// extracted by mini-css-extract-plugin
9648module.exports = {"root":"PaymentContainer_root__sUV6J","payment-container":"PaymentContainer_payment-container__O7h5s","fadeout":"PaymentContainer_fadeout__rdFZ_","ellipsis":"PaymentContainer_ellipsis__38gxP"};
9649
9650/***/ }),
9651
9652/***/ 461021:
9653/***/ (function(module) {
9654
9655// extracted by mini-css-extract-plugin
9656module.exports = {"discount__container":"PaymentDiscount_discount__container__kQu8d","mobile-only":"PaymentDiscount_mobile-only__AHouQ","desktop-only":"PaymentDiscount_desktop-only__md7W2","form":"PaymentDiscount_form__b9_KD"};
9657
9658/***/ }),
9659
9660/***/ 109137:
9661/***/ (function(module) {
9662
9663// extracted by mini-css-extract-plugin
9664module.exports = {"root":"PaymentDriverTip_root__x22HR","payment-driver-tip":"PaymentDriverTip_payment-driver-tip__Es5CA","payment-auth":"PaymentDriverTip_payment-auth__l3zYw","error":"PaymentDriverTip_error__beAjO","field_error":"PaymentDriverTip_field_error__oOFlr","field_default":"PaymentDriverTip_field_default__oxjnT","fadeout":"PaymentDriverTip_fadeout__AAUQb","ellipsis":"PaymentDriverTip_ellipsis__vNVFA"};
9665
9666/***/ }),
9667
9668/***/ 301099:
9669/***/ (function(module) {
9670
9671// extracted by mini-css-extract-plugin
9672module.exports = {"payment-method":"PaymentMethod_payment-method__Ryy8E","payment-methods-container":"PaymentMethod_payment-methods-container__wnwyR"};
9673
9674/***/ }),
9675
9676/***/ 247648:
9677/***/ (function(module) {
9678
9679// extracted by mini-css-extract-plugin
9680module.exports = {"section":"PaymentReview_section__ImNgy","review-block":"PaymentReview_review-block__8B3wJ","review-block__inner":"PaymentReview_review-block__inner__s4nbF","review-block__label":"PaymentReview_review-block__label__3xL_h","review-block__value":"PaymentReview_review-block__value__Cml5C","review-block__link":"PaymentReview_review-block__link__Sqb74","divider":"PaymentReview_divider__gt6EK"};
9681
9682/***/ }),
9683
9684/***/ 409357:
9685/***/ (function(module) {
9686
9687// extracted by mini-css-extract-plugin
9688module.exports = {"pos-membership-save-card-consent":"PosMembershipSaveCardConsent_pos-membership-save-card-consent__vIAdr","important-label":"PosMembershipSaveCardConsent_important-label__nxKhX"};
9689
9690/***/ }),
9691
9692/***/ 744723:
9693/***/ (function(module) {
9694
9695// extracted by mini-css-extract-plugin
9696module.exports = {"autoship-payment-checkbox":"SubscriptionConfirmation_autoship-payment-checkbox__DwTZT","autoship-subscription-error":"SubscriptionConfirmation_autoship-subscription-error__6xDZu"};
9697
9698/***/ }),
9699
9700/***/ 513041:
9701/***/ (function(module) {
9702
9703// extracted by mini-css-extract-plugin
9704module.exports = {"fieldset":"CardPaymentForm_fieldset__7gi3j","field__input--iframe-container":"CardPaymentForm_field__input--iframe-container__8GtJz","field":"CardPaymentForm_field__cEnd4","field__input-wrapper":"CardPaymentForm_field__input-wrapper__dUJka","field__label":"CardPaymentForm_field__label__xh1GQ","field__label--visible":"CardPaymentForm_field__label--visible__yyRwm","content-box":"CardPaymentForm_content-box__voF10","content-box--gift-card-insufficient":"CardPaymentForm_content-box--gift-card-insufficient__638MB","content-box--webview-visitor":"CardPaymentForm_content-box--webview-visitor__jLlBM","content-box--paypal-not-allowed":"CardPaymentForm_content-box--paypal-not-allowed__MUG0R","field__input":"CardPaymentForm_field__input__uLnFP","icon-svg--color-adaptive-lighter":"CardPaymentForm_icon-svg--color-adaptive-lighter__hFBEA","field__icon":"CardPaymentForm_field__icon___z43C","field__caret":"CardPaymentForm_field__caret__eOmP1","content-box--membership-agreement-not-checked":"CardPaymentForm_content-box--membership-agreement-not-checked__WqzMH","paypal-container":"CardPaymentForm_paypal-container__H320C","paypal-container--hidden":"CardPaymentForm_paypal-container--hidden__pgiqc","animate-floating-labels":"CardPaymentForm_animate-floating-labels__vf2xZ","floating-labels":"CardPaymentForm_floating-labels__Kim0k","field__input-wrapper--icon-right":"CardPaymentForm_field__input-wrapper--icon-right__E75eG","field--half":"CardPaymentForm_field--half__aMhQQ","field__input--active":"CardPaymentForm_field__input--active___0xA5","tooltip-container":"CardPaymentForm_tooltip-container___ASlF","icon-svg":"CardPaymentForm_icon-svg__tMUsU","icon-svg--block":"CardPaymentForm_icon-svg--block__ordpJ","icon-svg--size-16":"CardPaymentForm_icon-svg--size-16__ZaqYl","icon-svg--center":"CardPaymentForm_icon-svg--center__UPkWD","tooltip-control":"CardPaymentForm_tooltip-control__dpK_4","tooltip":"CardPaymentForm_tooltip__giEOz","show-tooltip":"CardPaymentForm_show-tooltip__naw_y","has-tooltip":"CardPaymentForm_has-tooltip__sddIh","field--error":"CardPaymentForm_field--error__URk7F","field__message--error":"CardPaymentForm_field__message--error__4H5fR","field__message":"CardPaymentForm_field__message__AqJ5z","layout--checkout":"CardPaymentForm_layout--checkout__5CcWZ","name-input"
9704:"CardPaymentForm_name-input__Atw00","name-input--error":"CardPaymentForm_name-input--error__L8D9a","paypal-wrapper":"CardPaymentForm_paypal-wrapper__29q7f","loader-overrides":"CardPaymentForm_loader-overrides__hMS5N","checkbox-styling":"CardPaymentForm_checkbox-styling__k0nx3"};
9705
9706/***/ }),
9707
9708/***/ 759380:
9709/***/ (function(module) {
9710
9711// extracted by mini-css-extract-plugin
9712module.exports = {"root":"GiftCardForm_root__rUn5i","gift-card-container":"GiftCardForm_gift-card-container__Ww2nB","gift-card-container--error":"GiftCardForm_gift-card-container--error___QtfH","header":"GiftCardForm_header__A6HzP","add-button":"GiftCardForm_add-button__N1RjM","gift-card-component-wrapper":"GiftCardForm_gift-card-component-wrapper__9kRht","gift-card-component-wrapper--show":"GiftCardForm_gift-card-component-wrapper--show__oNGW5","gift-card-content":"GiftCardForm_gift-card-content__psYYb","gift-card-component":"GiftCardForm_gift-card-component__5vY3_","gift-card-component--hide":"GiftCardForm_gift-card-component--hide__nqUVM","apply-button-wrapper":"GiftCardForm_apply-button-wrapper__jpeVX","apply-button":"GiftCardForm_apply-button__d3gFm","gift-card-info":"GiftCardForm_gift-card-info__uAorj","details-wrapper":"GiftCardForm_details-wrapper__hgMQ3","icon-number-wrapper":"GiftCardForm_icon-number-wrapper__Tu8OH","icon-wrapper":"GiftCardForm_icon-wrapper__0GRXT","remove-button":"GiftCardForm_remove-button__5M6tU","info-details":"GiftCardForm_info-details__LC0Wd","applied-amount":"GiftCardForm_applied-amount__XmCcC","error-messages":"GiftCardForm_error-messages__eGKql","fadeout":"GiftCardForm_fadeout__szewF","ellipsis":"GiftCardForm_ellipsis__cOHib"};
9713
9714/***/ }),
9715
9716/***/ 460634:
9717/***/ (function(module) {
9718
9719// extracted by mini-css-extract-plugin
9720module.exports = {"container":"TaxDelayedCard_container__JYXsG","card--title":"TaxDelayedCard_card--title__Gapha"};
9721
9722/***/ }),
9723
9724/***/ 66837:
9725/***/ (function(module) {
9726
9727// extracted by mini-css-extract-plugin
9728module.exports = {"input-container":"PostGridAutocomplete_input-container__1F4m5","search-field-container":"PostGridAutocomplete_search-field-container__2ZMdG","required":"PostGridAutocomplete_required__66tDA","tooltip":"PostGridAutocomplete_tooltip__xv_DX","input-grey":"PostGridAutocomplete_input-grey__wssSN","text-field--error":"PostGridAutocomplete_text-field--error__7ZpJJ","error":"PostGridAutocomplete_error__zpaK_","error-text":"PostGridAutocomplete_error-text__ejRGG","previewicon":"PostGridAutocomplete_previewicon__IYdUc","previewicon--show":"PostGridAutocomplete_previewicon--show__YSAWW","disabled-text-feild":"PostGridAutocomplete_disabled-text-feild__a98v9","postgrid-address-search":"PostGridAutocomplete_postgrid-address-search__LtMYP","suggestions-dropdown":"PostGridAutocomplete_suggestions-dropdown__OUFJZ","suggestion-option":"PostGridAutocomplete_suggestion-option__2180q","selected":"PostGridAutocomplete_selected__X_v7Z","icon":"PostGridAutocomplete_icon__6FjtB","suggestion-text":"PostGridAutocomplete_suggestion-text__y2aJL"};
9729
9730/***/ })
9731
9732}]);

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.