diff --git a/.gitignore b/.gitignore index ef76532e3e2a..936f02ba0800 100644 --- a/.gitignore +++ b/.gitignore @@ -94,10 +94,10 @@ browser/components/aboutwelcome/logs/ browser/components/asrouter/logs/ # Ignore ASRouter generated test files -browser/components/newtab/content-src/asrouter/schemas/corpus/CFRMessageProvider.messages.json -browser/components/newtab/content-src/asrouter/schemas/corpus/OnboardingMessageProvider.messages.json -browser/components/newtab/content-src/asrouter/schemas/corpus/PanelTestProvider.messages.json -browser/components/newtab/content-src/asrouter/schemas/corpus/PanelTestProvider_toast_notification.messages.json +browser/components/asrouter/content-src/schemas/corpus/CFRMessageProvider.messages.json +browser/components/asrouter/content-src/schemas/corpus/OnboardingMessageProvider.messages.json +browser/components/asrouter/content-src/schemas/corpus/PanelTestProvider.messages.json +browser/components/asrouter/content-src/schemas/corpus/PanelTestProvider_toast_notification.messages.json # Ignore Pocket component build and dev assets browser/components/pocket/content/panels/css/main.compiled.css.map diff --git a/.hgignore b/.hgignore index 204750f81566..ae96829d6436 100644 --- a/.hgignore +++ b/.hgignore @@ -86,10 +86,10 @@ ^browser/components/asrouter/logs/ # Ignore ASRouter generated test files -^browser/components/newtab/content-src/asrouter/schemas/corpus/CFRMessageProvider\.messages\.json -^browser/components/newtab/content-src/asrouter/schemas/corpus/OnboardingMessageProvider\.messages\.json -^browser/components/newtab/content-src/asrouter/schemas/corpus/PanelTestProvider\.messages\.json -^browser/components/newtab/content-src/asrouter/schemas/corpus/PanelTestProvider_toast_notification\.messages\.json +^browser/components/asrouter/content-src/schemas/corpus/CFRMessageProvider\.messages\.json +^browser/components/asrouter/content-src/schemas/corpus/OnboardingMessageProvider\.messages\.json +^browser/components/asrouter/content-src/schemas/corpus/PanelTestProvider\.messages\.json +^browser/components/asrouter/content-src/schemas/corpus/PanelTestProvider_toast_notification\.messages\.json # Ignore Pocket component build and dev assets ^browser/components/pocket/content/panels/css/main\.compiled\.css\.map diff --git a/.prettierignore b/.prettierignore index 2993ddc97fe1..ab47dfa7c55b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1460,8 +1460,8 @@ browser/components/aboutwelcome/node_modules/ browser/components/asrouter/node_modules/ browser/components/asrouter/content/asrouter-admin.bundle.js browser/components/asrouter/logs/ -browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json -browser/components/newtab/content-src/asrouter/schemas/MessagingExperiment.schema.json +browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json +browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json browser/components/newtab/logs/ browser/components/newtab/node_modules/ browser/components/storybook/storybook-static/ diff --git a/browser/components/asrouter/README.md b/browser/components/asrouter/README.md deleted file mode 100644 index 213093af86f8..000000000000 --- a/browser/components/asrouter/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Activity Stream Router - -## Preferences `browser.newtab.activity-stream.asrouter.*` - -Name | Used for | Type | Example value ---- | --- | --- | --- -`allowHosts` | Allow a host in order to fetch messages from its endpoint | `[String]` | `["gist.github.com", "gist.githubusercontent.com", "localhost:8000"]` -`providers.cfr` | Message provider options for cfr | `Object` | [see below](#message-providers) -`providers.onboarding` | Message provider options for onboarding | `Object` | [see below](#message-providers) -`useRemoteL10n` | Controls whether to use the remote Fluent files for l10n, default as `true` | `Boolean` | `[true|false]` - -### Message providers examples - -```json -{ - "id" : "onboarding", - "enabled": true, - "type" : "local", - "localProvider" : "OnboardingMessageProvider" -} -``` - -### [Message format documentation](https://github.com/mozilla/activity-stream/blob/master/content-src/asrouter/schemas/message-format.md) diff --git a/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx b/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx index f16dbacbd803..315d7dfae60a 100644 --- a/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx +++ b/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx @@ -1473,7 +1473,7 @@ export class ASRouterAdminInner extends React.PureComponent { Need help using these tools? Check out our{" "} documentation diff --git a/browser/components/asrouter/content-src/schemas/message-format.md b/browser/components/asrouter/content-src/schemas/message-format.md deleted file mode 100644 index 65f031e26074..000000000000 --- a/browser/components/asrouter/content-src/schemas/message-format.md +++ /dev/null @@ -1,111 +0,0 @@ -## Activity Stream Router message format - -Field name | Type | Required | Description | Example / Note ---- | --- | --- | --- | --- -`id` | `string` | Yes | A unique identifier for the message that should not conflict with any other previous message | `ONBOARDING_1` -`template` | `string` | Yes | An id matching an existing Activity Stream Router template | -`content` | `object` | Yes | An object containing all variables/props to be rendered in the template. Subset of allowed tags detailed below. | [See example below](#html-subset) -`bundled` | `integer` | No | The number of messages of the same template this one should be shown with | [See example below](#a-bundled-message-example) -`order` | `integer` | No | If bundled with other messages of the same template, which order should this one be placed in? Defaults to 0 if no order is desired | [See example below](#a-bundled-message-example) -`campaign` | `string` | No | Campaign id that the message belongs to | `RustWebAssembly` -`targeting` | `string` `JEXL` | No | A [JEXL expression](http://normandy.readthedocs.io/en/latest/user/filter_expressions.html#jexl-basics) with all targeting information needed in order to decide if the message is shown | Not yet implemented, [Examples](#targeting-attributes) -`trigger` | `string` | No | An event or condition upon which the message will be immediately shown. This can be combined with `targeting`. Messages that define a trigger will not be shown during non-trigger-based passive message rotation. -`trigger.params` | `[string]` | No | A set of hostnames passed down as parameters to the trigger condition. Used to restrict the number of domains where the trigger/message is valid. | [See example below](#trigger-params) -`trigger.patterns` | `[string]` | No | A set of patterns that match multiple hostnames passed down as parameters to the trigger condition. Used to restrict the number of domains where the trigger/message is valid. | [See example below](#trigger-patterns) -`frequency` | `object` | No | A definition for frequency cap information for the message -`frequency.lifetime` | `integer` | No | The maximum number of lifetime impressions for the message. -`frequency.custom` | `array` | No | An array of frequency cap definition objects including `period`, a time period in milliseconds, and `cap`, a max number of impressions for that period. - -### Message example -```javascript -{ - weight: 100, - id: "PROTECTIONS_PANEL_1", - template: "protections_panel", - content: { - title: { - string_id: "cfr-protections-panel-header" - }, - body: { - string_id: "cfr-protections-panel-body" - }, - link_text: { - string_id: "cfr-protections-panel-link-text" - }, - cta_url: "https://support.mozilla.org/1/firefox/121.0a1/Darwin/en-US/etp-promotions?as=u&utm_source=inproduct", - cta_type: "OPEN_URL" - }, - trigger: { - id: "protectionsPanelOpen" - }, - groups: [], - provider: "onboarding" -} -``` - -### A Bundled Message example -The following 2 messages have a `bundled` property, indicating that they should be shown together, since they have the same template. The number `2` indicates that this message should be shown in a bundle of 2 messages of the same template. The order property defines that ONBOARDING_2 should be shown after ONBOARDING_3 in the bundle. -```javascript -{ - id: "ONBOARDING_2", - template: "onboarding", - bundled: 2, - order: 2, - content: { - title: "Private Browsing", - body: "Browse by yourself. Private Browsing with Tracking Protection blocks online trackers that follow you around the web." - }, - targeting: "", - trigger: "firstRun" -} -{ - id: "ONBOARDING_3", - template: "onboarding", - bundled: 2, - order: 1, - content: { - title: "Find it faster", - body: "Access all of your favorite search engines with a click. Search the whole Web or just one website from the search box." - }, - targeting: "", - trigger: "firstRun" -} -``` - -### HTML subset -The following tags are allowed in the content of a message: `i, b, u, strong, em, br`. - -Links cannot be rendered using regular anchor tags because [Fluent does not allow for href attributes](https://github.com/projectfluent/fluent.js/blob/a03d3aa833660f8c620738b26c80e46b1a4edb05/fluent-dom/src/overlay.js#L13). They will be wrapped in custom tags, for example `link` and the url will be provided as part of the payload: -``` -{ - "id": "7899", - "content": { - "text": "Use the CMD (CTRL) + T keyboard shortcut to open a new tab quickly!", - "links": { - "cta": { - "url": "https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly" - } - } - } -} -``` -If a tag that is not on the allowed is used, the text content will be extracted and displayed. - -Grouping multiple allowed elements is not possible, only the first level will be used: `text` will be interpreted as `text`. - -### Trigger params -A set of hostnames that need to exactly match the location of the selected tab in order for the trigger to execute. -``` -["github.com", "wwww.github.com"] -``` -More examples in the [CFRMessageProvider](https://github.com/mozilla/activity-stream/blob/e76ce12fbaaac1182aa492b84fc038f78c3acc33/lib/CFRMessageProvider.jsm#L40-L47). - -### Trigger patterns -A set of patterns that can match multiple hostnames. When the location of the selected tab matches one of the patterns it can execute a trigger. -``` -["*://*.github.com"] // can match `github.com` but also match `https://gist.github.com/` -``` -More [MatchPattern examples](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#Examples). - -### Targeting attributes -(This section has moved to [targeting-attributes.md](../docs/targeting-attributes.md)). diff --git a/browser/components/asrouter/content/asrouter-admin.bundle.js b/browser/components/asrouter/content/asrouter-admin.bundle.js index 3507088493ea..9c924896eb48 100644 --- a/browser/components/asrouter/content/asrouter-admin.bundle.js +++ b/browser/components/asrouter/content/asrouter-admin.bundle.js @@ -1910,7 +1910,7 @@ class ASRouterAdminInner extends (react__WEBPACK_IMPORTED_MODULE_1___default().P className: "icon icon-small-spacer icon-info" }), " ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("span", null, "Need help using these tools? Check out our", " ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("a", { target: "blank", - href: "https://firefox-source-docs.mozilla.org/browser/components/newtab/content-src/asrouter/docs/debugging-docs.html" + href: "https://firefox-source-docs.mozilla.org/browser/components/asrouter/docs/debugging-docs.html" }, "documentation"))), this.getSection())); } } diff --git a/browser/components/asrouter/tests/unit/TargetingDocs.test.js b/browser/components/asrouter/tests/unit/TargetingDocs.test.js index d00f971453cc..536049e64bc5 100644 --- a/browser/components/asrouter/tests/unit/TargetingDocs.test.js +++ b/browser/components/asrouter/tests/unit/TargetingDocs.test.js @@ -50,7 +50,7 @@ describe("ASRTargeting docs", () => { describe("All targeting params documented in targeting-attributes.md", () => { for (const targetingParam of ASRTargetingAttributes) { - // If this test is failing, you probably forgot to add docs to content-src/asrouter/targeting-attributes.md + // If this test is failing, you probably forgot to add docs to asrouter/docs/targeting-attributes.md // for a new targeting attribute, or you forgot to put it in the table of contents up top. it(`should have docs and table of contents entry for ${targetingParam}`, () => { assert.include( diff --git a/browser/components/urlbar/content/quicksuggestOnboarding.css b/browser/components/urlbar/content/quicksuggestOnboarding.css index 6ed8454398c9..97a1fa0390a1 100644 --- a/browser/components/urlbar/content/quicksuggestOnboarding.css +++ b/browser/components/urlbar/content/quicksuggestOnboarding.css @@ -4,7 +4,7 @@ /** * When making changes, follow the example of the AboutWelcome messaging surface for font sizes, line heights, - * etc. See: https://searchfox.org/mozilla-central/source/browser/components/newtab/content-src/aboutwelcome/aboutwelcome.scss + * etc. See: https://searchfox.org/mozilla-central/source/browser/components/aboutwelcome/content-src/aboutwelcome.scss */ :root { diff --git a/toolkit/components/messaging-system/schemas/TriggerActionSchemas/index.md b/toolkit/components/messaging-system/schemas/TriggerActionSchemas/index.md index 0d2f6dc89b31..85be613392e4 100644 --- a/toolkit/components/messaging-system/schemas/TriggerActionSchemas/index.md +++ b/toolkit/components/messaging-system/schemas/TriggerActionSchemas/index.md @@ -114,7 +114,7 @@ same reason, the trigger only fires after a 10-second delay. The trigger context includes an `event` and `type` that can be used in targeting. Possible events include `add`, `update`, and `use`. Possible types are `card` and `address`. This trigger is especially intended to be used in tandem with the -`creditCardsSaved` and `addressesSaved` [targeting attributes](../../../../../browser/components/newtab/content-src/asrouter/docs/targeting-attributes.md). +`creditCardsSaved` and `addressesSaved` [targeting attributes](/browser/components/asrouter/docs/targeting-attributes.md). ```js { diff --git a/tools/rewriting/Generated.txt b/tools/rewriting/Generated.txt index 419a2db32845..181f1656d367 100644 --- a/tools/rewriting/Generated.txt +++ b/tools/rewriting/Generated.txt @@ -7,8 +7,8 @@ browser/components/aboutwelcome/node_modules/ browser/components/asrouter/node_modules/ browser/components/asrouter/content/asrouter-admin.bundle.js browser/components/asrouter/logs/ -browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json -browser/components/newtab/content-src/asrouter/schemas/MessagingExperiment.schema.json +browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json +browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json browser/components/newtab/logs/ browser/components/newtab/node_modules/ browser/components/storybook/storybook-static/