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,GAAO,ECL9DwyB,EAAoBa,EAAI,I,MCKxB,IAAIkB,EAAkB,CACrB,IAAK,GAaN/B,EAAoBO,EAAEM,EAAKmB,GAA0C,IAA7BD,EAAgBC,GAGxD,IAAIC,EAAuB,CAACC,EAA4BruB,KACvD,IAGIosB,EAAU+B,GAHTxB,EAAU2B,EAAaC,GAAWvuB,EAGhBye,EAAI,EAC3B,GAAGkO,EAASxP,MAAMxgB,GAAgC,IAAxBuxB,EAAgBvxB,KAAa,CACtD,IAAIyvB,KAAYkC,EACZnC,EAAoBoB,EAAEe,EAAalC,KACrCD,EAAoBM,EAAEL,GAAYkC,EAAYlC,IAGhD,GAAGmC,EAAS,IAAI1tB,EAAS0tB,EAAQpC,EAClC,CAEA,IADGkC,GAA4BA,EAA2BruB,GACrDye,EAAIkO,EAASrxB,OAAQmjB,IACzB0P,EAAUxB,EAASlO,GAChB0N,EAAoBoB,EAAEW,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAOhC,EAAoBO,EAAE7rB,EAAO,EAGjC2tB,EAAqBC,KAA4B,sBAAIA,KAA4B,uBAAK,GAC1FD,EAAmBrF,QAAQiF,EAAqBllB,KAAK,KAAM,IAC3DslB,EAAmBnlB,KAAO+kB,EAAqBllB,KAAK,KAAMslB,EAAmBnlB,KAAKH,KAAKslB,G,KC7CvF,IAAIE,EAAsBvC,EAAoBO,OAAElxB,EAAW,CAAC,KAAK,IAAO2wB,EAAoB,QAC5FuC,EAAsBvC,EAAoBO,EAAEgC,E","sources":["webpack://pizza-hut/webpack/runtime/chunk loaded","webpack://pizza-hut/./src/hooks/useEventListener.ts","webpack://pizza-hut/./src/hooks/useOutsideClick.ts","webpack://pizza-hut/./src/shared/utils.ts","webpack://pizza-hut/./src/shared/helpers/routing-helpers.ts","webpack://pizza-hut/./src/shared/components/radio.component.tsx","webpack://pizza-hut/./src/apps/NavigationApp/components/language-switch.component.tsx","webpack://pizza-hut/./src/shared/api/axios.ts","webpack://pizza-hut/./src/shared/types.ts","webpack://pizza-hut/./src/shared/tools/api-response-wrapper.ts","webpack://pizza-hut/./src/shared/store/global/global.actions.ts","webpack://pizza-hut/./src/shared/store/static-content/static-content.actions.ts","webpack://pizza-hut/./src/shared/helpers/index.ts","webpack://pizza-hut/./src/shared/components/loader.component.tsx","webpack://pizza-hut/./src/shared/components/toast.component.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Components/stores-list.component.tsx","webpack://pizza-hut/./src/shared/components/suggestions.component.tsx","webpack://pizza-hut/./src/hooks/useShowDelay.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Components/address-input.component.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Containers/info-panel.container.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Components/localization-addition.component.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Components/last-used-addresses.component.tsx","webpack://pizza-hut/./src/shared/validators/index.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Validators/address.validator.ts","webpack://pizza-hut/./src/typings/web-bridge.types.ts","webpack://pizza-hut/./src/apps/LocalizationApp/types/localization.types.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Store/actions.ts","webpack://pizza-hut/./src/apps/LocalizationApp/helpers/store-status.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Containers/localization-search.container.tsx","webpack://pizza-hut/./src/hooks/useVisible.ts","webpack://pizza-hut/./src/shared/components/modal.compontent.tsx","webpack://pizza-hut/./src/shared/components/select-time.component.tsx","webpack://pizza-hut/./src/shared/tools/uuid-generator.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Components/store-unavailable.component.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Containers/choose-time.container.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Components/order-type-switch.component.tsx","webpack://pizza-hut/./src/shared/components/change-address-alert.component.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Components/change-store.component.tsx","webpack://pizza-hut/./src/shared/components/single-action-modal.component.tsx","webpack://pizza-hut/./src/hooks/useKeyPress.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Containers/store-status-info.container.tsx","webpack://pizza-hut/./src/apps/LocalizationApp/Store/static-content/localization-static-content.actions.ts","webpack://pizza-hut/./src/apps/LocalizationApp/Containers/search-window.container.tsx","webpack://pizza-hut/./src/apps/ProductsApp/types/dto.types.ts","webpack://pizza-hut/./src/shared/helpers/coupons-helpers.ts","webpack://pizza-hut/./src/apps/NavigationApp/store/address-wizzard/address-wizzard.actions.ts","webpack://pizza-hut/./src/apps/NavigationApp/store/static-content/static-content.actions.ts","webpack://pizza-hut/./src/apps/NavigationApp/navigation.types.ts","webpack://pizza-hut/./src/apps/NavigationApp/store/actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/offers/offers.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/basket/basket.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/static-content/products-static-content.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/customize-product/customize-product.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/checkout/checkout.reducer.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/static-content/checkout-static-content.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/checkout/checkout.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/metadata/metadata.actions.ts","webpack://pizza-hut/./src/apps/ProductsApp/store/products/products.actions.ts","webpack://pizza-hut/./src/apps/NavigationApp/containers/address-wizzard.container.tsx","webpack://pizza-hut/./src/apps/NavigationApp/components/simple-navbar.component.tsx","webpack://pizza-hut/./src/shared/helpers/mobile-app-helper.ts","webpack://pizza-hut/./src/apps/AccountApp/store/static-content/account-static-content.actions.ts","webpack://pizza-hut/./src/shared/store/global/global.reducer.ts","webpack://pizza-hut/./src/apps/AccountApp/store/static-content/account-static-content.reducer.ts","webpack://pizza-hut/./src/apps/AccountApp/store/registration/registration.actions.ts","webpack://pizza-hut/./src/apps/AccountApp/store/registration/registration.reducer.ts","webpack://pizza-hut/./src/apps/AccountApp/store/signin/signin.actions.ts","webpack://pizza-hut/./src/apps/AccountApp/store/signin/signin.reducer.ts","webpack://pizza-hut/./src/apps/AccountApp/store/actions.ts","webpack://pizza-hut/./src/apps/AccountApp/account.types.ts","webpack://pizza-hut/./src/apps/AccountApp/store/reset-password/reset-password.actions.ts","webpack://pizza-hut/./src/apps/AccountApp/store/reset-password/reset-password.reducer.ts","webpack://pizza-hut/./src/apps/AccountApp/store/index.ts","webpack://pizza-hut/./src/shared/validators/helpers.ts","webpack://pizza-hut/./src/shared/components/form-input.component.tsx","webpack://pizza-hut/./src/shared/components/checkbox-input.component.tsx","webpack://pizza-hut/./src/shared/validators/common.validator.ts","webpack://pizza-hut/./src/apps/AccountApp/validators/signin-form.validator.ts","webpack://pizza-hut/./src/apps/AccountApp/components/signin/signin-account-form.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/pages/signin.page.tsx","webpack://pizza-hut/./src/apps/AccountApp/validators/create-account-form.validator.ts","webpack://pizza-hut/./src/apps/AccountApp/components/register/create-account-form.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/pages/register.page.tsx","webpack://pizza-hut/./src/apps/AccountApp/validators/reset-password-form.validator.ts","webpack://pizza-hut/./src/apps/AccountApp/components/reset-password/reset-password-form.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/components/reset-password/email-not-found.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/components/reset-password/email-sent-confirmation.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/validators/change-password-form.validator.ts","webpack://pizza-hut/./src/apps/AccountApp/components/reset-password/change-password-form.component.tsx","webpack://pizza-hut/./src/apps/AccountApp/pages/reset-password.page.tsx","webpack://pizza-hut/./src/apps/AccountApp/index.tsx","webpack://pizza-hut/./src/apps/AccountApp/App.tsx","webpack://pizza-hut/./src/apps/AccountApp/router.tsx","webpack://pizza-hut/webpack/bootstrap","webpack://pizza-hut/webpack/runtime/compat get default export","webpack://pizza-hut/webpack/runtime/define property getters","webpack://pizza-hut/webpack/runtime/global","webpack://pizza-hut/webpack/runtime/hasOwnProperty shorthand","webpack://pizza-hut/webpack/runtime/make namespace object","webpack://pizza-hut/webpack/runtime/runtimeId","webpack://pizza-hut/webpack/runtime/jsonp chunk loading","webpack://pizza-hut/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","import { RefObject, useEffect, useRef } from 'react';\r\n\r\nfunction useEventListener(eventName: K, handler: (event: WindowEventMap[K]) => void): void;\r\nfunction useEventListener(\r\n eventName: K,\r\n handler: (event: HTMLElementEventMap[K]) => void,\r\n element: RefObject,\r\n): void;\r\n\r\nfunction useEventListener(\r\n eventName: KW | KH,\r\n handler: (event: WindowEventMap[KW] | HTMLElementEventMap[KH] | Event) => void,\r\n element?: RefObject,\r\n) {\r\n // Create a ref that stores handler\r\n const savedHandler = useRef();\r\n\r\n useEffect(() => {\r\n // Define the listening target\r\n const targetElement: T | Window = element?.current || window;\r\n if (!(targetElement && targetElement.addEventListener)) {\r\n return;\r\n }\r\n\r\n // Update saved handler if necessary\r\n if (savedHandler.current !== handler) {\r\n savedHandler.current = handler;\r\n }\r\n\r\n // Create event listener that calls handler function stored in ref\r\n const eventListener: typeof handler = (event) => {\r\n // eslint-disable-next-line no-extra-boolean-cast\r\n if (!!savedHandler?.current) {\r\n savedHandler.current(event);\r\n }\r\n };\r\n\r\n targetElement.addEventListener(eventName, eventListener);\r\n\r\n // Remove event listener on cleanup\r\n return () => {\r\n targetElement.removeEventListener(eventName, eventListener);\r\n };\r\n }, [eventName, element, handler]);\r\n}\r\n\r\nexport default useEventListener;\r\n","import { RefObject } from 'react';\r\nimport useEventListener from './useEventListener';\r\n\r\ntype Handler = (event: Event) => void;\r\n\r\nfunction useOnClickOutside(ref: RefObject, handler: Handler): void {\r\n useEventListener('click', (event) => {\r\n const el = ref?.current;\r\n\r\n // Do nothing if clicking ref's element or descendent elements\r\n if (!el || el.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n handler(event);\r\n });\r\n}\r\n\r\nexport default useOnClickOutside;\r\n","import { compose } from 'redux';\r\n\r\nconst composeEnhancers = (process.env.NODE_ENV === 'development' && window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\r\n\r\nexport default composeEnhancers;\r\n\r\nexport interface LoadReduxFromLocalStorageParams {\r\n state: TState;\r\n key: string;\r\n}\r\nexport function LoadReduxFromLocalStorage({ state, key }: LoadReduxFromLocalStorageParams): TState {\r\n try {\r\n const sessionItem = localStorage.getItem(key);\r\n\r\n if (!sessionItem) {\r\n return state;\r\n }\r\n\r\n return {\r\n ...state,\r\n ...JSON.parse(sessionItem),\r\n };\r\n } catch (ex) {\r\n console.debug(`Problem with loading state from session storage for key ${key}`);\r\n console.log(ex);\r\n }\r\n\r\n return state;\r\n}\r\n\r\nexport function LoadReduxItemFromLocalStorage(defaultValue: T, key: string): T {\r\n try {\r\n const sessionItem = localStorage.getItem(key);\r\n\r\n if (!sessionItem) {\r\n return defaultValue;\r\n }\r\n\r\n return JSON.parse(sessionItem);\r\n } catch (ex) {\r\n console.debug(`Problem with loading redux state item from session storage for key ${key}`);\r\n console.log(ex);\r\n }\r\n\r\n return defaultValue;\r\n}\r\n\r\nexport function storeDataInCookie(key: string, value: T, expirationDate?: Date): void {\r\n const cookieValue = `${encodeURIComponent(String(value))}; path=/${\r\n expirationDate ? `; expires=${expirationDate.toUTCString()}` : ''\r\n }`;\r\n document.cookie = `${key}=${cookieValue}`;\r\n}\r\n\r\nexport function removeDataFromCookie(key: string) {\r\n document.cookie = `${encodeURIComponent(key)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\r\n}\r\n\r\nexport function LoadReduxFromCookie({ state, key }: LoadReduxFromLocalStorageParams): TState {\r\n try {\r\n const cookieState = document.cookie.split('; ')?.find((row) => row.startsWith(`${key}=`));\r\n\r\n if (!cookieState) {\r\n return state;\r\n }\r\n\r\n const decodedCookieState = decodeURIComponent(cookieState).split('=')[1].split('; ')[0];\r\n\r\n return {\r\n ...state,\r\n ...JSON.parse(decodedCookieState),\r\n };\r\n } catch (ex) {\r\n console.debug(`Problem with loading state from session storage for key ${key}`);\r\n console.log(ex);\r\n }\r\n\r\n return state;\r\n}\r\n\r\nexport function cookieExists(key: string) {\r\n const cookieData = document.cookie.split('; ')?.find((row) => row.startsWith(`${key}=`));\r\n if (!cookieData) return false;\r\n return true;\r\n}\r\nexport function removeBasketFromLocalStorage() {\r\n localStorage.removeItem('basket');\r\n localStorage.removeItem('addressWizzard');\r\n}\r\n\r\nexport function capitalizeFirstLetter(value?: string): string {\r\n if (!value) return '';\r\n return value.charAt(0).toUpperCase() + value.slice(1);\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\nimport { removeDataFromCookie } from 'shared/utils';\r\n\r\nexport const redirectToHomePage = (): void => {\r\n window.location.href = hostURL();\r\n};\r\n\r\nexport const logout = (): void => {\r\n removeDataFromCookie('pizza-hut-access-token');\r\n window.location.href = `${hostURL()}account/sign-out`;\r\n};\r\n\r\nexport const hostURL = (): string => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const url = (document.getElementById('baseUrl') as any).value;\r\n return `${url}/`;\r\n};\r\nexport const appCulture = (): string => {\r\n const culture = (document.getElementById('requestedCulture') as any).value;\r\n return culture;\r\n};\r\n\r\nconst getClientURL = (): string => {\r\n const host = hostURL();\r\n const href = document.getElementsByTagName('base')[0].getAttribute('href');\r\n return host + href;\r\n};\r\n\r\nexport const getRedirectURL = (href: string): string => {\r\n const url = `${getClientURL()}/${href}`;\r\n return url;\r\n};\r\n\r\nexport const getOtherAppRedirectURL = (href: string): string => {\r\n const url = hostURL() + href;\r\n return url;\r\n};\r\n\r\nexport const redirectToOtherAppURL = (href: string): void => {\r\n const url = hostURL() + href;\r\n window.location.href = url;\r\n};\r\n\r\nexport const redirectToExternalURL = (href: string): void => {\r\n window.location.href = href;\r\n};\r\n\r\nexport const redirectToURL = (href: string): void => {\r\n const url = hostURL() + href;\r\n window.location.href = url;\r\n};\r\n\r\nexport const redirectToNotFound = (): void => {\r\n const url = `${hostURL()}not-found`;\r\n window.location.href = url;\r\n};\r\n\r\nexport const backToHistory = (): void => {\r\n // eslint-disable-next-line no-restricted-globals\r\n history.back();\r\n};\r\nexport const redirectToMainPage = (): void => {\r\n window.location.href = hostURL();\r\n};\r\n\r\nexport const parametersToObject = (args: string): any => {\r\n const value = args.substring(1, args.length);\r\n const obj: any = {};\r\n\r\n if (value == null || value === undefined) return obj;\r\n\r\n const splitOperator = '&';\r\n const equalOperator = '=';\r\n const parameters = value.split(splitOperator);\r\n\r\n for (let index = 0; index < parameters.length; index++) {\r\n const element = parameters[index];\r\n const keyAndValueArray = element.split(equalOperator);\r\n // eslint-disable-next-line prefer-destructuring\r\n obj[keyAndValueArray[0]] = keyAndValueArray[1];\r\n }\r\n\r\n return obj;\r\n};\r\n\r\nexport const openNewWindow = (href: string): void => {\r\n const url = hostURL() + href;\r\n window.open(url);\r\n};\r\n","import React from 'react';\r\n\r\nexport interface RadioProps {\r\n selected?: boolean;\r\n onClick?: (event: React.MouseEvent) => void;\r\n testId: string;\r\n}\r\n\r\nconst Radio: React.FC = ({ onClick, selected, testId }) => {\r\n return (\r\n {\r\n onClick && onClick(event);\r\n }}\r\n data-testid={`${testId}__radio-button`}\r\n />\r\n );\r\n};\r\nexport default Radio;\r\n","import React, { useRef, useState } from 'react';\r\nimport useOnClickOutside from 'hooks/useOutsideClick';\r\nimport { appCulture, hostURL } from 'shared/helpers/routing-helpers';\r\nimport { SupportedCulture } from 'shared/types';\r\nimport { capitalizeFirstLetter } from 'shared/utils';\r\nimport Radio from 'shared/components/radio.component';\r\n\r\ninterface LanguageSwitchProps {\r\n cultures: SupportedCulture[];\r\n}\r\n\r\nconst LanguageSwitch: React.FC = ({ cultures }): JSX.Element | null => {\r\n const [expand, setExpand] = useState(false);\r\n\r\n const ref = useRef(null);\r\n\r\n useOnClickOutside(ref, () => {\r\n setExpand(false);\r\n });\r\n\r\n if (!cultures || cultures.length === 1) return null;\r\n\r\n const baseUrl = hostURL();\r\n const selectedCulture = cultures.find((clt) => clt.id === appCulture()) ?? cultures.find((clt) => clt.isDefault);\r\n\r\n function createLink(culture: SupportedCulture): string {\r\n const baseUrlWithCulture = new URL(createBaseUrl(culture));\r\n baseUrlWithCulture.searchParams.append('forceCulture', 'true');\r\n return baseUrlWithCulture.href;\r\n }\r\n\r\n function createBaseUrl(culture: SupportedCulture): string {\r\n const segments = document.location.pathname\r\n .concat(document.location.search)\r\n .split('/')\r\n .filter((el) => el !== '');\r\n if (segments.length >= 1) {\r\n if (segments[0] === appCulture()) {\r\n if (segments[0] === culture.id) {\r\n return document.location.href;\r\n }\r\n segments.shift();\r\n }\r\n return `${baseUrl}${culture.isDefault ? '' : `${culture.id}/`}${segments.join('/')}`;\r\n }\r\n return `${baseUrl}${culture.isDefault ? '' : `${culture.id}/`}`;\r\n }\r\n\r\n return (\r\n
setExpand(!expand)} ref={ref}>\r\n \r\n

{capitalizeFirstLetter(selectedCulture?.fullName).slice(0, 3)}

