onesignal-expo-plugin 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/index.d.ts +1 -95
- package/dist/index.js +22 -23
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.js +7 -0
- package/dist/types-BKWSKFuI.d.ts +96 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -58,19 +58,18 @@ Add the plugin to the **front** of the [plugin array](https://docs.expo.dev/vers
|
|
|
58
58
|
|
|
59
59
|
or
|
|
60
60
|
|
|
61
|
-
**app.config.js**
|
|
61
|
+
**app.config.js/ts**
|
|
62
62
|
|
|
63
63
|
```js
|
|
64
|
+
import withOneSignal from 'onesignal-expo-plugin/plugin';
|
|
65
|
+
|
|
64
66
|
export default {
|
|
65
67
|
...
|
|
66
68
|
plugins: [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
]
|
|
69
|
+
withOneSignal({
|
|
70
|
+
mode: 'development',
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
74
73
|
};
|
|
75
74
|
```
|
|
76
75
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,100 +1,6 @@
|
|
|
1
|
+
import { t as OneSignalPluginProps } from "./types-BKWSKFuI.js";
|
|
1
2
|
import { ConfigPlugin } from "expo/config-plugins.js";
|
|
2
3
|
|
|
3
|
-
//#region src/types/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for the iOS Widget Extension target that hosts Live Activities.
|
|
6
|
-
*/
|
|
7
|
-
type OneSignalLiveActivityProps = {
|
|
8
|
-
/**
|
|
9
|
-
* (optional) Custom widget extension target name. Defaults to "OneSignalWidget".
|
|
10
|
-
* The full bundle identifier becomes "{ios.bundleIdentifier}.{bundleIdentifierSuffix ?? targetName}".
|
|
11
|
-
*/
|
|
12
|
-
targetName?: string;
|
|
13
|
-
/**
|
|
14
|
-
* (optional) Suffix appended to ios.bundleIdentifier for the widget extension. Defaults to targetName.
|
|
15
|
-
*/
|
|
16
|
-
bundleIdentifierSuffix?: string;
|
|
17
|
-
/**
|
|
18
|
-
* (optional) Local path to a custom Live Activity widget Swift file. If omitted, ships a default
|
|
19
|
-
* widget built on `DefaultLiveActivityAttributes` so it works with `OneSignal.LiveActivities.setupDefault()`.
|
|
20
|
-
*/
|
|
21
|
-
widgetFilePath?: string;
|
|
22
|
-
/**
|
|
23
|
-
* (optional) IPHONEOS_DEPLOYMENT_TARGET for the widget extension. Defaults to "16.2" (ActivityKit minimum).
|
|
24
|
-
* Values below 16.2 are clamped with a warning. Independent of the NSE's `iPhoneDeploymentTarget` prop.
|
|
25
|
-
*/
|
|
26
|
-
deploymentTarget?: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* OneSignalPluginProps refer to the properties set by the user in their app config file (e.g: app.json)
|
|
30
|
-
*/
|
|
31
|
-
type OneSignalPluginProps = {
|
|
32
|
-
/**
|
|
33
|
-
* (required) Used to configure APNs environment entitlement. "development" or "production"
|
|
34
|
-
*/
|
|
35
|
-
mode: 'development' | 'production';
|
|
36
|
-
/**
|
|
37
|
-
* (optional) Used to configure Apple Team ID. You can find your Apple Team ID by running expo credentials:manager e.g: "91SW8A37CR"
|
|
38
|
-
* @deprecated Use `ios.appleTeamId` in your Expo config instead. This prop will be removed in a future major release.
|
|
39
|
-
*/
|
|
40
|
-
devTeam?: string;
|
|
41
|
-
/**
|
|
42
|
-
* (optional) Target IPHONEOS_DEPLOYMENT_TARGET value to be used when adding the iOS NSE. A deployment target is nothing more than
|
|
43
|
-
* the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "12.0".
|
|
44
|
-
*/
|
|
45
|
-
iPhoneDeploymentTarget?: string;
|
|
46
|
-
/**
|
|
47
|
-
* (optional) The small notification icons for Android. Images will be automatically scaled up/down, the recommended size
|
|
48
|
-
* is 96x96 to always scale down.
|
|
49
|
-
*/
|
|
50
|
-
smallIcons?: string[];
|
|
51
|
-
/**
|
|
52
|
-
* (optional) The accent color to use for notification icons on Android. Must be a valid Android color resource, for example: "#FF0000"
|
|
53
|
-
*/
|
|
54
|
-
smallIconAccentColor?: string;
|
|
55
|
-
/**
|
|
56
|
-
* (optional) The large notification icons for Android. Images will be automatically scaled up/down to 256x256.
|
|
57
|
-
*/
|
|
58
|
-
largeIcons?: string[];
|
|
59
|
-
/**
|
|
60
|
-
* (optional) Local path to a custom Notification Service Extension (NSE) source file.
|
|
61
|
-
* Both Swift (`.swift`) and Objective-C (`.m`) are supported. For `.m`, an optional sibling
|
|
62
|
-
* `NotificationService.h` will be picked up if present; otherwise the plugin's default header
|
|
63
|
-
* is used. Typically a copy of `serviceExtensionFiles/NotificationService.swift` or
|
|
64
|
-
* `NotificationService.m`, altered to support custom logic.
|
|
65
|
-
*/
|
|
66
|
-
iosNSEFilePath?: string;
|
|
67
|
-
/**
|
|
68
|
-
* (optional) Used to configure a custom iOS app group name. If not provided, defaults to "group.{ios.bundleIdentifier}.onesignal".
|
|
69
|
-
* @see https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-create-an-app-group
|
|
70
|
-
*/
|
|
71
|
-
appGroupName?: string;
|
|
72
|
-
/**
|
|
73
|
-
* (optional) Used to configure a custom bundle identifier suffix for the iOS Notification Service Extension.
|
|
74
|
-
* The full bundle identifier will be "{ios.bundleIdentifier}.{nseBundleIdentifier}".
|
|
75
|
-
* If not provided, defaults to "OneSignalNotificationServiceExtension".
|
|
76
|
-
*/
|
|
77
|
-
nseBundleIdentifier?: string;
|
|
78
|
-
/**
|
|
79
|
-
* (optional) If true, the iOS Notification Service Extension (NSE) will not be added to the project.
|
|
80
|
-
* The NSE is required for badges, confirmed delivery, media attachments, and action buttons.
|
|
81
|
-
* Only disable if you only need basic push notifications.
|
|
82
|
-
*/
|
|
83
|
-
disableNSE?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* (optional) An array of local paths to custom notification sound files (.wav only).
|
|
86
|
-
* Files are added to the iOS app bundle and Android res/raw/.
|
|
87
|
-
* @see https://documentation.onesignal.com/docs/customize-notification-sounds
|
|
88
|
-
*/
|
|
89
|
-
sounds?: string[];
|
|
90
|
-
/**
|
|
91
|
-
* (optional) Opt in to scaffolding an iOS Widget Extension target for Live Activities.
|
|
92
|
-
* Presence of this prop enables Live Activity setup. Requires iOS 16.1+ and a .p8 APNs key.
|
|
93
|
-
* @see https://documentation.onesignal.com/docs/cross-platform-live-activity-setup
|
|
94
|
-
*/
|
|
95
|
-
liveActivities?: OneSignalLiveActivityProps;
|
|
96
|
-
};
|
|
97
|
-
//#endregion
|
|
98
4
|
//#region src/onesignal/withOneSignal.d.ts
|
|
99
5
|
declare const withOneSignal: ConfigPlugin<OneSignalPluginProps>;
|
|
100
6
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -28,21 +28,6 @@ let _expo_image_utils = require("@expo/image-utils");
|
|
|
28
28
|
let expo_config_plugins_js = require("expo/config-plugins.js");
|
|
29
29
|
let fs_promises = require("fs/promises");
|
|
30
30
|
fs_promises = __toESM(fs_promises);
|
|
31
|
-
//#region src/types/types.ts
|
|
32
|
-
const ONESIGNAL_PLUGIN_PROPS = [
|
|
33
|
-
"mode",
|
|
34
|
-
"devTeam",
|
|
35
|
-
"iPhoneDeploymentTarget",
|
|
36
|
-
"smallIcons",
|
|
37
|
-
"largeIcons",
|
|
38
|
-
"iosNSEFilePath",
|
|
39
|
-
"smallIconAccentColor",
|
|
40
|
-
"appGroupName",
|
|
41
|
-
"nseBundleIdentifier",
|
|
42
|
-
"disableNSE",
|
|
43
|
-
"sounds",
|
|
44
|
-
"liveActivities"
|
|
45
|
-
];
|
|
46
31
|
const TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
47
32
|
const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
|
|
48
33
|
const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
|
|
@@ -83,6 +68,26 @@ var OneSignalLog = class {
|
|
|
83
68
|
//#region src/support/helpers.ts
|
|
84
69
|
const HEX_COLOR_6_REGEX = /^#?[0-9A-Fa-f]{6}$/;
|
|
85
70
|
const HEX_COLOR_8_REGEX = /^#?[0-9A-Fa-f]{8}$/;
|
|
71
|
+
const ONESIGNAL_PLUGIN_PROPS = [
|
|
72
|
+
"mode",
|
|
73
|
+
"devTeam",
|
|
74
|
+
"iPhoneDeploymentTarget",
|
|
75
|
+
"smallIcons",
|
|
76
|
+
"largeIcons",
|
|
77
|
+
"iosNSEFilePath",
|
|
78
|
+
"smallIconAccentColor",
|
|
79
|
+
"appGroupName",
|
|
80
|
+
"nseBundleIdentifier",
|
|
81
|
+
"disableNSE",
|
|
82
|
+
"sounds",
|
|
83
|
+
"liveActivities"
|
|
84
|
+
];
|
|
85
|
+
const LIVE_ACTIVITY_PROPS = [
|
|
86
|
+
"targetName",
|
|
87
|
+
"bundleIdentifierSuffix",
|
|
88
|
+
"widgetFilePath",
|
|
89
|
+
"deploymentTarget"
|
|
90
|
+
];
|
|
86
91
|
/**
|
|
87
92
|
* Converts a hex color string (#RGB, #RRGGBB, or #AARRGGBB) to an
|
|
88
93
|
* 8-character ARGB hex string (no '#') expected by the OneSignal Android SDK.
|
|
@@ -118,19 +123,13 @@ function validatePluginProps(props) {
|
|
|
118
123
|
if (props.liveActivities !== void 0) {
|
|
119
124
|
if (props.liveActivities === null || Array.isArray(props.liveActivities) || typeof props.liveActivities !== "object") throw new Error("OneSignal Expo Plugin: 'liveActivities' must be an object.");
|
|
120
125
|
const liveActivities = props.liveActivities;
|
|
121
|
-
const liveActivityProps = [
|
|
122
|
-
"targetName",
|
|
123
|
-
"bundleIdentifierSuffix",
|
|
124
|
-
"widgetFilePath",
|
|
125
|
-
"deploymentTarget"
|
|
126
|
-
];
|
|
127
126
|
for (const prop of Object.keys(liveActivities)) {
|
|
128
|
-
if (!
|
|
127
|
+
if (!LIVE_ACTIVITY_PROPS.some((allowedProp) => allowedProp === prop)) throw new Error(`OneSignal Expo Plugin: You have provided an invalid property "${prop}" to 'liveActivities'.`);
|
|
129
128
|
if (typeof liveActivities[prop] !== "string") throw new Error(`OneSignal Expo Plugin: 'liveActivities.${prop}' must be a string.`);
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
const inputProps = Object.keys(props);
|
|
133
|
-
for (const prop of inputProps) if (!ONESIGNAL_PLUGIN_PROPS.
|
|
132
|
+
for (const prop of inputProps) if (!ONESIGNAL_PLUGIN_PROPS.some((allowedProp) => allowedProp === prop)) throw new Error(`OneSignal Expo Plugin: You have provided an invalid property "${prop}" to the OneSignal plugin.`);
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
135
|
* Detect whether the customer's NSE is Swift or Objective-C from `iosNSEFilePath`.
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as OneSignalPluginProps } from "./types-BKWSKFuI.js";
|
|
2
|
+
|
|
3
|
+
//#region package.json.d.ts
|
|
4
|
+
declare let name: string;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/onesignal/plugin.d.ts
|
|
7
|
+
declare const withOneSignal: (props: OneSignalPluginProps) => [typeof name, OneSignalPluginProps];
|
|
8
|
+
export = withOneSignal;
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the iOS Widget Extension target that hosts Live Activities.
|
|
4
|
+
*/
|
|
5
|
+
type OneSignalLiveActivityProps = {
|
|
6
|
+
/**
|
|
7
|
+
* (optional) Custom widget extension target name. Defaults to "OneSignalWidget".
|
|
8
|
+
* The full bundle identifier becomes "{ios.bundleIdentifier}.{bundleIdentifierSuffix ?? targetName}".
|
|
9
|
+
*/
|
|
10
|
+
targetName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* (optional) Suffix appended to ios.bundleIdentifier for the widget extension. Defaults to targetName.
|
|
13
|
+
*/
|
|
14
|
+
bundleIdentifierSuffix?: string;
|
|
15
|
+
/**
|
|
16
|
+
* (optional) Local path to a custom Live Activity widget Swift file. If omitted, ships a default
|
|
17
|
+
* widget built on `DefaultLiveActivityAttributes` so it works with `OneSignal.LiveActivities.setupDefault()`.
|
|
18
|
+
*/
|
|
19
|
+
widgetFilePath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* (optional) IPHONEOS_DEPLOYMENT_TARGET for the widget extension. Defaults to "16.2" (ActivityKit minimum).
|
|
22
|
+
* Values below 16.2 are clamped with a warning. Independent of the NSE's `iPhoneDeploymentTarget` prop.
|
|
23
|
+
*/
|
|
24
|
+
deploymentTarget?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* OneSignalPluginProps refer to the properties set by the user in their app config file (e.g: app.json)
|
|
28
|
+
*/
|
|
29
|
+
type OneSignalPluginProps = {
|
|
30
|
+
/**
|
|
31
|
+
* (required) Used to configure APNs environment entitlement. "development" or "production"
|
|
32
|
+
*/
|
|
33
|
+
mode: 'development' | 'production';
|
|
34
|
+
/**
|
|
35
|
+
* (optional) Used to configure Apple Team ID. You can find your Apple Team ID by running expo credentials:manager e.g: "91SW8A37CR"
|
|
36
|
+
* @deprecated Use `ios.appleTeamId` in your Expo config instead. This prop will be removed in a future major release.
|
|
37
|
+
*/
|
|
38
|
+
devTeam?: string;
|
|
39
|
+
/**
|
|
40
|
+
* (optional) Target IPHONEOS_DEPLOYMENT_TARGET value to be used when adding the iOS NSE. A deployment target is nothing more than
|
|
41
|
+
* the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "12.0".
|
|
42
|
+
*/
|
|
43
|
+
iPhoneDeploymentTarget?: string;
|
|
44
|
+
/**
|
|
45
|
+
* (optional) The small notification icons for Android. Images will be automatically scaled up/down, the recommended size
|
|
46
|
+
* is 96x96 to always scale down.
|
|
47
|
+
*/
|
|
48
|
+
smallIcons?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* (optional) The accent color to use for notification icons on Android. Must be a valid Android color resource, for example: "#FF0000"
|
|
51
|
+
*/
|
|
52
|
+
smallIconAccentColor?: string;
|
|
53
|
+
/**
|
|
54
|
+
* (optional) The large notification icons for Android. Images will be automatically scaled up/down to 256x256.
|
|
55
|
+
*/
|
|
56
|
+
largeIcons?: string[];
|
|
57
|
+
/**
|
|
58
|
+
* (optional) Local path to a custom Notification Service Extension (NSE) source file.
|
|
59
|
+
* Both Swift (`.swift`) and Objective-C (`.m`) are supported. For `.m`, an optional sibling
|
|
60
|
+
* `NotificationService.h` will be picked up if present; otherwise the plugin's default header
|
|
61
|
+
* is used. Typically a copy of `serviceExtensionFiles/NotificationService.swift` or
|
|
62
|
+
* `NotificationService.m`, altered to support custom logic.
|
|
63
|
+
*/
|
|
64
|
+
iosNSEFilePath?: string;
|
|
65
|
+
/**
|
|
66
|
+
* (optional) Used to configure a custom iOS app group name. If not provided, defaults to "group.{ios.bundleIdentifier}.onesignal".
|
|
67
|
+
* @see https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-create-an-app-group
|
|
68
|
+
*/
|
|
69
|
+
appGroupName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* (optional) Used to configure a custom bundle identifier suffix for the iOS Notification Service Extension.
|
|
72
|
+
* The full bundle identifier will be "{ios.bundleIdentifier}.{nseBundleIdentifier}".
|
|
73
|
+
* If not provided, defaults to "OneSignalNotificationServiceExtension".
|
|
74
|
+
*/
|
|
75
|
+
nseBundleIdentifier?: string;
|
|
76
|
+
/**
|
|
77
|
+
* (optional) If true, the iOS Notification Service Extension (NSE) will not be added to the project.
|
|
78
|
+
* The NSE is required for badges, confirmed delivery, media attachments, and action buttons.
|
|
79
|
+
* Only disable if you only need basic push notifications.
|
|
80
|
+
*/
|
|
81
|
+
disableNSE?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* (optional) An array of local paths to custom notification sound files (.wav only).
|
|
84
|
+
* Files are added to the iOS app bundle and Android res/raw/.
|
|
85
|
+
* @see https://documentation.onesignal.com/docs/customize-notification-sounds
|
|
86
|
+
*/
|
|
87
|
+
sounds?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* (optional) Opt in to scaffolding an iOS Widget Extension target for Live Activities.
|
|
90
|
+
* Presence of this prop enables Live Activity setup. Requires iOS 16.1+ and a .p8 APNs key.
|
|
91
|
+
* @see https://documentation.onesignal.com/docs/cross-platform-live-activity-setup
|
|
92
|
+
*/
|
|
93
|
+
liveActivities?: OneSignalLiveActivityProps;
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
export { OneSignalPluginProps as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "OneSignal Expo config plugin for adding iOS and Android push notification support to managed Expo apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"EAS",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"default": "./dist/index.js"
|
|
32
32
|
},
|
|
33
|
+
"./plugin": {
|
|
34
|
+
"types": "./dist/plugin.d.ts",
|
|
35
|
+
"default": "./dist/plugin.js"
|
|
36
|
+
},
|
|
33
37
|
"./package.json": "./package.json"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|