# PWA.json

All Marfeel sites come with a pwa.json pre-configured at scaffold-time. The ALOT team owns this file.

This file allows configuring 2 major PWA features: offline access and push notifications provider.

The default pwa.json contains a OneSignal app id called marfeelPush: it belongs to Marfeel OneSignal account.

Example of a default file:

{
  "pwa" : -1,
  "marfeelPush" : [ {
    "name" : "oneSignal",
    "appId" : "123456-a123-4b56-7c89-0123456789"
  } ]
}

# Provider configuration

Tenants can replace the default marfeelPush object by a oneSignal object with their own id via MarfeelStudio. If the PWA is not active yet, and the MarfeelStudio screen is only displaying the wizard, the file can be directly modified by Marfeel developers in the site repository.

Only one push notification provider can be configured at any given time for the PWA.

Pushwoosh

However, it is possible to have configured both MarfeelPush for the PWA and PushWoosh for the native app.

# PWA number configuration

The pwa number in the json file represents the current status of the site's PWA. It determines the service worker's caching strategy (opens new window) in addition to the push notifications.

  • -1 is the default: it means the configuration is inferred at compilation-time depending on the tenant's features.

TIP

Unless a tenant asks to deactivate a specific feature, the default should not be modified.

The following table shows all the possible values and what they represent:

PWA Number Mobile Push notifications Desktop Push notifications Offline access Explanation
0 Disables everything
2 x x Mobile Push Notifications & offline access
4 x x Desktop Push Notifications & offline access
6 x x x Mobile & Desktop Push Notifications & offline access
10 x Only Mobile Push Notifications
12 x Only Desktop Push Notifications
14 x x Mobile & Desktop Push Notifications
16 x Only offline access

Other values

The PWA number used to be a bitset representation of features. Some of those features don't exist anymore: older configurations might have a value set which is not in this array: it is invalid and should be modified.

The following table contains all the historical values. Use it to understand what an outdated value means, and to replace it with its up-to-date counterpart.

Legacy values
PWA Number Mobile Push notifications Desktop Push notifications Offline access Explanation
0 Disables everything
1 x Only offline access
2 x x Mobile Push Notifications & offline access
3 x x Mobile Push Notifications & offline access
4 x x Desktop Push Notifications & offline access
5 x x Desktop Push Notifications & offline access
6 x x x Mobile & Desktop Push Notifications & offline access
7 x x x Mobile & Desktop Push Notifications & offline access
8 Disables everything
9 Disables everything
10 x Only Mobile Push Notifications
11 x Only Mobile Push Notifications
12 x Only Desktop Push Notifications
13 x Only Desktop Push Notifications
14 x x Mobile & Desktop Push Notifications
15 x x Mobile & Desktop Push Notifications
16 x Only offline access
17 x Only offline access
18 x x Mobile Push Notifications & offline access
19 x x Mobile Push Notifications & offline access
20 x x Desktop Push Notifications & offline access
21 x x Desktop Push Notifications & offline access
22 x x x Mobile & Desktop Push Notifications & offline access
23 x x x Mobile & Desktop Push Notifications & offline access
24 x Only offline access
25 x Only offline access
26 x x Mobile Push Notifications & offline access
27 x x Mobile Push Notifications & offline access
28 x x Desktop Push Notifications & offline access
29 x x Desktop Push Notifications & offline access
30 x x x Mobile & Desktop Push Notifications & offline access
31 x x x Mobile & Desktop Push Notifications & offline access

:::

# Desktop Push notifications

Desktop Push notifications are always disabled by default.

To enable Desktop Push notifications, overwrite the default pwa value with the right number. Take into account the currently active features (mobile notifications and/or offline access), and add the right value to activate Desktop Push notifications.

For example, if the current number is 0, put 4. If the current number is 10, put 14.

# Legacy implementation

Legacy tenants have their PWA configuration in the definition.json rather than the pwa.json file.

The content of the definition's pwa object has priority over the pwa.json file. However, the content is interpreted exactly the same way, no matter its source.