customerio-expo-plugin 1.0.0-beta.9 → 2.0.0-beta.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 (207) hide show
  1. package/README.md +8 -5
  2. package/package.json +32 -24
  3. package/plugin/app.plugin.js +1 -0
  4. package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
  5. package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js.map +1 -1
  6. package/{lib → plugin/lib}/commonjs/android/withCIOAndroid.js +2 -0
  7. package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -0
  8. package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js.map +1 -1
  9. package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js.map +1 -1
  10. package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js.map +1 -1
  11. package/plugin/lib/commonjs/android/withProjectStrings.js +70 -0
  12. package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -0
  13. package/plugin/lib/commonjs/helpers/constants/android.js +14 -0
  14. package/{lib → plugin/lib}/commonjs/helpers/constants/android.js.map +1 -1
  15. package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js.map +1 -1
  16. package/plugin/lib/commonjs/helpers/constants/ios.js +119 -0
  17. package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -0
  18. package/plugin/lib/commonjs/helpers/native-files/ios/apn/NotificationService.swift +25 -0
  19. package/{src/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/apn}/PushService.swift +11 -13
  20. package/plugin/lib/commonjs/helpers/native-files/ios/common/Env.swift +7 -0
  21. package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
  22. package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +59 -0
  23. package/{lib → plugin/lib}/commonjs/helpers/utils/codeInjection.js +9 -1
  24. package/plugin/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
  25. package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js.map +1 -1
  26. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +50 -0
  27. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  28. package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +26 -0
  29. package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +1 -0
  30. package/{lib → plugin/lib}/commonjs/index.js +1 -2
  31. package/{lib → plugin/lib}/commonjs/index.js.map +1 -1
  32. package/plugin/lib/commonjs/ios/utils.js +17 -0
  33. package/plugin/lib/commonjs/ios/utils.js.map +1 -0
  34. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +151 -0
  35. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
  36. package/{lib → plugin/lib}/commonjs/ios/withCIOIos.js +2 -0
  37. package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -0
  38. package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +68 -0
  39. package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -0
  40. package/{lib → plugin/lib}/commonjs/ios/withNotificationsXcodeProject.js +59 -45
  41. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
  42. package/{lib → plugin/lib}/commonjs/ios/withXcodeProject.js +2 -1
  43. package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -0
  44. package/{lib → plugin/lib}/commonjs/postInstall.js.map +1 -1
  45. package/plugin/lib/commonjs/postInstallHelper.js +22 -0
  46. package/plugin/lib/commonjs/postInstallHelper.js.map +1 -0
  47. package/plugin/lib/commonjs/types/cio-types.js.map +1 -0
  48. package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js.map +1 -1
  49. package/{lib → plugin/lib}/module/android/withAppGoogleServices.js.map +1 -1
  50. package/{lib → plugin/lib}/module/android/withCIOAndroid.js +2 -0
  51. package/plugin/lib/module/android/withCIOAndroid.js.map +1 -0
  52. package/{lib → plugin/lib}/module/android/withGistMavenRepository.js.map +1 -1
  53. package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js.map +1 -1
  54. package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js.map +1 -1
  55. package/plugin/lib/module/android/withProjectStrings.js +63 -0
  56. package/plugin/lib/module/android/withProjectStrings.js.map +1 -0
  57. package/{lib → plugin/lib}/module/helpers/constants/android.js.map +1 -1
  58. package/{lib → plugin/lib}/module/helpers/constants/globals.d.js.map +1 -1
  59. package/plugin/lib/module/helpers/constants/ios.js +112 -0
  60. package/plugin/lib/module/helpers/constants/ios.js.map +1 -0
  61. package/plugin/lib/module/helpers/native-files/ios/apn/NotificationService.swift +25 -0
  62. package/{lib/commonjs/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/apn}/PushService.swift +11 -13
  63. package/plugin/lib/module/helpers/native-files/ios/common/Env.swift +7 -0
  64. package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
  65. package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +59 -0
  66. package/{lib → plugin/lib}/module/helpers/utils/codeInjection.js +7 -1
  67. package/plugin/lib/module/helpers/utils/codeInjection.js.map +1 -0
  68. package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js.map +1 -1
  69. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +43 -0
  70. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  71. package/plugin/lib/module/helpers/utils/pluginUtils.js +19 -0
  72. package/plugin/lib/module/helpers/utils/pluginUtils.js.map +1 -0
  73. package/{lib → plugin/lib}/module/index.js.map +1 -1
  74. package/plugin/lib/module/ios/utils.js +10 -0
  75. package/plugin/lib/module/ios/utils.js.map +1 -0
  76. package/plugin/lib/module/ios/withAppDelegateModifications.js +144 -0
  77. package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -0
  78. package/{lib → plugin/lib}/module/ios/withCIOIos.js +2 -0
  79. package/plugin/lib/module/ios/withCIOIos.js.map +1 -0
  80. package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +61 -0
  81. package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -0
  82. package/{lib → plugin/lib}/module/ios/withNotificationsXcodeProject.js +59 -44
  83. package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
  84. package/{lib → plugin/lib}/module/ios/withXcodeProject.js +2 -1
  85. package/plugin/lib/module/ios/withXcodeProject.js.map +1 -0
  86. package/{lib → plugin/lib}/module/postInstall.js.map +1 -1
  87. package/plugin/lib/module/postInstallHelper.js +20 -0
  88. package/plugin/lib/module/postInstallHelper.js.map +1 -0
  89. package/plugin/lib/module/types/cio-types.js.map +1 -0
  90. package/plugin/lib/typescript/android/withProjectStrings.d.ts +15 -0
  91. package/plugin/lib/typescript/helpers/constants/ios.d.ts +30 -0
  92. package/{lib → plugin/lib}/typescript/helpers/utils/codeInjection.d.ts +3 -1
  93. package/{lib → plugin/lib}/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -2
  94. package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +4 -0
  95. package/plugin/lib/typescript/ios/utils.d.ts +7 -0
  96. package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +3 -0
  97. package/{lib → plugin/lib}/typescript/types/cio-types.d.ts +11 -2
  98. package/{src → plugin/src}/android/withCIOAndroid.ts +2 -0
  99. package/plugin/src/android/withProjectStrings.ts +57 -0
  100. package/plugin/src/helpers/constants/ios.ts +144 -0
  101. package/plugin/src/helpers/native-files/ios/apn/NotificationService.swift +25 -0
  102. package/{lib/module/helpers/native-files/ios → plugin/src/helpers/native-files/ios/apn}/PushService.swift +11 -13
  103. package/plugin/src/helpers/native-files/ios/common/Env.swift +7 -0
  104. package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
  105. package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +59 -0
  106. package/{src → plugin/src}/helpers/utils/codeInjection.ts +12 -1
  107. package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +68 -0
  108. package/plugin/src/helpers/utils/pluginUtils.ts +22 -0
  109. package/plugin/src/ios/utils.ts +10 -0
  110. package/{src → plugin/src}/ios/withAppDelegateModifications.ts +133 -23
  111. package/{src → plugin/src}/ios/withCIOIos.ts +2 -0
  112. package/plugin/src/ios/withGoogleServicesJsonFile.ts +97 -0
  113. package/{src → plugin/src}/ios/withNotificationsXcodeProject.ts +97 -47
  114. package/{src → plugin/src}/ios/withXcodeProject.ts +2 -1
  115. package/plugin/src/postInstallHelper.js +32 -0
  116. package/{src → plugin/src}/types/cio-types.ts +11 -2
  117. package/lib/commonjs/android/withCIOAndroid.js.map +0 -1
  118. package/lib/commonjs/helpers/constants/android.js +0 -21
  119. package/lib/commonjs/helpers/constants/ios.js +0 -121
  120. package/lib/commonjs/helpers/constants/ios.js.map +0 -1
  121. package/lib/commonjs/helpers/native-files/ios/Env.swift +0 -8
  122. package/lib/commonjs/helpers/native-files/ios/NotificationService.swift +0 -22
  123. package/lib/commonjs/helpers/utils/codeInjection.js.map +0 -1
  124. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +0 -36
  125. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +0 -1
  126. package/lib/commonjs/ios/withAppDelegateModifications.js +0 -89
  127. package/lib/commonjs/ios/withAppDelegateModifications.js.map +0 -1
  128. package/lib/commonjs/ios/withCIOIos.js.map +0 -1
  129. package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +0 -1
  130. package/lib/commonjs/ios/withXcodeProject.js.map +0 -1
  131. package/lib/commonjs/postInstallHelper.js +0 -20
  132. package/lib/commonjs/postInstallHelper.js.map +0 -1
  133. package/lib/commonjs/types/cio-types.js.map +0 -1
  134. package/lib/module/android/withCIOAndroid.js.map +0 -1
  135. package/lib/module/helpers/constants/ios.js +0 -84
  136. package/lib/module/helpers/constants/ios.js.map +0 -1
  137. package/lib/module/helpers/native-files/ios/Env.swift +0 -8
  138. package/lib/module/helpers/native-files/ios/NotificationService.swift +0 -22
  139. package/lib/module/helpers/utils/codeInjection.js.map +0 -1
  140. package/lib/module/helpers/utils/injectCIOPodfileCode.js +0 -29
  141. package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +0 -1
  142. package/lib/module/ios/withAppDelegateModifications.js +0 -82
  143. package/lib/module/ios/withAppDelegateModifications.js.map +0 -1
  144. package/lib/module/ios/withCIOIos.js.map +0 -1
  145. package/lib/module/ios/withNotificationsXcodeProject.js.map +0 -1
  146. package/lib/module/ios/withXcodeProject.js.map +0 -1
  147. package/lib/module/postInstallHelper.js +0 -18
  148. package/lib/module/postInstallHelper.js.map +0 -1
  149. package/lib/module/types/cio-types.js.map +0 -1
  150. package/lib/typescript/helpers/constants/ios.d.ts +0 -31
  151. package/src/helpers/constants/ios.ts +0 -104
  152. package/src/helpers/native-files/ios/Env.swift +0 -8
  153. package/src/helpers/native-files/ios/NotificationService.swift +0 -22
  154. package/src/helpers/utils/injectCIOPodfileCode.ts +0 -54
  155. package/src/postInstallHelper.js +0 -22
  156. /package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js +0 -0
  157. /package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js +0 -0
  158. /package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js +0 -0
  159. /package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js +0 -0
  160. /package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js +0 -0
  161. /package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js +0 -0
  162. /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
  163. /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.h +0 -0
  164. /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.m +0 -0
  165. /package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js +0 -0
  166. /package/{lib → plugin/lib}/commonjs/postInstall.js +0 -0
  167. /package/{lib → plugin/lib}/commonjs/types/cio-types.js +0 -0
  168. /package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js +0 -0
  169. /package/{lib → plugin/lib}/module/android/withAppGoogleServices.js +0 -0
  170. /package/{lib → plugin/lib}/module/android/withGistMavenRepository.js +0 -0
  171. /package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js +0 -0
  172. /package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js +0 -0
  173. /package/{lib → plugin/lib}/module/helpers/constants/android.js +0 -0
  174. /package/{lib → plugin/lib}/module/helpers/constants/globals.d.js +0 -0
  175. /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
  176. /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.h +0 -0
  177. /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.m +0 -0
  178. /package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js +0 -0
  179. /package/{lib → plugin/lib}/module/index.js +0 -0
  180. /package/{lib → plugin/lib}/module/postInstall.js +0 -0
  181. /package/{lib → plugin/lib}/module/types/cio-types.js +0 -0
  182. /package/{lib → plugin/lib}/typescript/android/withAndroidManifestUpdates.d.ts +0 -0
  183. /package/{lib → plugin/lib}/typescript/android/withAppGoogleServices.d.ts +0 -0
  184. /package/{lib → plugin/lib}/typescript/android/withCIOAndroid.d.ts +0 -0
  185. /package/{lib → plugin/lib}/typescript/android/withGistMavenRepository.d.ts +0 -0
  186. /package/{lib → plugin/lib}/typescript/android/withGoogleServicesJSON.d.ts +0 -0
  187. /package/{lib → plugin/lib}/typescript/android/withProjectGoogleServices.d.ts +0 -0
  188. /package/{lib → plugin/lib}/typescript/helpers/constants/android.d.ts +0 -0
  189. /package/{lib → plugin/lib}/typescript/helpers/utils/fileManagement.d.ts +0 -0
  190. /package/{lib → plugin/lib}/typescript/index.d.ts +0 -0
  191. /package/{lib → plugin/lib}/typescript/ios/withAppDelegateModifications.d.ts +0 -0
  192. /package/{lib → plugin/lib}/typescript/ios/withCIOIos.d.ts +0 -0
  193. /package/{lib → plugin/lib}/typescript/ios/withNotificationsXcodeProject.d.ts +0 -0
  194. /package/{lib → plugin/lib}/typescript/ios/withXcodeProject.d.ts +0 -0
  195. /package/{src → plugin/src}/android/withAndroidManifestUpdates.ts +0 -0
  196. /package/{src → plugin/src}/android/withAppGoogleServices.ts +0 -0
  197. /package/{src → plugin/src}/android/withGistMavenRepository.ts +0 -0
  198. /package/{src → plugin/src}/android/withGoogleServicesJSON.ts +0 -0
  199. /package/{src → plugin/src}/android/withProjectGoogleServices.ts +0 -0
  200. /package/{src → plugin/src}/helpers/constants/android.ts +0 -0
  201. /package/{src → plugin/src}/helpers/constants/globals.d.ts +0 -0
  202. /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
  203. /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.h +0 -0
  204. /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.m +0 -0
  205. /package/{src → plugin/src}/helpers/utils/fileManagement.ts +0 -0
  206. /package/{src → plugin/src}/index.ts +0 -0
  207. /package/{src → plugin/src}/postInstall.js +0 -0
