customerio-expo-plugin 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customerio-expo-plugin",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Expo config plugin for the Customer IO React Native SDK",
5
5
  "main": "plugin/lib/commonjs/index",
6
6
  "module": "plugin/lib/module/index",
@@ -146,7 +146,7 @@ function addNotificationServiceExtensionToXcodeProject(xcodeProject, options) {
146
146
  // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
147
147
  const projObjects = xcodeProject.hash.project.objects;
148
148
  projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};
149
- projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};
149
+ projObjects.PBXContainerItemProxy = projObjects.PBXContainerItemProxy || {};
150
150
 
151
151
  // Add the NSE target. This also adds PBXTargetDependency and PBXContainerItemProxy.
152
152
  const nseTarget = xcodeProject.addTarget(_ios.CIO_NOTIFICATION_TARGET_NAME, 'app_extension', _ios.CIO_NOTIFICATION_TARGET_NAME, `${bundleIdentifier}.richpush`);
@@ -1 +1 @@
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,uB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OAAO,CAACI,gBAAgB,cAAA8I,sBAAA,uBAAxBA,sBAAA,CAA0BrD,GAAG;EACpD,IAAI,CAAC,IAAAwB,kCAAsB,EAACV,cAAc,CAAC,EAAE;IAC3C;EACF;EACA,MAAMT,IAAI,GAAGgC,qBAAqB,CAACjD,8BAAc,CAACmB,QAAQ,CAACgB,WAAW,CAAC,EAAEpH,OAAO,CAAC;EACjFiF,8BAAc,CAACI,SAAS,CAAC+B,WAAW,EAAElB,IAAI,CAAC;AAC7C,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.PBXContainerItemProxy || {};\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,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,qBAAA,GAAAH,OAAO,CAACI,gBAAgB,cAAAD,qBAAA,uBAAxBA,qBAAA,CAA0BG,WAAW,MAAK,IAAI,EAAE;MAClD,MAAMC,oBAAoB,CAACP,OAAO,EAAEC,YAAY,CA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EACjC6C,oBAAoB,CAACD,QAAQ,CAAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B,EAAAT,sBAAA,GAAAvI,OAAO,CAACI,gBAAgB,cAAAmI,sBAAA,uBAAxBA,sBAAA,CAA0BS,uBAAuB,MAAK,KAAK;EAC7D9C,IAAI,GAAG,IAAAC,iCAAkB,EACvBD,IAAI,EACJ,qCAAqC,EACrC8C,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED,MAAMrG,UAAU,IAAA+F,sBAAA,GAAGxI,OAAO,CAACI,gBAAgB,cAAAoI,sBAAA,uBAAxBA,sBAAA,CAA0B/F,UAAU;EACvD,MAAMwG,qBAAqB,GAAGxG,UAAU,GACpC,uBAAuB8D,IAAI,CAACC,SAAS,CAAC/D,UAAU,CAAC,KAAK,GACtD,EAAE;EACNyD,IAAI,GAAG,IAAAC,iCAAkB,EACvBD,IAAI,EACJ,mCAAmC,EACnC+C,qBACF,CAAC;EAED,OAAO/C,IAAI;AACb;AAEA,MAAM0B,cAAc,GAAGA,CACrB5H,OAAmC,EACnCoH,WAAmB,KAChB;EAAA,IAAA8B,sBAAA;EACH,MAAMvC,cAAc,IAAAuC,sBAAA,GAAGlJ,OAAO,CAACI,gBAAgB,cAAA8I,sBAAA,uBAAxBA,sBAAA,CAA0BrD,GAAG;EACpD,IAAI,CAAC,IAAAwB,kCAAsB,EAACV,cAAc,CAAC,EAAE;IAC3C;EACF;EACA,MAAMT,IAAI,GAAGgC,qBAAqB,CAACjD,8BAAc,CAACmB,QAAQ,CAACgB,WAAW,CAAC,EAAEpH,OAAO,CAAC;EACjFiF,8BAAc,CAACI,SAAS,CAAC+B,WAAW,EAAElB,IAAI,CAAC;AAC7C,CAAC","ignoreList":[]}
@@ -134,7 +134,7 @@ export function addNotificationServiceExtensionToXcodeProject(xcodeProject, opti
134
134
  // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
135
135
  const projObjects = xcodeProject.hash.project.objects;
136
136
  projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};