\r\n \r\n
\r\n
\r\n {cultures.map((culture) => {\r\n return (\r\n \r\n
\r\n \r\n
\r\n\r\n

{capitalizeFirstLetter(culture.fullName)}

\r\n \r\n );\r\n })}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport default LanguageSwitch;\r\n","import axios, { AxiosInstance } from 'axios';\r\n\r\nconst baseURL = (document.getElementById('baseUrl') as any).value;\r\n\r\nconst instance: AxiosInstance = axios.create({\r\n baseURL,\r\n});\r\n\r\nexport default instance;\r\n","import { openNewWindow } from './helpers/routing-helpers';\r\n/* eslint-disable @typescript-eslint/no-explicit-any */\r\n/* eslint-disable no-extend-native */\r\n/* eslint-disable func-names */\r\ndeclare global {\r\n interface Array {\r\n orderByDesc(propertyName: string): void;\r\n orderByAsc(propertyName: string): void;\r\n removeDuplicates(): any[];\r\n }\r\n}\r\n\r\nArray.prototype.orderByAsc = function (propertyName: string): void {\r\n this.sort((a, b) => {\r\n return a[propertyName] - b[propertyName];\r\n });\r\n};\r\nArray.prototype.orderByDesc = function (propertyName: string): void {\r\n this.sort((a, b) => {\r\n return b[propertyName] - a[propertyName];\r\n });\r\n};\r\nArray.prototype.removeDuplicates = function (): any[] {\r\n const removedDuplicates = new Set(this);\r\n const arrayWithoutDuplicates = Array.from(removedDuplicates);\r\n return arrayWithoutDuplicates;\r\n};\r\n\r\nexport interface StaticContent {\r\n messages: {\r\n tooltipsGeoDisabled: string;\r\n tooltipsFillAddress: string;\r\n tooltipsFillStreetNumber: string;\r\n tooltipsAdressConfirmation: string;\r\n errorMessagesWrongAddress: string;\r\n errorMessagesWrongStreetNumber: string;\r\n errorMessagesImpossibleToLocateDelivery: string;\r\n errorMessagesImpossibleToLocatePickup: string;\r\n errorMessagesNoStores: string;\r\n errorModalTitle: string;\r\n errorModalDescription: string;\r\n\r\n // TODO update to return not as a part of messages\r\n apiKey: string;\r\n };\r\n simplifiedFooter: {\r\n Name: string;\r\n Url: string;\r\n OpenInNewWindow?: { Value: boolean };\r\n }[];\r\n configuration: {\r\n hideCouponsScratchedPrices: boolean;\r\n }\r\n}\r\n\r\nexport interface PropertyChangedPayload {\r\n name: string;\r\n value: string;\r\n}\r\n\r\nexport interface PropertyChangedEventArgs {\r\n target: {\r\n name: string;\r\n value: T;\r\n };\r\n}\r\n\r\nexport interface ServerSideValidationPayload {\r\n fieldName: string;\r\n message: string;\r\n status: number;\r\n errorCode: string;\r\n}\r\n\r\nexport interface GeneralServerError {\r\n succeeded: boolean;\r\n status: number;\r\n errorCode: string;\r\n contentMessageForErrorFound: boolean;\r\n contextDescription: string;\r\n errorDescription: string;\r\n errorTranslations: {\r\n title: string;\r\n description: string;\r\n },\r\n detail: string;\r\n}\r\n\r\nexport interface PlaceOrderError extends GeneralServerError {\r\n entitiesErrors: {\r\n entityIdentifier: string;\r\n entityType: string;\r\n errorCode: string;\r\n }[];\r\n}\r\n\r\nexport interface LoaderPayload {\r\n value: boolean;\r\n}\r\n\r\nexport enum UserMessageType {\r\n INFO,\r\n WARNING,\r\n ERROR,\r\n}\r\nexport interface UserMessage {\r\n type: UserMessageType;\r\n message: string;\r\n status?: number;\r\n}\r\n\r\nexport enum OrderDistributionType {\r\n Delivery = 'DELIVERY',\r\n Pickup = 'PICKUP',\r\n}\r\n\r\nexport interface ValidatorItem {\r\n fn(value: string): boolean;\r\n message: string;\r\n messageType: UserMessageType;\r\n}\r\n\r\nexport interface ValidationResult {\r\n messages: UserMessage[];\r\n success: boolean;\r\n}\r\n\r\nexport interface AppCookies {\r\n 'pizza-hut-access-token': {\r\n email: string;\r\n phone: string;\r\n };\r\n}\r\n\r\nexport interface SupportedCulture {\r\n isDefault: boolean;\r\n id: string;\r\n fullName: string;\r\n shortName: string;\r\n}\r\n\r\nexport interface ModalProps {\r\n submitCallbackFn?(): void;\r\n cancelCallbackFn(): void;\r\n}\r\n\r\nexport enum OrderStatusEnum {\r\n CreatingOrder = 0,\r\n AwaitingExternalPayment = 1,\r\n PaymentSettledButNotYetSuppliedToStore = 2,\r\n ReceivedByStore = 3,\r\n InOven = 4,\r\n ReadyForDispatch = 5,\r\n OutForDelivery = 6,\r\n Completed = 7,\r\n Cancelled = 8,\r\n ReceivedButFutureOrder = 9,\r\n ExternalPaymentFailed = 10,\r\n AwaitingExternalValidation = 11,\r\n ExternalValidationFailed = 12,\r\n AwaitingExternalCreation = 13,\r\n ExternalCreationFailed = 14,\r\n ExternalCreationTimedOut = 15,\r\n}\r\n\r\nexport enum AppReviewTarget {\r\n NATIVE_STORE = 'NATIVE_STORE',\r\n DB = 'DB'\r\n}\r\n\r\nexport interface AppConfiguration {\r\n maxChangeableToppingsForEditPizza: number;\r\n maxExtraToppingsForEditPizza: number;\r\n maxToppingsForCustomPizza: number;\r\n appReviewsEnabled: boolean;\r\n positiveReviewsTarget: AppReviewTarget;\r\n negativeReviewsTarget: AppReviewTarget;\r\n}\r\n\r\nexport enum ApplicationType {\r\n MOBILE = 'Mobile',\r\n WEBSITE = 'Website'\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { Dispatch } from 'redux';\r\nimport { UserMessage, UserMessageType } from 'shared/types';\r\nimport { GlobalActionTypes } from '../store/global/global.actions';\r\n\r\ninterface ResponseWrapperArgs {\r\n action(): Promise;\r\n dispatch: Dispatch;\r\n errMessage?: UserMessage;\r\n allowedErr?: {\r\n statusArr?: number[];\r\n errorCodes?: string[];\r\n action?(err: any): void;\r\n };\r\n errorCallback?(err: any): Promise;\r\n withoutGlobalNotification?: boolean;\r\n}\r\n\r\nasync function ResponseWrapper({\r\n action,\r\n dispatch,\r\n errMessage,\r\n allowedErr,\r\n errorCallback,\r\n withoutGlobalNotification = false,\r\n}: ResponseWrapperArgs): Promise {\r\n let message = errMessage;\r\n try {\r\n dispatch({\r\n type: GlobalActionTypes.CLEAR_MESSAGES,\r\n });\r\n return await action();\r\n } catch (error: any) {\r\n if (allowedErr?.statusArr?.includes(error.response.status)) {\r\n allowedErr.action && allowedErr.action(error);\r\n return undefined;\r\n }\r\n if (allowedErr?.errorCodes?.includes(error.response.data.errorCode)) {\r\n allowedErr.action && allowedErr.action(error);\r\n return undefined;\r\n }\r\n if (errMessage == null || errMessage === undefined) {\r\n const { errorCode, status } = error.response.data;\r\n\r\n message = {\r\n message: errorCode || 'Server error.',\r\n type: UserMessageType.ERROR,\r\n status,\r\n };\r\n }\r\n\r\n if (!withoutGlobalNotification) {\r\n dispatch({ type: GlobalActionTypes.SET_MESSAGES, payload: [message] });\r\n }\r\n\r\n console.error(error);\r\n\r\n if (errorCallback) {\r\n return errorCallback(error);\r\n }\r\n dispatch({ type: GlobalActionTypes.SET_LOADER_STATE, payload: false });\r\n dispatch({ type: GlobalActionTypes.SHOW_UNHANDLED_ERROR_MODAL, payload: true });\r\n }\r\n}\r\n\r\nexport default ResponseWrapper;\r\n","/* eslint-disable no-use-before-define */\r\nimport { ApplicationState } from 'apps/LocalizationApp/Store';\r\nimport { Action, Dispatch } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport { FormValidatorHandler } from 'shared/validators';\r\nimport { logout } from 'shared/helpers/routing-helpers';\r\nimport axios from 'shared/api/axios';\r\nimport { PushNotificationsProvider } from 'typings/web-bridge.types';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { AxiosResponse } from 'axios';\r\nimport { UserMessage, UserMessageType, LoaderPayload, SupportedCulture, AppConfiguration } from '../../types';\r\n\r\nexport enum GlobalActionTypes {\r\n SET_MESSAGES = '[Shared.Global] SET_MESSAGES',\r\n CLEAR_MESSAGES = '[Shared.Global] CLEAR_MESSAGES',\r\n SET_USER_STATUS = '[Shared.Global] SET_USER_STATUS',\r\n SET_LOADER_STATE = '[Shared.Global] SET_LOADER_STATE',\r\n SHOW_UNHANDLED_ERROR_MODAL = '[Shared.Global] SHOW_UNHANDLED_ERROR_MODAL',\r\n SET_SUPPORTED_CULTURES = '[Shared.Global] SET_SUPPORTED_CULTURES',\r\n SET_APP_CONFIGURATION = '[Shared.Global] SET_APP_CONFIGURATION',\r\n}\r\n\r\nexport interface SetMessages {\r\n type: GlobalActionTypes.SET_MESSAGES;\r\n payload: UserMessage[];\r\n}\r\n\r\nexport interface ClearMessages {\r\n type: GlobalActionTypes.CLEAR_MESSAGES;\r\n}\r\n\r\nexport interface SetSupportedCultures {\r\n type: GlobalActionTypes.SET_SUPPORTED_CULTURES;\r\n payload: SupportedCulture[];\r\n}\r\nexport interface SetLoaderState {\r\n type: GlobalActionTypes.SET_LOADER_STATE;\r\n payload: LoaderPayload;\r\n}\r\n\r\nexport interface SetShowUnhandledError {\r\n type: GlobalActionTypes.SHOW_UNHANDLED_ERROR_MODAL;\r\n payload: boolean;\r\n}\r\n\r\ninterface SetUserStatusPayload {\r\n signedin: boolean;\r\n}\r\n\r\ninterface SetUserStatus extends Action {\r\n type: GlobalActionTypes.SET_USER_STATUS;\r\n payload: SetUserStatusPayload;\r\n}\r\n\r\ninterface SetMessageWithExpirationTimeArgs {\r\n type: UserMessageType;\r\n message: string;\r\n expirationTime?: number;\r\n}\r\n\r\nexport interface SetAppConfiguration {\r\n type: GlobalActionTypes.SET_APP_CONFIGURATION;\r\n payload: AppConfiguration;\r\n}\r\n\r\nexport const setMessageWithExpirationTime =\r\n ({\r\n message,\r\n type,\r\n expirationTime = 5000,\r\n }: SetMessageWithExpirationTimeArgs): ThunkAction =>\r\n async (dispatch): Promise => {\r\n const action: SetMessages = {\r\n payload: [\r\n {\r\n message,\r\n type,\r\n },\r\n ],\r\n type: GlobalActionTypes.SET_MESSAGES,\r\n };\r\n dispatch(action);\r\n const tooltipTimer = setTimeout(() => {\r\n dispatch({\r\n type: GlobalActionTypes.CLEAR_MESSAGES,\r\n });\r\n clearTimeout(tooltipTimer);\r\n }, expirationTime);\r\n };\r\n\r\ninterface ValidateAndNotifyArgs {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n dispatch: Dispatch;\r\n validator: FormValidatorHandler;\r\n}\r\n\r\nexport function ValidateAndNotify({ dispatch, validator }: ValidateAndNotifyArgs): boolean {\r\n const result = validator.validate();\r\n if (result.success) {\r\n return true;\r\n }\r\n\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: result.messages[0].message,\r\n type: result.messages[0].type,\r\n }),\r\n );\r\n\r\n return false;\r\n}\r\n\r\nexport const SetLoader =\r\n (value: boolean): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: GlobalActionTypes.SET_LOADER_STATE,\r\n payload: {\r\n value,\r\n },\r\n });\r\n };\r\n\r\nconst mobileLogout = (): void => {\r\n const mobile = window.S4DWebBridge();\r\n if (mobile == null) {\r\n return;\r\n }\r\n mobile.userLoggedOut();\r\n};\r\n\r\nexport const logoutHandler =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n const deviceTokens: string | null = localStorage.getItem('deviceTokens');\r\n\r\n if (deviceTokens) {\r\n const parsedDeviceTokens: { deviceId: string; installationId: string; provider: PushNotificationsProvider } =\r\n JSON.parse(deviceTokens);\r\n const { deviceId, installationId, provider } = parsedDeviceTokens;\r\n\r\n ResponseWrapper({\r\n action: () => {\r\n return axios.post('api/accounts/remove-tokens', { deviceId, installationId, provider });\r\n },\r\n dispatch,\r\n });\r\n }\r\n\r\n mobileLogout();\r\n logout();\r\n };\r\n\r\nexport const getLanguages =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const cultures: AxiosResponse = await axios.get('api/culture');\r\n dispatch({\r\n type: GlobalActionTypes.SET_SUPPORTED_CULTURES,\r\n payload: cultures.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getAppConfiguration =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await axios.get('api/configuration');\r\n dispatch({\r\n type: GlobalActionTypes.SET_APP_CONFIGURATION,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\n\r\nexport type GlobalActions =\r\n | SetSupportedCultures\r\n | SetMessages\r\n | ClearMessages\r\n | SetUserStatus\r\n | SetLoaderState\r\n | SetShowUnhandledError\r\n | SetAppConfiguration;\r\n","import { AxiosResponse } from 'axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport Axios from '../../api/axios';\r\nimport { StaticContent } from '../../types';\r\n\r\nexport enum StaticContentActionTypes {\r\n SET_STATIC_CONTENT = '[Shared.StaticContent] SET_STATIC_CONTENT',\r\n SET_SIMPLIFIED_FOOTER = '[Shared.StaticContent] SET_SIMPLIFIED_FOOTER',\r\n SET_CONFIGURATION = '[Shared.StaticContent] SET_CONFIGURATION'\r\n}\r\n\r\ninterface SetStaticContent {\r\n type: StaticContentActionTypes.SET_STATIC_CONTENT;\r\n payload: StaticContent['messages'];\r\n}\r\ninterface SetSimplifiedFooter {\r\n type: StaticContentActionTypes.SET_SIMPLIFIED_FOOTER;\r\n payload: StaticContent['simplifiedFooter'];\r\n}\r\n\r\ninterface SetConfiguration {\r\n type: StaticContentActionTypes.SET_CONFIGURATION;\r\n payload: StaticContent['configuration'];\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n try {\r\n const value: AxiosResponse = await Axios.get('api/static-content');\r\n dispatch({\r\n type: StaticContentActionTypes.SET_STATIC_CONTENT,\r\n payload: value.data,\r\n });\r\n } catch (err) {\r\n console.error(err);\r\n throw err;\r\n }\r\n };\r\n\r\nexport const getSimplifiedFooterStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n try {\r\n const footer: AxiosResponse = await Axios.get('api/static-content/simplified-footer');\r\n dispatch({ type: StaticContentActionTypes.SET_SIMPLIFIED_FOOTER, payload: footer.data });\r\n } catch (err) {\r\n console.error(err);\r\n throw err;\r\n }\r\n };\r\n\r\nexport const getCmsConfiguration =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n try {\r\n const value: AxiosResponse = await Axios.get('api/static-content/cms-configuration');\r\n dispatch({\r\n type: StaticContentActionTypes.SET_CONFIGURATION,\r\n payload: value.data,\r\n });\r\n } catch (err) {\r\n console.error(err);\r\n throw err;\r\n }\r\n };\r\n\r\nexport type StaticContentActions = SetStaticContent | SetSimplifiedFooter | SetConfiguration;\r\n","/* eslint-disable no-restricted-globals */\r\nimport * as _routingHelpers from './routing-helpers';\r\n\r\n// exports\r\nexport const RoutingHelpers = _routingHelpers;\r\n\r\nexport const DateTime = {\r\n now: (): string => {\r\n const date = new Date();\r\n const timestamp = `${date.getFullYear()}-${\r\n date.getMonth() + 1\r\n }-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;\r\n return timestamp;\r\n },\r\n formatTimeHHMM: (date: Date): string => {\r\n const hour = date.getHours().toString().length === 1 ? `0${date.getHours()}` : date.getHours().toString();\r\n const minutes = date.getMinutes().toString().length === 1 ? `0${date.getMinutes()}` : date.getMinutes().toString();\r\n\r\n return `${hour}:${minutes}`;\r\n },\r\n // method to format DD/MM/YYYY to Date object\r\n formatToDateObject: (date: string): Date | undefined => {\r\n if (!date || date.length === 0) return undefined;\r\n const year = date.slice(6);\r\n const month = date.slice(3, 5);\r\n const day = date.slice(0, 2);\r\n\r\n return new Date(`${year}-${month}-${day}`);\r\n },\r\n};\r\n\r\nexport const StringHelper = {\r\n GetFirstNWords: (sourceString: string, n: number): string => {\r\n return sourceString && typeof n === 'number' ? sourceString.split(' ').slice(0, n).join(' ') : '';\r\n },\r\n OmitFirstNWords: (sourceString: string, n: number): string => {\r\n if (sourceString && typeof n === 'number') {\r\n const words = sourceString.split(' ');\r\n return words.slice(n, words.length).join(' ');\r\n }\r\n return '';\r\n },\r\n};\r\n\r\nexport const PaymentHelper = {\r\n getCurrencyISOCode(): string {\r\n const currency = (document.getElementById('defaultCurrency') as any).value;\r\n return currency;\r\n },\r\n getDefaultCulture(): string {\r\n const culture = (document.getElementById('defaultCulture') as any).value;\r\n return culture;\r\n },\r\n formatToDisplay(value: number): string {\r\n return new Intl.NumberFormat(this.getDefaultCulture(), { style: 'currency', currency: this.getCurrencyISOCode() }).format(\r\n value,\r\n );\r\n },\r\n formatStringToDisplay(value: string): string {\r\n const valAsNumber = parseFloat(value.replace(',', '.'));\r\n if (isNaN(valAsNumber)) return '';\r\n return this.formatToDisplay(valAsNumber);\r\n },\r\n};\r\n\r\n// eslint-disable-next-line\r\nexport const FieldsToBooleanCondition = (obj: any): boolean => {\r\n const keys = Object.keys(obj);\r\n let result = false;\r\n keys.forEach((key) => {\r\n if (obj[key] !== false) result = obj[key] !== false;\r\n });\r\n return result;\r\n};\r\n","import React, { useEffect, useState } from 'react';\r\n\r\nexport interface LoaderProps {\r\n text?: string;\r\n fullScreen?: boolean;\r\n}\r\n\r\nconst Loader: React.FC = ({ text, fullScreen }) => {\r\n const mobile = window.S4DWebBridge();\r\n const delay = 1000;\r\n const [show, setShowLoader] = useState(false);\r\n\r\n useEffect(() => {\r\n setShowLoader(false);\r\n mobile && mobile?.hideLoader();\r\n const delayedLoader = setTimeout(() => {\r\n mobile && mobile?.showLoader();\r\n setShowLoader(true);\r\n }, delay);\r\n return () => {\r\n clearTimeout(delayedLoader);\r\n mobile && mobile?.hideLoader();\r\n setShowLoader(false);\r\n };\r\n }, []);\r\n\r\n if (!show) return null;\r\n return (\r\n \r\n \r\n {text && (\r\n \r\n {text}\r\n \r\n )}\r\n \r\n );\r\n};\r\nexport default Loader;\r\n","import React from 'react';\r\n\r\ninterface ToastProps {\r\n show: boolean;\r\n message: string;\r\n onClose(): void;\r\n}\r\n\r\nconst Toast: React.FC = ({ message, onClose, show }) => {\r\n return (\r\n \r\n {message}\r\n \r\n \r\n );\r\n};\r\n\r\nexport default Toast;\r\n","import { LocalizationStaticContent } from 'apps/LocalizationApp/Store/static-content/localization-static-content.reducer';\r\nimport React from 'react';\r\nimport { useSelector } from 'react-redux';\r\nimport { ApplicationState } from '../Store';\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport { StoreDto } from '../types/dto.types';\r\n\r\ninterface StoresListProps {\r\n onSelect(store: StoreDto): void;\r\n show: boolean;\r\n onToggle(): void;\r\n distanceUnit: string;\r\n}\r\n\r\nconst StoresList: React.FC = ({ onSelect, show, onToggle, distanceUnit }) => {\r\n const { nearbyStores, selectedAddress } = useSelector((state) => state.localization);\r\n const { dropdownLabelPickupResults } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n\r\n function renderStores(): JSX.Element {\r\n return (\r\n <>\r\n \r\n

{dropdownLabelPickupResults}

\r\n \r\n \r\n
\r\n {show &&\r\n nearbyStores.map((store) => {\r\n return (\r\n {\r\n gtm.localizationModule.submitClickedOnCollection();\r\n onSelect(store);\r\n }}\r\n key={store.id}\r\n className=\"store-suggestion-item p-2 px-lg-3 d-flex\"\r\n data-testid=\"localization__button--select-store\"\r\n >\r\n
\r\n \r\n
\r\n

\r\n {`${store.street}, ${store.streetNumber}${\r\n selectedAddress.isCompleteAddress\r\n ? ` (${(store.distance / 1000).toFixed(1)} ${distanceUnit})`\r\n : ''\r\n }`}\r\n

\r\n

\r\n {store.city}\r\n

\r\n
\r\n
\r\n
\r\n );\r\n })}\r\n \r\n \r\n );\r\n }\r\n\r\n return <>{nearbyStores.length > 0 && renderStores()};\r\n};\r\n\r\nexport default StoresList;\r\n","import React, { useEffect, useState } from 'react';\r\nimport { AddressDetailsDto, AddressSuggestionDto } from '../../apps/LocalizationApp/types/dto.types';\r\n\r\ninterface PredictionsProps {\r\n suggestions: AddressSuggestionDto[];\r\n onSelect(placeId: string): void;\r\n selectedAddress: AddressDetailsDto;\r\n}\r\n\r\nconst Suggestions: React.FC = ({ suggestions, onSelect, selectedAddress }) => {\r\n const [selectedSuggestion, setSelectedSuggestion] = useState();\r\n const suggestionsIds = suggestions.map((suggestion) => suggestion.placeId);\r\n\r\n useEffect(() => {\r\n window.addEventListener('keydown', handleKeyboardNavigation);\r\n if (selectedSuggestion) {\r\n document.getElementById(selectedSuggestion)?.classList.add('selected');\r\n }\r\n return () => {\r\n window.removeEventListener('keydown', handleKeyboardNavigation);\r\n };\r\n });\r\n\r\n const handleKeyboardNavigation = (e: KeyboardEvent) => {\r\n switch (e.key) {\r\n case 'Down':\r\n e.preventDefault();\r\n moveDown();\r\n case 'ArrowDown':\r\n e.preventDefault();\r\n moveDown();\r\n break;\r\n case 'Up':\r\n e.preventDefault();\r\n moveUp();\r\n case 'ArrowUp':\r\n e.preventDefault();\r\n moveUp();\r\n break;\r\n case 'Enter':\r\n e.preventDefault();\r\n selectedSuggestion && onSelect(selectedSuggestion);\r\n default:\r\n break;\r\n }\r\n };\r\n\r\n const moveDown = () => {\r\n if (selectedSuggestion) {\r\n const currentSuggestion = document.getElementById(selectedSuggestion);\r\n const currentSuggestionIndex = suggestionsIds.indexOf(selectedSuggestion);\r\n const nextSuggestion = suggestionsIds[currentSuggestionIndex < suggestionsIds.length - 1 ? currentSuggestionIndex + 1 : 0];\r\n currentSuggestion?.classList.remove('selected');\r\n setSelectedSuggestion(nextSuggestion);\r\n } else {\r\n setSelectedSuggestion(suggestionsIds[0]);\r\n }\r\n };\r\n\r\n const moveUp = () => {\r\n if (selectedSuggestion) {\r\n const currentSuggestion = document.getElementById(selectedSuggestion);\r\n const currentSuggestionIndex = suggestionsIds.indexOf(selectedSuggestion);\r\n const nextSuggestion =\r\n suggestionsIds[currentSuggestionIndex === 0 ? suggestionsIds.length - 1 : currentSuggestionIndex - 1];\r\n currentSuggestion?.classList.remove('selected');\r\n setSelectedSuggestion(nextSuggestion);\r\n } else {\r\n setSelectedSuggestion(suggestionsIds[-1]);\r\n }\r\n };\r\n\r\n function renderSuggestion(suggestion: AddressSuggestionDto): JSX.Element {\r\n const isSuggestionSubstr = suggestion.mainText.toLowerCase().includes(selectedAddress.value.toLowerCase());\r\n const formattedSuggestion =\r\n isSuggestionSubstr && suggestion.mainText.toLowerCase().split(selectedAddress.value.toLowerCase(), 2);\r\n return (\r\n <>\r\n {formattedSuggestion ? (\r\n

\r\n {formattedSuggestion[0]}\r\n {selectedAddress.value}\r\n {formattedSuggestion[1]}\r\n

\r\n ) : (\r\n

\r\n {suggestion.mainText}\r\n

\r\n )}\r\n {suggestion.secondaryText && (\r\n

\r\n {suggestion.secondaryText}\r\n

\r\n )}\r\n \r\n );\r\n }\r\n\r\n return (\r\n <>\r\n {suggestions &&\r\n suggestions.map((suggestion) => (\r\n {\r\n onSelect(suggestion.placeId);\r\n }}\r\n key={suggestion.placeId}\r\n className=\"address-suggestion-item d-flex p-1\"\r\n data-testid=\"localization__button--select-suggestion\"\r\n tabIndex={0}\r\n id={suggestion.placeId}\r\n >\r\n
\r\n \r\n
{renderSuggestion(suggestion)}
\r\n
\r\n \r\n ))}{' '}\r\n \r\n );\r\n};\r\n\r\nexport default Suggestions;\r\n","import { useEffect, useState } from 'react';\r\n\r\ninterface ShowDelay {\r\n show: ShowOptions;\r\n}\r\n\r\nenum ShowOptions {\r\n show = 'show',\r\n hide = 'd-none',\r\n none = '',\r\n}\r\n\r\nexport default function useShowDelay(isVisible: boolean): ShowDelay {\r\n const [show, setShow] = useState(ShowOptions.none);\r\n\r\n useEffect(() => {\r\n setShow(ShowOptions.none);\r\n setTimeout(() => {\r\n setShow(isVisible ? ShowOptions.show : ShowOptions.hide);\r\n }, 100);\r\n }, [isVisible]);\r\n\r\n return { show };\r\n}\r\n","import React from 'react';\r\nimport useShowDelay from 'hooks/useShowDelay';\r\nimport { ApplicationState } from 'apps/LocalizationApp/Store';\r\nimport { useSelector } from 'react-redux';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\nimport { AddressDetailsDto } from '../types/dto.types';\r\n\r\ninterface AddressInputProps {\r\n address: AddressDetailsDto;\r\n isPickup: boolean;\r\n onChangeFn(sender?: React.ChangeEvent, clear?: boolean): void;\r\n onClear(): void;\r\n suggestionsHelper(): void;\r\n showStreetNumberInput: boolean;\r\n}\r\n\r\nconst AddressInput: React.FC = ({\r\n address,\r\n isPickup,\r\n onChangeFn,\r\n onClear,\r\n suggestionsHelper,\r\n showStreetNumberInput,\r\n}) => {\r\n const { localizationInputPlaceholder } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n\r\n const { value, streetNumber } = address;\r\n const { show: showClear } = useShowDelay(!!value);\r\n\r\n function onClickHandler(): void {\r\n if (value) {\r\n suggestionsHelper();\r\n }\r\n isPickup ? gtm.localizationModule.inputClickedOnCollection() : gtm.localizationModule.inputClickedOnDelivery();\r\n }\r\n\r\n function getInputStyle(): string {\r\n if (!showStreetNumberInput) return 'rounded-top';\r\n return 'rounded';\r\n }\r\n\r\n return (\r\n
\r\n \r\n \r\n\r\n {showStreetNumberInput && (\r\n \r\n )}\r\n
\r\n );\r\n};\r\n\r\nexport default AddressInput;\r\n","import React, { useEffect, useState } from 'react';\r\nimport { useSelector } from 'react-redux';\r\n\r\n// shared\r\nimport { GlobalState } from 'shared/store/global/global.reducer';\r\nimport { StaticContent, UserMessageType } from 'shared/types';\r\nimport { ApplicationState } from '../Store';\r\n\r\ninterface InfoPanelContainerProps {\r\n testId: string;\r\n}\r\n\r\nfunction getContainerClassByType(type: UserMessageType): string {\r\n switch (type) {\r\n case UserMessageType.INFO:\r\n return 'bg-white';\r\n case UserMessageType.WARNING:\r\n return 'bg-warning';\r\n default:\r\n return 'bg-white';\r\n }\r\n}\r\n\r\nfunction getTextClassByType(type: UserMessageType): string {\r\n switch (type) {\r\n case UserMessageType.INFO:\r\n return '';\r\n case UserMessageType.WARNING:\r\n return 'px-3 py-2';\r\n default:\r\n return 'text-danger p-bold';\r\n }\r\n}\r\n\r\nfunction getArrowClassByType(type: UserMessageType): string {\r\n switch (type) {\r\n case UserMessageType.INFO:\r\n return 'border-0';\r\n case UserMessageType.WARNING:\r\n return 'border-warning';\r\n default:\r\n return 'border-0';\r\n }\r\n}\r\n\r\nconst InfoPanelContainer: React.FC = ({ testId }) => {\r\n const globalState = useSelector((e) => e.global);\r\n const { messages } = useSelector((state) => state.staticContent);\r\n const [offset, setOffset] = useState<{}>();\r\n\r\n const firstElement = globalState.messages[0];\r\n\r\n useEffect((): void => {\r\n if (firstElement && firstElement.message) {\r\n if (firstElement.message === messages.tooltipsFillStreetNumber) {\r\n setOffset({ right: 20 });\r\n return;\r\n }\r\n setOffset(undefined);\r\n }\r\n }, [globalState]);\r\n\r\n if (globalState.messages.length === 0) return <>;\r\n\r\n return (\r\n \r\n

{firstElement.message}

