customerio-expo-plugin 2.0.3 → 2.1.0

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 (76) hide show
  1. package/package.json +8 -7
  2. package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
  3. package/plugin/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
  4. package/plugin/lib/commonjs/android/withGistMavenRepository.js.map +1 -1
  5. package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
  6. package/plugin/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
  7. package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -1
  8. package/plugin/lib/commonjs/helpers/constants/ios.js +27 -1
  9. package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -1
  10. package/plugin/lib/commonjs/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +52 -0
  11. package/plugin/lib/commonjs/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +74 -0
  12. package/plugin/lib/commonjs/helpers/utils/fileManagement.js.map +1 -1
  13. package/plugin/lib/commonjs/ios/utils.js +17 -2
  14. package/plugin/lib/commonjs/ios/utils.js.map +1 -1
  15. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
  16. package/plugin/lib/commonjs/ios/withCIOIos.js +8 -1
  17. package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
  18. package/plugin/lib/commonjs/ios/withCIOIosSwift.js +269 -0
  19. package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -0
  20. package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
  21. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +4 -3
  22. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
  23. package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
  24. package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
  25. package/plugin/lib/module/android/withAppGoogleServices.js.map +1 -1
  26. package/plugin/lib/module/android/withGistMavenRepository.js.map +1 -1
  27. package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
  28. package/plugin/lib/module/android/withProjectGoogleServices.js.map +1 -1
  29. package/plugin/lib/module/android/withProjectStrings.js.map +1 -1
  30. package/plugin/lib/module/helpers/constants/ios.js +26 -0
  31. package/plugin/lib/module/helpers/constants/ios.js.map +1 -1
  32. package/plugin/lib/module/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +52 -0
  33. package/plugin/lib/module/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +74 -0
  34. package/plugin/lib/module/helpers/utils/fileManagement.js.map +1 -1
  35. package/plugin/lib/module/ios/utils.js +15 -1
  36. package/plugin/lib/module/ios/utils.js.map +1 -1
  37. package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
  38. package/plugin/lib/module/ios/withCIOIos.js +8 -1
  39. package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
  40. package/plugin/lib/module/ios/withCIOIosSwift.js +262 -0
  41. package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -0
  42. package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
  43. package/plugin/lib/module/ios/withNotificationsXcodeProject.js +5 -4
  44. package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
  45. package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
  46. package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +1 -1
  47. package/plugin/lib/typescript/android/withAppGoogleServices.d.ts +1 -1
  48. package/plugin/lib/typescript/android/withGistMavenRepository.d.ts +1 -1
  49. package/plugin/lib/typescript/android/withGoogleServicesJSON.d.ts +1 -1
  50. package/plugin/lib/typescript/android/withProjectGoogleServices.d.ts +1 -1
  51. package/plugin/lib/typescript/android/withProjectStrings.d.ts +1 -1
  52. package/plugin/lib/typescript/helpers/constants/ios.d.ts +3 -0
  53. package/plugin/lib/typescript/helpers/utils/fileManagement.d.ts +1 -2
  54. package/plugin/lib/typescript/ios/utils.d.ts +2 -0
  55. package/plugin/lib/typescript/ios/withAppDelegateModifications.d.ts +1 -1
  56. package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +3 -0
  57. package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +1 -1
  58. package/plugin/lib/typescript/ios/withNotificationsXcodeProject.d.ts +1 -1
  59. package/plugin/lib/typescript/ios/withXcodeProject.d.ts +1 -1
  60. package/plugin/src/android/withAndroidManifestUpdates.ts +2 -1
  61. package/plugin/src/android/withAppGoogleServices.ts +2 -1
  62. package/plugin/src/android/withGistMavenRepository.ts +2 -1
  63. package/plugin/src/android/withGoogleServicesJSON.ts +2 -1
  64. package/plugin/src/android/withProjectGoogleServices.ts +2 -1
  65. package/plugin/src/android/withProjectStrings.ts +2 -1
  66. package/plugin/src/helpers/constants/ios.ts +29 -0
  67. package/plugin/src/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +52 -0
  68. package/plugin/src/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +74 -0
  69. package/plugin/src/helpers/utils/fileManagement.ts +1 -1
  70. package/plugin/src/ios/utils.ts +20 -3
  71. package/plugin/src/ios/withAppDelegateModifications.ts +2 -1
  72. package/plugin/src/ios/withCIOIos.ts +15 -2
  73. package/plugin/src/ios/withCIOIosSwift.ts +384 -0
  74. package/plugin/src/ios/withGoogleServicesJsonFile.ts +1 -1
  75. package/plugin/src/ios/withNotificationsXcodeProject.ts +9 -9
  76. package/plugin/src/ios/withXcodeProject.ts +2 -1
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withCIOIosSwift = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var _fileManagement = require("../helpers/utils/fileManagement");
10
+ var _ios = require("../helpers/constants/ios");
11
+ var _codeInjection = require("../helpers/utils/codeInjection");
12
+ var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ // Constants
15
+ const CIO_SDK_APP_DELEGATE_HANDLER_CLASS = 'CioSdkAppDelegateHandler';
16
+ const CIO_SDK_APP_DELEGATE_HANDLER_FILENAME = `${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}.swift`;
17
+
18
+ /**
19
+ * Copy and configure the CioSdkAppDelegateHandler.swift file
20
+ */
21
+ const copyAndConfigureAppDelegateHandler = (config, props) => {
22
+ var _props$pushNotificati, _props$pushNotificati2, _props$pushNotificati3, _props$pushNotificati4;
23
+ const projectRoot = config.modRequest.projectRoot;
24
+ const iosProjectRoot = _path.default.join(projectRoot, 'ios');
25
+ const useFcm = (0, _utils.isFcmPushProvider)(props);
26
+
27
+ // Source path for the handler file
28
+ const handlerSourcePath = _path.default.join(_ios.LOCAL_PATH_TO_CIO_NSE_FILES, useFcm ? 'fcm' : 'apn', CIO_SDK_APP_DELEGATE_HANDLER_FILENAME);
29
+
30
+ // Destination path in the iOS project
31
+ const projectName = config.modRequest.projectName || '';
32
+ if (!projectName) {
33
+ console.warn('Project name is undefined, cannot copy CioSdkAppDelegateHandler.swift');
34
+ return config;
35
+ }
36
+ const handlerDestPath = _path.default.join(iosProjectRoot, projectName, CIO_SDK_APP_DELEGATE_HANDLER_FILENAME);
37
+ _fileManagement.FileManagement.copyFile(handlerSourcePath, handlerDestPath);
38
+
39
+ // Add the file to the Xcode project
40
+ const xcodeProject = config.modResults;
41
+
42
+ // Create a group for CustomerIO files if it doesn't exist
43
+ let group;
44
+ const existingGroup = xcodeProject.pbxGroupByName('CustomerIO');
45
+ if (existingGroup) {
46
+ group = existingGroup;
47
+ } else {
48
+ group = xcodeProject.pbxCreateGroup('CustomerIO');
49
+ const classesKey = xcodeProject.findPBXGroupKey({
50
+ name: projectName
51
+ });
52
+ xcodeProject.addToPbxGroup(group, classesKey);
53
+ }
54
+
55
+ // Add the file to the Xcode project
56
+ xcodeProject.addSourceFile(`${projectName}/${CIO_SDK_APP_DELEGATE_HANDLER_FILENAME}`, null, group);
57
+ let handlerFileContent = _fileManagement.FileManagement.readFile(handlerDestPath);
58
+ const disableNotificationRegistration = (_props$pushNotificati = props.pushNotification) === null || _props$pushNotificati === void 0 ? void 0 : _props$pushNotificati.disableNotificationRegistration;
59
+ let snippet = '';
60
+ // unless this property is explicity set to true, push notification
61
+ // registration will be added to the AppDelegate
62
+ if (disableNotificationRegistration !== true) {
63
+ snippet = _ios.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2;
64
+ }
65
+ handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, _ios.CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER, snippet);
66
+ const autoTrackPushEvents = ((_props$pushNotificati2 = props.pushNotification) === null || _props$pushNotificati2 === void 0 ? void 0 : _props$pushNotificati2.autoTrackPushEvents) !== false;
67
+ handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/, autoTrackPushEvents.toString());
68
+ const autoFetchDeviceToken = ((_props$pushNotificati3 = props.pushNotification) === null || _props$pushNotificati3 === void 0 ? void 0 : _props$pushNotificati3.autoFetchDeviceToken) !== false;
69
+ handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
70
+ const showPushAppInForeground = ((_props$pushNotificati4 = props.pushNotification) === null || _props$pushNotificati4 === void 0 ? void 0 : _props$pushNotificati4.showPushAppInForeground) !== false;
71
+ handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
72
+ _fileManagement.FileManagement.writeFile(handlerDestPath, handlerFileContent);
73
+ return config;
74
+ };
75
+ const withCIOIosSwift = (configOuter, props) => {
76
+ // First, copy the CioSdkAppDelegateHandler.swift file to the iOS project and add it to Xcode project
77
+ configOuter = (0, _configPlugins.withXcodeProject)(configOuter, async config => {
78
+ return copyAndConfigureAppDelegateHandler(config, props);
79
+ });
80
+
81
+ // Then modify the AppDelegate
82
+ return (0, _configPlugins.withAppDelegate)(configOuter, async config => {
83
+ return modifyAppDelegate(config, props);
84
+ });
85
+ };
86
+
87
+ /**
88
+ * Modify the AppDelegate to integrate with Customer.io SDK
89
+ */
90
+ exports.withCIOIosSwift = withCIOIosSwift;
91
+ const modifyAppDelegate = (config, props) => {
92
+ var _props$pushNotificati5;
93
+ const appDelegateContent = config.modResults.contents;
94
+
95
+ // Check if modifications have already been applied
96
+ if (appDelegateContent.includes(CIO_SDK_APP_DELEGATE_HANDLER_CLASS)) {
97
+ console.log('CustomerIO Swift AppDelegate changes already exist. Skipping...');
98
+ return config;
99
+ }
100
+
101
+ // Add the handler property declaration
102
+ let modifiedContent = addHandlerPropertyDeclaration(appDelegateContent);
103
+
104
+ // Modify didFinishLaunchingWithOptions to initialize and call the handler
105
+ modifiedContent = modifyDidFinishLaunchingWithOptions(modifiedContent);
106
+
107
+ // Add didRegisterForRemoteNotificationsWithDeviceToken implementation
108
+ modifiedContent = addDidRegisterForRemoteNotificationsWithDeviceToken(modifiedContent);
109
+
110
+ // Add didFailToRegisterForRemoteNotificationsWithError implementation
111
+ modifiedContent = addDidFailToRegisterForRemoteNotificationsWithError(modifiedContent);
112
+
113
+ // Add deep link handling for killed state if enabled
114
+ if (((_props$pushNotificati5 = props.pushNotification) === null || _props$pushNotificati5 === void 0 ? void 0 : _props$pushNotificati5.handleDeeplinkInKilledState) === true) {
115
+ modifiedContent = addHandleDeeplinkInKilledState(modifiedContent);
116
+ }
117
+ config.modResults.contents = modifiedContent;
118
+ return config;
119
+ };
120
+
121
+ /**
122
+ * Check if a method exists in the AppDelegate content
123
+ * @param content The AppDelegate content
124
+ * @param methodSignature The method signature to check for
125
+ * @returns true if the method exists, false otherwise
126
+ */
127
+ const methodExistsInAppDelegate = (content, methodSignature) => {
128
+ return content.includes(methodSignature);
129
+ };
130
+
131
+ /**
132
+ * Add handler property declaration to the AppDelegate class
133
+ * This adds the line: let cioSdkHandler = CioSdkAppDelegateHandler()
134
+ * to the AppDelegate class
135
+ */
136
+ const addHandlerPropertyDeclaration = content => {
137
+ // Look for the AppDelegate class declaration
138
+ const classDeclarationRegex = /class\s+AppDelegate\s*:\s*.*\s*{/;
139
+ const match = content.match(classDeclarationRegex);
140
+ if (!match) {
141
+ console.warn('Could not find AppDelegate class declaration');
142
+ return content;
143
+ }
144
+ const position = match.index + match[0].length;
145
+ return content.substring(0, position) + `\n let cioSdkHandler = ${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}()\n` + content.substring(position);
146
+ };
147
+
148
+ /**
149
+ * Modify didFinishLaunchingWithOptions to call the handler
150
+ * This adds the handler call before the return statement in didFinishLaunchingWithOptions
151
+ */
152
+ const modifyDidFinishLaunchingWithOptions = content => {
153
+ // Find the return statement in didFinishLaunchingWithOptions
154
+ // Always look for launchOptions since modifiedLaunchOptions is only set later
155
+ const returnStatementRegex = /return\s+super\.application\s*\(\s*application\s*,\s*didFinishLaunchingWithOptions\s*:\s*launchOptions\s*\)/;
156
+ const returnStatementMatch = content.match(returnStatementRegex);
157
+ if (!returnStatementMatch) {
158
+ console.warn('Could not find return statement with super.application in didFinishLaunchingWithOptions');
159
+ return content;
160
+ }
161
+
162
+ // Add handler call before the return statement
163
+ const insertPosition = returnStatementMatch.index;
164
+ const handlerCallCode = ` cioSdkHandler.application(application, didFinishLaunchingWithOptions: launchOptions)\n\n `;
165
+ return content.substring(0, insertPosition) + handlerCallCode + content.substring(insertPosition);
166
+ };
167
+
168
+ /**
169
+ * Add or modify didRegisterForRemoteNotificationsWithDeviceToken implementation
170
+ * If the method already exists, it adds the handler call to the existing method
171
+ * If the method doesn't exist, it adds a new method implementation
172
+ */
173
+ const addDidRegisterForRemoteNotificationsWithDeviceToken = content => {
174
+ const methodSignature = 'func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:';
175
+
176
+ // Check if method already exists
177
+ if (methodExistsInAppDelegate(content, methodSignature)) {
178
+ // Method exists, modify it to call our handler
179
+ const methodRegex = /func\s+application\s*\(\s*_\s+application\s*:\s*UIApplication\s*,\s*didRegisterForRemoteNotificationsWithDeviceToken\s+deviceToken\s*:\s*Data\s*\)\s*{[\s\S]*?}/;
180
+ const match = content.match(methodRegex);
181
+ if (match) {
182
+ // Add our handler call to the existing method
183
+ const methodContent = match[0];
184
+ const openBraceIndex = methodContent.indexOf('{') + 1;
185
+ const modifiedMethod = methodContent.substring(0, openBraceIndex) + '\n // Call CustomerIO SDK handler\n' + ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\n' + methodContent.substring(openBraceIndex);
186
+ return content.replace(methodRegex, modifiedMethod);
187
+ }
188
+ return content;
189
+ } else {
190
+ // Method doesn't exist, add it inside the AppDelegate class
191
+ // Find the end of the AppDelegate class
192
+ const classEndRegex = /^}(\s*$|\s*\/\/)/m;
193
+ const classEndMatch = content.match(classEndRegex);
194
+ if (!classEndMatch) {
195
+ console.warn('Could not find end of AppDelegate class');
196
+ return content;
197
+ }
198
+
199
+ // Insert the method inside the class
200
+ const position = classEndMatch.index;
201
+ return content.substring(0, position) + '\n // Handle device token registration\n' + ' public override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\n' + ' // Call CustomerIO SDK handler\n' + ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\n' + ' super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\n' + ' }\n' + content.substring(position);
202
+ }
203
+ };
204
+
205
+ /**
206
+ * Add or modify didFailToRegisterForRemoteNotificationsWithError implementation
207
+ * If the method already exists, it adds the handler call to the existing method
208
+ * If the method doesn't exist, it adds a new method implementation
209
+ */
210
+ const addDidFailToRegisterForRemoteNotificationsWithError = content => {
211
+ const methodSignature = 'func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error:';
212
+
213
+ // Check if method already exists
214
+ if (methodExistsInAppDelegate(content, methodSignature)) {
215
+ // Method exists, modify it to call our handler
216
+ const methodRegex = /func\s+application\s*\(\s*_\s+application\s*:\s*UIApplication\s*,\s*didFailToRegisterForRemoteNotificationsWithError\s+error\s*:\s*Error\s*\)\s*{[\s\S]*?}/;
217
+ const match = content.match(methodRegex);
218
+ if (match) {
219
+ // Add our handler call to the existing method
220
+ const methodContent = match[0];
221
+ const openBraceIndex = methodContent.indexOf('{') + 1;
222
+ const modifiedMethod = methodContent.substring(0, openBraceIndex) + '\n // Call CustomerIO SDK handler\n' + ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\n' + methodContent.substring(openBraceIndex);
223
+ return content.replace(methodRegex, modifiedMethod);
224
+ }
225
+ return content;
226
+ } else {
227
+ // Method doesn't exist, add it inside the AppDelegate class
228
+ // Find the end of the AppDelegate class
229
+ const classEndRegex = /^}(\s*$|\s*\/\/)/m;
230
+ const classEndMatch = content.match(classEndRegex);
231
+ if (!classEndMatch) {
232
+ console.warn('Could not find end of AppDelegate class');
233
+ return content;
234
+ }
235
+
236
+ // Insert the method inside the class
237
+ const position = classEndMatch.index;
238
+ return content.substring(0, position) + '\n // Handle remote notification registration errors\n' + ' public override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {\n' + ' // Call CustomerIO SDK handler\n' + ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\n' + ' super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\n' + ' }\n' + content.substring(position);
239
+ }
240
+ };
241
+
242
+ /**
243
+ * Add deep link handling for killed state
244
+ * This replaces the return statement with deep link handling code
245
+ * and a modified return statement that uses modifiedLaunchOptions
246
+ */
247
+ const addHandleDeeplinkInKilledState = content => {
248
+ // Check if deep link code snippet is already present
249
+ const deepLinkMarker = "Deep link workaround for app killed state start";
250
+ if (content.includes(deepLinkMarker)) {
251
+ return content;
252
+ }
253
+
254
+ // Find the return statement with launchOptions
255
+ const returnStatementRegex = /return\s+super\.application\s*\(\s*application\s*,\s*didFinishLaunchingWithOptions\s*:\s*launchOptions\s*\)/;
256
+ const returnStatementMatch = content.match(returnStatementRegex);
257
+ if (!returnStatementMatch) {
258
+ console.warn("Could not find return statement with launchOptions");
259
+ return content;
260
+ }
261
+
262
+ // Create the replacement code with deep link handling and modified return statement
263
+ const modifiedReturnStatement = "return super.application(application, didFinishLaunchingWithOptions: modifiedLaunchOptions)";
264
+ const replacementCode = _ios.CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET + "\n\n " + modifiedReturnStatement;
265
+
266
+ // Replace the return statement with deep link handling code and modified return statement
267
+ return content.replace(returnStatementRegex, replacementCode);
268
+ };
269
+ //# sourceMappingURL=withCIOIosSwift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","_path","_interopRequireDefault","_fileManagement","_ios","_codeInjection","_utils","e","__esModule","default","CIO_SDK_APP_DELEGATE_HANDLER_CLASS","CIO_SDK_APP_DELEGATE_HANDLER_FILENAME","copyAndConfigureAppDelegateHandler","config","props","_props$pushNotificati","_props$pushNotificati2","_props$pushNotificati3","_props$pushNotificati4","projectRoot","modRequest","iosProjectRoot","path","join","useFcm","isFcmPushProvider","handlerSourcePath","LOCAL_PATH_TO_CIO_NSE_FILES","projectName","console","warn","handlerDestPath","FileManagement","copyFile","xcodeProject","modResults","group","existingGroup","pbxGroupByName","pbxCreateGroup","classesKey","findPBXGroupKey","name","addToPbxGroup","addSourceFile","handlerFileContent","readFile","disableNotificationRegistration","pushNotification","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2","replaceCodeByRegex","CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","writeFile","withCIOIosSwift","configOuter","withXcodeProject","withAppDelegate","modifyAppDelegate","exports","_props$pushNotificati5","appDelegateContent","contents","includes","log","modifiedContent","addHandlerPropertyDeclaration","modifyDidFinishLaunchingWithOptions","addDidRegisterForRemoteNotificationsWithDeviceToken","addDidFailToRegisterForRemoteNotificationsWithError","handleDeeplinkInKilledState","addHandleDeeplinkInKilledState","methodExistsInAppDelegate","content","methodSignature","classDeclarationRegex","match","position","index","length","substring","returnStatementRegex","returnStatementMatch","insertPosition","handlerCallCode","methodRegex","methodContent","openBraceIndex","indexOf","modifiedMethod","replace","classEndRegex","classEndMatch","deepLinkMarker","modifiedReturnStatement","replacementCode","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET"],"sources":["withCIOIosSwift.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport {\n withAppDelegate,\n withXcodeProject,\n} from '@expo/config-plugins';\nimport path from 'path';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport {\n LOCAL_PATH_TO_CIO_NSE_FILES,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { isFcmPushProvider } from './utils';\n\n// Constants\nconst CIO_SDK_APP_DELEGATE_HANDLER_CLASS = 'CioSdkAppDelegateHandler';\nconst CIO_SDK_APP_DELEGATE_HANDLER_FILENAME = `${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}.swift`;\n\n/**\n * Copy and configure the CioSdkAppDelegateHandler.swift file\n */\nconst copyAndConfigureAppDelegateHandler = (\n config: any,\n props: CustomerIOPluginOptionsIOS\n): any => {\n const projectRoot = config.modRequest.projectRoot;\n const iosProjectRoot = path.join(projectRoot, 'ios');\n const useFcm = isFcmPushProvider(props);\n\n // Source path for the handler file\n const handlerSourcePath = path.join(\n LOCAL_PATH_TO_CIO_NSE_FILES,\n useFcm ? 'fcm' : 'apn',\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n // Destination path in the iOS project\n const projectName = config.modRequest.projectName || '';\n if (!projectName) {\n console.warn(\n 'Project name is undefined, cannot copy CioSdkAppDelegateHandler.swift'\n );\n return config;\n }\n\n const handlerDestPath = path.join(\n iosProjectRoot,\n projectName,\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n FileManagement.copyFile(handlerSourcePath, handlerDestPath);\n\n // Add the file to the Xcode project\n const xcodeProject = config.modResults;\n\n // Create a group for CustomerIO files if it doesn't exist\n let group;\n const existingGroup = xcodeProject.pbxGroupByName('CustomerIO');\n if (existingGroup) {\n group = existingGroup;\n } else {\n group = xcodeProject.pbxCreateGroup('CustomerIO');\n const classesKey = xcodeProject.findPBXGroupKey({ name: projectName });\n xcodeProject.addToPbxGroup(group, classesKey);\n }\n\n // Add the file to the Xcode project\n xcodeProject.addSourceFile(\n `${projectName}/${CIO_SDK_APP_DELEGATE_HANDLER_FILENAME}`,\n null,\n group\n );\n\n let handlerFileContent = FileManagement.readFile(handlerDestPath);\n\n const disableNotificationRegistration =\n props.pushNotification?.disableNotificationRegistration;\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2;\n }\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n snippet\n );\n\n const autoTrackPushEvents =\n props.pushNotification?.autoTrackPushEvents !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n props.pushNotification?.autoFetchDeviceToken !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n props.pushNotification?.showPushAppInForeground !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(handlerDestPath, handlerFileContent);\n\n return config;\n};\n\nexport const withCIOIosSwift: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n configOuter,\n props\n) => {\n // First, copy the CioSdkAppDelegateHandler.swift file to the iOS project and add it to Xcode project\n configOuter = withXcodeProject(configOuter, async (config) => {\n return copyAndConfigureAppDelegateHandler(config, props);\n });\n\n // Then modify the AppDelegate\n return withAppDelegate(configOuter, async (config) => {\n return modifyAppDelegate(config, props);\n });\n};\n\n/**\n * Modify the AppDelegate to integrate with Customer.io SDK\n */\nconst modifyAppDelegate = (\n config: any,\n props: CustomerIOPluginOptionsIOS\n): any => {\n const appDelegateContent = config.modResults.contents;\n\n // Check if modifications have already been applied\n if (appDelegateContent.includes(CIO_SDK_APP_DELEGATE_HANDLER_CLASS)) {\n console.log(\n 'CustomerIO Swift AppDelegate changes already exist. Skipping...'\n );\n return config;\n }\n\n // Add the handler property declaration\n let modifiedContent = addHandlerPropertyDeclaration(appDelegateContent);\n\n // Modify didFinishLaunchingWithOptions to initialize and call the handler\n modifiedContent = modifyDidFinishLaunchingWithOptions(modifiedContent);\n\n // Add didRegisterForRemoteNotificationsWithDeviceToken implementation\n modifiedContent =\n addDidRegisterForRemoteNotificationsWithDeviceToken(modifiedContent);\n\n // Add didFailToRegisterForRemoteNotificationsWithError implementation\n modifiedContent =\n addDidFailToRegisterForRemoteNotificationsWithError(modifiedContent);\n \n // Add deep link handling for killed state if enabled\n if (props.pushNotification?.handleDeeplinkInKilledState === true) {\n modifiedContent = addHandleDeeplinkInKilledState(modifiedContent);\n }\n\n config.modResults.contents = modifiedContent;\n return config;\n};\n\n/**\n * Check if a method exists in the AppDelegate content\n * @param content The AppDelegate content\n * @param methodSignature The method signature to check for\n * @returns true if the method exists, false otherwise\n */\nconst methodExistsInAppDelegate = (\n content: string,\n methodSignature: string\n): boolean => {\n return content.includes(methodSignature);\n};\n\n/**\n * Add handler property declaration to the AppDelegate class\n * This adds the line: let cioSdkHandler = CioSdkAppDelegateHandler()\n * to the AppDelegate class\n */\nconst addHandlerPropertyDeclaration = (content: string): string => {\n // Look for the AppDelegate class declaration\n const classDeclarationRegex = /class\\s+AppDelegate\\s*:\\s*.*\\s*{/;\n const match = content.match(classDeclarationRegex);\n\n if (!match) {\n console.warn('Could not find AppDelegate class declaration');\n return content;\n }\n\n const position = match.index! + match[0].length;\n return (\n content.substring(0, position) +\n `\\n let cioSdkHandler = ${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}()\\n` +\n content.substring(position)\n );\n};\n\n/**\n * Modify didFinishLaunchingWithOptions to call the handler\n * This adds the handler call before the return statement in didFinishLaunchingWithOptions\n */\nconst modifyDidFinishLaunchingWithOptions = (content: string): string => {\n // Find the return statement in didFinishLaunchingWithOptions\n // Always look for launchOptions since modifiedLaunchOptions is only set later\n const returnStatementRegex = /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n \n const returnStatementMatch = content.match(returnStatementRegex);\n\n if (!returnStatementMatch) {\n console.warn(\n 'Could not find return statement with super.application in didFinishLaunchingWithOptions'\n );\n return content;\n }\n\n // Add handler call before the return statement\n const insertPosition = returnStatementMatch.index!;\n const handlerCallCode = ` cioSdkHandler.application(application, didFinishLaunchingWithOptions: launchOptions)\\n\\n `;\n \n return (\n content.substring(0, insertPosition) +\n handlerCallCode +\n content.substring(insertPosition)\n );\n};\n\n/**\n * Add or modify didRegisterForRemoteNotificationsWithDeviceToken implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n content: string\n): string => {\n const methodSignature = 'func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:';\n \n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didRegisterForRemoteNotificationsWithDeviceToken\\s+deviceToken\\s*:\\s*Data\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n console.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index!;\n return (\n content.substring(0, position) +\n '\\n // Handle device token registration\\n' +\n ' public override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add or modify didFailToRegisterForRemoteNotificationsWithError implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n content: string\n): string => {\n const methodSignature = 'func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error:';\n \n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didFailToRegisterForRemoteNotificationsWithError\\s+error\\s*:\\s*Error\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n console.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index!;\n return (\n content.substring(0, position) +\n '\\n // Handle remote notification registration errors\\n' +\n ' public override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add deep link handling for killed state\n * This replaces the return statement with deep link handling code\n * and a modified return statement that uses modifiedLaunchOptions\n */\nconst addHandleDeeplinkInKilledState = (content: string): string => {\n // Check if deep link code snippet is already present\n const deepLinkMarker = \"Deep link workaround for app killed state start\";\n if (content.includes(deepLinkMarker)) {\n return content;\n }\n\n // Find the return statement with launchOptions\n const returnStatementRegex = /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n const returnStatementMatch = content.match(returnStatementRegex);\n \n if (!returnStatementMatch) {\n console.warn(\"Could not find return statement with launchOptions\");\n return content;\n }\n \n // Create the replacement code with deep link handling and modified return statement\n const modifiedReturnStatement = \"return super.application(application, didFinishLaunchingWithOptions: modifiedLaunchOptions)\";\n const replacementCode = CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET + \"\\n\\n \" + modifiedReturnStatement;\n \n // Replace the return statement with deep link handling code and modified return statement\n return content.replace(returnStatementRegex, replacementCode);\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAMA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C;AACA,MAAMG,kCAAkC,GAAG,0BAA0B;AACrE,MAAMC,qCAAqC,GAAG,GAAGD,kCAAkC,QAAQ;;AAE3F;AACA;AACA;AACA,MAAME,kCAAkC,GAAGA,CACzCC,MAAW,EACXC,KAAiC,KACzB;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EACR,MAAMC,WAAW,GAAGN,MAAM,CAACO,UAAU,CAACD,WAAW;EACjD,MAAME,cAAc,GAAGC,aAAI,CAACC,IAAI,CAACJ,WAAW,EAAE,KAAK,CAAC;EACpD,M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6FAA6F;EAC7H,MAAMC,eAAe,GAAGC,oDAA+C,GAAG,UAAU,GAAGF,uBAAuB;;EAE9G;EACA,OAAOrB,OAAO,CAACiB,OAAO,CAACT,oBAAoB,EAAEc,eAAe,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_fileManagement","_utils","withGoogleServicesJsonFile","config","cioProps","withXcodeProject","props","_cioProps$pushNotific","useFcm","isFcmPushProvider","console","log","iosPath","modRequest","platformProjectRoot","googleServicesFile","pushNotification","appName","projectName","FileManagement","exists","_config$ios","ios","warn","copyFile","addFileToXcodeProject","modResults","e","error","exports","project","fileName","groupName","filepath","IOSConfig","XcodeUtils","ensureGroupRecursively","addResourceFileToGroup","isBuildFile"],"sources":["withGoogleServicesJsonFile.ts"],"sourcesContent":["import {\n withXcodeProject,\n IOSConfig,\n ConfigPlugin,\n} from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport const withGoogleServicesJsonFile: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (config, cioProps) => {\n return withXcodeProject(config, async (props) => {\n const useFcm = isFcmPushProvider(cioProps);\n if (!useFcm) {\n // Nothing to do, for providers other than FCM, the Google services JSON file isn't needed\n return props;\n }\n\n console.log(\n 'Only specify Customer.io ios.pushNotification.googleServicesFile config if you are not already including' +\n ' GoogleService-Info.plist as part of Firebase integration'\n );\n\n // googleServicesFile\n const iosPath = props.modRequest.platformProjectRoot;\n const googleServicesFile = cioProps.pushNotification?.googleServicesFile;\n const appName = props.modRequest.projectName;\n\n if (FileManagement.exists(`${iosPath}/GoogleService-Info.plist`)) {\n console.log(\n `File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (\n FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)\n ) {\n // This is where RN Firebase potentially copies GoogleService-Info.plist\n // Do not copy if it's already done by Firebase to avoid conflict in Resources\n console.log(\n `File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n if (config.ios?.googleServicesFile) {\n console.warn(\n 'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +\n ' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'\n );\n }\n\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${iosPath}/GoogleService-Info.plist`\n );\n\n addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');\n } catch (e) {\n console.error(\n `There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n } else {\n console.error(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n\n return props;\n });\n};\n\nfunction addFileToXcodeProject(project: any, fileName: string) {\n const groupName = 'Resources';\n const filepath = fileName;\n\n if (!IOSConfig.XcodeUtils.ensureGroupRecursively(project, groupName)) {\n console.error(\n `Error copying GoogleService-Info.plist. Failed to find or create '${groupName}' group in Xcode.`\n );\n return;\n }\n\n // Add GoogleService-Info.plist to the Xcode project\n IOSConfig.XcodeUtils.addResourceFileToGroup({\n project,\n filepath,\n groupName,\n isBuildFile: true,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,0BAEZ,GAAGA,CAACC,MAAM,EAAEC,QAAQ,KAAK;EACxB,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAAA,IAAAC,qBAAA;IAC/C,MAAMC,MAAM,GAAG,IAAAC,wBAAiB,EAACL,QAAQ,CAA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kB,KAAK,CACX,wCAAwCb,kBAAkB,yDAAyDH,OAAO,2BAC5H,CAAC;IACH;IAEA,OAAON,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACuB,OAAA,CAAA3B,0BAAA,GAAAA,0BAAA;AAEF,SAASuB,qBAAqBA,CAACK,OAAY,EAAEC,QAAgB,EAAE;EAC7D,MAAMC,SAAS,GAAG,WAAW;EAC7B,MAAMC,QAAQ,GAAGF,QAAQ;EAEzB,IAAI,CAACG,wBAAS,CAACC,UAAU,CAACC,sBAAsB,CAACN,OAAO,EAAEE,SAAS,CAAC,EAAE;IACpEtB,OAAO,CAACkB,KAAK,CACX,qEAAqEI,SAAS,mBAChF,CAAC;IACD;EACF;;EAEA;EACAE,wBAAS,CAACC,UAAU,CAACE,sBAAsB,CAAC;IAC1CP,OAAO;IACPG,QAAQ;IACRD,SAAS;IACTM,WAAW,EAAE;EACf,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_configPlugins","require","_fileManagement","_utils","withGoogleServicesJsonFile","config","cioProps","withXcodeProject","props","_cioProps$pushNotific","useFcm","isFcmPushProvider","console","log","iosPath","modRequest","platformProjectRoot","googleServicesFile","pushNotification","appName","projectName","FileManagement","exists","_config$ios","ios","warn","copyFile","addFileToXcodeProject","modResults","e","error","exports","project","fileName","groupName","filepath","IOSConfig","XcodeUtils","ensureGroupRecursively","addResourceFileToGroup","isBuildFile"],"sources":["withGoogleServicesJsonFile.ts"],"sourcesContent":["import {\n withXcodeProject,\n IOSConfig,\n} from '@expo/config-plugins';\nimport type { ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport const withGoogleServicesJsonFile: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (config, cioProps) => {\n return withXcodeProject(config, async (props) => {\n const useFcm = isFcmPushProvider(cioProps);\n if (!useFcm) {\n // Nothing to do, for providers other than FCM, the Google services JSON file isn't needed\n return props;\n }\n\n console.log(\n 'Only specify Customer.io ios.pushNotification.googleServicesFile config if you are not already including' +\n ' GoogleService-Info.plist as part of Firebase integration'\n );\n\n // googleServicesFile\n const iosPath = props.modRequest.platformProjectRoot;\n const googleServicesFile = cioProps.pushNotification?.googleServicesFile;\n const appName = props.modRequest.projectName;\n\n if (FileManagement.exists(`${iosPath}/GoogleService-Info.plist`)) {\n console.log(\n `File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (\n FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)\n ) {\n // This is where RN Firebase potentially copies GoogleService-Info.plist\n // Do not copy if it's already done by Firebase to avoid conflict in Resources\n console.log(\n `File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n if (config.ios?.googleServicesFile) {\n console.warn(\n 'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +\n ' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'\n );\n }\n\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${iosPath}/GoogleService-Info.plist`\n );\n\n addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');\n } catch (e) {\n console.error(\n `There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n } else {\n console.error(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n\n return props;\n });\n};\n\nfunction addFileToXcodeProject(project: any, fileName: string) {\n const groupName = 'Resources';\n const filepath = fileName;\n\n if (!IOSConfig.XcodeUtils.ensureGroupRecursively(project, groupName)) {\n console.error(\n `Error copying GoogleService-Info.plist. Failed to find or create '${groupName}' group in Xcode.`\n );\n return;\n }\n\n // Add GoogleService-Info.plist to the Xcode project\n IOSConfig.XcodeUtils.addResourceFileToGroup({\n project,\n filepath,\n groupName,\n isBuildFile: true,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,0BAEZ,GAAGA,CAACC,MAAM,EAAEC,QAAQ,KAAK;EACxB,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAAA,IAAAC,qBAAA;IAC/C,MAAMC,MAAM,GAAG,IAAAC,wBAAiB,EAACL,QAAQ,CAAC;IAC1C,IAAI,CAACI,MAAM,EAAE;MACX;MACA,OAAOF,KAAK;IACd;IAEAI,OAAO,CAACC,GAAG,CACT,0GAA0G,GACxG,2DACJ,CAAC;;IAED;IACA,MAAMC,OAAO,GAAGN,KAAK,CAACO,UAAU,CAACC,mBAAmB;IACpD,MAAMC,kBAAkB,IAAAR,qBAAA,GAAGH,QAAQ,CAACY,gBAAgB,cAAAT,qBAAA,uBAAzBA,qBAAA,CAA2BQ,kBAAkB;IACxE,MAAME,OAAO,GAAGX,KAAK,CAACO,UAAU,CAACK,WAAW;IAE5C,IAAIC,8BAAc,CAACC,MAAM,CAAC,GAAGR,OAAO,2BAA2B,CAAC,EAAE;MAChEF,OAAO,CAACC,GAAG,CACT,wBAAwBC,OAAO,wCACjC,CAAC;MACD,OAAON,KAAK;IACd;IAEA,IACEa,8BAAc,CAACC,MAAM,CAAC,GAAGR,OAAO,IAAIK,OAAO,2BAA2B,CAAC,EACvE;MACA;MACA;MACAP,OAAO,CAACC,GAAG,CACT,wBAAwBC,OAAO,IAAIK,OAAO,wCAC5C,CAAC;MACD,OAAOX,KAAK;IACd;IAEA,IAAIS,kBAAkB,IAAII,8BAAc,CAACC,MAAM,CAACL,kBAAkB,CAAC,EAAE;MAAA,IAAAM,WAAA;MACnE,KAAAA,WAAA,GAAIlB,MAAM,CAACmB,GAAG,cAAAD,WAAA,eAAVA,WAAA,CAAYN,kBAAkB,EAAE;QAClCL,OAAO,CAACa,IAAI,CACV,0HAA0H,GACxH,uIACJ,CAAC;MACH;MAEA,IAAI;QACFJ,8BAAc,CAACK,QAAQ,CACrBT,kBAAkB,EAClB,GAAGH,OAAO,2BACZ,CAAC;QAEDa,qBAAqB,CAACnB,KAAK,CAACoB,UAAU,EAAE,0BAA0B,CAAC;MACrE,CAAC,CAAC,OAAOC,CAAC,EAAE;QACVjB,OAAO,CAACkB,KAAK,CACX,gGAAgGhB,OAAO,2BACzG,CAAC;MACH;IACF,CAAC,MAAM;MACLF,OAAO,CAACkB,KAAK,CACX,wCAAwCb,kBAAkB,yDAAyDH,OAAO,2BAC5H,CAAC;IACH;IAEA,OAAON,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACuB,OAAA,CAAA3B,0BAAA,GAAAA,0BAAA;AAEF,SAASuB,qBAAqBA,CAACK,OAAY,EAAEC,QAAgB,EAAE;EAC7D,MAAMC,SAAS,GAAG,WAAW;EAC7B,MAAMC,QAAQ,GAAGF,QAAQ;EAEzB,IAAI,CAACG,wBAAS,CAACC,UAAU,CAACC,sBAAsB,CAACN,OAAO,EAAEE,SAAS,CAAC,EAAE;IACpEtB,OAAO,CAACkB,KAAK,CACX,qEAAqEI,SAAS,mBAChF,CAAC;IACD;EACF;;EAEA;EACAE,wBAAS,CAACC,UAAU,CAACE,sBAAsB,CAAC;IAC1CP,OAAO;IACPG,QAAQ;IACRD,SAAS;IACTM,WAAW,EAAE;EACf,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -13,10 +13,11 @@ var _utils = require("./utils");
13
13
  const PLIST_FILENAME = `${_ios.CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
14
14
  const ENV_FILENAME = 'Env.swift';
15
15
  const TARGETED_DEVICE_FAMILY = `"1,2"`;
16
- const addNotificationServiceExtension = async (options, xcodeProject) => {
16
+ const addNotificationServiceExtension = async (options, xcodeProject, isExpoVersion53OrHigher) => {
17
17
  try {
18
18
  var _options$pushNotifica;
19
- if (options.pushNotification) {
19
+ // PushService file is only needed for pre-Expo 53 code generation
20
+ if (options.pushNotification && !isExpoVersion53OrHigher) {
20
21
  await addPushNotificationFile(options, xcodeProject);
21
22
  }
22
23
  if (((_options$pushNotifica = options.pushNotification) === null || _options$pushNotifica === void 0 ? void 0 : _options$pushNotifica.useRichPush) === true) {
@@ -71,7 +72,7 @@ const withCioNotificationsXcodeProject = (configOuter, props) => {
71
72
  useFrameworks,
72
73
  iosDeploymentTarget
73
74
  };
74
- const modifiedProjectFile = await addNotificationServiceExtension(options, config.modResults);
75
+ const modifiedProjectFile = await addNotificationServiceExtension(options, config.modResults, (0, _utils.isExpoVersion53OrHigher)(configOuter));
75
76
  if (modifiedProjectFile) {
76
77
  config.modResults = modifiedProjectFile;
77
78
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","objects","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","env","regionMap","us","eu","mappedRegion","toLowerCase","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n LOCAL_PATH_TO_CIO_NSE_FILES,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\n) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${\n isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\n projObjects['PBXTargetDependency'] || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey\n );\n\n if (region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const mappedRegion = (regionMap as any)[region.toLowerCase()] || '';\n if (!mappedRegion) {\n console.warn(\n `${region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? 'fcm' : 'apn'}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MA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AACG,gBAAgB,cAAAiH,sBAAA,uBAAxBA,sBAAA,CAA0BS,uBAAuB,MAAK,KAAK;EAC7DjC,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,qCAAqC,EACrCiC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAEDnF,8BAAc,CAAC+C,SAAS,CAACC,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpoVersion53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","objects","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","env","regionMap","us","eu","mappedRegion","toLowerCase","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n LOCAL_PATH_TO_CIO_NSE_FILES,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n isExpoVersion53OrHigher: boolean\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpoVersion53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter)\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${\n isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\n projObjects['PBXTargetDependency'] || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey\n );\n\n if (region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const mappedRegion = (regionMap as any)[region.toLowerCase()] || '';\n if (!mappedRegion) {\n console.warn(\n `${region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? 'fcm' : 'apn'}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,EAC1BC,uBAAgC,KAC7B;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,IAAIH,OAAO,CAACI,gBAAgB,IAAI,CAACF,uBAAuB,EAAE;M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K;EAC7DjC,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,qCAAqC,EACrCiC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAEDnF,8BAAc,CAAC+C,SAAS,CAACC,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_utils","_injectCIOPodfileCode","withCioXcodeProject","config","cioProps","withXcodeProject","props","iosPath","modRequest","platformProjectRoot","injectCIOPodfileCode","isFcmPushProvider","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { isFcmPushProvider } from './utils';\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const iosPath = props.modRequest.platformProjectRoot;\n\n await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps));\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAGO,MAAMG,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAC/C,MAAMC,OAAO,GAAGD,KAAK,CAACE,UAAU,CAACC,mBAAmB;IAEpD,MAAM,IAAAC,0CAAoB,EAACH,OAAO,EAAE,IAAAI,wBAAiB,EAACP,QAAQ,CAAC,CAAC;IAEhE,OAAOE,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACM,OAAA,CAAAV,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_configPlugins","require","_utils","_injectCIOPodfileCode","withCioXcodeProject","config","cioProps","withXcodeProject","props","iosPath","modRequest","platformProjectRoot","injectCIOPodfileCode","isFcmPushProvider","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport { isFcmPushProvider } from './utils';\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const iosPath = props.modRequest.platformProjectRoot;\n\n await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps));\n\n return props;\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAGO,MAAMG,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAC/C,MAAMC,OAAO,GAAGD,KAAK,CAACE,UAAU,CAACC,mBAAmB;IAEpD,MAAM,IAAAC,0CAAoB,EAACH,OAAO,EAAE,IAAAI,wBAAiB,EAACP,QAAQ,CAAC,CAAC;IAEhE,OAAOE,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACM,OAAA,CAAAV,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAKxE,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,sBAAsB;AAK1D,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAQ,sBAAsB;AAEvE,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,mBAAmB,EACnB,OAAOC,sBAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLU,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOR,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,sBAAsB;AAEzD,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,mBAAmB,EACnB,OAAOC,sBAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLU,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOR,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC7B,OAAOC,8BAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle } from '@expo/config-plugins';\nimport type { ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,sBAAsB;AAG7D,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC7B,OAAOC,8BAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACL,cAAc,CAACU,MAAM,CAAC,GAAGJ,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIT,cAAc,CAACU,MAAM,CAACD,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFT,cAAc,CAACW,QAAQ,CACrBF,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,OAAOM,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACT,4FAA4FR,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLO,OAAO,CAACC,GAAG,CACT,wCAAwCL,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACT,wBAAwBR,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle } from '@expo/config-plugins';\nimport type { ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,sBAAsB;AAG7D,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACL,cAAc,CAACU,MAAM,CAAC,GAAGJ,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIT,cAAc,CAACU,MAAM,CAACD,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFT,cAAc,CAACW,QAAQ,CACrBF,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,OAAOM,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACT,4FAA4FR,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLO,OAAO,CAACC,GAAG,CACT,wCAAwCL,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACT,wBAAwBR,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,8BAA8B,EAC9B,OAAOC,0BAA0B,EACnC,CAAC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,sBAAsB;AAE7D,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,8BAA8B,EAC9B,OAAOC,0BAA0B,EACnC,CAAC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}