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
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
- <p align="center">
1
+ <p align=center>
2
2
  <a href="https://customer.io">
3
- <img src="https://user-images.githubusercontent.com/6409227/144680509-907ee093-d7ad-4a9c-b0a5-f640eeb060cd.png" height="60">
3
+ <img src="https://avatars.githubusercontent.com/u/1152079?s=200&v=4" height="60">
4
4
  </a>
5
- <p align="center">Power automated communication that people like to receive.</p>
6
5
  </p>
7
6
 
8
7
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md)
@@ -15,9 +14,13 @@ The Expo plugin takes advantage of our [React Native SDK](https://github.com/cus
15
14
 
16
15
  After you add the plugin to your project, you'll need to install our React Native SDK and run pre-build. The plugin automatically generates and configures the necessary native code files required to make our React Native SDK to work on your project.
17
16
 
18
- # Getting started
17
+ # Getting started
19
18
 
20
- You'll find our [complete SDK documentation at https://customer.io/docs/sdk/expo](https://customer.io/docs/sdk/expo/).
19
+ You'll find our [complete SDK documentation at https://customer.io/docs/sdk/expo](https://customer.io/docs/sdk/expo/).
20
+
21
+ # Local development
22
+
23
+ [Here is a quick start guide to start with local development.](/local-development-readme.md)
21
24
 
22
25
  # Contributing
23
26
 
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "customerio-expo-plugin",
3
- "version": "1.0.0-beta.9",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Expo config plugin for the Customer IO React Native SDK",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/index.d.ts",
8
- "source": "src/index",
9
- "react-native": "src/index",
5
+ "main": "plugin/lib/commonjs/index",
6
+ "module": "plugin/lib/module/index",
7
+ "types": "plugin/lib/typescript/index.d.ts",
8
+ "source": "plugin/src/index",
9
+ "react-native": "plugin/src/index",
10
10
  "license": "MIT",
11
11
  "files": [
12
- "src",
13
- "lib/**/*"
12
+ "plugin/app.plugin.js",
13
+ "plugin/src",
14
+ "plugin/lib/**/*"
14
15
  ],
15
16
  "exports": {
16
- ".": "./lib/commonjs/index.js",
17
- "./postinstall": "./src/postInstallHelper.js"
17
+ "./app.plugin.js": "./plugin/app.plugin.js",
18
+ ".": "./plugin/lib/commonjs/index.js",
19
+ "./postinstall": "./plugin/src/postInstallHelper.js"
18
20
  },
19
21
  "scripts": {
20
22
  "build": "npm run clean && tsc",
@@ -23,7 +25,14 @@
23
25
  "lint": "eslint . --fix",
24
26
  "typescript": "tsc --noEmit",
25
27
  "prepare": "npm run clean && bob build",
26
- "postinstall": "node src/postInstall.js"
28
+ "postinstall": "node plugin/src/postInstall.js",
29
+ "test": "jest",
30
+ "setup-tests": "bash scripts/setup-test.sh",
31
+ "cleanup": "bash scripts/cleanup-after-tests.sh",
32
+ "test-plugin": "npm run setup-tests && npm run test && npm run cleanup",
33
+ "cleanAll": "bash scripts/clean-all.sh",
34
+ "buildAll": "bash scripts/build-all.sh",
35
+ "cleanAndBuildAll": "npm run cleanAll && npm run buildAll"
27
36
  },
28
37
  "keywords": [
29
38
  "react-native",
@@ -31,7 +40,7 @@
31
40
  "android"
32
41
  ],
33
42
  "repository": "https://github.com/customerio/customerio-expo-plugin",
34
- "author": "ami-segun <segun@customer.io> (https://customer.io/)",
43
+ "author": "CustomerIO Team <win@customer.io> (https://customer.io/)",
35
44
  "bugs": {
36
45
  "url": "https://github.com/customerio/customerio-expo-plugin/issues"
37
46
  },
@@ -40,7 +49,7 @@
40
49
  "registry": "https://registry.npmjs.org/"
41
50
  },
