customerio-expo-plugin 0.0.5 → 1.0.0-alpha.2

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 (155) hide show
  1. package/lib/commonjs/analytics/injectAnalytics.js +31 -0
  2. package/lib/commonjs/analytics/injectAnalytics.js.map +1 -0
  3. package/lib/commonjs/android/withAppGoogleServices.js +22 -0
  4. package/lib/commonjs/android/withAppGoogleServices.js.map +1 -0
  5. package/lib/commonjs/android/withCIOAndroid.js +18 -0
  6. package/lib/commonjs/android/withCIOAndroid.js.map +1 -0
  7. package/lib/commonjs/android/withGistMavenRepository.js +21 -0
  8. package/lib/commonjs/android/withGistMavenRepository.js.map +1 -0
  9. package/lib/commonjs/android/withGoogleServicesJSON.js +34 -0
  10. package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -0
  11. package/lib/commonjs/android/withProjectGoogleServices.js +20 -0
  12. package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -0
  13. package/lib/commonjs/helpers/constants/android.js +21 -0
  14. package/lib/commonjs/helpers/constants/android.js.map +1 -0
  15. package/lib/commonjs/helpers/constants/globals.d.js +2 -0
  16. package/lib/commonjs/helpers/constants/globals.d.js.map +1 -0
  17. package/lib/commonjs/helpers/constants/ios.js +140 -0
  18. package/lib/commonjs/helpers/constants/ios.js.map +1 -0
  19. package/{build/helpers/ios/CIONotificationService-Info.plist → lib/commonjs/helpers/native-files/ios/NotificationService-Info.plist} +2 -2
  20. package/{build/helpers/ios/CIONotificationService.h → lib/commonjs/helpers/native-files/ios/NotificationService.h} +0 -0
  21. package/{build/helpers/ios/CIONotificationService.m → lib/commonjs/helpers/native-files/ios/NotificationService.m} +2 -6
  22. package/{build/helpers/ios/CIONotificationService.swift → lib/commonjs/helpers/native-files/ios/NotificationService.swift} +0 -2
  23. package/{build/helpers → lib/commonjs/helpers/native-files}/ios/PushNotification.swift +1 -10
  24. package/lib/commonjs/helpers/utils/codeInjection.js +33 -0
  25. package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
  26. package/lib/commonjs/helpers/utils/fileManagement.js +76 -0
  27. package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -0
  28. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +37 -0
  29. package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  30. package/lib/commonjs/index.js +23 -0
  31. package/lib/commonjs/index.js.map +1 -0
  32. package/lib/commonjs/ios/withAppDelegateModifications.js +85 -0
  33. package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
  34. package/lib/commonjs/ios/withAppDelegateXcodeProject.js +79 -0
  35. package/lib/commonjs/ios/withAppDelegateXcodeProject.js.map +1 -0
  36. package/lib/commonjs/ios/withCIOIos.js +23 -0
  37. package/lib/commonjs/ios/withCIOIos.js.map +1 -0
  38. package/lib/commonjs/ios/withNotificationsXcodeProject.js +158 -0
  39. package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
  40. package/lib/commonjs/ios/withXcodeProject.js +28 -0
  41. package/lib/commonjs/ios/withXcodeProject.js.map +1 -0
  42. package/lib/commonjs/types/cio-types.js +2 -0
  43. package/lib/commonjs/types/cio-types.js.map +1 -0
  44. package/lib/commonjs/version.js +9 -0
  45. package/lib/commonjs/version.js.map +1 -0
  46. package/lib/module/analytics/injectAnalytics.js +24 -0
  47. package/lib/module/analytics/injectAnalytics.js.map +1 -0
  48. package/lib/module/android/withAppGoogleServices.js +15 -0
  49. package/lib/module/android/withAppGoogleServices.js.map +1 -0
  50. package/lib/module/android/withCIOAndroid.js +12 -0
  51. package/lib/module/android/withCIOAndroid.js.map +1 -0
  52. package/lib/module/android/withGistMavenRepository.js +14 -0
  53. package/lib/module/android/withGistMavenRepository.js.map +1 -0
  54. package/lib/module/android/withGoogleServicesJSON.js +27 -0
  55. package/lib/module/android/withGoogleServicesJSON.js.map +1 -0
  56. package/lib/module/android/withProjectGoogleServices.js +13 -0
  57. package/lib/module/android/withProjectGoogleServices.js.map +1 -0
  58. package/lib/module/helpers/constants/android.js +8 -0
  59. package/lib/module/helpers/constants/android.js.map +1 -0
  60. package/lib/module/helpers/constants/globals.d.js +2 -0
  61. package/lib/module/helpers/constants/globals.d.js.map +1 -0
  62. package/lib/module/helpers/constants/ios.js +103 -0
  63. package/lib/module/helpers/constants/ios.js.map +1 -0
  64. package/lib/module/helpers/native-files/ios/NotificationService-Info.plist +31 -0
  65. package/lib/module/helpers/native-files/ios/NotificationService.h +5 -0
  66. package/lib/module/helpers/native-files/ios/NotificationService.m +26 -0
  67. package/lib/module/helpers/native-files/ios/NotificationService.swift +19 -0
  68. package/lib/module/helpers/native-files/ios/PushNotification.swift +47 -0
  69. package/lib/module/helpers/utils/codeInjection.js +24 -0
  70. package/lib/module/helpers/utils/codeInjection.js.map +1 -0
  71. package/lib/module/helpers/utils/fileManagement.js +69 -0
  72. package/lib/module/helpers/utils/fileManagement.js.map +1 -0
  73. package/lib/module/helpers/utils/injectCIOPodfileCode.js +30 -0
  74. package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
  75. package/lib/module/index.js +16 -0
  76. package/lib/module/index.js.map +1 -0
  77. package/lib/module/ios/withAppDelegateModifications.js +78 -0
  78. package/lib/module/ios/withAppDelegateModifications.js.map +1 -0
  79. package/lib/module/ios/withAppDelegateXcodeProject.js +71 -0
  80. package/lib/module/ios/withAppDelegateXcodeProject.js.map +1 -0
  81. package/lib/module/ios/withCIOIos.js +17 -0
  82. package/lib/module/ios/withCIOIos.js.map +1 -0
  83. package/lib/module/ios/withNotificationsXcodeProject.js +150 -0
  84. package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
  85. package/lib/module/ios/withXcodeProject.js +21 -0
  86. package/lib/module/ios/withXcodeProject.js.map +1 -0
  87. package/lib/module/types/cio-types.js +2 -0
  88. package/lib/module/types/cio-types.js.map +1 -0
  89. package/lib/module/version.js +2 -0
  90. package/lib/module/version.js.map +1 -0
  91. package/lib/typescript/analytics/injectAnalytics.d.ts +3 -0
  92. package/lib/typescript/android/withAppGoogleServices.d.ts +3 -0
  93. package/lib/typescript/android/withCIOAndroid.d.ts +3 -0
  94. package/lib/typescript/android/withGistMavenRepository.d.ts +3 -0
  95. package/lib/typescript/android/withGoogleServicesJSON.d.ts +3 -0
  96. package/lib/typescript/android/withProjectGoogleServices.d.ts +3 -0
  97. package/lib/typescript/helpers/constants/android.d.ts +7 -0
  98. package/lib/typescript/helpers/constants/ios.d.ts +31 -0
  99. package/lib/typescript/helpers/utils/codeInjection.d.ts +4 -0
  100. package/lib/typescript/helpers/utils/fileManagement.d.ts +12 -0
  101. package/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -0
  102. package/lib/typescript/index.d.ts +4 -0
  103. package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -0
  104. package/lib/typescript/ios/withAppDelegateXcodeProject.d.ts +3 -0
  105. package/lib/typescript/ios/withCIOIos.d.ts +3 -0
  106. package/lib/typescript/ios/withNotificationsXcodeProject.d.ts +3 -0
  107. package/lib/typescript/ios/withXcodeProject.d.ts +3 -0
  108. package/lib/typescript/types/cio-types.d.ts +25 -0
  109. package/lib/typescript/version.d.ts +1 -0
  110. package/package.json +88 -13
  111. package/src/analytics/injectAnalytics.ts +36 -0
  112. package/src/android/withAppGoogleServices.ts +26 -0
  113. package/src/android/withCIOAndroid.ts +19 -0
  114. package/src/android/withGistMavenRepository.ts +26 -0
  115. package/src/android/withGoogleServicesJSON.ts +36 -0
  116. package/src/android/withProjectGoogleServices.ts +24 -0
  117. package/src/helpers/constants/android.ts +14 -0
  118. package/src/helpers/constants/globals.d.ts +8 -0
  119. package/src/helpers/constants/ios.ts +116 -0
  120. package/src/helpers/native-files/ios/NotificationService-Info.plist +31 -0
  121. package/src/helpers/native-files/ios/NotificationService.h +5 -0
  122. package/src/helpers/native-files/ios/NotificationService.m +26 -0
  123. package/src/helpers/native-files/ios/NotificationService.swift +19 -0
  124. package/src/helpers/native-files/ios/PushNotification.swift +47 -0
  125. package/src/helpers/utils/codeInjection.ts +46 -0
  126. package/src/helpers/utils/fileManagement.ts +87 -0
  127. package/src/helpers/utils/injectCIOPodfileCode.ts +53 -0
  128. package/src/index.ts +26 -0
  129. package/src/ios/withAppDelegateModifications.ts +166 -0
  130. package/src/ios/withAppDelegateXcodeProject.ts +89 -0
  131. package/src/ios/withCIOIos.ts +25 -0
  132. package/src/ios/withNotificationsXcodeProject.ts +237 -0
  133. package/src/ios/withXcodeProject.ts +25 -0
  134. package/src/types/cio-types.ts +31 -0
  135. package/src/version.ts +1 -0
  136. package/build/helpers/.DS_Store +0 -0
  137. package/build/helpers/ios/.DS_Store +0 -0
  138. package/build/package.json +0 -36
  139. package/build/src/android/withAppGoogleServices.js +0 -12
  140. package/build/src/android/withCIOAndroid.js +0 -15
  141. package/build/src/android/withGistMavenRepository.js +0 -12
  142. package/build/src/android/withGoogleServicesJSON.js +0 -24
  143. package/build/src/android/withProjectGoogleServices.js +0 -12
  144. package/build/src/helpers/constants/android.js +0 -9
  145. package/build/src/helpers/constants/ios.js +0 -102
  146. package/build/src/helpers/utils/codeInjection.js +0 -30
  147. package/build/src/helpers/utils/fileManagement.js +0 -40
  148. package/build/src/helpers/utils/injectCIOPodfileCode.js +0 -37
  149. package/build/src/index.js +0 -11
  150. package/build/src/ios/withAppDelegateModifications.js +0 -77
  151. package/build/src/ios/withAppDelegateXcodeProject.js +0 -78
  152. package/build/src/ios/withCIOIos.js +0 -15
  153. package/build/src/ios/withNotificationsXcodeProject.js +0 -133
  154. package/build/src/ios/withXcodeProject.js +0 -22
  155. package/build/src/types/cio-types.js +0 -8
