customerio-expo-plugin 3.3.0 → 3.5.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 (107) hide show
  1. package/package.json +8 -1
  2. package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +64 -59
  3. package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
  4. package/plugin/lib/commonjs/android/withAppGoogleServices.js +10 -7
  5. package/plugin/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
  6. package/plugin/lib/commonjs/android/withGoogleServicesJSON.js +18 -21
  7. package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
  8. package/plugin/lib/commonjs/android/withLocationGradleProperties.js +16 -12
  9. package/plugin/lib/commonjs/android/withLocationGradleProperties.js.map +1 -1
  10. package/plugin/lib/commonjs/android/withMainApplicationModifications.js +19 -12
  11. package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -1
  12. package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js +2 -1
  13. package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js.map +1 -1
  14. package/plugin/lib/commonjs/android/withProjectBuildGradle.js +29 -25
  15. package/plugin/lib/commonjs/android/withProjectBuildGradle.js.map +1 -1
  16. package/plugin/lib/commonjs/android/withProjectGoogleServices.js +9 -5
  17. package/plugin/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
  18. package/plugin/lib/commonjs/helpers/constants/ios.js +76 -8
  19. package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -1
  20. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +76 -31
  21. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
  22. package/plugin/lib/commonjs/index.js +7 -0
  23. package/plugin/lib/commonjs/index.js.map +1 -1
  24. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +47 -33
  25. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
  26. package/plugin/lib/commonjs/ios/withCIOIosSwift.js +44 -54
  27. package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
  28. package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +46 -30
  29. package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
  30. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +192 -122
  31. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
  32. package/plugin/lib/commonjs/postInstallHelper.js +58 -11
  33. package/plugin/lib/commonjs/postInstallHelper.js.map +1 -1
  34. package/plugin/lib/commonjs/utils/resolveRNSDK.js +97 -0
  35. package/plugin/lib/commonjs/utils/resolveRNSDK.js.map +1 -0
  36. package/plugin/lib/commonjs/utils/writeExpoVersion.js +56 -0
  37. package/plugin/lib/commonjs/utils/writeExpoVersion.js.map +1 -0
  38. package/plugin/lib/module/android/withAndroidManifestUpdates.js +61 -58
  39. package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
  40. package/plugin/lib/module/android/withAppGoogleServices.js +9 -7
  41. package/plugin/lib/module/android/withAppGoogleServices.js.map +1 -1
  42. package/plugin/lib/module/android/withGoogleServicesJSON.js +17 -21
  43. package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
  44. package/plugin/lib/module/android/withLocationGradleProperties.js +15 -12
  45. package/plugin/lib/module/android/withLocationGradleProperties.js.map +1 -1
  46. package/plugin/lib/module/android/withMainApplicationModifications.js +18 -12
  47. package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -1
  48. package/plugin/lib/module/android/withNotificationChannelMetadata.js +1 -1
  49. package/plugin/lib/module/android/withNotificationChannelMetadata.js.map +1 -1
  50. package/plugin/lib/module/android/withProjectBuildGradle.js +28 -25
  51. package/plugin/lib/module/android/withProjectBuildGradle.js.map +1 -1
  52. package/plugin/lib/module/android/withProjectGoogleServices.js +8 -5
  53. package/plugin/lib/module/android/withProjectGoogleServices.js.map +1 -1
  54. package/plugin/lib/module/helpers/constants/ios.js +75 -8
  55. package/plugin/lib/module/helpers/constants/ios.js.map +1 -1
  56. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +74 -31
  57. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
  58. package/plugin/lib/module/index.js +7 -0
  59. package/plugin/lib/module/index.js.map +1 -1
  60. package/plugin/lib/module/ios/withAppDelegateModifications.js +45 -33
  61. package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
  62. package/plugin/lib/module/ios/withCIOIosSwift.js +42 -54
  63. package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
  64. package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +45 -30
  65. package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
  66. package/plugin/lib/module/ios/withNotificationsXcodeProject.js +187 -122
  67. package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
  68. package/plugin/lib/module/postInstallHelper.js +58 -11
  69. package/plugin/lib/module/postInstallHelper.js.map +1 -1
  70. package/plugin/lib/module/utils/resolveRNSDK.js +88 -0
  71. package/plugin/lib/module/utils/resolveRNSDK.js.map +1 -0
  72. package/plugin/lib/module/utils/writeExpoVersion.js +48 -0
  73. package/plugin/lib/module/utils/writeExpoVersion.js.map +1 -0
  74. package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +2 -0
  75. package/plugin/lib/typescript/android/withAppGoogleServices.d.ts +1 -0
  76. package/plugin/lib/typescript/android/withGoogleServicesJSON.d.ts +1 -0
  77. package/plugin/lib/typescript/android/withLocationGradleProperties.d.ts +2 -0
  78. package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +6 -0
  79. package/plugin/lib/typescript/android/withNotificationChannelMetadata.d.ts +5 -0
  80. package/plugin/lib/typescript/android/withProjectBuildGradle.d.ts +9 -0
  81. package/plugin/lib/typescript/android/withProjectGoogleServices.d.ts +1 -0
  82. package/plugin/lib/typescript/helpers/constants/ios.d.ts +18 -0
  83. package/plugin/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +25 -1
  84. package/plugin/lib/typescript/ios/withAppDelegateModifications.d.ts +13 -0
  85. package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +11 -0
  86. package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +14 -1
  87. package/plugin/lib/typescript/ios/withNotificationsXcodeProject.d.ts +53 -2
  88. package/plugin/lib/typescript/utils/resolveRNSDK.d.ts +7 -0
  89. package/plugin/lib/typescript/utils/writeExpoVersion.d.ts +3 -0
  90. package/plugin/src/android/withAndroidManifestUpdates.ts +83 -73
  91. package/plugin/src/android/withAppGoogleServices.ts +13 -11
  92. package/plugin/src/android/withGoogleServicesJSON.ts +30 -28
  93. package/plugin/src/android/withLocationGradleProperties.ts +23 -17
  94. package/plugin/src/android/withMainApplicationModifications.ts +25 -15
  95. package/plugin/src/android/withNotificationChannelMetadata.ts +1 -1
  96. package/plugin/src/android/withProjectBuildGradle.ts +37 -27
  97. package/plugin/src/android/withProjectGoogleServices.ts +14 -9
  98. package/plugin/src/helpers/constants/ios.ts +87 -8
  99. package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +97 -50
  100. package/plugin/src/index.ts +7 -0
  101. package/plugin/src/ios/withAppDelegateModifications.ts +61 -48
  102. package/plugin/src/ios/withCIOIosSwift.ts +58 -62
  103. package/plugin/src/ios/withGoogleServicesJsonFile.ts +66 -48
  104. package/plugin/src/ios/withNotificationsXcodeProject.ts +257 -207
  105. package/plugin/src/postInstallHelper.js +75 -17
  106. package/plugin/src/utils/resolveRNSDK.ts +118 -0
  107. package/plugin/src/utils/writeExpoVersion.ts +62 -0