\r\n {offset &&
}\r\n
\r\n );\r\n};\r\n\r\nexport default InfoPanelContainer;\r\n","import React from 'react';\r\nimport { LocalizationAdditionContent } from '../Store/static-content/localization-static-content.reducer';\r\n\r\ninterface LocalizationAdditionProps {\r\n additionData?: LocalizationAdditionContent;\r\n}\r\n\r\nconst LocalizationAddition: React.FC = ({ additionData }) => {\r\n if (!additionData) return null;\r\n return (\r\n
\r\n {additionData.headerText}\r\n

\r\n {additionData.paragraphText}\r\n {additionData.linkText && additionData.linkHref && (\r\n \r\n {additionData.linkText}\r\n \r\n )}\r\n

\r\n
\r\n );\r\n};\r\n\r\nexport default LocalizationAddition;\r\n","import React from 'react';\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { AddressDetailsDto, StoreDto } from '../types/dto.types';\r\n\r\ninterface Props {\r\n onSelectStoreFn(store: StoreDto): void;\r\n onSelectAddressFn(address: AddressDetailsDto): void;\r\n lastAddresses: AddressDetailsDto[];\r\n lastStores: StoreDto[];\r\n distributionType: OrderDistributionType;\r\n dropdownLabel: string;\r\n onToggleFn(): void;\r\n showLastUsed: boolean;\r\n}\r\n\r\nconst LastUsedAddresses = ({\r\n onSelectAddressFn,\r\n onSelectStoreFn,\r\n lastAddresses,\r\n lastStores,\r\n distributionType,\r\n dropdownLabel,\r\n onToggleFn,\r\n showLastUsed,\r\n}: Props) => {\r\n if (distributionType === OrderDistributionType.Delivery && lastAddresses.length < 1) {\r\n return <>;\r\n }\r\n if (distributionType === OrderDistributionType.Pickup && lastStores.length < 1) {\r\n return <>;\r\n }\r\n\r\n function renderAddress(address: AddressDetailsDto): JSX.Element {\r\n return (\r\n onSelectAddressFn(address)}\r\n key={address.city + address.street + address.streetNumber}\r\n className=\"store-suggestion-item p-2 px-lg-3 d-flex\"\r\n data-testid=\"localization__button--select-store\"\r\n >\r\n
\r\n \r\n
\r\n {`${address.street}, ${address.streetNumber}`}

\r\n

\r\n {address.city}\r\n

\r\n
\r\n
\r\n \r\n );\r\n }\r\n\r\n function renderStore(store: StoreDto) {\r\n return (\r\n onSelectStoreFn(store)}\r\n key={store.id}\r\n className=\"store-suggestion-item p-2 px-lg-3 d-flex\"\r\n data-testid=\"localization__button--select-store\"\r\n >\r\n
\r\n \r\n
\r\n {`${store.street}, ${store.streetNumber}`}

\r\n

\r\n {store.city}\r\n

\r\n
\r\n
\r\n \r\n );\r\n }\r\n\r\n function renderItems(): JSX.Element {\r\n if (distributionType === OrderDistributionType.Delivery) {\r\n return <>{lastAddresses.map((address) => renderAddress(address))};\r\n }\r\n return <>{lastStores.map((store) => renderStore(store))};\r\n }\r\n\r\n return (\r\n <>\r\n \r\n

{dropdownLabel}

\r\n \r\n \r\n
\r\n {showLastUsed && renderItems()}\r\n
\r\n \r\n );\r\n};\r\n\r\nexport default LastUsedAddresses;\r\n","import { UserMessage, UserMessageType, ValidatorItem, ValidationResult } from '../types';\r\n\r\nexport interface FormValidatorHandlerArgs {\r\n value: string;\r\n validators: ValidatorItem[];\r\n name?: string;\r\n}\r\nexport class FormValidatorHandler {\r\n value: string;\r\n\r\n name?: string;\r\n\r\n validators: ValidatorItem[];\r\n\r\n constructor({ value, validators = [], name }: FormValidatorHandlerArgs) {\r\n this.value = value;\r\n this.validators = validators;\r\n this.name = name;\r\n this.validate = this.validate.bind(this);\r\n }\r\n\r\n validate(): ValidationResult {\r\n const messages: UserMessage[] = [];\r\n\r\n for (let index = 0; index < this.validators.length; index++) {\r\n const validator = this.validators[index];\r\n const result = validator.fn(this.value);\r\n\r\n if (result !== true) {\r\n messages.push({\r\n message: validator.message,\r\n type: validator.messageType,\r\n });\r\n break;\r\n }\r\n }\r\n\r\n return {\r\n success: messages.length === 0,\r\n messages,\r\n };\r\n }\r\n}\r\ninterface ValidatorArgs {\r\n message: string;\r\n messageType: UserMessageType;\r\n}\r\n\r\ninterface LengthValidatorArgs extends ValidatorArgs {\r\n length: number;\r\n}\r\ninterface MaxValueArgs extends ValidatorArgs {\r\n maxValue: number;\r\n}\r\ninterface MinValueArgs extends ValidatorArgs {\r\n minValue: number;\r\n}\r\ninterface RegexArgs extends ValidatorArgs {\r\n pattern: string;\r\n}\r\n\r\nexport const CommonValidators = {\r\n required: ({ message = 'Required field.', messageType }: ValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n return value !== undefined && value != null && value.length > 0;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n maxValue: ({ message = 'Required field.', messageType, maxValue }: MaxValueArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (!value && value.length < 1) return false;\r\n const valAsNumber = parseFloat(value.replace(',', '.'));\r\n if (valAsNumber === undefined || valAsNumber == null || Number.isNaN(valAsNumber)) {\r\n return false;\r\n }\r\n\r\n if (valAsNumber > maxValue) {\r\n return false;\r\n }\r\n\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n minValue: ({ message = 'Required field.', messageType, minValue }: MinValueArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (!value && value.length < 1) return false;\r\n const valAsNumber = parseFloat(value.replace(',', '.'));\r\n if (valAsNumber === undefined || valAsNumber == null || Number.isNaN(valAsNumber)) {\r\n return false;\r\n }\r\n\r\n if (valAsNumber < minValue) {\r\n return false;\r\n }\r\n\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n minLength: ({ message = 'Required field.', messageType, length }: LengthValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (value === undefined || value == null || value.length === 0) {\r\n return true;\r\n }\r\n\r\n return value.length >= length;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n maxLength: ({ message = 'Required field.', messageType, length }: LengthValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (value === undefined || value == null || value.length === 0) {\r\n return true;\r\n }\r\n\r\n return value.length <= length;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n email: ({ message = 'Incorrect e-mail.', messageType }: ValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (value === undefined || value == null || value.length === 0) {\r\n return false;\r\n }\r\n\r\n const mainTest = (v: string): boolean =>\r\n // eslint-disable-next-line no-control-regex\r\n /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])/i.test(\r\n v,\r\n );\r\n\r\n const arr = [mainTest];\r\n\r\n for (let i = 0; i < arr.length; i++) {\r\n const testFn = arr[i];\r\n const isValid = testFn(value);\r\n\r\n if (!isValid) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n regex: ({ message = 'Value does not match pattern.', messageType, pattern }: RegexArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n const regex = new RegExp(pattern);\r\n if (!regex.test(value)) return false;\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n phoneNumber: ({ message = 'Phone number invalid.', messageType }: ValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (!value) return true;\r\n const regex = new RegExp(`^\\\\d{9,11}$`);\r\n if (!regex.test(value)) return false;\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n date: ({ message = 'Invalid date', messageType }: ValidatorArgs): ValidatorItem => ({\r\n fn: (value): boolean => {\r\n if (!value) return true;\r\n // eslint-disable-next-line no-useless-escape\r\n const regex = new RegExp(`^([0-2][0-9]|(3)[0-1])(\\/)(((0)[0-9])|((1)[0-2]))(\\/)\\\\d{4}$`);\r\n if (!regex.test(value)) return false;\r\n return true;\r\n },\r\n message,\r\n messageType,\r\n }),\r\n};\r\n","import { Dispatch } from 'redux';\r\nimport { AddressDetailsDto } from '../types/dto.types';\r\nimport { FormValidatorHandler, CommonValidators } from '../../../shared/validators';\r\nimport { setMessageWithExpirationTime, ValidateAndNotify } from '../../../shared/store/global/global.actions';\r\nimport { UserMessageType, StaticContent } from '../../../shared/types';\r\n\r\ninterface ValidateAddressArgs {\r\n address: AddressDetailsDto;\r\n messages: StaticContent['messages'];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n dispatch: Dispatch;\r\n}\r\n\r\nexport const ValidatePickupAddress = ({ dispatch, address, messages }: ValidateAddressArgs): boolean => {\r\n const { tooltipsFillAddress, errorMessagesWrongAddress } = messages;\r\n const validators: FormValidatorHandler[] = [\r\n new FormValidatorHandler({\r\n value: address.street,\r\n validators: [CommonValidators.required({ message: tooltipsFillAddress, messageType: UserMessageType.WARNING })],\r\n }),\r\n new FormValidatorHandler({\r\n value: address.city,\r\n validators: [CommonValidators.required({ message: tooltipsFillAddress, messageType: UserMessageType.WARNING })],\r\n }),\r\n ];\r\n\r\n let isAtLeastOneValid = false;\r\n\r\n validators.forEach((validator) => {\r\n const result = validator.validate();\r\n if (result.success) {\r\n isAtLeastOneValid = true;\r\n }\r\n });\r\n\r\n if (!isAtLeastOneValid) {\r\n if (address.value) {\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: errorMessagesWrongAddress,\r\n type: UserMessageType.ERROR,\r\n }),\r\n );\r\n return false;\r\n }\r\n for (let index = 0; index < validators.length; index++) {\r\n const validator = validators[index];\r\n if (\r\n !ValidateAndNotify({\r\n dispatch,\r\n validator,\r\n })\r\n ) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n};\r\nexport enum ValidateDeliveryResponse {\r\n StreetErr = 'STREET',\r\n NumberErr = 'NUMBER',\r\n Valid = 'VALID',\r\n}\r\nexport const ValidateDeliveryAddress = ({ dispatch, address, messages }: ValidateAddressArgs): ValidateDeliveryResponse => {\r\n const { tooltipsFillAddress, tooltipsFillStreetNumber, errorMessagesWrongAddress } = messages;\r\n const validators: FormValidatorHandler[] = [\r\n new FormValidatorHandler({\r\n value: address.value,\r\n validators: [CommonValidators.required({ message: tooltipsFillAddress, messageType: UserMessageType.WARNING })],\r\n }),\r\n new FormValidatorHandler({\r\n value: address.street,\r\n validators: [CommonValidators.required({ message: errorMessagesWrongAddress, messageType: UserMessageType.ERROR })],\r\n }),\r\n new FormValidatorHandler({\r\n value: address.streetNumber,\r\n validators: [CommonValidators.required({ message: tooltipsFillStreetNumber, messageType: UserMessageType.WARNING })],\r\n }),\r\n ];\r\n\r\n for (let index = 0; index < validators.length; index++) {\r\n const validator = validators[index];\r\n\r\n if (\r\n !ValidateAndNotify({\r\n dispatch,\r\n validator,\r\n })\r\n ) {\r\n return index === 0 ? ValidateDeliveryResponse.StreetErr : ValidateDeliveryResponse.NumberErr;\r\n }\r\n }\r\n\r\n return ValidateDeliveryResponse.Valid;\r\n};\r\n","export enum LocalizationRequestErrorType {\r\n ERROR = 'Error',\r\n LOCALIZATION_DISABLED = 'LocalizationDisabled',\r\n}\r\n\r\nexport type LocationRequestSuccessCallback = (latitude: number, longitude: number) => void;\r\nexport type LocationRequestErrorCallback = (errorType: LocalizationRequestErrorType) => void;\r\n\r\nexport enum PushNotificationsProvider {\r\n FIREBASE = 0,\r\n HMS = 1,\r\n}\r\n","export enum StoreState {\r\n OPEN,\r\n OPEN_BUT_NO_ONLINE_ORDERS,\r\n OPEN_BUT_NO_DELIVERY_ORDERS,\r\n OPEN_BUT_NO_DELIVERY_BASED_ON_DELIVERY_HOURS,\r\n OPEN_BUT_NO_PICKUP_BASED_ON_PICKU_PHOURS,\r\n CLOSED,\r\n OPEN_BUT_NO_PICKUP_ORDERS,\r\n}\r\n\r\nexport enum LocalizationStrategy {\r\n PH_ES = 'PHES',\r\n PH_MX = 'PHMX'\r\n}\r\n","/* eslint-disable @typescript-eslint/no-throw-literal */\r\n/* eslint-disable import/no-cycle */\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport Axios from 'shared/api/axios';\r\nimport axios, { AxiosResponse } from 'axios';\r\n\r\n// shared\r\nimport { GlobalActionTypes, SetLoader, setMessageWithExpirationTime } from 'shared/store/global/global.actions';\r\nimport { UserMessageType, PropertyChangedPayload, OrderDistributionType } from 'shared/types';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { LocalizationRequestErrorType } from 'typings/web-bridge.types';\r\nimport { AdditionalAddressInfoDto, SelectedDateTimeFrame } from 'apps/LocalizationApp/types/dto.types';\r\nimport { AccountDetailsAddressDto } from 'apps/AccountManagementApp/account-details.types';\r\nimport { storeDataInCookie } from 'shared/utils';\r\nimport { add } from 'date-fns';\r\nimport { ApplicationState } from '.';\r\nimport { CurrentStore, StoreStatus } from './reducers';\r\nimport { AddressDetailsDto, AddressSuggestionDto, AvailableHoursDto, StoreDto } from '../types/dto.types';\r\nimport { LocalizationStrategy } from '../types/localization.types';\r\n\r\n// store\r\nimport { getStoreStatus } from '../helpers/store-status';\r\n\r\nexport enum LocalizationActionTypes {\r\n CHANGE_ORDER_DISTRIBUTION = '[LOCALIZATION_APP] CHANGE_ORDER_DISTRIBUTION',\r\n ON_PROPERTY_CHANGED = '[LOCALIZATION_APP] ON_PROPERTY_CHANGED',\r\n SET_SUGGESTIONS = '[LOCALIZATION_APP] SET_SUGGESTIONS',\r\n SET_SELECTED_ADDRESS = '[LOCALIZATION_APP] SET_SELECTED_ADDRESS',\r\n SET_ORDER_TIME = '[LOCALIZATION_APP] SET_ORDER_TIME',\r\n SET_NEARBY_STORES = '[LOCALIZATION_APP] SET_NEARBY_STORES',\r\n SET_CURRENT_STORE = '[LOCALIZATION_APP] SET_CURRENT_STORE',\r\n CLEAR_STORE = '[LOCALIZATION_APP] CLEAR_STORE',\r\n SHOW_TOAST = '[LOCALIZATION_APP] SHOW_TOAST',\r\n SHOW_MODAL = '[LOCALIZATION_APP] SHOW_MODAL',\r\n SHOW_NUMBER_INPUT = '[LOCALIZATION_APP] SHOW_NUMBER_INPUT',\r\n SET_LAST_USED_ADDRESSES = '[LOCALIZATION_APP] SET_LAST_USED_ADDRESSES',\r\n SET_LAST_USED_STORES = '[LOCALIZATION_APP] SET_LAST_USED_STORES',\r\n SET_FORCE_DELIVERY_DISTRIBUTION = '[LOCALIZATION_APP] SET_FORCE_DELIVERY_DISTRIBUTION',\r\n SET_SELECTED_STORE_STATUS = '[LOCALIZATION_APP] SET_CURRENT_STORE_STATUS',\r\n SET_ADDRESS_ADDITIONAL_INFO = '[LOCALIZATION_APP] SET_ADDRESS_ADDITIONAL_INFO',\r\n}\r\n\r\ninterface ChangeOrderDistribution {\r\n type: LocalizationActionTypes.CHANGE_ORDER_DISTRIBUTION;\r\n payload: OrderDistributionType;\r\n}\r\ninterface OnPropertyChanged {\r\n type: LocalizationActionTypes.ON_PROPERTY_CHANGED;\r\n payload: PropertyChangedPayload;\r\n}\r\ninterface SetSuggestions {\r\n type: LocalizationActionTypes.SET_SUGGESTIONS;\r\n payload: AddressSuggestionDto[];\r\n}\r\ninterface SetSelectedAddress {\r\n type: LocalizationActionTypes.SET_SELECTED_ADDRESS;\r\n payload?: AddressDetailsDto;\r\n}\r\ninterface SetSelectedOrderTime {\r\n type: LocalizationActionTypes.SET_ORDER_TIME;\r\n payload: SelectedDateTimeFrame;\r\n}\r\ninterface SetNearbyStores {\r\n type: LocalizationActionTypes.SET_NEARBY_STORES;\r\n payload: StoreDto[];\r\n}\r\ninterface ClearStore extends Action {\r\n type: LocalizationActionTypes.CLEAR_STORE;\r\n}\r\ninterface ShowToast extends Action {\r\n type: LocalizationActionTypes.SHOW_TOAST;\r\n payload: boolean;\r\n}\r\ninterface ShowModal extends Action {\r\n type: LocalizationActionTypes.SHOW_MODAL;\r\n payload: boolean;\r\n}\r\ninterface ShowNumberInput extends Action {\r\n type: LocalizationActionTypes.SHOW_NUMBER_INPUT;\r\n payload: boolean;\r\n}\r\ninterface SetLastUsedAddresses extends Action {\r\n type: LocalizationActionTypes.SET_LAST_USED_ADDRESSES;\r\n payload: AccountDetailsAddressDto[];\r\n}\r\ninterface SetLastUsedStores extends Action {\r\n type: LocalizationActionTypes.SET_LAST_USED_STORES;\r\n payload: StoreDto[];\r\n}\r\ninterface SetForceDeliveryDistribution extends Action {\r\n type: LocalizationActionTypes.SET_FORCE_DELIVERY_DISTRIBUTION;\r\n payload: boolean;\r\n}\r\ninterface SetSelectedtStoreStatus extends Action {\r\n type: LocalizationActionTypes.SET_SELECTED_STORE_STATUS;\r\n payload: StoreStatus;\r\n}\r\ninterface SetAddressAdditionalInfo extends Action {\r\n type: LocalizationActionTypes.SET_ADDRESS_ADDITIONAL_INFO;\r\n payload: AdditionalAddressInfoDto;\r\n}\r\n\r\nconst CancellationToken = axios.CancelToken;\r\nlet suggestionCancel: () => void;\r\n\r\nexport const getSuggestions =\r\n (input: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n if (input.length < 3) {\r\n return; // to short address\r\n }\r\n\r\n if (suggestionCancel) {\r\n suggestionCancel();\r\n }\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/locations/suggestions', {\r\n params: { input },\r\n cancelToken: new CancellationToken((cancelExecutor: () => void) => {\r\n suggestionCancel = cancelExecutor;\r\n }),\r\n });\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SUGGESTIONS,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getSelectedAddress =\r\n (placeId: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/locations/details', { params: { placeId } });\r\n const isDelivery = state.localization.distributionType === OrderDistributionType.Delivery;\r\n\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_NUMBER_INPUT,\r\n payload: isDelivery && !value.data.isCompleteAddress,\r\n });\r\n\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_ADDRESS,\r\n payload: value.data,\r\n });\r\n\r\n if (!value.data.streetNumber && state.localization.distributionType === OrderDistributionType.Delivery) {\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: state.staticContent.messages.tooltipsFillStreetNumber,\r\n type: UserMessageType.WARNING,\r\n }),\r\n );\r\n }\r\n\r\n if (value.data.isCompleteAddress && state.localization.distributionType === OrderDistributionType.Delivery) {\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: state.staticContent.messages.tooltipsAdressConfirmation,\r\n type: UserMessageType.WARNING,\r\n }),\r\n );\r\n }\r\n\r\n if (!isDelivery) {\r\n dispatch(getNearbyStores());\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getCoordsSuggestions =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { tooltipsGeoDisabled, errorMessagesImpossibleToLocateDelivery } = state.staticContent.messages;\r\n\r\n navigator.geolocation.getCurrentPosition(\r\n (position) => {\r\n dispatch(SetLoader(true));\r\n dispatch(prepareCoordsSuggestions(position.coords.latitude, position.coords.longitude));\r\n },\r\n (err) => {\r\n const warning = err.code === 1;\r\n const message = warning ? tooltipsGeoDisabled : errorMessagesImpossibleToLocateDelivery;\r\n const type = warning ? UserMessageType.WARNING : UserMessageType.ERROR;\r\n dispatch(SetLoader(false));\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message,\r\n type,\r\n }),\r\n );\r\n },\r\n );\r\n };\r\n\r\nexport const prepareCoordsSuggestions =\r\n (latitude: number, longitude: number): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { errorMessagesImpossibleToLocateDelivery } = state.staticContent.messages;\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n const apiResponse: AxiosResponse = await Axios.get('api/locations/suggestion-for-coordinates', {\r\n params: {\r\n latitude,\r\n longitude,\r\n language: 'es',\r\n },\r\n });\r\n\r\n if (!apiResponse.data.isCompleteAddress) {\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_NUMBER_INPUT,\r\n payload: true,\r\n });\r\n }\r\n\r\n dispatch({ type: LocalizationActionTypes.SET_SELECTED_ADDRESS, payload: apiResponse.data });\r\n\r\n if (apiResponse.data.isCompleteAddress) {\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: state.staticContent.messages.tooltipsAdressConfirmation,\r\n type: UserMessageType.WARNING,\r\n }),\r\n );\r\n }\r\n\r\n if (state.localization.distributionType === OrderDistributionType.Pickup) {\r\n dispatch(getNearbyStores());\r\n }\r\n dispatch(SetLoader(false));\r\n },\r\n dispatch,\r\n errMessage: {\r\n type: UserMessageType.ERROR,\r\n message: errorMessagesImpossibleToLocateDelivery,\r\n },\r\n });\r\n };\r\n\r\nexport const setRequestLocalizationError =\r\n (error: LocalizationRequestErrorType): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { errorMessagesImpossibleToLocateDelivery, tooltipsGeoDisabled } = state.staticContent.messages;\r\n\r\n const errorMessage =\r\n error === LocalizationRequestErrorType.LOCALIZATION_DISABLED\r\n ? tooltipsGeoDisabled\r\n : errorMessagesImpossibleToLocateDelivery;\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: errorMessage,\r\n type: UserMessageType.WARNING,\r\n }),\r\n );\r\n };\r\n\r\nconst getNearbyStores =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { selectedAddressDetails } = state.localization;\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/stores/nearby-pickup-stores', {\r\n params: {\r\n address: selectedAddressDetails,\r\n limit: 5,\r\n includeDistance: true,\r\n },\r\n });\r\n\r\n if (value.data.length <= 0) {\r\n dispatch(\r\n setMessageWithExpirationTime({\r\n message: state.staticContent.messages.errorMessagesNoStores,\r\n type: UserMessageType.ERROR,\r\n }),\r\n );\r\n dispatch(clearCurrentStoreStatus());\r\n }\r\n dispatch({\r\n type: LocalizationActionTypes.SET_NEARBY_STORES,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nconst getStoreAvailableHours = async (storeId: string, distributionType: OrderDistributionType): Promise => {\r\n const apiUrl =\r\n distributionType === OrderDistributionType.Delivery\r\n ? 'api/stores/available-times-for-delivery'\r\n : 'api/stores/available-times-for-pickup';\r\n\r\n const value: AxiosResponse = await Axios.get(apiUrl, {\r\n params: {\r\n storeId,\r\n },\r\n });\r\n\r\n return value?.data;\r\n};\r\n\r\nexport const getCurrentStore =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { selectedAddress, distributionType, selectedAddressDetails: selectedAddressOriginalValue } = state.localization;\r\n\r\n return ResponseWrapper({\r\n action: async (): Promise => {\r\n const storeToDeliveryResponse: AxiosResponse = await Axios.get('api/stores/store-delivering-to-address', {\r\n params: {\r\n address: selectedAddressOriginalValue,\r\n },\r\n });\r\n const storeToDelivery = storeToDeliveryResponse.data;\r\n\r\n if (\r\n storeToDelivery &&\r\n !storeToDelivery.isUsingS4DRegistry &&\r\n selectedAddress.localizationStrategy === LocalizationStrategy.PH_MX\r\n ) {\r\n if (!storeToDelivery.externalStoreId) throw 'Store external ID not provided';\r\n\r\n const additionalAddressInfo = await getAdditionalAddressInfo(selectedAddress, storeToDelivery.externalStoreId);\r\n dispatch({ type: LocalizationActionTypes.SET_ADDRESS_ADDITIONAL_INFO, payload: additionalAddressInfo });\r\n }\r\n\r\n const storeStatus = await getStoreStatus(storeToDelivery.id, distributionType);\r\n const dataReady = storeToDelivery && storeStatus;\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_STORE_STATUS,\r\n payload: { ...storeStatus, storePhoneNumber: storeToDelivery.phoneNumber },\r\n });\r\n\r\n if (dataReady && !storeStatus.canPlaceOrder) {\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch(SetLoader(false));\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: true });\r\n return;\r\n }\r\n\r\n // it is possible that getStoreStatus method will return canPlaceOrder with TRUE value, but there will be no available opening hours\r\n // this situation will occur when the store is ALREADY closed this day - we are checking it here and showing toast\r\n const availableHours = await getStoreAvailableHours(storeToDelivery.id, distributionType);\r\n if (!availableHours.timeframes || availableHours?.timeframes.length === 0) {\r\n dispatch(SetLoader(false));\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_TOAST,\r\n payload: true,\r\n });\r\n setTimeout(\r\n () =>\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_TOAST,\r\n payload: false,\r\n }),\r\n 5000,\r\n );\r\n return;\r\n }\r\n\r\n dispatch({\r\n type: LocalizationActionTypes.SET_CURRENT_STORE,\r\n payload: {\r\n ...storeToDelivery,\r\n availableHours,\r\n isOpen: storeStatus.canPlaceOrder,\r\n },\r\n });\r\n\r\n dispatch(SetLoader(false));\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: true });\r\n },\r\n dispatch,\r\n allowedErr: {\r\n statusArr: [404],\r\n action: (): void => {\r\n gtm.localizationModule.localizationError();\r\n dispatch(SetLoader(false));\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: true });\r\n dispatch(clearCurrentStoreStatus());\r\n dispatch(getNearbyStores());\r\n },\r\n },\r\n });\r\n };\r\n\r\nexport const setCurrentStoreForPickup =\r\n (store: StoreDto): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { distributionType } = getState().localization;\r\n return ResponseWrapper({\r\n action: async (): Promise => {\r\n const storeStatus = await getStoreStatus(store.id, distributionType);\r\n const dataReady = storeStatus;\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_STORE_STATUS,\r\n payload: { ...storeStatus, storePhoneNumber: store.phoneNumber },\r\n });\r\n\r\n if (dataReady && !storeStatus.canPlaceOrder) {\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: true });\r\n return;\r\n }\r\n\r\n // it is possible that getStoreStatus method will return canPlaceOrder with TRUE value, but there will be no available opening hours\r\n // this situation will occur when the store is ALREADY closed this day - we are checking it here and showing toast\r\n const availableHours = await getStoreAvailableHours(store.id, distributionType);\r\n if (!availableHours.timeframes || availableHours?.timeframes.length === 0) {\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_TOAST,\r\n payload: true,\r\n });\r\n setTimeout(\r\n () =>\r\n dispatch({\r\n type: LocalizationActionTypes.SHOW_TOAST,\r\n payload: false,\r\n }),\r\n 5000,\r\n );\r\n return;\r\n }\r\n\r\n if (distributionType === OrderDistributionType.Delivery) {\r\n dispatch({ type: LocalizationActionTypes.CHANGE_ORDER_DISTRIBUTION, payload: OrderDistributionType.Pickup });\r\n dispatch({ type: LocalizationActionTypes.SET_NEARBY_STORES, payload: [] });\r\n }\r\n\r\n dispatch({\r\n type: LocalizationActionTypes.SET_CURRENT_STORE,\r\n payload: {\r\n availableHours,\r\n isOpen: storeStatus.canPlaceOrder,\r\n ...store,\r\n },\r\n });\r\n\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: true });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport type GetAvailableHours = (\r\n storeId: string,\r\n distributionType: OrderDistributionType,\r\n) => ThunkAction;\r\ninterface SetCurrentStore extends Action {\r\n type: LocalizationActionTypes.SET_CURRENT_STORE;\r\n payload: CurrentStore;\r\n}\r\n\r\nexport const getCityBySelectedAddress = async (selectedAddress: AddressDetailsDto): Promise => {\r\n const input = `${selectedAddress.street}, ${selectedAddress.streetNumber}`;\r\n const suggestions: AxiosResponse = await Axios.get('api/locations/suggestions', { params: { input } });\r\n\r\n if (suggestions.data.length > 0) {\r\n const value: AxiosResponse = await Axios.get('api/locations/details', {\r\n params: { placeId: suggestions.data[0].placeId },\r\n });\r\n\r\n return value.data.city;\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nexport const validateAddress = async (\r\n selectedAddress: AddressDetailsDto,\r\n dispatch: any,\r\n message: string,\r\n): Promise => {\r\n const input = `${selectedAddress.street}, ${selectedAddress.streetNumber}, ${selectedAddress.city}, ${selectedAddress.postalCode}, ${selectedAddress.region}`;\r\n const suggestions: AxiosResponse = await Axios.get('api/locations/suggestions', { params: { input } });\r\n\r\n if (suggestions.data?.length == 0){\r\n dispatch(setMessageWithExpirationTime({ message, type: UserMessageType.ERROR }));\r\n return undefined;\r\n }\r\n\r\n if (!selectedAddress){\r\n return undefined;\r\n }\r\n\r\n // for not complete addresses and historic ones we need to choose the MOST PROBABLE suggestion\r\n const addressForValidation = selectedAddress.isCompleteAddress && selectedAddress.placeId\r\n ? suggestions.data.find(s => s.placeId === selectedAddress.placeId)\r\n : suggestions.data[0];\r\n\r\n if (addressForValidation){\r\n const primaryAddress: AxiosResponse = await Axios.get('api/locations/details', {\r\n params: { placeId: addressForValidation.placeId },\r\n });\r\n\r\n if (primaryAddress?.data?.isCompleteAddress) {\r\n return { ...selectedAddress, ...primaryAddress.data };\r\n }\r\n }\r\n\r\n // alternate address from suggestions - for MX locations, location with street number is often returned as second suggestion\r\n const alternateAddressForValidation = suggestions.data[1];\r\n if (alternateAddressForValidation) {\r\n const secondaryAddress: AxiosResponse = await Axios.get('api/locations/details', {\r\n params: { placeId: alternateAddressForValidation.placeId },\r\n });\r\n\r\n if (secondaryAddress?.data?.isCompleteAddress) {\r\n return { ...selectedAddress, ...secondaryAddress.data };\r\n }\r\n }\r\n\r\n dispatch(setMessageWithExpirationTime({ message, type: UserMessageType.ERROR }));\r\n return undefined;\r\n};\r\n\r\nexport const getAdditionalAddressInfo = async (\r\n selectedAddress: AddressDetailsDto,\r\n storeExternalId: string,\r\n): Promise => {\r\n const result: AxiosResponse = await Axios.get('api/locations/additional-info', {\r\n params: {\r\n streetName: selectedAddress.street,\r\n streetNumber: selectedAddress.streetNumber,\r\n city: selectedAddress.city,\r\n state: selectedAddress.region,\r\n postalCode: selectedAddress.postalCode,\r\n country: selectedAddress.country,\r\n latitude: selectedAddress.latitude,\r\n longitude: selectedAddress.longitude,\r\n storeId: storeExternalId,\r\n },\r\n });\r\n\r\n return result.data;\r\n};\r\n\r\nexport const setStoreAndSave =\r\n (store?: StoreDto, isOpen?: boolean): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n if (store && isOpen !== undefined) {\r\n dispatch({\r\n type: LocalizationActionTypes.SET_CURRENT_STORE,\r\n payload: {\r\n isOpen,\r\n ...store,\r\n },\r\n });\r\n }\r\n\r\n const state = getState();\r\n const { currentStore, selectedAddress, distributionType, selectedOrderTime } = state.localization;\r\n const updatedCurrentStore = { ...currentStore, availableHours: undefined };\r\n\r\n const json = JSON.stringify({\r\n currentStore: updatedCurrentStore,\r\n selectedAddress,\r\n distributionType,\r\n selectedOrderTime,\r\n });\r\n\r\n const expirationDate = selectedOrderTime?.isAsap\r\n ? add(new Date(), { minutes: 30 })\r\n : new Date(selectedOrderTime?.utcDateTimeFrame as Date);\r\n\r\n storeDataInCookie('localization', json, expirationDate);\r\n\r\n if (currentStore.id !== '') {\r\n gtm.localizationModule.localizationSuccess(distributionType, currentStore.id);\r\n }\r\n };\r\n\r\nexport const refreshSelectedAddressAndSave =\r\n (addressAddition: string, addressRemarks: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { currentStore, selectedAddress, distributionType, selectedOrderTime } = state.localization;\r\n\r\n const updatedSelectedAddress = { ...selectedAddress, addressAddition, remark: addressRemarks };\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_ADDRESS,\r\n payload: updatedSelectedAddress,\r\n });\r\n\r\n const json = JSON.stringify({\r\n currentStore,\r\n selectedAddress: updatedSelectedAddress,\r\n distributionType,\r\n selectedOrderTime,\r\n });\r\n\r\n const expirationDate = selectedOrderTime?.isAsap\r\n ? add(new Date(), { minutes: 30 })\r\n : new Date(selectedOrderTime?.utcDateTimeFrame as Date);\r\n\r\n storeDataInCookie('localization', json, expirationDate);\r\n };\r\n\r\nexport const changeDistributionType =\r\n (distributionType: OrderDistributionType): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: GlobalActionTypes.CLEAR_MESSAGES,\r\n });\r\n dispatch({\r\n type: LocalizationActionTypes.SET_FORCE_DELIVERY_DISTRIBUTION,\r\n payload: false,\r\n });\r\n dispatch({\r\n type: LocalizationActionTypes.CHANGE_ORDER_DISTRIBUTION,\r\n payload: distributionType,\r\n });\r\n dispatch({ type: LocalizationActionTypes.SET_NEARBY_STORES, payload: [] });\r\n };\r\n\r\nexport const getLastAddresses =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n return ResponseWrapper({\r\n action: async (): Promise => {\r\n const addresses = await Axios.get('api/accounts/addresses', { params: { limit: 5 } });\r\n\r\n dispatch({ type: LocalizationActionTypes.SET_LAST_USED_ADDRESSES, payload: addresses.data });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getLastStores =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n return ResponseWrapper({\r\n action: async (): Promise => {\r\n const addresses = await Axios.get('api/accounts/last-pickup-stores');\r\n\r\n dispatch({ type: LocalizationActionTypes.SET_LAST_USED_STORES, payload: addresses.data });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const clearStoreAndSave =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch(setStoreAndSave());\r\n };\r\n\r\nexport const setCurrentStoreStatus =\r\n (store: StoreDto, toDeliver: boolean): ThunkAction =>\r\n async (dispatch): Promise => {\r\n return ResponseWrapper({\r\n action: async (): Promise => {\r\n const params = { storeId: store.id, toDeliver };\r\n const storeStatus = await Axios.get('api/stores/store-status', { params });\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_STORE_STATUS,\r\n payload: { ...storeStatus, storePhoneNumber: store.phoneNumber },\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const clearCurrentStoreStatus =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({ type: LocalizationActionTypes.SET_SELECTED_STORE_STATUS, payload: undefined });\r\n };\r\n\r\nexport type LocalizationActions =\r\n | ChangeOrderDistribution\r\n | OnPropertyChanged\r\n | SetSuggestions\r\n | SetSelectedAddress\r\n | SetSelectedOrderTime\r\n | SetCurrentStore\r\n | SetNearbyStores\r\n | ClearStore\r\n | ShowToast\r\n | ShowModal\r\n | ShowNumberInput\r\n | SetLastUsedAddresses\r\n | SetLastUsedStores\r\n | SetForceDeliveryDistribution\r\n | SetSelectedtStoreStatus\r\n | SetAddressAdditionalInfo;\r\n","import Axios from 'shared/api/axios';\r\n\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { DateTime } from 'shared/helpers';\r\nimport { StoreDto, StoreStatusDto } from '../types/dto.types';\r\n\r\nexport const getStoreStatus = async (storeId: string, distributionType: OrderDistributionType): Promise => {\r\n const params = { storeId, toDeliver: distributionType === OrderDistributionType.Delivery };\r\n const storeStatusResponse = await Axios.get('api/stores/store-status', { params });\r\n\r\n return storeStatusResponse.data;\r\n};\r\n","/* eslint-disable react/jsx-no-bind */\r\nimport React, { useEffect, useState } from 'react';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\nimport useVisible from 'hooks/useVisible';\r\n\r\n// shared\r\nimport { StringHelper } from 'shared/helpers';\r\nimport { OrderDistributionType, UserMessageType, StaticContent } from 'shared/types';\r\nimport { SetLoader, setMessageWithExpirationTime } from 'shared/store/global/global.actions';\r\nimport { LocalizationRequestErrorType } from 'typings/web-bridge.types';\r\n\r\n// components\r\nimport { GlobalState } from 'shared/store/global/global.reducer';\r\nimport StoresList from '../Components/stores-list.component';\r\nimport Suggestions from '../../../shared/components/suggestions.component';\r\nimport AddressInput from '../Components/address-input.component';\r\nimport InfoPanelContainer from './info-panel.container';\r\nimport LocalizationAddition from '../Components/localization-addition.component';\r\nimport LastUsedAddresses from '../Components/last-used-addresses.component';\r\n\r\n// validators\r\nimport { ValidateDeliveryAddress, ValidateDeliveryResponse } from '../Validators/address.validator';\r\n\r\n// store\r\nimport { LocalizationActionTypes, validateAddress, getCityBySelectedAddress } from '../Store/actions';\r\nimport * as LocalizationActions from '../Store/actions';\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport { ApplicationState } from '../Store';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\n\r\nlet predictionsTimer: ReturnType;\r\n\r\nconst LocalizationSearch: React.FC = () => {\r\n const { messages } = useSelector((state) => state.staticContent);\r\n const {\r\n mainCTA,\r\n geolocationTextDelivery,\r\n geolocationTextPickup,\r\n signInLink,\r\n deliveryAddition,\r\n pickupAddition,\r\n dropdownDeliveryLabelRegisteredUser,\r\n dropdownPickupLabelRegisteredUser,\r\n storeDistanceUnit,\r\n } = useSelector((state) => state.localizationStaticContent);\r\n\r\n const { signedin } = useSelector((state) => state.global);\r\n\r\n const { ref, isVisible, setIsVisible } = useVisible(false);\r\n const [showStores, setShowStores] = useState(true);\r\n const [showLastUsed, setShowLastUsed] = useState(false);\r\n\r\n const dispatch = useDispatch();\r\n const { selectedAddress, suggestions, distributionType, showNumberInput, lastAddresses, lastStores } = useSelector<\r\n ApplicationState,\r\n LocalizationState\r\n >((state) => state.localization);\r\n\r\n const isDelivery = distributionType === OrderDistributionType.Delivery;\r\n const showSuggestions = suggestions && suggestions.length > 0 && isVisible;\r\n\r\n function setFocusOnInput(input: 'address' | 'number'): void {\r\n if (input === 'address') {\r\n // eslint-disable-next-line no-unused-expressions\r\n document.getElementById('address-input--main-field')?.focus();\r\n } else {\r\n // eslint-disable-next-line no-unused-expressions\r\n document.getElementById('address-input--street-number')?.focus();\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n if (showNumberInput && selectedAddress.value) {\r\n setFocusOnInput('number');\r\n }\r\n }, [showNumberInput]);\r\n\r\n useEffect(() => {\r\n if (signedin) {\r\n dispatch(LocalizationActions.getLastAddresses());\r\n dispatch(LocalizationActions.getLastStores());\r\n }\r\n }, [signedin]);\r\n\r\n function userLocationHandler(): void {\r\n isDelivery ? gtm.localizationModule.geolocationClickedOnDelivery() : gtm.localizationModule.geolocationClickedOnCollection();\r\n\r\n const mobile = window.S4DWebBridge();\r\n if (mobile == null) {\r\n dispatch(LocalizationActions.getCoordsSuggestions());\r\n } else {\r\n dispatch(SetLoader(true));\r\n mobile.requestLocation(successMobileLocationRequestHandler, failedMobileLocationRequestHandler);\r\n }\r\n\r\n if (!isDelivery) {\r\n setShowStores(true);\r\n setShowLastUsed(false);\r\n }\r\n }\r\n\r\n function successMobileLocationRequestHandler(latitude: number, longitude: number): void {\r\n dispatch(LocalizationActions.prepareCoordsSuggestions(latitude, longitude));\r\n }\r\n\r\n function failedMobileLocationRequestHandler(error: LocalizationRequestErrorType): void {\r\n dispatch(LocalizationActions.setRequestLocalizationError(error));\r\n dispatch(SetLoader(false));\r\n }\r\n\r\n function selectSuggestionHandler(placeId: string): void {\r\n isDelivery ? gtm.localizationModule.suggestionClickedOnDelivery() : gtm.localizationModule.suggestionClickedOnCollection();\r\n dispatch(LocalizationActions.getSelectedAddress(placeId));\r\n setIsVisible(false);\r\n\r\n if (!isDelivery) {\r\n setShowStores(true);\r\n setShowLastUsed(false);\r\n }\r\n }\r\n\r\n async function goToTimeSlotSelect(): Promise {\r\n if (!selectedAddress.value) {\r\n dispatch(setMessageWithExpirationTime({ message: messages.tooltipsFillAddress, type: UserMessageType.WARNING }));\r\n setFocusOnInput('address');\r\n return;\r\n }\r\n if (!selectedAddress.street) {\r\n dispatch(setMessageWithExpirationTime({ message: messages.errorMessagesWrongAddress, type: UserMessageType.ERROR }));\r\n setFocusOnInput('address');\r\n return;\r\n }\r\n const validationResult = ValidateDeliveryAddress({ address: selectedAddress, dispatch, messages });\r\n if (validationResult !== ValidateDeliveryResponse.Valid) {\r\n if (validationResult === ValidateDeliveryResponse.NumberErr) {\r\n setFocusOnInput('number');\r\n return;\r\n }\r\n setFocusOnInput('address');\r\n return;\r\n }\r\n if (!selectedAddress.city) {\r\n // Google's api sometimes can't return the city for address that don't provide an house number\r\n // At this stage we know for sure the value of house number and we can make a new request to get the city\r\n const city = await getCityBySelectedAddress(selectedAddress);\r\n if (city) {\r\n selectedAddress.city = city;\r\n }\r\n }\r\n dispatch(SetLoader(true));\r\n const validAddress = await validateAddress(selectedAddress, dispatch, messages.errorMessagesWrongStreetNumber);\r\n if (validAddress) {\r\n dispatch({ type: LocalizationActions.LocalizationActionTypes.SET_SELECTED_ADDRESS, payload: validAddress });\r\n dispatch(LocalizationActions.getCurrentStore());\r\n } else {\r\n dispatch(SetLoader(false));\r\n setFocusOnInput('number');\r\n }\r\n }\r\n\r\n function getSuggestions(value: string): void {\r\n clearTimeout(predictionsTimer);\r\n predictionsTimer = setTimeout(() => {\r\n dispatch(LocalizationActions.getSuggestions(value));\r\n setIsVisible(true);\r\n }, 250);\r\n }\r\n\r\n function onPropertyChange(sender: React.ChangeEvent): void {\r\n const { name, value } = sender.target;\r\n dispatch({ type: LocalizationActionTypes.ON_PROPERTY_CHANGED, payload: { name, value } });\r\n\r\n name !== 'streetNumber' && getSuggestions(value);\r\n }\r\n\r\n function getGeolocationStyle(): string {\r\n if (!isDelivery) return 'border-top-0';\r\n if (showNumberInput) return 'rounded mt-1';\r\n return 'border-top-0';\r\n }\r\n\r\n return (\r\n
\r\n \r\n \r\n {\r\n dispatch({ type: LocalizationActionTypes.SET_SELECTED_ADDRESS });\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n }}\r\n suggestionsHelper={(): void => setIsVisible(true)}\r\n showStreetNumberInput={showNumberInput}\r\n />\r\n {showSuggestions && (\r\n
\r\n \r\n \r\n
\r\n
\r\n )}\r\n
\r\n \r\n \r\n {isDelivery ? geolocationTextDelivery : geolocationTextPickup}\r\n \r\n
\r\n {isDelivery && (\r\n {\r\n gtm.localizationModule.submitClickedOnDelivery();\r\n goToTimeSlotSelect();\r\n }}\r\n data-testid=\"localization__button--get-to-select-hour-modal\"\r\n >\r\n {mainCTA}\r\n \r\n )}\r\n {!isDelivery && (\r\n {\r\n dispatch(LocalizationActions.setCurrentStoreForPickup(store));\r\n }}\r\n show={showStores}\r\n onToggle={(): void => {\r\n setShowStores((prevState) => !prevState);\r\n showLastUsed && setShowLastUsed(false);\r\n }}\r\n />\r\n )}\r\n\r\n {!signedin && (\r\n

\r\n \r\n {StringHelper.GetFirstNWords(signInLink, 2)}\r\n \r\n {StringHelper.OmitFirstNWords(signInLink, 2)}\r\n

\r\n )}\r\n {signedin && (\r\n {\r\n dispatch({\r\n type: LocalizationActionTypes.SET_SELECTED_ADDRESS,\r\n payload: { ...address, isCompleteAddress: true },\r\n });\r\n }}\r\n onSelectStoreFn={(store) => {\r\n dispatch(LocalizationActions.setCurrentStoreForPickup(store));\r\n }}\r\n lastAddresses={lastAddresses}\r\n lastStores={lastStores}\r\n distributionType={distributionType}\r\n dropdownLabel={\r\n distributionType === OrderDistributionType.Delivery\r\n ? dropdownDeliveryLabelRegisteredUser\r\n : dropdownPickupLabelRegisteredUser\r\n }\r\n onToggleFn={(): void => {\r\n setShowLastUsed((prev) => !prev);\r\n showStores && setShowStores(false);\r\n }}\r\n showLastUsed={showLastUsed}\r\n />\r\n )}\r\n \r\n );\r\n};\r\n\r\nexport default LocalizationSearch;\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { useState, useRef, useEffect, MouseEvent, MutableRefObject } from 'react';\r\n\r\ninterface ObjectVisibleHook {\r\n ref: React.MutableRefObject;\r\n isVisible: boolean;\r\n setIsVisible: React.Dispatch>;\r\n}\r\n\r\nfunction useVisible(initialIsVisible?: boolean): ObjectVisibleHook {\r\n const [isVisible, setIsVisible] = useState(initialIsVisible ?? false);\r\n const ref = useRef(null);\r\n\r\n const handleClickOutside = (ev: globalThis.MouseEvent): any => {\r\n if (ref.current !== null) {\r\n if (!ref.current.contains(ev.target)) {\r\n setIsVisible(false);\r\n }\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n document.addEventListener('click', handleClickOutside, true);\r\n return (): void => {\r\n document.removeEventListener('click', handleClickOutside, true);\r\n };\r\n }, []);\r\n\r\n return { ref, isVisible, setIsVisible };\r\n}\r\nexport default useVisible;\r\n","import React, { ReactNode, useEffect } from 'react';\r\nimport useShowDelay from 'hooks/useShowDelay';\r\nimport { ModalProps as _modalProps } from '../types';\r\n\r\ninterface BackdropComponentProps {\r\n children: ReactNode;\r\n isVisible: boolean;\r\n transparent?: boolean;\r\n onClose?(): void;\r\n closeButton?(): void;\r\n closeButtonTestId?: string;\r\n fullWidth?: boolean;\r\n backdropButton?: { visible: boolean; fixedPosition?: boolean };\r\n}\r\n\r\nconst BackdropComponent: React.FC = ({\r\n children,\r\n isVisible,\r\n onClose,\r\n transparent,\r\n closeButton,\r\n closeButtonTestId,\r\n fullWidth,\r\n backdropButton,\r\n}) => {\r\n const { show } = useShowDelay(isVisible);\r\n\r\n useEffect(() => {\r\n const body: HTMLBodyElement = document.getElementsByTagName('body')[0];\r\n if (isVisible) {\r\n body.style.overflowY = 'hidden';\r\n } else {\r\n body.style.overflowY = 'auto';\r\n }\r\n // eslint-disable-next-line no-unused-expressions\r\n return (): void => {\r\n body.style.overflowY = 'auto';\r\n };\r\n }, [isVisible]);\r\n\r\n const showCloseButton = !!closeButton && !backdropButton?.visible;\r\n\r\n return (\r\n
\r\n
\r\n {backdropButton?.visible && (\r\n \r\n )}\r\n
\r\n
\r\n {\r\n e.stopPropagation();\r\n }}\r\n style={\r\n fullWidth\r\n ? {\r\n maxWidth: 'unset',\r\n }\r\n : {}\r\n }\r\n >\r\n \r\n {showCloseButton && (\r\n
\r\n \r\n
\r\n )}\r\n {backdropButton?.visible && !backdropButton.fixedPosition && (\r\n \r\n )}\r\n {children}\r\n
\r\n
\r\n
\r\n
\r\n \r\n );\r\n};\r\n\r\nexport default BackdropComponent;\r\n\r\nexport type ModalProps = _modalProps;\r\n","/* eslint-disable no-use-before-define */\r\nimport React, { useEffect, useState } from 'react';\r\nimport uuidGenerator from 'shared/tools/uuid-generator';\r\nimport { AvailableDateTimeFrame, SelectedDateTimeFrame } from 'apps/LocalizationApp/types/dto.types';\r\n\r\ninterface SelectTimeProps {\r\n availableHours: AvailableDateTimeFrame[];\r\n onSetTimeFn(orderTime: SelectedDateTimeFrame): void;\r\n labels: {\r\n mainCTA: string;\r\n chooseTimeHeading: string;\r\n chooseTimeAsap: string;\r\n };\r\n}\r\n\r\nconst SelectTime: React.FC = function ({ availableHours, onSetTimeFn, labels }) {\r\n useEffect(() => {\r\n gtm.modalLoad('order-time-select');\r\n }, []);\r\n\r\n const [selectedDateTimeFrame, setSelectedDateTimeFrame] = useState();\r\n\r\n function onTimeSelected(index: number): void {\r\n const baseDateTimeFrame = availableHours[index];\r\n setSelectedDateTimeFrame({\r\n dateTimeFrame: baseDateTimeFrame.isAsap ? undefined : baseDateTimeFrame.dateTimeFrame,\r\n isAsap: baseDateTimeFrame.isAsap,\r\n timeFrame: baseDateTimeFrame.timeFrame,\r\n isFirstAvailableDateFrame: index === 0,\r\n utcDateTimeFrame: baseDateTimeFrame.utcDateTimeFrame,\r\n });\r\n }\r\n\r\n function setOrderTime(): void {\r\n selectedDateTimeFrame && onSetTimeFn(selectedDateTimeFrame);\r\n }\r\n\r\n function renderHourDisplayValue(index: number): string {\r\n if (index < 0) return '';\r\n const hour = availableHours[index].timeFrame;\r\n return printHour(hour, availableHours[index].isAsap, index === 0);\r\n }\r\n\r\n function printHour(hour: string, isAsap: boolean, isFirstOnList: boolean) {\r\n if (isAsap) {\r\n return labels.chooseTimeAsap;\r\n }\r\n if (isFirstOnList) {\r\n return `${labels.chooseTimeAsap} ${hour}`;\r\n }\r\n return hour;\r\n }\r\n\r\n useEffect(() => {\r\n onTimeSelected(0);\r\n }, []);\r\n\r\n return (\r\n
\r\n {labels.chooseTimeHeading}\r\n
\r\n \r\n \r\n \r\n {renderHourDisplayValue(\r\n (selectedDateTimeFrame &&\r\n availableHours.findIndex((ah) => ah.timeFrame === selectedDateTimeFrame.timeFrame)) ??\r\n 0,\r\n )}\r\n \r\n \r\n
\r\n {availableHours.map((hour, index) => (\r\n onTimeSelected(index)}\r\n data-testid={`localization__button--available-hour-${hour?.timeFrame}`}\r\n >\r\n {renderHourDisplayValue(index)}\r\n \r\n ))}\r\n
\r\n
\r\n \r\n {labels.mainCTA}\r\n \r\n
\r\n );\r\n};\r\n\r\nexport default SelectTime;\r\n","function uuidGenerator(): string {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function replacing(c): string {\r\n const r = (Math.random() * 16) | 0;\r\n const v = c === 'x' ? r : r & (0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n}\r\n\r\nexport default uuidGenerator;\r\n","import React from 'react';\r\nimport { useSelector } from 'react-redux';\r\nimport { ApplicationState } from '../Store';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\nimport { StoreDto } from '../types/dto.types';\r\n\r\ninterface StoreUnavailableProps {\r\n nearbyStores: StoreDto[];\r\n currentStoreId: string;\r\n onSelect(store: StoreDto): void;\r\n onReturn(): void;\r\n}\r\n\r\nconst StoreUnavailable: React.FC = ({ nearbyStores, currentStoreId, onSelect, onReturn }) => {\r\n const { storeUnavailable } = useSelector((state) => state.localizationStaticContent);\r\n const storesList: StoreDto[] = nearbyStores.filter((store) => store.id !== currentStoreId);\r\n\r\n return (\r\n <>\r\n {storesList.length > 0 && (\r\n
\r\n
\r\n

\r\n {storeUnavailable.outOfDeliveryRangeHeading}\r\n

\r\n

{storeUnavailable.outOfDeliveryRangeText}

\r\n
\r\n {storesList.map((store) => {\r\n return (\r\n onSelect(store)}\r\n key={store.id}\r\n data-testid=\"localization__button--select-another-store\"\r\n >\r\n

{`${store.street}, ${store.streetNumber} (${store.city})`}

\r\n

{`${storeUnavailable.distancePrefix}${(\r\n store.distance / 1000\r\n ).toFixed(2)}${storeUnavailable.distanceSuffix}`}

\r\n \r\n
\r\n );\r\n })}\r\n \r\n )}\r\n {storesList.length <= 0 && (\r\n \r\n

\r\n {storeUnavailable.noStoreAvailable}\r\n

\r\n \r\n {storeUnavailable.returnButton}\r\n \r\n \r\n )}\r\n \r\n );\r\n};\r\n\r\nexport default StoreUnavailable;\r\n","import React from 'react';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\n\r\n// components\r\nimport Backdrop from 'shared/components/modal.compontent';\r\nimport SelectTime from 'shared/components/select-time.component';\r\nimport StoreUnavailable from '../Components/store-unavailable.component';\r\n\r\n// store\r\nimport { LocalizationActionTypes, setCurrentStoreForPickup, setStoreAndSave } from '../Store/actions';\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport { ApplicationState } from '../Store';\r\nimport { StoreDto } from '../types/dto.types';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\n\r\nconst ChooseTime: React.FC = () => {\r\n const { currentStore, nearbyStores, distributionType, showModal } = useSelector(\r\n (state) => state.localization,\r\n );\r\n const { mainCTA, chooseTimeHeading, chooseTimeAsap } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n\r\n const dispatch = useDispatch();\r\n\r\n if (!showModal) return <>;\r\n\r\n function selectStoreHandler(store: StoreDto): void {\r\n dispatch(setCurrentStoreForPickup(store));\r\n }\r\n\r\n function onClose(): void {\r\n dispatch({ type: LocalizationActionTypes.CLEAR_STORE });\r\n dispatch({ type: LocalizationActionTypes.CHANGE_ORDER_DISTRIBUTION, payload: distributionType });\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }\r\n\r\n function renderData(): JSX.Element {\r\n if (currentStore?.isOpen && currentStore.availableHours && currentStore.availableHours.timeframes.length > 0) {\r\n return (\r\n {\r\n dispatch({\r\n type: LocalizationActionTypes.SET_ORDER_TIME,\r\n payload: orderTime,\r\n });\r\n dispatch(setStoreAndSave());\r\n gtm.localizationModule.orderTimeSelected();\r\n window.location.href = '/products/offers';\r\n }}\r\n labels={{ mainCTA, chooseTimeHeading, chooseTimeAsap }}\r\n />\r\n );\r\n }\r\n return (\r\n \r\n );\r\n }\r\n\r\n return (\r\n \r\n {renderData()}\r\n \r\n );\r\n};\r\n\r\nexport default ChooseTime;\r\n","import { ApplicationState } from 'apps/LocalizationApp/Store';\r\nimport { LocalizationStaticContent } from 'apps/LocalizationApp/Store/static-content/localization-static-content.reducer';\r\nimport React from 'react';\r\nimport { useSelector } from 'react-redux';\r\nimport { OrderDistributionType } from 'shared/types';\r\n\r\nexport interface OrderDistributionSwitchProps {\r\n distributionType: OrderDistributionType;\r\n distributionChange: (type: OrderDistributionType) => void;\r\n}\r\n\r\nconst OrderTypeSwitch: React.FC = ({ distributionType, distributionChange }) => {\r\n const { pickupIcon, pickupIconDisabled, deliveryIcon, deliveryIconDisabled } = useSelector<\r\n ApplicationState,\r\n LocalizationStaticContent\r\n >((state) => state.localizationStaticContent);\r\n const isPickup = distributionType === OrderDistributionType.Pickup;\r\n const { deliveryTabText, pickupTabText } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n return (\r\n
\r\n {\r\n distributionChange(OrderDistributionType.Delivery);\r\n gtm.localizationModule.deliveryTabClicked();\r\n }}\r\n className={`d-flex font-weight-bold justify-content-center align-items-center mr-1 w-100 ${\r\n distributionType === OrderDistributionType.Delivery ? 'active' : ''\r\n }`}\r\n data-testid=\"localization__button--delivery-switch\"\r\n >\r\n
\r\n \r\n
\r\n \r\n {deliveryTabText}\r\n \r\n
\r\n {\r\n distributionChange(OrderDistributionType.Pickup);\r\n gtm.localizationModule.collectionTabClicked();\r\n }}\r\n className={`d-flex font-weight-bold justify-content-center align-items-center ml-1 w-100 ${\r\n distributionType === OrderDistributionType.Pickup ? 'active' : ''\r\n }`}\r\n data-testid=\"localization__button--pickup-switch\"\r\n >\r\n
\r\n \r\n
\r\n \r\n {pickupTabText}\r\n \r\n \r\n \r\n );\r\n};\r\nexport default OrderTypeSwitch;\r\n","import React from 'react';\r\n\r\ninterface ChangeAddressAlertProps {\r\n labels: {\r\n title: string;\r\n informationText: string;\r\n confirmButton: string;\r\n cancelButton: string;\r\n };\r\n onConfirmFn(): void;\r\n onCancelFn(): void;\r\n}\r\n\r\nconst ChangeAddressAlert: React.FC = ({ labels, onConfirmFn, onCancelFn }) => {\r\n const { title, informationText, confirmButton, cancelButton } = labels;\r\n\r\n return (\r\n
\r\n
\r\n

\r\n {title}\r\n

\r\n \r\n {informationText}\r\n

\r\n \r\n {confirmButton}\r\n \r\n \r\n {cancelButton}\r\n \r\n
\r\n
\r\n );\r\n};\r\n\r\nexport default ChangeAddressAlert;\r\n","import React, { useState } from 'react';\r\nimport { useSelector } from 'react-redux';\r\n\r\n// store\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport ChangeAddressAlert from 'shared/components/change-address-alert.component';\r\nimport { ApplicationState } from '../Store';\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\n\r\ninterface ChangeStoreProps {\r\n onContinueFn(): void;\r\n onChangeStoreFn(): void;\r\n}\r\n\r\nconst ChangeStore: React.FC = ({ onContinueFn, onChangeStoreFn }) => {\r\n // store\r\n const { changeStore, addressAlertModal } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n const { selectedAddress, distributionType, currentStore } = useSelector(\r\n (state) => state.localization,\r\n );\r\n\r\n const [showConfirm, setShowConfirm] = useState(false);\r\n\r\n // actions\r\n const onChangeStore = (): void => {\r\n gtm.localizationModule.changeAddressClicked();\r\n const basket = localStorage.getItem('basket');\r\n const parsedBasket = basket ? JSON.parse(basket) : null;\r\n if (parsedBasket?.basket?.items?.length > 0) {\r\n setShowConfirm(true);\r\n return;\r\n }\r\n\r\n onChangeStoreFn();\r\n };\r\n\r\n if (showConfirm) {\r\n return (\r\n {\r\n setShowConfirm(false);\r\n }}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n
\r\n
\r\n

