customerio-expo-plugin 1.0.0-beta.14 → 1.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +2 -3
  2. package/app.plugin.js +1 -0
  3. package/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
  4. package/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
  5. package/lib/commonjs/android/withCIOAndroid.js.map +1 -1
  6. package/lib/commonjs/android/withGistMavenRepository.js.map +1 -1
  7. package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
  8. package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
  9. package/lib/commonjs/helpers/constants/android.js.map +1 -1
  10. package/lib/commonjs/helpers/constants/globals.d.js.map +1 -1
  11. package/lib/commonjs/helpers/constants/ios.js.map +1 -1
  12. package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -1
  13. package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -1
  14. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
  17. package/lib/commonjs/ios/withCIOIos.js.map +1 -1
  18. package/lib/commonjs/ios/withNotificationsXcodeProject.js +1 -1
  19. package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
  20. package/lib/commonjs/ios/withXcodeProject.js.map +1 -1
  21. package/lib/commonjs/postInstall.js.map +1 -1
  22. package/lib/commonjs/postInstallHelper.js.map +1 -1
  23. package/lib/commonjs/types/cio-types.js.map +1 -1
  24. package/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
  25. package/lib/module/android/withAppGoogleServices.js.map +1 -1
  26. package/lib/module/android/withCIOAndroid.js.map +1 -1
  27. package/lib/module/android/withGistMavenRepository.js.map +1 -1
  28. package/lib/module/android/withGoogleServicesJSON.js.map +1 -1
  29. package/lib/module/android/withProjectGoogleServices.js.map +1 -1
  30. package/lib/module/helpers/constants/android.js.map +1 -1
  31. package/lib/module/helpers/constants/globals.d.js.map +1 -1
  32. package/lib/module/helpers/constants/ios.js.map +1 -1
  33. package/lib/module/helpers/utils/codeInjection.js.map +1 -1
  34. package/lib/module/helpers/utils/fileManagement.js.map +1 -1
  35. package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/ios/withAppDelegateModifications.js.map +1 -1
  38. package/lib/module/ios/withCIOIos.js.map +1 -1
  39. package/lib/module/ios/withNotificationsXcodeProject.js +1 -1
  40. package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
  41. package/lib/module/ios/withXcodeProject.js.map +1 -1
  42. package/lib/module/postInstall.js.map +1 -1
  43. package/lib/module/postInstallHelper.js.map +1 -1
  44. package/lib/module/types/cio-types.js.map +1 -1
  45. package/package.json +3 -1
  46. package/src/ios/withNotificationsXcodeProject.ts +1 -1
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
- <p align="center">
1
+ <p align=center>
2
2
  <a href="https://customer.io">
3
- <img src="https://user-images.githubusercontent.com/6409227/144680509-907ee093-d7ad-4a9c-b0a5-f640eeb060cd.png" height="60">
3
+ <img src="https://avatars.githubusercontent.com/u/1152079?s=200&v=4" height="60">
4
4
  </a>
5
- <p align="center">Power automated communication that people like to receive.</p>
6
5
  </p>
7
6
 