42
51
  "peerDependencies": {
43
- "customerio-reactnative": "^2.0.0"
52
+ "customerio-reactnative": ">=3.4.0"
44
53
  },
45
54
  "devDependencies": {
46
55
  "@expo/config-plugins": "^4.1.4",
@@ -55,13 +64,11 @@
55
64
  "prettier": "^2.6.2",
56
65
  "react-native-builder-bob": "^0.18.3",
57
66
  "typescript": "^4.6.4",
58
- "xcode": "^3.0.1"
59
- },
60
- "jest": {
61
- "preset": "react-native",
62
- "modulePathIgnorePatterns": [
63
- "<rootDir>/lib/"
64
- ]
67
+ "xcode": "^3.0.1",
68
+ "@types/jest": "^29.5.14",
69
+ "jest": "^29.7.0",
70
+ "jest-environment-jsdom": "^29.7.0",
71
+ "ts-jest": "^29.2.5"
65
72
  },
66
73
  "commitlint": {
67
74
  "extends": [
@@ -89,7 +96,7 @@
89
96
  },
90
97
  "eslintIgnore": [
91
98
  "node_modules/",
92
- "lib/"
99
+ "plugin/lib/"
93
100
  ],
94
101
  "prettier": {
95
102
  "quoteProps": "consistent",
@@ -99,8 +106,8 @@
99
106
  "useTabs": false
100
107
  },
101
108
  "react-native-builder-bob": {
102
- "source": "src",
103
- "output": "lib",
109
+ "source": "plugin/src",
110
+ "output": "plugin/lib",
104
111
  "targets": [
105
112
  "commonjs",
106
113
  "module",
@@ -113,6 +120,7 @@
113
120
  ]
114
121
  },
115
122
  "dependencies": {
116
- "find-package-json": "^1.2.0"
123
+ "find-package-json": "^1.2.0",
124
+ "fs-extra": "^11.2.0"
117
125
  }
118
126
  }
@@ -0,0 +1 @@
1
+ module.exports = require("./lib/commonjs/index");
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log","exports"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,kCAAmB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log","exports"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,kCAAmB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log","exports"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,+BAAsB,CAAC;IAChD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EAClB,OAAML,+BAAuB,EAChC,CAAC;IACH,CAAC,MAAM;MACLM,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log","exports"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,+BAAsB,CAAC;IAChD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EACnB,OAAOL,+BAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLM,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -9,11 +9,13 @@ var _withAppGoogleServices = require("./withAppGoogleServices");
9
9
  var _withGistMavenRepository = require("./withGistMavenRepository");
10
10
  var _withGoogleServicesJSON = require("./withGoogleServicesJSON");
11
11
  var _withProjectGoogleServices = require("./withProjectGoogleServices");