\r\n {distributionType === OrderDistributionType.Delivery\r\n ? changeStore.changeDeliveryTitle\r\n : changeStore.changePickupTitle}\r\n

\r\n

\r\n {distributionType === OrderDistributionType.Delivery\r\n ? `${selectedAddress.street}, ${selectedAddress.streetNumber}. ${selectedAddress.city}`\r\n : `${currentStore.street}, ${currentStore.streetNumber}. ${currentStore.city}`}\r\n

\r\n \r\n {changeStore.changeStoreButton}\r\n \r\n \r\n {changeStore.goToCatalogButton}\r\n \r\n
\r\n
\r\n );\r\n};\r\n\r\nexport default ChangeStore;\r\n","import useKeyPress from 'hooks/useKeyPress';\r\nimport React from 'react';\r\nimport Modal, { ModalProps } from 'shared/components/modal.compontent';\r\n\r\ninterface Props extends ModalProps {\r\n labels: {\r\n header: string;\r\n subHeader: string;\r\n ctaText?: string;\r\n };\r\n isVisible: boolean;\r\n onConfirmFn?: () => void;\r\n testId: string;\r\n}\r\n\r\nconst SingleActionModal = ({ labels, isVisible, cancelCallbackFn, onConfirmFn, testId }: Props) => {\r\n useKeyPress('ENTER', onConfirmFn || cancelCallbackFn);\r\n\r\n return (\r\n \r\n
\r\n
\r\n {labels.header}\r\n
\r\n

\r\n {labels.subHeader}\r\n

\r\n {labels.ctaText && (\r\n \r\n {labels.ctaText}\r\n \r\n )}\r\n
\r\n \r\n );\r\n};\r\n\r\nexport default SingleActionModal;\r\n","import { useEffect } from 'react';\r\n\r\nexport default function useKeyPress(keyCode: KeyboardEvent['code'], callback: () => void, deps?: React.DependencyList): void {\r\n const keyPressHandler = (event: KeyboardEvent) => {\r\n if (event.key?.toUpperCase() === keyCode.toUpperCase()) {\r\n event.preventDefault();\r\n callback();\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n window.addEventListener('keydown', keyPressHandler);\r\n return () => {\r\n window.removeEventListener('keydown', keyPressHandler);\r\n };\r\n }, deps);\r\n}\r\n","import React, { useEffect } from 'react';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\n\r\nimport SingleActionModal from 'shared/components/single-action-modal.component';\r\n\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport { ApplicationState } from '../Store';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\nimport { StoreState } from '../types/localization.types';\r\nimport { LocalizationActionTypes } from '../Store/actions';\r\n\r\ninterface Props {\r\n isVisible: boolean;\r\n}\r\n\r\nconst StoreStatusInfo = ({ isVisible }: Props): JSX.Element => {\r\n const { selectedStoreStatus, distributionType } = useSelector((state) => state.localization);\r\n const { storeStatusInfo } = useSelector((state) => state.localizationStaticContent);\r\n const dispatch = useDispatch();\r\n\r\n const renderModalSwitch = (): JSX.Element | null => {\r\n switch (selectedStoreStatus.state) {\r\n case StoreState.OPEN_BUT_NO_ONLINE_ORDERS:\r\n const modalText = `${storeStatusInfo.noOnlineOrdersModalText} ${selectedStoreStatus.storePhoneNumber}`;\r\n return (\r\n {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n onConfirmFn={() => {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n isVisible\r\n testId=\"no-online-orders-modal\"\r\n />\r\n );\r\n case StoreState.OPEN_BUT_NO_DELIVERY_ORDERS:\r\n return (\r\n {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n onConfirmFn={() => {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n isVisible\r\n testId=\"no-delivery-orders-modal\"\r\n />\r\n );\r\n case StoreState.OPEN_BUT_NO_PICKUP_ORDERS:\r\n return (\r\n {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n onConfirmFn={() => {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n isVisible\r\n testId=\"no-pickup-orders-modal\"\r\n />\r\n );\r\n case StoreState.CLOSED:\r\n const header =\r\n distributionType === OrderDistributionType.Delivery\r\n ? storeStatusInfo.noDeliveryOrdersModalHeader\r\n : storeStatusInfo.noPickupOrdersModalHeader;\r\n const subheader =\r\n distributionType === OrderDistributionType.Delivery\r\n ? storeStatusInfo.noDeliveryOrdersModalText\r\n : storeStatusInfo.noPickupOrdersModalText;\r\n\r\n return (\r\n {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n onConfirmFn={() => {\r\n dispatch({ type: LocalizationActionTypes.SHOW_MODAL, payload: false });\r\n }}\r\n isVisible\r\n testId=\"no-pickup-orders-modal\"\r\n />\r\n );\r\n default:\r\n return null;\r\n }\r\n };\r\n\r\n return
{isVisible ? renderModalSwitch() : null}
;\r\n};\r\n\r\nexport default StoreStatusInfo;\r\n","import Axios from 'shared/api/axios';\r\nimport { AxiosResponse } from 'axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { LocalizationStaticContent } from './localization-static-content.reducer';\r\nimport { ApplicationState } from '../index';\r\n\r\nexport enum LocalizationStaticContentActionTypes {\r\n SET_STATIC_CONTENT = '[Localization.StaticContent] SET_STATIC_CONTENT',\r\n}\r\n\r\ninterface SetStaticContent {\r\n type: LocalizationStaticContentActionTypes.SET_STATIC_CONTENT;\r\n payload: LocalizationStaticContent;\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/static-content/localization');\r\n dispatch({\r\n type: LocalizationStaticContentActionTypes.SET_STATIC_CONTENT,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport type StaticContentActions = SetStaticContent;\r\n","import React, { useEffect } from 'react';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\n\r\n// shared\r\nimport { RoutingHelpers } from 'shared/helpers';\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { getStaticContent } from 'shared/store/static-content/static-content.actions';\r\nimport { GlobalState } from 'shared/store/global/global.reducer';\r\nimport Loader from 'shared/components/loader.component';\r\n\r\n// components\r\nimport Toast from 'shared/components/toast.component';\r\nimport LocalizationSearch from './localization-search.container';\r\nimport ChooseTime from './choose-time.container';\r\nimport OrderTypeSwitch from '../Components/order-type-switch.component';\r\nimport ChangeStore from '../Components/change-store.component';\r\nimport StoreStatusInfo from './store-status-info.container';\r\n\r\n// store\r\nimport { LocalizationState } from '../Store/reducers';\r\nimport * as LocalizationActions from '../Store/actions';\r\nimport { ApplicationState } from '../Store';\r\nimport { getStaticContent as getLocalizationStaticContent } from '../Store/static-content/localization-static-content.actions';\r\nimport { LocalizationStaticContent } from '../Store/static-content/localization-static-content.reducer';\r\nimport { cookieExists } from 'shared/utils';\r\n\r\nconst SearchWindow = (): JSX.Element => {\r\n const { currentStore, distributionType, forceDeliveryDistributionType, selectedStoreStatus, showModal, nearbyStores, showToast } =\r\n useSelector((state) => state.localization);\r\n const { storeIsClosedToast } = useSelector(\r\n (state) => state.localizationStaticContent,\r\n );\r\n const { loader } = useSelector((state) => state.global);\r\n const dispatch = useDispatch();\r\n\r\n useEffect(() => {\r\n dispatch(getStaticContent());\r\n dispatch(getLocalizationStaticContent());\r\n }, []);\r\n\r\n const storeSelected = currentStore.id !== '' && cookieExists('localization');\r\n\r\n return (\r\n
\r\n {storeSelected ? (\r\n {\r\n dispatch(LocalizationActions.clearStoreAndSave());\r\n forceDeliveryDistributionType &&\r\n dispatch(LocalizationActions.changeDistributionType(OrderDistributionType.Delivery));\r\n localStorage.removeItem('basket');\r\n }}\r\n />\r\n ) : (\r\n
\r\n {\r\n dispatch(LocalizationActions.changeDistributionType(type));\r\n }}\r\n />\r\n
\r\n \r\n
\r\n
\r\n )}\r\n {!selectedStoreStatus.canPlaceOrder &&\r\n selectedStoreStatus.state !== undefined &&\r\n nearbyStores.length === 0 &&\r\n showModal ? (\r\n \r\n ) : (\r\n \r\n )}\r\n {loader && }\r\n {\r\n dispatch({ type: LocalizationActions.LocalizationActionTypes.SHOW_TOAST, payload: false });\r\n }}\r\n />\r\n
\r\n );\r\n};\r\n\r\nexport default SearchWindow;\r\n\r\nconst redirectToOffers = (): void => {\r\n const { redirectToOtherAppURL } = RoutingHelpers;\r\n redirectToOtherAppURL('products/offers');\r\n};\r\n","import { BasketItem, SKU } from 'apps/ProductsApp/types/basket.types';\r\n\r\nexport interface Option {\r\n sku: SKU;\r\n title: string;\r\n name: string;\r\n deliveryPrice: number;\r\n pickupPrice: number;\r\n type: string;\r\n subType: string;\r\n sortOrder: number;\r\n extraCharge?: number;\r\n default: boolean;\r\n}\r\n\r\nexport interface OptionDetails extends Option {\r\n additionalToppings?: ToppingBase[];\r\n defaultToppings?: ToppingBase[];\r\n description: string;\r\n id: number;\r\n image: string;\r\n xTastyProducts: number[];\r\n}\r\n\r\nexport interface Tag {\r\n id: string;\r\n title: string;\r\n iconUrl: string;\r\n}\r\n\r\nexport enum StoreStockStatus {\r\n Unknown = 0,\r\n IsInStock = 1,\r\n OutOfStock = 2,\r\n}\r\n\r\nexport interface Product {\r\n id: string;\r\n title: string;\r\n route: string;\r\n categoryId: string;\r\n description: string;\r\n isCustomizable: boolean;\r\n isCreateCustomPizza: boolean;\r\n isRestrictedForDeliveryTime: boolean;\r\n isXTasty: boolean;\r\n menuImage: {\r\n label: string;\r\n url: string;\r\n toolTip: string;\r\n };\r\n options: Option[];\r\n tags: Tag[];\r\n stockStatus: StoreStockStatus;\r\n}\r\n\r\nexport interface ProductDetails extends Product {\r\n productPage: {\r\n productDetailDescription: string;\r\n productDetailMetaDescription: string;\r\n productDetailMetaKeywords: string;\r\n productDetailSubTitle: string;\r\n productDetailTitle: string;\r\n productDetailImage: {\r\n label: string;\r\n url: string;\r\n toolTip: string;\r\n };\r\n };\r\n additionalInfo: string;\r\n}\r\n\r\nexport interface Category {\r\n id: string;\r\n title: string;\r\n route: string;\r\n}\r\n\r\nexport interface CategoryDto {\r\n id: string;\r\n title: string;\r\n route: string;\r\n products: Product[];\r\n}\r\n\r\nexport interface ProductDetails extends Product {\r\n options: OptionDetails[];\r\n customProductImage: string;\r\n customProductImageSmall: string;\r\n xTastyImage: string;\r\n xTastySlicesCount?: number;\r\n xTastyProducts?: XTastyProduct[]\r\n}\r\n\r\nexport interface XTastyProduct {\r\n id: string,\r\n title: string\r\n}\r\n\r\nexport interface ToppingBase {\r\n id: number;\r\n price: number;\r\n}\r\n\r\nexport interface Topping extends ToppingBase {\r\n title: string;\r\n description?: string;\r\n imageUrl?: string;\r\n imageThumbnailUrl: string;\r\n categoryId: string;\r\n}\r\n\r\nexport interface Offer {\r\n altText: string;\r\n title: string;\r\n code: string;\r\n description: string;\r\n shortDescription: string;\r\n price?: number;\r\n imagePath: string;\r\n mobileImagePath: string;\r\n forDelivery: boolean;\r\n forPickup: boolean;\r\n isPopular: boolean;\r\n defaultCouponPrice?: number;\r\n}\r\n\r\nexport interface OfferDetails extends Offer {\r\n allowRepetition: boolean;\r\n choiceSlots: OfferChoice[];\r\n type: OfferTypes;\r\n}\r\n\r\nexport interface OfferCustomizationDetails extends OfferDetails {\r\n isComplete: boolean;\r\n calculatedOfferPrice?: number; // please always calculate on backend side.\r\n appliedDealId?: string;\r\n position: number | string;\r\n}\r\n\r\nexport enum OfferTypes {\r\n EURO_DEAL_PLUS = 'EURO_DEAL_PLUS',\r\n PERC_DIS = 'PERC_DIS',\r\n OTHER = 'OTHER',\r\n FXD_DIS = 'FXD_DIS',\r\n XTH_PIZ_FRE = 'XTH_PIZ_FRE',\r\n XTH_PIZ_FRE_PLS = 'XTH_PIZ_FRE_PLS',\r\n FXD_ORD_DSC = 'FXD_ORD_DSC',\r\n PERC_ORD_DSC = 'PERC_ORD_DSC'\r\n}\r\nexport interface SelectedChoice\r\n extends Pick<\r\n BasketItem,\r\n | 'sku'\r\n | 'price'\r\n | 'basePrice'\r\n | 'xTastyChoices'\r\n | 'removedToppings'\r\n | 'addedToppings'\r\n | 'extraCharge'\r\n | 'specificationToppingsPrices'\r\n > {\r\n isFree?: boolean;\r\n appliedDealIndex?: number;\r\n}\r\n\r\nexport interface OfferChoice {\r\n selectedChoice?: SelectedChoice;\r\n choices: Product[];\r\n}\r\n\r\nexport interface AppConfiguration {\r\n maxChangeableToppingsForEditPizza: number;\r\n maxExtraToppingsForEditPizza: number;\r\n maxToppingsForCustomPizza: number;\r\n}\r\n\r\nexport interface OrderDetailsResponse {\r\n orderId: number;\r\n orderDate: string;\r\n isAsap: boolean;\r\n firstName: string;\r\n lastName: string;\r\n emailAddress: string;\r\n phoneNumber: string;\r\n street: string;\r\n streetNumber: string;\r\n city: string;\r\n district: string;\r\n country: string;\r\n addressAddition: string;\r\n addressRemark: string;\r\n receiptCompanyData: {\r\n isCompanyCustomer: boolean;\r\n companyName: string;\r\n companyAddress: string;\r\n vatId: string;\r\n };\r\n orderRemark: string;\r\n}\r\n\r\nexport interface OffersComboDto {\r\n couponId: string;\r\n isPossible: boolean;\r\n remarks: string;\r\n}\r\n\r\nexport interface ProductSEO {\r\n html: string;\r\n header: string;\r\n title: string;\r\n}\r\n","import { OfferChoice, OfferTypes } from 'apps/ProductsApp/types/dto.types';\r\n\r\nexport const isOfferComplexType = (couponType: OfferTypes): boolean => {\r\n if (isTwoForOneOffer(couponType)) return true;\r\n switch (couponType) {\r\n case OfferTypes.EURO_DEAL_PLUS:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n};\r\n\r\nexport const isTwoForOneOffer = (type?: OfferTypes): boolean => {\r\n if (type === OfferTypes.XTH_PIZ_FRE || type === OfferTypes.XTH_PIZ_FRE_PLS) return true;\r\n return false;\r\n};\r\n\r\nexport const getCheapestSelectedItemIndex = (choiceSlots: OfferChoice[]): number => {\r\n const productBasePrices = choiceSlots\r\n .map((choice) => {\r\n if (choice.selectedChoice) return choice.selectedChoice.basePrice;\r\n })\r\n .filter((basePrice) => basePrice !== undefined) as number[];\r\n const lowestPrice = Math.min(...productBasePrices);\r\n\r\n // Si Senior, there can be couple of items with same , lowest price\r\n const lowestPricedItems = choiceSlots.filter((el) => el.selectedChoice?.basePrice === lowestPrice);\r\n if (lowestPricedItems) {\r\n lowestPricedItems.sort((a, b) => {\r\n const totalLowerPriceA =\r\n (a.selectedChoice?.basePrice ?? 0) + (a.selectedChoice?.specificationToppingsPrices?.totalToppingsPrice ?? 0);\r\n const totalLowerPriceB =\r\n (b.selectedChoice?.basePrice ?? 0) + (b.selectedChoice?.specificationToppingsPrices?.totalToppingsPrice ?? 0);\r\n return totalLowerPriceA - totalLowerPriceB;\r\n });\r\n }\r\n return choiceSlots.findIndex((el) => el === lowestPricedItems[0]);\r\n};\r\n","import { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\n\r\n// types\r\nimport { ApplicationState } from '../index';\r\nimport { AddressWizzardSteps } from '../../navigation.types';\r\n\r\n// action types\r\nexport enum AddressWizzardActionsTypes {\r\n SET_WIZZARD_STEP = '[NAVIGATION_APP] SET_WIZZARD_STEP',\r\n}\r\n\r\n// payloads\r\ninterface SetWizzardStepPayload {\r\n step: AddressWizzardSteps;\r\n}\r\n\r\ninterface SetWizzardStep extends Action {\r\n type: AddressWizzardActionsTypes.SET_WIZZARD_STEP;\r\n payload: SetWizzardStepPayload;\r\n}\r\n\r\n// methods\r\n\r\nexport const changeWizzardStep =\r\n (step: AddressWizzardSteps): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: AddressWizzardActionsTypes.SET_WIZZARD_STEP,\r\n payload: {\r\n step,\r\n },\r\n });\r\n };\r\n\r\nexport type AddressActions = SetWizzardStep;\r\n","import { AxiosResponse } from 'axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport Axios from 'shared/api/axios';\r\nimport { ApplicationState } from '..';\r\nimport { NavigationStaticContent } from './static-content.reducer';\r\n\r\nexport enum NavigationStaticContentActionTypes {\r\n SET_STATIC_CONTENT = '[ORDER STATUS] SET_STATIC_CONTENT',\r\n}\r\n\r\ninterface SetStaticContent extends Action {\r\n type: NavigationStaticContentActionTypes.SET_STATIC_CONTENT;\r\n payload: NavigationStaticContent;\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const result: AxiosResponse = await Axios.get('api/static-content/navigation');\r\n\r\n dispatch({ type: NavigationStaticContentActionTypes.SET_STATIC_CONTENT, payload: result.data });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport type NavigationStaticContentActions = SetStaticContent;\r\n","export enum HeaderType {\r\n Other = 1,\r\n PLPorOLP = 2,\r\n}\r\n\r\nexport enum AddressWizzardSteps {\r\n None = 1,\r\n ChangeAddressModal = 2,\r\n LocalizationModal = 3,\r\n}\r\n\r\nexport interface SimplifiedAddress {\r\n street: string;\r\n streetNumber: string;\r\n city: string;\r\n}\r\n","import * as _addressWizzardActions from './address-wizzard/address-wizzard.actions';\r\nimport * as _staticContentActions from './static-content/static-content.actions';\r\n\r\nexport const AddressWizzardActions = _addressWizzardActions;\r\nexport const StaticContentActions = _staticContentActions;\r\n","import { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport { AxiosResponse } from 'axios';\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport Axios from 'shared/api/axios';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { getCheapestSelectedItemIndex, isOfferComplexType, isTwoForOneOffer } from 'shared/helpers/coupons-helpers';\r\nimport { BasketActionTypes } from 'apps/ProductsApp/store/basket/basket.actions';\r\n\r\nimport { ApplicationState, OffersState } from '..';\r\nimport { BasketActions, ProductsActions } from '../actions';\r\nimport { Offer, OfferCustomizationDetails, OfferDetails, OffersComboDto, SelectedChoice } from '../../types/dto.types';\r\nimport { BasketOffer } from '../../types/basket.types';\r\n\r\nexport enum OffersActionTypes {\r\n SET_OFFERS = '[OFFERS] SET_OFFERS',\r\n SET_CUSTOMIZATION_OFFER = '[OFFERS] SET_CUSTOMIZATION_OFFER',\r\n SET_OPEN_DEAL_CONFIGURATION = '[OFFERS] SET_OPEN_DEAL_CONFIGURATION',\r\n SET_OFFERS_COMBINATION = '[OFFERS] SET_INVALID_COMBINATION',\r\n SET_INVALID_COMBINATION_MODAL = '[OFFERS] SET_INVALID_COMBINATION_MODAL',\r\n SET_INVALID_PRODUCT_COMPOSITION_MODAL = '[OFFERS] SET_INVALID_PRODUCT_COMPOSITION_MODAL',\r\n}\r\n\r\nconst OFFERS_LOADER = 'offersLoader';\r\n\r\ninterface SetOffers extends Action {\r\n type: OffersActionTypes.SET_OFFERS;\r\n payload: Offer[];\r\n}\r\ninterface SetCustomizationOffer extends Action {\r\n type: OffersActionTypes.SET_CUSTOMIZATION_OFFER;\r\n payload?: OfferCustomizationDetails;\r\n}\r\ninterface SetOpenDealConfiguration extends Action {\r\n type: OffersActionTypes.SET_OPEN_DEAL_CONFIGURATION;\r\n payload?: boolean;\r\n}\r\ninterface SetInvalidCombination extends Action {\r\n type: OffersActionTypes.SET_OFFERS_COMBINATION;\r\n payload?: OffersComboDto[];\r\n}\r\ninterface SetInvalidCombinationModal extends Action {\r\n type: OffersActionTypes.SET_INVALID_COMBINATION_MODAL;\r\n payload?: OffersState['invalidComboModal'];\r\n}\r\ninterface SetInvalidProductCompositionModal extends Action {\r\n type: OffersActionTypes.SET_INVALID_PRODUCT_COMPOSITION_MODAL;\r\n payload?: OffersState['invalidProductCompositionModal'];\r\n}\r\n\r\nexport const getOffers =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { localization } = getState();\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, true));\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/offers', {\r\n params: {\r\n deliveryType: localization.distributionType,\r\n storeId: localization.currentStore.id,\r\n deliveryDateTime: localization.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n dispatch({\r\n type: OffersActionTypes.SET_OFFERS,\r\n payload: value.data,\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n gtm.productsModule.dealsLoad(value.data);\r\n },\r\n dispatch,\r\n errorCallback: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n });\r\n };\r\n\r\nexport const updateCustomizationOffer =\r\n (choiceIndex: number, item?: SelectedChoice): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const updatedCustomizationOffer: OfferCustomizationDetails = {\r\n ...(getState().offers.customizationOffer as OfferCustomizationDetails),\r\n };\r\n\r\n const updatedItem = item;\r\n\r\n updatedCustomizationOffer.choiceSlots[choiceIndex].selectedChoice = updatedItem;\r\n\r\n updatedCustomizationOffer.isComplete =\r\n updatedCustomizationOffer.choiceSlots.filter((slot) => !slot.selectedChoice).length === 0;\r\n\r\n if (isTwoForOneOffer(updatedCustomizationOffer.type)) {\r\n if (updatedCustomizationOffer.isComplete) {\r\n const cheapestChoiceIndex = getCheapestSelectedItemIndex(updatedCustomizationOffer.choiceSlots);\r\n\r\n if (updatedCustomizationOffer.choiceSlots[cheapestChoiceIndex].selectedChoice) {\r\n (updatedCustomizationOffer.choiceSlots[cheapestChoiceIndex].selectedChoice as SelectedChoice).isFree = true;\r\n }\r\n } else {\r\n updatedCustomizationOffer.choiceSlots.forEach((choice) => {\r\n const { selectedChoice } = choice;\r\n if (selectedChoice) {\r\n selectedChoice.isFree = false;\r\n }\r\n return { ...choice, selectedChoice };\r\n });\r\n }\r\n }\r\n\r\n dispatch({ type: OffersActionTypes.SET_CUSTOMIZATION_OFFER, payload: updatedCustomizationOffer });\r\n\r\n if (updatedCustomizationOffer.isComplete) {\r\n dispatch(calculateOfferPrice(updatedCustomizationOffer.code));\r\n }\r\n\r\n dispatch({ type: OffersActionTypes.SET_OPEN_DEAL_CONFIGURATION, payload: true });\r\n };\r\n\r\nexport const editCustomizationOffer =\r\n (appliedDealId: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const basketCompiledOffer = {\r\n ...(state.basket.basket.compiledOffers.find((offer) => offer.appliedDealIdentifier === appliedDealId) as BasketOffer),\r\n };\r\n const details: AxiosResponse = await Axios.get(`api/offers/${basketCompiledOffer.code}`, {\r\n params: {\r\n deliveryType: state.localization.distributionType,\r\n storeId: state.localization.currentStore.id,\r\n },\r\n });\r\n\r\n const updatedCustomizationOffer = {\r\n ...details.data,\r\n appliedDealId,\r\n choiceSlots: details.data.choiceSlots.map((slot, index) => {\r\n return { ...slot, selectedChoice: basketCompiledOffer.choices[index] };\r\n }),\r\n isComplete: true,\r\n calculatedOfferPrice: basketCompiledOffer.price,\r\n };\r\n if (isTwoForOneOffer(updatedCustomizationOffer.type) && updatedCustomizationOffer.isComplete) {\r\n const cheapestChoiceIndex = getCheapestSelectedItemIndex(updatedCustomizationOffer.choiceSlots);\r\n\r\n if (updatedCustomizationOffer.choiceSlots[cheapestChoiceIndex].selectedChoice) {\r\n (updatedCustomizationOffer.choiceSlots[cheapestChoiceIndex].selectedChoice as SelectedChoice).isFree = true;\r\n }\r\n }\r\n\r\n dispatch({ type: OffersActionTypes.SET_CUSTOMIZATION_OFFER, payload: updatedCustomizationOffer });\r\n dispatch({ type: OffersActionTypes.SET_OPEN_DEAL_CONFIGURATION, payload: true });\r\n };\r\n\r\ninterface GetOffersDetailsProps {\r\n couponCode: string;\r\n redirectCallback?: () => void;\r\n position: number | string;\r\n}\r\n\r\nexport const getOfferDetails =\r\n ({ couponCode, redirectCallback, position }: GetOffersDetailsProps): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, true));\r\n\r\n const { localization } = getState();\r\n ResponseWrapper({\r\n action: async () => {\r\n const details: AxiosResponse = await Axios.get(`api/offers/${couponCode}`, {\r\n params: {\r\n deliveryType: localization.distributionType,\r\n storeId: localization.currentStore.id,\r\n deliveryDateTime: localization.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n\r\n if (isOfferComplexType(details.data.type)) {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n dispatch({\r\n type: OffersActionTypes.SET_CUSTOMIZATION_OFFER,\r\n payload: { ...details.data, isComplete: false, position },\r\n });\r\n dispatch({ type: OffersActionTypes.SET_OPEN_DEAL_CONFIGURATION, payload: true });\r\n\r\n redirectCallback && redirectCallback();\r\n return;\r\n }\r\n\r\n gtm.productsModule.addDealToBasket(details.data, position);\r\n dispatch(BasketActions.addCoupon(couponCode));\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n dispatch,\r\n allowedErr: {\r\n errorCodes: ['CouponNotAvailableAtRequstedTime'],\r\n action: (): void => {\r\n dispatch({ type: BasketActionTypes.SET_OFFER_NOT_AVAILABLE_MODAL, payload: true });\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n },\r\n errorCallback: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n });\r\n };\r\n\r\nexport const pauseAddingOffer = (couponCode: string, position: number | string): void => {\r\n const pausedOffer = JSON.stringify({ couponCode, position });\r\n sessionStorage.setItem('pausedOffer', pausedOffer);\r\n};\r\n\r\nexport const resumeAddingOffer =\r\n (couponCode: string, redirectCallback: () => void, position: number): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { currentStore, distributionType, selectedOrderTime } = getState().localization;\r\n const { offers } = getState().offers;\r\n\r\n if (offers.length <= 0) {\r\n const value: AxiosResponse = await Axios.get('api/offers', {\r\n params: {\r\n storeId: currentStore.id,\r\n deliveryType: distributionType,\r\n deliveryDateTime: selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n dispatch({\r\n type: OffersActionTypes.SET_OFFERS,\r\n payload: value.data,\r\n });\r\n if (\r\n value.data.findIndex((offer) => {\r\n if (offer.code === couponCode) {\r\n return distributionType === OrderDistributionType.Delivery ? offer.forDelivery : offer.forPickup;\r\n }\r\n return false;\r\n }) >= 0\r\n ) {\r\n dispatch(getOfferDetails({ couponCode, redirectCallback, position }));\r\n return;\r\n }\r\n }\r\n if (\r\n offers.findIndex((offer) => {\r\n return offer.code === couponCode && distributionType === OrderDistributionType.Delivery\r\n ? offer.forDelivery\r\n : offer.forPickup;\r\n }) >= 0\r\n ) {\r\n dispatch(getOfferDetails({ couponCode, redirectCallback, position }));\r\n return;\r\n }\r\n\r\n dispatch({ type: BasketActions.BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: true });\r\n dispatch(() => sessionStorage.removeItem('pausedOffer'));\r\n };\r\n\r\nexport const checkOfferCombinationValidity =\r\n (\r\n couponCode: string,\r\n redirectCallback: () => void,\r\n position: number | string,\r\n ): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, true));\r\n const { basket } = getState();\r\n const { currentStore } = getState().localization;\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n const codes = basket.basket.coupons.map((coupon) => coupon.code);\r\n const response: AxiosResponse = await Axios.get(`api/offers/${couponCode}/combinations`, {\r\n params: {\r\n codes,\r\n storeId: currentStore.id,\r\n },\r\n });\r\n\r\n dispatch({ type: OffersActionTypes.SET_OFFERS_COMBINATION, payload: response.data });\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n\r\n if (basket.basket.coupons.length < 1 || response.data.every((item) => item.isPossible)) {\r\n dispatch(getOfferDetails({ couponCode, redirectCallback, position }));\r\n\r\n return;\r\n }\r\n\r\n dispatch({\r\n type: OffersActionTypes.SET_INVALID_COMBINATION_MODAL,\r\n payload: {\r\n show: true,\r\n couponCode,\r\n addedOfferPosition: position,\r\n },\r\n });\r\n },\r\n dispatch,\r\n errorCallback: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n });\r\n };\r\n\r\nexport const calculateOfferPrice =\r\n (couponCode: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, true));\r\n\r\n const { offers, localization } = getState();\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n const selProds = (offers.customizationOffer?.choiceSlots.map((cs) => cs.selectedChoice) as SelectedChoice[]) ?? [];\r\n const request = {\r\n couponCode,\r\n storeId: localization.currentStore.id,\r\n deliverOrder: localization.distributionType === OrderDistributionType.Delivery,\r\n deliveryTimestamp: localization.selectedOrderTime?.dateTimeFrame,\r\n selectedProducts: selProds.map((sp) => {\r\n return {\r\n productId: sp.sku.productId,\r\n optionId: sp.sku.optionId,\r\n productSpecifications: extractProductSpecifiactionFromOfferChoice(sp),\r\n };\r\n }),\r\n };\r\n const response: AxiosResponse<{ price: number }> = await Axios.post(`api/offers/calculate`, request);\r\n\r\n if (response.status === 200 && response.data.price) {\r\n dispatch({\r\n type: OffersActionTypes.SET_CUSTOMIZATION_OFFER,\r\n payload: { ...offers.customizationOffer, calculatedOfferPrice: response.data.price },\r\n });\r\n }\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n dispatch,\r\n errorCallback: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(OFFERS_LOADER, false));\r\n },\r\n });\r\n };\r\n\r\nconst extractProductSpecifiactionFromOfferChoice = (selectedProduct: SelectedChoice) => {\r\n if (selectedProduct.xTastyChoices?.length > 0) {\r\n return selectedProduct.xTastyChoices?.map((xtc) => {\r\n return {\r\n productId: xtc.productId,\r\n addToppings: xtc.addedToppings?.map((at) => at.id),\r\n removeToppings: xtc.removedToppings?.map((rt) => rt.id),\r\n };\r\n });\r\n }\r\n\r\n return [\r\n {\r\n productId: selectedProduct.sku.productId,\r\n addToppings: selectedProduct.addedToppings?.map((at) => at.id),\r\n removeToppings: selectedProduct.removedToppings?.map((rt) => rt.id),\r\n },\r\n ];\r\n};\r\n\r\nexport type OffersActions =\r\n | SetOffers\r\n | SetCustomizationOffer\r\n | SetOpenDealConfiguration\r\n | SetInvalidCombination\r\n | SetInvalidCombinationModal\r\n | SetInvalidProductCompositionModal;\r\n","/* eslint-disable no-param-reassign */\r\nimport { BasketState } from 'apps/ProductsApp/store';\r\nimport { AxiosError, AxiosResponse } from 'axios';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport { FormControl } from 'shared/components/form-input.component';\r\nimport Axios from 'shared/api/axios';\r\nimport { Action } from 'redux';\r\nimport { CommonValidators, FormValidatorHandler } from 'shared/validators';\r\nimport { OrderDistributionType, UserMessageType } from 'shared/types';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { redirectToOtherAppURL } from 'shared/helpers/routing-helpers';\r\n\r\nimport { isOfferComplexType } from 'shared/helpers/coupons-helpers';\r\nimport { AddressWizzardActions } from 'apps/NavigationApp/store/actions';\r\nimport { AddressWizzardSteps } from 'apps/NavigationApp/navigation.types';\r\nimport {\r\n AccountHistoryOrderDto,\r\n AccountOrdersDto,\r\n HistoryOrderCoupon,\r\n HistoryOrderProduct,\r\n} from 'apps/AccountManagementApp/account-details.types';\r\n\r\nimport { ApplicationState } from '..';\r\nimport { OfferTypes, Topping, Offer } from '../../types/dto.types';\r\nimport {\r\n AppliedCoupon,\r\n Basket,\r\n BasketItem,\r\n BasketOffer,\r\n CrossSellOffer,\r\n RecalculationError,\r\n SimplifiedBasketItem,\r\n SKU,\r\n XTastyChoice,\r\n} from '../../types/basket.types';\r\nimport { OffersActions, ProductsActions } from '../actions';\r\nimport { checkOfferCombinationValidity } from '../offers/offers.actions';\r\nimport { refreshProducts } from '../products/products.actions';\r\nimport { cookieExists, removeBasketFromLocalStorage } from 'shared/utils';\r\nimport { appCulture } from 'shared/helpers/routing-helpers';\r\n\r\nconst BASKET_LOADER = 'basketLoader';\r\n\r\nexport enum BasketActionTypes {\r\n SET_BASKET = '[BASKET_APP] SET_BASKET',\r\n SET_CROSS_SELL = '[BASKET_APP] SET_CROSS_SELL',\r\n SET_VOUCHER_MODAL_VISIBILITY = '[BASKET_APP] SET_VOUCHER_MODAL_VISIBILITY',\r\n SET_VOUCHER_INPUT = '[BASKET_APP] SET_VOUCHER_INPUT',\r\n SET_PAUSED_RECALCULATE_REQUEST = '[BASKET_APP] SET_PAUSED_RECALCULATE_REQUEST',\r\n SET_PRODUCT_NOT_AVAILABLE_MODAL = '[BASKET_APP] SET_PRODUCT_NOT_AVAILABLE_MODAL',\r\n SET_OFFER_NOT_AVAILABLE_MODAL = '[BASKET_APP] SET_OFFER_NOT_AVAILABLE_MODAL',\r\n SET_OUT_OF_STOCK_PRODUCTS = '[BASKET_APP] SET_OUT_OF_STOCK_PRODUCTS',\r\n SET_LAST_USER_ORDER = '[BASKET_APP] SET_LAST_USER_ORDER',\r\n SET_LANGUAGE = '[BASKET_APP] SET_LANGUAGE',\r\n SET_NO_OF_VOUCHERS_EXCEEDED_MODAL = '[BASKET_APP] SET_NO_OF_VOUCHERS_EXCEEDED_MODAL',\r\n SET_COUPON_CODE_INVALID_MODAL = '[BASKET_APP] SET_COUPON_CODE_INVALID_MODAL',\r\n}\r\n\r\nexport interface SetBasket extends Action {\r\n type: BasketActionTypes.SET_BASKET;\r\n payload: Basket;\r\n}\r\nexport interface SetCrossSell extends Action {\r\n type: BasketActionTypes.SET_CROSS_SELL;\r\n payload: CrossSellOffer;\r\n}\r\nexport interface SetCouponModalVisibility extends Action {\r\n type: BasketActionTypes.SET_VOUCHER_MODAL_VISIBILITY;\r\n payload: boolean;\r\n}\r\n\r\nexport interface SetVoucherInput extends Action {\r\n type: BasketActionTypes.SET_VOUCHER_INPUT;\r\n payload: FormControl;\r\n}\r\n\r\nexport interface SetLastUserOrder extends Action {\r\n type: BasketActionTypes.SET_LAST_USER_ORDER;\r\n payload: AccountHistoryOrderDto;\r\n}\r\n\r\nexport interface SetTempItem extends Action {\r\n type: BasketActionTypes.SET_PAUSED_RECALCULATE_REQUEST;\r\n payload?: { items: BasketItem[]; coupons: AppliedCoupon[]; params: BasketOptions; compiledOffers?: BasketOffer[] };\r\n}\r\nexport interface SetProductNotAvailableModal extends Action {\r\n type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL;\r\n payload: boolean;\r\n}\r\nexport interface SetOfferNotAvailableModal extends Action {\r\n type: BasketActionTypes.SET_OFFER_NOT_AVAILABLE_MODAL;\r\n payload: boolean;\r\n}\r\nexport interface SetOutOfStockProducts extends Action {\r\n type: BasketActionTypes.SET_OUT_OF_STOCK_PRODUCTS;\r\n payload?: BasketState['outOfStockDetails'];\r\n}\r\nexport interface SetLanguage extends Action {\r\n type: BasketActionTypes.SET_LANGUAGE;\r\n payload: string;\r\n}\r\nexport interface SetNoOfVoucherExceeded extends Action {\r\n type: BasketActionTypes.SET_NO_OF_VOUCHERS_EXCEEDED_MODAL;\r\n payload: boolean;\r\n}\r\nexport interface SetCouponCodeInvalid extends Action {\r\n type: BasketActionTypes.SET_COUPON_CODE_INVALID_MODAL;\r\n payload: boolean;\r\n}\r\n\r\nexport const getEmptyBasket =\r\n (force = false): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { basket, pausedRecalculateRequest } = getState().basket;\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n if (pausedRecalculateRequest) {\r\n return;\r\n }\r\n if ((basket.items.length === 0 && basket.coupons.length === 0) || force) {\r\n const value: AxiosResponse = await Axios.get('api/baskets/');\r\n\r\n dispatch({ type: BasketActionTypes.SET_BASKET, payload: { ...value.data, compiledOffers: [] } });\r\n }\r\n },\r\n\r\n dispatch,\r\n });\r\n };\r\n\r\ninterface ItemToSimplify {\r\n sku: SKU;\r\n addedToppings?: Topping[];\r\n removedToppings?: Topping[];\r\n xTastyChoices?: XTastyChoice[];\r\n appliedDealId?: string;\r\n appliedDealIndex?: number;\r\n amount?: number;\r\n}\r\n\r\nfunction mapItemToSimplified(item: ItemToSimplify): SimplifiedBasketItem {\r\n return {\r\n sku: item.sku,\r\n addedToppings: item.addedToppings ? item.addedToppings : [],\r\n removedToppings: item.removedToppings ? item.removedToppings : [],\r\n xTastyChoices: item.xTastyChoices ? item.xTastyChoices : [],\r\n appliedDealId: item.appliedDealId ?? '',\r\n appliedDealIndex: item.appliedDealIndex,\r\n amount: item.amount ? item.amount : 1,\r\n };\r\n}\r\n\r\nexport const addProductBySKU =\r\n (sku: SKU): ThunkAction =>\r\n (dispatch): void => {\r\n dispatch(addProduct(mapItemToSimplified({ sku })));\r\n };\r\n\r\nexport const addProduct =\r\n (addedItem: SimplifiedBasketItem): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const basket = { ...getState().basket.basket };\r\n const items = [...basket.items];\r\n\r\n items.push(addedItem as BasketItem);\r\n\r\n dispatch(recalculateBasket({ items, coupons: basket.coupons }));\r\n };\r\n\r\nexport const replaceProduct =\r\n (\r\n productToReplace: SimplifiedBasketItem,\r\n productBeforeChanges: SimplifiedBasketItem,\r\n ): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const basket = { ...getState().basket.basket };\r\n const items = [...basket.items];\r\n\r\n const itemToReplaceIndex = items.findIndex((el) => JSON.stringify(el) === JSON.stringify(productBeforeChanges));\r\n if (itemToReplaceIndex !== -1) {\r\n items[itemToReplaceIndex] = productToReplace as BasketItem;\r\n }\r\n\r\n if (!getState().localization.currentStore.id) {\r\n dispatch(AddressWizzardActions.changeWizzardStep(AddressWizzardSteps.LocalizationModal));\r\n return;\r\n }\r\n\r\n dispatch(recalculateBasket({ items, coupons: basket.coupons }));\r\n };\r\n\r\nexport const removeProduct =\r\n (item: BasketItem): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const basket = { ...getState().basket.basket };\r\n const items = [...basket.items];\r\n const coupons = [...basket.coupons];\r\n const itemIndex = items.findIndex((el) => JSON.stringify(el) === JSON.stringify(item));\r\n\r\n if (items[itemIndex].appliedDealId && items[itemIndex].appliedDealIdentifier) {\r\n const couponIndex = coupons.findIndex(\r\n (coupon) => coupon.code === items[itemIndex].appliedDealId && coupon.type !== OfferTypes.PERC_DIS,\r\n );\r\n couponIndex >= 0 && coupons.splice(couponIndex, 1);\r\n }\r\n items.splice(itemIndex, 1);\r\n\r\n dispatch(recalculateBasket({ items, coupons }));\r\n };\r\n\r\nexport const addCoupon =\r\n (couponCode: string, includeSuggestions = false, useRecursively = false): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const basket = { ...state.basket.basket };\r\n let items = [...basket.items];\r\n let coupons = [...basket.coupons];\r\n const { offersCombo } = state.offers;\r\n\r\n if (offersCombo && offersCombo.length > 0) {\r\n offersCombo.forEach((offer) => {\r\n if (!offer.isPossible) {\r\n let shouldRemoveItems = true;\r\n coupons = coupons.filter((coupon) => {\r\n if (coupon.code === offer.couponId) {\r\n shouldRemoveItems = isOfferComplexType(coupon.type);\r\n return false;\r\n }\r\n return true;\r\n });\r\n if (shouldRemoveItems) {\r\n items = items.filter((item) => item.appliedDealId !== offer.couponId);\r\n } else {\r\n // remove applied coupon id from item when coupon is replaced by other\r\n items.forEach((item) => {\r\n if (item.appliedDealId === offer.couponId) item.appliedDealId = '';\r\n });\r\n }\r\n }\r\n });\r\n dispatch({ type: OffersActions.OffersActionTypes.SET_OFFERS_COMBINATION });\r\n }\r\n\r\n coupons.push({ code: couponCode, useRecursively } as AppliedCoupon);\r\n\r\n dispatch(recalculateBasket({ items, coupons, includeSuggestions }));\r\n };\r\n\r\nexport const addCompiledOffer =\r\n (dealIdentifier?: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n\r\n const basket = { ...state.basket.basket };\r\n const { customizationOffer, offersCombo } = state.offers;\r\n let coupons = [...basket.coupons];\r\n let items = dealIdentifier ? basket.items.filter((item) => item.appliedDealIdentifier !== dealIdentifier) : [...basket.items];\r\n const compilationItems = customizationOffer?.choiceSlots.map((item) => {\r\n return {\r\n ...item.selectedChoice,\r\n appliedDealIndex:\r\n item.selectedChoice?.appliedDealIndex && item.selectedChoice?.appliedDealIndex >= 0\r\n ? item.selectedChoice.appliedDealIndex\r\n : state.basket.basket.compiledOffers.length,\r\n appliedDealId: customizationOffer.code,\r\n } as BasketItem;\r\n }) as BasketItem[];\r\n\r\n if (offersCombo && offersCombo.length > 0) {\r\n offersCombo.forEach((offer) => {\r\n if (!offer.isPossible) {\r\n let shouldRemoveItems = true;\r\n coupons = [...coupons].filter((coupon) => {\r\n if (coupon.code === offer.couponId) {\r\n shouldRemoveItems = isOfferComplexType(coupon.type);\r\n return false;\r\n }\r\n return true;\r\n });\r\n if (shouldRemoveItems) {\r\n items = [...items].filter((item) => item.appliedDealId !== offer.couponId);\r\n }\r\n }\r\n });\r\n dispatch({ type: OffersActions.OffersActionTypes.SET_OFFERS_COMBINATION });\r\n }\r\n\r\n if (!customizationOffer?.appliedDealId) {\r\n customizationOffer && coupons.push({ code: customizationOffer?.code } as AppliedCoupon);\r\n }\r\n\r\n compilationItems && items.push(...compilationItems);\r\n dispatch({ type: OffersActions.OffersActionTypes.SET_CUSTOMIZATION_OFFER });\r\n dispatch(recalculateBasket({ items, coupons }));\r\n };\r\n\r\nexport const removeCoupon =\r\n (code: string, includeSuggestions = false, removeAll = false): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const basket = { ...getState().basket.basket };\r\n let coupons = [...basket.coupons];\r\n if (removeAll) {\r\n coupons = basket.coupons.filter((coupon) => coupon.code !== code);\r\n } else {\r\n coupons.splice(\r\n basket.coupons.findIndex((coupon) => coupon.code === code),\r\n 1,\r\n );\r\n }\r\n\r\n dispatch(recalculateBasket({ items: basket.items, coupons, includeSuggestions }));\r\n };\r\n\r\nexport const removeCompiledOffer =\r\n (appliedDealId: string, code: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const basket = { ...state.basket.basket };\r\n const couponIndex = basket.coupons.findIndex((coupon) => coupon.code === code);\r\n const coupons = [...basket.coupons];\r\n const items = basket.items.filter((item) => item.appliedDealIdentifier !== appliedDealId);\r\n\r\n coupons.splice(couponIndex, 1);\r\n\r\n dispatch(recalculateBasket({ items, coupons }));\r\n };\r\n\r\nexport interface BasketOptions {\r\n includeSuggestions?: boolean;\r\n redirectToProducts?: boolean;\r\n removeInvalidProductsNCoupons?: boolean;\r\n}\r\ninterface RecalculateBasketParams extends BasketOptions {\r\n items: BasketItem[];\r\n coupons: AppliedCoupon[];\r\n}\r\n\r\nexport const refreshBasket =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { basket } = getState().basket;\r\n if (basket.items.length > 0 || basket.coupons.length > 0) {\r\n dispatch(\r\n recalculateBasket({\r\n items: basket.items,\r\n coupons: basket.coupons,\r\n includeSuggestions: false,\r\n }),\r\n );\r\n }\r\n };\r\n\r\nexport const reorderFromHistoryProductsNCoupons =\r\n (\r\n historyCoupons: HistoryOrderCoupon[],\r\n historyProducts: HistoryOrderProduct[],\r\n redirectToProducts = false,\r\n ): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { basket } = getState().basket;\r\n\r\n const newBasket = addHistoryBasketToCurrent(basket, historyCoupons, historyProducts);\r\n\r\n if (newBasket.items.length > 0 || newBasket.coupons.length > 0) {\r\n dispatch(\r\n recalculateBasket({\r\n items: newBasket.items,\r\n coupons: newBasket.coupons,\r\n includeSuggestions: false,\r\n redirectToProducts,\r\n removeInvalidProductsNCoupons: true,\r\n }),\r\n );\r\n }\r\n };\r\n \r\nexport const recalculateBasket =\r\n ({\r\n items,\r\n coupons,\r\n includeSuggestions = false,\r\n redirectToProducts = false,\r\n removeInvalidProductsNCoupons = false,\r\n }: RecalculateBasketParams): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, true));\r\n ResponseWrapper({\r\n action: async () => {\r\n const localizationCookieExpired = !cookieExists('localization');\r\n if (!state.localization.currentStore.id) {\r\n dispatch({\r\n type: BasketActionTypes.SET_PAUSED_RECALCULATE_REQUEST,\r\n payload: {\r\n items,\r\n coupons,\r\n params: {\r\n includeSuggestions,\r\n redirectToProducts,\r\n removeInvalidProductsNCoupons,\r\n },\r\n },\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n dispatch(AddressWizzardActions.changeWizzardStep(AddressWizzardSteps.LocalizationModal));\r\n dispatch(saveBasket());\r\n return;\r\n }\r\n\r\n if (localizationCookieExpired) {\r\n // so there is redux localization, but it is expired (not in cookie)\r\n dispatch(removeBasket());\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n dispatch(AddressWizzardActions.changeWizzardStep(AddressWizzardSteps.LocalizationModal));\r\n return;\r\n }\r\n\r\n const value: AxiosResponse = await Axios.post(\r\n 'api/baskets',\r\n {\r\n items: items.map((item) => mapItemToSimplified(item)),\r\n coupons,\r\n isDelivery: state.localization.distributionType === OrderDistributionType.Delivery,\r\n orderDateTime: state.localization.selectedOrderTime?.dateTimeFrame,\r\n storeId: state.localization.currentStore.id,\r\n deliveryAddress: {\r\n Street: state.localization.selectedAddress.street,\r\n City: state.localization.selectedAddress.city,\r\n Country: state.localization.selectedAddress.region,\r\n District: state.localization.selectedAddress.region,\r\n StreetNumber: state.localization.selectedAddress.streetNumber,\r\n },\r\n removeInvalidProductsNCoupons,\r\n },\r\n {\r\n params: {\r\n includeSuggestions,\r\n },\r\n },\r\n );\r\n\r\n const basketWithOffers = groupCompiledOffers(value.data);\r\n dispatch({\r\n type: BasketActionTypes.SET_BASKET,\r\n payload: basketWithOffers,\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n dispatch(saveBasket());\r\n\r\n const removedCoupons = (value.data.removedCouponsCodes && value.data.removedCouponsCodes.length > 0) ?? false;\r\n const removedProducts = (value.data.removedProductsIds && value.data.removedProductsIds.length > 0) ?? false;\r\n\r\n if (removeInvalidProductsNCoupons && (removedCoupons || removedProducts)) {\r\n dispatch({ type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: true });\r\n }\r\n\r\n if (redirectToProducts){\r\n redirectToOtherAppURL('products');\r\n }\r\n },\r\n dispatch,\r\n allowedErr: {\r\n // TODO update to different status code after proper backend fix\r\n errorCodes: [\r\n 'PRICE_CALCULATION_INVALID_PRODUCTS',\r\n 'ProductNotAvailableForSelectedDeliveryTime',\r\n 'RequestedProductNotAvailableForStore',\r\n 'ProductOutOfStock',\r\n 'PRODUCT_NOT_FOUND',\r\n 'RequestedProductsDoNotMatchCouponCodes',\r\n 'CouponProductCompositionInvalid',\r\n 'NoActionFoundForCouponCode',\r\n 'SingleUseCouponUsagesExceeded',\r\n 'OptionOutOfStock',\r\n 'CouponCodeInvalid',\r\n ],\r\n action: (err: AxiosError) => {\r\n const errorDescription = err.response?.data.errorDescription;\r\n\r\n if (errorDescription === 'RequestedProductsDoNotMatchCouponCodes'\r\n || errorDescription === 'CouponProductCompositionInvalid'\r\n ) {\r\n dispatch({ type: OffersActions.OffersActionTypes.SET_INVALID_PRODUCT_COMPOSITION_MODAL, payload: true });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n return;\r\n }\r\n\r\n if (err.response?.data.errorCode === 'SingleUseCouponUsagesExceeded') {\r\n dispatch({ type: BasketActionTypes.SET_NO_OF_VOUCHERS_EXCEEDED_MODAL, payload: true });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n return;\r\n }\r\n\r\n if (err.response?.data.errorCode === 'CouponCodeInvalid') {\r\n dispatch({ type: BasketActionTypes.SET_COUPON_CODE_INVALID_MODAL, payload: true });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n return;\r\n }\r\n\r\n dispatch({ type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: true });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n\r\n if (errorDescription === 'ProductOutOfStock'\r\n || errorDescription === 'OptionOutOfStock') {\r\n const outOfStockProducts = err.response?.data.entitiesErrors.map((item) => item.entityIdentifier);\r\n if (outOfStockProducts && outOfStockProducts.length > 0) {\r\n dispatch({\r\n type: BasketActionTypes.SET_OUT_OF_STOCK_PRODUCTS,\r\n payload: { outOfStockProducts, basketItems: items, basketCoupons: coupons },\r\n });\r\n }\r\n }\r\n },\r\n },\r\n errorCallback: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n },\r\n });\r\n };\r\n\r\nexport const getCrossSell =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/offers/cross-sell', {\r\n params: {\r\n storeId: state.localization.currentStore.id,\r\n deliveryDateTime: state.localization.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n dispatch({\r\n type: BasketActionTypes.SET_CROSS_SELL,\r\n payload: value.data[0],\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getLastUserOrder =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const response: AxiosResponse = await Axios.get('api/accounts/orders/history');\r\n if (response?.data.historyOrders && response.data.historyOrders.length > 0) {\r\n dispatch({\r\n type: BasketActionTypes.SET_LAST_USER_ORDER,\r\n payload: response.data.historyOrders[0],\r\n });\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const updateVoucherInput =\r\n (voucher: string, validate = false): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const validator = new FormValidatorHandler({\r\n value: voucher,\r\n validators: [\r\n CommonValidators.required({\r\n message: state.productsStaticContent.voucherModal.errorMessageRequired,\r\n messageType: UserMessageType.ERROR,\r\n }),\r\n ],\r\n });\r\n\r\n dispatch({\r\n type: BasketActionTypes.SET_VOUCHER_INPUT,\r\n payload: {\r\n value: voucher,\r\n errorMessage: validate ? validator.validate().messages[0]?.message : undefined,\r\n touched: true,\r\n },\r\n });\r\n };\r\n\r\nexport const addVoucher =\r\n (redirectCallback: (code: string) => void): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n\r\n if (state.basket.voucherControl.touched && !state.basket.voucherControl.errorMessage) {\r\n ResponseWrapper({\r\n action: async () => {\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, true));\r\n const value: AxiosResponse = await Axios.get(`api/offers/vouchers/${state.basket.voucherControl.value}`, {\r\n params: {\r\n deliveryType: state.localization.distributionType,\r\n storeId: state.localization.currentStore.id,\r\n },\r\n });\r\n if (value.data) {\r\n dispatch(checkOfferCombinationValidity(value.data.code, () => redirectCallback(value.data.code), 0));\r\n dispatch({ type: BasketActionTypes.SET_VOUCHER_MODAL_VISIBILITY, payload: false });\r\n gtm.cartModule.offerPromoAdded(value.data, state.basket.basketTraceId);\r\n }\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n },\r\n dispatch,\r\n allowedErr: {\r\n statusArr: [404, 400, 500],\r\n action: (): void => {\r\n dispatch({\r\n type: BasketActionTypes.SET_VOUCHER_INPUT,\r\n payload: {\r\n value: state.basket.voucherControl.value,\r\n errorMessage: state.productsStaticContent.voucherModal.errorMessageWrongCoupon,\r\n touched: true,\r\n },\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(BASKET_LOADER, false));\r\n },\r\n },\r\n });\r\n }\r\n };\r\n\r\nexport const continueRecalculateRequest =\r\n (items: BasketItem[], coupons: AppliedCoupon[], params: BasketOptions): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n let updatedCoupons = coupons;\r\n if (coupons.length > 0) {\r\n const state = getState();\r\n let { offers } = state.offers;\r\n\r\n if (offers.length === 0) {\r\n const value: AxiosResponse = await Axios.get('api/offers', {\r\n params: {\r\n storeId: state.localization.currentStore.id,\r\n deliveryType: state.localization.distributionType,\r\n deliveryDateTime: state.localization.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n offers = value.data;\r\n }\r\n\r\n const isOfferAssignedToStore = offers.find((offer) => offer.code === coupons[0].code);\r\n\r\n if (!isOfferAssignedToStore) {\r\n const value: AxiosResponse = await Axios.get('api/offers/cross-sell', {\r\n params: {\r\n storeId: state.localization.currentStore.id,\r\n deliveryDateTime: state.localization.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n\r\n if (value.data[0].code !== coupons[0].code) {\r\n dispatch({ type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: true });\r\n updatedCoupons = [];\r\n }\r\n }\r\n }\r\n\r\n dispatch(recalculateBasket({ items, coupons: updatedCoupons, ...params }));\r\n dispatch({ type: BasketActionTypes.SET_PAUSED_RECALCULATE_REQUEST });\r\n };\r\n\r\nexport const saveBasket =\r\n (): ThunkAction =>\r\n async (_dispatch, getState): Promise => {\r\n const state = getState();\r\n const { basket, pausedRecalculateRequest, basketTraceId } = state.basket;\r\n\r\n const basketJson = JSON.stringify({\r\n language: appCulture(),\r\n basket,\r\n pausedRecalculateRequest,\r\n basketTraceId,\r\n });\r\n\r\n localStorage.setItem('basket', basketJson);\r\n\r\n _dispatch({ type: BasketActionTypes.SET_LANGUAGE, payload: appCulture() });\r\n };\r\n\r\nexport const removeBasket =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n removeBasketFromLocalStorage();\r\n dispatch(getEmptyBasket(true));\r\n };\r\n\r\nfunction groupCompiledOffers(basket: Basket): Basket {\r\n const updatedBasket = { ...basket };\r\n updatedBasket.compiledOffers = [];\r\n\r\n updatedBasket.items.forEach((item, index) => {\r\n if (!item.appliedDealIdentifier) return;\r\n\r\n const compileOfferIndex = updatedBasket.compiledOffers.findIndex(\r\n (offer) => offer.appliedDealIdentifier === item.appliedDealIdentifier,\r\n );\r\n\r\n if (compileOfferIndex >= 0) {\r\n updatedBasket.compiledOffers[compileOfferIndex].choices.push(item);\r\n updatedBasket.items[index].isCompilationPart = true;\r\n updatedBasket.items[index].appliedDealIndex = compileOfferIndex;\r\n return;\r\n }\r\n\r\n const currentCoupon = updatedBasket.coupons.find(\r\n (coupon) => coupon.identifier === item.appliedDealIdentifier,\r\n ) as AppliedCoupon;\r\n if (!isOfferComplexType(currentCoupon.type)) return;\r\n\r\n updatedBasket.compiledOffers.push({\r\n appliedDealIdentifier: item.appliedDealIdentifier,\r\n choices: [item],\r\n price: currentCoupon.price,\r\n title: currentCoupon.displayTitle,\r\n code: currentCoupon.code,\r\n type: currentCoupon.type,\r\n });\r\n updatedBasket.items[index].isCompilationPart = true;\r\n updatedBasket.items[index].appliedDealIndex = updatedBasket.compiledOffers.length - 1;\r\n });\r\n\r\n return updatedBasket;\r\n}\r\n\r\nexport const removeOutOfStockProducts =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const {\r\n basket: { outOfStockDetails },\r\n } = getState();\r\n if (!outOfStockDetails) {\r\n dispatch({ type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: false });\r\n dispatch({ type: BasketActionTypes.SET_OFFER_NOT_AVAILABLE_MODAL, payload: false });\r\n return;\r\n }\r\n\r\n const { outOfStockProducts, basketItems, basketCoupons } = outOfStockDetails;\r\n\r\n const removedItemsDealIndexes = basketItems\r\n .filter((item) => outOfStockProducts?.includes(item.sku.productId) && item.appliedDealIndex >= 0)\r\n .map((item) => item.appliedDealIndex)\r\n .removeDuplicates();\r\n\r\n const updatedItems = basketItems\r\n .filter((item) => !outOfStockProducts.includes(item.sku.productId))\r\n .map((item) => {\r\n return { ...item, appliedDealId: removedItemsDealIndexes.includes(item.appliedDealIndex) ? '' : item.appliedDealId };\r\n });\r\n const updatedCoupons = basketCoupons.filter((_, index) => !removedItemsDealIndexes.includes(index));\r\n\r\n dispatch(recalculateBasket({ items: updatedItems, coupons: updatedCoupons }));\r\n dispatch({ type: BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: false });\r\n dispatch({ type: BasketActionTypes.SET_OFFER_NOT_AVAILABLE_MODAL, payload: false });\r\n dispatch({ type: BasketActionTypes.SET_OUT_OF_STOCK_PRODUCTS });\r\n dispatch(refreshProducts());\r\n };\r\n\r\nfunction addHistoryBasketToCurrent(\r\n currentBasket: Basket,\r\n historyCoupons: HistoryOrderCoupon[],\r\n historyProducts: HistoryOrderProduct[],\r\n): RecalculateBasketParams {\r\n const newItems = [...currentBasket.items];\r\n const newCoupons = [...currentBasket.coupons];\r\n let currentCouponIndex = currentBasket.coupons.length;\r\n historyCoupons.forEach((cp) => {\r\n const originCouponProducts = cp.products.map((pr) => {\r\n return {\r\n addedToppings: pr.addedToppings,\r\n removedToppings: pr.removedToppings,\r\n amount: pr.amount,\r\n xTastyChoices: pr.xTastyChoices,\r\n sku: {\r\n productTitle: pr.title,\r\n optionTitle: pr.optionTitle,\r\n optionSubTitle: pr.optionSubType,\r\n optionId: pr.optionId,\r\n productId: pr.id,\r\n },\r\n appliedDealId: cp.code,\r\n appliedDealIndex: currentCouponIndex,\r\n } as SimplifiedBasketItem;\r\n });\r\n const originCoupon = {\r\n code: cp.code,\r\n description: cp.description,\r\n discount: cp.discount,\r\n displayTitle: cp.title,\r\n isApplied: true,\r\n price: cp.price,\r\n type: cp.type,\r\n useRecursively: false,\r\n } as AppliedCoupon;\r\n newItems.push(...(originCouponProducts as BasketItem[]));\r\n newCoupons.push(originCoupon);\r\n currentCouponIndex++;\r\n });\r\n\r\n const productsFromOriginOrder = historyProducts.map((pr) => {\r\n return {\r\n addedToppings: pr.addedToppings,\r\n removedToppings: pr.removedToppings,\r\n amount: pr.amount,\r\n xTastyChoices: pr.xTastyChoices,\r\n sku: {\r\n productTitle: pr.title,\r\n optionTitle: pr.optionTitle,\r\n optionSubTitle: pr.optionSubType,\r\n optionId: pr.optionId,\r\n productId: pr.id,\r\n },\r\n } as SimplifiedBasketItem;\r\n });\r\n\r\n newItems.push(...(productsFromOriginOrder as BasketItem[]));\r\n\r\n const recalcParams: RecalculateBasketParams = {\r\n items: newItems,\r\n coupons: newCoupons,\r\n includeSuggestions: false,\r\n };\r\n\r\n return recalcParams;\r\n}\r\n\r\nexport type BasketActions =\r\n | SetLastUserOrder\r\n | SetBasket\r\n | SetCrossSell\r\n | SetCouponModalVisibility\r\n | SetVoucherInput\r\n | SetTempItem\r\n | SetProductNotAvailableModal\r\n | SetOfferNotAvailableModal\r\n | SetOutOfStockProducts\r\n | SetLanguage\r\n | SetNoOfVoucherExceeded\r\n | SetCouponCodeInvalid;\r\n","import { AxiosResponse } from 'axios';\r\nimport Axios from 'shared/api/axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { ApplicationState } from '../index';\r\nimport { InlineBannerStaticContent, ProductsStaticContent } from './products-static-content.reducer';\r\n\r\nexport enum ProductsStaticContentActionTypes {\r\n SET_STATIC_CONTENT = '[Products.StaticContent] SET_STATIC_CONTENT',\r\n SET_INLINE_BANNER = '[Products.StaticContent] SET_INLINE_BANNER',\r\n}\r\n\r\ninterface SetStaticContent {\r\n type: ProductsStaticContentActionTypes.SET_STATIC_CONTENT;\r\n payload: ProductsStaticContent;\r\n}\r\ninterface SetInlineBanner {\r\n type: ProductsStaticContentActionTypes.SET_INLINE_BANNER;\r\n payload: InlineBannerStaticContent;\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/static-content/products');\r\n dispatch({\r\n type: ProductsStaticContentActionTypes.SET_STATIC_CONTENT,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\nexport const getInlineBanner =\r\n (category: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get(`api/static-content/inline-banner`, {\r\n params: {\r\n category,\r\n },\r\n validateStatus: (status: number) => status >= 200 && status < 300 && status !== 204,\r\n });\r\n dispatch({\r\n type: ProductsStaticContentActionTypes.SET_INLINE_BANNER,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n allowedErr: {\r\n statusArr: [204],\r\n action: (): void => {\r\n dispatch({\r\n type: ProductsStaticContentActionTypes.SET_INLINE_BANNER,\r\n payload: {\r\n inlineBannerVisibility: false,\r\n inlineBannerImage: '',\r\n inlineBannerRow: 0,\r\n inlineBannerUrl: '',\r\n } as InlineBannerStaticContent,\r\n });\r\n },\r\n },\r\n errorCallback: async () => {\r\n dispatch({\r\n type: ProductsStaticContentActionTypes.SET_INLINE_BANNER,\r\n payload: {\r\n inlineBannerVisibility: false,\r\n inlineBannerImage: '',\r\n inlineBannerRow: 0,\r\n inlineBannerUrl: '',\r\n } as InlineBannerStaticContent,\r\n });\r\n },\r\n });\r\n };\r\n\r\nexport type StaticContentActions = SetStaticContent | SetInlineBanner;\r\n","import { ApplicationState } from 'apps/ProductsApp/store';\r\nimport { CustomizeProductStep } from 'apps/ProductsApp/store/customize-product/customize-product.reducer';\r\nimport { CustomizationProduct, SliceCustomization } from 'apps/ProductsApp/types/catalog.types';\r\nimport { AxiosResponse } from 'axios';\r\nimport Axios from 'shared/api/axios';\r\nimport { Dispatch } from 'react';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { BasketItem, SpecificationToppingsPrices, SimplifiedBasketItem } from 'apps/ProductsApp/types/basket.types';\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { extractDefaultToppings, initSlices } from 'apps/ProductsApp/helpers/customize-product.helper';\r\nimport { CategoryDto, OptionDetails, Option, Product, ProductDetails, Topping } from '../../types/dto.types';\r\nimport { ProductsActions } from '../actions';\r\n\r\nexport enum CustomizeProductActionTypes {\r\n CLEAR_CUSTOMIZE_STATE = '[CUSTOMIZE_PRODUCT] CLEAR_CUSTOMIZE_STATE',\r\n SET_CUSTOMIZATION_PIZZA = '[CUSTOMIZE_PRODUCT] SET_CUSTOMIZATION_PIZZA',\r\n SET_CUSTOMIZATION_PRODUCT = '[CUSTOMIZE_PRODUCT] SET_CUSTOMIZATION_PRODUCT',\r\n SET_CURRENT_STEP = '[CUSTOMIZE_PRODUCT] SET_CURRENT_STEP',\r\n SET_ADD_FUNCTION = '[CUSTOMIZE_PRODUCT] SET_ADD_FUNCTION',\r\n SET_ACTIVE_OPTION = '[CUSTOMIZE_PRODUCT] SET_ACTIVE_OPTION',\r\n SET_ACTIVE_SLICE = '[CUSTOMIZE_PRODUCT] SET_ACTIVE_SLICE',\r\n SET_ADDED_TOPPINGS = '[CUSTOMIZE_PRODUCT] SET_ADDED_TOPPINGS',\r\n SET_REMOVED_TOPPINGS = '[CUSTOMIZE_PRODUCT] SET_REMOVED_TOPPINGS',\r\n SET_SELECTED_CHEESE = '[CUSTOMIZE_PRODUCT] SET_SELECTED_CHEESE',\r\n SET_SELECTED_SAUCE = '[CUSTOMIZE_PRODUCT] SET_SELECTED_SAUCE',\r\n SET_SLICE_PRODUCT = '[CUSTOMIZE_PRODUCT] SET_SLICE_PRODUCT',\r\n INIT_SLICES = '[CUSTOMIZE_PRODUCT] INIT_SLICES',\r\n LOAD_PRODUCT_FROM_MODEL = '[CUSTOMIZE_PRODUCT] LOAD_PRODUCT_FROM_MODEL',\r\n CONFIRM_SLICE_PRODUCT = '[CUSTOMIZE_PRODUCT] CONFIRM_SLICE_PRODUCT',\r\n SET_AVAILABLE_RECIPES = '[CUSTOMIZE_PRODUCT] SET_AVAILABLE_RECIPES',\r\n SET_TOPPINGS_PRICE = '[CUSTOMIZE_PRODUCT] SET_TOPPINGS_PRICE',\r\n SET_PRODUCT_PRICE = '[CUSTOMIZE_PRODUCT] SET_PRODUCT_PRICE',\r\n}\r\n\r\nconst CUSTOMIZE_PRODUCT_LOADER = 'customizeProductLoader';\r\n\r\ninterface SetCustomizationPizza extends Action {\r\n type: CustomizeProductActionTypes.SET_CUSTOMIZATION_PIZZA;\r\n payload: CustomizationProduct;\r\n}\r\ninterface SetCustomizationProduct extends Action {\r\n type: CustomizeProductActionTypes.SET_CUSTOMIZATION_PRODUCT;\r\n payload: CustomizationProduct;\r\n}\r\n\r\ninterface ClearCustomizeState extends Action {\r\n type: CustomizeProductActionTypes.CLEAR_CUSTOMIZE_STATE;\r\n}\r\n\r\ninterface SetCurrentStep extends Action {\r\n type: CustomizeProductActionTypes.SET_CURRENT_STEP;\r\n payload: CustomizeProductStep;\r\n}\r\n\r\ninterface SetActiveOption extends Action {\r\n type: CustomizeProductActionTypes.SET_ACTIVE_OPTION;\r\n payload: OptionDetails;\r\n}\r\ninterface SetAddedToppings extends Action {\r\n type: CustomizeProductActionTypes.SET_ADDED_TOPPINGS;\r\n payload: Topping[];\r\n}\r\ninterface SetRemovedToppings extends Action {\r\n type: CustomizeProductActionTypes.SET_REMOVED_TOPPINGS;\r\n payload: Topping[];\r\n}\r\n\r\ninterface SetSelectedCheese extends Action {\r\n type: CustomizeProductActionTypes.SET_SELECTED_CHEESE;\r\n payload: Topping;\r\n}\r\n\r\ninterface SetSelectedSauce extends Action {\r\n type: CustomizeProductActionTypes.SET_SELECTED_SAUCE;\r\n payload: Topping;\r\n}\r\n\r\ninterface InitSlices extends Action {\r\n type: CustomizeProductActionTypes.INIT_SLICES;\r\n payload: { slices: SliceCustomization[]; activeSlice: number };\r\n}\r\n\r\ninterface SetActiveSlice extends Action {\r\n type: CustomizeProductActionTypes.SET_ACTIVE_SLICE;\r\n payload: number;\r\n}\r\n\r\ninterface SetAddFunction extends Action {\r\n type: CustomizeProductActionTypes.SET_ADD_FUNCTION;\r\n payload: (basketItemToAdd: SimplifiedBasketItem) => void;\r\n}\r\ninterface CustomizeProductFromBasket extends Action {\r\n type: CustomizeProductActionTypes.LOAD_PRODUCT_FROM_MODEL;\r\n payload: {\r\n slices: SliceCustomization[];\r\n activeOption: OptionDetails;\r\n };\r\n}\r\ninterface SetRecipeOnSlice extends Action {\r\n type: CustomizeProductActionTypes.SET_SLICE_PRODUCT;\r\n payload: ProductDetails;\r\n}\r\ninterface ConfirmRecipeOnSlice extends Action {\r\n type: CustomizeProductActionTypes.CONFIRM_SLICE_PRODUCT;\r\n}\r\ninterface SetAvailableRecipes extends Action {\r\n type: CustomizeProductActionTypes.SET_AVAILABLE_RECIPES;\r\n payload: Product[];\r\n}\r\ninterface SetToppingsPrice extends Action {\r\n type: CustomizeProductActionTypes.SET_TOPPINGS_PRICE;\r\n payload: SpecificationToppingsPrices;\r\n}\r\n\r\ninterface SetProductPrice extends Action {\r\n type: CustomizeProductActionTypes.SET_PRODUCT_PRICE;\r\n payload: number;\r\n}\r\n\r\nexport function clearCustomizeState() {\r\n return (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.CLEAR_CUSTOMIZE_STATE,\r\n });\r\n };\r\n}\r\n\r\ninterface SetCustomizationProductProps {\r\n productId: string;\r\n callbackFunction: (basketItemToAdd: BasketItem) => void;\r\n limitedOptions?: Option[];\r\n position: number;\r\n offerCode?: string;\r\n offerChoiceIndex?: number;\r\n}\r\n\r\nexport const setCustomizationProduct =\r\n ({\r\n productId,\r\n callbackFunction,\r\n limitedOptions,\r\n position,\r\n offerCode,\r\n offerChoiceIndex\r\n }: SetCustomizationProductProps): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n try {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, true));\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_ADD_FUNCTION,\r\n payload: callbackFunction,\r\n });\r\n const storeId = getState().localization.currentStore.id;\r\n const value: ProductDetails = await getProductDetails(productId, storeId);\r\n const isStarter = value.categoryId !== 'PIZ';\r\n\r\n if (limitedOptions) {\r\n const updatedOptions = limitedOptions.map((option) => {\r\n return value.options.find((detailedOption) => {\r\n return (\r\n JSON.stringify(detailedOption.sku.optionId) === JSON.stringify(option.sku.optionId) &&\r\n JSON.stringify(detailedOption.sku.productId) === JSON.stringify(option.sku.productId)\r\n );\r\n }) as OptionDetails;\r\n });\r\n value.options = updatedOptions;\r\n }\r\n\r\n dispatch({\r\n type: isStarter\r\n ? CustomizeProductActionTypes.SET_CUSTOMIZATION_PRODUCT\r\n : CustomizeProductActionTypes.SET_CUSTOMIZATION_PIZZA,\r\n payload: { ...value, position, offerCode, offerChoiceIndex },\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n } catch {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const editCustomizationProduct =\r\n (\r\n basketItem: BasketItem,\r\n callbackFunction: (basketItemToReplace: SimplifiedBasketItem) => void,\r\n ): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n ResponseWrapper({\r\n action: async () => {\r\n try {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, true));\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_ADD_FUNCTION,\r\n payload: callbackFunction,\r\n });\r\n const storeId = getState().localization.currentStore.id;\r\n const product: ProductDetails = await getProductDetails(basketItem.sku.productId, storeId);\r\n const isStarter = product.categoryId !== 'PIZ';\r\n const optionDetails = product.options.find((el) => el.id.toString() === basketItem.sku.optionId);\r\n\r\n optionDetails &&\r\n dispatch({\r\n type: CustomizeProductActionTypes.LOAD_PRODUCT_FROM_MODEL,\r\n payload: {\r\n slices: await initSlicesFromBasketItem(basketItem, state.products.toppings, storeId, product),\r\n activeOption: optionDetails,\r\n },\r\n });\r\n if (basketItem.specificationToppingsPrices) {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_TOPPINGS_PRICE,\r\n payload: basketItem.specificationToppingsPrices,\r\n });\r\n }\r\n if (isStarter) {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_CUSTOMIZATION_PRODUCT,\r\n payload: product,\r\n });\r\n } else {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_CUSTOMIZATION_PIZZA,\r\n payload: product,\r\n });\r\n }\r\n\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n } catch {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const setAvailableRecipes =\r\n (storeId?: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n try {\r\n const allPizzas: AxiosResponse = await Axios.get(`api/products/categories`, {\r\n params: {\r\n categoryCode: 'PIZ',\r\n storeId,\r\n },\r\n });\r\n dispatch({ type: CustomizeProductActionTypes.SET_AVAILABLE_RECIPES, payload: allPizzas.data[0].products });\r\n } catch (ex) {\r\n console.warn(`Could not fetch all products for category PIZ`, ex);\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const setSliceProduct =\r\n (productId: string): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n\r\n ResponseWrapper({\r\n action: async () => {\r\n try {\r\n const storeId = getState().localization.currentStore.id;\r\n const productDetails: ProductDetails = await getProductDetails(productId, storeId);\r\n const { activeOption, slices, activeSlice } = state.customizeProduct;\r\n const selectedOptionId = activeOption?.id;\r\n const productOption = productDetails.options.find((el) => el.id === selectedOptionId);\r\n if (productOption) {\r\n const defaultToppings = extractDefaultToppings(state.products.toppings, productOption);\r\n const slicesWithDefaultToppings = updateSliceWithDefaultToppings(slices, activeSlice, defaultToppings, true);\r\n dispatch({\r\n type: CustomizeProductActionTypes.INIT_SLICES,\r\n payload: {\r\n slices: slicesWithDefaultToppings,\r\n activeSlice,\r\n },\r\n });\r\n }\r\n dispatch({ type: CustomizeProductActionTypes.SET_SLICE_PRODUCT, payload: productDetails });\r\n } catch {\r\n console.warn(`Could not find details for product with id: ${productId}`);\r\n }\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const setActiveOption =\r\n (option: OptionDetails): ThunkAction =>\r\n (dispatch, getState): void => {\r\n const state = getState();\r\n const { activeSlice, productToCustomize } = state.customizeProduct;\r\n const xTastySlicesCount = productToCustomize?.xTastySlicesCount ?? 1;\r\n let slices = initSlices(state.customizeProduct.slices, xTastySlicesCount);\r\n if (slices.length === 1) {\r\n const defaultToppings = extractDefaultToppings(state.products.toppings, option);\r\n slices = updateSliceWithDefaultToppings(slices, activeSlice, defaultToppings);\r\n }\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_ACTIVE_OPTION,\r\n payload: option,\r\n });\r\n\r\n dispatch({\r\n type: CustomizeProductActionTypes.INIT_SLICES,\r\n payload: {\r\n slices,\r\n activeSlice: 0,\r\n },\r\n });\r\n };\r\n\r\nfunction updateSliceWithDefaultToppings(\r\n currentSlices: SliceCustomization[],\r\n sliceId: number,\r\n defaultToppings: Topping[],\r\n resetSauceNCheese = false,\r\n): SliceCustomization[] {\r\n const slices = [...currentSlices];\r\n const defaultSauce = defaultToppings.find((el) => el.categoryId === 'SAU');\r\n const defaultCheese = defaultToppings.find((el) => el.categoryId === 'RND');\r\n slices[sliceId].defaultSauce = defaultSauce;\r\n slices[sliceId].defaultCheese = defaultCheese;\r\n slices[sliceId].defaultToppings = defaultToppings;\r\n if (resetSauceNCheese || slices[sliceId].selectedSauce === undefined) {\r\n slices[sliceId].selectedSauce = defaultSauce;\r\n }\r\n if (resetSauceNCheese || slices[sliceId].selectedCheese === undefined) {\r\n slices[sliceId].selectedCheese = defaultCheese;\r\n }\r\n return slices;\r\n}\r\n\r\nasync function initSlicesFromBasketItem(\r\n item: BasketItem,\r\n allToppings: Topping[],\r\n storeId: string,\r\n baseProduct: ProductDetails,\r\n): Promise {\r\n if (item.xTastyChoices.length > 0) {\r\n const sliceCustomizations: SliceCustomization[] = new Array(item.xTastyChoices.length);\r\n item.xTastyChoices.map(async (xtastyPart, index) => {\r\n const product: ProductDetails = await getProductDetails(xtastyPart.productId, storeId);\r\n const productOption = product.options.find((el) => el.id.toString() === item.sku.optionId);\r\n const defaultToppings = productOption ? extractDefaultToppings(allToppings, productOption) : [];\r\n sliceCustomizations[index] = {\r\n sliceProductConfirmed: true,\r\n sliceProduct: product,\r\n ...getSliceCustomization(defaultToppings, xtastyPart.addedToppings, xtastyPart.removedToppings),\r\n } as SliceCustomization;\r\n });\r\n return sliceCustomizations;\r\n }\r\n\r\n const productOption = baseProduct.options.find((el) => el.id.toString() === item.sku.optionId);\r\n const defaultToppings = productOption ? extractDefaultToppings(allToppings, productOption) : [];\r\n return [\r\n {\r\n ...getSliceCustomization(defaultToppings, item.addedToppings ?? [], item.removedToppings ?? []),\r\n },\r\n ];\r\n}\r\n\r\nfunction getSliceCustomization(defaultToppings: Topping[], addedToppings: Topping[], removedToppings: Topping[]): SliceCustomization {\r\n const defaultSauce = defaultToppings.find((el) => el.categoryId === 'SAU');\r\n const defaultCheese = defaultToppings.find((el) => el.categoryId === 'RND');\r\n const selectedSauce = addedToppings.find((el) => el.categoryId === 'SAU') ?? defaultSauce;\r\n const selectedCheese = addedToppings.find((el) => el.categoryId === 'RND') ?? defaultCheese;\r\n const addedWithoutSaucesNCheeses = addedToppings.filter((topping) => topping.categoryId !== 'SAU' && topping.categoryId !== 'RND');\r\n const removedWithoutSaucesNCheeses = removedToppings.filter(\r\n (topping) => topping.categoryId !== 'SAU' && topping.categoryId !== 'RND',\r\n );\r\n\r\n return {\r\n defaultToppings,\r\n defaultCheese,\r\n defaultSauce,\r\n selectedCheese,\r\n selectedSauce,\r\n addedToppings: addedWithoutSaucesNCheeses,\r\n removedToppings: removedWithoutSaucesNCheeses,\r\n } as SliceCustomization;\r\n}\r\n\r\nasync function getProductDetails(productId: string, storeId: string): Promise {\r\n const product = await Axios.get(`api/products/details/${productId}`, {\r\n params: {\r\n storeId,\r\n },\r\n });\r\n return product.data;\r\n}\r\n\r\nexport const addToppings =\r\n (addedToppings: Topping[]): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_ADDED_TOPPINGS,\r\n payload: addedToppings,\r\n });\r\n dispatch(updatePrice());\r\n };\r\n\r\nexport const removeToppings =\r\n (removedToppings: Topping[]): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_REMOVED_TOPPINGS,\r\n payload: removedToppings,\r\n });\r\n dispatch(updatePrice());\r\n };\r\n\r\nexport const updatePrice =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { customizeProduct, localization } = getState();\r\n const { productToCustomize, activeOption, activeSlice, slices } = customizeProduct;\r\n const { currentStore, distributionType } = localization;\r\n\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, true));\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n const isReadyToPriceUpdate = !productToCustomize?.isXTasty || slices.every(s => s.sliceProductConfirmed);\r\n if (!isReadyToPriceUpdate){\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n return;\r\n }\r\n\r\n const toppingsPrice = await Axios.post<{ toppingsCalculationResult: SpecificationToppingsPrices }>(\r\n 'api/baskets/toppings-calculation',\r\n {\r\n storeId: currentStore.id,\r\n deliverOrder: distributionType === OrderDistributionType.Delivery,\r\n productId: productToCustomize?.id,\r\n optionId: activeOption?.sku.optionId,\r\n productSpecification: productToCustomize?.isXTasty\r\n ? slices.map((slice) => {\r\n return {\r\n productId: slice.sliceProduct?.id,\r\n addedToppings: slice.addedToppings?.map((topping) => topping.id) ?? [],\r\n removedToppings: slice.removedToppings?.map((topping) => topping.id) ?? [],\r\n };\r\n })\r\n : [\r\n {\r\n productId: productToCustomize?.id,\r\n addedToppings: slices[activeSlice].addedToppings?.map((topping) => topping.id) ?? [],\r\n removedToppings: slices[activeSlice].removedToppings?.map((topping) => topping.id) ?? [],\r\n },\r\n ],\r\n },\r\n );\r\n\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_TOPPINGS_PRICE,\r\n payload: toppingsPrice.data.toppingsCalculationResult,\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n },\r\n dispatch,\r\n errorCallback: async (err) => {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n console.error(err);\r\n },\r\n });\r\n };\r\n\r\nconst recalculateProductPrice =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { customizeProduct, localization } = getState();\r\n const { productToCustomize, activeOption, activeSlice, slices } = customizeProduct;\r\n const { currentStore, distributionType } = localization;\r\n\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, true));\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n const isReadyToPriceUpdate = !productToCustomize?.isXTasty || slices.every(s => s.sliceProductConfirmed);\r\n if (!isReadyToPriceUpdate){\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n return;\r\n }\r\n\r\n const calculatedPrice = await Axios.post('api/baskets/product-calculation', {\r\n storeId: currentStore.id,\r\n deliverOrder: distributionType === OrderDistributionType.Delivery,\r\n productId: productToCustomize?.id,\r\n optionId: activeOption?.sku.optionId,\r\n productSpecification: productToCustomize?.isXTasty\r\n ? slices.map((slice) => {\r\n return {\r\n productId: slice.sliceProduct?.id,\r\n addedToppings: [],\r\n removedToppings: [],\r\n };\r\n })\r\n : [\r\n {\r\n productId: productToCustomize?.id,\r\n addedToppings: slices[activeSlice].addedToppings?.map((topping) => topping.id) ?? [],\r\n removedToppings: slices[activeSlice].removedToppings?.map((topping) => topping.id) ?? [],\r\n },\r\n ],\r\n });\r\n\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_PRODUCT_PRICE,\r\n payload: calculatedPrice.data.price ?? 0,\r\n });\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n },\r\n dispatch,\r\n errorCallback: async (err) => {\r\n dispatch(ProductsActions.SetProductsLoader(CUSTOMIZE_PRODUCT_LOADER, false));\r\n console.error(err);\r\n },\r\n });\r\n };\r\n\r\nexport const setSauce =\r\n (sauce: Topping): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_SELECTED_SAUCE,\r\n payload: sauce,\r\n });\r\n dispatch(updatePrice());\r\n };\r\n\r\nexport const setCheese =\r\n (cheese: Topping): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.SET_SELECTED_CHEESE,\r\n payload: cheese,\r\n });\r\n dispatch(updatePrice());\r\n };\r\n\r\nexport const confirmSliceProduct =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CustomizeProductActionTypes.CONFIRM_SLICE_PRODUCT,\r\n });\r\n dispatch(updatePrice());\r\n dispatch(recalculateProductPrice());\r\n };\r\n\r\nexport type CustomizeProductActions =\r\n | ClearCustomizeState\r\n | ConfirmRecipeOnSlice\r\n | SetCustomizationPizza\r\n | CustomizeProductFromBasket\r\n | InitSlices\r\n | SetCustomizationProduct\r\n | SetCurrentStep\r\n | SetAddFunction\r\n | SetActiveOption\r\n | SetAddedToppings\r\n | SetRemovedToppings\r\n | SetSelectedCheese\r\n | SetSelectedSauce\r\n | SetActiveSlice\r\n | SetAvailableRecipes\r\n | SetRecipeOnSlice\r\n | SetToppingsPrice\r\n | SetProductPrice;\r\n","import { FormControl } from 'shared/components/form-input.component';\r\nimport { PaymentMethod, OneClickPayment } from '../../types/checkout.types';\r\nimport { CheckoutActionTypes, CheckoutActions } from './checkout.actions';\r\n\r\nexport interface CheckoutForm {\r\n isFormDirty: boolean;\r\n remark: FormControl;\r\n addressAddition: FormControl;\r\n addressRemark: FormControl;\r\n firstName: FormControl;\r\n lastName: FormControl;\r\n phoneNumber: FormControl;\r\n email: FormControl;\r\n selectedPaymentMethod?: PaymentMethod;\r\n selectedQuickPaymentMethod?: OneClickPayment;\r\n savePaymentMethod: boolean;\r\n commercialCommunication: boolean;\r\n acceptPolicy: boolean;\r\n acceptGeneralConditions: boolean;\r\n satisfactionSurvey: boolean;\r\n usePaysWithCashAmount: boolean;\r\n paysWithCashAmount: FormControl;\r\n isCompanyModuleEnabled: boolean;\r\n invoice: boolean;\r\n invoiceCIF: FormControl;\r\n invoiceBusinessName: FormControl;\r\n invoiceAddress: FormControl;\r\n}\r\n\r\nexport interface OrderValidation {\r\n typeOfError: OrderError;\r\n values: string[];\r\n}\r\nexport enum OrderError {\r\n MinimumValueNotReached = 'MinimumValueNotReached',\r\n MaximumValueReached = 'MaximumValueReached',\r\n NoOfferApplied = 'NoOfferApplied', // This is special one - that just a warning\r\n CMSTranslatedError = 'CMSTranslatedError',\r\n GenericError = 'GenericError',\r\n ItemUnavailableInExternalSystem = 'ItemUnavailableInExternalSystem',\r\n}\r\nexport interface CheckoutState {\r\n availablePaymentMethods: PaymentMethod[];\r\n oneClickPaymentMethods: OneClickPayment[];\r\n checkoutForm: CheckoutForm;\r\n validation?: OrderValidation[];\r\n confirmedWarning?: OrderError;\r\n ctaDisabled: boolean;\r\n}\r\n\r\nconst initialState: CheckoutState = {\r\n availablePaymentMethods: [],\r\n oneClickPaymentMethods: [],\r\n ctaDisabled: false,\r\n checkoutForm: {\r\n isFormDirty: false,\r\n remark: {\r\n value: '',\r\n touched: false,\r\n },\r\n addressAddition: {\r\n value: '',\r\n touched: false,\r\n },\r\n addressRemark: {\r\n value: '',\r\n touched: false,\r\n },\r\n firstName: {\r\n value: '',\r\n touched: false,\r\n },\r\n lastName: {\r\n value: '',\r\n touched: false,\r\n },\r\n phoneNumber: {\r\n value: '',\r\n touched: false,\r\n },\r\n email: {\r\n value: '',\r\n touched: false,\r\n },\r\n savePaymentMethod: false,\r\n commercialCommunication: false,\r\n acceptPolicy: false,\r\n acceptGeneralConditions: false,\r\n satisfactionSurvey: false,\r\n usePaysWithCashAmount: false,\r\n paysWithCashAmount: {\r\n value: '',\r\n touched: false,\r\n },\r\n isCompanyModuleEnabled: false,\r\n invoice: false,\r\n invoiceAddress: {\r\n value: '',\r\n touched: false,\r\n },\r\n invoiceCIF: {\r\n value: '',\r\n touched: false,\r\n },\r\n invoiceBusinessName: {\r\n value: '',\r\n touched: false,\r\n },\r\n },\r\n};\r\n\r\nconst checkoutReducer = (state = initialState, action: CheckoutActions): CheckoutState => {\r\n switch (action.type) {\r\n case CheckoutActionTypes.CLEAR_CHECKOUT_STATE: {\r\n return {\r\n ...initialState,\r\n };\r\n }\r\n case CheckoutActionTypes.SET_CTA_DISABLED: {\r\n return {\r\n ...state,\r\n ctaDisabled: action.payload,\r\n };\r\n }\r\n case CheckoutActionTypes.SET_ORDER_VALIDATED: {\r\n return {\r\n ...state,\r\n validation: action.payload,\r\n };\r\n }\r\n case CheckoutActionTypes.CLEAR_ORDER_VALIDATED: {\r\n return {\r\n ...state,\r\n validation: undefined,\r\n };\r\n }\r\n case CheckoutActionTypes.SET_CHECKOUT_PREFERENCES: {\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n ...action.payload,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.SET_AVAILABLE_PAYMENT_METHODS: {\r\n return {\r\n ...state,\r\n availablePaymentMethods: action.payload,\r\n };\r\n }\r\n case CheckoutActionTypes.SET_QUICK_PAYMENT_METHODS: {\r\n return {\r\n ...state,\r\n oneClickPaymentMethods: action.payload,\r\n };\r\n }\r\n case CheckoutActionTypes.SET_ACTIVE_PAYMENT_METHOD: {\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n savePaymentMethod: false,\r\n selectedPaymentMethod: action.payload,\r\n selectedQuickPaymentMethod: undefined,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.SET_QUICK_PAYMENT_METHOD: {\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n savePaymentMethod: false,\r\n selectedQuickPaymentMethod: action.payload,\r\n selectedPaymentMethod: undefined,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.ON_PROPERTY_CHANGED: {\r\n const { name, value } = action.payload;\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n [name]: {\r\n value,\r\n touched: true,\r\n },\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.ON_CHECKBOX_CHANGED: {\r\n const { name, value } = action.payload;\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n [name]: value,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.SET_FORM_DIRTY: {\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...state.checkoutForm,\r\n isFormDirty: action.payload,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.SET_ORDER_FORMS: {\r\n return {\r\n ...state,\r\n checkoutForm: {\r\n ...action.payload,\r\n },\r\n };\r\n }\r\n case CheckoutActionTypes.SET_CONFIRMED_WARNING: {\r\n return {\r\n ...state,\r\n confirmedWarning: action.payload,\r\n };\r\n }\r\n\r\n default: {\r\n return { ...state };\r\n }\r\n }\r\n};\r\n\r\nexport default checkoutReducer;\r\n","import { AxiosResponse } from 'axios';\r\nimport Axios from 'shared/api/axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { CheckoutStaticContent } from 'apps/ProductsApp/store/static-content/checkout-static-content-reducer';\r\nimport { ApplicationState } from '../index';\r\n\r\nexport enum CheckoutStaticContentActionTypes {\r\n SET_STATIC_CONTENT = '[Checkout.StaticContent] SET_STATIC_CONTENT',\r\n}\r\n\r\ninterface SetStaticContent {\r\n type: CheckoutStaticContentActionTypes.SET_STATIC_CONTENT;\r\n payload: CheckoutStaticContent;\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/static-content/checkout');\r\n dispatch({\r\n type: CheckoutStaticContentActionTypes.SET_STATIC_CONTENT,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport type StaticContentActions = SetStaticContent;\r\n","import { AxiosError, AxiosResponse } from 'axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport { refreshSelectedAddressAndSave } from 'apps/LocalizationApp/Store/actions';\r\nimport { OrderDistributionType, PlaceOrderError, PropertyChangedPayload } from 'shared/types';\r\nimport Axios from 'shared/api/axios';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { OrderDetailsResponse } from 'apps/ProductsApp/types/dto.types';\r\nimport { CheckoutForm, OrderError, OrderValidation } from 'apps/ProductsApp/store/checkout/checkout.reducer';\r\nimport { initialState } from 'apps/ProductsApp/store/static-content/checkout-static-content-reducer';\r\nimport { redirectToExternalURL, redirectToOtherAppURL } from 'shared/helpers/routing-helpers';\r\nimport { OrderDto, PaymentMethod, CheckoutPreferences, PlacedOrderSuccessDto, OneClickPayment } from '../../types/checkout.types';\r\nimport { ApplicationState } from '../index';\r\nimport { BasketActions, ProductsActions } from '../actions';\r\n\r\nexport enum CheckoutActionTypes {\r\n SET_CHECKOUT_REMARK = '[CHECKOUT] SET_CHECKOUT_REMARK',\r\n ON_PROPERTY_CHANGED = '[CHECKOUT] ON_PROPERTY_CHANGED',\r\n ON_CHECKBOX_CHANGED = '[CHECKOUT] ON_CHECKBOX_CHANGED',\r\n SET_FORM_DIRTY = '[CHECKOUT] SET_FORM_DIRTY',\r\n SET_AVAILABLE_PAYMENT_METHODS = '[CHECKOUT] SET_AVAILABLE_PAYMENT_METHODS',\r\n SET_CHECKOUT_PREFERENCES = '[CHECKOUT] SET_CHECKOUT_PREFERENCES',\r\n SET_QUICK_PAYMENT_METHODS = '[CHECKOUT] SET_QUICK_PAYMENT_METHODS',\r\n SET_ACTIVE_PAYMENT_METHOD = '[CHECKOUT] SET_ACTIVE_PAYMENT_METHOD',\r\n SET_QUICK_PAYMENT_METHOD = '[CHECKOUT] SET_QUICK_PAYMENT_METHOD',\r\n SET_ORDER_VALIDATED = '[CHECKOUT] SET_ORDER_VALIDATED',\r\n CLEAR_ORDER_VALIDATED = '[CHECKOUT] CLEAR_ORDER_VALIDATED',\r\n CLEAR_CHECKOUT_STATE = '[CHECKOUT] CLEAR_CHECKOUT_STATE',\r\n SET_ORDER_FORMS = '[CHECKOUT] SET_ORDER_FORMS',\r\n SET_CONFIRMED_WARNING = '[CHECKOUT] SET_CONFIRMED_WARNING',\r\n SET_CTA_DISABLED = '[CHECKOUT] SET_CTA_DISABLED',\r\n}\r\n\r\nconst CHECKOUT_LOADER = 'checkoutLoader';\r\n\r\ninterface OnPropertyChanged extends Action {\r\n type: CheckoutActionTypes.ON_PROPERTY_CHANGED;\r\n payload: PropertyChangedPayload;\r\n}\r\ninterface OnCheckboxChanged extends Action {\r\n type: CheckoutActionTypes.ON_CHECKBOX_CHANGED;\r\n payload: { name: string; value: boolean };\r\n}\r\ninterface SetFormDirty extends Action {\r\n type: CheckoutActionTypes.SET_FORM_DIRTY;\r\n payload: boolean;\r\n}\r\ninterface SetAvailablePaymentMethods extends Action {\r\n type: CheckoutActionTypes.SET_AVAILABLE_PAYMENT_METHODS;\r\n payload: PaymentMethod[];\r\n}\r\ninterface SetCheckoutPreferences extends Action {\r\n type: CheckoutActionTypes.SET_CHECKOUT_PREFERENCES;\r\n payload: CheckoutPreferences[];\r\n}\r\ninterface SetQuickPaymentMethods extends Action {\r\n type: CheckoutActionTypes.SET_QUICK_PAYMENT_METHODS;\r\n payload: OneClickPayment[];\r\n}\r\ninterface SetActivePaymentMethod extends Action {\r\n type: CheckoutActionTypes.SET_ACTIVE_PAYMENT_METHOD;\r\n payload: PaymentMethod;\r\n}\r\ninterface SetQuickPaymentMethod extends Action {\r\n type: CheckoutActionTypes.SET_QUICK_PAYMENT_METHOD;\r\n payload: OneClickPayment;\r\n}\r\n\r\ninterface SetOrderValidated extends Action {\r\n type: CheckoutActionTypes.SET_ORDER_VALIDATED;\r\n payload: OrderValidation[];\r\n}\r\ninterface ClearOrderValidated extends Action {\r\n type: CheckoutActionTypes.CLEAR_ORDER_VALIDATED;\r\n}\r\ninterface ClearCheckoutState extends Action {\r\n type: CheckoutActionTypes.CLEAR_CHECKOUT_STATE;\r\n}\r\ninterface SetOrderForms extends Action {\r\n type: CheckoutActionTypes.SET_ORDER_FORMS;\r\n payload: CheckoutForm;\r\n}\r\ninterface SetConfirmedWarning extends Action {\r\n type: CheckoutActionTypes.SET_CONFIRMED_WARNING;\r\n payload?: OrderError;\r\n}\r\ninterface SetCtaDisabled extends Action {\r\n type: CheckoutActionTypes.SET_CTA_DISABLED;\r\n payload: boolean;\r\n}\r\n\r\nexport const getApplicableOffers =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { basket } = getState().basket;\r\n const { items, coupons } = basket;\r\n\r\n dispatch(BasketActions.recalculateBasket({ items, coupons, includeSuggestions: true }));\r\n };\r\n\r\nexport const getAvailablePaymentMethods =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const { currentStore, distributionType } = state.localization;\r\n const { currentUser } = state.global;\r\n // TO DO - > FETCH PLATFORM CODE FROM API\r\n const platformCode = distributionType === OrderDistributionType.Delivery ? 'OPM' : 'OAF';\r\n const paymentMethods: AxiosResponse = await Axios.get('api/orders/payment-methods', {\r\n params: {\r\n paymentPlatformCode: platformCode,\r\n storeId: currentStore.id,\r\n },\r\n });\r\n paymentMethods.data.orderByAsc('sort');\r\n dispatch({\r\n type: CheckoutActionTypes.SET_AVAILABLE_PAYMENT_METHODS,\r\n payload: paymentMethods.data,\r\n });\r\n\r\n if (currentUser) {\r\n const quickPaymentMethods: AxiosResponse = await Axios.get('api/orders/payment-methods-quick', {\r\n params: {\r\n paymentPlatformCode: platformCode,\r\n storeId: currentStore.id,\r\n },\r\n });\r\n dispatch({\r\n type: CheckoutActionTypes.SET_QUICK_PAYMENT_METHODS,\r\n payload: quickPaymentMethods.data,\r\n });\r\n }\r\n };\r\n\r\nexport const getCheckoutPreferences =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n const checkoutPreferences: AxiosResponse = await Axios.get('api/orders/checkout-preferences');\r\n dispatch({\r\n type: CheckoutActionTypes.SET_CHECKOUT_PREFERENCES,\r\n payload: checkoutPreferences.data,\r\n });\r\n };\r\n\r\nexport const updateCheckoutFormControl =\r\n (updateControl: React.ChangeEvent): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CheckoutActionTypes.ON_PROPERTY_CHANGED,\r\n payload: {\r\n name: updateControl.target.name,\r\n value: updateControl.target.value,\r\n },\r\n });\r\n };\r\nexport const updateCheckoutFormControlByName =\r\n (name: string, value: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CheckoutActionTypes.ON_PROPERTY_CHANGED,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n };\r\n\r\nexport const updateCheckoutCheckbox =\r\n (value: boolean, name: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: CheckoutActionTypes.ON_CHECKBOX_CHANGED,\r\n payload: { value, name },\r\n });\r\n };\r\n\r\nexport const validateAndPlaceOrder =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n const orderDto = buildOrderDto(state);\r\n if (!orderDto) return;\r\n gtm.checkoutModule.orderSubmit(state.basket.basketTraceId);\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n const validationResult: AxiosResponse = await Axios.post(`api/orders/validate`, orderDto);\r\n const errors = validationResult.data.length > 0;\r\n if (errors && validationResult.data[0].typeOfError !== state.checkout.confirmedWarning) {\r\n dispatch(ProductsActions.SetProductsLoader(CHECKOUT_LOADER, false));\r\n dispatch(setCtaButtonDisabled(false));\r\n dispatch({\r\n type: CheckoutActionTypes.SET_ORDER_VALIDATED,\r\n payload: validationResult.data,\r\n });\r\n\r\n return;\r\n }\r\n dispatch(placeOrder());\r\n },\r\n dispatch,\r\n allowedErr: {\r\n errorCodes: ['ProductOutOfStock'],\r\n action: (): void => {\r\n dispatch(ProductsActions.SetProductsLoader(CHECKOUT_LOADER, false));\r\n dispatch(setCtaButtonDisabled(false));\r\n dispatch({ type: BasketActions.BasketActionTypes.SET_PRODUCT_NOT_AVAILABLE_MODAL, payload: true });\r\n },\r\n },\r\n });\r\n };\r\n\r\nconst placeOrder =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const state = getState();\r\n\r\n const orderDto = buildOrderDto(state);\r\n if (!orderDto) return;\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n Axios.post(`api/orders`, orderDto)\r\n .then((orderPlacementResult: AxiosResponse) => {\r\n if (orderPlacementResult.data.succeeded) {\r\n dispatch(\r\n refreshSelectedAddressAndSave(\r\n state.checkout.checkoutForm.addressAddition.value,\r\n state.checkout.checkoutForm.addressRemark.value,\r\n ),\r\n );\r\n const orderPlacementSuccess = orderPlacementResult.data as PlacedOrderSuccessDto;\r\n if (orderPlacementSuccess.paymentMustBeStarted) {\r\n const mobile = window.S4DWebBridge();\r\n if (mobile) {\r\n mobile.openExternalUrl(orderPlacementSuccess.startPaymentUrl);\r\n } else {\r\n redirectToExternalURL(orderPlacementSuccess.startPaymentUrl);\r\n }\r\n } else {\r\n redirectToOtherAppURL(`thank-you?id=${orderPlacementResult.data.publicOrderId}`);\r\n }\r\n if (window.S4DWebBridge()) dispatch(ProductsActions.SetProductsLoader(CHECKOUT_LOADER, false));\r\n gtm.checkoutModule.increasePurchases();\r\n }\r\n })\r\n .catch((apiError: AxiosError) => {\r\n const orderPlacementError = apiError.response?.data as PlaceOrderError;\r\n\r\n let errorType = OrderError.GenericError;\r\n let values: string[] = [];\r\n if (orderPlacementError.contentMessageForErrorFound){\r\n errorType = OrderError.CMSTranslatedError\r\n values = [orderPlacementError.errorTranslations?.title, orderPlacementError.errorTranslations?.description]\r\n }\r\n if (orderPlacementError.entitiesErrors?.length > 0){\r\n errorType = OrderError.ItemUnavailableInExternalSystem\r\n values = orderPlacementError.entitiesErrors.map(ee => ee.entityIdentifier)\r\n }\r\n\r\n const { errorHeader } = state.checkoutStaticContent.checkoutValidation;\r\n if (orderPlacementError.errorCode === '40') {\r\n errorType = OrderError.CMSTranslatedError;\r\n values = [\r\n errorHeader,\r\n state.checkoutStaticContent.checkoutValidation.updatingCustomerDataError ||\r\n initialState.checkoutValidation.updatingCustomerDataError,\r\n ];\r\n }\r\n if (orderPlacementError.errorCode === '70') {\r\n errorType = OrderError.CMSTranslatedError;\r\n values = [\r\n errorHeader,\r\n state.checkoutStaticContent.checkoutValidation.missingMenuItemsError ||\r\n initialState.checkoutValidation.missingMenuItemsError,\r\n ];\r\n }\r\n if (orderPlacementError.errorCode === '120') {\r\n errorType = OrderError.CMSTranslatedError;\r\n values = [\r\n errorHeader,\r\n state.checkoutStaticContent.checkoutValidation.sendingToStoreError ||\r\n initialState.checkoutValidation.sendingToStoreError,\r\n ];\r\n }\r\n if (orderPlacementError.errorCode === '140') {\r\n errorType = OrderError.CMSTranslatedError;\r\n values = [\r\n errorHeader,\r\n state.checkoutStaticContent.checkoutValidation.invalidStoreIdError ||\r\n initialState.checkoutValidation.invalidStoreIdError,\r\n ];\r\n }\r\n\r\n const validationResult: OrderValidation = {\r\n typeOfError: errorType,\r\n values: values,\r\n };\r\n dispatch({\r\n type: CheckoutActionTypes.SET_ORDER_VALIDATED,\r\n payload: [validationResult],\r\n });\r\n dispatch(setCtaButtonDisabled(false));\r\n dispatch(ProductsActions.SetProductsLoader(CHECKOUT_LOADER, false));\r\n gtm.checkoutModule.orderError(state.basket.basketTraceId);\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getOrderDetails =\r\n (publicOrderId: string): ThunkAction =>\r\n async (dispatch): Promise => {\r\n await ResponseWrapper({\r\n action: async () => {\r\n const orderData: AxiosResponse = await Axios.get(`api/orders/${publicOrderId}/checkout-details`);\r\n\r\n dispatch({ type: CheckoutActionTypes.SET_ORDER_FORMS, payload: mapToCheckoutForm(orderData.data) });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const setCtaButtonDisabled =\r\n (disabled: boolean): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({ type: CheckoutActionTypes.SET_CTA_DISABLED, payload: disabled });\r\n };\r\n\r\nfunction buildOrderDto(state: ApplicationState): OrderDto | undefined {\r\n const { localization, basket: BasketState, checkout, global } = state;\r\n const { selectedAddress, selectedOrderTime, currentStore } = localization;\r\n const { checkoutForm } = checkout;\r\n const { basket } = BasketState;\r\n\r\n const deviceTokensJson = localStorage.getItem('deviceTokens');\r\n const deviceTokensParsed = deviceTokensJson && JSON.parse(deviceTokensJson);\r\n\r\n if (selectedAddress && selectedOrderTime && currentStore && basket.items.length > 0) {\r\n return {\r\n basket: {\r\n ...basket,\r\n deliveryAddress: {\r\n ...basket.deliveryAddress,\r\n latitude: selectedAddress.latitude,\r\n longitude: selectedAddress.longitude,\r\n zipCode: selectedAddress.postalCode,\r\n additionalInfo: selectedAddress.additionalInfo\r\n },\r\n orderDateTime: selectedOrderTime.isAsap ? null : selectedOrderTime.dateTimeFrame,\r\n paymentMethod: checkoutForm.selectedQuickPaymentMethod?.id ?? checkoutForm.selectedPaymentMethod?.id,\r\n },\r\n store: {\r\n id: currentStore.id,\r\n },\r\n firstName: checkoutForm.firstName?.value || global.currentUser?.firstName,\r\n lastName: checkoutForm.lastName?.value || global.currentUser?.lastName,\r\n addressAddition: checkoutForm.addressAddition.value,\r\n addressRemark: checkoutForm.addressRemark.value,\r\n phoneNumber: checkoutForm.phoneNumber.value,\r\n emailAddress: checkoutForm.email.value,\r\n isAsap: selectedOrderTime.isAsap ?? false,\r\n orderDate: selectedOrderTime.isAsap ? null : selectedOrderTime.dateTimeFrame,\r\n orderRemark: checkoutForm.remark.value,\r\n skipSatisfactionSurvey: checkoutForm.satisfactionSurvey,\r\n commercialCommunication: checkoutForm.commercialCommunication,\r\n acceptPrivacyPolicy: checkoutForm.acceptPolicy,\r\n acceptGeneralConditions: checkoutForm.acceptGeneralConditions,\r\n paysWithCashAmount: checkoutForm.usePaysWithCashAmount ? checkoutForm.paysWithCashAmount.value : null,\r\n savePaymentMethod: checkoutForm.savePaymentMethod,\r\n payment: {\r\n paymentId: '', // TDB when payment id passed from rest - REMOVE FROM BASKET?\r\n oneClickPaymentId: checkoutForm.selectedQuickPaymentMethod?.oneClickPaymentId,\r\n },\r\n company: {\r\n isCompanyCustomer: checkoutForm.invoice,\r\n vatId: checkoutForm.invoiceCIF.value,\r\n companyName: checkoutForm.invoiceBusinessName.value,\r\n companyAddress: checkoutForm.invoiceAddress.value,\r\n },\r\n deviceId: deviceTokensParsed?.deviceId,\r\n installationId: deviceTokensParsed?.installationId,\r\n provider: deviceTokensParsed?.provider,\r\n } as OrderDto;\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction mapToCheckoutForm(data: OrderDetailsResponse): CheckoutForm {\r\n // TODO add selectedPaymentMethod along with refactor this control on checkout page\r\n return {\r\n isFormDirty: false,\r\n remark: { value: data.orderRemark, touched: !!data.orderRemark },\r\n addressAddition: { value: data.addressAddition, touched: !!data.addressAddition },\r\n addressRemark: { value: data.addressRemark, touched: !!data.addressRemark },\r\n firstName: { value: data.firstName, touched: !!data.firstName },\r\n lastName: { value: data.lastName, touched: !!data.lastName },\r\n phoneNumber: { value: data.phoneNumber, touched: !!data.phoneNumber },\r\n email: { value: data.emailAddress, touched: !!data.emailAddress },\r\n // selectedPaymentMethod?: {value: data.},\r\n savePaymentMethod: false,\r\n commercialCommunication: false,\r\n acceptPolicy: true,\r\n acceptGeneralConditions: true,\r\n satisfactionSurvey: false,\r\n usePaysWithCashAmount: false,\r\n paysWithCashAmount: { value: '', touched: false },\r\n isCompanyModuleEnabled: false,\r\n invoice: data.receiptCompanyData?.isCompanyCustomer,\r\n invoiceCIF: { value: data.receiptCompanyData?.vatId, touched: !!data.receiptCompanyData?.vatId },\r\n invoiceBusinessName: { value: data.receiptCompanyData?.companyName, touched: !!data.receiptCompanyData?.companyName },\r\n invoiceAddress: { value: data.receiptCompanyData?.companyAddress, touched: !!data.receiptCompanyData?.companyAddress },\r\n };\r\n}\r\n\r\nexport type CheckoutActions =\r\n | SetCtaDisabled\r\n | SetOrderValidated\r\n | ClearOrderValidated\r\n | OnPropertyChanged\r\n | OnCheckboxChanged\r\n | SetFormDirty\r\n | SetAvailablePaymentMethods\r\n | SetCheckoutPreferences\r\n | SetQuickPaymentMethods\r\n | SetQuickPaymentMethod\r\n | SetActivePaymentMethod\r\n | ClearCheckoutState\r\n | SetOrderForms\r\n | SetConfirmedWarning;\r\n","import { Action } from 'redux';\r\n\r\nexport enum MetadataActionTypes {\r\n SET_TITLE = '[PRODUCTS_APP] SET_TITLE',\r\n}\r\n\r\ninterface SetProductHeader extends Action {\r\n type: MetadataActionTypes.SET_TITLE;\r\n payload: string;\r\n}\r\n\r\nexport type MetadataActions = SetProductHeader;\r\n","import { Action } from 'redux';\r\nimport { ThunkAction, ThunkDispatch } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { AxiosResponse } from 'axios';\r\nimport Axios from 'shared/api/axios';\r\nimport { redirectToNotFound } from 'shared/helpers/routing-helpers';\r\nimport { OrderDistributionType } from 'shared/types';\r\nimport { ApplicationState } from '..';\r\nimport { Category, CategoryDto, Topping, AppConfiguration, ProductSEO } from '../../types/dto.types';\r\nimport { ProductsActions } from '../actions';\r\nimport { MetadataActionTypes } from '../metadata/metadata.actions';\r\n\r\nexport enum ProductActionTypes {\r\n SET_CATEGORIES = '[PRODUCTS_APP] SET_CATEGORIES',\r\n SET_CONFIGURATION = '[PRODUCTS_APP] SET_CONFIGURATION',\r\n SET_ACTIVE_CATEGORY = '[PRODUCTS_APP] SET_ACTIVE_CATEGORY',\r\n SET_PRODUCTS = '[PRODUCTS_APP] SET_PRODUCTS',\r\n SET_TOPPINGS = '[PRODUCTS_APP] SET_TOPPINGS',\r\n SET_LOADER = '[PRODUCTS_APP] SET_LOADER',\r\n SET_CUSTOMIZATION_PRODUCT = '[PRODUCTS_APP] SET_CUSTOMIZATION_PRODUCT',\r\n SET_UPSELL_PRODUCTS = '[PRODUCTS_APP] SET_UPSELL_PRODUCTS',\r\n SET_PRODUCT_HEADER = '[PRODUCTS_APP] SET_PRODUCT_HEADER',\r\n}\r\n\r\ninterface SetProductHeader extends Action {\r\n type: ProductActionTypes.SET_PRODUCT_HEADER;\r\n payload: string;\r\n}\r\n\r\ninterface SetCategories extends Action {\r\n type: ProductActionTypes.SET_CATEGORIES;\r\n payload: Category[];\r\n}\r\ninterface SetConfiguration extends Action {\r\n type: ProductActionTypes.SET_CONFIGURATION;\r\n payload: AppConfiguration;\r\n}\r\ninterface SetActiveCategory extends Action {\r\n type: ProductActionTypes.SET_ACTIVE_CATEGORY;\r\n payload: string;\r\n}\r\ninterface SetProducts extends Action {\r\n type: ProductActionTypes.SET_PRODUCTS;\r\n payload: CategoryDto[];\r\n}\r\ninterface SetToppings extends Action {\r\n type: ProductActionTypes.SET_TOPPINGS;\r\n payload: Topping[];\r\n}\r\ninterface SetLoader extends Action {\r\n type: ProductActionTypes.SET_LOADER;\r\n payload: {\r\n name: string;\r\n on: boolean;\r\n };\r\n}\r\n\r\nexport const getProducts =\r\n (category: string | null = null): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const LOADER_NAME = 'getProducts';\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: true,\r\n },\r\n });\r\n const localizationState = getState().localization;\r\n const state = getState();\r\n\r\n let {\r\n products: { categories },\r\n } = state;\r\n\r\n if (categories.length === 0) {\r\n let categoriesIncludingProducts: CategoryDto[] = [];\r\n const fetchCategoriesIncludingProducts = await ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/products/categories', {\r\n params: {\r\n storeId: localizationState.currentStore.id,\r\n isDelivery: localizationState.distributionType === OrderDistributionType.Delivery,\r\n deliveryDateTime: localizationState.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n categoriesIncludingProducts = value.data;\r\n return true;\r\n },\r\n dispatch,\r\n errorCallback: async () => false,\r\n });\r\n\r\n if (!fetchCategoriesIncludingProducts) {\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: false,\r\n },\r\n });\r\n return;\r\n }\r\n\r\n const categoriesWithAnyProduct: CategoryDto[] = categoriesIncludingProducts.filter((c) => c.products.some((p) => !!p));\r\n\r\n const fetchCategoriesSuccess = await ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/products/categories?includeProducts=false', {\r\n params: {\r\n storeId: localizationState.currentStore.id,\r\n deliveryDateTime: localizationState.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n categories = value.data.filter((c) => categoriesWithAnyProduct.map((cp) => cp.id).includes(c.id));\r\n return true;\r\n },\r\n dispatch,\r\n errorCallback: async () => false,\r\n });\r\n\r\n if (!fetchCategoriesSuccess) {\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: false,\r\n },\r\n });\r\n return;\r\n }\r\n\r\n dispatch({\r\n type: ProductActionTypes.SET_CATEGORIES,\r\n payload: categories,\r\n });\r\n\r\n if (category) {\r\n setActiveCategory(categories, category, dispatch);\r\n }\r\n\r\n dispatch({\r\n type: ProductActionTypes.SET_PRODUCTS,\r\n payload: categoriesWithAnyProduct,\r\n });\r\n } else if (category) {\r\n setActiveCategory(categories, category, dispatch);\r\n }\r\n\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: false,\r\n },\r\n });\r\n };\r\n\r\nconst setActiveCategory = (\r\n categories: Category[],\r\n categoryRoute: string,\r\n dispatch: ThunkDispatch,\r\n) => {\r\n const selectedCategory = categories.find((w) => w.route.toLowerCase() === categoryRoute.toLowerCase());\r\n\r\n if (selectedCategory === undefined) {\r\n redirectToNotFound(); // redirect to not found page\r\n return;\r\n }\r\n\r\n dispatch({\r\n type: ProductActionTypes.SET_ACTIVE_CATEGORY,\r\n payload: selectedCategory.id,\r\n });\r\n};\r\n\r\nexport const refreshProducts = (): ThunkAction => async (dispatch, getState) => {\r\n const localizationState = getState().localization;\r\n const state = getState();\r\n const LOADER_NAME = 'refreshProducts';\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: true,\r\n },\r\n });\r\n const {\r\n products: { activeCategory },\r\n } = state;\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/products/categories', {\r\n params: {\r\n categoryCode: activeCategory,\r\n storeId: localizationState.currentStore.id,\r\n isDelivery: localizationState.distributionType === OrderDistributionType.Delivery,\r\n deliveryDateTime: localizationState.selectedOrderTime?.dateTimeFrame,\r\n },\r\n });\r\n dispatch({\r\n type: ProductActionTypes.SET_PRODUCTS,\r\n payload: value.data,\r\n });\r\n\r\n dispatch({\r\n type: ProductActionTypes.SET_ACTIVE_CATEGORY,\r\n payload: activeCategory,\r\n });\r\n },\r\n dispatch,\r\n });\r\n dispatch({\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name: LOADER_NAME,\r\n on: false,\r\n },\r\n });\r\n};\r\n\r\nexport const getToppings =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/products/toppings');\r\n dispatch({\r\n type: ProductActionTypes.SET_TOPPINGS,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const getAppConfiguration =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/configuration');\r\n dispatch({\r\n type: ProductActionTypes.SET_CONFIGURATION,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const initProductsStoreData =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch(getAppConfiguration());\r\n dispatch(getToppings());\r\n };\r\n\r\nexport const getSeoText =\r\n (category: string, seoContainer: HTMLElement): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get(`api/products/${category}/seo`);\r\n const seo = value.data;\r\n seoContainer.innerHTML = seo.html;\r\n dispatch({\r\n type: ProductActionTypes.SET_PRODUCT_HEADER,\r\n payload: seo.header,\r\n });\r\n dispatch({\r\n type: MetadataActionTypes.SET_TITLE,\r\n payload: seo.title,\r\n });\r\n },\r\n dispatch,\r\n errorCallback: async () => {\r\n seoContainer.innerHTML = '';\r\n },\r\n });\r\n };\r\n\r\nexport const SetProductsLoader = (name: string, on: boolean) => {\r\n return {\r\n type: ProductsActions.ProductActionTypes.SET_LOADER,\r\n payload: {\r\n name,\r\n on,\r\n },\r\n };\r\n};\r\n\r\nexport type ProductActions =\r\n | SetCategories\r\n | SetActiveCategory\r\n | SetConfiguration\r\n | SetProducts\r\n | SetToppings\r\n | SetLoader\r\n | SetProductHeader;\r\n","import React, { useEffect } from 'react';\r\nimport { useSelector, useDispatch } from 'react-redux';\r\nimport { useHistory } from 'react-router';\r\n\r\n// components\r\nimport SearchWindowContainer from 'apps/LocalizationApp/Containers/search-window.container';\r\nimport ChangeStoreContainer from 'apps/LocalizationApp/Components/change-store.component';\r\nimport { clearStoreAndSave } from 'apps/LocalizationApp/Store/actions';\r\nimport { getStaticContent } from 'apps/LocalizationApp/Store/static-content/localization-static-content.actions';\r\nimport LocalizationModal from 'shared/components/modal.compontent';\r\n\r\n// store\r\nimport { getProducts } from 'apps/ProductsApp/store/products/products.actions';\r\nimport { getOffers } from 'apps/ProductsApp/store/offers/offers.actions';\r\nimport { LocalizationState } from 'apps/LocalizationApp/Store';\r\nimport { AddressWizzardActions } from '../store/actions';\r\nimport { ApplicationState, AddressWizzardState } from '../store';\r\n// types\r\nimport { AddressWizzardSteps } from '../navigation.types';\r\n\r\nconst AddressWizzard: React.FC = () => {\r\n // redux state\r\n const dispatch = useDispatch();\r\n const addressWizzard = useSelector((state) => state.addressWizzard);\r\n const { showModal } = useSelector((state) => state.localization);\r\n const history = useHistory();\r\n\r\n const localizationModalVisibility = addressWizzard.currentWizzardStep !== AddressWizzardSteps.None;\r\n const isLastStep = addressWizzard.currentWizzardStep === AddressWizzardSteps.LocalizationModal;\r\n\r\n // actions\r\n const cancelWizzardProcess = (): void => {\r\n dispatch(AddressWizzardActions.changeWizzardStep(AddressWizzardSteps.None));\r\n };\r\n\r\n const changeWizzardStep = (step: AddressWizzardSteps): void => {\r\n dispatch(AddressWizzardActions.changeWizzardStep(step));\r\n };\r\n\r\n useEffect(() => {\r\n dispatch(getStaticContent());\r\n }, []);\r\n\r\n // wizzard steps\r\n const renderWizzardContent = (): JSX.Element => {\r\n const currentPath = history && history.location.pathname.replace(/\\//g, '');\r\n switch (addressWizzard.currentWizzardStep) {\r\n case AddressWizzardSteps.ChangeAddressModal:\r\n return (\r\n {\r\n history.push('/offers');\r\n cancelWizzardProcess();\r\n }}\r\n onChangeStoreFn={(): void => {\r\n dispatch(clearStoreAndSave());\r\n if (currentPath === 'offers') {\r\n dispatch(getOffers());\r\n } else if (currentPath) {\r\n dispatch(getProducts(history.location.pathname.replace(/\\//g, '')));\r\n }\r\n changeWizzardStep(AddressWizzardSteps.LocalizationModal);\r\n }}\r\n />\r\n );\r\n case AddressWizzardSteps.LocalizationModal:\r\n return ;\r\n default:\r\n return <>;\r\n }\r\n };\r\n\r\n return (\r\n \r\n {renderWizzardContent()}\r\n \r\n );\r\n};\r\n\r\nexport default AddressWizzard;\r\n","import React, { useEffect } from 'react';\r\nimport LanguageSwitch from 'apps/NavigationApp/components/language-switch.component';\r\nimport { ApplicationState } from 'apps/NavigationApp/store';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\nimport { redirectToHomePage } from 'shared/helpers/routing-helpers';\r\nimport { GlobalState } from 'shared/store/global/global.reducer';\r\nimport { getLanguages } from 'shared/store/global/global.actions';\r\nimport AddressWizzard from 'apps/NavigationApp/containers/address-wizzard.container';\r\n\r\ninterface SimpleNavbarProps {\r\n usingLocalization?: boolean;\r\n}\r\nconst SimpleNavbar: React.FC = ({ usingLocalization = false }): JSX.Element => {\r\n const dispatch = useDispatch();\r\n const { supportedCultures } = useSelector((state) => state.global);\r\n\r\n useEffect(() => {\r\n dispatch(getLanguages());\r\n }, []);\r\n\r\n return (\r\n
\r\n \r\n {usingLocalization && }\r\n
\r\n );\r\n};\r\n\r\nexport default SimpleNavbar;\r\n","export const changeMobileBarsColor = (lowerBarColor: string | undefined, upperBarColor: string | undefined): void => {\r\n const mobile = window.S4DWebBridge();\r\n if (mobile) {\r\n if (lowerBarColor){\r\n mobile.setBackgroundColor(lowerBarColor, 2);\r\n }\r\n if (upperBarColor){\r\n mobile.setBackgroundColor(upperBarColor, 1);\r\n }\r\n }\r\n};","import Axios from 'shared/api/axios';\r\nimport { AxiosResponse } from 'axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { AccountStaticContent } from './account-static-content.reducer';\r\nimport { ApplicationState } from '../index';\r\n\r\nexport enum AccountStaticContentActions {\r\n SET_STATIC_CONTENT = '[Account.StaticContent] SET_STATIC_CONTENT',\r\n}\r\n\r\ninterface SetStaticContent {\r\n type: AccountStaticContentActions.SET_STATIC_CONTENT;\r\n payload: AccountStaticContent;\r\n}\r\n\r\nexport const getStaticContent =\r\n (): ThunkAction =>\r\n async (dispatch): Promise => {\r\n ResponseWrapper({\r\n action: async () => {\r\n const value: AxiosResponse = await Axios.get('api/static-content/account');\r\n dispatch({\r\n type: AccountStaticContentActions.SET_STATIC_CONTENT,\r\n payload: value.data,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport type StaticContentActions = SetStaticContent;\r\n","import { AppConfiguration, AppReviewTarget, SupportedCulture, UserMessage } from '../../types';\r\nimport { GlobalActions, GlobalActionTypes } from './global.actions';\r\n\r\nconst { SET_USER_STATUS, SET_MESSAGES, CLEAR_MESSAGES, SET_LOADER_STATE, SHOW_UNHANDLED_ERROR_MODAL, SET_SUPPORTED_CULTURES, SET_APP_CONFIGURATION } =\r\n GlobalActionTypes;\r\n\r\nexport interface UserInfo {\r\n email: string;\r\n phone: string;\r\n firstName?: string;\r\n lastName?: string;\r\n lastActiveOrder?: string;\r\n}\r\n\r\nexport interface GlobalState {\r\n messages: UserMessage[];\r\n host: string;\r\n signedin: boolean;\r\n currentUser?: UserInfo;\r\n loader: boolean;\r\n showErrorModal: boolean;\r\n supportedCultures: SupportedCulture[];\r\n appConfiguration: AppConfiguration;\r\n}\r\n\r\nconst initialState: GlobalState = {\r\n messages: [],\r\n host: (document.getElementById('baseUrl') as HTMLInputElement).value,\r\n signedin: false,\r\n loader: false,\r\n showErrorModal: false,\r\n supportedCultures: [],\r\n appConfiguration: {\r\n maxChangeableToppingsForEditPizza: 8,\r\n maxExtraToppingsForEditPizza: 8,\r\n maxToppingsForCustomPizza: 8,\r\n appReviewsEnabled: false,\r\n positiveReviewsTarget: AppReviewTarget.NATIVE_STORE,\r\n negativeReviewsTarget: AppReviewTarget.DB\r\n }\r\n};\r\n\r\nconst authCookies = document.cookie;\r\n\r\nif (authCookies) {\r\n const items = authCookies.split(';');\r\n\r\n for (let i = 0; i < items.length; i++) {\r\n const name = items[i].substring(0, items[i].indexOf('='));\r\n const value = items[i].substring(items[i].indexOf('=') + 1);\r\n\r\n if (name.toLowerCase().replace(/ /g, '') === 'pizza-hut-access-token') {\r\n const json = decodeURIComponent(value);\r\n const obj = JSON.parse(json);\r\n\r\n initialState.currentUser = {\r\n email: obj.Email,\r\n phone: obj.Phone,\r\n firstName: obj.FirstName,\r\n lastName: obj.LastName,\r\n lastActiveOrder: obj.LastActiveOrder,\r\n };\r\n initialState.signedin = true;\r\n }\r\n }\r\n}\r\n\r\nconst globalReducer = (state = initialState, action: GlobalActions): GlobalState => {\r\n switch (action.type) {\r\n case SET_MESSAGES: {\r\n return {\r\n ...state,\r\n messages: action.payload,\r\n };\r\n }\r\n case CLEAR_MESSAGES: {\r\n return {\r\n ...state,\r\n messages: initialState.messages,\r\n };\r\n }\r\n case SET_USER_STATUS: {\r\n const { signedin } = action.payload;\r\n return {\r\n ...state,\r\n signedin,\r\n };\r\n }\r\n case SET_LOADER_STATE: {\r\n const { value } = action.payload;\r\n return {\r\n ...state,\r\n loader: value,\r\n };\r\n }\r\n case SHOW_UNHANDLED_ERROR_MODAL: {\r\n return {\r\n ...state,\r\n showErrorModal: action.payload,\r\n };\r\n }\r\n case SET_SUPPORTED_CULTURES: {\r\n return {\r\n ...state,\r\n supportedCultures: action.payload,\r\n };\r\n }\r\n case SET_APP_CONFIGURATION: {\r\n return {\r\n ...state,\r\n appConfiguration: action.payload,\r\n };\r\n }\r\n default:\r\n return {\r\n ...state,\r\n };\r\n }\r\n};\r\n\r\nexport default globalReducer;\r\n","import { AccountStaticContentActions, StaticContentActions } from './account-static-content.actions';\r\n\r\nexport interface AccountModalStaticContent {\r\n header: string;\r\n subHeader: string;\r\n ctaText?: string;\r\n}\r\n\r\nexport interface ChangePasswordStaticContent {\r\n header: string;\r\n subHeader: string;\r\n cta: string;\r\n newPasswordLabel: string;\r\n newPasswordPlaceholder: string;\r\n newPasswordConfirmationLabel: string;\r\n newPasswordConfirmationPlaceholder: string;\r\n}\r\nexport interface AccountStaticContent {\r\n goBackText: string;\r\n logInTabText: string;\r\n registerTabText: string;\r\n logInHeader: string;\r\n logInSubHeader: string;\r\n rememberLogin: string;\r\n registerHeader: string;\r\n registerSubHeader: string;\r\n emailLabel: string;\r\n emailPlaceholder: string;\r\n emailRequiredError: string;\r\n emailInvalidError: string;\r\n emailExistsError: string;\r\n passwordLabel: string;\r\n passwordPlaceholder: string;\r\n passwordConfirmLabel: string;\r\n passwordConfirmPlaceholder: string;\r\n passwordRequiredError: string;\r\n passwordNotMatchError: string;\r\n passwordInvalidError: string;\r\n passwordIncorrectError: string;\r\n phoneNumberLabel: string;\r\n phoneNumberPlaceholder: string;\r\n phoneNumberRequiredError: string;\r\n phoneNumberInvalidError: string;\r\n acceptPrivacyPolicyText: string;\r\n acceptPrivacyPolicyLinkText: string;\r\n acceptPrivacyPolicyLink: string;\r\n acceptPrivacyPolicyRequiredError: string;\r\n acceptCommunication: string;\r\n logInCtaText: string;\r\n registerCtaText: string;\r\n remindPasswordCtaText: string;\r\n remindPasswordText: string;\r\n remindPasswordHeader: string;\r\n remindPasswordSubHeader: string;\r\n additionalEmailError: AccountModalStaticContent;\r\n additionalEmailMaximumError: AccountModalStaticContent;\r\n remindPasswordSendSuccess: AccountModalStaticContent;\r\n remindPasswordSendError: AccountModalStaticContent;\r\n newPasswordForm: ChangePasswordStaticContent;\r\n emailValidationModal: Required;\r\n firstLastNameVisible: boolean;\r\n firstNameLabel: string;\r\n firstNamePlaceholder: string;\r\n firstNameRequiredError: string;\r\n firstNameMaxLength: number | undefined;\r\n lastNameLabel: string;\r\n lastNamePlaceholder: string;\r\n lastNameRequiredError: string;\r\n lastNameMaxLength: number | undefined;\r\n}\r\n\r\nconst initialState: AccountStaticContent = {\r\n goBackText: '< Atrás',\r\n logInTabText: 'Iniciar sesión',\r\n registerTabText: 'Crear cuenta',\r\n logInHeader: 'Entra con tu email',\r\n logInSubHeader: 'Accede a tus pedidos favoritos, guarda tus direcciones y pide de forma fácil y rápida.',\r\n rememberLogin: 'Recordar contraseña siempre',\r\n registerHeader: '¿Nuevo por aquí?',\r\n registerSubHeader: 'Regístrate para guardar tu información y hacer tus pedidos de forma más fácil y rápida.',\r\n emailLabel: 'Email',\r\n emailPlaceholder: 'Introduce tu email',\r\n emailRequiredError: 'El email es necesario',\r\n emailInvalidError: 'Introduce un email válido',\r\n emailExistsError: 'Este email ya está registrado',\r\n passwordLabel: 'Contraseña',\r\n passwordPlaceholder: 'Introduce tu contraseña',\r\n passwordConfirmLabel: 'Confirma tu contraseña',\r\n passwordConfirmPlaceholder: 'Confirma tu contraseña',\r\n passwordRequiredError: 'Es necesario introducir una contraseña',\r\n passwordNotMatchError: 'Las contraseñas no coinciden',\r\n passwordInvalidError: 'Su contasena debe contener entre 4 y 15 caracteres',\r\n passwordIncorrectError: 'Usuario o contraseña incorrectos',\r\n phoneNumberLabel: 'Teléfono',\r\n phoneNumberPlaceholder: 'Introduce tu teléfono',\r\n phoneNumberRequiredError: 'El número de teléfono es necesario',\r\n phoneNumberInvalidError: 'Introduce un número válido',\r\n acceptPrivacyPolicyText: 'He leído y acepto la',\r\n acceptPrivacyPolicyLinkText: 'Política de Privacidad',\r\n acceptPrivacyPolicyLink: 'legal',\r\n acceptPrivacyPolicyRequiredError: 'Debes aceptar el aviso legal y las condiciones de uso antes de continuar',\r\n acceptCommunication: 'Sí, acepto recibir comunicaciones comerciales y ofertas personalizadas según mi perfil.',\r\n logInCtaText: 'Iniciar sesión',\r\n registerCtaText: 'Crear cuenta',\r\n remindPasswordCtaText: 'Recuperar contraseña',\r\n remindPasswordText: 'Recuperar contraseña',\r\n remindPasswordHeader: 'Recuperar contraseña',\r\n remindPasswordSubHeader: 'Introduce tu email y te enviaremos las instrucciones para crear una contraseña nueva.',\r\n additionalEmailError: {\r\n header: 'Lo sentimos',\r\n subHeader: 'No ha sido posible asociar el email introducido a la cuenta.',\r\n },\r\n additionalEmailMaximumError: {\r\n header: 'Lo sentimos',\r\n subHeader: 'Has alcanzado el máximo de emails asociados. Debes eliminar un email para poder añadir otro.',\r\n },\r\n remindPasswordSendSuccess: {\r\n header: 'Comprueba tu correo para restablecer la contraseña',\r\n subHeader: 'Tu nueva contraseña está lista. Te hemos enviado un correo con unos sencillos pasos para restablecerla.',\r\n ctaText: '¡Todo claro!',\r\n },\r\n remindPasswordSendError: {\r\n header: 'El email que has introducido no pertenece a ninguna cuenta',\r\n subHeader: 'Por favor, revisa si la dirección de correo electrónico es correcta y vuelve a intentarlo, o regístrate.',\r\n ctaText: 'Volver a intentar',\r\n },\r\n newPasswordForm: {\r\n header: 'Nueva contraseña',\r\n subHeader: 'Introduce una nueva contraseña para tu cuenta en Pizza Hut',\r\n cta: 'Cambiar contraseña',\r\n newPasswordLabel: 'Nueva contraseña',\r\n newPasswordPlaceholder: 'Introduce tu nueva contraseña',\r\n newPasswordConfirmationLabel: 'Confirma tu nueva contraseña',\r\n newPasswordConfirmationPlaceholder: 'Confirma tu contraseña',\r\n },\r\n emailValidationModal: {\r\n header: 'Valida tu cuenta',\r\n subHeader: 'Es necesario validar tu email para poder realizar otro pedido ¿No lo encuentras?',\r\n ctaText: 'Reenviar email',\r\n },\r\n firstLastNameVisible: false,\r\n firstNameLabel: 'Nombre',\r\n firstNamePlaceholder: 'Tu nombre',\r\n firstNameRequiredError: 'El nombre es necesario',\r\n firstNameMaxLength: undefined,\r\n lastNameLabel: 'Apellido',\r\n lastNamePlaceholder: 'Tu apellido',\r\n lastNameRequiredError: 'El apellido es necesario',\r\n lastNameMaxLength: undefined,\r\n};\r\n\r\nconst AccountStaticContentReducer = (state = initialState, action: StaticContentActions): AccountStaticContent => {\r\n switch (action.type) {\r\n case AccountStaticContentActions.SET_STATIC_CONTENT: {\r\n const { payload } = action;\r\n return {\r\n ...state,\r\n ...payload,\r\n };\r\n }\r\n default: {\r\n return { ...state };\r\n }\r\n }\r\n};\r\n\r\nexport default AccountStaticContentReducer;\r\n","import { GlobalActions } from 'apps/AccountApp/store/actions';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\n\r\n// shared\r\nimport Axios from 'shared/api/axios';\r\nimport { hostURL, redirectToHomePage } from 'shared/helpers/routing-helpers';\r\nimport { SetLoader } from 'shared/store/global/global.actions';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\n\r\n// store\r\nimport { ServerSideValidationPayload, PropertyChangedPayload } from 'shared/types';\r\nimport { ApplicationState } from '..';\r\n\r\n// types\r\n\r\nexport enum RegistrationActionsTypes {\r\n ON_PROPERTY_CHANGED = '[ACCOUNT_APP_REGISTRATION] ON_PROPERTY_CHANGED',\r\n SET_SERVER_SIDE_VALIDATION = '[ACCOUNT_APP_REGISTRATION] SET_SERVER_SIDE_VALIDATION',\r\n}\r\n\r\ninterface OnPropertyChanged extends Action {\r\n type: RegistrationActionsTypes.ON_PROPERTY_CHANGED;\r\n payload: PropertyChangedPayload;\r\n}\r\n\r\ninterface SetServerSideValidation extends Action {\r\n type: RegistrationActionsTypes.SET_SERVER_SIDE_VALIDATION;\r\n payload: ServerSideValidationPayload;\r\n}\r\n\r\nexport const createUser =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n dispatch(SetLoader(true));\r\n const state = getState();\r\n const verificationUrl = `${hostURL()}account/confirmation`;\r\n const {\r\n registration: { registrationForm },\r\n } = state;\r\n await ResponseWrapper({\r\n action: async () => {\r\n await Axios.post('api/accounts', {\r\n verificationUrl,\r\n ...registrationForm,\r\n subscribeForSMSCommunication: registrationForm.subscriptionForNewsletter,\r\n });\r\n redirectToHomePage();\r\n },\r\n dispatch,\r\n withoutGlobalNotification: true,\r\n errorCallback: async (err) => {\r\n const { errorCode, status } = err.response.data;\r\n\r\n if (errorCode === 'ExistingEmailAddress') {\r\n dispatch({\r\n type: RegistrationActionsTypes.SET_SERVER_SIDE_VALIDATION,\r\n payload: {\r\n message: state.staticContent.emailInvalidError,\r\n fieldName: 'emailAddress',\r\n errorCode,\r\n status,\r\n },\r\n });\r\n }\r\n },\r\n });\r\n dispatch(SetLoader(false));\r\n };\r\n\r\nexport type RegistrationActions = OnPropertyChanged | SetServerSideValidation;\r\n","// actions\r\nimport { RegistrationActionsTypes, RegistrationActions } from './registration.actions';\r\n\r\n// types\r\nimport { RegistrationForm } from '../../account.types';\r\nimport { PushNotificationsProvider } from 'typings/web-bridge.types';\r\n\r\nconst { ON_PROPERTY_CHANGED, SET_SERVER_SIDE_VALIDATION } = RegistrationActionsTypes;\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\r\nexport interface UserRegistrationState {\r\n registrationForm: RegistrationForm;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n serverValidation: any;\r\n}\r\n\r\nexport const userInitState: UserRegistrationState = {\r\n registrationForm: {\r\n emailAddress: '',\r\n password: '',\r\n passwordConfirmation: '',\r\n phoneNumber: '',\r\n firstName: '',\r\n lastName: '',\r\n acceptTermsAndCondition: false,\r\n subscriptionForNewsletter: false,\r\n deviceId: '',\r\n installationId: '',\r\n provider: PushNotificationsProvider.FIREBASE\r\n },\r\n serverValidation: {},\r\n};\r\n\r\nconst registrationReducer = (state = userInitState, action: RegistrationActions): UserRegistrationState => {\r\n switch (action.type) {\r\n case ON_PROPERTY_CHANGED: {\r\n const { name, value } = action.payload;\r\n return {\r\n ...state,\r\n registrationForm: {\r\n ...state.registrationForm,\r\n [name]: value,\r\n },\r\n serverValidation: {\r\n [name]: undefined,\r\n },\r\n };\r\n }\r\n case SET_SERVER_SIDE_VALIDATION: {\r\n const { fieldName, status, errorCode, message } = action.payload;\r\n return {\r\n ...state,\r\n serverValidation: {\r\n ...state.serverValidation,\r\n [fieldName]: {\r\n status,\r\n errorCode,\r\n message,\r\n },\r\n },\r\n };\r\n }\r\n default:\r\n return state;\r\n }\r\n};\r\n\r\nexport default registrationReducer;\r\n","import Axios from 'shared/api/axios';\r\nimport { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\nimport { hostURL, redirectToHomePage } from 'shared/helpers/routing-helpers';\r\nimport { SetLoader } from 'shared/store/global/global.actions';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\nimport { ServerSideValidationPayload, PropertyChangedPayload } from 'shared/types';\r\nimport { ApplicationState } from '..';\r\n\r\n\r\nexport enum SignInActionsTypes {\r\n ON_PROPERTY_CHANGED = '[ACCOUNT_APP_SIGNIN] ON_PROPERTY_CHANGED',\r\n CLOSE_VALIDATION_MODAL = '[ACCOUNT_APP_SIGNIN] CLOSE_VALIDATION_MODAL',\r\n SET_SERVER_SIDE_VALIDATION = '[ACCOUNT_APP_SIGNIN] SET_SERVER_SIDE_VALIDATION',\r\n}\r\n\r\ninterface OnPropertyChanged extends Action {\r\n type: SignInActionsTypes.ON_PROPERTY_CHANGED;\r\n payload: PropertyChangedPayload;\r\n}\r\n\r\ninterface CloseValidationModal extends Action {\r\n type: SignInActionsTypes.CLOSE_VALIDATION_MODAL;\r\n}\r\n\r\ninterface SetServerSideValidation extends Action {\r\n type: SignInActionsTypes.SET_SERVER_SIDE_VALIDATION;\r\n payload: ServerSideValidationPayload;\r\n}\r\n\r\nexport const requestEmailValidation =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const verificationUrl = `${hostURL()}account/confirmation`;\r\n const emailAddress = getState().signIn.signInForm.email;\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n Axios.post('api/accounts/resend-verification', { verificationUrl, emailAddress });\r\n dispatch({\r\n type: SignInActionsTypes.CLOSE_VALIDATION_MODAL,\r\n });\r\n },\r\n dispatch,\r\n });\r\n };\r\n\r\nexport const logIn =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n dispatch(SetLoader(true));\r\n const state = getState();\r\n const {\r\n signIn: { signInForm },\r\n } = state;\r\n\r\n await ResponseWrapper({\r\n action: async () => {\r\n await Axios.post('account', {\r\n ...signInForm,\r\n });\r\n redirectToHomePage();\r\n },\r\n dispatch,\r\n withoutGlobalNotification: true,\r\n errorCallback: async (err) => {\r\n const { errorCode, status } = err.response.data;\r\n\r\n if(errorCode === 'AccountNotVerified') {\r\n dispatch({\r\n type: SignInActionsTypes.ON_PROPERTY_CHANGED,\r\n payload: {\r\n name: 'errorInModal',\r\n value: true,\r\n },\r\n });\r\n }\r\n\r\n if (errorCode === 'InvalidPassword' || errorCode === 'NoUserFoundForEmailAddress') {\r\n dispatch({\r\n type: SignInActionsTypes.SET_SERVER_SIDE_VALIDATION,\r\n payload: {\r\n message: state.staticContent.passwordIncorrectError,\r\n fieldName: 'password',\r\n errorCode,\r\n status,\r\n },\r\n });\r\n }\r\n },\r\n });\r\n dispatch(SetLoader(false));\r\n };\r\n\r\nexport type SignInActions = OnPropertyChanged | CloseValidationModal | SetServerSideValidation;\r\n","// actions\r\nimport { SignInActionsTypes, SignInActions } from './signin.actions';\r\n\r\n// types\r\nimport { SignInForm } from '../../account.types';\r\nimport { PushNotificationsProvider } from 'typings/web-bridge.types';\r\n\r\nconst { ON_PROPERTY_CHANGED, SET_SERVER_SIDE_VALIDATION, CLOSE_VALIDATION_MODAL } = SignInActionsTypes;\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\r\nexport interface UserSignInState {\r\n signInForm: SignInForm;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n serverValidation: any;\r\n}\r\n\r\nexport const userInitState: UserSignInState = {\r\n signInForm: {\r\n email: '',\r\n password: '',\r\n rememberPassword: true,\r\n errorInModal: '',\r\n deviceId: '',\r\n installationId: '',\r\n provider: PushNotificationsProvider.FIREBASE,\r\n },\r\n serverValidation: {},\r\n};\r\n\r\nconst signInReducer = (state = userInitState, action: SignInActions): UserSignInState => {\r\n switch (action.type) {\r\n case ON_PROPERTY_CHANGED: {\r\n const { name, value } = action.payload;\r\n return {\r\n ...state,\r\n signInForm: {\r\n ...state.signInForm,\r\n [name]: value,\r\n },\r\n serverValidation: {\r\n [name]: undefined,\r\n },\r\n };\r\n }\r\n case SET_SERVER_SIDE_VALIDATION: {\r\n const { fieldName, status, errorCode, message } = action.payload;\r\n return {\r\n ...state,\r\n serverValidation: {\r\n ...state.serverValidation,\r\n [fieldName]: {\r\n status,\r\n errorCode,\r\n message,\r\n },\r\n },\r\n };\r\n }\r\n case CLOSE_VALIDATION_MODAL: {\r\n return {\r\n ...state,\r\n signInForm: {\r\n ...state.signInForm,\r\n errorInModal: '',\r\n },\r\n };\r\n }\r\n default:\r\n return state;\r\n }\r\n};\r\n\r\nexport default signInReducer;\r\n","// shared\r\nimport * as _globalActions from 'shared/store/global/global.actions';\r\n\r\n// app\r\nimport * as _signImActions from './signin/signin.actions';\r\nimport * as _registrationActions from './registration/registration.actions';\r\nimport * as _resetPasswordActions from './reset-password/reset-password.actions';\r\n\r\nexport const RegistrationActions = _registrationActions;\r\nexport const SignInActions = _signImActions;\r\nexport const GlobalActions = _globalActions;\r\nexport const ResetPasswordActions = _resetPasswordActions;\r\n","import { PushNotificationsProvider } from \"typings/web-bridge.types\";\r\n\r\nexport interface RegistrationForm {\r\n emailAddress: string;\r\n phoneNumber: string;\r\n password: string;\r\n passwordConfirmation: string;\r\n acceptTermsAndCondition: boolean;\r\n subscriptionForNewsletter: boolean;\r\n deviceId: string;\r\n installationId: string;\r\n provider: PushNotificationsProvider;\r\n firstName: string;\r\n lastName: string;\r\n}\r\n\r\nexport interface SignInForm {\r\n email: string;\r\n password: string;\r\n rememberPassword: boolean;\r\n deviceId: string;\r\n installationId: string;\r\n provider: PushNotificationsProvider;\r\n errorInModal: string;\r\n}\r\n\r\nexport interface ResetPasswordForm {\r\n emailAddress: string;\r\n newPassword: string;\r\n newPasswordConfirmation: string;\r\n key: string;\r\n}\r\n\r\nexport enum ResetPasswordStep {\r\n REQUEST_FOR_PASSWORD = 1,\r\n EMAIL_NOT_FOUND = 2,\r\n RESET_EMAIL_SENT = 3,\r\n CHANGE_PASSWORD = 4,\r\n}\r\n\r\nexport interface PropertyChangedPayload {\r\n name: string;\r\n value: string;\r\n}\r\n\r\nexport interface CreateAccountDTO {\r\n emailAddress: string;\r\n password: string;\r\n subscriptionForNewsletter: boolean;\r\n verificationUrl: string;\r\n}\r\n","import { Action } from 'redux';\r\nimport { ThunkAction } from 'redux-thunk';\r\n\r\n// shared\r\nimport Axios from 'shared/api/axios';\r\nimport { hostURL, redirectToHomePage } from 'shared/helpers/routing-helpers';\r\nimport { PropertyChangedPayload } from 'shared/types';\r\nimport ResponseWrapper from 'shared/tools/api-response-wrapper';\r\n\r\n// store\r\nimport { ApplicationState } from '..';\r\nimport { GlobalActions } from '../actions';\r\n\r\n// types\r\nimport { ResetPasswordStep } from '../../account.types';\r\n\r\nexport enum ResetPasswordActionsTypes {\r\n ON_PROPERTY_CHANGED = '[ACCOUNT_APP_ResetPassword] ON_PROPERTY_CHANGED',\r\n SET_CURRENT_STEP = '[ACCOUNT_APP_ResetPassword] SET_CURRENT_STEP',\r\n}\r\n\r\ninterface OnPropertyChanged extends Action {\r\n type: ResetPasswordActionsTypes.ON_PROPERTY_CHANGED;\r\n payload: PropertyChangedPayload;\r\n}\r\n\r\ninterface SetCurrentStep extends Action {\r\n type: ResetPasswordActionsTypes.SET_CURRENT_STEP;\r\n payload: ResetPasswordStep;\r\n}\r\n\r\nexport const requestToPasswordReset =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { SetLoader } = GlobalActions;\r\n dispatch(SetLoader(true));\r\n const state = getState();\r\n const verificationUrl = `${hostURL()}account/reset-password`;\r\n const {\r\n resetPassword: { resetPasswordForm },\r\n } = state;\r\n await ResponseWrapper({\r\n action: async () => {\r\n const res = await Axios.post('api/accounts/password-reset-requests', { url: verificationUrl, ...resetPasswordForm });\r\n dispatch(changeCurrentStep(ResetPasswordStep.RESET_EMAIL_SENT));\r\n },\r\n dispatch,\r\n errorCallback: async (err) => {\r\n const { errorCode } = err.response.data;\r\n if (errorCode === 'NoUserFoundForEmailAddress') {\r\n dispatch(changeCurrentStep(ResetPasswordStep.EMAIL_NOT_FOUND));\r\n }\r\n }, //\r\n withoutGlobalNotification: true,\r\n });\r\n\r\n dispatch(SetLoader(false));\r\n };\r\n\r\nexport const changePassword =\r\n (): ThunkAction =>\r\n async (dispatch, getState): Promise => {\r\n const { SetLoader } = GlobalActions;\r\n dispatch(SetLoader(true));\r\n const state = getState();\r\n const {\r\n resetPassword: { resetPasswordForm },\r\n } = state;\r\n await ResponseWrapper({\r\n action: async () => {\r\n const res = await Axios.post('api/accounts/password-resets', { ...resetPasswordForm });\r\n redirectToHomePage();\r\n },\r\n dispatch,\r\n });\r\n\r\n dispatch(SetLoader(false));\r\n };\r\n\r\nexport const changeCurrentStep =\r\n (step: ResetPasswordStep): ThunkAction =>\r\n async (dispatch): Promise => {\r\n dispatch({\r\n type: ResetPasswordActionsTypes.SET_CURRENT_STEP,\r\n payload: step,\r\n });\r\n };\r\n\r\nexport type ResetPasswordActions = OnPropertyChanged | SetCurrentStep;\r\n","// actions\r\nimport { ResetPasswordActions, ResetPasswordActionsTypes } from './reset-password.actions';\r\n\r\n// types\r\nimport { ResetPasswordForm, ResetPasswordStep } from '../../account.types';\r\n\r\nconst { ON_PROPERTY_CHANGED, SET_CURRENT_STEP } = ResetPasswordActionsTypes;\r\n\r\nexport interface ResetPasswordState {\r\n resetPasswordForm: ResetPasswordForm;\r\n currentStep: ResetPasswordStep;\r\n}\r\n\r\nexport const userInitState: ResetPasswordState = {\r\n resetPasswordForm: {\r\n emailAddress: '',\r\n newPassword: '',\r\n key: '',\r\n newPasswordConfirmation: '',\r\n },\r\n currentStep: ResetPasswordStep.REQUEST_FOR_PASSWORD,\r\n};\r\n\r\nconst resetPasswordReducer = (state = userInitState, action: ResetPasswordActions): ResetPasswordState => {\r\n switch (action.type) {\r\n case ON_PROPERTY_CHANGED: {\r\n const { name, value } = action.payload;\r\n return {\r\n ...state,\r\n resetPasswordForm: {\r\n ...state.resetPasswordForm,\r\n [name]: value,\r\n },\r\n };\r\n }\r\n case SET_CURRENT_STEP: {\r\n const currentStep = action.payload;\r\n return {\r\n ...state,\r\n currentStep,\r\n };\r\n }\r\n default:\r\n return state;\r\n }\r\n};\r\n\r\nexport default resetPasswordReducer;\r\n","import { createStore, applyMiddleware, compose, combineReducers } from 'redux';\r\nimport thunk from 'redux-thunk';\r\n\r\n// store\r\nimport global, { GlobalState as _globalState } from 'shared/store/global/global.reducer';\r\nimport staticContent, {\r\n AccountStaticContent as _accountStaticContent,\r\n} from 'apps/AccountApp/store/static-content/account-static-content.reducer';\r\nimport { LoadReduxItemFromLocalStorage } from 'shared/utils';\r\nimport registration, { UserRegistrationState as _userRegistrationState } from './registration/registration.reducer';\r\nimport signIn, { UserSignInState as _userSignInState, userInitState } from './signin/signin.reducer';\r\nimport resetPassword, { ResetPasswordState as _resetPasswordState } from './reset-password/reset-password.reducer';\r\n\r\nexport interface ApplicationState {\r\n registration: _userRegistrationState;\r\n signIn: _userSignInState;\r\n global: _globalState;\r\n resetPassword: _resetPasswordState;\r\n staticContent: _accountStaticContent;\r\n}\r\n\r\nconst accountReducers = {\r\n registration,\r\n signIn,\r\n global,\r\n resetPassword,\r\n staticContent,\r\n};\r\n\r\nconst rootReducer = combineReducers({\r\n ...accountReducers,\r\n});\r\n\r\nconst composeEnhancers = (process.env.NODE_ENV === 'development' && window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;\r\n\r\nconst middlewares = [thunk];\r\nconst enhancer = composeEnhancers(applyMiddleware(...middlewares));\r\n\r\nconst store = createStore(\r\n rootReducer,\r\n {\r\n signIn: {\r\n signInForm: {\r\n ...userInitState.signInForm,\r\n rememberPassword: LoadReduxItemFromLocalStorage(\r\n userInitState.signInForm.rememberPassword,\r\n 'signInRememberPassword',\r\n ),\r\n },\r\n serverValidation: null,\r\n },\r\n },\r\n enhancer,\r\n);\r\n\r\nexport default store;\r\nexport type GlobalState = _globalState;\r\n","import { ValidationResult } from '../types';\r\n\r\nexport const GetServerValidationMessage = (serverValidation: any, fieldName: string): string => {\r\n if (serverValidation && serverValidation[fieldName]) {\r\n return serverValidation[fieldName].message;\r\n }\r\n\r\n return '';\r\n};\r\n\r\nexport const ToValidaationMessage = (result: ValidationResult): string => {\r\n if (result.success) return '';\r\n\r\n return result.messages[0].message;\r\n};\r\n\r\nexport const ToValidationMessageWithServer = (result: ValidationResult, serverValidation: unknown, fieldName: string): string => {\r\n const server = GetServerValidationMessage(serverValidation, fieldName);\r\n\r\n if (server !== '') {\r\n return server;\r\n }\r\n\r\n return ToValidaationMessage(result);\r\n};\r\n","import React, { useEffect, useState } from 'react';\r\n\r\nexport interface FormControl {\r\n value: string;\r\n errorMessage?: string;\r\n isValid?: boolean;\r\n touched?: boolean;\r\n}\r\n\r\ninterface FormProps {\r\n id: string;\r\n name?: string;\r\n label?: string;\r\n placeholder?: string;\r\n testId: string;\r\n onChangeFn(e: React.ChangeEvent): void;\r\n onBlurFn?(e: React.ChangeEvent): void;\r\n control: FormControl;\r\n dirty?: boolean;\r\n type?: string;\r\n autocomplete?: string;\r\n readonly?: boolean;\r\n forceInvalid?: boolean;\r\n maxLength?: number;\r\n}\r\n\r\nconst FormInput: React.FC = ({\r\n id,\r\n placeholder,\r\n label,\r\n testId,\r\n onChangeFn,\r\n onBlurFn,\r\n control,\r\n name,\r\n dirty = false,\r\n type,\r\n autocomplete = 'off',\r\n readonly,\r\n forceInvalid = false,\r\n maxLength,\r\n}) => {\r\n const [isDirty, setIsDirty] = useState(false);\r\n const [passwordVisible, setPasswordVisibility] = useState(false);\r\n\r\n useEffect(() => {\r\n setIsDirty(dirty);\r\n }, [dirty]);\r\n\r\n const inputType = type !== 'password' ? 'text' : passwordVisible ? 'text' : 'password';\r\n const passwordIcon = passwordVisible ? 'icon-password-visible' : 'icon-password-invisible';\r\n\r\n return (\r\n <>\r\n {label && (\r\n \r\n )}\r\n
\r\n 0 ? 'password-padding' : ''\r\n }`}\r\n id={id}\r\n value={control.value || ''}\r\n placeholder={placeholder}\r\n data-testid={testId}\r\n onBlur={(sender): void => {\r\n setIsDirty(true);\r\n onChangeFn(sender);\r\n if (onBlurFn) onBlurFn(sender);\r\n }}\r\n onChange={(sender): void => {\r\n setIsDirty(false);\r\n onChangeFn(sender);\r\n }}\r\n readOnly={readonly}\r\n maxLength={maxLength}\r\n />\r\n\r\n {(control.errorMessage || forceInvalid) && isDirty && (\r\n <>\r\n 0 ? 'with-password' : ''\r\n }`}\r\n data-testid={`${testId}-error-icon`}\r\n />\r\n

