@adobe/alloy 2.29.0-beta.13 → 2.29.0-beta.14
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/libEs5/components/PushNotifications/helpers/getPushSubscriptionDetails.js +6 -2
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/utils/bytes.js +12 -1
- package/libEs6/components/PushNotifications/helpers/getPushSubscriptionDetails.js +6 -2
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/utils/bytes.js +12 -1
- package/package.json +2 -2
- package/types/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts.map +1 -1
- package/types/utils/bytes.d.ts +3 -1
- package/types/utils/bytes.d.ts.map +1 -1
|
@@ -90,8 +90,12 @@ const getPushSubscriptionDetails = async ({
|
|
|
90
90
|
return {
|
|
91
91
|
endpoint: subscription.endpoint,
|
|
92
92
|
keys: {
|
|
93
|
-
p256dh: (0, _index.bytesToBase64)(new Uint8Array(subscription.getKey("p256dh"))
|
|
94
|
-
|
|
93
|
+
p256dh: (0, _index.bytesToBase64)(new Uint8Array(subscription.getKey("p256dh")), {
|
|
94
|
+
urlSafe: true
|
|
95
|
+
}),
|
|
96
|
+
auth: (0, _index.bytesToBase64)(new Uint8Array(subscription.getKey("auth")), {
|
|
97
|
+
urlSafe: true
|
|
98
|
+
})
|
|
95
99
|
}
|
|
96
100
|
};
|
|
97
101
|
} catch (e) {
|
|
@@ -14,4 +14,4 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = exports.default = "2.29.0-beta.
|
|
17
|
+
var _default = exports.default = "2.29.0-beta.14";
|
package/libEs5/utils/bytes.js
CHANGED
|
@@ -31,8 +31,19 @@ const base64ToBytes = base64String => {
|
|
|
31
31
|
/**
|
|
32
32
|
* Takes a Uint8Array and returns a base64 string.
|
|
33
33
|
* @param {Uint8Array} bytes
|
|
34
|
+
* @param {Object} [options={}] - Options for encoding
|
|
35
|
+
* @param {boolean} [options.urlSafe=false] - Whether to return URL-safe base64 (no padding, + becomes -, / becomes _)
|
|
34
36
|
* @returns {string}
|
|
35
37
|
*/
|
|
36
38
|
exports.base64ToBytes = base64ToBytes;
|
|
37
|
-
const bytesToBase64 = bytes =>
|
|
39
|
+
const bytesToBase64 = (bytes, options = {}) => {
|
|
40
|
+
const {
|
|
41
|
+
urlSafe = false
|
|
42
|
+
} = options || {};
|
|
43
|
+
const base64 = btoa(String.fromCharCode(...bytes));
|
|
44
|
+
if (urlSafe) {
|
|
45
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
46
|
+
}
|
|
47
|
+
return base64;
|
|
48
|
+
};
|
|
38
49
|
exports.bytesToBase64 = bytesToBase64;
|
|
@@ -88,8 +88,12 @@ const getPushSubscriptionDetails = async ({
|
|
|
88
88
|
return {
|
|
89
89
|
endpoint: subscription.endpoint,
|
|
90
90
|
keys: {
|
|
91
|
-
p256dh: bytesToBase64(new Uint8Array(subscription.getKey("p256dh"))
|
|
92
|
-
|
|
91
|
+
p256dh: bytesToBase64(new Uint8Array(subscription.getKey("p256dh")), {
|
|
92
|
+
urlSafe: true
|
|
93
|
+
}),
|
|
94
|
+
auth: bytesToBase64(new Uint8Array(subscription.getKey("auth")), {
|
|
95
|
+
urlSafe: true
|
|
96
|
+
})
|
|
93
97
|
}
|
|
94
98
|
};
|
|
95
99
|
} catch (e) {
|
package/libEs6/utils/bytes.js
CHANGED
|
@@ -28,6 +28,17 @@ export const base64ToBytes = base64String => {
|
|
|
28
28
|
/**
|
|
29
29
|
* Takes a Uint8Array and returns a base64 string.
|
|
30
30
|
* @param {Uint8Array} bytes
|
|
31
|
+
* @param {Object} [options={}] - Options for encoding
|
|
32
|
+
* @param {boolean} [options.urlSafe=false] - Whether to return URL-safe base64 (no padding, + becomes -, / becomes _)
|
|
31
33
|
* @returns {string}
|
|
32
34
|
*/
|
|
33
|
-
export const bytesToBase64 = bytes =>
|
|
35
|
+
export const bytesToBase64 = (bytes, options = {}) => {
|
|
36
|
+
const {
|
|
37
|
+
urlSafe = false
|
|
38
|
+
} = options || {};
|
|
39
|
+
const base64 = btoa(String.fromCharCode(...bytes));
|
|
40
|
+
if (urlSafe) {
|
|
41
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
42
|
+
}
|
|
43
|
+
return base64;
|
|
44
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.29.0-beta.
|
|
3
|
+
"version": "2.29.0-beta.14",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "libEs5/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"uuid": "^11.1.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@adobe/alloy": "^2.29.0-beta.
|
|
97
|
+
"@adobe/alloy": "^2.29.0-beta.13",
|
|
98
98
|
"@babel/cli": "^7.28.3",
|
|
99
99
|
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
100
100
|
"@babel/plugin-transform-runtime": "^7.28.3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPushSubscriptionDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/getPushSubscriptionDetails.js"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wEAhBG;IAAwB,cAAc,EAA9B,MAAM;IACU,MAAM,EAAtB,MAAM;CAEd,GAAU,OAAO,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"getPushSubscriptionDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/getPushSubscriptionDetails.js"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wEAhBG;IAAwB,cAAc,EAA9B,MAAM;IACU,MAAM,EAAtB,MAAM;CAEd,GAAU,OAAO,CAAC,gBAAgB,CAAC,CA6FrC;sCA3GqC,aAAa"}
|
package/types/utils/bytes.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/utils/bytes.js"],"names":[],"mappings":"AAiBO,4CAHI,MAAM,GACJ,UAAU,CAWtB;
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/utils/bytes.js"],"names":[],"mappings":"AAiBO,4CAHI,MAAM,GACJ,UAAU,CAWtB;AASM,qCALI,UAAU,YAElB;IAA0B,OAAO,GAAzB,OAAO;CACf,GAAU,MAAM,CAWlB"}
|