"use strict";(self.webpackChunkapp_container=self.webpackChunkapp_container||[]).push([[7185],{7185:(t,e,i)=>{i.a(t,(async(t,n)=>{try{i.r(e),i.d(e,{IOSPrompt:()=>b});const{useCallback:t,useEffect:o,useState:l}=await i.e(4914).then(i.t.bind(i,4914,23)).then((t=>({useEffect:t.useEffect,useState:t.useState,useCallback:t.useCallback}))),a=await i.e(4214).then(i.bind(i,4214)).then((t=>t.checkUserSubscribed)),d=await i.e(5906).then(i.bind(i,5906)).then((t=>t.requestNotificationPermission)),s=await i.e(5605).then(i.t.bind(i,5605,23)).then((t=>t.GlobalStore)),u=await i.e(8330).then(i.t.bind(i,8330,23)).then((t=>t.useSelector)),c=await i.e(1139).then(i.bind(i,1139)).then((t=>t.LinkUser)),r=await i.e(2097).then(i.bind(i,2097)).then((t=>t.SubscribeandLink)),p=await i.e(4914).then(i.t.bind(i,4914,23)).then((t=>t.default)),{SetLocalStorage:m,GetLocalStorage:h}=await i.e(4326).then(i.bind(i,4326)).then((t=>({SetLocalStorage:t.SetLocalStorage,GetLocalStorage:t.GetLocalStorage}))),{API:w}=await i.e(118).then(i.bind(i,118)).then((t=>t)),v=await i.e(5556).then(i.bind(i,3175)).then((t=>t.timeDifference)),b=e=>{let{browserOnClick:i}=e;const[n,b]=l(!1),f=u((t=>t.storeFrontContainer.notificationJWTToken)),_=s.Get()._globalActions.Helpers[0].IsIOSDevice,[g,S]=l(!1),[k,C]=l(!0),[y,L]=l(null),N=window.UnoDuoComponent("NotificationCustomPrompt"),T=window.UnoDuoComponent("WidgetIOSCustomPrompt"),x=()=>{S(!1)},D=()=>{C(!1)},E=t((t=>{setTimeout((()=>{d(w,h,m,f)}),[null!=t?t:0])}),[f]),P=()=>{var t,e,i;x(),D(),"custom"!==(null==y?void 0:y.prompt_type)?E(1e3*(null!==(t=window.matchMedia("(max-width: 767px)"))&&void 0!==t&&t.matches?null!==(e=null==y?void 0:y.timing_gap_mobile)&&void 0!==e?e:0:null!==(i=null==y?void 0:y.timing_gap_desktop)&&void 0!==i?i:0)):E(0)};return o((()=>{!y&&f&&w.notification.promptData(f).then((t=>{"custom"!==(null==t?void 0:t.prompt_type)&&"ios_prompt"!==(null==t?void 0:t.prompt_type)&&"default"!==(null==t?void 0:t.prompt_type)||L(t)}))}),[y,f]),o((()=>{f&&a(h).then((t=>{if(!t&&"Notification"in window&&"granted"!==Notification.permission&&"denied"!==Notification.permission){if(y&&null!=y&&y.is_push_enabled){const t=y;if("default"===(null==t?void 0:t.prompt_type)&&!n){const e=()=>{var e,i,n;const o=h("FlitsCodeLoadTime"),l=1e3*(null!==(e=window.matchMedia("(max-width: 767px)"))&&void 0!==e&&e.matches?null!==(i=null==t?void 0:t.timing_gap_mobile)&&void 0!==i?i:0:null!==(n=null==t?void 0:t.timing_gap_desktop)&&void 0!==n?n:0)-1e3*v(o);h("FlitsFirstClick")||(E(l<0?0:l),m("FlitsFirstClick",(new Date).getTime())),b(!0)};i?window.addEventListener("FirstClickedOnBrowser",n?null:e):e()}var e,o,l;"custom"===(null==t?void 0:t.prompt_type)&&(L(t),setTimeout((()=>{m("NotificationPrompt",(new Date).getTime()),S(!0)}),[1e3*(null!==(e=window.matchMedia("(max-width: 767px)"))&&void 0!==e&&e.matches?null!==(o=null==t?void 0:t.timing_gap_mobile)&&void 0!==o?o:0:null!==(l=null==t?void 0:t.timing_gap_desktop)&&void 0!==l?l:0)])),"ios_prompt"===(null==t?void 0:t.prompt_type)&&(m("NotificationPrompt",(new Date).getTime()),E(0))}}else{var a,d;if(""!==(null===(a=window)||void 0===a||null===(a=a.flitsThemeAppExtensionObjects)||void 0===a||null===(a=a.customer)||void 0===a?void 0:a.customer_id)&&"-1"!==(null===(d=window)||void 0===d||null===(d=d.flitsThemeAppExtensionObjects)||void 0===d||null===(d=d.customer)||void 0===d?void 0:d.customer_id)){var s;const t=h("Notification"),e=t?null!==(s=t[""])&&void 0!==s?s:t[-1]:null;e&&c(m,t,w,e,f)}!t&&"Notification"in window&&"granted"===Notification.permission&&r(h,m,w,f)}})).catch((t=>{}))}),[f,i,y,n,E]),y&&_?!1===window.navigator.standalone&&null!=y&&y.ios_enabled&&k&&null!=y&&y.is_push_enabled?p.createElement(T,{openModal:k,closeModal:D,data:y,handleSubscribe:P}):g&&"true"!==h("isCustomPromptAlreadyAllowd")&&p.createElement(N,{openModal:g,closeModal:x,data:y,handleSubscribe:P}):null};n()}catch(t){n(t)}}),1)}}]);