customerio-expo-plugin 2.5.0 → 2.7.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 +13 -31
- package/plugin/app.plugin.js +1 -1
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +56 -15
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/commonjs/android/withCIOAndroid.js +7 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +45 -0
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -0
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js +1 -1
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectStrings.js +14 -7
- package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/android.js +7 -1
- package/plugin/lib/commonjs/helpers/constants/android.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/common.js +18 -0
- package/plugin/lib/commonjs/helpers/constants/common.js.map +1 -0
- package/plugin/lib/commonjs/helpers/constants/ios.js +7 -7
- package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/commonjs/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +2 -2
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js +62 -0
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js.map +1 -0
- package/plugin/lib/commonjs/index.js +13 -2
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/utils.js +1 -1
- package/plugin/lib/commonjs/ios/utils.js.map +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +17 -11
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +133 -49
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +17 -19
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/postInstallHelper.js.map +1 -1
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/commonjs/utils/android.js +109 -0
- package/plugin/lib/commonjs/utils/android.js.map +1 -0
- package/plugin/lib/commonjs/utils/config.js +43 -0
- package/plugin/lib/commonjs/utils/config.js.map +1 -0
- package/plugin/lib/commonjs/utils/plugin.js +49 -0
- package/plugin/lib/commonjs/utils/plugin.js.map +1 -0
- package/plugin/lib/commonjs/utils/validation.js +44 -0
- package/plugin/lib/commonjs/utils/validation.js.map +1 -0
- package/plugin/lib/commonjs/utils/xcode.js +67 -0
- package/plugin/lib/commonjs/utils/xcode.js.map +1 -0
- package/plugin/lib/module/android/withAndroidManifestUpdates.js +55 -14
- package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +7 -2
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/module/android/withMainApplicationModifications.js +38 -0
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -0
- package/plugin/lib/module/android/withNotificationChannelMetadata.js +1 -1
- package/plugin/lib/module/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/module/android/withProjectStrings.js +13 -6
- package/plugin/lib/module/android/withProjectStrings.js.map +1 -1
- package/plugin/lib/module/helpers/constants/android.js +6 -0
- package/plugin/lib/module/helpers/constants/android.js.map +1 -1
- package/plugin/lib/module/helpers/constants/common.js +12 -0
- package/plugin/lib/module/helpers/constants/common.js.map +1 -0
- package/plugin/lib/module/helpers/constants/ios.js +6 -6
- package/plugin/lib/module/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/module/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/lib/module/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +2 -2
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js +57 -0
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js.map +1 -0
- package/plugin/lib/module/index.js +14 -2
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/utils.js +1 -2
- package/plugin/lib/module/ios/utils.js.map +1 -1
- package/plugin/lib/module/ios/withAppDelegateModifications.js +3 -3
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +17 -11
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +134 -50
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +2 -2
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +18 -20
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/module/postInstallHelper.js.map +1 -1
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/module/utils/android.js +100 -0
- package/plugin/lib/module/utils/android.js.map +1 -0
- package/plugin/lib/module/utils/config.js +38 -0
- package/plugin/lib/module/utils/config.js.map +1 -0
- package/plugin/lib/module/utils/plugin.js +38 -0
- package/plugin/lib/module/utils/plugin.js.map +1 -0
- package/plugin/lib/module/utils/validation.js +39 -0
- package/plugin/lib/module/utils/validation.js.map +1 -0
- package/plugin/lib/module/utils/xcode.js +60 -0
- package/plugin/lib/module/utils/xcode.js.map +1 -0
- package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +1 -0
- package/plugin/lib/typescript/android/withCIOAndroid.d.ts +2 -2
- package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +3 -0
- package/plugin/lib/typescript/android/withProjectStrings.d.ts +2 -1
- package/plugin/lib/typescript/helpers/constants/android.d.ts +3 -0
- package/plugin/lib/typescript/helpers/constants/common.d.ts +11 -0
- package/plugin/lib/typescript/helpers/constants/ios.d.ts +3 -1
- package/plugin/lib/typescript/helpers/utils/patchPluginNativeCode.d.ts +7 -0
- package/plugin/lib/typescript/ios/utils.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIos.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +3 -3
- package/plugin/lib/typescript/types/cio-types.d.ts +46 -6
- package/plugin/lib/typescript/utils/android.d.ts +5 -0
- package/plugin/lib/typescript/utils/config.d.ts +8 -0
- package/plugin/lib/typescript/utils/plugin.d.ts +4 -0
- package/plugin/lib/typescript/utils/validation.d.ts +3 -0
- package/plugin/lib/typescript/utils/xcode.d.ts +28 -0
- package/plugin/src/android/withAndroidManifestUpdates.ts +70 -21
- package/plugin/src/android/withCIOAndroid.ts +8 -2
- package/plugin/src/android/withGoogleServicesJSON.ts +2 -2
- package/plugin/src/android/withMainApplicationModifications.ts +50 -0
- package/plugin/src/android/withNotificationChannelMetadata.ts +7 -3
- package/plugin/src/android/withProjectStrings.ts +20 -10
- package/plugin/src/helpers/constants/android.ts +7 -0
- package/plugin/src/helpers/constants/common.ts +12 -0
- package/plugin/src/helpers/constants/ios.ts +11 -13
- package/plugin/src/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/src/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +8 -7
- package/plugin/src/helpers/utils/patchPluginNativeCode.ts +97 -0
- package/plugin/src/index.ts +18 -2
- package/plugin/src/ios/utils.ts +5 -5
- package/plugin/src/ios/withAppDelegateModifications.ts +11 -8
- package/plugin/src/ios/withCIOIos.ts +19 -11
- package/plugin/src/ios/withCIOIosSwift.ts +195 -73
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +7 -10
- package/plugin/src/ios/withNotificationsXcodeProject.ts +25 -26
- package/plugin/src/ios/withXcodeProject.ts +1 -1
- package/plugin/src/postInstallHelper.js +1 -1
- package/plugin/src/types/cio-types.ts +48 -8
- package/plugin/src/utils/android.ts +112 -0
- package/plugin/src/utils/config.ts +53 -0
- package/plugin/src/utils/plugin.ts +46 -0
- package/plugin/src/utils/validation.ts +54 -0
- package/plugin/src/utils/xcode.ts +74 -0
- package/plugin/lib/commonjs/helpers/constants/globals.d.js +0 -2
- package/plugin/lib/commonjs/helpers/constants/globals.d.js.map +0 -1
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +0 -26
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +0 -1
- package/plugin/lib/module/helpers/constants/globals.d.js +0 -2
- package/plugin/lib/module/helpers/constants/globals.d.js.map +0 -1
- package/plugin/lib/module/helpers/utils/pluginUtils.js +0 -19
- package/plugin/lib/module/helpers/utils/pluginUtils.js.map +0 -1
- package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +0 -4
- package/plugin/src/helpers/constants/globals.d.ts +0 -8
- package/plugin/src/helpers/utils/pluginUtils.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","CIO_NOTIFICATION_TARGET_NAME","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","DEFAULT_BUNDLE_VERSION","LOCAL_PATH_TO_CIO_NSE_FILES","replaceCodeByRegex","injectCIONotificationPodfileCode","FileManagement","isExpoVersion53OrHigher","isFcmPushProvider","PLIST_FILENAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","iosPath","appName","modifiedProjectFile","modResults","isFcmProvider","pbxTargetByName","warn","nsePath","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","objects","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","writeFile","envFileName","_options$pushNotifica2","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","env","regionMap","us","eu","mappedRegion","toLowerCase","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n LOCAL_PATH_TO_CIO_NSE_FILES,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject,\n isExpoVersion53OrHigher: boolean\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpoVersion53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter)\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${\n isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\n projObjects['PBXTargetDependency'] || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey\n );\n\n if (region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const mappedRegion = (regionMap as any)[region.toLowerCase()] || '';\n if (!mappedRegion) {\n console.warn(\n `${region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? 'fcm' : 'apn'}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AAEvD,SACEC,4BAA4B,EAC5BC,qCAAqC,EACrCC,sBAAsB,EACtBC,2BAA2B,QACtB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,uBAAuB,EAAEC,iBAAiB,QAAQ,SAAS;AAEpE,MAAMC,cAAc,GAAG,GAAGT,4BAA4B,aAAa;AACnE,MAAMU,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,EAC1BP,uBAAgC,KAC7B;EACH,IAAI;IAAA,IAAAQ,qBAAA;IACF;IACA,IAAIF,OAAO,CAACG,gBAAgB,IAAI,CAACT,uBAAuB,EAAE;MACxD,MAAMU,uBAAuB,CAACJ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EAEDzH,cAAc,CAACsF,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","getIosNativeFilesPath","FileManagement","isExpoVersion53OrHigher","isFcmPushProvider","PLIST_FILENAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","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","regionMap","us","eu","mappedRegion","toLowerCase","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","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 { getIosNativeFilesPath } from '../utils/plugin';\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 console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const { appleTeamId, iosDeploymentTarget, useFrameworks } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter),\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: 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 console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = ['NotificationService.swift'];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${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 console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n 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 (!cdpApiKey) {\n throw new Error(\n 'NotificationServiceExtension failed: cdpApiKey missing. Provide in config.cdpApiKey or ios.pushNotification.env.cdpApiKey.'\n );\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey\n );\n\n if (region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const mappedRegion =\n regionMap[region.toLowerCase() as keyof typeof regionMap] || '';\n if (!mappedRegion) {\n console.warn(\n `${region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: 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 console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const { cdpApiKey, region } = options.pushNotification?.env || {\n cdpApiKey: undefined,\n region: undefined,\n };\n if (!cdpApiKey) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.pushNotification.env.cdpApiKey is missing from app.config.js or app.json.'\n );\n }\n\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AACA,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,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,uBAAuB,EAAEC,iBAAiB,QAAQ,SAAS;AAEpE,MAAMC,cAAc,GAAG,GAAGT,4BAA4B,aAAa;AACnE,MAAMU,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,EAC1BC,gBAAyB,KACtB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,IAAIH,OAAO,CAACI,gBAAgB,IAAI,CAACF,gBAAgB,EAAE;MACjD,MAAMG,uBAAuB,CAACL,OAAO,EAAEC,YAAY,CAAC;IACtD;IAEA,IAAI,EAAAE,qBAAA,GAAAH,OAAO,CAAC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S,CAACC,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withXcodeProject } from '@expo/config-plugins';
|
|
2
|
-
import { isFcmPushProvider } from './utils';
|
|
3
2
|
import { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';
|
|
3
|
+
import { isFcmPushProvider } from './utils';
|
|
4
4
|
export const withCioXcodeProject = (config, cioProps) => {
|
|
5
5
|
return withXcodeProject(config, async props => {
|
|
6
6
|
const iosPath = props.modRequest.platformProjectRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","
|
|
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 { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const iosPath = props.modRequest.platformProjectRoot;\n\n await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps));\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AAEvD,SAASC,oBAAoB,QAAQ,uCAAuC;AAE5E,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,OAAO,MAAMC,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAOL,gBAAgB,CAACI,MAAM,EAAE,MAAOE,KAAK,IAAK;IAC/C,MAAMC,OAAO,GAAGD,KAAK,CAACE,UAAU,CAACC,mBAAmB;IAEpD,MAAMR,oBAAoB,CAACM,OAAO,EAAEL,iBAAiB,CAACG,QAAQ,CAAC,CAAC;IAEhE,OAAOC,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fs","require","runPostInstall","reactNativePackageJsonFile","__dirname","expoPackageJsonFile","existsSync","reactNativePackageJson","readFileSync","expoPackageJson","reactNativePackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","console","warn","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const reactNativePackageJsonFile = `${__dirname}/../../../customerio-reactnative/package.json`;\n const expoPackageJsonFile = `${__dirname}/../../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(reactNativePackageJsonFile)) {\n const reactNativePackageJson = fs.readFileSync(\n reactNativePackageJsonFile,\n 'utf8'\n );\n const expoPackageJson = require(expoPackageJsonFile);\n\n const reactNativePackage = JSON.parse(reactNativePackageJson);\n reactNativePackage.expoVersion = expoPackageJson.version;\n\n fs.writeFileSync(\n reactNativePackageJsonFile,\n JSON.stringify(reactNativePackage, null, 2)\n );\n }\n } catch (error) {\n console.warn(\n 'Unable to find customerio-reactnative package.json file. Please make sure you have installed the customerio-reactnative package.',\n error\n );\n }\n}\n\nexports.runPostInstall = runPostInstall
|
|
1
|
+
{"version":3,"names":["fs","require","runPostInstall","reactNativePackageJsonFile","__dirname","expoPackageJsonFile","existsSync","reactNativePackageJson","readFileSync","expoPackageJson","reactNativePackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","console","warn","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const reactNativePackageJsonFile = `${__dirname}/../../../customerio-reactnative/package.json`;\n const expoPackageJsonFile = `${__dirname}/../../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(reactNativePackageJsonFile)) {\n const reactNativePackageJson = fs.readFileSync(\n reactNativePackageJsonFile,\n 'utf8'\n );\n const expoPackageJson = require(expoPackageJsonFile);\n\n const reactNativePackage = JSON.parse(reactNativePackageJson);\n reactNativePackage.expoVersion = expoPackageJson.version;\n\n fs.writeFileSync(\n reactNativePackageJsonFile,\n JSON.stringify(reactNativePackage, null, 2)\n );\n }\n } catch (error) {\n console.warn(\n 'Unable to find customerio-reactnative package.json file. Please make sure you have installed the customerio-reactnative package.',\n error\n );\n }\n}\n\nexports.runPostInstall = runPostInstall;\n"],"mappings":"AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,0BAA0B,GAAG,GAAGC,SAAS,+CAA+C;EAC9F,MAAMC,mBAAmB,GAAG,GAAGD,SAAS,qBAAqB;EAC7D,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,0BAA0B,CAAC,EAAE;MAC7C,MAAMI,sBAAsB,GAAGP,EAAE,CAACQ,YAAY,CAC5CL,0BAA0B,EAC1B,MACF,CAAC;MACD,MAAMM,eAAe,GAAGR,OAAO,CAACI,mBAAmB,CAAC;MAEpD,MAAMK,kBAAkB,GAAGC,IAAI,CAACC,KAAK,CAACL,sBAAsB,CAAC;MAC7DG,kBAAkB,CAACG,WAAW,GAAGJ,eAAe,CAACK,OAAO;MAExDd,EAAE,CAACe,aAAa,CACdZ,0BAA0B,EAC1BQ,IAAI,CAACK,SAAS,CAACN,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAC5C,CAAC;IACH;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CACV,kIAAkI,EAClIF,KACF,CAAC;EACH;AACF;AAEAG,OAAO,CAAClB,cAAc,GAAGA,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["
|
|
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\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":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { FileManagement } from '../helpers/utils/fileManagement';
|
|
3
|
+
import { getAndroidNativeFilesPath } from './plugin';
|
|
4
|
+
|
|
5
|
+
// Generic utility to add import to Kotlin files
|
|
6
|
+
export const addImportToFile = (content, importStatement) => {
|
|
7
|
+
if (content.includes(importStatement)) {
|
|
8
|
+
return content;
|
|
9
|
+
}
|
|
10
|
+
const importRegex = /^import\s+[^\s\n]+.*$/gm;
|
|
11
|
+
const imports = [...content.matchAll(importRegex)];
|
|
12
|
+
if (imports.length === 0) {
|
|
13
|
+
const packageRegex = /package\s+[^\s;]+[;\s]*\n/;
|
|
14
|
+
const packageMatch = content.match(packageRegex);
|
|
15
|
+
if (!packageMatch) return content;
|
|
16
|
+
const insertPosition = (packageMatch.index ?? 0) + packageMatch[0].length;
|
|
17
|
+
return content.substring(0, insertPosition) + `\n${importStatement}\n` + content.substring(insertPosition);
|
|
18
|
+
}
|
|
19
|
+
const lastImport = imports[imports.length - 1];
|
|
20
|
+
const insertPosition = (lastImport.index ?? 0) + lastImport[0].length;
|
|
21
|
+
return content.substring(0, insertPosition) + `\n\n${importStatement}` + content.substring(insertPosition);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Find matching bracket position (simplified version inspired by the library method)
|
|
25
|
+
const findMatchingBracketPosition = (content, bracket, startPos) => {
|
|
26
|
+
const openBracket = bracket;
|
|
27
|
+
const closeBracket = bracket === '{' ? '}' : bracket === '(' ? ')' : ']';
|
|
28
|
+
let depth = 0;
|
|
29
|
+
let foundOpen = false;
|
|
30
|
+
for (let i = startPos; i < content.length; i++) {
|
|
31
|
+
const char = content[i];
|
|
32
|
+
if (char === openBracket) {
|
|
33
|
+
foundOpen = true;
|
|
34
|
+
depth++;
|
|
35
|
+
} else if (char === closeBracket) {
|
|
36
|
+
depth--;
|
|
37
|
+
if (foundOpen && depth === 0) {
|
|
38
|
+
return i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return -1;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Generic utility to add code to end of a method (before closing brace)
|
|
46
|
+
export const addCodeToMethod = (content, methodRegex, codeToAdd) => {
|
|
47
|
+
const methodMatch = content.match(methodRegex);
|
|
48
|
+
if (!methodMatch || methodMatch.index === undefined) return content;
|
|
49
|
+
const methodStart = methodMatch.index;
|
|
50
|
+
const methodContent = methodMatch[0];
|
|
51
|
+
|
|
52
|
+
// Find the opening brace position within the method match
|
|
53
|
+
const openBraceIndex = methodContent.indexOf('{');
|
|
54
|
+
if (openBraceIndex === -1) return content;
|
|
55
|
+
|
|
56
|
+
// Find the matching closing brace
|
|
57
|
+
const absoluteOpenBracePos = methodStart + openBraceIndex;
|
|
58
|
+
const closeBracePos = findMatchingBracketPosition(content, '{', absoluteOpenBracePos);
|
|
59
|
+
if (closeBracePos === -1) return content;
|
|
60
|
+
|
|
61
|
+
// Detect indentation of the method's opening brace line
|
|
62
|
+
const linesUpToOpenBrace = content.substring(0, absoluteOpenBracePos).split('\n');
|
|
63
|
+
const braceLine = linesUpToOpenBrace[linesUpToOpenBrace.length - 1];
|
|
64
|
+
const methodIndentMatch = braceLine.match(/^(\s*)/);
|
|
65
|
+
const methodIndent = methodIndentMatch ? methodIndentMatch[1] : '';
|
|
66
|
+
// Assume one indentation level is two spaces if not detected from next line
|
|
67
|
+
let indentLevel = ' ';
|
|
68
|
+
// Try to detect indentation from the next line after the opening brace
|
|
69
|
+
const afterBrace = content.substring(absoluteOpenBracePos + 1, closeBracePos);
|
|
70
|
+
const afterBraceLines = afterBrace.split('\n').filter(l => l.trim().length > 0);
|
|
71
|
+
if (afterBraceLines.length > 0) {
|
|
72
|
+
const nextLineIndentMatch = afterBraceLines[0].match(/^(\s*)/);
|
|
73
|
+
if (nextLineIndentMatch && nextLineIndentMatch[1].length > methodIndent.length) {
|
|
74
|
+
indentLevel = nextLineIndentMatch[1].slice(methodIndent.length);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const finalIndent = methodIndent + indentLevel;
|
|
78
|
+
// Insert code just before the closing brace, with detected indentation
|
|
79
|
+
return content.substring(0, closeBracePos) + '\n' + finalIndent + codeToAdd + '\n' + methodIndent + content.substring(closeBracePos);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Copy template file to Android project with content transformation
|
|
83
|
+
export const copyTemplateFile = (expoConfig, filename, classPackage, patchContent) => {
|
|
84
|
+
const projectRoot = expoConfig.modRequest.projectRoot;
|
|
85
|
+
const mainSourceDir = path.join(projectRoot, 'android/app/src/main/java');
|
|
86
|
+
const packagePath = path.join(mainSourceDir, classPackage.replace(/\./g, '/'));
|
|
87
|
+
try {
|
|
88
|
+
FileManagement.mkdir(packagePath, {
|
|
89
|
+
recursive: true
|
|
90
|
+
});
|
|
91
|
+
const sourcePath = path.join(getAndroidNativeFilesPath(), filename);
|
|
92
|
+
const content = patchContent(FileManagement.readFile(sourcePath));
|
|
93
|
+
const destinationPath = path.join(packagePath, filename);
|
|
94
|
+
FileManagement.writeFile(destinationPath, content);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.warn(`Failed to copy ${filename} to Android project:`, error);
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["path","FileManagement","getAndroidNativeFilesPath","addImportToFile","content","importStatement","includes","importRegex","imports","matchAll","length","packageRegex","packageMatch","match","insertPosition","index","substring","lastImport","findMatchingBracketPosition","bracket","startPos","openBracket","closeBracket","depth","foundOpen","i","char","addCodeToMethod","methodRegex","codeToAdd","methodMatch","undefined","methodStart","methodContent","openBraceIndex","indexOf","absoluteOpenBracePos","closeBracePos","linesUpToOpenBrace","split","braceLine","methodIndentMatch","methodIndent","indentLevel","afterBrace","afterBraceLines","filter","l","trim","nextLineIndentMatch","slice","finalIndent","copyTemplateFile","expoConfig","filename","classPackage","patchContent","projectRoot","modRequest","mainSourceDir","join","packagePath","replace","mkdir","recursive","sourcePath","readFile","destinationPath","writeFile","error","console","warn"],"sources":["android.ts"],"sourcesContent":["import type { ExportedConfigWithProps } from '@expo/config-plugins';\nimport type { ApplicationProjectFile } from '@expo/config-plugins/build/android/Paths';\nimport path from 'path';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport { getAndroidNativeFilesPath } from './plugin';\n\n// Generic utility to add import to Kotlin files\nexport const addImportToFile = (content: string, importStatement: string): string => {\n if (content.includes(importStatement)) {\n return content;\n }\n\n const importRegex = /^import\\s+[^\\s\\n]+.*$/gm;\n const imports = [...content.matchAll(importRegex)];\n\n if (imports.length === 0) {\n const packageRegex = /package\\s+[^\\s;]+[;\\s]*\\n/;\n const packageMatch = content.match(packageRegex);\n if (!packageMatch) return content;\n\n const insertPosition = (packageMatch.index ?? 0) + packageMatch[0].length;\n return content.substring(0, insertPosition) + `\\n${importStatement}\\n` + content.substring(insertPosition);\n }\n\n const lastImport = imports[imports.length - 1];\n const insertPosition = (lastImport.index ?? 0) + lastImport[0].length;\n return content.substring(0, insertPosition) + `\\n\\n${importStatement}` + content.substring(insertPosition);\n};\n\n// Find matching bracket position (simplified version inspired by the library method)\nconst findMatchingBracketPosition = (content: string, bracket: string, startPos: number): number => {\n const openBracket = bracket;\n const closeBracket = bracket === '{' ? '}' : bracket === '(' ? ')' : ']';\n\n let depth = 0;\n let foundOpen = false;\n\n for (let i = startPos; i < content.length; i++) {\n const char = content[i];\n if (char === openBracket) {\n foundOpen = true;\n depth++;\n } else if (char === closeBracket) {\n depth--;\n if (foundOpen && depth === 0) {\n return i;\n }\n }\n }\n return -1;\n};\n\n// Generic utility to add code to end of a method (before closing brace)\nexport const addCodeToMethod = (content: string, methodRegex: RegExp, codeToAdd: string): string => {\n const methodMatch = content.match(methodRegex);\n if (!methodMatch || methodMatch.index === undefined) return content;\n\n const methodStart = methodMatch.index;\n const methodContent = methodMatch[0];\n\n // Find the opening brace position within the method match\n const openBraceIndex = methodContent.indexOf('{');\n if (openBraceIndex === -1) return content;\n\n // Find the matching closing brace\n const absoluteOpenBracePos = methodStart + openBraceIndex;\n const closeBracePos = findMatchingBracketPosition(content, '{', absoluteOpenBracePos);\n if (closeBracePos === -1) return content;\n\n // Detect indentation of the method's opening brace line\n const linesUpToOpenBrace = content.substring(0, absoluteOpenBracePos).split('\\n');\n const braceLine = linesUpToOpenBrace[linesUpToOpenBrace.length - 1];\n const methodIndentMatch = braceLine.match(/^(\\s*)/);\n const methodIndent = methodIndentMatch ? methodIndentMatch[1] : '';\n // Assume one indentation level is two spaces if not detected from next line\n let indentLevel = ' ';\n // Try to detect indentation from the next line after the opening brace\n const afterBrace = content.substring(absoluteOpenBracePos + 1, closeBracePos);\n const afterBraceLines = afterBrace.split('\\n').filter(l => l.trim().length > 0);\n if (afterBraceLines.length > 0) {\n const nextLineIndentMatch = afterBraceLines[0].match(/^(\\s*)/);\n if (nextLineIndentMatch && nextLineIndentMatch[1].length > methodIndent.length) {\n indentLevel = nextLineIndentMatch[1].slice(methodIndent.length);\n }\n }\n const finalIndent = methodIndent + indentLevel;\n // Insert code just before the closing brace, with detected indentation\n return content.substring(0, closeBracePos) + '\\n' + finalIndent + codeToAdd + '\\n' + methodIndent + content.substring(closeBracePos);\n};\n\n// Copy template file to Android project with content transformation\nexport const copyTemplateFile = (\n expoConfig: ExportedConfigWithProps<ApplicationProjectFile>,\n filename: string,\n classPackage: string,\n patchContent: (content: string) => string,\n): void => {\n const projectRoot = expoConfig.modRequest.projectRoot;\n const mainSourceDir = path.join(projectRoot, 'android/app/src/main/java');\n const packagePath = path.join(mainSourceDir, classPackage.replace(/\\./g, '/'));\n\n try {\n FileManagement.mkdir(packagePath, { recursive: true });\n const sourcePath = path.join(getAndroidNativeFilesPath(), filename);\n const content = patchContent(FileManagement.readFile(sourcePath));\n const destinationPath = path.join(packagePath, filename);\n FileManagement.writeFile(destinationPath, content);\n } catch (error) {\n console.warn(`Failed to copy ${filename} to Android project:`, error);\n throw error;\n }\n};\n"],"mappings":"AAEA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,yBAAyB,QAAQ,UAAU;;AAEpD;AACA,OAAO,MAAMC,eAAe,GAAGA,CAACC,OAAe,EAAEC,eAAuB,KAAa;EACnF,IAAID,OAAO,CAACE,QAAQ,CAACD,eAAe,CAAC,EAAE;IACrC,OAAOD,OAAO;EAChB;EAEA,MAAMG,WAAW,GAAG,yBAAyB;EAC7C,MAAMC,OAAO,GAAG,CAAC,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CAACD,aAAa,EAAEJ,YAAY,CAACO,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;EAE9E,IAAI;IACF7D,cAAc,CAAC8D,KAAK,CAACF,WAAW,EAAE;MAAEG,SAAS,EAAE;IAAK,CAAC,CAAC;IACtD,MAAMC,UAAU,GAAGjE,IAAI,CAAC4D,IAAI,CAAC1D,yBAAyB,CAAC,CAAC,EAAEoD,QAAQ,CAAC;IACnE,MAAMlD,OAAO,GAAGoD,YAAY,CAACvD,cAAc,CAACiE,QAAQ,CAACD,UAAU,CAAC,CAAC;IACjE,MAAME,eAAe,GAAGnE,IAAI,CAAC4D,IAAI,CAACC,WAAW,EAAEP,QAAQ,CAAC;IACxDrD,cAAc,CAACmE,SAAS,CAACD,eAAe,EAAE/D,OAAO,CAAC;EACpD,CAAC,CAAC,OAAOiE,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,kBAAkBjB,QAAQ,sBAAsB,EAAEe,KAAK,CAAC;IACrE,MAAMA,KAAK;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges config values with env values for backward compatibility.
|
|
3
|
+
* If env is provided, it takes precedence. If nativeConfig is provided but env is not,
|
|
4
|
+
* nativeConfig values are used. This prioritizes existing env configuration for backward compatibility.
|
|
5
|
+
*/
|
|
6
|
+
function mergeConfigWithEnvValues(props, nativeConfig) {
|
|
7
|
+
var _props$pushNotificati;
|
|
8
|
+
const nativeCdpApiKey = nativeConfig === null || nativeConfig === void 0 ? void 0 : nativeConfig.cdpApiKey;
|
|
9
|
+
const nativeRegion = nativeConfig === null || nativeConfig === void 0 ? void 0 : nativeConfig.region;
|
|
10
|
+
const envConfig = (_props$pushNotificati = props.pushNotification) === null || _props$pushNotificati === void 0 ? void 0 : _props$pushNotificati.env;
|
|
11
|
+
const envCdpApiKey = envConfig === null || envConfig === void 0 ? void 0 : envConfig.cdpApiKey;
|
|
12
|
+
const envRegion = envConfig === null || envConfig === void 0 ? void 0 : envConfig.region;
|
|
13
|
+
|
|
14
|
+
// Check for conflicts between env and nativeConfig
|
|
15
|
+
if (nativeCdpApiKey && envCdpApiKey) {
|
|
16
|
+
if (nativeCdpApiKey !== envCdpApiKey || (nativeRegion === null || nativeRegion === void 0 ? void 0 : nativeRegion.toLowerCase()) !== (envRegion === null || envRegion === void 0 ? void 0 : envRegion.toLowerCase())) {
|
|
17
|
+
const errorMessage = `Configuration conflict: 'config' and 'ios.pushNotification.env' values must match when both are provided.\n` + ` config.cdpApiKey: "${nativeCdpApiKey}"\n` + ` env.cdpApiKey: "${envCdpApiKey}"\n` + ` config.region: "${nativeRegion}"\n` + ` env.region: "${envRegion}"`;
|
|
18
|
+
console.error(errorMessage);
|
|
19
|
+
throw new Error(errorMessage);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Values match - warn about redundant configuration
|
|
23
|
+
console.warn(`Both 'config' and 'ios.pushNotification.env' are provided with matching values. ` + `Consider removing 'ios.pushNotification.env' since 'config' is already specified.`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Return config (values are guaranteed to be the same if both exist)
|
|
27
|
+
const cdpApiKey = nativeCdpApiKey || envCdpApiKey;
|
|
28
|
+
const region = nativeRegion || envRegion;
|
|
29
|
+
if (cdpApiKey) {
|
|
30
|
+
return {
|
|
31
|
+
cdpApiKey,
|
|
32
|
+
region
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
export { mergeConfigWithEnvValues };
|
|
38
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["mergeConfigWithEnvValues","props","nativeConfig","_props$pushNotificati","nativeCdpApiKey","cdpApiKey","nativeRegion","region","envConfig","pushNotification","env","envCdpApiKey","envRegion","toLowerCase","errorMessage","console","error","Error","warn","undefined"],"sources":["config.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS, NativeSDKConfig, RichPushConfig } from '../types/cio-types';\n\n/**\n * Merges config values with env values for backward compatibility.\n * If env is provided, it takes precedence. If nativeConfig is provided but env is not,\n * nativeConfig values are used. This prioritizes existing env configuration for backward compatibility.\n */\nfunction mergeConfigWithEnvValues(\n props: CustomerIOPluginOptionsIOS,\n nativeConfig?: NativeSDKConfig\n): RichPushConfig | undefined {\n const nativeCdpApiKey = nativeConfig?.cdpApiKey;\n const nativeRegion = nativeConfig?.region;\n\n const envConfig = props.pushNotification?.env;\n const envCdpApiKey = envConfig?.cdpApiKey;\n const envRegion = envConfig?.region;\n\n // Check for conflicts between env and nativeConfig\n if (nativeCdpApiKey && envCdpApiKey) {\n if (nativeCdpApiKey !== envCdpApiKey || nativeRegion?.toLowerCase() !== envRegion?.toLowerCase()) {\n const errorMessage = `Configuration conflict: 'config' and 'ios.pushNotification.env' values must match when both are provided.\\n` +\n ` config.cdpApiKey: \"${nativeCdpApiKey}\"\\n` +\n ` env.cdpApiKey: \"${envCdpApiKey}\"\\n` +\n ` config.region: \"${nativeRegion}\"\\n` +\n ` env.region: \"${envRegion}\"`;\n\n console.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n // Values match - warn about redundant configuration\n console.warn(\n `Both 'config' and 'ios.pushNotification.env' are provided with matching values. ` +\n `Consider removing 'ios.pushNotification.env' since 'config' is already specified.`\n );\n }\n\n // Return config (values are guaranteed to be the same if both exist)\n const cdpApiKey = nativeCdpApiKey || envCdpApiKey;\n const region = nativeRegion || envRegion;\n\n if (cdpApiKey) {\n return {\n cdpApiKey,\n region,\n };\n }\n\n return undefined;\n}\n\nexport { mergeConfigWithEnvValues };\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,wBAAwBA,CAC/BC,KAAiC,EACjCC,YAA8B,EACF;EAAA,IAAAC,qBAAA;EAC5B,MAAMC,eAAe,GAAGF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,SAAS;EAC/C,MAAMC,YAAY,GAAGJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEK,MAAM;EAEzC,MAAMC,SAAS,IAAAL,qBAAA,GAAGF,KAAK,CAACQ,gBAAgB,cAAAN,qBAAA,uBAAtBA,qBAAA,CAAwBO,GAAG;EAC7C,MAAMC,YAAY,GAAGH,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEH,SAAS;EACzC,MAAMO,SAAS,GAAGJ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAED,MAAM;;EAEnC;EACA,IAAIH,eAAe,IAAIO,YAAY,EAAE;IACnC,IAAIP,eAAe,KAAKO,YAAY,IAAI,CAAAL,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEO,WAAW,CAAC,CAAC,OAAKD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEC,WAAW,CAAC,CAAC,GAAE;MAChG,MAAMC,YAAY,GAAG,6GAA6G,GAChI,wBAAwBV,eAAe,KAAK,GAC5C,qBAAqBO,YAAY,KAAK,GACtC,qBAAqBL,YAAY,KAAK,GACtC,kBAAkBM,SAAS,GAAG;MAEhCG,OAAO,CAACC,KAAK,CAACF,YAAY,CAAC;MAC3B,MAAM,IAAIG,KAAK,CAACH,YAAY,CAAC;IAC/B;;IAEA;IACAC,OAAO,CAACG,IAAI,CACV,kFAAkF,GAClF,mFACF,CAAC;EACH;;EAEA;EACA,MAAMb,SAAS,GAAGD,eAAe,IAAIO,YAAY;EACjD,MAAMJ,MAAM,GAAGD,YAAY,IAAIM,SAAS;EAExC,IAAIP,SAAS,EAAE;IACb,OAAO;MACLA,SAAS;MACTE;IACF,CAAC;EACH;EAEA,OAAOY,SAAS;AAClB;AAEA,SAASnB,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const findPluginPackageRoot = () => {
|
|
4
|
+
const finder = require('find-package-json');
|
|
5
|
+
const f = finder(__dirname);
|
|
6
|
+
const root = f.next().filename;
|
|
7
|
+
return path.dirname(root);
|
|
8
|
+
};
|
|
9
|
+
const pluginPackageRoot = findPluginPackageRoot();
|
|
10
|
+
|
|
11
|
+
// Returns path to plugin's native template files directory
|
|
12
|
+
export const getNativeFilesPath = () => {
|
|
13
|
+
return path.join(pluginPackageRoot, 'plugin/src/helpers/native-files/');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Returns path to plugin's Android native template files
|
|
17
|
+
export const getAndroidNativeFilesPath = () => {
|
|
18
|
+
return path.join(getNativeFilesPath(), 'android');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Returns path to plugin's iOS native template files
|
|
22
|
+
export const getIosNativeFilesPath = () => {
|
|
23
|
+
return path.join(getNativeFilesPath(), 'ios');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Reads the version of the plugin from its `package.json` and returns it as a string.
|
|
27
|
+
export const getPluginVersion = () => {
|
|
28
|
+
const packageJsonPath = path.resolve(pluginPackageRoot, 'package.json');
|
|
29
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
30
|
+
throw new Error(`package.json not found at ${packageJsonPath}`);
|
|
31
|
+
}
|
|
32
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
33
|
+
if (!packageJson.version) {
|
|
34
|
+
throw new Error(`"version" field is missing in ${packageJsonPath}`);
|
|
35
|
+
}
|
|
36
|
+
return packageJson.version;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fs","path","findPluginPackageRoot","finder","require","f","__dirname","root","next","filename","dirname","pluginPackageRoot","getNativeFilesPath","join","getAndroidNativeFilesPath","getIosNativeFilesPath","getPluginVersion","packageJsonPath","resolve","existsSync","Error","packageJson","JSON","parse","readFileSync","version"],"sources":["plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nconst findPluginPackageRoot = (): string => {\n const finder = require('find-package-json');\n const f = finder(__dirname);\n const root = f.next().filename;\n return path.dirname(root);\n};\n\nconst pluginPackageRoot = findPluginPackageRoot();\n\n// Returns path to plugin's native template files directory\nexport const getNativeFilesPath = (): string => {\n return path.join(\n pluginPackageRoot,\n 'plugin/src/helpers/native-files/'\n );\n};\n\n// Returns path to plugin's Android native template files\nexport const getAndroidNativeFilesPath = (): string => {\n return path.join(getNativeFilesPath(), 'android');\n};\n\n// Returns path to plugin's iOS native template files\nexport const getIosNativeFilesPath = (): string => {\n return path.join(getNativeFilesPath(), 'ios');\n};\n\n// Reads the version of the plugin from its `package.json` and returns it as a string.\nexport const getPluginVersion = (): string => {\n const packageJsonPath = path.resolve(\n pluginPackageRoot,\n 'package.json'\n );\n if (!fs.existsSync(packageJsonPath)) {\n throw new Error(`package.json not found at ${packageJsonPath}`);\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n if (!packageJson.version) {\n throw new Error(`\"version\" field is missing in ${packageJsonPath}`);\n }\n return packageJson.version;\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAEvB,MAAMC,qBAAqB,GAAGA,CAAA,KAAc;EAC1C,MAAMC,MAAM,GAAGC,OAAO,CAAC,mBAAmB,CAAC;EAC3C,MAAMC,CAAC,GAAGF,MAAM,CAACG,SAAS,CAAC;EAC3B,MAAMC,IAAI,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;EAC9B,OAAOR,IAAI,CAACS,OAAO,CAACH,IAAI,CAAC;AAC3B,CAAC;AAED,MAAMI,iBAAiB,GAAGT,qBAAqB,CAAC,CAAC;;AAEjD;AACA,OAAO,MAAMU,kBAAkB,GAAGA,CAAA,KAAc;EAC9C,OAAOX,IAAI,CAACY,IAAI,CACdF,iBAAiB,EACjB,kCACF,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAMG,yBAAyB,GAAGA,CAAA,KAAc;EACrD,OAAOb,IAAI,CAACY,IAAI,CAACD,kBAAkB,CAAC,CAAC,EAAE,SAAS,CAAC;AACnD,CAAC;;AAED;AACA,OAAO,MAAMG,qBAAqB,GAAGA,CAAA,KAAc;EACjD,OAAOd,IAAI,CAACY,IAAI,CAACD,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC;AAC/C,CAAC;;AAED;AACA,OAAO,MAAMI,gBAAgB,GAAGA,CAAA,KAAc;EAC5C,MAAMC,eAAe,GAAGhB,IAAI,CAACiB,OAAO,CAClCP,iBAAiB,EACjB,cACF,CAAC;EACD,IAAI,CAACX,EAAE,CAACmB,UAAU,CAACF,eAAe,CAAC,EAAE;IACnC,MAAM,IAAIG,KAAK,CAAC,6BAA6BH,eAAe,EAAE,CAAC;EACjE;EAEA,MAAMI,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACvB,EAAE,CAACwB,YAAY,CAACP,eAAe,EAAE,MAAM,CAAC,CAAC;EACxE,IAAI,CAACI,WAAW,CAACI,OAAO,EAAE;IACxB,MAAM,IAAIL,KAAK,CAAC,iCAAiCH,eAAe,EAAE,CAAC;EACrE;EACA,OAAOI,WAAW,CAACI,OAAO;AAC5B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function validateRequired(value, fieldName, context) {
|
|
2
|
+
if (value === undefined || value === null) {
|
|
3
|
+
throw new Error(`${context}: ${fieldName} is required, received: ${value}`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function validateString(value, fieldName, context) {
|
|
7
|
+
if (value !== undefined && (typeof value !== 'string' || value.trim() === '')) {
|
|
8
|
+
throw new Error(`${context}: ${fieldName} must be a non-empty string, received: ${typeof value === 'string' ? `"${value}"` : value}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function validateBoolean(value, fieldName, context) {
|
|
12
|
+
if (value !== undefined && typeof value !== 'boolean') {
|
|
13
|
+
throw new Error(`${context}: ${fieldName} must be a boolean, received: ${value}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function validateEnum(value, fieldName, allowedValues, context) {
|
|
17
|
+
if (value === undefined) return;
|
|
18
|
+
validateString(value, fieldName, context);
|
|
19
|
+
const lowerValue = value.toLowerCase();
|
|
20
|
+
const lowerAllowedValues = allowedValues.map(v => v.toLowerCase());
|
|
21
|
+
if (!lowerAllowedValues.includes(lowerValue)) {
|
|
22
|
+
const valuesStr = allowedValues.map(v => `"${v}"`).join(', ');
|
|
23
|
+
throw new Error(`${context}: ${fieldName} must be one of ${valuesStr}, received: ${value}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function validateNativeSDKConfig(config) {
|
|
27
|
+
const context = 'NativeSDKConfig';
|
|
28
|
+
validateRequired(config.cdpApiKey, 'cdpApiKey', context);
|
|
29
|
+
validateString(config.cdpApiKey, 'cdpApiKey', context);
|
|
30
|
+
validateEnum(config.region, 'region', ['US', 'EU'], context);
|
|
31
|
+
validateEnum(config.screenViewUse, 'screenViewUse', ['all', 'inapp'], context);
|
|
32
|
+
validateEnum(config.logLevel, 'logLevel', ['none', 'error', 'info', 'debug'], context);
|
|
33
|
+
validateBoolean(config.autoTrackDeviceAttributes, 'autoTrackDeviceAttributes', context);
|
|
34
|
+
validateBoolean(config.trackApplicationLifecycleEvents, 'trackApplicationLifecycleEvents', context);
|
|
35
|
+
validateString(config.siteId, 'siteId', context);
|
|
36
|
+
validateString(config.migrationSiteId, 'migrationSiteId', context);
|
|
37
|
+
}
|
|
38
|
+
export { validateNativeSDKConfig };
|
|
39
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["validateRequired","value","fieldName","context","undefined","Error","validateString","trim","validateBoolean","validateEnum","allowedValues","lowerValue","toLowerCase","lowerAllowedValues","map","v","includes","valuesStr","join","validateNativeSDKConfig","config","cdpApiKey","region","screenViewUse","logLevel","autoTrackDeviceAttributes","trackApplicationLifecycleEvents","siteId","migrationSiteId"],"sources":["validation.ts"],"sourcesContent":["import type { NativeSDKConfig } from '../types/cio-types';\n\nfunction validateRequired(value: unknown, fieldName: string, context: string): void {\n if (value === undefined || value === null) {\n throw new Error(`${context}: ${fieldName} is required, received: ${value}`);\n }\n}\n\nfunction validateString(value: unknown, fieldName: string, context: string): void {\n if (value !== undefined && (typeof value !== 'string' || value.trim() === '')) {\n throw new Error(`${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): void {\n if (value !== undefined && typeof value !== 'boolean') {\n throw new Error(`${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): void {\n if (value === undefined) return;\n\n validateString(value, fieldName, context);\n\n const lowerValue = (value as string).toLowerCase();\n const lowerAllowedValues = allowedValues.map(v => v.toLowerCase());\n if (!lowerAllowedValues.includes(lowerValue)) {\n const valuesStr = allowedValues.map(v => `\"${v}\"`).join(', ');\n throw new Error(`${context}: ${fieldName} must be one of ${valuesStr}, received: ${value}`);\n }\n}\n\nfunction validateNativeSDKConfig(config: NativeSDKConfig): void {\n const context = 'NativeSDKConfig';\n\n validateRequired(config.cdpApiKey, 'cdpApiKey', context);\n validateString(config.cdpApiKey, 'cdpApiKey', context);\n\n validateEnum(config.region, 'region', ['US', 'EU'] as const, context);\n validateEnum(config.screenViewUse, 'screenViewUse', ['all', 'inapp'] as const, context);\n validateEnum(config.logLevel, 'logLevel', ['none', 'error', 'info', 'debug'] as const, context);\n validateBoolean(config.autoTrackDeviceAttributes, 'autoTrackDeviceAttributes', context);\n validateBoolean(config.trackApplicationLifecycleEvents, 'trackApplicationLifecycleEvents', context);\n validateString(config.siteId, 'siteId', context);\n validateString(config.migrationSiteId, 'migrationSiteId', context);\n}\n\nexport { validateNativeSDKConfig };\n"],"mappings":"AAEA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
+
* Gets an existing CustomerIO group or creates a new one in the Xcode project
|
|
6
|
+
* @param xcodeProject The Xcode project instance
|
|
7
|
+
* @param projectName The iOS project name
|
|
8
|
+
* @returns The CustomerIO group reference
|
|
9
|
+
*/
|
|
10
|
+
export function getOrCreateCustomerIOGroup(xcodeProject, projectName) {
|
|
11
|
+
// Check if CustomerIO group already exists
|
|
12
|
+
let customerIOGroup = xcodeProject.pbxGroupByName('CustomerIO');
|
|
13
|
+
if (customerIOGroup) {
|
|
14
|
+
return customerIOGroup;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Create new CustomerIO group and add it to the project
|
|
18
|
+
customerIOGroup = xcodeProject.pbxCreateGroup('CustomerIO');
|
|
19
|
+
const projectGroupKey = xcodeProject.findPBXGroupKey({
|
|
20
|
+
name: projectName
|
|
21
|
+
});
|
|
22
|
+
xcodeProject.addToPbxGroup(customerIOGroup, projectGroupKey);
|
|
23
|
+
return customerIOGroup;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Copies template file to iOS project, applies transformations, and registers with Xcode
|
|
28
|
+
* @param params.xcodeProject Xcode project instance
|
|
29
|
+
* @param params.iosProjectRoot iOS project root path
|
|
30
|
+
* @param params.projectName iOS project name
|
|
31
|
+
* @param params.sourceFilePath Source template file path
|
|
32
|
+
* @param params.targetFileName Target file name
|
|
33
|
+
* @param params.transform Content transformation function
|
|
34
|
+
* @param params.customerIOGroup CustomerIO group (auto-created if not provided)
|
|
35
|
+
* @returns Destination file path
|
|
36
|
+
*/
|
|
37
|
+
export function copyFileToXcode({
|
|
38
|
+
xcodeProject,
|
|
39
|
+
iosProjectRoot,
|
|
40
|
+
projectName,
|
|
41
|
+
sourceFilePath,
|
|
42
|
+
targetFileName,
|
|
43
|
+
transform,
|
|
44
|
+
customerIOGroup = getOrCreateCustomerIOGroup(xcodeProject, projectName)
|
|
45
|
+
}) {
|
|
46
|
+
// Construct the full destination path within the iOS project directory
|
|
47
|
+
const destinationPath = path.join(iosProjectRoot, projectName, targetFileName);
|
|
48
|
+
try {
|
|
49
|
+
// Read template, apply transformations, and write to project
|
|
50
|
+
const content = transform(FileManagement.readFile(sourceFilePath));
|
|
51
|
+
FileManagement.writeFile(destinationPath, content);
|
|
52
|
+
// Register file with Xcode project
|
|
53
|
+
xcodeProject.addSourceFile(`${projectName}/${targetFileName}`, null, customerIOGroup);
|
|
54
|
+
return destinationPath;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.warn(`Failed to add ${targetFileName} to Xcode project:`, error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=xcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["path","FileManagement","getOrCreateCustomerIOGroup","xcodeProject","projectName","customerIOGroup","pbxGroupByName","pbxCreateGroup","projectGroupKey","findPBXGroupKey","name","addToPbxGroup","copyFileToXcode","iosProjectRoot","sourceFilePath","targetFileName","transform","destinationPath","join","content","readFile","writeFile","addSourceFile","error","console","warn"],"sources":["xcode.ts"],"sourcesContent":["import type { XcodeProject } from \"@expo/config-plugins\";\nimport path from 'path';\nimport { FileManagement } from \"../helpers/utils/fileManagement\";\n\n/**\n * Gets an existing CustomerIO group or creates a new one in the Xcode project\n * @param xcodeProject The Xcode project instance\n * @param projectName The iOS project name\n * @returns The CustomerIO group reference\n */\nexport function getOrCreateCustomerIOGroup(\n xcodeProject: XcodeProject,\n projectName: string,\n): XcodeProject['pbxCreateGroup'] {\n // Check if CustomerIO group already exists\n let customerIOGroup = xcodeProject.pbxGroupByName('CustomerIO');\n if (customerIOGroup) {\n return customerIOGroup;\n }\n\n // Create new CustomerIO group and add it to the project\n customerIOGroup = xcodeProject.pbxCreateGroup('CustomerIO');\n const projectGroupKey = xcodeProject.findPBXGroupKey({ name: projectName });\n xcodeProject.addToPbxGroup(customerIOGroup, projectGroupKey);\n return customerIOGroup;\n}\n\n/**\n * Copies template file to iOS project, applies transformations, and registers with Xcode\n * @param params.xcodeProject Xcode project instance\n * @param params.iosProjectRoot iOS project root path\n * @param params.projectName iOS project name\n * @param params.sourceFilePath Source template file path\n * @param params.targetFileName Target file name\n * @param params.transform Content transformation function\n * @param params.customerIOGroup CustomerIO group (auto-created if not provided)\n * @returns Destination file path\n */\nexport function copyFileToXcode({\n xcodeProject,\n iosProjectRoot,\n projectName,\n sourceFilePath,\n targetFileName,\n transform,\n customerIOGroup = getOrCreateCustomerIOGroup(xcodeProject, projectName),\n}: {\n xcodeProject: XcodeProject;\n iosProjectRoot: string;\n projectName: string;\n sourceFilePath: string;\n targetFileName: string;\n transform: (content: string) => string;\n customerIOGroup?: XcodeProject['pbxCreateGroup'];\n}): string {\n // Construct the full destination path within the iOS project directory\n const destinationPath = path.join(\n iosProjectRoot,\n projectName,\n targetFileName\n );\n\n try {\n // Read template, apply transformations, and write to project\n const content = transform(FileManagement.readFile(sourceFilePath));\n FileManagement.writeFile(destinationPath, content);\n // Register file with Xcode project\n xcodeProject.addSourceFile(`${projectName}/${targetFileName}`, null, customerIOGroup);\n return destinationPath;\n } catch (error) {\n console.warn(`Failed to add ${targetFileName} to Xcode project:`, error);\n throw error;\n }\n}\n"],"mappings":"AACA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,cAAc,QAAQ,iCAAiC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CACxCC,YAA0B,EAC1BC,WAAmB,EACa;EAChC;EACA,IAAIC,eAAe,GAAGF,YAAY,CAACG,cAAc,CAAC,YAAY,CAAC;EAC/D,IAAID,eAAe,EAAE;IACnB,OAAOA,eAAe;EACxB;;EAEA;EACAA,eAAe,GAAGF,YAAY,CAACI,cAAc,CAAC,YAAY,CAAC;EAC3D,MAAMC,eAAe,GAAGL,YAAY,CAACM,eAAe,CAAC;IAAEC,IAAI,EAAEN;EAAY,CAAC,CAAC;EAC3ED,YAAY,CAACQ,aAAa,CAACN,eAAe,EAAEG,eAAe,CAAC;EAC5D,OAAOH,eAAe;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,eAAeA,CAAC;EAC9BT,YAAY;EACZU,cAAc;EACdT,WAAW;EACXU,cAAc;EACdC,cAAc;EACdC,SAAS;EACTX,eAAe,GAAGH,0BAA0B,CAACC,YAAY,EAAEC,WAAW;AASxE,CAAC,EAAU;EACT;EACA,MAAMa,eAAe,GAAGjB,IAAI,CAACkB,IAAI,CAC/BL,cAAc,EACdT,WAAW,EACXW,cACF,CAAC;EAED,IAAI;IACF;IACA,MAAMI,OAAO,GAAGH,SAAS,CAACf,cAAc,CAACmB,QAAQ,CAACN,cAAc,CAAC,CAAC;IAClEb,cAAc,CAACoB,SAAS,CAACJ,eAAe,EAAEE,OAAO,CAAC;IAClD;IACAhB,YAAY,CAACmB,aAAa,CAAC,GAAGlB,WAAW,IAAIW,cAAc,EAAE,EAAE,IAAI,EAAEV,eAAe,CAAC;IACrF,OAAOY,eAAe;EACxB,CAAC,CAAC,OAAOM,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iBAAiBV,cAAc,oBAAoB,EAAEQ,KAAK,CAAC;IACxE,MAAMA,KAAK;EACb;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
3
|
+
export declare const DEFAULT_LOW_PRIORITY = -10;
|
|
3
4
|
export declare const withAndroidManifestUpdates: ConfigPlugin<CustomerIOPluginOptionsAndroid>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
3
|
-
export declare function withCIOAndroid(config: ExpoConfig, props: CustomerIOPluginOptionsAndroid): ExpoConfig;
|
|
2
|
+
import type { CustomerIOPluginOptionsAndroid, NativeSDKConfig } from '../types/cio-types';
|
|
3
|
+
export declare function withCIOAndroid(config: ExpoConfig, sdkConfig: NativeSDKConfig | undefined, props: CustomerIOPluginOptionsAndroid): ExpoConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { ResourceXML } from '@expo/config-plugins/build/android/Resources';
|
|
2
3
|
/**
|
|
3
4
|
* Adds or updates string resources in Android's strings.xml required by the plugin
|
|
4
5
|
*/
|
|
@@ -9,7 +10,7 @@ export declare const withProjectStrings: ConfigPlugin;
|
|
|
9
10
|
* @param stringResources - Array of string resources to add or update
|
|
10
11
|
* @returns Updated strings.xml object
|
|
11
12
|
*/
|
|
12
|
-
export declare function addStringsToXml(stringsXml:
|
|
13
|
+
export declare function addStringsToXml(stringsXml: ResourceXML, stringResources: {
|
|
13
14
|
name: string;
|
|
14
15
|
value: string;
|
|
15
16
|
}[]): void;
|
|
@@ -5,3 +5,6 @@ export declare const CIO_PROJECT_ALLPROJECTS_REGEX: RegExp;
|
|
|
5
5
|
export declare const CIO_PROJECT_GIST_MAVEN_SNIPPET = " maven { url \"https://maven.gist.build\" }";
|
|
6
6
|
export declare const CIO_APP_GOOGLE_SNIPPET = "apply plugin: \"com.google.gms.google-services\" // Google Services plugin";
|
|
7
7
|
export declare const CIO_PROJECT_GOOGLE_SNIPPET = " classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin";
|
|
8
|
+
export declare const CIO_MAINAPPLICATION_ONCREATE_REGEX: RegExp;
|
|
9
|
+
export declare const CIO_NATIVE_SDK_INITIALIZE_CALL = "CustomerIOSDKInitializer.initialize(this)";
|
|
10
|
+
export declare const CIO_NATIVE_SDK_INITIALIZE_SNIPPET = "// Auto Initialize Native Customer.io SDK\n CustomerIOSDKInitializer.initialize(this)";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform constants for native SDK initialization
|
|
3
|
+
*/
|
|
4
|
+
export declare const PLATFORM: {
|
|
5
|
+
readonly IOS: "ios";
|
|
6
|
+
readonly ANDROID: "android";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Platform type definition
|
|
10
|
+
*/
|
|
11
|
+
export type Platform = typeof PLATFORM[keyof typeof PLATFORM];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const LOCAL_PATH_TO_CIO_NSE_FILES: any;
|
|
2
1
|
export declare function getRelativePathToRNSDK(iosPath: string): any;
|
|
3
2
|
export declare const IOS_DEPLOYMENT_TARGET = "13.0";
|
|
4
3
|
export declare const GROUP_IDENTIFIER_TEMPLATE_REGEX: RegExp;
|
|
@@ -31,3 +30,6 @@ export declare const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET = "\n //
|
|
|
31
30
|
export declare const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = "\n@objc(registerPushNotification)\n public func registerPushNotification() {\n\n let center = UNUserNotificationCenter.current()\n center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in\n if error == nil{\n DispatchQueue.main.async {\n UIApplication.shared.registerForRemoteNotifications()\n }\n }\n }\n }";
|
|
32
31
|
export declare const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2 = "\n let center = UNUserNotificationCenter.current()\n center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in\n if error == nil{\n DispatchQueue.main.async {\n UIApplication.shared.registerForRemoteNotifications()\n }\n }\n }";
|
|
33
32
|
export declare const CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER: RegExp;
|
|
33
|
+
export declare const CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX: RegExp;
|
|
34
|
+
export declare const CIO_NATIVE_SDK_INITIALIZE_CALL = "CustomerIOSDKInitializer.initialize()";
|
|
35
|
+
export declare const CIO_NATIVE_SDK_INITIALIZE_SNIPPET = "// Auto Initialize Native Customer.io SDK\n CustomerIOSDKInitializer.initialize()\n ";
|