1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4"use strict";
5
6const TWO_DAYS = 2 * 24 * 3600 * 1000;
7
8const MESSAGES = () => [
9  {
10    id: "WNP_THANK_YOU",
11    template: "update_action",
12    content: {
13      action: {
14        id: "moments-wnp",
15        data: {
16          url:
17            "https://www.mozilla.org/%LOCALE%/etc/firefox/retention/thank-you-a/",
18          expireDelta: TWO_DAYS,
19        },
20      },
21    },
22    trigger: { id: "momentsUpdate" },
23  },
24  {
25    id: "WHATS_NEW_FINGERPRINTER_COUNTER_ALT",
26    template: "whatsnew_panel_message",
27    order: 6,
28    content: {
29      bucket_id: "WHATS_NEW_72",
30      published_date: 1574776601000,
31      title: "Title",
32      icon_url:
33        "chrome://activity-stream/content/data/content/assets/protection-report-icon.png",
34      icon_alt: { string_id: "cfr-badge-reader-label-newfeature" },
35      body: "Message body",
36      link_text: "Click here",
37      cta_url: "",
38      cta_type: "OPEN_PROTECTION_REPORT",
39    },
40    targeting: `firefoxVersion >= 72`,
41    trigger: { id: "whatsNewPanelOpened" },
42  },
43  {
44    id: "WHATS_NEW_70_1",
45    template: "whatsnew_panel_message",
46    order: 3,
47    content: {
48      bucket_id: "WHATS_NEW_70_1",
49      published_date: 1560969794394,
50      title: "Protection Is Our Focus",
51      icon_url:
52        "chrome://activity-stream/content/data/content/assets/whatsnew-send-icon.png",
53      icon_alt: "Firefox Send Logo",
54      body:
55        "The New Enhanced Tracking Protection, gives you the best level of protection and performance. Discover how this version is the safest version of firefox ever made.",
56      cta_url: "https://blog.mozilla.org/",
57      cta_type: "OPEN_URL",
58    },
59    targeting: `firefoxVersion > 69`,
60    trigger: { id: "whatsNewPanelOpened" },
61  },
62  {
63    id: "WHATS_NEW_70_2",
64    template: "whatsnew_panel_message",
65    order: 1,
66    content: {
67      bucket_id: "WHATS_NEW_70_1",
68      published_date: 1560969794394,
69      title: "Another thing new in Firefox 70",
70      body:
71        "The New Enhanced Tracking Protection, gives you the best level of protection and performance. Discover how this version is the safest version of firefox ever made.",
72      link_text: "Learn more on our blog",
73      cta_url: "https://blog.mozilla.org/",
74      cta_type: "OPEN_URL",
75    },
76    targeting: `firefoxVersion > 69`,
77    trigger: { id: "whatsNewPanelOpened" },
78  },
79  {
80    id: "WHATS_NEW_SEARCH_SHORTCUTS_84",
81    template: "whatsnew_panel_message",
82    order: 2,
83    content: {
84      bucket_id: "WHATS_NEW_SEARCH_SHORTCUTS_84",
85      published_date: 1560969794394,
86      title: "Title",
87      icon_url: "chrome://global/skin/icons/check.svg",
88      icon_alt: "",
89      body: "Message content",
90      cta_url:
91        "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/search-shortcuts",
92      cta_type: "OPEN_URL",
93      link_text: "Click here",
94    },
95    targeting: "firefoxVersion >= 84",
96    trigger: {
97      id: "whatsNewPanelOpened",
98    },
99  },
100  {
101    id: "WHATS_NEW_PIONEER_82",
102    template: "whatsnew_panel_message",
103    order: 1,
104    content: {
105      bucket_id: "WHATS_NEW_PIONEER_82",
106      published_date: 1603152000000,
107      title: "Put your data to work for a better internet",
108      icon_url: "",
109      icon_alt: "",
110      body:
111        "Contribute your data to Mozilla's Pioneer program to help researchers understand pressing technology issues like misinformation, data privacy, and ethical AI.",
112      cta_url: "pioneer",
113      cta_where: "tab",
114      cta_type: "OPEN_ABOUT_PAGE",
115      link_text: "Join Pioneer",
116    },
117    targeting: "firefoxVersion >= 82",
118    trigger: {
119      id: "whatsNewPanelOpened",
120    },
121  },
122  {
123    id: "WHATS_NEW_MEDIA_SESSION_82",
124    template: "whatsnew_panel_message",
125    order: 3,
126    content: {
127      bucket_id: "WHATS_NEW_MEDIA_SESSION_82",
128      published_date: 1603152000000,
129      title: "Title",
130      body: "Message content",
131      cta_url:
132        "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/media-keyboard-control",
133      cta_type: "OPEN_URL",
134      link_text: "Click here",
135    },
136    targeting: "firefoxVersion >= 82",
137    trigger: {
138      id: "whatsNewPanelOpened",
139    },
140  },
141  {
142    id: "WHATS_NEW_69_1",
143    template: "whatsnew_panel_message",
144    order: 1,
145    content: {
146      bucket_id: "WHATS_NEW_69_1",
147      published_date: 1557346235089,
148      title: "Something new in Firefox 69",
149      body:
150        "The New Enhanced Tracking Protection, gives you the best level of protection and performance. Discover how this version is the safest version of firefox ever made.",
151      link_text: "Learn more on our blog",
152      cta_url: "https://blog.mozilla.org/",
153      cta_type: "OPEN_URL",
154    },
155    targeting: `firefoxVersion > 68`,
156    trigger: { id: "whatsNewPanelOpened" },
157  },
158  {
159    id: "PERSONALIZED_CFR_MESSAGE",
160    template: "cfr_doorhanger",
161    groups: ["cfr"],
162    content: {
163      layout: "icon_and_message",
164      category: "cfrFeatures",
165      notification_text: "Personalized CFR Recommendation",
166      heading_text: { string_id: "cfr-doorhanger-bookmark-fxa-header" },
167      info_icon: {
168        label: {
169          attributes: {
170            tooltiptext: { string_id: "cfr-doorhanger-fxa-close-btn-tooltip" },
171          },
172        },
173        sumo_path: "https://example.com",
174      },
175      text: { string_id: "cfr-doorhanger-bookmark-fxa-body" },
176      icon: "chrome://branding/content/icon64.png",
177      icon_class: "cfr-doorhanger-large-icon",
178      persistent_doorhanger: true,
179      buttons: {
180        primary: {
181          label: { string_id: "cfr-doorhanger-milestone-ok-button" },
182          action: {
183            type: "OPEN_URL",
184            data: {
185              args:
186                "https://send.firefox.com/login/?utm_source=activity-stream&entrypoint=activity-stream-cfr-pdf",
187              where: "tabshifted",
188            },
189          },
190        },
191        secondary: [
192          {
193            label: { string_id: "cfr-doorhanger-extension-cancel-button" },
194            action: { type: "CANCEL" },
195          },
196          {
197            label: {
198              string_id: "cfr-doorhanger-extension-never-show-recommendation",
199            },
200          },
201          {
202            label: {
203              string_id: "cfr-doorhanger-extension-manage-settings-button",
204            },
205            action: {
206              type: "OPEN_PREFERENCES_PAGE",
207              data: { category: "general-cfrfeatures" },
208            },
209          },
210        ],
211      },
212    },
213    targeting: "scores.PERSONALIZED_CFR_MESSAGE.score > scoreThreshold",
214    trigger: {
215      id: "openURL",
216      patterns: ["*://*/*.pdf"],
217    },
218  },
219  {
220    id: "SPOTLIGHT_MESSAGE_93",
221    template: "spotlight",
222    groups: ["panel-test-provider"],
223    content: {
224      template: "logo-and-content",
225      logo: {
226        imageURL: "chrome://browser/content/logos/vpn-promo-logo.svg",
227      },
228      body: {
229        title: {
230          label: {
231            string_id: "spotlight-public-wifi-vpn-header",
232          },
233        },
234        text: {
235          label: {
236            string_id: "spotlight-public-wifi-vpn-body",
237          },
238        },
239        primary: {
240          label: {
241            string_id: "spotlight-public-wifi-vpn-primary-button",
242          },
243          action: {
244            type: "OPEN_URL",
245            data: {
246              args: "https://www.mozilla.org/en-US/products/vpn/",
247              where: "tabshifted",
248            },
249          },
250        },
251        secondary: {
252          label: {
253            string_id: "spotlight-public-wifi-vpn-link",
254          },
255          action: {
256            type: "CANCEL",
257          },
258        },
259      },
260    },
261    frequency: { lifetime: 3 },
262    trigger: { id: "defaultBrowserCheck" },
263  },
264  {
265    id: "TCP_SPOTLIGHT_MESSAGE_95",
266    groups: ["panel-test-provider"],
267    template: "spotlight",
268    content: {
269      template: "logo-and-content",
270      logo: {
271        imageURL: "chrome://branding/content/about-logo@2x.png",
272        size: "64px",
273      },
274      body: {
275        title: {
276          label: {
277            string_id: "spotlight-total-cookie-protection-header",
278          },
279          size: "24px",
280        },
281        text: {
282          label: {
283            string_id: "spotlight-total-cookie-protection-body",
284          },
285          size: "18px",
286        },
287        primary: {
288          label: {
289            string_id: "spotlight-total-cookie-protection-primary-button",
290          },
291          action: {
292            type: "ENABLE_TOTAL_COOKIE_PROTECTION",
293          },
294        },
295        secondary: {
296          label: {
297            string_id: "spotlight-total-cookie-protection-secondary-button",
298          },
299          action: {
300            type: "ENABLE_TOTAL_COOKIE_PROTECTION_SECTION_AND_OPT_OUT",
301          },
302        },
303      },
304      extra: {
305        expanded: {
306          label: {
307            string_id: "spotlight-total-cookie-protection-expanded",
308          },
309          size: "13px",
310        },
311      },
312    },
313    frequency: { lifetime: 3 },
314    trigger: { id: "defaultBrowserCheck" },
315  },
316  {
317    id: "BETTER_INTERNET_GLOBAL_ROLLOUT",
318    groups: ["eco"],
319    content: {
320      template: "logo-and-content",
321      logo: {
322        imageURL:
323          "chrome://activity-stream/content/data/content/assets/remote/mountain.svg",
324        size: "115px",
325      },
326      body: {
327        title: {
328          label: {
329            string_id: "spotlight-better-internet-header",
330          },
331          size: "22px",
332        },
333        text: {
334          label: {
335            string_id: "spotlight-better-internet-body",
336          },
337          size: "16px",
338        },
339        primary: {
340          label: {
341            string_id: "spotlight-pin-primary-button",
342          },
343          action: {
344            type: "PIN_FIREFOX_TO_TASKBAR",
345          },
346        },
347        secondary: {
348          label: {
349            string_id: "spotlight-pin-secondary-button",
350          },
351          action: {
352            type: "CANCEL",
353          },
354        },
355      },
356    },
357    trigger: {
358      id: "defaultBrowserCheck",
359    },
360    template: "spotlight",
361    frequency: {
362      lifetime: 1,
363    },
364    targeting:
365      "userMonthlyActivity|length >= 1 && userMonthlyActivity|length <= 6 && doesAppNeedPin",
366  },
367  {
368    id: "PEACE_OF_MIND_GLOBAL_ROLLOUT",
369    groups: ["eco"],
370    content: {
371      template: "logo-and-content",
372      logo: {
373        imageURL:
374          "chrome://activity-stream/content/data/content/assets/remote/umbrella.png",
375        size: "115px",
376      },
377      body: {
378        title: {
379          label: {
380            string_id: "spotlight-peace-mind-header",
381          },
382          size: "22px",
383        },
384        text: {
385          label: {
386            string_id: "spotlight-peace-mind-body",
387          },
388          size: "15px",
389        },
390        primary: {
391          label: {
392            string_id: "spotlight-pin-primary-button",
393          },
394          action: {
395            type: "PIN_FIREFOX_TO_TASKBAR",
396          },
397        },
398        secondary: {
399          label: {
400            string_id: "spotlight-pin-secondary-button",
401          },
402          action: {
403            type: "CANCEL",
404          },
405        },
406      },
407    },
408    trigger: {
409      id: "defaultBrowserCheck",
410    },
411    template: "spotlight",
412    frequency: {
413      lifetime: 1,
414    },
415    targeting:
416      "userMonthlyActivity|length >= 7 && userMonthlyActivity|length <= 13 && doesAppNeedPin",
417  },
418  {
419    id: "MULTISTAGE_SPOTLIGHT_MESSAGE",
420    groups: ["panel-test-provider"],
421    template: "spotlight",
422    content: {
423      template: "multistage",
424      backdrop: "transparent",
425      screens: [
426        {
427          id: "AW_PIN_FIREFOX",
428          order: 0,
429          content: {
430            title: {
431              string_id: "mr1-onboarding-pin-header",
432            },
433            logo: {},
434            hero_text: {
435              string_id: "mr1-welcome-screen-hero-text",
436            },
437            help_text: {
438              text: {
439                string_id: "mr1-onboarding-welcome-image-caption",
440              },
441            },
442            primary_button: {
443              label: {
444                string_id: "mr1-onboarding-pin-primary-button-label",
445              },
446              action: {
447                navigate: true,
448                type: "PIN_FIREFOX_TO_TASKBAR",
449              },
450            },
451            secondary_button: {
452              label: {
453                string_id: "mr1-onboarding-set-default-secondary-button-label",
454              },
455              action: {
456                navigate: true,
457              },
458            },
459          },
460        },
461        {
462          id: "AW_SET_DEFAULT",
463          order: 1,
464          content: {
465            logo: {
466              imageURL: "chrome://browser/content/logos/vpn-promo-logo.svg",
467              height: "100px",
468            },
469            title: {
470              string_id: "mr1-onboarding-default-header",
471            },
472            title_style: "slim larger",
473            subtitle: {
474              string_id: "mr1-onboarding-default-subtitle",
475            },
476            primary_button: {
477              label: {
478                string_id: "mr1-onboarding-default-primary-button-label",
479              },
480              action: {
481                navigate: true,
482                type: "SET_DEFAULT_BROWSER",
483              },
484            },
485            secondary_button: {
486              label: {
487                string_id: "mr1-onboarding-set-default-secondary-button-label",
488              },
489              action: {
490                navigate: true,
491              },
492            },
493          },
494        },
495        {
496          id: "BACKGROUND_IMAGE",
497          order: 2,
498          content: {
499            background:
500              "url(chrome://activity-stream/content/data/content/assets/proton-bkg.avif) no-repeat center/cover",
501            text_color: "light",
502            logo: {},
503            title: "A dialog with a background image",
504            subtitle: "The text color is configurable",
505            primary_button: {
506              label: "Continue",
507              action: {
508                navigate: true,
509              },
510            },
511            secondary_button: {
512              label: {
513                string_id: "mr1-onboarding-set-default-secondary-button-label",
514              },
515              action: {
516                navigate: true,
517              },
518            },
519          },
520        },
521        {
522          id: "BACKGROUND_COLOR",
523          order: 3,
524          content: {
525            background: "white",
526            logo: {
527              height: "200px",
528              imageURL: "",
529            },
530            title: "Peace of mind.",
531            title_style: "fancy slim larger",
532            text_color: "dark",
533            subtitle:
534              "For the best privacy protection, keep Firefox in easy reach.",
535            primary_button: {
536              label: "Continue",
537              action: {
538                navigate: true,
539              },
540            },
541            secondary_button: {
542              label: {
543                string_id: "mr1-onboarding-set-default-secondary-button-label",
544              },
545              action: {
546                navigate: true,
547              },
548            },
549          },
550        },
551      ],
552    },
553    frequency: { lifetime: 3 },
554    trigger: { id: "defaultBrowserCheck" },
555  },
556  {
557    id: "PB_NEWTAB_VPN_PROMO",
558    template: "pb_newtab",
559    content: {
560      promoEnabled: true,
561      infoEnabled: true,
562      infoIcon: "",
563      infoTitle: "",
564      infoBody: "fluent:about-private-browsing-info-description-private-window",
565      infoLinkText: "fluent:about-private-browsing-learn-more-link",
566      infoTitleEnabled: false,
567      promoLinkType: "button",
568      promoLinkText: "fluent:about-private-browsing-prominent-cta",
569      promoSectionStyle: "below-search",
570      promoHeader: "fluent:about-private-browsing-get-privacy",
571      promoTitle: "fluent:about-private-browsing-hide-activity-1",
572      promoTitleEnabled: true,
573      promoImageLarge: "chrome://browser/content/assets/moz-vpn.svg",
574    },
575    targeting: "region != 'CN' && !hasActiveEnterprisePolicies",
576    frequency: { lifetime: 3 },
577  },
578];
579
580const PanelTestProvider = {
581  getMessages() {
582    return Promise.resolve(
583      MESSAGES().map(message => ({
584        ...message,
585        targeting: `providerCohorts.panel_local_testing == "SHOW_TEST"`,
586      }))
587    );
588  },
589};
590this.PanelTestProvider = PanelTestProvider;
591
592const EXPORTED_SYMBOLS = ["PanelTestProvider"];
593