customerio-expo-plugin 2.7.1 → 2.7.3
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 +4 -3
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +5 -4
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/commonjs/android/withAppGoogleServices.js +2 -1
- package/plugin/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/plugin/lib/commonjs/android/withCIOAndroid.js +17 -11
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withGistMavenRepository.js +2 -1
- package/plugin/lib/commonjs/android/withGistMavenRepository.js.map +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js +4 -3
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +2 -1
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/fileManagement.js +5 -4
- package/plugin/lib/commonjs/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +2 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js +5 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/commonjs/index.js +3 -11
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +2 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +7 -3
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +11 -10
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +8 -7
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +29 -23
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/utils/android.js +2 -1
- package/plugin/lib/commonjs/utils/android.js.map +1 -1
- package/plugin/lib/commonjs/utils/config.js +3 -2
- package/plugin/lib/commonjs/utils/config.js.map +1 -1
- package/plugin/lib/commonjs/utils/logger.js +35 -0
- package/plugin/lib/commonjs/utils/logger.js.map +1 -0
- package/plugin/lib/commonjs/utils/validation.js +68 -25
- package/plugin/lib/commonjs/utils/validation.js.map +1 -1
- package/plugin/lib/commonjs/utils/xcode.js +2 -1
- package/plugin/lib/commonjs/utils/xcode.js.map +1 -1
- package/plugin/lib/module/android/withAndroidManifestUpdates.js +6 -4
- package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/module/android/withAppGoogleServices.js +2 -1
- package/plugin/lib/module/android/withAppGoogleServices.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +17 -11
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withGistMavenRepository.js +2 -1
- package/plugin/lib/module/android/withGistMavenRepository.js.map +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js +4 -3
- package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/module/android/withMainApplicationModifications.js +2 -1
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/module/helpers/utils/fileManagement.js +6 -5
- package/plugin/lib/module/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +2 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js +5 -1
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/module/index.js +3 -12
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/withAppDelegateModifications.js +2 -1
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +7 -3
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +11 -10
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +8 -7
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +29 -23
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/utils/android.js +2 -1
- package/plugin/lib/module/utils/android.js.map +1 -1
- package/plugin/lib/module/utils/config.js +4 -2
- package/plugin/lib/module/utils/config.js.map +1 -1
- package/plugin/lib/module/utils/logger.js +29 -0
- package/plugin/lib/module/utils/logger.js.map +1 -0
- package/plugin/lib/module/utils/validation.js +68 -27
- package/plugin/lib/module/utils/validation.js.map +1 -1
- package/plugin/lib/module/utils/xcode.js +2 -1
- package/plugin/lib/module/utils/xcode.js.map +1 -1
- package/plugin/lib/typescript/android/withCIOAndroid.d.ts +1 -1
- package/plugin/lib/typescript/ios/withCIOIos.d.ts +1 -1
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +1 -1
- package/plugin/lib/typescript/utils/logger.d.ts +8 -0
- package/plugin/lib/typescript/utils/validation.d.ts +6 -3
- package/plugin/src/android/withAndroidManifestUpdates.ts +5 -4
- package/plugin/src/android/withAppGoogleServices.ts +2 -1
- package/plugin/src/android/withCIOAndroid.ts +18 -12
- package/plugin/src/android/withGistMavenRepository.ts +3 -2
- package/plugin/src/android/withGoogleServicesJSON.ts +4 -3
- package/plugin/src/android/withMainApplicationModifications.ts +2 -1
- package/plugin/src/helpers/utils/fileManagement.ts +10 -9
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +2 -1
- package/plugin/src/helpers/utils/patchPluginNativeCode.ts +6 -1
- package/plugin/src/index.ts +3 -13
- package/plugin/src/ios/withAppDelegateModifications.ts +2 -1
- package/plugin/src/ios/withCIOIos.ts +12 -8
- package/plugin/src/ios/withCIOIosSwift.ts +15 -14
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +8 -7
- package/plugin/src/ios/withNotificationsXcodeProject.ts +31 -35
- package/plugin/src/utils/android.ts +2 -1
- package/plugin/src/utils/config.ts +3 -2
- package/plugin/src/utils/logger.ts +37 -0
- package/plugin/src/utils/validation.ts +96 -32
- package/plugin/src/utils/xcode.ts +2 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
+
import { logger } from '../utils/logger';
|
|
3
|
+
|
|
2
4
|
// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false
|
|
3
5
|
export const DEFAULT_LOW_PRIORITY = -10;
|
|
4
6
|
export const withAndroidManifestUpdates = (configOuter, options) => {
|
|
@@ -23,13 +25,13 @@ export const withAndroidManifestUpdates = (configOuter, options) => {
|
|
|
23
25
|
// Handle priority based on setHighPriorityPushHandler value
|
|
24
26
|
if (options.setHighPriorityPushHandler === true) {
|
|
25
27
|
// High priority - no priority attribute means default high priority
|
|
26
|
-
|
|
28
|
+
logger.info('Successfully set CustomerIO push handler as high priority in AndroidManifest.xml');
|
|
27
29
|
} else if (options.setHighPriorityPushHandler === false) {
|
|
28
30
|
// Low priority - set fixed priority
|
|
29
31
|
intentFilter.$ = {
|
|
30
32
|
'android:priority': DEFAULT_LOW_PRIORITY.toString()
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
logger.info(`Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
33
35
|
}
|
|
34
36
|
application[0].service.push({
|
|
35
37
|
'$': {
|
|
@@ -46,7 +48,7 @@ export const withAndroidManifestUpdates = (configOuter, options) => {
|
|
|
46
48
|
const intentFilter = existingService['intent-filter'][0];
|
|
47
49
|
if (intentFilter.$ && intentFilter.$['android:priority']) {
|
|
48
50
|
delete intentFilter.$['android:priority'];
|
|
49
|
-
|
|
51
|
+
logger.info('Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml');
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
} else if (options.setHighPriorityPushHandler === false) {
|
|
@@ -61,7 +63,7 @@ export const withAndroidManifestUpdates = (configOuter, options) => {
|
|
|
61
63
|
intentFilter.$ = {};
|
|
62
64
|
}
|
|
63
65
|
intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();
|
|
64
|
-
|
|
66
|
+
logger.info(`Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
props.modResults.manifest.application = application;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifest","DEFAULT_LOW_PRIORITY","withAndroidManifestUpdates","configOuter","options","props","application","modResults","manifest","customerIOMessagingpush","service","existingServiceIndex","findIndex","$","intentFilter","action","setHighPriorityPushHandler","
|
|
1
|
+
{"version":3,"names":["withAndroidManifest","logger","DEFAULT_LOW_PRIORITY","withAndroidManifestUpdates","configOuter","options","props","application","modResults","manifest","customerIOMessagingpush","service","existingServiceIndex","findIndex","$","intentFilter","action","setHighPriorityPushHandler","info","toString","push","existingService","length"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { logger } from '../utils/logger';\n\n// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false\nexport const DEFAULT_LOW_PRIORITY = -10;\n\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, options) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0].service) {\n application[0].service = [];\n }\n\n const existingServiceIndex = application[0].service.findIndex(\n (service) => service.$['android:name'] === customerIOMessagingpush\n );\n\n if (existingServiceIndex === -1) {\n // Intent filter structure for Firebase messaging service\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter: any = {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n };\n\n // Handle priority based on setHighPriorityPushHandler value\n if (options.setHighPriorityPushHandler === true) {\n // High priority - no priority attribute means default high priority\n logger.info(\n 'Successfully set CustomerIO push handler as high priority in AndroidManifest.xml'\n );\n } else if (options.setHighPriorityPushHandler === false) {\n // Low priority - set fixed priority\n intentFilter.$ = {\n 'android:priority': DEFAULT_LOW_PRIORITY.toString(),\n };\n logger.info(\n `Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`\n );\n }\n\n application[0].service.push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [intentFilter],\n });\n } else if (options.setHighPriorityPushHandler === true) {\n // Service exists, need to ensure it becomes high priority (remove priority attribute)\n const existingService = application[0].service[existingServiceIndex];\n\n if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter = existingService['intent-filter'][0] as any;\n if (intentFilter.$ && intentFilter.$['android:priority']) {\n delete intentFilter.$['android:priority'];\n logger.info(\n 'Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml'\n );\n }\n }\n } else if (options.setHighPriorityPushHandler === false) {\n // Service exists, update to low priority\n const existingService = application[0].service[existingServiceIndex];\n\n // Update existing service intent-filter with fixed priority\n if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter = existingService['intent-filter'][0] as any;\n if (!intentFilter.$) {\n intentFilter.$ = {};\n }\n intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();\n logger.info(\n `Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`\n );\n }\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,sBAAsB;AAI1D,SAASC,MAAM,QAAQ,iBAAiB;;AAExC;AACA,OAAO,MAAMC,oBAAoB,GAAG,CAAC,EAAE;AAGvC,OAAO,MAAMC,0BAEZ,GAAGA,CAACC,WAAW,EAAEC,OAAO,KAAK;EAC5B,OAAOL,mBAAmB,CAACI,WAAW,EAAGE,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,EAAE;MAC3BJ,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,GAAG,EAAE;IAC7B;IAEA,MAAMC,oBAAoB,GAAGL,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,CAACE,SAAS,CAC1DF,OAAO,IAAKA,OAAO,CAACG,CAAC,CAAC,cAAc,CAAC,KAAKJ,uBAC7C,CAAC;IAED,IAAIE,oBAAoB,KAAK,CAAC,CAAC,EAAE;MAC/B;MACA;MACA,MAAMG,YAAiB,GAAG;QACxBC,MAAM,EAAE,CACN;UACEF,CAAC,EAAE;YACD,cAAc,EAAE;UAClB;QACF,CAAC;MAEL,CAAC;;MAED;MACA,IAAIT,OAA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AAe,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QACnF;QACA,MAAMP,YAAY,GAAGM,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAQ;QAC/D,IAAI,CAACN,YAAY,CAACD,CAAC,EAAE;UACnBC,YAAY,CAACD,CAAC,GAAG,CAAC,CAAC;QACrB;QACAC,YAAY,CAACD,CAAC,CAAC,kBAAkB,CAAC,GAAGZ,oBAAoB,CAACiB,QAAQ,CAAC,CAAC;QACpElB,MAAM,CAACiB,IAAI,CACT,0EAA0EhB,oBAAoB,0BAChG,CAAC;MACH;IACF;IAEAI,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withAppBuildGradle } from '@expo/config-plugins';
|
|
2
2
|
import { CIO_APP_APPLY_REGEX, CIO_APP_GOOGLE_SNIPPET } from '../helpers/constants/android';
|
|
3
|
+
import { logger } from '../utils/logger';
|
|
3
4
|
export const withAppGoogleServices = configOuter => {
|
|
4
5
|
return withAppBuildGradle(configOuter, props => {
|
|
5
6
|
const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);
|
|
@@ -7,7 +8,7 @@ export const withAppGoogleServices = configOuter => {
|
|
|
7
8
|
if (!match) {
|
|
8
9
|
props.modResults.contents = props.modResults.contents.replace(CIO_APP_APPLY_REGEX, `$1\n${CIO_APP_GOOGLE_SNIPPET}`);
|
|
9
10
|
} else {
|
|
10
|
-
|
|
11
|
+
logger.info('app/build.gradle snippet already exists. Skipping...');
|
|
11
12
|
}
|
|
12
13
|
return props;
|
|
13
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","
|
|
1
|
+
{"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","logger","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","info"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { logger } from '../utils/logger';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n logger.info('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,sBAAsB;AAEzD,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAErC,SAASC,MAAM,QAAQ,iBAAiB;AAExC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,kBAAkB,CAACK,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACN,sBAAsB,CAAC;IAChD,MAAMO,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DX,mBAAmB,EACnB,OAAOC,sBAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLC,MAAM,CAACU,IAAI,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -7,22 +7,28 @@ import { withNotificationChannelMetadata } from './withNotificationChannelMetada
|
|
|
7
7
|
import { withProjectGoogleServices } from './withProjectGoogleServices';
|
|
8
8
|
import { withProjectStrings } from './withProjectStrings';
|
|
9
9
|
export function withCIOAndroid(config, sdkConfig, props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
// Only run notification setup if props are provided
|
|
11
|
+
if (props) {
|
|
12
|
+
var _props$pushNotificati;
|
|
13
|
+
config = withGistMavenRepository(config, props);
|
|
14
|
+
config = withProjectGoogleServices(config, props);
|
|
15
|
+
config = withAppGoogleServices(config, props);
|
|
16
|
+
config = withGoogleServicesJSON(config, props);
|
|
17
|
+
if (props.setHighPriorityPushHandler !== undefined) {
|
|
18
|
+
config = withAndroidManifestUpdates(config, props);
|
|
19
|
+
}
|
|
20
|
+
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
21
|
+
config = withNotificationChannelMetadata(config, props);
|
|
22
|
+
}
|
|
21
23
|
}
|
|
24
|
+
|
|
22
25
|
// Add auto initialization if sdkConfig is provided
|
|
23
26
|
if (sdkConfig) {
|
|
24
27
|
config = withMainApplicationModifications(config, sdkConfig);
|
|
25
28
|
}
|
|
29
|
+
|
|
30
|
+
// Update project strings for user agent metadata
|
|
31
|
+
config = withProjectStrings(config);
|
|
26
32
|
return config;
|
|
27
33
|
}
|
|
28
34
|
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withMainApplicationModifications","withNotificationChannelMetadata","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","sdkConfig","props","_props$pushNotificati","setHighPriorityPushHandler","undefined","pushNotification","channel"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid, NativeSDKConfig } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withMainApplicationModifications } from './withMainApplicationModifications';\nimport { withNotificationChannelMetadata } from './withNotificationChannelMetadata';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\nimport { withProjectStrings } from './withProjectStrings';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n sdkConfig
|
|
1
|
+
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withMainApplicationModifications","withNotificationChannelMetadata","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","sdkConfig","props","_props$pushNotificati","setHighPriorityPushHandler","undefined","pushNotification","channel"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid, NativeSDKConfig } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withMainApplicationModifications } from './withMainApplicationModifications';\nimport { withNotificationChannelMetadata } from './withNotificationChannelMetadata';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\nimport { withProjectStrings } from './withProjectStrings';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsAndroid,\n): ExpoConfig {\n // Only run notification setup if props are provided\n if (props) {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler !== undefined) {\n config = withAndroidManifestUpdates(config, props);\n }\n if (props.pushNotification?.channel) {\n config = withNotificationChannelMetadata(config, props);\n }\n }\n\n // Add auto initialization if sdkConfig is provided\n if (sdkConfig) {\n config = withMainApplicationModifications(config, sdkConfig);\n }\n\n // Update project strings for user agent metadata\n config = withProjectStrings(config);\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,+BAA+B,QAAQ,mCAAmC;AACnF,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,SAA2B,EAC3BC,KAAsC,EAC1B;EACZ;EACA,IAAIA,KAAK,EAAE;IAAA,IAAAC,qBAAA;IACTH,MAAM,GAAGP,uBAAuB,CAACO,MAAM,EAAEE,KAAK,CAAC;IAC/CF,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEE,KAAK,CAAC;IACjDF,MAAM,GAAGR,qBAAqB,CAACQ,MAAM,EAAEE,KAAK,CAAC;IAC7CF,MAAM,GAAGN,sBAAsB,CAACM,MAAM,EAAEE,KAAK,CAAC;IAC9C,IAAIA,KAAK,CAACE,0BAA0B,KAAKC,SAAS,EAAE;MAClDL,MAAM,GAAGT,0BAA0B,CAACS,MAAM,EAAEE,KAAK,CAAC;IACpD;IACA,KAAAC,qBAAA,GAAID,KAAK,CAACI,gBAAgB,cAAAH,qBAAA,eAAtBA,qBAAA,CAAwBI,OAAO,EAAE;MACnCP,MAAM,GAAGJ,+BAA+B,CAACI,MAAM,EAAEE,KAAK,CAAC;IACzD;EACF;;EAEA;EACA,IAAID,SAAS,EAAE;IACbD,MAAM,GAAGL,gCAAgC,CAACK,MAAM,EAAEC,SAAS,CAAC;EAC9D;;EAEA;EACAD,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EAEnC,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { withProjectBuildGradle } from '@expo/config-plugins';
|
|
2
2
|
import { CIO_GIST_MAVEN_REGEX, CIO_PROJECT_ALLPROJECTS_REGEX, CIO_PROJECT_GIST_MAVEN_SNIPPET } from '../helpers/constants/android';
|
|
3
|
+
import { logger } from '../utils/logger';
|
|
3
4
|
export const withGistMavenRepository = configOuter => {
|
|
4
5
|
return withProjectBuildGradle(configOuter, props => {
|
|
5
6
|
const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);
|
|
6
7
|
if (!targetMatch) {
|
|
7
8
|
props.modResults.contents = props.modResults.contents.replace(CIO_PROJECT_ALLPROJECTS_REGEX, `$1\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`);
|
|
8
9
|
} else {
|
|
9
|
-
|
|
10
|
+
logger.info('build.gradle snippet already exists. Skipping...');
|
|
10
11
|
}
|
|
11
12
|
return props;
|
|
12
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","logger","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","info"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport { logger } from '../utils/logger';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n logger.info('build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,sBAAsB;AAE7D,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AACrC,SAASC,MAAM,QAAQ,iBAAiB;AAGxC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAON,sBAAsB,CAACM,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACV,oBAAoB,CAAC;IACzE,IAAI,CAACO,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DV,6BAA6B,EAC7B,OAAOC,8BAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLC,MAAM,CAACS,IAAI,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAON,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withProjectBuildGradle } from '@expo/config-plugins';
|
|
2
|
+
import { logger } from '../utils/logger';
|
|
2
3
|
import { FileManagement } from './../helpers/utils/fileManagement';
|
|
3
4
|
export const withGoogleServicesJSON = (configOuter, cioProps) => {
|
|
4
5
|
return withProjectBuildGradle(configOuter, props => {
|
|
@@ -15,13 +16,13 @@ export const withGoogleServicesJSON = (configOuter, cioProps) => {
|
|
|
15
16
|
try {
|
|
16
17
|
FileManagement.copyFile(googleServicesFile, `${androidPath}/app/google-services.json`);
|
|
17
18
|
} catch {
|
|
18
|
-
|
|
19
|
+
logger.info(`There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`);
|
|
19
20
|
}
|
|
20
21
|
} else {
|
|
21
|
-
|
|
22
|
+
logger.info(`The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`);
|
|
22
23
|
}
|
|
23
24
|
} else {
|
|
24
|
-
|
|
25
|
+
logger.info(`File already exists: ${androidPath}/app/google-services.json. Skipping...`);
|
|
25
26
|
}
|
|
26
27
|
return props;
|
|
27
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","logger","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","info"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withProjectBuildGradle } from '@expo/config-plugins';\n\nimport { logger } from '../utils/logger';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch {\n logger.info(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n logger.info(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n logger.info(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,sBAAsB;AAE7D,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOL,sBAAsB,CAACI,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACL,cAAc,CAACU,MAAM,CAAC,GAAGJ,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIT,cAAc,CAACU,MAAM,CAACD,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFT,cAAc,CAACW,QAAQ,CACrBF,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,MAAM;UACNP,MAAM,CAACa,IAAI,CACT,4FAA4FN,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLP,MAAM,CAACa,IAAI,CACT,wCAAwCH,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLP,MAAM,CAACa,IAAI,CACT,wBAAwBN,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_CALL, CIO
|
|
|
3
3
|
import { PLATFORM } from '../helpers/constants/common';
|
|
4
4
|
import { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';
|
|
5
5
|
import { addCodeToMethod, addImportToFile, copyTemplateFile } from '../utils/android';
|
|
6
|
+
import { logger } from '../utils/logger';
|
|
6
7
|
export const withMainApplicationModifications = (configOuter, sdkConfig) => {
|
|
7
8
|
return withMainApplication(configOuter, async config => {
|
|
8
9
|
const content = setupCustomerIOSDKInitializer(config, sdkConfig);
|
|
@@ -30,7 +31,7 @@ const setupCustomerIOSDKInitializer = (config, sdkConfig) => {
|
|
|
30
31
|
content = addCodeToMethod(content, CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_SNIPPET);
|
|
31
32
|
}
|
|
32
33
|
} catch (error) {
|
|
33
|
-
|
|
34
|
+
logger.warn(`Could not setup ${SDK_INITIALIZER_CLASS}:`, error);
|
|
34
35
|
return config.modResults.contents;
|
|
35
36
|
}
|
|
36
37
|
return content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withMainApplication","CIO_MAINAPPLICATION_ONCREATE_REGEX","CIO_NATIVE_SDK_INITIALIZE_CALL","CIO_NATIVE_SDK_INITIALIZE_SNIPPET","PLATFORM","patchNativeSDKInitializer","addCodeToMethod","addImportToFile","copyTemplateFile","withMainApplicationModifications","configOuter","sdkConfig","config","content","setupCustomerIOSDKInitializer","modResults","contents","SDK_INITIALIZER_CLASS","SDK_INITIALIZER_PACKAGE","SDK_INITIALIZER_FILE","SDK_INITIALIZER_IMPORT","ANDROID","includes","error","
|
|
1
|
+
{"version":3,"names":["withMainApplication","CIO_MAINAPPLICATION_ONCREATE_REGEX","CIO_NATIVE_SDK_INITIALIZE_CALL","CIO_NATIVE_SDK_INITIALIZE_SNIPPET","PLATFORM","patchNativeSDKInitializer","addCodeToMethod","addImportToFile","copyTemplateFile","logger","withMainApplicationModifications","configOuter","sdkConfig","config","content","setupCustomerIOSDKInitializer","modResults","contents","SDK_INITIALIZER_CLASS","SDK_INITIALIZER_PACKAGE","SDK_INITIALIZER_FILE","SDK_INITIALIZER_IMPORT","ANDROID","includes","error","warn"],"sources":["withMainApplicationModifications.ts"],"sourcesContent":["import type { ConfigPlugin, ExportedConfigWithProps } from '@expo/config-plugins';\nimport { withMainApplication } from '@expo/config-plugins';\nimport type { ApplicationProjectFile } from '@expo/config-plugins/build/android/Paths';\nimport { CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_CALL, CIO_NATIVE_SDK_INITIALIZE_SNIPPET } from '../helpers/constants/android';\nimport { PLATFORM } from '../helpers/constants/common';\nimport { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';\nimport type { NativeSDKConfig } from '../types/cio-types';\nimport { addCodeToMethod, addImportToFile, copyTemplateFile } from '../utils/android';\nimport { logger } from '../utils/logger';\n\nexport const withMainApplicationModifications: ConfigPlugin<NativeSDKConfig> = (configOuter, sdkConfig) => {\n return withMainApplication(configOuter, async (config) => {\n const content = setupCustomerIOSDKInitializer(config, sdkConfig);\n config.modResults.contents = content;\n return config;\n });\n};\n\n/**\n * Setup CustomerIOSDKInitializer for Android auto initialization\n */\nconst setupCustomerIOSDKInitializer = (\n config: ExportedConfigWithProps<ApplicationProjectFile>,\n sdkConfig: NativeSDKConfig,\n): string => {\n const SDK_INITIALIZER_CLASS = 'CustomerIOSDKInitializer';\n const SDK_INITIALIZER_PACKAGE = 'io.customer.sdk.expo';\n\n const SDK_INITIALIZER_FILE = `${SDK_INITIALIZER_CLASS}.kt`;\n const SDK_INITIALIZER_IMPORT = `import ${SDK_INITIALIZER_PACKAGE}.${SDK_INITIALIZER_CLASS}`;\n\n let content = config.modResults.contents;\n\n try {\n // Always regenerate the CustomerIOSDKInitializer file to reflect config changes\n copyTemplateFile(config, SDK_INITIALIZER_FILE, SDK_INITIALIZER_PACKAGE, (content) =>\n patchNativeSDKInitializer(content, PLATFORM.ANDROID, sdkConfig)\n );\n // Add import if not already present\n content = addImportToFile(content, SDK_INITIALIZER_IMPORT);\n // Add initialization code to onCreate if not already present\n if (!content.includes(CIO_NATIVE_SDK_INITIALIZE_CALL)) {\n content = addCodeToMethod(content, CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_SNIPPET);\n }\n } catch (error) {\n logger.warn(`Could not setup ${SDK_INITIALIZER_CLASS}:`, error);\n return config.modResults.contents;\n }\n\n return content;\n};\n"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,sBAAsB;AAE1D,SAASC,kCAAkC,EAAEC,8BAA8B,EAAEC,iCAAiC,QAAQ,8BAA8B;AACpJ,SAASC,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,yBAAyB,QAAQ,wCAAwC;AAElF,SAASC,eAAe,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,kBAAkB;AACrF,SAASC,MAAM,QAAQ,iBAAiB;AAExC,OAAO,MAAMC,gCAA+D,GAAGA,CAACC,WAAW,EAAEC,SAAS,KAAK;EACzG,OAAOZ,mBAAmB,CAACW,WAAW,EAAE,MAAOE,MAAM,IAAK;IACxD,MAAMC,OAAO,GAAGC,6BAA6B,CAACF,MAAM,EAAED,SAAS,CAAC;IAChEC,MAAM,CAACG,UAAU,CAACC,QAAQ,GAAGH,OAAO;IACpC,OAAOD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA,MAAME,6BAA6B,GAAGA,CACpCF,MAAuD,EACvDD,SAA0B,KACf;EACX,MAAMM,qBAAqB,GAAG,0BAA0B;EACxD,MAAMC,uBAAuB,GAAG,sBAAsB;EAEtD,MAAMC,oBAAoB,GAAG,GAAGF,qBAAqB,KAAK;EAC1D,MAAMG,sBAAsB,GAAG,UAAUF,uBAAuB,IAAID,qBAAqB,EAAE;EAE3F,IAAIJ,OAAO,GAAGD,MAAM,CAACG,UAAU,CAACC,QAAQ;EAExC,IAAI;IACF;IACAT,gBAAgB,CAACK,MAAM,EAAEO,oBAAoB,EAAED,uBAAuB,EAAGL,OAAO,IAC9ET,yBAAyB,CAACS,OAAO,EAAEV,QAAQ,CAACkB,OAAO,EAAEV,SAAS,CAChE,CAAC;IACD;IACAE,OAAO,GAAGP,eAAe,CAACO,OAAO,EAAEO,sBAAsB,CAAC;IAC1D;IACA,IAAI,CAACP,OAAO,CAACS,QAAQ,CAACrB,8BAA8B,CAAC,EAAE;MACrDY,OAAO,GAAGR,eAAe,CAACQ,OAAO,EAAEb,kCAAkC,EAAEE,iCAAiC,CAAC;IAC3G;EACF,CAAC,CAAC,OAAOqB,KAAK,EAAE;IACdf,MAAM,CAACgB,IAAI,CAAC,mBAAmBP,qBAAqB,GAAG,EAAEM,KAAK,CAAC;IAC/D,OAAOX,MAAM,CAACG,UAAU,CAACC,QAAQ;EACnC;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { appendFile, copyFileSync, existsSync, mkdirSync, readFile, readFileSync, writeFile, writeFileSync } from 'fs';
|
|
2
|
+
import { logger } from '../../utils/logger';
|
|
2
3
|
export class FileManagement {
|
|
3
4
|
static async read(path) {
|
|
4
5
|
return new Promise((resolve, reject) => {
|
|
@@ -40,28 +41,28 @@ export class FileManagement {
|
|
|
40
41
|
try {
|
|
41
42
|
copyFileSync(src, dest);
|
|
42
43
|
} catch (err) {
|
|
43
|
-
|
|
44
|
+
logger.error(`Error copying file from ${src} to ${dest}: `, err);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
static mkdir(path, options) {
|
|
47
48
|
try {
|
|
48
49
|
mkdirSync(path, options);
|
|
49
50
|
} catch (err) {
|
|
50
|
-
|
|
51
|
+
logger.error(`Error creating directory ${path}: `, err);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
static writeFile(path, data) {
|
|
54
55
|
try {
|
|
55
56
|
writeFileSync(path, data);
|
|
56
57
|
} catch (err) {
|
|
57
|
-
|
|
58
|
+
logger.error(`Error writing to file ${path}: `, err);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
static readFile(path) {
|
|
61
62
|
try {
|
|
62
63
|
return readFileSync(path, 'utf-8');
|
|
63
64
|
} catch (err) {
|
|
64
|
-
|
|
65
|
+
logger.error(`Error reading file ${path}: `, err);
|
|
65
66
|
}
|
|
66
67
|
return '';
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["appendFile","copyFileSync","existsSync","mkdirSync","readFile","readFileSync","writeFile","writeFileSync","logger","FileManagement","read","path","Promise","resolve","reject","err","data","write","contents","append","exists","copyFile","src","dest","error","mkdir","options"],"sources":["fileManagement.ts"],"sourcesContent":["import type { MakeDirectoryOptions } from 'fs';\nimport {\n appendFile,\n copyFileSync,\n existsSync,\n mkdirSync,\n readFile,\n readFileSync,\n writeFile,\n writeFileSync,\n} from 'fs';\nimport { logger } from '../../utils/logger';\n\nexport class FileManagement {\n static async read(path: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n readFile(path, 'utf8', (err, data) => {\n if (err || !data) {\n reject(err);\n return;\n }\n resolve(data);\n });\n });\n }\n\n static async write(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n writeFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static async append(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n appendFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static exists(path: string) {\n return existsSync(path);\n }\n\n static copyFile(src: string, dest: string) {\n try {\n copyFileSync(src, dest);\n } catch (err) {\n logger.error(`Error copying file from ${src} to ${dest}: `, err);\n }\n }\n\n static mkdir(path: string, options: MakeDirectoryOptions) {\n try {\n mkdirSync(path, options);\n } catch (err) {\n logger.error(`Error creating directory ${path}: `, err);\n }\n }\n\n static writeFile(path: string, data: string) {\n try {\n writeFileSync(path, data);\n } catch (err) {\n logger.error(`Error writing to file ${path}: `, err);\n }\n }\n\n static readFile(path: string) {\n try {\n return readFileSync(path, 'utf-8');\n } catch (err) {\n logger.error(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":"AACA,SACEA,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,aAAa,QACR,IAAI;AACX,SAASC,MAAM,QAAQ,oBAAoB;AAE3C,OAAO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAIA,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9CV,QAAQ,CAACO,IAAI,EAAE,MAAM,EAAE,CAACI,GAAG,EAAEC,IAAI,KAAK;QACpC,IAAID,GAAG,IAAI,CAACC,IAAI,EAAE;UAChBF,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAACG,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAKA,CAACN,IAAY,EAAEO,QAAgB,EAAiB;IA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AEK,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZP,MAAM,CAACgB,KAAK,CAAC,yBAAyBb,IAAI,IAAI,EAAEI,GAAG,CAAC;IACtD;EACF;EAEA,OAAOX,QAAQA,CAACO,IAAY,EAAE;IAC5B,IAAI;MACF,OAAON,YAAY,CAACM,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOI,GAAG,EAAE;MACZP,MAAM,CAACgB,KAAK,CAAC,sBAAsBb,IAAI,IAAI,EAAEI,GAAG,CAAC;IACnD;IAEA,OAAO,EAAE;EACX;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from '../../utils/logger';
|
|
1
2
|
import { getRelativePathToRNSDK } from '../constants/ios';
|
|
2
3
|
import { injectCodeByRegex } from './codeInjection';
|
|
3
4
|
import { FileManagement } from './fileManagement';
|
|
@@ -19,7 +20,7 @@ ${blockEnd}
|
|
|
19
20
|
`.trim();
|
|
20
21
|
FileManagement.write(filename, injectCodeByRegex(podfile, lineInPodfileToInjectSnippetBefore, snippetToInjectInPodfile).join('\n'));
|
|
21
22
|
} else {
|
|
22
|
-
|
|
23
|
+
logger.info('CustomerIO Podfile snippets already exists. Skipping...');
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
export async function injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmPushProvider) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","isFcmPushProvider","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","
|
|
1
|
+
{"version":3,"names":["logger","getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","isFcmPushProvider","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","info","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { logger } from '../../utils/logger';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(\n iosPath: string,\n isFcmPushProvider: boolean\n) {\n const blockStart = '# --- CustomerIO Host App START ---';\n const blockEnd = '# --- CustomerIO Host App END ---';\n\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(new RegExp(blockStart));\n\n if (!matches) {\n // We need to decide what line of code in the Podfile to insert our native code.\n // The \"post_install\" line is always present in an Expo project Podfile so it's reliable.\n // Find that line in the Podfile and then we will insert our code above that line.\n const lineInPodfileToInjectSnippetBefore = /post_install do \\|installer\\|/;\n\n const snippetToInjectInPodfile = `\n${blockStart}\n pod 'customerio-reactnative/${isFcmPushProvider ? 'fcm' : 'apn'\n }', :path => '${getRelativePathToRNSDK(iosPath)}'\n${blockEnd}\n`.trim();\n\n FileManagement.write(\n filename,\n injectCodeByRegex(\n podfile,\n lineInPodfileToInjectSnippetBefore,\n snippetToInjectInPodfile\n ).join('\\n')\n );\n } else {\n logger.info('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks'],\n isFcmPushProvider: boolean\n) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n\n const blockStart = '# --- CustomerIO Notification START ---';\n const blockEnd = '# --- CustomerIO Notification END ---';\n\n const matches = podfile.match(new RegExp(blockStart));\n\n if (!matches) {\n const snippetToInjectInPodfile = `\n${blockStart}\ntarget 'NotificationService' do\n ${useFrameworks === 'static' ? 'use_frameworks! :linkage => :static' : ''}\n pod 'customerio-reactnative-richpush/${isFcmPushProvider ? 'fcm' : 'apn'\n }', :path => '${getRelativePathToRNSDK(iosPath)}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,eAAeC,oBAAoBA,CACxCC,OAAe,EACfC,iBAA0B,EAC1B;EACA,MAAMC,UAAU,GAAG,qCAAqC;EACxD,MAAMC,QAAQ,GAAG,mCAAmC;EAEpD,MAAMC,QAAQ,GAAG,GAAGJ,OAAO,UAAU;EACrC,MAAMK,OAAO,GAAG,MAAMP,cAAc,CAACQ,IAAI,CAACF,QAAQ,CAAC;EACnD,MAAMG,OAAO,GAAGF,OAAO,CAACG,KAAK,CAAC,IAAIC,MAAM,CAACP,UAAU,CAAC,CAAC;EAErD,IAAI,CAACK,OAAO,EAAE;IACZ;IACA;IACA;IACA,MAAMG,kCAAkC,GAAG,+BAA+B;IAE1E,MAAMC,wBAAwB,GAAG;AACrC,EAAET,UAAU;AACZ,gCAAgCD,iBAAiB,GAAG,KAAK,GAAG,KAAK,gBAC3CL,sBAAsB,CAACI,OAAO,CAAC;AACrD,EAAEG,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJd,cAAc,CAACe,KAAK,CAClBT,QAAQ,EACRP,iBAAiB,CACfQ,OAAO,EACPK,kCAAkC,EAClCC,wBACF,CAAC,CAACG,IAAI,CAAC,IAAI,CACb,CAAC;EACH,CAAC,MAAM;IACLnB,MAAM,CAACoB,IAAI,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEA,OAAO,eAAeC,gCAAgCA,CACpDhB,OAAe,EACfiB,aAA0D,EAC1DhB,iBAA0B,EAC1B;EACA,MAAMG,QAAQ,GAAG,GAAGJ,OAAO,UAAU;EACrC,MAAMK,OAAO,GAAG,MAAMP,cAAc,CAACQ,IAAI,CAACF,QAAQ,CAAC;EAEnD,MAAMF,UAAU,GAAG,yCAAyC;EAC5D,MAAMC,QAAQ,GAAG,uCAAuC;EAExD,MAAMI,OAAO,GAAGF,OAAO,CAACG,KAAK,CAAC,IAAIC,MAAM,CAACP,UAAU,CAAC,CAAC;EAErD,IAAI,CAACK,OAAO,EAAE;IACZ,MAAMI,wBAAwB,GAAG;AACrC,EAAET,UAAU;AACZ;AACA,IAAIe,aAAa,KAAK,QAAQ,GAAG,qCAAqC,GAAG,EAAE;AAC3E,yCAAyChB,iBAAiB,GAAG,KAAK,GAAG,KAAK,gBACpDL,sBAAsB,CAACI,OAAO,CAAC;AACrD;AACA,EAAEG,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJd,cAAc,CAACoB,MAAM,CAACd,QAAQ,EAAEO,wBAAwB,CAAC;EAC3D;AACF","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { PLATFORM } from '../constants/common';
|
|
2
1
|
import { getPluginVersion } from '../../utils/plugin';
|
|
2
|
+
import { validateNativeSDKConfig } from '../../utils/validation';
|
|
3
|
+
import { PLATFORM } from '../constants/common';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Shared utility function to perform common SDK config replacements
|
|
@@ -7,6 +8,9 @@ import { getPluginVersion } from '../../utils/plugin';
|
|
|
7
8
|
*/
|
|
8
9
|
export function patchNativeSDKInitializer(rawContent, platform, sdkConfig) {
|
|
9
10
|
var _siteId, _migrationSiteId;
|
|
11
|
+
// Validate SDK configuration to ensure all fields are present and
|
|
12
|
+
// correct at the time of patching in prebuild
|
|
13
|
+
validateNativeSDKConfig(sdkConfig);
|
|
10
14
|
let content = rawContent;
|
|
11
15
|
|
|
12
16
|
// Helper function to replace placeholders with platform-specific fallback values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getPluginVersion","validateNativeSDKConfig","PLATFORM","patchNativeSDKInitializer","rawContent","platform","sdkConfig","_siteId","_migrationSiteId","content","replaceValue","placeholder","value","transform","fallback","ANDROID","undefined","replace","pluginVersion","cdpApiKey","region","configValue","logLevel","autoTrackDeviceAttributes","toString","trackApplicationLifecycleEvents","screenViewUse","siteId","migrationSiteId","trim"],"sources":["patchPluginNativeCode.ts"],"sourcesContent":["import type { NativeSDKConfig } from '../../types/cio-types';\nimport { getPluginVersion } from '../../utils/plugin';\nimport { validateNativeSDKConfig } from '../../utils/validation';\nimport { PLATFORM, type Platform } from '../constants/common';\n\n/**\n * Shared utility function to perform common SDK config replacements\n * for both iOS and Android template files\n */\nexport function patchNativeSDKInitializer(\n rawContent: string,\n platform: Platform,\n sdkConfig: NativeSDKConfig\n): string {\n // Validate SDK configuration to ensure all fields are present and \n // correct at the time of patching in prebuild\n validateNativeSDKConfig(sdkConfig);\n\n let content = rawContent;\n\n // Helper function to replace placeholders with platform-specific fallback values\n const replaceValue = <T>(\n placeholder: RegExp,\n value: T | undefined,\n transform: (configValue: T) => string,\n fallback: string = platform === PLATFORM.ANDROID ? 'null' : 'nil'\n ) => {\n if (value !== undefined && value !== null) {\n content = content.replace(placeholder, transform(value));\n } else {\n content = content.replace(placeholder, fallback);\n }\n };\n\n // Replace EXPO_PLUGIN_VERSION with actual plugin version\n const pluginVersion = getPluginVersion();\n content = content.replace(/\\{\\{EXPO_PLUGIN_VERSION\\}\\}/g, pluginVersion);\n\n // Replace CDP API Key (required field)\n content = content.replace(/\\{\\{CDP_API_KEY\\}\\}/g, sdkConfig.cdpApiKey);\n\n // Handle region - use empty string as fallback (nil not supported for region)\n replaceValue(\n /\\{\\{REGION\\}\\}/g,\n sdkConfig.region,\n (configValue) => `\"${configValue}\"`,\n '\"\"'\n );\n\n // Handle logLevel - use nil/null as fallback\n replaceValue(\n /\\{\\{LOG_LEVEL\\}\\}/g,\n sdkConfig.logLevel,\n (configValue) => `\"${configValue}\"`\n );\n\n // Handle optional boolean configurations\n replaceValue(\n /\\{\\{AUTO_TRACK_DEVICE_ATTRIBUTES\\}\\}/g,\n sdkConfig.autoTrackDeviceAttributes,\n (configValue) => configValue.toString()\n );\n\n replaceValue(\n /\\{\\{TRACK_APPLICATION_LIFECYCLE_EVENTS\\}\\}/g,\n sdkConfig.trackApplicationLifecycleEvents,\n (configValue) => configValue.toString()\n );\n\n // Handle screenViewUse - use nil/null as fallback\n replaceValue(\n /\\{\\{SCREEN_VIEW_USE\\}\\}/g,\n sdkConfig.screenViewUse,\n (configValue) => `\"${configValue}\"`\n );\n\n // Handle siteId/migrationSiteId business logic\n let siteId = sdkConfig.siteId;\n let migrationSiteId = sdkConfig.migrationSiteId;\n\n // Business rule: if only siteId provided, copy to migrationSiteId; if only migrationSiteId provided, set siteId to undefined\n if (siteId && !migrationSiteId) {\n migrationSiteId = siteId;\n } else if (migrationSiteId && !siteId) {\n siteId = undefined;\n }\n\n // Replace siteId and migrationSiteId placeholders (trim whitespace and handle empty strings)\n replaceValue(\n /\\{\\{SITE_ID\\}\\}/g,\n siteId?.trim() || undefined,\n (configValue) => `\"${configValue}\"`\n );\n\n replaceValue(\n /\\{\\{MIGRATION_SITE_ID\\}\\}/g,\n migrationSiteId?.trim() || undefined,\n (configValue) => `\"${configValue}\"`\n );\n\n return content;\n}\n"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,wBAAwB;AAChE,SAASC,QAAQ,QAAuB,qBAAqB;;AAE7D;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACvCC,UAAkB,EAClBC,QAAkB,EAClBC,SAA0B,EAClB;EAAA,IAAAC,OAAA,EAAAC,gBAAA;EACR;EACA;EACAP,uBAAuB,CAACK,SAAS,CAAC;EAElC,IAAIG,OAAO,GAAGL,UAAU;;EAExB;EACA,MAAMM,YAAY,GAAGA,CACnBC,WAAmB,EACnBC,KAAoB,EACpBC,SAAqC,EACrCC,QA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,MAAM,IAAI,CAACC,eAAe,EAAE;IAC9BA,eAAe,GAAGD,MAAM;EAC1B,CAAC,MAAM,IAAIC,eAAe,IAAI,CAACD,MAAM,EAAE;IACrCA,MAAM,GAAGX,SAAS;EACpB;;EAEA;EACAN,YAAY,CACV,kBAAkB,EAClB,EAAAH,OAAA,GAAAoB,MAAM,cAAApB,OAAA,uBAANA,OAAA,CAAQsB,IAAI,CAAC,CAAC,KAAIb,SAAS,EAC1BK,WAAW,IAAK,IAAIA,WAAW,GAClC,CAAC;EAEDX,YAAY,CACV,4BAA4B,EAC5B,EAAAF,gBAAA,GAAAoB,eAAe,cAAApB,gBAAA,uBAAfA,gBAAA,CAAiBqB,IAAI,CAAC,CAAC,KAAIb,SAAS,EACnCK,WAAW,IAAK,IAAIA,WAAW,GAClC,CAAC;EAED,OAAOZ,OAAO;AAChB","ignoreList":[]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { withCIOAndroid } from './android/withCIOAndroid';
|
|
2
2
|
import { isExpoVersion53OrHigher } from './ios/utils';
|
|
3
3
|
import { withCIOIos } from './ios/withCIOIos';
|
|
4
|
-
import { validateNativeSDKConfig } from './utils/validation';
|
|
5
|
-
|
|
6
4
|
// Entry point for config plugin
|
|
7
5
|
function withCustomerIOPlugin(config, props) {
|
|
8
6
|
// Check if config is being used with unsupported Expo version
|
|
@@ -10,16 +8,9 @@ function withCustomerIOPlugin(config, props) {
|
|
|
10
8
|
throw new Error('CustomerIO auto initialization (config property) requires Expo SDK 53 or higher. ' + 'Please upgrade to Expo SDK 53+ or use manual initialization instead. ' + 'See documentation for manual setup instructions.');
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
if (props.ios) {
|
|
18
|
-
config = withCIOIos(config, props.config, props.ios);
|
|
19
|
-
}
|
|
20
|
-
if (props.android) {
|
|
21
|
-
config = withCIOAndroid(config, props.config, props.android);
|
|
22
|
-
}
|
|
11
|
+
// Apply platform specific modifications
|
|
12
|
+
config = withCIOIos(config, props.config, props.ios);
|
|
13
|
+
config = withCIOAndroid(config, props.config, props.android);
|
|
23
14
|
return config;
|
|
24
15
|
}
|
|
25
16
|
export default withCustomerIOPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withCIOAndroid","isExpoVersion53OrHigher","withCIOIos","
|
|
1
|
+
{"version":3,"names":["withCIOAndroid","isExpoVersion53OrHigher","withCIOIos","withCustomerIOPlugin","config","props","Error","ios","android"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\nimport { isExpoVersion53OrHigher } from './ios/utils';\nimport { withCIOIos } from './ios/withCIOIos';\nimport type { CustomerIOPluginOptions } from './types/cio-types';\n\n// Entry point for config plugin\nfunction withCustomerIOPlugin(\n config: ExpoConfig,\n props: CustomerIOPluginOptions\n) {\n // Check if config is being used with unsupported Expo version\n if (props.config && !isExpoVersion53OrHigher(config)) {\n throw new Error(\n 'CustomerIO auto initialization (config property) requires Expo SDK 53 or higher. ' +\n 'Please upgrade to Expo SDK 53+ or use manual initialization instead. ' +\n 'See documentation for manual setup instructions.'\n );\n }\n\n // Apply platform specific modifications\n config = withCIOIos(config, props.config, props.ios);\n config = withCIOAndroid(config, props.config, props.android);\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,uBAAuB,QAAQ,aAAa;AACrD,SAASC,UAAU,QAAQ,kBAAkB;AAG7C;AACA,SAASC,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA;EACA,IAAIA,KAAK,CAACD,MAAM,IAAI,CAACH,uBAAuB,CAACG,MAAM,CAAC,EAAE;IACpD,MAAM,IAAIE,KAAK,CACb,mFAAmF,GACnF,uEAAuE,GACvE,kDACF,CAAC;EACH;;EAEA;EACAF,MAAM,GAAGF,UAAU,CAACE,MAAM,EAAEC,KAAK,CAACD,MAAM,EAAEC,KAAK,CAACE,GAAG,CAAC;EACpDH,MAAM,GAAGJ,cAAc,CAACI,MAAM,EAAEC,KAAK,CAACD,MAAM,EAAEC,KAAK,CAACG,OAAO,CAAC;EAE5D,OAAOJ,MAAM;AACf;AAEA,eAAeD,oBAAoB","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Pat
|
|
|
3
3
|
import { CIO_APPDELEGATEDECLARATION_REGEX, CIO_APPDELEGATEHEADER_IMPORT_SNIPPET, CIO_APPDELEGATEHEADER_REGEX, CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET, CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET, CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET, CIO_DEEPLINK_COMMENT_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET, CIO_DIDFINISHLAUNCHINGMETHOD_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET, CIO_INITIALIZECIOSDK_SNIPPET, CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX, CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET, CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET, CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX, CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET } from '../helpers/constants/ios';
|
|
4
4
|
import { injectCodeBeforeMultiLineRegex, injectCodeByLineNumber, injectCodeByMultiLineRegex, injectCodeByMultiLineRegexAndReplaceLine, matchRegexExists, replaceCodeByRegex } from '../helpers/utils/codeInjection';
|
|
5
5
|
import { FileManagement } from '../helpers/utils/fileManagement';
|
|
6
|
+
import { logger } from '../utils/logger';
|
|
6
7
|
import { isFcmPushProvider } from './utils';
|
|
7
8
|
const addImport = (stringContents, appName) => {
|
|
8
9
|
const importRegex = /^(#import .*)\n/gm;
|
|
@@ -131,7 +132,7 @@ export const withAppDelegateModifications = (configOuter, props) => {
|
|
|
131
132
|
stringContents = addExpoNotificationsHeaderModification(stringContents);
|
|
132
133
|
config.modResults.contents = stringContents;
|
|
133
134
|
} else {
|
|
134
|
-
|
|
135
|
+
logger.info('Customerio AppDelegate changes already exist. Skipping...');
|
|
135
136
|
}
|
|
136
137
|
return config;
|
|
137
138
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppDelegate","getAppDelegateHeaderFilePath","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","matchRegexExists","replaceCodeByRegex","FileManagement","isFcmPushProvider","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addFirebaseDelegateForwardDeclarationIfNeeded","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","_props$pushNotificati","_props$pushNotificati2","headerPath","projectRoot","headerContent","read","write","pushNotification","disableNotificationRegistration","handleDeeplinkInKilledState","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAppDelegate } from '@expo/config-plugins';\nimport { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';\n\nimport {\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_APPDELEGATEHEADER_IMPORT_SNIPPET,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_INITIALIZECIOSDK_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n matchRegexExists,\n replaceCodeByRegex,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nconst addImport = (stringContents: string, appName: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = getImportSnippet(appName);\n\n const match = stringContents.match(importRegex);\n let endOfMatchIndex: number;\n if (!match || match.index === undefined) {\n // No imports found, just add to start of file:\n endOfMatchIndex = 0;\n } else {\n // Add after first import:\n endOfMatchIndex = match.index + match[0].length;\n }\n\n stringContents = injectCodeByLineNumber(\n stringContents,\n endOfMatchIndex,\n addedImport\n );\n\n return stringContents;\n};\n\nconst addNotificationHandlerDeclaration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addNotificationConfiguration = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addInitializeNativeCioSdk = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledStateConfiguration = (\n stringContents: string,\n regex: RegExp\n) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n regex,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET\n );\n\n return stringContents;\n};\n\n// Adds required import for Expo Notifications package in AppDelegate.\n// Required to call functions from the package.\nconst addExpoNotificationsHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n `\n#if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n#import <EXNotifications/EXNotificationCenterDelegate.h>\n#endif\n`\n );\n\n return stringContents;\n};\n\nconst addFirebaseDelegateForwardDeclarationIfNeeded = (\n stringContents: string\n) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n '@protocol FIRMessagingDelegate;'\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n // Add UNUserNotificationCenterDelegate if needed\n stringContents = stringContents.replace(\n CIO_APPDELEGATEHEADER_REGEX,\n (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {\n if (\n existingDelegates &&\n existingDelegates.includes(\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET\n )\n ) {\n // The AppDelegate declaration already includes UNUserNotificationCenterDelegate, so we don't need to modify it\n return match;\n } else if (existingDelegates) {\n // Other delegates exist, append ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration}<${existingDelegates}, ${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n } else {\n // No delegates exist, add ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration.trim()} <${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n }\n }\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledState = (stringContents: string) => {\n // Find if the deep link code snippet is already present\n if (matchRegexExists(stringContents, CIO_DEEPLINK_COMMENT_REGEX)) {\n return stringContents;\n }\n\n // Check if the app delegate is using RCTBridge or LaunchOptions\n let snippet;\n let regex = CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n if (\n matchRegexExists(\n stringContents,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET;\n regex = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n } else if (\n matchRegexExists(\n stringContents,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET;\n }\n // Add code only if the app delegate is using RCTBridge or LaunchOptions\n if (snippet !== undefined) {\n stringContents = addHandleDeeplinkInKilledStateConfiguration(\n stringContents,\n regex\n );\n stringContents = replaceCodeByRegex(stringContents, regex, snippet);\n }\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\n const regex = new RegExp(\n `#import <${config.modRequest.projectName}-Swift.h>`\n );\n const match = stringContents.match(regex);\n\n if (!match) {\n const headerPath = getAppDelegateHeaderFilePath(\n config.modRequest.projectRoot\n );\n let headerContent = await FileManagement.read(headerPath);\n headerContent = addAppdelegateHeaderModification(headerContent);\n FileManagement.write(headerPath, headerContent);\n\n stringContents = addImport(\n stringContents,\n config.modRequest.projectName as string\n );\n stringContents = addNotificationHandlerDeclaration(stringContents);\n\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (props.pushNotification?.disableNotificationRegistration !== true) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (props.pushNotification?.handleDeeplinkInKilledState === true) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n if (isFcmPushProvider(props)) {\n stringContents =\n addFirebaseDelegateForwardDeclarationIfNeeded(stringContents);\n }\n\n stringContents = addExpoNotificationsHeaderModification(stringContents);\n\n config.modResults.contents = stringContents;\n } else {\n console.log('Customerio AppDelegate changes already exist. Skipping...');\n }\n\n return config;\n });\n};\nfunction getImportSnippet(appName: string) {\n return `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <${appName}-Swift.h>\n `;\n}\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,4BA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AAClB,cAAc,CAAC;MACjE;MAEAA,cAAc,GAAGiB,sCAAsC,CAACjB,cAAc,CAAC;MAEvE+B,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGjC,cAAc;IAC7C,CAAC,MAAM;MACL+C,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOjB,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AACD,SAAS3B,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAO;AACT;AACA;AACA,WAAWA,OAAO;AAClB,GAAG;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["withAppDelegate","getAppDelegateHeaderFilePath","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","matchRegexExists","replaceCodeByRegex","FileManagement","logger","isFcmPushProvider","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addFirebaseDelegateForwardDeclarationIfNeeded","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","_props$pushNotificati","_props$pushNotificati2","headerPath","projectRoot","headerContent","read","write","pushNotification","disableNotificationRegistration","handleDeeplinkInKilledState","info"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAppDelegate } from '@expo/config-plugins';\nimport { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';\n\nimport {\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_APPDELEGATEHEADER_IMPORT_SNIPPET,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_INITIALIZECIOSDK_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n matchRegexExists,\n replaceCodeByRegex,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { isFcmPushProvider } from './utils';\n\nconst addImport = (stringContents: string, appName: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = getImportSnippet(appName);\n\n const match = stringContents.match(importRegex);\n let endOfMatchIndex: number;\n if (!match || match.index === undefined) {\n // No imports found, just add to start of file:\n endOfMatchIndex = 0;\n } else {\n // Add after first import:\n endOfMatchIndex = match.index + match[0].length;\n }\n\n stringContents = injectCodeByLineNumber(\n stringContents,\n endOfMatchIndex,\n addedImport\n );\n\n return stringContents;\n};\n\nconst addNotificationHandlerDeclaration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addNotificationConfiguration = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addInitializeNativeCioSdk = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledStateConfiguration = (\n stringContents: string,\n regex: RegExp\n) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n regex,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET\n );\n\n return stringContents;\n};\n\n// Adds required import for Expo Notifications package in AppDelegate.\n// Required to call functions from the package.\nconst addExpoNotificationsHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n `\n#if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n#import <EXNotifications/EXNotificationCenterDelegate.h>\n#endif\n`\n );\n\n return stringContents;\n};\n\nconst addFirebaseDelegateForwardDeclarationIfNeeded = (\n stringContents: string\n) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n '@protocol FIRMessagingDelegate;'\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n // Add UNUserNotificationCenterDelegate if needed\n stringContents = stringContents.replace(\n CIO_APPDELEGATEHEADER_REGEX,\n (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {\n if (\n existingDelegates &&\n existingDelegates.includes(\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET\n )\n ) {\n // The AppDelegate declaration already includes UNUserNotificationCenterDelegate, so we don't need to modify it\n return match;\n } else if (existingDelegates) {\n // Other delegates exist, append ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration}<${existingDelegates}, ${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n } else {\n // No delegates exist, add ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration.trim()} <${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n }\n }\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledState = (stringContents: string) => {\n // Find if the deep link code snippet is already present\n if (matchRegexExists(stringContents, CIO_DEEPLINK_COMMENT_REGEX)) {\n return stringContents;\n }\n\n // Check if the app delegate is using RCTBridge or LaunchOptions\n let snippet;\n let regex = CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n if (\n matchRegexExists(\n stringContents,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET;\n regex = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n } else if (\n matchRegexExists(\n stringContents,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET;\n }\n // Add code only if the app delegate is using RCTBridge or LaunchOptions\n if (snippet !== undefined) {\n stringContents = addHandleDeeplinkInKilledStateConfiguration(\n stringContents,\n regex\n );\n stringContents = replaceCodeByRegex(stringContents, regex, snippet);\n }\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\n const regex = new RegExp(\n `#import <${config.modRequest.projectName}-Swift.h>`\n );\n const match = stringContents.match(regex);\n\n if (!match) {\n const headerPath = getAppDelegateHeaderFilePath(\n config.modRequest.projectRoot\n );\n let headerContent = await FileManagement.read(headerPath);\n headerContent = addAppdelegateHeaderModification(headerContent);\n FileManagement.write(headerPath, headerContent);\n\n stringContents = addImport(\n stringContents,\n config.modRequest.projectName as string\n );\n stringContents = addNotificationHandlerDeclaration(stringContents);\n\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (props.pushNotification?.disableNotificationRegistration !== true) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (props.pushNotification?.handleDeeplinkInKilledState === true) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n if (isFcmPushProvider(props)) {\n stringContents =\n addFirebaseDelegateForwardDeclarationIfNeeded(stringContents);\n }\n\n stringContents = addExpoNotificationsHeaderModification(stringContents);\n\n config.modResults.contents = stringContents;\n } else {\n logger.info('Customerio AppDelegate changes already exist. Skipping...');\n }\n\n return config;\n });\n};\nfunction getImportSnippet(appName: string) {\n return `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <${appName}-Swift.h>\n `;\n}\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,4BAA4B,QAAQ,sCAAsC;AAEnF,SACEC,gCAAgC,EAChCC,oCAAoC,EACpCC,2BAA2B,EAC3BC,sDAAsD,EACtDC,2CA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