12
+ var _withProjectStrings = require("./withProjectStrings");
12
13
  function withCIOAndroid(config, props) {
13
14
  config = (0, _withGistMavenRepository.withGistMavenRepository)(config, props);
14
15
  config = (0, _withProjectGoogleServices.withProjectGoogleServices)(config, props);
15
16
  config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
16
17
  config = (0, _withGoogleServicesJSON.withGoogleServicesJSON)(config, props);
18
+ config = (0, _withProjectStrings.withProjectStrings)(config);
17
19
  if (props.setHighPriorityPushHandler) {
18
20
  config = (0, _withAndroidManifestUpdates.withAndroidManifestUpdates)(config, props);
19
21
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","_withProjectStrings","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","withProjectStrings","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\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,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAEO,SAASM,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAG,IAAAE,gDAAuB,EAACF,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAG,oDAAyB,EAACH,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAI,4CAAqB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAK,8CAAsB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC9CD,MAAM,GAAG,IAAAM,sCAAkB,EAACN,MAAM,CAAC;EACnC,IAAIC,KAAK,CAACM,0BAA0B,EAAE;IACpCP,MAAM,GAAG,IAAAQ,sDAA0B,EAACR,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log","exports"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACC,6BAAoB,CAAC;IACzE,IAAI,CAACJ,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACG,OAAO,CAC3DC,sCAA6B,EAC5B,OAAMC,uCAA+B,EACxC,CAAC;IACH,CAAC,MAAM;MACLC,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log","exports"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACC,6BAAoB,CAAC;IACzE,IAAI,CAACJ,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACG,OAAO,CAC3DC,sCAA6B,EAC7B,OAAOC,uCAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLC,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAO,IAAAC,qCAAsB,EAACF,WAAW,EAAGG,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACK,8BAAc,CAACC,MAAM,CAAE,GAAEL,WAAY,2BAA0B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EACjB,GAAEH,WAAY,2BACjB,CAAC;QACH,CAAC,CAAC,OAAOO,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACR,4FAA2FT,WAAY,2BAC1G,CAAC;QACH;MACF,CAAC,MAAM;QACLQ,OAAO,CAACC,GAAG,CACR,wCAAuCN,kBAAmB,yDAAwDH,WAAY,2BACjI,CAAC;MACH;IACF,CAAC,MAAM;MACLQ,OAAO,CAACC,GAAG,CACR,wBAAuBT,WAAY,wCACtC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACY,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAO,IAAAC,qCAAsB,EAACF,WAAW,EAAGG,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACK,8BAAc,CAACC,MAAM,CAAC,GAAGL,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,OAAOO,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACT,4FAA4FT,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLQ,OAAO,CAACC,GAAG,CACT,wCAAwCN,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLQ,OAAO,CAACC,GAAG,CACT,wBAAwBT,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACY,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configPlugins","require","_android","withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","exports"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,mCAA0B,CAAC;IACpD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC7B,OAAML,mCAA2B,EACpC,CAAC;IACH;IAEA,OAAOH,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_configPlugins","require","_android","withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","exports"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,mCAA0B,CAAC;IACpD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC9B,OAAOL,mCAA0B,EACnC,CAAC;IACH;IAEA,OAAOH,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addStringsToXml = addStringsToXml;
7
+ exports.withProjectStrings = void 0;
8
+ var _configPlugins = require("@expo/config-plugins");
9
+ var _pluginUtils = require("../helpers/utils/pluginUtils");
10
+ /**
11
+ * Adds or updates string resources in Android's strings.xml required by the plugin
12
+ */
13
+ const withProjectStrings = config => {
14
+ return (0, _configPlugins.withStringsXml)(config, config => {
15
+ const stringsXml = config.modResults;
16
+ const pluginVersion = (0, _pluginUtils.getPluginVersion)();
17
+
18
+ // Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating
19
+ // the strings here instead
20
+ // These strings are added to the strings.xml file by Customer.io's React Native SDK
21
+ // We're updating them here to include the Expo client source and version so user agent
22
+ // can be generated correctly for Expo apps
23
+ addStringsToXml(stringsXml, [{
24
+ name: 'customer_io_react_native_sdk_client_source',
25
+ value: 'Expo'
26
+ }, {
27
+ name: 'customer_io_react_native_sdk_client_version',
28
+ value: pluginVersion
29
+ }]);
30
+ return config;
31
+ });
32
+ };
33
+
34
+ /**
35
+ * Adds or updates multiple string resources in Android's strings.xml
36
+ * @param stringsXml - Parsed strings.xml object
37
+ * @param stringResources - Array of string resources to add or update
38
+ * @returns Updated strings.xml object
39
+ */
40
+ exports.withProjectStrings = withProjectStrings;
41
+ function addStringsToXml(stringsXml, stringResources) {
42
+ // Ensure the resource exists
43
+ if (!stringsXml.resources) {
44
+ stringsXml.resources = {
45
+ string: []
46
+ };
47
+ }
48
+ stringResources.forEach(({
49
+ name,
50
+ value
51
+ }) => {
52
+ const existingStringIndex = stringsXml.resources.string.findIndex(item => {
53
+ var _item$$;
54
+ return ((_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.name) === name;
55
+ });
56
+ if (existingStringIndex !== -1) {
57
+ // Update the existing string
58
+ stringsXml.resources.string[existingStringIndex]._ = value;
59
+ } else {
60
+ // Add a new string resource
61
+ stringsXml.resources.string.push({
62
+ $: {
63
+ name
64
+ },
65
+ _: value
66
+ });
67
+ }
68
+ });
69
+ }
70
+ //# sourceMappingURL=withProjectStrings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","_pluginUtils","withProjectStrings","config","withStringsXml","stringsXml","modResults","pluginVersion","getPluginVersion","addStringsToXml","name","value","exports","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,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,MAAME,kBAAgC,GAAIC,MAAM,IAAK;EAC1D,OAAO,IAAAC,6BAAc,EAACD,MAAM,EAAGA,MAAM,IAAK;IACxC,MAAME,UAAU,GAAGF,MAAM,CAACG,UAAU;IACpC,MAAMC,aAAa,GAAG,IAAAC,6BAAgB,EAAC,CAAC;;IAExC;IACA;IACA;IACA;IACA;IACAC,eAAe,CAACJ,UAAU,EAAE,CAC1B;MAAEK,IAAI,EAAE,4CAA4C;MAAEC,KAAK,EAAE;IAAO,CAAC,EACrE;MAAED,IAAI,EAAE,6CAA6C;MAAEC,KAAK,EAAEJ;IAAc,CAAC,CAC9E,CAAC;IAEF,OAAOJ,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAS,OAAA,CAAAV,kBAAA,GAAAA,kBAAA;AAMO,SAASO,eAAeA,CAC7BJ,UAAe,EACfQ,eAAkD,EAClD;EACA;EACA,IAAI,CAACR,UAAU,CAACS,SAAS,EAAE;IACzBT,UAAU,CAACS,SAAS,GAAG;MAAEC,MAAM,EAAE;IAAG,CAAC;EACvC;EAEAF,eAAe,CAACG,OAAO,CAAC,CAAC;IAAEN,IAAI;IAAEC;EAAM,CAAC,KAAK;IAC3C,MAAMM,mBAAmB,GAAGZ,UAAU,CAACS,SAAS,CAACC,MAAM,CAACG,SAAS,CAC9DC,IAA6B;MAAA,IAAAC,OAAA;MAAA,OAAK,EAAAA,OAAA,GAAAD,IAAI,CAACE,CAAC,cAAAD,OAAA,uBAANA,OAAA,CAAQV,IAAI,MAAKA,IAAI;IAAA,CAC1D,CAAC;IAED,IAAIO,mBAAmB,KAAK,CAAC,CAAC,EAAE;MAC9B;MACAZ,UAAU,CAACS,SAAS,CAACC,MAAM,CAACE,mBAAmB,CAAC,CAACK,CAAC,GAAGX,KAAK;IAC5D,CAAC,MAAM;MACL;MACAN,UAAU,CAACS,SAAS,CAACC,MAAM,CAACQ,IAAI,CAAC;QAC/BF,CAAC,EAAE;UAAEX;QAAK,CAAC;QACXY,CAAC,EAAEX;MACL,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,14 @@
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_GIST_MAVEN_REGEX = exports.CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_APPLY_REGEX = void 0;
7
+ const CIO_PROJECT_BUILDSCRIPTS_REGEX = exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = /(buildscript\s*\{(.|\n)*dependencies\s*\{)/;
8
+ const CIO_APP_APPLY_REGEX = exports.CIO_APP_APPLY_REGEX = /(apply plugin: "com.android.application")/;
9
+ const CIO_GIST_MAVEN_REGEX = exports.CIO_GIST_MAVEN_REGEX = /maven { url "https:\/\/maven.gist.build" }/;
10
+ const CIO_PROJECT_ALLPROJECTS_REGEX = exports.CIO_PROJECT_ALLPROJECTS_REGEX = /(allprojects\s*\{(.|\n){1,500}repositories\s*\{)/;
11
+ const CIO_PROJECT_GIST_MAVEN_SNIPPET = exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = ' maven { url "https://maven.gist.build" }';
12
+ const CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_GOOGLE_SNIPPET = 'apply plugin: "com.google.gms.google-services" // Google Services plugin';
13
+ const CIO_PROJECT_GOOGLE_SNIPPET = exports.CIO_PROJECT_GOOGLE_SNIPPET = ' classpath "com.google.gms:google-services:4.3.13" // Google Services plugin';
14
+ //# sourceMappingURL=android.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","exports","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAACC,OAAA,CAAAD,8BAAA,GAAAA,8BAAA;AACxC,MAAME,mBAAmB,GAAG,2CAA2C;AAACD,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AACxE,MAAMC,oBAAoB,GAC/B,4CAA4C;AAACF,OAAA,CAAAE,oBAAA,GAAAA,oBAAA;AACxC,MAAMC,6BAA6B,GACxC,kDAAkD;AAACH,OAAA,CAAAG,6BAAA,GAAAA,6BAAA;AAE9C,MAAMC,8BAA8B,GACzC,kDAAkD;AAACJ,OAAA,CAAAI,8BAAA,GAAAA,8BAAA;AAC9C,MAAMC,sBAAsB,GACjC,2EAA2E;AAACL,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AACvE,MAAMC,0BAA0B,GACrC,sFAAsF;AAACN,OAAA,CAAAM,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","exports","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GACzC,4CAA4C;AACvC,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,2CAA2C;AACvE,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAC/B,4CAA4C;AACvC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GACxC,kDAAkD;AAE7C,MAAMC,8BAA8B,GAAAJ,OAAA,CAAAI,8BAAA,GACzC,kDAAkD;AAC7C,MAAMC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,GACjC,2EAA2E;AACtE,MAAMC,0BAA0B,GAAAN,OAAA,CAAAM,0BAAA,GACrC,sFAAsF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,119 @@
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_TARGET_NAME = exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_NOTIFICATION_TARGET_NAME = exports.CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = exports.CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_INITIALIZECIOSDK_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_DEEPLINK_COMMENT_REGEX = exports.CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET = exports.CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = exports.CIO_APPDELEGATEDECLARATION_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = void 0;
7
+ exports.getRelativePathToRNSDK = getRelativePathToRNSDK;
8
+ const finder = require('find-package-json');
9
+ const path = require('path');
10
+ const resolveFrom = require('resolve-from');
11
+ const f = finder(__dirname);
12
+ let pluginPackageRoot = f.next().filename;
13
+ // This is the path to the root of the customerio-expo-plugin package
14
+ pluginPackageRoot = path.dirname(pluginPackageRoot);
15
+ const LOCAL_PATH_TO_CIO_NSE_FILES = exports.LOCAL_PATH_TO_CIO_NSE_FILES = path.join(pluginPackageRoot, 'plugin/src/helpers/native-files/ios');
16
+ function getRelativePathToRNSDK(iosPath) {
17
+ // Root path of the Expo project
18
+ const rootAppPath = path.dirname(iosPath);
19
+
20
+ // Path of the cio RN package.json file. Example: test-app/node_modules/customerio-reactnative/package.json
21
+ const pluginPackageJsonPath = resolveFrom.silent(rootAppPath, `customerio-reactnative/package.json`);
22
+
23
+ // Example: ../node_modules/customerio-reactnative
24
+ return path.relative(iosPath, path.dirname(pluginPackageJsonPath));
25
+ }
26
+ const IOS_DEPLOYMENT_TARGET = exports.IOS_DEPLOYMENT_TARGET = '13.0';
27
+ const GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
28
+ const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
29
+ const BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
30
+ const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = /.*\[super(\s)application:application(\s)didFinishLaunchingWithOptions:launchOptions\];/;
31
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = /return \[super application:application didFailToRegisterForRemoteNotificationsWithError:error\];/;
32
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = /(- \(void\)application:\(UIApplication \*\)application didFailToRegisterForRemoteNotificationsWithError:\(NSError \*\)error(\s|\n)*?\{)(.|\n){2}.*\n\}/;
33
+ const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = /return \[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\];/;
34
+ const CIO_APPDELEGATEDECLARATION_REGEX = exports.CIO_APPDELEGATEDECLARATION_REGEX = /@implementation AppDelegate(.|\n)/;
35
+ const CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEHEADER_REGEX = /(@interface AppDelegate\s*:\s*EXAppDelegateWrapper\s*)(<([^>]+)>)?/;
36
+ const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX = /^\s*RCTBridge\s*\*\s*\w+\s*=\s*\[\s*self\.reactDelegate\s+createBridgeWithDelegate:self\s+launchOptions:launchOptions\s*\];\s*$/gm;
37
+ const CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX = /^\s*return\s\[\s*super\s*application:\s*application\s*didFinishLaunchingWithOptions\s*:\s*launchOptions\s*\];/gm;
38
+ const CIO_DEEPLINK_COMMENT_REGEX = exports.CIO_DEEPLINK_COMMENT_REGEX = /\sDeep link workaround for app killed state start/gm;
39
+ const DEFAULT_BUNDLE_VERSION = exports.DEFAULT_BUNDLE_VERSION = '1';
40
+ const DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
41
+ const CIO_TARGET_NAME = exports.CIO_TARGET_NAME = 'CustomerIOSDK';
42
+ const CIO_NOTIFICATION_TARGET_NAME = exports.CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';
43
+ const CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = exports.CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = `#import <UserNotifications/UserNotifications.h>`;
44
+ const CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET = exports.CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET = 'UNUserNotificationCenterDelegate';
45
+ const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `
46
+ CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];
47
+ `;
48
+ const CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = `
49
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:modifiedLaunchOptions];
50
+ `;
51
+ const CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = exports.CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = `
52
+ return [super application:application didFinishLaunchingWithOptions:modifiedLaunchOptions];`;
53
+ const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
54
+ [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
55
+ [pnHandlerObj application:application error:error];
56
+ `;
57
+ const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
58
+ [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
59
+ return [pnHandlerObj application:application deviceToken:deviceToken];
60
+ `;
61
+ const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `
62
+ // Register for push notifications
63
+ [pnHandlerObj registerPushNotification];
64
+ `;
65
+ const CIO_INITIALIZECIOSDK_SNIPPET = exports.CIO_INITIALIZECIOSDK_SNIPPET = `
66
+ [pnHandlerObj initializeCioSdk];
67
+
68
+ // Code to make the CIO SDK compatible with expo-notifications package.
69
+ //
70
+ // 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.
71
+ // 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
72
+ // 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
73
+ // click handler in iOS at runtime.
74
+ //
75
+ // 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
76
+ // that another SDK or host iOS app has already set itself as the click handler:
77
+ // https://github.com/expo/expo/blob/1b29637bec0b9888e8bc8c310476293a3e2d9786/packages/expo-notifications/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m#L31-L37
78
+ // ...to get around this, we must manually set it as the click handler after the CIO SDK. That's what this code block does.
79
+ //
80
+ // Note: Initialize the native iOS SDK and setup SDK push click handling before running this code.
81
+ # if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)
82
+ // 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,
83
+ // no push metrics reporting will occur.
84
+ // EXNotificationCenterDelegate *notificationCenterDelegate = [[EXNotificationCenterDelegate alloc] init];
85
+
86
+ // ...instead, get the singleton reference from Expo.
87
+ id<UNUserNotificationCenterDelegate> notificationCenterDelegate = (id<UNUserNotificationCenterDelegate>) [EXModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];
88
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
89
+ center.delegate = notificationCenterDelegate;
90
+ # endif
91
+ `;
92
+ const CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = exports.CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = `
93
+ // Deep link workaround for app killed state start
94
+ NSMutableDictionary *modifiedLaunchOptions = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
95
+ if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
96
+ NSDictionary *pushContent = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
97
+ if (pushContent[@"CIO"] && pushContent[@"CIO"][@"push"] && pushContent[@"CIO"][@"push"][@"link"]) {
98
+ NSString *initialURL = pushContent[@"CIO"][@"push"][@"link"];
99
+ if (!launchOptions[UIApplicationLaunchOptionsURLKey]) {
100
+ modifiedLaunchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:initialURL];
101
+ }
102
+ }
103
+ }
104
+ //Deep link workaround for app killed state ends
105
+ `;
106
+ const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `
107
+ @objc(registerPushNotification)
108
+ public func registerPushNotification() {
109
+
110
+ let center = UNUserNotificationCenter.current()
111
+ center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
112
+ if error == nil{
113
+ DispatchQueue.main.async {
114
+ UIApplication.shared.registerForRemoteNotifications()
115
+ }
116
+ }
117
+ }
118
+ }`;
119
+ //# 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","exports","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;AAE5C,MAAMI,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAGR,IAAI,CAACU,IAAI,CAClDN,iBAAiB,EACjB,qCACF,CAAC;AAEM,SAASO,sBAAsBA,CAACC,OAAe,EAAE;EACtD;EACA,MAAMC,WAAW,GAAGb,IAAI,CAACO,OAAO,CAACK,OAAO,CAAC;;EAEzC;EACA,MAAME,qBAAqB,GAAGb,WAAW,CAACc,MAAM,CAACF,WAAW,EAAE,qCAAqC,CAAC;;EAEpG;EACA,OAAOb,IAAI,CAACgB,QAAQ,CAACJ,OAAO,EAAEZ,IAAI,CAACO,OAAO,CAACO,qBAAqB,CAAC,CAAC;AACpE;AAEO,MAAMG,qBAAqB,GAAAR,OAAA,CAAAQ,qBAAA,GAAG,MAAM;AACpC,MAAMC,+BAA+B,GAAAT,OAAA,CAAAS,+BAAA,GAAG,wBAAwB;AAChE,MAAMC,mCAAmC,GAAAV,OAAA,CAAAU,mCAAA,GAAG,4BAA4B;AACxE,MAAMC,6BAA6B,GAAAX,OAAA,CAAAW,6BAAA,GAAG,sBAAsB;AAC5D,MAAMC,kCAAkC,GAAAZ,OAAA,CAAAY,kCAAA,GAC7C,wFAAwF;AAEnF,MAAMC,0DAA0D,GAAAb,OAAA,CAAAa,0DAAA,GACrE,kGAAkG;AAE7F,MAAMC,8DAA8D,GAAAd,OAAA,CAAAc,8DAAA,GACzE,wJAAwJ;AAEnJ,MAAMC,0DAA0D,GAAAf,OAAA,CAAAe,0DAAA,GACrE,wGAAwG;AAEnG,MAAMC,gCAAgC,GAAAhB,OAAA,CAAAgB,gCAAA,GAC3C,mCAAmC;AAE9B,MAAMC,2BAA2B,GAAAjB,OAAA,CAAAiB,2BAAA,GACtC,oEAAoE;AAE/D,MAAMC,4CAA4C,GAAAlB,OAAA,CAAAkB,4CAAA,GACvD,mIAAmI;AAE9H,MAAMC,gDAAgD,GAAAnB,OAAA,CAAAmB,gDAAA,GAC3D,iHAAiH;AAE5G,MAAMC,0BAA0B,GAAApB,OAAA,CAAAoB,0BAAA,GACrC,qDAAqD;AAChD,MAAMC,sBAAsB,GAAArB,OAAA,CAAAqB,sBAAA,GAAG,GAAG;AAClC,MAAMC,4BAA4B,GAAAtB,OAAA,CAAAsB,4BAAA,GAAG,KAAK;AAC1C,MAAMC,eAAe,GAAAvB,OAAA,CAAAuB,eAAA,GAAG,eAAe;AACvC,MAAMC,4BAA4B,GAAAxB,OAAA,CAAAwB,4BAAA,GAAG,qBAAqB;AAE1D,MAAMC,oCAAoC,GAAAzB,OAAA,CAAAyB,oCAAA,GAAG,iDAAiD;AAC9F,MAAMC,sDAAsD,GAAA1B,OAAA,CAAA0B,sDAAA,GACjE,kCAAkC;AAC7B,MAAMC,8CAA8C,GAAA3B,OAAA,CAAA2B,8CAAA,GAAG;AAC9D;AACA,CAAC;AACM,MAAMC,8CAA8C,GAAA5B,OAAA,CAAA4B,8CAAA,GAAG;AAC9D;AACA,CAAC;AAEM,MAAMC,yCAAyC,GAAA7B,OAAA,CAAA6B,yCAAA,GAAG;AACzD,4FAA4F;AAErF,MAAMC,4DAA4D,GAAA9B,OAAA,CAAA8B,4DAAA,GAAG;AAC5E;AACA;AACA,CAAC;AAEM,MAAMC,4DAA4D,GAAA/B,OAAA,CAAA+B,4DAAA,GAAG;AAC5E;AACA;AACA,CAAC;AAEM,MAAMC,2CAA2C,GAAAhC,OAAA,CAAAgC,2CAAA,GAAG;AAC3D;AACA;AACA,CAAC;AAEM,MAAMC,4BAA4B,GAAAjC,OAAA,CAAAiC,4BAAA,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yCAAyC,GAAAlC,OAAA,CAAAkC,yCAAA,GAAG;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,qCAAqC,GAAAnC,OAAA,CAAAmC,qCAAA,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
  }
@@ -3,10 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.injectCodeBeforeMultiLineRegex = injectCodeBeforeMultiLineRegex;
6
7
  exports.injectCodeByLineNumber = injectCodeByLineNumber;
7
8
  exports.injectCodeByMultiLineRegex = injectCodeByMultiLineRegex;
8
9
  exports.injectCodeByMultiLineRegexAndReplaceLine = injectCodeByMultiLineRegexAndReplaceLine;
9
10
  exports.injectCodeByRegex = injectCodeByRegex;
11
+ exports.matchRegexExists = matchRegexExists;
10
12
  exports.replaceCodeByRegex = replaceCodeByRegex;
11
13
  function injectCodeByRegex(fileContent, lineRegex, snippet) {
12
14
  const lines = fileContent.split('\n');
@@ -20,9 +22,15 @@ function injectCodeByRegex(fileContent, lineRegex, snippet) {
20
22
  function injectCodeByMultiLineRegex(fileContent, lineRegex, snippet) {
21
23
  return fileContent.replace(lineRegex, `$&\n${snippet}`);
22
24
  }
25
+ function injectCodeBeforeMultiLineRegex(fileContent, lineRegex, snippet) {
26
+ return fileContent.replace(lineRegex, `${snippet}\n$&`);
27
+ }
23
28
  function replaceCodeByRegex(fileContent, lineRegex, snippet) {
24
29
  return fileContent.replace(lineRegex, snippet);
25
30
  }
31
+ function matchRegexExists(fileContent, regex) {
32
+ return regex.test(fileContent);
33
+ }
26
34
  function injectCodeByMultiLineRegexAndReplaceLine(fileContent, lineRegex, snippet) {
27
35
  return fileContent.replace(lineRegex, `${snippet}`);
28
36
  }
@@ -32,6 +40,6 @@ function injectCodeByLineNumber(fileContent, index, snippet) {
32
40
  if (index > -1) {
33
41
  content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
34
42
  }
35
- return content;
43
+ return content.join('\n');
36
44
  }
37
45
  //# sourceMappingURL=codeInjection.js.map