@guardian/support-dotcom-components 4.0.0 → 5.0.0

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.
@@ -1,4 +1,4 @@
1
- import { BannerPayload, BannerProps, EpicPayload, EpicProps, HeaderPayload, HeaderProps } from '../shared/types';
1
+ import { BannerPayload, BannerProps, EpicPayload, EpicProps, HeaderPayload, HeaderProps, GutterPayload, GutterProps } from '../shared/types';
2
2
  import { TestTracking } from '../shared/types/abTests/shared';
3
3
  export interface ModuleData<PROPS> {
4
4
  name: string;
@@ -13,5 +13,6 @@ export interface ModuleDataResponse<PROPS> {
13
13
  export declare const getEpic: (baseUrl: string, payload: EpicPayload) => Promise<ModuleDataResponse<EpicProps>>;
14
14
  export declare const getLiveblogEpic: (baseUrl: string, payload: EpicPayload) => Promise<ModuleDataResponse<EpicProps>>;
15
15
  export declare const getBanner: (baseUrl: string, payload: BannerPayload) => Promise<ModuleDataResponse<BannerProps>>;
16
+ export declare const getGutterLiveblog: (baseUrl: string, payload: GutterPayload) => Promise<ModuleDataResponse<GutterProps>>;
16
17
  export declare const getHeader: (baseUrl: string, payload: HeaderPayload) => Promise<ModuleDataResponse<HeaderProps>>;
17
18
  //# sourceMappingURL=requests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/dotcom/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,WAAW,UAAU,CAAC,KAAK;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB,CAAC,KAAK;IACrC,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,EAAE,YAAY,CAAC;KACtB,CAAC;CACL;AA4CD,eAAO,MAAM,OAAO,YACP,MAAM,WACN,WAAW,KACrB,QAAQ,mBAAmB,SAAS,CAAC,CAA4C,CAAC;AAErF,eAAO,MAAM,eAAe,YACf,MAAM,WACN,WAAW,KACrB,QAAQ,mBAAmB,SAAS,CAAC,CAAqD,CAAC;AAE9F,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,QAAQ,mBAAmB,WAAW,CAAC,CAA8C,CAAC;AAEzF,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,QAAQ,mBAAmB,WAAW,CAAC,CAA8C,CAAC"}
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/dotcom/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,WAAW,UAAU,CAAC,KAAK;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB,CAAC,KAAK;IACrC,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,EAAE,YAAY,CAAC;KACtB,CAAC;CACL;AA4CD,eAAO,MAAM,OAAO,YACP,MAAM,WACN,WAAW,KACrB,QAAQ,mBAAmB,SAAS,CAAC,CAA4C,CAAC;AAErF,eAAO,MAAM,eAAe,YACf,MAAM,WACN,WAAW,KACrB,QAAQ,mBAAmB,SAAS,CAAC,CAAqD,CAAC;AAE9F,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,QAAQ,mBAAmB,WAAW,CAAC,CAA8C,CAAC;AAEzF,eAAO,MAAM,iBAAiB,YACjB,MAAM,WACN,aAAa,KACvB,QAAQ,mBAAmB,WAAW,CAAC,CAAuD,CAAC;AAElG,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,QAAQ,mBAAmB,WAAW,CAAC,CAA8C,CAAC"}
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{z 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",o="gu.history.articleCountsThisWeek",r=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","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),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=r(new Date),a=e.get(o);if(a&&a.week===t){const i=a.articles[n]||0;return e.set(o,{week:t,articles:{...a.articles,[n]:i+1}}),i>0}return e.set(o,{week:t,articles:{[n]:1}}),!1})(e,n);if(!a){const n=r(new Date),a=e.get(i)||[],o=a[0];if(o&&o.week&&o.week===n)o.count+=1,o.tags=u(t,o.tags),e.set(i,a);else{a.unshift({week:n,count:1,tags:u(t,{})});const o=n-365,r=a.filter((e=>e.week>=o));e.set(i,r)}}},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"}},p={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"},b={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},C=e=>Object.keys(m).find((n=>m[n].countries.includes(e??"")))||"International",S=(e,n=[])=>0===n.length||!!e&&n.includes(C(e.toUpperCase())),h=e=>{if(e){const n=C(e);return b[n]}return"£"},y=e=>{if(e)return p[e]},A=e=>/subscribe\/weekly\/checkout/.test(e),T=(e,n)=>{if(n){const t=(e=>m[C(e)]?.supportRegionId)(n);if(t&&!A(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},I=(e,n,t,a)=>{if(a){const i=a[C(t)];if(i){return`${h(t)}${i[e][n].price}`}}},N={CURRENCY_SYMBOL:({countryCode:e})=>h(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>I("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>I("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>I("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>I("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"}))()},M=(e,n,t)=>e?e.replace(E,(e=>{const a=e.substring(2,e.length-2),i=N[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",E=/%%.*?%%/g,G=e=>{const n=e.match(E)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},U=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},R=(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}`}},B=new Date("2023-12-31"),P=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<U(e.getFullYear()),L=(e,n=new Date)=>{return"US"===e&&P(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(U(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=U(e.getFullYear())&&e<B)(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()):R(n);var t},D=e.object({text:e.string(),baseUrl:e.string()});let w=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(w);const O=e.object({type:e.literal(w.Custom),cta:D}),k=e.object({type:e.literal(w.ContributionsReminder)}),f=e.discriminatedUnion("type",[O,k]);let K=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const F=e.nativeEnum(K);let v=function(e){return e.money="money",e}({});const j=e.nativeEnum(v),H=e.object({countLabel:e.string(),goalReachedPrimary:e.string().optional(),goalReachedSecondary:e.string().optional()}),Y=e.object({total:e.number(),goal:e.number()}),V=e.enum(["US","AU"]),W=e.object({endType:F,countType:j,currencySymbol:e.string(),copy:H,name:V,tickerData:Y.optional()}),Z=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),$=e.enum(["for52Weeks","forTargetedWeeks"]),x=e.object({type:e.literal("above"),copy:e.string().optional(),countType:$.optional()}),_=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),J=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),Q=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:J,products:e.array(_).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string(),clientName:e.string()}),z=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()}),q=e.object({name:e.string(),description:e.string().optional(),headshot:z.optional()}),X=/^[0-9A-F]{2}$/,ee=e.string().refine((e=>X.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),ne=e.object({r:ee,g:ee,b:ee,kind:e.literal("hex")}),te=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),ae=e.object({buttonColour:ne.nullish(),buttonTextColour:ne.nullish(),buttonBorderColour:ne.nullish(),buttonSelectColour:ne.nullish(),buttonSelectTextColour:ne.nullish(),buttonSelectBorderColour:ne.nullish(),kind:e.literal("ChoiceCards")}),ie=e.discriminatedUnion("kind",[te,ae]),oe=e.object({visual:ie.nullish(),colours:e.object({basic:e.object({background:ne,bodyText:ne})})}),re=e=>`#${e.r}${e.g}${e.b}`,se=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),le=e.enum(["new","guest","current"]),ue=e.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header"]),ce=e.enum(["Live","Draft","Archived"]),de=e.enum(["Mobile","Desktop","All","iOS","Android"]),ge=e.enum(["SignedIn","SignedOut","All"]),me=e.enum(["HasConsented","HasNotConsented","All"]),pe=e.object({name:e.literal("ABTest")}),be=e.object({name:e.literal("EpsilonGreedyBandit"),epsilon:e.number(),sampleCount:e.number().optional()}),Ce=e.object({name:e.literal("Roulette"),sampleCount:e.number().optional()}),Se=e.intersection(e.discriminatedUnion("name",[pe,be,Ce]),e.object({testName:e.string().optional()})),he=e.object({channel:ue,name:e.string(),status:ce,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:de.optional(),signedInStatus:ge.optional(),consentStatus:me.optional(),methodologies:Se.array().optional()}),ye=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(le),product:e.array(se)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const Te=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ie=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),Ne=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),Me=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:Ne,displayContributionType:Ne.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()})})}),Ee=e.object({newsletterId:e.string(),successDescription:e.string()}),Ge=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:W.optional(),cta:D.optional(),secondaryCta:f.optional(),newsletterSignup:Ee.optional(),image:z.optional(),showReminderFields:Ie.optional(),separateArticleCount:x.optional(),maxViews:Te.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:q.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:Me.optional(),defaultChoiceCardFrequency:Ne.optional()}),Ue=e.object({variant:Ge,tracking:Q,countryCode:e.string().nullish(),articleCounts:Z,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Re=e.enum(["contributions","subscriptions","signIn","abandonedBasket"]),Be=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:D.optional(),secondaryCta:f.optional()}),Pe=e.object({tracking:Q,bannerChannel:Re,content:Be.nullish(),mobileContent:Be.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:W.nullish(),submitComponentEvent:e.any(),articleCounts:Z,hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:oe.nullish()}),Le=e.object({heading:e.string(),subheading:e.string(),primaryCta:D.optional(),secondaryCta:D.optional(),benefits:e.array(e.string()).optional()}),De=e.object({content:Le,tracking:Q,mobileContent:Le.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),we=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Oe=["ONE_OFF","MONTHLY","ANNUAL"];he.extend({name:e.string(),status:ce,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:we.optional(),userCohort:ye,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:Ae.optional(),priority:e.number(),variants:Ge.array()});const ke=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")])}),fe=(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()))},Ke=(e,n)=>fe("epic",e,n),Fe=(e,n)=>fe("liveblog-epic",e,n),ve=(e,n)=>fe("banner",e,n),je=(e,n)=>fe("header",e,n);export{d as CountryGroupId,w as SecondaryCtaType,v as TickerCountType,K as TickerEndType,ke as abandonedBasketSchema,T as addRegionIdToSupportUrl,Pe as bannerSchema,R as buildReminderFields,G as containsNonArticleCountPlaceholder,Oe as contributionTabFrequencies,C as countryCodeToCountryGroupId,g as countryGroupIdSchema,Ue as epicPropsSchema,ve as getBanner,y as getCountryName,Ke as getEpic,t as getEpicViewLog,je as getHeader,Fe as getLiveblogEpic,h as getLocalCurrencySymbol,L as getReminderFields,s as getWeeklyArticleHistory,De as headerPropsSchema,re as hexColourToString,S as inCountryGroups,c as incrementWeeklyArticleCount,A as isGWCheckoutUrl,a as logEpicView,M as replaceNonArticleCountPlaceholders};
1
+ import{z 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",o="gu.history.articleCountsThisWeek",r=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","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),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=r(new Date),a=e.get(o);if(a&&a.week===t){const i=a.articles[n]||0;return e.set(o,{week:t,articles:{...a.articles,[n]:i+1}}),i>0}return e.set(o,{week:t,articles:{[n]:1}}),!1})(e,n);if(!a){const n=r(new Date),a=e.get(i)||[],o=a[0];if(o&&o.week&&o.week===n)o.count+=1,o.tags=u(t,o.tags),e.set(i,a);else{a.unshift({week:n,count:1,tags:u(t,{})});const o=n-365,r=a.filter((e=>e.week>=o));e.set(i,r)}}},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"}},p={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"},b={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},C=e=>Object.keys(m).find((n=>m[n].countries.includes(e??"")))||"International",S=(e,n=[])=>0===n.length||!!e&&n.includes(C(e.toUpperCase())),h=e=>{if(e){const n=C(e);return b[n]}return"£"},y=e=>{if(e)return p[e]},A=e=>/subscribe\/weekly\/checkout/.test(e),T=(e,n)=>{if(n){const t=(e=>m[C(e)]?.supportRegionId)(n);if(t&&!A(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},I=(e,n,t,a)=>{if(a){const i=a[C(t)];if(i){return`${h(t)}${i[e][n].price}`}}},N={CURRENCY_SYMBOL:({countryCode:e})=>h(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>I("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>I("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>I("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>I("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"}))()},M=(e,n,t)=>e?e.replace(E,(e=>{const a=e.substring(2,e.length-2),i=N[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",E=/%%.*?%%/g,G=e=>{const n=e.match(E)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},U=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},R=(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}`}},B=new Date("2023-12-31"),P=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<U(e.getFullYear()),L=(e,n=new Date)=>{return"US"===e&&P(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(U(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=U(e.getFullYear())&&e<B)(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()):R(n);var t},D=e.object({text:e.string(),baseUrl:e.string()});let w=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(w);const O=e.object({type:e.literal(w.Custom),cta:D}),k=e.object({type:e.literal(w.ContributionsReminder)}),f=e.discriminatedUnion("type",[O,k]);let K=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const v=e.nativeEnum(K);let F=function(e){return e.money="money",e}({});const j=e.nativeEnum(F),H=e.object({countLabel:e.string(),goalReachedPrimary:e.string().optional(),goalReachedSecondary:e.string().optional()}),Y=e.object({total:e.number(),goal:e.number()}),V=e.enum(["US","AU"]),W=e.object({endType:v,countType:j,currencySymbol:e.string(),copy:H,name:V,tickerData:Y.optional()}),Z=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),$=e.enum(["for52Weeks","forTargetedWeeks"]),x=e.object({type:e.literal("above"),copy:e.string().optional(),countType:$.optional()}),_=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),J=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),Q=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:J,products:e.array(_).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string(),clientName:e.string()}),z=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()}),q=e.object({name:e.string(),description:e.string().optional(),headshot:z.optional()}),X=/^[0-9A-F]{2}$/,ee=e.string().refine((e=>X.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),ne=e.object({r:ee,g:ee,b:ee,kind:e.literal("hex")}),te=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),ae=e.object({buttonColour:ne.nullish(),buttonTextColour:ne.nullish(),buttonBorderColour:ne.nullish(),buttonSelectColour:ne.nullish(),buttonSelectTextColour:ne.nullish(),buttonSelectBorderColour:ne.nullish(),kind:e.literal("ChoiceCards")}),ie=e.discriminatedUnion("kind",[te,ae]),oe=e.object({visual:ie.nullish(),colours:e.object({basic:e.object({background:ne,bodyText:ne})})}),re=e=>`#${e.r}${e.g}${e.b}`,se=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),le=e.enum(["new","guest","current"]),ue=e.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),ce=e.enum(["Live","Draft","Archived"]),de=e.enum(["Mobile","Desktop","All","iOS","Android"]),ge=e.enum(["SignedIn","SignedOut","All"]),me=e.enum(["HasConsented","HasNotConsented","All"]),pe=e.object({name:e.literal("ABTest")}),be=e.object({name:e.literal("EpsilonGreedyBandit"),epsilon:e.number(),sampleCount:e.number().optional()}),Ce=e.object({name:e.literal("Roulette"),sampleCount:e.number().optional()}),Se=e.intersection(e.discriminatedUnion("name",[pe,be,Ce]),e.object({testName:e.string().optional()})),he=e.object({channel:ue,name:e.string(),status:ce,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:de.optional(),signedInStatus:ge.optional(),consentStatus:me.optional(),methodologies:Se.array().optional()}),ye=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(le),product:e.array(se)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const Te=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ie=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),Ne=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),Me=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:Ne,displayContributionType:Ne.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()})})}),Ee=e.object({newsletterId:e.string(),successDescription:e.string()}),Ge=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:W.optional(),cta:D.optional(),secondaryCta:f.optional(),newsletterSignup:Ee.optional(),image:z.optional(),showReminderFields:Ie.optional(),separateArticleCount:x.optional(),maxViews:Te.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:q.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:Me.optional(),defaultChoiceCardFrequency:Ne.optional()}),Ue=e.object({variant:Ge,tracking:Q,countryCode:e.string().nullish(),articleCounts:Z,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Re=e.enum(["contributions","subscriptions","signIn","abandonedBasket"]),Be=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:D.optional(),secondaryCta:f.optional()}),Pe=e.object({tracking:Q,bannerChannel:Re,content:Be.nullish(),mobileContent:Be.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:W.nullish(),submitComponentEvent:e.any(),articleCounts:Z,hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:oe.nullish()}),Le=e.object({heading:e.string(),subheading:e.string(),primaryCta:D.optional(),secondaryCta:D.optional(),benefits:e.array(e.string()).optional()}),De=e.object({content:Le,tracking:Q,mobileContent:Le.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),we=e.object({image:z,bodyCopy:e.array(e.string()),cta:D.optional()});e.object({content:we,tracking:Q,countryCode:e.string().optional(),submitComponentEvent:e.any()});const Oe=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),ke=["ONE_OFF","MONTHLY","ANNUAL"];he.extend({name:e.string(),status:ce,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:Oe.optional(),userCohort:ye,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:Ae.optional(),priority:e.number(),variants:Ge.array()});const fe=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")])}),Ke=(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()))},ve=(e,n)=>Ke("epic",e,n),Fe=(e,n)=>Ke("liveblog-epic",e,n),je=(e,n)=>Ke("banner",e,n),He=(e,n)=>Ke("gutter-liveblog",e,n),Ye=(e,n)=>Ke("header",e,n);export{d as CountryGroupId,w as SecondaryCtaType,F as TickerCountType,K as TickerEndType,fe as abandonedBasketSchema,T as addRegionIdToSupportUrl,Pe as bannerSchema,R as buildReminderFields,G as containsNonArticleCountPlaceholder,ke as contributionTabFrequencies,C as countryCodeToCountryGroupId,g as countryGroupIdSchema,Ue as epicPropsSchema,je as getBanner,y as getCountryName,ve as getEpic,t as getEpicViewLog,He as getGutterLiveblog,Ye as getHeader,Fe as getLiveblogEpic,h as getLocalCurrencySymbol,L as getReminderFields,s as getWeeklyArticleHistory,De as headerPropsSchema,re as hexColourToString,S as inCountryGroups,c as incrementWeeklyArticleCount,A as isGWCheckoutUrl,a as logEpicView,M as replaceNonArticleCountPlaceholders};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zod");const n="gu.contributions.views",t="gu.history.weeklyArticleCount",a="gu.history.articleCountsThisWeek",o=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},r=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","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),i=(e,n={})=>(e.forEach((e=>{r.has(e)&&(n[e]=(n[e]??0)+1)})),n),s=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],l=e.z.enum(s),u={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"},d={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(u).find((n=>u[n].countries.includes(e??"")))||"International",g=e=>{if(e){const n=p(e);return d[n]}return"£"},z=e=>{if(e)return c[e]},m=e=>/subscribe\/weekly\/checkout/.test(e),C=(e,n,t,a)=>{if(a){const o=a[p(t)];if(o){return`${g(t)}${o[e][n].price}`}}},b={CURRENCY_SYMBOL:({countryCode:e})=>g(e),COUNTRY_NAME:({countryCode:e})=>z(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>C("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>C("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>C("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>C("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"}))()},S=/%%.*?%%/g,h=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},y=(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"}),o=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${o}-${t}-01`,reminderLabel:`${a} ${o}`}},A=new Date("2023-12-31"),T=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<h(e.getFullYear()),I=e.z.object({text:e.z.string(),baseUrl:e.z.string()});let N=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.z.nativeEnum(N);const M=e.z.object({type:e.z.literal(N.Custom),cta:I}),E=e.z.object({type:e.z.literal(N.ContributionsReminder)}),G=e.z.discriminatedUnion("type",[M,E]);let U=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const R=e.z.nativeEnum(U);let B=function(e){return e.money="money",e}({});const P=e.z.nativeEnum(B),L=e.z.object({countLabel:e.z.string(),goalReachedPrimary:e.z.string().optional(),goalReachedSecondary:e.z.string().optional()}),D=e.z.object({total:e.z.number(),goal:e.z.number()}),w=e.z.enum(["US","AU"]),O=e.z.object({endType:R,countType:P,currencySymbol:e.z.string(),copy:L,name:w,tickerData:D.optional()}),k=e.z.object({for52Weeks:e.z.number(),forTargetedWeeks:e.z.number()}),x=e.z.enum(["for52Weeks","forTargetedWeeks"]),f=e.z.object({type:e.z.literal("above"),copy:e.z.string().optional(),countType:x.optional()}),F=e.z.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),K=e.z.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),v=e.z.object({abTestName:e.z.string(),abTestVariant:e.z.string(),campaignCode:e.z.string(),componentType:K,products:e.z.array(F).nullish(),labels:e.z.array(e.z.string()).nullish(),ophanPageId:e.z.string(),platformId:e.z.string(),referrerUrl:e.z.string(),clientName:e.z.string()}),j=e.z.object({mainUrl:e.z.string(),mobileUrl:e.z.string().optional(),tabletUrl:e.z.string().optional(),desktopUrl:e.z.string().optional(),leftColUrl:e.z.string().optional(),wideUrl:e.z.string().optional(),altText:e.z.string()}),H=e.z.object({name:e.z.string(),description:e.z.string().optional(),headshot:j.optional()}),V=/^[0-9A-F]{2}$/,Y=e.z.string().refine((e=>V.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),W=e.z.object({r:Y,g:Y,b:Y,kind:e.z.literal("hex")}),Z=e.z.object({mobileUrl:e.z.string(),tabletUrl:e.z.string(),desktopUrl:e.z.string(),altText:e.z.string(),kind:e.z.literal("Image")}),$=e.z.object({buttonColour:W.nullish(),buttonTextColour:W.nullish(),buttonBorderColour:W.nullish(),buttonSelectColour:W.nullish(),buttonSelectTextColour:W.nullish(),buttonSelectBorderColour:W.nullish(),kind:e.z.literal("ChoiceCards")}),_=e.z.discriminatedUnion("kind",[Z,$]),J=e.z.object({visual:_.nullish(),colours:e.z.object({basic:e.z.object({background:W,bodyText:W})})}),Q=e.z.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),q=e.z.enum(["new","guest","current"]),X=e.z.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header"]),ee=e.z.enum(["Live","Draft","Archived"]),ne=e.z.enum(["Mobile","Desktop","All","iOS","Android"]),te=e.z.enum(["SignedIn","SignedOut","All"]),ae=e.z.enum(["HasConsented","HasNotConsented","All"]),oe=e.z.object({name:e.z.literal("ABTest")}),re=e.z.object({name:e.z.literal("EpsilonGreedyBandit"),epsilon:e.z.number(),sampleCount:e.z.number().optional()}),ie=e.z.object({name:e.z.literal("Roulette"),sampleCount:e.z.number().optional()}),se=e.z.intersection(e.z.discriminatedUnion("name",[oe,re,ie]),e.z.object({testName:e.z.string().optional()})),le=e.z.object({channel:X,name:e.z.string(),status:ee,priority:e.z.number(),controlProportionSettings:e.z.object({proportion:e.z.number(),offset:e.z.number()}).optional(),deviceType:ne.optional(),signedInStatus:te.optional(),consentStatus:ae.optional(),methodologies:se.array().optional()}),ue=e.z.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ce=e.z.object({minViews:e.z.number(),maxViews:e.z.number().optional(),periodInWeeks:e.z.number(),tagIds:e.z.array(e.z.string()).optional()});e.z.object({userType:e.z.array(q),product:e.z.array(Q)}),e.z.object({tagIds:e.z.array(e.z.string()),sectionIds:e.z.array(e.z.string()),excludedTagIds:e.z.array(e.z.string()),excludedSectionIds:e.z.array(e.z.string())});const de=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()}),pe=e.z.object({reminderCta:e.z.string(),reminderLabel:e.z.string(),reminderPeriod:e.z.string()}),ge=e.z.enum(["ONE_OFF","MONTHLY","ANNUAL"]),ze=e.z.object({testName:e.z.string(),variantName:e.z.string(),defaultContributionType:ge,displayContributionType:ge.array(),amountsCardData:e.z.object({ONE_OFF:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()}),MONTHLY:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()}),ANNUAL:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()})})}),me=e.z.object({newsletterId:e.z.string(),successDescription:e.z.string()}),Ce=e.z.object({name:e.z.string(),heading:e.z.string().optional(),paragraphs:e.z.array(e.z.string()),highlightedText:e.z.string().optional(),tickerSettings:O.optional(),cta:I.optional(),secondaryCta:G.optional(),newsletterSignup:me.optional(),image:j.optional(),showReminderFields:pe.optional(),separateArticleCount:f.optional(),maxViews:de.optional(),showSignInLink:e.z.boolean().optional(),bylineWithImage:H.optional(),showChoiceCards:e.z.boolean().optional(),choiceCardAmounts:ze.optional(),defaultChoiceCardFrequency:ge.optional()}),be=e.z.object({variant:Ce,tracking:v,countryCode:e.z.string().nullish(),articleCounts:k,onReminderOpen:e.z.any().nullish(),fetchEmail:e.z.any().nullish(),submitComponentEvent:e.z.any().nullish(),openCmp:e.z.any().nullish(),hasConsentForArticleCount:e.z.boolean().nullish(),stage:e.z.string().nullish()}),Se=e.z.enum(["contributions","subscriptions","signIn","abandonedBasket"]),he=e.z.object({heading:e.z.string().optional(),messageText:e.z.string().optional(),paragraphs:e.z.array(e.z.string()).optional(),mobileMessageText:e.z.string().optional(),highlightedText:e.z.string().optional(),cta:I.optional(),secondaryCta:G.optional()}),ye=e.z.object({tracking:v,bannerChannel:Se,content:he.nullish(),mobileContent:he.nullish(),countryCode:e.z.string().nullish(),isSupporter:e.z.boolean().nullish(),tickerSettings:O.nullish(),submitComponentEvent:e.z.any(),articleCounts:k,hasOptedOutOfArticleCount:e.z.boolean().nullish(),fetchEmail:e.z.any().nullish(),separateArticleCount:e.z.boolean().nullish(),design:J.nullish()}),Ae=e.z.object({heading:e.z.string(),subheading:e.z.string(),primaryCta:I.optional(),secondaryCta:I.optional(),benefits:e.z.array(e.z.string()).optional()}),Te=e.z.object({content:Ae,tracking:v,mobileContent:Ae.optional(),countryCode:e.z.string().optional(),submitComponentEvent:e.z.any(),numArticles:e.z.number().optional()}),Ie=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()});le.extend({name:e.z.string(),status:ee,locations:e.z.array(l),tagIds:e.z.array(e.z.string()),sections:e.z.array(e.z.string()),excludedTagIds:e.z.array(e.z.string()),excludedSections:e.z.array(e.z.string()),alwaysAsk:e.z.boolean(),maxViews:Ie.optional(),userCohort:ue,hasCountryName:e.z.boolean(),highPriority:e.z.boolean(),useLocalViewLog:e.z.boolean(),articlesViewedSettings:ce.optional(),priority:e.z.number(),variants:Ce.array()});const Ne=e.z.object({amount:e.z.union([e.z.number(),e.z.literal("other")]),billingPeriod:e.z.union([e.z.literal("ONE_OFF"),e.z.literal("MONTHLY"),e.z.literal("ANNUAL")]),product:e.z.union([e.z.literal("Contribution"),e.z.literal("SupporterPlus"),e.z.literal("PremiumTier"),e.z.literal("DailyEdition"),e.z.literal("GuardianWeekly"),e.z.literal("Paper"),e.z.literal("PaperAndDigital")]),region:e.z.union([e.z.literal("uk"),e.z.literal("us"),e.z.literal("au"),e.z.literal("eu"),e.z.literal("int"),e.z.literal("nz"),e.z.literal("ca")])}),Me=(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=s,exports.SecondaryCtaType=N,exports.TickerCountType=B,exports.TickerEndType=U,exports.abandonedBasketSchema=Ne,exports.addRegionIdToSupportUrl=(e,n)=>{if(n){const t=(e=>u[p(e)]?.supportRegionId)(n);if(t&&!m(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},exports.bannerSchema=ye,exports.buildReminderFields=y,exports.containsNonArticleCountPlaceholder=e=>{const n=e.match(S)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=p,exports.countryGroupIdSchema=l,exports.epicPropsSchema=be,exports.getBanner=(e,n)=>Me("banner",e,n),exports.getCountryName=z,exports.getEpic=(e,n)=>Me("epic",e,n),exports.getEpicViewLog=e=>e.get(n)||void 0,exports.getHeader=(e,n)=>Me("header",e,n),exports.getLiveblogEpic=(e,n)=>Me("liveblog-epic",e,n),exports.getLocalCurrencySymbol=g,exports.getReminderFields=(e,n=new Date)=>{return"US"===e&&T(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(h(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=h(e.getFullYear())&&e<A)(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()):y(n);var t},exports.getWeeklyArticleHistory=e=>e.get(t)||void 0,exports.headerPropsSchema=Te,exports.hexColourToString=e=>`#${e.r}${e.g}${e.b}`,exports.inCountryGroups=(e,n=[])=>0===n.length||!!e&&n.includes(p(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,n,r)=>{const s=((e,n)=>{const t=o(new Date),r=e.get(a);if(r&&r.week===t){const o=r.articles[n]||0;return e.set(a,{week:t,articles:{...r.articles,[n]:o+1}}),o>0}return e.set(a,{week:t,articles:{[n]:1}}),!1})(e,n);if(!s){const n=o(new Date),a=e.get(t)||[],s=a[0];if(s&&s.week&&s.week===n)s.count+=1,s.tags=i(r,s.tags),e.set(t,a);else{a.unshift({week:n,count:1,tags:i(r,{})});const o=n-365,s=a.filter((e=>e.week>=o));e.set(t,s)}}},exports.isGWCheckoutUrl=m,exports.logEpicView=e=>{const t=localStorage.getItem(n),a=t?JSON.parse(t).value:[];a.push({date:(new Date).getTime(),testId:e});const o={value:a.slice(-50)};localStorage.setItem(n,JSON.stringify(o))},exports.replaceNonArticleCountPlaceholders=(e,n,t)=>e?e.replace(S,(e=>{const a=e.substring(2,e.length-2),o=b[a];if(o){const e=o({countryCode:n,prices:t});if(e)return e}return e})):"";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zod");const t="gu.contributions.views",n="gu.history.weeklyArticleCount",a="gu.history.articleCountsThisWeek",o=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},r=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","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),i=(e,t={})=>(e.forEach((e=>{r.has(e)&&(t[e]=(t[e]??0)+1)})),t),s=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],l=e.z.enum(s),u={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"},d={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(u).find((t=>u[t].countries.includes(e??"")))||"International",g=e=>{if(e){const t=p(e);return d[t]}return"£"},z=e=>{if(e)return c[e]},m=e=>/subscribe\/weekly\/checkout/.test(e),C=(e,t,n,a)=>{if(a){const o=a[p(n)];if(o){return`${g(n)}${o[e][t].price}`}}},b={CURRENCY_SYMBOL:({countryCode:e})=>g(e),COUNTRY_NAME:({countryCode:e})=>z(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>C("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>C("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>C("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>C("GuardianWeekly","Annual",e,t),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"}))()},S=/%%.*?%%/g,h=e=>{const t=(e=>{const t=new Date(e,10,1).getDay();return new Date(e,10,22+(11-t)%7)})(e);return t.setDate(t.getDate()+5),t},y=(e=new Date)=>{const t=(e=>{const t=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+t),e})(e),n=(t.getMonth()+1).toString().padStart(2,"0"),a=t.toLocaleString("default",{month:"long"}),o=t.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${o}-${n}-01`,reminderLabel:`${a} ${o}`}},A=new Date("2023-12-31"),T=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<h(e.getFullYear()),I=e.z.object({text:e.z.string(),baseUrl:e.z.string()});let N=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.z.nativeEnum(N);const M=e.z.object({type:e.z.literal(N.Custom),cta:I}),E=e.z.object({type:e.z.literal(N.ContributionsReminder)}),G=e.z.discriminatedUnion("type",[M,E]);let U=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const R=e.z.nativeEnum(U);let B=function(e){return e.money="money",e}({});const P=e.z.nativeEnum(B),L=e.z.object({countLabel:e.z.string(),goalReachedPrimary:e.z.string().optional(),goalReachedSecondary:e.z.string().optional()}),D=e.z.object({total:e.z.number(),goal:e.z.number()}),w=e.z.enum(["US","AU"]),k=e.z.object({endType:R,countType:P,currencySymbol:e.z.string(),copy:L,name:w,tickerData:D.optional()}),O=e.z.object({for52Weeks:e.z.number(),forTargetedWeeks:e.z.number()}),x=e.z.enum(["for52Weeks","forTargetedWeeks"]),f=e.z.object({type:e.z.literal("above"),copy:e.z.string().optional(),countType:x.optional()}),v=e.z.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),F=e.z.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),K=e.z.object({abTestName:e.z.string(),abTestVariant:e.z.string(),campaignCode:e.z.string(),componentType:F,products:e.z.array(v).nullish(),labels:e.z.array(e.z.string()).nullish(),ophanPageId:e.z.string(),platformId:e.z.string(),referrerUrl:e.z.string(),clientName:e.z.string()}),j=e.z.object({mainUrl:e.z.string(),mobileUrl:e.z.string().optional(),tabletUrl:e.z.string().optional(),desktopUrl:e.z.string().optional(),leftColUrl:e.z.string().optional(),wideUrl:e.z.string().optional(),altText:e.z.string()}),H=e.z.object({name:e.z.string(),description:e.z.string().optional(),headshot:j.optional()}),V=/^[0-9A-F]{2}$/,Y=e.z.string().refine((e=>V.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),W=e.z.object({r:Y,g:Y,b:Y,kind:e.z.literal("hex")}),Z=e.z.object({mobileUrl:e.z.string(),tabletUrl:e.z.string(),desktopUrl:e.z.string(),altText:e.z.string(),kind:e.z.literal("Image")}),$=e.z.object({buttonColour:W.nullish(),buttonTextColour:W.nullish(),buttonBorderColour:W.nullish(),buttonSelectColour:W.nullish(),buttonSelectTextColour:W.nullish(),buttonSelectBorderColour:W.nullish(),kind:e.z.literal("ChoiceCards")}),_=e.z.discriminatedUnion("kind",[Z,$]),J=e.z.object({visual:_.nullish(),colours:e.z.object({basic:e.z.object({background:W,bodyText:W})})}),Q=e.z.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),q=e.z.enum(["new","guest","current"]),X=e.z.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),ee=e.z.enum(["Live","Draft","Archived"]),te=e.z.enum(["Mobile","Desktop","All","iOS","Android"]),ne=e.z.enum(["SignedIn","SignedOut","All"]),ae=e.z.enum(["HasConsented","HasNotConsented","All"]),oe=e.z.object({name:e.z.literal("ABTest")}),re=e.z.object({name:e.z.literal("EpsilonGreedyBandit"),epsilon:e.z.number(),sampleCount:e.z.number().optional()}),ie=e.z.object({name:e.z.literal("Roulette"),sampleCount:e.z.number().optional()}),se=e.z.intersection(e.z.discriminatedUnion("name",[oe,re,ie]),e.z.object({testName:e.z.string().optional()})),le=e.z.object({channel:X,name:e.z.string(),status:ee,priority:e.z.number(),controlProportionSettings:e.z.object({proportion:e.z.number(),offset:e.z.number()}).optional(),deviceType:te.optional(),signedInStatus:ne.optional(),consentStatus:ae.optional(),methodologies:se.array().optional()}),ue=e.z.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ce=e.z.object({minViews:e.z.number(),maxViews:e.z.number().optional(),periodInWeeks:e.z.number(),tagIds:e.z.array(e.z.string()).optional()});e.z.object({userType:e.z.array(q),product:e.z.array(Q)}),e.z.object({tagIds:e.z.array(e.z.string()),sectionIds:e.z.array(e.z.string()),excludedTagIds:e.z.array(e.z.string()),excludedSectionIds:e.z.array(e.z.string())});const de=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()}),pe=e.z.object({reminderCta:e.z.string(),reminderLabel:e.z.string(),reminderPeriod:e.z.string()}),ge=e.z.enum(["ONE_OFF","MONTHLY","ANNUAL"]),ze=e.z.object({testName:e.z.string(),variantName:e.z.string(),defaultContributionType:ge,displayContributionType:ge.array(),amountsCardData:e.z.object({ONE_OFF:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()}),MONTHLY:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()}),ANNUAL:e.z.object({amounts:e.z.array(e.z.number()),defaultAmount:e.z.number(),hideChooseYourAmount:e.z.boolean().optional()})})}),me=e.z.object({newsletterId:e.z.string(),successDescription:e.z.string()}),Ce=e.z.object({name:e.z.string(),heading:e.z.string().optional(),paragraphs:e.z.array(e.z.string()),highlightedText:e.z.string().optional(),tickerSettings:k.optional(),cta:I.optional(),secondaryCta:G.optional(),newsletterSignup:me.optional(),image:j.optional(),showReminderFields:pe.optional(),separateArticleCount:f.optional(),maxViews:de.optional(),showSignInLink:e.z.boolean().optional(),bylineWithImage:H.optional(),showChoiceCards:e.z.boolean().optional(),choiceCardAmounts:ze.optional(),defaultChoiceCardFrequency:ge.optional()}),be=e.z.object({variant:Ce,tracking:K,countryCode:e.z.string().nullish(),articleCounts:O,onReminderOpen:e.z.any().nullish(),fetchEmail:e.z.any().nullish(),submitComponentEvent:e.z.any().nullish(),openCmp:e.z.any().nullish(),hasConsentForArticleCount:e.z.boolean().nullish(),stage:e.z.string().nullish()}),Se=e.z.enum(["contributions","subscriptions","signIn","abandonedBasket"]),he=e.z.object({heading:e.z.string().optional(),messageText:e.z.string().optional(),paragraphs:e.z.array(e.z.string()).optional(),mobileMessageText:e.z.string().optional(),highlightedText:e.z.string().optional(),cta:I.optional(),secondaryCta:G.optional()}),ye=e.z.object({tracking:K,bannerChannel:Se,content:he.nullish(),mobileContent:he.nullish(),countryCode:e.z.string().nullish(),isSupporter:e.z.boolean().nullish(),tickerSettings:k.nullish(),submitComponentEvent:e.z.any(),articleCounts:O,hasOptedOutOfArticleCount:e.z.boolean().nullish(),fetchEmail:e.z.any().nullish(),separateArticleCount:e.z.boolean().nullish(),design:J.nullish()}),Ae=e.z.object({heading:e.z.string(),subheading:e.z.string(),primaryCta:I.optional(),secondaryCta:I.optional(),benefits:e.z.array(e.z.string()).optional()}),Te=e.z.object({content:Ae,tracking:K,mobileContent:Ae.optional(),countryCode:e.z.string().optional(),submitComponentEvent:e.z.any(),numArticles:e.z.number().optional()}),Ie=e.z.object({image:j,bodyCopy:e.z.array(e.z.string()),cta:I.optional()});e.z.object({content:Ie,tracking:K,countryCode:e.z.string().optional(),submitComponentEvent:e.z.any()});const Ne=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()});le.extend({name:e.z.string(),status:ee,locations:e.z.array(l),tagIds:e.z.array(e.z.string()),sections:e.z.array(e.z.string()),excludedTagIds:e.z.array(e.z.string()),excludedSections:e.z.array(e.z.string()),alwaysAsk:e.z.boolean(),maxViews:Ne.optional(),userCohort:ue,hasCountryName:e.z.boolean(),highPriority:e.z.boolean(),useLocalViewLog:e.z.boolean(),articlesViewedSettings:ce.optional(),priority:e.z.number(),variants:Ce.array()});const Me=e.z.object({amount:e.z.union([e.z.number(),e.z.literal("other")]),billingPeriod:e.z.union([e.z.literal("ONE_OFF"),e.z.literal("MONTHLY"),e.z.literal("ANNUAL")]),product:e.z.union([e.z.literal("Contribution"),e.z.literal("SupporterPlus"),e.z.literal("PremiumTier"),e.z.literal("DailyEdition"),e.z.literal("GuardianWeekly"),e.z.literal("Paper"),e.z.literal("PaperAndDigital")]),region:e.z.union([e.z.literal("uk"),e.z.literal("us"),e.z.literal("au"),e.z.literal("eu"),e.z.literal("int"),e.z.literal("nz"),e.z.literal("ca")])}),Ee=(e,t,n)=>{const a=(e=>{if(URLSearchParams){const t=new URLSearchParams(window.location.search).get(`force-${e}`);if(t)return t}return null})(e);return fetch(`${t}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then((t=>{if(!t.ok)throw Error(t.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${t.status}`);return t})).then((e=>e.json()))};exports.CountryGroupId=s,exports.SecondaryCtaType=N,exports.TickerCountType=B,exports.TickerEndType=U,exports.abandonedBasketSchema=Me,exports.addRegionIdToSupportUrl=(e,t)=>{if(t){const n=(e=>u[p(e)]?.supportRegionId)(t);if(n&&!m(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,t,a)=>`${t}/${n.toLowerCase()}/${a}`))}return e},exports.bannerSchema=ye,exports.buildReminderFields=y,exports.containsNonArticleCountPlaceholder=e=>{const t=e.match(S)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!t&&t.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=p,exports.countryGroupIdSchema=l,exports.epicPropsSchema=be,exports.getBanner=(e,t)=>Ee("banner",e,t),exports.getCountryName=z,exports.getEpic=(e,t)=>Ee("epic",e,t),exports.getEpicViewLog=e=>e.get(t)||void 0,exports.getGutterLiveblog=(e,t)=>Ee("gutter-liveblog",e,t),exports.getHeader=(e,t)=>Ee("header",e,t),exports.getLiveblogEpic=(e,t)=>Ee("liveblog-epic",e,t),exports.getLocalCurrencySymbol=g,exports.getReminderFields=(e,t=new Date)=>{return"US"===e&&T(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${n=t.getFullYear()}-${(h(n).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${n}`}:"US"===e&&(e=>e>=h(e.getFullYear())&&e<A)(t)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(t.getFullYear()):y(t);var n},exports.getWeeklyArticleHistory=e=>e.get(n)||void 0,exports.headerPropsSchema=Te,exports.hexColourToString=e=>`#${e.r}${e.g}${e.b}`,exports.inCountryGroups=(e,t=[])=>0===t.length||!!e&&t.includes(p(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,t,r)=>{const s=((e,t)=>{const n=o(new Date),r=e.get(a);if(r&&r.week===n){const o=r.articles[t]||0;return e.set(a,{week:n,articles:{...r.articles,[t]:o+1}}),o>0}return e.set(a,{week:n,articles:{[t]:1}}),!1})(e,t);if(!s){const t=o(new Date),a=e.get(n)||[],s=a[0];if(s&&s.week&&s.week===t)s.count+=1,s.tags=i(r,s.tags),e.set(n,a);else{a.unshift({week:t,count:1,tags:i(r,{})});const o=t-365,s=a.filter((e=>e.week>=o));e.set(n,s)}}},exports.isGWCheckoutUrl=m,exports.logEpicView=e=>{const n=localStorage.getItem(t),a=n?JSON.parse(n).value:[];a.push({date:(new Date).getTime(),testId:e});const o={value:a.slice(-50)};localStorage.setItem(t,JSON.stringify(o))},exports.replaceNonArticleCountPlaceholders=(e,t,n)=>e?e.replace(S,(e=>{const a=e.substring(2,e.length-2),o=b[a];if(o){const e=o({countryCode:t,prices:n});if(e)return e}return e})):"";
@@ -432,7 +432,7 @@ export interface BannerTest extends BannerTestFromTool {
432
432
  variants: BannerVariant[];
433
433
  }
434
434
  export declare const bannerTestFromToolSchema: z.ZodObject<{
435
- channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header"]>;
435
+ channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"]>;
436
436
  priority: z.ZodNumber;
437
437
  name: z.ZodString;
438
438
  status: z.ZodEnum<["Live", "Draft", "Archived"]>;
@@ -914,7 +914,7 @@ export declare const bannerTestFromToolSchema: z.ZodObject<{
914
914
  daysBetween: number;
915
915
  }>>;
916
916
  }, "strip", z.ZodTypeAny, {
917
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
917
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
918
918
  priority: number;
919
919
  name: string;
920
920
  status: "Live" | "Draft" | "Archived";
@@ -1024,7 +1024,7 @@ export declare const bannerTestFromToolSchema: z.ZodObject<{
1024
1024
  daysBetween: number;
1025
1025
  } | undefined;
1026
1026
  }, {
1027
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
1027
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
1028
1028
  priority: number;
1029
1029
  name: string;
1030
1030
  status: "Live" | "Draft" | "Archived";
@@ -70,7 +70,7 @@ export interface EpicTest extends EpicTestFromTool {
70
70
  expiry?: string;
71
71
  }
72
72
  export declare const epicTestFromToolSchema: z.ZodObject<{
73
- channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header"]>;
73
+ channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"]>;
74
74
  controlProportionSettings: z.ZodOptional<z.ZodObject<{
75
75
  proportion: z.ZodNumber;
76
76
  offset: z.ZodNumber;
@@ -718,7 +718,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
718
718
  defaultChoiceCardFrequency?: "ONE_OFF" | "MONTHLY" | "ANNUAL" | undefined;
719
719
  }>, "many">;
720
720
  }, "strip", z.ZodTypeAny, {
721
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
721
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
722
722
  priority: number;
723
723
  name: string;
724
724
  status: "Live" | "Draft" | "Archived";
@@ -864,7 +864,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
864
864
  tagIds?: string[] | undefined;
865
865
  } | undefined;
866
866
  }, {
867
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
867
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
868
868
  priority: number;
869
869
  name: string;
870
870
  status: "Live" | "Draft" | "Archived";
@@ -0,0 +1,409 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Models and schemas for data from the database
4
+ */
5
+ declare const gutterVariantFromToolSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ content: z.ZodObject<{
8
+ image: z.ZodObject<{
9
+ mainUrl: z.ZodString;
10
+ mobileUrl: z.ZodOptional<z.ZodString>;
11
+ tabletUrl: z.ZodOptional<z.ZodString>;
12
+ desktopUrl: z.ZodOptional<z.ZodString>;
13
+ leftColUrl: z.ZodOptional<z.ZodString>;
14
+ wideUrl: z.ZodOptional<z.ZodString>;
15
+ altText: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ mainUrl: string;
18
+ altText: string;
19
+ mobileUrl?: string | undefined;
20
+ tabletUrl?: string | undefined;
21
+ desktopUrl?: string | undefined;
22
+ leftColUrl?: string | undefined;
23
+ wideUrl?: string | undefined;
24
+ }, {
25
+ mainUrl: string;
26
+ altText: string;
27
+ mobileUrl?: string | undefined;
28
+ tabletUrl?: string | undefined;
29
+ desktopUrl?: string | undefined;
30
+ leftColUrl?: string | undefined;
31
+ wideUrl?: string | undefined;
32
+ }>;
33
+ bodyCopy: z.ZodArray<z.ZodString, "many">;
34
+ cta: z.ZodOptional<z.ZodObject<{
35
+ text: z.ZodString;
36
+ baseUrl: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ text: string;
39
+ baseUrl: string;
40
+ }, {
41
+ text: string;
42
+ baseUrl: string;
43
+ }>>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ image: {
46
+ mainUrl: string;
47
+ altText: string;
48
+ mobileUrl?: string | undefined;
49
+ tabletUrl?: string | undefined;
50
+ desktopUrl?: string | undefined;
51
+ leftColUrl?: string | undefined;
52
+ wideUrl?: string | undefined;
53
+ };
54
+ bodyCopy: string[];
55
+ cta?: {
56
+ text: string;
57
+ baseUrl: string;
58
+ } | undefined;
59
+ }, {
60
+ image: {
61
+ mainUrl: string;
62
+ altText: string;
63
+ mobileUrl?: string | undefined;
64
+ tabletUrl?: string | undefined;
65
+ desktopUrl?: string | undefined;
66
+ leftColUrl?: string | undefined;
67
+ wideUrl?: string | undefined;
68
+ };
69
+ bodyCopy: string[];
70
+ cta?: {
71
+ text: string;
72
+ baseUrl: string;
73
+ } | undefined;
74
+ }>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ name: string;
77
+ content: {
78
+ image: {
79
+ mainUrl: string;
80
+ altText: string;
81
+ mobileUrl?: string | undefined;
82
+ tabletUrl?: string | undefined;
83
+ desktopUrl?: string | undefined;
84
+ leftColUrl?: string | undefined;
85
+ wideUrl?: string | undefined;
86
+ };
87
+ bodyCopy: string[];
88
+ cta?: {
89
+ text: string;
90
+ baseUrl: string;
91
+ } | undefined;
92
+ };
93
+ }, {
94
+ name: string;
95
+ content: {
96
+ image: {
97
+ mainUrl: string;
98
+ altText: string;
99
+ mobileUrl?: string | undefined;
100
+ tabletUrl?: string | undefined;
101
+ desktopUrl?: string | undefined;
102
+ leftColUrl?: string | undefined;
103
+ wideUrl?: string | undefined;
104
+ };
105
+ bodyCopy: string[];
106
+ cta?: {
107
+ text: string;
108
+ baseUrl: string;
109
+ } | undefined;
110
+ };
111
+ }>;
112
+ export type GutterVariantFromTool = z.infer<typeof gutterVariantFromToolSchema>;
113
+ export declare const gutterTestFromToolSchema: z.ZodObject<{
114
+ channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"]>;
115
+ priority: z.ZodNumber;
116
+ name: z.ZodString;
117
+ status: z.ZodEnum<["Live", "Draft", "Archived"]>;
118
+ controlProportionSettings: z.ZodOptional<z.ZodObject<{
119
+ proportion: z.ZodNumber;
120
+ offset: z.ZodNumber;
121
+ }, "strip", z.ZodTypeAny, {
122
+ offset: number;
123
+ proportion: number;
124
+ }, {
125
+ offset: number;
126
+ proportion: number;
127
+ }>>;
128
+ deviceType: z.ZodOptional<z.ZodEnum<["Mobile", "Desktop", "All", "iOS", "Android"]>>;
129
+ signedInStatus: z.ZodOptional<z.ZodEnum<["SignedIn", "SignedOut", "All"]>>;
130
+ consentStatus: z.ZodOptional<z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>>;
131
+ methodologies: z.ZodOptional<z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<"name", [z.ZodObject<{
132
+ name: z.ZodLiteral<"ABTest">;
133
+ }, "strip", z.ZodTypeAny, {
134
+ name: "ABTest";
135
+ }, {
136
+ name: "ABTest";
137
+ }>, z.ZodObject<{
138
+ name: z.ZodLiteral<"EpsilonGreedyBandit">;
139
+ epsilon: z.ZodNumber;
140
+ sampleCount: z.ZodOptional<z.ZodNumber>;
141
+ }, "strip", z.ZodTypeAny, {
142
+ name: "EpsilonGreedyBandit";
143
+ epsilon: number;
144
+ sampleCount?: number | undefined;
145
+ }, {
146
+ name: "EpsilonGreedyBandit";
147
+ epsilon: number;
148
+ sampleCount?: number | undefined;
149
+ }>, z.ZodObject<{
150
+ name: z.ZodLiteral<"Roulette">;
151
+ sampleCount: z.ZodOptional<z.ZodNumber>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ name: "Roulette";
154
+ sampleCount?: number | undefined;
155
+ }, {
156
+ name: "Roulette";
157
+ sampleCount?: number | undefined;
158
+ }>]>, z.ZodObject<{
159
+ testName: z.ZodOptional<z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ testName?: string | undefined;
162
+ }, {
163
+ testName?: string | undefined;
164
+ }>>, "many">>;
165
+ locations: z.ZodArray<z.ZodEnum<["GBPCountries", "UnitedStates", "AUDCountries", "EURCountries", "International", "NZDCountries", "Canada"]>, "many">;
166
+ userCohort: z.ZodEnum<["AllExistingSupporters", "AllNonSupporters", "Everyone", "PostAskPauseSingleContributors"]>;
167
+ contextTargeting: z.ZodObject<{
168
+ tagIds: z.ZodArray<z.ZodString, "many">;
169
+ sectionIds: z.ZodArray<z.ZodString, "many">;
170
+ excludedTagIds: z.ZodArray<z.ZodString, "many">;
171
+ excludedSectionIds: z.ZodArray<z.ZodString, "many">;
172
+ }, "strip", z.ZodTypeAny, {
173
+ tagIds: string[];
174
+ sectionIds: string[];
175
+ excludedTagIds: string[];
176
+ excludedSectionIds: string[];
177
+ }, {
178
+ tagIds: string[];
179
+ sectionIds: string[];
180
+ excludedTagIds: string[];
181
+ excludedSectionIds: string[];
182
+ }>;
183
+ variants: z.ZodArray<z.ZodObject<{
184
+ name: z.ZodString;
185
+ content: z.ZodObject<{
186
+ image: z.ZodObject<{
187
+ mainUrl: z.ZodString;
188
+ mobileUrl: z.ZodOptional<z.ZodString>;
189
+ tabletUrl: z.ZodOptional<z.ZodString>;
190
+ desktopUrl: z.ZodOptional<z.ZodString>;
191
+ leftColUrl: z.ZodOptional<z.ZodString>;
192
+ wideUrl: z.ZodOptional<z.ZodString>;
193
+ altText: z.ZodString;
194
+ }, "strip", z.ZodTypeAny, {
195
+ mainUrl: string;
196
+ altText: string;
197
+ mobileUrl?: string | undefined;
198
+ tabletUrl?: string | undefined;
199
+ desktopUrl?: string | undefined;
200
+ leftColUrl?: string | undefined;
201
+ wideUrl?: string | undefined;
202
+ }, {
203
+ mainUrl: string;
204
+ altText: string;
205
+ mobileUrl?: string | undefined;
206
+ tabletUrl?: string | undefined;
207
+ desktopUrl?: string | undefined;
208
+ leftColUrl?: string | undefined;
209
+ wideUrl?: string | undefined;
210
+ }>;
211
+ bodyCopy: z.ZodArray<z.ZodString, "many">;
212
+ cta: z.ZodOptional<z.ZodObject<{
213
+ text: z.ZodString;
214
+ baseUrl: z.ZodString;
215
+ }, "strip", z.ZodTypeAny, {
216
+ text: string;
217
+ baseUrl: string;
218
+ }, {
219
+ text: string;
220
+ baseUrl: string;
221
+ }>>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ image: {
224
+ mainUrl: string;
225
+ altText: string;
226
+ mobileUrl?: string | undefined;
227
+ tabletUrl?: string | undefined;
228
+ desktopUrl?: string | undefined;
229
+ leftColUrl?: string | undefined;
230
+ wideUrl?: string | undefined;
231
+ };
232
+ bodyCopy: string[];
233
+ cta?: {
234
+ text: string;
235
+ baseUrl: string;
236
+ } | undefined;
237
+ }, {
238
+ image: {
239
+ mainUrl: string;
240
+ altText: string;
241
+ mobileUrl?: string | undefined;
242
+ tabletUrl?: string | undefined;
243
+ desktopUrl?: string | undefined;
244
+ leftColUrl?: string | undefined;
245
+ wideUrl?: string | undefined;
246
+ };
247
+ bodyCopy: string[];
248
+ cta?: {
249
+ text: string;
250
+ baseUrl: string;
251
+ } | undefined;
252
+ }>;
253
+ }, "strip", z.ZodTypeAny, {
254
+ name: string;
255
+ content: {
256
+ image: {
257
+ mainUrl: string;
258
+ altText: string;
259
+ mobileUrl?: string | undefined;
260
+ tabletUrl?: string | undefined;
261
+ desktopUrl?: string | undefined;
262
+ leftColUrl?: string | undefined;
263
+ wideUrl?: string | undefined;
264
+ };
265
+ bodyCopy: string[];
266
+ cta?: {
267
+ text: string;
268
+ baseUrl: string;
269
+ } | undefined;
270
+ };
271
+ }, {
272
+ name: string;
273
+ content: {
274
+ image: {
275
+ mainUrl: string;
276
+ altText: string;
277
+ mobileUrl?: string | undefined;
278
+ tabletUrl?: string | undefined;
279
+ desktopUrl?: string | undefined;
280
+ leftColUrl?: string | undefined;
281
+ wideUrl?: string | undefined;
282
+ };
283
+ bodyCopy: string[];
284
+ cta?: {
285
+ text: string;
286
+ baseUrl: string;
287
+ } | undefined;
288
+ };
289
+ }>, "many">;
290
+ }, "strip", z.ZodTypeAny, {
291
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
292
+ priority: number;
293
+ name: string;
294
+ status: "Live" | "Draft" | "Archived";
295
+ locations: ("GBPCountries" | "UnitedStates" | "AUDCountries" | "EURCountries" | "International" | "NZDCountries" | "Canada")[];
296
+ userCohort: "AllExistingSupporters" | "AllNonSupporters" | "Everyone" | "PostAskPauseSingleContributors";
297
+ variants: {
298
+ name: string;
299
+ content: {
300
+ image: {
301
+ mainUrl: string;
302
+ altText: string;
303
+ mobileUrl?: string | undefined;
304
+ tabletUrl?: string | undefined;
305
+ desktopUrl?: string | undefined;
306
+ leftColUrl?: string | undefined;
307
+ wideUrl?: string | undefined;
308
+ };
309
+ bodyCopy: string[];
310
+ cta?: {
311
+ text: string;
312
+ baseUrl: string;
313
+ } | undefined;
314
+ };
315
+ }[];
316
+ contextTargeting: {
317
+ tagIds: string[];
318
+ sectionIds: string[];
319
+ excludedTagIds: string[];
320
+ excludedSectionIds: string[];
321
+ };
322
+ controlProportionSettings?: {
323
+ offset: number;
324
+ proportion: number;
325
+ } | undefined;
326
+ deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
327
+ signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
328
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
329
+ methodologies?: (({
330
+ name: "ABTest";
331
+ } | {
332
+ name: "EpsilonGreedyBandit";
333
+ epsilon: number;
334
+ sampleCount?: number | undefined;
335
+ } | {
336
+ name: "Roulette";
337
+ sampleCount?: number | undefined;
338
+ }) & {
339
+ testName?: string | undefined;
340
+ })[] | undefined;
341
+ }, {
342
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
343
+ priority: number;
344
+ name: string;
345
+ status: "Live" | "Draft" | "Archived";
346
+ locations: ("GBPCountries" | "UnitedStates" | "AUDCountries" | "EURCountries" | "International" | "NZDCountries" | "Canada")[];
347
+ userCohort: "AllExistingSupporters" | "AllNonSupporters" | "Everyone" | "PostAskPauseSingleContributors";
348
+ variants: {
349
+ name: string;
350
+ content: {
351
+ image: {
352
+ mainUrl: string;
353
+ altText: string;
354
+ mobileUrl?: string | undefined;
355
+ tabletUrl?: string | undefined;
356
+ desktopUrl?: string | undefined;
357
+ leftColUrl?: string | undefined;
358
+ wideUrl?: string | undefined;
359
+ };
360
+ bodyCopy: string[];
361
+ cta?: {
362
+ text: string;
363
+ baseUrl: string;
364
+ } | undefined;
365
+ };
366
+ }[];
367
+ contextTargeting: {
368
+ tagIds: string[];
369
+ sectionIds: string[];
370
+ excludedTagIds: string[];
371
+ excludedSectionIds: string[];
372
+ };
373
+ controlProportionSettings?: {
374
+ offset: number;
375
+ proportion: number;
376
+ } | undefined;
377
+ deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
378
+ signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
379
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
380
+ methodologies?: (({
381
+ name: "ABTest";
382
+ } | {
383
+ name: "EpsilonGreedyBandit";
384
+ epsilon: number;
385
+ sampleCount?: number | undefined;
386
+ } | {
387
+ name: "Roulette";
388
+ sampleCount?: number | undefined;
389
+ }) & {
390
+ testName?: string | undefined;
391
+ })[] | undefined;
392
+ }>;
393
+ export type GutterTestFromTool = z.infer<typeof gutterTestFromToolSchema>;
394
+ /**
395
+ * Models with additional properties determined by the server
396
+ */
397
+ export interface GutterVariant extends GutterVariantFromTool {
398
+ moduleName?: string;
399
+ }
400
+ export interface GutterTest extends GutterTestFromTool {
401
+ variants: GutterVariant[];
402
+ }
403
+ export interface GutterTestSelection {
404
+ test: GutterTest;
405
+ variant: GutterVariant;
406
+ moduleName: string;
407
+ }
408
+ export {};
409
+ //# sourceMappingURL=gutter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutter.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/abTests/gutter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IAClD,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACtB"}
@@ -161,7 +161,7 @@ declare const headerVariantFromToolSchema: z.ZodObject<{
161
161
  }>;
162
162
  export type HeaderVariantFromTool = z.infer<typeof headerVariantFromToolSchema>;
163
163
  export declare const headerTestFromToolSchema: z.ZodObject<{
164
- channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header"]>;
164
+ channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"]>;
165
165
  priority: z.ZodNumber;
166
166
  name: z.ZodString;
167
167
  status: z.ZodEnum<["Live", "Draft", "Archived"]>;
@@ -382,7 +382,7 @@ export declare const headerTestFromToolSchema: z.ZodObject<{
382
382
  } | undefined;
383
383
  }>, "many">;
384
384
  }, "strip", z.ZodTypeAny, {
385
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
385
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
386
386
  priority: number;
387
387
  name: string;
388
388
  status: "Live" | "Draft" | "Archived";
@@ -441,7 +441,7 @@ export declare const headerTestFromToolSchema: z.ZodObject<{
441
441
  userType: ("new" | "guest" | "current")[];
442
442
  } | undefined;
443
443
  }, {
444
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
444
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
445
445
  priority: number;
446
446
  name: string;
447
447
  status: "Live" | "Draft" | "Archived";
@@ -2,4 +2,5 @@ export * from './epic';
2
2
  export * from './header';
3
3
  export * from './banner';
4
4
  export * from './shared';
5
+ export * from './gutter';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/abTests/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/abTests/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { purchaseInfoProduct, purchaseInfoUser } from '../purchaseInfo';
3
3
  import { OphanComponentType, OphanProduct } from '@guardian/libs';
4
- declare const Channel: readonly ["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header"];
4
+ declare const Channel: readonly ["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"];
5
5
  export type Channel = (typeof Channel)[number];
6
6
  declare const TestStatus: readonly ["Live", "Draft", "Archived"];
7
7
  export type TestStatus = (typeof TestStatus)[number];
@@ -70,7 +70,7 @@ export interface Test<V extends Variant> {
70
70
  methodologies?: Methodology[];
71
71
  }
72
72
  export declare const testSchema: z.ZodObject<{
73
- channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header"]>;
73
+ channel: z.ZodEnum<["Epic", "EpicAMP", "EpicAppleNews", "EpicLiveblog", "Banner1", "Banner2", "Header", "GutterLiveblog"]>;
74
74
  name: z.ZodString;
75
75
  status: z.ZodEnum<["Live", "Draft", "Archived"]>;
76
76
  priority: z.ZodNumber;
@@ -122,7 +122,7 @@ export declare const testSchema: z.ZodObject<{
122
122
  testName?: string | undefined;
123
123
  }>>, "many">>;
124
124
  }, "strip", z.ZodTypeAny, {
125
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
125
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
126
126
  priority: number;
127
127
  name: string;
128
128
  status: "Live" | "Draft" | "Archived";
@@ -146,7 +146,7 @@ export declare const testSchema: z.ZodObject<{
146
146
  testName?: string | undefined;
147
147
  })[] | undefined;
148
148
  }, {
149
- channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header";
149
+ channel: "Epic" | "EpicAMP" | "EpicAppleNews" | "EpicLiveblog" | "Banner1" | "Banner2" | "Header" | "GutterLiveblog";
150
150
  priority: number;
151
151
  name: string;
152
152
  status: "Live" | "Draft" | "Archived";
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/abTests/shared.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/abTests/shared.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,251 @@
1
+ import { z } from 'zod';
2
+ import { OphanComponentEvent } from '@guardian/libs';
3
+ import { Tracking, Cta, Image } from './shared';
4
+ export interface GutterContent {
5
+ image: Image;
6
+ bodyCopy: string[];
7
+ cta?: Cta;
8
+ }
9
+ export declare const gutterContentSchema: z.ZodObject<{
10
+ image: z.ZodObject<{
11
+ mainUrl: z.ZodString;
12
+ mobileUrl: z.ZodOptional<z.ZodString>;
13
+ tabletUrl: z.ZodOptional<z.ZodString>;
14
+ desktopUrl: z.ZodOptional<z.ZodString>;
15
+ leftColUrl: z.ZodOptional<z.ZodString>;
16
+ wideUrl: z.ZodOptional<z.ZodString>;
17
+ altText: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ mainUrl: string;
20
+ altText: string;
21
+ mobileUrl?: string | undefined;
22
+ tabletUrl?: string | undefined;
23
+ desktopUrl?: string | undefined;
24
+ leftColUrl?: string | undefined;
25
+ wideUrl?: string | undefined;
26
+ }, {
27
+ mainUrl: string;
28
+ altText: string;
29
+ mobileUrl?: string | undefined;
30
+ tabletUrl?: string | undefined;
31
+ desktopUrl?: string | undefined;
32
+ leftColUrl?: string | undefined;
33
+ wideUrl?: string | undefined;
34
+ }>;
35
+ bodyCopy: z.ZodArray<z.ZodString, "many">;
36
+ cta: z.ZodOptional<z.ZodObject<{
37
+ text: z.ZodString;
38
+ baseUrl: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ text: string;
41
+ baseUrl: string;
42
+ }, {
43
+ text: string;
44
+ baseUrl: string;
45
+ }>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ image: {
48
+ mainUrl: string;
49
+ altText: string;
50
+ mobileUrl?: string | undefined;
51
+ tabletUrl?: string | undefined;
52
+ desktopUrl?: string | undefined;
53
+ leftColUrl?: string | undefined;
54
+ wideUrl?: string | undefined;
55
+ };
56
+ bodyCopy: string[];
57
+ cta?: {
58
+ text: string;
59
+ baseUrl: string;
60
+ } | undefined;
61
+ }, {
62
+ image: {
63
+ mainUrl: string;
64
+ altText: string;
65
+ mobileUrl?: string | undefined;
66
+ tabletUrl?: string | undefined;
67
+ desktopUrl?: string | undefined;
68
+ leftColUrl?: string | undefined;
69
+ wideUrl?: string | undefined;
70
+ };
71
+ bodyCopy: string[];
72
+ cta?: {
73
+ text: string;
74
+ baseUrl: string;
75
+ } | undefined;
76
+ }>;
77
+ export interface GutterProps {
78
+ content: GutterContent;
79
+ tracking: Tracking;
80
+ countryCode?: string;
81
+ submitComponentEvent?: (componentEvent: OphanComponentEvent) => void;
82
+ }
83
+ export declare const gutterPropsSchema: z.ZodObject<{
84
+ content: z.ZodObject<{
85
+ image: z.ZodObject<{
86
+ mainUrl: z.ZodString;
87
+ mobileUrl: z.ZodOptional<z.ZodString>;
88
+ tabletUrl: z.ZodOptional<z.ZodString>;
89
+ desktopUrl: z.ZodOptional<z.ZodString>;
90
+ leftColUrl: z.ZodOptional<z.ZodString>;
91
+ wideUrl: z.ZodOptional<z.ZodString>;
92
+ altText: z.ZodString;
93
+ }, "strip", z.ZodTypeAny, {
94
+ mainUrl: string;
95
+ altText: string;
96
+ mobileUrl?: string | undefined;
97
+ tabletUrl?: string | undefined;
98
+ desktopUrl?: string | undefined;
99
+ leftColUrl?: string | undefined;
100
+ wideUrl?: string | undefined;
101
+ }, {
102
+ mainUrl: string;
103
+ altText: string;
104
+ mobileUrl?: string | undefined;
105
+ tabletUrl?: string | undefined;
106
+ desktopUrl?: string | undefined;
107
+ leftColUrl?: string | undefined;
108
+ wideUrl?: string | undefined;
109
+ }>;
110
+ bodyCopy: z.ZodArray<z.ZodString, "many">;
111
+ cta: z.ZodOptional<z.ZodObject<{
112
+ text: z.ZodString;
113
+ baseUrl: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ text: string;
116
+ baseUrl: string;
117
+ }, {
118
+ text: string;
119
+ baseUrl: string;
120
+ }>>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ image: {
123
+ mainUrl: string;
124
+ altText: string;
125
+ mobileUrl?: string | undefined;
126
+ tabletUrl?: string | undefined;
127
+ desktopUrl?: string | undefined;
128
+ leftColUrl?: string | undefined;
129
+ wideUrl?: string | undefined;
130
+ };
131
+ bodyCopy: string[];
132
+ cta?: {
133
+ text: string;
134
+ baseUrl: string;
135
+ } | undefined;
136
+ }, {
137
+ image: {
138
+ mainUrl: string;
139
+ altText: string;
140
+ mobileUrl?: string | undefined;
141
+ tabletUrl?: string | undefined;
142
+ desktopUrl?: string | undefined;
143
+ leftColUrl?: string | undefined;
144
+ wideUrl?: string | undefined;
145
+ };
146
+ bodyCopy: string[];
147
+ cta?: {
148
+ text: string;
149
+ baseUrl: string;
150
+ } | undefined;
151
+ }>;
152
+ tracking: z.ZodObject<{
153
+ abTestName: z.ZodString;
154
+ abTestVariant: z.ZodString;
155
+ campaignCode: z.ZodString;
156
+ componentType: z.ZodEnum<["ACQUISITIONS_EPIC", "ACQUISITIONS_ENGAGEMENT_BANNER", "ACQUISITIONS_SUBSCRIPTIONS_BANNER", "ACQUISITIONS_HEADER", "ACQUISITIONS_OTHER"]>;
157
+ products: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["CONTRIBUTION", "MEMBERSHIP_SUPPORTER", "DIGITAL_SUBSCRIPTION", "PRINT_SUBSCRIPTION"]>, "many">>>;
158
+ labels: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
159
+ ophanPageId: z.ZodString;
160
+ platformId: z.ZodString;
161
+ referrerUrl: z.ZodString;
162
+ clientName: z.ZodString;
163
+ }, "strip", z.ZodTypeAny, {
164
+ abTestName: string;
165
+ abTestVariant: string;
166
+ campaignCode: string;
167
+ componentType: "ACQUISITIONS_EPIC" | "ACQUISITIONS_ENGAGEMENT_BANNER" | "ACQUISITIONS_HEADER" | "ACQUISITIONS_OTHER" | "ACQUISITIONS_SUBSCRIPTIONS_BANNER";
168
+ ophanPageId: string;
169
+ platformId: string;
170
+ referrerUrl: string;
171
+ clientName: string;
172
+ products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
173
+ labels?: string[] | null | undefined;
174
+ }, {
175
+ abTestName: string;
176
+ abTestVariant: string;
177
+ campaignCode: string;
178
+ componentType: "ACQUISITIONS_EPIC" | "ACQUISITIONS_ENGAGEMENT_BANNER" | "ACQUISITIONS_HEADER" | "ACQUISITIONS_OTHER" | "ACQUISITIONS_SUBSCRIPTIONS_BANNER";
179
+ ophanPageId: string;
180
+ platformId: string;
181
+ referrerUrl: string;
182
+ clientName: string;
183
+ products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
184
+ labels?: string[] | null | undefined;
185
+ }>;
186
+ countryCode: z.ZodOptional<z.ZodString>;
187
+ submitComponentEvent: z.ZodAny;
188
+ }, "strip", z.ZodTypeAny, {
189
+ content: {
190
+ image: {
191
+ mainUrl: string;
192
+ altText: string;
193
+ mobileUrl?: string | undefined;
194
+ tabletUrl?: string | undefined;
195
+ desktopUrl?: string | undefined;
196
+ leftColUrl?: string | undefined;
197
+ wideUrl?: string | undefined;
198
+ };
199
+ bodyCopy: string[];
200
+ cta?: {
201
+ text: string;
202
+ baseUrl: string;
203
+ } | undefined;
204
+ };
205
+ tracking: {
206
+ abTestName: string;
207
+ abTestVariant: string;
208
+ campaignCode: string;
209
+ componentType: "ACQUISITIONS_EPIC" | "ACQUISITIONS_ENGAGEMENT_BANNER" | "ACQUISITIONS_HEADER" | "ACQUISITIONS_OTHER" | "ACQUISITIONS_SUBSCRIPTIONS_BANNER";
210
+ ophanPageId: string;
211
+ platformId: string;
212
+ referrerUrl: string;
213
+ clientName: string;
214
+ products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
215
+ labels?: string[] | null | undefined;
216
+ };
217
+ countryCode?: string | undefined;
218
+ submitComponentEvent?: any;
219
+ }, {
220
+ content: {
221
+ image: {
222
+ mainUrl: string;
223
+ altText: string;
224
+ mobileUrl?: string | undefined;
225
+ tabletUrl?: string | undefined;
226
+ desktopUrl?: string | undefined;
227
+ leftColUrl?: string | undefined;
228
+ wideUrl?: string | undefined;
229
+ };
230
+ bodyCopy: string[];
231
+ cta?: {
232
+ text: string;
233
+ baseUrl: string;
234
+ } | undefined;
235
+ };
236
+ tracking: {
237
+ abTestName: string;
238
+ abTestVariant: string;
239
+ campaignCode: string;
240
+ componentType: "ACQUISITIONS_EPIC" | "ACQUISITIONS_ENGAGEMENT_BANNER" | "ACQUISITIONS_HEADER" | "ACQUISITIONS_OTHER" | "ACQUISITIONS_SUBSCRIPTIONS_BANNER";
241
+ ophanPageId: string;
242
+ platformId: string;
243
+ referrerUrl: string;
244
+ clientName: string;
245
+ products?: ("CONTRIBUTION" | "MEMBERSHIP_SUPPORTER" | "DIGITAL_SUBSCRIPTION" | "PRINT_SUBSCRIPTION")[] | null | undefined;
246
+ labels?: string[] | null | undefined;
247
+ };
248
+ countryCode?: string | undefined;
249
+ submitComponentEvent?: any;
250
+ }>;
251
+ //# sourceMappingURL=gutter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutter.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/props/gutter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAkB,GAAG,EAAa,KAAK,EAAe,MAAM,UAAU,CAAC;AAExF,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AAEH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACxE;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK5B,CAAC"}
@@ -3,4 +3,5 @@ export * from './banner';
3
3
  export * from './header';
4
4
  export * from './shared';
5
5
  export * from './design';
6
+ export * from './gutter';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/props/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/props/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { EpicViewLog } from '../../lib/viewLog';
2
2
  import { PageTracking, WeeklyArticleHistory } from './shared';
3
- export type Tag = {
3
+ type Tag = {
4
4
  id: string;
5
5
  type: string;
6
6
  };
@@ -26,4 +26,5 @@ export type EpicPayload = {
26
26
  tracking: PageTracking;
27
27
  targeting: EpicTargeting;
28
28
  };
29
+ export {};
29
30
  //# sourceMappingURL=epic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"epic.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/targeting/epic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,GAAG,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,EAAE,OAAO,CAAC;IAEjC,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IAEvB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,yBAAyB,EAAE,OAAO,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,aAAa,CAAC;CAC5B,CAAC"}
1
+ {"version":3,"file":"epic.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/targeting/epic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE9D,KAAK,GAAG,GAAG;IACP,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,EAAE,OAAO,CAAC;IAEjC,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IAEvB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,yBAAyB,EAAE,OAAO,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,aAAa,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { PageTracking } from './shared';
2
+ export interface GutterTargeting {
3
+ showSupportMessaging: boolean;
4
+ countryCode: string;
5
+ mvtId: number;
6
+ isSignedIn: boolean;
7
+ tagIds?: string[];
8
+ sectionId?: string;
9
+ }
10
+ export type GutterPayload = {
11
+ tracking: PageTracking;
12
+ targeting: GutterTargeting;
13
+ };
14
+ //# sourceMappingURL=gutter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutter.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/targeting/gutter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,eAAe;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;CAC9B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './epic';
2
2
  export * from './header';
3
3
  export * from './banner';
4
+ export * from './gutter';
4
5
  export * from './shared';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/targeting/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/types/targeting/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/support-dotcom-components",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Service to serve Reader Revenue components to dotcom",
5
5
  "repository": "github:guardian/support-dotcom-components",
6
6
  "author": "The Guardian",