@buoy-gg/notifications 7.0.41 → 7.0.43

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.
Files changed (71) hide show
  1. package/lib/commonjs/components/LocalNotificationTest.js +1 -185
  2. package/lib/commonjs/components/NotificationTestView.js +1 -329
  3. package/lib/commonjs/components/NotificationToolView.js +1 -673
  4. package/lib/commonjs/components/notificationStyles.js +1 -292
  5. package/lib/commonjs/expo.js +1 -247
  6. package/lib/commonjs/index.js +1 -148
  7. package/lib/commonjs/json.js +1 -58
  8. package/lib/commonjs/payload.js +1 -68
  9. package/lib/commonjs/preset.js +1 -56
  10. package/lib/commonjs/preview.js +1 -18
  11. package/lib/commonjs/recorder.js +1 -339
  12. package/lib/commonjs/runtime.js +1 -110
  13. package/lib/commonjs/storage.js +1 -61
  14. package/lib/commonjs/types.js +0 -1
  15. package/lib/module/components/LocalNotificationTest.js +1 -180
  16. package/lib/module/components/NotificationTestView.js +1 -324
  17. package/lib/module/components/NotificationToolView.js +1 -668
  18. package/lib/module/components/notificationStyles.js +1 -288
  19. package/lib/module/expo.js +1 -241
  20. package/lib/module/index.js +1 -13
  21. package/lib/module/json.js +1 -51
  22. package/lib/module/payload.js +1 -63
  23. package/lib/module/preset.js +1 -50
  24. package/lib/module/preview.js +1 -14
  25. package/lib/module/recorder.js +1 -332
  26. package/lib/module/runtime.js +1 -103
  27. package/lib/module/storage.js +1 -56
  28. package/lib/module/types.js +0 -1
  29. package/package.json +2 -2
  30. package/lib/commonjs/components/LocalNotificationTest.js.map +0 -1
  31. package/lib/commonjs/components/NotificationTestView.js.map +0 -1
  32. package/lib/commonjs/components/NotificationToolView.js.map +0 -1
  33. package/lib/commonjs/components/notificationStyles.js.map +0 -1
  34. package/lib/commonjs/expo.js.map +0 -1
  35. package/lib/commonjs/index.js.map +0 -1
  36. package/lib/commonjs/json.js.map +0 -1
  37. package/lib/commonjs/payload.js.map +0 -1
  38. package/lib/commonjs/preset.js.map +0 -1
  39. package/lib/commonjs/preview.js.map +0 -1
  40. package/lib/commonjs/recorder.js.map +0 -1
  41. package/lib/commonjs/runtime.js.map +0 -1
  42. package/lib/commonjs/storage.js.map +0 -1
  43. package/lib/commonjs/types.js.map +0 -1
  44. package/lib/module/components/LocalNotificationTest.js.map +0 -1
  45. package/lib/module/components/NotificationTestView.js.map +0 -1
  46. package/lib/module/components/NotificationToolView.js.map +0 -1
  47. package/lib/module/components/notificationStyles.js.map +0 -1
  48. package/lib/module/expo.js.map +0 -1
  49. package/lib/module/index.js.map +0 -1
  50. package/lib/module/json.js.map +0 -1
  51. package/lib/module/payload.js.map +0 -1
  52. package/lib/module/preset.js.map +0 -1
  53. package/lib/module/preview.js.map +0 -1
  54. package/lib/module/recorder.js.map +0 -1
  55. package/lib/module/runtime.js.map +0 -1
  56. package/lib/module/storage.js.map +0 -1
  57. package/lib/module/types.js.map +0 -1
  58. package/lib/typescript/components/LocalNotificationTest.d.ts.map +0 -1
  59. package/lib/typescript/components/NotificationTestView.d.ts.map +0 -1
  60. package/lib/typescript/components/NotificationToolView.d.ts.map +0 -1
  61. package/lib/typescript/components/notificationStyles.d.ts.map +0 -1
  62. package/lib/typescript/expo.d.ts.map +0 -1
  63. package/lib/typescript/index.d.ts.map +0 -1
  64. package/lib/typescript/json.d.ts.map +0 -1
  65. package/lib/typescript/payload.d.ts.map +0 -1
  66. package/lib/typescript/preset.d.ts.map +0 -1
  67. package/lib/typescript/preview.d.ts.map +0 -1
  68. package/lib/typescript/recorder.d.ts.map +0 -1
  69. package/lib/typescript/runtime.d.ts.map +0 -1
  70. package/lib/typescript/storage.d.ts.map +0 -1
  71. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,148 +1 @@
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={NotificationRecorder:true,expoMetadata:true,attachExpoNotifications:true,instrumentExpoNotificationHandler:true,instrumentNotificationBackgroundTask:true,installExpoNotificationCapture:true,getNotificationRecorder:true,notificationSyncAdapter:true,NotificationToolView:true,notificationToolPreset:true,createNotificationTool:true,NotificationsModal:true,NotificationsIcon:true,composeSimulatorPayload:true,validateSimulatorPayload:true,createExpoNotificationStorage:true,NotificationTestView:true};Object.defineProperty(exports,"NotificationRecorder",{enumerable:true,get:function(){return _recorder.NotificationRecorder}});Object.defineProperty(exports,"NotificationTestView",{enumerable:true,get:function(){return _NotificationTestView.NotificationTestView}});Object.defineProperty(exports,"NotificationToolView",{enumerable:true,get:function(){return _NotificationToolView.NotificationToolView}});Object.defineProperty(exports,"NotificationsIcon",{enumerable:true,get:function(){return _sharedUi.NotificationsIcon}});Object.defineProperty(exports,"NotificationsModal",{enumerable:true,get:function(){return _preset.NotificationsModal}});Object.defineProperty(exports,"attachExpoNotifications",{enumerable:true,get:function(){return _expo.attachExpoNotifications}});Object.defineProperty(exports,"composeSimulatorPayload",{enumerable:true,get:function(){return _payload.composeSimulatorPayload}});Object.defineProperty(exports,"createExpoNotificationStorage",{enumerable:true,get:function(){return _storage.createExpoNotificationStorage}});Object.defineProperty(exports,"createNotificationTool",{enumerable:true,get:function(){return _preset.createNotificationTool}});Object.defineProperty(exports,"expoMetadata",{enumerable:true,get:function(){return _recorder.expoMetadata}});Object.defineProperty(exports,"getNotificationRecorder",{enumerable:true,get:function(){return _runtime.getNotificationRecorder}});Object.defineProperty(exports,"installExpoNotificationCapture",{enumerable:true,get:function(){return _runtime.installExpoNotificationCapture}});Object.defineProperty(exports,"instrumentExpoNotificationHandler",{enumerable:true,get:function(){return _expo.instrumentExpoNotificationHandler}});Object.defineProperty(exports,"instrumentNotificationBackgroundTask",{enumerable:true,get:function(){return _expo.instrumentNotificationBackgroundTask}});Object.defineProperty(exports,"notificationSyncAdapter",{enumerable:true,get:function(){return _runtime.notificationSyncAdapter}});Object.defineProperty(exports,"notificationToolPreset",{enumerable:true,get:function(){return _preset.notificationToolPreset}});Object.defineProperty(exports,"validateSimulatorPayload",{enumerable:true,get:function(){return _payload.validateSimulatorPayload}});var _types=require("./types");Object.keys(_types).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_types[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _types[e]}})});var _recorder=require("./recorder");var _expo=require("./expo");var _runtime=require("./runtime");var _NotificationToolView=require("./components/NotificationToolView");var _preset=require("./preset");var _sharedUi=require("@buoy-gg/shared-ui");var _payload=require("./payload");var _storage=require("./storage");var _NotificationTestView=require("./components/NotificationTestView");
@@ -1,58 +1 @@
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.byteLength=byteLength;exports.json=json;exports.object=object;exports.string=string;function object(t){return t!==null&&typeof t==="object"&&!Array.isArray(t)?t:{}}function string(t){return typeof t==="string"?t:null}function json(t){const r=new WeakSet;function n(e,o){if(e==null)return null;if(typeof e==="string")return e.length>12e3?e.slice(0,12e3)+" [truncated]":e;if(typeof e==="boolean")return e;if(typeof e==="number")return Number.isFinite(e)?e:String(e);if(typeof e!=="object")return String(e);if(r.has(e))return"[Circular]";if(o>12)return"[Depth limit]";r.add(e);if(e instanceof Error)return{name:e.name,message:e.message};if(e instanceof Date)return Number.isNaN(e.getTime())?"[Invalid date]":e.toISOString();if(Array.isArray(e))return e.slice(0,200).map(i=>n(i,o+1));const s={};for(const i of Object.keys(e).slice(0,200)){try{Object.defineProperty(s,i,{value:n(e[i],o+1),enumerable:true})}catch{s[i]="[Unreadable]"}}return s}return n(t,0)}function byteLength(t){let r=0;for(const n of t){const e=n.codePointAt(0);r+=e<=127?1:e<=2047?2:e<=65535?3:4}return r}
@@ -1,68 +1 @@
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.composeSimulatorPayload=composeSimulatorPayload;exports.validateSimulatorPayload=validateSimulatorPayload;var _json=require("./json");function composeSimulatorPayload(a){const e={...a.data,__buoyTestId:a.testId};const s=a.silent?{"content-available":1}:{alert:{title:a.title,body:a.body},sound:"default"};return JSON.stringify(a.adapter==="expo"?{aps:s,body:e}:{...e,aps:s},null,2)}function validateSimulatorPayload(a){const e=[];const s=[];if(typeof a!=="string")return{valid:false,bytes:0,errors:["Provide the APNs payload as JSON text."],warnings:s,testId:null};const i=(0,_json.byteLength)(a);if(i>4096)e.push(`Payload is ${i} bytes. APNs payloads must fit in 4096 UTF-8 bytes.`);let n;try{n=JSON.parse(a)}catch{e.push("Payload is not valid JSON.")}const o=(0,_json.object)(n);if(!n||typeof n!=="object"||Array.isArray(n))e.push("The payload must be a JSON object.");if(!o.aps||typeof o.aps!=="object"||Array.isArray(o.aps))e.push('The payload needs an "aps" object.');const t=(0,_json.object)(o.aps);if(t.alert!==void 0&&typeof t.alert!=="string"&&(t.alert===null||typeof t.alert!=="object"||Array.isArray(t.alert)))e.push("aps.alert must be text or an object.");if(t.badge!==void 0&&(!Number.isInteger(t.badge)||Number(t.badge)<0))e.push("aps.badge must be a non-negative integer.");for(const r of["content-available","mutable-content"])if(t[r]!==void 0&&t[r]!==1)e.push(`aps.${r} must be 1 when present.`);if(t["content-available"]===1)s.push("Background execution depends on app configuration and OS scheduling. A successful send does not prove the task ran.");if(t["mutable-content"]===1)s.push("Use real APNs delivery to verify notification service extensions.");if(o.data!==void 0&&o.body===void 0)s.push("Expo on iOS reads custom data from a top-level body object. This raw payload will be sent unchanged.");const l=(0,_json.object)(o.body).__buoyTestId??o.__buoyTestId;return{valid:e.length===0,bytes:i,errors:e,warnings:s,testId:typeof l==="string"?l:null}}
@@ -1,56 +1 @@
1
- "use strict";
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NotificationsModal=NotificationsModal;exports.notificationToolPreset=exports.createNotificationTool=void 0;var _react=_interopRequireWildcard(require("react"));var _sharedUi=require("@buoy-gg/shared-ui");var _NotificationToolView=require("./components/NotificationToolView");var _runtime=require("./runtime");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(o,n){if("function"==typeof WeakMap)var r=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(t,u){if(!u&&t&&t.__esModule)return t;var e,s,c={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return c;if(e=u?a:r){if(e.has(t))return e.get(t);e.set(t,c)}for(const i in t)"default"!==i&&{}.hasOwnProperty.call(t,i)&&((s=(e=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,i))&&(s.get||s.set)?e(c,i,s):c[i]=t[i]);return c})(o,n)}function NotificationsModal(o){const n=(0,_react.useSyncExternalStore)(_runtime.notificationSyncAdapter.subscribe,_runtime.notificationSyncAdapter.getSnapshot);return(0,_jsxRuntime.jsx)(_NotificationToolView.NotificationToolView,{snapshot:n,renderShell:({header:r,body:a})=>(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{...o,persistenceKey:o.persistenceKey??"buoy-notifications",variant:"night",header:{showToggleButton:true,customContent:r},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:a}),onAction:async(r,a)=>{const t=_runtime.notificationSyncAdapter.actions[r];if(!t)throw new Error("This notification action is unavailable.");return t(a)}})}const notificationToolPreset=exports.notificationToolPreset=(0,_sharedUi.defineToolPreset)({id:"push-notifications",name:"NOTIFICATIONS",description:"Send a test notification and inspect how the app responds",slot:"both",icon:({size:o,color:n})=>(0,_jsxRuntime.jsx)(_sharedUi.NotificationsIcon,{size:o,color:n}),component:NotificationsModal});const createNotificationTool=exports.createNotificationTool=(0,_sharedUi.createToolFactory)(notificationToolPreset);
@@ -1,18 +1 @@
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.normalizePreviewAppearance=normalizePreviewAppearance;function normalizePreviewAppearance(e){if(!e||typeof e!=="object")return void 0;const t={};if(typeof e.appName==="string")t.appName=e.appName.trim().slice(0,80);if(typeof e.iconUri==="string"&&e.iconUri.length<=32768&&/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e.iconUri))t.iconUri=e.iconUri;for(const i of["backgroundColor","textColor"]){if(typeof e[i]==="string"&&/^#[0-9a-f]{6}$/i.test(e[i]))t[i]=e[i]}return Object.keys(t).length?t:void 0}