@bubblsdk/react-native-sdk 4.1.7 → 5.0.0-alpha.2

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 (176) hide show
  1. package/BubblReactNativeSdk.podspec +29 -9
  2. package/CHANGELOG.md +52 -1
  3. package/LICENSE +202 -1
  4. package/README.md +172 -83
  5. package/android/build.gradle +33 -30
  6. package/android/src/main/AndroidManifest.xml +1 -0
  7. package/android/src/main/java/tech/bubbl/reactnative/BubblJson.kt +135 -0
  8. package/android/src/main/java/tech/bubbl/reactnative/BubblSdkModule.kt +277 -0
  9. package/android/src/main/java/tech/bubbl/reactnative/BubblSdkPackage.kt +26 -0
  10. package/app.plugin.js +2 -0
  11. package/ios/BubblPush.swift +44 -0
  12. package/ios/BubblSdk.h +7 -0
  13. package/ios/BubblSdk.mm +252 -0
  14. package/ios/BubblSdkImpl.swift +335 -0
  15. package/ios-extension/BubblReactNativeNotificationService.podspec +44 -0
  16. package/ios-extension/Sources/BubblCore/API/ApiResponse.swift +90 -0
  17. package/ios-extension/Sources/BubblCore/API/CredentialStore.swift +116 -0
  18. package/ios-extension/Sources/BubblCore/API/DeviceApiClient.swift +239 -0
  19. package/ios-extension/Sources/BubblCore/API/ErrorActions.swift +68 -0
  20. package/ios-extension/Sources/BubblCore/API/Http.swift +39 -0
  21. package/ios-extension/Sources/BubblCore/API/ServerClock.swift +69 -0
  22. package/ios-extension/Sources/BubblCore/BubblVersion.swift +5 -0
  23. package/ios-extension/Sources/BubblCore/Device/ConfigSync.swift +216 -0
  24. package/ios-extension/Sources/BubblCore/Device/DeviceSync.swift +160 -0
  25. package/ios-extension/Sources/BubblCore/Device/ProvisioningProfile.swift +24 -0
  26. package/ios-extension/Sources/BubblCore/Engine/EngineCore.swift +523 -0
  27. package/ios-extension/Sources/BubblCore/Engine/Geofencing.swift +170 -0
  28. package/ios-extension/Sources/BubblCore/Engine/Permissions.swift +90 -0
  29. package/ios-extension/Sources/BubblCore/Engine/Privacy.swift +64 -0
  30. package/ios-extension/Sources/BubblCore/Engine/PrivacyControls.swift +184 -0
  31. package/ios-extension/Sources/BubblCore/Engine/Pushes.swift +61 -0
  32. package/ios-extension/Sources/BubblCore/Engine/Sandbox.swift +149 -0
  33. package/ios-extension/Sources/BubblCore/Events/EventQueue.swift +207 -0
  34. package/ios-extension/Sources/BubblCore/Events/EventStore.swift +159 -0
  35. package/ios-extension/Sources/BubblCore/Geofence/Geofence.swift +160 -0
  36. package/ios-extension/Sources/BubblCore/Geofence/GeofenceEngine.swift +488 -0
  37. package/ios-extension/Sources/BubblCore/Geofence/GeofenceState.swift +103 -0
  38. package/ios-extension/Sources/BubblCore/Geofence/RegionBudget.swift +62 -0
  39. package/ios-extension/Sources/BubblCore/Notification/BubblNotification.swift +137 -0
  40. package/ios-extension/Sources/BubblCore/Notification/NotificationEvents.swift +160 -0
  41. package/ios-extension/Sources/BubblCore/Notification/Push.swift +134 -0
  42. package/ios-extension/Sources/BubblCore/Notification/SurveyForm.swift +185 -0
  43. package/ios-extension/Sources/BubblCore/RequestSigner.swift +56 -0
  44. package/ios-extension/Sources/BubblCore/Support/AsyncMutex.swift +39 -0
  45. package/ios-extension/Sources/BubblCore/Support/BubblLog.swift +52 -0
  46. package/ios-extension/Sources/BubblCore/Support/JSON.swift +31 -0
  47. package/ios-extension/Sources/BubblCore/Support/JSONValue.swift +94 -0
  48. package/ios-extension/Sources/BubblCore/Support/Locking.swift +11 -0
  49. package/ios-extension/Sources/BubblCore/Support/ValueStore.swift +109 -0
  50. package/ios-extension/Sources/BubblNotificationService/BubblNotificationService.swift +124 -0
  51. package/ios-sdk/BubblCore/API/ApiResponse.swift +90 -0
  52. package/ios-sdk/BubblCore/API/CredentialStore.swift +116 -0
  53. package/ios-sdk/BubblCore/API/DeviceApiClient.swift +239 -0
  54. package/ios-sdk/BubblCore/API/ErrorActions.swift +68 -0
  55. package/ios-sdk/BubblCore/API/Http.swift +39 -0
  56. package/ios-sdk/BubblCore/API/ServerClock.swift +69 -0
  57. package/ios-sdk/BubblCore/BubblVersion.swift +5 -0
  58. package/ios-sdk/BubblCore/Device/ConfigSync.swift +216 -0
  59. package/ios-sdk/BubblCore/Device/DeviceSync.swift +160 -0
  60. package/ios-sdk/BubblCore/Device/ProvisioningProfile.swift +24 -0
  61. package/ios-sdk/BubblCore/Engine/EngineCore.swift +523 -0
  62. package/ios-sdk/BubblCore/Engine/Geofencing.swift +170 -0
  63. package/ios-sdk/BubblCore/Engine/Permissions.swift +90 -0
  64. package/ios-sdk/BubblCore/Engine/Privacy.swift +64 -0
  65. package/ios-sdk/BubblCore/Engine/PrivacyControls.swift +184 -0
  66. package/ios-sdk/BubblCore/Engine/Pushes.swift +61 -0
  67. package/ios-sdk/BubblCore/Engine/Sandbox.swift +149 -0
  68. package/ios-sdk/BubblCore/Events/EventQueue.swift +207 -0
  69. package/ios-sdk/BubblCore/Events/EventStore.swift +159 -0
  70. package/ios-sdk/BubblCore/Geofence/Geofence.swift +160 -0
  71. package/ios-sdk/BubblCore/Geofence/GeofenceEngine.swift +488 -0
  72. package/ios-sdk/BubblCore/Geofence/GeofenceState.swift +103 -0
  73. package/ios-sdk/BubblCore/Geofence/RegionBudget.swift +62 -0
  74. package/ios-sdk/BubblCore/Notification/BubblNotification.swift +137 -0
  75. package/ios-sdk/BubblCore/Notification/NotificationEvents.swift +160 -0
  76. package/ios-sdk/BubblCore/Notification/Push.swift +134 -0
  77. package/ios-sdk/BubblCore/Notification/SurveyForm.swift +185 -0
  78. package/ios-sdk/BubblCore/RequestSigner.swift +56 -0
  79. package/ios-sdk/BubblCore/Support/AsyncMutex.swift +39 -0
  80. package/ios-sdk/BubblCore/Support/BubblLog.swift +52 -0
  81. package/ios-sdk/BubblCore/Support/JSON.swift +31 -0
  82. package/ios-sdk/BubblCore/Support/JSONValue.swift +94 -0
  83. package/ios-sdk/BubblCore/Support/Locking.swift +11 -0
  84. package/ios-sdk/BubblCore/Support/ValueStore.swift +109 -0
  85. package/ios-sdk/BubblLaunch/BubblLaunch.m +45 -0
  86. package/ios-sdk/BubblLaunch/include/BubblLaunch.h +5 -0
  87. package/ios-sdk/BubblSDK/Bubbl.swift +308 -0
  88. package/ios-sdk/BubblSDK/BubblBackend.swift +118 -0
  89. package/ios-sdk/BubblSDK/BubblCredential.swift +30 -0
  90. package/ios-sdk/BubblSDK/BubblMessage.swift +151 -0
  91. package/ios-sdk/BubblSDK/BubblOptions.swift +39 -0
  92. package/ios-sdk/BubblSDK/BubblPermissions.swift +79 -0
  93. package/ios-sdk/BubblSDK/BubblTestDeviceResult.swift +10 -0
  94. package/ios-sdk/BubblSDK/Engine/BackgroundRefresh.swift +92 -0
  95. package/ios-sdk/BubblSDK/Engine/EngineHost+Geofences.swift +177 -0
  96. package/ios-sdk/BubblSDK/Engine/EngineHost+Privacy.swift +65 -0
  97. package/ios-sdk/BubblSDK/Engine/EngineHost+Push.swift +154 -0
  98. package/ios-sdk/BubblSDK/Engine/EngineHost.swift +356 -0
  99. package/ios-sdk/BubblSDK/Engine/SupportedBubbl.swift +320 -0
  100. package/ios-sdk/BubblSDK/Engine/SystemLog.swift +27 -0
  101. package/ios-sdk/BubblSDK/Engine/WorkRunner.swift +107 -0
  102. package/ios-sdk/BubblSDK/Notification/Look.swift +78 -0
  103. package/ios-sdk/BubblSDK/Notification/NotificationMedia.swift +329 -0
  104. package/ios-sdk/BubblSDK/Notification/NotificationModel.swift +172 -0
  105. package/ios-sdk/BubblSDK/Notification/NotificationScreen.swift +428 -0
  106. package/ios-sdk/BubblSDK/Notification/ScreenPresenter.swift +148 -0
  107. package/ios-sdk/BubblSDK/Permissions/PermissionFlow.swift +169 -0
  108. package/ios-sdk/BubblSDK/Permissions/PrivacyView.swift +110 -0
  109. package/ios-sdk/BubblSDK/Platform/AppleDevicePlatform.swift +95 -0
  110. package/ios-sdk/BubblSDK/Platform/KeychainCredentialStore.swift +114 -0
  111. package/ios-sdk/BubblSDK/Platform/LocationService.swift +418 -0
  112. package/ios-sdk/BubblSDK/Platform/PushIntegration.swift +288 -0
  113. package/ios-sdk/BubblSDK/Platform/URLSessionHttpClient.swift +69 -0
  114. package/ios-sdk/BubblSDK/PrivacyInfo.xcprivacy +76 -0
  115. package/jest/index.js +75 -0
  116. package/lib/commonjs/BubblModule.js +14 -0
  117. package/lib/commonjs/BubblModule.js.map +1 -0
  118. package/lib/commonjs/BubblModule.web.js +13 -0
  119. package/lib/commonjs/BubblModule.web.js.map +1 -0
  120. package/lib/commonjs/NativeBubblSdk.js +20 -0
  121. package/lib/commonjs/NativeBubblSdk.js.map +1 -0
  122. package/lib/commonjs/index.js +336 -0
  123. package/lib/commonjs/index.js.map +1 -0
  124. package/lib/commonjs/package.json +1 -0
  125. package/lib/commonjs/types.js +2 -0
  126. package/lib/commonjs/types.js.map +1 -0
  127. package/lib/module/BubblModule.js +5 -0
  128. package/lib/module/BubblModule.js.map +1 -0
  129. package/lib/module/BubblModule.web.js +9 -0
  130. package/lib/module/BubblModule.web.js.map +1 -0
  131. package/lib/module/NativeBubblSdk.js +18 -0
  132. package/lib/module/NativeBubblSdk.js.map +1 -0
  133. package/lib/module/index.js +331 -0
  134. package/lib/module/index.js.map +1 -0
  135. package/lib/module/package.json +1 -0
  136. package/lib/module/types.js +2 -0
  137. package/lib/module/types.js.map +1 -0
  138. package/lib/typescript/commonjs/package.json +1 -0
  139. package/lib/typescript/commonjs/src/BubblModule.d.ts +3 -0
  140. package/lib/typescript/commonjs/src/BubblModule.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/BubblModule.web.d.ts +8 -0
  142. package/lib/typescript/commonjs/src/BubblModule.web.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/NativeBubblSdk.d.ts +59 -0
  144. package/lib/typescript/commonjs/src/NativeBubblSdk.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/index.d.ts +111 -0
  146. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/types.d.ts +192 -0
  148. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  149. package/lib/typescript/module/package.json +1 -0
  150. package/lib/typescript/module/src/BubblModule.d.ts +3 -0
  151. package/lib/typescript/module/src/BubblModule.d.ts.map +1 -0
  152. package/lib/typescript/module/src/BubblModule.web.d.ts +8 -0
  153. package/lib/typescript/module/src/BubblModule.web.d.ts.map +1 -0
  154. package/lib/typescript/module/src/NativeBubblSdk.d.ts +59 -0
  155. package/lib/typescript/module/src/NativeBubblSdk.d.ts.map +1 -0
  156. package/lib/typescript/module/src/index.d.ts +111 -0
  157. package/lib/typescript/module/src/index.d.ts.map +1 -0
  158. package/lib/typescript/module/src/types.d.ts +192 -0
  159. package/lib/typescript/module/src/types.d.ts.map +1 -0
  160. package/package.json +105 -24
  161. package/plugin/build/imageNotifications.d.ts +35 -0
  162. package/plugin/build/imageNotifications.js +198 -0
  163. package/plugin/build/index.d.ts +84 -0
  164. package/plugin/build/index.js +176 -0
  165. package/src/BubblModule.ts +2 -0
  166. package/src/BubblModule.web.ts +9 -0
  167. package/src/NativeBubblSdk.ts +67 -0
  168. package/src/index.ts +338 -282
  169. package/src/types.ts +182 -0
  170. package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkModule.kt +0 -680
  171. package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkNotificationIntents.kt +0 -32
  172. package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkPackage.kt +0 -14
  173. package/ios/BubblSdk.swift +0 -802
  174. package/ios/BubblSdkBridge.m +0 -86
  175. package/react-native.config.js +0 -11
  176. package/src/specs/NativeBubblSdk.ts +0 -54
