@scalemule/sdk 0.0.25 → 0.0.26
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/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +39 -1
- package/dist/index.mjs +39 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2707,6 +2707,10 @@ interface RegisterPushTokenData {
|
|
|
2707
2707
|
app_version?: string;
|
|
2708
2708
|
os_version?: string;
|
|
2709
2709
|
device_model?: string;
|
|
2710
|
+
timezone?: string;
|
|
2711
|
+
language?: string;
|
|
2712
|
+
browser?: string;
|
|
2713
|
+
registration_source?: string;
|
|
2710
2714
|
}
|
|
2711
2715
|
declare class CommunicationService extends ServiceModule {
|
|
2712
2716
|
protected basePath: string;
|
|
@@ -2792,10 +2796,13 @@ interface WebPushManagerOptions {
|
|
|
2792
2796
|
serviceWorkerUrl?: string;
|
|
2793
2797
|
/** Required: HTTP transport abstraction */
|
|
2794
2798
|
fetcher: PushApiFetcher;
|
|
2799
|
+
/** Where the user subscribed (e.g., 'landing_prompt', 'post_signup', 'settings') */
|
|
2800
|
+
registrationSource?: string;
|
|
2795
2801
|
}
|
|
2796
2802
|
declare class WebPushManager {
|
|
2797
2803
|
private fetcher;
|
|
2798
2804
|
private swUrl;
|
|
2805
|
+
private registrationSource?;
|
|
2799
2806
|
private state;
|
|
2800
2807
|
private registration;
|
|
2801
2808
|
constructor(options: WebPushManagerOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -2707,6 +2707,10 @@ interface RegisterPushTokenData {
|
|
|
2707
2707
|
app_version?: string;
|
|
2708
2708
|
os_version?: string;
|
|
2709
2709
|
device_model?: string;
|
|
2710
|
+
timezone?: string;
|
|
2711
|
+
language?: string;
|
|
2712
|
+
browser?: string;
|
|
2713
|
+
registration_source?: string;
|
|
2710
2714
|
}
|
|
2711
2715
|
declare class CommunicationService extends ServiceModule {
|
|
2712
2716
|
protected basePath: string;
|
|
@@ -2792,10 +2796,13 @@ interface WebPushManagerOptions {
|
|
|
2792
2796
|
serviceWorkerUrl?: string;
|
|
2793
2797
|
/** Required: HTTP transport abstraction */
|
|
2794
2798
|
fetcher: PushApiFetcher;
|
|
2799
|
+
/** Where the user subscribed (e.g., 'landing_prompt', 'post_signup', 'settings') */
|
|
2800
|
+
registrationSource?: string;
|
|
2795
2801
|
}
|
|
2796
2802
|
declare class WebPushManager {
|
|
2797
2803
|
private fetcher;
|
|
2798
2804
|
private swUrl;
|
|
2805
|
+
private registrationSource?;
|
|
2799
2806
|
private state;
|
|
2800
2807
|
private registration;
|
|
2801
2808
|
constructor(options: WebPushManagerOptions);
|
package/dist/index.js
CHANGED
|
@@ -4583,6 +4583,7 @@ var WebPushManager = class {
|
|
|
4583
4583
|
}
|
|
4584
4584
|
this.fetcher = options.fetcher;
|
|
4585
4585
|
this.swUrl = options.serviceWorkerUrl || "/sw.js";
|
|
4586
|
+
this.registrationSource = options.registrationSource;
|
|
4586
4587
|
try {
|
|
4587
4588
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
4588
4589
|
if (stored) {
|
|
@@ -4644,7 +4645,13 @@ var WebPushManager = class {
|
|
|
4644
4645
|
token: endpoint,
|
|
4645
4646
|
platform: "web",
|
|
4646
4647
|
device_id: resolvedDeviceId,
|
|
4647
|
-
subscription
|
|
4648
|
+
subscription,
|
|
4649
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
4650
|
+
language: navigator.language,
|
|
4651
|
+
browser: detectBrowser(),
|
|
4652
|
+
os_version: detectOS(),
|
|
4653
|
+
device_model: detectDeviceType(),
|
|
4654
|
+
registration_source: this.registrationSource
|
|
4648
4655
|
});
|
|
4649
4656
|
this.state = {
|
|
4650
4657
|
endpoint,
|
|
@@ -4740,6 +4747,37 @@ function generateDeviceId() {
|
|
|
4740
4747
|
return v.toString(16);
|
|
4741
4748
|
});
|
|
4742
4749
|
}
|
|
4750
|
+
function detectBrowser() {
|
|
4751
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
4752
|
+
const ua = navigator.userAgent;
|
|
4753
|
+
if (ua.includes("Firefox/")) return "Firefox/" + (ua.split("Firefox/")[1] || "").split(" ")[0];
|
|
4754
|
+
if (ua.includes("Edg/")) return "Edge/" + (ua.split("Edg/")[1] || "").split(" ")[0];
|
|
4755
|
+
if (ua.includes("Chrome/")) return "Chrome/" + (ua.split("Chrome/")[1] || "").split(" ")[0];
|
|
4756
|
+
if (ua.includes("Safari/") && !ua.includes("Chrome")) {
|
|
4757
|
+
const ver = (ua.split("Version/")[1] || "").split(" ")[0];
|
|
4758
|
+
return "Safari/" + ver;
|
|
4759
|
+
}
|
|
4760
|
+
return "Unknown";
|
|
4761
|
+
}
|
|
4762
|
+
function detectOS() {
|
|
4763
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
4764
|
+
const ua = navigator.userAgent;
|
|
4765
|
+
if (ua.includes("Windows NT")) return "Windows/" + ((ua.split("Windows NT ")[1] || "").split(/[;)]/)[0] || "");
|
|
4766
|
+
if (ua.includes("Mac OS X"))
|
|
4767
|
+
return "macOS/" + ((ua.split("Mac OS X ")[1] || "").split(/[;)]/)[0] || "").replace(/_/g, ".");
|
|
4768
|
+
if (ua.includes("Android")) return "Android/" + ((ua.split("Android ")[1] || "").split(/[;)]/)[0] || "");
|
|
4769
|
+
if (ua.includes("iPhone OS"))
|
|
4770
|
+
return "iOS/" + ((ua.split("iPhone OS ")[1] || "").split(" ")[0] || "").replace(/_/g, ".");
|
|
4771
|
+
if (ua.includes("Linux")) return "Linux";
|
|
4772
|
+
return "Unknown";
|
|
4773
|
+
}
|
|
4774
|
+
function detectDeviceType() {
|
|
4775
|
+
if (typeof navigator === "undefined") return "unknown";
|
|
4776
|
+
const ua = navigator.userAgent;
|
|
4777
|
+
if (/Mobi|Android.*Mobile|iPhone/i.test(ua)) return "mobile";
|
|
4778
|
+
if (/iPad|Android(?!.*Mobile)|Tablet/i.test(ua)) return "tablet";
|
|
4779
|
+
return "desktop";
|
|
4780
|
+
}
|
|
4743
4781
|
|
|
4744
4782
|
// src/web-push-sw.ts
|
|
4745
4783
|
var WEB_PUSH_SERVICE_WORKER = `
|
package/dist/index.mjs
CHANGED
|
@@ -4224,6 +4224,7 @@ var WebPushManager = class {
|
|
|
4224
4224
|
}
|
|
4225
4225
|
this.fetcher = options.fetcher;
|
|
4226
4226
|
this.swUrl = options.serviceWorkerUrl || "/sw.js";
|
|
4227
|
+
this.registrationSource = options.registrationSource;
|
|
4227
4228
|
try {
|
|
4228
4229
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
4229
4230
|
if (stored) {
|
|
@@ -4285,7 +4286,13 @@ var WebPushManager = class {
|
|
|
4285
4286
|
token: endpoint,
|
|
4286
4287
|
platform: "web",
|
|
4287
4288
|
device_id: resolvedDeviceId,
|
|
4288
|
-
subscription
|
|
4289
|
+
subscription,
|
|
4290
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
4291
|
+
language: navigator.language,
|
|
4292
|
+
browser: detectBrowser(),
|
|
4293
|
+
os_version: detectOS(),
|
|
4294
|
+
device_model: detectDeviceType(),
|
|
4295
|
+
registration_source: this.registrationSource
|
|
4289
4296
|
});
|
|
4290
4297
|
this.state = {
|
|
4291
4298
|
endpoint,
|
|
@@ -4381,6 +4388,37 @@ function generateDeviceId() {
|
|
|
4381
4388
|
return v.toString(16);
|
|
4382
4389
|
});
|
|
4383
4390
|
}
|
|
4391
|
+
function detectBrowser() {
|
|
4392
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
4393
|
+
const ua = navigator.userAgent;
|
|
4394
|
+
if (ua.includes("Firefox/")) return "Firefox/" + (ua.split("Firefox/")[1] || "").split(" ")[0];
|
|
4395
|
+
if (ua.includes("Edg/")) return "Edge/" + (ua.split("Edg/")[1] || "").split(" ")[0];
|
|
4396
|
+
if (ua.includes("Chrome/")) return "Chrome/" + (ua.split("Chrome/")[1] || "").split(" ")[0];
|
|
4397
|
+
if (ua.includes("Safari/") && !ua.includes("Chrome")) {
|
|
4398
|
+
const ver = (ua.split("Version/")[1] || "").split(" ")[0];
|
|
4399
|
+
return "Safari/" + ver;
|
|
4400
|
+
}
|
|
4401
|
+
return "Unknown";
|
|
4402
|
+
}
|
|
4403
|
+
function detectOS() {
|
|
4404
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
4405
|
+
const ua = navigator.userAgent;
|
|
4406
|
+
if (ua.includes("Windows NT")) return "Windows/" + ((ua.split("Windows NT ")[1] || "").split(/[;)]/)[0] || "");
|
|
4407
|
+
if (ua.includes("Mac OS X"))
|
|
4408
|
+
return "macOS/" + ((ua.split("Mac OS X ")[1] || "").split(/[;)]/)[0] || "").replace(/_/g, ".");
|
|
4409
|
+
if (ua.includes("Android")) return "Android/" + ((ua.split("Android ")[1] || "").split(/[;)]/)[0] || "");
|
|
4410
|
+
if (ua.includes("iPhone OS"))
|
|
4411
|
+
return "iOS/" + ((ua.split("iPhone OS ")[1] || "").split(" ")[0] || "").replace(/_/g, ".");
|
|
4412
|
+
if (ua.includes("Linux")) return "Linux";
|
|
4413
|
+
return "Unknown";
|
|
4414
|
+
}
|
|
4415
|
+
function detectDeviceType() {
|
|
4416
|
+
if (typeof navigator === "undefined") return "unknown";
|
|
4417
|
+
const ua = navigator.userAgent;
|
|
4418
|
+
if (/Mobi|Android.*Mobile|iPhone/i.test(ua)) return "mobile";
|
|
4419
|
+
if (/iPad|Android(?!.*Mobile)|Tablet/i.test(ua)) return "tablet";
|
|
4420
|
+
return "desktop";
|
|
4421
|
+
}
|
|
4384
4422
|
|
|
4385
4423
|
// src/web-push-sw.ts
|
|
4386
4424
|
var WEB_PUSH_SERVICE_WORKER = `
|