@@ -1,133 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.withCioNotificationsXcodeProject = void 0;
7
- const config_plugins_1 = require("@expo/config-plugins");
8
- const fs_1 = __importDefault(require("fs"));
9
- const xcode_1 = __importDefault(require("xcode"));
10
- const ios_1 = require("../helpers/constants/ios");
11
- const injectCIOPodfileCode_1 = require("../helpers/utils/injectCIOPodfileCode");
12
- const PLIST_FILENAME = `${ios_1.CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
13
- const TARGETED_DEVICE_FAMILY = `"1,2"`;
14
- const addNotificationServiceExtension = async (options) => {
15
- const { appleTeamId, bundleIdentifier, bundleShortVersion, bundleVersion, iosPath, appName, iosDeploymentTarget, } = options;
16
- const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
17
- const xcodeProject = xcode_1.default.project(projPath);
18
- xcodeProject.parse(async function (err) {
19
- if (err) {
20
- throw new Error(`Error parsing iOS project: ${JSON.stringify(err)}`);
21
- }
22
- await (0, injectCIOPodfileCode_1.injectCIONotificationPodfileCode)(iosPath);
23
- fs_1.default.mkdirSync(`${iosPath}/${ios_1.CIO_NOTIFICATION_TARGET_NAME}`, {
24
- recursive: true,
25
- });
26
- const files = [
27
- PLIST_FILENAME,
28
- 'CIONotificationService.h',
29
- 'CIONotificationService.swift',
30
- 'CIONotificationService.m',
31
- ];
32
- const getTargetFile = (filename) => `${iosPath}/${ios_1.CIO_NOTIFICATION_TARGET_NAME}/${filename}`;
33
- files.forEach((filename) => {
34
- const targetFile = getTargetFile(filename);
35
- fs_1.default.copyFileSync(`${ios_1.LOCAL_PATH_TO_CIO_NSE_FILES}/${filename}`, targetFile);
36
- });
37
- /* MODIFY COPIED EXTENSION FILES */
38
- const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);
39
- updateNseInfoPlist({
40
- bundleVersion,
41
- bundleShortVersion,
42
- infoPlistTargetFile,
43
- });
44
- // Create new PBXGroup for the extension
45
- const extGroup = xcodeProject.addPbxGroup(files, ios_1.CIO_NOTIFICATION_TARGET_NAME, ios_1.CIO_NOTIFICATION_TARGET_NAME);
46
- // Add the new PBXGroup to the top level group. This makes the
47
- // files / folder appear in the file explorer in Xcode.
48
- const groups = xcodeProject.hash.project.objects['PBXGroup'];
49
- Object.keys(groups).forEach((key) => {
50
- if (groups[key].name === undefined) {
51
- xcodeProject.addToPbxGroup(extGroup.uuid, key);
52
- }
53
- });
54
- // WORK AROUND for codeProject.addTarget BUG
55
- // Xcode projects don't contain these if there is only one target
56
- // An upstream fix should be made to the code referenced in this link:
57
- // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
58
- const projObjects = xcodeProject.hash.project.objects;
59
- projObjects['PBXTargetDependency'] =
60
- projObjects['PBXTargetDependency'] || {};
61
- projObjects['PBXContainerItemProxy'] =
62
- projObjects['PBXTargetDependency'] || {};
63
- if (xcodeProject.pbxTargetByName(ios_1.CIO_NOTIFICATION_TARGET_NAME)) {
64
- console.warn(`${ios_1.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
65
- return;
66
- }
67
- // Add the NSE target
68
- // This also adds PBXTargetDependency and PBXContainerItemProxy
69
- const nseTarget = xcodeProject.addTarget(ios_1.CIO_NOTIFICATION_TARGET_NAME, 'app_extension', ios_1.CIO_NOTIFICATION_TARGET_NAME, `${bundleIdentifier}.richpush`);
70
- // Add build phases to the new target
71
- xcodeProject.addBuildPhase(['CIONotificationService.m', 'CIONotificationService.swift'], 'PBXSourcesBuildPhase', 'Sources', nseTarget.uuid);
72
- xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', nseTarget.uuid);
73
- xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', nseTarget.uuid);
74
- // Edit the Deployment info of the target
75
- const configurations = xcodeProject.pbxXCBuildConfigurationSection();
76
- for (const key in configurations) {
77
- if (typeof configurations[key].buildSettings !== 'undefined' &&
78
- configurations[key].buildSettings.PRODUCT_NAME ===
79
- `"${ios_1.CIO_NOTIFICATION_TARGET_NAME}"`) {
80
- const buildSettingsObj = configurations[key].buildSettings;
81
- buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
82
- buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
83
- iosDeploymentTarget !== null && iosDeploymentTarget !== void 0 ? iosDeploymentTarget : '13.0';
84
- buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
85
- buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
86
- buildSettingsObj.SWIFT_VERSION = 4.2;
87
- }
88
- }
89
- // Add development team to the target & the main
90
- xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);
91
- xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);
92
- fs_1.default.writeFileSync(projPath, xcodeProject.writeSync());
93
- });
94
- };
95
- const withCioNotificationsXcodeProject = (configOuter, props) => {
96
- return (0, config_plugins_1.withXcodeProject)(configOuter, async (config) => {
97
- const { modRequest, ios, version: bundleShortVersion } = config;
98
- const { appleTeamId, iosDeploymentTarget } = props;
99
- if (ios === undefined)
100
- throw new Error('Adding NotificationServiceExtension failed: ios config missing from app.config.js.');
101
- const { projectName, platformProjectRoot } = modRequest;
102
- const { bundleIdentifier, buildNumber } = ios;
103
- if (bundleShortVersion === undefined) {
104
- throw new Error('Adding NotificationServiceExtension failed: version missing from app.config.js');
105
- }
106
- if (bundleIdentifier === undefined) {
107
- throw new Error('Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js');
108
- }
109
- if (projectName === undefined) {
110
- throw new Error('Adding NotificationServiceExtension failed: name missing from app.config.js');
111
- }
112
- const options = {
113
- appleTeamId,
114
- bundleIdentifier,
115
- bundleShortVersion,
116
- bundleVersion: buildNumber !== null && buildNumber !== void 0 ? buildNumber : ios_1.DEFAULT_BUNDLE_VERSION,
117
- iosPath: platformProjectRoot,
118
- appName: projectName,
119
- iosDeploymentTarget,
120
- };
121
- await addNotificationServiceExtension(options);
122
- return config;
123
- });
124
- };
125
- exports.withCioNotificationsXcodeProject = withCioNotificationsXcodeProject;
126
- const updateNseInfoPlist = ({ bundleVersion, bundleShortVersion, infoPlistTargetFile, }) => {
127
- const BUNDLE_SHORT_VERSION_RE = /\{\{BUNDLE_SHORT_VERSION\}\}/;
128
- const BUNDLE_VERSION_RE = /\{\{BUNDLE_VERSION\}\}/;
129
- let plistFileString = fs_1.default.readFileSync(infoPlistTargetFile, 'utf-8');
130
- plistFileString = plistFileString.replace(BUNDLE_VERSION_RE, bundleVersion);
131
- plistFileString = plistFileString.replace(BUNDLE_SHORT_VERSION_RE, bundleShortVersion);
132
- fs_1.default.writeFileSync(infoPlistTargetFile, plistFileString);
133
- };
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withCioXcodeProject = void 0;
4
- const config_plugins_1 = require("@expo/config-plugins");
5
- const injectCIOPodfileCode_1 = require("../helpers/utils/injectCIOPodfileCode");
6
- const withCioXcodeProject = (config, cioProps) => {
7
- return (0, config_plugins_1.withXcodeProject)(config, async (props) => {
8
- var _a, _b;
9
- const options = {
10
- iosPath: props.modRequest.platformProjectRoot,
11
- bundleIdentifier: (_a = props.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier,
12
- devTeam: cioProps === null || cioProps === void 0 ? void 0 : cioProps.devTeam,
13
- bundleVersion: (_b = props.ios) === null || _b === void 0 ? void 0 : _b.buildNumber,
14
- bundleShortVersion: props === null || props === void 0 ? void 0 : props.version,
15
- iosDeploymentTarget: cioProps === null || cioProps === void 0 ? void 0 : cioProps.iosDeploymentTarget,
16
- };
17
- const { iosPath } = options;
18
- await (0, injectCIOPodfileCode_1.injectCIOPodfileCode)(iosPath);
19
- return props;
20
- });
21
- };
22
- exports.withCioXcodeProject = withCioXcodeProject;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mode = void 0;
4
- var Mode;
5
- (function (Mode) {
6
- Mode["Dev"] = "development";
7
- Mode["Prod"] = "production";
8
- })(Mode = exports.Mode || (exports.Mode = {}));