SnippetsTestMessageProvider.jsm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. const TEST_ICON = "chrome://branding/content/icon64.png";
  6. const TEST_ICON_16 = "chrome://branding/content/icon16.png";
  7. const TEST_ICON_BW = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfjBQ8QDifrKGc/AAABf0lEQVQoz4WRO08UUQCFvztzd1AgG9jRgGwkhEoMIYGSygYt+A00tpZGY0jYxAJKEwkNjX9AK2xACx4dhFiQQCiMMRr2kYXdnQcz7L0z91qAMVac6hTfSU7OgVsk/prtyfSNfRb7ge2cd7dmVucP/wM2lwqVqoyICahRx9Nz71+8AnAAvlTct+dSYDBYcgJ+Fj68XFu/AfamnIoWFoHFYrAUuYMSn55/fAIOxIs1t4MhQpNxRYsUD0ld7r8DCfZph4QecrqkhCREgMLSeISQkAy0UBgE0CYgIkeRA9HdsCQhpEGCxichpItHigEcPH4XJLRbTf8STY0iiiuu60Ifxexx04F0N+aCgJCAhPQmD/cp/RC5A79WvUyhUHSIidAIoESv9VfAhW9n8+XqTCoyMsz1cviMMrGz9BrjAuboYHZajyXCInEocI8yvccbC+0muABanR4/tONjQz3DzgNKtj9sfv66XD9B/3tT9g/akb7h0bJwzxqqmlRHLr4rLPwBlYWoYj77l2AAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDUtMTVUMTY6MTQ6MzkrMDA6MDD5/4XBAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTA1LTE1VDE2OjE0OjM5KzAwOjAwiKI9fQAAAABJRU5ErkJggg==";
  8. const MESSAGES = () => ([
  9. {
  10. "id": "SIMPLE_TEST_1",
  11. "template": "simple_snippet",
  12. "campaign": "test_campaign_blocking",
  13. "content": {
  14. "icon": TEST_ICON,
  15. "icon_dark_theme": TEST_ICON_BW,
  16. "title": "Firefox Account!",
  17. "title_icon": TEST_ICON_16,
  18. "title_icon_dark_theme": TEST_ICON_BW,
  19. "text": "<syncLink>Sync it, link it, take it with you</syncLink>. All this and more with a Firefox Account.",
  20. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  21. "block_button_text": "Block",
  22. },
  23. },
  24. {
  25. "id": "SIMPLE_TEST_1_NO_DARK_THEME",
  26. "template": "simple_snippet",
  27. "campaign": "test_campaign_blocking",
  28. "content": {
  29. "icon": TEST_ICON,
  30. "icon_dark_theme": "",
  31. "title": "Firefox Account!",
  32. "title_icon": TEST_ICON_16,
  33. "title_icon_dark_theme": "",
  34. "text": "<syncLink>Sync it, link it, take it with you</syncLink>. All this and more with a Firefox Account.",
  35. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  36. "block_button_text": "Block",
  37. },
  38. },
  39. {
  40. "id": "SIMPLE_TEST_1_SAME_CAMPAIGN",
  41. "template": "simple_snippet",
  42. "campaign": "test_campaign_blocking",
  43. "content": {
  44. "icon": TEST_ICON,
  45. "icon_dark_theme": TEST_ICON_BW,
  46. "text": "<syncLink>Sync it, link it, take it with you</syncLink>. All this and more with a Firefox Account.",
  47. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  48. "block_button_text": "Block",
  49. },
  50. },
  51. {
  52. "id": "SIMPLE_TEST_TALL",
  53. "template": "simple_snippet",
  54. "content": {
  55. "icon": TEST_ICON,
  56. "icon_dark_theme": TEST_ICON_BW,
  57. "text": "<syncLink>Sync it, link it, take it with you</syncLink>. All this and more with a Firefox Account.",
  58. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  59. "button_label": "Get one now!",
  60. "button_url": "https://www.mozilla.org/en-US/firefox/accounts",
  61. "block_button_text": "Block",
  62. "tall": true,
  63. },
  64. },
  65. {
  66. "id": "SIMPLE_TEST_BUTTON_URL_1",
  67. "template": "simple_snippet",
  68. "content": {
  69. "icon": TEST_ICON,
  70. "icon_dark_theme": TEST_ICON_BW,
  71. "button_label": "Get one now!",
  72. "button_url": "https://www.mozilla.org/en-US/firefox/accounts",
  73. "text": "Sync it, link it, take it with you. All this and more with a Firefox Account.",
  74. "block_button_text": "Block",
  75. },
  76. },
  77. {
  78. "id": "SIMPLE_WITH_TITLE_TEST_1",
  79. "template": "simple_snippet",
  80. "content": {
  81. "icon": TEST_ICON,
  82. "icon_dark_theme": TEST_ICON_BW,
  83. "title": "Ready to sync?",
  84. "text": "Get connected with a <syncLink>Firefox account</syncLink>.",
  85. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  86. "block_button_text": "Block",
  87. },
  88. },
  89. {
  90. "id": "NEWSLETTER_TEST_DEFAULTS",
  91. "template": "newsletter_snippet",
  92. "content": {
  93. "scene1_icon": TEST_ICON,
  94. "scene1_icon_dark_theme": TEST_ICON_BW,
  95. "scene1_title": "Be a part of a movement.",
  96. "scene1_title_icon": TEST_ICON_16,
  97. "scene1_title_icon_dark_theme": TEST_ICON_BW,
  98. "scene1_text": "Internet shutdowns, hackers, harassment &ndash; the health of the internet is on the line. Sign up and Mozilla will keep you updated on how you can help.",
  99. "scene1_button_label": "Continue",
  100. "scene1_button_color": "#712b00",
  101. "scene1_button_background_color": "#ff9400",
  102. "scene2_title": "Let's do this!",
  103. "locale": "en-CA",
  104. "scene2_dismiss_button_text": "Dismiss",
  105. "scene2_text": "Sign up for the Mozilla newsletter and we will keep you updated on how you can help.",
  106. "scene2_privacy_html": "I'm okay with Mozilla handling my info as explained in this <privacyLink>Privacy Notice</privacyLink>.",
  107. "scene2_newsletter": "mozilla-foundation",
  108. "success_text": "Check your inbox for the confirmation!",
  109. "error_text": "Error!",
  110. "links": {"privacyLink": {"url": "https://www.mozilla.org/privacy/websites/?sample_rate=0.001&snippet_name=7894"}},
  111. },
  112. },
  113. {
  114. "id": "NEWSLETTER_TEST_1",
  115. "template": "newsletter_snippet",
  116. "content": {
  117. "scene1_icon": TEST_ICON,
  118. "scene1_icon_dark_theme": TEST_ICON_BW,
  119. "scene1_title": "Be a part of a movement.",
  120. "scene1_title_icon": "",
  121. "scene1_text": "Internet shutdowns, hackers, harassment &ndash; the health of the internet is on the line. Sign up and Mozilla will keep you updated on how you can help.",
  122. "scene1_button_label": "Continue",
  123. "scene1_button_color": "#712b00",
  124. "scene1_button_background_color": "#ff9400",
  125. "scene2_title": "Let's do this!",
  126. "locale": "en-CA",
  127. "scene2_dismiss_button_text": "Dismiss",
  128. "scene2_text": "Sign up for the Mozilla newsletter and we will keep you updated on how you can help.",
  129. "scene2_privacy_html": "I'm okay with Mozilla handling my info as explained in this <privacyLink>Privacy Notice</privacyLink>.",
  130. "scene2_button_label": "Sign Me up",
  131. "scene2_email_placeholder_text": "Your email here",
  132. "scene2_newsletter": "mozilla-foundation",
  133. "success_text": "Check your inbox for the confirmation!",
  134. "error_text": "Error!",
  135. "links": {"privacyLink": {"url": "https://www.mozilla.org/privacy/websites/?sample_rate=0.001&snippet_name=7894"}},
  136. },
  137. },
  138. {
  139. "id": "FXA_SNIPPET_TEST_1",
  140. "template": "fxa_signup_snippet",
  141. "content": {
  142. "scene1_icon": TEST_ICON,
  143. "scene1_icon_dark_theme": TEST_ICON_BW,
  144. "scene1_button_label": "Get connected with sync!",
  145. "scene1_button_color": "#712b00",
  146. "scene1_button_background_color": "#ff9400",
  147. "scene1_text": "Connect to Firefox by securely syncing passwords, bookmarks, and open tabs.",
  148. "scene1_title": "Browser better.",
  149. "scene1_title_icon": TEST_ICON_16,
  150. "scene1_title_icon_dark_theme": TEST_ICON_BW,
  151. "scene2_text": "Connect to your Firefox account to securely sync passwords, bookmarks, and open tabs.",
  152. "scene2_title": "Title 123",
  153. "scene2_email_placeholder_text": "Your email",
  154. "scene2_button_label": "Continue",
  155. "scene2_dismiss_button_text": "Dismiss",
  156. },
  157. },
  158. {
  159. id: "SNIPPETS_SEND_TO_DEVICE_TEST",
  160. template: "send_to_device_snippet",
  161. content: {
  162. include_sms: true,
  163. locale: "en-CA",
  164. country: "us",
  165. message_id_sms: "ff-mobilesn-download",
  166. message_id_email: "download-firefox-mobile",
  167. scene1_button_background_color: "#6200a4",
  168. scene1_button_color: "#FFFFFF",
  169. scene1_button_label: "Install now",
  170. scene1_icon: TEST_ICON,
  171. scene1_icon_dark_theme: TEST_ICON_BW,
  172. scene1_text: "Browse without compromise with Firefox Mobile.",
  173. scene1_title: "Full-featured. Customizable. Lightning fast",
  174. scene1_title_icon: TEST_ICON_16,
  175. scene1_title_icon_dark_theme: TEST_ICON_BW,
  176. scene2_button_label: "Send",
  177. scene2_disclaimer_html: "The intended recipient of the email must have consented. <privacyLink>Learn more</privacyLink>.",
  178. scene2_dismiss_button_text: "Dismiss",
  179. scene2_icon: TEST_ICON,
  180. scene2_icon_dark_theme: TEST_ICON_BW,
  181. scene2_input_placeholder: "Your email address or phone number",
  182. scene2_text: "Send Firefox to your phone and take a powerful independent browser with you.",
  183. scene2_title: "Let's do this!",
  184. error_text: "Oops, there was a problem.",
  185. success_title: "Your download link was sent.",
  186. success_text: "Check your device for the email message!",
  187. links: {"privacyLink": {"url": "https://www.mozilla.org/privacy/websites/?sample_rate=0.001&snippet_name=7894"}},
  188. },
  189. },
  190. {
  191. id: "SNIPPETS_SEND_TO_DEVICE_TEST_NO_DARK_THEME",
  192. template: "send_to_device_snippet",
  193. content: {
  194. include_sms: true,
  195. locale: "en-CA",
  196. country: "us",
  197. message_id_sms: "ff-mobilesn-download",
  198. message_id_email: "download-firefox-mobile",
  199. scene1_button_background_color: "#6200a4",
  200. scene1_button_color: "#FFFFFF",
  201. scene1_button_label: "Install now",
  202. scene1_icon: TEST_ICON,
  203. scene1_icon_dark_theme: "",
  204. scene1_text: "Browse without compromise with Firefox Mobile.",
  205. scene1_title: "Full-featured. Customizable. Lightning fast",
  206. scene1_title_icon: TEST_ICON_16,
  207. scene1_title_icon_dark_theme: "",
  208. scene2_button_label: "Send",
  209. scene2_disclaimer_html: "The intended recipient of the email must have consented. <privacyLink>Learn more</privacyLink>.",
  210. scene2_dismiss_button_text: "Dismiss",
  211. scene2_icon: TEST_ICON,
  212. scene2_icon_dark_theme: "",
  213. scene2_input_placeholder: "Your email address or phone number",
  214. scene2_text: "Send Firefox to your phone and take a powerful independent browser with you.",
  215. scene2_title: "Let's do this!",
  216. error_text: "Oops, there was a problem.",
  217. success_title: "Your download link was sent.",
  218. success_text: "Check your device for the email message!",
  219. links: {"privacyLink": {"url": "https://www.mozilla.org/privacy/websites/?sample_rate=0.001&snippet_name=7894"}},
  220. },
  221. },
  222. {
  223. "id": "EOY_TEST_1",
  224. "template": "eoy_snippet",
  225. "content": {
  226. "highlight_color": "#f05",
  227. "background_color": "#ddd",
  228. "text_color": "yellow",
  229. "selected_button": "donation_amount_first",
  230. "icon": TEST_ICON,
  231. "icon_dark_theme": TEST_ICON_BW,
  232. "button_label": "Donate",
  233. "monthly_checkbox_label_text": "Make my donation monthly",
  234. "currency_code": "usd",
  235. "donation_amount_first": 50,
  236. "donation_amount_second": 25,
  237. "donation_amount_third": 10,
  238. "donation_amount_fourth": 5,
  239. "donation_form_url": "https://donate.mozilla.org/pl/?utm_source=desktop-snippet&amp;utm_medium=snippet&amp;utm_campaign=donate&amp;utm_term=7556",
  240. "text": "Big corporations want to restrict how we access the web. Fake news is making it harder for us to find the truth. Online bullies are silencing inspired voices. The <em>not-for-profit Mozilla Foundation</em> fights for a healthy internet with programs like our Tech Policy Fellowships and Internet Health Report; <b>will you donate today</b>?",
  241. },
  242. },
  243. {
  244. "id": "EOY_BOLD_TEST_1",
  245. "template": "eoy_snippet",
  246. "content": {
  247. "icon": TEST_ICON,
  248. "icon_dark_theme": TEST_ICON_BW,
  249. "selected_button": "donation_amount_second",
  250. "button_label": "Donate",
  251. "monthly_checkbox_label_text": "Make my donation monthly",
  252. "currency_code": "usd",
  253. "donation_amount_first": 50,
  254. "donation_amount_second": 25,
  255. "donation_amount_third": 10,
  256. "donation_amount_fourth": 5,
  257. "donation_form_url": "https://donate.mozilla.org",
  258. "text": "Big corporations want to restrict how we access the web. Fake news is making it harder for us to find the truth. Online bullies are silencing inspired voices. The <em>not-for-profit Mozilla Foundation</em> fights for a healthy internet with programs like our Tech Policy Fellowships and Internet Health Report; <b>will you donate today</b>?",
  259. "test": "bold",
  260. },
  261. },
  262. {
  263. "id": "EOY_TAKEOVER_TEST_1",
  264. "template": "eoy_snippet",
  265. "content": {
  266. "icon": TEST_ICON,
  267. "icon_dark_theme": TEST_ICON_BW,
  268. "button_label": "Donate",
  269. "monthly_checkbox_label_text": "Make my donation monthly",
  270. "currency_code": "usd",
  271. "donation_amount_first": 50,
  272. "donation_amount_second": 25,
  273. "donation_amount_third": 10,
  274. "donation_amount_fourth": 5,
  275. "donation_form_url": "https://donate.mozilla.org",
  276. "text": "Big corporations want to restrict how we access the web. Fake news is making it harder for us to find the truth. Online bullies are silencing inspired voices. The <em>not-for-profit Mozilla Foundation</em> fights for a healthy internet with programs like our Tech Policy Fellowships and Internet Health Report; <b>will you donate today</b>?",
  277. "test": "takeover",
  278. },
  279. },
  280. {
  281. "id": "SIMPLE_TEST_WITH_SECTION_HEADING",
  282. "template": "simple_snippet",
  283. "content": {
  284. "button_label": "Get one now!",
  285. "button_url": "https://www.mozilla.org/en-US/firefox/accounts",
  286. "icon": TEST_ICON,
  287. "icon_dark_theme": TEST_ICON_BW,
  288. "title": "Firefox Account!",
  289. "text": "<syncLink>Sync it, link it, take it with you</syncLink>. All this and more with a Firefox Account.",
  290. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  291. "block_button_text": "Block",
  292. "section_title_icon": "resource://activity-stream/data/content/assets/glyph-pocket-16.svg",
  293. "section_title_text": "Messages from Mozilla",
  294. },
  295. },
  296. {
  297. "id": "SIMPLE_TEST_WITH_SECTION_HEADING_AND_LINK",
  298. "template": "simple_snippet",
  299. "content": {
  300. "icon": TEST_ICON,
  301. "icon_dark_theme": TEST_ICON_BW,
  302. "title": "Firefox Account!",
  303. "text": "Sync it, link it, take it with you. All this and more with a Firefox Account.",
  304. "block_button_text": "Block",
  305. "section_title_icon": "resource://activity-stream/data/content/assets/glyph-pocket-16.svg",
  306. "section_title_text": "Messages from Mozilla (click for info)",
  307. "section_title_url": "https://www.mozilla.org/about",
  308. },
  309. },
  310. {
  311. "id": "SIMPLE_BELOW_SEARCH_TEST_1",
  312. "template": "simple_below_search_snippet",
  313. "content": {
  314. "icon": TEST_ICON,
  315. "icon_dark_theme": TEST_ICON_BW,
  316. "text": "Securely store passwords, bookmarks, and more with a Firefox Account. <syncLink>Sign up</syncLink>",
  317. "links": {"syncLink": {"url": "https://www.mozilla.org/en-US/firefox/accounts"}},
  318. "block_button_text": "Block",
  319. },
  320. },
  321. ]);
  322. const SnippetsTestMessageProvider = {
  323. getMessages() {
  324. return MESSAGES()
  325. // Ensures we never actually show test except when triggered by debug tools
  326. .map(message => ({...message, targeting: `providerCohorts.snippets_local_testing == "SHOW_TEST"`}));
  327. },
  328. };
  329. this.SnippetsTestMessageProvider = SnippetsTestMessageProvider;
  330. const EXPORTED_SYMBOLS = ["SnippetsTestMessageProvider"];