@@ -3,6 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addNotificationServiceExtensionToXcodeProject = addNotificationServiceExtensionToXcodeProject;
7
+ exports.applyAppGroupIdToNotificationService = applyAppGroupIdToNotificationService;
8
+ exports.applyBundleVersionToNsePlist = applyBundleVersionToNsePlist;
9
+ exports.applyConfigToPushFile = applyConfigToPushFile;
10
+ exports.applyRichPushConfigToEnv = applyRichPushConfigToEnv;
6
11
  exports.withCioNotificationsXcodeProject = void 0;
7
12
  var _configPlugins = require("@expo/config-plugins");
8
13
  var _ios = require("../helpers/constants/ios");
@@ -15,6 +20,16 @@ var _fileManagement = require("./../helpers/utils/fileManagement");
15
20
  var _utils = require("./utils");
16
21
  const PLIST_FILENAME = `${_ios.CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
17
22
  const ENV_FILENAME = 'Env.swift';
23
+
24
+ // NSE source files registered in the Xcode group AND copied to the target
25
+ // directory. Single source of truth — both `addNotificationServiceExtensionToXcodeProject`
26
+ // (registers them in the PBXGroup) and `addRichPushXcodeProj` (copies them
27
+ // from the plugin's native-files dir) read the same arrays. Keeping these
28
+ // in sync is load-bearing: the Xcode group must reference the same files
29
+ // that exist on disk, or the build fails with "no such file" / unresolved
30
+ // references.
31
+ const NSE_PLATFORM_SPECIFIC_FILES = ['NotificationService.swift'];
32
+ const NSE_COMMON_FILES = [PLIST_FILENAME, 'NotificationService.h', 'NotificationService.m', ENV_FILENAME];
18
33
  const TARGETED_DEVICE_FAMILY = `"1,2"`;
19
34
  const addNotificationServiceExtension = async (options, xcodeProject, isExpo53OrHigher) => {
20
35
  try {
@@ -83,76 +98,35 @@ const withCioNotificationsXcodeProject = (configOuter, props) => {
83
98
  });
84
99
  };
85
100
  exports.withCioNotificationsXcodeProject = withCioNotificationsXcodeProject;
86
- const addRichPushXcodeProj = async (options, xcodeProject) => {
87
- var _options$pushNotifica2, _options$pushNotifica3, _options$pushNotifica4;
101
+ const NSE_ENTITLEMENTS_FILENAME = 'NotificationService.entitlements';
102
+ /**
103
+ * Mutates the parsed XcodeProject to register the rich-push NotificationService
104
+ * extension target: creates a PBXGroup for its files, registers the group under
105
+ * the project's top-level group, adds the app_extension target, wires three
106
+ * build phases (Sources, Resources, Frameworks), configures the target's build
107
+ * settings (DEVELOPMENT_TEAM, IPHONEOS_DEPLOYMENT_TARGET, code-sign style,
108
+ * Swift version, and CODE_SIGN_ENTITLEMENTS when `appGroupId` is set), and
109
+ * stamps the development team attribute on both the new target and the
110
+ * project's main target attributes.
111
+ *
112
+ * Idempotent — returns the project unchanged if a target named
113
+ * `CIO_NOTIFICATION_TARGET_NAME` is already present.
114
+ */
115
+ function addNotificationServiceExtensionToXcodeProject(xcodeProject, options) {
116
+ if (xcodeProject.pbxTargetByName(_ios.CIO_NOTIFICATION_TARGET_NAME)) {
117
+ _logger.logger.warn(`${_ios.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
118
+ return xcodeProject;
119
+ }
88
120
  const {
89
121
  appleTeamId,
90
122
  bundleIdentifier,
91
- bundleShortVersion,
92
- bundleVersion,
93
- iosPath,
94
123
  iosDeploymentTarget,
95
- useFrameworks
124
+ appGroupId
96
125
  } = options;