@@ -3,35 +3,35 @@ import { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Pat
3
3
 
4
4
  import {
5
5
  CIO_APPDELEGATEDECLARATION_REGEX,
6
+ CIO_APPDELEGATEHEADER_IMPORT_SNIPPET,
6
7
  CIO_APPDELEGATEHEADER_REGEX,
7
- CIO_APPDELEGATEHEADER_SNIPPET,
8
+ CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET,
8
9
  CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,
9
- CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,
10
+ CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET,
11
+ CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,
10
12
  CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,
11
13
  CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,
12
14
  CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,
13
- CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,
14
15
  CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,
15
16
  CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,
17
+ CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,
16
18
  CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,
17
- CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,
19
+ CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,
20
+ CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,
21
+ CIO_DEEPLINK_COMMENT_REGEX,
22
+ CIO_INITIALIZECIOSDK_SNIPPET,
18
23
  } from '../helpers/constants/ios';
19
24
  import {
25
+ injectCodeBeforeMultiLineRegex,
20
26
  injectCodeByLineNumber,
21
27
  injectCodeByMultiLineRegex,
22
28
  injectCodeByMultiLineRegexAndReplaceLine,
29
+ replaceCodeByRegex,
30
+ matchRegexExists,
23
31
  } from '../helpers/utils/codeInjection';
24
32
  import { FileManagement } from '../helpers/utils/fileManagement';
25
33
  import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
26
-
27
- const pushCodeSnippets = [
28
- CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,
29
- CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,
30
- ];
31
-
32
- const additionalMethodsForPushNotifications = `${pushCodeSnippets.join(
33
- '\n'
34
- )}\n`; // Join newlines and ensure a newline at the end.
34
+ import { isFcmPushProvider } from './utils';
35
35
 
36
36
  const addImport = (stringContents: string, appName: string) => {
37
37
  const importRegex = /^(#import .*)\n/gm;
@@ -51,7 +51,7 @@ const addImport = (stringContents: string, appName: string) => {
51
51
  stringContents,
52
52
  endOfMatchIndex,
53
53
  addedImport
54
- ).join('\n');
54
+ );
55
55
 
56
56
  return stringContents;
57
57
  };
@@ -67,7 +67,7 @@ const addNotificationHandlerDeclaration = (stringContents: string) => {
67
67
  };
68
68
 
69
69
  const addNotificationConfiguration = (stringContents: string) => {
70
- stringContents = injectCodeByMultiLineRegex(
70
+ stringContents = injectCodeBeforeMultiLineRegex(
71
71
  stringContents,
72
72
  CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,
73
73
  CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET
@@ -76,6 +76,29 @@ const addNotificationConfiguration = (stringContents: string) => {
76
76
  return stringContents;
77
77
  };
78
78
 
79
+ const addInitializeNativeCioSdk = (stringContents: string) => {
80
+ stringContents = injectCodeBeforeMultiLineRegex(
81
+ stringContents,
82
+ CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,
83
+ CIO_INITIALIZECIOSDK_SNIPPET
84
+ );
85
+
86
+ return stringContents;
87
+ };
88
+
89
+ const addHandleDeeplinkInKilledStateConfiguration = (
90
+ stringContents: string,
91
+ regex: RegExp
92
+ ) => {
93
+ stringContents = injectCodeBeforeMultiLineRegex(
94
+ stringContents,
95
+ regex,
96
+ CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET
97
+ );
98
+
99
+ return stringContents;
100
+ };
101
+
79
102
  const addDidFailToRegisterForRemoteNotificationsWithError = (
80
103
  stringContents: string
81
104
  ) => {
@@ -100,26 +123,98 @@ const addDidRegisterForRemoteNotificationsWithDeviceToken = (
100
123
  return stringContents;
101
124
  };
102
125
 
103
- const addAdditionalMethodsForPushNotifications = (stringContents: string) => {
104
- stringContents = injectCodeByMultiLineRegex(
126
+ // Adds required import for Expo Notifications package in AppDelegate.
127
+ // Required to call functions from the package.
128
+ const addExpoNotificationsHeaderModification = (stringContents: string) => {
129
+ stringContents = injectCodeByLineNumber(
105
130
  stringContents,
106
- CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,
107
- additionalMethodsForPushNotifications
131
+ 0,
132
+ `
133
+ #if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)
134
+ #import <EXNotifications/EXNotificationCenterDelegate.h>
135
+ #endif
136
+ `
108
137
  );
109
138
 
110
139
  return stringContents;
111
140
  };
112
141
 
113
- const addAppdelegateHeaderModification = (stringContents: string) => {
114
- stringContents = injectCodeByMultiLineRegexAndReplaceLine(
142
+ const addFirebaseDelegateForwardDeclarationIfNeeded = (stringContents: string) => {
143
+ stringContents = injectCodeByLineNumber(
115
144
  stringContents,
145
+ 0,
146
+ '@protocol FIRMessagingDelegate;'
147
+ );
148
+
149
+ return stringContents;
150
+ };
151
+
152
+ const addAppdelegateHeaderModification = (stringContents: string) => {
153
+ // Add UNUserNotificationCenterDelegate if needed
154
+ stringContents = stringContents.replace(
116
155
  CIO_APPDELEGATEHEADER_REGEX,
117
- CIO_APPDELEGATEHEADER_SNIPPET
156
+ (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {
157
+ if (
158
+ existingDelegates &&
159
+ existingDelegates.includes(
160
+ CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET
161
+ )
162
+ ) {
163
+ // The AppDelegate declaration already includes UNUserNotificationCenterDelegate, so we don't need to modify it
164
+ return match;
165
+ } else if (existingDelegates) {
166
+ // Other delegates exist, append ours
167
+ return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}
168
+ ${interfaceDeclaration}<${existingDelegates}, ${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>
169
+ `;
170
+ } else {
171
+ // No delegates exist, add ours
172
+ return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}
173
+ ${interfaceDeclaration.trim()} <${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>
174
+ `;
175
+ }
176
+ }
118
177
  );
119
178
 
120
179
  return stringContents;
121
180
  };
122
181
 
182
+ const addHandleDeeplinkInKilledState = (stringContents: string) => {
183
+ // Find if the deep link code snippet is already present
184
+ if (matchRegexExists(stringContents, CIO_DEEPLINK_COMMENT_REGEX)) {
185
+ return stringContents;
186
+ }
187
+
188
+ // Check if the app delegate is using RCTBridge or LaunchOptions
189
+ let snippet = undefined;
190
+ let regex = CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX;
191
+ if (
192
+ matchRegexExists(
193
+ stringContents,
194
+ CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX
195
+ )
196
+ ) {
197
+ snippet = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET;
198
+ regex = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX;
199
+ } else if (
200
+ matchRegexExists(
201
+ stringContents,
202
+ CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX
203
+ )
204
+ ) {
205
+ snippet = CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET;
206
+ }
207
+ // Add code only if the app delegate is using RCTBridge or LaunchOptions
208
+ if (snippet !== undefined) {
209
+ stringContents = addHandleDeeplinkInKilledStateConfiguration(
210
+ stringContents,
211
+ regex
212
+ );
213
+ stringContents = replaceCodeByRegex(stringContents, regex, snippet);
214
+ }
215
+ return stringContents;
216
+ };
217
+
123
218
  export const withAppDelegateModifications: ConfigPlugin<
124
219
  CustomerIOPluginOptionsIOS
125
220
  > = (configOuter, props) => {
@@ -151,12 +246,27 @@ export const withAppDelegateModifications: ConfigPlugin<
151
246
  ) {
152
247
  stringContents = addNotificationConfiguration(stringContents);
153
248
  }
154
- stringContents = addAdditionalMethodsForPushNotifications(stringContents);
249
+
250
+ stringContents = addInitializeNativeCioSdk(stringContents);
251
+
252
+ if (
253
+ props.handleDeeplinkInKilledState !== undefined &&
254
+ props.handleDeeplinkInKilledState === true
255
+ ) {
256
+ stringContents = addHandleDeeplinkInKilledState(stringContents);
257
+ }
258
+
155
259
  stringContents =
156
260
  addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
157
261
  stringContents =
158
262
  addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);
159
263
 
264
+ if (isFcmPushProvider(props)) {
265
+ stringContents = addFirebaseDelegateForwardDeclarationIfNeeded(stringContents);
266
+ }
267
+
268
+ stringContents = addExpoNotificationsHeaderModification(stringContents);
269
+
160
270
  config.modResults.contents = stringContents;
161
271
  } else {
162
272
  console.log('Customerio AppDelegate changes already exist. Skipping...');
@@ -4,6 +4,7 @@ import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
4
4
  import { withAppDelegateModifications } from './withAppDelegateModifications';
5
5
  import { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';
6
6
  import { withCioXcodeProject } from './withXcodeProject';
7
+ import { withGoogleServicesJsonFile } from './withGoogleServicesJsonFile';
7
8
 
8
9
  export function withCIOIos(
9
10
  config: ExpoConfig,
@@ -13,6 +14,7 @@ export function withCIOIos(
13
14
  config = withAppDelegateModifications(config, props);
14
15
  config = withCioNotificationsXcodeProject(config, props);
15
16
  config = withCioXcodeProject(config, props);
17
+ config = withGoogleServicesJsonFile(config, props);
16
18
  }
17
19
 
18
20
  return config;
@@ -0,0 +1,97 @@
1
+ import {
2
+ withXcodeProject,
3
+ IOSConfig,
4
+ ConfigPlugin,
5
+ } from '@expo/config-plugins';
6
+
7
+ import { FileManagement } from './../helpers/utils/fileManagement';
8
+ import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
9
+ import { isFcmPushProvider } from './utils';
10
+
11
+ export const withGoogleServicesJsonFile: ConfigPlugin<
12
+ CustomerIOPluginOptionsIOS
13
+ > = (config, cioProps) => {
14
+ return withXcodeProject(config, async (props) => {
15
+ const useFcm = isFcmPushProvider(cioProps);
16
+ if (!useFcm) {
17
+ // Nothing to do, for providers other than FCM, the Google services JSON file isn't needed
18
+ return props;
19
+ }
20
+
21
+ console.log(
22
+ 'Only specify Customer.io ios.pushNotification.googleServicesFile config if you are not already including' +
23
+ ' GoogleService-Info.plist as part of Firebase integration'
24
+ );
25
+
26
+ // googleServicesFile
27
+ const iosPath = props.modRequest.platformProjectRoot;
28
+ const googleServicesFile = cioProps.pushNotification?.googleServicesFile;
29
+ const appName = props.modRequest.projectName;
30
+
31
+ if (FileManagement.exists(`${iosPath}/GoogleService-Info.plist`)) {
32
+ console.log(
33
+ `File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`
34
+ );
35
+ return props;
36
+ }
37
+
38
+ if (
39
+ FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)
40
+ ) {
41
+ // This is where RN Firebase potentially copies GoogleService-Info.plist
42
+ // Do not copy if it's already done by Firebase to avoid conflict in Resources
43
+ console.log(
44
+ `File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`
45
+ );
46
+ return props;
47
+ }
48
+
49
+ if (googleServicesFile && FileManagement.exists(googleServicesFile)) {
50
+ if (config.ios?.googleServicesFile) {
51
+ console.warn(
52
+ 'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +
53
+ ' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'
54
+ );
55
+ }
56
+
57
+ try {
58
+ FileManagement.copyFile(
59
+ googleServicesFile,
60
+ `${iosPath}/GoogleService-Info.plist`
61
+ );
62
+
63
+ addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');
64
+ } catch (e) {
65
+ console.error(
66
+ `There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`
67
+ );
68
+ }
69
+ } else {
70
+ console.error(
71
+ `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`
72
+ );
73
+ }
74
+
75
+ return props;
76
+ });
77
+ };
78
+
79
+ function addFileToXcodeProject(project: any, fileName: string) {
80
+ const groupName = 'Resources';
81
+ const filepath = fileName;
82
+
83
+ if (!IOSConfig.XcodeUtils.ensureGroupRecursively(project, groupName)) {
84
+ console.error(
85
+ `Error copying GoogleService-Info.plist. Failed to find or create '${groupName}' group in Xcode.`
86
+ );
87
+ return;
88
+ }
89
+
90
+ // Add GoogleService-Info.plist to the Xcode project
91
+ IOSConfig.XcodeUtils.addResourceFileToGroup({
92
+ project,
93
+ filepath,
94
+ groupName,
95
+ isBuildFile: true,
96
+ });
97
+ }
@@ -1,5 +1,8 @@
1
- import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';
2
- import xcode from 'xcode';
1
+ import {
2
+ ConfigPlugin,
3
+ XcodeProject,
4
+ withXcodeProject,
5
+ } from '@expo/config-plugins';
3
6
 
4
7
  import {
5
8
  CIO_NOTIFICATION_TARGET_NAME,
@@ -11,6 +14,7 @@ import { replaceCodeByRegex } from '../helpers/utils/codeInjection';
11
14
  import { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';
12
15
  import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
13
16
  import { FileManagement } from './../helpers/utils/fileManagement';
17
+ import { isFcmPushProvider } from './utils';
14
18
 
15
19
  const PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
16
20
  const ENV_FILENAME = 'Env.swift';
@@ -18,21 +22,10 @@ const ENV_FILENAME = 'Env.swift';
18
22
  const TARGETED_DEVICE_FAMILY = `"1,2"`;
19
23
 
20
24
  const addNotificationServiceExtension = async (
21
- options: CustomerIOPluginOptionsIOS
25
+ options: CustomerIOPluginOptionsIOS,
26
+ xcodeProject: XcodeProject
22
27
  ) => {
23
- // iosPath and appName are predefined from Expo config.
24
- // See function withCioNotificationsXcodeProject to get where the variabes are pulled from.
25
- const { iosPath, appName } = options;
26
-
27
- const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
28
-
29
- const xcodeProject = xcode.project(projPath);
30
-
31
- xcodeProject.parse(async function (err: Error) {
32
- if (err) {
33
- throw new Error(`Error parsing iOS project: ${JSON.stringify(err)}`);
34
- }
35
-
28
+ try {
36
29
  if (options.pushNotification) {
37
30
  await addPushNotificationFile(options, xcodeProject);
38
31
  }
@@ -40,9 +33,11 @@ const addNotificationServiceExtension = async (
40
33
  if (options.pushNotification?.useRichPush) {
41
34
  await addRichPushXcodeProj(options, xcodeProject);
42
35
  }
43
-
44
- FileManagement.writeFile(projPath, xcodeProject.writeSync());
45
- });
36
+ return xcodeProject;
37
+ } catch (error: any) {
38
+ console.error(error);
39
+ return null;
40
+ }
46
41
  };
47
42
 
48
43
  export const withCioNotificationsXcodeProject: ConfigPlugin<
@@ -97,7 +92,14 @@ export const withCioNotificationsXcodeProject: ConfigPlugin<
97
92
  pushNotification,
98
93
  };
99
94
 
100
- await addNotificationServiceExtension(options);
95
+ const modifiedProjectFile = await addNotificationServiceExtension(
96
+ options,
97
+ config.modResults
98
+ );
99
+
100
+ if (modifiedProjectFile) {
101
+ config.modResults = modifiedProjectFile;
102
+ }
101
103
 
102
104
  return config;
103
105
  });
@@ -117,7 +119,9 @@ const addRichPushXcodeProj = async (
117
119
  useFrameworks,
118
120
  } = options;
119
121
 
120
- await injectCIONotificationPodfileCode(iosPath, useFrameworks);
122
+ const isFcmProvider = isFcmPushProvider(options);
123
+
124
+ await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);
121
125
 
122
126
  // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project
123
127
  // If true then skip creating a new group to avoid duplicate folders
@@ -133,20 +137,32 @@ const addRichPushXcodeProj = async (
133
137
  recursive: true,
134
138
  });
135
139
 
136
- const files = [
140
+ const platformSpecificFiles = [
141
+ 'NotificationService.swift',
142
+ ];
143
+
144
+ const commonFiles = [
137
145
  PLIST_FILENAME,
138
146
  'NotificationService.h',
139
- 'NotificationService.swift',
140
147
  'NotificationService.m',
141
148
  ENV_FILENAME,
142
149
  ];
143
150
 
144
151
  const getTargetFile = (filename: string) => `${nsePath}/${filename}`;
152
+ // Copy platform-specific files
153
+ platformSpecificFiles.forEach((filename) => {
154
+ const targetFile = getTargetFile(filename);
155
+ FileManagement.copyFile(
156
+ `${LOCAL_PATH_TO_CIO_NSE_FILES}/${isFcmProvider ? "fcm" : "apn"}/${filename}`,
157
+ targetFile
158
+ );
159
+ });
145
160
 
146
- files.forEach((filename) => {
161
+ // Copy common files
162
+ commonFiles.forEach((filename) => {
147
163
  const targetFile = getTargetFile(filename);
148
164
  FileManagement.copyFile(
149
- `${LOCAL_PATH_TO_CIO_NSE_FILES}/${filename}`,
165
+ `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,
150
166
  targetFile
151
167
  );
152
168
  });
@@ -162,7 +178,7 @@ const addRichPushXcodeProj = async (
162
178
 
163
179
  // Create new PBXGroup for the extension
164
180
  const extGroup = xcodeProject.addPbxGroup(
165
- files,
181
+ [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,
166
182
  CIO_NOTIFICATION_TARGET_NAME,
167
183
  CIO_NOTIFICATION_TARGET_NAME
168
184
  );
@@ -233,7 +249,7 @@ const addRichPushXcodeProj = async (
233
249
  const buildSettingsObj = configurations[key].buildSettings;
234
250
  buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
235
251
  buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
236
- iosDeploymentTarget || '13.0';
252
+ iosDeploymentTarget || '15.1';
237
253
  buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
238
254
  buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
239
255
  buildSettingsObj.SWIFT_VERSION = 4.2;
@@ -278,25 +294,16 @@ const updateNseEnv = (
278
294
  options: CustomerIOPluginOptionsIOS,
279
295
  envFileName: string
280
296
  ) => {
281
- const SITE_ID_RE = /\{\{SITE_ID\}\}/;
282
- const API_KEY_RE = /\{\{API_KEY\}\}/;
297
+ const CDP_API_KEY_RE = /\{\{CDP_API_KEY\}\}/;
283
298
  const REGION_RE = /\{\{REGION\}\}/;
284
299
 
285
300
  let envFileContent = FileManagement.readFile(envFileName);
286
301
 
287
- if (options.pushNotification?.env?.siteId) {
302
+ if (options.pushNotification?.env?.cdpApiKey) {
288
303
  envFileContent = replaceCodeByRegex(
289
304
  envFileContent,
290
- SITE_ID_RE,
291
- options.pushNotification?.env?.siteId
292
- );
293
- }
294
-
295
- if (options.pushNotification?.env?.apiKey) {
296
- envFileContent = replaceCodeByRegex(
297
- envFileContent,
298
- API_KEY_RE,
299
- options.pushNotification?.env?.apiKey
305
+ CDP_API_KEY_RE,
306
+ options.pushNotification?.env?.cdpApiKey
300
307
  );
301
308
  }
302
309
 
@@ -327,25 +334,29 @@ async function addPushNotificationFile(
327
334
  options: CustomerIOPluginOptionsIOS,
328
335
  xcodeProject: any
329
336
  ) {
337
+ // Maybe copy a different file with FCM config based on config
330
338
  const { iosPath, appName } = options;
331
- const file = 'PushService.swift';
339
+ const isFcmProvider = isFcmPushProvider(options);
340
+ // PushService.swift is platform-specific and always lives in the platform folder
341
+ const sourceFile = `${isFcmProvider ? "fcm" : "apn"}/PushService.swift`;
342
+ const targetFileName = 'PushService.swift';
332
343
  const appPath = `${iosPath}/${appName}`;
333
344
  const getTargetFile = (filename: string) => `${appPath}/${filename}`;
334
- const targetFile = getTargetFile(file);
345
+ const targetFile = getTargetFile(targetFileName);
335
346
 
336
347
  // Check whether {file} exists in the project. If false, then add the file
337
348
  // If {file} exists then skip and return
338
- if (!FileManagement.exists(getTargetFile(file))) {
349
+ if (!FileManagement.exists(getTargetFile(targetFileName))) {
339
350
  FileManagement.mkdir(appPath, {
340
351
  recursive: true,
341
352
  });
342
353
 
343
354
  FileManagement.copyFile(
344
- `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,
355
+ `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,
345
356
  targetFile
346
357
  );
347
358
  } else {
348
- console.log(`${getTargetFile(file)} already exists. Skipping...`);
359
+ console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);
349
360
  return;
350
361
  }
351
362
 
@@ -355,7 +366,7 @@ async function addPushNotificationFile(
355
366
  const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });
356
367
  xcodeProject.addToPbxGroup(group, classesKey);
357
368
 
358
- xcodeProject.addSourceFile(`${appName}/${file}`, null, group);
369
+ xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);
359
370
  }
360
371
 
361
372
  const updatePushFile = (
@@ -373,8 +384,47 @@ const updatePushFile = (
373
384
  ) {
374
385
  snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;
375
386
  }
376
-
377
387
  envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);
378
388
 
389
+ if (options.pushNotification) {
390
+ envFileContent = replaceCodeByRegex(
391
+ envFileContent,
392
+ /\{\{CDP_API_KEY\}\}/,
393
+ options.pushNotification.env.cdpApiKey
394
+ );
395
+ envFileContent = replaceCodeByRegex(
396
+ envFileContent,
397
+ /\{\{REGION\}\}/,
398
+ options.pushNotification.env.region.toUpperCase()
399
+ );
400
+ }
401
+
402
+ const autoTrackPushEvents =
403
+ options.autoTrackPushEvents === undefined ||
404
+ options.autoTrackPushEvents === true;
405
+ envFileContent = replaceCodeByRegex(
406
+ envFileContent,
407
+ /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/,
408
+ autoTrackPushEvents.toString()
409
+ );
410
+
411
+ const autoFetchDeviceToken =
412
+ options.autoFetchDeviceToken === undefined ||
413
+ options.autoFetchDeviceToken === true;
414
+ envFileContent = replaceCodeByRegex(
415
+ envFileContent,
416
+ /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/,
417
+ autoFetchDeviceToken.toString()
418
+ );
419
+
420
+ const showPushAppInForeground =
421
+ options.showPushAppInForeground === undefined ||
422
+ options.showPushAppInForeground === true;
423
+ envFileContent = replaceCodeByRegex(
424
+ envFileContent,
425
+ /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/,
426
+ showPushAppInForeground.toString()
427
+ );
428
+
379
429
  FileManagement.writeFile(envFileName, envFileContent);
380
430
  };
@@ -2,6 +2,7 @@ import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';
2
2
 
3
3
  import { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';
4
4
  import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
5
+ import { isFcmPushProvider } from './utils';
5
6
 
6
7
  export const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (
7
8
  config,
@@ -18,7 +19,7 @@ export const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (
18
19
  };
19
20
  const { iosPath } = options;
20
21
 
21
- await injectCIOPodfileCode(iosPath);
22
+ await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps));
22
23
 
23
24
  return props;
24
25
  });
@@ -0,0 +1,32 @@
1
+ const fs = require('fs');
2
+
3
+ function runPostInstall() {
4
+ // react native SDK package.json path
5
+ const reactNativePackageJsonFile = `${__dirname}/../../../customerio-reactnative/package.json`;
6
+ const expoPackageJsonFile = `${__dirname}/../../package.json`;
7
+ try {
8
+ // if react native SDK is installed
9
+ if (fs.existsSync(reactNativePackageJsonFile)) {
10
+ const reactNativePackageJson = fs.readFileSync(
11
+ reactNativePackageJsonFile,
12
+ 'utf8'
13
+ );
14
+ const expoPackageJson = require(expoPackageJsonFile);
15
+
16
+ const reactNativePackage = JSON.parse(reactNativePackageJson);
17
+ reactNativePackage.expoVersion = expoPackageJson.version;
18
+
19
+ fs.writeFileSync(
20
+ reactNativePackageJsonFile,
21
+ JSON.stringify(reactNativePackage, null, 2)
22
+ );
23
+ }
24
+ } catch (error) {
25
+ console.warn(
26
+ 'Unable to find customerio-reactnative package.json file. Please make sure you have installed the customerio-reactnative package.',
27
+ error
28
+ );
29
+ }
30
+ }
31
+
32
+ exports.runPostInstall = runPostInstall;
@@ -16,12 +16,21 @@ export type CustomerIOPluginOptionsIOS = {
16
16
  appleTeamId?: string;
17
17
  appName?: string;
18
18
  disableNotificationRegistration?: boolean;
19
+ /**
20
+ * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.
21
+ */
22
+ handleNotificationClick?: boolean;
23
+ showPushAppInForeground?: boolean;
24
+ autoTrackPushEvents?: boolean;
25
+ autoFetchDeviceToken?: boolean;
26
+ handleDeeplinkInKilledState?: boolean;
19
27
  useFrameworks?: 'static' | 'dynamic';
20
28
  pushNotification?: {
29
+ provider?: 'apn' | 'fcm';
30
+ googleServicesFile?: string;
21
31
  useRichPush: boolean;
22
32
  env: {
23
- siteId: string;
24
- apiKey: string;
33
+ cdpApiKey: string;
25
34
  region: string;
26
35
  };
27
36
  };
@@ -1 +0,0 @@
1
- {"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAEO,SAASK,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAG,IAAAE,gDAAuB,EAACF,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAG,oDAAyB,EAACH,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAI,4CAAqB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAK,8CAAsB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACK,0BAA0B,EAAE;IACpCN,MAAM,GAAG,IAAAO,sDAA0B,EAACP,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf"}