\r\n {control.errorMessage}\r\n

\r\n \r\n )}\r\n\r\n {type === 'password' && control.value.length > 0 && (\r\n {\r\n setPasswordVisibility(!passwordVisible);\r\n }}\r\n className={`d-block position-absolute ${passwordIcon}`}\r\n data-testid={`${testId}-password-icon`}\r\n />\r\n )}\r\n
\r\n \r\n );\r\n};\r\n\r\nconst prepareInputClasses = (control: FormControl, dirty: boolean, forceInvalid: boolean): string => {\r\n if (!dirty) return '';\r\n\r\n return control.isValid ? 'border-success' : control.errorMessage || forceInvalid ? 'border-danger' : '';\r\n};\r\n\r\nexport default FormInput;\r\n","import React, { useEffect, useState } from 'react';\r\n\r\nimport { PropertyChangedEventArgs } from '../types';\r\n\r\ninterface CheckboxInputProps {\r\n name: string;\r\n id?: string;\r\n onChangeFn(e: PropertyChangedEventArgs): void;\r\n checked: boolean;\r\n errorMessage?: string;\r\n dirty?: boolean;\r\n testId: string;\r\n children?: React.ReactNode;\r\n}\r\n\r\nconst CheckboxInput: React.FC = ({\r\n name,\r\n id,\r\n onChangeFn,\r\n checked,\r\n errorMessage,\r\n dirty = false,\r\n children,\r\n testId,\r\n}) => {\r\n const [isDirty, setIsDirty] = useState(false);\r\n\r\n useEffect(() => {\r\n setIsDirty(dirty);\r\n }, [dirty]);\r\n\r\n return (\r\n