@@ -0,0 +1,192 @@
1
+ /**
2
+ * The public types, as in docs/PUBLIC_API.md: the same fields as the native SDKs' (iOS's names,
3
+ * lower camel), filled in natively and copied over as they are.
4
+ */
5
+ export type LogLevel = 'none' | 'error' | 'warning' | 'info' | 'debug';
6
+ export type BubblOptions = {
7
+ /** The Bubbl API to talk to (https; http only for localhost, the emulator host or *.test). */
8
+ baseUrl: string;
9
+ /** Nothing runs (no network, location or notifications) until setConsent(true). */
10
+ requireConsent?: boolean;
11
+ /** How much Bubbl logs natively (Logcat tag "BubblSDK", or the unified log). Default 'warning'. */
12
+ logLevel?: LogLevel;
13
+ /** The device's segments, as setSegments would set them. */
14
+ segments?: string[];
15
+ };
16
+ /**
17
+ * A device credential issued outside the app, for startWithCredential: the same as the native
18
+ * SDKs' BubblCredential. Keep the secret out of logs and analytics; Bubbl only hands it to the
19
+ * native SDK, which keeps it in the Keychain / Android Keystore.
20
+ */
21
+ export type BubblCredential = {
22
+ keyId: string;
23
+ secret: string;
24
+ /** The install the credential was issued for (a pairing flow passes the install id it paired with). */
25
+ installId: string;
26
+ };
27
+ export type QuestionType = 'openEnded' | 'singleChoice' | 'multipleChoice' | 'rating' | 'boolean' | 'number' | 'slider';
28
+ export type BubblQuestion = {
29
+ id: string;
30
+ text: string;
31
+ type: QuestionType;
32
+ required: boolean;
33
+ choices: {
34
+ id: string;
35
+ text: string;
36
+ }[];
37
+ };
38
+ /**
39
+ * A notification from Bubbl, as the app's listener and events see it. Keep `json` (the whole
40
+ * notification as the device API sent it) to show it again later with present().
41
+ */
42
+ export type BubblMessage = {
43
+ /** Echo this on anything reported about it. */
44
+ id: string;
45
+ headline: string;
46
+ body: string;
47
+ isSurvey: boolean;
48
+ /** Sent from a Sandbox workspace (a test, not a real campaign). */
49
+ isSandbox: boolean;
50
+ /** image, video, audio, youtube, application, text or file; null without media. */
51
+ mediaType: string | null;
52
+ mediaUrl: string | null;
53
+ mediaThumbnailUrl: string | null;
54
+ ctaLabel: string | null;
55
+ ctaUrl: string | null;
56
+ /** A survey's questions in order (empty for a message). */
57
+ questions: BubblQuestion[];
58
+ json: string;
59
+ };
60
+ /**
61
+ * Answers to a survey by question id: singleChoice a choice id; multipleChoice a list of choice
62
+ * ids; rating a whole number 1–5; boolean true/false; number a number; slider 0–10; openEnded
63
+ * text (at most 2000 characters).
64
+ */
65
+ export type SurveyAnswers = Record<string, string | string[] | number | boolean | null>;
66
+ /**
67
+ * A Sandbox test device: 'pending' until someone approves it (in the dashboard with `code`, or with
68
+ * Bubbl.registerTestDevice), then 'approved'.
69
+ */
70
+ export type BubblTestDevice = {
71
+ status: 'pending' | 'approved';
72
+ /** While pending: the short code the dashboard lists this device under (e.g. K7Q-2MX). */
73
+ code?: string;
74
+ };
75
+ /** What Bubbl.registerTestDevice came to. */
76
+ export type BubblTestDeviceResult = {
77
+ approved: boolean;
78
+ /** Why not, when not approved (a wrong or expired code, no network, before start). */
79
+ message?: string;
80
+ };
81
+ export type BubblPermissionStatus = {
82
+ notifications: 'granted' | 'denied' | 'notDetermined';
83
+ location: 'always' | 'whenInUse' | 'denied' | 'notDetermined';
84
+ /** Fine rather than approximate location. */
85
+ preciseLocation: boolean;
86
+ };
87
+ /**
88
+ * What Bubbl tells the app, by `type`. Events grow in minor versions (a new `type`, never a changed
89
+ * one), so a `switch (event.type)` needs a `default` branch for types it doesn't know yet.
90
+ */
91
+ export type BubblEvent = {
92
+ type: 'notification.received';
93
+ message: BubblMessage;
94
+ } | {
95
+ type: 'notification.displayed';
96
+ message: BubblMessage;
97
+ } | {
98
+ type: 'notification.opened';
99
+ message: BubblMessage;
100
+ } | {
101
+ type: 'notification.cta_clicked';
102
+ message: BubblMessage;
103
+ } | {
104
+ type: 'notification.dismissed';
105
+ message: BubblMessage;
106
+ } | {
107
+ type: 'media.viewed';
108
+ message: BubblMessage;
109
+ } | {
110
+ type: 'media.completed';
111
+ message: BubblMessage;
112
+ } | {
113
+ type: 'survey.started';
114
+ message: BubblMessage;
115
+ } | {
116
+ type: 'survey.submitted';
117
+ message: BubblMessage;
118
+ } | {
119
+ type: 'geofence.entered';
120
+ locationId: string;
121
+ } | {
122
+ type: 'geofence.exited';
123
+ locationId: string;
124
+ } | {
125
+ type: 'error';
126
+ message: string;
127
+ }
128
+ /**
129
+ * Bubbl was started with a credential issued outside the app, and the server refused it: Bubbl
130
+ * has stopped until it's started with a new one. (Android now; iOS when its SDK has it.)
131
+ */
132
+ | {
133
+ type: 'credential.rejected';
134
+ };
135
+ /**
136
+ * Where Bubbl stands on this device, for support and debug screens: the fields both platforms
137
+ * have, then each platform's own (null on the other platform).
138
+ */
139
+ export type BubblDiagnostics = {
140
+ started: boolean;
141
+ sdkVersion: string;
142
+ /** Bubbl works on this device (iOS 17 and later, Android 8.1 and later): Bubbl.isSupported. */
143
+ supported: boolean;
144
+ /** False when the workspace requires a newer SDK. */
145
+ sdkSupported: boolean;
146
+ registered: boolean;
147
+ /** The install id Bubbl keeps (how Dashboard › Active users finds this device); null before there is one. */
148
+ installId: string | null;
149
+ /** Running: started, consent allows it, not paused by the server, supported. */
150
+ active: boolean;
151
+ /** Unix seconds until which the server paused Bubbl, if it has. */
152
+ pausedUntil: number | null;
153
+ consentRequired: boolean;
154
+ consent: boolean | null;
155
+ locationEnabled: boolean;
156
+ permissions: BubblPermissionStatus | null;
157
+ hasPushToken: boolean;
158
+ geofences: number;
159
+ queuedEvents: number;
160
+ lastError: string | null;
161
+ /** Started with a credential issued outside the app, which the server refused. */
162
+ credentialRejected: boolean;
163
+ /**
164
+ * The workspace the key belongs to: 'sandbox' (pk_test_) or 'production' (pk_live_); null before
165
+ * the device has registered.
166
+ */
167
+ environment: 'sandbox' | 'production' | null;
168
+ /** In Sandbox, where this device stands as a test device; null in Production. */
169
+ testDevice: BubblTestDevice | null;
170
+ /** Geofences work with the app closed ("Always" location). */
171
+ backgroundLocation: boolean;
172
+ /** Geofence events lost before the first unlock after a reboot (always 0 on Android). */
173
+ transitionsDroppedWhileLocked: number;
174
+ /** Android: the user restricted the app's background activity. */
175
+ backgroundRestricted: boolean | null;
176
+ /** Android: battery optimisation applies (background work may wait in Doze). */
177
+ batteryOptimized: boolean | null;
178
+ /** iOS: Background App Refresh is on for the app. */
179
+ backgroundRefreshAvailable: boolean | null;
180
+ /** iOS: Low Power Mode is on. */
181
+ lowPowerMode: boolean | null;
182
+ /** iOS: the OS watches the geofences (else they're checked from location changes). */
183
+ osWatchesGeofences: boolean | null;
184
+ };
185
+ /** Return true (or a promise of true) to show the message yourself; false lets Bubbl show it. */
186
+ export type NotificationListener = (message: BubblMessage) => boolean | Promise<boolean>;
187
+ export type EventListener = (event: BubblEvent) => void;
188
+ /** What addEventListener returns: call remove() to stop listening. */
189
+ export type Subscription = {
190
+ remove(): void;
191
+ };
192
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG;IACzB,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzC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AAI,IAAI,CAAA;CAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,3 @@
1
+ /** The native module, or null where it isn't in the build. On the web, BubblModule.web.ts. */
2
+ export { default } from './NativeBubblSdk.js';
3
+ //# sourceMappingURL=BubblModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubblModule.d.ts","sourceRoot":"","sources":["../../../../src/BubblModule.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Spec } from './NativeBubblSdk.js';
2
+ /**
3
+ * No native module on the web, and react-native-web has no TurboModuleRegistry to ask for one, so
4
+ * NativeBubblSdk.ts isn't loaded at all: Bubbl's calls do nothing there.
5
+ */
6
+ declare const BubblModule: Spec | null;
7
+ export default BubblModule;
8
+ //# sourceMappingURL=BubblModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubblModule.web.d.ts","sourceRoot":"","sources":["../../../../src/BubblModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAkB,CAAC;AAE7C;;;GAGG;AACH,QAAA,MAAM,WAAW,EAAE,IAAI,GAAG,IAAW,CAAC;AAEtC,eAAe,WAAW,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { TurboModule } from 'react-native';
2
+ /**
3
+ * The native module under the facade (src/index.ts): the Bubbl SDK on each platform, called with
4
+ * JSON strings rather than mapped objects (the same convention as the Flutter wrapper), so the
5
+ * bridge stays small and the native types stay the source of truth.
6
+ *
7
+ * - Messages cross as their contract Notification JSON (BubblMessage.json) going in, and as the
8
+ * public message object (fields worked out natively, plus json) coming out.
9
+ * - Events and notifications for the app's listener arrive as JSON on one event, "BubblSdkEvent".
10
+ *
11
+ * Codegen reads this file (package.json codegenConfig); keep it to the types codegen knows.
12
+ */
13
+ export interface Spec extends TurboModule {
14
+ /** Bubbl works on this device (iOS 17+, Android 8.1+); below, every call does nothing. */
15
+ isSupported(): boolean;
16
+ start(apiKey: string, optionsJson: string): void;
17
+ /** The credential as plain strings, never inside JSON: a parse error could echo the secret. */
18
+ startWithCredential(keyId: string, secret: string, installId: string, optionsJson: string): void;
19
+ stop(): void;
20
+ setConsent(granted: boolean): void;
21
+ optOut(): void;
22
+ deleteMyData(): void;
23
+ setLocationEnabled(enabled: boolean): void;
24
+ /** BubblPermissionStatus as JSON, or null before start. */
25
+ permissionStatus(): Promise<string | null>;
26
+ requestNotifications(): Promise<string | null>;
27
+ requestLocation(always: boolean): Promise<string | null>;
28
+ openSettings(): void;
29
+ setSegments(segments: string[]): void;
30
+ track(name: string, propertiesJson: string): void;
31
+ /** Whether the app has a notification listener (the native side consults it only in the foreground). */
32
+ setNotificationListenerEnabled(enabled: boolean): void;
33
+ /**
34
+ * A "notification.handle" carries a token: JS claims it on arrival (else native shows the
35
+ * notification after a few seconds), then finishes it once the app's listener has decided
36
+ * (native shows it unless the app does). Native shows whatever is unsettled when JS goes away.
37
+ */
38
+ claimNotification(token: string): void;
39
+ finishNotification(token: string, appShowsIt: boolean): void;
40
+ present(messageJson: string): void;
41
+ reportDisplayed(messageJson: string): void;
42
+ reportOpened(messageJson: string): void;
43
+ reportCtaClicked(messageJson: string): void;
44
+ reportDismissed(messageJson: string): void;
45
+ reportMediaViewed(messageJson: string): void;
46
+ reportMediaCompleted(messageJson: string, durationSeconds: number): void;
47
+ reportSurveyStarted(messageJson: string): void;
48
+ submitSurvey(messageJson: string, answersJson: string): Promise<boolean>;
49
+ openCta(messageJson: string): void;
50
+ /** Bubbl.Diagnostics as JSON. */
51
+ /** BubblTestDeviceResult as JSON: {approved, message}. */
52
+ registerTestDevice(code: string): Promise<string>;
53
+ diagnostics(): Promise<string>;
54
+ addListener(eventName: string): void;
55
+ removeListeners(count: number): void;
56
+ }
57
+ declare const _default: Spec | null | undefined;
58
+ export default _default;
59
+ //# sourceMappingURL=N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G,IAAI,CAAC;IACvC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7D,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACzE,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,iCAAiC;IACjC,0DAA0D;IAC1D,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAG/B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAED,wBAAyD"}
@@ -0,0 +1,111 @@
1
+ import type { BubblCredential, BubblDiagnostics, BubblMessage, BubblOptions, BubblPermissionStatus, BubblTestDeviceResult, EventListener, NotificationListener, Subscription, SurveyAnswers } from './types.js';
2
+ export type * from './types.js';
3
+ /**
4
+ * Bubbl for a React Native app: the same functions as the native SDKs (docs/PUBLIC_API.md).
5
+ * Install the package, then call start once, early, e.g. at the top of index.js:
6
+ *
7
+ * Bubbl.start('pk_live_…', { baseUrl: 'https://…' });
8
+ *
9
+ * Bubbl never stops the app: a mistake (an empty key, an http:// URL) is logged natively, not
10
+ * thrown, calls before start do nothing, and so do calls where there's no native module (web,
11
+ * Expo Go, Jest), said once in the console. Geofences and pushes keep working with the app
12
+ * closed: the native SDK starts itself from its saved settings when the OS wakes the app.
13
+ */
14
+ export declare const Bubbl: {
15
+ /**
16
+ * Whether Bubbl works on this device: iOS 17 and later, Android 8.1 (API 27) and later. The
17
+ * package installs on older versions too, and there every call does nothing (permissions give
18
+ * null, the listener is never asked, diagnostics say supported: false). False where there's no
19
+ * native module.
20
+ */
21
+ readonly isSupported: boolean;
22
+ /** Start Bubbl. Calling again with the same key and options changes nothing. */
23
+ start(apiKey: string, options: BubblOptions): void;
24
+ /**
25
+ * Start with a device credential issued outside the app (installs provisioned ahead of time, an
26
+ * app's own pairing flow) instead of an API key: the device never registers itself. As start
27
+ * otherwise, at every launch. A different credential than last time starts afresh as a new
28
+ * device; if the server refuses it, Bubbl stops ('credential.rejected', diagnostics) until it's
29
+ * started with a new one. An incomplete credential is logged natively (without the secret).
30
+ */
31
+ startWithCredential(credential: BubblCredential, options: BubblOptions): void;
32
+ /** Stop on this device until start is called again; the server isn't told, nothing is dropped. */
33
+ stop(): void;
34
+ /** For requireConsent: true starts everything, false is optOut. */
35
+ setConsent(granted: boolean): void;
36
+ /** Stop for this user; the server is told. */
37
+ optOut(): void;
38
+ /** Erase the device on the server and here; Bubbl stays off afterwards. */
39
+ deleteMyData(): void;
40
+ /** Location (geofences) off or on; the rest carries on. */
41
+ setLocationEnabled(enabled: boolean): void;
42
+ /**
43
+ * The permissions Bubbl uses. Asking shows the privacy view first when the dashboard says so,
44
+ * then the system prompt.
45
+ */
46
+ permissions: {
47
+ /** Where the device stands; null before start. */
48
+ status(): Promise<BubblPermissionStatus | null>;
49
+ requestNotifications(): Promise<BubblPermissionStatus | null>;
50
+ /** While the app is in use, or always (geofences with the app closed): a second step. */
51
+ requestLocation(options?: {
52
+ always?: boolean;
53
+ }): Promise<BubblPermissionStatus | null>;
54
+ /** The app's page in system settings, for a permission refused for good. */
55
+ openSettings(): void;
56
+ };
57
+ /** The device's segments (replaces any set before). */
58
+ setSegments(segments: string[]): void;
59
+ /**
60
+ * A custom event: a name of letters, digits and . _ : - (at most 100), with up to 50 flat
61
+ * properties (text, numbers, true/false, null).
62
+ */
63
+ track(name: string, properties?: Record<string, string | number | boolean | null>): void;
64
+ /** BubblEvents as they happen. */
65
+ addEventListener(listener: EventListener): Subscription;
66
+ /**
67
+ * The app's say before Bubbl shows a notification while the app is open: return true to show it
68
+ * yourself (then report what happens with the report functions), false to let Bubbl. With the
69
+ * app in the background it isn't asked: Bubbl posts its system notification, whose tap opens
70
+ * Bubbl's card. Null goes back to Bubbl showing everything.
71
+ */
72
+ setNotificationListener(listener: NotificationListener | null): void;
73
+ /** Show a message in Bubbl's notification screen (e.g. one kept from before). */
74
+ present(message: BubblMessage): void;
75
+ /** For an app drawing notifications itself: it's on screen. */
76
+ reportDisplayed(message: BubblMessage): void;
77
+ /** …the user opened it. */
78
+ reportOpened(message: BubblMessage): void;
79
+ /** …the user tapped its call to action. */
80
+ reportCtaClicked(message: BubblMessage): void;
81
+ /** …the user closed it without acting. */
82
+ reportDismissed(message: BubblMessage): void;
83
+ /** …its media was shown or started playing. */
84
+ reportMediaViewed(message: BubblMessage): void;
85
+ /** …its video or audio played to the end, durationSeconds long. */
86
+ reportMediaCompleted(message: BubblMessage, durationSeconds: number): void;
87
+ /** …the user started answering its survey. */
88
+ reportSurveyStarted(message: BubblMessage): void;
89
+ /**
90
+ * Send the answers to a survey the app showed itself, checked as the server checks them: false
91
+ * (with the reason logged natively) when they can't be sent.
92
+ */
93
+ submitSurvey(message: BubblMessage, answers: SurveyAnswers): Promise<boolean>;
94
+ /** Open the message's call to action as Bubbl would, and report it. */
95
+ openCta(message: BubblMessage): void;
96
+ /** Whether a push's data is Bubbl's, so the app's own push handling can skip it. */
97
+ isBubblMessage(data: Record<string, unknown> | null | undefined): boolean;
98
+ /**
99
+ * Sandbox: approve this device as a test device with the code the dashboard shows, so it gets
100
+ * the Sandbox's notifications. Never throws: not approved comes with the reason as message
101
+ * (a wrong or expired code, no network, before start, an unsupported device).
102
+ */
103
+ registerTestDevice(code: string): Promise<BubblTestDeviceResult>;
104
+ /**
105
+ * Where Bubbl stands on this device. Where there's no native module (see above) it still
106
+ * resolves, like every other call: not started, with the reason as lastError.
107
+ */
108
+ diagnostics(): Promise<BubblDiagnostics>;
109
+ };
110
+ export default Bubbl;
111
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAEhB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACd,MAAM,YAAS,CAAC;AAEjB,mBAAmB,YAAS,CAAC;AAkJ7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;OAKG;0BACgB,OAAO;IAI1B,gFAAgF;kBAClE,MAAM,WAAW,YAAY,GAAG,IAAI;IAIlD;;;;;;OAMG;oCAC6B,eAAe,WAAW,YAAY,GAAG,IAAI;IAU7E,kGAAkG;YAC1F,IAAI;IAIZ,mEAAmE;wBAC/C,OAAO,GAAG,IAAI;IAIlC,8CAA8C;cACpC,IAAI;IAId,2EAA2E;oBAC3D,IAAI;IAIpB,2DAA2D;gCAC/B,OAAO,GAAG,IAAI;IAI1C;;;OAGG;;QAED,kDAAkD;kBAClC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;gCAGvB,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAGnE,yFAAyF;kCAC1D;YAAE,MAAM,CAAC,EAAE,OAAO,CAAA;SAAE,GAAQ,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAGhG,4EAA4E;wBAC5D,IAAI;;IAKtB,uDAAuD;0BACjC,MAAM,EAAE,GAAG,IAAI;IAIrC;;;OAGG;gBACS,MAAM,eAAc,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,GAAQ,IAAI;IAI5F,kCAAkC;+BACP,aAAa,GAAG,YAAY;IAWvD;;;;;OAKG;sCAC+B,oBAAoB,GAAG,IAAI,GAAG,IAAI;IASpE,iFAAiF;qBAChE,YAAY,GAAG,IAAI;IAIpC,+DAA+D;6BACtC,YAAY,GAAG,IAAI;IAG5C,2BAA2B;0BACL,YAAY,GAAG,IAAI;IAGzC,2CAA2C;8BACjB,YAAY,GAAG,IAAI;IAG7C,0CAA0C;6BACjB,YAAY,GAAG,IAAI;IAG5C,+CAA+C;+BACpB,YAAY,GAAG,IAAI;IAG9C,mEAAmE;kCACrC,YAAY,mBAAmB,MAAM,GAAG,IAAI;IAG1E,8CAA8C;iCACjB,YAAY,GAAG,IAAI;IAIhD;;;OAGG;0BACyB,YAAY,WAAW,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAInF,uEAAuE;qBACtD,YAAY,GAAG,IAAI;IAIpC,oFAAoF;yBAC/D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAIzE;;;;OAIG;6BAC4B,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAStE;;;OAGG;mBACkB,OAAO,CAAC,gBAAgB,CAAC;CAa/C,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * The public types, as in docs/PUBLIC_API.md: the same fields as the native SDKs' (iOS's names,
3
+ * lower camel), filled in natively and copied over as they are.
4
+ */
5
+ export type LogLevel = 'none' | 'error' | 'warning' | 'info' | 'debug';
6
+ export type BubblOptions = {
7
+ /** The Bubbl API to talk to (https; http only for localhost, the emulator host or *.test). */
8
+ baseUrl: string;
9
+ /** Nothing runs (no network, location or notifications) until setConsent(true). */
10
+ requireConsent?: boolean;
11
+ /** How much Bubbl logs natively (Logcat tag "BubblSDK", or the unified log). Default 'warning'. */
12
+ logLevel?: LogLevel;
13
+ /** The device's segments, as setSegments would set them. */
14
+ segments?: string[];
15
+ };
16
+ /**
17
+ * A device credential issued outside the app, for startWithCredential: the same as the native
18
+ * SDKs' BubblCredential. Keep the secret out of logs and analytics; Bubbl only hands it to the
19
+ * native SDK, which keeps it in the Keychain / Android Keystore.
20
+ */
21
+ export type BubblCredential = {
22
+ keyId: string;
23
+ secret: string;
24
+ /** The install the credential was issued for (a pairing flow passes the install id it paired with). */
25
+ installId: string;
26
+ };
27
+ export type QuestionType = 'openEnded' | 'singleChoice' | 'multipleChoice' | 'rating' | 'boolean' | 'number' | 'slider';
28
+ export type BubblQuestion = {
29
+ id: string;
30
+ text: string;
31
+ type: QuestionType;
32
+ required: boolean;
33
+ choices: {
34
+ id: string;
35
+ text: string;
36
+ }[];
37
+ };
38
+ /**
39
+ * A notification from Bubbl, as the app's listener and events see it. Keep `json` (the whole
40
+ * notification as the device API sent it) to show it again later with present().
41
+ */
42
+ export type BubblMessage = {
43
+ /** Echo this on anything reported about it. */
44
+ id: string;
45
+ headline: string;
46
+ body: string;
47
+ isSurvey: boolean;
48
+ /** Sent from a Sandbox workspace (a test, not a real campaign). */
49
+ isSandbox: boolean;
50
+ /** image, video, audio, youtube, application, text or file; null without media. */
51
+ mediaType: string | null;
52
+ mediaUrl: string | null;
53
+ mediaThumbnailUrl: string | null;
54
+ ctaLabel: string | null;
55
+ ctaUrl: string | null;
56
+ /** A survey's questions in order (empty for a message). */
57
+ questions: BubblQuestion[];
58
+ json: string;
59
+ };
60
+ /**
61
+ * Answers to a survey by question id: singleChoice a choice id; multipleChoice a list of choice
62
+ * ids; rating a whole number 1–5; boolean true/false; number a number; slider 0–10; openEnded
63
+ * text (at most 2000 characters).
64
+ */
65
+ export type SurveyAnswers = Record<string, string | string[] | number | boolean | null>;
66
+ /**
67
+ * A Sandbox test device: 'pending' until someone approves it (in the dashboard with `code`, or with
68
+ * Bubbl.registerTestDevice), then 'approved'.
69
+ */
70
+ export type BubblTestDevice = {
71
+ status: 'pending' | 'approved';
72
+ /** While pending: the short code the dashboard lists this device under (e.g. K7Q-2MX). */
73
+ code?: string;
74
+ };
75
+ /** What Bubbl.registerTestDevice came to. */
76
+ export type BubblTestDeviceResult = {
77
+ approved: boolean;
78
+ /** Why not, when not approved (a wrong or expired code, no network, before start). */
79
+ message?: string;
80
+ };
81
+ export type BubblPermissionStatus = {
82
+ notifications: 'granted' | 'denied' | 'notDetermined';
83
+ location: 'always' | 'whenInUse' | 'denied' | 'notDetermined';
84
+ /** Fine rather than approximate location. */
85
+ preciseLocation: boolean;
86
+ };
87
+ /**
88
+ * What Bubbl tells the app, by `type`. Events grow in minor versions (a new `type`, never a changed
89
+ * one), so a `switch (event.type)` needs a `default` branch for types it doesn't know yet.
90
+ */
91
+ export type BubblEvent = {
92
+ type: 'notification.received';
93
+ message: BubblMessage;
94
+ } | {
95
+ type: 'notification.displayed';
96
+ message: BubblMessage;
97
+ } | {
98
+ type: 'notification.opened';
99
+ message: BubblMessage;
100
+ } | {
101
+ type: 'notification.cta_clicked';
102
+ message: BubblMessage;
103
+ } | {
104
+ type: 'notification.dismissed';
105
+ message: BubblMessage;
106
+ } | {
107
+ type: 'media.viewed';
108
+ message: BubblMessage;
109
+ } | {
110
+ type: 'media.completed';
111
+ message: BubblMessage;
112
+ } | {
113
+ type: 'survey.started';
114
+ message: BubblMessage;
115
+ } | {
116
+ type: 'survey.submitted';
117
+ message: BubblMessage;
118
+ } | {
119
+ type: 'geofence.entered';
120
+ locationId: string;
121
+ } | {
122
+ type: 'geofence.exited';
123
+ locationId: string;
124
+ } | {
125
+ type: 'error';
126
+ message: string;
127
+ }
128
+ /**
129
+ * Bubbl was started with a credential issued outside the app, and the server refused it: Bubbl
130
+ * has stopped until it's started with a new one. (Android now; iOS when its SDK has it.)
131
+ */
132
+ | {
133
+ type: 'credential.rejected';
134
+ };
135
+ /**
136
+ * Where Bubbl stands on this device, for support and debug screens: the fields both platforms
137
+ * have, then each platform's own (null on the other platform).
138
+ */
139
+ export type BubblDiagnostics = {
140
+ started: boolean;
141
+ sdkVersion: string;
142
+ /** Bubbl works on this device (iOS 17 and later, Android 8.1 and later): Bubbl.isSupported. */
143
+ supported: boolean;
144
+ /** False when the workspace requires a newer SDK. */
145
+ sdkSupported: boolean;
146
+ registered: boolean;
147
+ /** The install id Bubbl keeps (how Dashboard › Active users finds this device); null before there is one. */
148
+ installId: string | null;
149
+ /** Running: started, consent allows it, not paused by the server, supported. */
150
+ active: boolean;
151
+ /** Unix seconds until which the server paused Bubbl, if it has. */
152
+ pausedUntil: number | null;
153
+ consentRequired: boolean;
154
+ consent: boolean | null;
155
+ locationEnabled: boolean;
156
+ permissions: BubblPermissionStatus | null;
157
+ hasPushToken: boolean;
158
+ geofences: number;
159
+ queuedEvents: number;
160
+ lastError: string | null;
161
+ /** Started with a credential issued outside the app, which the server refused. */
162
+ credentialRejected: boolean;
163
+ /**
164
+ * The workspace the key belongs to: 'sandbox' (pk_test_) or 'production' (pk_live_); null before
165
+ * the device has registered.
166
+ */
167
+ environment: 'sandbox' | 'production' | null;
168
+ /** In Sandbox, where this device stands as a test device; null in Production. */
169
+ testDevice: BubblTestDevice | null;
170
+ /** Geofences work with the app closed ("Always" location). */
171
+ backgroundLocation: boolean;
172
+ /** Geofence events lost before the first unlock after a reboot (always 0 on Android). */
173
+ transitionsDroppedWhileLocked: number;
174
+ /** Android: the user restricted the app's background activity. */
175
+ backgroundRestricted: boolean | null;
176
+ /** Android: battery optimisation applies (background work may wait in Doze). */
177
+ batteryOptimized: boolean | null;
178
+ /** iOS: Background App Refresh is on for the app. */
179
+ backgroundRefreshAvailable: boolean | null;
180
+ /** iOS: Low Power Mode is on. */
181
+ lowPowerMode: boolean | null;
182
+ /** iOS: the OS watches the geofences (else they're checked from location changes). */
183
+ osWatchesGeofences: boolean | null;
184
+ };
185
+ /** Return true (or a promise of true) to show the message yourself; false lets Bubbl show it. */
186
+ export type NotificationListener = (message: BubblMessage) => boolean | Promise<boolean>;
187
+ export type EventListener = (event: BubblEvent) => void;
188
+ /** What addEventListener returns: call remove() to stop listening. */
189
+ export type Subscription = {
190
+ remove(): void;
191
+ };
192
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG;IACzB,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,I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