customerio-expo-plugin 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js +13 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js +37 -0
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js.map +1 -0
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +21 -5
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/commonjs/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +19 -2
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/patchLocationCode.js +50 -0
- package/plugin/lib/commonjs/helpers/utils/patchLocationCode.js.map +1 -0
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js +3 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/commonjs/index.js +2 -2
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +46 -4
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +25 -12
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +45 -11
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js +4 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/commonjs/utils/validation.js +13 -0
- package/plugin/lib/commonjs/utils/validation.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +13 -2
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withLocationGradleProperties.js +30 -0
- package/plugin/lib/module/android/withLocationGradleProperties.js.map +1 -0
- package/plugin/lib/module/android/withMainApplicationModifications.js +20 -4
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/module/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/lib/module/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/lib/module/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +18 -2
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/helpers/utils/patchLocationCode.js +44 -0
- package/plugin/lib/module/helpers/utils/patchLocationCode.js.map +1 -0
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js +3 -2
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/module/index.js +2 -2
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +46 -4
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +25 -12
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +45 -11
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js +5 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/module/utils/validation.js +13 -1
- package/plugin/lib/module/utils/validation.js.map +1 -1
- package/plugin/lib/typescript/android/withCIOAndroid.d.ts +2 -2
- package/plugin/lib/typescript/android/withLocationGradleProperties.d.ts +9 -0
- package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +7 -2
- package/plugin/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +9 -1
- package/plugin/lib/typescript/helpers/utils/patchLocationCode.d.ts +12 -0
- package/plugin/lib/typescript/helpers/utils/patchPluginNativeCode.d.ts +3 -1
- package/plugin/lib/typescript/index.d.ts +2 -1
- package/plugin/lib/typescript/ios/withCIOIos.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +2 -2
- package/plugin/lib/typescript/ios/withXcodeProject.d.ts +8 -1
- package/plugin/lib/typescript/types/cio-types.d.ts +35 -0
- package/plugin/lib/typescript/utils/validation.d.ts +3 -2
- package/plugin/src/android/withCIOAndroid.ts +13 -2
- package/plugin/src/android/withLocationGradleProperties.ts +41 -0
- package/plugin/src/android/withMainApplicationModifications.ts +26 -4
- package/plugin/src/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/src/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/src/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/src/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +35 -3
- package/plugin/src/helpers/utils/patchLocationCode.ts +80 -0
- package/plugin/src/helpers/utils/patchPluginNativeCode.ts +10 -1
- package/plugin/src/index.ts +9 -3
- package/plugin/src/ios/withCIOIos.ts +40 -3
- package/plugin/src/ios/withCIOIosSwift.ts +30 -4
- package/plugin/src/ios/withNotificationsXcodeProject.ts +56 -1
- package/plugin/src/ios/withXcodeProject.ts +20 -3
- package/plugin/src/types/cio-types.ts +38 -0
- package/plugin/src/utils/validation.ts +18 -1
|
@@ -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","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","_options$pushNotifica2","isFcmProvider","pbxTargetByName","warn","nsePath","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","env","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","writeFile","envFileName","richPushConfig","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","sourceFile","targetFileName","appPath","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: unknown) {\n logger.error(String(error));\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter),\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/${isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects.PBXGroup;\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};\n projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n // Use merged config values (config takes precedence over env)\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n // Simplify region mapping with case insensitive keys and fallback for invalid regions\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n // Fallback to US if invalid region provided\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, regionMap.us);\n } else {\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, mappedRegion);\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? 'fcm' : 'apn'}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n\n let snippet = '';\n // unless this property is explicitly set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey,\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName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,CAAC;EAEzE3B,cAAc,GAAGtG,kBAAkB,CACjCsG,cAAc,EACd,qBAAqB,EACrBC,SACF,CAAC;EAED,IAAIC,MAAM,EAAE;IACVF,cAAc,GAAGtG,kBAAkB,CACjCsG,cAAc,EACd,gBAAgB,EAChBE,MAAM,CAAC0B,WAAW,CAAC,CACrB,CAAC;EACH;EAEA,MAAMC,mBAAmB,GACvB,EAAAP,sBAAA,GAAAhH,OAAO,CAACI,gBAAgB,cAAA4G,sBAAA,uBAAxBA,sBAAA,CAA0BO,mBAAmB,MAAK,KAAK;EACzD7B,cAAc,GAAGtG,kBAAkB,CACjCsG,cAAc,EACd,gCAAgC,EAChC6B,mBAAmB,CAACC,QAAQ,CAAC,CAC/B,CAAC;EAED,MAAMC,oBAAoB,GACxB,EAAAR,sBAAA,GAAAjH,OAAO,CAACI,gBAAgB,cAAA6G,sBAAA,uBAAxBA,sBAAA,CAA0BQ,oBAAoB,MAAK,KAAK;EAC1D/B,cAAc,GAAGtG,kBAAkB,CACjCsG,cAAc,EACd,iCAAiC,EACjC+B,oBAAoB,CAACD,QAAQ,CAAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B,EAAAR,sBAAA,GAAAlH,OAAO,CAACI,gBAAgB,cAAA8G,sBAAA,uBAAxBA,sBAAA,CAA0BQ,uBAAuB,MAAK,KAAK;EAC7DhC,cAAc,GAAGtG,kBAAkB,CACjCsG,cAAc,EACd,qCAAqC,EACrCgC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED/H,cAAc,CAAC4F,SAAS,CAACC,WAAW,EAAEI,cAAc,CAAC;AACvD,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","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","_options$pushNotifica2","_options$pushNotifica3","_options$pushNotifica4","isFcmProvider","pbxTargetByName","warn","nsePath","mkdir","recursive","platformSpecificFiles","nseEntitlementsFilename","appGroupId","nseEntitlementsContent","writeFile","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","env","updateNseNotificationService","allGroupFiles","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","CODE_SIGN_ENTITLEMENTS","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","notificationServiceFile","APP_GROUP_ID_BUILDER_LINE_RE","content","builderLine","JSON","stringify","envFileName","richPushConfig","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","sourceFile","targetFileName","appPath","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","_options$pushNotifica8","_options$pushNotifica9","_options$pushNotifica0","REGISTER_RE","disableNotificationRegistration","snippet","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","appGroupIdBuilderLine"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: unknown) {\n logger.error(String(error));\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter),\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const nseEntitlementsFilename = 'NotificationService.entitlements';\n const appGroupId = options.pushNotification?.appGroupId;\n\n // Write NSE entitlements file only when appGroupId is explicitly configured\n if (appGroupId) {\n const nseEntitlementsContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>com.apple.security.application-groups</key>\n <array>\n <string>${appGroupId}</string>\n </array>\n</dict>\n</plist>\n`;\n FileManagement.writeFile(`${nsePath}/${nseEntitlementsFilename}`, nseEntitlementsContent);\n }\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/${isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\n updateNseNotificationService(getTargetFile('NotificationService.swift'), options.pushNotification?.appGroupId);\n\n // The entitlements file is generated (not copied from source), so it's listed separately\n // for the Xcode group so it appears in the file navigator\n const allGroupFiles = [\n ...platformSpecificFiles,\n ...commonFiles,\n ...(appGroupId ? [nseEntitlementsFilename] : []),\n ];\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n allGroupFiles,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects.PBXGroup;\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects.PBXTargetDependency = projObjects.PBXTargetDependency || {};\n projObjects.PBXContainerItemProxy = projObjects.PBXTargetDependency || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n if (appGroupId) {\n buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${CIO_NOTIFICATION_TARGET_NAME}/${nseEntitlementsFilename}`;\n }\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseNotificationService = (\n notificationServiceFile: string,\n appGroupId?: string,\n) => {\n const APP_GROUP_ID_BUILDER_LINE_RE = /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/;\n\n let content = FileManagement.readFile(notificationServiceFile);\n const builderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n content = replaceCodeByRegex(content, APP_GROUP_ID_BUILDER_LINE_RE, builderLine);\n FileManagement.writeFile(notificationServiceFile, content);\n};\n\nconst updateNseEnv = (\n envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n // Use merged config values (config takes precedence over env)\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n // Simplify region mapping with case insensitive keys and fallback for invalid regions\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n // Fallback to US if invalid region provided\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, regionMap.us);\n } else {\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, mappedRegion);\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? 'fcm' : 'apn'}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n\n let snippet = '';\n // unless this property is explicitly set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey,\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n const appGroupId = options.pushNotification?.appGroupId;\n const appGroupIdBuilderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/,\n appGroupIdBuilderLine\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AACA,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,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,EAC1BC,gBAAyB,KACtB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,IAAIH,OAAO,CAACI,gBAAgB,IAAI,CAACF,gBAAgB,EAAE;MACjD,MAAMG,uBAAuB,CAACL,OAAO,EAAEC,YAAY,CAAC;IACtD;I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BAAxBA,sBAAA,CAA0BS,uBAAuB,MAAK,KAAK;EAC7DjC,cAAc,GAAGpH,kBAAkB,CACjCoH,cAAc,EACd,qCAAqC,EACrCiC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED,MAAM5F,UAAU,IAAAsF,sBAAA,GAAGjI,OAAO,CAACI,gBAAgB,cAAA6H,sBAAA,uBAAxBA,sBAAA,CAA0BtF,UAAU;EACvD,MAAM+F,qBAAqB,GAAG/F,UAAU,GACpC,uBAAuBuD,IAAI,CAACC,SAAS,CAACxD,UAAU,CAAC,KAAK,GACtD,EAAE;EACN6D,cAAc,GAAGpH,kBAAkB,CACjCoH,cAAc,EACd,mCAAmC,EACnCkC,qBACF,CAAC;EAEDjJ,cAAc,CAACoD,SAAS,CAACuD,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { withXcodeProject } from '@expo/config-plugins';
|
|
2
2
|
import { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';
|
|
3
3
|
import { isFcmPushProvider } from './utils';
|
|
4
|
+
|
|
5
|
+
/** Props for the CIO Xcode project mod; push options are optional when only location is enabled. */
|
|
6
|
+
|
|
4
7
|
export const withCioXcodeProject = (config, cioProps) => {
|
|
5
8
|
return withXcodeProject(config, async props => {
|
|
6
9
|
const iosPath = props.modRequest.platformProjectRoot;
|
|
7
|
-
|
|
10
|
+
const podfileOptions = cioProps === null || cioProps === void 0 ? void 0 : cioProps.podfileOptions;
|
|
11
|
+
await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps), podfileOptions);
|
|
8
12
|
return props;
|
|
9
13
|
});
|
|
10
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","injectCIOPodfileCode","isFcmPushProvider","withCioXcodeProject","config","cioProps","props","iosPath","modRequest","platformProjectRoot"],"sources":["withXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {
|
|
1
|
+
{"version":3,"names":["withXcodeProject","injectCIOPodfileCode","isFcmPushProvider","withCioXcodeProject","config","cioProps","props","iosPath","modRequest","platformProjectRoot","podfileOptions"],"sources":["withXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n injectCIOPodfileCode,\n type InjectCIOPodfileOptions,\n} from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport type WithCioXcodeProjectOptions = {\n /** Options for Podfile host app snippet (location subspec, etc.) */\n podfileOptions?: InjectCIOPodfileOptions;\n};\n\n/** Props for the CIO Xcode project mod; push options are optional when only location is enabled. */\nexport type WithCioXcodeProjectProps = Partial<CustomerIOPluginOptionsIOS> &\n WithCioXcodeProjectOptions;\n\nexport const withCioXcodeProject: ConfigPlugin<WithCioXcodeProjectProps> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const iosPath = props.modRequest.platformProjectRoot;\n const podfileOptions = cioProps?.podfileOptions;\n\n await injectCIOPodfileCode(\n iosPath,\n isFcmPushProvider(cioProps as CustomerIOPluginOptionsIOS | undefined),\n podfileOptions\n );\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AAEvD,SACEC,oBAAoB,QAEf,uCAAuC;AAE9C,SAASC,iBAAiB,QAAQ,SAAS;;AAO3C;;AAIA,OAAO,MAAMC,mBAA2D,GAAGA,CACzEC,MAAM,EACNC,QAAQ,KACL;EACH,OAAOL,gBAAgB,CAACI,MAAM,EAAE,MAAOE,KAAK,IAAK;IAC/C,MAAMC,OAAO,GAAGD,KAAK,CAACE,UAAU,CAACC,mBAAmB;IACpD,MAAMC,cAAc,GAAGL,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEK,cAAc;IAE/C,MAAMT,oBAAoB,CACxBM,OAAO,EACPL,iBAAiB,CAACG,QAAkD,CAAC,EACrEK,cACF,CAAC;IAED,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["/**\n * Properties set by the user in their app config file (e.g: app.json or app.plugin.js)\n * @public\n */\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n/**\n * Plugin options for iOS platform configuration\n * @public\n */\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\n/**\n * Plugin options for Android platform configuration\n * @public\n */\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n pushNotification?: {\n channel?: {\n id?: string;\n name?: string;\n importance?: number;\n };\n };\n /**\n * Controls whether to disable Android 16 support by downgrading androidx dependencies.\n *\n * When true (default for Expo SDK 53), forces older androidx versions compatible with\n * Android API 35 and AGP 8.8.2, preventing Android 16 incompatibility errors.\n *\n * When false (default for Expo SDK 54+), allows newer androidx versions that support Android 16\n * but require Android API 36 and AGP 8.9.1+.\n *\n * If not specified, the plugin auto-detects based on Expo SDK version:\n * - Expo SDK ≤53: true (disables Android 16)\n * - Expo SDK ≥54: false (enables Android 16)\n */\n disableAndroid16Support?: boolean;\n};\n\n/**\n * SDK configuration options for auto initialization\n * @public\n */\nexport type NativeSDKConfig = {\n cdpApiKey: string; // Required\n region?: 'US' | 'EU'; // Default: 'US'. The workspace region set for your workspace on the Customer.io dashboard\n autoTrackDeviceAttributes?: boolean; // Default: true\n trackApplicationLifecycleEvents?: boolean; // Default: true\n screenViewUse?: 'all' | 'inapp'; // Default: 'all'. 'all': sent to server + in-app messages, 'inapp': in-app messages only\n logLevel?: 'none' | 'error' | 'info' | 'debug'; // Default: 'debug'. Controls SDK logging verbosity\n siteId?: string; // Optional, if only siteId defined, migrationSiteId = siteId\n migrationSiteId?: string; // Optional, if only migrationSiteId defined, siteId should be null\n};\n\n/**\n * Combined plugin options for both iOS and Android platforms\n * @public\n */\nexport type CustomerIOPluginOptions = {\n config?: NativeSDKConfig; // If defined, enables auto initialization of native SDK\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n\n/**\n * Rich push configuration used to initialize Notification Service Extension (NSE) on the native side\n * @public\n */\nexport type RichPushConfig = {\n cdpApiKey: string;\n region?: string;\n};\n\n/**\n * Push notification configuration options\n * @public\n */\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * Rich push config should match the values used to initialize SDK in the app.\n * Optional if `config` is provided at the top level.\n */\n env?: RichPushConfig;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["/**\n * Properties set by the user in their app config file (e.g: app.json or app.plugin.js)\n * @public\n */\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n/**\n * Plugin options for iOS platform configuration\n * @public\n */\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\n/**\n * Plugin options for Android platform configuration\n * @public\n */\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n pushNotification?: {\n channel?: {\n id?: string;\n name?: string;\n importance?: number;\n };\n };\n /**\n * Controls whether to disable Android 16 support by downgrading androidx dependencies.\n *\n * When true (default for Expo SDK 53), forces older androidx versions compatible with\n * Android API 35 and AGP 8.8.2, preventing Android 16 incompatibility errors.\n *\n * When false (default for Expo SDK 54+), allows newer androidx versions that support Android 16\n * but require Android API 36 and AGP 8.9.1+.\n *\n * If not specified, the plugin auto-detects based on Expo SDK version:\n * - Expo SDK ≤53: true (disables Android 16)\n * - Expo SDK ≥54: false (enables Android 16)\n */\n disableAndroid16Support?: boolean;\n};\n\n/**\n * Location tracking mode for the Customer.io SDK location module.\n * Location is off by default. Only used when location is enabled (plugin option location.enabled: true).\n * @public\n */\nexport type LocationTrackingMode = 'OFF' | 'MANUAL' | 'ON_APP_START';\n\n/**\n * SDK configuration options for auto initialization\n * @public\n */\nexport type NativeSDKConfig = {\n cdpApiKey: string; // Required\n region?: 'US' | 'EU'; // Default: 'US'. The workspace region set for your workspace on the Customer.io dashboard\n autoTrackDeviceAttributes?: boolean; // Default: true\n trackApplicationLifecycleEvents?: boolean; // Default: true\n screenViewUse?: 'all' | 'inapp'; // Default: 'all'. 'all': sent to server + in-app messages, 'inapp': in-app messages only\n logLevel?: 'none' | 'error' | 'info' | 'debug'; // Default: 'debug'. Controls SDK logging verbosity\n siteId?: string; // Optional, if only siteId defined, migrationSiteId = siteId\n migrationSiteId?: string; // Optional, if only migrationSiteId defined, siteId should be null\n /**\n * Location module config. Location is off by default; only applied when plugin option location.enabled is true.\n * trackingMode: 'MANUAL' (host app controls when location is captured, default),\n * 'ON_APP_START' (SDK captures once per launch when app becomes active), or 'OFF'.\n */\n location?: {\n trackingMode?: LocationTrackingMode;\n };\n};\n\n/**\n * Location is off by default. When true, enables the Customer.io SDK location native module (iOS Podfile location subspec,\n * Android gradle.properties flag). Permissions and privacy keys (Info.plist, AndroidManifest)\n * remain the host app's responsibility.\n * @public\n */\nexport type CustomerIOPluginLocationOptions = {\n enabled?: boolean;\n};\n\n/**\n * Combined plugin options for both iOS and Android platforms\n * @public\n */\nexport type CustomerIOPluginOptions = {\n config?: NativeSDKConfig; // If defined, enables auto initialization of native SDK\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n /**\n * Location is off by default. When location.enabled is true, the plugin adds SDK build-time setup (Podfile location subspec,\n * gradle.properties). Host apps must add their own location permissions and privacy usage strings.\n */\n location?: CustomerIOPluginLocationOptions;\n};\n\n/**\n * Rich push configuration used to initialize Notification Service Extension (NSE) on the native side\n * @public\n */\nexport type RichPushConfig = {\n cdpApiKey: string;\n region?: string;\n};\n\n/**\n * Push notification configuration options\n * @public\n */\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * Rich push config should match the values used to initialize SDK in the app.\n * Optional if `config` is provided at the top level.\n */\n env?: RichPushConfig;\n\n /**\n * iOS App Group identifier shared between the host app and the Notification Service Extension.\n * When set, `.appGroupId(...)` is injected into the MessagingPushConfigBuilder, the identifier\n * is added to the host app entitlements, and an NSE entitlements file is written.\n * When omitted, the native SDK handles group discovery on its own and no entitlements are added.\n */\n appGroupId?: string;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -76,5 +76,17 @@ function validateRichPushConfig(config) {
|
|
|
76
76
|
isValid = validateRegion(config === null || config === void 0 ? void 0 : config.region, 'region', context) && isValid;
|
|
77
77
|
return isValid;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
function validatePushNotificationOptions(options) {
|
|
80
|
+
const context = 'PushNotification';
|
|
81
|
+
let isValid = true;
|
|
82
|
+
const appGroupId = options.appGroupId;
|
|
83
|
+
if (appGroupId !== undefined) {
|
|
84
|
+
isValid = validateString(appGroupId, 'appGroupId', context) && isValid;
|
|
85
|
+
if (isValid && !appGroupId.startsWith('group.')) {
|
|
86
|
+
logger.warn(`${context}: appGroupId "${appGroupId}" does not start with "group." — ensure this matches your Apple App Group entitlement.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return isValid;
|
|
90
|
+
}
|
|
91
|
+
export { validateNativeSDKConfig, validatePushNotificationOptions, validateRequired, validateRichPushConfig, validateString };
|
|
80
92
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["logger","validate","isValid","messageFactory","message","process","env","CUSTOMERIO_STRICT_MODE","Error","format","warn","isUndefined","value","undefined","validateRequired","fieldName","context","validateString","trim","validateBoolean","validateEnum","allowedValues","lowerValue","toLowerCase","lowerAllowedValues","map","v","includes","valuesStr","join","validateRegion","validateNativeSDKConfig","config","cdpApiKey","region","screenViewUse","logLevel","autoTrackDeviceAttributes","trackApplicationLifecycleEvents","siteId","migrationSiteId","validateRichPushConfig"],"sources":["validation.ts"],"sourcesContent":["import type { NativeSDKConfig, RichPushConfig } from '../types/cio-types';\nimport { logger } from './logger';\n\n/**\n * Validates a condition and handles errors based on CUSTOMERIO_STRICT_MODE flag.\n * @param isValid - Function that returns true if validation passes\n * @param messageFactory - Function that returns the error message if validation fails\n * @returns true if validation passes, false if it fails\n */\nfunction validate(isValid: () => boolean, messageFactory: () => string): boolean {\n if (isValid()) {\n return true;\n }\n\n // Throw errors unless explicitly disabled, default to strict validation\n const message = messageFactory();\n // Throw an error if strict mode is enabled, log a warning otherwise\n if (process.env.CUSTOMERIO_STRICT_MODE === 'true') {\n throw new Error(logger.format(message));\n } else {\n logger.warn(message);\n }\n return false;\n}\n\nfunction isUndefined(value: unknown): boolean {\n return value === undefined;\n}\n\nfunction validateRequired(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => !isUndefined(value) && value !== null,\n () => `${context}: ${fieldName} is required, received: ${value}`\n );\n}\n\nfunction validateString(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => isUndefined(value) || (typeof value === 'string' && value.trim() !== ''),\n () => `${context}: ${fieldName} must be a non-empty string, received: ${typeof value === 'string' ? `\"${value}\"` : value}`\n );\n}\n\nfunction validateBoolean(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => isUndefined(value) || typeof value === 'boolean',\n () => `${context}: ${fieldName} must be a boolean, received: ${value}`\n );\n}\n\nfunction validateEnum<T extends string>(\n value: unknown,\n fieldName: string,\n allowedValues: readonly T[],\n context: string\n): boolean {\n if (isUndefined(value)) return true;\n\n // First validate it's a string\n if (!validateString(value, fieldName, context)) {\n return false;\n }\n\n // Then validate it's in the allowed values\n return validate(\n () => {\n const lowerValue = (value as string).toLowerCase();\n const lowerAllowedValues = allowedValues.map(v => v.toLowerCase());\n return lowerAllowedValues.includes(lowerValue);\n },\n () => {\n const valuesStr = allowedValues.map(v => `\"${v}\"`).join(', ');\n return `${context}: ${fieldName} must be one of ${valuesStr}, received: ${value}`;\n }\n );\n}\n\nfunction validateRegion(value: unknown, fieldName: string, context: string): boolean {\n return validateEnum(value, fieldName, ['US', 'EU'], context);\n}\n\nfunction validateNativeSDKConfig(config: NativeSDKConfig): boolean {\n const context = 'NativeSDKConfig';\n\n let isValid = true;\n\n isValid = validateRequired(config.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateString(config.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateRegion(config.region, 'region', context) && isValid;\n isValid = validateEnum(config.screenViewUse, 'screenViewUse', ['all', 'inapp'], context) && isValid;\n isValid = validateEnum(config.logLevel, 'logLevel', ['none', 'error', 'info', 'debug'], context) && isValid;\n isValid = validateBoolean(config.autoTrackDeviceAttributes, 'autoTrackDeviceAttributes', context) && isValid;\n isValid = validateBoolean(config.trackApplicationLifecycleEvents, 'trackApplicationLifecycleEvents', context) && isValid;\n isValid = validateString(config.siteId, 'siteId', context) && isValid;\n isValid = validateString(config.migrationSiteId, 'migrationSiteId', context) && isValid;\n\n return isValid;\n}\n\nfunction validateRichPushConfig(config: RichPushConfig | undefined): boolean {\n const context = 'NotificationServiceExtension';\n\n let isValid = true;\n\n isValid = validateRequired(config?.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateString(config?.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateRegion(config?.region, 'region', context) && isValid;\n\n return isValid;\n}\n\nexport {\n validateNativeSDKConfig,\n validateRequired,\n validateRichPushConfig,\n validateString\n};\n\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,UAAU;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAACC,OAAsB,EAAEC,cAA4B,EAAW;EAC/E,IAAID,OAAO,CAAC,CAAC,EAAE;IACb,OAAO,IAAI;EACb;;EAEA;EACA,MAAME,OAAO,GAAGD,cAAc,CAAC,CAAC;EAChC;EACA,IAAIE,OAAO,CAACC,GAAG,CAACC,sBAAsB,KAAK,MAAM,EAAE;IACjD,MAAM,IAAIC,KAAK,CAACR,MAAM,CAACS,MAAM,CAACL,OAAO,CAAC,CAAC;EACzC,CAAC,MAAM;IACLJ,MAAM,CAACU,IAAI,CAACN,OAAO,CAAC;EACtB;EACA,OAAO,KAAK;AACd;AAEA,SAASO,WAAWA,CAACC,KAAc,EAAW;EAC5C,OAAOA,KAAK,KAAKC,SAAS;AAC5B;AAEA,SAASC,gBAAgBA,CAACF,KAAc,EAAEG,SAAiB,EAAEC,OAAe,EAAW;EACrF,OAAOf,QAAQ,CACb,MAAM,CAACU,WAAW,CAACC,KAAK,CAAC,IAAIA,KAAK,KAAK,IAAI,EAC3C,MAAM,GAAGI,OAAO,KAAKD,SAAS,2BAA2BH,KAAK,EAChE,CAAC;AACH;AAEA,SAASK,cAAcA,CAACL,KAAc,EAAEG,SAAiB,EAAEC,OAAe,EAAW;EACnF,OAAOf,QAAQ,CACb,MAAMU,WAAW,CAACC,KAAK,CAAC,IAAK,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACM,IAAI,CAAC,CAAC,KAAK,EAAG,EA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O,GAAG,IAAI;EAElBA,OAAO,GAAGY,gBAAgB,CAACkB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEC,SAAS,EAAE,WAAW,EAAEjB,OAAO,CAAC,IAAId,OAAO;EAC9EA,OAAO,GAAGe,cAAc,CAACe,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEC,SAAS,EAAE,WAAW,EAAEjB,OAAO,CAAC,IAAId,OAAO;EAC5EA,OAAO,GAAG4B,cAAc,CAACE,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEE,MAAM,EAAE,QAAQ,EAAElB,OAAO,CAAC,IAAId,OAAO;EAEtE,OAAOA,OAAO;AAChB;AAEA,SACE6B,uBAAuB,
|
|
1
|
+
{"version":3,"names":["logger","validate","isValid","messageFactory","message","process","env","CUSTOMERIO_STRICT_MODE","Error","format","warn","isUndefined","value","undefined","validateRequired","fieldName","context","validateString","trim","validateBoolean","validateEnum","allowedValues","lowerValue","toLowerCase","lowerAllowedValues","map","v","includes","valuesStr","join","validateRegion","validateNativeSDKConfig","config","cdpApiKey","region","screenViewUse","logLevel","autoTrackDeviceAttributes","trackApplicationLifecycleEvents","siteId","migrationSiteId","validateRichPushConfig","validatePushNotificationOptions","options","appGroupId","startsWith"],"sources":["validation.ts"],"sourcesContent":["import type { CustomerIOPluginPushNotificationOptions, NativeSDKConfig, RichPushConfig } from '../types/cio-types';\nimport { logger } from './logger';\n\n/**\n * Validates a condition and handles errors based on CUSTOMERIO_STRICT_MODE flag.\n * @param isValid - Function that returns true if validation passes\n * @param messageFactory - Function that returns the error message if validation fails\n * @returns true if validation passes, false if it fails\n */\nfunction validate(isValid: () => boolean, messageFactory: () => string): boolean {\n if (isValid()) {\n return true;\n }\n\n // Throw errors unless explicitly disabled, default to strict validation\n const message = messageFactory();\n // Throw an error if strict mode is enabled, log a warning otherwise\n if (process.env.CUSTOMERIO_STRICT_MODE === 'true') {\n throw new Error(logger.format(message));\n } else {\n logger.warn(message);\n }\n return false;\n}\n\nfunction isUndefined(value: unknown): boolean {\n return value === undefined;\n}\n\nfunction validateRequired(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => !isUndefined(value) && value !== null,\n () => `${context}: ${fieldName} is required, received: ${value}`\n );\n}\n\nfunction validateString(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => isUndefined(value) || (typeof value === 'string' && value.trim() !== ''),\n () => `${context}: ${fieldName} must be a non-empty string, received: ${typeof value === 'string' ? `\"${value}\"` : value}`\n );\n}\n\nfunction validateBoolean(value: unknown, fieldName: string, context: string): boolean {\n return validate(\n () => isUndefined(value) || typeof value === 'boolean',\n () => `${context}: ${fieldName} must be a boolean, received: ${value}`\n );\n}\n\nfunction validateEnum<T extends string>(\n value: unknown,\n fieldName: string,\n allowedValues: readonly T[],\n context: string\n): boolean {\n if (isUndefined(value)) return true;\n\n // First validate it's a string\n if (!validateString(value, fieldName, context)) {\n return false;\n }\n\n // Then validate it's in the allowed values\n return validate(\n () => {\n const lowerValue = (value as string).toLowerCase();\n const lowerAllowedValues = allowedValues.map(v => v.toLowerCase());\n return lowerAllowedValues.includes(lowerValue);\n },\n () => {\n const valuesStr = allowedValues.map(v => `\"${v}\"`).join(', ');\n return `${context}: ${fieldName} must be one of ${valuesStr}, received: ${value}`;\n }\n );\n}\n\nfunction validateRegion(value: unknown, fieldName: string, context: string): boolean {\n return validateEnum(value, fieldName, ['US', 'EU'], context);\n}\n\nfunction validateNativeSDKConfig(config: NativeSDKConfig): boolean {\n const context = 'NativeSDKConfig';\n\n let isValid = true;\n\n isValid = validateRequired(config.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateString(config.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateRegion(config.region, 'region', context) && isValid;\n isValid = validateEnum(config.screenViewUse, 'screenViewUse', ['all', 'inapp'], context) && isValid;\n isValid = validateEnum(config.logLevel, 'logLevel', ['none', 'error', 'info', 'debug'], context) && isValid;\n isValid = validateBoolean(config.autoTrackDeviceAttributes, 'autoTrackDeviceAttributes', context) && isValid;\n isValid = validateBoolean(config.trackApplicationLifecycleEvents, 'trackApplicationLifecycleEvents', context) && isValid;\n isValid = validateString(config.siteId, 'siteId', context) && isValid;\n isValid = validateString(config.migrationSiteId, 'migrationSiteId', context) && isValid;\n\n return isValid;\n}\n\nfunction validateRichPushConfig(config: RichPushConfig | undefined): boolean {\n const context = 'NotificationServiceExtension';\n\n let isValid = true;\n\n isValid = validateRequired(config?.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateString(config?.cdpApiKey, 'cdpApiKey', context) && isValid;\n isValid = validateRegion(config?.region, 'region', context) && isValid;\n\n return isValid;\n}\n\nfunction validatePushNotificationOptions(options: CustomerIOPluginPushNotificationOptions): boolean {\n const context = 'PushNotification';\n\n let isValid = true;\n\n const appGroupId = options.appGroupId;\n if (appGroupId !== undefined) {\n isValid = validateString(appGroupId, 'appGroupId', context) && isValid;\n if (isValid && !appGroupId.startsWith('group.')) {\n logger.warn(`${context}: appGroupId \"${appGroupId}\" does not start with \"group.\" — ensure this matches your Apple App Group entitlement.`);\n }\n }\n\n return isValid;\n}\n\nexport {\n validateNativeSDKConfig,\n validatePushNotificationOptions,\n validateRequired,\n validateRichPushConfig,\n validateString\n};\n\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,UAAU;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAACC,OAAsB,EAAEC,cAA4B,EAAW;EAC/E,IAAID,OAAO,CAAC,CAAC,EAAE;IACb,OAAO,IAAI;EACb;;EAEA;EACA,MAAME,OAAO,GAAGD,cAAc,CAAC,CAAC;EAChC;EACA,IAAIE,OAAO,CAACC,GAAG,CAACC,sBAAsB,KAAK,MAAM,EAAE;IACjD,MAAM,IAAIC,KAAK,CAACR,MAAM,CAACS,MAAM,CAACL,OAAO,CAAC,CAAC;EACzC,CAAC,MAAM;IACLJ,MAAM,CAACU,IAAI,CAACN,OAAO,CAAC;EACtB;EACA,OAAO,KAAK;AACd;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0C,UAAU,CAACC,UAAU,CAAC,QAAQ,CAAC,EAAE;MAC/C7C,MAAM,CAACU,IAAI,CAAC,GAAGM,OAAO,iBAAiB4B,UAAU,wFAAwF,CAAC;IAC5I;EACF;EAEA,OAAO1C,OAAO;AAChB;AAEA,SACE6B,uBAAuB,EACvBW,+BAA+B,EAC/B5B,gBAAgB,EAChB2B,sBAAsB,EACtBxB,cAAc","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import type { CustomerIOPluginOptionsAndroid, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
-
export declare function withCIOAndroid(config: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsAndroid): ExpoConfig;
|
|
2
|
+
import type { CustomerIOPluginOptionsAndroid, CustomerIOPluginLocationOptions, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
+
export declare function withCIOAndroid(config: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsAndroid, location?: CustomerIOPluginLocationOptions): ExpoConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { CustomerIOPluginLocationOptions } from '../types/cio-types';
|
|
3
|
+
/**
|
|
4
|
+
* Adds or updates customerio_location_enabled in android/gradle.properties when location.enabled is true.
|
|
5
|
+
* The Customer.io React Native SDK reads this to enable the location native module.
|
|
6
|
+
*/
|
|
7
|
+
export declare const withLocationGradleProperties: ConfigPlugin<{
|
|
8
|
+
location?: CustomerIOPluginLocationOptions;
|
|
9
|
+
}>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
import type { NativeSDKConfig } from '../types/cio-types';
|
|
3
|
-
|
|
2
|
+
import type { CustomerIOPluginLocationOptions, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
+
type MainApplicationModParams = {
|
|
4
|
+
sdkConfig: NativeSDKConfig;
|
|
5
|
+
location?: CustomerIOPluginLocationOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare const withMainApplicationModifications: ConfigPlugin<MainApplicationModParams>;
|
|
8
|
+
export {};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';
|
|
2
|
-
export
|
|
2
|
+
export type InjectCIOPodfileOptions = {
|
|
3
|
+
/** When true, add the location subspec. When false/omit, use single push subspec only. */
|
|
4
|
+
locationEnabled?: boolean;
|
|
5
|
+
/** When false and locationEnabled, inject only :subspecs => ['location']. When true, use push + location. */
|
|
6
|
+
hasPush?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** Builds the host app pod line for the Podfile (single subspec or :subspecs with location). Exported for tests. */
|
|
9
|
+
export declare function buildHostAppPodSnippet(iosPath: string, isFcmPushProvider: boolean, options?: InjectCIOPodfileOptions): string;
|
|
10
|
+
export declare function injectCIOPodfileCode(iosPath: string, isFcmPushProvider: boolean, options?: InjectCIOPodfileOptions): Promise<void>;
|
|
3
11
|
export declare function injectCIONotificationPodfileCode(iosPath: string, useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks'], isFcmPushProvider: boolean): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LocationTrackingMode } from '../../types/cio-types';
|
|
2
|
+
import { type Platform } from '../constants/common';
|
|
3
|
+
/** Options for location module in generated native initializer */
|
|
4
|
+
export type LocationInitOptions = {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
trackingMode?: LocationTrackingMode;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Replaces {{LOCATION_MODULE_IMPORT}} and {{LOCATION_MODULE_INIT}} placeholders
|
|
10
|
+
* in SDK initializer template content for the given platform.
|
|
11
|
+
*/
|
|
12
|
+
export declare function patchLocationPlaceholders(content: string, platform: Platform, locationOptions?: LocationInitOptions): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { NativeSDKConfig } from '../../types/cio-types';
|
|
2
2
|
import { type Platform } from '../constants/common';
|
|
3
|
+
import { type LocationInitOptions } from './patchLocationCode';
|
|
4
|
+
export type { LocationInitOptions };
|
|
3
5
|
/**
|
|
4
6
|
* Shared utility function to perform common SDK config replacements
|
|
5
7
|
* for both iOS and Android template files
|
|
6
8
|
*/
|
|
7
|
-
export declare function patchNativeSDKInitializer(rawContent: string, platform: Platform, sdkConfig: NativeSDKConfig): string;
|
|
9
|
+
export declare function patchNativeSDKInitializer(rawContent: string, platform: Platform, sdkConfig: NativeSDKConfig, locationOptions?: LocationInitOptions): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import type { CustomerIOPluginOptions } from './types/cio-types';
|
|
2
|
+
import type { CustomerIOPluginOptions, LocationTrackingMode, NativeSDKConfig } from './types/cio-types';
|
|
3
|
+
export type { LocationTrackingMode, NativeSDKConfig };
|
|
3
4
|
declare function withCustomerIOPlugin(config: ExpoConfig, props: CustomerIOPluginOptions): ExpoConfig;
|
|
4
5
|
export default withCustomerIOPlugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import type { CustomerIOPluginOptionsIOS, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
-
export declare function withCIOIos(config: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsIOS): ExpoConfig;
|
|
2
|
+
import type { CustomerIOPluginOptionsIOS, CustomerIOPluginLocationOptions, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
+
export declare function withCIOIos(config: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsIOS, location?: CustomerIOPluginLocationOptions): ExpoConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import type { CustomerIOPluginOptionsIOS, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
-
export declare const withCIOIosSwift: (configOuter: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsIOS) => ExpoConfig;
|
|
2
|
+
import type { CustomerIOPluginOptionsIOS, CustomerIOPluginLocationOptions, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
+
export declare const withCIOIosSwift: (configOuter: ExpoConfig, sdkConfig?: NativeSDKConfig, props?: CustomerIOPluginOptionsIOS, location?: CustomerIOPluginLocationOptions) => ExpoConfig;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { type InjectCIOPodfileOptions } from '../helpers/utils/injectCIOPodfileCode';
|
|
2
3
|
import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
|
|
3
|
-
export
|
|
4
|
+
export type WithCioXcodeProjectOptions = {
|
|
5
|
+
/** Options for Podfile host app snippet (location subspec, etc.) */
|
|
6
|
+
podfileOptions?: InjectCIOPodfileOptions;
|
|
7
|
+
};
|
|
8
|
+
/** Props for the CIO Xcode project mod; push options are optional when only location is enabled. */
|
|
9
|
+
export type WithCioXcodeProjectProps = Partial<CustomerIOPluginOptionsIOS> & WithCioXcodeProjectOptions;
|
|
10
|
+
export declare const withCioXcodeProject: ConfigPlugin<WithCioXcodeProjectProps>;
|
|
@@ -76,6 +76,12 @@ export type CustomerIOPluginOptionsAndroid = {
|
|
|
76
76
|
*/
|
|
77
77
|
disableAndroid16Support?: boolean;
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Location tracking mode for the Customer.io SDK location module.
|
|
81
|
+
* Location is off by default. Only used when location is enabled (plugin option location.enabled: true).
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
export type LocationTrackingMode = 'OFF' | 'MANUAL' | 'ON_APP_START';
|
|
79
85
|
/**
|
|
80
86
|
* SDK configuration options for auto initialization
|
|
81
87
|
* @public
|
|
@@ -89,6 +95,23 @@ export type NativeSDKConfig = {
|
|
|
89
95
|
logLevel?: 'none' | 'error' | 'info' | 'debug';
|
|
90
96
|
siteId?: string;
|
|
91
97
|
migrationSiteId?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Location module config. Location is off by default; only applied when plugin option location.enabled is true.
|
|
100
|
+
* trackingMode: 'MANUAL' (host app controls when location is captured, default),
|
|
101
|
+
* 'ON_APP_START' (SDK captures once per launch when app becomes active), or 'OFF'.
|
|
102
|
+
*/
|
|
103
|
+
location?: {
|
|
104
|
+
trackingMode?: LocationTrackingMode;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Location is off by default. When true, enables the Customer.io SDK location native module (iOS Podfile location subspec,
|
|
109
|
+
* Android gradle.properties flag). Permissions and privacy keys (Info.plist, AndroidManifest)
|
|
110
|
+
* remain the host app's responsibility.
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
export type CustomerIOPluginLocationOptions = {
|
|
114
|
+
enabled?: boolean;
|
|
92
115
|
};
|
|
93
116
|
/**
|
|
94
117
|
* Combined plugin options for both iOS and Android platforms
|
|
@@ -98,6 +121,11 @@ export type CustomerIOPluginOptions = {
|
|
|
98
121
|
config?: NativeSDKConfig;
|
|
99
122
|
android: CustomerIOPluginOptionsAndroid;
|
|
100
123
|
ios: CustomerIOPluginOptionsIOS;
|
|
124
|
+
/**
|
|
125
|
+
* Location is off by default. When location.enabled is true, the plugin adds SDK build-time setup (Podfile location subspec,
|
|
126
|
+
* gradle.properties). Host apps must add their own location permissions and privacy usage strings.
|
|
127
|
+
*/
|
|
128
|
+
location?: CustomerIOPluginLocationOptions;
|
|
101
129
|
};
|
|
102
130
|
/**
|
|
103
131
|
* Rich push configuration used to initialize Notification Service Extension (NSE) on the native side
|
|
@@ -125,4 +153,11 @@ export type CustomerIOPluginPushNotificationOptions = {
|
|
|
125
153
|
* Optional if `config` is provided at the top level.
|
|
126
154
|
*/
|
|
127
155
|
env?: RichPushConfig;
|
|
156
|
+
/**
|
|
157
|
+
* iOS App Group identifier shared between the host app and the Notification Service Extension.
|
|
158
|
+
* When set, `.appGroupId(...)` is injected into the MessagingPushConfigBuilder, the identifier
|
|
159
|
+
* is added to the host app entitlements, and an NSE entitlements file is written.
|
|
160
|
+
* When omitted, the native SDK handles group discovery on its own and no entitlements are added.
|
|
161
|
+
*/
|
|
162
|
+
appGroupId?: string;
|
|
128
163
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { NativeSDKConfig, RichPushConfig } from '../types/cio-types';
|
|
1
|
+
import type { CustomerIOPluginPushNotificationOptions, NativeSDKConfig, RichPushConfig } from '../types/cio-types';
|
|
2
2
|
declare function validateRequired(value: unknown, fieldName: string, context: string): boolean;
|
|
3
3
|
declare function validateString(value: unknown, fieldName: string, context: string): boolean;
|
|
4
4
|
declare function validateNativeSDKConfig(config: NativeSDKConfig): boolean;
|
|
5
5
|
declare function validateRichPushConfig(config: RichPushConfig | undefined): boolean;
|
|
6
|
-
|
|
6
|
+
declare function validatePushNotificationOptions(options: CustomerIOPluginPushNotificationOptions): boolean;
|
|
7
|
+
export { validateNativeSDKConfig, validatePushNotificationOptions, validateRequired, validateRichPushConfig, validateString };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
CustomerIOPluginOptionsAndroid,
|
|
5
|
+
CustomerIOPluginLocationOptions,
|
|
6
|
+
NativeSDKConfig,
|
|
7
|
+
} from '../types/cio-types';
|
|
4
8
|
import { withAndroidManifestUpdates } from './withAndroidManifestUpdates';
|
|
5
9
|
import { withAppGoogleServices } from './withAppGoogleServices';
|
|
6
10
|
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
11
|
+
import { withLocationGradleProperties } from './withLocationGradleProperties';
|
|
7
12
|
import { withMainApplicationModifications } from './withMainApplicationModifications';
|
|
8
13
|
import { withNotificationChannelMetadata } from './withNotificationChannelMetadata';
|
|
9
14
|
import { withProjectBuildGradle } from './withProjectBuildGradle';
|
|
@@ -14,6 +19,7 @@ export function withCIOAndroid(
|
|
|
14
19
|
config: ExpoConfig,
|
|
15
20
|
sdkConfig?: NativeSDKConfig,
|
|
16
21
|
props?: CustomerIOPluginOptionsAndroid,
|
|
22
|
+
location?: CustomerIOPluginLocationOptions,
|
|
17
23
|
): ExpoConfig {
|
|
18
24
|
// Only run notification setup if props are provided
|
|
19
25
|
if (props) {
|
|
@@ -30,7 +36,7 @@ export function withCIOAndroid(
|
|
|
30
36
|
|
|
31
37
|
// Add auto initialization if sdkConfig is provided
|
|
32
38
|
if (sdkConfig) {
|
|
33
|
-
config = withMainApplicationModifications(config, sdkConfig);
|
|
39
|
+
config = withMainApplicationModifications(config, { sdkConfig, location });
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
// Update project strings for user agent metadata
|
|
@@ -40,5 +46,10 @@ export function withCIOAndroid(
|
|
|
40
46
|
// This prevents androidx versions that require API 36 from being pulled in
|
|
41
47
|
config = withProjectBuildGradle(config, props);
|
|
42
48
|
|
|
49
|
+
// Enable SDK location module when location.enabled is true
|
|
50
|
+
if (location?.enabled === true) {
|
|
51
|
+
config = withLocationGradleProperties(config, { location });
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
return config;
|
|
44
55
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { withGradleProperties } from '@expo/config-plugins';
|
|
3
|
+
import type { PropertiesItem } from '@expo/config-plugins/build/android/Properties';
|
|
4
|
+
|
|
5
|
+
import type { CustomerIOPluginLocationOptions } from '../types/cio-types';
|
|
6
|
+
|
|
7
|
+
const CUSTOMERIO_LOCATION_ENABLED_KEY = 'customerio_location_enabled';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Adds or updates customerio_location_enabled in android/gradle.properties when location.enabled is true.
|
|
11
|
+
* The Customer.io React Native SDK reads this to enable the location native module.
|
|
12
|
+
*/
|
|
13
|
+
export const withLocationGradleProperties: ConfigPlugin<{
|
|
14
|
+
location?: CustomerIOPluginLocationOptions;
|
|
15
|
+
}> = (config, props) => {
|
|
16
|
+
if (props?.location?.enabled !== true) {
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return withGradleProperties(config, (config) => {
|
|
21
|
+
const items = config.modResults as PropertiesItem[];
|
|
22
|
+
const existingIndex = items.findIndex(
|
|
23
|
+
(item) => item.type === 'property' && item.key === CUSTOMERIO_LOCATION_ENABLED_KEY
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const newItem: PropertiesItem = {
|
|
27
|
+
type: 'property',
|
|
28
|
+
key: CUSTOMERIO_LOCATION_ENABLED_KEY,
|
|
29
|
+
value: 'true',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (existingIndex >= 0) {
|
|
33
|
+
items[existingIndex] = newItem;
|
|
34
|
+
} else {
|
|
35
|
+
items.push(newItem);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
config.modResults = items;
|
|
39
|
+
return config;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -4,24 +4,45 @@ import type { ApplicationProjectFile } from '@expo/config-plugins/build/android/
|
|
|
4
4
|
import { CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_CALL, CIO_NATIVE_SDK_INITIALIZE_SNIPPET } from '../helpers/constants/android';
|
|
5
5
|
import { PLATFORM } from '../helpers/constants/common';
|
|
6
6
|
import { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
CustomerIOPluginLocationOptions,
|
|
9
|
+
NativeSDKConfig,
|
|
10
|
+
} from '../types/cio-types';
|
|
8
11
|
import { addCodeToMethod, addImportToFile, copyTemplateFile } from '../utils/android';
|
|
9
12
|
import { logger } from '../utils/logger';
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
type MainApplicationModParams = {
|
|
15
|
+
sdkConfig: NativeSDKConfig;
|
|
16
|
+
location?: CustomerIOPluginLocationOptions;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const withMainApplicationModifications: ConfigPlugin<MainApplicationModParams> = (configOuter, { sdkConfig, location }) => {
|
|
12
20
|
return withMainApplication(configOuter, async (config) => {
|
|
13
|
-
const content = setupCustomerIOSDKInitializer(config, sdkConfig);
|
|
21
|
+
const content = setupCustomerIOSDKInitializer(config, sdkConfig, location);
|
|
14
22
|
config.modResults.contents = content;
|
|
15
23
|
return config;
|
|
16
24
|
});
|
|
17
25
|
};
|
|
18
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Build location options for native initializer from plugin config.
|
|
29
|
+
* trackingMode comes from config.location.trackingMode (only used when location.enabled is true).
|
|
30
|
+
*/
|
|
31
|
+
const getLocationInitOptions = (
|
|
32
|
+
location?: CustomerIOPluginLocationOptions,
|
|
33
|
+
sdkConfig?: NativeSDKConfig
|
|
34
|
+
) => ({
|
|
35
|
+
enabled: location?.enabled === true,
|
|
36
|
+
trackingMode: sdkConfig?.location?.trackingMode,
|
|
37
|
+
});
|
|
38
|
+
|
|
19
39
|
/**
|
|
20
40
|
* Setup CustomerIOSDKInitializer for Android auto initialization
|
|
21
41
|
*/
|
|
22
42
|
const setupCustomerIOSDKInitializer = (
|
|
23
43
|
config: ExportedConfigWithProps<ApplicationProjectFile>,
|
|
24
44
|
sdkConfig: NativeSDKConfig,
|
|
45
|
+
location?: CustomerIOPluginLocationOptions,
|
|
25
46
|
): string => {
|
|
26
47
|
const SDK_INITIALIZER_CLASS = 'CustomerIOSDKInitializer';
|
|
27
48
|
const SDK_INITIALIZER_PACKAGE = 'io.customer.sdk.expo';
|
|
@@ -29,12 +50,13 @@ const setupCustomerIOSDKInitializer = (
|
|
|
29
50
|
const SDK_INITIALIZER_FILE = `${SDK_INITIALIZER_CLASS}.kt`;
|
|
30
51
|
const SDK_INITIALIZER_IMPORT = `import ${SDK_INITIALIZER_PACKAGE}.${SDK_INITIALIZER_CLASS}`;
|
|
31
52
|
|
|
53
|
+
const locationOptions = getLocationInitOptions(location, sdkConfig);
|
|
32
54
|
let content = config.modResults.contents;
|
|
33
55
|
|
|
34
56
|
try {
|
|
35
57
|
// Always regenerate the CustomerIOSDKInitializer file to reflect config changes
|
|
36
58
|
copyTemplateFile(config, SDK_INITIALIZER_FILE, SDK_INITIALIZER_PACKAGE, (content) =>
|
|
37
|
-
patchNativeSDKInitializer(content, PLATFORM.ANDROID, sdkConfig)
|
|
59
|
+
patchNativeSDKInitializer(content, PLATFORM.ANDROID, sdkConfig, locationOptions)
|
|
38
60
|
);
|
|
39
61
|
// Add import if not already present
|
|
40
62
|
content = addImportToFile(content, SDK_INITIALIZER_IMPORT);
|
|
@@ -7,6 +7,7 @@ import io.customer.messaginginapp.ModuleMessagingInApp
|
|
|
7
7
|
import io.customer.messagingpush.MessagingPushModuleConfig
|
|
8
8
|
import io.customer.messagingpush.ModuleMessagingPushFCM
|
|
9
9
|
import io.customer.reactnative.sdk.messaginginapp.ReactInAppEventListener
|
|
10
|
+
{{LOCATION_MODULE_IMPORT}}
|
|
10
11
|
import io.customer.sdk.CustomerIOBuilder
|
|
11
12
|
import io.customer.sdk.core.util.CioLogLevel
|
|
12
13
|
import io.customer.sdk.data.model.Region
|
|
@@ -41,6 +42,7 @@ object CustomerIOSDKInitializer {
|
|
|
41
42
|
MessagingPushModuleConfig.Builder().build()
|
|
42
43
|
)
|
|
43
44
|
)
|
|
45
|
+
{{LOCATION_MODULE_INIT}}
|
|
44
46
|
|
|
45
47
|
build()
|
|
46
48
|
}
|