/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * This file is generated by browser/components/asrouter/bin/import-rollouts.js
 * Run the following from the repository root to regenerate it:
 * ./mach npm run import-rollouts --prefix=browser/components/asrouter
 */

export const NimbusRolloutMessageProvider = {
  getMessages() {
    return [
      {
        // Nimbus slug: 1-click-set-to-default-existing-profiles-rollout:treatment-b
        // Version range: 128+
        // Recipe: https://experimenter.services.mozilla.com/nimbus/1-click-set-to-default-existing-profiles-rollout/summary#treatment-b
        id: "FOX_DOODLE_SET_DEFAULT",
        groups: ["eco"],
        content: {
          id: "FOX_DOODLE_SET_DEFAULT",
          screens: [
            {
              id: "FOX_DOODLE_SET_DEFAULT_SCREEN",
              content: {
                logo: {
                  height: "125px",
                  imageURL:
                    "chrome://activity-stream/content/data/content/assets/fox-doodle-waving.gif",
                  reducedMotionImageURL:
                    "chrome://activity-stream/content/data/content/assets/fox-doodle-waving-static.png",
                },
                title: {
                  fontSize: "22px",
                  string_id: "fox-doodle-pin-headline",
                  fontWeight: 590,
                  paddingBlock: "4px 0",
                  letterSpacing: 0,
                  paddingInline: "24px",
                },
                subtitle: {
                  fontSize: "15px",
                  string_id: "fox-doodle-pin-body",
                  lineHeight: "1.4",
                  marginBlock: "8px 16px",
                  letterSpacing: 0,
                  paddingInline: "24px",
                },
                dismiss_button: {
                  action: {
                    navigate: true,
                  },
                },
                primary_button: {
                  label: {
                    string_id: "fox-doodle-pin-primary",
                    marginBlock: "4px 0",
                    paddingBlock: "0",
                    paddingInline: "16px",
                  },
                  action: {
                    type: "SET_DEFAULT_BROWSER",
                    navigate: true,
                  },
                },
                secondary_button: {
                  label: {
                    string_id: "fox-doodle-pin-secondary",
                    marginBlock: "0 -20px",
                  },
                  action: {
                    navigate: true,
                  },
                },
              },
            },
          ],
          backdrop: "transparent",
          template: "multistage",
          transitions: true,
        },
        trigger: {
          id: "defaultBrowserCheck",
        },
        template: "spotlight",
        frequency: {
          lifetime: 2,
        },
        targeting:
          "source == 'startup' && !isMajorUpgrade && !activeNotifications && !isDefaultBrowser && !willShowDefaultPrompt && 'browser.shell.checkDefaultBrowser'|preferenceValue && (currentDate|date - profileAgeCreated|date) / 86400000 >= 28 && previousSessionEnd && userPrefs.cfrFeatures == true",
      },
      {
        // Nimbus slug: us-review-checker-rollout-v2:treatment-a (message 1 of 4)
        // Recipe: https://experimenter.services.mozilla.com/nimbus/us-review-checker-rollout-v2/summary#treatment-a
        id: "FAKESPOT_CALLOUT_NO_OP_DUMMY",
        trigger: {
          id: "shoppingProductPageWithSidebarClosed",
        },
        template: "feature_callout",
        content: {},
        priority: 2,
        targeting: "true",
      },
      {
        // Nimbus slug: us-review-checker-rollout-v2:treatment-a (message 2 of 4)
        // Recipe: https://experimenter.services.mozilla.com/nimbus/us-review-checker-rollout-v2/summary#treatment-a
        id: "FAKESPOT_CALLOUT_CLOSED_NOT_OPTED_IN_AUTO_OPEN",
        content: {
          id: "FAKESPOT_CALLOUT_CLOSED_NOT_OPTED_IN_AUTO_OPEN",
          screens: [
            {
              id: "FAKESPOT_CALLOUT_CLOSED_NOT_OPTED_IN_AUTO_OPEN",
              anchors: [
                {
                  selector: "#shopping-sidebar-button",
                  panel_position: {
                    anchor_attachment: "bottomcenter",
                    callout_attachment: "topright",
                  },
                  no_open_on_anchor: true,
                },
              ],
              content: {
                logo: {
                  height: "214px",
                  imageURL:
                    "chrome://browser/content/shopping/assets/priceTagButtonCallout.svg",
                },
                title: {
                  string_id:
                    "shopping-callout-closed-not-opted-in-revised-title",
                },
                width: "401px",
                position: "callout",
                subtitle: {
                  string_id:
                    "shopping-callout-closed-not-opted-in-revised-subtitle",
                  letterSpacing: "0",
                },
                dismiss_button: {
                  size: "small",
                  action: {
                    dismiss: true,
                  },
                  marginBlock: "28px 0",
                  marginInline: "0 28px",
                },
                primary_button: {
                  label: {
                    string_id:
                      "shopping-callout-closed-not-opted-in-revised-button",
                    marginBlock: "0 -8px",
                  },
                  style: "secondary",
                  action: {
                    dismiss: true,
                  },
                },
                page_event_listeners: [
                  {
                    action: {
                      dismiss: true,
                    },
                    params: {
                      type: "click",
                      selectors: "#shopping-sidebar-button",
                    },
                  },
                ],
              },
            },
          ],
          backdrop: "transparent",
          template: "multistage",
          transitions: false,
          disableHistoryUpdates: true,
        },
        trigger: {
          id: "shoppingProductPageWithSidebarClosed",
        },
        priority: 3,
        template: "feature_callout",
        frequency: {
          lifetime: 1,
        },
        targeting:
          "isSidebarClosing && 'browser.shopping.experience2023.autoOpen.enabled' | preferenceValue == true && 'browser.shopping.experience2023.optedIn' | preferenceValue == 0 && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features' | preferenceValue != false",
        skip_in_tests:
          "not tested in automation and might pop up unexpectedly during review checker tests",
      },
      {
        // Nimbus slug: us-review-checker-rollout-v2:treatment-a (message 3 of 4)
        // Recipe: https://experimenter.services.mozilla.com/nimbus/us-review-checker-rollout-v2/summary#treatment-a
        id: "FAKESPOT_CALLOUT_PDP_NOT_OPTED_IN_REMINDER",
        content: {
          id: "FAKESPOT_CALLOUT_PDP_NOT_OPTED_IN_REMINDER",
          screens: [
            {
              id: "FAKESPOT_CALLOUT_PDP_NOT_OPTED_IN_REMINDER",
              anchors: [
                {
                  selector: "#shopping-sidebar-button",
                  panel_position: {
                    anchor_attachment: "bottomcenter",
                    callout_attachment: "topright",
                  },
                  no_open_on_anchor: true,
                },
              ],
              content: {
                logo: {
                  alt: {
                    string_id: "shopping-callout-not-opted-in-reminder-img-alt",
                  },
                  height: "214px",
                  imageURL:
                    "chrome://browser/content/shopping/assets/reviewsVisualCallout.svg",
                },
                tiles: {
                  data: [
                    {
                      id: "checkbox-dont-show-again",
                      icon: {
                        style: {
                          width: "16px",
                          height: "16px",
                          marginInline: "0 8px",
                        },
                      },
                      type: "checkbox",
                      label: {
                        string_id:
                          "shopping-callout-not-opted-in-reminder-ignore-checkbox",
                      },
                      style: {
                        alignItems: "center",
                      },
                      action: {
                        data: {
                          pref: {
                            name: "messaging-system-action.shopping-callouts-1-block",
                            value: true,
                          },
                        },
                        type: "SET_PREF",
                      },
                      defaultValue: false,
                    },
                  ],
                  type: "multiselect",
                  style: {
                    alignItems: "flex-start",
                    flexDirection: "column",
                  },
                },
                title: {
                  fontSize: "20px",
                  string_id: "shopping-callout-not-opted-in-reminder-title",
                  letterSpacing: "0",
                },
                width: "401px",
                position: "callout",
                subtitle: {
                  string_id: "shopping-callout-not-opted-in-reminder-subtitle",
                  letterSpacing: "0",
                },
                dismiss_button: {
                  size: "small",
                  action: {
                    data: {
                      actions: [],
                    },
                    type: "MULTI_ACTION",
                    dismiss: true,
                    collectSelect: true,
                  },
                  marginBlock: "28px 0",
                  marginInline: "0 28px",
                },
                primary_button: {
                  label: {
                    string_id:
                      "shopping-callout-not-opted-in-reminder-close-button",
                    marginBlock: "0 -8px",
                  },
                  style: "secondary",
                  action: {
                    data: {
                      actions: [],
                    },
                    type: "MULTI_ACTION",
                    dismiss: true,
                    collectSelect: true,
                  },
                },
                secondary_button: {
                  label: {
                    string_id:
                      "shopping-callout-not-opted-in-reminder-open-button",
                    marginBlock: "0 -8px",
                  },
                  style: "primary",
                  action: {
                    data: {
                      actions: [
                        {
                          data: {
                            pref: {
                              name: "browser.shopping.experience2023.active",
                              value: true,
                            },
                          },
                          type: "SET_PREF",
                        },
                      ],
                    },
                    type: "MULTI_ACTION",
                    dismiss: true,
                    collectSelect: true,
                  },
                },
                page_event_listeners: [
                  {
                    action: {
                      dismiss: true,
                    },
                    params: {
                      type: "click",
                      selectors: "#shopping-sidebar-button",
                    },
                  },
                ],
              },
            },
          ],
          backdrop: "transparent",
          template: "multistage",
          transitions: false,
          disableHistoryUpdates: true,
        },
        trigger: {
          id: "shoppingProductPageWithSidebarClosed",
        },
        priority: 4,
        template: "feature_callout",
        frequency: {
          custom: [
            {
              cap: 1,
              period: 432000000,
            },
          ],
          lifetime: 3,
        },
        targeting:
          "!isSidebarClosing && 'browser.shopping.experience2023.autoOpen.enabled' | preferenceValue == true && 'browser.shopping.experience2023.optedIn' | preferenceValue == 0 && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features' | preferenceValue != false && !'messaging-system-action.shopping-callouts-1-block' | preferenceValue && (currentDate | date - messageImpressions.FAKESPOT_CALLOUT_CLOSED_NOT_OPTED_IN_AUTO_OPEN[messageImpressions.FAKESPOT_CALLOUT_CLOSED_NOT_OPTED_IN_AUTO_OPEN | length - 1] | date) / 3600000 > 24",
        skip_in_tests:
          "not tested in automation and might pop up unexpectedly during review checker tests",
      },
      {
        // Nimbus slug: us-review-checker-rollout-v2:treatment-a (message 4 of 4)
        // Recipe: https://experimenter.services.mozilla.com/nimbus/us-review-checker-rollout-v2/summary#treatment-a
        id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY",
        content: {
          id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY",
          screens: [
            {
              id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY_1",
              anchors: [
                {
                  selector: "#shopping-sidebar-button",
                  arrow_width: "22.62742",
                  panel_position: {
                    anchor_attachment: "bottomcenter",
                    callout_attachment: "topright",
                  },
                  no_open_on_anchor: true,
                },
              ],
              content: {
                tiles: {
                  data: [
                    {
                      id: "fakespot-opted-out-survey-hard-to-understand",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "It’s hard to understand",
                      },
                      randomize: true,
                      defaultValue: false,
                    },
                    {
                      id: "fakespot-opted-out-survey-too-slow",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "It’s too slow",
                      },
                      randomize: true,
                      defaultValue: false,
                    },
                    {
                      id: "fakespot-opted-out-survey-not-accurate",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "It’s not accurate",
                      },
                      randomize: true,
                      defaultValue: false,
                    },
                    {
                      id: "fakespot-opted-out-survey-not-helpful",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "It’s not helpful to me",
                      },
                      randomize: true,
                      defaultValue: false,
                    },
                    {
                      id: "fakespot-opted-out-survey-check-reviews-myself",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "I’d rather check reviews myself",
                      },
                      randomize: true,
                      defaultValue: false,
                    },
                    {
                      id: "fakespot-opted-out-survey-other",
                      icon: {
                        style: {
                          marginInline: "2px 8px",
                        },
                      },
                      type: "checkbox",
                      group: "checkboxes",
                      label: {
                        raw: "Other",
                      },
                      defaultValue: false,
                    },
                  ],
                  type: "multiselect",
                  label:
                    "Please let us know why you turned off Review Checker. Select multiple if needed.",
                  style: {
                    alignItems: "flex-start",
                    flexDirection: "column",
                  },
                },
                title: "Help improve Firefox",
                width: "332px",
                layout: "survey",
                padding: "20",
                position: "callout",
                title_logo: {
                  imageURL: "chrome://branding/content/about-logo.png",
                },
                dismiss_button: {
                  size: "small",
                  label: {
                    aria_label: "Close",
                  },
                  action: {
                    data: {
                      actions: [
                        {
                          data: {
                            id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY",
                          },
                          type: "BLOCK_MESSAGE",
                        },
                        {
                          data: {
                            pref: {
                              name: "messaging-system-action.fakespot-opted-out-survey.progress",
                            },
                          },
                          type: "SET_PREF",
                        },
                      ],
                    },
                    type: "MULTI_ACTION",
                    dismiss: true,
                    collectSelect: true,
                  },
                },
                secondary_button: {
                  label: "Submit",
                  style: "primary",
                  action: {
                    data: {
                      actions: [
                        {
                          data: {
                            pref: {
                              name: "messaging-system-action.fakespot-opted-out-survey.progress",
                              value:
                                '{"screen":"FAKESPOT_CALLOUT_OPTED_OUT_SURVEY_2","complete":false}',
                            },
                          },
                          type: "SET_PREF",
                        },
                      ],
                    },
                    type: "MULTI_ACTION",
                    collectSelect: true,
                  },
                  disabled: "hasActiveMultiSelect",
                },
              },
              force_hide_steps_indicator: true,
            },
            {
              id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY_2",
              anchors: [
                {
                  selector: "#shopping-sidebar-button",
                  arrow_width: "22.62742",
                  panel_position: {
                    anchor_attachment: "bottomcenter",
                    callout_attachment: "topright",
                  },
                  no_open_on_anchor: true,
                },
              ],
              content: {
                title: "Thanks for your feedback!",
                layout: "inline",
                position: "callout",
                title_logo: {
                  imageURL:
                    "https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/706c7a85-cf23-442e-8a92-7ebc7f537375.svg",
                },
                dismiss_button: {
                  size: "small",
                  label: {
                    aria_label: "Close",
                  },
                  action: {
                    data: {
                      pref: {
                        name: "messaging-system-action.fakespot-opted-out-survey.progress",
                      },
                    },
                    type: "SET_PREF",
                    dismiss: true,
                  },
                },
                page_event_listeners: [
                  {
                    action: {
                      dismiss: true,
                    },
                    params: {
                      type: "timeout",
                      options: {
                        once: true,
                        interval: 20000,
                      },
                    },
                  },
                  {
                    action: {
                      data: {
                        id: "FAKESPOT_CALLOUT_OPTED_OUT_SURVEY",
                      },
                      type: "BLOCK_MESSAGE",
                    },
                    params: {
                      type: "tourend",
                      options: {
                        once: true,
                      },
                    },
                  },
                ],
              },
              force_hide_steps_indicator: true,
            },
          ],
          backdrop: "transparent",
          template: "multistage",
          transitions: false,
          tour_pref_name:
            "messaging-system-action.fakespot-opted-out-survey.progress",
          disableHistoryUpdates: true,
          tour_pref_default_value:
            '{"screen":"FAKESPOT_CALLOUT_OPTED_OUT_SURVEY_1","complete":false}',
        },
        trigger: {
          id: "preferenceObserver",
          params: ["browser.shopping.experience2023.optedIn"],
        },
        priority: 2,
        template: "feature_callout",
        targeting:
          "'browser.shopping.experience2023.optedIn' | preferenceValue == 2 && !'browser.shopping.experience2023.active' | preferenceValue && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features' | preferenceValue != false",
      },
      {
        // Nimbus slug: recommend-add-ons-staff-pick-relaunch-treatment-a-rollout:treatment-a
        // Version range: 123+
        // Recipe: https://experimenter.services.mozilla.com/nimbus/recommend-add-ons-staff-pick-relaunch-treatment-a-rollout/summary#treatment-a
        id: "ADDONS_STAFF_PICK",
        groups: ["cfr"],
        content: {
          id: "ADDONS_STAFF_PICK",
          screens: [
            {
              id: "ADDONS_STAFF_PICK_A",
              anchors: [
                {
                  selector: "#unified-extensions-button",
                  arrow_width: "26.9",
                  panel_position: {
                    anchor_attachment: "bottomcenter",
                    callout_attachment: "topright",
                  },
                },
              ],
              content: {
                title: {
                  raw: "Give your browsing a boost",
                  marginInline: "0 48px",
                },
                width: "310px",
                padding: 16,
                position: "callout",
                subtitle: {
                  raw: "Make browsing faster, safer, or just plain fun with Firefox add-ons. See what our staff recommends!",
                  paddingInline: "34px 0",
                },
                title_logo: {
                  width: "24px",
                  height: "24px",
                  imageURL:
                    "https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/173414e1-81f7-4612-b868-e78df0557011.svg",
                  marginInline: "4px 14px",
                },
                dismiss_button: {
                  size: "small",
                  action: {
                    dismiss: true,
                  },
                  marginBlock: "14px 0",
                  marginInline: "0 14px",
                },
                primary_button: {
                  label: {
                    raw: "Explore add-ons",
                  },
                  action: {
                    data: {
                      args: "https://addons.mozilla.org/en-US/firefox/collections/4757633/25c2b44583534b3fa8fea977c419cd/?page=1&collection_sort=-added",
                      where: "tabshifted",
                    },
                    type: "OPEN_URL",
                    dismiss: true,
                  },
                },
              },
            },
          ],
          backdrop: "transparent",
          template: "multistage",
          transitions: false,
        },
        trigger: {
          id: "defaultBrowserCheck",
        },
        template: "feature_callout",
        frequency: {
          lifetime: 1,
        },
        targeting:
          "!screenImpressions.AW_AMO_INTRODUCE && !willShowDefaultPrompt && !activeNotifications && source == 'newtab' && !isFirstStartup",
      },
    ];
  },
};
