@guardian/support-dotcom-components 2.3.1 → 2.3.3
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/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/shared/src/types/props/banner.d.ts +8 -6
- package/dist/shared/src/types/props/banner.d.ts.map +1 -1
- package/dist/shared/src/types/props/epic.d.ts +2 -2
- package/dist/shared/src/types/props/epic.d.ts.map +1 -1
- package/dist/shared/src/types/props/header.d.ts +2 -2
- package/dist/shared/src/types/props/header.d.ts.map +1 -1
- package/dist/shared/src/types/targeting/banner.d.ts +1 -0
- package/dist/shared/src/types/targeting/banner.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"zod";const n="gu.contributions.views",t=e=>e.get(n)||void 0,a=e=>{const t=localStorage.getItem(n),a=t?JSON.parse(t).value:[];a.push({date:(new Date).getTime(),testId:e});const i={value:a.slice(-50)};localStorage.setItem(n,JSON.stringify(i))},i="gu.history.weeklyArticleCount",r="gu.history.articleCountsThisWeek",o=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},s=e=>e.get(i)||void 0,l=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes"]),u=(e,n={})=>(e.forEach((e=>{l.has(e)&&(n[e]=(n[e]??0)+1)})),n),c=(e,n,t)=>{const a=((e,n)=>{const t=o(new Date),a=e.get(r);if(a&&a.week===t){const i=a.articles[n]||0;return e.set(r,{week:t,articles:{...a.articles,[n]:i+1}}),i>0}return e.set(r,{week:t,articles:{[n]:1}}),!1})(e,n);if(!a){const n=o(new Date),a=e.get(i)||[],r=a[0];if(r&&r.week&&r.week===n)r.count+=1,r.tags=u(t,r.tags),e.set(i,a);else{a.unshift({week:n,count:1,tags:u(t,{})});const r=n-365,o=a.filter((e=>e.week>=r));e.set(i,o)}}},d=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],g=e.enum(d),m={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},C={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},p={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},b=e=>Object.keys(m).find((n=>m[n].countries.includes(e??"")))||"International",S=(e,n=[])=>0===n.length||!!e&&n.includes(b(e.toUpperCase())),h=e=>{if(e){const n=b(e);return p[n]}return"£"},y=e=>{if(e)return C[e]},A=(e,n)=>{if(n){const t=(e=>m[b(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},T=(e,n,t,a)=>{if(a){const i=a[b(t)];if(i){return`${h(t)}${i[e][n].price}`}}},I={CURRENCY_SYMBOL:({countryCode:e})=>h(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>T("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>T("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>T("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>T("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},N=(e,n,t)=>e?e.replace(M,(e=>{const a=e.substring(2,e.length-2),i=I[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",M=/%%.*?%%/g,E=e=>{const n=e.match(M)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},G=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},U=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),i=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${i}-${t}-01`,reminderLabel:`${a} ${i}`}},R=new Date("2023-12-31"),B=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<G(e.getFullYear()),P=(e,n=new Date)=>{return"US"===e&&B(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(G(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=G(e.getFullYear())&&e<R)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):U(n);var t},L=e.object({text:e.string(),baseUrl:e.string()});let D=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(D);const w=e.object({type:e.literal(D.Custom),cta:L}),O=e.object({type:e.literal(D.ContributionsReminder)}),f=e.discriminatedUnion("type",[w,O]);let K=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const k=e.nativeEnum(K);let F=function(e){return e.money="money",e}({});const v=e.nativeEnum(F),H=e.object({countLabel:e.string(),goalReachedPrimary:e.string(),goalReachedSecondary:e.string()}),Y=e.object({total:e.number(),goal:e.number()}),j=e.enum(["US","AU"]),V=e.object({endType:k,countType:v,currencySymbol:e.string(),copy:H,name:j,tickerData:Y.optional()}),W=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),Z=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),x=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:Z,products:e.array(W).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string(),clientName:e.string()}),$=e.object({mainUrl:e.string(),mobileUrl:e.string().optional(),tabletUrl:e.string().optional(),desktopUrl:e.string().optional(),leftColUrl:e.string().optional(),wideUrl:e.string().optional(),altText:e.string()}),_=e.object({name:e.string(),description:e.string().optional(),headshot:$.optional()}),J=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),Q=e.enum(["new","guest","current"]),z=e.enum(["Live","Draft","Archived"]),q=e.enum(["Mobile","Desktop","All","iOS","Android"]),X=e.enum(["SignedIn","SignedOut","All"]),ee=e.enum(["HasConsented","HasNotConsented","All"]),ne=e.object({name:e.string(),status:z,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:q.optional(),signedInStatus:X.optional(),consentStatus:ee.optional()}),te=e.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ae=e.object({minViews:e.number(),maxViews:e.number().optional(),periodInWeeks:e.number(),tagIds:e.array(e.string()).optional()});e.object({userType:e.array(Q),product:e.array(J)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const ie=e.enum(["for52Weeks","forTargetedWeeks"]),re=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),oe=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),se=e.object({type:e.literal("above"),copy:e.string().optional(),countType:ie.optional()}),le=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),ue=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),ce=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:ue,displayContributionType:ue.array(),amountsCardData:e.object({ONE_OFF:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),MONTHLY:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),ANNUAL:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()})})}),de=e.object({url:e.string()}),ge=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:V.optional(),cta:L.optional(),secondaryCta:f.optional(),newsletterSignup:de.optional(),image:$.optional(),showReminderFields:le.optional(),separateArticleCount:se.optional(),maxViews:oe.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:_.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:ce.optional(),defaultChoiceCardFrequency:ue.optional()}),me=e.object({variant:ge,tracking:x,countryCode:e.string().nullish(),articleCounts:re,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Ce=/^[0-9A-F]{2}$/,pe=e.string().refine((e=>Ce.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),be=e.object({r:pe,g:pe,b:pe,kind:e.literal("hex")}),Se=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),he=e.object({buttonColour:be.nullish(),buttonTextColour:be.nullish(),buttonBorderColour:be.nullish(),buttonSelectColour:be.nullish(),buttonSelectTextColour:be.nullish(),buttonSelectBorderColour:be.nullish(),kind:e.literal("ChoiceCards")}),ye=e.discriminatedUnion("kind",[Se,he]),Ae=e.object({visual:ye.nullish(),colours:e.object({basic:e.object({background:be,bodyText:be})})}),Te=e.enum(["contributions","subscriptions","signIn"]),Ie=e.object({heading:e.string().optional(),messageText:e.string().optional(),paragraphs:e.array(e.string()).optional(),mobileMessageText:e.string().optional(),highlightedText:e.string().optional(),cta:L.optional(),secondaryCta:f.optional()});e.object({tracking:x,bannerChannel:Te,content:Ie.nullish(),mobileContent:Ie.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:V.nullish(),submitComponentEvent:e.any(),numArticles:e.number().nullish(),hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:Ae.nullish()});const Ne=e.object({heading:e.string(),subheading:e.string(),primaryCta:L.optional(),secondaryCta:L.optional(),benefits:e.array(e.string()).optional()}),Me=e.object({content:Ne,tracking:x,mobileContent:Ne.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),Ee=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ge=["ONE_OFF","MONTHLY","ANNUAL"];ne.extend({name:e.string(),status:z,locations:e.array(g),tagIds:e.array(e.string()),sections:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSections:e.array(e.string()),alwaysAsk:e.boolean(),maxViews:Ee.optional(),userCohort:te,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:ae.optional(),priority:e.number(),variants:ge.array(),isBanditTest:e.boolean().optional()});const Ue=e.object({amount:e.union([e.number(),e.literal("other")]),billingPeriod:e.union([e.literal("ONE_OFF"),e.literal("MONTHLY"),e.literal("ANNUAL")]),product:e.union([e.literal("Contribution"),e.literal("SupporterPlus"),e.literal("PremiumTier"),e.literal("DailyEdition"),e.literal("GuardianWeekly"),e.literal("Paper"),e.literal("PaperAndDigital")]),region:e.union([e.literal("uk"),e.literal("us"),e.literal("au"),e.literal("eu"),e.literal("int"),e.literal("nz"),e.literal("ca")])}),Re=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))},Be=(e,n)=>Re("epic",e,n),Pe=(e,n)=>Re("liveblog-epic",e,n),Le=(e,n)=>Re("banner",e,n),De=(e,n)=>Re("header",e,n);export{d as CountryGroupId,D as SecondaryCtaType,F as TickerCountType,K as TickerEndType,Ue as abandonedBasketSchema,A as addRegionIdToSupportUrl,U as buildReminderFields,E as containsNonArticleCountPlaceholder,Ge as contributionTabFrequencies,b as countryCodeToCountryGroupId,g as countryGroupIdSchema,me as epicPropsSchema,Le as getBanner,y as getCountryName,Be as getEpic,t as getEpicViewLog,De as getHeader,Pe as getLiveblogEpic,h as getLocalCurrencySymbol,P as getReminderFields,s as getWeeklyArticleHistory,Me as headerPropsSchema,S as inCountryGroups,c as incrementWeeklyArticleCount,a as logEpicView,N as replaceNonArticleCountPlaceholders};
|
|
1
|
+
import*as e from"zod";const n="gu.contributions.views",t=e=>e.get(n)||void 0,a=e=>{const t=localStorage.getItem(n),a=t?JSON.parse(t).value:[];a.push({date:(new Date).getTime(),testId:e});const i={value:a.slice(-50)};localStorage.setItem(n,JSON.stringify(i))},i="gu.history.weeklyArticleCount",r="gu.history.articleCountsThisWeek",o=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},s=e=>e.get(i)||void 0,l=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes"]),u=(e,n={})=>(e.forEach((e=>{l.has(e)&&(n[e]=(n[e]??0)+1)})),n),c=(e,n,t)=>{const a=((e,n)=>{const t=o(new Date),a=e.get(r);if(a&&a.week===t){const i=a.articles[n]||0;return e.set(r,{week:t,articles:{...a.articles,[n]:i+1}}),i>0}return e.set(r,{week:t,articles:{[n]:1}}),!1})(e,n);if(!a){const n=o(new Date),a=e.get(i)||[],r=a[0];if(r&&r.week&&r.week===n)r.count+=1,r.tags=u(t,r.tags),e.set(i,a);else{a.unshift({week:n,count:1,tags:u(t,{})});const r=n-365,o=a.filter((e=>e.week>=r));e.set(i,o)}}},d=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],g=e.enum(d),m={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},C={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},p={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},b=e=>Object.keys(m).find((n=>m[n].countries.includes(e??"")))||"International",S=(e,n=[])=>0===n.length||!!e&&n.includes(b(e.toUpperCase())),h=e=>{if(e){const n=b(e);return p[n]}return"£"},y=e=>{if(e)return C[e]},A=(e,n)=>{if(n){const t=(e=>m[b(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},T=(e,n,t,a)=>{if(a){const i=a[b(t)];if(i){return`${h(t)}${i[e][n].price}`}}},I={CURRENCY_SYMBOL:({countryCode:e})=>h(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>T("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>T("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>T("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>T("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},N=(e,n,t)=>e?e.replace(M,(e=>{const a=e.substring(2,e.length-2),i=I[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",M=/%%.*?%%/g,E=e=>{const n=e.match(M)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},G=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},U=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),i=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${i}-${t}-01`,reminderLabel:`${a} ${i}`}},R=new Date("2023-12-31"),B=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<G(e.getFullYear()),P=(e,n=new Date)=>{return"US"===e&&B(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(G(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=G(e.getFullYear())&&e<R)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):U(n);var t},L=e.object({text:e.string(),baseUrl:e.string()});let D=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(D);const w=e.object({type:e.literal(D.Custom),cta:L}),O=e.object({type:e.literal(D.ContributionsReminder)}),f=e.discriminatedUnion("type",[w,O]);let k=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const K=e.nativeEnum(k);let F=function(e){return e.money="money",e}({});const v=e.nativeEnum(F),H=e.object({countLabel:e.string(),goalReachedPrimary:e.string(),goalReachedSecondary:e.string()}),Y=e.object({total:e.number(),goal:e.number()}),j=e.enum(["US","AU"]),V=e.object({endType:K,countType:v,currencySymbol:e.string(),copy:H,name:j,tickerData:Y.optional()}),W=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),Z=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),x=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:Z,products:e.array(W).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string(),clientName:e.string()}),$=e.object({mainUrl:e.string(),mobileUrl:e.string().optional(),tabletUrl:e.string().optional(),desktopUrl:e.string().optional(),leftColUrl:e.string().optional(),wideUrl:e.string().optional(),altText:e.string()}),_=e.object({name:e.string(),description:e.string().optional(),headshot:$.optional()}),J=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),Q=e.enum(["new","guest","current"]),z=e.enum(["Live","Draft","Archived"]),q=e.enum(["Mobile","Desktop","All","iOS","Android"]),X=e.enum(["SignedIn","SignedOut","All"]),ee=e.enum(["HasConsented","HasNotConsented","All"]),ne=e.object({name:e.string(),status:z,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:q.optional(),signedInStatus:X.optional(),consentStatus:ee.optional()}),te=e.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ae=e.object({minViews:e.number(),maxViews:e.number().optional(),periodInWeeks:e.number(),tagIds:e.array(e.string()).optional()});e.object({userType:e.array(Q),product:e.array(J)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const ie=e.enum(["for52Weeks","forTargetedWeeks"]),re=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),oe=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),se=e.object({type:e.literal("above"),copy:e.string().optional(),countType:ie.optional()}),le=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),ue=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),ce=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:ue,displayContributionType:ue.array(),amountsCardData:e.object({ONE_OFF:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),MONTHLY:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),ANNUAL:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()})})}),de=e.object({url:e.string()}),ge=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:V.optional(),cta:L.optional(),secondaryCta:f.optional(),newsletterSignup:de.optional(),image:$.optional(),showReminderFields:le.optional(),separateArticleCount:se.optional(),maxViews:oe.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:_.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:ce.optional(),defaultChoiceCardFrequency:ue.optional()}),me=e.object({variant:ge,tracking:x,countryCode:e.string().nullish(),articleCounts:re,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Ce=/^[0-9A-F]{2}$/,pe=e.string().refine((e=>Ce.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),be=e.object({r:pe,g:pe,b:pe,kind:e.literal("hex")}),Se=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),he=e.object({buttonColour:be.nullish(),buttonTextColour:be.nullish(),buttonBorderColour:be.nullish(),buttonSelectColour:be.nullish(),buttonSelectTextColour:be.nullish(),buttonSelectBorderColour:be.nullish(),kind:e.literal("ChoiceCards")}),ye=e.discriminatedUnion("kind",[Se,he]),Ae=e.object({visual:ye.nullish(),colours:e.object({basic:e.object({background:be,bodyText:be})})}),Te=e.enum(["contributions","subscriptions","signIn","abandonedBasket"]),Ie=e.object({heading:e.string().optional(),messageText:e.string().optional(),paragraphs:e.array(e.string()).optional(),mobileMessageText:e.string().optional(),highlightedText:e.string().optional(),cta:L.optional(),secondaryCta:f.optional()});e.object({tracking:x,bannerChannel:Te,content:Ie.nullish(),mobileContent:Ie.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:V.nullish(),submitComponentEvent:e.any(),numArticles:e.number().nullish(),hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:Ae.nullish()});const Ne=e.object({heading:e.string(),subheading:e.string(),primaryCta:L.optional(),secondaryCta:L.optional(),benefits:e.array(e.string()).optional()}),Me=e.object({content:Ne,tracking:x,mobileContent:Ne.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),Ee=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ge=["ONE_OFF","MONTHLY","ANNUAL"];ne.extend({name:e.string(),status:z,locations:e.array(g),tagIds:e.array(e.string()),sections:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSections:e.array(e.string()),alwaysAsk:e.boolean(),maxViews:Ee.optional(),userCohort:te,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:ae.optional(),priority:e.number(),variants:ge.array(),isBanditTest:e.boolean().optional()});const Ue=e.object({amount:e.union([e.number(),e.literal("other")]),billingPeriod:e.union([e.literal("ONE_OFF"),e.literal("MONTHLY"),e.literal("ANNUAL")]),product:e.union([e.literal("Contribution"),e.literal("SupporterPlus"),e.literal("PremiumTier"),e.literal("DailyEdition"),e.literal("GuardianWeekly"),e.literal("Paper"),e.literal("PaperAndDigital")]),region:e.union([e.literal("uk"),e.literal("us"),e.literal("au"),e.literal("eu"),e.literal("int"),e.literal("nz"),e.literal("ca")])}),Re=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))},Be=(e,n)=>Re("epic",e,n),Pe=(e,n)=>Re("liveblog-epic",e,n),Le=(e,n)=>Re("banner",e,n),De=(e,n)=>Re("header",e,n);export{d as CountryGroupId,D as SecondaryCtaType,F as TickerCountType,k as TickerEndType,Ue as abandonedBasketSchema,A as addRegionIdToSupportUrl,U as buildReminderFields,E as containsNonArticleCountPlaceholder,Ge as contributionTabFrequencies,b as countryCodeToCountryGroupId,g as countryGroupIdSchema,me as epicPropsSchema,Le as getBanner,y as getCountryName,Be as getEpic,t as getEpicViewLog,De as getHeader,Pe as getLiveblogEpic,h as getLocalCurrencySymbol,P as getReminderFields,s as getWeeklyArticleHistory,Me as headerPropsSchema,S as inCountryGroups,c as incrementWeeklyArticleCount,a as logEpicView,N as replaceNonArticleCountPlaceholders};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("zod"));const t="gu.contributions.views",a="gu.history.weeklyArticleCount",r="gu.history.articleCountsThisWeek",o=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},i=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes"]),s=(e,n={})=>(e.forEach((e=>{i.has(e)&&(n[e]=(n[e]??0)+1)})),n),l=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],u=n.enum(l),c={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},d={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},g={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(c).find((n=>c[n].countries.includes(e??"")))||"International",m=e=>{if(e){const n=p(e);return g[n]}return"£"},C=e=>{if(e)return d[e]},b=(e,n,t,a)=>{if(a){const r=a[p(t)];if(r){return`${m(t)}${r[e][n].price}`}}},S={CURRENCY_SYMBOL:({countryCode:e})=>m(e),COUNTRY_NAME:({countryCode:e})=>C(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>b("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>b("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>b("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>b("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},h=/%%.*?%%/g,y=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},A=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),r=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${r}-${t}-01`,reminderLabel:`${a} ${r}`}},T=new Date("2023-12-31"),I=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<y(e.getFullYear()),N=n.object({text:n.string(),baseUrl:n.string()});let M=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});n.nativeEnum(M);const E=n.object({type:n.literal(M.Custom),cta:N}),G=n.object({type:n.literal(M.ContributionsReminder)}),R=n.discriminatedUnion("type",[E,G]);let U=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const B=n.nativeEnum(U);let P=function(e){return e.money="money",e}({});const L=n.nativeEnum(P),D=n.object({countLabel:n.string(),goalReachedPrimary:n.string(),goalReachedSecondary:n.string()}),w=n.object({total:n.number(),goal:n.number()}),O=n.enum(["US","AU"]),f=n.object({endType:B,countType:L,currencySymbol:n.string(),copy:D,name:O,tickerData:w.optional()}),k=n.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),F=n.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),K=n.object({abTestName:n.string(),abTestVariant:n.string(),campaignCode:n.string(),componentType:F,products:n.array(k).nullish(),labels:n.array(n.string()).nullish(),ophanPageId:n.string(),platformId:n.string(),referrerUrl:n.string(),clientName:n.string()}),x=n.object({mainUrl:n.string(),mobileUrl:n.string().optional(),tabletUrl:n.string().optional(),desktopUrl:n.string().optional(),leftColUrl:n.string().optional(),wideUrl:n.string().optional(),altText:n.string()}),v=n.object({name:n.string(),description:n.string().optional(),headshot:x.optional()}),j=n.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),H=n.enum(["new","guest","current"]),V=n.enum(["Live","Draft","Archived"]),Y=n.enum(["Mobile","Desktop","All","iOS","Android"]),W=n.enum(["SignedIn","SignedOut","All"]),Z=n.enum(["HasConsented","HasNotConsented","All"]),_=n.object({name:n.string(),status:V,priority:n.number(),controlProportionSettings:n.object({proportion:n.number(),offset:n.number()}).optional(),deviceType:Y.optional(),signedInStatus:W.optional(),consentStatus:Z.optional()}),$=n.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),J=n.object({minViews:n.number(),maxViews:n.number().optional(),periodInWeeks:n.number(),tagIds:n.array(n.string()).optional()});n.object({userType:n.array(H),product:n.array(j)}),n.object({tagIds:n.array(n.string()),sectionIds:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSectionIds:n.array(n.string())});const Q=n.enum(["for52Weeks","forTargetedWeeks"]),z=n.object({for52Weeks:n.number(),forTargetedWeeks:n.number()}),q=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()}),X=n.object({type:n.literal("above"),copy:n.string().optional(),countType:Q.optional()}),ee=n.object({reminderCta:n.string(),reminderLabel:n.string(),reminderPeriod:n.string()}),ne=n.enum(["ONE_OFF","MONTHLY","ANNUAL"]),te=n.object({testName:n.string(),variantName:n.string(),defaultContributionType:ne,displayContributionType:ne.array(),amountsCardData:n.object({ONE_OFF:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),MONTHLY:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),ANNUAL:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()})})}),ae=n.object({url:n.string()}),re=n.object({name:n.string(),heading:n.string().optional(),paragraphs:n.array(n.string()),highlightedText:n.string().optional(),tickerSettings:f.optional(),cta:N.optional(),secondaryCta:R.optional(),newsletterSignup:ae.optional(),image:x.optional(),showReminderFields:ee.optional(),separateArticleCount:X.optional(),maxViews:q.optional(),showSignInLink:n.boolean().optional(),bylineWithImage:v.optional(),showChoiceCards:n.boolean().optional(),choiceCardAmounts:te.optional(),defaultChoiceCardFrequency:ne.optional()}),oe=n.object({variant:re,tracking:K,countryCode:n.string().nullish(),articleCounts:z,onReminderOpen:n.any().nullish(),fetchEmail:n.any().nullish(),submitComponentEvent:n.any().nullish(),openCmp:n.any().nullish(),hasConsentForArticleCount:n.boolean().nullish(),stage:n.string().nullish()}),ie=/^[0-9A-F]{2}$/,se=n.string().refine((e=>ie.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),le=n.object({r:se,g:se,b:se,kind:n.literal("hex")}),ue=n.object({mobileUrl:n.string(),tabletUrl:n.string(),desktopUrl:n.string(),altText:n.string(),kind:n.literal("Image")}),ce=n.object({buttonColour:le.nullish(),buttonTextColour:le.nullish(),buttonBorderColour:le.nullish(),buttonSelectColour:le.nullish(),buttonSelectTextColour:le.nullish(),buttonSelectBorderColour:le.nullish(),kind:n.literal("ChoiceCards")}),de=n.discriminatedUnion("kind",[ue,ce]),ge=n.object({visual:de.nullish(),colours:n.object({basic:n.object({background:le,bodyText:le})})}),pe=n.enum(["contributions","subscriptions","signIn"]),me=n.object({heading:n.string().optional(),messageText:n.string().optional(),paragraphs:n.array(n.string()).optional(),mobileMessageText:n.string().optional(),highlightedText:n.string().optional(),cta:N.optional(),secondaryCta:R.optional()});n.object({tracking:K,bannerChannel:pe,content:me.nullish(),mobileContent:me.nullish(),countryCode:n.string().nullish(),isSupporter:n.boolean().nullish(),tickerSettings:f.nullish(),submitComponentEvent:n.any(),numArticles:n.number().nullish(),hasOptedOutOfArticleCount:n.boolean().nullish(),fetchEmail:n.any().nullish(),separateArticleCount:n.boolean().nullish(),design:ge.nullish()});const Ce=n.object({heading:n.string(),subheading:n.string(),primaryCta:N.optional(),secondaryCta:N.optional(),benefits:n.array(n.string()).optional()}),be=n.object({content:Ce,tracking:K,mobileContent:Ce.optional(),countryCode:n.string().optional(),submitComponentEvent:n.any(),numArticles:n.number().optional()}),Se=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()});_.extend({name:n.string(),status:V,locations:n.array(u),tagIds:n.array(n.string()),sections:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSections:n.array(n.string()),alwaysAsk:n.boolean(),maxViews:Se.optional(),userCohort:$,hasCountryName:n.boolean(),highPriority:n.boolean(),useLocalViewLog:n.boolean(),articlesViewedSettings:J.optional(),priority:n.number(),variants:re.array(),isBanditTest:n.boolean().optional()});const he=n.object({amount:n.union([n.number(),n.literal("other")]),billingPeriod:n.union([n.literal("ONE_OFF"),n.literal("MONTHLY"),n.literal("ANNUAL")]),product:n.union([n.literal("Contribution"),n.literal("SupporterPlus"),n.literal("PremiumTier"),n.literal("DailyEdition"),n.literal("GuardianWeekly"),n.literal("Paper"),n.literal("PaperAndDigital")]),region:n.union([n.literal("uk"),n.literal("us"),n.literal("au"),n.literal("eu"),n.literal("int"),n.literal("nz"),n.literal("ca")])}),ye=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))};exports.CountryGroupId=l,exports.SecondaryCtaType=M,exports.TickerCountType=P,exports.TickerEndType=U,exports.abandonedBasketSchema=he,exports.addRegionIdToSupportUrl=(e,n)=>{if(n){const t=(e=>c[p(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},exports.buildReminderFields=A,exports.containsNonArticleCountPlaceholder=e=>{const n=e.match(h)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=p,exports.countryGroupIdSchema=u,exports.epicPropsSchema=oe,exports.getBanner=(e,n)=>ye("banner",e,n),exports.getCountryName=C,exports.getEpic=(e,n)=>ye("epic",e,n),exports.getEpicViewLog=e=>e.get(t)||void 0,exports.getHeader=(e,n)=>ye("header",e,n),exports.getLiveblogEpic=(e,n)=>ye("liveblog-epic",e,n),exports.getLocalCurrencySymbol=m,exports.getReminderFields=(e,n=new Date)=>{return"US"===e&&I(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(y(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=y(e.getFullYear())&&e<T)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):A(n);var t},exports.getWeeklyArticleHistory=e=>e.get(a)||void 0,exports.headerPropsSchema=be,exports.inCountryGroups=(e,n=[])=>0===n.length||!!e&&n.includes(p(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,n,t)=>{const i=((e,n)=>{const t=o(new Date),a=e.get(r);if(a&&a.week===t){const o=a.articles[n]||0;return e.set(r,{week:t,articles:{...a.articles,[n]:o+1}}),o>0}return e.set(r,{week:t,articles:{[n]:1}}),!1})(e,n);if(!i){const n=o(new Date),r=e.get(a)||[],i=r[0];if(i&&i.week&&i.week===n)i.count+=1,i.tags=s(t,i.tags),e.set(a,r);else{r.unshift({week:n,count:1,tags:s(t,{})});const o=n-365,i=r.filter((e=>e.week>=o));e.set(a,i)}}},exports.logEpicView=e=>{const n=localStorage.getItem(t),a=n?JSON.parse(n).value:[];a.push({date:(new Date).getTime(),testId:e});const r={value:a.slice(-50)};localStorage.setItem(t,JSON.stringify(r))},exports.replaceNonArticleCountPlaceholders=(e,n,t)=>e?e.replace(h,(e=>{const a=e.substring(2,e.length-2),r=S[a];if(r){const e=r({countryCode:n,prices:t});if(e)return e}return e})):"";
|
|
1
|
+
"use strict";function e(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("zod"));const t="gu.contributions.views",a="gu.history.weeklyArticleCount",r="gu.history.articleCountsThisWeek",o=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},i=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes"]),s=(e,n={})=>(e.forEach((e=>{i.has(e)&&(n[e]=(n[e]??0)+1)})),n),l=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],u=n.enum(l),c={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},d={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},g={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(c).find((n=>c[n].countries.includes(e??"")))||"International",m=e=>{if(e){const n=p(e);return g[n]}return"£"},C=e=>{if(e)return d[e]},b=(e,n,t,a)=>{if(a){const r=a[p(t)];if(r){return`${m(t)}${r[e][n].price}`}}},S={CURRENCY_SYMBOL:({countryCode:e})=>m(e),COUNTRY_NAME:({countryCode:e})=>C(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>b("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>b("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>b("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>b("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},h=/%%.*?%%/g,y=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},A=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),r=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${r}-${t}-01`,reminderLabel:`${a} ${r}`}},T=new Date("2023-12-31"),I=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<y(e.getFullYear()),N=n.object({text:n.string(),baseUrl:n.string()});let M=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});n.nativeEnum(M);const E=n.object({type:n.literal(M.Custom),cta:N}),G=n.object({type:n.literal(M.ContributionsReminder)}),R=n.discriminatedUnion("type",[E,G]);let U=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const B=n.nativeEnum(U);let P=function(e){return e.money="money",e}({});const L=n.nativeEnum(P),D=n.object({countLabel:n.string(),goalReachedPrimary:n.string(),goalReachedSecondary:n.string()}),w=n.object({total:n.number(),goal:n.number()}),O=n.enum(["US","AU"]),f=n.object({endType:B,countType:L,currencySymbol:n.string(),copy:D,name:O,tickerData:w.optional()}),k=n.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),F=n.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),K=n.object({abTestName:n.string(),abTestVariant:n.string(),campaignCode:n.string(),componentType:F,products:n.array(k).nullish(),labels:n.array(n.string()).nullish(),ophanPageId:n.string(),platformId:n.string(),referrerUrl:n.string(),clientName:n.string()}),x=n.object({mainUrl:n.string(),mobileUrl:n.string().optional(),tabletUrl:n.string().optional(),desktopUrl:n.string().optional(),leftColUrl:n.string().optional(),wideUrl:n.string().optional(),altText:n.string()}),v=n.object({name:n.string(),description:n.string().optional(),headshot:x.optional()}),j=n.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),H=n.enum(["new","guest","current"]),V=n.enum(["Live","Draft","Archived"]),Y=n.enum(["Mobile","Desktop","All","iOS","Android"]),W=n.enum(["SignedIn","SignedOut","All"]),Z=n.enum(["HasConsented","HasNotConsented","All"]),_=n.object({name:n.string(),status:V,priority:n.number(),controlProportionSettings:n.object({proportion:n.number(),offset:n.number()}).optional(),deviceType:Y.optional(),signedInStatus:W.optional(),consentStatus:Z.optional()}),$=n.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),J=n.object({minViews:n.number(),maxViews:n.number().optional(),periodInWeeks:n.number(),tagIds:n.array(n.string()).optional()});n.object({userType:n.array(H),product:n.array(j)}),n.object({tagIds:n.array(n.string()),sectionIds:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSectionIds:n.array(n.string())});const Q=n.enum(["for52Weeks","forTargetedWeeks"]),z=n.object({for52Weeks:n.number(),forTargetedWeeks:n.number()}),q=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()}),X=n.object({type:n.literal("above"),copy:n.string().optional(),countType:Q.optional()}),ee=n.object({reminderCta:n.string(),reminderLabel:n.string(),reminderPeriod:n.string()}),ne=n.enum(["ONE_OFF","MONTHLY","ANNUAL"]),te=n.object({testName:n.string(),variantName:n.string(),defaultContributionType:ne,displayContributionType:ne.array(),amountsCardData:n.object({ONE_OFF:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),MONTHLY:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),ANNUAL:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()})})}),ae=n.object({url:n.string()}),re=n.object({name:n.string(),heading:n.string().optional(),paragraphs:n.array(n.string()),highlightedText:n.string().optional(),tickerSettings:f.optional(),cta:N.optional(),secondaryCta:R.optional(),newsletterSignup:ae.optional(),image:x.optional(),showReminderFields:ee.optional(),separateArticleCount:X.optional(),maxViews:q.optional(),showSignInLink:n.boolean().optional(),bylineWithImage:v.optional(),showChoiceCards:n.boolean().optional(),choiceCardAmounts:te.optional(),defaultChoiceCardFrequency:ne.optional()}),oe=n.object({variant:re,tracking:K,countryCode:n.string().nullish(),articleCounts:z,onReminderOpen:n.any().nullish(),fetchEmail:n.any().nullish(),submitComponentEvent:n.any().nullish(),openCmp:n.any().nullish(),hasConsentForArticleCount:n.boolean().nullish(),stage:n.string().nullish()}),ie=/^[0-9A-F]{2}$/,se=n.string().refine((e=>ie.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),le=n.object({r:se,g:se,b:se,kind:n.literal("hex")}),ue=n.object({mobileUrl:n.string(),tabletUrl:n.string(),desktopUrl:n.string(),altText:n.string(),kind:n.literal("Image")}),ce=n.object({buttonColour:le.nullish(),buttonTextColour:le.nullish(),buttonBorderColour:le.nullish(),buttonSelectColour:le.nullish(),buttonSelectTextColour:le.nullish(),buttonSelectBorderColour:le.nullish(),kind:n.literal("ChoiceCards")}),de=n.discriminatedUnion("kind",[ue,ce]),ge=n.object({visual:de.nullish(),colours:n.object({basic:n.object({background:le,bodyText:le})})}),pe=n.enum(["contributions","subscriptions","signIn","abandonedBasket"]),me=n.object({heading:n.string().optional(),messageText:n.string().optional(),paragraphs:n.array(n.string()).optional(),mobileMessageText:n.string().optional(),highlightedText:n.string().optional(),cta:N.optional(),secondaryCta:R.optional()});n.object({tracking:K,bannerChannel:pe,content:me.nullish(),mobileContent:me.nullish(),countryCode:n.string().nullish(),isSupporter:n.boolean().nullish(),tickerSettings:f.nullish(),submitComponentEvent:n.any(),numArticles:n.number().nullish(),hasOptedOutOfArticleCount:n.boolean().nullish(),fetchEmail:n.any().nullish(),separateArticleCount:n.boolean().nullish(),design:ge.nullish()});const Ce=n.object({heading:n.string(),subheading:n.string(),primaryCta:N.optional(),secondaryCta:N.optional(),benefits:n.array(n.string()).optional()}),be=n.object({content:Ce,tracking:K,mobileContent:Ce.optional(),countryCode:n.string().optional(),submitComponentEvent:n.any(),numArticles:n.number().optional()}),Se=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()});_.extend({name:n.string(),status:V,locations:n.array(u),tagIds:n.array(n.string()),sections:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSections:n.array(n.string()),alwaysAsk:n.boolean(),maxViews:Se.optional(),userCohort:$,hasCountryName:n.boolean(),highPriority:n.boolean(),useLocalViewLog:n.boolean(),articlesViewedSettings:J.optional(),priority:n.number(),variants:re.array(),isBanditTest:n.boolean().optional()});const he=n.object({amount:n.union([n.number(),n.literal("other")]),billingPeriod:n.union([n.literal("ONE_OFF"),n.literal("MONTHLY"),n.literal("ANNUAL")]),product:n.union([n.literal("Contribution"),n.literal("SupporterPlus"),n.literal("PremiumTier"),n.literal("DailyEdition"),n.literal("GuardianWeekly"),n.literal("Paper"),n.literal("PaperAndDigital")]),region:n.union([n.literal("uk"),n.literal("us"),n.literal("au"),n.literal("eu"),n.literal("int"),n.literal("nz"),n.literal("ca")])}),ye=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))};exports.CountryGroupId=l,exports.SecondaryCtaType=M,exports.TickerCountType=P,exports.TickerEndType=U,exports.abandonedBasketSchema=he,exports.addRegionIdToSupportUrl=(e,n)=>{if(n){const t=(e=>c[p(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},exports.buildReminderFields=A,exports.containsNonArticleCountPlaceholder=e=>{const n=e.match(h)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=p,exports.countryGroupIdSchema=u,exports.epicPropsSchema=oe,exports.getBanner=(e,n)=>ye("banner",e,n),exports.getCountryName=C,exports.getEpic=(e,n)=>ye("epic",e,n),exports.getEpicViewLog=e=>e.get(t)||void 0,exports.getHeader=(e,n)=>ye("header",e,n),exports.getLiveblogEpic=(e,n)=>ye("liveblog-epic",e,n),exports.getLocalCurrencySymbol=m,exports.getReminderFields=(e,n=new Date)=>{return"US"===e&&I(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(y(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=y(e.getFullYear())&&e<T)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):A(n);var t},exports.getWeeklyArticleHistory=e=>e.get(a)||void 0,exports.headerPropsSchema=be,exports.inCountryGroups=(e,n=[])=>0===n.length||!!e&&n.includes(p(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,n,t)=>{const i=((e,n)=>{const t=o(new Date),a=e.get(r);if(a&&a.week===t){const o=a.articles[n]||0;return e.set(r,{week:t,articles:{...a.articles,[n]:o+1}}),o>0}return e.set(r,{week:t,articles:{[n]:1}}),!1})(e,n);if(!i){const n=o(new Date),r=e.get(a)||[],i=r[0];if(i&&i.week&&i.week===n)i.count+=1,i.tags=s(t,i.tags),e.set(a,r);else{r.unshift({week:n,count:1,tags:s(t,{})});const o=n-365,i=r.filter((e=>e.week>=o));e.set(a,i)}}},exports.logEpicView=e=>{const n=localStorage.getItem(t),a=n?JSON.parse(n).value:[];a.push({date:(new Date).getTime(),testId:e});const r={value:a.slice(-50)};localStorage.setItem(t,JSON.stringify(r))},exports.replaceNonArticleCountPlaceholders=(e,n,t)=>e?e.replace(h,(e=>{const a=e.substring(2,e.length-2),r=S[a];if(r){const e=r({countryCode:n,prices:t});if(e)return e}return e})):"";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSX } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { Cta, SecondaryCta, TickerSettings, Tracking } from './shared';
|
|
3
3
|
import { OphanComponentEvent } from '../ophan';
|
|
4
4
|
import * as z from 'zod';
|
|
5
5
|
import { Prices } from '../prices';
|
|
6
6
|
import { SelectedAmountsVariant } from '../abTests';
|
|
7
7
|
import { ConfigurableDesign } from './design';
|
|
8
|
-
|
|
8
|
+
import { AbandonedBasket } from '../targeting';
|
|
9
|
+
export declare const bannerChannelSchema: z.ZodEnum<["contributions", "subscriptions", "signIn", "abandonedBasket"]>;
|
|
9
10
|
export type BannerChannel = z.infer<typeof bannerChannelSchema>;
|
|
10
11
|
export interface BannerContent {
|
|
11
12
|
heading?: string;
|
|
@@ -102,7 +103,7 @@ export declare const bannerContentSchema: z.ZodObject<{
|
|
|
102
103
|
type: import("./shared").SecondaryCtaType.ContributionsReminder;
|
|
103
104
|
} | undefined;
|
|
104
105
|
}>;
|
|
105
|
-
export interface BannerProps extends
|
|
106
|
+
export interface BannerProps extends JSX.IntrinsicAttributes {
|
|
106
107
|
tracking: Tracking;
|
|
107
108
|
bannerChannel: BannerChannel;
|
|
108
109
|
content?: BannerContent;
|
|
@@ -118,6 +119,7 @@ export interface BannerProps extends EmotionJSX.IntrinsicAttributes {
|
|
|
118
119
|
prices?: Prices;
|
|
119
120
|
choiceCardAmounts?: SelectedAmountsVariant;
|
|
120
121
|
design?: ConfigurableDesign;
|
|
122
|
+
abandonedBasket?: AbandonedBasket;
|
|
121
123
|
}
|
|
122
124
|
export declare const bannerSchema: z.ZodObject<{
|
|
123
125
|
tracking: z.ZodObject<{
|
|
@@ -154,7 +156,7 @@ export declare const bannerSchema: z.ZodObject<{
|
|
|
154
156
|
products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
|
|
155
157
|
labels?: string[] | null | undefined;
|
|
156
158
|
}>;
|
|
157
|
-
bannerChannel: z.ZodEnum<["contributions", "subscriptions", "signIn"]>;
|
|
159
|
+
bannerChannel: z.ZodEnum<["contributions", "subscriptions", "signIn", "abandonedBasket"]>;
|
|
158
160
|
content: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
159
161
|
heading: z.ZodOptional<z.ZodString>;
|
|
160
162
|
messageText: z.ZodOptional<z.ZodString>;
|
|
@@ -815,7 +817,7 @@ export declare const bannerSchema: z.ZodObject<{
|
|
|
815
817
|
products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
|
|
816
818
|
labels?: string[] | null | undefined;
|
|
817
819
|
};
|
|
818
|
-
bannerChannel: "contributions" | "subscriptions" | "signIn";
|
|
820
|
+
bannerChannel: "contributions" | "subscriptions" | "signIn" | "abandonedBasket";
|
|
819
821
|
content?: {
|
|
820
822
|
heading?: string | undefined;
|
|
821
823
|
messageText?: string | undefined;
|
|
@@ -954,7 +956,7 @@ export declare const bannerSchema: z.ZodObject<{
|
|
|
954
956
|
products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
|
|
955
957
|
labels?: string[] | null | undefined;
|
|
956
958
|
};
|
|
957
|
-
bannerChannel: "contributions" | "subscriptions" | "signIn";
|
|
959
|
+
bannerChannel: "contributions" | "subscriptions" | "signIn" | "abandonedBasket";
|
|
958
960
|
content?: {
|
|
959
961
|
heading?: string | undefined;
|
|
960
962
|
messageText?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EACH,GAAG,EAEH,YAAY,EAEZ,cAAc,EAEd,QAAQ,EAEX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,eAAO,MAAM,mBAAmB,4EAK9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ9B,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,GAAG,CAAC,mBAAmB;IACxD,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcvB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSX } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import { Stage, Tracking } from './shared';
|
|
4
4
|
import { OphanComponentEvent } from '../ophan';
|
|
@@ -7,7 +7,7 @@ export type ArticleCountType = 'for52Weeks' | 'forTargetedWeeks';
|
|
|
7
7
|
export type ArticleCounts = {
|
|
8
8
|
[type in ArticleCountType]: number;
|
|
9
9
|
};
|
|
10
|
-
export interface EpicProps extends
|
|
10
|
+
export interface EpicProps extends JSX.IntrinsicAttributes {
|
|
11
11
|
variant: EpicVariant;
|
|
12
12
|
tracking: Tracking;
|
|
13
13
|
countryCode?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epic.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/epic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"epic.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/epic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAKH,KAAK,EAEL,QAAQ,EAEX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,gBAAgB,GACtB,YAAY,GACZ,kBAAkB,CAAC;AAIzB,MAAM,MAAM,aAAa,GAAG;KACvB,IAAI,IAAI,gBAAgB,GAAG,MAAM;CACrC,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,GAAG,CAAC,mBAAmB;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAE7B,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AA4BD,eAAO,MAAM,2BAA2B,6CAA2C,CAAC;AA8BpF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBxB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSX } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import { OphanComponentEvent } from '../ophan';
|
|
4
4
|
import { Tracking, Cta } from './shared';
|
|
@@ -58,7 +58,7 @@ export declare const headerContentSchema: z.ZodObject<{
|
|
|
58
58
|
} | undefined;
|
|
59
59
|
benefits?: string[] | undefined;
|
|
60
60
|
}>;
|
|
61
|
-
export interface HeaderProps extends
|
|
61
|
+
export interface HeaderProps extends JSX.IntrinsicAttributes {
|
|
62
62
|
content: HeaderContent;
|
|
63
63
|
tracking: Tracking;
|
|
64
64
|
mobileContent?: HeaderContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/props/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAkB,GAAG,EAAa,MAAM,UAAU,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM9B,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,GAAG,CAAC,mBAAmB;IACxD,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC"}
|
|
@@ -6,6 +6,7 @@ export type BannerTargeting = {
|
|
|
6
6
|
engagementBannerLastClosedAt?: string;
|
|
7
7
|
subscriptionBannerLastClosedAt?: string;
|
|
8
8
|
signInBannerLastClosedAt?: string;
|
|
9
|
+
abandonedBasketBannerLastClosedAt?: string;
|
|
9
10
|
mvtId: number;
|
|
10
11
|
countryCode: string;
|
|
11
12
|
weeklyArticleHistory?: WeeklyArticleHistory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/targeting/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;CAC9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/targeting/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;CAC9B,CAAC"}
|