@ikas/storefront-next 4.16.2 → 4.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ext/tslib/tslib.es6.js +1 -1
- package/build/provider/page-data-next.d.ts +2 -0
- package/build/provider/page-data-next.js +1 -1
- package/build/utils/redirect-guard/hosts.d.ts +69 -0
- package/build/utils/redirect-guard/hosts.js +1 -0
- package/build/utils/redirect-guard/index.d.ts +7 -0
- package/build/utils/redirect-guard/index.js +1 -0
- package/build/utils/redirect-guard/runtime.d.ts +50 -0
- package/build/utils/redirect-guard/runtime.js +1 -0
- package/build/utils/redirect-guard/script.d.ts +14 -0
- package/build/utils/redirect-guard/script.js +1 -0
- package/build/utils/redirect-guard/settings.d.ts +16 -0
- package/build/utils/redirect-guard/settings.js +1 -0
- package/build/utils/redirect-guard/texts.d.ts +12 -0
- package/build/utils/redirect-guard/texts.js +1 -0
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,a){function c(e){try{i(r.next(e))}catch(e){a(e)}}function l(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,l)}i((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,r=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function o(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}export{e as __assign,t as __awaiter,n as __generator,o as __makeTemplateObject,r as __spreadArray};
|
|
@@ -14,6 +14,7 @@ export declare class IkasNextPageDataProvider {
|
|
|
14
14
|
static getProdSettings(locale: string): Promise<SettingsData | null>;
|
|
15
15
|
static getSettings(locale: string): Promise<SettingsData | null>;
|
|
16
16
|
static setStorefrontConfig(settings: SettingsData): Promise<void>;
|
|
17
|
+
static applyStorefrontConfig(settings: SettingsData, isStandalone?: boolean): void;
|
|
17
18
|
static setTranslations(settings: SettingsData, componentIds: string[], pageType?: IkasThemeJsonPageType, isEditor?: boolean, contextLocale?: string): Promise<void>;
|
|
18
19
|
static getExtraProps(settings: SettingsData, provider: IkasPageDataProvider, pageType?: IkasThemeJsonPageType): Promise<Record<string, any>>;
|
|
19
20
|
static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
|
|
@@ -117,4 +118,5 @@ export declare type IkasCheckoutCustomizationProps = {
|
|
|
117
118
|
secondaryButtonBgColor?: string;
|
|
118
119
|
secondaryButtonTextColor?: string;
|
|
119
120
|
secondaryButtonBorderColor?: string;
|
|
121
|
+
loyaltyIconColor?: string;
|
|
120
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__spreadArray as o,__assign as r}from'./../ext/tslib/tslib.es6.js';import n from"fs";import s from"next/config.js";import{IkasThemeJsonPageType as i}from"@ikas/storefront-models";import{IkasPageDataProvider as a}from"@ikas/storefront-providers";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{getStorefrontSettings as c,listMerchantSettings as u,setAPIClientConfig as p,listCheckoutSettings as g}from"@ikas/storefront-api";import{getGoogleFontHref as d}from"../utils/google-fonts.js";import{I18NFileReader as f}from"../utils/i18n.js";import{createFile as m,deleteDirContent as h}from"../utils/fs.js";var S=function(){function S(){}return S.readLocalTheme=function(){return new Promise((function(e,t){n.readFile("./src/theme.json",{flag:"a+"},(function(o,r){if(o)return t(o);var n=r.length?JSON.parse(r.toString()):{};e(n)}))}))},S.readSettingsFile=function(){return new Promise((function(e){var t=s().serverRuntimeConfig.SETTINGS;n.readFile(t,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var r=o.length?JSON.parse(o.toString()):{};e(r)}))}))},S.cacheLocalSettingsFile=function(o){return e(this,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h(e=".ikas")];case 1:return t.sent(),r="settings-".concat(this.startTime,".json"),[4,m(e,r,JSON.stringify(o,null,2))];case 2:return t.sent(),[2]}}))}))},S.readLocalSettingsFile=function(){try{var e=n.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},S.getLocalSettings=function(o){return e(this,void 0,void 0,(function(){var e,r,n,s,i,a,l,u,p,g;return t(this,(function(t){switch(t.label){case 0:return[4,S.readLocalSettingsFile()];case 1:return(e=t.sent())?[3,4]:[4,c()];case 2:return(r=t.sent()).isSuccess&&r.data?(e=r.data,[4,this.cacheLocalSettingsFile(e)]):(console.error("Storefront settings fetch failed!"),console.error(r),[2,null]);case 3:t.sent(),t.label=4;case 4:return n=e.storefront,s=e.salesChannel,i=[],a=e.productBackInStockSettings?{customerLoginRequired:e.productBackInStockSettings.customerLoginRequired}:null,l=e.customerReviewSettings?{customerLoginRequired:e.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:e.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,S.readLocalTheme()];case 5:return u=t.sent(),p=S.createColorScript(u.settings),[4,S.createFontScript(u.settings)];case 6:return g=t.sent(),p&&i.push(p),g&&i.push(g),[2,{storefront:n,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:n.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:u},salesChannel:s,routing:n.routings.length?n.routings.find((function(e){return e.locale===o||e.id===o}))||n.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:u.settings.favicon,stockPreference:u.settings.stockPreference,storefrontJSScripts:i,highPriorityStoreFrontJSScripts:[],domain:"localhost:3333",productBackInStockSettings:a,customerReviewSettings:l,merchantSettings:e.merchantSettings,customerSettings:e.customerSettings,storefrontPopups:e.storefrontPopups,loyaltyPrograms:e.loyaltyPrograms}]}}))}))},S.getProdSettings=function(o){return e(this,void 0,void 0,(function(){var r=this;return t(this,(function(s){return[2,new Promise((function(s){return e(r,void 0,void 0,(function(){var r,i,a,l,c,p,g,d,f,m,h,v,C;return t(this,(function(y){switch(y.label){case 0:return[4,S.readSettingsFile()];case 1:return(r=y.sent())&&r.localizationMap?(i=r.storefront,a=r.salesChannel,l=r.localizationMap,c=r.storefrontJSScripts||[],p=r.highPriorityStoreFrontJSScripts||[],g=r.domain,d=r.productBackInStockSettings?{customerLoginRequired:r.productBackInStockSettings.customerLoginRequired}:null,f=r.customerReviewSettings?{customerLoginRequired:r.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:r.customerReviewSettings.customerPurchaseRequired||!1}:null,(m=r.merchantSettings)?[3,3]:[4,u({})]):[2,s(null)];case 2:if(!(h=y.sent()).isSuccess||!h.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,s(null)];m=h.data,y.label=3;case 3:return m&&(m.address=null,delete m.merchantAddress),v=l[o],C=i.routings.find((function(e){return e.id===o||e.path===o})),v&&C?(n.readFile(v,{flag:"a+"},(function(o,n){return e(this,void 0,void 0,(function(){var e,l,u,h,v,y,P;return t(this,(function(t){switch(t.label){case 0:return o?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(o),[2,s(null)]):(e=n.length?JSON.parse(n.toString()):{},u=(l=e).themeJson.settings.favicon,h=l.themeJson.settings.stockPreference,l.themeJson.settings?(v=S.createColorScript(l.themeJson.settings),[4,S.createFontScript(l.themeJson.settings)]):[3,2]);case 1:y=t.sent(),v&&c.push(v),y&&c.push(y),t.label=2;case 2:return P=r.customerSettings,s({storefront:i,themeLocalization:l,salesChannel:a,routing:C,favicon:u,stockPreference:h,storefrontJSScripts:c,highPriorityStoreFrontJSScripts:p,domain:g,productBackInStockSettings:d,customerReviewSettings:f,merchantSettings:m,customerSettings:P,custom:r.custom,storefrontPopups:r.storefrontPopups,loyaltyPrograms:r.loyaltyPrograms,payWithIkasUrl:r.payWithIkasUrl}),[2]}}))}))})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,s(null)])}}))}))}))]}))}))},S.getSettings=function(o){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(o)]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,this.getProdSettings(o)]}}))}))},S.setStorefrontConfig=function(o){var r,n;return e(this,void 0,void 0,(function(){var e,s,i,a,c,u,g,d,f,m,h,S,v,C,y,P;return t(this,(function(t){return e=o.storefront,s=o.salesChannel,i=o.routing,a=o.favicon,c=o.stockPreference,u=o.storefrontJSScripts,g=o.highPriorityStoreFrontJSScripts,d=o.domain,f=o.productBackInStockSettings,m=o.customerReviewSettings,h=o.merchantSettings,S=o.customerSettings,v=o.custom,C=o.storefrontPopups,y=o.loyaltyPrograms,P=o.payWithIkasUrl,l.init({apiUrl:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:e.id,storefrontRoutingId:i.id,storefrontThemeId:e.mainStorefrontThemeId,storefrontB2BSettings:e.b2bSettings||void 0,storefrontType:e.type,salesChannelId:e.salesChannelId,priceListId:i.priceListId||void 0,stockLocationIds:null===(r=s.stockLocations)||void 0===r?void 0:r.map((function(e){return e.id})),routings:e.routings,paymentGateways:s.paymentGateways||[],gtmId:e.gtmId||void 0,fbpId:e.fbpId||void 0,analytics4Id:e.analytics4Id||void 0,universalAnalyticsId:e.universalAnalyticsId||void 0,tiktokPixelId:e.tiktokPixelId||void 0,openAiPixelId:e.openAiPixelId||void 0,favicon:a||null,pickUpStockLocationIds:e.pickUpStockLocationIds&&e.pickUpStockLocationIds.length?e.pickUpStockLocationIds:null,stockPreference:c||null,storefrontJSScripts:u||[],highPriorityStoreFrontJSScripts:g||[],domain:d,productBackInStockSettings:f,customerReviewSettings:m,merchantSettings:h,customerSettings:S,metaTemplates:e.metaTemplates||null,custom:v||null,indexPageSeoSettings:e.indexPageSeoSettings,storefrontPopups:C,loyaltyPrograms:y,payWithIkasUrl:P,milesSmilesSettings:(null===(n=e.socialLoginSettings)||void 0===n?void 0:n.find((function(e){return"miles_smiles"===e.provider})))||null}),p(),[2]}))}))},S.setTranslations=function(r,n,a,c,u){return e(this,void 0,void 0,(function(){var e,p,g,d,m,h,S,v;return t(this,(function(t){switch(t.label){case 0:return e=s().serverRuntimeConfig,p=r.routing,g="local"===process.env.NEXT_PUBLIC_ENV,d=r.themeLocalization.themeJson.components.filter((function(e){return c||n.includes(e.id)})),m=o(["common"],d.map((function(e){return e.dir})),!0),(a===i.CHECKOUT||c)&&m.push("checkout-page"),h=e.nextI18nConf,S=g&&u?u:p.locale,[4,new f(S,m,g?void 0:h.localePath).read()];case 1:return v=t.sent(),l.init({translations:v}),[2]}}))}))},S.getExtraProps=function(o,r,n){var s,a,l,c,u,p,d,f,m,h,S,v,C,y,P,I,L,T,w,k,O,B,R,b;return e(this,void 0,void 0,(function(){var e,V,E,F,U;return t(this,(function(t){switch(t.label){case 0:return e={},V=o.themeLocalization,n!==i.CHECKOUT?[3,2]:(E=null===(s=r.page)||void 0===s?void 0:s.components[0])?[4,g({})]:[3,2];case 1:(F=t.sent()).isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(F.graphQLErrors),console.error(F.errorCodes)),U={logo:null!==(a=E.propValues.logo)&&void 0!==a?a:null,showTax:null===(l=E.propValues.showTax)||void 0===l||l,showLoyaltyPoints:null!==(c=E.propValues.showLoyaltyPoints)&&void 0!==c&&c,showCampaignOffersDesign:null!==(u=E.propValues.showCampaignOffersDesign)&&void 0!==u&&u,showCampaignIsBiggerImage:null!==(p=E.propValues.showCampaignIsBiggerImage)&&void 0!==p&&p,campaignOfferIsSmallDesign:null!==(d=E.propValues.campaignOfferIsSmallDesign)&&void 0!==d&&d,showCampaignHideDiscountBadge:null!==(f=E.propValues.showCampaignHideDiscountBadge)&&void 0!==f&&f,campaignOfferCountdownStyleIsLine:null!==(m=E.propValues.campaignOfferCountdownStyleIsLine)&&void 0!==m&&m,campaignOfferCountdownStyleIsLineSuccessPage:null!==(h=E.propValues.campaignOfferCountdownStyleIsLineSuccessPage)&&void 0!==h&&h,campaignOffersEnableMiddlePhase:null!==(S=E.propValues.campaignOffersEnableMiddlePhase)&&void 0!==S&&S,campaignOffersTitleColor:null!==(v=E.propValues.campaignOffersTitleColor)&&void 0!==v?v:null,campaignOffersDescriptionColor:null!==(C=E.propValues.campaignOffersDescriptionColor)&&void 0!==C?C:null,campaignOffersContainerBgColor:null!==(y=E.propValues.campaignOffersContainerBgColor)&&void 0!==y?y:null,campaignOffersDiscountPercentageColor:null!==(P=E.propValues.campaignOffersDiscountPercentageColor)&&void 0!==P?P:null,campaignOffersDiscountPercentageBgColor:null!==(I=E.propValues.campaignOffersDiscountPercentageBgColor)&&void 0!==I?I:null,campaignOffersCountdownTextColor:null!==(L=E.propValues.campaignOffersCountdownTextColor)&&void 0!==L?L:null,campaignOffersCountdownTimeColor:null!==(T=E.propValues.campaignOffersCountdownTimeColor)&&void 0!==T?T:null,campaignOffersCountdownBgColor:null!==(w=E.propValues.campaignOffersCountdownBgColor)&&void 0!==w?w:null,campaignOffersMiddlePhaseOverlayColor:null!==(k=E.propValues.campaignOffersMiddlePhaseOverlayColor)&&void 0!==k?k:null,buttonBgColor:E.propValues.buttonBgColor,buttonTextColor:E.propValues.buttonTextColor,buttonDisabledBgColor:E.propValues.buttonDisabledBgColor,buttonDisabledTextColor:E.propValues.buttonDisabledTextColor,primaryTextColor:E.propValues.primaryTextColor,secondaryTextColor:E.propValues.secondaryTextColor,primaryBgColor:E.propValues.primaryBgColor,secondaryBgColor:E.propValues.secondaryBgColor,borderColor:E.propValues.borderColor,cardBgColor:E.propValues.cardBgColor,errorColor:E.propValues.errorColor,errorLightColor:E.propValues.errorLightColor,warningColor:E.propValues.warningColor,warningLightColor:E.propValues.warningLightColor,successColor:E.propValues.successColor,successLightColor:E.propValues.successLightColor,secondaryButtonBgColor:null!==(O=E.propValues.secondaryButtonBgColor)&&void 0!==O?O:null,secondaryButtonTextColor:null!==(B=E.propValues.secondaryButtonTextColor)&&void 0!==B?B:null,secondaryButtonBorderColor:null!==(R=E.propValues.secondaryButtonBorderColor)&&void 0!==R?R:null},e.customizationProps=U,e.returnPolicy=V.returnPolicy,e.privacyPolicy=V.privacyPolicy,e.termsOfService=V.termsOfService,e.imprint=V.imprint,e.shippingPolicy=V.shippingPolicy,e.checkoutSettings=(null===(b=null==F?void 0:F.data)||void 0===b?void 0:b.length)?F.data[0]:null,t.label=2;case 2:return[2,e]}}))}))},S.getPageData=function(o,n,s,i,c){var u;return e(this,void 0,void 0,(function(){var e,g,d,f,m,h,v,C;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,g=!e&&c,l.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),p(),g?[3,7]:(d=o.locale)?[4,S.getSettings(d)]:[2,{props:{},notFound:!0}];case 1:return(f=t.sent())&&f.storefront.mainStorefrontThemeId&&f.storefront.salesChannelId?[4,this.setStorefrontConfig(f)]:[2,{props:{},notFound:!0}];case 2:return t.sent(),m=f.themeLocalization,(h=new a(m.themeJson,o.params,s,f.merchantSettings)).possiblePageTypes=i||(s?[s]:[]),c?[3,4]:[4,h.getPageData()];case 3:if(t.sent(),!h.page)return[2,{props:{},notFound:!0}];t.label=4;case 4:return v=c?h.theme.components.map((function(e){return e.id})):(null===(u=h.page)||void 0===u?void 0:u.components.map((function(e){return e.componentId})))||[],[4,this.setTranslations(f,v,s,c,d)];case 5:return t.sent(),[4,this.getExtraProps(f,h,s)];case 6:return C=t.sent(),n?[2,{props:r(r({},h.nextPageData.props),C)}]:[2,{props:r(r({},h.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},S.getStaticProps=function(o,r,n,s){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,S.getPageData(o,!1,r,n,s)];case 1:return[2,e.sent()]}}))}))},S.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,S.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},S.createColorScript=function(e){if(e.colors)return"<script>".concat(e.colors.map((function(e){return'document.documentElement.style.setProperty("'.concat(e.key,'","').concat(e.color,'");')})).join("\r\n"),"<\/script> \n ")},S.createFontScript=function(o){return e(this,void 0,void 0,(function(){var e,r,n;return t(this,(function(t){switch(t.label){case 0:return(e=d(o.fontFamily))?[4,fetch(e,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}})]:[3,3];case 1:return[4,t.sent().text()];case 2:return r=t.sent(),n=r.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(n,"\n\n body { \n font-family: '").concat(o.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},S.startTime=Date.now(),S}();export{S as IkasNextPageDataProvider};
|
|
1
|
+
import{__awaiter as e,__generator as t,__spreadArray as o,__assign as r}from'./../ext/tslib/tslib.es6.js';import n from"fs";import i from"next/config.js";import{IkasThemeJsonPageType as s}from"@ikas/storefront-models";import{IkasPageDataProvider as a}from"@ikas/storefront-providers";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{setAPIClientConfig as c,getStorefrontSettings as u,listMerchantSettings as p,listCheckoutSettings as g}from"@ikas/storefront-api";import{getGoogleFontHref as d}from"../utils/google-fonts.js";import{I18NFileReader as f}from"../utils/i18n.js";import{createFile as m,deleteDirContent as h}from"../utils/fs.js";import{getRedirectGuardScript as S}from"../utils/redirect-guard/index.js";var v=function(){function v(){}return v.readLocalTheme=function(){return new Promise((function(e,t){n.readFile("./src/theme.json",{flag:"a+"},(function(o,r){if(o)return t(o);var n=r.length?JSON.parse(r.toString()):{};e(n)}))}))},v.readSettingsFile=function(){return new Promise((function(e){var t=i().serverRuntimeConfig.SETTINGS;n.readFile(t,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var r=o.length?JSON.parse(o.toString()):{};e(r)}))}))},v.cacheLocalSettingsFile=function(o){return e(this,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h(e=".ikas")];case 1:return t.sent(),r="settings-".concat(this.startTime,".json"),[4,m(e,r,JSON.stringify(o,null,2))];case 2:return t.sent(),[2]}}))}))},v.readLocalSettingsFile=function(){try{var e=n.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},v.getLocalSettings=function(o){return e(this,void 0,void 0,(function(){var e,r,n,i,s,a,l,c,p,g;return t(this,(function(t){switch(t.label){case 0:return[4,v.readLocalSettingsFile()];case 1:return(e=t.sent())?[3,4]:[4,u()];case 2:return(r=t.sent()).isSuccess&&r.data?(e=r.data,[4,this.cacheLocalSettingsFile(e)]):(console.error("Storefront settings fetch failed!"),console.error(r),[2,null]);case 3:t.sent(),t.label=4;case 4:return n=e.storefront,i=e.salesChannel,s=[],a=e.productBackInStockSettings?{customerLoginRequired:e.productBackInStockSettings.customerLoginRequired}:null,l=e.customerReviewSettings?{customerLoginRequired:e.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:e.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,v.readLocalTheme()];case 5:return c=t.sent(),p=v.createColorScript(c.settings),[4,v.createFontScript(c.settings)];case 6:return g=t.sent(),p&&s.push(p),g&&s.push(g),[2,{storefront:n,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:n.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:c},salesChannel:i,routing:n.routings.length?n.routings.find((function(e){return e.locale===o||e.id===o}))||n.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:c.settings.favicon,stockPreference:c.settings.stockPreference,storefrontJSScripts:s,highPriorityStoreFrontJSScripts:[],domain:"localhost:3333",productBackInStockSettings:a,customerReviewSettings:l,merchantSettings:e.merchantSettings,customerSettings:e.customerSettings,storefrontPopups:e.storefrontPopups,loyaltyPrograms:e.loyaltyPrograms}]}}))}))},v.getProdSettings=function(o){return e(this,void 0,void 0,(function(){var r=this;return t(this,(function(i){return[2,new Promise((function(i){return e(r,void 0,void 0,(function(){var r,s,a,l,c,u,g,d,f,m,h,S,C;return t(this,(function(y){switch(y.label){case 0:return[4,v.readSettingsFile()];case 1:return(r=y.sent())&&r.localizationMap?(s=r.storefront,a=r.salesChannel,l=r.localizationMap,c=r.storefrontJSScripts||[],u=r.highPriorityStoreFrontJSScripts||[],g=r.domain,d=r.productBackInStockSettings?{customerLoginRequired:r.productBackInStockSettings.customerLoginRequired}:null,f=r.customerReviewSettings?{customerLoginRequired:r.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:r.customerReviewSettings.customerPurchaseRequired||!1}:null,(m=r.merchantSettings)?[3,3]:[4,p({})]):[2,i(null)];case 2:if(!(h=y.sent()).isSuccess||!h.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,i(null)];m=h.data,y.label=3;case 3:return m&&(m.address=null,delete m.merchantAddress),S=l[o],C=s.routings.find((function(e){return e.id===o||e.path===o})),S&&C?(n.readFile(S,{flag:"a+"},(function(o,n){return e(this,void 0,void 0,(function(){var e,l,p,h,S,y,I;return t(this,(function(t){switch(t.label){case 0:return o?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(o),[2,i(null)]):(e=n.length?JSON.parse(n.toString()):{},p=(l=e).themeJson.settings.favicon,h=l.themeJson.settings.stockPreference,l.themeJson.settings?(S=v.createColorScript(l.themeJson.settings),[4,v.createFontScript(l.themeJson.settings)]):[3,2]);case 1:y=t.sent(),S&&c.push(S),y&&c.push(y),t.label=2;case 2:return I=r.customerSettings,i({storefront:s,themeLocalization:l,salesChannel:a,routing:C,favicon:p,stockPreference:h,storefrontJSScripts:c,highPriorityStoreFrontJSScripts:u,domain:g,productBackInStockSettings:d,customerReviewSettings:f,merchantSettings:m,customerSettings:I,custom:r.custom,storefrontPopups:r.storefrontPopups,loyaltyPrograms:r.loyaltyPrograms,payWithIkasUrl:r.payWithIkasUrl}),[2]}}))}))})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,i(null)])}}))}))}))]}))}))},v.getSettings=function(o){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(o)]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,this.getProdSettings(o)]}}))}))},v.setStorefrontConfig=function(o){return e(this,void 0,void 0,(function(){return t(this,(function(e){return v.applyStorefrontConfig(o,!1),[2]}))}))},v.applyStorefrontConfig=function(e,t){var o,r;void 0===t&&(t=!1);var n=e.storefront,i=e.salesChannel,s=e.routing,a=e.favicon,u=e.stockPreference,p=e.storefrontJSScripts,g=e.highPriorityStoreFrontJSScripts,d=e.domain,f=e.productBackInStockSettings,m=e.customerReviewSettings,h=e.merchantSettings,v=e.customerSettings,C=e.custom,y=e.storefrontPopups,I=e.loyaltyPrograms,P=e.payWithIkasUrl;l.init({apiUrl:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:n.id,storefrontRoutingId:s.id,storefrontThemeId:n.mainStorefrontThemeId,storefrontB2BSettings:n.b2bSettings||void 0,storefrontType:n.type,salesChannelId:n.salesChannelId,priceListId:s.priceListId||void 0,stockLocationIds:null===(o=i.stockLocations)||void 0===o?void 0:o.map((function(e){return e.id})),routings:n.routings,paymentGateways:i.paymentGateways||[],gtmId:n.gtmId||void 0,fbpId:n.fbpId||void 0,analytics4Id:n.analytics4Id||void 0,universalAnalyticsId:n.universalAnalyticsId||void 0,tiktokPixelId:n.tiktokPixelId||void 0,openAiPixelId:n.openAiPixelId||void 0,favicon:a||null,pickUpStockLocationIds:n.pickUpStockLocationIds&&n.pickUpStockLocationIds.length?n.pickUpStockLocationIds:null,stockPreference:u||null,storefrontJSScripts:p||[],highPriorityStoreFrontJSScripts:g||[],navigationWarningScript:t?void 0:S(e),domain:d,productBackInStockSettings:f,customerReviewSettings:m,merchantSettings:h,customerSettings:v,metaTemplates:n.metaTemplates||null,custom:C||null,indexPageSeoSettings:n.indexPageSeoSettings,storefrontPopups:y,loyaltyPrograms:I,payWithIkasUrl:P,milesSmilesSettings:(null===(r=n.socialLoginSettings)||void 0===r?void 0:r.find((function(e){return"miles_smiles"===e.provider})))||null}),c()},v.setTranslations=function(r,n,a,c,u){return e(this,void 0,void 0,(function(){var e,p,g,d,m,h,S,v;return t(this,(function(t){switch(t.label){case 0:return e=i().serverRuntimeConfig,p=r.routing,g="local"===process.env.NEXT_PUBLIC_ENV,d=r.themeLocalization.themeJson.components.filter((function(e){return c||n.includes(e.id)})),m=o(["common"],d.map((function(e){return e.dir})),!0),(a===s.CHECKOUT||c)&&m.push("checkout-page"),h=e.nextI18nConf,S=g&&u?u:p.locale,[4,new f(S,m,g?void 0:h.localePath).read()];case 1:return v=t.sent(),l.init({translations:v}),[2]}}))}))},v.getExtraProps=function(o,r,n){var i,a,l,c,u,p,d,f,m,h,S,v,C,y,I,P,L,T,w,k,O,B,R,b,V;return e(this,void 0,void 0,(function(){var e,E,F,U,x;return t(this,(function(t){switch(t.label){case 0:return e={},E=o.themeLocalization,n!==s.CHECKOUT?[3,2]:(F=null===(i=r.page)||void 0===i?void 0:i.components[0])?[4,g({})]:[3,2];case 1:(U=t.sent()).isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(U.graphQLErrors),console.error(U.errorCodes)),x={logo:null!==(a=F.propValues.logo)&&void 0!==a?a:null,showTax:null===(l=F.propValues.showTax)||void 0===l||l,showLoyaltyPoints:null!==(c=F.propValues.showLoyaltyPoints)&&void 0!==c&&c,showCampaignOffersDesign:null!==(u=F.propValues.showCampaignOffersDesign)&&void 0!==u&&u,showCampaignIsBiggerImage:null!==(p=F.propValues.showCampaignIsBiggerImage)&&void 0!==p&&p,campaignOfferIsSmallDesign:null!==(d=F.propValues.campaignOfferIsSmallDesign)&&void 0!==d&&d,showCampaignHideDiscountBadge:null!==(f=F.propValues.showCampaignHideDiscountBadge)&&void 0!==f&&f,campaignOfferCountdownStyleIsLine:null!==(m=F.propValues.campaignOfferCountdownStyleIsLine)&&void 0!==m&&m,campaignOfferCountdownStyleIsLineSuccessPage:null!==(h=F.propValues.campaignOfferCountdownStyleIsLineSuccessPage)&&void 0!==h&&h,campaignOffersEnableMiddlePhase:null!==(S=F.propValues.campaignOffersEnableMiddlePhase)&&void 0!==S&&S,campaignOffersTitleColor:null!==(v=F.propValues.campaignOffersTitleColor)&&void 0!==v?v:null,campaignOffersDescriptionColor:null!==(C=F.propValues.campaignOffersDescriptionColor)&&void 0!==C?C:null,campaignOffersContainerBgColor:null!==(y=F.propValues.campaignOffersContainerBgColor)&&void 0!==y?y:null,campaignOffersDiscountPercentageColor:null!==(I=F.propValues.campaignOffersDiscountPercentageColor)&&void 0!==I?I:null,campaignOffersDiscountPercentageBgColor:null!==(P=F.propValues.campaignOffersDiscountPercentageBgColor)&&void 0!==P?P:null,campaignOffersCountdownTextColor:null!==(L=F.propValues.campaignOffersCountdownTextColor)&&void 0!==L?L:null,campaignOffersCountdownTimeColor:null!==(T=F.propValues.campaignOffersCountdownTimeColor)&&void 0!==T?T:null,campaignOffersCountdownBgColor:null!==(w=F.propValues.campaignOffersCountdownBgColor)&&void 0!==w?w:null,campaignOffersMiddlePhaseOverlayColor:null!==(k=F.propValues.campaignOffersMiddlePhaseOverlayColor)&&void 0!==k?k:null,buttonBgColor:F.propValues.buttonBgColor,buttonTextColor:F.propValues.buttonTextColor,buttonDisabledBgColor:F.propValues.buttonDisabledBgColor,buttonDisabledTextColor:F.propValues.buttonDisabledTextColor,primaryTextColor:F.propValues.primaryTextColor,secondaryTextColor:F.propValues.secondaryTextColor,primaryBgColor:F.propValues.primaryBgColor,secondaryBgColor:F.propValues.secondaryBgColor,borderColor:F.propValues.borderColor,cardBgColor:F.propValues.cardBgColor,errorColor:F.propValues.errorColor,errorLightColor:F.propValues.errorLightColor,warningColor:F.propValues.warningColor,warningLightColor:F.propValues.warningLightColor,successColor:F.propValues.successColor,successLightColor:F.propValues.successLightColor,secondaryButtonBgColor:null!==(O=F.propValues.secondaryButtonBgColor)&&void 0!==O?O:null,secondaryButtonTextColor:null!==(B=F.propValues.secondaryButtonTextColor)&&void 0!==B?B:null,secondaryButtonBorderColor:null!==(R=F.propValues.secondaryButtonBorderColor)&&void 0!==R?R:null,loyaltyIconColor:null!==(b=F.propValues.loyaltyIconColor)&&void 0!==b?b:null},e.customizationProps=x,e.returnPolicy=E.returnPolicy,e.privacyPolicy=E.privacyPolicy,e.termsOfService=E.termsOfService,e.imprint=E.imprint,e.shippingPolicy=E.shippingPolicy,e.checkoutSettings=(null===(V=null==U?void 0:U.data)||void 0===V?void 0:V.length)?U.data[0]:null,t.label=2;case 2:return[2,e]}}))}))},v.getPageData=function(o,n,i,s,u){var p;return e(this,void 0,void 0,(function(){var e,g,d,f,m,h,S,C;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,g=!e&&u,l.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),c(),g?[3,7]:(d=o.locale)?[4,v.getSettings(d)]:[2,{props:{},notFound:!0}];case 1:return(f=t.sent())&&f.storefront.mainStorefrontThemeId&&f.storefront.salesChannelId?[4,this.setStorefrontConfig(f)]:[2,{props:{},notFound:!0}];case 2:return t.sent(),m=f.themeLocalization,(h=new a(m.themeJson,o.params,i,f.merchantSettings)).possiblePageTypes=s||(i?[i]:[]),u?[3,4]:[4,h.getPageData()];case 3:if(t.sent(),!h.page)return[2,{props:{},notFound:!0}];t.label=4;case 4:return S=u?h.theme.components.map((function(e){return e.id})):(null===(p=h.page)||void 0===p?void 0:p.components.map((function(e){return e.componentId})))||[],[4,this.setTranslations(f,S,i,u,d)];case 5:return t.sent(),[4,this.getExtraProps(f,h,i)];case 6:return C=t.sent(),n?[2,{props:r(r({},h.nextPageData.props),C)}]:[2,{props:r(r({},h.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},v.getStaticProps=function(o,r,n,i){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!1,r,n,i)];case 1:return[2,e.sent()]}}))}))},v.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},v.createColorScript=function(e){if(e.colors)return"<script>".concat(e.colors.map((function(e){return'document.documentElement.style.setProperty("'.concat(e.key,'","').concat(e.color,'");')})).join("\r\n"),"<\/script> \n ")},v.createFontScript=function(o){return e(this,void 0,void 0,(function(){var e,r,n;return t(this,(function(t){switch(t.label){case 0:return(e=d(o.fontFamily))?[4,fetch(e,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}})]:[3,3];case 1:return[4,t.sent().text()];case 2:return r=t.sent(),n=r.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(n,"\n\n body { \n font-family: '").concat(o.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},v.startTime=Date.now(),v}();export{v as IkasNextPageDataProvider};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which hosts the navigation warning lets through without asking (FR-1077). Pure on purpose: the
|
|
3
|
+
* guard's `index.ts` reads the settings and the env and hands the values in, so tests import this
|
|
4
|
+
* file as it is.
|
|
5
|
+
*
|
|
6
|
+
* Two kinds of entry, the same two the backend accepts in `navigationWarningSettings.allowedHosts`
|
|
7
|
+
* — and the matching rule every storefront has to share:
|
|
8
|
+
* - `ornek.com` covers `ornek.com` and its `www.` twin (and `www.ornek.com` covers both too) —
|
|
9
|
+
* merchants type the bare name while their links point at `www.`.
|
|
10
|
+
* - `*.ornek.com` covers every subdomain under `ornek.com`, at any depth, but not `ornek.com`
|
|
11
|
+
* itself: a merchant who wants both adds both.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* ikas's starter list. It is not stored anywhere: every store gets it on top of its own
|
|
15
|
+
* `allowedHosts`, and a merchant cannot take an entry out — which is why it holds exact hosts
|
|
16
|
+
* only. A wildcard here would also allow what anyone can publish under the same domain (Google
|
|
17
|
+
* Sites and Forms, a link shim such as `l.facebook.com`, a payment link), and that is exactly
|
|
18
|
+
* where a hijacked script would send a shopper. Payment providers are left out for the same
|
|
19
|
+
* reason: on a Studio page payment happens in checkout, where the warning never runs.
|
|
20
|
+
*/
|
|
21
|
+
export declare const IKAS_DEFAULT_ALLOWED_HOSTS: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Where ikas's own social login sends the visitor (`socialLogin` in the storefront's customer
|
|
24
|
+
* store). ikas's own flow, so it is never warned — whatever the merchant's list says.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SOCIAL_LOGIN_HOSTS: readonly string[];
|
|
27
|
+
/** The longest host name DNS allows. */
|
|
28
|
+
export declare const MAX_HOST_LENGTH = 253;
|
|
29
|
+
export declare type HostRules = {
|
|
30
|
+
/** Hosts allowed exactly, `www.` twins included. */
|
|
31
|
+
exact: string[];
|
|
32
|
+
/** `*.` entries without the `*.`: every host below one is allowed, the host itself is not. */
|
|
33
|
+
suffix: string[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* One list entry, as a merchant types it or the backend sends it, in the form the browser compares
|
|
37
|
+
* against — or null when it is not a host at all. Goes through `URL` so an IDN becomes the punycode
|
|
38
|
+
* a destination's `hostname` carries, and a scheme, credentials, port, path or query falls away:
|
|
39
|
+
* `https://Örnek.com:8080/a` → `xn--rnek-4qa.com`, `*.Ornek.com.` → `*.ornek.com`. What the
|
|
40
|
+
* backend rejects is rejected here too: IP addresses, single labels, `*` anywhere but the leftmost
|
|
41
|
+
* label, a wildcard over a bare TLD, and labels or hosts longer than DNS allows.
|
|
42
|
+
*/
|
|
43
|
+
export declare function normalizeHostPattern(raw: unknown): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Normalized entries → the two sets the browser checks. Entries that are not normalized are
|
|
46
|
+
* skipped rather than trusted.
|
|
47
|
+
*/
|
|
48
|
+
export declare function compileHostRules(patterns: readonly string[]): HostRules;
|
|
49
|
+
declare type OwnHostSources = {
|
|
50
|
+
/** The host this request was served on (`settingsData.domain`). */
|
|
51
|
+
domain?: string | null;
|
|
52
|
+
/** Each routing's own domain, for stores that give a language a domain of its own. */
|
|
53
|
+
routingDomains?: (string | null | undefined)[];
|
|
54
|
+
/** The store's connected domains, as the settings carry them. */
|
|
55
|
+
storefrontDomains?: {
|
|
56
|
+
name?: string | null;
|
|
57
|
+
redirectDomainName?: string | null;
|
|
58
|
+
deleted?: boolean | null;
|
|
59
|
+
}[] | null;
|
|
60
|
+
/** URLs of ikas's own services a flow leaves the page for (Pay with ikas, the storefront API). */
|
|
61
|
+
serviceUrls?: (string | null | undefined)[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The hosts that are the store itself or ikas's own flows: never warned, never on the merchant's
|
|
65
|
+
* list. Wildcards are not accepted here — `*.myikas.com` in particular would cover every other
|
|
66
|
+
* store, a free trial one included.
|
|
67
|
+
*/
|
|
68
|
+
export declare function collectOwnHosts({ domain, routingDomains, storefrontDomains, serviceUrls, }: OwnHostSources): string[];
|
|
69
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__spreadArray as t}from'./../../ext/tslib/tslib.es6.js';var o=["instagram.com","facebook.com","m.facebook.com","x.com","twitter.com","youtube.com","m.youtube.com","youtu.be","tiktok.com","pinterest.com","tr.pinterest.com","pin.it","linkedin.com","tr.linkedin.com","threads.com","threads.net","t.me","wa.me","whatsapp.com","api.whatsapp.com","web.whatsapp.com","google.com","google.com.tr","maps.google.com","maps.app.goo.gl","g.page","search.google.com","play.google.com"],e=["accounts.google.com","www.facebook.com","m.facebook.com","appleid.apple.com","id.twitch.tv"],r=253,a=/^(\*\.)?[a-z0-9-]+(\.[a-z0-9-]+)+$/,n=/^\d+(\.\d+){3}$/;function c(t){if("string"!=typeof t)return null;var o=t.trim().toLowerCase();if(!o||o.length>253)return null;var e,r=o.startsWith("*.");r&&(o=o.slice(2));try{e=new URL(o.includes("://")?o:"http://"+o).hostname.replace(/\.$/,"")}catch(t){return null}if(n.test(e)||e.split(".").some((function(t){return t.length>63})))return null;var c=(r?"*.":"")+e;return a.test(c)?c:null}function i(t){var o=new Set,e=new Set;return t.forEach((function(t){if(c(t)===t)if(t.startsWith("*."))e.add(t.slice(2));else{var r=t.startsWith("www.")&&-1!==t.indexOf(".",4)?t.slice(4):t;o.add(r),o.add("www."+r)}})),{exact:Array.from(o),suffix:Array.from(e)}}function m(o){var e=o.domain,r=o.routingDomains,a=void 0===r?[]:r,n=o.storefrontDomains,i=void 0===n?[]:n,m=o.serviceUrls,s=void 0===m?[]:m,l=t(t(t([e],a,!0),(i||[]).filter((function(t){return!t.deleted})).reduce((function(t,o){return t.concat([o.name,o.redirectDomainName])}),[]),!0),s,!0),u=new Set;return l.forEach((function(t){var o=c(t);o&&!o.startsWith("*.")&&u.add(o)})),Array.from(u)}export{o as IKAS_DEFAULT_ALLOWED_HOSTS,r as MAX_HOST_LENGTH,e as SOCIAL_LOGIN_HOSTS,m as collectOwnHosts,i as compileHostRules,c as normalizeHostPattern};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SettingsData } from "../../provider/page-data-next";
|
|
2
|
+
/**
|
|
3
|
+
* The navigation warning's inline script for this store's pages (FR-1116), or "" while the warning
|
|
4
|
+
* is off, which leaves the page exactly as it renders without the guard. Checkout never gets it:
|
|
5
|
+
* the caller skips that page type, and the standalone checkout does not call this at all.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRedirectGuardScript(settings: SettingsData): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__spreadArray as o}from'./../../ext/tslib/tslib.es6.js';import{collectOwnHosts as r,compileHostRules as t,SOCIAL_LOGIN_HOSTS as s,IKAS_DEFAULT_ALLOWED_HOSTS as n}from"./hosts.js";import{buildRedirectGuardScript as i}from"./script.js";import{parseNavigationWarningSettings as e}from"./settings.js";import{getRedirectGuardTexts as m}from"./texts.js";function a(a){var f,l=e(a.storefront.navigationWarningSettings);if(!l)return"";var p=r({domain:a.domain,routingDomains:(a.storefront.routings||[]).map((function(o){return o.domain})),storefrontDomains:a.storefront.domains,serviceUrls:[a.payWithIkasUrl,process.env.NEXT_PUBLIC_GQL_URL,process.env.NEXT_PUBLIC_BASE_URL]}),u=t(o(o(o(o([],p,!0),s,!0),n,!0),l.allowedHosts,!0));return i({rules:u,texts:m(null===(f=a.routing)||void 0===f?void 0:f.locale)})}export{a as getRedirectGuardScript};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The navigation warning's browser half (FR-1077): the first script of every page while the store
|
|
3
|
+
* has the warning on, called as `RUNTIME(window, config)` — see `buildRedirectGuardScript`.
|
|
4
|
+
*
|
|
5
|
+
* SAME SCRIPT AS STUDIO (FR-1225): the string below is the runtime Studio stores print, copied
|
|
6
|
+
* verbatim, and must stay so — Next.js and Studio stores have to behave alike. Change it by copying
|
|
7
|
+
* Studio's current runtime again, never by patching this copy alone.
|
|
8
|
+
*
|
|
9
|
+
* ONE PENDING EXCEPTION (FR-1229): `fitToView` — the dialog laid over the visual viewport when the
|
|
10
|
+
* page is wider than the screen (FR-1228 D1, Android Chrome) — was written here first. Studio's
|
|
11
|
+
* runtime has to take the same change, after which the two are verbatim again.
|
|
12
|
+
*
|
|
13
|
+
* WHY A STRING, like the analytics snippets in `render/head.ts`, and not a function inlined through
|
|
14
|
+
* `Function.prototype.toString`: what ships is then exactly what is written and tested here. A
|
|
15
|
+
* stringified function is whatever the compiler made of it — the minified SSR build and tsx's test
|
|
16
|
+
* transform can each add helpers that live outside the function, and the copy that reaches the
|
|
17
|
+
* browser is not the one the tests ran. Hence the rules for the source below: ES2017 (it runs
|
|
18
|
+
* before anything else on the page, in every browser a shopper has), ASCII only, and no backtick or
|
|
19
|
+
* `${` (it sits in a template literal).
|
|
20
|
+
*
|
|
21
|
+
* WHAT IT DOES. It cancels — synchronously, which is the actual protection — every top-level
|
|
22
|
+
* navigation to a host that is neither the store's own nor on the allowlist, and shows the shopper
|
|
23
|
+
* where the page wanted to send them. "Continue" repeats exactly that navigation; anything else
|
|
24
|
+
* leaves them on the page. Three ways in:
|
|
25
|
+
* - The Navigation API's `navigate` event, for every navigation same-origin code starts in this
|
|
26
|
+
* tab: `location.*`, `form.submit()`, meta refresh, `window.open(…, "_self")` and the theme
|
|
27
|
+
* Router's `location.href`. Browsers without the API get the other two only.
|
|
28
|
+
* - A `click` listener for links. Bubble phase, so a page handler that already prevented the click
|
|
29
|
+
* (a link used as a lightbox trigger) is left alone, and registered before the Router's own
|
|
30
|
+
* window listener, so a held link stops there — the Router re-issues every click as
|
|
31
|
+
* `location.href` or, for `target=_blank`, `window.open`, which fires no `navigate` here.
|
|
32
|
+
* - `window.open` itself, for windows opened with a user gesture behind them. One without is left
|
|
33
|
+
* to the browser's popup blocker: asking about it would let "Continue" open a popup the browser
|
|
34
|
+
* was about to block.
|
|
35
|
+
* - The links of same-origin frames — where a chat widget usually draws its window. A link that
|
|
36
|
+
* opens a new tab or takes this tab away is held; one that stays inside the frame is not, and the
|
|
37
|
+
* frame's own `window.open` is left alone so the widget's popups keep working. Frames are hooked
|
|
38
|
+
* on every `load`, as a widget rewriting its frame (`document.open`) wipes its listeners; adding
|
|
39
|
+
* the same listener again is otherwise a no-op.
|
|
40
|
+
*
|
|
41
|
+
* WHAT IT ASSUMES OF THE PAGE: nothing, since everything else on it — apps, GTM, the merchant's own
|
|
42
|
+
* scripts — runs after it and may be hostile. The built-ins it relies on are captured before they
|
|
43
|
+
* can be patched, nothing is reachable from the page (no global, a closed shadow root), Continue
|
|
44
|
+
* takes only a real click and not in the first 600ms, the first destination of a dialog cannot be
|
|
45
|
+
* swapped for another, and a dialog removed from the page counts as "stay". What it cannot catch
|
|
46
|
+
* is listed in the plan and the report: anything inside a cross-origin frame, navigations started
|
|
47
|
+
* by another origin's document (such a frame navigating the top window, a page using
|
|
48
|
+
* `window.opener`), `open` taken from a fresh frame, and anything that runs before it.
|
|
49
|
+
*/
|
|
50
|
+
export declare const REDIRECT_GUARD_RUNTIME: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__makeTemplateObject as e}from'./../../ext/tslib/tslib.es6.js';var n,t=String.raw(n||(n=e(['(function (win, cfg) {\n "use strict";\n var doc = win.document;\n var FunctionP = win.Function.prototype;\n var uncurry = FunctionP.bind.bind(FunctionP.call);\n var apply = uncurry(FunctionP.apply);\n var describe = win.Object.getOwnPropertyDescriptor;\n var protoOf = win.Object.getPrototypeOf;\n var create = win.Object.create;\n var now = win.Date.now;\n var toText = win.String;\n\n function protoIn(realm, name) {\n var C;\n try {\n C = realm[name];\n } catch (error) {\n return null;\n }\n return C ? C.prototype : null;\n }\n function proto(name) {\n return protoIn(win, name);\n }\n function getter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.get ? uncurry(d.get) : null;\n }\n function setter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.set ? uncurry(d.set) : null;\n }\n function method(p, name) {\n var f = p ? p[name] : null;\n return typeof f === "function" ? uncurry(f) : null;\n }\n\n var EventP = proto("Event");\n var NodeP = proto("Node");\n var ElementP = proto("Element");\n var DocumentP = proto("Document");\n var WeakMapC = win.WeakMap;\n var attachShadow = method(ElementP, "attachShadow");\n if (!doc || !EventP || !NodeP || !attachShadow || !WeakMapC) return;\n\n var EventTargetP = proto("EventTarget");\n var listen = method(EventTargetP, "addEventListener");\n var unlisten = method(EventTargetP, "removeEventListener");\n var preventDefault = method(EventP, "preventDefault");\n var stopImmediatePropagation = method(EventP, "stopImmediatePropagation");\n var typeOf = getter(EventP, "type");\n var bubblesOf = getter(EventP, "bubbles");\n var cancelableOf = getter(EventP, "cancelable");\n var cancelBubbleOf = getter(EventP, "cancelBubble");\n var eventPhaseOf = getter(EventP, "eventPhase");\n var defaultPreventedOf = getter(EventP, "defaultPrevented");\n var targetOf = getter(EventP, "target");\n var composedPath = method(EventP, "composedPath");\n var MouseEventP = proto("MouseEvent");\n var buttonOf = getter(MouseEventP, "button");\n var ctrlKeyOf = getter(MouseEventP, "ctrlKey");\n var metaKeyOf = getter(MouseEventP, "metaKey");\n var shiftKeyOf = getter(MouseEventP, "shiftKey");\n var altKeyOf = getter(MouseEventP, "altKey");\n var submitterOf = getter(proto("SubmitEvent"), "submitter");\n var keyOf = getter(proto("KeyboardEvent"), "key");\n var persistedOf = getter(proto("PageTransitionEvent"), "persisted");\n var appendChild = method(NodeP, "appendChild");\n var removeChild = method(NodeP, "removeChild");\n var parentNodeOf = getter(NodeP, "parentNode");\n var nodeTypeOf = getter(NodeP, "nodeType");\n var isConnectedOf = getter(NodeP, "isConnected");\n var baseURIOf = getter(NodeP, "baseURI");\n var ownerDocumentOf = getter(NodeP, "ownerDocument");\n var setTextContent = setter(NodeP, "textContent");\n var hostOf = getter(proto("ShadowRoot"), "host");\n var localNameOf = getter(ElementP, "localName");\n var getAttribute = method(ElementP, "getAttribute");\n var getAttributeNS = method(ElementP, "getAttributeNS");\n var setAttribute = method(ElementP, "setAttribute");\n var removeAttribute = method(ElementP, "removeAttribute");\n var createElement = method(DocumentP, "createElement");\n var createTextNode = method(DocumentP, "createTextNode");\n var getElementsByTagName = method(DocumentP, "getElementsByTagName");\n var documentElementOf = getter(DocumentP, "documentElement");\n var activeElementOf = getter(DocumentP, "activeElement");\n var defaultViewOf = getter(DocumentP, "defaultView");\n var focus = method(proto("HTMLElement"), "focus");\n var DialogP = proto("HTMLDialogElement");\n var showModal = method(DialogP, "showModal");\n var closeDialog = method(DialogP, "close");\n var dialogOpenOf = getter(DialogP, "open");\n var submitForm = method(proto("HTMLFormElement"), "submit");\n var FormDataC = win.FormData;\n var eachFormEntry = method(proto("FormData"), "forEach");\n var IFrameP = proto("HTMLIFrameElement");\n var contentWindowOf = getter(IFrameP, "contentWindow");\n var contentDocumentOf = getter(IFrameP, "contentDocument");\n var weakGet = method(WeakMapC.prototype, "get");\n var weakSet = method(WeakMapC.prototype, "set");\n var DataTransferC = win.DataTransfer;\n var URLC = win.URL;\n var hrefOf = getter(URLC.prototype, "href");\n var protocolOf = getter(URLC.prototype, "protocol");\n var hostnameOf = getter(URLC.prototype, "hostname");\n var setSearch = setter(URLC.prototype, "search");\n var ParamsC = win.URLSearchParams;\n var appendParam = method(ParamsC && ParamsC.prototype, "append");\n var paramsText = method(ParamsC && ParamsC.prototype, "toString");\n var StringP = win.String.prototype;\n var slice = method(StringP, "slice");\n var indexOf = method(StringP, "indexOf");\n var toLowerCase = method(StringP, "toLowerCase");\n var charCodeAt = method(StringP, "charCodeAt");\n var MutationObserverC = win.MutationObserver;\n var observe = method(proto("MutationObserver"), "observe");\n var disconnect = method(proto("MutationObserver"), "disconnect");\n var loc = win.location;\n var nativeOpen = win.open;\n var innerWidthOf = getter(win, "innerWidth");\n var innerHeightOf = getter(win, "innerHeight");\n var visual = win.visualViewport || null;\n var VisualViewportP = proto("VisualViewport");\n var visualWidthOf = getter(VisualViewportP, "width");\n var visualHeightOf = getter(VisualViewportP, "height");\n var visualLeftOf = getter(VisualViewportP, "offsetLeft");\n var visualTopOf = getter(VisualViewportP, "offsetTop");\n var lengthOf = getter(win, "length");\n var nameOf = getter(win, "name");\n var activation = win.navigator ? win.navigator.userActivation : null;\n var isActiveOf = activation ? getter(protoOf(activation), "isActive") : null;\n var navigation = win.navigation;\n var NavigateEventP = proto("NavigateEvent");\n var navigationTypeOf = getter(NavigateEventP, "navigationType");\n var destinationOf = getter(NavigateEventP, "destination");\n var downloadRequestOf = getter(NavigateEventP, "downloadRequest");\n var formDataOf = getter(NavigateEventP, "formData");\n var sourceElementOf = getter(NavigateEventP, "sourceElement");\n var userInitiatedOf = getter(NavigateEventP, "userInitiated");\n var urlOf = getter(proto("NavigationDestination"), "url");\n var sameDocumentOf = getter(proto("NavigationDestination"), "sameDocument");\n\n var XLINK = "http://www.w3.org/1999/xlink";\n var MAX_SCRIPT_PROMPTS = 3;\n var PROCEED_DELAY = 600;\n var BYPASS_TTL = 2000;\n var STYLE =\n ":host{all:initial!important;display:block!important;position:fixed!important;inset:0!important;" +\n "z-index:2147483647!important;pointer-events:none!important}" +\n "dialog{box-sizing:border-box;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;" +\n "margin:0;padding:16px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;" +\n "pointer-events:auto;color-scheme:light;color:#141414;font-size:14px;line-height:1.45;text-align:left}" +\n "dialog:not([open]){display:none}" +\n "dialog::backdrop{background:rgba(26,26,26,.35)}" +\n ".fallback{background:rgba(26,26,26,.35)}" +\n ".card{box-sizing:border-box;width:100%;max-width:440px;max-height:100%;overflow:auto;padding:24px;" +\n "border-radius:12px;background:#fff;box-shadow:0 8px 8px -4px rgba(16,24,40,.03),0 20px 24px -4px rgba(16,24,40,.08)}" +\n "h2{margin:0 0 8px;font-size:18px;font-weight:600;line-height:1.35;letter-spacing:-.01em}" +\n "p{margin:0;color:#333}" +\n ".host{padding:1px 6px;border:1px solid #fecaca;border-radius:4px;background:#fee2e2;color:#450a0a;" +\n "font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;word-break:break-all}" +\n ".actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}" +\n "button{box-sizing:border-box;min-width:120px;height:44px;margin:0;padding:0 20px;border:1px solid #141414;" +\n "border-radius:8px;font:inherit;font-size:14px;font-weight:500;line-height:1.15;cursor:pointer}" +\n ".stay{background:#141414;color:#fff}.stay:hover{background:#111}" +\n ".proceed{background:transparent;color:#141414}.proceed:hover{background:#f5f4f1}" +\n "button:focus-visible{outline:2px solid #141414;outline-offset:2px}" +\n "@media (max-width:480px){.actions{flex-direction:column}button{width:100%}}" +\n "@keyframes fade{from{opacity:0}to{opacity:1}}" +\n "@media (prefers-reduced-motion:no-preference){.card{animation:fade .12s ease-out}}";\n\n var exactHosts = create(null);\n var suffixHosts = create(null);\n var index;\n for (index = 0; index < cfg.rules.exact.length; index++) exactHosts[cfg.rules.exact[index]] = true;\n for (index = 0; index < cfg.rules.suffix.length; index++) suffixHosts[cfg.rules.suffix[index]] = true;\n var here = loc.hostname;\n if (here) {\n exactHosts[here] = true;\n exactHosts[slice(here, 0, 4) === "www." ? slice(here, 4) : "www." + here] = true;\n }\n\n function isTrustedHost(host) {\n if (exactHosts[host] === true) return true;\n for (var dot = indexOf(host, "."); dot !== -1; dot = indexOf(host, ".", dot + 1)) {\n if (suffixHosts[slice(host, dot + 1)] === true) return true;\n }\n return false;\n }\n\n function parseWebUrl(raw, base) {\n var url;\n try {\n url = new URLC(raw, base || baseURIOf(doc));\n } catch (error) {\n return null;\n }\n var protocol = protocolOf(url);\n if (protocol !== "http:" && protocol !== "https:") return null;\n var host = hostnameOf(url);\n if (host.length > 1 && charCodeAt(host, host.length - 1) === 46) host = slice(host, 0, -1);\n return { href: hrefOf(url), host: host };\n }\n\n function isActiveIn(source) {\n return !isActiveOf || !source ? true : isActiveOf(source);\n }\n\n function element(parent, tag, className, text) {\n var node = createElement(doc, tag);\n if (className) setAttribute(node, "class", className);\n if (text) setTextContent(node, text);\n appendChild(parent, node);\n return node;\n }\n\n var texts = cfg.texts;\n var container = createElement(doc, "div");\n var shadow = attachShadow(container, { mode: "closed" });\n element(shadow, "style", "", STYLE);\n var dialog = element(shadow, "dialog", showModal ? "" : "fallback", "");\n setAttribute(dialog, "role", "alertdialog");\n setAttribute(dialog, "aria-modal", "true");\n setAttribute(dialog, "aria-labelledby", "title");\n setAttribute(dialog, "aria-describedby", "body");\n setAttribute(dialog, "lang", texts.lang);\n setAttribute(dialog, "dir", "ltr");\n var card = element(dialog, "div", "card", "");\n setAttribute(element(card, "h2", "", texts.title), "id", "title");\n var body = element(card, "p", "", "");\n setAttribute(body, "id", "body");\n appendChild(body, createTextNode(doc, texts.bodyBefore));\n var hostLabel = element(body, "bdi", "host", "");\n setAttribute(hostLabel, "dir", "ltr");\n appendChild(body, createTextNode(doc, texts.bodyAfter));\n var actions = element(card, "div", "actions", "");\n var stayButton = element(actions, "button", "stay", texts.stay);\n var proceedButton = element(actions, "button", "proceed", texts.proceed);\n setAttribute(stayButton, "type", "button");\n setAttribute(proceedButton, "type", "button");\n\n var pending = null;\n var bypass = null;\n var observer = null;\n var restoreFocusTo = null;\n var savedOverflow = "";\n var focusedButton = stayButton;\n var scriptPrompts = 0;\n\n // A fixed dialog covers the layout viewport. When the page is wider than the screen, Android\n // Chrome widens the layout viewport to the page, so the dialog is centred on the page and lands\n // outside what the shopper sees. Lay it over the visual viewport then; leave it to the CSS\n // whenever the two match, which is every page that fits its screen.\n function fitToView() {\n var style = dialog.style;\n style.left = style.top = style.right = style.bottom = style.width = style.height = "";\n if (!visual || !visualWidthOf || !visualHeightOf || !visualLeftOf || !visualTopOf) return;\n if (!innerWidthOf || !innerHeightOf) return;\n var width = visualWidthOf(visual);\n var height = visualHeightOf(visual);\n var left = visualLeftOf(visual);\n var top = visualTopOf(visual);\n if (!(width > 0 && height > 0)) return;\n // innerWidth/innerHeight: the layout viewport, scrollbars included. The root\'s overflow is\n // hidden while the dialog is open, so on a page that fits there is nothing between the two.\n if (left < 1 && top < 1 && width > innerWidthOf(win) - 1 && height > innerHeightOf(win) - 1) return;\n style.left = left + "px";\n style.top = top + "px";\n style.right = style.bottom = "auto";\n style.width = width + "px";\n style.height = height + "px";\n }\n\n function followView(on) {\n if (!visual) return;\n (on ? listen : unlisten)(visual, "resize", fitToView);\n (on ? listen : unlisten)(visual, "scroll", fitToView);\n }\n\n function show(next) {\n var root = documentElementOf(doc);\n if (!root) return;\n pending = next;\n next.shownAt = now();\n setTextContent(hostLabel, next.host);\n restoreFocusTo = activeElementOf(doc);\n var fontFamily = "";\n try {\n fontFamily = doc.body ? win.getComputedStyle(doc.body).fontFamily : "";\n } catch (error) {}\n card.style.fontFamily = fontFamily || "system-ui,-apple-system,\'Segoe UI\',Roboto,sans-serif";\n appendChild(root, container);\n savedOverflow = root.style.overflow;\n root.style.overflow = "hidden";\n if (showModal) {\n try {\n showModal(dialog);\n } catch (error) {\n setAttribute(dialog, "open", "");\n }\n } else {\n setAttribute(dialog, "open", "");\n }\n fitToView();\n followView(true);\n focus(stayButton);\n if (MutationObserverC && observe) {\n observer = new MutationObserverC(function () {\n if (pending !== null && !isConnectedOf(container)) reset();\n });\n observe(observer, root, { childList: true });\n }\n }\n\n function reset() {\n pending = null;\n followView(false);\n if (observer !== null) {\n disconnect(observer);\n observer = null;\n }\n if (closeDialog && dialogOpenOf(dialog)) closeDialog(dialog);\n else removeAttribute(dialog, "open");\n var parent = parentNodeOf(container);\n if (parent) removeChild(parent, container);\n var root = documentElementOf(doc);\n if (root) root.style.overflow = savedOverflow;\n var previous = restoreFocusTo;\n restoreFocusTo = null;\n if (previous) {\n try {\n focus(previous);\n } catch (error) {}\n }\n }\n\n function stay() {\n if (pending !== null) reset();\n }\n\n function submitCopy(copy, action, target) {\n var root = documentElementOf(doc);\n var form = createElement(doc, "form");\n setAttribute(form, "method", "post");\n setAttribute(form, "action", action);\n setAttribute(form, "enctype", copy.enctype);\n setAttribute(form, "target", target);\n setAttribute(form, "hidden", "");\n for (var i = 0; i < copy.entries.length; i++) {\n var input = createElement(doc, "input");\n var value = copy.entries[i][1];\n setAttribute(input, "name", copy.entries[i][0]);\n if (typeof value === "string") {\n setAttribute(input, "type", "hidden");\n setAttribute(input, "value", value);\n } else {\n if (!DataTransferC) return false;\n var transfer = new DataTransferC();\n transfer.items.add(value);\n setAttribute(input, "type", "file");\n input.files = transfer.files;\n }\n appendChild(form, input);\n }\n if (!root) return false;\n appendChild(root, form);\n submitForm(form);\n if (target !== "_self") removeChild(root, form);\n return true;\n }\n\n function proceed() {\n var approved = pending;\n reset();\n if (approved.newTab) {\n if (approved.form !== null) {\n submitCopy(approved.form, approved.href, "_blank");\n } else {\n apply(nativeOpen, win, [approved.href, approved.target, approved.features ? approved.features + ",noopener" : "noopener"]);\n }\n return;\n }\n bypass = { href: approved.href, until: now() + BYPASS_TTL };\n if (approved.form !== null) {\n if (!submitCopy(approved.form, approved.href, "_self")) bypass = null;\n } else if (approved.replace) {\n loc.replace(approved.href);\n } else {\n loc.assign(approved.href);\n }\n }\n\n function attempt(next) {\n if (pending !== null) {\n if (isConnectedOf(container)) return;\n reset();\n }\n if (next.script) {\n if (scriptPrompts >= MAX_SCRIPT_PROMPTS) return;\n scriptPrompts++;\n }\n show(next);\n }\n\n listen(stayButton, "click", function () {\n stay();\n });\n listen(proceedButton, "click", function (event) {\n if (event.isTrusted && pending !== null && now() - pending.shownAt >= PROCEED_DELAY) proceed();\n });\n listen(stayButton, "focus", function () {\n focusedButton = stayButton;\n });\n listen(proceedButton, "focus", function () {\n focusedButton = proceedButton;\n });\n listen(dialog, "click", function (event) {\n if (targetOf(event) === dialog) stay();\n });\n listen(dialog, "cancel", function (event) {\n preventDefault(event);\n stay();\n });\n listen(dialog, "close", function () {\n if (dialogOpenOf && !dialogOpenOf(dialog)) stay();\n });\n listen(dialog, "keydown", function (event) {\n if (showModal || !keyOf) return;\n var key = keyOf(event);\n if (key === "Escape") {\n stay();\n } else if (key === "Tab") {\n preventDefault(event);\n focus(focusedButton === stayButton ? proceedButton : stayButton);\n }\n });\n\n function isNode(value) {\n try {\n nodeTypeOf(value);\n return true;\n } catch (error) {\n return false;\n }\n }\n\n function linkHref(node) {\n if (!isNode(node) || nodeTypeOf(node) !== 1) return null;\n var name = localNameOf(node);\n if (name !== "a" && name !== "area") return null;\n var href = getAttribute(node, "href");\n if (href === null && getAttributeNS) href = getAttributeNS(node, XLINK, "href");\n return href;\n }\n\n function linkInPath(path, bubbles) {\n for (var i = 0; i < path.length; i++) {\n if (linkHref(path[i]) !== null) return path[i];\n if (!bubbles || !isNode(path[i]) || nodeTypeOf(path[i]) === 9) return null;\n }\n return null;\n }\n\n function parentAcross(node) {\n var parent = parentNodeOf(node);\n if (parent || nodeTypeOf(node) !== 11 || !hostOf) return parent;\n try {\n return hostOf(node);\n } catch (error) {\n return null;\n }\n }\n\n function linkAbove(node, bubbles) {\n for (var current = node, steps = 0; current && steps < 1024; current = parentAcross(current), steps++) {\n if (linkHref(current) !== null) return current;\n if (!bubbles) return null;\n }\n return null;\n }\n\n var watchedRoots = new WeakMapC();\n\n function isWatched(node) {\n var root = node;\n for (var parent = parentNodeOf(node); parent; parent = parentNodeOf(parent)) root = parent;\n return weakGet(watchedRoots, root) === true;\n }\n\n function baseTarget(root) {\n var bases = root ? getElementsByTagName(root, "base") : [];\n for (var i = 0; i < bases.length; i++) {\n var target = getAttribute(bases[i], "target");\n if (target !== null) return target;\n }\n return "";\n }\n\n function windowName(target) {\n try {\n return nameOf ? nameOf(target) : null;\n } catch (error) {\n return null;\n }\n }\n\n function hasFrameNamed(parent, name, level) {\n var count;\n try {\n count = lengthOf ? lengthOf(parent) : 0;\n } catch (error) {\n return false;\n }\n for (var i = 0; i < count && i < 64; i++) {\n var child;\n try {\n child = parent[i];\n } catch (error) {\n continue;\n }\n if (!child) continue;\n if (windowName(child) === name) return true;\n if (level < 4 && hasFrameNamed(child, name, level + 1)) return true;\n }\n return false;\n }\n\n function targetGoesTo(target, depth, realm) {\n var name = toLowerCase(target);\n if (name === "" || name === "_self") return depth === 0 ? "tab" : null;\n if (name === "_top") return "tab";\n if (name === "_parent") return depth <= 1 ? "tab" : null;\n if (name === "_blank") return "new";\n if (realm && windowName(realm) === target) return depth === 0 ? "tab" : null;\n if (windowName(win) === target) return "tab";\n return hasFrameNamed(win, target, 0) ? null : "new";\n }\n\n function viewOf(node) {\n var owner = ownerDocumentOf(node);\n return owner ? defaultViewOf(owner) : null;\n }\n\n function linkAttempt(node, depth, script) {\n var href = linkHref(node);\n if (href === null) return null;\n var url = parseWebUrl(href, baseURIOf(node));\n if (url === null || isTrustedHost(url.host)) return null;\n var target = getAttribute(node, "target");\n var goesTo = targetGoesTo(target === null ? baseTarget(ownerDocumentOf(node)) : target, depth, viewOf(node));\n if (goesTo === null) return null;\n return {\n href: url.href,\n host: url.host,\n newTab: goesTo === "new",\n target: "_blank",\n features: "",\n replace: false,\n form: null,\n script: script,\n };\n }\n\n function copyForm(data, source) {\n var entries = [];\n var hasFile = false;\n eachFormEntry(data, function (value, name) {\n entries[entries.length] = [name, value];\n if (typeof value !== "string") hasFile = true;\n });\n var enctype = null;\n if (source && nodeTypeOf(source) === 1) {\n enctype = getAttribute(source, "formenctype");\n var owner = localNameOf(source) === "form" ? source : source.form;\n if (!enctype && owner) enctype = getAttribute(owner, "enctype");\n }\n if (!enctype) enctype = hasFile ? "multipart/form-data" : "application/x-www-form-urlencoded";\n return { entries: entries, enctype: enctype };\n }\n\n function formValue(button, buttonName, form, formName) {\n var value = button ? getAttribute(button, buttonName) : null;\n return value !== null ? value : getAttribute(form, formName);\n }\n\n function readForm(form, button) {\n try {\n return button ? new FormDataC(form, button) : new FormDataC(form);\n } catch (error) {\n try {\n return new FormDataC(form);\n } catch (retryError) {\n return null;\n }\n }\n }\n\n function withQuery(href, entries) {\n if (!ParamsC || !appendParam || !paramsText || !setSearch) return href;\n var params = new ParamsC();\n for (var i = 0; i < entries.length; i++) {\n var value = entries[i][1];\n appendParam(params, entries[i][0], typeof value === "string" ? value : value.name);\n }\n var url = new URLC(href);\n setSearch(url, paramsText(params));\n return hrefOf(url);\n }\n\n function formAttempt(form, submitter, depth, script, copy) {\n if (!isNode(form) || nodeTypeOf(form) !== 1 || localNameOf(form) !== "form") return null;\n var button = submitter && isNode(submitter) && nodeTypeOf(submitter) === 1 ? submitter : null;\n var action = formValue(button, "formaction", form, "action");\n var url = parseWebUrl(action === null ? "" : action, baseURIOf(form));\n if (url === null || isTrustedHost(url.host)) return null;\n var target = formValue(button, "formtarget", form, "target");\n var goesTo = targetGoesTo(target === null ? baseTarget(ownerDocumentOf(form)) : target, depth, viewOf(form));\n if (goesTo === null || (goesTo === "tab" && navigation)) return null;\n var method = formValue(button, "formmethod", form, "method");\n method = method === null ? "get" : toLowerCase(method);\n if (method === "dialog") return null;\n var next = {\n href: url.href,\n host: url.host,\n newTab: goesTo === "new",\n target: goesTo === "new" ? "_blank" : "_self",\n features: "",\n replace: false,\n form: null,\n script: script,\n };\n if (!copy) return next;\n var data = readForm(form, button);\n if (data === null) return null;\n var copied = copyForm(data, button || form);\n if (method === "post") next.form = copied;\n else next.href = withQuery(url.href, copied.entries);\n return next;\n }\n\n function isMouseEvent(event) {\n try {\n buttonOf(event);\n return true;\n } catch (error) {\n return false;\n }\n }\n\n function isShoppersOwnChoice(event) {\n if (!event.isTrusted) return false;\n try {\n return buttonOf(event) !== 0 || ctrlKeyOf(event) || metaKeyOf(event) || shiftKeyOf(event) || altKeyOf(event);\n } catch (error) {\n return true;\n }\n }\n\n var eventStates = new WeakMapC();\n var armedEvents = [];\n\n function stateOf(event) {\n var state = weakGet(eventStates, event);\n if (!state) {\n state = { decided: false, link: null, armed: null };\n weakSet(eventStates, event, state);\n }\n return state;\n }\n\n function disarm(state) {\n var armed = state.armed;\n if (armed === null || armed.done) return;\n armed.done = true;\n for (var i = 0; i < armed.nodes.length; i++) {\n unlisten(armed.nodes[i], armed.type, armed.check, true);\n unlisten(armed.nodes[i], armed.type, armed.check, false);\n }\n }\n\n function sweep() {\n var live = [];\n for (var i = 0; i < armedEvents.length; i++) {\n if (eventPhaseOf(armedEvents[i]) === 0) disarm(stateOf(armedEvents[i]));\n else live[live.length] = armedEvents[i];\n }\n armedEvents = live;\n }\n\n function arm(event, type, decide) {\n var state = stateOf(event);\n if (state.decided || state.armed !== null || !composedPath || !unlisten) return;\n var check = function (current) {\n if (current === event && cancelBubbleOf(current)) decide(current);\n };\n var path = composedPath(event);\n var nodes = [];\n for (var i = 0; i < path.length; i++) {\n if (!isNode(path[i])) continue;\n listen(path[i], type, check, true);\n listen(path[i], type, check, false);\n nodes[nodes.length] = path[i];\n }\n state.armed = { nodes: nodes, type: type, check: check, done: false };\n armedEvents[armedEvents.length] = event;\n }\n\n function hold(event, next) {\n var state = stateOf(event);\n state.decided = true;\n disarm(state);\n preventDefault(event);\n stopImmediatePropagation(event);\n attempt(next);\n }\n\n function onClickCapture(event, depth, active) {\n sweep();\n var state = stateOf(event);\n if (state.decided || !composedPath) return;\n var link = linkInPath(composedPath(event), bubblesOf(event));\n if (link === null) return;\n state.link = link;\n if (!event.isTrusted) {\n var next = isMouseEvent(event) ? linkAttempt(link, depth, true) : null;\n if (next !== null && next.newTab && active()) hold(event, next);\n return;\n }\n if (isShoppersOwnChoice(event)) return;\n var held = linkAttempt(link, depth, false);\n if (held !== null && (held.newTab || !navigation)) {\n arm(event, "click", function (current) {\n decideClick(current, depth, active);\n });\n }\n }\n\n function decideClick(event, depth, active) {\n var state = stateOf(event);\n if (state.decided || defaultPreventedOf(event) || isShoppersOwnChoice(event)) return;\n if (!event.isTrusted && !isMouseEvent(event)) return;\n var link = state.link;\n if (link === null && composedPath) link = linkInPath(composedPath(event), bubblesOf(event));\n if (link === null) return;\n var next = linkAttempt(link, depth, !event.isTrusted);\n if (next === null || (next.script && next.newTab && !active())) return;\n hold(event, next);\n }\n\n function onSubmitCapture(event, depth, active) {\n sweep();\n var state = stateOf(event);\n if (state.decided) return;\n if (formAttempt(targetOf(event), submitterOf ? submitterOf(event) : null, depth, false, false) === null) return;\n arm(event, "submit", function (current) {\n decideSubmit(current, depth, active);\n });\n }\n\n function decideSubmit(event, depth, active) {\n var state = stateOf(event);\n if (state.decided || defaultPreventedOf(event)) return;\n var form = targetOf(event);\n var submitter = submitterOf ? submitterOf(event) : null;\n var found = formAttempt(form, submitter, depth, !event.isTrusted, false);\n if (found === null || (found.newTab && !active())) return;\n var next = formAttempt(form, submitter, depth, !event.isTrusted, true);\n if (next !== null) hold(event, next);\n }\n\n function holdScriptClick(node, bubbles, uncancelable, depth, active) {\n if (!isNode(node) || (!uncancelable && isWatched(node))) return false;\n var link = linkAbove(node, bubbles);\n if (link === null || (!isConnectedOf(link) && localNameOf(link) !== "a") || !viewOf(link)) return false;\n var next = linkAttempt(link, depth, true);\n if (next === null || (next.newTab && !active())) return false;\n attempt(next);\n return true;\n }\n\n function holdFormCall(form, submitter, unseenOnly, depth, active) {\n if (!isNode(form) || !isConnectedOf(form) || (unseenOnly && isWatched(form))) return false;\n var found = formAttempt(form, submitter, depth, true, false);\n if (found === null || (found.newTab && !active())) return false;\n var next = formAttempt(form, submitter, depth, true, true);\n if (next === null) return false;\n attempt(next);\n return true;\n }\n\n function isClick(event) {\n try {\n return typeOf(event) === "click" && isMouseEvent(event);\n } catch (error) {\n return false;\n }\n }\n\n function openAttempt(args, realm, depth) {\n if (args[0] === "") return null;\n var base;\n try {\n base = baseURIOf(realm.document);\n } catch (error) {\n return null;\n }\n var destination = parseWebUrl(args[0], base);\n if (destination === null || isTrustedHost(destination.host)) return null;\n var name = args[1] === "" ? "_blank" : args[1];\n var goesTo = targetGoesTo(name, depth, realm);\n if (goesTo === null) return null;\n return {\n href: destination.href,\n host: destination.host,\n newTab: goesTo === "new",\n target: name,\n features: args[2],\n replace: false,\n form: null,\n script: true,\n };\n }\n\n var ownFunctions = new WeakMapC();\n\n function wrap(target, name, make) {\n var original;\n try {\n original = target ? target[name] : null;\n } catch (error) {\n return;\n }\n if (typeof original !== "function" || weakGet(ownFunctions, original) === true) return;\n var wrapper = make(original);\n weakSet(ownFunctions, wrapper, true);\n try {\n target[name] = wrapper;\n } catch (error) {}\n }\n\n function wrapRealm(realm, depth, hooks) {\n var active = hooks.active;\n wrap(realm, "open", function (original) {\n return function open() {\n for (var i = 0; i < arguments.length; i++) {\n if (typeof arguments[i] === "symbol") return apply(original, realm, arguments);\n }\n var args = [\n arguments.length > 0 && arguments[0] !== undefined ? toText(arguments[0]) : "",\n arguments.length > 1 && arguments[1] !== undefined ? toText(arguments[1]) : "_blank",\n arguments.length > 2 && arguments[2] !== undefined ? toText(arguments[2]) : "",\n ];\n var next = openAttempt(args, realm, depth);\n if (next === null || (next.newTab && !active())) return apply(original, realm, args);\n attempt(next);\n return null;\n };\n });\n wrap(protoIn(realm, "HTMLElement"), "click", function (original) {\n return function click() {\n if (!holdScriptClick(this, true, false, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(protoIn(realm, "EventTarget"), "dispatchEvent", function (original) {\n return function dispatchEvent(event) {\n if (isClick(event) && holdScriptClick(this, bubblesOf(event), !cancelableOf(event), depth, active)) {\n return false;\n }\n return apply(original, this, arguments);\n };\n });\n var FormP = protoIn(realm, "HTMLFormElement");\n wrap(FormP, "submit", function (original) {\n return function submit() {\n if (!holdFormCall(this, null, false, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(FormP, "requestSubmit", function (original) {\n return function requestSubmit() {\n var submitter = arguments.length > 0 ? arguments[0] : null;\n if (!holdFormCall(this, submitter, true, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(protoIn(realm, "Element"), "attachShadow", function (original) {\n return function attachShadow(init) {\n var root = apply(original, this, arguments);\n watchShadow(root, depth, hooks);\n return root;\n };\n });\n }\n\n function watchShadow(root, depth, hooks) {\n try {\n listen(root, "click", hooks.clickCapture, true);\n listen(root, "submit", hooks.submitCapture, true);\n listen(root, "submit", hooks.submit);\n } catch (error) {\n return;\n }\n weakSet(watchedRoots, root, true);\n watchFrames(root, depth + 1);\n }\n\n var realmHooks = new WeakMapC();\n var frameLoadListeners = new WeakMapC();\n\n function hooksFor(realm, depth) {\n var realmActivation = null;\n if (depth > 0) {\n try {\n realmActivation = realm.navigator ? realm.navigator.userActivation : null;\n } catch (error) {}\n }\n var active = function () {\n return isActiveIn(activation) || (depth > 0 && isActiveIn(realmActivation));\n };\n return {\n active: active,\n clickCapture: function (event) {\n onClickCapture(event, depth, active);\n },\n click: function (event) {\n decideClick(event, depth, active);\n },\n submitCapture: function (event) {\n onSubmitCapture(event, depth, active);\n },\n submit: function (event) {\n decideSubmit(event, depth, active);\n },\n };\n }\n\n function armRealm(realm, depth) {\n var realmDocument;\n try {\n realmDocument = realm.document;\n } catch (error) {\n return;\n }\n if (!realmDocument) return;\n var hooks = weakGet(realmHooks, realm);\n if (!hooks) {\n hooks = hooksFor(realm, depth);\n weakSet(realmHooks, realm, hooks);\n }\n try {\n listen(realm, "click", hooks.clickCapture, true);\n listen(realm, "click", hooks.click);\n listen(realm, "submit", hooks.submitCapture, true);\n listen(realm, "submit", hooks.submit);\n } catch (error) {\n return;\n }\n weakSet(watchedRoots, realmDocument, true);\n wrapRealm(realm, depth, hooks);\n watchFrames(realmDocument, depth + 1);\n }\n\n function guardFrame(frame, depth) {\n var frameWin;\n try {\n frameWin = contentWindowOf(frame);\n if (!frameWin || !contentDocumentOf(frame)) return;\n } catch (error) {\n return;\n }\n armRealm(frameWin, depth);\n }\n\n function watchFrames(root, depth) {\n if (!contentWindowOf || !contentDocumentOf) return;\n var onLoad = weakGet(frameLoadListeners, root);\n if (!onLoad) {\n onLoad = function (event) {\n var frame = targetOf(event);\n if (frame && nodeTypeOf(frame) === 1 && localNameOf(frame) === "iframe") guardFrame(frame, depth);\n };\n weakSet(frameLoadListeners, root, onLoad);\n }\n listen(root, "load", onLoad, true);\n if (nodeTypeOf(root) !== 9) return;\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) guardFrame(frames[i], depth);\n }\n\n armRealm(win, 0);\n\n if (navigation && navigationTypeOf && destinationOf && urlOf) {\n listen(navigation, "navigate", function (event) {\n if (!event.isTrusted || !cancelableOf(event)) return;\n var type = navigationTypeOf(event);\n if (type === "traverse" || type === "reload") return;\n var destination = destinationOf(event);\n if (sameDocumentOf && sameDocumentOf(destination)) return;\n if (downloadRequestOf && downloadRequestOf(event) !== null) return;\n var url = parseWebUrl(urlOf(destination));\n if (url === null) return;\n if (bypass !== null && bypass.href === url.href) {\n var approved = now() <= bypass.until;\n bypass = null;\n if (approved) return;\n }\n if (isTrustedHost(url.host)) return;\n preventDefault(event);\n var data = formDataOf ? formDataOf(event) : null;\n attempt({\n href: url.href,\n host: url.host,\n newTab: false,\n target: "_self",\n features: "",\n replace: type === "replace",\n form: data ? copyForm(data, sourceElementOf ? sourceElementOf(event) : null) : null,\n script: !(userInitiatedOf && userInitiatedOf(event)),\n });\n });\n }\n\n listen(win, "pageshow", function (event) {\n if (pending !== null && persistedOf && persistedOf(event)) reset();\n });\n})'],['(function (win, cfg) {\n "use strict";\n var doc = win.document;\n var FunctionP = win.Function.prototype;\n var uncurry = FunctionP.bind.bind(FunctionP.call);\n var apply = uncurry(FunctionP.apply);\n var describe = win.Object.getOwnPropertyDescriptor;\n var protoOf = win.Object.getPrototypeOf;\n var create = win.Object.create;\n var now = win.Date.now;\n var toText = win.String;\n\n function protoIn(realm, name) {\n var C;\n try {\n C = realm[name];\n } catch (error) {\n return null;\n }\n return C ? C.prototype : null;\n }\n function proto(name) {\n return protoIn(win, name);\n }\n function getter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.get ? uncurry(d.get) : null;\n }\n function setter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.set ? uncurry(d.set) : null;\n }\n function method(p, name) {\n var f = p ? p[name] : null;\n return typeof f === "function" ? uncurry(f) : null;\n }\n\n var EventP = proto("Event");\n var NodeP = proto("Node");\n var ElementP = proto("Element");\n var DocumentP = proto("Document");\n var WeakMapC = win.WeakMap;\n var attachShadow = method(ElementP, "attachShadow");\n if (!doc || !EventP || !NodeP || !attachShadow || !WeakMapC) return;\n\n var EventTargetP = proto("EventTarget");\n var listen = method(EventTargetP, "addEventListener");\n var unlisten = method(EventTargetP, "removeEventListener");\n var preventDefault = method(EventP, "preventDefault");\n var stopImmediatePropagation = method(EventP, "stopImmediatePropagation");\n var typeOf = getter(EventP, "type");\n var bubblesOf = getter(EventP, "bubbles");\n var cancelableOf = getter(EventP, "cancelable");\n var cancelBubbleOf = getter(EventP, "cancelBubble");\n var eventPhaseOf = getter(EventP, "eventPhase");\n var defaultPreventedOf = getter(EventP, "defaultPrevented");\n var targetOf = getter(EventP, "target");\n var composedPath = method(EventP, "composedPath");\n var MouseEventP = proto("MouseEvent");\n var buttonOf = getter(MouseEventP, "button");\n var ctrlKeyOf = getter(MouseEventP, "ctrlKey");\n var metaKeyOf = getter(MouseEventP, "metaKey");\n var shiftKeyOf = getter(MouseEventP, "shiftKey");\n var altKeyOf = getter(MouseEventP, "altKey");\n var submitterOf = getter(proto("SubmitEvent"), "submitter");\n var keyOf = getter(proto("KeyboardEvent"), "key");\n var persistedOf = getter(proto("PageTransitionEvent"), "persisted");\n var appendChild = method(NodeP, "appendChild");\n var removeChild = method(NodeP, "removeChild");\n var parentNodeOf = getter(NodeP, "parentNode");\n var nodeTypeOf = getter(NodeP, "nodeType");\n var isConnectedOf = getter(NodeP, "isConnected");\n var baseURIOf = getter(NodeP, "baseURI");\n var ownerDocumentOf = getter(NodeP, "ownerDocument");\n var setTextContent = setter(NodeP, "textContent");\n var hostOf = getter(proto("ShadowRoot"), "host");\n var localNameOf = getter(ElementP, "localName");\n var getAttribute = method(ElementP, "getAttribute");\n var getAttributeNS = method(ElementP, "getAttributeNS");\n var setAttribute = method(ElementP, "setAttribute");\n var removeAttribute = method(ElementP, "removeAttribute");\n var createElement = method(DocumentP, "createElement");\n var createTextNode = method(DocumentP, "createTextNode");\n var getElementsByTagName = method(DocumentP, "getElementsByTagName");\n var documentElementOf = getter(DocumentP, "documentElement");\n var activeElementOf = getter(DocumentP, "activeElement");\n var defaultViewOf = getter(DocumentP, "defaultView");\n var focus = method(proto("HTMLElement"), "focus");\n var DialogP = proto("HTMLDialogElement");\n var showModal = method(DialogP, "showModal");\n var closeDialog = method(DialogP, "close");\n var dialogOpenOf = getter(DialogP, "open");\n var submitForm = method(proto("HTMLFormElement"), "submit");\n var FormDataC = win.FormData;\n var eachFormEntry = method(proto("FormData"), "forEach");\n var IFrameP = proto("HTMLIFrameElement");\n var contentWindowOf = getter(IFrameP, "contentWindow");\n var contentDocumentOf = getter(IFrameP, "contentDocument");\n var weakGet = method(WeakMapC.prototype, "get");\n var weakSet = method(WeakMapC.prototype, "set");\n var DataTransferC = win.DataTransfer;\n var URLC = win.URL;\n var hrefOf = getter(URLC.prototype, "href");\n var protocolOf = getter(URLC.prototype, "protocol");\n var hostnameOf = getter(URLC.prototype, "hostname");\n var setSearch = setter(URLC.prototype, "search");\n var ParamsC = win.URLSearchParams;\n var appendParam = method(ParamsC && ParamsC.prototype, "append");\n var paramsText = method(ParamsC && ParamsC.prototype, "toString");\n var StringP = win.String.prototype;\n var slice = method(StringP, "slice");\n var indexOf = method(StringP, "indexOf");\n var toLowerCase = method(StringP, "toLowerCase");\n var charCodeAt = method(StringP, "charCodeAt");\n var MutationObserverC = win.MutationObserver;\n var observe = method(proto("MutationObserver"), "observe");\n var disconnect = method(proto("MutationObserver"), "disconnect");\n var loc = win.location;\n var nativeOpen = win.open;\n var innerWidthOf = getter(win, "innerWidth");\n var innerHeightOf = getter(win, "innerHeight");\n var visual = win.visualViewport || null;\n var VisualViewportP = proto("VisualViewport");\n var visualWidthOf = getter(VisualViewportP, "width");\n var visualHeightOf = getter(VisualViewportP, "height");\n var visualLeftOf = getter(VisualViewportP, "offsetLeft");\n var visualTopOf = getter(VisualViewportP, "offsetTop");\n var lengthOf = getter(win, "length");\n var nameOf = getter(win, "name");\n var activation = win.navigator ? win.navigator.userActivation : null;\n var isActiveOf = activation ? getter(protoOf(activation), "isActive") : null;\n var navigation = win.navigation;\n var NavigateEventP = proto("NavigateEvent");\n var navigationTypeOf = getter(NavigateEventP, "navigationType");\n var destinationOf = getter(NavigateEventP, "destination");\n var downloadRequestOf = getter(NavigateEventP, "downloadRequest");\n var formDataOf = getter(NavigateEventP, "formData");\n var sourceElementOf = getter(NavigateEventP, "sourceElement");\n var userInitiatedOf = getter(NavigateEventP, "userInitiated");\n var urlOf = getter(proto("NavigationDestination"), "url");\n var sameDocumentOf = getter(proto("NavigationDestination"), "sameDocument");\n\n var XLINK = "http://www.w3.org/1999/xlink";\n var MAX_SCRIPT_PROMPTS = 3;\n var PROCEED_DELAY = 600;\n var BYPASS_TTL = 2000;\n var STYLE =\n ":host{all:initial!important;display:block!important;position:fixed!important;inset:0!important;" +\n "z-index:2147483647!important;pointer-events:none!important}" +\n "dialog{box-sizing:border-box;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;" +\n "margin:0;padding:16px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;" +\n "pointer-events:auto;color-scheme:light;color:#141414;font-size:14px;line-height:1.45;text-align:left}" +\n "dialog:not([open]){display:none}" +\n "dialog::backdrop{background:rgba(26,26,26,.35)}" +\n ".fallback{background:rgba(26,26,26,.35)}" +\n ".card{box-sizing:border-box;width:100%;max-width:440px;max-height:100%;overflow:auto;padding:24px;" +\n "border-radius:12px;background:#fff;box-shadow:0 8px 8px -4px rgba(16,24,40,.03),0 20px 24px -4px rgba(16,24,40,.08)}" +\n "h2{margin:0 0 8px;font-size:18px;font-weight:600;line-height:1.35;letter-spacing:-.01em}" +\n "p{margin:0;color:#333}" +\n ".host{padding:1px 6px;border:1px solid #fecaca;border-radius:4px;background:#fee2e2;color:#450a0a;" +\n "font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;word-break:break-all}" +\n ".actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}" +\n "button{box-sizing:border-box;min-width:120px;height:44px;margin:0;padding:0 20px;border:1px solid #141414;" +\n "border-radius:8px;font:inherit;font-size:14px;font-weight:500;line-height:1.15;cursor:pointer}" +\n ".stay{background:#141414;color:#fff}.stay:hover{background:#111}" +\n ".proceed{background:transparent;color:#141414}.proceed:hover{background:#f5f4f1}" +\n "button:focus-visible{outline:2px solid #141414;outline-offset:2px}" +\n "@media (max-width:480px){.actions{flex-direction:column}button{width:100%}}" +\n "@keyframes fade{from{opacity:0}to{opacity:1}}" +\n "@media (prefers-reduced-motion:no-preference){.card{animation:fade .12s ease-out}}";\n\n var exactHosts = create(null);\n var suffixHosts = create(null);\n var index;\n for (index = 0; index < cfg.rules.exact.length; index++) exactHosts[cfg.rules.exact[index]] = true;\n for (index = 0; index < cfg.rules.suffix.length; index++) suffixHosts[cfg.rules.suffix[index]] = true;\n var here = loc.hostname;\n if (here) {\n exactHosts[here] = true;\n exactHosts[slice(here, 0, 4) === "www." ? slice(here, 4) : "www." + here] = true;\n }\n\n function isTrustedHost(host) {\n if (exactHosts[host] === true) return true;\n for (var dot = indexOf(host, "."); dot !== -1; dot = indexOf(host, ".", dot + 1)) {\n if (suffixHosts[slice(host, dot + 1)] === true) return true;\n }\n return false;\n }\n\n function parseWebUrl(raw, base) {\n var url;\n try {\n url = new URLC(raw, base || baseURIOf(doc));\n } catch (error) {\n return null;\n }\n var protocol = protocolOf(url);\n if (protocol !== "http:" && protocol !== "https:") return null;\n var host = hostnameOf(url);\n if (host.length > 1 && charCodeAt(host, host.length - 1) === 46) host = slice(host, 0, -1);\n return { href: hrefOf(url), host: host };\n }\n\n function isActiveIn(source) {\n return !isActiveOf || !source ? true : isActiveOf(source);\n }\n\n function element(parent, tag, className, text) {\n var node = createElement(doc, tag);\n if (className) setAttribute(node, "class", className);\n if (text) setTextContent(node, text);\n appendChild(parent, node);\n return node;\n }\n\n var texts = cfg.texts;\n var container = createElement(doc, "div");\n var shadow = attachShadow(container, { mode: "closed" });\n element(shadow, "style", "", STYLE);\n var dialog = element(shadow, "dialog", showModal ? "" : "fallback", "");\n setAttribute(dialog, "role", "alertdialog");\n setAttribute(dialog, "aria-modal", "true");\n setAttribute(dialog, "aria-labelledby", "title");\n setAttribute(dialog, "aria-describedby", "body");\n setAttribute(dialog, "lang", texts.lang);\n setAttribute(dialog, "dir", "ltr");\n var card = element(dialog, "div", "card", "");\n setAttribute(element(card, "h2", "", texts.title), "id", "title");\n var body = element(card, "p", "", "");\n setAttribute(body, "id", "body");\n appendChild(body, createTextNode(doc, texts.bodyBefore));\n var hostLabel = element(body, "bdi", "host", "");\n setAttribute(hostLabel, "dir", "ltr");\n appendChild(body, createTextNode(doc, texts.bodyAfter));\n var actions = element(card, "div", "actions", "");\n var stayButton = element(actions, "button", "stay", texts.stay);\n var proceedButton = element(actions, "button", "proceed", texts.proceed);\n setAttribute(stayButton, "type", "button");\n setAttribute(proceedButton, "type", "button");\n\n var pending = null;\n var bypass = null;\n var observer = null;\n var restoreFocusTo = null;\n var savedOverflow = "";\n var focusedButton = stayButton;\n var scriptPrompts = 0;\n\n // A fixed dialog covers the layout viewport. When the page is wider than the screen, Android\n // Chrome widens the layout viewport to the page, so the dialog is centred on the page and lands\n // outside what the shopper sees. Lay it over the visual viewport then; leave it to the CSS\n // whenever the two match, which is every page that fits its screen.\n function fitToView() {\n var style = dialog.style;\n style.left = style.top = style.right = style.bottom = style.width = style.height = "";\n if (!visual || !visualWidthOf || !visualHeightOf || !visualLeftOf || !visualTopOf) return;\n if (!innerWidthOf || !innerHeightOf) return;\n var width = visualWidthOf(visual);\n var height = visualHeightOf(visual);\n var left = visualLeftOf(visual);\n var top = visualTopOf(visual);\n if (!(width > 0 && height > 0)) return;\n // innerWidth/innerHeight: the layout viewport, scrollbars included. The root\'s overflow is\n // hidden while the dialog is open, so on a page that fits there is nothing between the two.\n if (left < 1 && top < 1 && width > innerWidthOf(win) - 1 && height > innerHeightOf(win) - 1) return;\n style.left = left + "px";\n style.top = top + "px";\n style.right = style.bottom = "auto";\n style.width = width + "px";\n style.height = height + "px";\n }\n\n function followView(on) {\n if (!visual) return;\n (on ? listen : unlisten)(visual, "resize", fitToView);\n (on ? listen : unlisten)(visual, "scroll", fitToView);\n }\n\n function show(next) {\n var root = documentElementOf(doc);\n if (!root) return;\n pending = next;\n next.shownAt = now();\n setTextContent(hostLabel, next.host);\n restoreFocusTo = activeElementOf(doc);\n var fontFamily = "";\n try {\n fontFamily = doc.body ? win.getComputedStyle(doc.body).fontFamily : "";\n } catch (error) {}\n card.style.fontFamily = fontFamily || "system-ui,-apple-system,\'Segoe UI\',Roboto,sans-serif";\n appendChild(root, container);\n savedOverflow = root.style.overflow;\n root.style.overflow = "hidden";\n if (showModal) {\n try {\n showModal(dialog);\n } catch (error) {\n setAttribute(dialog, "open", "");\n }\n } else {\n setAttribute(dialog, "open", "");\n }\n fitToView();\n followView(true);\n focus(stayButton);\n if (MutationObserverC && observe) {\n observer = new MutationObserverC(function () {\n if (pending !== null && !isConnectedOf(container)) reset();\n });\n observe(observer, root, { childList: true });\n }\n }\n\n function reset() {\n pending = null;\n followView(false);\n if (observer !== null) {\n disconnect(observer);\n observer = null;\n }\n if (closeDialog && dialogOpenOf(dialog)) closeDialog(dialog);\n else removeAttribute(dialog, "open");\n var parent = parentNodeOf(container);\n if (parent) removeChild(parent, container);\n var root = documentElementOf(doc);\n if (root) root.style.overflow = savedOverflow;\n var previous = restoreFocusTo;\n restoreFocusTo = null;\n if (previous) {\n try {\n focus(previous);\n } catch (error) {}\n }\n }\n\n function stay() {\n if (pending !== null) reset();\n }\n\n function submitCopy(copy, action, target) {\n var root = documentElementOf(doc);\n var form = createElement(doc, "form");\n setAttribute(form, "method", "post");\n setAttribute(form, "action", action);\n setAttribute(form, "enctype", copy.enctype);\n setAttribute(form, "target", target);\n setAttribute(form, "hidden", "");\n for (var i = 0; i < copy.entries.length; i++) {\n var input = createElement(doc, "input");\n var value = copy.entries[i][1];\n setAttribute(input, "name", copy.entries[i][0]);\n if (typeof value === "string") {\n setAttribute(input, "type", "hidden");\n setAttribute(input, "value", value);\n } else {\n if (!DataTransferC) return false;\n var transfer = new DataTransferC();\n transfer.items.add(value);\n setAttribute(input, "type", "file");\n input.files = transfer.files;\n }\n appendChild(form, input);\n }\n if (!root) return false;\n appendChild(root, form);\n submitForm(form);\n if (target !== "_self") removeChild(root, form);\n return true;\n }\n\n function proceed() {\n var approved = pending;\n reset();\n if (approved.newTab) {\n if (approved.form !== null) {\n submitCopy(approved.form, approved.href, "_blank");\n } else {\n apply(nativeOpen, win, [approved.href, approved.target, approved.features ? approved.features + ",noopener" : "noopener"]);\n }\n return;\n }\n bypass = { href: approved.href, until: now() + BYPASS_TTL };\n if (approved.form !== null) {\n if (!submitCopy(approved.form, approved.href, "_self")) bypass = null;\n } else if (approved.replace) {\n loc.replace(approved.href);\n } else {\n loc.assign(approved.href);\n }\n }\n\n function attempt(next) {\n if (pending !== null) {\n if (isConnectedOf(container)) return;\n reset();\n }\n if (next.script) {\n if (scriptPrompts >= MAX_SCRIPT_PROMPTS) return;\n scriptPrompts++;\n }\n show(next);\n }\n\n listen(stayButton, "click", function () {\n stay();\n });\n listen(proceedButton, "click", function (event) {\n if (event.isTrusted && pending !== null && now() - pending.shownAt >= PROCEED_DELAY) proceed();\n });\n listen(stayButton, "focus", function () {\n focusedButton = stayButton;\n });\n listen(proceedButton, "focus", function () {\n focusedButton = proceedButton;\n });\n listen(dialog, "click", function (event) {\n if (targetOf(event) === dialog) stay();\n });\n listen(dialog, "cancel", function (event) {\n preventDefault(event);\n stay();\n });\n listen(dialog, "close", function () {\n if (dialogOpenOf && !dialogOpenOf(dialog)) stay();\n });\n listen(dialog, "keydown", function (event) {\n if (showModal || !keyOf) return;\n var key = keyOf(event);\n if (key === "Escape") {\n stay();\n } else if (key === "Tab") {\n preventDefault(event);\n focus(focusedButton === stayButton ? proceedButton : stayButton);\n }\n });\n\n function isNode(value) {\n try {\n nodeTypeOf(value);\n return true;\n } catch (error) {\n return false;\n }\n }\n\n function linkHref(node) {\n if (!isNode(node) || nodeTypeOf(node) !== 1) return null;\n var name = localNameOf(node);\n if (name !== "a" && name !== "area") return null;\n var href = getAttribute(node, "href");\n if (href === null && getAttributeNS) href = getAttributeNS(node, XLINK, "href");\n return href;\n }\n\n function linkInPath(path, bubbles) {\n for (var i = 0; i < path.length; i++) {\n if (linkHref(path[i]) !== null) return path[i];\n if (!bubbles || !isNode(path[i]) || nodeTypeOf(path[i]) === 9) return null;\n }\n return null;\n }\n\n function parentAcross(node) {\n var parent = parentNodeOf(node);\n if (parent || nodeTypeOf(node) !== 11 || !hostOf) return parent;\n try {\n return hostOf(node);\n } catch (error) {\n return null;\n }\n }\n\n function linkAbove(node, bubbles) {\n for (var current = node, steps = 0; current && steps < 1024; current = parentAcross(current), steps++) {\n if (linkHref(current) !== null) return current;\n if (!bubbles) return null;\n }\n return null;\n }\n\n var watchedRoots = new WeakMapC();\n\n function isWatched(node) {\n var root = node;\n for (var parent = parentNodeOf(node); parent; parent = parentNodeOf(parent)) root = parent;\n return weakGet(watchedRoots, root) === true;\n }\n\n function baseTarget(root) {\n var bases = root ? getElementsByTagName(root, "base") : [];\n for (var i = 0; i < bases.length; i++) {\n var target = getAttribute(bases[i], "target");\n if (target !== null) return target;\n }\n return "";\n }\n\n function windowName(target) {\n try {\n return nameOf ? nameOf(target) : null;\n } catch (error) {\n return null;\n }\n }\n\n function hasFrameNamed(parent, name, level) {\n var count;\n try {\n count = lengthOf ? lengthOf(parent) : 0;\n } catch (error) {\n return false;\n }\n for (var i = 0; i < count && i < 64; i++) {\n var child;\n try {\n child = parent[i];\n } catch (error) {\n continue;\n }\n if (!child) continue;\n if (windowName(child) === name) return true;\n if (level < 4 && hasFrameNamed(child, name, level + 1)) return true;\n }\n return false;\n }\n\n function targetGoesTo(target, depth, realm) {\n var name = toLowerCase(target);\n if (name === "" || name === "_self") return depth === 0 ? "tab" : null;\n if (name === "_top") return "tab";\n if (name === "_parent") return depth <= 1 ? "tab" : null;\n if (name === "_blank") return "new";\n if (realm && windowName(realm) === target) return depth === 0 ? "tab" : null;\n if (windowName(win) === target) return "tab";\n return hasFrameNamed(win, target, 0) ? null : "new";\n }\n\n function viewOf(node) {\n var owner = ownerDocumentOf(node);\n return owner ? defaultViewOf(owner) : null;\n }\n\n function linkAttempt(node, depth, script) {\n var href = linkHref(node);\n if (href === null) return null;\n var url = parseWebUrl(href, baseURIOf(node));\n if (url === null || isTrustedHost(url.host)) return null;\n var target = getAttribute(node, "target");\n var goesTo = targetGoesTo(target === null ? baseTarget(ownerDocumentOf(node)) : target, depth, viewOf(node));\n if (goesTo === null) return null;\n return {\n href: url.href,\n host: url.host,\n newTab: goesTo === "new",\n target: "_blank",\n features: "",\n replace: false,\n form: null,\n script: script,\n };\n }\n\n function copyForm(data, source) {\n var entries = [];\n var hasFile = false;\n eachFormEntry(data, function (value, name) {\n entries[entries.length] = [name, value];\n if (typeof value !== "string") hasFile = true;\n });\n var enctype = null;\n if (source && nodeTypeOf(source) === 1) {\n enctype = getAttribute(source, "formenctype");\n var owner = localNameOf(source) === "form" ? source : source.form;\n if (!enctype && owner) enctype = getAttribute(owner, "enctype");\n }\n if (!enctype) enctype = hasFile ? "multipart/form-data" : "application/x-www-form-urlencoded";\n return { entries: entries, enctype: enctype };\n }\n\n function formValue(button, buttonName, form, formName) {\n var value = button ? getAttribute(button, buttonName) : null;\n return value !== null ? value : getAttribute(form, formName);\n }\n\n function readForm(form, button) {\n try {\n return button ? new FormDataC(form, button) : new FormDataC(form);\n } catch (error) {\n try {\n return new FormDataC(form);\n } catch (retryError) {\n return null;\n }\n }\n }\n\n function withQuery(href, entries) {\n if (!ParamsC || !appendParam || !paramsText || !setSearch) return href;\n var params = new ParamsC();\n for (var i = 0; i < entries.length; i++) {\n var value = entries[i][1];\n appendParam(params, entries[i][0], typeof value === "string" ? value : value.name);\n }\n var url = new URLC(href);\n setSearch(url, paramsText(params));\n return hrefOf(url);\n }\n\n function formAttempt(form, submitter, depth, script, copy) {\n if (!isNode(form) || nodeTypeOf(form) !== 1 || localNameOf(form) !== "form") return null;\n var button = submitter && isNode(submitter) && nodeTypeOf(submitter) === 1 ? submitter : null;\n var action = formValue(button, "formaction", form, "action");\n var url = parseWebUrl(action === null ? "" : action, baseURIOf(form));\n if (url === null || isTrustedHost(url.host)) return null;\n var target = formValue(button, "formtarget", form, "target");\n var goesTo = targetGoesTo(target === null ? baseTarget(ownerDocumentOf(form)) : target, depth, viewOf(form));\n if (goesTo === null || (goesTo === "tab" && navigation)) return null;\n var method = formValue(button, "formmethod", form, "method");\n method = method === null ? "get" : toLowerCase(method);\n if (method === "dialog") return null;\n var next = {\n href: url.href,\n host: url.host,\n newTab: goesTo === "new",\n target: goesTo === "new" ? "_blank" : "_self",\n features: "",\n replace: false,\n form: null,\n script: script,\n };\n if (!copy) return next;\n var data = readForm(form, button);\n if (data === null) return null;\n var copied = copyForm(data, button || form);\n if (method === "post") next.form = copied;\n else next.href = withQuery(url.href, copied.entries);\n return next;\n }\n\n function isMouseEvent(event) {\n try {\n buttonOf(event);\n return true;\n } catch (error) {\n return false;\n }\n }\n\n function isShoppersOwnChoice(event) {\n if (!event.isTrusted) return false;\n try {\n return buttonOf(event) !== 0 || ctrlKeyOf(event) || metaKeyOf(event) || shiftKeyOf(event) || altKeyOf(event);\n } catch (error) {\n return true;\n }\n }\n\n var eventStates = new WeakMapC();\n var armedEvents = [];\n\n function stateOf(event) {\n var state = weakGet(eventStates, event);\n if (!state) {\n state = { decided: false, link: null, armed: null };\n weakSet(eventStates, event, state);\n }\n return state;\n }\n\n function disarm(state) {\n var armed = state.armed;\n if (armed === null || armed.done) return;\n armed.done = true;\n for (var i = 0; i < armed.nodes.length; i++) {\n unlisten(armed.nodes[i], armed.type, armed.check, true);\n unlisten(armed.nodes[i], armed.type, armed.check, false);\n }\n }\n\n function sweep() {\n var live = [];\n for (var i = 0; i < armedEvents.length; i++) {\n if (eventPhaseOf(armedEvents[i]) === 0) disarm(stateOf(armedEvents[i]));\n else live[live.length] = armedEvents[i];\n }\n armedEvents = live;\n }\n\n function arm(event, type, decide) {\n var state = stateOf(event);\n if (state.decided || state.armed !== null || !composedPath || !unlisten) return;\n var check = function (current) {\n if (current === event && cancelBubbleOf(current)) decide(current);\n };\n var path = composedPath(event);\n var nodes = [];\n for (var i = 0; i < path.length; i++) {\n if (!isNode(path[i])) continue;\n listen(path[i], type, check, true);\n listen(path[i], type, check, false);\n nodes[nodes.length] = path[i];\n }\n state.armed = { nodes: nodes, type: type, check: check, done: false };\n armedEvents[armedEvents.length] = event;\n }\n\n function hold(event, next) {\n var state = stateOf(event);\n state.decided = true;\n disarm(state);\n preventDefault(event);\n stopImmediatePropagation(event);\n attempt(next);\n }\n\n function onClickCapture(event, depth, active) {\n sweep();\n var state = stateOf(event);\n if (state.decided || !composedPath) return;\n var link = linkInPath(composedPath(event), bubblesOf(event));\n if (link === null) return;\n state.link = link;\n if (!event.isTrusted) {\n var next = isMouseEvent(event) ? linkAttempt(link, depth, true) : null;\n if (next !== null && next.newTab && active()) hold(event, next);\n return;\n }\n if (isShoppersOwnChoice(event)) return;\n var held = linkAttempt(link, depth, false);\n if (held !== null && (held.newTab || !navigation)) {\n arm(event, "click", function (current) {\n decideClick(current, depth, active);\n });\n }\n }\n\n function decideClick(event, depth, active) {\n var state = stateOf(event);\n if (state.decided || defaultPreventedOf(event) || isShoppersOwnChoice(event)) return;\n if (!event.isTrusted && !isMouseEvent(event)) return;\n var link = state.link;\n if (link === null && composedPath) link = linkInPath(composedPath(event), bubblesOf(event));\n if (link === null) return;\n var next = linkAttempt(link, depth, !event.isTrusted);\n if (next === null || (next.script && next.newTab && !active())) return;\n hold(event, next);\n }\n\n function onSubmitCapture(event, depth, active) {\n sweep();\n var state = stateOf(event);\n if (state.decided) return;\n if (formAttempt(targetOf(event), submitterOf ? submitterOf(event) : null, depth, false, false) === null) return;\n arm(event, "submit", function (current) {\n decideSubmit(current, depth, active);\n });\n }\n\n function decideSubmit(event, depth, active) {\n var state = stateOf(event);\n if (state.decided || defaultPreventedOf(event)) return;\n var form = targetOf(event);\n var submitter = submitterOf ? submitterOf(event) : null;\n var found = formAttempt(form, submitter, depth, !event.isTrusted, false);\n if (found === null || (found.newTab && !active())) return;\n var next = formAttempt(form, submitter, depth, !event.isTrusted, true);\n if (next !== null) hold(event, next);\n }\n\n function holdScriptClick(node, bubbles, uncancelable, depth, active) {\n if (!isNode(node) || (!uncancelable && isWatched(node))) return false;\n var link = linkAbove(node, bubbles);\n if (link === null || (!isConnectedOf(link) && localNameOf(link) !== "a") || !viewOf(link)) return false;\n var next = linkAttempt(link, depth, true);\n if (next === null || (next.newTab && !active())) return false;\n attempt(next);\n return true;\n }\n\n function holdFormCall(form, submitter, unseenOnly, depth, active) {\n if (!isNode(form) || !isConnectedOf(form) || (unseenOnly && isWatched(form))) return false;\n var found = formAttempt(form, submitter, depth, true, false);\n if (found === null || (found.newTab && !active())) return false;\n var next = formAttempt(form, submitter, depth, true, true);\n if (next === null) return false;\n attempt(next);\n return true;\n }\n\n function isClick(event) {\n try {\n return typeOf(event) === "click" && isMouseEvent(event);\n } catch (error) {\n return false;\n }\n }\n\n function openAttempt(args, realm, depth) {\n if (args[0] === "") return null;\n var base;\n try {\n base = baseURIOf(realm.document);\n } catch (error) {\n return null;\n }\n var destination = parseWebUrl(args[0], base);\n if (destination === null || isTrustedHost(destination.host)) return null;\n var name = args[1] === "" ? "_blank" : args[1];\n var goesTo = targetGoesTo(name, depth, realm);\n if (goesTo === null) return null;\n return {\n href: destination.href,\n host: destination.host,\n newTab: goesTo === "new",\n target: name,\n features: args[2],\n replace: false,\n form: null,\n script: true,\n };\n }\n\n var ownFunctions = new WeakMapC();\n\n function wrap(target, name, make) {\n var original;\n try {\n original = target ? target[name] : null;\n } catch (error) {\n return;\n }\n if (typeof original !== "function" || weakGet(ownFunctions, original) === true) return;\n var wrapper = make(original);\n weakSet(ownFunctions, wrapper, true);\n try {\n target[name] = wrapper;\n } catch (error) {}\n }\n\n function wrapRealm(realm, depth, hooks) {\n var active = hooks.active;\n wrap(realm, "open", function (original) {\n return function open() {\n for (var i = 0; i < arguments.length; i++) {\n if (typeof arguments[i] === "symbol") return apply(original, realm, arguments);\n }\n var args = [\n arguments.length > 0 && arguments[0] !== undefined ? toText(arguments[0]) : "",\n arguments.length > 1 && arguments[1] !== undefined ? toText(arguments[1]) : "_blank",\n arguments.length > 2 && arguments[2] !== undefined ? toText(arguments[2]) : "",\n ];\n var next = openAttempt(args, realm, depth);\n if (next === null || (next.newTab && !active())) return apply(original, realm, args);\n attempt(next);\n return null;\n };\n });\n wrap(protoIn(realm, "HTMLElement"), "click", function (original) {\n return function click() {\n if (!holdScriptClick(this, true, false, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(protoIn(realm, "EventTarget"), "dispatchEvent", function (original) {\n return function dispatchEvent(event) {\n if (isClick(event) && holdScriptClick(this, bubblesOf(event), !cancelableOf(event), depth, active)) {\n return false;\n }\n return apply(original, this, arguments);\n };\n });\n var FormP = protoIn(realm, "HTMLFormElement");\n wrap(FormP, "submit", function (original) {\n return function submit() {\n if (!holdFormCall(this, null, false, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(FormP, "requestSubmit", function (original) {\n return function requestSubmit() {\n var submitter = arguments.length > 0 ? arguments[0] : null;\n if (!holdFormCall(this, submitter, true, depth, active)) return apply(original, this, arguments);\n };\n });\n wrap(protoIn(realm, "Element"), "attachShadow", function (original) {\n return function attachShadow(init) {\n var root = apply(original, this, arguments);\n watchShadow(root, depth, hooks);\n return root;\n };\n });\n }\n\n function watchShadow(root, depth, hooks) {\n try {\n listen(root, "click", hooks.clickCapture, true);\n listen(root, "submit", hooks.submitCapture, true);\n listen(root, "submit", hooks.submit);\n } catch (error) {\n return;\n }\n weakSet(watchedRoots, root, true);\n watchFrames(root, depth + 1);\n }\n\n var realmHooks = new WeakMapC();\n var frameLoadListeners = new WeakMapC();\n\n function hooksFor(realm, depth) {\n var realmActivation = null;\n if (depth > 0) {\n try {\n realmActivation = realm.navigator ? realm.navigator.userActivation : null;\n } catch (error) {}\n }\n var active = function () {\n return isActiveIn(activation) || (depth > 0 && isActiveIn(realmActivation));\n };\n return {\n active: active,\n clickCapture: function (event) {\n onClickCapture(event, depth, active);\n },\n click: function (event) {\n decideClick(event, depth, active);\n },\n submitCapture: function (event) {\n onSubmitCapture(event, depth, active);\n },\n submit: function (event) {\n decideSubmit(event, depth, active);\n },\n };\n }\n\n function armRealm(realm, depth) {\n var realmDocument;\n try {\n realmDocument = realm.document;\n } catch (error) {\n return;\n }\n if (!realmDocument) return;\n var hooks = weakGet(realmHooks, realm);\n if (!hooks) {\n hooks = hooksFor(realm, depth);\n weakSet(realmHooks, realm, hooks);\n }\n try {\n listen(realm, "click", hooks.clickCapture, true);\n listen(realm, "click", hooks.click);\n listen(realm, "submit", hooks.submitCapture, true);\n listen(realm, "submit", hooks.submit);\n } catch (error) {\n return;\n }\n weakSet(watchedRoots, realmDocument, true);\n wrapRealm(realm, depth, hooks);\n watchFrames(realmDocument, depth + 1);\n }\n\n function guardFrame(frame, depth) {\n var frameWin;\n try {\n frameWin = contentWindowOf(frame);\n if (!frameWin || !contentDocumentOf(frame)) return;\n } catch (error) {\n return;\n }\n armRealm(frameWin, depth);\n }\n\n function watchFrames(root, depth) {\n if (!contentWindowOf || !contentDocumentOf) return;\n var onLoad = weakGet(frameLoadListeners, root);\n if (!onLoad) {\n onLoad = function (event) {\n var frame = targetOf(event);\n if (frame && nodeTypeOf(frame) === 1 && localNameOf(frame) === "iframe") guardFrame(frame, depth);\n };\n weakSet(frameLoadListeners, root, onLoad);\n }\n listen(root, "load", onLoad, true);\n if (nodeTypeOf(root) !== 9) return;\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) guardFrame(frames[i], depth);\n }\n\n armRealm(win, 0);\n\n if (navigation && navigationTypeOf && destinationOf && urlOf) {\n listen(navigation, "navigate", function (event) {\n if (!event.isTrusted || !cancelableOf(event)) return;\n var type = navigationTypeOf(event);\n if (type === "traverse" || type === "reload") return;\n var destination = destinationOf(event);\n if (sameDocumentOf && sameDocumentOf(destination)) return;\n if (downloadRequestOf && downloadRequestOf(event) !== null) return;\n var url = parseWebUrl(urlOf(destination));\n if (url === null) return;\n if (bypass !== null && bypass.href === url.href) {\n var approved = now() <= bypass.until;\n bypass = null;\n if (approved) return;\n }\n if (isTrustedHost(url.host)) return;\n preventDefault(event);\n var data = formDataOf ? formDataOf(event) : null;\n attempt({\n href: url.href,\n host: url.host,\n newTab: false,\n target: "_self",\n features: "",\n replace: type === "replace",\n form: data ? copyForm(data, sourceElementOf ? sourceElementOf(event) : null) : null,\n script: !(userInitiatedOf && userInitiatedOf(event)),\n });\n });\n }\n\n listen(win, "pageshow", function (event) {\n if (pending !== null && persistedOf && persistedOf(event)) reset();\n });\n})'])));export{t as REDIRECT_GUARD_RUNTIME};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HostRules } from "./hosts";
|
|
2
|
+
import { RedirectGuardTexts } from "./texts";
|
|
3
|
+
export declare type RedirectGuardConfig = {
|
|
4
|
+
rules: HostRules;
|
|
5
|
+
texts: RedirectGuardTexts;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* JSON for an inline script: pure ASCII, and unable to end the script element or open an HTML
|
|
9
|
+
* comment in it. `<`, `>` and `&` become `\u` escapes like every character outside ASCII (U+2028
|
|
10
|
+
* and U+2029 included), so the script means the same under any charset the page is read with.
|
|
11
|
+
*/
|
|
12
|
+
export declare function toInlineScriptJson(value: unknown): string;
|
|
13
|
+
/** The guard as the page's first script: the runtime, called with this store's rules and copy. */
|
|
14
|
+
export declare function buildRedirectGuardScript(config: RedirectGuardConfig): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NAVIGATION_WARNING_SCRIPT_ATTRIBUTE as t}from"@ikas/storefront-config";import{REDIRECT_GUARD_RUNTIME as r}from"./runtime.js";function n(t){return JSON.stringify(t).replace(/[<>&\u007f-\uffff]/g,(function(t){return"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0")}))}function o(o){return"<script ".concat(t,">").concat(r,"(window,").concat(n(o),");<\/script>")}export{o as buildRedirectGuardScript,n as toInlineScriptJson};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The backend's limit on the merchant's own list; anything past it is dropped, not inlined. */
|
|
2
|
+
export declare const MAX_ALLOWED_HOSTS = 100;
|
|
3
|
+
export declare type NavigationWarningSettings = {
|
|
4
|
+
/** The hosts the merchant added, normalized. ikas's starter list comes on top of these. */
|
|
5
|
+
allowedHosts: string[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* `storefront.navigationWarningSettings` (FR-1077) — `{ isEnabled: boolean, allowedHosts: string[] }`
|
|
9
|
+
* in the backend model — or null when the warning is off.
|
|
10
|
+
*
|
|
11
|
+
* Read as `unknown` all the same: the warning turns on for `isEnabled === true` and nothing else,
|
|
12
|
+
* so a missing field (every store until its merchant turns the warning on) or a malformed one
|
|
13
|
+
* leaves the page exactly as it renders without the warning. The backend validates the list
|
|
14
|
+
* before it stores it; it is normalized again here because these hosts end up inside a script.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseNavigationWarningSettings(value: unknown): NavigationWarningSettings | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{normalizeHostPattern as r}from"./hosts.js";var t=100;function o(t){if(!t||"object"!=typeof t)return null;var o=t,e=o.isEnabled,l=o.allowedHosts;return!0!==e?null:{allowedHosts:(Array.isArray(l)?l:[]).slice(0,100).map(r).filter((function(r){return!!r}))}}export{t as MAX_ALLOWED_HOSTS,o as parseNavigationWarningSettings};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type RedirectGuardTexts = {
|
|
2
|
+
/** The language the copy is in, for the dialog's `lang`. */
|
|
3
|
+
lang: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** The body around the destination host, which the browser fills in. */
|
|
6
|
+
bodyBefore: string;
|
|
7
|
+
bodyAfter: string;
|
|
8
|
+
stay: string;
|
|
9
|
+
proceed: string;
|
|
10
|
+
};
|
|
11
|
+
/** The copy for a routing locale (`tr`, `de-DE`, `en_US`…), English when there is none for it. */
|
|
12
|
+
export declare function getRedirectGuardTexts(locale: string | null | undefined): RedirectGuardTexts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={tr:{title:"Başka bir siteye gidiyorsunuz",body:"Bu sayfa sizi {host} adresine götürmek istiyor. Kartınızı ya da şifrenizi bu adreste girmeyin.",stay:"Bu sayfada kal",proceed:"Devam et"},en:{title:"You're going to another site",body:"This page wants to take you to {host}. Don't enter your card details or password there.",stay:"Stay on this page",proceed:"Continue"},de:{title:"Sie wechseln zu einer anderen Website",body:"Diese Seite möchte Sie zu {host} weiterleiten. Geben Sie dort keine Kartendaten oder Passwörter ein.",stay:"Auf dieser Seite bleiben",proceed:"Weiter"},fr:{title:"Vous allez vers un autre site",body:"Cette page veut vous rediriger vers {host}. N'y saisissez ni vos données de carte ni votre mot de passe.",stay:"Rester sur cette page",proceed:"Continuer"}};function t(t){var r=(t||"").toLowerCase().split(/[-_]/)[0],i=Object.prototype.hasOwnProperty.call(e,r)?r:"en",o=e[i],s=o.title,a=o.body,n=o.stay,d=o.proceed,y=a.split("{host}"),u=y[0],l=y[1];return{lang:i,title:s,bodyBefore:u,bodyAfter:void 0===l?"":l,stay:n,proceed:d}}export{t as getRedirectGuardTexts};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.4",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^4.16.
|
|
21
|
-
"@ikas/storefront-providers": "^4.16.
|
|
22
|
-
"@ikas/storefront-models": "^4.16.
|
|
23
|
-
"@ikas/storefront-api": "^4.16.
|
|
24
|
-
"@ikas/storefront-assets": "^4.16.
|
|
20
|
+
"@ikas/storefront-config": "^4.16.4",
|
|
21
|
+
"@ikas/storefront-providers": "^4.16.4",
|
|
22
|
+
"@ikas/storefront-models": "^4.16.4",
|
|
23
|
+
"@ikas/storefront-api": "^4.16.4",
|
|
24
|
+
"@ikas/storefront-assets": "^4.16.4",
|
|
25
25
|
"axios": "^0.26.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"adm-zip": "^0.5.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^4.16.
|
|
32
|
-
"@ikas/storefront-config": "^4.16.
|
|
33
|
-
"@ikas/storefront-providers": "^4.16.
|
|
34
|
-
"@ikas/storefront-models": "^4.16.
|
|
35
|
-
"@ikas/storefront-api": "^4.16.
|
|
36
|
-
"@ikas/storefront-assets": "^4.16.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.16.4",
|
|
32
|
+
"@ikas/storefront-config": "^4.16.4",
|
|
33
|
+
"@ikas/storefront-providers": "^4.16.4",
|
|
34
|
+
"@ikas/storefront-models": "^4.16.4",
|
|
35
|
+
"@ikas/storefront-api": "^4.16.4",
|
|
36
|
+
"@ikas/storefront-assets": "^4.16.4",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
38
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
39
39
|
"@rollup/plugin-json": "^4.1.0",
|