@adobe/alloy 2.29.0 → 2.30.0-beta.1
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/constants.js +19 -0
- package/libEs5/components/PushNotifications/helpers/readFromIndexedDb.js +41 -0
- package/libEs5/components/PushNotifications/helpers/saveToIndexedDb.js +50 -0
- package/libEs5/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +85 -0
- package/libEs5/components/PushNotifications/helpers/serviceWorkerPushListener.js +70 -0
- package/libEs5/components/PushNotifications/index.js +43 -10
- package/libEs5/components/PushNotifications/request/createSendPushSubscriptionPayload.js +3 -3
- package/libEs5/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +8 -3
- package/libEs5/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +146 -0
- package/libEs5/components/PushNotifications/serviceWorker.js +91 -0
- package/libEs5/components/PushNotifications/types.js +81 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/utils/index.js +19 -0
- package/libEs5/utils/indexedDb.js +73 -0
- package/libEs6/components/PushNotifications/helpers/constants.js +16 -0
- package/libEs6/components/PushNotifications/helpers/readFromIndexedDb.js +40 -0
- package/libEs6/components/PushNotifications/helpers/saveToIndexedDb.js +48 -0
- package/libEs6/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +82 -0
- package/libEs6/components/PushNotifications/helpers/serviceWorkerPushListener.js +69 -0
- package/libEs6/components/PushNotifications/index.js +43 -10
- package/libEs6/components/PushNotifications/request/createSendPushSubscriptionPayload.js +3 -3
- package/libEs6/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +8 -3
- package/libEs6/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +146 -0
- package/libEs6/components/PushNotifications/serviceWorker.js +90 -0
- package/libEs6/components/PushNotifications/types.js +81 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/utils/index.js +1 -0
- package/libEs6/utils/indexedDb.js +67 -0
- package/package.json +29 -36
- package/scripts/alloyBuilder.js +130 -4
- package/types/components/PushNotifications/helpers/constants.d.ts +5 -0
- package/types/components/PushNotifications/helpers/constants.d.ts.map +1 -0
- package/types/components/PushNotifications/helpers/readFromIndexedDb.d.ts +4 -0
- package/types/components/PushNotifications/helpers/readFromIndexedDb.d.ts.map +1 -0
- package/types/components/PushNotifications/helpers/saveToIndexedDb.d.ts +9 -0
- package/types/components/PushNotifications/helpers/saveToIndexedDb.d.ts.map +1 -0
- package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts +9 -0
- package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts.map +1 -0
- package/types/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts +8 -0
- package/types/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts.map +1 -0
- package/types/components/PushNotifications/index.d.ts +11 -3
- package/types/components/PushNotifications/index.d.ts.map +1 -1
- package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts +2 -2
- package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts.map +1 -1
- package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts +2 -1
- package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts.map +1 -1
- package/types/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts +11 -0
- package/types/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts.map +1 -0
- package/types/components/PushNotifications/serviceWorker.d.ts +2 -0
- package/types/components/PushNotifications/serviceWorker.d.ts.map +1 -0
- package/types/components/PushNotifications/types.d.ts +167 -0
- package/types/components/PushNotifications/types.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/indexedDb.d.ts +4 -0
- package/types/utils/indexedDb.d.ts.map +1 -0
package/scripts/alloyBuilder.js
CHANGED
|
@@ -12,6 +12,11 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import babel from "@babel/core";
|
|
15
|
+
import terser from "@rollup/plugin-terser";
|
|
16
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
17
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
18
|
+
import license from "rollup-plugin-license";
|
|
19
|
+
import { fileURLToPath } from "url";
|
|
15
20
|
import { checkbox, input, select } from "@inquirer/prompts";
|
|
16
21
|
import { Command, InvalidOptionArgumentError, Option } from "commander";
|
|
17
22
|
import fs from "fs";
|
|
@@ -21,6 +26,8 @@ import { buildConfig } from "../rollup.config.js";
|
|
|
21
26
|
import entryPointGeneratorBabelPlugin from "./helpers/entryPointGeneratorBabelPlugin.js";
|
|
22
27
|
import { getProjectRoot, safePathJoin } from "./helpers/path.js";
|
|
23
28
|
|
|
29
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
|
|
24
31
|
const packageJsonContent = fs.readFileSync(
|
|
25
32
|
safePathJoin(getProjectRoot(), "package.json"),
|
|
26
33
|
"utf8",
|
|
@@ -128,6 +135,57 @@ const build = async (argv) => {
|
|
|
128
135
|
);
|
|
129
136
|
};
|
|
130
137
|
|
|
138
|
+
const buildPushNotificationsServiceWorker = async (argv) => {
|
|
139
|
+
const outputPath = path.join(
|
|
140
|
+
argv.outputDir,
|
|
141
|
+
`alloyPushNotificationsServiceWorker${argv.minify ? ".min" : ""}.js`,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const plugins = [
|
|
145
|
+
resolve({
|
|
146
|
+
preferBuiltins: false,
|
|
147
|
+
// Support the browser field in dependencies' package.json.
|
|
148
|
+
// Useful for the uuid package.
|
|
149
|
+
mainFields: ["module", "main", "browser"],
|
|
150
|
+
}),
|
|
151
|
+
commonjs(),
|
|
152
|
+
];
|
|
153
|
+
if (argv.minify) {
|
|
154
|
+
plugins.push(terser());
|
|
155
|
+
plugins.push(
|
|
156
|
+
license({
|
|
157
|
+
cwd: path.join(dirname, ".."),
|
|
158
|
+
banner: {
|
|
159
|
+
content: {
|
|
160
|
+
file: path.join(dirname, "..", "license_banner"),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const rollupConfig = {
|
|
167
|
+
input: `${sourceRootPath}/components/PushNotifications/serviceWorker.js`,
|
|
168
|
+
output: [
|
|
169
|
+
{
|
|
170
|
+
file: outputPath,
|
|
171
|
+
format: "es",
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
plugins,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const bundle = await rollup(rollupConfig);
|
|
178
|
+
await bundle.write(rollupConfig.output[0]);
|
|
179
|
+
|
|
180
|
+
console.log(
|
|
181
|
+
`🎉 Wrote ${
|
|
182
|
+
path.isAbsolute(argv.outputDir)
|
|
183
|
+
? rollupConfig.output[0].file
|
|
184
|
+
: path.relative(process.cwd(), rollupConfig.output[0].file)
|
|
185
|
+
} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
131
189
|
const getMakeBuildCommand = () => {
|
|
132
190
|
const optionalComponentsParameters = getComponents().optional;
|
|
133
191
|
return new Command("build")
|
|
@@ -168,13 +226,11 @@ const getMakeBuildCommand = () => {
|
|
|
168
226
|
const stats = fs.statSync(value);
|
|
169
227
|
if (!stats.isDirectory()) {
|
|
170
228
|
throw new InvalidOptionArgumentError(
|
|
171
|
-
`
|
|
229
|
+
`"${value}" is not a valid directory path.`,
|
|
172
230
|
);
|
|
173
231
|
}
|
|
174
232
|
} catch (error) {
|
|
175
|
-
throw new InvalidOptionArgumentError(
|
|
176
|
-
`Output directory "${value}" is not a valid directory path. ${error.message}`,
|
|
177
|
-
);
|
|
233
|
+
throw new InvalidOptionArgumentError(error.message);
|
|
178
234
|
}
|
|
179
235
|
|
|
180
236
|
return value.replace(new RegExp(`${path.sep}+$`, "g"), "");
|
|
@@ -190,6 +246,74 @@ const getMakeBuildCommand = () => {
|
|
|
190
246
|
});
|
|
191
247
|
};
|
|
192
248
|
|
|
249
|
+
const getPushNotificationsServiceWorkerBuildCommand = () =>
|
|
250
|
+
new Command("build-sw")
|
|
251
|
+
.description("Build the s ervice worker.")
|
|
252
|
+
.addOption(
|
|
253
|
+
new Option("-m, --minify", "enable code minification").default(false),
|
|
254
|
+
)
|
|
255
|
+
.addOption(
|
|
256
|
+
new Option(
|
|
257
|
+
"-o, --outputDir <dir>",
|
|
258
|
+
"the output directory for the generated build",
|
|
259
|
+
)
|
|
260
|
+
.default(getProjectRoot())
|
|
261
|
+
.argParser((value) => {
|
|
262
|
+
if (!path.isAbsolute(value)) {
|
|
263
|
+
value = path.join(process.cwd(), value);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
try {
|
|
267
|
+
const stats = fs.statSync(value);
|
|
268
|
+
if (!stats.isDirectory()) {
|
|
269
|
+
throw new InvalidOptionArgumentError(
|
|
270
|
+
`"${value}" is not a valid directory path.`,
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
} catch (error) {
|
|
274
|
+
throw new InvalidOptionArgumentError(error.message);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return value.replace(new RegExp(`${path.sep}+$`, "g"), "");
|
|
278
|
+
}),
|
|
279
|
+
)
|
|
280
|
+
.action((opts) => {
|
|
281
|
+
return buildPushNotificationsServiceWorker(opts);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const getInteractivePushNotificationsServiceWorkerBuildCommand = () =>
|
|
285
|
+
new Command("interactive-build-sw")
|
|
286
|
+
.description(
|
|
287
|
+
"Interactive process that will ask a series of questions and then it will generate a service worker build.",
|
|
288
|
+
)
|
|
289
|
+
.action(async () => {
|
|
290
|
+
try {
|
|
291
|
+
const opts = {
|
|
292
|
+
minify: await select({
|
|
293
|
+
message: "How would you like your service worker JavaScript to be?",
|
|
294
|
+
choices: [
|
|
295
|
+
{ name: "Minified", value: true },
|
|
296
|
+
{ name: "Unminified", value: false },
|
|
297
|
+
],
|
|
298
|
+
}),
|
|
299
|
+
outputDir: await input({
|
|
300
|
+
message: "Where would you like to save the service worker build?",
|
|
301
|
+
default: process.cwd(),
|
|
302
|
+
}),
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
buildPushNotificationsServiceWorker(opts);
|
|
306
|
+
} catch (error) {
|
|
307
|
+
if (error.isTtyError) {
|
|
308
|
+
console.error(
|
|
309
|
+
"Prompt couldn't be rendered in the current environment",
|
|
310
|
+
);
|
|
311
|
+
} else if (error.name !== "ExitPromptError") {
|
|
312
|
+
console.error("An error occurred: ", error);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
193
317
|
const getInteractiveBuildCommand = () =>
|
|
194
318
|
new Command("interactive-build")
|
|
195
319
|
.description(
|
|
@@ -241,5 +365,7 @@ program
|
|
|
241
365
|
.version(version);
|
|
242
366
|
|
|
243
367
|
program.addCommand(getMakeBuildCommand());
|
|
368
|
+
program.addCommand(getPushNotificationsServiceWorkerBuildCommand());
|
|
244
369
|
program.addCommand(getInteractiveBuildCommand(), { isDefault: true });
|
|
370
|
+
program.addCommand(getInteractivePushNotificationsServiceWorkerBuildCommand());
|
|
245
371
|
program.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/constants.js"],"names":[],"mappings":"AAYA,sBAAuB,wBAAwB,CAAC;AAChD,yBAA0B,CAAC,CAAC;AAC5B,yBAA0B,QAAQ,CAAC;AACnC,wBAAyB,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readFromIndexedDb.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/readFromIndexedDb.js"],"names":[],"mappings":"AAyBe,kCAJJ,mBAAmB,GACjB,OAAO,CAAC,MAAO,SAAS,CAAC,CA2BrC;;yCArCwC,aAAa"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} data
|
|
3
|
+
* @param {Logger} logger
|
|
4
|
+
*
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
7
|
+
export default function saveToIndexedDB(data: any, logger: Logger): Promise<void>;
|
|
8
|
+
import type { Logger } from '../../../core/types.js';
|
|
9
|
+
//# sourceMappingURL=saveToIndexedDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveToIndexedDb.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/saveToIndexedDb.js"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH,2DAJW,MAAM,GAEJ,OAAO,CAAC,IAAI,CAAC,CAqCzB;4BAnD2B,wBAAwB"}
|
package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function _default({ event, sw, logger, fetch }: {
|
|
2
|
+
sw: ServiceWorkerGlobalScope;
|
|
3
|
+
event: NotificationEvent;
|
|
4
|
+
fetch: (url: string, options: object) => Promise<Response>;
|
|
5
|
+
logger: ServiceWorkerLogger;
|
|
6
|
+
}): void;
|
|
7
|
+
export default _default;
|
|
8
|
+
import type { ServiceWorkerLogger } from '../types.js';
|
|
9
|
+
//# sourceMappingURL=serviceWorkerNotificationClickListener.d.ts.map
|
package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceWorkerNotificationClickListener.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js"],"names":[],"mappings":"AAkCe,wDALZ;IAA0C,EAAE,EAApC,wBAAwB;IACG,KAAK,EAAhC,iBAAiB;IAC4C,KAAK,EAAlE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC;IACtB,MAAM,EAAnC,mBAAmB;CAC7B,QAkDA;;yCApEwC,aAAa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function _default({ sw, event, logger }: {
|
|
2
|
+
sw: ServiceWorkerGlobalScope;
|
|
3
|
+
event: PushEvent;
|
|
4
|
+
logger: ServiceWorkerLogger;
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
export default _default;
|
|
7
|
+
import type { ServiceWorkerLogger } from '../types.js';
|
|
8
|
+
//# sourceMappingURL=serviceWorkerPushListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceWorkerPushListener.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/helpers/serviceWorkerPushListener.js"],"names":[],"mappings":"AA4Be,iDALZ;IAA0C,EAAE,EAApC,wBAAwB;IACL,KAAK,EAAxB,SAAS;IACoB,MAAM,EAAnC,mBAAmB;CAC3B,GAAU,OAAO,CAAC,IAAI,CAAC,CA6CzB;;yCAvDwC,aAAa"}
|
|
@@ -3,20 +3,26 @@ export default createPushNotifications;
|
|
|
3
3
|
* @function
|
|
4
4
|
*
|
|
5
5
|
* @param {Object} options
|
|
6
|
-
* @param {{ orgId: string, pushNotifications: { vapidPublicKey: string }}} options.config
|
|
6
|
+
* @param {{ orgId: string, datastreamId: string, edgeDomain: string, edgeBasePath: string, pushNotifications: { vapidPublicKey: string, appId: string, trackingDatasetId: string }}} options.config
|
|
7
7
|
* @param {StorageCreator} options.createNamespacedStorage
|
|
8
8
|
* @param {EventManager} options.eventManager
|
|
9
9
|
* @param {Logger} options.logger
|
|
10
10
|
* @param {ConsentManager} options.consent
|
|
11
11
|
* @param {IdentityManager} options.identity
|
|
12
|
+
* @param {function(): string} options.getBrowser
|
|
12
13
|
* @param {EdgeRequestExecutor} options.sendEdgeNetworkRequest
|
|
13
|
-
* @returns {{
|
|
14
|
+
* @returns {{ lifecycle: object, commands: { sendPushSubscription: object } }}
|
|
14
15
|
*/
|
|
15
|
-
declare function createPushNotifications({ createNamespacedStorage, eventManager, config, logger, consent, identity, sendEdgeNetworkRequest, }: {
|
|
16
|
+
declare function createPushNotifications({ createNamespacedStorage, eventManager, config, logger, consent, identity, getBrowser, sendEdgeNetworkRequest, }: {
|
|
16
17
|
config: {
|
|
17
18
|
orgId: string;
|
|
19
|
+
datastreamId: string;
|
|
20
|
+
edgeDomain: string;
|
|
21
|
+
edgeBasePath: string;
|
|
18
22
|
pushNotifications: {
|
|
19
23
|
vapidPublicKey: string;
|
|
24
|
+
appId: string;
|
|
25
|
+
trackingDatasetId: string;
|
|
20
26
|
};
|
|
21
27
|
};
|
|
22
28
|
createNamespacedStorage: StorageCreator;
|
|
@@ -24,8 +30,10 @@ declare function createPushNotifications({ createNamespacedStorage, eventManager
|
|
|
24
30
|
logger: Logger;
|
|
25
31
|
consent: ConsentManager;
|
|
26
32
|
identity: IdentityManager;
|
|
33
|
+
getBrowser: () => string;
|
|
27
34
|
sendEdgeNetworkRequest: EdgeRequestExecutor;
|
|
28
35
|
}): {
|
|
36
|
+
lifecycle: object;
|
|
29
37
|
commands: {
|
|
30
38
|
sendPushSubscription: object;
|
|
31
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PushNotifications/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PushNotifications/index.js"],"names":[],"mappings":";AAgCA;;;;;;;;;;;;;GAaG;AACH,4JAVG;IAA2L,MAAM,EAAzL;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE;YAAE,cAAc,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,iBAAiB,EAAE,MAAM,CAAA;SAAE,CAAA;KAAC;IACjJ,uBAAuB,EAA/C,cAAc;IACQ,YAAY,EAAlC,YAAY;IACI,MAAM,EAAtB,MAAM;IACkB,OAAO,EAA/B,cAAc;IACW,QAAQ,EAAjC,eAAe;IACa,UAAU,EAAtC,MAAY,MAAM;IACW,sBAAsB,EAAnD,mBAAmB;CAC3B,GAAU;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE;QAAE,oBAAoB,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAwE7E;;;;;oCAxGmC,sBAAsB;kCAChB,qBAAqB;4BAArB,qBAAqB;oCAE3B,6BAA6B;qCAD5B,8BAA8B;yCAE1B,iCAAiC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare function _default({ ecid, eventManager, serializedPushSubscriptionDetails,
|
|
1
|
+
declare function _default({ ecid, eventManager, serializedPushSubscriptionDetails, appId, }: {
|
|
2
2
|
ecid: string;
|
|
3
3
|
eventManager: EventManager;
|
|
4
4
|
serializedPushSubscriptionDetails: string;
|
|
5
|
-
|
|
5
|
+
appId: string;
|
|
6
6
|
}): Promise<DataCollectionRequestPayload>;
|
|
7
7
|
export default _default;
|
|
8
8
|
import type { EventManager } from "../../../core/types.js";
|
package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSendPushSubscriptionPayload.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/request/createSendPushSubscriptionPayload.js"],"names":[],"mappings":"AAmCe,
|
|
1
|
+
{"version":3,"file":"createSendPushSubscriptionPayload.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/request/createSendPushSubscriptionPayload.js"],"names":[],"mappings":"AAmCe,6FAPZ;IAAwB,IAAI,EAApB,MAAM;IACgB,YAAY,EAAlC,YAAY;IACI,iCAAiC,EAAjD,MAAM;IACU,KAAK,EAArB,MAAM;CAEd,GAAU,OAAO,CAAC,4BAA4B,CAAC,CAgCjD;;kCArDiC,wBAAwB;kDACR,iCAAiC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
declare function _default({ config: { vapidPublicKey }, storage, logger, sendEdgeNetworkRequest, consent, eventManager, identity, window, }: {
|
|
1
|
+
declare function _default({ config: { vapidPublicKey, appId }, storage, logger, sendEdgeNetworkRequest, consent, eventManager, identity, window, }: {
|
|
2
2
|
config: {
|
|
3
3
|
vapidPublicKey: string;
|
|
4
|
+
appId: string;
|
|
4
5
|
};
|
|
5
6
|
storage: Storage;
|
|
6
7
|
logger: Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeSendPushSubscriptionRequest.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/request/makeSendPushSubscriptionRequest.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeSendPushSubscriptionRequest.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/request/makeSendPushSubscriptionRequest.js"],"names":[],"mappings":"AA+Ce,oJAXZ;IAAyD,MAAM,EAAvD;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC;IACtB,OAAO,EAAxB,OAAO;IACS,MAAM,EAAtB,MAAM;IACgB,YAAY,EAAlC,YAAY;IACa,QAAQ,EAAjC,eAAe;IACc,sBAAsB,EAAnD,mBAAmB;IACK,OAAO,EAA/B,cAAc;IACE,MAAM,EAAtB,MAAM;CAEd,GAAU,OAAO,CAAC,IAAI,CAAC,CAmDzB;;6BApF4B,yBAAyB;4BACZ,wBAAwB;kCAAxB,wBAAwB;qCAC7B,iCAAiC;yCAE7B,oCAAoC;oCADzC,gCAAgC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function _default({ xdm, actionLabel, applicationLaunches }: {
|
|
2
|
+
xdm: any;
|
|
3
|
+
actionLabel?: string;
|
|
4
|
+
applicationLaunches?: number;
|
|
5
|
+
}, { logger, fetch }: {
|
|
6
|
+
logger: ServiceWorkerLogger;
|
|
7
|
+
fetch: (url: string, options: object) => Promise<Response>;
|
|
8
|
+
}): Promise<boolean>;
|
|
9
|
+
export default _default;
|
|
10
|
+
import type { ServiceWorkerLogger } from '../types.js';
|
|
11
|
+
//# sourceMappingURL=makeSendServiceWorkerTrackingData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeSendServiceWorkerTrackingData.d.ts","sourceRoot":"","sources":["../../../../src/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js"],"names":[],"mappings":"AAkCe,qEAVZ;IAAwB,GAAG;IACF,WAAW,GAA5B,MAAM;IACW,mBAAmB,GAApC,MAAM;CACd,qBACA;IAAmC,MAAM,EAAjC,mBAAmB;IACwC,KAAK,EAAhE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC;CAE3D,GAAU,OAAO,CAAC,OAAO,CAAC,CAsH5B;;yCAvIwC,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceWorker.d.ts","sourceRoot":"","sources":["../../../src/components/PushNotifications/serviceWorker.js"],"names":[],"mappings":""}
|
|
@@ -6,6 +6,81 @@
|
|
|
6
6
|
* @property {string|null} keys.p256dh - The P-256 ECDH public key as an ArrayBuffer, or null if not available
|
|
7
7
|
* @property {string|null} keys.auth - The authentication secret as an ArrayBuffer, or null if not available
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} CustomerJourneyManagement
|
|
11
|
+
* @property {Object} messageExecution
|
|
12
|
+
* @property {string} messageExecution.messageExecutionID
|
|
13
|
+
* @property {string} messageExecution.messageID
|
|
14
|
+
* @property {string} messageExecution.messageType
|
|
15
|
+
* @property {string} messageExecution.campaignID
|
|
16
|
+
* @property {string} messageExecution.campaignVersionID
|
|
17
|
+
* @property {string} messageExecution.batchInstanceID
|
|
18
|
+
* @property {Object} [pushChannelContext]
|
|
19
|
+
* @property {"web"} [pushChannelContext.platform]
|
|
20
|
+
* @property {Object} [messageProfile]
|
|
21
|
+
* @property {Object} [messageProfile.channel]
|
|
22
|
+
* @property {string} [messageProfile.channel._id]
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} Decisioning
|
|
26
|
+
* @property {Object[]} propositions
|
|
27
|
+
* @property {Object} propositions[].scopeDetails
|
|
28
|
+
* @property {string} propositions[].scopeDetails.correlationID
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} XdmTrackingContext
|
|
32
|
+
* @property {Object} _experience
|
|
33
|
+
* @property {CustomerJourneyManagement} _experience.customerJourneyManagement
|
|
34
|
+
* @property {Decisioning} _experience.decisioning
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {Object} PushNotificationData
|
|
38
|
+
* @property {Object} web
|
|
39
|
+
* @property {string} web.title
|
|
40
|
+
* @property {string} web.body
|
|
41
|
+
* @property {string|null} web.media
|
|
42
|
+
* @property {Object} web.interaction
|
|
43
|
+
* @property {string} web.interaction.type
|
|
44
|
+
* @property {string|null} web.interaction.uri
|
|
45
|
+
* @property {Object} web.actions
|
|
46
|
+
* @property {Object[]} web.actions.buttons
|
|
47
|
+
* @property {string} web.actions.buttons[].label
|
|
48
|
+
* @property {string} web.actions.buttons[].type
|
|
49
|
+
* @property {string} web.actions.buttons[].uri
|
|
50
|
+
* @property {string} web.priority
|
|
51
|
+
* @property {Object} web._xdm
|
|
52
|
+
* @property {XdmTrackingContext} web._xdm.mixins
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} TrackingDataPayload
|
|
56
|
+
* @property {Object[]} events
|
|
57
|
+
* @property {Object} events[].xdm
|
|
58
|
+
* @property {Object} events[].xdm.identityMap
|
|
59
|
+
* @property {Object[]} events[].xdm.identityMap.ECID
|
|
60
|
+
* @property {string} events[].xdm.identityMap.ECID[].id
|
|
61
|
+
* @property {string} events[].xdm.timestamp
|
|
62
|
+
* @property {Object} events[].xdm.pushNotificationTracking
|
|
63
|
+
* @property {string} events[].xdm.pushNotificationTracking.pushProviderMessageID
|
|
64
|
+
* @property {string} events[].xdm.pushNotificationTracking.pushProvider
|
|
65
|
+
* @property {Object} [events[].xdm.pushNotificationTracking.customAction]
|
|
66
|
+
* @property {string} [events[].xdm.pushNotificationTracking.customAction.actionID]
|
|
67
|
+
* @property {Object} events[].xdm.application
|
|
68
|
+
* @property {Object} events[].xdm.application.launches
|
|
69
|
+
* @property {number} events[].xdm.application.launches.value
|
|
70
|
+
* @property {string} events[].xdm.eventType
|
|
71
|
+
* @property {Object} events[].xdm._experience
|
|
72
|
+
* @property {CustomerJourneyManagement} events[].xdm._experience.customerJourneyManagement
|
|
73
|
+
* @property {Decisioning} events[].xdm._experience.decisioning
|
|
74
|
+
* @property {Object} events[].meta
|
|
75
|
+
* @property {Object} events[].meta.collect
|
|
76
|
+
* @property {string} events[].meta.collect.datasetId
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* @typedef {Object} ServiceWorkerLogger
|
|
80
|
+
* @property {string} namespace
|
|
81
|
+
* @property {(...args: any[]) => void} info
|
|
82
|
+
* @property {(...args: any[]) => void} error
|
|
83
|
+
*/
|
|
9
84
|
export const Types: {};
|
|
10
85
|
export type PushSubscription = {
|
|
11
86
|
/**
|
|
@@ -20,4 +95,96 @@ export type PushSubscription = {
|
|
|
20
95
|
auth: string | null;
|
|
21
96
|
};
|
|
22
97
|
};
|
|
98
|
+
export type CustomerJourneyManagement = {
|
|
99
|
+
messageExecution: {
|
|
100
|
+
messageExecutionID: string;
|
|
101
|
+
messageID: string;
|
|
102
|
+
messageType: string;
|
|
103
|
+
campaignID: string;
|
|
104
|
+
campaignVersionID: string;
|
|
105
|
+
batchInstanceID: string;
|
|
106
|
+
};
|
|
107
|
+
pushChannelContext?: {
|
|
108
|
+
platform?: "web";
|
|
109
|
+
};
|
|
110
|
+
messageProfile?: {
|
|
111
|
+
channel?: {
|
|
112
|
+
_id?: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export type Decisioning = {
|
|
117
|
+
propositions: {
|
|
118
|
+
scopeDetails: {
|
|
119
|
+
correlationID: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export type XdmTrackingContext = {
|
|
124
|
+
_experience: {
|
|
125
|
+
customerJourneyManagement: CustomerJourneyManagement;
|
|
126
|
+
decisioning: Decisioning;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export type PushNotificationData = {
|
|
130
|
+
web: {
|
|
131
|
+
title: string;
|
|
132
|
+
body: string;
|
|
133
|
+
media: string | null;
|
|
134
|
+
interaction: {
|
|
135
|
+
type: string;
|
|
136
|
+
uri: string | null;
|
|
137
|
+
};
|
|
138
|
+
actions: {
|
|
139
|
+
buttons: {
|
|
140
|
+
label: string;
|
|
141
|
+
type: string;
|
|
142
|
+
uri: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
priority: string;
|
|
146
|
+
_xdm: {
|
|
147
|
+
mixins: XdmTrackingContext;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export type TrackingDataPayload = {
|
|
152
|
+
events: {
|
|
153
|
+
xdm: {
|
|
154
|
+
identityMap: {
|
|
155
|
+
ECID: {
|
|
156
|
+
id: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
timestamp: string;
|
|
160
|
+
pushNotificationTracking: {
|
|
161
|
+
pushProviderMessageID: string;
|
|
162
|
+
pushProvider: string;
|
|
163
|
+
customAction?: {
|
|
164
|
+
actionID?: string;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
application: {
|
|
168
|
+
launches: {
|
|
169
|
+
value: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
eventType: string;
|
|
173
|
+
_experience: {
|
|
174
|
+
customerJourneyManagement: CustomerJourneyManagement;
|
|
175
|
+
decisioning: Decisioning;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
meta: {
|
|
179
|
+
collect: {
|
|
180
|
+
datasetId: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export type ServiceWorkerLogger = {
|
|
186
|
+
namespace: string;
|
|
187
|
+
info: (...args: any[]) => void;
|
|
188
|
+
error: (...args: any[]) => void;
|
|
189
|
+
};
|
|
23
190
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/PushNotifications/types.js"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D;;;;;;GAMG;AAEH,uBAAwB;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/PushNotifications/types.js"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;GAKG;AAEH,uBAAwB;;;;;cAvFV,MAAM;;;;UAEjB;QAA6B,MAAM,EAAxB,MAAM,GAAC,IAAI;QACO,IAAI,EAAtB,MAAM,GAAC,IAAI;KACxB;;;sBAKE;QAAoC,kBAAkB,EAA3C,MAAM;QACmB,SAAS,EAAlC,MAAM;QACmB,WAAW,EAApC,MAAM;QACmB,UAAU,EAAnC,MAAM;QACmB,iBAAiB,EAA1C,MAAM;QACmB,eAAe,EAAxC,MAAM;KACjB;yBACA;QAAsC,QAAQ,GAAnC,KAAK;KAChB;qBACA;QAAmC,OAAO,GAC1C;YAA2C,GAAG,GAAnC,MAAM;SAA8B;KAAA;;;kBAM/C;QAAkC,YAAY,EAC9C;YAA+C,aAAa,EAAjD,MAAM;SACnB;KAAA;;;iBAKE;QAAkD,yBAAyB,EAAhE,yBAAyB;QACA,WAAW,EAApC,WAAW;KACxB;;;SAKE;QAAuB,KAAK,EAAjB,MAAM;QACM,IAAI,EAAhB,MAAM;QACW,KAAK,EAAtB,MAAM,GAAC,IAAI;QACC,WAAW,EAClC;YAAmC,IAAI,EAA5B,MAAM;YACuB,GAAG,EAAhC,MAAM,GAAC,IAAI;SACtB;QAAuB,OAAO,EAC9B;YAAiC,OAAO,EACxC;gBAAyC,KAAK,EAAnC,MAAM;gBACwB,IAAI,EAAlC,MAAM;gBACwB,GAAG,EAAjC,MAAM;aACjB;SAAA;QAAuB,QAAQ,EAApB,MAAM;QACM,IAAI,EAC3B;YAAwC,MAAM,EAAnC,kBAAkB;SAC/B;KAAA;;;YAKE;QAA4B,GAAG,EAC/B;YAAgC,WAAW,EAC3C;gBAA8C,IAAI,EAClD;oBAAmD,EAAE,EAA1C,MAAM;iBACjB;aAAA;YAAgC,SAAS,EAA9B,MAAM;YACe,wBAAwB,EACxD;gBAAyD,qBAAqB,EAAnE,MAAM;gBACwC,YAAY,EAA1D,MAAM;gBACyC,YAAY,GACtE;oBAAuE,QAAQ,GAApE,MAAM;iBACjB;aAAA;YAAgC,WAAW,EAC3C;gBAA4C,QAAQ,EACpD;oBAAqD,KAAK,EAA/C,MAAM;iBACjB;aAAA;YAAgC,SAAS,EAA9B,MAAM;YACe,WAAW,EAC3C;gBAA+D,yBAAyB,EAA7E,yBAAyB;gBACa,WAAW,EAAjD,WAAW;aACtB;SAAA;QAA4B,IAAI,EAChC;YAAiC,OAAO,EACxC;gBAAyC,SAAS,EAAvC,MAAM;aACnB;SAAA;KAAA;;;eAIa,MAAM;UACN,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI;WACxB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI"}
|
package/types/utils/index.d.ts
CHANGED
|
@@ -49,4 +49,5 @@ export { default as updateErrorMessage } from "./updateErrorMessage.js";
|
|
|
49
49
|
export { default as validateIdentityMap } from "./validateIdentityMap.js";
|
|
50
50
|
export { default as validateConfigOverride } from "./validateConfigOverride.js";
|
|
51
51
|
export { base64ToBytes, bytesToBase64 } from "./bytes.js";
|
|
52
|
+
export { openIndexedDb, getFromIndexedDbStore, putToIndexedDbStore } from "./indexedDb.js";
|
|
52
53
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function openIndexedDb(dbName: string, dbVersion: number, upgradeCallback?: Function): Promise<IDBDatabase>;
|
|
2
|
+
export function getFromIndexedDbStore(db: IDBDatabase, storeName: string, key: string | number | Date | ArrayBuffer | any[]): Promise<any>;
|
|
3
|
+
export function putToIndexedDbStore(db: IDBDatabase, storeName: string, data: any): Promise<any>;
|
|
4
|
+
//# sourceMappingURL=indexedDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexedDb.d.ts","sourceRoot":"","sources":["../../src/utils/indexedDb.js"],"names":[],"mappings":"AAmBO,sCANI,MAAM,aACN,MAAM,+BAGJ,OAAO,CAAC,WAAW,CAAC,CAgBhC;AASM,0CANI,WAAW,aACX,MAAM,OACN,MAAM,GAAC,MAAM,GAAC,IAAI,GAAC,WAAW,QAAM,GAElC,OAAO,CAAC,GAAG,CAAC,CAWxB;AAUM,wCANI,WAAW,aACX,MAAM,QACN,GAAG,GAED,OAAO,CAAC,GAAG,CAAC,CAWxB"}
|