137
- projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};
137
+ projObjects.PBXContainerItemProxy = projObjects.PBXContainerItemProxy || {};
138
138
 
139
139
  // Add the NSE target. This also adds PBXTargetDependency and PBXContainerItemProxy.
140
140
  const nseTarget = xcodeProject.addTarget(CIO_NOTIFICATION_TARGET_NAME, 'app_extension', CIO_NOTIFICATION_TARGET_NAME, `${bundleIdentifier}.richpush`);
@@ -1 +1 @@
1
- {"version":3,"names":["withXcodeProject","CIO_NOTIFICATION_TARGET_NAME","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","DEFAULT_BUNDLE_VERSION","replaceCodeByRegex","injectCIONotificationPodfileCode","logger","getIosNativeFilesPath","validateRichPushConfig","FileManagement","isExpoVersion53OrHigher","isFcmPushProvider","PLIST_FILENAME","ENV_FILENAME","NSE_PLATFORM_SPECIFIC_FILES","NSE_COMMON_FILES","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","String","withCioNotificationsXcodeProject","configOuter","props","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","iosPath","appName","modifiedProjectFile","modResults","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","nsePath","mkdir","recursive","nseEntitlementsContent","writeFile","getTargetFile","filename","copyFile","updateNseInfoPlist","infoPlistTargetFile","updateNseEnv","env","updateNseNotificationService","applyBundleVersionToNsePlist","content","payload","next","readFile","applyAppGroupIdToNotificationService","builderLine","JSON","stringify","notificationServiceFile","applyRichPushConfigToEnv","richPushConfig","cdpApiKey","region","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","envFileName","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","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,SAASA,gBAAgB,QAAQ,sBAAsB;AAEvD,SACEC,4BAA4B,EAC5BC,qCAAqC,EACrCC,sBAAsB,QACjB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,uBAAuB,EAAEC,iBAAiB,QAAQ,SAAS;AAEpE,MAAMC,cAAc,GAAG,GAAGX,4BAA4B,aAAa;AACnE,MAAMY,YAAY,GAAG,WAAW;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,CAAC,2BAA2B,CAAC;AACjE,MAAMC,gBAAgB,GAAG,CACvBH,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvBC,YAAY,CACb;AAED,MAAMG,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,qBAAA,GAAAH,OAAO,CAACI,gBAAgB,cAAAD,qBAAA,uBAAxBA,qBAAA,CAA0BG,WAAW,MAAK,IAAI,EAAE;MAClD,MAAMC,oBAAoB,CAACP,OAAO,EAAEC,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GAAA5H,OAAO,CAACI,gBAAgB,cAAAwH,sBAAA,uBAAxBA,sBAAA,CAA0BQ,uBAAuB,MAAK,KAAK;EAC7D3C,IAAI,GAAGvG,kBAAkB,CACvBuG,IAAI,EACJ,qCAAqC,EACrC2C,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED,MAAM9F,UAAU,IAAAyF,sBAAA,GAAG7H,OAAO,CAACI,gBAAgB,cAAAyH,sBAAA,uBAAxBA,sBAAA,CAA0BzF,UAAU;EACvD,MAAMiG,qBAAqB,GAAGjG,UAAU,GACpC,uBAAuByD,IAAI,CAACC,SAAS,CAAC1D,UAAU,CAAC,KAAK,GACtD,EAAE;EACNqD,IAAI,GAAGvG,kBAAkB,CACvBuG,IAAI,EACJ,mCAAmC,EACnC4C,qBACF,CAAC;EAED,OAAO5C,IAAI;AACb;AAEA,MAAMwB,cAAc,GAAGA,CACrBjH,OAAmC,EACnC0G,WAAmB,KAChB;EAAA,IAAA4B,sBAAA;EACH,MAAMrC,cAAc,IAAAqC,sBAAA,GAAGtI,OAAO,CAACI,gBAAgB,cAAAkI,sBAAA,uBAAxBA,sBAAA,CAA0BlD,GAAG;EACpD,IAAI,CAAC9F,sBAAsB,CAAC2G,cAAc,CAAC,EAAE;IAC3C;EACF;EACA,MAAMR,IAAI,GAAG8B,qBAAqB,CAAChI,cAAc,CAACmG,QAAQ,CAACgB,WAAW,CAAC,EAAE1G,OAAO,CAAC;EACjFT,cAAc,CAACsF,SAAS,CAAC6B,WAAW,EAAEjB,IAAI,CAAC;AAC7C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["withXcodeProject","CIO_NOTIFICATION_TARGET_NAME","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","DEFAULT_BUNDLE_VERSION","replaceCodeByRegex","injectCIONotificationPodfileCode","logger","getIosNativeFilesPath","validateRichPushConfig","FileManagement","isExpoVersion53OrHigher","isFcmPushProvider","PLIST_FILENAME","ENV_FILENAME","NSE_PLATFORM_SPECIFIC_FILES","NSE_COMMON_FILES","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","String","withCioNotificationsXcodeProject","configOuter","props","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","iosPath","appName","modifiedProjectFile","modResults","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","nsePath","mkdir","recursive","nseEntitlementsContent","writeFile","getTargetFile","filename","copyFile","updateNseInfoPlist","infoPlistTargetFile","updateNseEnv","env","updateNseNotificationService","applyBundleVersionToNsePlist","content","payload","next","readFile","applyAppGroupIdToNotificationService","builderLine","JSON","stringify","notificationServiceFile","applyRichPushConfigToEnv","richPushConfig","cdpApiKey","region","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","envFileName","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","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.PBXContainerItemProxy || {};\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,SAASA,gBAAgB,QAAQ,sBAAsB;AAEvD,SACEC,4BAA4B,EAC5BC,qCAAqC,EACrCC,sBAAsB,QACjB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,uBAAuB,EAAEC,iBAAiB,QAAQ,SAAS;AAEpE,MAAMC,cAAc,GAAG,GAAGX,4BAA4B,aAAa;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,IAAA4B,sBAAA;EACH,MAAMrC,cAAc,IAAAqC,sBAAA,GAAGtI,OAAO,CAACI,gBAAgB,cAAAkI,sBAAA,uBAAxBA,sBAAA,CAA0BlD,GAAG;EACpD,IAAI,CAAC9F,sBAAsB,CAAC2G,cAAc,CAAC,EAAE;IAC3C;EACF;EACA,MAAMR,IAAI,GAAG8B,qBAAqB,CAAChI,cAAc,CAACmG,QAAQ,CAACgB,WAAW,CAAC,EAAE1G,OAAO,CAAC;EACjFT,cAAc,CAACsF,SAAS,CAAC6B,WAAW,EAAEjB,IAAI,CAAC;AAC7C,CAAC","ignoreList":[]}
@@ -181,7 +181,7 @@ export function addNotificationServiceExtensionToXcodeProject(
181
181
  // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
182
182
  const projObjects = xcodeProject.hash.project.objects;
183
183
  projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};
184
- projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};
184
+ projObjects.PBXContainerItemProxy = projObjects.PBXContainerItemProxy || {};
185
185
 
186
186
  // Add the NSE target. This also adds PBXTargetDependency and PBXContainerItemProxy.
187
187
  const nseTarget = xcodeProject.addTarget(