@guardian/support-dotcom-components 6.1.0 → 6.2.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.
- package/dist/dotcom/index.d.ts +1 -2
- package/dist/dotcom/index.d.ts.map +1 -1
- package/dist/dotcom/requests.d.ts +2 -2
- package/dist/dotcom/requests.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/api/ampEpicRouter.d.ts +8 -0
- package/dist/server/api/ampEpicRouter.d.ts.map +1 -0
- package/dist/server/api/auxiaProxyRouter.d.ts +8 -0
- package/dist/server/api/auxiaProxyRouter.d.ts.map +1 -0
- package/dist/server/api/bannerRouter.d.ts +9 -0
- package/dist/server/api/bannerRouter.d.ts.map +1 -0
- package/dist/server/api/epicRouter.d.ts +9 -0
- package/dist/server/api/epicRouter.d.ts.map +1 -0
- package/dist/server/api/gutterRouter.d.ts +6 -0
- package/dist/server/api/gutterRouter.d.ts.map +1 -0
- package/dist/server/api/headerRouter.d.ts +6 -0
- package/dist/server/api/headerRouter.d.ts.map +1 -0
- package/dist/server/channelSwitches.d.ts +14 -0
- package/dist/server/channelSwitches.d.ts.map +1 -0
- package/dist/server/choiceCardAmounts.d.ts +5 -0
- package/dist/server/choiceCardAmounts.d.ts.map +1 -0
- package/dist/server/factories/bannerDesign.d.ts +5 -0
- package/dist/server/factories/bannerDesign.d.ts.map +1 -0
- package/dist/server/factories/bannerVariant.d.ts +5 -0
- package/dist/server/factories/bannerVariant.d.ts.map +1 -0
- package/dist/server/factories/epicVariant.d.ts +100 -0
- package/dist/server/factories/epicVariant.d.ts.map +1 -0
- package/dist/server/factories/index.d.ts +104 -0
- package/dist/server/factories/index.d.ts.map +1 -0
- package/dist/server/factories/targeting.d.ts +5 -0
- package/dist/server/factories/targeting.d.ts.map +1 -0
- package/dist/server/factories/test.d.ts +5 -0
- package/dist/server/factories/test.d.ts.map +1 -0
- package/dist/server/lib/ampVariantAssignments.d.ts +4 -0
- package/dist/server/lib/ampVariantAssignments.d.ts.map +1 -0
- package/dist/server/lib/dates.d.ts +2 -0
- package/dist/server/lib/dates.d.ts.map +1 -0
- package/dist/server/lib/deviceType.d.ts +4 -0
- package/dist/server/lib/deviceType.d.ts.map +1 -0
- package/dist/server/lib/env.d.ts +5 -0
- package/dist/server/lib/env.d.ts.map +1 -0
- package/dist/server/lib/fetchTickerData.d.ts +12 -0
- package/dist/server/lib/fetchTickerData.d.ts.map +1 -0
- package/dist/server/lib/history.d.ts +11 -0
- package/dist/server/lib/history.d.ts.map +1 -0
- package/dist/server/lib/params.d.ts +10 -0
- package/dist/server/lib/params.d.ts.map +1 -0
- package/dist/server/lib/superMode.d.ts +26 -0
- package/dist/server/lib/superMode.d.ts.map +1 -0
- package/dist/server/lib/targeting.d.ts +20 -0
- package/dist/server/lib/targeting.d.ts.map +1 -0
- package/dist/server/lib/targetingTesting.d.ts +26 -0
- package/dist/server/lib/targetingTesting.d.ts.map +1 -0
- package/dist/server/lib/tracking.d.ts +7 -0
- package/dist/server/lib/tracking.d.ts.map +1 -0
- package/dist/server/middleware/bodyContainsAllFields.d.ts +3 -0
- package/dist/server/middleware/bodyContainsAllFields.d.ts.map +1 -0
- package/dist/server/middleware/errorHandling.d.ts +3 -0
- package/dist/server/middleware/errorHandling.d.ts.map +1 -0
- package/dist/server/middleware/index.d.ts +4 -0
- package/dist/server/middleware/index.d.ts.map +1 -0
- package/dist/server/middleware/logging.d.ts +3 -0
- package/dist/server/middleware/logging.d.ts.map +1 -0
- package/dist/server/productPrices.d.ts +5 -0
- package/dist/server/productPrices.d.ts.map +1 -0
- package/dist/server/selection/ab.d.ts +12 -0
- package/dist/server/selection/ab.d.ts.map +1 -0
- package/dist/server/selection/banditData.d.ts +13 -0
- package/dist/server/selection/banditData.d.ts.map +1 -0
- package/dist/server/selection/epsilonGreedySelection.d.ts +9 -0
- package/dist/server/selection/epsilonGreedySelection.d.ts.map +1 -0
- package/dist/server/selection/helpers.d.ts +4 -0
- package/dist/server/selection/helpers.d.ts.map +1 -0
- package/dist/server/selection/rouletteSelection.d.ts +4 -0
- package/dist/server/selection/rouletteSelection.d.ts.map +1 -0
- package/dist/server/selection/selectVariant.d.ts +11 -0
- package/dist/server/selection/selectVariant.d.ts.map +1 -0
- package/dist/server/server.d.ts +2 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/signin-gate/lib.d.ts +62 -0
- package/dist/server/signin-gate/lib.d.ts.map +1 -0
- package/dist/server/tests/amp/ampEpic.d.ts +5 -0
- package/dist/server/tests/amp/ampEpic.d.ts.map +1 -0
- package/dist/server/tests/amp/ampEpicModels.d.ts +367 -0
- package/dist/server/tests/amp/ampEpicModels.d.ts.map +1 -0
- package/dist/server/tests/amp/ampEpicSelection.d.ts +11 -0
- package/dist/server/tests/amp/ampEpicSelection.d.ts.map +1 -0
- package/dist/server/tests/amp/ampEpicTests.d.ts +4 -0
- package/dist/server/tests/amp/ampEpicTests.d.ts.map +1 -0
- package/dist/server/tests/amp/ampTicker.d.ts +11 -0
- package/dist/server/tests/amp/ampTicker.d.ts.map +1 -0
- package/dist/server/tests/banners/abandonedBasketTests.d.ts +3 -0
- package/dist/server/tests/banners/abandonedBasketTests.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerDeploySchedule.d.ts +23 -0
- package/dist/server/tests/banners/bannerDeploySchedule.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerDeployTimes.d.ts +26 -0
- package/dist/server/tests/banners/bannerDeployTimes.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerDesigns.d.ts +5 -0
- package/dist/server/tests/banners/bannerDesigns.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerSelection.d.ts +20 -0
- package/dist/server/tests/banners/bannerSelection.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerTargetingTests.d.ts +4 -0
- package/dist/server/tests/banners/bannerTargetingTests.d.ts.map +1 -0
- package/dist/server/tests/banners/bannerTests.d.ts +5 -0
- package/dist/server/tests/banners/bannerTests.d.ts.map +1 -0
- package/dist/server/tests/banners/channelBannerTests.d.ts +7 -0
- package/dist/server/tests/banners/channelBannerTests.d.ts.map +1 -0
- package/dist/server/tests/banners/signInPromptTests.d.ts +3 -0
- package/dist/server/tests/banners/signInPromptTests.d.ts.map +1 -0
- package/dist/server/tests/epics/epicSelection.d.ts +35 -0
- package/dist/server/tests/epics/epicSelection.d.ts.map +1 -0
- package/dist/server/tests/epics/epicTests.d.ts +6 -0
- package/dist/server/tests/epics/epicTests.d.ts.map +1 -0
- package/dist/server/tests/epics/momentumTest.d.ts +15 -0
- package/dist/server/tests/epics/momentumTest.d.ts.map +1 -0
- package/dist/server/tests/gutters/gutterSelection.d.ts +6 -0
- package/dist/server/tests/gutters/gutterSelection.d.ts.map +1 -0
- package/dist/server/tests/gutters/gutterTests.d.ts +5 -0
- package/dist/server/tests/gutters/gutterTests.d.ts.map +1 -0
- package/dist/server/tests/headers/headerSelection.d.ts +6 -0
- package/dist/server/tests/headers/headerSelection.d.ts.map +1 -0
- package/dist/server/tests/headers/headerTests.d.ts +5 -0
- package/dist/server/tests/headers/headerTests.d.ts.map +1 -0
- package/dist/server/tests/store.d.ts +7 -0
- package/dist/server/tests/store.d.ts.map +1 -0
- package/dist/server/utils/S3.d.ts +10 -0
- package/dist/server/utils/S3.d.ts.map +1 -0
- package/dist/server/utils/cloudwatch.d.ts +5 -0
- package/dist/server/utils/cloudwatch.d.ts.map +1 -0
- package/dist/server/utils/logging.d.ts +5 -0
- package/dist/server/utils/logging.d.ts.map +1 -0
- package/dist/server/utils/removeNullValues.d.ts +2 -0
- package/dist/server/utils/removeNullValues.d.ts.map +1 -0
- package/dist/server/utils/ssm.d.ts +2 -0
- package/dist/server/utils/ssm.d.ts.map +1 -0
- package/dist/server/utils/supportFrontend.d.ts +2 -0
- package/dist/server/utils/supportFrontend.d.ts.map +1 -0
- package/dist/server/utils/valueReloader.d.ts +18 -0
- package/dist/server/utils/valueReloader.d.ts.map +1 -0
- package/dist/server/utils/withNowAs.d.ts +2 -0
- package/dist/server/utils/withNowAs.d.ts.map +1 -0
- package/dist/shared/lib/geolocation.d.ts.map +1 -1
- package/dist/shared/lib/history.d.ts +2 -4
- package/dist/shared/lib/history.d.ts.map +1 -1
- package/dist/shared/lib/placeholders.d.ts +1 -1
- package/dist/shared/lib/placeholders.d.ts.map +1 -1
- package/dist/shared/lib/viewLog.d.ts +1 -1
- package/dist/shared/lib/viewLog.d.ts.map +1 -1
- package/dist/shared/types/abTests/banner.d.ts +20 -76
- package/dist/shared/types/abTests/banner.d.ts.map +1 -1
- package/dist/shared/types/abTests/epic.d.ts +14 -50
- package/dist/shared/types/abTests/epic.d.ts.map +1 -1
- package/dist/shared/types/abTests/gutter.d.ts +3 -3
- package/dist/shared/types/abTests/gutter.d.ts.map +1 -1
- package/dist/shared/types/abTests/header.d.ts +3 -3
- package/dist/shared/types/abTests/header.d.ts.map +1 -1
- package/dist/shared/types/abTests/shared.d.ts +4 -4
- package/dist/shared/types/abTests/shared.d.ts.map +1 -1
- package/dist/shared/types/prices.d.ts +6 -12
- package/dist/shared/types/prices.d.ts.map +1 -1
- package/dist/shared/types/props/banner.d.ts +79 -103
- package/dist/shared/types/props/banner.d.ts.map +1 -1
- package/dist/shared/types/props/design.d.ts +54 -54
- package/dist/shared/types/props/epic.d.ts +16 -72
- package/dist/shared/types/props/epic.d.ts.map +1 -1
- package/dist/shared/types/props/gutter.d.ts +2 -2
- package/dist/shared/types/props/gutter.d.ts.map +1 -1
- package/dist/shared/types/props/header.d.ts +2 -2
- package/dist/shared/types/props/header.d.ts.map +1 -1
- package/dist/shared/types/props/shared.d.ts +6 -43
- package/dist/shared/types/props/shared.d.ts.map +1 -1
- package/dist/shared/types/purchaseInfo.d.ts.map +1 -1
- package/dist/shared/types/targeting/banner.d.ts +1 -1
- package/dist/shared/types/targeting/banner.d.ts.map +1 -1
- package/dist/shared/types/targeting/epic.d.ts +2 -2
- package/dist/shared/types/targeting/epic.d.ts.map +1 -1
- package/dist/shared/types/targeting/header.d.ts +1 -1
- package/dist/shared/types/targeting/header.d.ts.map +1 -1
- package/dist/shared/types/targeting/shared.d.ts +6 -7
- package/dist/shared/types/targeting/shared.d.ts.map +1 -1
- package/package.json +11 -9
package/dist/dotcom/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export { getEpicViewLog, logEpicView } from '../shared/lib/viewLog';
|
|
2
1
|
export { getWeeklyArticleHistory, incrementWeeklyArticleCount } from '../shared/lib/history';
|
|
3
2
|
export { replaceNonArticleCountPlaceholders, containsNonArticleCountPlaceholder, } from '../shared/lib/placeholders';
|
|
4
3
|
export * from '../shared/lib/geolocation';
|
|
5
4
|
export * from '../shared/lib/viewLog';
|
|
6
5
|
export * from '../shared/lib/reminderFields';
|
|
7
|
-
export { SecondaryCtaType
|
|
6
|
+
export { SecondaryCtaType } from '../shared/types/props/shared';
|
|
8
7
|
export { hexColourToString } from '../shared/types/props/design';
|
|
9
8
|
export { contributionTabFrequencies } from '../shared/types/abTests/epic';
|
|
10
9
|
export { headerPropsSchema } from '../shared/types/props/header';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dotcom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dotcom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACH,kCAAkC,EAClC,kCAAkC,GACrC,MAAM,4BAA4B,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,cAAc,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BannerPayload, BannerProps, EpicPayload, EpicProps,
|
|
2
|
-
import { TestTracking } from '../shared/types/abTests/shared';
|
|
1
|
+
import type { BannerPayload, BannerProps, EpicPayload, EpicProps, GutterPayload, GutterProps, HeaderPayload, HeaderProps } from '../shared/types';
|
|
2
|
+
import type { TestTracking } from '../shared/types/abTests/shared';
|
|
3
3
|
export interface ModuleData<PROPS> {
|
|
4
4
|
name: string;
|
|
5
5
|
props: PROPS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/dotcom/requests.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/dotcom/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,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,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAA4C,CAAC;AAErF,eAAO,MAAM,eAAe,YACf,MAAM,WACN,WAAW,KACrB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAqD,CAAC;AAE9F,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAA8C,CAAC;AAEzF,eAAO,MAAM,iBAAiB,YACjB,MAAM,WACN,aAAa,KACvB,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAuD,CAAC;AAElG,eAAO,MAAM,SAAS,YACT,MAAM,WACN,aAAa,KACvB,OAAO,CAAC,kBAAkB,CAAC,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=e.object({targetedCountryGroups:e.array(g),targetedCountryCodes:e.array(e.string()).optional()}).optional(),p={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"}},b={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"},C={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},S=e=>Object.keys(p).find((n=>p[n].countries.includes(e??"")))||"International",h=(e,n=[],t=[])=>0===n.length&&0===t.length||!!e&&(!!n.includes(S(e.toUpperCase()))||t.includes(e.toUpperCase())),y=e=>{if(e){const n=S(e);return C[n]}return"£"},A=e=>{if(e)return b[e]},T=e=>/subscribe\/weekly\/checkout/.test(e),I=(e,n)=>{if(n){const t=(e=>p[S(e)]?.supportRegionId)(n);if(t&&!T(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},N=(e,n,t,a)=>{if(a){const i=a[S(t)];if(i){return`${y(t)}${i[e][n].price}`}}},M={CURRENCY_SYMBOL:({countryCode:e})=>y(e),COUNTRY_NAME:({countryCode:e})=>A(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>N("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>N("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>N("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>N("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"}))()},E=(e,n,t)=>e?e.replace(G,(e=>{const a=e.substring(2,e.length-2),i=M[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",G=/%%.*?%%/g,U=e=>{const n=e.match(G)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},R=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},B=(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}`}},P=new Date("2023-12-31"),L=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<R(e.getFullYear()),D=(e,n=new Date)=>{return"US"===e&&L(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(R(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=R(e.getFullYear())&&e<P)(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()):B(n);var t},w=e.object({text:e.string(),baseUrl:e.string()});let O=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(O);const k=e.object({type:e.literal(O.Custom),cta:w}),f=e.object({type:e.literal(O.ContributionsReminder)}),K=e.discriminatedUnion("type",[k,f]);let v=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const F=e.nativeEnum(v);let j=function(e){return e.money="money",e}({});const H=e.nativeEnum(j),Y=e.object({countLabel:e.string(),goalReachedPrimary:e.string().optional(),goalReachedSecondary:e.string().optional()}),V=e.object({total:e.number(),goal:e.number()}),W=e.enum(["US","AU"]),Z=e.object({endType:F,countType:H,currencySymbol:e.string(),copy:Y,name:W,tickerData:V.optional()}),$=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),x=e.enum(["for52Weeks","forTargetedWeeks"]),_=e.object({type:e.literal("above"),copy:e.string().optional(),countType:x.optional()}),J=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),Q=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),z=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:Q,products:e.array(J).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string()}),q=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()}),X=e.object({name:e.string(),description:e.string().optional(),headshot:q.optional()}),ee=/^[0-9A-F]{2}$/,ne=e.string().refine((e=>ee.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),te=e.object({r:ne,g:ne,b:ne,kind:e.literal("hex")}),ae=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),ie=e.object({buttonColour:te.nullish(),buttonTextColour:te.nullish(),buttonBorderColour:te.nullish(),buttonSelectColour:te.nullish(),buttonSelectTextColour:te.nullish(),buttonSelectBorderColour:te.nullish(),kind:e.literal("ChoiceCards")}),oe=e.discriminatedUnion("kind",[ae,ie]),re=e.object({visual:oe.nullish(),colours:e.object({basic:e.object({background:te,bodyText:te})})}),se=e=>`#${e.r}${e.g}${e.b}`,le=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),ue=e.enum(["new","guest","current"]),ce=e.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),de=e.enum(["Live","Draft","Archived"]),ge=e.enum(["Mobile","Desktop","All","iOS","Android"]),me=e.enum(["SignedIn","SignedOut","All"]),pe=e.enum(["HasConsented","HasNotConsented","All"]),be=e.object({name:e.literal("ABTest")}),Ce=e.object({name:e.literal("EpsilonGreedyBandit"),epsilon:e.number(),sampleCount:e.number().optional()}),Se=e.object({name:e.literal("Roulette"),sampleCount:e.number().optional()}),he=e.intersection(e.discriminatedUnion("name",[be,Ce,Se]),e.object({testName:e.string().optional()})),ye=e.object({channel:ce,name:e.string(),status:de,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:ge.optional(),signedInStatus:me.optional(),consentStatus:pe.optional(),methodologies:he.array().optional()}),Ae=e.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),Te=e.object({minViews:e.number(),maxViews:e.number().optional(),periodInWeeks:e.number(),tagIds:e.array(e.string()).optional()});e.object({userType:e.array(ue),product:e.array(le)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const Ie=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ne=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),Me=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),Ee=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:Me,displayContributionType:Me.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()})})}),Ge=e.object({newsletterId:e.string(),successDescription:e.string()}),Ue=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:Z.optional(),cta:w.optional(),secondaryCta:K.optional(),newsletterSignup:Ge.optional(),image:q.optional(),showReminderFields:Ne.optional(),separateArticleCount:_.optional(),maxViews:Ie.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:X.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:Ee.optional(),defaultChoiceCardFrequency:Me.optional()}),Re=e.object({variant:Ue,tracking:z,countryCode:e.string().nullish(),articleCounts:$,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Be=e.enum(["contributions","subscriptions","signIn","abandonedBasket"]),Pe=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:w.optional(),secondaryCta:K.optional()}),Le=e.object({tracking:z,bannerChannel:Be,content:Pe.nullish(),mobileContent:Pe.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:Z.nullish(),submitComponentEvent:e.any(),articleCounts:$,hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:re.nullish()}),De=e.object({heading:e.string(),subheading:e.string(),primaryCta:w.optional(),secondaryCta:w.optional(),benefits:e.array(e.string()).optional()}),we=e.object({content:De,tracking:z,mobileContent:De.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),Oe=e.object({image:q,bodyCopy:e.array(e.string()),cta:w.optional()});e.object({content:Oe,tracking:z,countryCode:e.string().optional(),submitComponentEvent:e.any()});const ke=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),fe=["ONE_OFF","MONTHLY","ANNUAL"];ye.extend({name:e.string(),status:de,locations:e.array(g).optional(),regionTargeting:m.optional(),tagIds:e.array(e.string()),sections:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSections:e.array(e.string()),alwaysAsk:e.boolean(),maxViews:ke.optional(),userCohort:Ae,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:Te.optional(),priority:e.number(),variants:Ue.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")])}),ve=(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()))},Fe=(e,n)=>ve("epic",e,n),je=(e,n)=>ve("liveblog-epic",e,n),He=(e,n)=>ve("banner",e,n),Ye=(e,n)=>ve("gutter-liveblog",e,n),Ve=(e,n)=>ve("header",e,n);export{d as CountryGroupId,O as SecondaryCtaType,j as TickerCountType,v as TickerEndType,Ke as abandonedBasketSchema,I as addRegionIdToSupportUrl,Le as bannerSchema,B as buildReminderFields,U as containsNonArticleCountPlaceholder,fe as contributionTabFrequencies,S as countryCodeToCountryGroupId,g as countryGroupIdSchema,Re as epicPropsSchema,He as getBanner,A as getCountryName,Fe as getEpic,t as getEpicViewLog,Ye as getGutterLiveblog,Ve as getHeader,je as getLiveblogEpic,y as getLocalCurrencySymbol,D as getReminderFields,s as getWeeklyArticleHistory,we as headerPropsSchema,se as hexColourToString,h as inTargetedCountry,c as incrementWeeklyArticleCount,T as isGWCheckoutUrl,a as logEpicView,E as replaceNonArticleCountPlaceholders,m as targetedRegionsSchema};
|
|
1
|
+
import{z as e}from"zod";const n="gu.history.weeklyArticleCount",t="gu.history.articleCountsThisWeek",a=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},i=e=>e.get(n)||void 0,o=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"]),r=(e,n={})=>(e.forEach((e=>{o.has(e)&&(n[e]=(n[e]??0)+1)})),n),s=(e,i,o)=>{const s=((e,n)=>{const i=a(new Date),o=e.get(t);if(o&&o.week===i){const a=o.articles[n]||0;return e.set(t,{week:i,articles:{...o.articles,[n]:a+1}}),a>0}return e.set(t,{week:i,articles:{[n]:1}}),!1})(e,i);if(!s){const t=a(new Date),i=e.get(n)||[],s=i[0];if(s?.week&&s.week===t)s.count+=1,s.tags=r(o,s.tags),e.set(n,i);else{i.unshift({week:t,count:1,tags:r(o,{})});const a=t-365,s=i.filter((e=>e.week>=a));e.set(n,s)}}},l=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],u=e.enum(l),c=e.object({targetedCountryGroups:e.array(u),targetedCountryCodes:e.array(e.string()).optional()}).optional(),d={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"}},g={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"},m={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(d).find((n=>d[n].countries.includes(e??"")))||"International",b=(e,n=[],t=[])=>0===n.length&&0===t.length||!!e&&(!!n.includes(p(e.toUpperCase()))||t.includes(e.toUpperCase())),C=e=>{if(e){const n=p(e);return m[n]}return"£"},S=e=>{if(e)return g[e]},h=e=>e.includes("subscribe/weekly/checkout"),y=(e,n)=>{if(n){const t=(e=>d[p(e)].supportRegionId)(n);if(t&&!h(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},A=(e,n,t,a)=>{if(a){const i=a[p(t)];if(i){return`${C(t)}${i[e][n].price}`}}},I={CURRENCY_SYMBOL:({countryCode:e})=>C(e),COUNTRY_NAME:({countryCode:e})=>S(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>A("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>A("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>A("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>A("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"}))()},T=(e,n,t)=>e?e.replace(N,(e=>{const a=e.substring(2,e.length-2),i=I[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",N=/%%.*?%%/g,M=e=>{const n=e.match(N)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},E="gu.contributions.views",G=e=>e.get(E)||void 0,U=e=>{const n=localStorage.getItem(E),t=n?JSON.parse(n).value:[];t.push({date:(new Date).getTime(),testId:e});const a={value:t.slice(-50)};localStorage.setItem(E,JSON.stringify(a))},B=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}`}},L=new Date("2023-12-31"),P=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<B(e.getFullYear()),D=(e,n=new Date)=>{return"US"===e&&P(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(B(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=B(e.getFullYear())&&e<L)(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},w=e.object({text:e.string(),baseUrl:e.string()});let O=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(O);const k=e.object({type:e.literal(O.Custom),cta:w}),f=e.object({type:e.literal(O.ContributionsReminder)}),K=e.discriminatedUnion("type",[k,f]),F=e.object({countLabel:e.string()}),j=e.object({total:e.number(),goal:e.number()}),v=e.enum(["US","AU","global"]),H=e.object({currencySymbol:e.string(),copy:F,name:v,tickerData:j.optional()}),Y=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),V=e.enum(["for52Weeks","forTargetedWeeks"]),W=e.object({type:e.literal("above"),copy:e.string().optional(),countType:V.optional()}),Z=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),$=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),x=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:$,products:e.array(Z).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string()}),_=e.object({mainUrl:e.string(),mobileUrl:e.string().optional(),tabletUrl:e.string().optional(),desktopUrl:e.string().optional(),leftColUrl:e.string().optional(),wideUrl:e.string().optional(),altText:e.string()}),J=e.object({name:e.string(),description:e.string().optional(),headshot:_.optional()}),Q=/^[0-9A-F]{2}$/,z=e.string().refine((e=>Q.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),q=e.object({r:z,g:z,b:z,kind:e.literal("hex")}),X=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),ee=e.object({buttonColour:q.nullish(),buttonTextColour:q.nullish(),buttonBorderColour:q.nullish(),buttonSelectColour:q.nullish(),buttonSelectTextColour:q.nullish(),buttonSelectBorderColour:q.nullish(),kind:e.literal("ChoiceCards")}),ne=e.discriminatedUnion("kind",[X,ee]),te=e.object({visual:ne.nullish(),colours:e.object({basic:e.object({background:q,bodyText:q})})}),ae=e=>`#${e.r}${e.g}${e.b}`,ie=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),oe=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),re=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),se=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:re,displayContributionType:re.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()})})}),le=e.object({newsletterId:e.string(),successDescription:e.string()}),ue=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:H.optional(),cta:w.optional(),secondaryCta:K.optional(),newsletterSignup:le.optional(),image:_.optional(),showReminderFields:oe.optional(),separateArticleCount:W.optional(),maxViews:ie.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:J.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:se.optional(),defaultChoiceCardFrequency:re.optional()}),ce=e.object({variant:ue,tracking:x,countryCode:e.string().nullish(),articleCounts:Y,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),de=e.enum(["contributions","subscriptions","signIn","abandonedBasket"]),ge=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:w.optional(),secondaryCta:K.optional()}),me=e.object({tracking:x,bannerChannel:de,content:ge.nullish(),mobileContent:ge.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:H.nullish(),submitComponentEvent:e.any(),articleCounts:Y,hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:te.nullish()}),pe=e.object({heading:e.string(),subheading:e.string(),primaryCta:w.optional(),secondaryCta:w.optional(),benefits:e.array(e.string()).optional()}),be=e.object({content:pe,tracking:x,mobileContent:pe.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()}),Ce=e.object({image:_,bodyCopy:e.array(e.string()),cta:w.optional()});e.object({content:Ce,tracking:x,countryCode:e.string().optional(),submitComponentEvent:e.any()});const Se=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),he=e.enum(["new","guest","current"]),ye=e.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),Ae=e.enum(["Live","Draft","Archived"]),Ie=e.enum(["Mobile","Desktop","All","iOS","Android"]),Te=e.enum(["SignedIn","SignedOut","All"]),Ne=e.enum(["HasConsented","HasNotConsented","All"]),Me=e.object({name:e.literal("ABTest")}),Ee=e.object({name:e.literal("EpsilonGreedyBandit"),epsilon:e.number(),sampleCount:e.number().optional()}),Ge=e.object({name:e.literal("Roulette"),sampleCount:e.number().optional()}),Ue=e.intersection(e.discriminatedUnion("name",[Me,Ee,Ge]),e.object({testName:e.string().optional()})),Be=e.object({channel:ye,name:e.string(),status:Ae,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:Ie.optional(),signedInStatus:Te.optional(),consentStatus:Ne.optional(),methodologies:Ue.array().optional()}),Re=e.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),Le=e.object({minViews:e.number(),maxViews:e.number().optional(),periodInWeeks:e.number(),tagIds:e.array(e.string()).optional()});e.object({userType:e.array(he),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 Pe=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),De=["ONE_OFF","MONTHLY","ANNUAL"];Be.extend({name:e.string(),status:Ae,locations:e.array(u).optional(),regionTargeting:c.optional(),tagIds:e.array(e.string()),sections:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSections:e.array(e.string()),alwaysAsk:e.boolean(),maxViews:Pe.optional(),userCohort:Re,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:Le.optional(),priority:e.number(),variants:ue.array()});const we=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")])}),Oe=(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)=>Oe("epic",e,n),fe=(e,n)=>Oe("liveblog-epic",e,n),Ke=(e,n)=>Oe("banner",e,n),Fe=(e,n)=>Oe("gutter-liveblog",e,n),je=(e,n)=>Oe("header",e,n);export{l as CountryGroupId,O as SecondaryCtaType,we as abandonedBasketSchema,y as addRegionIdToSupportUrl,me as bannerSchema,R as buildReminderFields,M as containsNonArticleCountPlaceholder,De as contributionTabFrequencies,p as countryCodeToCountryGroupId,u as countryGroupIdSchema,ce as epicPropsSchema,Ke as getBanner,S as getCountryName,ke as getEpic,G as getEpicViewLog,Fe as getGutterLiveblog,je as getHeader,fe as getLiveblogEpic,C as getLocalCurrencySymbol,D as getReminderFields,i as getWeeklyArticleHistory,be as headerPropsSchema,ae as hexColourToString,b as inTargetedCountry,s as incrementWeeklyArticleCount,h as isGWCheckoutUrl,U as logEpicView,T as replaceNonArticleCountPlaceholders,c as targetedRegionsSchema};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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=e.z.object({targetedCountryGroups:e.z.array(l),targetedCountryCodes:e.z.array(e.z.string()).optional()}).optional(),c={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},d={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},p={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},g=e=>Object.keys(c).find((t=>c[t].countries.includes(e??"")))||"International",z=e=>{if(e){const t=g(e);return p[t]}return"£"},m=e=>{if(e)return d[e]},C=e=>/subscribe\/weekly\/checkout/.test(e),b=(e,t,n,a)=>{if(a){const o=a[g(n)];if(o){return`${z(n)}${o[e][t].price}`}}},S={CURRENCY_SYMBOL:({countryCode:e})=>z(e),COUNTRY_NAME:({countryCode:e})=>m(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>b("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>b("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>b("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>b("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"}))()},h=/%%.*?%%/g,y=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},A=(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}`}},T=new Date("2023-12-31"),I=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<y(e.getFullYear()),N=e.z.object({text:e.z.string(),baseUrl:e.z.string()});let M=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.z.nativeEnum(M);const E=e.z.object({type:e.z.literal(M.Custom),cta:N}),G=e.z.object({type:e.z.literal(M.ContributionsReminder)}),U=e.z.discriminatedUnion("type",[E,G]);let R=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const B=e.z.nativeEnum(R);let P=function(e){return e.money="money",e}({});const L=e.z.nativeEnum(P),D=e.z.object({countLabel:e.z.string(),goalReachedPrimary:e.z.string().optional(),goalReachedSecondary:e.z.string().optional()}),w=e.z.object({total:e.z.number(),goal:e.z.number()}),k=e.z.enum(["US","AU"]),O=e.z.object({endType:B,countType:L,currencySymbol:e.z.string(),copy:D,name:k,tickerData:w.optional()}),x=e.z.object({for52Weeks:e.z.number(),forTargetedWeeks:e.z.number()}),f=e.z.enum(["for52Weeks","forTargetedWeeks"]),v=e.z.object({type:e.z.literal("above"),copy:e.z.string().optional(),countType:f.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"]),j=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()}),H=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()}),V=e.z.object({name:e.z.string(),description:e.z.string().optional(),headshot:H.optional()}),Y=/^[0-9A-F]{2}$/,W=e.z.string().refine((e=>Y.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),Z=e.z.object({r:W,g:W,b:W,kind:e.z.literal("hex")}),$=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:Z.nullish(),buttonTextColour:Z.nullish(),buttonBorderColour:Z.nullish(),buttonSelectColour:Z.nullish(),buttonSelectTextColour:Z.nullish(),buttonSelectBorderColour:Z.nullish(),kind:e.z.literal("ChoiceCards")}),J=e.z.discriminatedUnion("kind",[$,_]),Q=e.z.object({visual:J.nullish(),colours:e.z.object({basic:e.z.object({background:Z,bodyText:Z})})}),q=e.z.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),X=e.z.enum(["new","guest","current"]),ee=e.z.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),te=e.z.enum(["Live","Draft","Archived"]),ne=e.z.enum(["Mobile","Desktop","All","iOS","Android"]),ae=e.z.enum(["SignedIn","SignedOut","All"]),oe=e.z.enum(["HasConsented","HasNotConsented","All"]),re=e.z.object({name:e.z.literal("ABTest")}),ie=e.z.object({name:e.z.literal("EpsilonGreedyBandit"),epsilon:e.z.number(),sampleCount:e.z.number().optional()}),se=e.z.object({name:e.z.literal("Roulette"),sampleCount:e.z.number().optional()}),le=e.z.intersection(e.z.discriminatedUnion("name",[re,ie,se]),e.z.object({testName:e.z.string().optional()})),ue=e.z.object({channel:ee,name:e.z.string(),status:te,priority:e.z.number(),controlProportionSettings:e.z.object({proportion:e.z.number(),offset:e.z.number()}).optional(),deviceType:ne.optional(),signedInStatus:ae.optional(),consentStatus:oe.optional(),methodologies:le.array().optional()}),ce=e.z.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),de=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(X),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 pe=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()}),ge=e.z.object({reminderCta:e.z.string(),reminderLabel:e.z.string(),reminderPeriod:e.z.string()}),ze=e.z.enum(["ONE_OFF","MONTHLY","ANNUAL"]),me=e.z.object({testName:e.z.string(),variantName:e.z.string(),defaultContributionType:ze,displayContributionType:ze.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()})})}),Ce=e.z.object({newsletterId:e.z.string(),successDescription:e.z.string()}),be=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:N.optional(),secondaryCta:U.optional(),newsletterSignup:Ce.optional(),image:H.optional(),showReminderFields:ge.optional(),separateArticleCount:v.optional(),maxViews:pe.optional(),showSignInLink:e.z.boolean().optional(),bylineWithImage:V.optional(),showChoiceCards:e.z.boolean().optional(),choiceCardAmounts:me.optional(),defaultChoiceCardFrequency:ze.optional()}),Se=e.z.object({variant:be,tracking:j,countryCode:e.z.string().nullish(),articleCounts:x,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()}),he=e.z.enum(["contributions","subscriptions","signIn","abandonedBasket"]),ye=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:N.optional(),secondaryCta:U.optional()}),Ae=e.z.object({tracking:j,bannerChannel:he,content:ye.nullish(),mobileContent:ye.nullish(),countryCode:e.z.string().nullish(),isSupporter:e.z.boolean().nullish(),tickerSettings:O.nullish(),submitComponentEvent:e.z.any(),articleCounts:x,hasOptedOutOfArticleCount:e.z.boolean().nullish(),fetchEmail:e.z.any().nullish(),separateArticleCount:e.z.boolean().nullish(),design:Q.nullish()}),Te=e.z.object({heading:e.z.string(),subheading:e.z.string(),primaryCta:N.optional(),secondaryCta:N.optional(),benefits:e.z.array(e.z.string()).optional()}),Ie=e.z.object({content:Te,tracking:j,mobileContent:Te.optional(),countryCode:e.z.string().optional(),submitComponentEvent:e.z.any(),numArticles:e.z.number().optional()}),Ne=e.z.object({image:H,bodyCopy:e.z.array(e.z.string()),cta:N.optional()});e.z.object({content:Ne,tracking:j,countryCode:e.z.string().optional(),submitComponentEvent:e.z.any()});const Me=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()});ue.extend({name:e.z.string(),status:te,locations:e.z.array(l).optional(),regionTargeting:u.optional(),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:Me.optional(),userCohort:ce,hasCountryName:e.z.boolean(),highPriority:e.z.boolean(),useLocalViewLog:e.z.boolean(),articlesViewedSettings:de.optional(),priority:e.z.number(),variants:be.array()});const Ee=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")])}),Ge=(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=M,exports.TickerCountType=P,exports.TickerEndType=R,exports.abandonedBasketSchema=Ee,exports.addRegionIdToSupportUrl=(e,t)=>{if(t){const n=(e=>c[g(e)]?.supportRegionId)(t);if(n&&!C(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,((e,t,a)=>`${t}/${n.toLowerCase()}/${a}`))}return e},exports.bannerSchema=Ae,exports.buildReminderFields=A,exports.containsNonArticleCountPlaceholder=e=>{const t=e.match(h)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!t&&t.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=g,exports.countryGroupIdSchema=l,exports.epicPropsSchema=Se,exports.getBanner=(e,t)=>Ge("banner",e,t),exports.getCountryName=m,exports.getEpic=(e,t)=>Ge("epic",e,t),exports.getEpicViewLog=e=>e.get(t)||void 0,exports.getGutterLiveblog=(e,t)=>Ge("gutter-liveblog",e,t),exports.getHeader=(e,t)=>Ge("header",e,t),exports.getLiveblogEpic=(e,t)=>Ge("liveblog-epic",e,t),exports.getLocalCurrencySymbol=z,exports.getReminderFields=(e,t=new Date)=>{return"US"===e&&I(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${n=t.getFullYear()}-${(y(n).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${n}`}:"US"===e&&(e=>e>=y(e.getFullYear())&&e<T)(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()):A(t);var n},exports.getWeeklyArticleHistory=e=>e.get(n)||void 0,exports.headerPropsSchema=Ie,exports.hexColourToString=e=>`#${e.r}${e.g}${e.b}`,exports.inTargetedCountry=(e,t=[],n=[])=>0===t.length&&0===n.length||!!e&&(!!t.includes(g(e.toUpperCase()))||n.includes(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=C,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(h,(e=>{const a=e.substring(2,e.length-2),o=S[a];if(o){const e=o({countryCode:t,prices:n});if(e)return e}return e})):"",exports.targetedRegionsSchema=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zod");const t="gu.history.weeklyArticleCount",n="gu.history.articleCountsThisWeek",a=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},o=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"]),r=(e,t={})=>(e.forEach((e=>{o.has(e)&&(t[e]=(t[e]??0)+1)})),t),i=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],s=e.z.enum(i),l=e.z.object({targetedCountryGroups:e.z.array(s),targetedCountryCodes:e.z.array(e.z.string()).optional()}).optional(),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:"$"},g=e=>Object.keys(u).find((t=>u[t].countries.includes(e??"")))||"International",p=e=>{if(e){const t=g(e);return d[t]}return"£"},z=e=>{if(e)return c[e]},m=e=>e.includes("subscribe/weekly/checkout"),C=(e,t,n,a)=>{if(a){const o=a[g(n)];if(o){return`${p(n)}${o[e][t].price}`}}},b={CURRENCY_SYMBOL:({countryCode:e})=>p(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="gu.contributions.views",y=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},A=(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}`}},T=new Date("2023-12-31"),I=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<y(e.getFullYear()),N=e.z.object({text:e.z.string(),baseUrl:e.z.string()});let M=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.z.nativeEnum(M);const E=e.z.object({type:e.z.literal(M.Custom),cta:N}),G=e.z.object({type:e.z.literal(M.ContributionsReminder)}),U=e.z.discriminatedUnion("type",[E,G]),R=e.z.object({countLabel:e.z.string()}),B=e.z.object({total:e.z.number(),goal:e.z.number()}),P=e.z.enum(["US","AU","global"]),L=e.z.object({currencySymbol:e.z.string(),copy:R,name:P,tickerData:B.optional()}),D=e.z.object({for52Weeks:e.z.number(),forTargetedWeeks:e.z.number()}),w=e.z.enum(["for52Weeks","forTargetedWeeks"]),O=e.z.object({type:e.z.literal("above"),copy:e.z.string().optional(),countType:w.optional()}),k=e.z.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),x=e.z.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),F=e.z.object({abTestName:e.z.string(),abTestVariant:e.z.string(),campaignCode:e.z.string(),componentType:x,products:e.z.array(k).nullish(),labels:e.z.array(e.z.string()).nullish(),ophanPageId:e.z.string(),platformId:e.z.string(),referrerUrl:e.z.string()}),f=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()}),v=e.z.object({name:e.z.string(),description:e.z.string().optional(),headshot:f.optional()}),K=/^[0-9A-F]{2}$/,j=e.z.string().refine((e=>K.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),H=e.z.object({r:j,g:j,b:j,kind:e.z.literal("hex")}),V=e.z.object({mobileUrl:e.z.string(),tabletUrl:e.z.string(),desktopUrl:e.z.string(),altText:e.z.string(),kind:e.z.literal("Image")}),Y=e.z.object({buttonColour:H.nullish(),buttonTextColour:H.nullish(),buttonBorderColour:H.nullish(),buttonSelectColour:H.nullish(),buttonSelectTextColour:H.nullish(),buttonSelectBorderColour:H.nullish(),kind:e.z.literal("ChoiceCards")}),W=e.z.discriminatedUnion("kind",[V,Y]),Z=e.z.object({visual:W.nullish(),colours:e.z.object({basic:e.z.object({background:H,bodyText:H})})}),$=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()}),_=e.z.object({reminderCta:e.z.string(),reminderLabel:e.z.string(),reminderPeriod:e.z.string()}),J=e.z.enum(["ONE_OFF","MONTHLY","ANNUAL"]),Q=e.z.object({testName:e.z.string(),variantName:e.z.string(),defaultContributionType:J,displayContributionType:J.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()})})}),q=e.z.object({newsletterId:e.z.string(),successDescription:e.z.string()}),X=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:L.optional(),cta:N.optional(),secondaryCta:U.optional(),newsletterSignup:q.optional(),image:f.optional(),showReminderFields:_.optional(),separateArticleCount:O.optional(),maxViews:$.optional(),showSignInLink:e.z.boolean().optional(),bylineWithImage:v.optional(),showChoiceCards:e.z.boolean().optional(),choiceCardAmounts:Q.optional(),defaultChoiceCardFrequency:J.optional()}),ee=e.z.object({variant:X,tracking:F,countryCode:e.z.string().nullish(),articleCounts:D,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()}),te=e.z.enum(["contributions","subscriptions","signIn","abandonedBasket"]),ne=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:N.optional(),secondaryCta:U.optional()}),ae=e.z.object({tracking:F,bannerChannel:te,content:ne.nullish(),mobileContent:ne.nullish(),countryCode:e.z.string().nullish(),isSupporter:e.z.boolean().nullish(),tickerSettings:L.nullish(),submitComponentEvent:e.z.any(),articleCounts:D,hasOptedOutOfArticleCount:e.z.boolean().nullish(),fetchEmail:e.z.any().nullish(),separateArticleCount:e.z.boolean().nullish(),design:Z.nullish()}),oe=e.z.object({heading:e.z.string(),subheading:e.z.string(),primaryCta:N.optional(),secondaryCta:N.optional(),benefits:e.z.array(e.z.string()).optional()}),re=e.z.object({content:oe,tracking:F,mobileContent:oe.optional(),countryCode:e.z.string().optional(),submitComponentEvent:e.z.any(),numArticles:e.z.number().optional()}),ie=e.z.object({image:f,bodyCopy:e.z.array(e.z.string()),cta:N.optional()});e.z.object({content:ie,tracking:F,countryCode:e.z.string().optional(),submitComponentEvent:e.z.any()});const se=e.z.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),le=e.z.enum(["new","guest","current"]),ue=e.z.enum(["Epic","EpicAMP","EpicAppleNews","EpicLiveblog","Banner1","Banner2","Header","GutterLiveblog"]),ce=e.z.enum(["Live","Draft","Archived"]),de=e.z.enum(["Mobile","Desktop","All","iOS","Android"]),ge=e.z.enum(["SignedIn","SignedOut","All"]),pe=e.z.enum(["HasConsented","HasNotConsented","All"]),ze=e.z.object({name:e.z.literal("ABTest")}),me=e.z.object({name:e.z.literal("EpsilonGreedyBandit"),epsilon:e.z.number(),sampleCount:e.z.number().optional()}),Ce=e.z.object({name:e.z.literal("Roulette"),sampleCount:e.z.number().optional()}),be=e.z.intersection(e.z.discriminatedUnion("name",[ze,me,Ce]),e.z.object({testName:e.z.string().optional()})),Se=e.z.object({channel:ue,name:e.z.string(),status:ce,priority:e.z.number(),controlProportionSettings:e.z.object({proportion:e.z.number(),offset:e.z.number()}).optional(),deviceType:de.optional(),signedInStatus:ge.optional(),consentStatus:pe.optional(),methodologies:be.array().optional()}),he=e.z.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ye=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(le),product:e.z.array(se)}),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 Ae=e.z.object({maxViewsCount:e.z.number(),maxViewsDays:e.z.number(),minDaysBetweenViews:e.z.number()});Se.extend({name:e.z.string(),status:ce,locations:e.z.array(s).optional(),regionTargeting:l.optional(),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:Ae.optional(),userCohort:he,hasCountryName:e.z.boolean(),highPriority:e.z.boolean(),useLocalViewLog:e.z.boolean(),articlesViewedSettings:ye.optional(),priority:e.z.number(),variants:X.array()});const Te=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")])}),Ie=(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=i,exports.SecondaryCtaType=M,exports.abandonedBasketSchema=Te,exports.addRegionIdToSupportUrl=(e,t)=>{if(t){const n=(e=>u[g(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=ae,exports.buildReminderFields=A,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=g,exports.countryGroupIdSchema=s,exports.epicPropsSchema=ee,exports.getBanner=(e,t)=>Ie("banner",e,t),exports.getCountryName=z,exports.getEpic=(e,t)=>Ie("epic",e,t),exports.getEpicViewLog=e=>e.get(h)||void 0,exports.getGutterLiveblog=(e,t)=>Ie("gutter-liveblog",e,t),exports.getHeader=(e,t)=>Ie("header",e,t),exports.getLiveblogEpic=(e,t)=>Ie("liveblog-epic",e,t),exports.getLocalCurrencySymbol=p,exports.getReminderFields=(e,t=new Date)=>{return"US"===e&&I(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${n=t.getFullYear()}-${(y(n).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${n}`}:"US"===e&&(e=>e>=y(e.getFullYear())&&e<T)(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()):A(t);var n},exports.getWeeklyArticleHistory=e=>e.get(t)||void 0,exports.headerPropsSchema=re,exports.hexColourToString=e=>`#${e.r}${e.g}${e.b}`,exports.inTargetedCountry=(e,t=[],n=[])=>0===t.length&&0===n.length||!!e&&(!!t.includes(g(e.toUpperCase()))||n.includes(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,o,i)=>{const s=((e,t)=>{const o=a(new Date),r=e.get(n);if(r&&r.week===o){const a=r.articles[t]||0;return e.set(n,{week:o,articles:{...r.articles,[t]:a+1}}),a>0}return e.set(n,{week:o,articles:{[t]:1}}),!1})(e,o);if(!s){const n=a(new Date),o=e.get(t)||[],s=o[0];if(s?.week&&s.week===n)s.count+=1,s.tags=r(i,s.tags),e.set(t,o);else{o.unshift({week:n,count:1,tags:r(i,{})});const a=n-365,s=o.filter((e=>e.week>=a));e.set(t,s)}}},exports.isGWCheckoutUrl=m,exports.logEpicView=e=>{const t=localStorage.getItem(h),n=t?JSON.parse(t).value:[];n.push({date:(new Date).getTime(),testId:e});const a={value:n.slice(-50)};localStorage.setItem(h,JSON.stringify(a))},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})):"",exports.targetedRegionsSchema=l;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { AmountsTests } from '../../shared/types';
|
|
3
|
+
import type { TickerDataProvider } from '../lib/fetchTickerData';
|
|
4
|
+
import type { AmpEpicTest } from '../tests/amp/ampEpicModels';
|
|
5
|
+
import type { ValueProvider } from '../utils/valueReloader';
|
|
6
|
+
export declare const setOneOffReminderEndpoint: () => string;
|
|
7
|
+
export declare const buildAmpEpicRouter: (choiceCardAmounts: ValueProvider<AmountsTests>, tickerData: TickerDataProvider, tests: ValueProvider<AmpEpicTest[]>) => Router;
|
|
8
|
+
//# sourceMappingURL=ampEpicRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampEpicRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/ampEpicRouter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAMjC,OAAO,KAAK,EAAmB,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AAG7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D,eAAO,MAAM,yBAAyB,QAAO,MAGgC,CAAC;AAE9E,eAAO,MAAM,kBAAkB,sBACR,aAAa,CAAC,YAAY,CAAC,cAClC,kBAAkB,SACvB,aAAa,CAAC,WAAW,EAAE,CAAC,KACpC,MAoOF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
export interface AuxiaRouterConfig {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getAuxiaRouterConfig: () => Promise<AuxiaRouterConfig>;
|
|
7
|
+
export declare const buildAuxiaProxyRouter: (config: AuxiaRouterConfig) => Router;
|
|
8
|
+
//# sourceMappingURL=auxiaProxyRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auxiaProxyRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/auxiaProxyRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAejC,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,iBAAiB,CAiBtE,CAAC;AAqIF,eAAO,MAAM,qBAAqB,WAAY,iBAAiB,KAAG,MAiFjE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { AmountsTests, BannerDesignFromTool, BannerTest, Prices } from '../../shared/types';
|
|
3
|
+
import type { ChannelSwitches } from '../channelSwitches';
|
|
4
|
+
import type { TickerDataProvider } from '../lib/fetchTickerData';
|
|
5
|
+
import type { BanditData } from '../selection/banditData';
|
|
6
|
+
import type { BannerDeployTimesProvider } from '../tests/banners/bannerDeployTimes';
|
|
7
|
+
import type { ValueProvider } from '../utils/valueReloader';
|
|
8
|
+
export declare const buildBannerRouter: (channelSwitches: ValueProvider<ChannelSwitches>, tickerData: TickerDataProvider, productPrices: ValueProvider<Prices | undefined>, bannerTests: ValueProvider<BannerTest[]>, bannerDeployTimes: BannerDeployTimesProvider, choiceCardAmounts: ValueProvider<AmountsTests>, bannerDesigns: ValueProvider<BannerDesignFromTool[]>, banditData: ValueProvider<BanditData[]>) => Router;
|
|
9
|
+
//# sourceMappingURL=bannerRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bannerRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/bannerRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EACR,YAAY,EACZ,oBAAoB,EAGpB,UAAU,EACV,MAAM,EAGT,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAMjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAIpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAa5D,eAAO,MAAM,iBAAiB,oBACT,aAAa,CAAC,eAAe,CAAC,cACnC,kBAAkB,iBACf,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,eACnC,aAAa,CAAC,UAAU,EAAE,CAAC,qBACrB,yBAAyB,qBACzB,aAAa,CAAC,YAAY,CAAC,iBAC/B,aAAa,CAAC,oBAAoB,EAAE,CAAC,cACxC,aAAa,CAAC,UAAU,EAAE,CAAC,KACxC,MA4HF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { AmountsTests, EpicTest } from '../../shared/types';
|
|
3
|
+
import type { ChannelSwitches } from '../channelSwitches';
|
|
4
|
+
import type { TickerDataProvider } from '../lib/fetchTickerData';
|
|
5
|
+
import type { SuperModeArticle } from '../lib/superMode';
|
|
6
|
+
import type { BanditData } from '../selection/banditData';
|
|
7
|
+
import type { ValueProvider } from '../utils/valueReloader';
|
|
8
|
+
export declare const buildEpicRouter: (channelSwitches: ValueProvider<ChannelSwitches>, superModeArticles: ValueProvider<SuperModeArticle[]>, articleEpicTests: ValueProvider<EpicTest[]>, liveblogEpicTests: ValueProvider<EpicTest[]>, choiceCardAmounts: ValueProvider<AmountsTests>, tickerData: TickerDataProvider, banditData: ValueProvider<BanditData[]>) => Router;
|
|
9
|
+
//# sourceMappingURL=epicRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epicRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/epicRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EACR,YAAY,EAGZ,QAAQ,EAMX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAIjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAiB5D,eAAO,MAAM,eAAe,oBACP,aAAa,CAAC,eAAe,CAAC,qBAC5B,aAAa,CAAC,gBAAgB,EAAE,CAAC,oBAClC,aAAa,CAAC,QAAQ,EAAE,CAAC,qBACxB,aAAa,CAAC,QAAQ,EAAE,CAAC,qBACzB,aAAa,CAAC,YAAY,CAAC,cAClC,kBAAkB,cAClB,aAAa,CAAC,UAAU,EAAE,CAAC,KACxC,MA+KF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { GutterTest } from '../../shared/types';
|
|
3
|
+
import type { ChannelSwitches } from '../channelSwitches';
|
|
4
|
+
import type { ValueProvider } from '../utils/valueReloader';
|
|
5
|
+
export declare const buildGutterRouter: (channelSwitches: ValueProvider<ChannelSwitches>, tests: ValueProvider<GutterTest[]>) => Router;
|
|
6
|
+
//# sourceMappingURL=gutterRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gutterRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/gutterRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAGR,UAAU,EAGb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,eAAO,MAAM,iBAAiB,oBACT,aAAa,CAAC,eAAe,CAAC,SACxC,aAAa,CAAC,UAAU,EAAE,CAAC,KACnC,MAkEF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { HeaderTest } from '../../shared/types';
|
|
3
|
+
import type { ChannelSwitches } from '../channelSwitches';
|
|
4
|
+
import type { ValueProvider } from '../utils/valueReloader';
|
|
5
|
+
export declare const buildHeaderRouter: (channelSwitches: ValueProvider<ChannelSwitches>, tests: ValueProvider<HeaderTest[]>) => Router;
|
|
6
|
+
//# sourceMappingURL=headerRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerRouter.d.ts","sourceRoot":"","sources":["../../../src/server/api/headerRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAGR,UAAU,EAGb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAO1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,eAAO,MAAM,iBAAiB,oBACT,aAAa,CAAC,eAAe,CAAC,SACxC,aAAa,CAAC,UAAU,EAAE,CAAC,KACnC,MA+DF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ValueReloader } from './utils/valueReloader';
|
|
2
|
+
export interface ChannelSwitches {
|
|
3
|
+
enableEpics: boolean;
|
|
4
|
+
enableBanners: boolean;
|
|
5
|
+
enableHeaders: boolean;
|
|
6
|
+
enableSuperMode: boolean;
|
|
7
|
+
enableHardcodedEpicTests: boolean;
|
|
8
|
+
enableHardcodedBannerTests: boolean;
|
|
9
|
+
enableScheduledBannerDeploys: boolean;
|
|
10
|
+
enableGutterLiveblogs: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const buildChannelSwitchesReloader: () => Promise<ValueReloader<ChannelSwitches>>;
|
|
13
|
+
export { buildChannelSwitchesReloader };
|
|
14
|
+
//# sourceMappingURL=channelSwitches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelSwitches.d.ts","sourceRoot":"","sources":["../../src/server/channelSwitches.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,wBAAwB,EAAE,OAAO,CAAC;IAClC,0BAA0B,EAAE,OAAO,CAAC;IACpC,4BAA4B,EAAE,OAAO,CAAC;IACtC,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAUD,QAAA,MAAM,4BAA4B,QAAO,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAC7C,CAAC;AAEnC,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AmountsTests } from '../shared/types';
|
|
2
|
+
import type { ValueReloader } from './utils/valueReloader';
|
|
3
|
+
declare const buildChoiceCardAmountsReloader: () => Promise<ValueReloader<AmountsTests>>;
|
|
4
|
+
export { buildChoiceCardAmountsReloader };
|
|
5
|
+
//# sourceMappingURL=choiceCardAmounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choiceCardAmounts.d.ts","sourceRoot":"","sources":["../../src/server/choiceCardAmounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,QAAA,MAAM,8BAA8B,QAAO,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CACnC,CAAC;AAE5C,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bannerDesign.d.ts","sourceRoot":"","sources":["../../../src/server/factories/bannerDesign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAa,MAAM,oBAAoB,CAAC;;AAiB1E,wBAwEI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bannerVariant.d.ts","sourceRoot":"","sources":["../../../src/server/factories/bannerVariant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;;AAExD,wBAMI"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Factory } from 'fishery';
|
|
2
|
+
declare const _default: Factory<{
|
|
3
|
+
name: string;
|
|
4
|
+
paragraphs: string[];
|
|
5
|
+
heading?: string | undefined;
|
|
6
|
+
highlightedText?: string | undefined;
|
|
7
|
+
tickerSettings?: {
|
|
8
|
+
name: "global" | "US" | "AU";
|
|
9
|
+
copy: {
|
|
10
|
+
countLabel: string;
|
|
11
|
+
};
|
|
12
|
+
currencySymbol: string;
|
|
13
|
+
tickerData?: {
|
|
14
|
+
total: number;
|
|
15
|
+
goal: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
cta?: {
|
|
19
|
+
text: string;
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
secondaryCta?: {
|
|
23
|
+
type: import("../../shared/types").SecondaryCtaType.Custom;
|
|
24
|
+
cta: {
|
|
25
|
+
text: string;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
type: import("../../shared/types").SecondaryCtaType.ContributionsReminder;
|
|
30
|
+
} | undefined;
|
|
31
|
+
newsletterSignup?: {
|
|
32
|
+
newsletterId: string;
|
|
33
|
+
successDescription: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
image?: {
|
|
36
|
+
mainUrl: string;
|
|
37
|
+
altText: string;
|
|
38
|
+
mobileUrl?: string | undefined;
|
|
39
|
+
tabletUrl?: string | undefined;
|
|
40
|
+
desktopUrl?: string | undefined;
|
|
41
|
+
leftColUrl?: string | undefined;
|
|
42
|
+
wideUrl?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
showReminderFields?: {
|
|
45
|
+
reminderCta: string;
|
|
46
|
+
reminderLabel: string;
|
|
47
|
+
reminderPeriod: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
separateArticleCount?: {
|
|
50
|
+
type: "above";
|
|
51
|
+
copy?: string | undefined;
|
|
52
|
+
countType?: "for52Weeks" | "forTargetedWeeks" | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
maxViews?: {
|
|
55
|
+
maxViewsCount: number;
|
|
56
|
+
maxViewsDays: number;
|
|
57
|
+
minDaysBetweenViews: number;
|
|
58
|
+
} | undefined;
|
|
59
|
+
showSignInLink?: boolean | undefined;
|
|
60
|
+
bylineWithImage?: {
|
|
61
|
+
name: string;
|
|
62
|
+
description?: string | undefined;
|
|
63
|
+
headshot?: {
|
|
64
|
+
mainUrl: string;
|
|
65
|
+
altText: string;
|
|
66
|
+
mobileUrl?: string | undefined;
|
|
67
|
+
tabletUrl?: string | undefined;
|
|
68
|
+
desktopUrl?: string | undefined;
|
|
69
|
+
leftColUrl?: string | undefined;
|
|
70
|
+
wideUrl?: string | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
showChoiceCards?: boolean | undefined;
|
|
74
|
+
choiceCardAmounts?: {
|
|
75
|
+
testName: string;
|
|
76
|
+
variantName: string;
|
|
77
|
+
defaultContributionType: "ONE_OFF" | "MONTHLY" | "ANNUAL";
|
|
78
|
+
displayContributionType: ("ONE_OFF" | "MONTHLY" | "ANNUAL")[];
|
|
79
|
+
amountsCardData: {
|
|
80
|
+
ONE_OFF: {
|
|
81
|
+
amounts: number[];
|
|
82
|
+
defaultAmount: number;
|
|
83
|
+
hideChooseYourAmount?: boolean | undefined;
|
|
84
|
+
};
|
|
85
|
+
MONTHLY: {
|
|
86
|
+
amounts: number[];
|
|
87
|
+
defaultAmount: number;
|
|
88
|
+
hideChooseYourAmount?: boolean | undefined;
|
|
89
|
+
};
|
|
90
|
+
ANNUAL: {
|
|
91
|
+
amounts: number[];
|
|
92
|
+
defaultAmount: number;
|
|
93
|
+
hideChooseYourAmount?: boolean | undefined;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
} | undefined;
|
|
97
|
+
defaultChoiceCardFrequency?: "ONE_OFF" | "MONTHLY" | "ANNUAL" | undefined;
|
|
98
|
+
}, any, any>;
|
|
99
|
+
export default _default;
|
|
100
|
+
//# sourceMappingURL=epicVariant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epicVariant.d.ts","sourceRoot":"","sources":["../../../src/server/factories/epicVariant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlC,wBAoBI"}
|