@buoy-gg/notifications 7.0.41
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/LICENSE +58 -0
- package/README.md +28 -0
- package/lib/commonjs/components/LocalNotificationTest.js +185 -0
- package/lib/commonjs/components/LocalNotificationTest.js.map +1 -0
- package/lib/commonjs/components/NotificationTestView.js +329 -0
- package/lib/commonjs/components/NotificationTestView.js.map +1 -0
- package/lib/commonjs/components/NotificationToolView.js +673 -0
- package/lib/commonjs/components/NotificationToolView.js.map +1 -0
- package/lib/commonjs/components/notificationStyles.js +292 -0
- package/lib/commonjs/components/notificationStyles.js.map +1 -0
- package/lib/commonjs/expo.js +247 -0
- package/lib/commonjs/expo.js.map +1 -0
- package/lib/commonjs/index.js +148 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/json.js +58 -0
- package/lib/commonjs/json.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/payload.js +68 -0
- package/lib/commonjs/payload.js.map +1 -0
- package/lib/commonjs/preset.js +56 -0
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/preview.js +18 -0
- package/lib/commonjs/preview.js.map +1 -0
- package/lib/commonjs/recorder.js +339 -0
- package/lib/commonjs/recorder.js.map +1 -0
- package/lib/commonjs/runtime.js +110 -0
- package/lib/commonjs/runtime.js.map +1 -0
- package/lib/commonjs/storage.js +61 -0
- package/lib/commonjs/storage.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/components/LocalNotificationTest.js +180 -0
- package/lib/module/components/LocalNotificationTest.js.map +1 -0
- package/lib/module/components/NotificationTestView.js +324 -0
- package/lib/module/components/NotificationTestView.js.map +1 -0
- package/lib/module/components/NotificationToolView.js +668 -0
- package/lib/module/components/NotificationToolView.js.map +1 -0
- package/lib/module/components/notificationStyles.js +288 -0
- package/lib/module/components/notificationStyles.js.map +1 -0
- package/lib/module/expo.js +241 -0
- package/lib/module/expo.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/json.js +51 -0
- package/lib/module/json.js.map +1 -0
- package/lib/module/payload.js +63 -0
- package/lib/module/payload.js.map +1 -0
- package/lib/module/preset.js +50 -0
- package/lib/module/preset.js.map +1 -0
- package/lib/module/preview.js +14 -0
- package/lib/module/preview.js.map +1 -0
- package/lib/module/recorder.js +332 -0
- package/lib/module/recorder.js.map +1 -0
- package/lib/module/runtime.js +103 -0
- package/lib/module/runtime.js.map +1 -0
- package/lib/module/storage.js +56 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/components/LocalNotificationTest.d.ts +8 -0
- package/lib/typescript/components/LocalNotificationTest.d.ts.map +1 -0
- package/lib/typescript/components/NotificationTestView.d.ts +27 -0
- package/lib/typescript/components/NotificationTestView.d.ts.map +1 -0
- package/lib/typescript/components/NotificationToolView.d.ts +16 -0
- package/lib/typescript/components/NotificationToolView.d.ts.map +1 -0
- package/lib/typescript/components/notificationStyles.d.ts +284 -0
- package/lib/typescript/components/notificationStyles.d.ts.map +1 -0
- package/lib/typescript/expo.d.ts +66 -0
- package/lib/typescript/expo.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +15 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/json.d.ts +7 -0
- package/lib/typescript/json.d.ts.map +1 -0
- package/lib/typescript/payload.d.ts +18 -0
- package/lib/typescript/payload.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +31 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/preview.d.ts +4 -0
- package/lib/typescript/preview.d.ts.map +1 -0
- package/lib/typescript/recorder.d.ts +52 -0
- package/lib/typescript/recorder.d.ts.map +1 -0
- package/lib/typescript/runtime.d.ts +50 -0
- package/lib/typescript/runtime.d.ts.map +1 -0
- package/lib/typescript/storage.d.ts +23 -0
- package/lib/typescript/storage.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +64 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
NotificationRecorder: true,
|
|
8
|
+
expoMetadata: true,
|
|
9
|
+
attachExpoNotifications: true,
|
|
10
|
+
instrumentExpoNotificationHandler: true,
|
|
11
|
+
instrumentNotificationBackgroundTask: true,
|
|
12
|
+
installExpoNotificationCapture: true,
|
|
13
|
+
getNotificationRecorder: true,
|
|
14
|
+
notificationSyncAdapter: true,
|
|
15
|
+
NotificationToolView: true,
|
|
16
|
+
notificationToolPreset: true,
|
|
17
|
+
createNotificationTool: true,
|
|
18
|
+
NotificationsModal: true,
|
|
19
|
+
NotificationsIcon: true,
|
|
20
|
+
composeSimulatorPayload: true,
|
|
21
|
+
validateSimulatorPayload: true,
|
|
22
|
+
createExpoNotificationStorage: true,
|
|
23
|
+
NotificationTestView: true
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "NotificationRecorder", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _recorder.NotificationRecorder;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "NotificationTestView", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _NotificationTestView.NotificationTestView;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "NotificationToolView", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _NotificationToolView.NotificationToolView;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "NotificationsIcon", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _sharedUi.NotificationsIcon;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "NotificationsModal", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _preset.NotificationsModal;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "attachExpoNotifications", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _expo.attachExpoNotifications;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "composeSimulatorPayload", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return _payload.composeSimulatorPayload;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "createExpoNotificationStorage", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _storage.createExpoNotificationStorage;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "createNotificationTool", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _preset.createNotificationTool;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "expoMetadata", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _recorder.expoMetadata;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "getNotificationRecorder", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _runtime.getNotificationRecorder;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "installExpoNotificationCapture", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return _runtime.installExpoNotificationCapture;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "instrumentExpoNotificationHandler", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return _expo.instrumentExpoNotificationHandler;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "instrumentNotificationBackgroundTask", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _expo.instrumentNotificationBackgroundTask;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "notificationSyncAdapter", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _runtime.notificationSyncAdapter;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "notificationToolPreset", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () {
|
|
118
|
+
return _preset.notificationToolPreset;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "validateSimulatorPayload", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _payload.validateSimulatorPayload;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
var _types = require("./types");
|
|
128
|
+
Object.keys(_types).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
131
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
132
|
+
Object.defineProperty(exports, key, {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _types[key];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
var _recorder = require("./recorder");
|
|
140
|
+
var _expo = require("./expo");
|
|
141
|
+
var _runtime = require("./runtime");
|
|
142
|
+
var _NotificationToolView = require("./components/NotificationToolView");
|
|
143
|
+
var _preset = require("./preset");
|
|
144
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
145
|
+
var _payload = require("./payload");
|
|
146
|
+
var _storage = require("./storage");
|
|
147
|
+
var _NotificationTestView = require("./components/NotificationTestView");
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_recorder","_expo","_runtime","_NotificationToolView","_preset","_sharedUi","_payload","_storage","_NotificationTestView"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AACA,IAAAc,KAAA,GAAAd,OAAA;AAEA,IAAAe,QAAA,GAAAf,OAAA;AAEA,IAAAgB,qBAAA,GAAAhB,OAAA;AAEA,IAAAiB,OAAA,GAAAjB,OAAA;AACA,IAAAkB,SAAA,GAAAlB,OAAA;AACA,IAAAmB,QAAA,GAAAnB,OAAA;AACA,IAAAoB,QAAA,GAAApB,OAAA;AAEA,IAAAqB,qBAAA,GAAArB,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.byteLength = byteLength;
|
|
7
|
+
exports.json = json;
|
|
8
|
+
exports.object = object;
|
|
9
|
+
exports.string = string;
|
|
10
|
+
function object(value) {
|
|
11
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
12
|
+
}
|
|
13
|
+
function string(value) {
|
|
14
|
+
return typeof value === "string" ? value : null;
|
|
15
|
+
}
|
|
16
|
+
function json(value) {
|
|
17
|
+
const seen = new WeakSet();
|
|
18
|
+
function visit(v, depth) {
|
|
19
|
+
if (v == null) return null;
|
|
20
|
+
if (typeof v === "string") return v.length > 12000 ? v.slice(0, 12000) + " [truncated]" : v;
|
|
21
|
+
if (typeof v === "boolean") return v;
|
|
22
|
+
if (typeof v === "number") return Number.isFinite(v) ? v : String(v);
|
|
23
|
+
if (typeof v !== "object") return String(v);
|
|
24
|
+
if (seen.has(v)) return "[Circular]";
|
|
25
|
+
if (depth > 12) return "[Depth limit]";
|
|
26
|
+
seen.add(v);
|
|
27
|
+
if (v instanceof Error) return {
|
|
28
|
+
name: v.name,
|
|
29
|
+
message: v.message
|
|
30
|
+
};
|
|
31
|
+
if (v instanceof Date) return Number.isNaN(v.getTime()) ? "[Invalid date]" : v.toISOString();
|
|
32
|
+
if (Array.isArray(v)) return v.slice(0, 200).map(item => visit(item, depth + 1));
|
|
33
|
+
const out = {};
|
|
34
|
+
for (const key of Object.keys(v).slice(0, 200)) {
|
|
35
|
+
try {
|
|
36
|
+
Object.defineProperty(out, key, {
|
|
37
|
+
value: visit(v[key], depth + 1),
|
|
38
|
+
enumerable: true
|
|
39
|
+
});
|
|
40
|
+
} catch {
|
|
41
|
+
out[key] = "[Unreadable]";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
return visit(value, 0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** UTF-8 size without requiring Buffer or TextEncoder in Hermes. */
|
|
50
|
+
function byteLength(value) {
|
|
51
|
+
let bytes = 0;
|
|
52
|
+
for (const character of value) {
|
|
53
|
+
const cp = character.codePointAt(0);
|
|
54
|
+
bytes += cp <= 0x7f ? 1 : cp <= 0x7ff ? 2 : cp <= 0xffff ? 3 : 4;
|
|
55
|
+
}
|
|
56
|
+
return bytes;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["object","value","Array","isArray","string","json","seen","WeakSet","visit","v","depth","length","slice","Number","isFinite","String","has","add","Error","name","message","Date","isNaN","getTime","toISOString","map","item","out","key","Object","keys","defineProperty","enumerable","byteLength","bytes","character","cp","codePointAt"],"sourceRoot":"../../src","sources":["json.ts"],"mappings":";;;;;;;;;AAEO,SAASA,MAAMA,CAACC,KAAc,EAA2B;EAC9D,OAAOA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,GACvEA,KAAK,GAA8B,CAAC,CAAC;AAC3C;AACO,SAASG,MAAMA,CAACH,KAAc,EAAiB;EACpD,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAI;AACjD;AACO,SAASI,IAAIA,CAACJ,KAAc,EAAQ;EACzC,MAAMK,IAAI,GAAG,IAAIC,OAAO,CAAS,CAAC;EAClC,SAASC,KAAKA,CAACC,CAAU,EAAEC,KAAa,EAAQ;IAC9C,IAAID,CAAC,IAAI,IAAI,EAAE,OAAO,IAAI;IAC1B,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE,OAAOA,CAAC,CAACE,MAAM,GAAG,KAAK,GAAGF,CAAC,CAACG,KAAK,CAAC,CAAC,E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A6BmB,GAAG,CAAC,EAAElB,KAAK,GAAG,CAAC,CAAC;UAAEsB,UAAU,EAAE;QAAK,CAAC,CAAC;MAAE,CAAC,CAC5H,MAAM;QAAEL,GAAG,CAACC,GAAG,CAAC,GAAG,cAAc;MAAE;IACrC;IACA,OAAOD,GAAG;EACZ;EACA,OAAOnB,KAAK,CAACP,KAAK,EAAE,CAAC,CAAC;AACxB;;AAEA;AACO,SAASgC,UAAUA,CAAChC,KAAa,EAAU;EAChD,IAAIiC,KAAK,GAAG,CAAC;EACb,KAAK,MAAMC,SAAS,IAAIlC,KAAK,EAAE;IAC7B,MAAMmC,EAAE,GAAGD,SAAS,CAACE,WAAW,CAAC,CAAC,CAAE;IACpCH,KAAK,IAAIE,EAAE,IAAI,IAAI,GAAG,CAAC,GAAGA,EAAE,IAAI,KAAK,GAAG,CAAC,GAAGA,EAAE,IAAI,MAAM,GAAG,CAAC,GAAG,CAAC;EAClE;EACA,OAAOF,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.composeSimulatorPayload = composeSimulatorPayload;
|
|
7
|
+
exports.validateSimulatorPayload = validateSimulatorPayload;
|
|
8
|
+
var _json = require("./json");
|
|
9
|
+
function composeSimulatorPayload(draft) {
|
|
10
|
+
const data = {
|
|
11
|
+
...draft.data,
|
|
12
|
+
__buoyTestId: draft.testId
|
|
13
|
+
};
|
|
14
|
+
const aps = draft.silent ? {
|
|
15
|
+
"content-available": 1
|
|
16
|
+
} : {
|
|
17
|
+
alert: {
|
|
18
|
+
title: draft.title,
|
|
19
|
+
body: draft.body
|
|
20
|
+
},
|
|
21
|
+
sound: "default"
|
|
22
|
+
};
|
|
23
|
+
return JSON.stringify(draft.adapter === "expo" ? {
|
|
24
|
+
aps,
|
|
25
|
+
body: data
|
|
26
|
+
} : {
|
|
27
|
+
...data,
|
|
28
|
+
aps
|
|
29
|
+
}, null, 2);
|
|
30
|
+
}
|
|
31
|
+
function validateSimulatorPayload(source) {
|
|
32
|
+
const errors = [];
|
|
33
|
+
const warnings = [];
|
|
34
|
+
if (typeof source !== "string") return {
|
|
35
|
+
valid: false,
|
|
36
|
+
bytes: 0,
|
|
37
|
+
errors: ["Provide the APNs payload as JSON text."],
|
|
38
|
+
warnings,
|
|
39
|
+
testId: null
|
|
40
|
+
};
|
|
41
|
+
const bytes = (0, _json.byteLength)(source);
|
|
42
|
+
if (bytes > 4096) errors.push(`Payload is ${bytes} bytes. APNs payloads must fit in 4096 UTF-8 bytes.`);
|
|
43
|
+
let parsed;
|
|
44
|
+
try {
|
|
45
|
+
parsed = JSON.parse(source);
|
|
46
|
+
} catch {
|
|
47
|
+
errors.push("Payload is not valid JSON.");
|
|
48
|
+
}
|
|
49
|
+
const value = (0, _json.object)(parsed);
|
|
50
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) errors.push("The payload must be a JSON object.");
|
|
51
|
+
if (!value.aps || typeof value.aps !== "object" || Array.isArray(value.aps)) errors.push('The payload needs an "aps" object.');
|
|
52
|
+
const aps = (0, _json.object)(value.aps);
|
|
53
|
+
if (aps.alert !== undefined && typeof aps.alert !== "string" && (aps.alert === null || typeof aps.alert !== "object" || Array.isArray(aps.alert))) errors.push("aps.alert must be text or an object.");
|
|
54
|
+
if (aps.badge !== undefined && (!Number.isInteger(aps.badge) || Number(aps.badge) < 0)) errors.push("aps.badge must be a non-negative integer.");
|
|
55
|
+
for (const key of ["content-available", "mutable-content"]) if (aps[key] !== undefined && aps[key] !== 1) errors.push(`aps.${key} must be 1 when present.`);
|
|
56
|
+
if (aps["content-available"] === 1) warnings.push("Background execution depends on app configuration and OS scheduling. A successful send does not prove the task ran.");
|
|
57
|
+
if (aps["mutable-content"] === 1) warnings.push("Use real APNs delivery to verify notification service extensions.");
|
|
58
|
+
if (value.data !== undefined && value.body === undefined) warnings.push("Expo on iOS reads custom data from a top-level body object. This raw payload will be sent unchanged.");
|
|
59
|
+
const testId = (0, _json.object)(value.body).__buoyTestId ?? value.__buoyTestId;
|
|
60
|
+
return {
|
|
61
|
+
valid: errors.length === 0,
|
|
62
|
+
bytes,
|
|
63
|
+
errors,
|
|
64
|
+
warnings,
|
|
65
|
+
testId: typeof testId === "string" ? testId : null
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_json","require","composeSimulatorPayload","draft","data","__buoyTestId","testId","aps","silent","alert","title","body","sound","JSON","stringify","adapter","validateSimulatorPayload","source","errors","warnings","valid","bytes","byteLength","push","parsed","parse","value","object","Array","isArray","undefined","badge","Number","isInteger","key","length"],"sourceRoot":"../../src","sources":["payload.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGO,SAASC,uBAAuBA,CAACC,KAAwB,EAAU;EACxE,MAAMC,IAAI,GAAG;IAAE,GAAGD,KAAK,CAACC,IAAI;IAAEC,YAAY,EAAEF,KAAK,CAACG;EAAO,CAAC;EAC1D,MAAMC,GAAG,GAAGJ,KAAK,CAACK,MAAM,GAAG;IAAE,mBAAmB,EAAE;EAAE,CAAC,GAAG;IAAEC,KAAK,EAAE;MAAEC,KAAK,EAAEP,KAAK,CAACO,KAAK;MAAEC,IAAI,EAAER,KAAK,CAACQ;IAAK,CAAC;IAAEC,KAAK,EAAE;EAAU,CAAC;EAC7H,OAAOC,IAAI,CAACC,SAAS,CAACX,KAAK,CAACY,OAAO,KAAK,MAAM,GAAG;IAAER,GAAG;IAAEI,IAAI,EAAEP;EAAK,CAAC,GAAG;IAAE,GAAGA,IAAI;IAAEG;EAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AACnG;AAEO,SAASS,wBAAwBA,CAACC,MAA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|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotificationsModal = NotificationsModal;
|
|
7
|
+
exports.notificationToolPreset = exports.createNotificationTool = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
var _NotificationToolView = require("./components/NotificationToolView");
|
|
11
|
+
var _runtime = require("./runtime");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
function NotificationsModal(props) {
|
|
15
|
+
const snapshot = (0, _react.useSyncExternalStore)(_runtime.notificationSyncAdapter.subscribe, _runtime.notificationSyncAdapter.getSnapshot);
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NotificationToolView.NotificationToolView, {
|
|
17
|
+
snapshot: snapshot,
|
|
18
|
+
renderShell: ({
|
|
19
|
+
header,
|
|
20
|
+
body
|
|
21
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.JsModal, {
|
|
22
|
+
...props,
|
|
23
|
+
persistenceKey: props.persistenceKey ?? "buoy-notifications",
|
|
24
|
+
variant: "night",
|
|
25
|
+
header: {
|
|
26
|
+
showToggleButton: true,
|
|
27
|
+
customContent: header
|
|
28
|
+
},
|
|
29
|
+
enablePersistence: true,
|
|
30
|
+
initialMode: "bottomSheet",
|
|
31
|
+
disableScrollWrapper: true,
|
|
32
|
+
children: body
|
|
33
|
+
}),
|
|
34
|
+
onAction: async (action, params) => {
|
|
35
|
+
const fn = _runtime.notificationSyncAdapter.actions[action];
|
|
36
|
+
if (!fn) throw new Error("This notification action is unavailable.");
|
|
37
|
+
return fn(params);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const notificationToolPreset = exports.notificationToolPreset = (0, _sharedUi.defineToolPreset)({
|
|
42
|
+
id: "push-notifications",
|
|
43
|
+
name: "NOTIFICATIONS",
|
|
44
|
+
description: "Send a test notification and inspect how the app responds",
|
|
45
|
+
slot: "both",
|
|
46
|
+
icon: ({
|
|
47
|
+
size,
|
|
48
|
+
color
|
|
49
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.NotificationsIcon, {
|
|
50
|
+
size: size,
|
|
51
|
+
color: color
|
|
52
|
+
}),
|
|
53
|
+
component: NotificationsModal
|
|
54
|
+
});
|
|
55
|
+
const createNotificationTool = exports.createNotificationTool = (0, _sharedUi.createToolFactory)(notificationToolPreset);
|
|
56
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_sharedUi","_NotificationToolView","_runtime","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NotificationsModal","props","snapshot","useSyncExternalStore","notificationSyncAdapter","subscribe","getSnapshot","jsx","NotificationToolView","renderShell","header","body","JsModal","persistenceKey","variant","showToggleButton","customContent","enablePersistence","initialMode","disableScrollWrapper","children","onAction","action","params","fn","actions","Error","notificationToolPreset","exports","defineToolPreset","id","name","description","slot","icon","size","color","NotificationsIcon","component","createNotificationTool","createToolFactory"],"sourceRoot":"../../src","sources":["preset.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA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AW,sBAAA,GAAG,IAAAC,2BAAiB,EAACb,sBAAsB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.normalizePreviewAppearance = normalizePreviewAppearance;
|
|
7
|
+
/** Keep preview artwork self-contained and small enough for device snapshots. */
|
|
8
|
+
function normalizePreviewAppearance(value) {
|
|
9
|
+
if (!value || typeof value !== "object") return undefined;
|
|
10
|
+
const result = {};
|
|
11
|
+
if (typeof value.appName === "string") result.appName = value.appName.trim().slice(0, 80);
|
|
12
|
+
if (typeof value.iconUri === "string" && value.iconUri.length <= 32768 && /^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(value.iconUri)) result.iconUri = value.iconUri;
|
|
13
|
+
for (const key of ["backgroundColor", "textColor"]) {
|
|
14
|
+
if (typeof value[key] === "string" && /^#[0-9a-f]{6}$/i.test(value[key])) result[key] = value[key];
|
|
15
|
+
}
|
|
16
|
+
return Object.keys(result).length ? result : undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["normalizePreviewAppearance","value","undefined","result","appName","trim","slice","iconUri","length","test","key","Object","keys"],"sourceRoot":"../../src","sources":["preview.ts"],"mappings":";;;;;;AAEA;AACO,SAASA,0BAA0BA,CACxCC,KAAqC,EACM;EAC3C,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAOC,SAAS;EACzD,MAAMC,MAAqC,GAAG,CAAC,CAAC;EAChD,IAAI,OAAOF,KAAK,CAACG,OAAO,KAAK,QAAQ,EACnCD,MAAM,CAACC,OAAO,GAAGH,KAAK,CAACG,OAAO,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;EACpD,IACE,OAAOL,KAAK,CAACM,OAAO,KAAK,QAAQ,IACjCN,KAAK,CAACM,OAAO,CAACC,MAAM,IAAI,KAAK,IAC7B,2DAA2D,CAACC,IAAI,CAC9DR,KAAK,CAACM,OACR,CAAC,EAEDJ,MAAM,CAACI,OAAO,GAAGN,KAAK,CAACM,OAAO;EAChC,KAAK,MAAMG,GAAG,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,EAAW;IAC3D,IAAI,OAAOT,KAAK,CAACS,GAAG,CAAC,KAAK,QAAQ,IAAI,iBAAiB,CAACD,IAAI,CAACR,KAAK,CAACS,GAAG,CAAE,CAAC,EACvEP,MAAM,CAACO,GAAG,CAAC,GAAGT,KAAK,CAACS,GAAG,CAAC;EAC5B;EACA,OAAOC,MAAM,CAACC,IAAI,CAACT,MAAM,CAAC,CAACK,MAAM,GAAGL,MAAM,GAAGD,SAAS;AACxD","ignoreList":[]}
|