customerio-expo-plugin 1.0.0-beta.9 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +8 -5
  2. package/package.json +32 -24
  3. package/plugin/app.plugin.js +1 -0
  4. package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
  5. package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js.map +1 -1
  6. package/{lib → plugin/lib}/commonjs/android/withCIOAndroid.js +2 -0
  7. package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -0
  8. package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js.map +1 -1
  9. package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js.map +1 -1
  10. package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js.map +1 -1
  11. package/plugin/lib/commonjs/android/withProjectStrings.js +70 -0
  12. package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -0
  13. package/plugin/lib/commonjs/helpers/constants/android.js +14 -0
  14. package/{lib → plugin/lib}/commonjs/helpers/constants/android.js.map +1 -1
  15. package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js.map +1 -1
  16. package/plugin/lib/commonjs/helpers/constants/ios.js +119 -0
  17. package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -0
  18. package/plugin/lib/commonjs/helpers/native-files/ios/Env.swift +7 -0
  19. package/plugin/lib/commonjs/helpers/native-files/ios/NotificationService.swift +25 -0
  20. package/{src → plugin/lib/commonjs}/helpers/native-files/ios/PushService.swift +10 -13
  21. package/{lib → plugin/lib}/commonjs/helpers/utils/codeInjection.js +9 -1
  22. package/plugin/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
  23. package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js.map +1 -1
  24. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +50 -0
  25. package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  26. package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +26 -0
  27. package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +1 -0
  28. package/{lib → plugin/lib}/commonjs/index.js +1 -2
  29. package/{lib → plugin/lib}/commonjs/index.js.map +1 -1
  30. package/{lib → plugin/lib}/commonjs/ios/withAppDelegateModifications.js +63 -9
  31. package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
  32. package/{lib → plugin/lib}/commonjs/ios/withCIOIos.js.map +1 -1
  33. package/{lib → plugin/lib}/commonjs/ios/withNotificationsXcodeProject.js +30 -34
  34. package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
  35. package/{lib → plugin/lib}/commonjs/ios/withXcodeProject.js.map +1 -1
  36. package/{lib → plugin/lib}/commonjs/postInstall.js.map +1 -1
  37. package/plugin/lib/commonjs/postInstallHelper.js +22 -0
  38. package/plugin/lib/commonjs/postInstallHelper.js.map +1 -0
  39. package/plugin/lib/commonjs/types/cio-types.js.map +1 -0
  40. package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js.map +1 -1
  41. package/{lib → plugin/lib}/module/android/withAppGoogleServices.js.map +1 -1
  42. package/{lib → plugin/lib}/module/android/withCIOAndroid.js +2 -0
  43. package/plugin/lib/module/android/withCIOAndroid.js.map +1 -0
  44. package/{lib → plugin/lib}/module/android/withGistMavenRepository.js.map +1 -1
  45. package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js.map +1 -1
  46. package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js.map +1 -1
  47. package/plugin/lib/module/android/withProjectStrings.js +63 -0
  48. package/plugin/lib/module/android/withProjectStrings.js.map +1 -0
  49. package/{lib → plugin/lib}/module/helpers/constants/android.js.map +1 -1
  50. package/{lib → plugin/lib}/module/helpers/constants/globals.d.js.map +1 -1
  51. package/plugin/lib/module/helpers/constants/ios.js +112 -0
  52. package/plugin/lib/module/helpers/constants/ios.js.map +1 -0
  53. package/plugin/lib/module/helpers/native-files/ios/Env.swift +7 -0
  54. package/plugin/lib/module/helpers/native-files/ios/NotificationService.swift +25 -0
  55. package/{lib → plugin/lib}/module/helpers/native-files/ios/PushService.swift +10 -13
  56. package/{lib → plugin/lib}/module/helpers/utils/codeInjection.js +7 -1
  57. package/plugin/lib/module/helpers/utils/codeInjection.js.map +1 -0
  58. package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js.map +1 -1
  59. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +43 -0
  60. package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  61. package/plugin/lib/module/helpers/utils/pluginUtils.js +19 -0
  62. package/plugin/lib/module/helpers/utils/pluginUtils.js.map +1 -0
  63. package/{lib → plugin/lib}/module/index.js.map +1 -1
  64. package/plugin/lib/module/ios/withAppDelegateModifications.js +136 -0
  65. package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -0
  66. package/{lib → plugin/lib}/module/ios/withCIOIos.js.map +1 -1
  67. package/{lib → plugin/lib}/module/ios/withNotificationsXcodeProject.js +30 -33
  68. package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
  69. package/{lib → plugin/lib}/module/ios/withXcodeProject.js.map +1 -1
  70. package/{lib → plugin/lib}/module/postInstall.js.map +1 -1
  71. package/plugin/lib/module/postInstallHelper.js +20 -0
  72. package/plugin/lib/module/postInstallHelper.js.map +1 -0
  73. package/plugin/lib/module/types/cio-types.js.map +1 -0
  74. package/plugin/lib/typescript/android/withProjectStrings.d.ts +15 -0
  75. package/plugin/lib/typescript/helpers/constants/ios.d.ts +30 -0
  76. package/{lib → plugin/lib}/typescript/helpers/utils/codeInjection.d.ts +3 -1
  77. package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +4 -0
  78. package/{lib → plugin/lib}/typescript/types/cio-types.d.ts +8 -2
  79. package/{src → plugin/src}/android/withCIOAndroid.ts +2 -0
  80. package/plugin/src/android/withProjectStrings.ts +57 -0
  81. package/plugin/src/helpers/constants/ios.ts +144 -0
  82. package/plugin/src/helpers/native-files/ios/Env.swift +7 -0
  83. package/plugin/src/helpers/native-files/ios/NotificationService.swift +25 -0
  84. package/{lib/commonjs → plugin/src}/helpers/native-files/ios/PushService.swift +10 -13
  85. package/{src → plugin/src}/helpers/utils/codeInjection.ts +12 -1
  86. package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +67 -0
  87. package/plugin/src/helpers/utils/pluginUtils.ts +22 -0
  88. package/{src → plugin/src}/ios/withAppDelegateModifications.ts +118 -23
  89. package/{src → plugin/src}/ios/withNotificationsXcodeProject.ts +57 -35
  90. package/plugin/src/postInstallHelper.js +32 -0
  91. package/{src → plugin/src}/types/cio-types.ts +8 -2
  92. package/lib/commonjs/android/withCIOAndroid.js.map +0 -1
  93. package/lib/commonjs/helpers/constants/android.js +0 -21
  94. package/lib/commonjs/helpers/constants/ios.js +0 -121
  95. package/lib/commonjs/helpers/constants/ios.js.map +0 -1
  96. package/lib/commonjs/helpers/native-files/ios/Env.swift +0 -8
  97. package/lib/commonjs/helpers/native-files/ios/NotificationService.swift +0 -22
  98. package/lib/commonjs/helpers/utils/codeInjection.js.map +0 -1
  99. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +0 -36
  100. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +0 -1
  101. package/lib/commonjs/ios/withAppDelegateModifications.js.map +0 -1
  102. package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +0 -1
  103. package/lib/commonjs/postInstallHelper.js +0 -20
  104. package/lib/commonjs/postInstallHelper.js.map +0 -1
  105. package/lib/commonjs/types/cio-types.js.map +0 -1
  106. package/lib/module/android/withCIOAndroid.js.map +0 -1
  107. package/lib/module/helpers/constants/ios.js +0 -84
  108. package/lib/module/helpers/constants/ios.js.map +0 -1
  109. package/lib/module/helpers/native-files/ios/Env.swift +0 -8
  110. package/lib/module/helpers/native-files/ios/NotificationService.swift +0 -22
  111. package/lib/module/helpers/utils/codeInjection.js.map +0 -1
  112. package/lib/module/helpers/utils/injectCIOPodfileCode.js +0 -29
  113. package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +0 -1
  114. package/lib/module/ios/withAppDelegateModifications.js +0 -82
  115. package/lib/module/ios/withAppDelegateModifications.js.map +0 -1
  116. package/lib/module/ios/withNotificationsXcodeProject.js.map +0 -1
  117. package/lib/module/postInstallHelper.js +0 -18
  118. package/lib/module/postInstallHelper.js.map +0 -1
  119. package/lib/module/types/cio-types.js.map +0 -1
  120. package/lib/typescript/helpers/constants/ios.d.ts +0 -31
  121. package/src/helpers/constants/ios.ts +0 -104
  122. package/src/helpers/native-files/ios/Env.swift +0 -8
  123. package/src/helpers/native-files/ios/NotificationService.swift +0 -22
  124. package/src/helpers/utils/injectCIOPodfileCode.ts +0 -54
  125. package/src/postInstallHelper.js +0 -22
  126. /package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js +0 -0
  127. /package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js +0 -0
  128. /package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js +0 -0
  129. /package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js +0 -0
  130. /package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js +0 -0
  131. /package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js +0 -0
  132. /package/{lib → plugin/lib}/commonjs/helpers/native-files/ios/NotificationService-Info.plist +0 -0
  133. /package/{lib → plugin/lib}/commonjs/helpers/native-files/ios/NotificationService.h +0 -0
  134. /package/{lib → plugin/lib}/commonjs/helpers/native-files/ios/NotificationService.m +0 -0
  135. /package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js +0 -0
  136. /package/{lib → plugin/lib}/commonjs/ios/withCIOIos.js +0 -0
  137. /package/{lib → plugin/lib}/commonjs/ios/withXcodeProject.js +0 -0
  138. /package/{lib → plugin/lib}/commonjs/postInstall.js +0 -0
  139. /package/{lib → plugin/lib}/commonjs/types/cio-types.js +0 -0
  140. /package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js +0 -0
  141. /package/{lib → plugin/lib}/module/android/withAppGoogleServices.js +0 -0
  142. /package/{lib → plugin/lib}/module/android/withGistMavenRepository.js +0 -0
  143. /package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js +0 -0
  144. /package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js +0 -0
  145. /package/{lib → plugin/lib}/module/helpers/constants/android.js +0 -0
  146. /package/{lib → plugin/lib}/module/helpers/constants/globals.d.js +0 -0
  147. /package/{lib → plugin/lib}/module/helpers/native-files/ios/NotificationService-Info.plist +0 -0
  148. /package/{lib → plugin/lib}/module/helpers/native-files/ios/NotificationService.h +0 -0
  149. /package/{lib → plugin/lib}/module/helpers/native-files/ios/NotificationService.m +0 -0
  150. /package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js +0 -0
  151. /package/{lib → plugin/lib}/module/index.js +0 -0
  152. /package/{lib → plugin/lib}/module/ios/withCIOIos.js +0 -0
  153. /package/{lib → plugin/lib}/module/ios/withXcodeProject.js +0 -0
  154. /package/{lib → plugin/lib}/module/postInstall.js +0 -0
  155. /package/{lib → plugin/lib}/module/types/cio-types.js +0 -0
  156. /package/{lib → plugin/lib}/typescript/android/withAndroidManifestUpdates.d.ts +0 -0
  157. /package/{lib → plugin/lib}/typescript/android/withAppGoogleServices.d.ts +0 -0
  158. /package/{lib → plugin/lib}/typescript/android/withCIOAndroid.d.ts +0 -0
  159. /package/{lib → plugin/lib}/typescript/android/withGistMavenRepository.d.ts +0 -0
  160. /package/{lib → plugin/lib}/typescript/android/withGoogleServicesJSON.d.ts +0 -0
  161. /package/{lib → plugin/lib}/typescript/android/withProjectGoogleServices.d.ts +0 -0
  162. /package/{lib → plugin/lib}/typescript/helpers/constants/android.d.ts +0 -0
  163. /package/{lib → plugin/lib}/typescript/helpers/utils/fileManagement.d.ts +0 -0
  164. /package/{lib → plugin/lib}/typescript/helpers/utils/injectCIOPodfileCode.d.ts +0 -0
  165. /package/{lib → plugin/lib}/typescript/index.d.ts +0 -0
  166. /package/{lib → plugin/lib}/typescript/ios/withAppDelegateModifications.d.ts +0 -0
  167. /package/{lib → plugin/lib}/typescript/ios/withCIOIos.d.ts +0 -0
  168. /package/{lib → plugin/lib}/typescript/ios/withNotificationsXcodeProject.d.ts +0 -0
  169. /package/{lib → plugin/lib}/typescript/ios/withXcodeProject.d.ts +0 -0
  170. /package/{src → plugin/src}/android/withAndroidManifestUpdates.ts +0 -0
  171. /package/{src → plugin/src}/android/withAppGoogleServices.ts +0 -0
  172. /package/{src → plugin/src}/android/withGistMavenRepository.ts +0 -0
  173. /package/{src → plugin/src}/android/withGoogleServicesJSON.ts +0 -0
  174. /package/{src → plugin/src}/android/withProjectGoogleServices.ts +0 -0
  175. /package/{src → plugin/src}/helpers/constants/android.ts +0 -0
  176. /package/{src → plugin/src}/helpers/constants/globals.d.ts +0 -0
  177. /package/{src → plugin/src}/helpers/native-files/ios/NotificationService-Info.plist +0 -0
  178. /package/{src → plugin/src}/helpers/native-files/ios/NotificationService.h +0 -0
  179. /package/{src → plugin/src}/helpers/native-files/ios/NotificationService.m +0 -0
  180. /package/{src → plugin/src}/helpers/utils/fileManagement.ts +0 -0
  181. /package/{src → plugin/src}/index.ts +0 -0
  182. /package/{src → plugin/src}/ios/withCIOIos.ts +0 -0
  183. /package/{src → plugin/src}/ios/withXcodeProject.ts +0 -0
  184. /package/{src → plugin/src}/postInstall.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withProjectGoogleServices","withProjectStrings","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';\nimport { withProjectStrings } from './withProjectStrings';\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 config = withProjectStrings(config);\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;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAGL,uBAAuB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGN,qBAAqB,CAACM,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGJ,sBAAsB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC9CD,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EACnC,IAAIC,KAAK,CAACC,0BAA0B,EAAE;IACpCF,MAAM,GAAGP,0BAA0B,CAACO,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":[]}