8
7
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md)
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./lib/commonjs/index");
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log","exports"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\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 hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,kCAAmB,EAACD,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,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log","exports"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\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 hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,kCAAmB,EAACD,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,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log","exports"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, 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';\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 console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,+BAAsB,CAAC;IAChD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EAClB,OAAML,+BAAuB,EAChC,CAAC;IACH,CAAC,MAAM;MACLM,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log","exports"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, 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';\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 console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,+BAAsB,CAAC;IAChD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EACnB,OAAOL,+BAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLM,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAEO,SAASK,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAG,IAAAE,gDAAuB,EAACF,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAG,oDAAyB,EAACH,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAI,4CAAqB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAK,8CAAsB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACK,0BAA0B,EAAE;IACpCN,MAAM,GAAG,IAAAO,sDAA0B,EAACP,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf"}
1
+ {"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAEO,SAASK,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAG,IAAAE,gDAAuB,EAACF,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAG,oDAAyB,EAACH,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAI,4CAAqB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAK,8CAAsB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACK,0BAA0B,EAAE;IACpCN,MAAM,GAAG,IAAAO,sDAA0B,EAACP,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log","exports"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } 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 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 console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACC,6BAAoB,CAAC;IACzE,IAAI,CAACJ,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACG,OAAO,CAC3DC,sCAA6B,EAC5B,OAAMC,uCAA+B,EACxC,CAAC;IACH,CAAC,MAAM;MACLC,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log","exports"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } 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 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 console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACC,6BAAoB,CAAC;IACzE,IAAI,CAACJ,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACG,OAAO,CAC3DC,sCAA6B,EAC7B,OAAOC,uCAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLC,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\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 (e) {\n console.log(\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 console.log(\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 console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAO,IAAAC,qCAAsB,EAACF,WAAW,EAAGG,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACK,8BAAc,CAACC,MAAM,CAAE,GAAEL,WAAY,2BAA0B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EACjB,GAAEH,WAAY,2BACjB,CAAC;QACH,CAAC,CAAC,OAAOO,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACR,4FAA2FT,WAAY,2BAC1G,CAAC;QACH;MACF,CAAC,MAAM;QACLQ,OAAO,CAACC,GAAG,CACR,wCAAuCN,kBAAmB,yDAAwDH,WAAY,2BACjI,CAAC;MACH;IACF,CAAC,MAAM;MACLQ,OAAO,CAACC,GAAG,CACR,wBAAuBT,WAAY,wCACtC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACY,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\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 (e) {\n console.log(\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 console.log(\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 console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAO,IAAAC,qCAAsB,EAACF,WAAW,EAAGG,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACK,8BAAc,CAACC,MAAM,CAAC,GAAGL,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,OAAOO,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACT,4FAA4FT,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLQ,OAAO,CAACC,GAAG,CACT,wCAAwCN,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLQ,OAAO,CAACC,GAAG,CACT,wBAAwBT,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACY,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","exports"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,mCAA0B,CAAC;IACpD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC7B,OAAML,mCAA2B,EACpC,CAAC;IACH;IAEA,OAAOH,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","exports"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,mCAA0B,CAAC;IACpD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC9B,OAAOL,mCAA0B,EACnC,CAAC;IACH;IAEA,OAAOH,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","exports","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GACzC,4CAA4C;AACvC,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,2CAA2C;AACvE,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAC/B,4CAA4C;AACvC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GACxC,kDAAkD;AAE7C,MAAMC,8BAA8B,GAAAJ,OAAA,CAAAI,8BAAA,GACzC,kDAAkD;AAC7C,MAAMC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,GACjC,2EAA2E;AACtE,MAAMC,0BAA0B,GAAAN,OAAA,CAAAM,0BAAA,GACrC,sFAAsF"}
1
+ {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","exports","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GACzC,4CAA4C;AACvC,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,2CAA2C;AACvE,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAC/B,4CAA4C;AACvC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GACxC,kDAAkD;AAE7C,MAAMC,8BAA8B,GAAAJ,OAAA,CAAAI,8BAAA,GACzC,kDAAkD;AAC7C,MAAMC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,GACjC,2EAA2E;AACtE,MAAMC,0BAA0B,GAAAN,OAAA,CAAAM,0BAAA,GACrC,sFAAsF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["finder","require","path","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_RN_SDK","exports","join","LOCAL_PATH_TO_CIO_NSE_FILES","getRelativePathToRNSDK","currentFile","relative","IOS_DEPLOYMENT_TARGET","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DEEPLINK_COMMENT_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["const finder = require('find-package-json');\nconst path = require('path');\n\nconst f = finder(__dirname);\nlet pluginPackageRoot = f.next().filename;\n// This is the path to the root of the customerio-expo-plugin package\npluginPackageRoot = path.dirname(pluginPackageRoot);\n\nexport const LOCAL_PATH_TO_RN_SDK = path.join(\n pluginPackageRoot,\n '../customerio-reactnative'\n);\n\nexport const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'src/helpers/native-files/ios'\n);\n\nexport function getRelativePathToRNSDK(currentFile: string) {\n return path.relative(path.dirname(currentFile), LOCAL_PATH_TO_RN_SDK);\n}\n\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /.*\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /(@interface AppDelegate\\s*:\\s*EXAppDelegateWrapper\\s*)(<([^>]+)>)?/;\n\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*RCTBridge\\s*\\*\\s*\\w+\\s*=\\s*\\[\\s*self\\.reactDelegate\\s+createBridgeWithDelegate:self\\s+launchOptions:launchOptions\\s*\\];\\s*$/gm;\n\nexport const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*return\\s\\[\\s*super\\s*application:\\s*application\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\];/gm;\n\nexport const CIO_DEEPLINK_COMMENT_REGEX =\n /\\sDeep link workaround for app killed state start/gm;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\n\nexport const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;\nexport const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET =\n 'UNUserNotificationCenterDelegate';\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `\nRCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];\n`;\n\nexport const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `\nreturn [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification];\n`;\n\nexport const CIO_INITIALIZECIOSDK_SNIPPET = ` \n [pnHandlerObj initializeCioSdk];\n\n// Code to make the CIO SDK compatible with expo-notifications package.\n// \n// The CIO SDK and expo-notifications both need to handle when a push gets clicked. However, iOS only allows one click handler to be set per app.\n// To get around this limitation, we set the CIO SDK as the click handler. The CIO SDK sets itself up so that when another SDK or host iOS app \n// sets itself as the click handler, the CIO SDK will still be able to handle when the push gets clicked, even though it's not the designated \n// click handler in iOS at runtime. \n// \n// This should work for most SDKs. However, expo-notifications is unique in it's implementation. It will not setup push click handling it if detects \n// that another SDK or host iOS app has already set itself as the click handler:\n// https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37\n// ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.\n//\n// Note: Initialize the native iOS SDK and setup SDK push click handling before running this code. \n# if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n // Creating a new instance, as the comments in expo-notifications suggests, does not work. With this code, if you send a CIO push to device and click on it,\n // no push metrics reporting will occur.\n // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];\n\n // ...instead, get the singleton reference from Expo. \n id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n center.delegate = notificationCenterDelegate;\n# endif\n`;\n\nexport const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `\n// Deep link workaround for app killed state start\nNSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];\n if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {\n NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];\n if (pushContent[@\"CIO\"] && pushContent[@\"CIO\"][@\"push\"] && pushContent[@\"CIO\"][@\"push\"][@\"link\"]) {\n NSString *initialURL = pushContent[@\"CIO\"][@\"push\"][@\"link\"];\n if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {\n modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];\n }\n }\n }\n//Deep link workaround for app killed state ends\n`;\n\nexport 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 }`;\n"],"mappings":";;;;;;;AAAA,MAAMA,MAAM,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAME,CAAC,GAAGH,MAAM,CAACI,SAAS,CAAC;AAC3B,IAAIC,iBAAiB,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;AACzC;AACAF,iBAAiB,GAAGH,IAAI,CAACM,OAAO,CAACH,iBAAiB,CAAC;AAE5C,MAAMI,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGP,IAAI,CAACS,IAAI,CAC3CN,iBAAiB,EACjB,2BACF,CAAC;AAEM,MAAMO,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAGV,IAAI,CAACS,IAAI,CAClDN,iBAAiB,EACjB,8BACF,CAAC;AAEM,SAASQ,sBAAsBA,CAACC,WAAmB,EAAE;EAC1D,OAAOZ,IAAI,CAACa,QAAQ,CAACb,IAAI,CAACM,OAAO,CAACM,WAAW,CAAC,EAAEL,oBAAoB,CAAC;AACvE;AAEO,MAAMO,qB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MAAMC,8CAA8C,GAAAzB,OAAA,CAAAyB,8CAAA,GAAI;AAC/D;AACA,CAAC;AACM,MAAMC,8CAA8C,GAAA1B,OAAA,CAAA0B,8CAAA,GAAI;AAC/D;AACA,CAAC;AAEM,MAAMC,yCAAyC,GAAA3B,OAAA,CAAA2B,yCAAA,GAAI;AAC1D,4FAA4F;AAErF,MAAMC,4DAA4D,GAAA5B,OAAA,CAAA4B,4DAAA,GAAI;AAC7E;AACA;AACA,CAAC;AAEM,MAAMC,4DAA4D,GAAA7B,OAAA,CAAA6B,4DAAA,GAAI;AAC7E;AACA;AACA,CAAC;AAEM,MAAMC,2CAA2C,GAAA9B,OAAA,CAAA8B,2CAAA,GAAI;AAC5D;AACA;AACA,CAAC;AAEM,MAAMC,4BAA4B,GAAA/B,OAAA,CAAA+B,4BAAA,GAAI;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yCAAyC,GAAAhC,OAAA,CAAAgC,yCAAA,GAAI;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,qCAAqC,GAAAjC,OAAA,CAAAiC,qCAAA,GAAI;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI"}
1
+ {"version":3,"names":["finder","require","path","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_RN_SDK","exports","join","LOCAL_PATH_TO_CIO_NSE_FILES","getRelativePathToRNSDK","currentFile","relative","IOS_DEPLOYMENT_TARGET","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DEEPLINK_COMMENT_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["const finder = require('find-package-json');\nconst path = require('path');\n\nconst f = finder(__dirname);\nlet pluginPackageRoot = f.next().filename;\n// This is the path to the root of the customerio-expo-plugin package\npluginPackageRoot = path.dirname(pluginPackageRoot);\n\nexport const LOCAL_PATH_TO_RN_SDK = path.join(\n pluginPackageRoot,\n '../customerio-reactnative'\n);\n\nexport const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'src/helpers/native-files/ios'\n);\n\nexport function getRelativePathToRNSDK(currentFile: string) {\n return path.relative(path.dirname(currentFile), LOCAL_PATH_TO_RN_SDK);\n}\n\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /.*\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /(@interface AppDelegate\\s*:\\s*EXAppDelegateWrapper\\s*)(<([^>]+)>)?/;\n\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*RCTBridge\\s*\\*\\s*\\w+\\s*=\\s*\\[\\s*self\\.reactDelegate\\s+createBridgeWithDelegate:self\\s+launchOptions:launchOptions\\s*\\];\\s*$/gm;\n\nexport const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*return\\s\\[\\s*super\\s*application:\\s*application\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\];/gm;\n\nexport const CIO_DEEPLINK_COMMENT_REGEX =\n /\\sDeep link workaround for app killed state start/gm;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\n\nexport const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;\nexport const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET =\n 'UNUserNotificationCenterDelegate';\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `\nRCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];\n`;\n\nexport const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `\nreturn [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification];\n`;\n\nexport const CIO_INITIALIZECIOSDK_SNIPPET = ` \n [pnHandlerObj initializeCioSdk];\n\n// Code to make the CIO SDK compatible with expo-notifications package.\n// \n// The CIO SDK and expo-notifications both need to handle when a push gets clicked. However, iOS only allows one click handler to be set per app.\n// To get around this limitation, we set the CIO SDK as the click handler. The CIO SDK sets itself up so that when another SDK or host iOS app \n// sets itself as the click handler, the CIO SDK will still be able to handle when the push gets clicked, even though it's not the designated \n// click handler in iOS at runtime. \n// \n// This should work for most SDKs. However, expo-notifications is unique in it's implementation. It will not setup push click handling it if detects \n// that another SDK or host iOS app has already set itself as the click handler:\n// https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37\n// ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.\n//\n// Note: Initialize the native iOS SDK and setup SDK push click handling before running this code. \n# if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n // Creating a new instance, as the comments in expo-notifications suggests, does not work. With this code, if you send a CIO push to device and click on it,\n // no push metrics reporting will occur.\n // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];\n\n // ...instead, get the singleton reference from Expo. \n id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n center.delegate = notificationCenterDelegate;\n# endif\n`;\n\nexport const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `\n// Deep link workaround for app killed state start\nNSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];\n if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {\n NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];\n if (pushContent[@\"CIO\"] && pushContent[@\"CIO\"][@\"push\"] && pushContent[@\"CIO\"][@\"push\"][@\"link\"]) {\n NSString *initialURL = pushContent[@\"CIO\"][@\"push\"][@\"link\"];\n if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {\n modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];\n }\n }\n }\n//Deep link workaround for app killed state ends\n`;\n\nexport 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 }`;\n"],"mappings":";;;;;;;AAAA,MAAMA,MAAM,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAME,CAAC,GAAGH,MAAM,CAACI,SAAS,CAAC;AAC3B,IAAIC,iBAAiB,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;AACzC;AACAF,iBAAiB,GAAGH,IAAI,CAACM,OAAO,CAACH,iBAAiB,CAAC;AAE5C,MAAMI,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGP,IAAI,CAACS,IAAI,CAC3CN,iBAAiB,EACjB,2BACF,CAAC;AAEM,MAAMO,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAGV,IAAI,CAACS,IAAI,CAClDN,iBAAiB,EACjB,8BACF,CAAC;AAEM,SAASQ,sBAAsBA,CAACC,WAAmB,EAAE;EAC1D,OAAOZ,IAAI,CAACa,QAAQ,CAACb,IAAI,CAACM,OAAO,CAACM,WAAW,CAAC,EAAEL,oBAAoB,CAAC;AACvE;AAEO,MAAMO,qBAAqB,GAAAN,OAAA,CAAAM,qBAAA,GAAG,MAAM;AACpC,MAAMC,+BAA+B,GAAAP,OAAA,CAAAO,+BAAA,GAAG,wBAAwB;AAChE,MAAMC,mCAAmC,GAAAR,OAAA,CAA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M,MAAMC,yCAAyC,GAAA3B,OAAA,CAAA2B,yCAAA,GAAG;AACzD,4FAA4F;AAErF,MAAMC,4DAA4D,GAAA5B,OAAA,CAAA4B,4DAAA,GAAG;AAC5E;AACA;AACA,CAAC;AAEM,MAAMC,4DAA4D,GAAA7B,OAAA,CAAA6B,4DAAA,GAAG;AAC5E;AACA;AACA,CAAC;AAEM,MAAMC,2CAA2C,GAAA9B,OAAA,CAAA8B,2CAAA,GAAG;AAC3D;AACA;AACA,CAAC;AAEM,MAAMC,4BAA4B,GAAA/B,OAAA,CAAA+B,4BAAA,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yCAAyC,GAAAhC,OAAA,CAAAgC,yCAAA,GAAG;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,qCAAqC,GAAAjC,OAAA,CAAAiC,qCAAA,GAAG;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","injectCodeBeforeMultiLineRegex","replaceCodeByRegex","matchRegexExists","regex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber","join"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function injectCodeBeforeMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}\\n$&`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function matchRegexExists(fileContent: string, regex: RegExp) {\n return regex.test(fileContent);\n}\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;AAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB;AAEO,SAASE,0BAA0BA,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEO,SAASW,8BAA8BA,CAC5Cb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,MAAK,CAAC;AACzD;AAEO,SAASY,kBAAkBA,CAChCd,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAEC,OAAO,CAAC;AAChD;AAEO,SAASa,gBAAgBA,CAACf,WAAmB,EAAEgB,KAAa,EAAE;EACnE,OAAOA,KAAK,CAACR,IAAI,CAACR,WAAW,CAAC;AAChC;AACO,SAASiB,wCAAwCA,CACtDjB,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEO,SAASgB,sBAAsBA,CACpClB,WAAmB,EACnBK,KAAa,EACbH,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,IAAIK,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO,CAACU,IAAI,CAAC,IAAI,CAAC;AAC3B"}
1
+ {"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","injectCodeBeforeMultiLineRegex","replaceCodeByRegex","matchRegexExists","regex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber","join"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function injectCodeBeforeMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}\\n$&`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function matchRegexExists(fileContent: string, regex: RegExp) {\n return regex.test(fileContent);\n}\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;AAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAA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{"version":3,"names":["_fs","require","FileManagement","read","path","Promise","resolve","reject","readFile","err","data","write","contents","writeFile","append","appendFile","exists","existsSync","copyFile","src","dest","copyFileSync","console","log","mkdir","options","mkdirSync","writeFileSync","readFileSync","exports"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\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 console.log(`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 console.log(`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 console.log(`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 console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAYO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAIA,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC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AAEX,GAAG,CAAC;IACjE;EACF;EAEA,OAAOe,KAAKA,CAACpB,IAAY,EAAEqB,OAA6B,EAAE;IACxD,IAAI;MACF,IAAAC,aAAS,EAACtB,IAAI,EAAEqB,OAAO,CAAC;IAC1B,CAAC,CAAC,OAAOhB,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,4BAA2BnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IACxD;EACF;EAEA,OAAOI,SAASA,CAACT,IAAY,EAAEM,IAAY,EAAE;IAC3C,IAAI;MACF,IAAAiB,iBAAa,EAACvB,IAAI,EAAEM,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,yBAAwBnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IACrD;EACF;EAEA,OAAOD,QAAQA,CAACJ,IAAY,EAAE;IAC5B,IAAI;MACF,OAAO,IAAAwB,gBAAY,EAACxB,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOK,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,sBAAqBnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF;AAACoB,OAAA,CAAA3B,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_fs","require","FileManagement","read","path","Promise","resolve","reject","readFile","err","data","write","contents","writeFile","append","appendFile","exists","existsSync","copyFile","src","dest","copyFileSync","console","log","mkdir","options","mkdirSync","writeFileSync","readFileSync","exports"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\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 console.log(`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 console.log(`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 console.log(`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 console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAYO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAIA,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9C,IAAAC,YAAQ,EAACJ,IAAI,EAAE,MAAM,EAAE,CAACK,GAAG,EAAEC,IAAI,KAAK;QACpC,IAAID,GAAG,IAAI,CAACC,IAAI,EAAE;UAChBH,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,CAACI,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAKA,CAACP,IAAY,EAAEQ,QAAgB,EAAiB;IAChE,OAAO,IAAIP,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAAM,aAAS,EAACT,IAAI,EAAEQ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AAE;MACZa,OAAO,CAACC,GAAG,CAAC,yBAAyBnB,IAAI,IAAI,EAAEK,GAAG,CAAC;IACrD;EACF;EAEA,OAAOD,QAAQA,CAACJ,IAAY,EAAE;IAC5B,IAAI;MACF,OAAO,IAAAwB,gBAAY,EAACxB,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOK,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAC,sBAAsBnB,IAAI,IAAI,EAAEK,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF;AAACoB,OAAA,CAAA3B,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_ios","require","_codeInjection","_fileManagement","injectCIOPodfileCode","iosPath","blockStart","blockEnd","filename","podfile","FileManagement","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","getRelativePathToRNSDK","trim","write","injectCodeByRegex","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\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 console.log('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAEO,eAAeG,oBAAoBA,CAACC,OAAe,EAAE;EAC1D,MAAMC,UAAU,GAAG,qCAAqC;EACxD,MAAMC,QAAQ,GAAG,mCAAmC;EAEpD,MAAMC,QAAQ,GAAI,GAAEH,OAAQ,UAAS;EACrC,MAAMI,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EACnD,MAAMI,OAAO,GAAGH,OAAO,CAACI,KAAK,CAAC,IAAIC,MAAM,CAACR,UAAU,CAAC,CAAC;EAErD,IAAI,CAACM,OAAO,EAAE;IACZ;IACA;IACA;IACA,MAAMG,kCAAkC,GAAG,+BAA+B;IAE1E,MAAMC,wBAAwB,GAAI;AACtC,EAAEV,UAAW;AACb,gDAAgD,IAAAW,2BAAsB,EAClET,QACF,CAAE;AACJ,EAAED,QAAS;AACX,CAAC,CAACW,IAAI,CAAC,CAAC;IAEJR,8BAAc,CAACS,KAAK,CAClBX,QAAQ,EACR,IAAAY,gCAAiB,EACfX,OAAO,EACPM,kCAAkC,EAClCC,wBACF,CAAC,CAACK,IAAI,CAAC,IAAI,CACb,CAAC;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEO,eAAeC,gCAAgCA,CACpDnB,OAAe,EACfoB,aAA0D,EAC1D;EACA,MAAMjB,QAAQ,GAAI,GAAEH,OAAQ,UAAS;EACrC,MAAMI,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EAEnD,MAAMF,UAAU,GAAG,yCAAyC;EAC5D,MAAMC,QAAQ,GAAG,uCAAuC;EAExD,MAAMK,OAAO,GAAGH,OAAO,CAACI,KAAK,CAAC,IAAIC,MAAM,CAACR,UAAU,CAAC,CAAC;EAErD,IAAI,CAACM,OAAO,EAAE;IACZ,MAAMI,wBAAwB,GAAI;AACtC,EAAEV,UAAW;AACb;AACA,IAAImB,aAAa,KAAK,QAAQ,GAAG,qCAAqC,GAAG,EAAG;AAC5E,yDAAyD,IAAAR,2BAAsB,EAC3ET,QACF,CAAE;AACJ;AACA,EAAED,QAAS;AACX,CAAC,CAACW,IAAI,CAAC,CAAC;IAEJR,8BAAc,CAACgB,MAAM,CAAClB,QAAQ,EAAEQ,wBAAwB,CAAC;EAC3D;AACF"}
1
+ {"version":3,"names":["_ios","require","_codeInjection","_fileManagement","injectCIOPodfileCode","iosPath","blockStart","blockEnd","filename","podfile","FileManagement","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","getRelativePathToRNSDK","trim","write","injectCodeByRegex","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\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 console.log('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAEO,eAAeG,oBAAoBA,CAACC,OAAe,EAAE;EAC1D,MAAMC,UAAU,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,EAAED,QAAQ;AACV,CAAC,CAACW,IAAI,CAAC,CAAC;IAEJR,8BAAc,CAACgB,MAAM,CAAClB,QAAQ,EAAEQ,wBAAwB,CAAC;EAC3D;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_withCIOAndroid","require","_withCIOIos","withCustomerIOPlugin","config","props","ios","withCIOIos","android","withCIOAndroid","_default","exports","default"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\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 if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA;AACA,SAASE,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAG,IAAAG,sBAAU,EAACH,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACG,OAAO,EAAE;IACjBJ,MAAM,GAAG,IAAAK,8BAAc,EAACL,MAAM,EAAEC,KAAK,CAACG,OAAO,CAAC;EAChD;EAEA,OAAOJ,MAAM;AACf;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcT,oBAAoB"}
1
+ {"version":3,"names":["_withCIOAndroid","require","_withCIOIos","withCustomerIOPlugin","config","props","ios","withCIOIos","android","withCIOAndroid","_default","exports","default"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\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 if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA;AACA,SAASE,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAG,IAAAG,sBAAU,EAACH,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACG,OAAO,EAAE;IACjBJ,MAAM,GAAG,IAAAK,8BAAc,EAACL,MAAM,EAAEC,KAAK,CAACG,OAAO,CAAC;EAChD;EAEA,OAAOJ,MAAM;AACf;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcT,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_Paths","_ios","_codeInjection","_fileManagement","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","injectCodeByLineNumber","addNotificationHandlerDeclaration","injectCodeByMultiLineRegex","CIO_APPDELEGATEDECLARATION_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","addNotificationConfiguration","injectCodeBeforeMultiLineRegex","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","addInitializeNativeCioSdk","CIO_INITIALIZECIOSDK_SNIPPET","addHandleDeeplinkInKilledStateConfiguration","regex","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","addDidFailToRegisterForRemoteNotificationsWithError","injectCodeByMultiLineRegexAndReplaceLine","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","addDidRegisterForRemoteNotificationsWithDeviceToken","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","addExpoNotificationsHeaderModification","addAppdelegateHeaderModification","replace","CIO_APPDELEGATEHEADER_REGEX","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","trim","addHandleDeeplinkInKilledState","matchRegexExists","CIO_DEEPLINK_COMMENT_REGEX","snippet","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","replaceCodeByRegex","withAppDelegateModifications","configOuter","props","withAppDelegate","config","modResults","contents","RegExp","modRequest","projectName","headerPath","getAppDelegateHeaderFilePath","projectRoot","headerContent","FileManagement","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log","exports"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, 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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\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 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 = undefined;\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 // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\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":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OA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MAC/DC,8BAAc,CAACE,KAAK,CAACN,UAAU,EAAEG,aAAa,CAAC;MAE/ChE,cAAc,GAAGD,SAAS,CACxBC,cAAc,EACduD,MAAM,CAACI,UAAU,CAACC,WACpB,CAAC;MACD5D,cAAc,GAAGW,iCAAiC,CAACX,cAAc,CAAC;;MAElE;MACA,IACEqD,KAAK,CAACe,+BAA+B,KAAK5D,SAAS,IACnD6C,KAAK,CAACe,+BAA+B,KAAK,KAAK,EAC/C;QACApE,cAAc,GAAGe,4BAA4B,CAACf,cAAc,CAAC;MAC/D;MAEAA,cAAc,GAAGmB,yBAAyB,CAACnB,cAAc,CAAC;MAE1D,IACEqD,KAAK,CAACgB,2BAA2B,KAAK7D,SAAS,IAC/C6C,KAAK,CAACgB,2BAA2B,KAAK,IAAI,EAC1C;QACArE,cAAc,GAAG0C,8BAA8B,CAAC1C,cAAc,CAAC;MACjE;MAEAA,cAAc,GACZwB,mDAAmD,CAACxB,cAAc,CAAC;MACrEA,cAAc,GACZ4B,mDAAmD,CAAC5B,cAAc,CAAC;MAErEA,cAAc,GAAG+B,sCAAsC,CAAC/B,cAAc,CAAC;MAEvEuD,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGzD,cAAc;IAC7C,CAAC,MAAM;MACLsE,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOhB,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACiB,OAAA,CAAArB,4BAAA,GAAAA,4BAAA;AACF,SAAS/C,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAQ;AACV;AACA;AACA,WAAWA,OAAQ;AACnB,GAAG;AACH"}
1
+ {"version":3,"names":["_configPlugins","require","_Paths","_ios","_codeInjection","_fileManagement","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","injectCodeByLineNumber","addNotificationHandlerDeclaration","injectCodeByMultiLineRegex","CIO_APPDELEGATEDECLARATION_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","addNotificationConfiguration","injectCodeBeforeMultiLineRegex","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","addInitializeNativeCioSdk","CIO_INITIALIZECIOSDK_SNIPPET","addHandleDeeplinkInKilledStateConfiguration","regex","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","addDidFailToRegisterForRemoteNotificationsWithError","injectCodeByMultiLineRegexAndReplaceLine","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","addDidRegisterForRemoteNotificationsWithDeviceToken","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","addExpoNotificationsHeaderModification","addAppdelegateHeaderModification","replace","CIO_APPDELEGATEHEADER_REGEX","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","trim","addHandleDeeplinkInKilledState","matchRegexExists","CIO_DEEPLINK_COMMENT_REGEX","snippet","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","replaceCodeByRegex","withAppDelegateModifications","configOuter","props","withAppDelegate","config","modResults","contents","RegExp","modRequest","projectName","headerPath","getAppDelegateHeaderFilePath","projectRoot","headerContent","FileManagement","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log","exports"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, 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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\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 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 = undefined;\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 // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\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":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,IAAA,GAAAF,OAAA;AAoBA,IAAAG,cAAA,GAAAH,OAAA;AAQA,IAAAI,eAAA,GAAAJ,OAAA;AAGA,MAAMK,SAAS,GAAGA,CAACC,cAAsB,EAAEC,OAAe,KAAK;EAC7D,MAAMC,WAAW,GAAG,mBAAmB;EACvC,MAAMC,WAAW,GAAGC,gBAAgB,CAACH,OAAO,CAAC;EAE7C,MAAMI,KAAK,GAAGL,cAAc,CAACK,KAAK,CAACH,WAAW,CAAC;EAC/C,IAAII,eAAuB;EAC3B,IAAI,CAACD,KAAK,IAAIA,KAAK,CAACE,KAAK,KAAKC,SAAS,EAAE;IACvC;IACAF,eAAe,GAAG,CAAC;EACrB,CAAC,MAAM;IACL;IACAA,eAAe,GAAGD,KAAK,CAACE,KAAK,GAAGF,KAAK,CAAC,CAAC,CAAC,CAACI,MAAM;EACjD;EAEAT,cAAc,GAAG,IAAAU,qCAAsB,EACrCV,cAAc,EACdM,eAAe,EACfH,WACF,CAAC;EAED,OAAOH,cAAc;AACvB,CAAC;AAED,MAAMW,iCAAiC,GAAIX,cAAsB,IAAK;EACpEA,cAAc,GAAG,IAAAY,yCAA0B,EACzCZ,cAAc,EACda,qCAAgC,EAChCC,mDACF,CAAC;EAED,OAAOd,cAAc;AACvB,CAAC;AAED,MAAMe,4BAA4B,GAAIf,cAAsB,IAAK;EAC/DA,cAAc,GAAG,IAAAgB,6CAA8B,EAC7ChB,cAAc,EACdiB,uCAAkC,EAClCC,gDACF,CA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ACzC,OAAO;AACT;AACA;AACA,WAAWA,OAAO;AAClB,GAAG;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_withAppDelegateModifications","require","_withNotificationsXcodeProject","_withXcodeProject","withCIOIos","config","props","pushNotification","withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,6BAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAG,IAAAG,0DAA4B,EAACH,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAG,IAAAI,+DAAgC,EAACJ,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAG,IAAAK,qCAAmB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOD,MAAM;AACf"}
1
+ {"version":3,"names":["_withAppDelegateModifications","require","_withNotificationsXcodeProject","_withXcodeProject","withCIOIos","config","props","pushNotification","withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,6BAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAG,IAAAG,0DAA4B,EAACH,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAG,IAAAI,+DAAgC,EAACJ,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAG,IAAAK,qCAAmB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -157,7 +157,7 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
157
157
  if (typeof configurations[key].buildSettings !== 'undefined' && configurations[key].buildSettings.PRODUCT_NAME === `"${_ios.CIO_NOTIFICATION_TARGET_NAME}"`) {
158
158
  const buildSettingsObj = configurations[key].buildSettings;
159
159
  buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
160
- buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '13.0';
160
+ buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '13.4';
161
161
  buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
162
162
  buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
163
163
  buildSettingsObj.SWIFT_VERSION = 4.2;
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","files","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","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","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","_options$pushNotifica4","_options$pushNotifica6","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","_options$pushNotifica3","apiKey","_options$pushNotifica5","region","_options$pushNotifica7","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica8","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} 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';\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) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\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 {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = 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 pushNotification,\n };\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\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 await injectCIONotificationPodfileCode(iosPath, useFrameworks);\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 files = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.swift',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n files.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${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 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 || '13.0';\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 SITE_ID_RE = /\\{\\{SITE_ID\\}\\}/;\n const API_KEY_RE = /\\{\\{API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.siteId) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n SITE_ID_RE,\n options.pushNotification?.env?.siteId\n );\n }\n\n if (options.pushNotification?.env?.apiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n API_KEY_RE,\n options.pushNotification?.env?.apiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.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 const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\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(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} 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}/${file}`, 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\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SITE_ID\\}\\}/,\n options.pushNotification.env.siteId\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{API_KEY\\}\\}/,\n options.pushNotification.env.apiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AAEA,MAAMK,cAAc,GAAI,GAAEC,iCAA6B,aAAY;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAI,OAAM;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,KAC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AC7CrB,OAAO,CAAC2H,uBAAuB,KAAK,IAAI;EAC1C/B,cAAc,GAAG,IAAAT,iCAAkB,EACjCS,cAAc,EACd,qCAAqC,EACrC+B,uBAAuB,CAACD,QAAQ,CAAC,CACnC,CAAC;EAEDpF,8BAAc,CAAC8C,SAAS,CAACC,WAAW,EAAEO,cAAc,CAAC;AACvD,CAAC"}
1
+ {"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","files","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","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","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","_options$pushNotifica4","_options$pushNotifica6","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","_options$pushNotifica3","apiKey","_options$pushNotifica5","region","_options$pushNotifica7","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica8","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} 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';\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) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\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 {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = 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 pushNotification,\n };\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\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 await injectCIONotificationPodfileCode(iosPath, useFrameworks);\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 files = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.swift',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n files.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${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 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 || '13.4';\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 SITE_ID_RE = /\\{\\{SITE_ID\\}\\}/;\n const API_KEY_RE = /\\{\\{API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.siteId) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n SITE_ID_RE,\n options.pushNotification?.env?.siteId\n );\n }\n\n if (options.pushNotification?.env?.apiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n API_KEY_RE,\n options.pushNotification?.env?.apiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.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 const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\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(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} 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}/${file}`, 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\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SITE_ID\\}\\}/,\n options.pushNotification.env.siteId\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{API_KEY\\}\\}/,\n options.pushNotification.env.apiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AA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AO,CAACyH,mBAAmB,KAAK,IAAI;EACtC7B,cAAc,GAAG,IAAAT,iCAAkB,EACjCS,cAAc,EACd,gCAAgC,EAChC6B,mBAAmB,CAACC,QAAQ,CAAC,CAC/B,CAAC;EAED,MAAMC,uBAAuB,GAC3B3H,OAAO,CAAC2H,uBAAuB,KAAKtG,SAAS,IAC7CrB,OAAO,CAAC2H,uBAAuB,KAAK,IAAI;EAC1C/B,cAAc,GAAG,IAAAT,iCAAkB,EACjCS,cAAc,EACd,qCAAqC,EACrC+B,uBAAuB,CAACD,QAAQ,CAAC,CACnC,CAAC;EAEDpF,8BAAc,CAAC8C,SAAS,CAACC,WAAW,EAAEO,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","withCioXcodeProject","config","cioProps","withXcodeProject","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget","injectCIOPodfileCode","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath);\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAGO,MAAME,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEX,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEW,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEgB;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAM,IAAAY,0CAAoB,EAACX,OAAO,CAAC;IAEnC,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACgB,OAAA,CAAApB,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","withCioXcodeProject","config","cioProps","withXcodeProject","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget","injectCIOPodfileCode","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath);\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAGO,MAAME,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEX,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEW,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEgB;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAM,IAAAY,0CAAoB,EAACX,OAAO,CAAC;IAEnC,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACgB,OAAA,CAAApB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":";;AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":";;AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["fs","require","runPostInstall","rnPjsonFile","__dirname","expoPjsonFile","existsSync","rnPJson","readFileSync","expoPjson","rnPackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;\n const expoPjsonFile = `${__dirname}/../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(rnPjsonFile)) {\n const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');\n expoPjson = require(expoPjsonFile);\n\n const rnPackage = JSON.parse(rnPJson);\n rnPackage.expoVersion = expoPjson.version;\n\n\n fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));\n }\n } catch (error) {}\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":";;AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,WAAW,GAAI,GAAEC,SAAU,4CAA2C;EAC5E,MAAMC,aAAa,GAAI,GAAED,SAAU,kBAAiB;EACpD,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,WAAW,CAAC,EAAE;MAC9B,MAAMI,OAAO,GAAGP,EAAE,CAACQ,YAAY,CAACL,WAAW,EAAE,MAAM,CAAC;MACpDM,SAAS,GAAGR,OAAO,CAACI,aAAa,CAAC;MAElC,MAAMK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACL,OAAO,CAAC;MACrCG,SAAS,CAACG,WAAW,GAAGJ,SAAS,CAACK,OAAO;MAGzCd,EAAE,CAACe,aAAa,CAACZ,WAAW,EAAEQ,IAAI,CAACK,SAAS,CAACN,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE,CAAC;AACnB;AAEAC,OAAO,CAAChB,cAAc,GAAGA,cAAc"}
1
+ {"version":3,"names":["fs","require","runPostInstall","rnPjsonFile","__dirname","expoPjsonFile","existsSync","rnPJson","readFileSync","expoPjson","rnPackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;\n const expoPjsonFile = `${__dirname}/../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(rnPjsonFile)) {\n const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');\n expoPjson = require(expoPjsonFile);\n\n const rnPackage = JSON.parse(rnPJson);\n rnPackage.expoVersion = expoPjson.version;\n\n\n fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));\n }\n } catch (error) {}\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":";;AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,WAAW,GAAG,GAAGC,SAAS,4CAA4C;EAC5E,MAAMC,aAAa,GAAG,GAAGD,SAAS,kBAAkB;EACpD,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,WAAW,CAAC,EAAE;MAC9B,MAAMI,OAAO,GAAGP,EAAE,CAACQ,YAAY,CAACL,WAAW,EAAE,MAAM,CAAC;MACpDM,SAAS,GAAGR,OAAO,CAACI,aAAa,CAAC;MAElC,MAAMK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACL,OAAO,CAAC;MACrCG,SAAS,CAACG,WAAW,GAAGJ,SAAS,CAACK,OAAO;MAGzCd,EAAE,CAACe,aAAa,CAACZ,WAAW,EAAEQ,IAAI,CAACK,SAAS,CAACN,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE,CAAC;AACnB;AAEAC,OAAO,CAAChB,cAAc,GAAGA,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\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 disableNotificationRegistration?: boolean;\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 showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n siteId: string;\n apiKey: string;\n region: string;\n };\n };\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\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 disableNotificationRegistration?: boolean;\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 showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n siteId: string;\n apiKey: string;\n region: string;\n };\n };\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\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 hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAKxE,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,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,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\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 hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAKxE,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,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,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, 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';\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 console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAQ,sBAAsB;AAEvE,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,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,CAC3DV,mBAAmB,EAClB,OAAMC,sBAAuB,EAChC,CAAC;IACH,CAAC,MAAM;MACLU,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOR,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, 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';\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 console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAQ,sBAAsB;AAEvE,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,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,CAC3DV,mBAAmB,EACnB,OAAOC,sBAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLU,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOR,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withProjectGoogleServices","withCIOAndroid","config","props","setHighPriorityPushHandler"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\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,yBAAyB,QAAQ,6BAA6B;AAEvE,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAGJ,uBAAuB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGF,yBAAyB,CAACE,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGL,qBAAqB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGH,sBAAsB,CAACG,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACC,0BAA0B,EAAE;IACpCF,MAAM,GAAGN,0BAA0B,CAACM,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf"}
1
+ {"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withProjectGoogleServices","withCIOAndroid","config","props","setHighPriorityPushHandler"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\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,yBAAyB,QAAQ,6BAA6B;AAEvE,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAGJ,uBAAuB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGF,yBAAyB,CAACE,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGL,qBAAqB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGH,sBAAsB,CAACG,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACC,0BAA0B,EAAE;IACpCF,MAAM,GAAGN,0BAA0B,CAACM,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -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","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } 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 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 console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC5B,OAAMC,8BAA+B,EACxC,CAAC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
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","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } 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 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 console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC7B,OAAOC,8BAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\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 (e) {\n console.log(\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 console.log(\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 console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,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,CAAE,GAAEJ,WAAY,2BAA0B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIT,cAAc,CAACU,MAAM,CAACD,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFT,cAAc,CAACW,QAAQ,CACrBF,kBAAkB,EACjB,GAAEH,WAAY,2BACjB,CAAC;QACH,CAAC,CAAC,OAAOM,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACR,4FAA2FR,WAAY,2BAC1G,CAAC;QACH;MACF,CAAC,MAAM;QACLO,OAAO,CAACC,GAAG,CACR,wCAAuCL,kBAAmB,yDAAwDH,WAAY,2BACjI,CAAC;MACH;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACR,wBAAuBR,WAAY,wCACtC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\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 (e) {\n console.log(\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 console.log(\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 console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,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,OAAOM,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACT,4FAA4FR,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLO,OAAO,CAACC,GAAG,CACT,wCAAwCL,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACT,wBAAwBR,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,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,CAC3DV,8BAA8B,EAC7B,OAAMC,0BAA2B,EACpC,CAAC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,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,CAC3DV,8BAA8B,EAC9B,OAAOC,0BAA0B,EACnC,CAAC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":"AAAA,OAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAC9C,OAAO,MAAMC,mBAAmB,GAAG,2CAA2C;AAC9E,OAAO,MAAMC,oBAAoB,GAC/B,4CAA4C;AAC9C,OAAO,MAAMC,6BAA6B,GACxC,kDAAkD;AAEpD,OAAO,MAAMC,8BAA8B,GACzC,kDAAkD;AACpD,OAAO,MAAMC,sBAAsB,GACjC,2EAA2E;AAC7E,OAAO,MAAMC,0BAA0B,GACrC,sFAAsF"}
1
+ {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":"AAAA,OAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAC9C,OAAO,MAAMC,mBAAmB,GAAG,2CAA2C;AAC9E,OAAO,MAAMC,oBAAoB,GAC/B,4CAA4C;AAC9C,OAAO,MAAMC,6BAA6B,GACxC,kDAAkD;AAEpD,OAAO,MAAMC,8BAA8B,GACzC,kDAAkD;AACpD,OAAO,MAAMC,sBAAsB,GACjC,2EAA2E;AAC7E,OAAO,MAAMC,0BAA0B,GACrC,sFAAsF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["finder","require","path","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_RN_SDK","join","LOCAL_PATH_TO_CIO_NSE_FILES","getRelativePathToRNSDK","currentFile","relative","IOS_DEPLOYMENT_TARGET","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DEEPLINK_COMMENT_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["const finder = require('find-package-json');\nconst path = require('path');\n\nconst f = finder(__dirname);\nlet pluginPackageRoot = f.next().filename;\n// This is the path to the root of the customerio-expo-plugin package\npluginPackageRoot = path.dirname(pluginPackageRoot);\n\nexport const LOCAL_PATH_TO_RN_SDK = path.join(\n pluginPackageRoot,\n '../customerio-reactnative'\n);\n\nexport const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'src/helpers/native-files/ios'\n);\n\nexport function getRelativePathToRNSDK(currentFile: string) {\n return path.relative(path.dirname(currentFile), LOCAL_PATH_TO_RN_SDK);\n}\n\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /.*\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /(@interface AppDelegate\\s*:\\s*EXAppDelegateWrapper\\s*)(<([^>]+)>)?/;\n\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*RCTBridge\\s*\\*\\s*\\w+\\s*=\\s*\\[\\s*self\\.reactDelegate\\s+createBridgeWithDelegate:self\\s+launchOptions:launchOptions\\s*\\];\\s*$/gm;\n\nexport const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*return\\s\\[\\s*super\\s*application:\\s*application\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\];/gm;\n\nexport const CIO_DEEPLINK_COMMENT_REGEX =\n /\\sDeep link workaround for app killed state start/gm;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\n\nexport const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;\nexport const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET =\n 'UNUserNotificationCenterDelegate';\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `\nRCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];\n`;\n\nexport const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `\nreturn [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification];\n`;\n\nexport const CIO_INITIALIZECIOSDK_SNIPPET = ` \n [pnHandlerObj initializeCioSdk];\n\n// Code to make the CIO SDK compatible with expo-notifications package.\n// \n// The CIO SDK and expo-notifications both need to handle when a push gets clicked. However, iOS only allows one click handler to be set per app.\n// To get around this limitation, we set the CIO SDK as the click handler. The CIO SDK sets itself up so that when another SDK or host iOS app \n// sets itself as the click handler, the CIO SDK will still be able to handle when the push gets clicked, even though it's not the designated \n// click handler in iOS at runtime. \n// \n// This should work for most SDKs. However, expo-notifications is unique in it's implementation. It will not setup push click handling it if detects \n// that another SDK or host iOS app has already set itself as the click handler:\n// https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37\n// ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.\n//\n// Note: Initialize the native iOS SDK and setup SDK push click handling before running this code. \n# if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n // Creating a new instance, as the comments in expo-notifications suggests, does not work. With this code, if you send a CIO push to device and click on it,\n // no push metrics reporting will occur.\n // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];\n\n // ...instead, get the singleton reference from Expo. \n id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n center.delegate = notificationCenterDelegate;\n# endif\n`;\n\nexport const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `\n// Deep link workaround for app killed state start\nNSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];\n if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {\n NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];\n if (pushContent[@\"CIO\"] && pushContent[@\"CIO\"][@\"push\"] && pushContent[@\"CIO\"][@\"push\"][@\"link\"]) {\n NSString *initialURL = pushContent[@\"CIO\"][@\"push\"][@\"link\"];\n if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {\n modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];\n }\n }\n }\n//Deep link workaround for app killed state ends\n`;\n\nexport 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 }`;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAME,CAAC,GAAGH,MAAM,CAACI,SAAS,CAAC;AAC3B,IAAIC,iBAAiB,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;AACzC;AACAF,iBAAiB,GAAGH,IAAI,CAACM,OAAO,CAACH,iBAAiB,CAAC;AAEnD,OAAO,MAAMI,oBAAoB,GAAGP,IAAI,CAACQ,IAAI,CAC3CL,iBAAiB,EACjB,2BACF,CAAC;AAED,OAAO,MAAMM,2BAA2B,GA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,MAAMC,4DAA4D,GAAI;AAC7E;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2CAA2C,GAAI;AAC5D;AACA;AACA,CAAC;AAED,OAAO,MAAMC,4BAA4B,GAAI;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yCAAyC,GAAI;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,qCAAqC,GAAI;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI"}
1
+ {"version":3,"names":["finder","require","path","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_RN_SDK","join","LOCAL_PATH_TO_CIO_NSE_FILES","getRelativePathToRNSDK","currentFile","relative","IOS_DEPLOYMENT_TARGET","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DEEPLINK_COMMENT_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_INITIALIZECIOSDK_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["const finder = require('find-package-json');\nconst path = require('path');\n\nconst f = finder(__dirname);\nlet pluginPackageRoot = f.next().filename;\n// This is the path to the root of the customerio-expo-plugin package\npluginPackageRoot = path.dirname(pluginPackageRoot);\n\nexport const LOCAL_PATH_TO_RN_SDK = path.join(\n pluginPackageRoot,\n '../customerio-reactnative'\n);\n\nexport const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'src/helpers/native-files/ios'\n);\n\nexport function getRelativePathToRNSDK(currentFile: string) {\n return path.relative(path.dirname(currentFile), LOCAL_PATH_TO_RN_SDK);\n}\n\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /.*\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /(@interface AppDelegate\\s*:\\s*EXAppDelegateWrapper\\s*)(<([^>]+)>)?/;\n\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*RCTBridge\\s*\\*\\s*\\w+\\s*=\\s*\\[\\s*self\\.reactDelegate\\s+createBridgeWithDelegate:self\\s+launchOptions:launchOptions\\s*\\];\\s*$/gm;\n\nexport const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX =\n /^\\s*return\\s\\[\\s*super\\s*application:\\s*application\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\];/gm;\n\nexport const CIO_DEEPLINK_COMMENT_REGEX =\n /\\sDeep link workaround for app killed state start/gm;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\n\nexport const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;\nexport const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET =\n 'UNUserNotificationCenterDelegate';\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\nexport const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `\nRCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];\n`;\n\nexport const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `\nreturn [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification];\n`;\n\nexport const CIO_INITIALIZECIOSDK_SNIPPET = ` \n [pnHandlerObj initializeCioSdk];\n\n// Code to make the CIO SDK compatible with expo-notifications package.\n// \n// The CIO SDK and expo-notifications both need to handle when a push gets clicked. However, iOS only allows one click handler to be set per app.\n// To get around this limitation, we set the CIO SDK as the click handler. The CIO SDK sets itself up so that when another SDK or host iOS app \n// sets itself as the click handler, the CIO SDK will still be able to handle when the push gets clicked, even though it's not the designated \n// click handler in iOS at runtime. \n// \n// This should work for most SDKs. However, expo-notifications is unique in it's implementation. It will not setup push click handling it if detects \n// that another SDK or host iOS app has already set itself as the click handler:\n// https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37\n// ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.\n//\n// Note: Initialize the native iOS SDK and setup SDK push click handling before running this code. \n# if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n // Creating a new instance, as the comments in expo-notifications suggests, does not work. With this code, if you send a CIO push to device and click on it,\n // no push metrics reporting will occur.\n // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];\n\n // ...instead, get the singleton reference from Expo. \n id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];\n UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n center.delegate = notificationCenterDelegate;\n# endif\n`;\n\nexport const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `\n// Deep link workaround for app killed state start\nNSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];\n if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {\n NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];\n if (pushContent[@\"CIO\"] && pushContent[@\"CIO\"][@\"push\"] && pushContent[@\"CIO\"][@\"push\"][@\"link\"]) {\n NSString *initialURL = pushContent[@\"CIO\"][@\"push\"][@\"link\"];\n if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {\n modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];\n }\n }\n }\n//Deep link workaround for app killed state ends\n`;\n\nexport 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 }`;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAGC,OAAO,CAAC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AAO,MAAMC,eAAe,GAAG,eAAe;AAC9C,OAAO,MAAMC,4BAA4B,GAAG,qBAAqB;AAEjE,OAAO,MAAMC,oCAAoC,GAAG,iDAAiD;AACrG,OAAO,MAAMC,sDAAsD,GACjE,kCAAkC;AACpC,OAAO,MAAMC,8CAA8C,GAAG;AAC9D;AACA,CAAC;AACD,OAAO,MAAMC,8CAA8C,GAAG;AAC9D;AACA,CAAC;AAED,OAAO,MAAMC,yCAAyC,GAAG;AACzD,4FAA4F;AAE5F,OAAO,MAAMC,4DAA4D,GAAG;AAC5E;AACA;AACA,CAAC;AAED,OAAO,MAAMC,4DAA4D,GAAG;AAC5E;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2CAA2C,GAAG;AAC3D;AACA;AACA,CAAC;AAED,OAAO,MAAMC,4BAA4B,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yCAAyC,GAAG;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,qCAAqC,GAAG;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","injectCodeBeforeMultiLineRegex","replaceCodeByRegex","matchRegexExists","regex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber","join"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function injectCodeBeforeMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}\\n$&`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function matchRegexExists(fileContent: string, regex: RegExp) {\n return regex.test(fileContent);\n}\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content.join('\\n');\n}\n"],"mappings":"AAAA,OAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB;AAEA,OAAO,SAASE,0BAA0BA,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEA,OAAO,SAASW,8BAA8BA,CAC5Cb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,MAAK,CAAC;AACzD;AAEA,OAAO,SAASY,kBAAkBA,CAChCd,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAEC,OAAO,CAAC;AAChD;AAEA,OAAO,SAASa,gBAAgBA,CAACf,WAAmB,EAAEgB,KAAa,EAAE;EACnE,OAAOA,KAAK,CAACR,IAAI,CAACR,WAAW,CAAC;AAChC;AACA,OAAO,SAASiB,wCAAwCA,CACtDjB,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEA,OAAO,SAASgB,sBAAsBA,CACpClB,WAAmB,EACnBK,KAAa,EACbH,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,IAAIK,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO,CAACU,IAAI,CAAC,IAAI,CAAC;AAC3B"}
1
+ {"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","injectCodeBeforeMultiLineRegex","replaceCodeByRegex","matchRegexExists","regex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber","join"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function injectCodeBeforeMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}\\n$&`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function matchRegexExists(fileContent: string, regex: RegExp) {\n return regex.test(fileContent);\n}\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content.join('\\n');\n}\n"],"mappings":"AAAA,OAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAA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EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO,CAACU,IAAI,CAAC,IAAI,CAAC;AAC3B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["readFile","writeFile","appendFile","existsSync","copyFileSync","mkdirSync","writeFileSync","readFileSync","FileManagement","read","path","Promise","resolve","reject","err","data","write","contents","append","exists","copyFile","src","dest","console","log","mkdir","options"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\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 console.log(`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 console.log(`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 console.log(`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 console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":"AAAA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AW,EAAEC,IAAY,EAAE;IACzC,IAAI;MACFlB,YAAY,CAACiB,GAAG,EAAEC,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOR,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,2BAA0BH,GAAI,OAAMC,IAAK,IAAG,EAAER,GAAG,CAAC;IACjE;EACF;EAEA,OAAOW,KAAKA,CAACf,IAAY,EAAEgB,OAA6B,EAAE;IACxD,IAAI;MACFrB,SAAS,CAACK,IAAI,EAAEgB,OAAO,CAAC;IAC1B,CAAC,CAAC,OAAOZ,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,4BAA2Bd,IAAK,IAAG,EAAEI,GAAG,CAAC;IACxD;EACF;EAEA,OAAOb,SAASA,CAACS,IAAY,EAAEK,IAAY,EAAE;IAC3C,IAAI;MACFT,aAAa,CAACI,IAAI,EAAEK,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,yBAAwBd,IAAK,IAAG,EAAEI,GAAG,CAAC;IACrD;EACF;EAEA,OAAOd,QAAQA,CAACU,IAAY,EAAE;IAC5B,IAAI;MACF,OAAOH,YAAY,CAACG,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOI,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,sBAAqBd,IAAK,IAAG,EAAEI,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF"}
1
+ {"version":3,"names":["readFile","writeFile","appendFile","existsSync","copyFileSync","mkdirSync","writeFileSync","readFileSync","FileManagement","read","path","Promise","resolve","reject","err","data","write","contents","append","exists","copyFile","src","dest","console","log","mkdir","options"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\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 console.log(`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 console.log(`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 console.log(`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 console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":"AAAA,SACEA,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,aAAa,EACbC,YAAY,QAEP,IAAI;AAEX,OAAO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAIA,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9Cb,QAAQ,CAACU,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;IAC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b,SAASA,CAACS,IAAY,EAAEK,IAAY,EAAE;IAC3C,IAAI;MACFT,aAAa,CAACI,IAAI,EAAEK,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAC,yBAAyBd,IAAI,IAAI,EAAEI,GAAG,CAAC;IACrD;EACF;EAEA,OAAOd,QAAQA,CAACU,IAAY,EAAE;IAC5B,IAAI;MACF,OAAOH,YAAY,CAACG,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOI,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAC,sBAAsBd,IAAI,IAAI,EAAEI,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\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 console.log('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,eAAeC,oBAAoBA,CAACC,OAAe,EAAE;EAC1D,MAAMC,UAAU,GAAG,qCAAqC;EACxD,MAAMC,QAAQ,GAAG,mCAAmC;EAEpD,MAAMC,QAAQ,GAAI,GAAEH,OAAQ,UAAS;EACrC,MAAMI,OAAO,GAAG,MAAMN,cAAc,CAACO,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,GAAI;AACtC,EAAET,UAAW;AACb,gDAAgDL,sBAAsB,CAClEO,QACF,CAAE;AACJ,EAAED,QAAS;AACX,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJb,cAAc,CAACc,KAAK,CAClBT,QAAQ,EACRN,iBAAiB,CACfO,OAAO,EACPK,kCAAkC,EAClCC,wBACF,CAAC,CAACG,IAAI,CAAC,IAAI,CACb,CAAC;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEA,OAAO,eAAeC,gCAAgCA,CACpDhB,OAAe,EACfiB,aAA0D,EAC1D;EACA,MAAMd,QAAQ,GAAI,GAAEH,OAAQ,UAAS;EACrC,MAAMI,OAAO,GAAG,MAAMN,cAAc,CAACO,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,GAAI;AACtC,EAAET,UAAW;AACb;AACA,IAAIgB,aAAa,KAAK,QAAQ,GAAG,qCAAqC,GAAG,EAAG;AAC5E,yDAAyDrB,sBAAsB,CAC3EO,QACF,CAAE;AACJ;AACA,EAAED,QAAS;AACX,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJb,cAAc,CAACoB,MAAM,CAACf,QAAQ,EAAEO,wBAAwB,CAAC;EAC3D;AACF"}
1
+ {"version":3,"names":["getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\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 console.log('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\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/apn', :path => '${getRelativePathToRNSDK(\n filename\n )}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,eAAeC,oBAAoBA,CAACC,OA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CAAC;AACH;AACA,EAAED,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJb,cAAc,CAACoB,MAAM,CAACf,QAAQ,EAAEO,wBAAwB,CAAC;EAC3D;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withCIOAndroid","withCIOIos","withCustomerIOPlugin","config","props","ios","android"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\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 if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,UAAU,QAAQ,kBAAkB;AAG7C;AACA,SAASC,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAGF,UAAU,CAACE,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACE,OAAO,EAAE;IACjBH,MAAM,GAAGH,cAAc,CAACG,MAAM,EAAEC,KAAK,CAACE,OAAO,CAAC;EAChD;EAEA,OAAOH,MAAM;AACf;AAEA,eAAeD,oBAAoB"}
1
+ {"version":3,"names":["withCIOAndroid","withCIOIos","withCustomerIOPlugin","config","props","ios","android"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\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 if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,UAAU,QAAQ,kBAAkB;AAG7C;AACA,SAASC,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAGF,UAAU,CAACE,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACE,OAAO,EAAE;IACjBH,MAAM,GAAGH,cAAc,CAACG,MAAM,EAAEC,KAAK,CAACE,OAAO,CAAC;EAChD;EAEA,OAAOH,MAAM;AACf;AAEA,eAAeD,oBAAoB","ignoreList":[]}
@@ -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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_INITIALIZECIOSDK_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","replaceCodeByRegex","matchRegexExists","FileManagement","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","headerPath","projectRoot","headerContent","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, 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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\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 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 = undefined;\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 // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\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":"AAAA,SAAuBA,eAAe,QAAQ,sBAAsB;AACpE,SAASC,4BAA4B,QAAQ,sCAAsC;AAEnF,SACEC,gCAAgC,EAChCC,oCAAoC,EACpCC,2BAA2B,EAC3BC,sDAAsD,EACtDC,2CAA2C,EAC3CC,yCAAyC,EACzCC,4CAA4C,EAC5CC,0DAA0D,EAC1DC,4DAA4D,EAC5DC,kCAAkC,EAClCC,0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C;MACzDE,aAAa,GAAGpB,gCAAgC,CAACoB,aAAa,CAAC;MAC/DxC,cAAc,CAAC0C,KAAK,CAACJ,UAAU,EAAEE,aAAa,CAAC;MAE/CtC,cAAc,GAAGD,SAAS,CACxBC,cAAc,EACd8B,MAAM,CAACI,UAAU,CAACC,WACpB,CAAC;MACDnC,cAAc,GAAGU,iCAAiC,CAACV,cAAc,CAAC;;MAElE;MACA,IACE6B,KAAK,CAACY,+BAA+B,KAAKjC,SAAS,IACnDqB,KAAK,CAACY,+BAA+B,KAAK,KAAK,EAC/C;QACAzC,cAAc,GAAGW,4BAA4B,CAACX,cAAc,CAAC;MAC/D;MAEAA,cAAc,GAAGY,yBAAyB,CAACZ,cAAc,CAAC;MAE1D,IACE6B,KAAK,CAACa,2BAA2B,KAAKlC,SAAS,IAC/CqB,KAAK,CAACa,2BAA2B,KAAK,IAAI,EAC1C;QACA1C,cAAc,GAAGyB,8BAA8B,CAACzB,cAAc,CAAC;MACjE;MAEAA,cAAc,GACZe,mDAAmD,CAACf,cAAc,CAAC;MACrEA,cAAc,GACZgB,mDAAmD,CAAChB,cAAc,CAAC;MAErEA,cAAc,GAAGiB,sCAAsC,CAACjB,cAAc,CAAC;MAEvE8B,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGhC,cAAc;IAC7C,CAAC,MAAM;MACL2C,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOd,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AACD,SAAS1B,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAQ;AACV;AACA;AACA,WAAWA,OAAQ;AACnB,GAAG;AACH"}
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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_INITIALIZECIOSDK_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","replaceCodeByRegex","matchRegexExists","FileManagement","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","headerPath","projectRoot","headerContent","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, 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_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\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 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 = undefined;\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 // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\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":"AAAA,SAAuBA,eAAe,QAAQ,sBAAsB;AACpE,SAASC,4BAA4B,QAAQ,sCAAsC;AAEnF,SACEC,gCAAgC,EAChCC,oCAAoC,EACpCC,2BAA2B,EAC3BC,sDAAsD,EACtDC,2CAA2C,EAC3CC,yCAAyC,EACzCC,4CAA4C,EAC5CC,0DAA0D,EAC1DC,4DAA4D,EAC5DC,kCAAkC,EAClCC,0DAA0D,EAC1DC,4DAA4D,EAC5DC,gDAAgD,EAChDC,8CAA8C,EAC9CC,yCAAyC,EACzCC,8CAA8C,EAC9CC,0BAA0B,EAC1BC,4BAA4B,QACvB,0BAA0B;AACjC,SACEC,8BAA8B,EAC9BC,sBAAsB,EACtBC,0BAA0B,EAC1BC,wCAAwC,EACxCC,kBAAkB,EAClBC,gBAAgB,QACX,gCAAgC;AACvC,SAASC,cAAc,QAAQ,iCAAiC;AAGhE,MAAMC,SAAS,GAAGA,CAACC,cAAsB,EAAEC,OAAe,KAAK;EAC7D,MAAMC,WAAW,GAAG,mBAAmB;EACvC,MAAMC,WAAW,GAAGC,gBAAgB,CAACH,OAAO,CAAC;EAE7C,MAAMI,KAAK,GAAGL,cAAc,CAACK,KAAK,CAACH,WAAW,CAAC;EAC/C,IAAII,eAAuB;EAC3B,IAAI,CAACD,KAAK,IAAIA,KAAK,CAACE,KAAK,KAAKC,SAAS,EAAE;IACvC;IACAF,eAAe,GAAG,CAAC;EACrB,CAAC,MAAM;IACL;IACAA,eAAe,GAAGD,KAAK,CAACE,KAAK,GAAGF,KAAK,CAAC,CAAC,CAAC,CAACI,MAAM;EACjD;EAEAT,cAAc,GAAGP,sBAAsB,CACrCO,cAAc,EACdM,eAAe,EAC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AQ,GAAGhC,cAAc;IAC7C,CAAC,MAAM;MACL2C,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOd,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AACD,SAAS1B,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAO;AACT;AACA;AACA,WAAWA,OAAO;AAClB,GAAG;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject","withCIOIos","config","props","pushNotification"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,4BAA4B,QAAQ,gCAAgC;AAC7E,SAASC,gCAAgC,QAAQ,iCAAiC;AAClF,SAASC,mBAAmB,QAAQ,oBAAoB;AAExD,OAAO,SAASC,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAGJ,4BAA4B,CAACI,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAGH,gCAAgC,CAACG,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAGF,mBAAmB,CAACE,MAAM,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOD,MAAM;AACf"}
1
+ {"version":3,"names":["withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject","withCIOIos","config","props","pushNotification"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,4BAA4B,QAAQ,gCAAgC;AAC7E,SAASC,gCAAgC,QAAQ,iCAAiC;AAClF,SAASC,mBAAmB,QAAQ,oBAAoB;AAExD,OAAO,SAASC,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAGJ,4BAA4B,CAACI,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAGH,gCAAgC,CAACG,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAGF,mBAAmB,CAACE,MAAM,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -150,7 +150,7 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
150
150
  if (typeof configurations[key].buildSettings !== 'undefined' && configurations[key].buildSettings.PRODUCT_NAME === `"${CIO_NOTIFICATION_TARGET_NAME}"`) {
151
151
  const buildSettingsObj = configurations[key].buildSettings;
152
152
  buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
153
- buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '13.0';
153
+ buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '13.4';
154
154
  buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
155
155
  buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
156
156
  buildSettingsObj.SWIFT_VERSION = 4.2;
@@ -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","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","pbxTargetByName","warn","nsePath","mkdir","recursive","files","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","_options$pushNotifica4","_options$pushNotifica6","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","_options$pushNotifica3","apiKey","_options$pushNotifica5","region","_options$pushNotifica7","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica8","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","toUpperCase","autoTrackPushEvents","toString","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} 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';\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) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\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 {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = 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 pushNotification,\n };\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\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 await injectCIONotificationPodfileCode(iosPath, useFrameworks);\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 files = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.swift',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n files.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${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 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 || '13.0';\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 SITE_ID_RE = /\\{\\{SITE_ID\\}\\}/;\n const API_KEY_RE = /\\{\\{API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.siteId) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n SITE_ID_RE,\n options.pushNotification?.env?.siteId\n );\n }\n\n if (options.pushNotification?.env?.apiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n API_KEY_RE,\n options.pushNotification?.env?.apiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.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 const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\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(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} 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}/${file}`, 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\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SITE_ID\\}\\}/,\n options.pushNotification.env.siteId\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{API_KEY\\}\\}/,\n options.pushNotification.env.apiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AAAA,SAGEA,gBAAgB,QACX,sBAAsB;AAE7B,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;AAElE,MAAMC,cAAc,GAAI,GAAEP,4BAA6B,aAAY;AACnE,MAAMQ,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,G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AC7CpB,OAAO,CAACmH,uBAAuB,KAAK,IAAI;EAC1C9B,cAAc,GAAG5F,kBAAkB,CACjC4F,cAAc,EACd,qCAAqC,EACrC8B,uBAAuB,CAACD,QAAQ,CAAC,CACnC,CAAC;EAEDvH,cAAc,CAACkF,SAAS,CAACC,WAAW,EAAEO,cAAc,CAAC;AACvD,CAAC"}
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","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","pbxTargetByName","warn","nsePath","mkdir","recursive","files","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","_options$pushNotifica4","_options$pushNotifica6","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","_options$pushNotifica3","apiKey","_options$pushNotifica5","region","_options$pushNotifica7","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica8","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","toUpperCase","autoTrackPushEvents","toString","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} 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';\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) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\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 {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = 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 pushNotification,\n };\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\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 await injectCIONotificationPodfileCode(iosPath, useFrameworks);\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 files = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.swift',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n files.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${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 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 || '13.4';\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 SITE_ID_RE = /\\{\\{SITE_ID\\}\\}/;\n const API_KEY_RE = /\\{\\{API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.siteId) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n SITE_ID_RE,\n options.pushNotification?.env?.siteId\n );\n }\n\n if (options.pushNotification?.env?.apiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n API_KEY_RE,\n options.pushNotification?.env?.apiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.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 const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\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(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} 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}/${file}`, 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\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SITE_ID\\}\\}/,\n options.pushNotification.env.siteId\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{API_KEY\\}\\}/,\n options.pushNotification.env.apiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AAAA,SAGEA,gBAAgB,QACX,sBAAsB;AAE7B,SACEC,4BAA4B,EAC5BC,qCAAqC,EACrCC,sBAAsB,EACtBC,2BAA2B,QACtB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,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,gCAAgC,EAChC4B,mBAAmB,CAACC,QAAQ,CAAC,CAC/B,CAAC;EAED,MAAMC,uBAAuB,GAC3BnH,OAAO,CAACmH,uBAAuB,KAAK/F,SAAS,IAC7CpB,OAAO,CAACmH,uBAAuB,KAAK,IAAI;EAC1C9B,cAAc,GAAG5F,kBAAkB,CACjC4F,cAAc,EACd,qCAAqC,EACrC8B,uBAAuB,CAACD,QAAQ,CAAC,CACnC,CAAC;EAEDvH,cAAc,CAACkF,SAAS,CAACC,WAAW,EAAEO,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["withXcodeProject","injectCIOPodfileCode","withCioXcodeProject","config","cioProps","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath);\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,gBAAgB,QAAQ,sBAAsB;AAErE,SAASC,oBAAoB,QAAQ,uCAAuC;AAG5E,OAAO,MAAMC,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAOJ,gBAAgB,CAACG,MAAM,EAAE,MAAOE,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEV,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEU,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEf,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEe;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAMP,oBAAoB,CAACQ,OAAO,CAAC;IAEnC,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["withXcodeProject","injectCIOPodfileCode","withCioXcodeProject","config","cioProps","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath);\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,gBAAgB,QAAQ,sBAAsB;AAErE,SAASC,oBAAoB,QAAQ,uCAAuC;AAG5E,OAAO,MAAMC,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAOJ,gBAAgB,CAACG,MAAM,EAAE,MAAOE,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEV,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEU,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEf,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEe;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAMP,oBAAoB,CAACQ,OAAO,CAAC;IAEnC,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":"AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":"AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["fs","require","runPostInstall","rnPjsonFile","__dirname","expoPjsonFile","existsSync","rnPJson","readFileSync","expoPjson","rnPackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;\n const expoPjsonFile = `${__dirname}/../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(rnPjsonFile)) {\n const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');\n expoPjson = require(expoPjsonFile);\n\n const rnPackage = JSON.parse(rnPJson);\n rnPackage.expoVersion = expoPjson.version;\n\n\n fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));\n }\n } catch (error) {}\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":"AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,WAAW,GAAI,GAAEC,SAAU,4CAA2C;EAC5E,MAAMC,aAAa,GAAI,GAAED,SAAU,kBAAiB;EACpD,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,WAAW,CAAC,EAAE;MAC9B,MAAMI,OAAO,GAAGP,EAAE,CAACQ,YAAY,CAACL,WAAW,EAAE,MAAM,CAAC;MACpDM,SAAS,GAAGR,OAAO,CAACI,aAAa,CAAC;MAElC,MAAMK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACL,OAAO,CAAC;MACrCG,SAAS,CAACG,WAAW,GAAGJ,SAAS,CAACK,OAAO;MAGzCd,EAAE,CAACe,aAAa,CAACZ,WAAW,EAAEQ,IAAI,CAACK,SAAS,CAACN,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE,CAAC;AACnB;AAEAC,OAAO,CAAChB,cAAc,GAAGA,cAAc"}
1
+ {"version":3,"names":["fs","require","runPostInstall","rnPjsonFile","__dirname","expoPjsonFile","existsSync","rnPJson","readFileSync","expoPjson","rnPackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;\n const expoPjsonFile = `${__dirname}/../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(rnPjsonFile)) {\n const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');\n expoPjson = require(expoPjsonFile);\n\n const rnPackage = JSON.parse(rnPJson);\n rnPackage.expoVersion = expoPjson.version;\n\n\n fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));\n }\n } catch (error) {}\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":"AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,WAAW,GAAG,GAAGC,SAAS,4CAA4C;EAC5E,MAAMC,aAAa,GAAG,GAAGD,SAAS,kBAAkB;EACpD,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,WAAW,CAAC,EAAE;MAC9B,MAAMI,OAAO,GAAGP,EAAE,CAACQ,YAAY,CAACL,WAAW,EAAE,MAAM,CAAC;MACpDM,SAAS,GAAGR,OAAO,CAACI,aAAa,CAAC;MAElC,MAAMK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACL,OAAO,CAAC;MACrCG,SAAS,CAACG,WAAW,GAAGJ,SAAS,CAACK,OAAO;MAGzCd,EAAE,CAACe,aAAa,CAACZ,WAAW,EAAEQ,IAAI,CAACK,SAAS,CAACN,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE,CAAC;AACnB;AAEAC,OAAO,CAAChB,cAAc,GAAGA,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\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 disableNotificationRegistration?: boolean;\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 showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n siteId: string;\n apiKey: string;\n region: string;\n };\n };\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\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 disableNotificationRegistration?: boolean;\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 showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n siteId: string;\n apiKey: string;\n region: string;\n };\n };\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customerio-expo-plugin",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.16",
4
4
  "description": "Expo config plugin for the Customer IO React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -9,10 +9,12 @@
9
9
  "react-native": "src/index",
10
10
  "license": "MIT",
11
11
  "files": [
12
+ "app.plugin.js",
12
13
  "src",
13
14
  "lib/**/*"
14
15
  ],
15
16
  "exports": {
17
+ "./app.plugin.js": "./app.plugin.js",
16
18
  ".": "./lib/commonjs/index.js",
17
19
  "./postinstall": "./src/postInstallHelper.js"
18
20
  },
@@ -234,7 +234,7 @@ const addRichPushXcodeProj = async (
234
234
  const buildSettingsObj = configurations[key].buildSettings;
235
235
  buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
236
236
  buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
237
- iosDeploymentTarget || '13.0';
237
+ iosDeploymentTarget || '13.4';
238
238
  buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
239
239
  buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
240
240
  buildSettingsObj.SWIFT_VERSION = 4.2;