97
- const isFcmProvider = (0, _utils.isFcmPushProvider)(options);
98
- await (0, _injectCIOPodfileCode.injectCIONotificationPodfileCode)(iosPath, useFrameworks, isFcmProvider);
99
-
100
- // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project
101
- // If true then skip creating a new group to avoid duplicate folders
102
- if (xcodeProject.pbxTargetByName(_ios.CIO_NOTIFICATION_TARGET_NAME)) {
103
- _logger.logger.warn(`${_ios.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
104
- return;
105
- }
106
- const nsePath = `${iosPath}/${_ios.CIO_NOTIFICATION_TARGET_NAME}`;
107
- _fileManagement.FileManagement.mkdir(nsePath, {
108
- recursive: true
109
- });
110
- const platformSpecificFiles = ['NotificationService.swift'];
111
- const nseEntitlementsFilename = 'NotificationService.entitlements';
112
- const appGroupId = (_options$pushNotifica2 = options.pushNotification) === null || _options$pushNotifica2 === void 0 ? void 0 : _options$pushNotifica2.appGroupId;
113
-
114
- // Write NSE entitlements file only when appGroupId is explicitly configured
115
- if (appGroupId) {
116
- const nseEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
117
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
118
- <plist version="1.0">
119
- <dict>
120
- <key>com.apple.security.application-groups</key>
121
- <array>
122
- <string>${appGroupId}</string>
123
- </array>
124
- </dict>
125
- </plist>
126
- `;
127
- _fileManagement.FileManagement.writeFile(`${nsePath}/${nseEntitlementsFilename}`, nseEntitlementsContent);
128
- }
129
- const commonFiles = [PLIST_FILENAME, 'NotificationService.h', 'NotificationService.m', ENV_FILENAME];
130
- const getTargetFile = filename => `${nsePath}/${filename}`;
131
- // Copy platform-specific files
132
- platformSpecificFiles.forEach(filename => {
133
- const targetFile = getTargetFile(filename);
134
- _fileManagement.FileManagement.copyFile(`${(0, _plugin.getIosNativeFilesPath)()}/${isFcmProvider ? 'fcm' : 'apn'}/${filename}`, targetFile);
135
- });
136
-
137
- // Copy common files
138
- commonFiles.forEach(filename => {
139
- const targetFile = getTargetFile(filename);
140
- _fileManagement.FileManagement.copyFile(`${(0, _plugin.getIosNativeFilesPath)()}/common/${filename}`, targetFile);
141
- });
142
-
143
- /* MODIFY COPIED EXTENSION FILES */
144
- const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);
145
- updateNseInfoPlist({
146
- bundleVersion,
147
- bundleShortVersion,
148
- infoPlistTargetFile
149
- });
150
- updateNseEnv(getTargetFile(ENV_FILENAME), (_options$pushNotifica3 = options.pushNotification) === null || _options$pushNotifica3 === void 0 ? void 0 : _options$pushNotifica3.env);
151
- updateNseNotificationService(getTargetFile('NotificationService.swift'), (_options$pushNotifica4 = options.pushNotification) === null || _options$pushNotifica4 === void 0 ? void 0 : _options$pushNotifica4.appGroupId);
152
126
 
153
127
  // The entitlements file is generated (not copied from source), so it's listed separately
154
- // for the Xcode group so it appears in the file navigator
155
- const allGroupFiles = [...platformSpecificFiles, ...commonFiles, ...(appGroupId ? [nseEntitlementsFilename] : [])];
128
+ // for the Xcode group so it appears in the file navigator.
129
+ const allGroupFiles = [...NSE_PLATFORM_SPECIFIC_FILES, ...NSE_COMMON_FILES, ...(appGroupId ? [NSE_ENTITLEMENTS_FILENAME] : [])];
156
130
 
157
131
  // Create new PBXGroup for the extension
158
132
  const extGroup = xcodeProject.addPbxGroup(allGroupFiles, _ios.CIO_NOTIFICATION_TARGET_NAME, _ios.CIO_NOTIFICATION_TARGET_NAME);
@@ -173,13 +147,8 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
173
147
  const projObjects = xcodeProject.hash.project.objects;
174
148
  projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};
175
149
  projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};