@@ -0,0 +1,63 @@
1
+ import { withStringsXml } from '@expo/config-plugins';
2
+ import { getPluginVersion } from '../helpers/utils/pluginUtils';
3
+
4
+ /**
5
+ * Adds or updates string resources in Android's strings.xml required by the plugin
6
+ */
7
+ export const withProjectStrings = config => {
8
+ return withStringsXml(config, config => {
9
+ const stringsXml = config.modResults;
10
+ const pluginVersion = getPluginVersion();
11
+
12
+ // Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating
13
+ // the strings here instead
14
+ // These strings are added to the strings.xml file by Customer.io's React Native SDK
15
+ // We're updating them here to include the Expo client source and version so user agent
16
+ // can be generated correctly for Expo apps
17
+ addStringsToXml(stringsXml, [{
18
+ name: 'customer_io_react_native_sdk_client_source',
19
+ value: 'Expo'
20
+ }, {
21
+ name: 'customer_io_react_native_sdk_client_version',
22
+ value: pluginVersion
23
+ }]);
24
+ return config;
25
+ });
26
+ };
27
+
28
+ /**
29
+ * Adds or updates multiple string resources in Android's strings.xml
30
+ * @param stringsXml - Parsed strings.xml object
31
+ * @param stringResources - Array of string resources to add or update
32
+ * @returns Updated strings.xml object
33
+ */
34
+ export function addStringsToXml(stringsXml, stringResources) {
35
+ // Ensure the resource exists
36
+ if (!stringsXml.resources) {
37
+ stringsXml.resources = {
38
+ string: []
39
+ };
40
+ }
41
+ stringResources.forEach(({
42
+ name,
43
+ value
44
+ }) => {
45
+ const existingStringIndex = stringsXml.resources.string.findIndex(item => {
46
+ var _item$$;
47
+ return ((_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.name) === name;
48
+ });
49
+ if (existingStringIndex !== -1) {
50
+ // Update the existing string
51
+ stringsXml.resources.string[existingStringIndex]._ = value;
52
+ } else {
53
+ // Add a new string resource
54
+ stringsXml.resources.string.push({
55
+ $: {
56
+ name
57
+ },
58
+ _: value
59
+ });
60
+ }
61
+ });
62
+ }
63
+ //# sourceMappingURL=withProjectStrings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withStringsXml","getPluginVersion","withProjectStrings","config","stringsXml","modResults","pluginVersion","addStringsToXml","name","value","stringResources","resources","string","forEach","existingStringIndex","findIndex","item","_item$$","$","_","push"],"sources":["withProjectStrings.ts"],"sourcesContent":["import { ConfigPlugin, withStringsXml } from '@expo/config-plugins';\nimport { getPluginVersion } from '../helpers/utils/pluginUtils';\n\n/**\n * Adds or updates string resources in Android's strings.xml required by the plugin\n */\nexport const withProjectStrings: ConfigPlugin = (config) => {\n return withStringsXml(config, (config) => {\n const stringsXml = config.modResults;\n const pluginVersion = getPluginVersion();\n\n // Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating\n // the strings here instead\n // These strings are added to the strings.xml file by Customer.io's React Native SDK\n // We're updating them here to include the Expo client source and version so user agent\n // can be generated correctly for Expo apps\n addStringsToXml(stringsXml, [\n { name: 'customer_io_react_native_sdk_client_source', value: 'Expo' },\n { name: 'customer_io_react_native_sdk_client_version', value: pluginVersion },\n ]);\n\n return config;\n });\n};\n\n/**\n * Adds or updates multiple string resources in Android's strings.xml\n * @param stringsXml - Parsed strings.xml object\n * @param stringResources - Array of string resources to add or update\n * @returns Updated strings.xml object\n */\nexport function addStringsToXml(\n stringsXml: any,\n stringResources: { name: string, value: string }[]\n) {\n // Ensure the resource exists\n if (!stringsXml.resources) {\n stringsXml.resources = { string: [] };\n }\n\n stringResources.forEach(({ name, value }) => {\n const existingStringIndex = stringsXml.resources.string.findIndex(\n (item: { $: { name: string } }) => item.$?.name === name\n );\n\n if (existingStringIndex !== -1) {\n // Update the existing string\n stringsXml.resources.string[existingStringIndex]._ = value;\n } else {\n // Add a new string resource\n stringsXml.resources.string.push({\n $: { name },\n _: value,\n });\n }\n });\n}\n"],"mappings":"AAAA,SAAuBA,cAAc,QAAQ,sBAAsB;AACnE,SAASC,gBAAgB,QAAQ,8BAA8B;;AAE/D;AACA;AACA;AACA,OAAO,MAAMC,kBAAgC,GAAIC,MAAM,IAAK;EAC1D,OAAOH,cAAc,CAACG,MAAM,EAAGA,MAAM,IAAK;IACxC,MAAMC,UAAU,GAAGD,MAAM,CAACE,UAAU;IACpC,MAAMC,aAAa,GAAGL,gBAAgB,CAAC,CAAC;;IAExC;IACA;IACA;IACA;IACA;IACAM,eAAe,CAACH,UAAU,EAAE,CAC1B;MAAEI,IAAI,EAAE,4CAA4C;MAAEC,KAAK,EAAE;IAAO,CAAC,EACrE;MAAED,IAAI,EAAE,6CAA6C;MAAEC,KAAK,EAAEH;IAAc,CAAC,CAC9E,CAAC;IAEF,OAAOH,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAC7BH,UAAe,EACfM,eAAkD,EAClD;EACA;EACA,IAAI,CAACN,UAAU,CAACO,SAAS,EAAE;IACzBP,UAAU,CAACO,SAAS,GAAG;MAAEC,MAAM,EAAE;IAAG,CAAC;EACvC;EAEAF,eAAe,CAACG,OAAO,CAAC,CAAC;IAAEL,IAAI;IAAEC;EAAM,CAAC,KAAK;IAC3C,MAAMK,mBAAmB,GAAGV,UAAU,CAACO,SAAS,CAACC,MAAM,CAACG,SAAS,CAC9DC,IAA6B;MAAA,IAAAC,OAAA;MAAA,OAAK,EAAAA,OAAA,GAAAD,IAAI,CAACE,CAAC,cAAAD,OAAA,uBAANA,OAAA,CAAQT,IAAI,MAAKA,IAAI;IAAA,CAC1D,CAAC;IAED,IAAIM,mBAAmB,KAAK,CAAC,CAAC,EAAE;MAC9B;MACAV,UAAU,CAACO,SAAS,CAACC,MAAM,CAACE,mBAAmB,CAAC,CAACK,CAAC,GAAGV,KAAK;IAC5D,CAAC,MAAM;MACL;MACAL,UAAU,CAACO,SAAS,CAACC,MAAM,CAACQ,IAAI,CAAC;QAC/BF,CAAC,EAAE;UAAEV;QAAK,CAAC;QACXW,CAAC,EAAEV;MACL,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ","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":[]}
@@ -0,0 +1,112 @@
1
+ const finder = require('find-package-json');
2
+ const path = require('path');
3
+ const resolveFrom = require('resolve-from');
4
+ const f = finder(__dirname);
5
+ let pluginPackageRoot = f.next().filename;
6
+ // This is the path to the root of the customerio-expo-plugin package
7
+ pluginPackageRoot = path.dirname(pluginPackageRoot);
8
+ export const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(pluginPackageRoot, 'plugin/src/helpers/native-files/ios');
9
+ export function getRelativePathToRNSDK(iosPath) {
10
+ // Root path of the Expo project
11
+ const rootAppPath = path.dirname(iosPath);
12
+
13
+ // Path of the cio RN package.json file. Example: test-app/node_modules/customerio-reactnative/package.json
14
+ const pluginPackageJsonPath = resolveFrom.silent(rootAppPath, `customerio-reactnative/package.json`);
15
+
16
+ // Example: ../node_modules/customerio-reactnative
17
+ return path.relative(iosPath, path.dirname(pluginPackageJsonPath));
18
+ }
19
+ export const IOS_DEPLOYMENT_TARGET = '13.0';
20
+ export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
21
+ export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
22
+ export const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
23
+ export const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = /.*\[super(\s)application:application(\s)didFinishLaunchingWithOptions:launchOptions\];/;
24
+ export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = /return \[super application:application didFailToRegisterForRemoteNotificationsWithError:error\];/;
25
+ export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = /(- \(void\)application:\(UIApplication \*\)application didFailToRegisterForRemoteNotificationsWithError:\(NSError \*\)error(\s|\n)*?\{)(.|\n){2}.*\n\}/;
26
+ export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = /return \[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\];/;
27
+ export const CIO_APPDELEGATEDECLARATION_REGEX = /@implementation AppDelegate(.|\n)/;
28
+ export const CIO_APPDELEGATEHEADER_REGEX = /(@interface AppDelegate\s*:\s*EXAppDelegateWrapper\s*)(<([^>]+)>)?/;
29
+ export const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX = /^\s*RCTBridge\s*\*\s*\w+\s*=\s*\[\s*self\.reactDelegate\s+createBridgeWithDelegate:self\s+launchOptions:launchOptions\s*\];\s*$/gm;
30
+ export const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX = /^\s*return\s\[\s*super\s*application:\s*application\s*didFinishLaunchingWithOptions\s*:\s*launchOptions\s*\];/gm;
31
+ export const CIO_DEEPLINK_COMMENT_REGEX = /\sDeep link workaround for app killed state start/gm;
32
+ export const DEFAULT_BUNDLE_VERSION = '1';
33
+ export const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
34
+ export const CIO_TARGET_NAME = 'CustomerIOSDK';
35
+ export const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';
36
+ export const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;
37
+ export const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET = 'UNUserNotificationCenterDelegate';
38
+ export const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `
39
+ CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];
40
+ `;
41
+ export const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `
42
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];
43
+ `;
44
+ export const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `
45
+ return [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;
46
+ export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
47
+ [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
48
+ [pnHandlerObj application:application error:error];
49
+ `;
50
+ export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
51
+ [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
52
+ return [pnHandlerObj application:application deviceToken:deviceToken];
53
+ `;
54
+ export const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `
55
+ // Register for push notifications
56
+ [pnHandlerObj registerPushNotification];
57
+ `;
58
+ export const CIO_INITIALIZECIOSDK_SNIPPET = `
59
+ [pnHandlerObj initializeCioSdk];
60
+
61
+ // Code to make the CIO SDK compatible with expo-notifications package.
62
+ //
63
+ // 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.
64
+ // 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
65
+ // 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
66
+ // click handler in iOS at runtime.
67
+ //
68
+ // 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
69
+ // that another SDK or host iOS app has already set itself as the click handler:
70
+ // https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37
71
+ // ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.
72
+ //
73
+ // Note: Initialize the native iOS SDK and setup SDK push click handling before running this code.
74
+ # if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)
75
+ // 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,
76
+ // no push metrics reporting will occur.
77
+ // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];
78
+
79
+ // ...instead, get the singleton reference from Expo.
80
+ id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];
81
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
82
+ center.delegate = notificationCenterDelegate;
83
+ # endif
84
+ `;
85
+ export const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `
86
+ // Deep link workaround for app killed state start
87
+ NSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
88
+ if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
89
+ NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
90
+ if (pushContent[@"CIO"] && pushContent[@"CIO"][@"push"] && pushContent[@"CIO"][@"push"][@"link"]) {
91
+ NSString *initialURL = pushContent[@"CIO"][@"push"][@"link"];
92
+ if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {
93
+ modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];
94
+ }
95
+ }
96
+ }
97
+ //Deep link workaround for app killed state ends
98
+ `;
99
+ export const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `
100
+ @objc(registerPushNotification)
101
+ public func registerPushNotification() {
102
+
103
+ let center = UNUserNotificationCenter.current()
104
+ center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
105
+ if error == nil{
106
+ DispatchQueue.main.async {
107
+ UIApplication.shared.registerForRemoteNotifications()
108
+ }
109
+ }
110
+ }
111
+ }`;
112
+ //# sourceMappingURL=ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["finder","require","path","resolveFrom","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_CIO_NSE_FILES","join","getRelativePathToRNSDK","iosPath","rootAppPath","pluginPackageJsonPath","silent","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');\nconst resolveFrom = require('resolve-from');\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_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'plugin/src/helpers/native-files/ios'\n);\n\nexport function getRelativePathToRNSDK(iosPath: string) {\n // Root path of the Expo project\n const rootAppPath = path.dirname(iosPath);\n\n // Path of the cio RN package.json file. Example: test-app/node_modules/customerio-reactnative/package.json\n const pluginPackageJsonPath = resolveFrom.silent(rootAppPath, `customerio-reactnative/package.json`);\n\n // Example: ../node_modules/customerio-reactnative\n return path.relative(iosPath, path.dirname(pluginPackageJsonPath));\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;AAC5B,MAAME,WAAW,GAAGF,OAAO,CAAC,cAAc,CAAC;AAE3C,MAAMG,CAAC,GAAGJ,MAAM,CAACK,SAAS,CAAC;AAC3B,IAAIC,iBAAiB,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;AACzC;AACAF,iBAAiB,GAAGJ,IAAI,CAACO,OAAO,CAACH,iBAAiB,CAAC;AAEnD,OAAO,MAAMI,2BAA2B,GAAGR,IAAI,CAACS,IAAI,CAClDL,iBAAiB,EACjB,qCACF,CAAC;AAED,OAAO,SAASM,sBAAsBA,CAACC,OAAe,EAAE;EACtD;EACA,MAAMC,WAAW,GAAGZ,IAAI,CAACO,OAAO,CAACI,OAAO,CAAC;;EAEzC;EACA,MAAME,qBAAqB,GAAGZ,WAAW,CAACa,MAAM,CAACF,WAAW,EAAE,qCAAqC,CAAC;;EAEpG;EACA,OAAOZ,IAAI,CAACe,QAAQ,CAACJ,OAAO,EAAEX,IAAI,CAACO,OAAO,CAACM,qBAAqB,CAAC,CAAC;AACpE;AAEA,OAAO,MAAMG,qBAAqB,GAAG,MAAM;AAC3C,OAAO,MAAMC,+BAA+B,GAAG,wBAAwB;AACvE,OAAO,MAAMC,mCAAmC,GAAG,4BAA4B;AAC/E,OAAO,MAAMC,6BAA6B,GAAG,sBAAsB;AACnE,OAAO,MAAMC,kCAAkC,GAC7C,wFAAwF;AAE1F,OAAO,MAAMC,0DAA0D,GACrE,kGAAkG;AAEpG,OAAO,MAAMC,8DAA8D,GACzE,wJAAwJ;AAE1J,OAAO,MAAMC,0DAA0D,GACrE,wGAAwG;AAE1G,OAAO,MAAMC,gCAAgC,GAC3C,mCAAmC;AAErC,OAAO,MAAMC,2BAA2B,GACtC,oEAAoE;AAEtE,OAAO,MAAMC,4CAA4C,GACvD,mIAAmI;AAErI,OAAO,MAAMC,gDAAgD,GAC3D,iHAAiH;AAEnH,OAAO,MAAMC,0BAA0B,GACrC,qDAAqD;AACvD,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AACzC,OAAO,MAAMC,4BAA4B,GAAG,KAAK;AACjD,OAAO,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":[]}
@@ -0,0 +1,7 @@
1
+ import Foundation
2
+ import CioInternalCommon
3
+
4
+ class Env {
5
+ static var customerIOCdpApiKey: String = "{{CDP_API_KEY}}"
6
+ static var customerIORegion: Region = {{REGION}} // "us" or "eu"
7
+ }
@@ -0,0 +1,25 @@
1
+ import Foundation
2
+ import UserNotifications
3
+ import CioMessagingPushAPN
4
+
5
+ @objc
6
+ public class NotificationServiceCioManager : NSObject {
7
+
8
+ public override init() {}
9
+
10
+ @objc(didReceive:withContentHandler:)
11
+ public func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
12
+ MessagingPushAPN.initializeForExtension(
13
+ withConfig: MessagingPushConfigBuilder(cdpApiKey: Env.customerIOCdpApiKey)
14
+ .region(Env.customerIORegion)
15
+ .build()
16
+ )
17
+
18
+ MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
19
+ }
20
+
21
+ @objc(serviceExtensionTimeWillExpire)
22
+ public func serviceExtensionTimeWillExpire() {
23
+ MessagingPush.shared.serviceExtensionTimeWillExpire()
24
+ }
25
+ }
@@ -1,6 +1,5 @@
1
1
  import Foundation
2
2
  import CioMessagingPushAPN
3
- import CioTracking
4
3
  import UserNotifications
5
4
  import UIKit
6
5
 
@@ -11,6 +10,16 @@ public class CIOAppPushNotificationsHandler : NSObject {
11
10
 
12
11
  {{REGISTER_SNIPPET}}
13
12
 
13
+ @objc(initializeCioSdk)
14
+ public func initializeCioSdk() {
15
+ MessagingPushAPN.initialize(
16
+ withConfig: MessagingPushConfigBuilder()
17
+ .showPushAppInForeground({{SHOW_PUSH_APP_IN_FOREGROUND}})
18
+ .autoTrackPushEvents({{AUTO_TRACK_PUSH_EVENTS}})
19
+ .build()
20
+ )
21
+ }
22
+
14
23
  @objc(application:deviceToken:)
15
24
  public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
16
25
  MessagingPush.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
@@ -20,16 +29,4 @@ public class CIOAppPushNotificationsHandler : NSObject {
20
29
  public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
21
30
  MessagingPush.shared.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
22
31
  }
23
-
24
- @objc(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)
25
- public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
26
- let handled = MessagingPush.shared.userNotificationCenter(center, didReceive: response,
27
- withCompletionHandler: completionHandler)
28
-
29
- // If the Customer.io SDK does not handle the push, it's up to you to handle it and call the
30
- // completion handler. If the SDK did handle it, it called the completion handler for you.
31
- if !handled {
32
- completionHandler()
33
- }
34
- }
35
32
  }
@@ -10,9 +10,15 @@ export function injectCodeByRegex(fileContent, lineRegex, snippet) {
10
10
  export function injectCodeByMultiLineRegex(fileContent, lineRegex, snippet) {
11
11
  return fileContent.replace(lineRegex, `$&\n${snippet}`);
12
12
  }
13
+ export function injectCodeBeforeMultiLineRegex(fileContent, lineRegex, snippet) {
14
+ return fileContent.replace(lineRegex, `${snippet}\n$&`);
15
+ }
13
16
  export function replaceCodeByRegex(fileContent, lineRegex, snippet) {
14
17
  return fileContent.replace(lineRegex, snippet);
15
18
  }
19
+ export function matchRegexExists(fileContent, regex) {
20
+ return regex.test(fileContent);
21
+ }
16
22
  export function injectCodeByMultiLineRegexAndReplaceLine(fileContent, lineRegex, snippet) {
17
23
  return fileContent.replace(lineRegex, `${snippet}`);
18
24
  }
@@ -22,6 +28,6 @@ export function injectCodeByLineNumber(fileContent, index, snippet) {
22
28
  if (index > -1) {
23
29
  content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
24
30
  }
25
- return content;
31
+ return content.join('\n');
26
32
  }
27
33
  //# sourceMappingURL=codeInjection.js.map
@@ -0,0 +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,EAAE,OAAOC,OAAO,EAAE,CAAC;AACzD;AAEA,OAAO,SAASW,8BAA8BA,CAC5Cb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAE,GAAGC,OAAO,MAAM,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,EAAE,GAAGC,OAAO,EAAE,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","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,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;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAKA,CAACN,IAAY,EAAEO,QAAgB,EAAiB;IAChE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CZ,SAAS,CAACS,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QACzC,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaM,MAAMA,CAACR,IAAY,EAAEO,QAAgB,EAAiB;IACjE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CX,UAAU,CAACQ,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QAC1C,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,OAAOO,MAAMA,CAACT,IAAY,EAAE;IAC1B,OAAOP,UAAU,CAACO,IAAI,CAAC;EACzB;EAEA,OAAOU,QAAQA,CAACC,GAAW,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;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAKA,CAACN,IAAY,EAAEO,QAAgB,EAAiB;IAChE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CZ,SAAS,CAACS,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QACzC,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaM,MAAMA,CAACR,IAAY,EAAEO,QAAgB,EAAiB;IACjE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CX,UAAU,CAACQ,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QAC1C,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,OAAOO,MAAMA,CAACT,IAAY,EAAE;IAC1B,OAAOP,UAAU,CAACO,IAAI,CAAC;EACzB;EAEA,OAAOU,QAAQA,CAACC,GAAW,EAAEC,IAAY,EAAE;IACzC,IAAI;MACFlB,YAAY,CAACiB,GAAG,EAAEC,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOR,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAC,2BAA2BH,GAAG,OAAOC,IAAI,IAAI,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,CAAC,4BAA4Bd,IAAI,IAAI,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,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":[]}
@@ -0,0 +1,43 @@
1
+ import { getRelativePathToRNSDK } from '../constants/ios';
2
+ import { injectCodeByRegex } from './codeInjection';
3
+ import { FileManagement } from './fileManagement';
4
+ export async function injectCIOPodfileCode(iosPath) {
5
+ const blockStart = '# --- CustomerIO Host App START ---';
6
+ const blockEnd = '# --- CustomerIO Host App END ---';
7
+ const filename = `${iosPath}/Podfile`;
8
+ const podfile = await FileManagement.read(filename);
9
+ const matches = podfile.match(new RegExp(blockStart));
10
+ if (!matches) {
11
+ // We need to decide what line of code in the Podfile to insert our native code.
12
+ // The "post_install" line is always present in an Expo project Podfile so it's reliable.
13
+ // Find that line in the Podfile and then we will insert our code above that line.
14
+ const lineInPodfileToInjectSnippetBefore = /post_install do \|installer\|/;
15
+ const snippetToInjectInPodfile = `
16
+ ${blockStart}
17
+ pod 'customerio-reactnative/apn', :path => '${getRelativePathToRNSDK(iosPath)}'
18
+ ${blockEnd}
19
+ `.trim();
20
+ FileManagement.write(filename, injectCodeByRegex(podfile, lineInPodfileToInjectSnippetBefore, snippetToInjectInPodfile).join('\n'));
21
+ } else {
22
+ console.log('CustomerIO Podfile snippets already exists. Skipping...');
23
+ }
24
+ }
25
+ export async function injectCIONotificationPodfileCode(iosPath, useFrameworks) {
26
+ const filename = `${iosPath}/Podfile`;
27
+ const podfile = await FileManagement.read(filename);
28
+ const blockStart = '# --- CustomerIO Notification START ---';
29
+ const blockEnd = '# --- CustomerIO Notification END ---';
30
+ const matches = podfile.match(new RegExp(blockStart));
31
+ if (!matches) {
32
+ const snippetToInjectInPodfile = `
33
+ ${blockStart}
34
+ target 'NotificationService' do
35
+ ${useFrameworks === 'static' ? 'use_frameworks! :linkage => :static' : ''}
36
+ pod 'customerio-reactnative-richpush/apn', :path => '${getRelativePathToRNSDK(iosPath)}'
37
+ end
38
+ ${blockEnd}
39
+ `.trim();
40
+ FileManagement.append(filename, snippetToInjectInPodfile);
41
+ }
42
+ }
43
+ //# sourceMappingURL=injectCIOPodfileCode.js.map
@@ -0,0 +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 iosPath\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 iosPath\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,GAAG,GAAGH,OAAO,UAAU;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,GAAG;AACrC,EAAET,UAAU;AACZ,gDAAgDL,sBAAsB,CAClEI,OACF,CAAC;AACH,EAAEE,QAAQ;AACV,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,GAAG,GAAGH,OAAO,UAAU;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,GAAG;AACrC,EAAET,UAAU;AACZ;AACA,IAAIgB,aAAa,KAAK,QAAQ,GAAG,qCAAqC,GAAG,EAAE;AAC3E,yDAAyDrB,sBAAsB,CAC3EI,OACF,CAAC;AACH;AACA,EAAEE,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJb,cAAc,CAACoB,MAAM,CAACf,QAAQ,EAAEO,wBAAwB,CAAC;EAC3D;AACF","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ /**
5
+ * Reads the version of the plugin from its `package.json` and returns it as a string.
6
+ */
7
+ export const getPluginVersion = () => {
8
+ // Always resolves relative to the utility file's location
9
+ const packageJsonPath = path.resolve(__dirname, '../../../../../package.json');
10
+ if (!fs.existsSync(packageJsonPath)) {
11
+ throw new Error(`package.json not found at ${packageJsonPath}`);
12
+ }
13
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
14
+ if (!packageJson.version) {
15
+ throw new Error(`"version" field is missing in ${packageJsonPath}`);
16
+ }
17
+ return packageJson.version;
18
+ };
19
+ //# sourceMappingURL=pluginUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fs","path","getPluginVersion","packageJsonPath","resolve","__dirname","existsSync","Error","packageJson","JSON","parse","readFileSync","version"],"sources":["pluginUtils.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n/**\n * Reads the version of the plugin from its `package.json` and returns it as a string.\n */\nexport const getPluginVersion = (): string => {\n // Always resolves relative to the utility file's location\n const packageJsonPath = path.resolve(__dirname, '../../../../../package.json');\n\n if (!fs.existsSync(packageJsonPath)) {\n throw new Error(`package.json not found at ${packageJsonPath}`);\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n\n if (!packageJson.version) {\n throw new Error(`\"version\" field is missing in ${packageJsonPath}`);\n }\n\n return packageJson.version;\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAc;EAC5C;EACA,MAAMC,eAAe,GAAGF,IAAI,CAACG,OAAO,CAACC,SAAS,EAAE,6BAA6B,CAAC;EAE9E,IAAI,CAACL,EAAE,CAACM,UAAU,CAACH,eAAe,CAAC,EAAE;IACnC,MAAM,IAAII,KAAK,CAAC,6BAA6BJ,eAAe,EAAE,CAAC;EACjE;EAEA,MAAMK,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACV,EAAE,CAACW,YAAY,CAACR,eAAe,EAAE,MAAM,CAAC,CAAC;EAExE,IAAI,CAACK,WAAW,CAACI,OAAO,EAAE;IACxB,MAAM,IAAIL,KAAK,CAAC,iCAAiCJ,eAAe,EAAE,CAAC;EACrE;EAEA,OAAOK,WAAW,CAACI,OAAO;AAC5B,CAAC","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":[]}