customerio-expo-plugin 0.0.4 → 1.0.0-alpha.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 (143) hide show
  1. package/lib/commonjs/android/withAppGoogleServices.js +16 -0
  2. package/lib/commonjs/android/withAppGoogleServices.js.map +1 -0
  3. package/lib/commonjs/android/withCIOAndroid.js +18 -0
  4. package/lib/commonjs/android/withCIOAndroid.js.map +1 -0
  5. package/lib/commonjs/android/withGistMavenRepository.js +16 -0
  6. package/lib/commonjs/android/withGistMavenRepository.js.map +1 -0
  7. package/lib/commonjs/android/withGoogleServicesJSON.js +30 -0
  8. package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -0
  9. package/lib/commonjs/android/withProjectGoogleServices.js +16 -0
  10. package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -0
  11. package/lib/commonjs/helpers/constants/android.js +19 -0
  12. package/lib/commonjs/helpers/constants/android.js.map +1 -0
  13. package/lib/commonjs/helpers/constants/globals.d.js +2 -0
  14. package/lib/commonjs/helpers/constants/globals.d.js.map +1 -0
  15. package/lib/commonjs/helpers/constants/ios.js +138 -0
  16. package/lib/commonjs/helpers/constants/ios.js.map +1 -0
  17. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/CIONotificationService-Info.plist +0 -0
  18. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/CIONotificationService.h +0 -0
  19. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/CIONotificationService.m +0 -0
  20. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/CIONotificationService.swift +0 -0
  21. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/PushNotification.swift +0 -0
  22. package/lib/commonjs/helpers/utils/codeInjection.js +33 -0
  23. package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
  24. package/lib/commonjs/helpers/utils/fileManagement.js +44 -0
  25. package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -0
  26. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +32 -0
  27. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  28. package/lib/commonjs/index.js +17 -0
  29. package/lib/commonjs/index.js.map +1 -0
  30. package/lib/commonjs/ios/withAppDelegateModifications.js +76 -0
  31. package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
  32. package/lib/commonjs/ios/withAppDelegateXcodeProject.js +96 -0
  33. package/lib/commonjs/ios/withAppDelegateXcodeProject.js.map +1 -0
  34. package/lib/commonjs/ios/withCIOIos.js +18 -0
  35. package/lib/commonjs/ios/withCIOIos.js.map +1 -0
  36. package/lib/commonjs/ios/withNotificationsXcodeProject.js +157 -0
  37. package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
  38. package/lib/commonjs/ios/withXcodeProject.js +28 -0
  39. package/lib/commonjs/ios/withXcodeProject.js.map +1 -0
  40. package/lib/commonjs/types/cio-types.js +15 -0
  41. package/lib/commonjs/types/cio-types.js.map +1 -0
  42. package/lib/module/android/withAppGoogleServices.js +9 -0
  43. package/lib/module/android/withAppGoogleServices.js.map +1 -0
  44. package/lib/module/android/withCIOAndroid.js +12 -0
  45. package/lib/module/android/withCIOAndroid.js.map +1 -0
  46. package/lib/module/android/withGistMavenRepository.js +9 -0
  47. package/lib/module/android/withGistMavenRepository.js.map +1 -0
  48. package/lib/module/android/withGoogleServicesJSON.js +23 -0
  49. package/lib/module/android/withGoogleServicesJSON.js.map +1 -0
  50. package/lib/module/android/withProjectGoogleServices.js +9 -0
  51. package/lib/module/android/withProjectGoogleServices.js.map +1 -0
  52. package/lib/module/helpers/constants/android.js +7 -0
  53. package/lib/module/helpers/constants/android.js.map +1 -0
  54. package/lib/module/helpers/constants/globals.d.js +2 -0
  55. package/lib/module/helpers/constants/globals.d.js.map +1 -0
  56. package/lib/module/helpers/constants/ios.js +102 -0
  57. package/lib/module/helpers/constants/ios.js.map +1 -0
  58. package/lib/module/helpers/native-files/ios/CIONotificationService-Info.plist +31 -0
  59. package/lib/module/helpers/native-files/ios/CIONotificationService.h +5 -0
  60. package/lib/module/helpers/native-files/ios/CIONotificationService.m +30 -0
  61. package/lib/module/helpers/native-files/ios/CIONotificationService.swift +21 -0
  62. package/lib/module/helpers/native-files/ios/PushNotification.swift +56 -0
  63. package/lib/module/helpers/utils/codeInjection.js +24 -0
  64. package/lib/module/helpers/utils/codeInjection.js.map +1 -0
  65. package/lib/module/helpers/utils/fileManagement.js +37 -0
  66. package/lib/module/helpers/utils/fileManagement.js.map +1 -0
  67. package/lib/module/helpers/utils/injectCIOPodfileCode.js +25 -0
  68. package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  69. package/lib/module/index.js +10 -0
  70. package/lib/module/index.js.map +1 -0
  71. package/lib/module/ios/withAppDelegateModifications.js +69 -0
  72. package/lib/module/ios/withAppDelegateModifications.js.map +1 -0
  73. package/lib/module/ios/withAppDelegateXcodeProject.js +88 -0
  74. package/lib/module/ios/withAppDelegateXcodeProject.js.map +1 -0
  75. package/lib/module/ios/withCIOIos.js +12 -0
  76. package/lib/module/ios/withCIOIos.js.map +1 -0
  77. package/lib/module/ios/withNotificationsXcodeProject.js +149 -0
  78. package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
  79. package/lib/module/ios/withXcodeProject.js +21 -0
  80. package/lib/module/ios/withXcodeProject.js.map +1 -0
  81. package/lib/module/types/cio-types.js +10 -0
  82. package/lib/module/types/cio-types.js.map +1 -0
  83. package/lib/typescript/android/withAppGoogleServices.d.ts +3 -0
  84. package/lib/typescript/android/withCIOAndroid.d.ts +3 -0
  85. package/lib/typescript/android/withGistMavenRepository.d.ts +3 -0
  86. package/lib/typescript/android/withGoogleServicesJSON.d.ts +3 -0
  87. package/lib/typescript/android/withProjectGoogleServices.d.ts +3 -0
  88. package/lib/typescript/helpers/constants/android.d.ts +6 -0
  89. package/lib/typescript/helpers/constants/ios.d.ts +30 -0
  90. package/lib/typescript/helpers/utils/codeInjection.d.ts +4 -0
  91. package/lib/typescript/helpers/utils/fileManagement.d.ts +5 -0
  92. package/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -0
  93. package/lib/typescript/index.d.ts +4 -0
  94. package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -0
  95. package/lib/typescript/ios/withAppDelegateXcodeProject.d.ts +3 -0
  96. package/lib/typescript/ios/withCIOIos.d.ts +3 -0
  97. package/lib/typescript/ios/withNotificationsXcodeProject.d.ts +3 -0
  98. package/lib/typescript/ios/withXcodeProject.d.ts +3 -0
  99. package/lib/typescript/types/cio-types.d.ts +22 -0
  100. package/package.json +87 -13
  101. package/src/android/withAppGoogleServices.ts +19 -0
  102. package/src/android/withCIOAndroid.ts +19 -0
  103. package/src/android/withGistMavenRepository.ts +19 -0
  104. package/src/android/withGoogleServicesJSON.ts +30 -0
  105. package/src/android/withProjectGoogleServices.ts +19 -0
  106. package/src/helpers/constants/android.ts +12 -0
  107. package/src/helpers/constants/globals.d.ts +8 -0
  108. package/src/helpers/constants/ios.ts +116 -0
  109. package/src/helpers/native-files/ios/CIONotificationService-Info.plist +31 -0
  110. package/src/helpers/native-files/ios/CIONotificationService.h +5 -0
  111. package/src/helpers/native-files/ios/CIONotificationService.m +30 -0
  112. package/src/helpers/native-files/ios/CIONotificationService.swift +21 -0
  113. package/src/helpers/native-files/ios/PushNotification.swift +56 -0
  114. package/src/helpers/utils/codeInjection.ts +46 -0
  115. package/src/helpers/utils/fileManagement.ts +39 -0
  116. package/src/helpers/utils/injectCIOPodfileCode.ts +47 -0
  117. package/src/index.ts +21 -0
  118. package/src/ios/withAppDelegateModifications.ts +150 -0
  119. package/src/ios/withAppDelegateXcodeProject.ts +110 -0
  120. package/src/ios/withCIOIos.ts +19 -0
  121. package/src/ios/withNotificationsXcodeProject.ts +231 -0
  122. package/src/ios/withXcodeProject.ts +25 -0
  123. package/src/types/cio-types.ts +28 -0
  124. package/build/helpers/.DS_Store +0 -0
  125. package/build/helpers/ios/.DS_Store +0 -0
  126. package/build/package.json +0 -36
  127. package/build/src/android/withAppGoogleServices.js +0 -12
  128. package/build/src/android/withCIOAndroid.js +0 -15
  129. package/build/src/android/withGistMavenRepository.js +0 -12
  130. package/build/src/android/withGoogleServicesJSON.js +0 -24
  131. package/build/src/android/withProjectGoogleServices.js +0 -12
  132. package/build/src/helpers/constants/android.js +0 -9
  133. package/build/src/helpers/constants/ios.js +0 -102
  134. package/build/src/helpers/utils/codeInjection.js +0 -30
  135. package/build/src/helpers/utils/fileManagement.js +0 -40
  136. package/build/src/helpers/utils/injectCIOPodfileCode.js +0 -37
  137. package/build/src/index.js +0 -11
  138. package/build/src/ios/withAppDelegateModifications.js +0 -77
  139. package/build/src/ios/withAppDelegateXcodeProject.js +0 -78
  140. package/build/src/ios/withCIOIos.js +0 -15
  141. package/build/src/ios/withNotificationsXcodeProject.js +0 -133
  142. package/build/src/ios/withXcodeProject.js +0 -22
  143. package/build/src/types/cio-types.js +0 -8
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withAppGoogleServices = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _android = require("../helpers/constants/android");
9
+ const withAppGoogleServices = configOuter => {
10
+ return (0, _configPlugins.withAppBuildGradle)(configOuter, props => {
11
+ props.modResults.contents = props.modResults.contents.replace(_android.CIO_APP_APPLY_REGEX, `$1\n${_android.CIO_APP_GOOGLE_SNIPPET}`);
12
+ return props;
13
+ });
14
+ };
15
+ exports.withAppGoogleServices = withAppGoogleServices;
16
+ //# sourceMappingURL=withAppGoogleServices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withAppGoogleServices","configOuter","withAppBuildGradle","props","modResults","contents","replace","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET"],"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 props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAMO,MAAMA,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChDA,KAAK,CAACC,UAAU,CAACC,QAAQ,GAAGF,KAAK,CAACC,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EAClB,OAAMC,+BAAuB,EAAC,CAChC;IACD,OAAOL,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withCIOAndroid = withCIOAndroid;
7
+ var _withAppGoogleServices = require("./withAppGoogleServices");
8
+ var _withGistMavenRepository = require("./withGistMavenRepository");
9
+ var _withGoogleServicesJSON = require("./withGoogleServicesJSON");
10
+ var _withProjectGoogleServices = require("./withProjectGoogleServices");
11
+ function withCIOAndroid(config, props) {
12
+ config = (0, _withGistMavenRepository.withGistMavenRepository)(config, props);
13
+ config = (0, _withProjectGoogleServices.withProjectGoogleServices)(config, props);
14
+ config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
15
+ config = (0, _withGoogleServicesJSON.withGoogleServicesJSON)(config, props);
16
+ return config;
17
+ }
18
+ //# sourceMappingURL=withCIOAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\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\n return config;\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AAEO,SAASA,cAAc,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;EAE9C,OAAOD,MAAM;AACf"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withGistMavenRepository = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _android = require("../helpers/constants/android");
9
+ const withGistMavenRepository = configOuter => {
10
+ return (0, _configPlugins.withProjectBuildGradle)(configOuter, props => {
11
+ props.modResults.contents = props.modResults.contents.replace(_android.CIO_PROJECT_ALLPROJECTS_REGEX, `$1\n${_android.CIO_PROJECT_GIST_MAVEN_SNIPPET}`);
12
+ return props;
13
+ });
14
+ };
15
+ exports.withGistMavenRepository = withGistMavenRepository;
16
+ //# sourceMappingURL=withGistMavenRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withGistMavenRepository","configOuter","withProjectBuildGradle","props","modResults","contents","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\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 props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAMO,MAAMA,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpDA,KAAK,CAACC,UAAU,CAACC,QAAQ,GAAGF,KAAK,CAACC,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,sCAA6B,EAC5B,OAAMC,uCAA+B,EAAC,CACxC;IACD,OAAOL,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withGoogleServicesJSON = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _fs = require("fs");
9
+ const withGoogleServicesJSON = (configOuter, cioProps) => {
10
+ return (0, _configPlugins.withProjectBuildGradle)(configOuter, props => {
11
+ const options = {
12
+ androidPath: props.modRequest.platformProjectRoot,
13
+ googleServicesFilePath: cioProps === null || cioProps === void 0 ? void 0 : cioProps.googleServicesFilePath
14
+ };
15
+ const {
16
+ androidPath,
17
+ googleServicesFilePath
18
+ } = options;
19
+ if (googleServicesFilePath) {
20
+ try {
21
+ (0, _fs.copyFileSync)(`${googleServicesFilePath}google-services.json`, `${androidPath}/app/google-services.json`);
22
+ } catch (e) {
23
+ console.log('There was an error copying your google-services.json file.');
24
+ }
25
+ }
26
+ return props;
27
+ });
28
+ };
29
+ exports.withGoogleServicesJSON = withGoogleServicesJSON;
30
+ //# sourceMappingURL=withGoogleServicesJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFilePath","copyFileSync","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\nimport { copyFileSync } from 'fs';\n\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 googleServicesFilePath: cioProps?.googleServicesFilePath,\n };\n const { androidPath, googleServicesFilePath } = options;\n if (googleServicesFilePath) {\n try {\n copyFileSync(\n `${googleServicesFilePath}google-services.json`,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n 'There was an error copying your google-services.json file.'\n );\n }\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AACA;AAIO,MAAMA,sBAEZ,GAAG,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,sBAAsB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IACpC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAuB,CAAC,GAAGJ,OAAO;IACvD,IAAII,sBAAsB,EAAE;MAC1B,IAAI;QACF,IAAAC,gBAAY,EACT,GAAED,sBAAuB,sBAAqB,EAC9C,GAAEH,WAAY,2BAA0B,CAC1C;MACH,CAAC,CAAC,OAAOK,CAAC,EAAE;QACVC,OAAO,CAACC,GAAG,CACT,4DAA4D,CAC7D;MACH;IACF;IAEA,OAAOT,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withProjectGoogleServices = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _android = require("./../helpers/constants/android");
9
+ const withProjectGoogleServices = configOuter => {
10
+ return (0, _configPlugins.withProjectBuildGradle)(configOuter, props => {
11
+ props.modResults.contents = props.modResults.contents.replace(_android.CIO_PROJECT_BUILDSCRIPTS_REGEX, `$1\n${_android.CIO_PROJECT_GOOGLE_SNIPPET}`);
12
+ return props;
13
+ });
14
+ };
15
+ exports.withProjectGoogleServices = withProjectGoogleServices;
16
+ //# sourceMappingURL=withProjectGoogleServices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withProjectGoogleServices","configOuter","withProjectBuildGradle","props","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET"],"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 props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAMO,MAAMA,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpDA,KAAK,CAACC,UAAU,CAACC,QAAQ,GAAGF,KAAK,CAACC,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC7B,OAAMC,mCAA2B,EAAC,CACpC;IACD,OAAOL,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CIO_PROJECT_GOOGLE_SNIPPET = exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = exports.CIO_PROJECT_ALLPROJECTS_REGEX = exports.CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_APPLY_REGEX = void 0;
7
+ const CIO_PROJECT_BUILDSCRIPTS_REGEX = /(buildscript\s*\{(.|\n)*dependencies\s*\{)/;
8
+ exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = CIO_PROJECT_BUILDSCRIPTS_REGEX;
9
+ const CIO_APP_APPLY_REGEX = /(apply plugin: "com.android.application")/;
10
+ exports.CIO_APP_APPLY_REGEX = CIO_APP_APPLY_REGEX;
11
+ const CIO_PROJECT_ALLPROJECTS_REGEX = /(allprojects\s*\{(.|\n)*repositories\s*\{)/;
12
+ exports.CIO_PROJECT_ALLPROJECTS_REGEX = CIO_PROJECT_ALLPROJECTS_REGEX;
13
+ const CIO_PROJECT_GIST_MAVEN_SNIPPET = ' maven { url "https://maven.gist.build" }';
14
+ exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = CIO_PROJECT_GIST_MAVEN_SNIPPET;
15
+ const CIO_APP_GOOGLE_SNIPPET = 'apply plugin: "com.google.gms.google-services" // Google Services plugin';
16
+ exports.CIO_APP_GOOGLE_SNIPPET = CIO_APP_GOOGLE_SNIPPET;
17
+ const CIO_PROJECT_GOOGLE_SNIPPET = ' classpath "com.google.gms:google-services:4.3.13" // Google Services plugin';
18
+ exports.CIO_PROJECT_GOOGLE_SNIPPET = CIO_PROJECT_GOOGLE_SNIPPET;
19
+ //# sourceMappingURL=android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_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_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n)*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,GACzC,4CAA4C;AAAC;AACxC,MAAMC,mBAAmB,GAAG,2CAA2C;AAAC;AACxE,MAAMC,6BAA6B,GACxC,4CAA4C;AAAC;AAExC,MAAMC,8BAA8B,GACzC,kDAAkD;AAAC;AAC9C,MAAMC,sBAAsB,GACjC,2EAA2E;AAAC;AACvE,MAAMC,0BAA0B,GACrC,sFAAsF;AAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=globals.d.js.map
@@ -0,0 +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":""}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LOCAL_PATH_TO_CIO_NSE_FILES = exports.IOS_DEPLOYMENT_TARGET = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.DEFAULT_BUNDLE_VERSION = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = exports.CIO_TARGET_NAME = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_PODFILE_TARGET_NAMES_SNIPPET = exports.CIO_PODFILE_SNIPPET = exports.CIO_PODFILE_REGEX = exports.CIO_PODFILE_POST_INSTALL_SNIPPET = exports.CIO_PODFILE_POST_INSTALL_REGEX = exports.CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_REGEX = exports.CIO_NOTIFICATION_TARGET_NAME = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_APPDELEGATEHEADER_SNIPPET = exports.CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEDECLARATION_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = void 0;
7
+ const LOCAL_PATH_TO_CIO_NSE_FILES = `node_modules/customerio-expo-plugin/src/helpers/native-files/ios`;
8
+ exports.LOCAL_PATH_TO_CIO_NSE_FILES = LOCAL_PATH_TO_CIO_NSE_FILES;
9
+ const IOS_DEPLOYMENT_TARGET = '13.0';
10
+ exports.IOS_DEPLOYMENT_TARGET = IOS_DEPLOYMENT_TARGET;
11
+ const CIO_PODFILE_REGEX = /pod 'RCT-Folly'/;
12
+ exports.CIO_PODFILE_REGEX = CIO_PODFILE_REGEX;
13
+ const CIO_PODFILE_NOTIFICATION_REGEX = /target 'CIONotificationService' do/;
14
+ exports.CIO_PODFILE_NOTIFICATION_REGEX = CIO_PODFILE_NOTIFICATION_REGEX;
15
+ const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
16
+ exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = GROUP_IDENTIFIER_TEMPLATE_REGEX;
17
+ const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
18
+ exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = BUNDLE_SHORT_VERSION_TEMPLATE_REGEX;
19
+ const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
20
+ exports.BUNDLE_VERSION_TEMPLATE_REGEX = BUNDLE_VERSION_TEMPLATE_REGEX;
21
+ const CIO_PODFILE_POST_INSTALL_REGEX = /post_install do \|installer\|/;
22
+ exports.CIO_PODFILE_POST_INSTALL_REGEX = CIO_PODFILE_POST_INSTALL_REGEX;
23
+ const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = /(- \(BOOL\)application:\(UIApplication \*\)application didFinishLaunchingWithOptions:\(NSDictionary \*\)launchOptions(\s|\n)*?\{)((.|\n)*)\[super(\s)application:application(\s)didFinishLaunchingWithOptions:launchOptions\];/;
24
+ exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = CIO_DIDFINISHLAUNCHINGMETHOD_REGEX;
25
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = /return \[super application:application didFailToRegisterForRemoteNotificationsWithError:error\];/;
26
+ exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX;
27
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = /(- \(void\)application:\(UIApplication \*\)application didFailToRegisterForRemoteNotificationsWithError:\(NSError \*\)error(\s|\n)*?\{)(.|\n){2}.*\n\}/;
28
+ exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX;
29
+ const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = /return \[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\];/;
30
+ exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX;
31
+ const CIO_APPDELEGATEDECLARATION_REGEX = /@implementation AppDelegate(.|\n)/;
32
+ exports.CIO_APPDELEGATEDECLARATION_REGEX = CIO_APPDELEGATEDECLARATION_REGEX;
33
+ const CIO_APPDELEGATEHEADER_REGEX = /@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>/;
34
+ exports.CIO_APPDELEGATEHEADER_REGEX = CIO_APPDELEGATEHEADER_REGEX;
35
+ const DEFAULT_BUNDLE_VERSION = '1';
36
+ exports.DEFAULT_BUNDLE_VERSION = DEFAULT_BUNDLE_VERSION;
37
+ const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
38
+ exports.DEFAULT_BUNDLE_SHORT_VERSION = DEFAULT_BUNDLE_SHORT_VERSION;
39
+ const CIO_TARGET_NAME = 'CustomerIOSDK';
40
+ exports.CIO_TARGET_NAME = CIO_TARGET_NAME;
41
+ const CIO_NOTIFICATION_TARGET_NAME = 'CIONotificationService';
42
+ exports.CIO_NOTIFICATION_TARGET_NAME = CIO_NOTIFICATION_TARGET_NAME;
43
+ const CIO_APPDELEGATEHEADER_SNIPPET = `
44
+ #import <UserNotifications/UserNotifications.h>
45
+
46
+ @interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>
47
+ `;
48
+ exports.CIO_APPDELEGATEHEADER_SNIPPET = CIO_APPDELEGATEHEADER_SNIPPET;
49
+ const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `
50
+ CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];
51
+ `;
52
+ exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET;
53
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
54
+ [pnHandlerObj application:application error:error];
55
+ `;
56
+ exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET;
57
+ const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
58
+ return [pnHandlerObj application:application deviceToken:deviceToken];
59
+ `;
60
+
61
+ // Configure Customerio push notifications SDK by adding to application:didFinishLaunchingWithOptions: delegate method
62
+ // From Braze docs: https://www.customer.io/docs/sdk/react-native/push/#obj-c-push
63
+ exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET;
64
+ const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `
65
+ // Register for push notifications
66
+ [pnHandlerObj registerPushNotification:self];
67
+ `;
68
+
69
+ // Enable push handling - notification response
70
+ exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET;
71
+ const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = `
72
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
73
+ [pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
74
+ }`;
75
+
76
+ // Foreground push handling
77
+ exports.CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET;
78
+ const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `
79
+ // show push when the app is in foreground
80
+ - (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
81
+ completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
82
+ }`;
83
+ exports.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET;
84
+ const CIO_PODFILE_NOTIFICATION_SNIPPET = `
85
+ target '${CIO_NOTIFICATION_TARGET_NAME}' do
86
+ pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'
87
+ end`;
88
+ exports.CIO_PODFILE_NOTIFICATION_SNIPPET = CIO_PODFILE_NOTIFICATION_SNIPPET;
89
+ const CIO_PODFILE_SNIPPET = `
90
+ pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'
91
+ pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'
92
+ pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'`;
93
+ exports.CIO_PODFILE_SNIPPET = CIO_PODFILE_SNIPPET;
94
+ const CIO_PODFILE_TARGET_NAMES_SNIPPET = `
95
+ cio_target_names = [
96
+ 'CustomerIOTracking',
97
+ 'CustomerIOCommon',
98
+ 'CustomerIOMessagingPushAPN',
99
+ 'CustomerIOMessagingPush'
100
+ ]`;
101
+ exports.CIO_PODFILE_TARGET_NAMES_SNIPPET = CIO_PODFILE_TARGET_NAMES_SNIPPET;
102
+ const CIO_PODFILE_POST_INSTALL_SNIPPET = `
103
+ installer.pods_project.targets.each do |target|
104
+ if cio_target_names.include? target.name
105
+ puts "Modifying target #{target.name}"
106
+
107
+ target.build_configurations.each do |config|
108
+ puts "Setting build config settings for #{target.name}"
109
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'
110
+ end
111
+ end
112
+ end`;
113
+ exports.CIO_PODFILE_POST_INSTALL_SNIPPET = CIO_PODFILE_POST_INSTALL_SNIPPET;
114
+ const CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = `
115
+ cio_target_names = [
116
+ 'CustomerIOTracking',
117
+ 'CustomerIOCommon',
118
+ 'CustomerIOMessagingPushAPN',
119
+ 'CustomerIOMessagingPush'
120
+ ]
121
+
122
+ post_install do |installer|
123
+
124
+ installer.pods_project.targets.each do |target|
125
+ if cio_target_names.include? target.name
126
+ puts "Modifying target #{target.name}"
127
+
128
+ target.build_configurations.each do |config|
129
+ puts "Setting build config settings for #{target.name}"
130
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'
131
+ end
132
+ end
133
+ end
134
+ react_native_post_install(installer)
135
+ __apply_Xcode_12_5_M1_post_install_workaround(installer)
136
+ end`;
137
+ exports.CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET;
138
+ //# sourceMappingURL=ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LOCAL_PATH_TO_CIO_NSE_FILES","IOS_DEPLOYMENT_TARGET","CIO_PODFILE_REGEX","CIO_PODFILE_NOTIFICATION_REGEX","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_PODFILE_POST_INSTALL_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_SNIPPET","CIO_PODFILE_TARGET_NAMES_SNIPPET","CIO_PODFILE_POST_INSTALL_SNIPPET","CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["export const LOCAL_PATH_TO_CIO_NSE_FILES = `node_modules/customerio-expo-plugin/src/helpers/native-files/ios`;\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const CIO_PODFILE_REGEX = /pod 'RCT-Folly'/;\nexport const CIO_PODFILE_NOTIFICATION_REGEX =\n /target 'CIONotificationService' do/;\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_PODFILE_POST_INSTALL_REGEX = /post_install do \\|installer\\|/;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /(- \\(BOOL\\)application:\\(UIApplication \\*\\)application didFinishLaunchingWithOptions:\\(NSDictionary \\*\\)launchOptions(\\s|\\n)*?\\{)((.|\\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 : EXAppDelegateWrapper <RCTBridgeDelegate>/;\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 = 'CIONotificationService';\nexport const CIO_APPDELEGATEHEADER_SNIPPET = `\n#import <UserNotifications/UserNotifications.h>\n\n@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>\n`;\n\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\n// Configure Customerio push notifications SDK by adding to application:didFinishLaunchingWithOptions: delegate method\n// From Braze docs: https://www.customer.io/docs/sdk/react-native/push/#obj-c-push\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification:self];\n`;\n\n// Enable push handling - notification response\nexport const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = `\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {\n [pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];\n}`;\n\n// Foreground push handling\nexport const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `\n// show push when the app is in foreground\n- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {\n completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);\n}`;\nexport const CIO_PODFILE_NOTIFICATION_SNIPPET = `\ntarget '${CIO_NOTIFICATION_TARGET_NAME}' do\n pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'\nend`;\nexport const CIO_PODFILE_SNIPPET = `\n pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'\n pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'\n pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'`;\nexport const CIO_PODFILE_TARGET_NAMES_SNIPPET = `\n cio_target_names = [\n 'CustomerIOTracking',\n 'CustomerIOCommon',\n 'CustomerIOMessagingPushAPN',\n 'CustomerIOMessagingPush'\n ]`;\nexport const CIO_PODFILE_POST_INSTALL_SNIPPET = `\n installer.pods_project.targets.each do |target|\n if cio_target_names.include? target.name\n puts \"Modifying target #{target.name}\"\n\n target.build_configurations.each do |config|\n puts \"Setting build config settings for #{target.name}\"\n config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'\n end\n end\n end`;\nexport const CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = `\ncio_target_names = [\n 'CustomerIOTracking',\n 'CustomerIOCommon',\n 'CustomerIOMessagingPushAPN',\n 'CustomerIOMessagingPush'\n]\n\npost_install do |installer|\n\n installer.pods_project.targets.each do |target|\n if cio_target_names.include? target.name\n puts \"Modifying target #{target.name}\"\n\n target.build_configurations.each do |config|\n puts \"Setting build config settings for #{target.name}\"\n config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'\n end\n end\n end\n react_native_post_install(installer)\n __apply_Xcode_12_5_M1_post_install_workaround(installer)\nend`;\n"],"mappings":";;;;;;AAAO,MAAMA,2BAA2B,GAAI,kEAAiE;AAAC;AACvG,MAAMC,qBAAqB,GAAG,MAAM;AAAC;AACrC,MAAMC,iBAAiB,GAAG,iBAAiB;AAAC;AAC5C,MAAMC,8BAA8B,GACzC,oCAAoC;AAAC;AAChC,MAAMC,+BAA+B,GAAG,wBAAwB;AAAC;AACjE,MAAMC,mCAAmC,GAAG,4BAA4B;AAAC;AACzE,MAAMC,6BAA6B,GAAG,sBAAsB;AAAC;AAC7D,MAAMC,8BAA8B,GAAG,+BAA+B;AAAC;AACvE,MAAMC,kCAAkC,GAC7C,gOAAgO;AAAC;AAE5N,MAAMC,0DAA0D,GACrE,kGAAkG;AAAC;AAE9F,MAAMC,8DAA8D,GACzE,wJAAwJ;AAAC;AAEpJ,MAAMC,0DAA0D,GACrE,wGAAwG;AAAC;AAEpG,MAAMC,gCAAgC,GAC3C,mCAAmC;AAAC;AAE/B,MAAMC,2BAA2B,GACtC,mEAAmE;AAAC;AAC/D,MAAMC,sBAAsB,GAAG,GAAG;AAAC;AACnC,MAAMC,4BAA4B,GAAG,KAAK;AAAC;AAC3C,MAAMC,eAAe,GAAG,eAAe;AAAC;AACxC,MAAMC,4BAA4B,GAAG,wBAAwB;AAAC;AAC9D,MAAMC,6BAA6B,GAAI;AAC9C;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,8CAA8C,GAAI;AAC/D;AACA,CAAC;AAAC;AAEK,MAAMC,4DAA4D,GAAI;AAC7E;AACA,CAAC;AAAC;AAEK,MAAMC,4DAA4D,GAAI;AAC7E;AACA,CAAC;;AAED;AACA;AAAA;AACO,MAAMC,2CAA2C,GAAI;AAC5D;AACA;AACA,CAAC;;AAED;AAAA;AACO,MAAMC,iDAAiD,GAAI;AAClE;AACA;AACA,EAAE;;AAEF;AAAA;AACO,MAAMC,0CAA0C,GAAI;AAC3D;AACA;AACA;AACA,EAAE;AAAC;AACI,MAAMC,gCAAgC,GAAI;AACjD,UAAUR,4BAA6B;AACvC;AACA,IAAI;AAAC;AACE,MAAMS,mBAAmB,GAAI;AACpC;AACA;AACA,wDAAwD;AAAC;AAClD,MAAMC,gCAAgC,GAAI;AACjD;AACA;AACA;AACA;AACA;AACA,IAAI;AAAC;AACE,MAAMC,gCAAgC,GAAI;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AAAC;AACF,MAAMC,yCAAyC,GAAI;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.injectCodeByLineNumber = injectCodeByLineNumber;
7
+ exports.injectCodeByMultiLineRegex = injectCodeByMultiLineRegex;
8
+ exports.injectCodeByMultiLineRegexAndReplaceLine = injectCodeByMultiLineRegexAndReplaceLine;
9
+ exports.injectCodeByRegex = injectCodeByRegex;
10
+ function injectCodeByRegex(fileContent, lineRegex, snippet) {
11
+ const lines = fileContent.split('\n');
12
+ const index = lines.findIndex(line => lineRegex.test(line));
13
+ let content = lines;
14
+ if (index > -1) {
15
+ content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
16
+ }
17
+ return content;
18
+ }
19
+ function injectCodeByMultiLineRegex(fileContent, lineRegex, snippet) {
20
+ return fileContent.replace(lineRegex, `$&\n${snippet}`);
21
+ }
22
+ function injectCodeByMultiLineRegexAndReplaceLine(fileContent, lineRegex, snippet) {
23
+ return fileContent.replace(lineRegex, `${snippet}`);
24
+ }
25
+ function injectCodeByLineNumber(fileContent, index, snippet) {
26
+ const lines = fileContent.split('\n');
27
+ let content = lines;
28
+ if (index > -1) {
29
+ content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
30
+ }
31
+ return content;
32
+ }
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","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber"],"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 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;\n}\n"],"mappings":";;;;;;;;;AAAO,SAASA,iBAAiB,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,0BAA0B,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEO,SAASW,wCAAwC,CACtDb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEO,SAASY,sBAAsB,CACpCd,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;AAChB"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FileManagement = void 0;
7
+ var _fs = require("fs");
8
+ class FileManagement {
9
+ static async read(path) {
10
+ return new Promise((resolve, reject) => {
11
+ (0, _fs.readFile)(path, 'utf8', (err, data) => {
12
+ if (err || !data) {
13
+ reject(err);
14
+ return;
15
+ }
16
+ resolve(data);
17
+ });
18
+ });
19
+ }
20
+ static async write(path, contents) {
21
+ return new Promise((resolve, reject) => {
22
+ (0, _fs.writeFile)(path, contents, 'utf8', err => {
23
+ if (err) {
24
+ reject(err);
25
+ return;
26
+ }
27
+ resolve();
28
+ });
29
+ });
30
+ }
31
+ static async append(path, contents) {
32
+ return new Promise((resolve, reject) => {
33
+ (0, _fs.appendFile)(path, contents, 'utf8', err => {
34
+ if (err) {
35
+ reject(err);
36
+ return;
37
+ }
38
+ resolve();
39
+ });
40
+ });
41
+ }
42
+ }
43
+ exports.FileManagement = FileManagement;
44
+ //# sourceMappingURL=fileManagement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FileManagement","read","path","Promise","resolve","reject","readFile","err","data","write","contents","writeFile","append","appendFile"],"sources":["fileManagement.ts"],"sourcesContent":["import { readFile, writeFile, appendFile } 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"],"mappings":";;;;;;AAAA;AAEO,MAAMA,cAAc,CAAC;EAC1B,aAAaC,IAAI,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,KAAK,CAACP,IAAY,EAAEQ,QAAgB,EAAiB;IAChE,OAAO,IAAIP,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAAM,aAAS,EAACT,IAAI,EAAEQ,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QACzC,IAAIA,GAAG,EAAE;UACPF,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,EAAE;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaQ,MAAM,CAACV,IAAY,EAAEQ,QAAgB,EAAiB;IACjE,OAAO,IAAIP,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAAQ,cAAU,EAACX,IAAI,EAAEQ,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QAC1C,IAAIA,GAAG,EAAE;UACPF,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,EAAE;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.injectCIONotificationPodfileCode = injectCIONotificationPodfileCode;
7
+ exports.injectCIOPodfileCode = injectCIOPodfileCode;
8
+ var _ios = require("../constants/ios");
9
+ var _fileManagement = require("./fileManagement");
10
+ async function injectCIOPodfileCode(iosPath) {
11
+ const filename = `${iosPath}/Podfile`;
12
+ const podfile = await _fileManagement.FileManagement.read(filename);
13
+ const matches = podfile.match(_ios.CIO_PODFILE_REGEX);
14
+ const lines = podfile.split('\n');
15
+ const index = lines.findIndex(line => _ios.CIO_PODFILE_POST_INSTALL_REGEX.test(line));
16
+ let content = lines;
17
+ if (index > -1) {
18
+ content = [...lines.slice(0, index - 1), !matches ? _ios.CIO_PODFILE_SNIPPET : '', _ios.CIO_PODFILE_TARGET_NAMES_SNIPPET, ...lines.slice(index - 1, index + 1), _ios.CIO_PODFILE_POST_INSTALL_SNIPPET, ...lines.slice(index + 1)];
19
+ } else {
20
+ content.push(_ios.CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET);
21
+ }
22
+ _fileManagement.FileManagement.write(filename, content.join('\n'));
23
+ }
24
+ async function injectCIONotificationPodfileCode(iosPath) {
25
+ const filename = `${iosPath}/Podfile`;
26
+ const podfile = await _fileManagement.FileManagement.read(filename);
27
+ const matches = podfile.match(_ios.CIO_PODFILE_NOTIFICATION_REGEX);
28
+ if (!matches) {
29
+ _fileManagement.FileManagement.append(filename, _ios.CIO_PODFILE_NOTIFICATION_SNIPPET);
30
+ }
31
+ }
32
+ //# sourceMappingURL=injectCIOPodfileCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["injectCIOPodfileCode","iosPath","filename","podfile","FileManagement","read","matches","match","CIO_PODFILE_REGEX","lines","split","index","findIndex","line","CIO_PODFILE_POST_INSTALL_REGEX","test","content","slice","CIO_PODFILE_SNIPPET","CIO_PODFILE_TARGET_NAMES_SNIPPET","CIO_PODFILE_POST_INSTALL_SNIPPET","push","CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET","write","join","injectCIONotificationPodfileCode","CIO_PODFILE_NOTIFICATION_REGEX","append","CIO_PODFILE_NOTIFICATION_SNIPPET"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import {\n CIO_PODFILE_REGEX,\n CIO_PODFILE_SNIPPET,\n CIO_PODFILE_POST_INSTALL_REGEX,\n CIO_PODFILE_TARGET_NAMES_SNIPPET,\n CIO_PODFILE_POST_INSTALL_SNIPPET,\n CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET,\n CIO_PODFILE_NOTIFICATION_SNIPPET,\n CIO_PODFILE_NOTIFICATION_REGEX,\n} from '../constants/ios';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_REGEX);\n\n const lines = podfile.split('\\n');\n const index = lines.findIndex((line) =>\n CIO_PODFILE_POST_INSTALL_REGEX.test(line)\n );\n let content: string[] = lines;\n if (index > -1) {\n content = [\n ...lines.slice(0, index - 1),\n !matches ? CIO_PODFILE_SNIPPET : '',\n CIO_PODFILE_TARGET_NAMES_SNIPPET,\n ...lines.slice(index - 1, index + 1),\n CIO_PODFILE_POST_INSTALL_SNIPPET,\n ...lines.slice(index + 1),\n ];\n } else {\n content.push(CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET);\n }\n\n FileManagement.write(filename, content.join('\\n'));\n}\n\nexport async function injectCIONotificationPodfileCode(iosPath: string) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);\n\n if (!matches) {\n FileManagement.append(filename, CIO_PODFILE_NOTIFICATION_SNIPPET);\n }\n}\n"],"mappings":";;;;;;;AAAA;AAUA;AAEO,eAAeA,oBAAoB,CAACC,OAAe,EAAE;EAC1D,MAAMC,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EACnD,MAAMI,OAAO,GAAGH,OAAO,CAACI,KAAK,CAACC,sBAAiB,CAAC;EAEhD,MAAMC,KAAK,GAAGN,OAAO,CAACO,KAAK,CAAC,IAAI,CAAC;EACjC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IACjCC,mCAA8B,CAACC,IAAI,CAACF,IAAI,CAAC,CAC1C;EACD,IAAIG,OAAiB,GAAGP,KAAK;EAC7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdK,OAAO,GAAG,CACR,GAAGP,KAAK,CAACQ,KAAK,CAAC,CAAC,EAAEN,KAAK,GAAG,CAAC,CAAC,EAC5B,CAACL,OAAO,GAAGY,wBAAmB,GAAG,EAAE,EACnCC,qCAAgC,EAChC,GAAGV,KAAK,CAACQ,KAAK,CAACN,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG,CAAC,CAAC,EACpCS,qCAAgC,EAChC,GAAGX,KAAK,CAACQ,KAAK,CAACN,KAAK,GAAG,CAAC,CAAC,CAC1B;EACH,CAAC,MAAM;IACLK,OAAO,CAACK,IAAI,CAACC,8CAAyC,CAAC;EACzD;EAEAlB,8BAAc,CAACmB,KAAK,CAACrB,QAAQ,EAAEc,OAAO,CAACQ,IAAI,CAAC,IAAI,CAAC,CAAC;AACpD;AAEO,eAAeC,gCAAgC,CAACxB,OAAe,EAAE;EACtE,MAAMC,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EACnD,MAAMI,OAAO,GAAGH,OAAO,CAACI,KAAK,CAACmB,mCAA8B,CAAC;EAE7D,IAAI,CAACpB,OAAO,EAAE;IACZF,8BAAc,CAACuB,MAAM,CAACzB,QAAQ,EAAE0B,qCAAgC,CAAC;EACnE;AACF"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _withCIOAndroid = require("./android/withCIOAndroid");
8
+ var _withCIOIos = require("./ios/withCIOIos");
9
+ // Entry point for config plugin
10
+ function withCustomerIOPlugin(config, props) {
11
+ config = (0, _withCIOIos.withCIOIos)(config, props);
12
+ config = (0, _withCIOAndroid.withCIOAndroid)(config, props);
13
+ return config;
14
+ }
15
+ var _default = withCustomerIOPlugin;
16
+ exports.default = _default;
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withCustomerIOPlugin","config","props","withCIOIos","withCIOAndroid"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\nimport { withCIOIos } from './ios/withCIOIos';\nimport type {\n CustomerIOPluginOptionsIOS,\n CustomerIOPluginOptionsAndroid,\n} from './types/cio-types';\n\n// Entry point for config plugin\nfunction withCustomerIOPlugin(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS | CustomerIOPluginOptionsAndroid\n) {\n config = withCIOIos(config, props as CustomerIOPluginOptionsIOS);\n config = withCIOAndroid(config, props as CustomerIOPluginOptionsAndroid);\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":";;;;;;AAEA;AACA;AAMA;AACA,SAASA,oBAAoB,CAC3BC,MAAkB,EAClBC,KAAkE,EAClE;EACAD,MAAM,GAAG,IAAAE,sBAAU,EAACF,MAAM,EAAEC,KAAK,CAA+B;EAChED,MAAM,GAAG,IAAAG,8BAAc,EAACH,MAAM,EAAEC,KAAK,CAAmC;EAExE,OAAOD,MAAM;AACf;AAAC,eAEcD,oBAAoB;AAAA"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withAppDelegateModifications = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _Paths = require("@expo/config-plugins/build/ios/Paths");
9
+ var _ios = require("../helpers/constants/ios");
10
+ var _codeInjection = require("../helpers/utils/codeInjection");
11
+ var _fileManagement = require("../helpers/utils/fileManagement");
12
+ const pushCodeSnippets = [_ios.CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET, _ios.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET];
13
+ const additionalMethodsForPushNotifications = `${pushCodeSnippets.join('\n')}\n`; // Join w/ newlines and ensure a newline at the end.
14
+
15
+ const addImport = stringContents => {
16
+ const importRegex = /^(#import .*)\n/gm;
17
+ const addedImport = `
18
+ // Add swift bridge imports
19
+ #import <ExpoModulesCore-Swift.h>
20
+ #import <testiosapp-Swift.h>
21
+ `;
22
+ const match = stringContents.match(importRegex);
23
+ let endOfMatchIndex;
24
+ if (!match || match.index === undefined) {
25
+ // No imports found, just add to start of file:
26
+ endOfMatchIndex = 0;
27
+ } else {
28
+ // Add after first import:
29
+ endOfMatchIndex = match.index + match[0].length;
30
+ }
31
+ stringContents = (0, _codeInjection.injectCodeByLineNumber)(stringContents, endOfMatchIndex, addedImport).join('\n');
32
+ return stringContents;
33
+ };
34
+ const addNotificationHandlerDeclaration = stringContents => {
35
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegex)(stringContents, _ios.CIO_APPDELEGATEDECLARATION_REGEX, _ios.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET);
36
+ return stringContents;
37
+ };
38
+ const addNotificationConfiguration = stringContents => {
39
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegex)(stringContents, _ios.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX, _ios.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET);
40
+ return stringContents;
41
+ };
42
+ const addDidFailToRegisterForRemoteNotificationsWithError = stringContents => {
43
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, _ios.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET);
44
+ return stringContents;
45
+ };
46
+ const AddDidRegisterForRemoteNotificationsWithDeviceToken = stringContents => {
47
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, _ios.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET);
48
+ return stringContents;
49
+ };
50
+ const addAdditionalMethodsForPushNotifications = stringContents => {
51
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegex)(stringContents, _ios.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX, additionalMethodsForPushNotifications);
52
+ return stringContents;
53
+ };
54
+ const addAppdelegateHeaderModification = stringContents => {
55
+ stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_APPDELEGATEHEADER_REGEX, _ios.CIO_APPDELEGATEHEADER_SNIPPET);
56
+ return stringContents;
57
+ };
58
+ const withAppDelegateModifications = configOuter => {
59
+ return (0, _configPlugins.withAppDelegate)(configOuter, async config => {
60
+ let stringContents = config.modResults.contents;
61
+ const headerPath = (0, _Paths.getAppDelegateHeaderFilePath)(config.modRequest.projectRoot);
62
+ let headerContent = await _fileManagement.FileManagement.read(headerPath);
63
+ headerContent = addAppdelegateHeaderModification(headerContent);
64
+ _fileManagement.FileManagement.write(headerPath, headerContent);
65
+ stringContents = addImport(stringContents);
66
+ stringContents = addNotificationHandlerDeclaration(stringContents);
67
+ stringContents = addNotificationConfiguration(stringContents);
68
+ stringContents = addAdditionalMethodsForPushNotifications(stringContents);
69
+ stringContents = addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
70
+ stringContents = AddDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);
71
+ config.modResults.contents = stringContents;
72
+ return config;
73
+ });
74
+ };
75
+ exports.withAppDelegateModifications = withAppDelegateModifications;
76
+ //# sourceMappingURL=withAppDelegateModifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pushCodeSnippets","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","additionalMethodsForPushNotifications","join","addImport","stringContents","importRegex","addedImport","match","endOfMatchIndex","index","undefined","length","injectCodeByLineNumber","addNotificationHandlerDeclaration","injectCodeByMultiLineRegex","CIO_APPDELEGATEDECLARATION_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","addNotificationConfiguration","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","addDidFailToRegisterForRemoteNotificationsWithError","injectCodeByMultiLineRegexAndReplaceLine","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","AddDidRegisterForRemoteNotificationsWithDeviceToken","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","addAdditionalMethodsForPushNotifications","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","addAppdelegateHeaderModification","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_SNIPPET","withAppDelegateModifications","configOuter","withAppDelegate","config","modResults","contents","headerPath","getAppDelegateHeaderFilePath","modRequest","projectRoot","headerContent","FileManagement","read","write"],"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_REGEX,\n CIO_APPDELEGATEHEADER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\n\nconst pushCodeSnippets = [\n CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,\n CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,\n];\n\nconst additionalMethodsForPushNotifications = `${pushCodeSnippets.join(\n '\\n'\n)}\\n`; // Join w/ newlines and ensure a newline at the end.\n\nconst addImport = (stringContents: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <testiosapp-Swift.h>\n `;\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 ).join('\\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 = injectCodeByMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_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\nconst addAdditionalMethodsForPushNotifications = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,\n additionalMethodsForPushNotifications\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_SNIPPET\n );\n\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<any> = (\n configOuter\n) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\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(stringContents);\n stringContents = addNotificationHandlerDeclaration(stringContents);\n stringContents = addNotificationConfiguration(stringContents);\n stringContents = addAdditionalMethodsForPushNotifications(stringContents);\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n AddDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n config.modResults.contents = stringContents;\n return config;\n });\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AAeA;AAKA;AAEA,MAAMA,gBAAgB,GAAG,CACvBC,sDAAiD,EACjDC,+CAA0C,CAC3C;AAED,MAAMC,qCAAqC,GAAI,GAAEH,gBAAgB,CAACI,IAAI,CACpE,IAAI,CACJ,IAAG,CAAC,CAAC;;AAEP,MAAMC,SAAS,GAAIC,cAAsB,IAAK;EAC5C,MAAMC,WAAW,GAAG,mBAAmB;EACvC,MAAMC,WAAW,GAAI;AACvB;AACA;AACA;AACA,GAAG;EAED,MAAMC,KAAK,GAAGH,cAAc,CAACG,KAAK,CAACF,WAAW,CAAC;EAC/C,IAAIG,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;EAEAP,cAAc,GAAG,IAAAQ,qCAAsB,EACrCR,cAAc,EACdI,eAAe,EACfF,WAAW,CACZ,CAACJ,IAAI,CAAC,IAAI,CAAC;EAEZ,OAAOE,cAAc;AACvB,CAAC;AAED,MAAMS,iCAAiC,GAAIT,cAAsB,IAAK;EACpEA,cAAc,GAAG,IAAAU,yCAA0B,EACzCV,cAAc,EACdW,qCAAgC,EAChCC,mDAA8C,CAC/C;EAED,OAAOZ,cAAc;AACvB,CAAC;AAED,MAAMa,4BAA4B,GAAIb,cAAsB,IAAK;EAC/DA,cAAc,GAAG,IAAAU,yCAA0B,EACzCV,cAAc,EACdc,uCAAkC,EAClCC,gDAA2C,CAC5C;EAED,OAAOf,cAAc;AACvB,CAAC;AAED,MAAMgB,mDAAmD,GACvDhB,cAAsB,IACnB;EACHA,cAAc,GAAG,IAAAiB,uDAAwC,EACvDjB,cAAc,EACdkB,+DAA0D,EAC1DC,iEAA4D,CAC7D;EAED,OAAOnB,cAAc;AACvB,CAAC;AAED,MAAMoB,mDAAmD,GACvDpB,cAAsB,IACnB;EACHA,cAAc,GAAG,IAAAiB,uDAAwC,EACvDjB,cAAc,EACdqB,+DAA0D,EAC1DC,iEAA4D,CAC7D;EAED,OAAOtB,cAAc;AACvB,CAAC;AAED,MAAMuB,wCAAwC,GAAIvB,cAAsB,IAAK;EAC3EA,cAAc,GAAG,IAAAU,yCAA0B,EACzCV,cAAc,EACdwB,mEAA8D,EAC9D3B,qCAAqC,CACtC;EAED,OAAOG,cAAc;AACvB,CAAC;AAED,MAAMyB,gCAAgC,GAAIzB,cAAsB,IAAK;EACnEA,cAAc,GAAG,IAAAiB,uDAAwC,EACvDjB,cAAc,EACd0B,gCAA2B,EAC3BC,kCAA6B,CAC9B;EAED,OAAO3B,cAAc;AACvB,CAAC;AAEM,MAAM4B,4BAA+C,GAC1DC,WAAW,IACR;EACH,OAAO,IAAAC,8BAAe,EAACD,WAAW,EAAE,MAAOE,MAAM,IAAK;IACpD,IAAI/B,cAAc,GAAG+B,MAAM,CAACC,UAAU,CAACC,QAAQ;IAC/C,MAAMC,UAAU,GAAG,IAAAC,mCAA4B,EAC7CJ,MAAM,CAACK,UAAU,CAACC,WAAW,CAC9B;IACD,IAAIC,aAAa,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACN,UAAU,CAAC;IACzDI,aAAa,GAAGb,gCAAgC,CAACa,aAAa,CAAC;IAC/DC,8BAAc,CAACE,KAAK,CAACP,UAAU,EAAEI,aAAa,CAAC;IAE/CtC,cAAc,GAAGD,SAAS,CAACC,cAAc,CAAC;IAC1CA,cAAc,GAAGS,iCAAiC,CAACT,cAAc,CAAC;IAClEA,cAAc,GAAGa,4BAA4B,CAACb,cAAc,CAAC;IAC7DA,cAAc,GAAGuB,wCAAwC,CAACvB,cAAc,CAAC;IACzEA,cAAc,GACZgB,mDAAmD,CAAChB,cAAc,CAAC;IACrEA,cAAc,GACZoB,mDAAmD,CAACpB,cAAc,CAAC;IAErE+B,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGjC,cAAc;IAC3C,OAAO+B,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAAC"}