176
- if (xcodeProject.pbxTargetByName(_ios.CIO_NOTIFICATION_TARGET_NAME)) {
177
- _logger.logger.warn(`${_ios.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
178
- return;
179
- }
180
150
 
181
- // Add the NSE target
182
- // This also adds PBXTargetDependency and PBXContainerItemProxy
151
+ // Add the NSE target. This also adds PBXTargetDependency and PBXContainerItemProxy.
183
152
  const nseTarget = xcodeProject.addTarget(_ios.CIO_NOTIFICATION_TARGET_NAME, 'app_extension', _ios.CIO_NOTIFICATION_TARGET_NAME, `${bundleIdentifier}.richpush`);
184
153
 
185
154
  // Add build phases to the new target
@@ -198,7 +167,7 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
198
167
  buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
199
168
  buildSettingsObj.SWIFT_VERSION = 4.2;
200
169
  if (appGroupId) {
201
- buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${_ios.CIO_NOTIFICATION_TARGET_NAME}/${nseEntitlementsFilename}`;
170
+ buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${_ios.CIO_NOTIFICATION_TARGET_NAME}/${NSE_ENTITLEMENTS_FILENAME}`;
202
171
  }
203
172
  }
204
173
  }
@@ -206,40 +175,124 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
206
175
  // Add development team to the target & the main
207
176
  xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);
208
177
  xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);
178
+ return xcodeProject;
179
+ }
180
+ const addRichPushXcodeProj = async (options, xcodeProject) => {
181
+ var _options$pushNotifica2, _options$pushNotifica3;
182
+ const {
183
+ appleTeamId,
184
+ bundleIdentifier,
185
+ bundleShortVersion,
186
+ bundleVersion,
187
+ iosPath,
188
+ iosDeploymentTarget,
189
+ useFrameworks
190
+ } = options;
191
+ const isFcmProvider = (0, _utils.isFcmPushProvider)(options);
192
+ const appGroupId = (_options$pushNotifica2 = options.pushNotification) === null || _options$pushNotifica2 === void 0 ? void 0 : _options$pushNotifica2.appGroupId;
193
+ await (0, _injectCIOPodfileCode.injectCIONotificationPodfileCode)(iosPath, useFrameworks, isFcmProvider);
194
+
195
+ // Skip the rest of the work if the NSE target is already in place. The pbxproj-mutating
196
+ // helper has its own idempotency check, but bailing out here also avoids redundant file
197
+ // copies and entitlements writes when prebuild re-runs against an already-prepared project.
198
+ if (xcodeProject.pbxTargetByName(_ios.CIO_NOTIFICATION_TARGET_NAME)) {
199
+ _logger.logger.warn(`${_ios.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
200
+ return;
201
+ }
202
+ const nsePath = `${iosPath}/${_ios.CIO_NOTIFICATION_TARGET_NAME}`;
203
+ _fileManagement.FileManagement.mkdir(nsePath, {
204
+ recursive: true
205
+ });
206
+
207
+ // Write NSE entitlements file only when appGroupId is explicitly configured
208
+ if (appGroupId) {
209
+ const nseEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
210
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
211
+ <plist version="1.0">
212
+ <dict>
213
+ <key>com.apple.security.application-groups</key>
214
+ <array>
215
+ <string>${appGroupId}</string>
216
+ </array>
217
+ </dict>
218
+ </plist>
219
+ `;
220
+ _fileManagement.FileManagement.writeFile(`${nsePath}/${NSE_ENTITLEMENTS_FILENAME}`, nseEntitlementsContent);
221
+ }
222
+ const getTargetFile = filename => `${nsePath}/${filename}`;
223
+
224
+ // Copy platform-specific files
225
+ NSE_PLATFORM_SPECIFIC_FILES.forEach(filename => {
226
+ _fileManagement.FileManagement.copyFile(`${(0, _plugin.getIosNativeFilesPath)()}/${isFcmProvider ? 'fcm' : 'apn'}/${filename}`, getTargetFile(filename));
227
+ });
228
+
229
+ // Copy common files
230
+ NSE_COMMON_FILES.forEach(filename => {
231
+ _fileManagement.FileManagement.copyFile(`${(0, _plugin.getIosNativeFilesPath)()}/common/${filename}`, getTargetFile(filename));
232
+ });
233
+
234
+ /* MODIFY COPIED EXTENSION FILES */
235
+ updateNseInfoPlist({
236
+ bundleVersion,
237
+ bundleShortVersion,
238
+ infoPlistTargetFile: getTargetFile(PLIST_FILENAME)
239
+ });
240
+ updateNseEnv(getTargetFile(ENV_FILENAME), (_options$pushNotifica3 = options.pushNotification) === null || _options$pushNotifica3 === void 0 ? void 0 : _options$pushNotifica3.env);
241
+ updateNseNotificationService(getTargetFile('NotificationService.swift'), appGroupId);
242
+
243
+ // Register the NSE target in the parsed Xcode project
244
+ addNotificationServiceExtensionToXcodeProject(xcodeProject, {
245
+ appleTeamId,
246
+ bundleIdentifier,
247
+ iosDeploymentTarget,
248
+ appGroupId
249
+ });
209
250
  };
210
- const updateNseInfoPlist = payload => {
211
- const BUNDLE_SHORT_VERSION_RE = /\{\{BUNDLE_SHORT_VERSION\}\}/;
212
- const BUNDLE_VERSION_RE = /\{\{BUNDLE_VERSION\}\}/;
213
- let plistFileString = _fileManagement.FileManagement.readFile(payload.infoPlistTargetFile);
251
+
252
+ /**
253
+ * Pure string transform: substitutes the `{{BUNDLE_VERSION}}` and
254
+ * `{{BUNDLE_SHORT_VERSION}}` placeholders in the NSE Info.plist template.
255
+ * Either or both may be provided; missing values leave the corresponding
256
+ * placeholder untouched.
257
+ */
258
+ function applyBundleVersionToNsePlist(content, payload) {
259
+ let next = content;
214
260
  if (payload.bundleVersion) {
215
- plistFileString = (0, _codeInjection.replaceCodeByRegex)(plistFileString, BUNDLE_VERSION_RE, payload.bundleVersion);
261
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{BUNDLE_VERSION\}\}/, payload.bundleVersion);
216
262
  }
217
263
  if (payload.bundleShortVersion) {
218
- plistFileString = (0, _codeInjection.replaceCodeByRegex)(plistFileString, BUNDLE_SHORT_VERSION_RE, payload.bundleShortVersion);
264
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{BUNDLE_SHORT_VERSION\}\}/, payload.bundleShortVersion);
219
265
  }
220
- _fileManagement.FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);
266
+ return next;
267
+ }
268
+ const updateNseInfoPlist = payload => {
269
+ const next = applyBundleVersionToNsePlist(_fileManagement.FileManagement.readFile(payload.infoPlistTargetFile), payload);
270
+ _fileManagement.FileManagement.writeFile(payload.infoPlistTargetFile, next);
221
271
  };
222
- const updateNseNotificationService = (notificationServiceFile, appGroupId) => {
223
- const APP_GROUP_ID_BUILDER_LINE_RE = /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/;
224
- let content = _fileManagement.FileManagement.readFile(notificationServiceFile);
272
+
273
+ /**
274
+ * Pure string transform: substitutes the `{{APP_GROUP_ID_BUILDER_LINE}}`
275
+ * placeholder in NotificationService.swift with either the configured
276
+ * appGroupId builder line or an empty string.
277
+ */
278
+ function applyAppGroupIdToNotificationService(content, appGroupId) {
225
279
  const builderLine = appGroupId ? ` .appGroupId(${JSON.stringify(appGroupId)})\n` : '';
226
- content = (0, _codeInjection.replaceCodeByRegex)(content, APP_GROUP_ID_BUILDER_LINE_RE, builderLine);
227
- _fileManagement.FileManagement.writeFile(notificationServiceFile, content);
280
+ return (0, _codeInjection.replaceCodeByRegex)(content, /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/, builderLine);
281
+ }
282
+ const updateNseNotificationService = (notificationServiceFile, appGroupId) => {
283
+ const next = applyAppGroupIdToNotificationService(_fileManagement.FileManagement.readFile(notificationServiceFile), appGroupId);
284
+ _fileManagement.FileManagement.writeFile(notificationServiceFile, next);
228
285
  };
229
- const updateNseEnv = (envFileName, richPushConfig) => {
230
- const CDP_API_KEY_RE = /\{\{CDP_API_KEY\}\}/;
231
- const REGION_RE = /\{\{REGION\}\}/;
232
- let envFileContent = _fileManagement.FileManagement.readFile(envFileName);
233
286
 
234
- // Use merged config values (config takes precedence over env)
287
+ /**
288
+ * Pure string transform: substitutes the `{{CDP_API_KEY}}` and `{{REGION}}`
289
+ * placeholders in the NSE Env.swift template. Missing or invalid region
290
+ * falls back to `Region.US` and logs a warning.
291
+ */
292
+ function applyRichPushConfigToEnv(content, richPushConfig) {
235
293
  const cdpApiKey = richPushConfig === null || richPushConfig === void 0 ? void 0 : richPushConfig.cdpApiKey;
236
294
  const region = richPushConfig === null || richPushConfig === void 0 ? void 0 : richPushConfig.region;
237
- if (!(0, _validation.validateRichPushConfig)(richPushConfig)) {
238
- return;
239
- }
240
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, CDP_API_KEY_RE, cdpApiKey || 'MISSING_API_KEY');
241
-
242
- // Simplify region mapping with case insensitive keys and fallback for invalid regions
295
+ let next = (0, _codeInjection.replaceCodeByRegex)(content, /\{\{CDP_API_KEY\}\}/, cdpApiKey || 'MISSING_API_KEY');
243
296
  const regionKey = (region === null || region === void 0 ? void 0 : region.toLowerCase()) ?? '';
244
297
  const regionMap = {
245
298
  us: 'Region.US',
@@ -248,12 +301,18 @@ const updateNseEnv = (envFileName, richPushConfig) => {
248
301
  const mappedRegion = regionMap[regionKey];
249
302
  if (!mappedRegion) {
250
303
  _logger.logger.warn(`${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`);
251
- // Fallback to US if invalid region provided
252
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, REGION_RE, regionMap.us);
304
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{REGION\}\}/, regionMap.us);
253
305
  } else {
254
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, REGION_RE, mappedRegion);
306
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{REGION\}\}/, mappedRegion);
255
307
  }
256
- _fileManagement.FileManagement.writeFile(envFileName, envFileContent);
308
+ return next;
309
+ }
310
+ const updateNseEnv = (envFileName, richPushConfig) => {
311
+ if (!(0, _validation.validateRichPushConfig)(richPushConfig)) {
312
+ return;
313
+ }
314
+ const next = applyRichPushConfigToEnv(_fileManagement.FileManagement.readFile(envFileName), richPushConfig);
315
+ _fileManagement.FileManagement.writeFile(envFileName, next);
257
316
  };
258
317
  async function addPushNotificationFile(options, xcodeProject) {
259
318
  // Maybe copy a different file with FCM config based on config
@@ -288,12 +347,18 @@ async function addPushNotificationFile(options, xcodeProject) {
288
347
  xcodeProject.addToPbxGroup(group, classesKey);
289
348
  xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);
290
349
  }
291
- const updatePushFile = (options, envFileName) => {
292
- var _options$pushNotifica5, _options$pushNotifica6, _options$pushNotifica7, _options$pushNotifica8, _options$pushNotifica9, _options$pushNotifica0;
293
- const REGISTER_RE = /\{\{REGISTER_SNIPPET\}\}/;
294
- let envFileContent = _fileManagement.FileManagement.readFile(envFileName);
295
- const disableNotificationRegistration = (_options$pushNotifica5 = options.pushNotification) === null || _options$pushNotifica5 === void 0 ? void 0 : _options$pushNotifica5.disableNotificationRegistration;
296
- const richPushConfig = (_options$pushNotifica6 = options.pushNotification) === null || _options$pushNotifica6 === void 0 ? void 0 : _options$pushNotifica6.env;
350
+
351
+ /**
352
+ * Pure string transform: substitutes every PushService.swift placeholder
353
+ * (`{{REGISTER_SNIPPET}}`, `{{CDP_API_KEY}}`, `{{REGION}}`,
354
+ * `{{AUTO_TRACK_PUSH_EVENTS}}`, `{{AUTO_FETCH_DEVICE_TOKEN}}`,
355
+ * `{{SHOW_PUSH_APP_IN_FOREGROUND}}`, `{{APP_GROUP_ID_BUILDER_LINE}}`) using
356
+ * the configured push-notification options. Validation of the rich-push
357
+ * config (cdpApiKey/region required) is the wrapper's responsibility.
358
+ */
359
+ function applyConfigToPushFile(content, options) {
360
+ var _options$pushNotifica4, _options$pushNotifica5, _options$pushNotifica6, _options$pushNotifica7, _options$pushNotifica8, _options$pushNotifica9;
361
+ const richPushConfig = (_options$pushNotifica4 = options.pushNotification) === null || _options$pushNotifica4 === void 0 ? void 0 : _options$pushNotifica4.env;
297
362
  const {
298
363
  cdpApiKey,
299
364
  region
@@ -301,29 +366,34 @@ const updatePushFile = (options, envFileName) => {
301
366
  cdpApiKey: 'MISSING_API_KEY',
302
367
  region: undefined
303
368
  };
304
- if (!(0, _validation.validateRichPushConfig)(richPushConfig)) {
305
- return;
306
- }
307
- let snippet = '';
369
+ const disableNotificationRegistration = (_options$pushNotifica5 = options.pushNotification) === null || _options$pushNotifica5 === void 0 ? void 0 : _options$pushNotifica5.disableNotificationRegistration;
370
+
308
371
  // unless this property is explicitly set to true, push notification
309
372
  // registration will be added to the AppDelegate
310
- if (disableNotificationRegistration !== true) {
311
- snippet = _ios.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;
312
- }
313
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, REGISTER_RE, snippet);
314
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{CDP_API_KEY\}\}/, cdpApiKey);
373
+ const registerSnippet = disableNotificationRegistration !== true ? _ios.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET : '';
374
+ let next = (0, _codeInjection.replaceCodeByRegex)(content, /\{\{REGISTER_SNIPPET\}\}/, registerSnippet);
375
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{CDP_API_KEY\}\}/, cdpApiKey);
315
376
  if (region) {
316
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{REGION\}\}/, region.toUpperCase());
377
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{REGION\}\}/, region.toUpperCase());
317
378
  }
318
- const autoTrackPushEvents = ((_options$pushNotifica7 = options.pushNotification) === null || _options$pushNotifica7 === void 0 ? void 0 : _options$pushNotifica7.autoTrackPushEvents) !== false;
319
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/, autoTrackPushEvents.toString());
320
- const autoFetchDeviceToken = ((_options$pushNotifica8 = options.pushNotification) === null || _options$pushNotifica8 === void 0 ? void 0 : _options$pushNotifica8.autoFetchDeviceToken) !== false;
321
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
322
- const showPushAppInForeground = ((_options$pushNotifica9 = options.pushNotification) === null || _options$pushNotifica9 === void 0 ? void 0 : _options$pushNotifica9.showPushAppInForeground) !== false;
323
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
324
- const appGroupId = (_options$pushNotifica0 = options.pushNotification) === null || _options$pushNotifica0 === void 0 ? void 0 : _options$pushNotifica0.appGroupId;
379
+ const autoTrackPushEvents = ((_options$pushNotifica6 = options.pushNotification) === null || _options$pushNotifica6 === void 0 ? void 0 : _options$pushNotifica6.autoTrackPushEvents) !== false;
380
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/, autoTrackPushEvents.toString());
381
+ const autoFetchDeviceToken = ((_options$pushNotifica7 = options.pushNotification) === null || _options$pushNotifica7 === void 0 ? void 0 : _options$pushNotifica7.autoFetchDeviceToken) !== false;
382
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
383
+ const showPushAppInForeground = ((_options$pushNotifica8 = options.pushNotification) === null || _options$pushNotifica8 === void 0 ? void 0 : _options$pushNotifica8.showPushAppInForeground) !== false;
384
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
385
+ const appGroupId = (_options$pushNotifica9 = options.pushNotification) === null || _options$pushNotifica9 === void 0 ? void 0 : _options$pushNotifica9.appGroupId;
325
386
  const appGroupIdBuilderLine = appGroupId ? ` .appGroupId(${JSON.stringify(appGroupId)})\n` : '';
326
- envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/, appGroupIdBuilderLine);
327
- _fileManagement.FileManagement.writeFile(envFileName, envFileContent);
387
+ next = (0, _codeInjection.replaceCodeByRegex)(next, /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/, appGroupIdBuilderLine);
388
+ return next;
389
+ }
390
+ const updatePushFile = (options, envFileName) => {
391
+ var _options$pushNotifica0;
392
+ const richPushConfig = (_options$pushNotifica0 = options.pushNotification) === null || _options$pushNotifica0 === void 0 ? void 0 : _options$pushNotifica0.env;
393
+ if (!(0, _validation.validateRichPushConfig)(richPushConfig)) {
394
+ return;
395
+ }
396
+ const next = applyConfigToPushFile(_fileManagement.FileManagement.readFile(envFileName), options);
397
+ _fileManagement.FileManagement.writeFile(envFileName, next);
328
398
  };
329
399
  //# sourceMappingURL=withNotificationsXcodeProject.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_logger","_plugin","_validation","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","logger","String","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","isExpoVersion53OrHigher","exports","_options$pushNotifica2","_options$pushNotifica3","_options$pushNotifica4","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","nseEntitlementsFilename","appGroupId","nseEntitlementsContent","writeFile","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","getIosNativeFilesPath","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","env","updateNseNotificationService","allGroupFiles","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","CODE_SIGN_ENTITLEMENTS","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","replaceCodeByRegex","notificationServiceFile","APP_GROUP_ID_BUILDER_LINE_RE","content","builderLine","JSON","stringify","envFileName","richPushConfig","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","validateRichPushConfig","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","sourceFile","targetFileName","appPath","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","_options$pushNotifica8","_options$pushNotifica9","_options$pushNotifica0","REGISTER_RE","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","appGroupIdBuilderLine"],"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} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\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 isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\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: unknown) {\n logger.error(String(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: XcodeProject,\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 logger.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 nseEntitlementsFilename = 'NotificationService.entitlements';\n const appGroupId = options.pushNotification?.appGroupId;\n\n // Write NSE entitlements file only when appGroupId is explicitly configured\n if (appGroupId) {\n const nseEntitlementsContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>com.apple.security.application-groups</key>\n <array>\n <string>${appGroupId}</string>\n </array>\n</dict>\n</plist>\n`;\n FileManagement.writeFile(`${nsePath}/${nseEntitlementsFilename}`, nseEntitlementsContent);\n }\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 `${getIosNativeFilesPath()}/${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 `${getIosNativeFilesPath()}/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(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\n updateNseNotificationService(getTargetFile('NotificationService.swift'), options.pushNotification?.appGroupId);\n\n // The entitlements file is generated (not copied from source), so it's listed separately\n // for the Xcode group so it appears in the file navigator\n const allGroupFiles = [\n ...platformSpecificFiles,\n ...commonFiles,\n ...(appGroupId ? [nseEntitlementsFilename] : []),\n ];\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n allGroupFiles,\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 = projObjects.PBXTargetDependency || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.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 if (appGroupId) {\n buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${CIO_NOTIFICATION_TARGET_NAME}/${nseEntitlementsFilename}`;\n }\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 updateNseNotificationService = (\n notificationServiceFile: string,\n appGroupId?: string,\n) => {\n const APP_GROUP_ID_BUILDER_LINE_RE = /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/;\n\n let content = FileManagement.readFile(notificationServiceFile);\n const builderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n content = replaceCodeByRegex(content, APP_GROUP_ID_BUILDER_LINE_RE, builderLine);\n FileManagement.writeFile(notificationServiceFile, content);\n};\n\nconst updateNseEnv = (\n envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n // Use merged config values (config takes precedence over env)\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n // Simplify region mapping with case insensitive keys and fallback for invalid regions\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n // Fallback to US if invalid region provided\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, regionMap.us);\n } else {\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, mappedRegion);\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\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 `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${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 richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n\n let snippet = '';\n // unless this property is explicitly 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 const appGroupId = options.pushNotification?.appGroupId;\n const appGroupIdBuilderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/,\n appGroupIdBuilderLine\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAEA,MAAMS,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,gBAAyB,KACtB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,IAAIH,OAAO,CAACI,gBAAgB,IAAI,CAACF,gBAAgB,EAAE;MACjD,MAAMG,uBAAuB,CAACL,OAAO,EAAEC,YAAY,CAAC;IACtD;IAEA,IAAI,EAAAE,qB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AAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B,EAAAV,sBAAA,GAAA3I,OAAO,CAACI,gBAAgB,cAAAuI,sBAAA,uBAAxBA,sBAAA,CAA0BU,uBAAuB,MAAK,KAAK;EAC7DnC,cAAc,GAAG,IAAAX,iCAAkB,EACjCW,cAAc,EACd,qCAAqC,EACrCmC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED,MAAMhG,UAAU,IAAAyF,sBAAA,GAAG5I,OAAO,CAACI,gBAAgB,cAAAwI,sBAAA,uBAAxBA,sBAAA,CAA0BzF,UAAU;EACvD,MAAMmG,qBAAqB,GAAGnG,UAAU,GACpC,uBAAuByD,IAAI,CAACC,SAAS,CAAC1D,UAAU,CAAC,KAAK,GACtD,EAAE;EACN+D,cAAc,GAAG,IAAAX,iCAAkB,EACjCW,cAAc,EACd,mCAAmC,EACnCoC,qBACF,CAAC;EAEDxG,8BAAc,CAACO,SAAS,CAACyD,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_logger","_plugin","_validation","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","NSE_PLATFORM_SPECIFIC_FILES","NSE_COMMON_FILES","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","logger","String","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","isExpoVersion53OrHigher","exports","NSE_ENTITLEMENTS_FILENAME","addNotificationServiceExtensionToXcodeProject","pbxTargetByName","warn","appGroupId","allGroupFiles","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","forEach","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","CODE_SIGN_ENTITLEMENTS","addTargetAttribute","_options$pushNotifica2","_options$pushNotifica3","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","nsePath","FileManagement","mkdir","recursive","nseEntitlementsContent","writeFile","getTargetFile","filename","copyFile","getIosNativeFilesPath","updateNseInfoPlist","infoPlistTargetFile","updateNseEnv","env","updateNseNotificationService","applyBundleVersionToNsePlist","content","payload","next","replaceCodeByRegex","readFile","applyAppGroupIdToNotificationService","builderLine","JSON","stringify","notificationServiceFile","applyRichPushConfigToEnv","richPushConfig","cdpApiKey","region","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","envFileName","validateRichPushConfig","sourceFile","targetFileName","appPath","targetFile","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","applyConfigToPushFile","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","_options$pushNotifica8","_options$pushNotifica9","disableNotificationRegistration","registerSnippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","appGroupIdBuilderLine","_options$pushNotifica0"],"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} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\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\n// NSE source files registered in the Xcode group AND copied to the target\n// directory. Single source of truth — both `addNotificationServiceExtensionToXcodeProject`\n// (registers them in the PBXGroup) and `addRichPushXcodeProj` (copies them\n// from the plugin's native-files dir) read the same arrays. Keeping these\n// in sync is load-bearing: the Xcode group must reference the same files\n// that exist on disk, or the build fails with \"no such file\" / unresolved\n// references.\nconst NSE_PLATFORM_SPECIFIC_FILES = ['NotificationService.swift'];\nconst NSE_COMMON_FILES = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n];\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\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: unknown) {\n logger.error(String(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 NSE_ENTITLEMENTS_FILENAME = 'NotificationService.entitlements';\n\nexport type AddNseTargetToXcodeProjectOptions = {\n appleTeamId?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appGroupId?: string;\n};\n\n/**\n * Mutates the parsed XcodeProject to register the rich-push NotificationService\n * extension target: creates a PBXGroup for its files, registers the group under\n * the project's top-level group, adds the app_extension target, wires three\n * build phases (Sources, Resources, Frameworks), configures the target's build\n * settings (DEVELOPMENT_TEAM, IPHONEOS_DEPLOYMENT_TARGET, code-sign style,\n * Swift version, and CODE_SIGN_ENTITLEMENTS when `appGroupId` is set), and\n * stamps the development team attribute on both the new target and the\n * project's main target attributes.\n *\n * Idempotent — returns the project unchanged if a target named\n * `CIO_NOTIFICATION_TARGET_NAME` is already present.\n */\nexport function addNotificationServiceExtensionToXcodeProject(\n xcodeProject: XcodeProject,\n options: AddNseTargetToXcodeProjectOptions,\n): XcodeProject {\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`,\n );\n return xcodeProject;\n }\n\n const { appleTeamId, bundleIdentifier, iosDeploymentTarget, appGroupId } = options;\n\n // The entitlements file is generated (not copied from source), so it's listed separately\n // for the Xcode group so it appears in the file navigator.\n const allGroupFiles = [\n ...NSE_PLATFORM_SPECIFIC_FILES,\n ...NSE_COMMON_FILES,\n ...(appGroupId ? [NSE_ENTITLEMENTS_FILENAME] : []),\n ];\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n allGroupFiles,\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 = projObjects.PBXTargetDependency || {};\n\n // Add the NSE target. 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([], 'PBXResourcesBuildPhase', 'Resources', nseTarget.uuid);\n xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', nseTarget.uuid);\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 = iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n if (appGroupId) {\n buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${CIO_NOTIFICATION_TARGET_NAME}/${NSE_ENTITLEMENTS_FILENAME}`;\n }\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 return xcodeProject;\n}\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\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 const appGroupId = options.pushNotification?.appGroupId;\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Skip the rest of the work if the NSE target is already in place. The pbxproj-mutating\n // helper has its own idempotency check, but bailing out here also avoids redundant file\n // copies and entitlements writes when prebuild re-runs against an already-prepared project.\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.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, { recursive: true });\n\n // Write NSE entitlements file only when appGroupId is explicitly configured\n if (appGroupId) {\n const nseEntitlementsContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>com.apple.security.application-groups</key>\n <array>\n <string>${appGroupId}</string>\n </array>\n</dict>\n</plist>\n`;\n FileManagement.writeFile(`${nsePath}/${NSE_ENTITLEMENTS_FILENAME}`, nseEntitlementsContent);\n }\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n // Copy platform-specific files\n NSE_PLATFORM_SPECIFIC_FILES.forEach((filename) => {\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/${isFcmProvider ? 'fcm' : 'apn'}/${filename}`,\n getTargetFile(filename),\n );\n });\n\n // Copy common files\n NSE_COMMON_FILES.forEach((filename) => {\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/common/${filename}`,\n getTargetFile(filename),\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile: getTargetFile(PLIST_FILENAME),\n });\n updateNseEnv(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\n updateNseNotificationService(getTargetFile('NotificationService.swift'), appGroupId);\n\n // Register the NSE target in the parsed Xcode project\n addNotificationServiceExtensionToXcodeProject(xcodeProject, {\n appleTeamId,\n bundleIdentifier,\n iosDeploymentTarget,\n appGroupId,\n });\n};\n\n/**\n * Pure string transform: substitutes the `{{BUNDLE_VERSION}}` and\n * `{{BUNDLE_SHORT_VERSION}}` placeholders in the NSE Info.plist template.\n * Either or both may be provided; missing values leave the corresponding\n * placeholder untouched.\n */\nexport function applyBundleVersionToNsePlist(\n content: string,\n payload: { bundleVersion?: string; bundleShortVersion?: string }\n): string {\n let next = content;\n if (payload.bundleVersion) {\n next = replaceCodeByRegex(next, /\\{\\{BUNDLE_VERSION\\}\\}/, payload.bundleVersion);\n }\n if (payload.bundleShortVersion) {\n next = replaceCodeByRegex(next, /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/, payload.bundleShortVersion);\n }\n return next;\n}\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const next = applyBundleVersionToNsePlist(\n FileManagement.readFile(payload.infoPlistTargetFile),\n payload,\n );\n FileManagement.writeFile(payload.infoPlistTargetFile, next);\n};\n\n/**\n * Pure string transform: substitutes the `{{APP_GROUP_ID_BUILDER_LINE}}`\n * placeholder in NotificationService.swift with either the configured\n * appGroupId builder line or an empty string.\n */\nexport function applyAppGroupIdToNotificationService(\n content: string,\n appGroupId?: string\n): string {\n const builderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n return replaceCodeByRegex(content, /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/, builderLine);\n}\n\nconst updateNseNotificationService = (\n notificationServiceFile: string,\n appGroupId?: string,\n) => {\n const next = applyAppGroupIdToNotificationService(\n FileManagement.readFile(notificationServiceFile),\n appGroupId,\n );\n FileManagement.writeFile(notificationServiceFile, next);\n};\n\n/**\n * Pure string transform: substitutes the `{{CDP_API_KEY}}` and `{{REGION}}`\n * placeholders in the NSE Env.swift template. Missing or invalid region\n * falls back to `Region.US` and logs a warning.\n */\nexport function applyRichPushConfigToEnv(\n content: string,\n richPushConfig?: RichPushConfig,\n): string {\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n let next = replaceCodeByRegex(\n content,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = { us: 'Region.US', eu: 'Region.EU' } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n next = replaceCodeByRegex(next, /\\{\\{REGION\\}\\}/, regionMap.us);\n } else {\n next = replaceCodeByRegex(next, /\\{\\{REGION\\}\\}/, mappedRegion);\n }\n return next;\n}\n\nconst updateNseEnv = (\n envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n const next = applyRichPushConfigToEnv(\n FileManagement.readFile(envFileName),\n richPushConfig,\n );\n FileManagement.writeFile(envFileName, next);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\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 `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${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\n/**\n * Pure string transform: substitutes every PushService.swift placeholder\n * (`{{REGISTER_SNIPPET}}`, `{{CDP_API_KEY}}`, `{{REGION}}`,\n * `{{AUTO_TRACK_PUSH_EVENTS}}`, `{{AUTO_FETCH_DEVICE_TOKEN}}`,\n * `{{SHOW_PUSH_APP_IN_FOREGROUND}}`, `{{APP_GROUP_ID_BUILDER_LINE}}`) using\n * the configured push-notification options. Validation of the rich-push\n * config (cdpApiKey/region required) is the wrapper's responsibility.\n */\nexport function applyConfigToPushFile(\n content: string,\n options: CustomerIOPluginOptionsIOS,\n): string {\n const richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n\n // unless this property is explicitly set to true, push notification\n // registration will be added to the AppDelegate\n const registerSnippet = disableNotificationRegistration !== true\n ? CIO_REGISTER_PUSHNOTIFICATION_SNIPPET\n : '';\n\n let next = replaceCodeByRegex(content, /\\{\\{REGISTER_SNIPPET\\}\\}/, registerSnippet);\n next = replaceCodeByRegex(next, /\\{\\{CDP_API_KEY\\}\\}/, cdpApiKey);\n\n if (region) {\n next = replaceCodeByRegex(next, /\\{\\{REGION\\}\\}/, region.toUpperCase());\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n next = replaceCodeByRegex(\n next,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString(),\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n next = replaceCodeByRegex(\n next,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString(),\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n next = replaceCodeByRegex(\n next,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString(),\n );\n\n const appGroupId = options.pushNotification?.appGroupId;\n const appGroupIdBuilderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n next = replaceCodeByRegex(\n next,\n /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/,\n appGroupIdBuilderLine,\n );\n\n return next;\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const richPushConfig = options.pushNotification?.env;\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n const next = applyConfigToPushFile(FileManagement.readFile(envFileName), options);\n FileManagement.writeFile(envFileName, next);\n};\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAEA,MAAMS,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,CAAC,2BAA2B,CAAC;AACjE,MAAMC,gBAAgB,GAAG,CACvBJ,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvBE,YAAY,CACb;AAED,MAAMG,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,EAC1BC,gBAAyB,KACtB;EACH,I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