@buoy-gg/notifications 7.0.41 → 7.0.42
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/lib/commonjs/components/LocalNotificationTest.js +1 -185
- package/lib/commonjs/components/NotificationTestView.js +1 -329
- package/lib/commonjs/components/NotificationToolView.js +1 -673
- package/lib/commonjs/components/notificationStyles.js +1 -292
- package/lib/commonjs/expo.js +1 -247
- package/lib/commonjs/index.js +1 -148
- package/lib/commonjs/json.js +1 -58
- package/lib/commonjs/payload.js +1 -68
- package/lib/commonjs/preset.js +1 -56
- package/lib/commonjs/preview.js +1 -18
- package/lib/commonjs/recorder.js +1 -339
- package/lib/commonjs/runtime.js +1 -110
- package/lib/commonjs/storage.js +1 -61
- package/lib/commonjs/types.js +0 -1
- package/lib/module/components/LocalNotificationTest.js +1 -180
- package/lib/module/components/NotificationTestView.js +1 -324
- package/lib/module/components/NotificationToolView.js +1 -668
- package/lib/module/components/notificationStyles.js +1 -288
- package/lib/module/expo.js +1 -241
- package/lib/module/index.js +1 -13
- package/lib/module/json.js +1 -51
- package/lib/module/payload.js +1 -63
- package/lib/module/preset.js +1 -50
- package/lib/module/preview.js +1 -14
- package/lib/module/recorder.js +1 -332
- package/lib/module/runtime.js +1 -103
- package/lib/module/storage.js +1 -56
- package/lib/module/types.js +0 -1
- package/package.json +2 -2
- package/lib/commonjs/components/LocalNotificationTest.js.map +0 -1
- package/lib/commonjs/components/NotificationTestView.js.map +0 -1
- package/lib/commonjs/components/NotificationToolView.js.map +0 -1
- package/lib/commonjs/components/notificationStyles.js.map +0 -1
- package/lib/commonjs/expo.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/json.js.map +0 -1
- package/lib/commonjs/payload.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/preview.js.map +0 -1
- package/lib/commonjs/recorder.js.map +0 -1
- package/lib/commonjs/runtime.js.map +0 -1
- package/lib/commonjs/storage.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/components/LocalNotificationTest.js.map +0 -1
- package/lib/module/components/NotificationTestView.js.map +0 -1
- package/lib/module/components/NotificationToolView.js.map +0 -1
- package/lib/module/components/notificationStyles.js.map +0 -1
- package/lib/module/expo.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/json.js.map +0 -1
- package/lib/module/payload.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/preview.js.map +0 -1
- package/lib/module/recorder.js.map +0 -1
- package/lib/module/runtime.js.map +0 -1
- package/lib/module/storage.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/components/LocalNotificationTest.d.ts.map +0 -1
- package/lib/typescript/components/NotificationTestView.d.ts.map +0 -1
- package/lib/typescript/components/NotificationToolView.d.ts.map +0 -1
- package/lib/typescript/components/notificationStyles.d.ts.map +0 -1
- package/lib/typescript/expo.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/json.d.ts.map +0 -1
- package/lib/typescript/payload.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/preview.d.ts.map +0 -1
- package/lib/typescript/recorder.d.ts.map +0 -1
- package/lib/typescript/runtime.d.ts.map +0 -1
- package/lib/typescript/storage.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
|
@@ -1,292 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.styles = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
const styles = exports.styles = _reactNative.StyleSheet.create({
|
|
10
|
-
root: {
|
|
11
|
-
flex: 1,
|
|
12
|
-
minHeight: 0,
|
|
13
|
-
backgroundColor: "transparent"
|
|
14
|
-
},
|
|
15
|
-
fill: {
|
|
16
|
-
flex: 1,
|
|
17
|
-
minHeight: 0
|
|
18
|
-
},
|
|
19
|
-
inlineHeader: {
|
|
20
|
-
paddingHorizontal: 12,
|
|
21
|
-
paddingVertical: 8,
|
|
22
|
-
borderBottomWidth: 1,
|
|
23
|
-
borderBottomColor: _sharedUi.night.color.separator
|
|
24
|
-
},
|
|
25
|
-
status: {
|
|
26
|
-
flexDirection: "row",
|
|
27
|
-
alignItems: "center",
|
|
28
|
-
flexWrap: "wrap",
|
|
29
|
-
gap: 12,
|
|
30
|
-
paddingHorizontal: 16,
|
|
31
|
-
paddingVertical: 9
|
|
32
|
-
},
|
|
33
|
-
statusLabel: {
|
|
34
|
-
flexDirection: "row",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
gap: 6
|
|
37
|
-
},
|
|
38
|
-
dot: {
|
|
39
|
-
width: 5,
|
|
40
|
-
height: 5,
|
|
41
|
-
borderRadius: 3,
|
|
42
|
-
backgroundColor: _sharedUi.night.color.textTertiary
|
|
43
|
-
},
|
|
44
|
-
liveDot: {
|
|
45
|
-
backgroundColor: _sharedUi.night.color.accent
|
|
46
|
-
},
|
|
47
|
-
caption: {
|
|
48
|
-
color: _sharedUi.night.color.textSecondary,
|
|
49
|
-
fontSize: 12,
|
|
50
|
-
lineHeight: 17
|
|
51
|
-
},
|
|
52
|
-
provider: {
|
|
53
|
-
color: _sharedUi.night.color.textSecondary,
|
|
54
|
-
fontSize: 11,
|
|
55
|
-
marginLeft: "auto",
|
|
56
|
-
fontFamily: _sharedUi.monoFont
|
|
57
|
-
},
|
|
58
|
-
content: {
|
|
59
|
-
padding: 14,
|
|
60
|
-
gap: 20
|
|
61
|
-
},
|
|
62
|
-
eventList: {
|
|
63
|
-
paddingHorizontal: 12,
|
|
64
|
-
paddingTop: 2
|
|
65
|
-
},
|
|
66
|
-
searchRow: {
|
|
67
|
-
flexDirection: "row",
|
|
68
|
-
gap: 8,
|
|
69
|
-
paddingHorizontal: 12,
|
|
70
|
-
paddingBottom: 10,
|
|
71
|
-
alignItems: "center"
|
|
72
|
-
},
|
|
73
|
-
searchField: {
|
|
74
|
-
flex: 1,
|
|
75
|
-
minWidth: 0,
|
|
76
|
-
height: 36,
|
|
77
|
-
flexDirection: "row",
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
gap: 8,
|
|
80
|
-
paddingHorizontal: 10,
|
|
81
|
-
backgroundColor: _sharedUi.night.color.glass,
|
|
82
|
-
borderWidth: 1,
|
|
83
|
-
borderColor: _sharedUi.night.color.glassBorder,
|
|
84
|
-
borderRadius: _sharedUi.night.radius.row
|
|
85
|
-
},
|
|
86
|
-
searchInput: {
|
|
87
|
-
flex: 1,
|
|
88
|
-
minWidth: 0,
|
|
89
|
-
height: "100%",
|
|
90
|
-
color: _sharedUi.night.color.text,
|
|
91
|
-
fontSize: 13,
|
|
92
|
-
padding: 0
|
|
93
|
-
},
|
|
94
|
-
clearSearch: {
|
|
95
|
-
padding: 6
|
|
96
|
-
},
|
|
97
|
-
iconButton: {
|
|
98
|
-
width: 34,
|
|
99
|
-
height: 34,
|
|
100
|
-
alignItems: "center",
|
|
101
|
-
justifyContent: "center",
|
|
102
|
-
backgroundColor: _sharedUi.night.color.buttonSurface,
|
|
103
|
-
borderRadius: 8,
|
|
104
|
-
borderWidth: 1,
|
|
105
|
-
borderColor: _sharedUi.night.color.border
|
|
106
|
-
},
|
|
107
|
-
event: {
|
|
108
|
-
backgroundColor: _sharedUi.night.color.glass,
|
|
109
|
-
borderRadius: _sharedUi.night.radius.input,
|
|
110
|
-
borderWidth: 1,
|
|
111
|
-
borderColor: _sharedUi.night.color.glassBorder,
|
|
112
|
-
paddingHorizontal: 12,
|
|
113
|
-
paddingVertical: 10,
|
|
114
|
-
marginBottom: 6,
|
|
115
|
-
gap: 6
|
|
116
|
-
},
|
|
117
|
-
eventTop: {
|
|
118
|
-
flexDirection: "row",
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
gap: 10,
|
|
121
|
-
justifyContent: "space-between"
|
|
122
|
-
},
|
|
123
|
-
eventKind: {
|
|
124
|
-
flexDirection: "row",
|
|
125
|
-
alignItems: "center",
|
|
126
|
-
gap: 6,
|
|
127
|
-
flex: 1,
|
|
128
|
-
minWidth: 0
|
|
129
|
-
},
|
|
130
|
-
eventLabel: {
|
|
131
|
-
flexShrink: 1,
|
|
132
|
-
fontSize: 11,
|
|
133
|
-
fontWeight: "600"
|
|
134
|
-
},
|
|
135
|
-
timestamp: {
|
|
136
|
-
color: _sharedUi.night.color.textSecondary,
|
|
137
|
-
fontFamily: _sharedUi.monoFont,
|
|
138
|
-
fontSize: 10
|
|
139
|
-
},
|
|
140
|
-
eventSubject: {
|
|
141
|
-
flexDirection: "row",
|
|
142
|
-
alignItems: "center",
|
|
143
|
-
gap: 8
|
|
144
|
-
},
|
|
145
|
-
eventTitle: {
|
|
146
|
-
flex: 1,
|
|
147
|
-
color: _sharedUi.night.color.text,
|
|
148
|
-
fontSize: 15,
|
|
149
|
-
fontWeight: "500"
|
|
150
|
-
},
|
|
151
|
-
eventMeta: {
|
|
152
|
-
color: _sharedUi.night.color.textSecondary,
|
|
153
|
-
fontFamily: _sharedUi.monoFont,
|
|
154
|
-
fontSize: 10,
|
|
155
|
-
lineHeight: 15
|
|
156
|
-
},
|
|
157
|
-
resultCount: {
|
|
158
|
-
color: _sharedUi.night.color.textSecondary,
|
|
159
|
-
fontSize: 12,
|
|
160
|
-
marginBottom: 10,
|
|
161
|
-
marginLeft: 4
|
|
162
|
-
},
|
|
163
|
-
actionRow: {
|
|
164
|
-
flexDirection: "row",
|
|
165
|
-
alignItems: "center",
|
|
166
|
-
flexWrap: "wrap",
|
|
167
|
-
gap: 8
|
|
168
|
-
},
|
|
169
|
-
button: {
|
|
170
|
-
flexDirection: "row",
|
|
171
|
-
alignItems: "center",
|
|
172
|
-
justifyContent: "center",
|
|
173
|
-
gap: 6,
|
|
174
|
-
minHeight: 34,
|
|
175
|
-
paddingVertical: 8,
|
|
176
|
-
paddingHorizontal: 14,
|
|
177
|
-
borderRadius: _sharedUi.night.radius.pill,
|
|
178
|
-
backgroundColor: _sharedUi.night.color.fillSecondary,
|
|
179
|
-
alignSelf: "flex-start"
|
|
180
|
-
},
|
|
181
|
-
buttonText: {
|
|
182
|
-
color: _sharedUi.night.color.accent,
|
|
183
|
-
fontSize: 13,
|
|
184
|
-
fontWeight: "600"
|
|
185
|
-
},
|
|
186
|
-
primaryButton: {
|
|
187
|
-
backgroundColor: _sharedUi.night.color.accent
|
|
188
|
-
},
|
|
189
|
-
primaryButtonText: {
|
|
190
|
-
color: _sharedUi.night.color.onAccent
|
|
191
|
-
},
|
|
192
|
-
pressed: {
|
|
193
|
-
opacity: 0.7
|
|
194
|
-
},
|
|
195
|
-
disabled: {
|
|
196
|
-
opacity: 0.4
|
|
197
|
-
},
|
|
198
|
-
detailTitle: {
|
|
199
|
-
color: _sharedUi.night.color.text,
|
|
200
|
-
fontSize: 20,
|
|
201
|
-
fontWeight: "600"
|
|
202
|
-
},
|
|
203
|
-
field: {
|
|
204
|
-
flexDirection: "row",
|
|
205
|
-
paddingHorizontal: 16,
|
|
206
|
-
paddingVertical: 12,
|
|
207
|
-
gap: 14
|
|
208
|
-
},
|
|
209
|
-
fieldLabel: {
|
|
210
|
-
width: 110,
|
|
211
|
-
flexShrink: 0
|
|
212
|
-
},
|
|
213
|
-
value: {
|
|
214
|
-
flex: 1,
|
|
215
|
-
minWidth: 0,
|
|
216
|
-
color: _sharedUi.night.color.text,
|
|
217
|
-
fontFamily: _sharedUi.monoFont,
|
|
218
|
-
fontSize: 12,
|
|
219
|
-
lineHeight: 18
|
|
220
|
-
},
|
|
221
|
-
disclosure: {
|
|
222
|
-
flexDirection: "row",
|
|
223
|
-
alignItems: "center",
|
|
224
|
-
justifyContent: "space-between",
|
|
225
|
-
paddingHorizontal: 16,
|
|
226
|
-
paddingVertical: 14
|
|
227
|
-
},
|
|
228
|
-
disclosureTitle: {
|
|
229
|
-
color: _sharedUi.night.color.text,
|
|
230
|
-
fontSize: 13,
|
|
231
|
-
fontWeight: "500"
|
|
232
|
-
},
|
|
233
|
-
jsonBody: {
|
|
234
|
-
padding: 10,
|
|
235
|
-
borderTopWidth: 1,
|
|
236
|
-
borderTopColor: _sharedUi.night.color.separator
|
|
237
|
-
},
|
|
238
|
-
token: {
|
|
239
|
-
color: _sharedUi.night.color.text,
|
|
240
|
-
fontFamily: _sharedUi.monoFont,
|
|
241
|
-
fontSize: 12,
|
|
242
|
-
lineHeight: 20
|
|
243
|
-
},
|
|
244
|
-
bodyText: {
|
|
245
|
-
color: _sharedUi.night.color.text,
|
|
246
|
-
fontSize: 14,
|
|
247
|
-
lineHeight: 21
|
|
248
|
-
},
|
|
249
|
-
footnote: {
|
|
250
|
-
color: _sharedUi.night.color.textSecondary,
|
|
251
|
-
fontSize: 12,
|
|
252
|
-
lineHeight: 18,
|
|
253
|
-
marginTop: 8,
|
|
254
|
-
marginHorizontal: 4
|
|
255
|
-
},
|
|
256
|
-
emptyFootnote: {
|
|
257
|
-
color: _sharedUi.night.color.textSecondary,
|
|
258
|
-
fontSize: 12,
|
|
259
|
-
lineHeight: 18,
|
|
260
|
-
textAlign: "center",
|
|
261
|
-
marginHorizontal: 28
|
|
262
|
-
},
|
|
263
|
-
sectionActions: {
|
|
264
|
-
flexDirection: "row",
|
|
265
|
-
marginBottom: 10
|
|
266
|
-
},
|
|
267
|
-
warning: {
|
|
268
|
-
color: _sharedUi.night.color.warning,
|
|
269
|
-
fontSize: 12,
|
|
270
|
-
lineHeight: 18
|
|
271
|
-
},
|
|
272
|
-
notice: {
|
|
273
|
-
color: _sharedUi.night.color.accent,
|
|
274
|
-
backgroundColor: _sharedUi.night.color.glass,
|
|
275
|
-
paddingHorizontal: 16,
|
|
276
|
-
paddingVertical: 10,
|
|
277
|
-
fontSize: 12,
|
|
278
|
-
lineHeight: 18
|
|
279
|
-
},
|
|
280
|
-
errorNotice: {
|
|
281
|
-
color: _sharedUi.night.color.danger,
|
|
282
|
-
backgroundColor: _sharedUi.night.color.glass,
|
|
283
|
-
paddingHorizontal: 16,
|
|
284
|
-
paddingVertical: 10,
|
|
285
|
-
fontSize: 12,
|
|
286
|
-
lineHeight: 18
|
|
287
|
-
},
|
|
288
|
-
errorText: {
|
|
289
|
-
color: _sharedUi.night.color.danger
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
//# sourceMappingURL=notificationStyles.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");const styles=exports.styles=_reactNative.StyleSheet.create({root:{flex:1,minHeight:0,backgroundColor:"transparent"},fill:{flex:1,minHeight:0},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.separator},status:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:12,paddingHorizontal:16,paddingVertical:9},statusLabel:{flexDirection:"row",alignItems:"center",gap:6},dot:{width:5,height:5,borderRadius:3,backgroundColor:_sharedUi.night.color.textTertiary},liveDot:{backgroundColor:_sharedUi.night.color.accent},caption:{color:_sharedUi.night.color.textSecondary,fontSize:12,lineHeight:17},provider:{color:_sharedUi.night.color.textSecondary,fontSize:11,marginLeft:"auto",fontFamily:_sharedUi.monoFont},content:{padding:14,gap:20},eventList:{paddingHorizontal:12,paddingTop:2},searchRow:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingBottom:10,alignItems:"center"},searchField:{flex:1,minWidth:0,height:36,flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:10,backgroundColor:_sharedUi.night.color.glass,borderWidth:1,borderColor:_sharedUi.night.color.glassBorder,borderRadius:_sharedUi.night.radius.row},searchInput:{flex:1,minWidth:0,height:"100%",color:_sharedUi.night.color.text,fontSize:13,padding:0},clearSearch:{padding:6},iconButton:{width:34,height:34,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.night.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border},event:{backgroundColor:_sharedUi.night.color.glass,borderRadius:_sharedUi.night.radius.input,borderWidth:1,borderColor:_sharedUi.night.color.glassBorder,paddingHorizontal:12,paddingVertical:10,marginBottom:6,gap:6},eventTop:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},eventKind:{flexDirection:"row",alignItems:"center",gap:6,flex:1,minWidth:0},eventLabel:{flexShrink:1,fontSize:11,fontWeight:"600"},timestamp:{color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,fontSize:10},eventSubject:{flexDirection:"row",alignItems:"center",gap:8},eventTitle:{flex:1,color:_sharedUi.night.color.text,fontSize:15,fontWeight:"500"},eventMeta:{color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,fontSize:10,lineHeight:15},resultCount:{color:_sharedUi.night.color.textSecondary,fontSize:12,marginBottom:10,marginLeft:4},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8},button:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,minHeight:34,paddingVertical:8,paddingHorizontal:14,borderRadius:_sharedUi.night.radius.pill,backgroundColor:_sharedUi.night.color.fillSecondary,alignSelf:"flex-start"},buttonText:{color:_sharedUi.night.color.accent,fontSize:13,fontWeight:"600"},primaryButton:{backgroundColor:_sharedUi.night.color.accent},primaryButtonText:{color:_sharedUi.night.color.onAccent},pressed:{opacity:.7},disabled:{opacity:.4},detailTitle:{color:_sharedUi.night.color.text,fontSize:20,fontWeight:"600"},field:{flexDirection:"row",paddingHorizontal:16,paddingVertical:12,gap:14},fieldLabel:{width:110,flexShrink:0},value:{flex:1,minWidth:0,color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,fontSize:12,lineHeight:18},disclosure:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14},disclosureTitle:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"500"},jsonBody:{padding:10,borderTopWidth:1,borderTopColor:_sharedUi.night.color.separator},token:{color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont,fontSize:12,lineHeight:20},bodyText:{color:_sharedUi.night.color.text,fontSize:14,lineHeight:21},footnote:{color:_sharedUi.night.color.textSecondary,fontSize:12,lineHeight:18,marginTop:8,marginHorizontal:4},emptyFootnote:{color:_sharedUi.night.color.textSecondary,fontSize:12,lineHeight:18,textAlign:"center",marginHorizontal:28},sectionActions:{flexDirection:"row",marginBottom:10},warning:{color:_sharedUi.night.color.warning,fontSize:12,lineHeight:18},notice:{color:_sharedUi.night.color.accent,backgroundColor:_sharedUi.night.color.glass,paddingHorizontal:16,paddingVertical:10,fontSize:12,lineHeight:18},errorNotice:{color:_sharedUi.night.color.danger,backgroundColor:_sharedUi.night.color.glass,paddingHorizontal:16,paddingVertical:10,fontSize:12,lineHeight:18},errorText:{color:_sharedUi.night.color.danger}});
|
package/lib/commonjs/expo.js
CHANGED
|
@@ -1,247 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.attachExpoNotifications = attachExpoNotifications;
|
|
7
|
-
exports.expoBackgroundMetadata = expoBackgroundMetadata;
|
|
8
|
-
exports.instrumentExpoNotificationHandler = instrumentExpoNotificationHandler;
|
|
9
|
-
exports.instrumentNotificationBackgroundTask = instrumentNotificationBackgroundTask;
|
|
10
|
-
var _preview = require("./preview");
|
|
11
|
-
var _recorder = require("./recorder");
|
|
12
|
-
var _json = require("./json");
|
|
13
|
-
// Structural interfaces let the app pass its installed SDK without a native dependency.
|
|
14
|
-
|
|
15
|
-
function timeout(promise, ms = 15000) {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const timer = setTimeout(() => reject(new Error("Notification SDK timed out. Check permission and network settings, then retry.")), ms);
|
|
18
|
-
promise.then(value => {
|
|
19
|
-
clearTimeout(timer);
|
|
20
|
-
resolve(value);
|
|
21
|
-
}, error => {
|
|
22
|
-
clearTimeout(timer);
|
|
23
|
-
reject(error);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Does not replace presentation, routing or background handlers. */
|
|
29
|
-
function attachExpoNotifications(recorder, sdk, options) {
|
|
30
|
-
const capabilities = ["received", "responses", "permissions", "device-token"];
|
|
31
|
-
if (sdk.getLastNotificationResponse || sdk.getLastNotificationResponseAsync) capabilities.push("startup-response");
|
|
32
|
-
if (sdk.getPresentedNotificationsAsync) capabilities.push("presented");
|
|
33
|
-
if (sdk.scheduleNotificationAsync) capabilities.push("local-scheduling");
|
|
34
|
-
if (options.projectId && sdk.getExpoPushTokenAsync) capabilities.push("expo-token");
|
|
35
|
-
recorder.configure({
|
|
36
|
-
preview: (0, _preview.normalizePreviewAppearance)(options.preview),
|
|
37
|
-
provider: "expo",
|
|
38
|
-
platform: options.platform,
|
|
39
|
-
appId: options.appId ?? null,
|
|
40
|
-
providerVersion: options.providerVersion ?? null,
|
|
41
|
-
capabilities
|
|
42
|
-
});
|
|
43
|
-
let disposed = false;
|
|
44
|
-
const subscriptions = [];
|
|
45
|
-
const response = (value, startup = false) => {
|
|
46
|
-
if (disposed || !value) return;
|
|
47
|
-
void recorder.record(startup ? "startup-response" : "response", value, {
|
|
48
|
-
...(0, _recorder.expoMetadata)(value),
|
|
49
|
-
dedupeKey: (0, _recorder.responseKey)(value)
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
try {
|
|
53
|
-
subscriptions.push(sdk.addNotificationReceivedListener(value => {
|
|
54
|
-
if (!disposed) void recorder.record("received", value, (0, _recorder.expoMetadata)(value));
|
|
55
|
-
}));
|
|
56
|
-
subscriptions.push(sdk.addNotificationResponseReceivedListener(value => response(value)));
|
|
57
|
-
subscriptions.push(sdk.addPushTokenListener(token => {
|
|
58
|
-
// Token acquisition here can trigger this listener recursively.
|
|
59
|
-
if (!disposed && (token.type === "ios" || token.type === "android")) void recorder.observeToken(token.type === "ios" ? "apns" : "fcm", token.data).catch(() => {});
|
|
60
|
-
}));
|
|
61
|
-
} catch (error) {
|
|
62
|
-
for (const subscription of subscriptions) subscription.remove();
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
const initial = Promise.resolve().then(() => sdk.getLastNotificationResponse?.() ?? sdk.getLastNotificationResponseAsync?.()).then(value => response(value, true));
|
|
66
|
-
void initial.catch(() => {});
|
|
67
|
-
const actions = {
|
|
68
|
-
async getPermissions() {
|
|
69
|
-
const permissions = await timeout(sdk.getPermissionsAsync());
|
|
70
|
-
recorder.setPermissions(permissions);
|
|
71
|
-
return recorder.getSnapshot().permissions;
|
|
72
|
-
},
|
|
73
|
-
async listPresented() {
|
|
74
|
-
if (!sdk.getPresentedNotificationsAsync) throw new Error("This notification SDK cannot list presented notifications.");
|
|
75
|
-
const presented = await timeout(sdk.getPresentedNotificationsAsync());
|
|
76
|
-
recorder.setPresented(presented);
|
|
77
|
-
return recorder.getSnapshot().presented;
|
|
78
|
-
},
|
|
79
|
-
async refreshToken(params) {
|
|
80
|
-
const {
|
|
81
|
-
type
|
|
82
|
-
} = (0, _json.object)(params);
|
|
83
|
-
if (type === "expo") {
|
|
84
|
-
if (!sdk.getExpoPushTokenAsync || !options.projectId) throw new Error("Set projectId in installExpoNotificationCapture before requesting an Expo token.");
|
|
85
|
-
const token = await timeout(sdk.getExpoPushTokenAsync({
|
|
86
|
-
projectId: options.projectId
|
|
87
|
-
}));
|
|
88
|
-
await recorder.observeToken("expo", token.data, {
|
|
89
|
-
projectId: options.projectId
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
type: "expo",
|
|
93
|
-
value: token.data
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
if (type !== "device") throw new Error('Token type must be "device" or "expo".');
|
|
97
|
-
if (!sdk.getDevicePushTokenAsync) throw new Error("This notification SDK cannot register a device token.");
|
|
98
|
-
const token = await timeout(sdk.getDevicePushTokenAsync());
|
|
99
|
-
if (token.type !== "ios" && token.type !== "android") throw new Error("This platform does not provide an APNs or FCM token.");
|
|
100
|
-
await recorder.observeToken(token.type === "ios" ? "apns" : "fcm", token.data);
|
|
101
|
-
return {
|
|
102
|
-
type: token.type === "ios" ? "apns" : "fcm",
|
|
103
|
-
value: token.data
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
async scheduleLocal(params) {
|
|
107
|
-
if (!sdk.scheduleNotificationAsync) throw new Error("This notification SDK cannot schedule local notifications.");
|
|
108
|
-
const {
|
|
109
|
-
title,
|
|
110
|
-
body,
|
|
111
|
-
data,
|
|
112
|
-
seconds
|
|
113
|
-
} = (0, _json.object)(params);
|
|
114
|
-
if (typeof title !== "string" || typeof body !== "string" || typeof seconds !== "number" || !Number.isFinite(seconds) || seconds < 1 || seconds > 3600) throw new Error("Provide title, body and a delay from 1 to 3600 seconds.");
|
|
115
|
-
if (data !== undefined && (data === null || typeof data !== "object" || Array.isArray(data))) throw new Error("Local notification data must be an object.");
|
|
116
|
-
const id = await timeout(sdk.scheduleNotificationAsync({
|
|
117
|
-
content: {
|
|
118
|
-
title,
|
|
119
|
-
body,
|
|
120
|
-
data: data ?? {}
|
|
121
|
-
},
|
|
122
|
-
trigger: {
|
|
123
|
-
type: "timeInterval",
|
|
124
|
-
seconds,
|
|
125
|
-
repeats: false
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
await recorder.record("local-scheduled", {
|
|
129
|
-
title,
|
|
130
|
-
body,
|
|
131
|
-
data,
|
|
132
|
-
seconds
|
|
133
|
-
}, {
|
|
134
|
-
notificationId: id,
|
|
135
|
-
title,
|
|
136
|
-
testId: typeof (0, _json.object)(data).__buoyTestId === "string" ? (0, _json.object)(data).__buoyTestId : null
|
|
137
|
-
});
|
|
138
|
-
return {
|
|
139
|
-
notificationId: id,
|
|
140
|
-
transport: "local"
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
void actions.getPermissions().catch(() => {});
|
|
145
|
-
return {
|
|
146
|
-
actions,
|
|
147
|
-
ready: initial,
|
|
148
|
-
dispose() {
|
|
149
|
-
disposed = true;
|
|
150
|
-
for (const subscription of subscriptions) subscription.remove();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** Wrap the handler the app already passes to Notifications.setNotificationHandler. */
|
|
156
|
-
function instrumentExpoNotificationHandler(recorder, handler) {
|
|
157
|
-
const metadataById = new Map();
|
|
158
|
-
return {
|
|
159
|
-
...handler,
|
|
160
|
-
handleNotification: async function (...args) {
|
|
161
|
-
const metadata = (0, _recorder.expoMetadata)(args[0]);
|
|
162
|
-
if (metadata.notificationId) metadataById.set(metadata.notificationId, metadata);
|
|
163
|
-
if (metadataById.size > 50) metadataById.delete(metadataById.keys().next().value);
|
|
164
|
-
try {
|
|
165
|
-
const behavior = await handler.handleNotification.apply(this, args);
|
|
166
|
-
void recorder.record("presentation-decision", {
|
|
167
|
-
notification: args[0],
|
|
168
|
-
behavior
|
|
169
|
-
}, (0, _recorder.expoMetadata)(args[0]));
|
|
170
|
-
return behavior;
|
|
171
|
-
} catch (error) {
|
|
172
|
-
void recorder.record("presentation-error", {
|
|
173
|
-
notification: args[0],
|
|
174
|
-
error
|
|
175
|
-
}, (0, _recorder.expoMetadata)(args[0]));
|
|
176
|
-
throw error;
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
handleError: function (...args) {
|
|
180
|
-
const identifier = (0, _json.string)(args[0]);
|
|
181
|
-
const metadata = identifier ? metadataById.get(identifier) : undefined;
|
|
182
|
-
if (identifier) metadataById.delete(identifier);
|
|
183
|
-
void recorder.record("presentation-error", {
|
|
184
|
-
source: "sdk",
|
|
185
|
-
identifier,
|
|
186
|
-
error: args[1]
|
|
187
|
-
}, metadata ?? {
|
|
188
|
-
notificationId: identifier
|
|
189
|
-
});
|
|
190
|
-
return handler.handleError?.apply(this, args);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/** Expo's background task payload differs from its foreground Notification object. */
|
|
196
|
-
function expoBackgroundMetadata(value) {
|
|
197
|
-
const metadata = (0, _recorder.expoMetadata)(value);
|
|
198
|
-
const raw = (0, _json.object)(value);
|
|
199
|
-
const data = (0, _json.object)(raw.data);
|
|
200
|
-
const launchPayload = (0, _json.object)(data.UIApplicationLaunchOptionsRemoteNotificationKey);
|
|
201
|
-
let parsed = {};
|
|
202
|
-
if (typeof data.dataString === "string") {
|
|
203
|
-
try {
|
|
204
|
-
parsed = (0, _json.object)(JSON.parse(data.dataString));
|
|
205
|
-
} catch {/* Keep malformed data visible in the raw record. */}
|
|
206
|
-
}
|
|
207
|
-
const custom = (0, _json.object)(data.body ?? raw.body ?? launchPayload.body);
|
|
208
|
-
return {
|
|
209
|
-
...metadata,
|
|
210
|
-
testId: metadata.testId ?? (0, _json.string)(parsed.__buoyTestId) ?? (0, _json.string)(custom.__buoyTestId),
|
|
211
|
-
title: metadata.title ?? (0, _json.string)((0, _json.object)(raw.notification).title) ?? (0, _json.string)((0, _json.object)((0, _json.object)(raw.aps ?? launchPayload.aps).alert).title)
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/** Await local capture for at most 250 ms without extending the task for a desktop connection. */
|
|
216
|
-
async function persistBounded(promise) {
|
|
217
|
-
let timer;
|
|
218
|
-
await Promise.race([promise.catch(() => {}), new Promise(resolve => {
|
|
219
|
-
timer = setTimeout(resolve, 250);
|
|
220
|
-
})]);
|
|
221
|
-
if (timer) clearTimeout(timer);
|
|
222
|
-
}
|
|
223
|
-
function instrumentNotificationBackgroundTask(recorder, task) {
|
|
224
|
-
recorder.configure({
|
|
225
|
-
capabilities: [...new Set([...recorder.getSnapshot().capabilities, "background-task"])]
|
|
226
|
-
});
|
|
227
|
-
return async function (...args) {
|
|
228
|
-
const value = (0, _json.object)(args[0]).data ?? args[0];
|
|
229
|
-
const metadata = expoBackgroundMetadata(value);
|
|
230
|
-
await persistBounded(recorder.record("background-started", args[0], metadata));
|
|
231
|
-
try {
|
|
232
|
-
const result = await task.apply(this, args);
|
|
233
|
-
await persistBounded(recorder.record("background-completed", {
|
|
234
|
-
input: args[0],
|
|
235
|
-
result
|
|
236
|
-
}, metadata));
|
|
237
|
-
return result;
|
|
238
|
-
} catch (error) {
|
|
239
|
-
await persistBounded(recorder.record("background-error", {
|
|
240
|
-
input: args[0],
|
|
241
|
-
error
|
|
242
|
-
}, metadata));
|
|
243
|
-
throw error;
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
//# sourceMappingURL=expo.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.attachExpoNotifications=attachExpoNotifications;exports.expoBackgroundMetadata=expoBackgroundMetadata;exports.instrumentExpoNotificationHandler=instrumentExpoNotificationHandler;exports.instrumentNotificationBackgroundTask=instrumentNotificationBackgroundTask;var _preview=require("./preview");var _recorder=require("./recorder");var _json=require("./json");function timeout(o,t=15e3){return new Promise((e,n)=>{const s=setTimeout(()=>n(new Error("Notification SDK timed out. Check permission and network settings, then retry.")),t);o.then(a=>{clearTimeout(s);e(a)},a=>{clearTimeout(s);n(a)})})}function attachExpoNotifications(o,t,e){const n=["received","responses","permissions","device-token"];if(t.getLastNotificationResponse||t.getLastNotificationResponseAsync)n.push("startup-response");if(t.getPresentedNotificationsAsync)n.push("presented");if(t.scheduleNotificationAsync)n.push("local-scheduling");if(e.projectId&&t.getExpoPushTokenAsync)n.push("expo-token");o.configure({preview:(0,_preview.normalizePreviewAppearance)(e.preview),provider:"expo",platform:e.platform,appId:e.appId??null,providerVersion:e.providerVersion??null,capabilities:n});let s=false;const a=[];const u=(i,r=false)=>{if(s||!i)return;void o.record(r?"startup-response":"response",i,{...(0,_recorder.expoMetadata)(i),dedupeKey:(0,_recorder.responseKey)(i)})};try{a.push(t.addNotificationReceivedListener(i=>{if(!s)void o.record("received",i,(0,_recorder.expoMetadata)(i))}));a.push(t.addNotificationResponseReceivedListener(i=>u(i)));a.push(t.addPushTokenListener(i=>{if(!s&&(i.type==="ios"||i.type==="android"))void o.observeToken(i.type==="ios"?"apns":"fcm",i.data).catch(()=>{})}))}catch(i){for(const r of a)r.remove();throw i}const f=Promise.resolve().then(()=>t.getLastNotificationResponse?.()??t.getLastNotificationResponseAsync?.()).then(i=>u(i,true));void f.catch(()=>{});const l={async getPermissions(){const i=await timeout(t.getPermissionsAsync());o.setPermissions(i);return o.getSnapshot().permissions},async listPresented(){if(!t.getPresentedNotificationsAsync)throw new Error("This notification SDK cannot list presented notifications.");const i=await timeout(t.getPresentedNotificationsAsync());o.setPresented(i);return o.getSnapshot().presented},async refreshToken(i){const{type:r}=(0,_json.object)(i);if(r==="expo"){if(!t.getExpoPushTokenAsync||!e.projectId)throw new Error("Set projectId in installExpoNotificationCapture before requesting an Expo token.");const c=await timeout(t.getExpoPushTokenAsync({projectId:e.projectId}));await o.observeToken("expo",c.data,{projectId:e.projectId});return{type:"expo",value:c.data}}if(r!=="device")throw new Error('Token type must be "device" or "expo".');if(!t.getDevicePushTokenAsync)throw new Error("This notification SDK cannot register a device token.");const p=await timeout(t.getDevicePushTokenAsync());if(p.type!=="ios"&&p.type!=="android")throw new Error("This platform does not provide an APNs or FCM token.");await o.observeToken(p.type==="ios"?"apns":"fcm",p.data);return{type:p.type==="ios"?"apns":"fcm",value:p.data}},async scheduleLocal(i){if(!t.scheduleNotificationAsync)throw new Error("This notification SDK cannot schedule local notifications.");const{title:r,body:p,data:c,seconds:d}=(0,_json.object)(i);if(typeof r!=="string"||typeof p!=="string"||typeof d!=="number"||!Number.isFinite(d)||d<1||d>3600)throw new Error("Provide title, body and a delay from 1 to 3600 seconds.");if(c!==void 0&&(c===null||typeof c!=="object"||Array.isArray(c)))throw new Error("Local notification data must be an object.");const y=await timeout(t.scheduleNotificationAsync({content:{title:r,body:p,data:c??{}},trigger:{type:"timeInterval",seconds:d,repeats:false}}));await o.record("local-scheduled",{title:r,body:p,data:c,seconds:d},{notificationId:y,title:r,testId:typeof(0,_json.object)(c).__buoyTestId==="string"?(0,_json.object)(c).__buoyTestId:null});return{notificationId:y,transport:"local"}}};void l.getPermissions().catch(()=>{});return{actions:l,ready:f,dispose(){s=true;for(const i of a)i.remove()}}}function instrumentExpoNotificationHandler(o,t){const e=new Map;return{...t,handleNotification:async function(...n){const s=(0,_recorder.expoMetadata)(n[0]);if(s.notificationId)e.set(s.notificationId,s);if(e.size>50)e.delete(e.keys().next().value);try{const a=await t.handleNotification.apply(this,n);void o.record("presentation-decision",{notification:n[0],behavior:a},(0,_recorder.expoMetadata)(n[0]));return a}catch(a){void o.record("presentation-error",{notification:n[0],error:a},(0,_recorder.expoMetadata)(n[0]));throw a}},handleError:function(...n){const s=(0,_json.string)(n[0]);const a=s?e.get(s):void 0;if(s)e.delete(s);void o.record("presentation-error",{source:"sdk",identifier:s,error:n[1]},a??{notificationId:s});return t.handleError?.apply(this,n)}}}function expoBackgroundMetadata(o){const t=(0,_recorder.expoMetadata)(o);const e=(0,_json.object)(o);const n=(0,_json.object)(e.data);const s=(0,_json.object)(n.UIApplicationLaunchOptionsRemoteNotificationKey);let a={};if(typeof n.dataString==="string"){try{a=(0,_json.object)(JSON.parse(n.dataString))}catch{}}const u=(0,_json.object)(n.body??e.body??s.body);return{...t,testId:t.testId??(0,_json.string)(a.__buoyTestId)??(0,_json.string)(u.__buoyTestId),title:t.title??(0,_json.string)((0,_json.object)(e.notification).title)??(0,_json.string)((0,_json.object)((0,_json.object)(e.aps??s.aps).alert).title)}}async function persistBounded(o){let t;await Promise.race([o.catch(()=>{}),new Promise(e=>{t=setTimeout(e,250)})]);if(t)clearTimeout(t)}function instrumentNotificationBackgroundTask(o,t){o.configure({capabilities:[...new Set([...o.getSnapshot().capabilities,"background-task"])]});return async function(...e){const n=(0,_json.object)(e[0]).data??e[0];const s=expoBackgroundMetadata(n);await persistBounded(o.record("background-started",e[0],s));try{const a=await t.apply(this,e);await persistBounded(o.record("background-completed",{input:e[0],result:a},s));return a}catch(a){await persistBounded(o.record("background-error",{input:e[0],error:a},s));throw a}}}
|