-
Notifications
You must be signed in to change notification settings - Fork 0
/
583.0f2dd607.iframe.bundle.js
1 lines (1 loc) · 32.5 KB
/
583.0f2dd607.iframe.bundle.js
1
"use strict";(self.webpackChunk_haaretz_a_htz_sg=self.webpackChunk_haaretz_a_htz_sg||[]).push([[583],{"../../ds-atoms/s-logo-loading-indicator/src/LogoLoadingIndicator.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>LogoLoadingIndicator});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/jsx-runtime.js"),_haaretz_s_icon__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../ds-atoms/s-icon/src/index.ts"),_haaretz_s_visually_hidden__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../ds-atoms/s-visually-hidden/src/index.ts"),style9__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/style9/index.mjs");const c={wrapper:{color:"dHDnIz",display:"jhKQav",paddingBottom:"fxvVbr",paddingInlineEnd:"llcGuc",paddingInlineStart:"eBkqhC",paddingTop:"iivzay",position:"cjScYX",overflowX:"dUvWpK",overflowY:"hRLVFh"},placeholder:{width:"hHGIsI",height:"jXmXEB"},spinnerSvg:{height:"gdPTUr",left:"bOjOhu",position:"bEvNbr",top:"WhAZY",width:"cRUUAa",animationDuration:"jQXeCC",animationIterationCount:"kQuOcB",animationName:"GZVQz",animationTimingFunction:"jHFOea"},spinnerPath:{animationDuration:"jQXeCC",animationIterationCount:"kQuOcB",animationName:"lnkW",animationTimingFunction:"dDrDcI",fill:"rnYNS",stroke:"gYUVgM",strokeDasharray:"fbTwse",strokeDashoffset:"fwJipa",strokeLinecap:"jjWsSD",strokeWidth:"IXGqJ",transformOrigin:"hFynNp"},icon:{fontSize:"gcQrEv"}},iconName="alef";function LogoLoadingIndicator(_ref){let{hideLogo,inlineStyle,styleExtend=[]}=_ref;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:(0,style9__WEBPACK_IMPORTED_MODULE_1__.Z)(c.wrapper,...styleExtend),style:inlineStyle,"data-testid":"logo-loading-indicator",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_haaretz_s_visually_hidden__WEBPACK_IMPORTED_MODULE_2__.ZP,{children:"טוען..."}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{"aria-hidden":!0,viewBox:"0 0 66 66",className:(0,style9__WEBPACK_IMPORTED_MODULE_1__.Z)(c.spinnerSvg),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("circle",{className:(0,style9__WEBPACK_IMPORTED_MODULE_1__.Z)(c.spinnerPath),cx:"33",cy:"33",r:"30"})}),hideLogo?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div",{className:(0,style9__WEBPACK_IMPORTED_MODULE_1__.Z)(c.placeholder)}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_haaretz_s_icon__WEBPACK_IMPORTED_MODULE_3__.Z,{icon:iconName,styleExtend:[c.icon]})]})}try{LogoLoadingIndicator.displayName="LogoLoadingIndicator",LogoLoadingIndicator.__docgenInfo={description:"",displayName:"LogoLoadingIndicator",props:{hideLogo:{defaultValue:null,description:"Display the loading indicator without the logo",name:"hideLogo",required:!1,type:{name:"true | undefined"}},inlineStyle:{defaultValue:null,description:"CSS declarations to be set as inline `style` on the\nhtml element.\n\nBy setting values of CSS Custom Properties based on\nprops or state in the consuming component (where\nthe value of `inlineStyle` is passed), `inlineStyle`\ncan be used as an API contract for setting dynamic\nvalues to styles created with `style9.create()`:\n@example ```ts\nimport s9 from 'style9';\nconst { styleExtend, } = s9.create({\n styleExtend: {\n color: 'var(--color-based-on-prop)',\n },\n});\n\nfunction MyLogoLoadingIndicator(props) {\n const inlineStyle = {\n '--color-based-on-prop': props.color,\n },\n\n return (\n <LogoLoadingIndicator\n styleExtend={[ styleExtend, ]}\n inlineStyle={inlineStyle}\n />\n );\n}\n```",name:"inlineStyle",required:!1,type:{name:"InlineStyles | undefined"}},styleExtend:{defaultValue:{value:"[]"},description:"An array of `Style`s created by `style9.create()`.\nWARNING: **_do not_** pass simple CSS-in-JS object.\nThe items in the array must be created with Style9's\n`create` function.\nThe array can also hold falsy values to assist with\nconditional inclusion of `Style`s:\n@example ```ts\nconst { foo, bar, } = s9.create({ foo: { ... }, bar: { ... }, });\n<LogoLoadingIndicator styleExtend={[ someCondition && foo, bar, ]} />\n```",name:"styleExtend",required:!1,type:{name:"StyleExtend | undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../ds-atoms/s-logo-loading-indicator/src/LogoLoadingIndicator.tsx#LogoLoadingIndicator"]={docgenInfo:LogoLoadingIndicator.__docgenInfo,name:"LogoLoadingIndicator",path:"../../ds-atoms/s-logo-loading-indicator/src/LogoLoadingIndicator.tsx#LogoLoadingIndicator"})}catch(__react_docgen_typescript_loader_error){}},"../../ds-atoms/s-logo-loading-indicator/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=__webpack_require__("../../ds-atoms/s-logo-loading-indicator/src/LogoLoadingIndicator.tsx").Z},"../../ds-atoms/s-no-ssr/src/NoSSR.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>NoSSR});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/jsx-runtime.js"),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/index.js");function NoSSR(_ref){let{children}=_ref;const[loaded,setLoaded]=react__WEBPACK_IMPORTED_MODULE_1__.useState(!1);return react__WEBPACK_IMPORTED_MODULE_1__.useEffect((()=>{setLoaded(!0)}),[]),loaded?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment,{children}):null}try{NoSSR.displayName="NoSSR",NoSSR.__docgenInfo={description:"",displayName:"NoSSR",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../ds-atoms/s-no-ssr/src/NoSSR.tsx#NoSSR"]={docgenInfo:NoSSR.__docgenInfo,name:"NoSSR",path:"../../ds-atoms/s-no-ssr/src/NoSSR.tsx#NoSSR"})}catch(__react_docgen_typescript_loader_error){}},"../../ds-atoms/s-no-ssr/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=__webpack_require__("../../ds-atoms/s-no-ssr/src/NoSSR.tsx").Z},"../../hooks/s-use-bi/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src});var configShim=__webpack_require__("../../config/l-storybook-config/wwwroot/public/configShim.js"),react=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/index.js"),useBiDataContext=__webpack_require__("../../hooks/s-use-bi/src/useBiDataContext.tsx");const src=function useBi(){let biUrl,biType=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"action";const biServer=configShim.Z.get("bIServer");switch(biType){case"impression":biUrl=`${biServer}/impressionPlain`;break;case"pageview":biUrl=`${biServer}/requestPlain`;break;default:biUrl=`${biServer}/actionPlain`}const contextBiDataPromise=(0,useBiDataContext.Z)();return react.useCallback((userBiData=>{contextBiDataPromise.then((contextBiData=>{var _window$navigator;const{additional_info}=userBiData;additional_info&&"object"==typeof additional_info&&(userBiData.additional_info=JSON.stringify(additional_info));const finalBiData=Object.assign({},contextBiData,userBiData);null===(_window$navigator=window.navigator)||void 0===_window$navigator||_window$navigator.sendBeacon(biUrl,JSON.stringify(finalBiData))}))}),[biUrl,contextBiDataPromise])}},"../../hooks/s-use-config/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=__webpack_require__("../../hooks/s-use-config/src/useConfig.ts").Z},"../../pp-atoms/s-pp-image/src/PpImage.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>PpImage});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/jsx-runtime.js"),style9__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/style9/index.mjs");const c={base:{height:"jXmXEB",width:"fCehYP",pointerEvents:"eDssNQ"}};function PpImage(_ref){let{inlineStyle,styleExtend=[]}=_ref;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{className:(0,style9__WEBPACK_IMPORTED_MODULE_1__.Z)(c.base,...styleExtend),style:inlineStyle,focusable:!1,tabIndex:-1,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("use",{xlinkHref:"#promotion-img"})})}try{PpImage.displayName="PpImage",PpImage.__docgenInfo={description:"",displayName:"PpImage",props:{inlineStyle:{defaultValue:null,description:"CSS declarations to be set as inline `style` on the\nhtml element.\n\nBy setting values of CSS Custom Properties based on\nprops or state in the consuming component (where\nthe value of `inlineStyle` is passed), `inlineStyle`\ncan be used as an API contract for setting dynamic\nvalues to styles created with `style9.create()`:\n@example ```ts\nimport s9 from 'style9';\nconst { styleExtend, } = s9.create({\n styleExtend: {\n color: 'var(--color-based-on-prop)',\n },\n});\n\nfunction MyPpImage(props) {\n const inlineStyle = {\n '--color-based-on-prop': props.color,\n },\n\n return (\n <PpImage\n styleExtend={[ styleExtend, ]}\n inlineStyle={inlineStyle}\n />\n );\n}\n```",name:"inlineStyle",required:!1,type:{name:"InlineStyles | undefined"}},styleExtend:{defaultValue:{value:"[]"},description:"An array of `Style`s created by `style9.create()`.\nWARNING: **_do not_** pass simple CSS-in-JS object.\nThe items in the array must be created with Style9's\n`create` function.\nThe array can also hold falsy values to assist with\nconditional inclusion of `Style`s:\n@example ```ts\nconst { foo, bar, } = s9.create({ foo: { ... }, bar: { ... }, });\n<PpImage styleExtend={[ someCondition && foo, bar, ]} />\n```",name:"styleExtend",required:!1,type:{name:"StyleExtend | undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../pp-atoms/s-pp-image/src/PpImage.tsx#PpImage"]={docgenInfo:PpImage.__docgenInfo,name:"PpImage",path:"../../pp-atoms/s-pp-image/src/PpImage.tsx#PpImage"})}catch(__react_docgen_typescript_loader_error){}},"../../pp-atoms/s-pp-image/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=__webpack_require__("../../pp-atoms/s-pp-image/src/PpImage.tsx").Z},"../../pp-hooks/s-use-pp-message/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>s_use_pp_message_src});var src_cookie=__webpack_require__("../../utils/s-atoms/src/cookie/index.ts"),src=__webpack_require__("../../shared/s-consts/src/index.ts");const src_clearCookie=function clearCookie(cookieName){document.cookie=`${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.${src.Kn};`};var react=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/index.js");const defaultMessage={messageType:"",title:"",instructions:"",action:0,ctaType:"link",cta:"חזרה לדף הבית",link:"https://www.haaretz.co.il"};function usePPMessage(){const[cookie]=(0,src_cookie.Z)(),ppMessage=cookie.ppResponseMessage;return react.useEffect((()=>{ppMessage&&src_clearCookie("promotions-response-message")}),[ppMessage]),ppMessage||defaultMessage}usePPMessage.cookieName="promotions-response-message";const s_use_pp_message_src=usePPMessage},"../../pp-molecules/s-pp-payment-iframe/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>s_pp_payment_iframe_src});var defineProperty=__webpack_require__("../../../node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/esm/defineProperty.js"),jsx_runtime=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/jsx-runtime.js"),user=__webpack_require__("../../utils/s-atoms/src/user/index.ts"),src=__webpack_require__("../../shared/s-consts/src/index.ts");const src_setSessionCookie=function setSessionCookie(cookieName,value){document.cookie=`${cookieName}=${value}; path=/; domain=.${src.Kn};`};const src_getSearchParamAsString=function getSearchParamAsString(param){return"string"==typeof param?param:void 0};var s_no_ssr_src=__webpack_require__("../../ds-atoms/s-no-ssr/src/index.ts"),objectWithoutProperties=__webpack_require__("../../../node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),getPurchaseServiceLink=__webpack_require__("../../pp-utils/s-pp-build-promotions-link/src/getPurchaseServiceLink/index.ts");const _excluded=["msPurchaseUrl","foreign","productId","token","email"];const src_getChangeIframeLink=function getChangeIframeLink(_ref){let{msPurchaseUrl,foreign,productId,token,email}=_ref,props=(0,objectWithoutProperties.Z)(_ref,_excluded);if(!productId)return"";const searchParams=new URLSearchParams({cgtype:"heb_change",productId}),colorMode=document.documentElement.classList.contains("darkMode")?"dark":"light";searchParams.append("colorMode",colorMode),searchParams.append("foreign",String(!0===foreign));const optionalParams={utmCampaign:props.utmCampaign,utmContent:props.utmContent,utmMedium:props.utmMedium,utmSource:props.utmSource,token,email};for(const optionsParamsKey in optionalParams)if(Object.prototype.hasOwnProperty.call(optionalParams,optionsParamsKey)){const value=optionalParams[optionsParamsKey];value&&searchParams.append(optionsParamsKey,value.toString())}return(0,getPurchaseServiceLink.Z)({msPurchaseUrl,searchParams,endpoint:"cgPayment"})};var getCommonParameters=__webpack_require__("../../pp-utils/s-pp-build-promotions-link/src/getCommonParameters/index.ts");const getIframeLink_excluded=["msPurchaseUrl","foreign"];const getIframeLink=function getIFrameLink(_ref){let{msPurchaseUrl,foreign}=_ref,props=(0,objectWithoutProperties.Z)(_ref,getIframeLink_excluded);const searchParams=(0,getCommonParameters.Z)(props),colorMode=document.documentElement.classList.contains("darkMode")?"dark":"light";return searchParams.append("colorMode",colorMode),searchParams.append("foreign",String(!0===foreign)),(0,getPurchaseServiceLink.Z)({msPurchaseUrl,searchParams,endpoint:"cgPayment"})};var getUtmQueryParameters=__webpack_require__("../../pp-utils/s-pp-build-promotions-link/src/getUtmQueryParameters/index.ts"),generatePath=__webpack_require__("../../pp-utils/s-pp-routing-utils/src/generatePath/index.ts"),getNextStep=__webpack_require__("../../pp-utils/s-pp-routing-utils/src/getNextStep/index.ts"),s_use_bi_src=__webpack_require__("../../hooks/s-use-bi/src/index.ts"),s_use_config_src=__webpack_require__("../../hooks/s-use-config/src/index.ts"),usePPDataStore=__webpack_require__("../../pp-hooks/s-use-pp-data-store/src/usePPDataStore.tsx"),s_use_pp_message_src=__webpack_require__("../../pp-hooks/s-use-pp-message/src/index.ts"),dist=__webpack_require__("../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-router-mock/dist/index.js"),react=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/react/index.js"),style9=__webpack_require__("../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/style9/index.mjs");const src_withTimeout=function withTimeout(promise){let timeout=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,msgOnTimeout=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"operation timed out!";const timer=new Promise(((_,reject)=>setTimeout((()=>{reject(new Error(msgOnTimeout))}),timeout)));return Promise.race([promise,timer])};var console=__webpack_require__("../../../node_modules/.pnpm/[email protected]/node_modules/console-browserify/index.js");async function isForeignIp(config){let localCountry=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Israel";if("undefined"==typeof window)return Promise.reject(new Error("Tried using countryIpService outside of browser context"));try{const countryIpService=config.get("countryIp"),result=await fetch(countryIpService);return(await result.json()).country!==localCountry}catch(error){return console.error(error),!1}}const src_checkIsForeignIp=function checkIsForeignIp(_ref){let{localCountry,timeout,config}=_ref;return void 0!==timeout&&timeout>0?src_withTimeout(isForeignIp(config,localCountry),timeout):isForeignIp(config,localCountry)};var useIsForeignIp_console=__webpack_require__("../../../node_modules/.pnpm/[email protected]/node_modules/console-browserify/index.js");const components_useIsForeignIp=()=>{const config=(0,s_use_config_src.Z)(),[isForeignIp,setIsForeignIp]=react.useState(null);return react.useEffect((()=>{"boolean"!=typeof isForeignIp&&src_checkIsForeignIp({timeout:1e3,config}).then((result=>{setIsForeignIp(result)})).catch((IpError=>{useIsForeignIp_console.error("error from ip2country/",IpError),setIsForeignIp(!1)}))}),[config,isForeignIp]),isForeignIp};function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){(0,defineProperty.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}const c={iframe:{width:"ifmzlD",height:"CtRGV",minHeight:"XQeNX",overflowX:"dUvWpK",overflowY:"hRLVFh",marginBottom:"biWxPv",borderTopStyle:"jAobFs",borderRightStyle:"dQbyJV",borderBottomStyle:"oTbqa",borderLeftStyle:"gwsGKP",display:"kQBRAp",marginInlineStart:"bMPiZO",marginInlineEnd:"gzedBA","@media all and (max-width:63.9375em)":{maxWidth:"jIWHeJ"}}};function PpPaymentIFrameComponent(_ref){let{onMessage,setLoading,cartData,biData,kind,steps,couponId,personalCouponId}=_ref;const store=(0,usePPDataStore.JV)(),msPurchaseUrl=(0,s_use_config_src.Z)().get("msPurchaseUrl"),[iframeHeight,setIframeHeight]=react.useState("0px"),iframeRef=react.useRef(null),[error,setError]=react.useState(!1),router=(0,dist.useRouter)(),biAction=(0,s_use_bi_src.Z)(),loadedRef=react.useRef(!1),[,updateUser]=(0,user.Z)(),isForeignIp=components_useIsForeignIp(),productId=src_getSearchParamAsString(router.query.productId),confirmation=src_getSearchParamAsString(router.query.confirmation),email=src_getSearchParamAsString(router.query.email),utmParams=(0,getUtmQueryParameters.Z)(router.query),handlePaymentFrameTasks=react.useCallback((evt=>{function goToNextPage(stepName){let nextStepName=stepName;if(!nextStepName&&steps){const{nextStep}=(0,getNextStep.Z)("payment",steps);nextStepName=nextStep.name}nextStepName||(nextStepName="error");const{pathName,asPath}=(0,generatePath.Z)({nextStepName,asPath:router.asPath,currentQueryParams:router.query});router.replace(pathName,asPath,{shallow:!0})}const msgData=null==evt?void 0:evt.data;if("cgmessage"===(null==msgData?void 0:msgData.type))switch(msgData.command){case"resize_payment_form":"object"==typeof msgData.data&&setIframeHeight(msgData.data.height);break;case"thank_user":window.console.log("thank user",msgData),updateUser("login"),setLoading(!0),goToNextPage("change"===kind?"changeSuccess":void 0);break;case"error_user":window.console.log("got error",msgData),setError(!0),"object"==typeof msgData.data&&(src_setSessionCookie(s_use_pp_message_src.Z.cookieName,JSON.stringify(msgData.data)),goToNextPage("error"));break;case"service_unavailable":window.console.log("got service_unavailable",msgData),setError(!0),"object"==typeof msgData.data&&(src_setSessionCookie(s_use_pp_message_src.Z.cookieName,JSON.stringify(msgData.data)),goToNextPage("error"));break;case"page_busy":window.console.log("page busy"),setLoading(!0);break;case"page_idle":window.console.log("page idle"),setLoading(!1);break;case"purchase_clicked":biData&&biAction(_objectSpread({action_id:37,stage:"payment"},biData));break;default:window.console.log("default")}"function"==typeof onMessage&&evt&&onMessage(evt)}),[biAction,biData,kind,onMessage,router,setLoading,steps,updateUser]);if(react.useEffect((()=>{const iframe=iframeRef.current;return iframe&&"boolean"==typeof isForeignIp&&(iframe.onload=()=>{loadedRef.current||(window.console.log("iframe loaded"),setLoading(!1),loadedRef.current=!0)}),window.addEventListener("message",handlePaymentFrameTasks),()=>{window.removeEventListener("message",handlePaymentFrameTasks)}}),[handlePaymentFrameTasks,setLoading,isForeignIp]),error)return null;if("boolean"!=typeof isForeignIp)return null;const src="payment"===kind?getIframeLink(_objectSpread(_objectSpread(_objectSpread({couponId,personalCouponId},cartData||store),utmParams),{},{msPurchaseUrl,foreign:isForeignIp})):productId?src_getChangeIframeLink(_objectSpread(_objectSpread({msPurchaseUrl,foreign:isForeignIp,productId,token:confirmation,email},utmParams),utmParams)):"";return(0,jsx_runtime.jsx)("iframe",{"data-testid":"payment-iframe",className:(0,style9.Z)(c.iframe),style:{"--iframe-height":iframeHeight},src,sandbox:"allow-forms allow-popups allow-pointer-lock allow-scripts allow-same-origin",scrolling:"no",title:"secure-credit-card-form",ref:iframeRef})}try{PpPaymentIFrameComponent.displayName="PpPaymentIFrameComponent",PpPaymentIFrameComponent.__docgenInfo={description:"",displayName:"PpPaymentIFrameComponent",props:{onMessage:{defaultValue:null,description:"",name:"onMessage",required:!1,type:{name:"((evt: MessageEvent<PostMessageType>) => void) | undefined"}},biData:{defaultValue:null,description:"",name:"biData",required:!1,type:{name:"BiDataOverrides | undefined"}},setLoading:{defaultValue:null,description:"",name:"setLoading",required:!0,type:{name:"Dispatch<SetStateAction<boolean>>"}},kind:{defaultValue:null,description:"",name:"kind",required:!0,type:{name:"enum",value:[{value:'"payment"'},{value:'"change"'}]}},cartData:{defaultValue:null,description:"",name:"cartData",required:!1,type:{name:"PPDataStoreContextProps | CartDataFragment | undefined"}},steps:{defaultValue:null,description:"",name:"steps",required:!1,type:{name:"StepDataFragment[] | undefined"}},couponId:{defaultValue:null,description:"",name:"couponId",required:!1,type:{name:"string | null | undefined"}},personalCouponId:{defaultValue:null,description:"",name:"personalCouponId",required:!1,type:{name:"string | null | undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../pp-molecules/s-pp-payment-iframe/src/PpPaymentIFrame.tsx#PpPaymentIFrameComponent"]={docgenInfo:PpPaymentIFrameComponent.__docgenInfo,name:"PpPaymentIFrameComponent",path:"../../pp-molecules/s-pp-payment-iframe/src/PpPaymentIFrame.tsx#PpPaymentIFrameComponent"})}catch(__react_docgen_typescript_loader_error){}try{PpPaymentIFrame.displayName="PpPaymentIFrame",PpPaymentIFrame.__docgenInfo={description:"",displayName:"PpPaymentIFrame",props:{onMessage:{defaultValue:null,description:"",name:"onMessage",required:!1,type:{name:"((evt: MessageEvent<PostMessageType>) => void) | undefined"}},biData:{defaultValue:null,description:"",name:"biData",required:!1,type:{name:"BiDataOverrides | undefined"}},setLoading:{defaultValue:null,description:"",name:"setLoading",required:!0,type:{name:"Dispatch<SetStateAction<boolean>>"}},kind:{defaultValue:null,description:"",name:"kind",required:!0,type:{name:"enum",value:[{value:'"payment"'},{value:'"change"'}]}},cartData:{defaultValue:null,description:"",name:"cartData",required:!1,type:{name:"PPDataStoreContextProps | CartDataFragment | undefined"}},steps:{defaultValue:null,description:"",name:"steps",required:!1,type:{name:"StepDataFragment[] | undefined"}},couponId:{defaultValue:null,description:"",name:"couponId",required:!1,type:{name:"string | null | undefined"}},personalCouponId:{defaultValue:null,description:"",name:"personalCouponId",required:!1,type:{name:"string | null | undefined"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../pp-molecules/s-pp-payment-iframe/src/PpPaymentIFrame.tsx#PpPaymentIFrame"]={docgenInfo:PpPaymentIFrame.__docgenInfo,name:"PpPaymentIFrame",path:"../../pp-molecules/s-pp-payment-iframe/src/PpPaymentIFrame.tsx#PpPaymentIFrame"})}catch(__react_docgen_typescript_loader_error){}const s_pp_payment_iframe_src=function PpPaymentIFrameWrapper(props){return(0,jsx_runtime.jsx)(s_no_ssr_src.Z,{children:(0,jsx_runtime.jsx)(PpPaymentIFrameComponent,_objectSpread({},props))})}},"../../pp-molecules/s-pp-secure-payment/src/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=__webpack_require__("../../pp-molecules/s-pp-secure-payment/src/PpSecurePayment.tsx").Z},"../../pp-utils/s-pp-build-promotions-link/src/getCommonParameters/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_getCommonParameters});var isFilledPpOffersStore=__webpack_require__("../../utils/s-type-predicates/src/isFilledPpOffersStore/index.ts");const src_getCommonParameters=function getCommonParameters(props){if(!(0,isFilledPpOffersStore.Z)(props))throw new Error("Offer not selected");const{productNumber,promotionNumber,saleCode,thankYouMailTemplate,approveDebtClaim,contentId}=props,optionalParams={utmCampaign:props.utmCampaign,utmContent:props.utmContent,utmMedium:props.utmMedium,utmSource:props.utmSource,couponId:props.couponId,personalCouponId:props.personalCouponId},params=new URLSearchParams({contentId,productId:productNumber.toString(),saleCode:saleCode.toString(),promotionNumber:promotionNumber.toString(),approveDebtClaim:String(!0===approveDebtClaim),thankYouEmailTemplate:thankYouMailTemplate,cgtype:"heb"});return Object.keys(optionalParams).forEach((name=>{const value=optionalParams[name];value&¶ms.append(name,value.toString())})),params}},"../../pp-utils/s-pp-build-promotions-link/src/getPurchaseServiceLink/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_getPurchaseServiceLink});const src_getPurchaseServiceLink=function getPurchaseServiceLink(_ref){let{endpoint,msPurchaseUrl,searchParams}=_ref;if(!msPurchaseUrl)throw new Error("A URL for the purchase microservice is required");return`${msPurchaseUrl}/${endpoint}?${searchParams.toString()}`}},"../../pp-utils/s-pp-build-promotions-link/src/getUtmQueryParameters/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_getUtmQueryParameters});var discardNullableValues=__webpack_require__("../../utils/s-common-utils/src/discardNullableValues/index.ts");const src_getUtmQueryParameters=function getUtmQueryParameters(query){const{htm_source,htm_medium,htm_campaign,htm_content,utm_source,utm_medium,utm_campaign,utm_content}=query;return(0,discardNullableValues.Z)({utmCampaign:htm_campaign||utm_campaign,utmContent:htm_content||utm_content,utmMedium:htm_medium||utm_medium,utmSource:htm_source||utm_source})}},"../../pp-utils/s-pp-routing-utils/src/generatePath/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_generatePath});var defineProperty=__webpack_require__("../../../node_modules/.pnpm/@[email protected]/node_modules/@babel/runtime/helpers/esm/defineProperty.js");function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){(0,defineProperty.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}const src_generatePath=function generatePath(_ref){let{nextStepName,asPath,searchParams,currentQueryParams,ignoreCurrentSearchParams=!1,extendQueryParams={}}=_ref;const[,queryPartFromPath]=asPath.split(/\?(.+)/),extendSearchParams=null==searchParams?void 0:searchParams.toString(),segmentPath=currentQueryParams.pathSegment?`/${currentQueryParams.pathSegment}`:"";return{asPath:`${segmentPath}/${nextStepName}${queryPartFromPath&&!ignoreCurrentSearchParams?`?${queryPartFromPath}${extendSearchParams?`&${extendSearchParams}`:""}`:extendSearchParams?`?${extendSearchParams}`:""}`,pathName:{pathname:`${segmentPath}/${nextStepName}`,query:_objectSpread(_objectSpread({},currentQueryParams),extendQueryParams)}}}},"../../pp-utils/s-pp-routing-utils/src/getCurrentStep/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_getCurrentStep});const src_getCurrentStep=function getCurrentStep(currentStepName,steps){if(!currentStepName||"string"!=typeof currentStepName)throw new Error("Step name isn't valid");if(null==steps||!steps.length)throw new Error("Steps is required array");const currentStepIndex=steps.findIndex((step=>step.name===currentStepName));if(currentStepIndex<0)throw new Error("Invalid current step");return{currentStep:steps[currentStepIndex],currentStepIndex}}},"../../pp-utils/s-pp-routing-utils/src/getNextStep/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_getNextStep});var getCurrentStep=__webpack_require__("../../pp-utils/s-pp-routing-utils/src/getCurrentStep/index.ts");const src_getNextStep=function getNextStep(currentStep,steps){const{currentStepIndex}=(0,getCurrentStep.Z)(currentStep,steps),nextStepIndex=currentStepIndex+1;if(nextStepIndex>steps.length-1)throw new Error("Invalid next step");return{nextStep:steps[nextStepIndex],nextStepIndex}}},"../../utils/s-atoms/src/cookie/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>cookie});var _window,cookieToMap=__webpack_require__("../../utils/s-cookie-utils/src/cookieToMap/index.ts"),vanilla=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/jotai/esm/vanilla.mjs"),react=__webpack_require__("../../../node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/jotai/esm/react.mjs");const baseCookieAtom=(0,vanilla.cn)({});baseCookieAtom.debugPrivate=!0;const cookieAtom=(0,vanilla.cn)((get=>get(baseCookieAtom)),((_get,set,action)=>{set(baseCookieAtom,cookieDispenserFactory("undefined"==typeof window?action:document.cookie))}));function cookieDispenserFactory(cookie){const cookieMap=(0,cookieToMap.Z)(cookie,!0),{ppResponseMessage,userDetails}=cookieMap;return{ppResponseMessage,userDetails}}function useCookie(){return(0,react.KO)(cookieAtom)}cookieAtom.debugLabel="cookie","undefined"==typeof window||null!==(_window=window)&&void 0!==_window&&null!==(_window=_window.__NEXT_DATA__)&&void 0!==_window&&null!==(_window=_window.props)&&void 0!==_window&&null!==(_window=_window.pageProps)&&void 0!==_window&&_window.cookie||(cookieAtom.onMount=setAtom=>{setAtom(document.cookie)}),useCookie.cookieDispenserFactory=cookieDispenserFactory;const cookie=useCookie},"../../utils/s-type-predicates/src/isFilledPpOffersStore/index.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>src_isFilledPpOffersStore});const keysMap={periodCalc:!0,prices:!0,productNumber:!0,promotionNumber:!0,saleCode:!0,thankYouMailTemplate:!0,contentId:!0,paymentType:!0,offerType:!0};const src_isFilledPpOffersStore=function isFilledPpOffersStore(store){if(!(store instanceof Object))return!1;for(const key of Object.keys(keysMap))if(!(key in store))return!1;return!0}}}]);