@loyalytics/swan-react-native-sdk 2.0.1

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 (204) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +67 -0
  3. package/docs/IOS_NOTIFICATION_EXTENSION_SETUP.md +335 -0
  4. package/ios/README.md +64 -0
  5. package/ios/SwanNotificationServiceExtension/Info.plist +31 -0
  6. package/ios/SwanNotificationServiceExtension/NotificationService.swift +337 -0
  7. package/ios/SwanNotificationServiceExtension/SwanNotificationServiceExtension.entitlements +10 -0
  8. package/lib/commonjs/components/FooterView.js +125 -0
  9. package/lib/commonjs/components/FooterView.js.map +1 -0
  10. package/lib/commonjs/components/FullScreenView.js +172 -0
  11. package/lib/commonjs/components/FullScreenView.js.map +1 -0
  12. package/lib/commonjs/components/HeaderView.js +205 -0
  13. package/lib/commonjs/components/HeaderView.js.map +1 -0
  14. package/lib/commonjs/components/PopUpView.js +186 -0
  15. package/lib/commonjs/components/PopUpView.js.map +1 -0
  16. package/lib/commonjs/config/BatchConfig.js +53 -0
  17. package/lib/commonjs/config/BatchConfig.js.map +1 -0
  18. package/lib/commonjs/constants/ApiUrls.js +56 -0
  19. package/lib/commonjs/constants/ApiUrls.js.map +1 -0
  20. package/lib/commonjs/core/EventQueueManager.js +345 -0
  21. package/lib/commonjs/core/EventQueueManager.js.map +1 -0
  22. package/lib/commonjs/core/FlushManager.js +245 -0
  23. package/lib/commonjs/core/FlushManager.js.map +1 -0
  24. package/lib/commonjs/core/NetworkMonitor.js +97 -0
  25. package/lib/commonjs/core/NetworkMonitor.js.map +1 -0
  26. package/lib/commonjs/index.js +3506 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/providers/FirebasePushProvider.js +130 -0
  29. package/lib/commonjs/providers/FirebasePushProvider.js.map +1 -0
  30. package/lib/commonjs/providers/NullPushProvider.js +59 -0
  31. package/lib/commonjs/providers/NullPushProvider.js.map +1 -0
  32. package/lib/commonjs/providers/PushNotificationProvider.js +30 -0
  33. package/lib/commonjs/providers/PushNotificationProvider.js.map +1 -0
  34. package/lib/commonjs/services/DeviceRegistrationService.js +248 -0
  35. package/lib/commonjs/services/DeviceRegistrationService.js.map +1 -0
  36. package/lib/commonjs/services/PushTokenService.js +284 -0
  37. package/lib/commonjs/services/PushTokenService.js.map +1 -0
  38. package/lib/commonjs/state/AuthStateMachine.js +161 -0
  39. package/lib/commonjs/state/AuthStateMachine.js.map +1 -0
  40. package/lib/commonjs/state/DeviceStateMachine.js +104 -0
  41. package/lib/commonjs/state/DeviceStateMachine.js.map +1 -0
  42. package/lib/commonjs/state/PushStateMachine.js +129 -0
  43. package/lib/commonjs/state/PushStateMachine.js.map +1 -0
  44. package/lib/commonjs/types/EventQueue.js +50 -0
  45. package/lib/commonjs/types/EventQueue.js.map +1 -0
  46. package/lib/commonjs/types/SDK.js +2 -0
  47. package/lib/commonjs/types/SDK.js.map +1 -0
  48. package/lib/commonjs/utils/FirebaseNotificationManager.js +492 -0
  49. package/lib/commonjs/utils/FirebaseNotificationManager.js.map +1 -0
  50. package/lib/commonjs/utils/Logger.js +56 -0
  51. package/lib/commonjs/utils/Logger.js.map +1 -0
  52. package/lib/commonjs/utils/SharedCredentialsManager.js +146 -0
  53. package/lib/commonjs/utils/SharedCredentialsManager.js.map +1 -0
  54. package/lib/commonjs/version.js +12 -0
  55. package/lib/commonjs/version.js.map +1 -0
  56. package/lib/module/components/FooterView.js +121 -0
  57. package/lib/module/components/FooterView.js.map +1 -0
  58. package/lib/module/components/FullScreenView.js +167 -0
  59. package/lib/module/components/FullScreenView.js.map +1 -0
  60. package/lib/module/components/HeaderView.js +199 -0
  61. package/lib/module/components/HeaderView.js.map +1 -0
  62. package/lib/module/components/PopUpView.js +181 -0
  63. package/lib/module/components/PopUpView.js.map +1 -0
  64. package/lib/module/config/BatchConfig.js +49 -0
  65. package/lib/module/config/BatchConfig.js.map +1 -0
  66. package/lib/module/constants/ApiUrls.js +52 -0
  67. package/lib/module/constants/ApiUrls.js.map +1 -0
  68. package/lib/module/core/EventQueueManager.js +340 -0
  69. package/lib/module/core/EventQueueManager.js.map +1 -0
  70. package/lib/module/core/FlushManager.js +240 -0
  71. package/lib/module/core/FlushManager.js.map +1 -0
  72. package/lib/module/core/NetworkMonitor.js +92 -0
  73. package/lib/module/core/NetworkMonitor.js.map +1 -0
  74. package/lib/module/index.js +3494 -0
  75. package/lib/module/index.js.map +1 -0
  76. package/lib/module/providers/FirebasePushProvider.js +124 -0
  77. package/lib/module/providers/FirebasePushProvider.js.map +1 -0
  78. package/lib/module/providers/NullPushProvider.js +53 -0
  79. package/lib/module/providers/NullPushProvider.js.map +1 -0
  80. package/lib/module/providers/PushNotificationProvider.js +26 -0
  81. package/lib/module/providers/PushNotificationProvider.js.map +1 -0
  82. package/lib/module/services/DeviceRegistrationService.js +243 -0
  83. package/lib/module/services/DeviceRegistrationService.js.map +1 -0
  84. package/lib/module/services/PushTokenService.js +278 -0
  85. package/lib/module/services/PushTokenService.js.map +1 -0
  86. package/lib/module/state/AuthStateMachine.js +155 -0
  87. package/lib/module/state/AuthStateMachine.js.map +1 -0
  88. package/lib/module/state/DeviceStateMachine.js +98 -0
  89. package/lib/module/state/DeviceStateMachine.js.map +1 -0
  90. package/lib/module/state/PushStateMachine.js +123 -0
  91. package/lib/module/state/PushStateMachine.js.map +1 -0
  92. package/lib/module/types/EventQueue.js +46 -0
  93. package/lib/module/types/EventQueue.js.map +1 -0
  94. package/lib/module/types/SDK.js +2 -0
  95. package/lib/module/types/SDK.js.map +1 -0
  96. package/lib/module/utils/FirebaseNotificationManager.js +486 -0
  97. package/lib/module/utils/FirebaseNotificationManager.js.map +1 -0
  98. package/lib/module/utils/Logger.js +52 -0
  99. package/lib/module/utils/Logger.js.map +1 -0
  100. package/lib/module/utils/SharedCredentialsManager.js +140 -0
  101. package/lib/module/utils/SharedCredentialsManager.js.map +1 -0
  102. package/lib/module/version.js +8 -0
  103. package/lib/module/version.js.map +1 -0
  104. package/lib/typescript/commonjs/package.json +1 -0
  105. package/lib/typescript/commonjs/src/components/FooterView.d.ts +3 -0
  106. package/lib/typescript/commonjs/src/components/FooterView.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/components/FullScreenView.d.ts +3 -0
  108. package/lib/typescript/commonjs/src/components/FullScreenView.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/components/HeaderView.d.ts +3 -0
  110. package/lib/typescript/commonjs/src/components/HeaderView.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/components/PopUpView.d.ts +3 -0
  112. package/lib/typescript/commonjs/src/components/PopUpView.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/config/BatchConfig.d.ts +7 -0
  114. package/lib/typescript/commonjs/src/config/BatchConfig.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts +56 -0
  116. package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts +63 -0
  118. package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/core/FlushManager.d.ts +63 -0
  120. package/lib/typescript/commonjs/src/core/FlushManager.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts +38 -0
  122. package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/index.d.ts +663 -0
  124. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts +28 -0
  126. package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts +25 -0
  128. package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts +105 -0
  130. package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts +60 -0
  132. package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/services/PushTokenService.d.ts +82 -0
  134. package/lib/typescript/commonjs/src/services/PushTokenService.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts +61 -0
  136. package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts +51 -0
  138. package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts +61 -0
  140. package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/types/EventQueue.d.ts +85 -0
  142. package/lib/typescript/commonjs/src/types/EventQueue.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/types/SDK.d.ts +54 -0
  144. package/lib/typescript/commonjs/src/types/SDK.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts +169 -0
  146. package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/utils/Logger.d.ts +32 -0
  148. package/lib/typescript/commonjs/src/utils/Logger.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts +54 -0
  150. package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/version.d.ts +2 -0
  152. package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
  153. package/lib/typescript/module/package.json +1 -0
  154. package/lib/typescript/module/src/components/FooterView.d.ts +3 -0
  155. package/lib/typescript/module/src/components/FooterView.d.ts.map +1 -0
  156. package/lib/typescript/module/src/components/FullScreenView.d.ts +3 -0
  157. package/lib/typescript/module/src/components/FullScreenView.d.ts.map +1 -0
  158. package/lib/typescript/module/src/components/HeaderView.d.ts +3 -0
  159. package/lib/typescript/module/src/components/HeaderView.d.ts.map +1 -0
  160. package/lib/typescript/module/src/components/PopUpView.d.ts +3 -0
  161. package/lib/typescript/module/src/components/PopUpView.d.ts.map +1 -0
  162. package/lib/typescript/module/src/config/BatchConfig.d.ts +7 -0
  163. package/lib/typescript/module/src/config/BatchConfig.d.ts.map +1 -0
  164. package/lib/typescript/module/src/constants/ApiUrls.d.ts +56 -0
  165. package/lib/typescript/module/src/constants/ApiUrls.d.ts.map +1 -0
  166. package/lib/typescript/module/src/core/EventQueueManager.d.ts +63 -0
  167. package/lib/typescript/module/src/core/EventQueueManager.d.ts.map +1 -0
  168. package/lib/typescript/module/src/core/FlushManager.d.ts +63 -0
  169. package/lib/typescript/module/src/core/FlushManager.d.ts.map +1 -0
  170. package/lib/typescript/module/src/core/NetworkMonitor.d.ts +38 -0
  171. package/lib/typescript/module/src/core/NetworkMonitor.d.ts.map +1 -0
  172. package/lib/typescript/module/src/index.d.ts +663 -0
  173. package/lib/typescript/module/src/index.d.ts.map +1 -0
  174. package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts +28 -0
  175. package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts.map +1 -0
  176. package/lib/typescript/module/src/providers/NullPushProvider.d.ts +25 -0
  177. package/lib/typescript/module/src/providers/NullPushProvider.d.ts.map +1 -0
  178. package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts +105 -0
  179. package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts.map +1 -0
  180. package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts +60 -0
  181. package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts.map +1 -0
  182. package/lib/typescript/module/src/services/PushTokenService.d.ts +82 -0
  183. package/lib/typescript/module/src/services/PushTokenService.d.ts.map +1 -0
  184. package/lib/typescript/module/src/state/AuthStateMachine.d.ts +61 -0
  185. package/lib/typescript/module/src/state/AuthStateMachine.d.ts.map +1 -0
  186. package/lib/typescript/module/src/state/DeviceStateMachine.d.ts +51 -0
  187. package/lib/typescript/module/src/state/DeviceStateMachine.d.ts.map +1 -0
  188. package/lib/typescript/module/src/state/PushStateMachine.d.ts +61 -0
  189. package/lib/typescript/module/src/state/PushStateMachine.d.ts.map +1 -0
  190. package/lib/typescript/module/src/types/EventQueue.d.ts +85 -0
  191. package/lib/typescript/module/src/types/EventQueue.d.ts.map +1 -0
  192. package/lib/typescript/module/src/types/SDK.d.ts +54 -0
  193. package/lib/typescript/module/src/types/SDK.d.ts.map +1 -0
  194. package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts +169 -0
  195. package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
  196. package/lib/typescript/module/src/utils/Logger.d.ts +32 -0
  197. package/lib/typescript/module/src/utils/Logger.d.ts.map +1 -0
  198. package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts +54 -0
  199. package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts.map +1 -0
  200. package/lib/typescript/module/src/version.d.ts +2 -0
  201. package/lib/typescript/module/src/version.d.ts.map +1 -0
  202. package/package.json +230 -0
  203. package/scripts/generate-version.js +25 -0
  204. package/scripts/setup-ios-extension.js +275 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","Text","Image","TouchableOpacity","StyleSheet","Dimensions","Icon","jsx","_jsx","jsxs","_jsxs","width","get","HeaderView","designConfig","onClose","onButtonClick","commId","themeBackgroundColor","crossButtonColor","backgroundImageURL","iconURL","title","titleColor","description","descriptionColor","primaryButtonSwitch","primaryButtonColor","primaryButtonFontColor","primaryButtonText","primaryButtonAction","primaryButtonActionType","secondaryButtonSwitch","secondaryButtonColor","secondaryButtonFontColor","secondaryButtonText","secondaryButtonAction","secondaryButtonActionType","renderButton","type","text","bgColor","fontColor","action","actionType","extraStyle","style","styles","button","backgroundColor","onPress","event","children","buttonText","color","numberOfLines","notification","source","uri","background","resizeMode","foreground","content","close","name","size","iconContainer","icon","textContainer","buttonContainer","marginRight","create","overflow","position","flexDirection","top","left","elevation","shadowColor","shadowOffset","height","shadowOpacity","shadowRadius","zIndex","alignItems","padding","right","borderRadius","marginLeft","flex","fontWeight","fontSize","lineHeight","marginTop","marginHorizontal","marginBottom","justifyContent"],"sourceRoot":"../../../src","sources":["components/HeaderView.tsx"],"mappings":";;AAAA,SACEA,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,QACL,cAAc;AACrB,OAAOC,IAAI,MAAM,yCAAyC,CAAC,CAAC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5D,MAAM;EAAEC;AAAM,CAAC,GAAGN,UAAU,CAACO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;;AAE5C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,YAAY,GAAG,CAAC,CAAC;EAAEC,OAAO;EAAEC;AAAmB,CAAC,KAAK;EACzE,MAAM;IACJC,MAAM,GAAG,EAAE;IACXC,oBAAoB,GAAG,SAAS;IAChCC,gBAAgB,GAAG,MAAM;IACzBC,kBAAkB;IAClBC,OAAO;IACPC,KAAK,GAAG,OAAO;IACfC,UAAU,GAAG,MAAM;IACnBC,WAAW,GAAG,aAAa;IAC3BC,gBAAgB,GAAG,MAAM;IACzBC,mBAAmB,GAAG,IAAI;IAC1BC,kBAAkB,GAAG,SAAS;IAC9BC,sBAAsB,GAAG,MAAM;IAC/BC,iBAAiB,GAAG,gBAAgB;IACpCC,mBAAmB,GAAG,EAAE;IACxBC,uBAAuB,GAAG,EAAE;IAC5BC,qBAAqB,GAAG,IAAI;IAC5BC,oBAAoB,GAAG,SAAS;IAChCC,wBAAwB,GAAG,MAAM;IACjCC,mBAAmB,GAAG,kBAAkB;IACxCC,qBAAqB,GAAG,EAAE;IAC1BC,yBAAyB,GAAG;EAC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,KAAK,EAAE;IACLoE,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE,EAAE;IACZnB,QAAQ,EAAE;EACZ,CAAC;EACDhD,WAAW,EAAE;IACXmE,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdpB,QAAQ,EAAE,QAAQ;IAClBqB,SAAS,EAAE;EACb,CAAC;EACDxB,eAAe,EAAE;IACfK,aAAa,EAAE,KAAK;IACpBmB,SAAS,EAAE,CAAC;IACZC,gBAAgB,EAAE,EAAE;IACpBC,YAAY,EAAE;EAChB,CAAC;EACD/C,MAAM,EAAE;IACNyC,IAAI,EAAE,CAAC;IACPJ,OAAO,EAAE,EAAE;IACXD,UAAU,EAAE,QAAQ;IACpBY,cAAc,EAAE;EAClB,CAAC;EACD3C,UAAU,EAAE;IACVsC,QAAQ,EAAE,EAAE;IACZD,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAe7E,UAAU","ignoreList":[]}
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable react-native/no-inline-styles */
4
+ import { View, Text, Image, TouchableOpacity, StyleSheet } from 'react-native';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const PopUpView = ({
7
+ designConfig,
8
+ onClose,
9
+ onButtonClick
10
+ }) => {
11
+ const {
12
+ commId = '',
13
+ themeBackgroundColor = '#f5f5f5',
14
+ crossButtonColor = '#000',
15
+ imageURL,
16
+ title = 'Title',
17
+ titleColor = '#333',
18
+ description = 'Description',
19
+ descriptionColor = '#666',
20
+ primaryButtonSwitch = true,
21
+ primaryButtonColor = '#007BFF',
22
+ primaryButtonFontColor = '#FFF',
23
+ primaryButtonText = 'Primary Action',
24
+ primaryButtonAction = '',
25
+ primaryButtonActionType = '',
26
+ secondaryButtonSwitch = true,
27
+ secondaryButtonColor = '#6C757D',
28
+ secondaryButtonFontColor = '#FFF',
29
+ secondaryButtonText = 'Secondary Action',
30
+ secondaryButtonAction = '',
31
+ secondaryButtonActionType = ''
32
+ } = designConfig;
33
+ return /*#__PURE__*/_jsxs(View, {
34
+ style: [styles.notification, {
35
+ backgroundColor: themeBackgroundColor
36
+ }],
37
+ children: [/*#__PURE__*/_jsx(Text, {
38
+ style: [styles.close, {
39
+ color: crossButtonColor
40
+ }],
41
+ onPress: onClose,
42
+ children: "\xD7"
43
+ }), imageURL && /*#__PURE__*/_jsx(View, {
44
+ style: styles.imageContainer,
45
+ children: /*#__PURE__*/_jsx(Image, {
46
+ source: {
47
+ uri: imageURL
48
+ },
49
+ style: styles.image,
50
+ alt: "phone"
51
+ })
52
+ }), /*#__PURE__*/_jsx(Text, {
53
+ style: [styles.title, {
54
+ color: titleColor
55
+ }],
56
+ children: title || 'Title'
57
+ }), /*#__PURE__*/_jsx(Text, {
58
+ style: [styles.description, {
59
+ color: descriptionColor
60
+ }],
61
+ children: description || 'Description'
62
+ }), /*#__PURE__*/_jsxs(View, {
63
+ style: styles.buttonContainer,
64
+ children: [primaryButtonSwitch && /*#__PURE__*/_jsx(TouchableOpacity, {
65
+ style: [styles.button, styles.primaryButton, {
66
+ backgroundColor: primaryButtonColor,
67
+ width: primaryButtonSwitch ? '45%' : '100%',
68
+ justifyContent: 'center',
69
+ alignItems: 'center'
70
+ }],
71
+ onPress: () => {
72
+ onButtonClick({
73
+ type: 'primary',
74
+ event: 'clicked',
75
+ action: primaryButtonAction,
76
+ actionType: primaryButtonActionType,
77
+ commId
78
+ });
79
+ },
80
+ children: /*#__PURE__*/_jsx(Text, {
81
+ style: {
82
+ color: primaryButtonFontColor
83
+ },
84
+ children: primaryButtonText
85
+ })
86
+ }), secondaryButtonSwitch && /*#__PURE__*/_jsx(TouchableOpacity, {
87
+ style: [styles.button, styles.secondaryButton, {
88
+ backgroundColor: secondaryButtonColor,
89
+ width: primaryButtonSwitch ? '45%' : '100%',
90
+ justifyContent: 'center',
91
+ alignItems: 'center'
92
+ }],
93
+ onPress: () => {
94
+ onButtonClick({
95
+ type: 'secondary',
96
+ event: 'clicked',
97
+ action: secondaryButtonAction,
98
+ actionType: secondaryButtonActionType,
99
+ commId
100
+ });
101
+ },
102
+ children: /*#__PURE__*/_jsx(Text, {
103
+ style: {
104
+ color: secondaryButtonFontColor
105
+ },
106
+ children: secondaryButtonText
107
+ })
108
+ })]
109
+ })]
110
+ });
111
+ };
112
+ const styles = StyleSheet.create({
113
+ notification: {
114
+ borderRadius: 2,
115
+ overflow: 'hidden',
116
+ padding: 16,
117
+ position: 'absolute',
118
+ display: 'flex',
119
+ flexDirection: 'column',
120
+ width: 260,
121
+ top: 210,
122
+ left: 42.5
123
+ },
124
+ close: {
125
+ position: 'absolute',
126
+ right: 4,
127
+ top: 3,
128
+ fontSize: 18,
129
+ fontWeight: 'bold'
130
+ },
131
+ imageContainer: {
132
+ marginBottom: 8,
133
+ width: '100%',
134
+ height: 100
135
+ },
136
+ image: {
137
+ width: '100%',
138
+ height: '100%',
139
+ resizeMode: 'cover'
140
+ },
141
+ title: {
142
+ fontWeight: '400',
143
+ fontSize: 16,
144
+ textAlign: 'center',
145
+ width: 210,
146
+ overflow: 'hidden',
147
+ fontFamily: 'inherit'
148
+ },
149
+ description: {
150
+ marginTop: 4,
151
+ fontSize: 13,
152
+ width: 210,
153
+ textAlign: 'center',
154
+ overflow: 'hidden',
155
+ fontFamily: 'inherit',
156
+ display: 'flex'
157
+ },
158
+ buttonContainer: {
159
+ display: 'flex',
160
+ flexDirection: 'row',
161
+ justifyContent: 'space-around',
162
+ marginTop: 12
163
+ },
164
+ button: {
165
+ borderWidth: 0,
166
+ paddingTop: 5,
167
+ paddingBottom: 5,
168
+ paddingLeft: 10,
169
+ paddingRight: 10,
170
+ overflow: 'hidden',
171
+ fontFamily: 'inherit'
172
+ },
173
+ primaryButton: {
174
+ backgroundColor: 'transparent'
175
+ },
176
+ secondaryButton: {
177
+ backgroundColor: 'transparent'
178
+ }
179
+ });
180
+ export default PopUpView;
181
+ //# sourceMappingURL=PopUpView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","Text","Image","TouchableOpacity","StyleSheet","jsx","_jsx","jsxs","_jsxs","PopUpView","designConfig","onClose","onButtonClick","commId","themeBackgroundColor","crossButtonColor","imageURL","title","titleColor","description","descriptionColor","primaryButtonSwitch","primaryButtonColor","primaryButtonFontColor","primaryButtonText","primaryButtonAction","primaryButtonActionType","secondaryButtonSwitch","secondaryButtonColor","secondaryButtonFontColor","secondaryButtonText","secondaryButtonAction","secondaryButtonActionType","style","styles","notification","backgroundColor","children","close","color","onPress","imageContainer","source","uri","image","alt","buttonContainer","button","primaryButton","width","justifyContent","alignItems","type","event","action","actionType","secondaryButton","create","borderRadius","overflow","padding","position","display","flexDirection","top","left","right","fontSize","fontWeight","marginBottom","height","resizeMode","textAlign","fontFamily","marginTop","borderWidth","paddingTop","paddingBottom","paddingLeft","paddingRight"],"sourceRoot":"../../../src","sources":["components/PopUpView.tsx"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/E,MAAMC,SAAS,GAAGA,CAAC;EAAEC,YAAY;EAAEC,OAAO;EAAEC;AAAmB,CAAC,KAAK;EACnE,MAAM;IACJC,MAAM,GAAG,EAAE;IACXC,oBAAoB,GAAG,SAAS;IAChCC,gBAAgB,GAAG,MAAM;IACzBC,QAAQ;IACRC,KAAK,GAAG,OAAO;IACfC,UAAU,GAAG,MAAM;IACnBC,WAAW,GAAG,aAAa;IAC3BC,gBAAgB,GAAG,MAAM;IACzBC,mBAAmB,GAAG,IAAI;IAC1BC,kBAAkB,GAAG,SAAS;IAC9BC,sBAAsB,GAAG,MAAM;IAC/BC,iBAAiB,GAAG,gBAAgB;IACpCC,mBAAmB,GAAG,EAAE;IACxBC,uBAAuB,GAAG,EAAE;IAC5BC,qBAAqB,GAAG,IAAI;IAC5BC,oBAA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ACfC,YAAY,EAAE,EAAE;IAChBpB,QAAQ,EAAE,QAAQ;IAClBc,UAAU,EAAE;EACd,CAAC;EACDzB,aAAa,EAAE;IACbZ,eAAe,EAAE;EACnB,CAAC;EACDoB,eAAe,EAAE;IACfpB,eAAe,EAAE;EACnB;AACF,CAAC,CAAC;AAEF,eAAe3B,SAAS","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Default configuration for event batching
5
+ * Based on industry standards (CleverTap, Segment, Mixpanel)
6
+ */
7
+ export const DEFAULT_BATCH_CONFIG = {
8
+ /**
9
+ * Number of events to accumulate before triggering a batch send
10
+ * Default: 10 events
11
+ */
12
+ batchSize: 10,
13
+ /**
14
+ * Time interval in milliseconds between automatic flushes
15
+ * Default: 30 seconds (30000ms)
16
+ */
17
+ flushInterval: 30000,
18
+ /**
19
+ * Maximum number of events to store in the queue
20
+ * Oldest events are dropped when limit is reached
21
+ * Default: 1000 events
22
+ */
23
+ maxQueueSize: 1000,
24
+ /**
25
+ * Maximum number of retry attempts for failed batches
26
+ * After max retries, events are marked as permanently failed
27
+ * Default: 3 attempts
28
+ */
29
+ maxRetries: 3,
30
+ /**
31
+ * Base delay in milliseconds for exponential backoff retry strategy
32
+ * Retry delays: 2s, 4s, 8s (with maxRetries=3)
33
+ * Default: 2000ms (2 seconds)
34
+ */
35
+ retryBaseDelay: 2000,
36
+ /**
37
+ * Enable LZW64 compression for event payloads
38
+ * Uses existing SDK compression infrastructure
39
+ * Default: true
40
+ */
41
+ enableCompression: true,
42
+ /**
43
+ * Number of days after which old failed events are deleted
44
+ * Helps prevent database bloat from permanently failed events
45
+ * Default: 7 days
46
+ */
47
+ queueCleanupDays: 7
48
+ };
49
+ //# sourceMappingURL=BatchConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_BATCH_CONFIG","batchSize","flushInterval","maxQueueSize","maxRetries","retryBaseDelay","enableCompression","queueCleanupDays"],"sourceRoot":"../../../src","sources":["config/BatchConfig.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAwC,GAAG;EACtD;AACF;AACA;AACA;EACEC,SAAS,EAAE,EAAE;EAEb;AACF;AACA;AACA;EACEC,aAAa,EAAE,KAAK;EAEpB;AACF;AACA;AACA;AACA;EACEC,YAAY,EAAE,IAAI;EAElB;AACF;AACA;AACA;AACA;EACEC,UAAU,EAAE,CAAC;EAEb;AACF;AACA;AACA;AACA;EACEC,cAAc,EAAE,IAAI;EAEpB;AACF;AACA;AACA;AACA;EACEC,iBAAiB,EAAE,IAAI;EAEvB;AACF;AACA;AACA;AACA;EACEC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * API URLs used across the SDK
5
+ * Centralized to avoid circular dependencies
6
+ */
7
+
8
+ const WEBHOOK_BASE_URL = {
9
+ STAGE: 'https://connect.swan.cx/webhook/comms/dev',
10
+ PROD: 'https://connect.swan.cx/webhook/comms'
11
+ };
12
+ const WEB_SDK_BASE_URL = {
13
+ STAGE: 'https://connect.swan.cx/events/sdk/dev',
14
+ PROD: 'https://connect.swan.cx/events/sdk'
15
+ };
16
+ const ECOM_SDK_BASE_URL = {
17
+ STAGE: 'https://e-commerce.azurefd.net/api',
18
+ PROD: 'https://click.swan.cx/api'
19
+ };
20
+ export const ECOM_ENRICH_PROFILE_URL = {
21
+ STAGE: `${ECOM_SDK_BASE_URL.STAGE}/v2/customer/enrich-profile`,
22
+ PROD: `${ECOM_SDK_BASE_URL.PROD}/v2/customer/enrich-profile`
23
+ };
24
+ export const ECOM_TRACK_EVENT_URL = {
25
+ STAGE: `${ECOM_SDK_BASE_URL.STAGE}/v2/trackEvent`,
26
+ PROD: `${ECOM_SDK_BASE_URL.PROD}/v2/trackEvent`
27
+ };
28
+ export const ECOM_DEVICE_REGISTER_URL = {
29
+ STAGE: `${ECOM_SDK_BASE_URL.STAGE}/v2/device/register`,
30
+ PROD: `${ECOM_SDK_BASE_URL.PROD}/v2/device/register`
31
+ };
32
+ export const ECOM_PUSH_SUBSCRIPTION_URL = {
33
+ STAGE: `${ECOM_SDK_BASE_URL.STAGE}/device/push-subscription`,
34
+ PROD: `${ECOM_SDK_BASE_URL.PROD}/device/push-subscription`
35
+ };
36
+ export const WEBHOOK_MOBILE_PUSH_URL = {
37
+ STAGE: `${WEBHOOK_BASE_URL.STAGE}/mobile-push-tracking`,
38
+ PROD: `${WEBHOOK_BASE_URL.PROD}/mobile-push-tracking`
39
+ };
40
+ export const NOTIFICATION_GET_URL = {
41
+ STAGE: `${WEB_SDK_BASE_URL.STAGE}/post-in-app-notification-to-sdk`,
42
+ PROD: `${WEB_SDK_BASE_URL.PROD}/post-in-app-notification-to-sdk`
43
+ };
44
+ export default {
45
+ ECOM_ENRICH_PROFILE_URL,
46
+ ECOM_TRACK_EVENT_URL,
47
+ ECOM_DEVICE_REGISTER_URL,
48
+ ECOM_PUSH_SUBSCRIPTION_URL,
49
+ WEBHOOK_MOBILE_PUSH_URL,
50
+ NOTIFICATION_GET_URL
51
+ };
52
+ //# sourceMappingURL=ApiUrls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WEBHOOK_BASE_URL","STAGE","PROD","WEB_SDK_BASE_URL","ECOM_SDK_BASE_URL","ECOM_ENRICH_PROFILE_URL","ECOM_TRACK_EVENT_URL","ECOM_DEVICE_REGISTER_URL","ECOM_PUSH_SUBSCRIPTION_URL","WEBHOOK_MOBILE_PUSH_URL","NOTIFICATION_GET_URL"],"sourceRoot":"../../../src","sources":["constants/ApiUrls.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,MAAMA,gBAAgB,GAAG;EACvBC,KAAK,EAAE,2CAA2C;EAClDC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,gBAAgB,GAAG;EACvBF,KAAK,EAAE,wCAAwC;EAC/CC,IAAI,EAAE;AACR,CAAC;AAED,MAAME,iBAAiB,GAAG;EACxBH,KAAK,EAAE,oCAAoC;EAC3CC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMG,uBAAuB,GAAG;EACrCJ,KAAK,EAAE,GAAGG,iBAAiB,CAACH,KAAK,6BAA6B;EAC9DC,IAAI,EAAE,GAAGE,iBAAiB,CAACF,IAAI;AACjC,CAAC;AAED,OAAO,MAAMI,oBAAoB,GAAG;EAClCL,KAAK,EAAE,GAAGG,iBAAiB,CAACH,KAAK,gBAAgB;EACjDC,IAAI,EAAE,GAAGE,iBAAiB,CAACF,IAAI;AACjC,CAAC;AAED,OAAO,MAAMK,wBAAwB,GAAG;EACtCN,KAAK,EAAE,GAAGG,iBAAiB,CAACH,KAAK,qBAAqB;EACtDC,IAAI,EAAE,GAAGE,iBAAiB,CAACF,IAAI;AACjC,CAAC;AAED,OAAO,MAAMM,0BAA0B,GAAG;EACxCP,KAAK,EAAE,GAAGG,iBAAiB,CAACH,KAAK,2BAA2B;EAC5DC,IAAI,EAAE,GAAGE,iBAAiB,CAACF,IAAI;AACjC,CAAC;AAED,OAAO,MAAMO,uBAAuB,GAAG;EACrCR,KAAK,EAAE,GAAGD,gBAAgB,CAACC,KAAK,uBAAuB;EACvDC,IAAI,EAAE,GAAGF,gBAAgB,CAACE,IAAI;AAChC,CAAC;AAED,OAAO,MAAMQ,oBAAoB,GAAG;EAClCT,KAAK,EAAE,GAAGE,gBAAgB,CAACF,KAAK,kCAAkC;EAClEC,IAAI,EAAE,GAAGC,gBAAgB,CAACD,IAAI;AAChC,CAAC;AAED,eAAe;EACbG,uBAAuB;EACvBC,oBAAoB;EACpBC,wBAAwB;EACxBC,0BAA0B;EAC1BC,uBAAuB;EACvBC;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+
3
+ import Logger from "../utils/Logger.js";
4
+
5
+ /**
6
+ * EventQueueManager
7
+ * Manages persistent event queue using SQLite
8
+ * Handles enqueue, dequeue, status updates, and cleanup operations
9
+ */
10
+ export class EventQueueManager {
11
+ constructor(db, maxRetries = 3) {
12
+ this.db = db;
13
+ this.maxRetries = maxRetries;
14
+ }
15
+
16
+ /**
17
+ * Create EventQueue table with indexes
18
+ * Called during SDK initialization
19
+ */
20
+ async createTable() {
21
+ return new Promise((resolve, reject) => {
22
+ if (!this.db) {
23
+ return reject(new Error('Database not initialized'));
24
+ }
25
+ try {
26
+ this.db.transaction(txn => {
27
+ // Create main table
28
+ txn.executeSql(`CREATE TABLE IF NOT EXISTS EventQueue (
29
+ id TEXT PRIMARY KEY,
30
+ eventName TEXT NOT NULL,
31
+ eventData TEXT NOT NULL,
32
+ timestamp INTEGER NOT NULL,
33
+ priority INTEGER DEFAULT 0,
34
+ retryCount INTEGER DEFAULT 0,
35
+ status TEXT DEFAULT 'pending',
36
+ createdAt INTEGER NOT NULL,
37
+ lastAttemptAt INTEGER
38
+ )`, [], () => {
39
+ Logger.log('EventQueue table created');
40
+ }, (_, error) => {
41
+ Logger.error('EventQueue table creation error:', error);
42
+ reject(error);
43
+ });
44
+
45
+ // Create indexes for performance
46
+ txn.executeSql('CREATE INDEX IF NOT EXISTS idx_status ON EventQueue(status)', [], () => Logger.log('Index idx_status created'), (_, error) => Logger.error('Index creation error:', error));
47
+ txn.executeSql('CREATE INDEX IF NOT EXISTS idx_priority ON EventQueue(priority DESC)', [], () => Logger.log('Index idx_priority created'), (_, error) => Logger.error('Index creation error:', error));
48
+ txn.executeSql('CREATE INDEX IF NOT EXISTS idx_timestamp ON EventQueue(timestamp ASC)', [], () => {
49
+ Logger.log('Index idx_timestamp created');
50
+ resolve();
51
+ }, (_, error) => {
52
+ Logger.error('Index creation error:', error);
53
+ reject(error);
54
+ });
55
+ });
56
+ } catch (error) {
57
+ Logger.error('Table creation error:', error);
58
+ reject(error);
59
+ }
60
+ });
61
+ }
62
+
63
+ /**
64
+ * Add event to queue
65
+ * @param event Event to enqueue
66
+ */
67
+ async enqueue(event) {
68
+ return new Promise((resolve, reject) => {
69
+ if (!this.db) {
70
+ return reject(new Error('Database not initialized'));
71
+ }
72
+ try {
73
+ this.db.transaction(txn => {
74
+ txn.executeSql(`INSERT INTO EventQueue (id, eventName, eventData, timestamp, priority, retryCount, status, createdAt, lastAttemptAt)
75
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, [event.id, event.eventName, JSON.stringify(event.eventData), event.timestamp, event.priority, event.retryCount, event.status, event.createdAt, event.lastAttemptAt || null], () => {
76
+ Logger.log(`Event enqueued: ${event.eventName} (${event.id})`);
77
+ resolve();
78
+ }, (_, error) => {
79
+ Logger.error('Error enqueuing event:', error);
80
+ reject(error);
81
+ });
82
+ });
83
+ } catch (error) {
84
+ Logger.error('Error in enqueue:', error);
85
+ reject(error);
86
+ }
87
+ });
88
+ }
89
+
90
+ /**
91
+ * Retrieve events from queue for batch sending
92
+ * Priority events first, then FIFO
93
+ * @param batchSize Maximum number of events to retrieve
94
+ * @returns Array of queued events
95
+ */
96
+ async dequeue(batchSize) {
97
+ return new Promise((resolve, reject) => {
98
+ if (!this.db) {
99
+ return reject(new Error('Database not initialized'));
100
+ }
101
+ try {
102
+ const events = [];
103
+ this.db.transaction(txn => {
104
+ // Step 1: SELECT pending events
105
+ txn.executeSql(`SELECT * FROM EventQueue
106
+ WHERE status = 'pending'
107
+ ORDER BY priority DESC, timestamp ASC
108
+ LIMIT ?`, [batchSize], (_, res) => {
109
+ // Collect events and their IDs
110
+ const eventIds = [];
111
+ for (let i = 0; i < res.rows.length; i++) {
112
+ const row = res.rows.item(i);
113
+ events.push({
114
+ id: row.id,
115
+ eventName: row.eventName,
116
+ eventData: JSON.parse(row.eventData),
117
+ timestamp: row.timestamp,
118
+ priority: row.priority,
119
+ retryCount: row.retryCount,
120
+ status: row.status,
121
+ createdAt: row.createdAt,
122
+ lastAttemptAt: row.lastAttemptAt
123
+ });
124
+ eventIds.push(row.id);
125
+ }
126
+
127
+ // Step 2: Atomically update status to 'sending' to prevent duplicate dequeues
128
+ if (eventIds.length > 0) {
129
+ const placeholders = eventIds.map(() => '?').join(',');
130
+ txn.executeSql(`UPDATE EventQueue SET status = 'sending', lastAttemptAt = ? WHERE id IN (${placeholders})`, [Date.now(), ...eventIds], () => {
131
+ Logger.log(`Dequeued ${events.length} events and marked as sending`);
132
+ resolve(events);
133
+ }, (_, error) => {
134
+ Logger.error('Error updating event status to sending:', error);
135
+ reject(error);
136
+ });
137
+ } else {
138
+ Logger.log('Dequeued 0 events');
139
+ resolve(events);
140
+ }
141
+ }, (_, error) => {
142
+ Logger.error('Error dequeuing events:', error);
143
+ reject(error);
144
+ });
145
+ });
146
+ } catch (error) {
147
+ Logger.error('Error in dequeue:', error);
148
+ reject(error);
149
+ }
150
+ });
151
+ }
152
+
153
+ /**
154
+ * Mark events as successfully sent and remove from queue
155
+ * @param eventIds Array of event IDs to mark as sent
156
+ */
157
+ async markAsSent(eventIds) {
158
+ return new Promise((resolve, reject) => {
159
+ if (!this.db) {
160
+ return reject(new Error('Database not initialized'));
161
+ }
162
+ if (eventIds.length === 0) {
163
+ return resolve();
164
+ }
165
+ try {
166
+ const placeholders = eventIds.map(() => '?').join(',');
167
+ this.db.transaction(txn => {
168
+ txn.executeSql(`DELETE FROM EventQueue WHERE id IN (${placeholders})`, eventIds, () => {
169
+ Logger.log(`Marked ${eventIds.length} events as sent and deleted`);
170
+ resolve();
171
+ }, (_, error) => {
172
+ Logger.error('Error marking events as sent:', error);
173
+ reject(error);
174
+ });
175
+ });
176
+ } catch (error) {
177
+ Logger.error('Error in markAsSent:', error);
178
+ reject(error);
179
+ }
180
+ });
181
+ }
182
+
183
+ /**
184
+ * Mark events as failed and update retry count
185
+ * @param eventIds Array of event IDs that failed
186
+ * @param retryCount New retry count
187
+ */
188
+ async markAsFailed(eventIds, retryCount) {
189
+ return new Promise((resolve, reject) => {
190
+ if (!this.db) {
191
+ return reject(new Error('Database not initialized'));
192
+ }
193
+ if (eventIds.length === 0) {
194
+ return resolve();
195
+ }
196
+ try {
197
+ const placeholders = eventIds.map(() => '?').join(',');
198
+ const now = Date.now();
199
+ this.db.transaction(txn => {
200
+ txn.executeSql(`UPDATE EventQueue
201
+ SET retryCount = ?, status = ?, lastAttemptAt = ?
202
+ WHERE id IN (${placeholders})`, [retryCount, retryCount >= this.maxRetries ? 'failed' : 'pending', now, ...eventIds], () => {
203
+ Logger.log(`Marked ${eventIds.length} events as ${retryCount >= this.maxRetries ? 'failed' : 'pending'} (retry: ${retryCount})`);
204
+ resolve();
205
+ }, (_, error) => {
206
+ Logger.error('Error marking events as failed:', error);
207
+ reject(error);
208
+ });
209
+ });
210
+ } catch (error) {
211
+ Logger.error('Error in markAsFailed:', error);
212
+ reject(error);
213
+ }
214
+ });
215
+ }
216
+
217
+ /**
218
+ * Get current queue size (pending events only)
219
+ * @returns Number of pending events in queue
220
+ */
221
+ async getQueueSize() {
222
+ return new Promise((resolve, reject) => {
223
+ if (!this.db) {
224
+ return reject(new Error('Database not initialized'));
225
+ }
226
+ try {
227
+ this.db.transaction(txn => {
228
+ txn.executeSql(`SELECT COUNT(*) as count FROM EventQueue WHERE status = 'pending'`, [], (_, res) => {
229
+ const count = res.rows.item(0).count;
230
+ resolve(count);
231
+ }, (_, error) => {
232
+ Logger.error('Error getting queue size:', error);
233
+ reject(error);
234
+ });
235
+ });
236
+ } catch (error) {
237
+ Logger.error('Error in getQueueSize:', error);
238
+ reject(error);
239
+ }
240
+ });
241
+ }
242
+
243
+ /**
244
+ * Clean up old failed events
245
+ * Deletes events older than specified days with status 'failed'
246
+ * @param daysOld Number of days old to consider for deletion
247
+ */
248
+ async clearOldEvents(daysOld) {
249
+ return new Promise((resolve, reject) => {
250
+ if (!this.db) {
251
+ return reject(new Error('Database not initialized'));
252
+ }
253
+ try {
254
+ const cutoffTime = Date.now() - daysOld * 24 * 60 * 60 * 1000;
255
+ this.db.transaction(txn => {
256
+ txn.executeSql(`DELETE FROM EventQueue WHERE status = 'failed' AND createdAt < ?`, [cutoffTime], (_, res) => {
257
+ Logger.log(`Cleaned up ${res.rowsAffected} old failed events`);
258
+ resolve();
259
+ }, (_, error) => {
260
+ Logger.error('Error cleaning up old events:', error);
261
+ reject(error);
262
+ });
263
+ });
264
+ } catch (error) {
265
+ Logger.error('Error in clearOldEvents:', error);
266
+ reject(error);
267
+ }
268
+ });
269
+ }
270
+
271
+ /**
272
+ * Drop oldest events when queue is full
273
+ * Keeps queue size within limits by removing oldest pending events
274
+ * @param maxSize Maximum queue size to maintain
275
+ */
276
+ async enforceQueueLimit(maxSize) {
277
+ return new Promise((resolve, reject) => {
278
+ if (!this.db) {
279
+ return reject(new Error('Database not initialized'));
280
+ }
281
+ try {
282
+ this.db.transaction(txn => {
283
+ txn.executeSql(`DELETE FROM EventQueue
284
+ WHERE id IN (
285
+ SELECT id FROM EventQueue
286
+ WHERE status = 'pending'
287
+ ORDER BY timestamp ASC
288
+ LIMIT MAX(0, (SELECT COUNT(*) FROM EventQueue WHERE status = 'pending') - ?)
289
+ )`, [maxSize], (_, res) => {
290
+ if (res.rowsAffected > 0) {
291
+ Logger.warn(`Queue limit reached! Dropped ${res.rowsAffected} oldest events`);
292
+ }
293
+ resolve();
294
+ }, (_, error) => {
295
+ Logger.error('Error enforcing queue limit:', error);
296
+ reject(error);
297
+ });
298
+ });
299
+ } catch (error) {
300
+ Logger.error('Error in enforceQueueLimit:', error);
301
+ reject(error);
302
+ }
303
+ });
304
+ }
305
+
306
+ /**
307
+ * Recover stale 'sending' events back to 'pending'
308
+ * Called on SDK initialization to handle app crashes during flush
309
+ * Resets events stuck in 'sending' status for more than 5 minutes
310
+ */
311
+ async recoverStaleEvents() {
312
+ return new Promise((resolve, reject) => {
313
+ if (!this.db) {
314
+ return reject(new Error('Database not initialized'));
315
+ }
316
+ try {
317
+ // Reset events that have been in 'sending' status for more than 5 minutes
318
+ const staleThreshold = Date.now() - 5 * 60 * 1000; // 5 minutes
319
+
320
+ this.db.transaction(txn => {
321
+ txn.executeSql(`UPDATE EventQueue
322
+ SET status = 'pending'
323
+ WHERE status = 'sending' AND lastAttemptAt < ?`, [staleThreshold], (_, res) => {
324
+ if (res.rowsAffected > 0) {
325
+ Logger.log(`Recovered ${res.rowsAffected} stale events from 'sending' to 'pending'`);
326
+ }
327
+ resolve();
328
+ }, (_, error) => {
329
+ Logger.error('Error recovering stale events:', error);
330
+ reject(error);
331
+ });
332
+ });
333
+ } catch (error) {
334
+ Logger.error('Error in recoverStaleEvents:', error);
335
+ reject(error);
336
+ }
337
+ });
338
+ }
339
+ }
340
+ //# sourceMappingURL=EventQueueManager.js.map