doopush-react-native-sdk 0.1.2 → 0.5.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 (41) hide show
  1. package/README.md +71 -34
  2. package/android/build.gradle +9 -7
  3. package/android/src/main/java/com/doopush/reactnative/DooPushReactNativeSDKModule.kt +188 -28
  4. package/build/DooPush.d.ts +44 -7
  5. package/build/DooPush.d.ts.map +1 -1
  6. package/build/DooPush.js +76 -1
  7. package/build/DooPush.js.map +1 -1
  8. package/build/events.d.ts +7 -4
  9. package/build/events.d.ts.map +1 -1
  10. package/build/events.js +5 -2
  11. package/build/events.js.map +1 -1
  12. package/build/hooks.d.ts +34 -0
  13. package/build/hooks.d.ts.map +1 -0
  14. package/build/hooks.js +138 -0
  15. package/build/hooks.js.map +1 -0
  16. package/build/index.d.ts +1 -0
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +1 -0
  19. package/build/index.js.map +1 -1
  20. package/build/types.d.ts +28 -1
  21. package/build/types.d.ts.map +1 -1
  22. package/build/types.js.map +1 -1
  23. package/ios/DooPushReactNativeSDK.podspec +1 -3
  24. package/ios/DooPushReactNativeSDKModule.swift +169 -4
  25. package/package.json +13 -8
  26. package/plugin/build/android/withAndroid.js +6 -0
  27. package/plugin/build/android/withAppBuildGradle.js +71 -30
  28. package/plugin/build/android/withGoogleServices.js +74 -12
  29. package/plugin/build/android/withGradleProperties.d.ts +3 -0
  30. package/plugin/build/android/withGradleProperties.js +26 -0
  31. package/plugin/build/android/withOppoManifest.d.ts +3 -0
  32. package/plugin/build/android/withOppoManifest.js +61 -0
  33. package/plugin/build/android/withRootBuildGradle.d.ts +2 -2
  34. package/plugin/build/android/withRootBuildGradle.js +65 -10
  35. package/plugin/build/android/withSettingsGradle.d.ts +8 -0
  36. package/plugin/build/android/withSettingsGradle.js +33 -0
  37. package/plugin/build/ios/withIOS.js +2 -0
  38. package/plugin/build/ios/withPodfile.d.ts +8 -0
  39. package/plugin/build/ios/withPodfile.js +48 -0
  40. package/plugin/build/schema.d.ts +327 -1
  41. package/plugin/build/schema.js +82 -1
@@ -3,21 +3,76 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withDooPushRootBuildGradle = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
5
  /**
6
- * Adds Maven repositories (jitpack + mavenLocal during dev) to root build.gradle.
7
- * Idempotent.
6
+ * Adds Maven repositories and vendor Gradle plugin classpaths to root build.gradle.
7
+ * Idempotent. Supports the Groovy build.gradle generated by Expo prebuild.
8
8
  */
9
- const withDooPushRootBuildGradle = (config, _validated) => {
9
+ const withDooPushRootBuildGradle = (config, validated) => {
10
10
  return (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
11
11
  let contents = cfg.modResults.contents;
12
- // Add JitPack repo if missing.
13
- const jitpack = `maven { url 'https://jitpack.io' }`;
14
- if (!contents.includes('jitpack.io')) {
15
- contents = contents.replace(/allprojects\s*{\s*repositories\s*{/, `allprojects {\n repositories {\n ${jitpack}`);
12
+ const addAllProjectsRepo = (repo, marker) => {
13
+ const allprojectsStart = contents.search(/allprojects\s*{/);
14
+ if (allprojectsStart >= 0) {
15
+ const searchArea = contents.slice(allprojectsStart);
16
+ if (searchArea.includes(marker))
17
+ return;
18
+ }
19
+ contents = contents.replace(/allprojects\s*{\s*repositories\s*{/, `allprojects {\n repositories {\n ${repo}`);
20
+ };
21
+ const addBuildscriptRepo = (repo, marker) => {
22
+ const buildscriptRegex = /buildscript\s*{[\s\S]*?repositories\s*{/;
23
+ const buildscriptStart = contents.search(/buildscript\s*{/);
24
+ if (buildscriptStart >= 0) {
25
+ const afterBuildscript = contents.slice(buildscriptStart);
26
+ const dependenciesStart = afterBuildscript.search(/dependencies\s*{/);
27
+ const searchArea = dependenciesStart >= 0
28
+ ? afterBuildscript.slice(0, dependenciesStart)
29
+ : afterBuildscript.split(/allprojects\s*{/)[0];
30
+ if (searchArea.includes(marker))
31
+ return;
32
+ }
33
+ if (buildscriptRegex.test(contents)) {
34
+ contents = contents.replace(buildscriptRegex, (match) => `${match}\n ${repo}`);
35
+ }
36
+ else if (/buildscript\s*{/.test(contents)) {
37
+ contents = contents.replace(/buildscript\s*{/, `buildscript {\n repositories {\n ${repo}\n }`);
38
+ }
39
+ else {
40
+ contents = `buildscript {\n repositories {\n ${repo}\n }\n}\n\n${contents}`;
41
+ }
42
+ };
43
+ const addClasspath = (dependency) => {
44
+ var _a, _b;
45
+ const artifact = (_b = (_a = dependency.match(/'([^:]+:[^:]+):/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : dependency;
46
+ if (contents.includes(artifact))
47
+ return;
48
+ if (/buildscript\s*{[\s\S]*?dependencies\s*{/.test(contents)) {
49
+ contents = contents.replace(/(buildscript\s*{[\s\S]*?dependencies\s*{)/, `$1\n classpath ${dependency}`);
50
+ }
51
+ else if (/buildscript\s*{/.test(contents)) {
52
+ contents = contents.replace(/buildscript\s*{/, `buildscript {\n dependencies {\n classpath ${dependency}\n }`);
53
+ }
54
+ else {
55
+ contents = `buildscript {\n dependencies {\n classpath ${dependency}\n }\n}\n\n${contents}`;
56
+ }
57
+ };
58
+ addAllProjectsRepo(`maven { url 'https://jitpack.io' }`, 'jitpack.io');
59
+ if (validated.android.vendors.fcm) {
60
+ addClasspath("'com.google.gms:google-services:4.4.2'");
16
61
  }
17
- // mavenLocal for development.
18
- if (!contents.includes('mavenLocal()')) {
19
- contents = contents.replace(/allprojects\s*{\s*repositories\s*{/, `allprojects {\n repositories {\n mavenLocal()`);
62
+ if (validated.android.vendors.hms) {
63
+ const huaweiRepo = `maven { url 'https://developer.huawei.com/repo/' }`;
64
+ addAllProjectsRepo(huaweiRepo, 'developer.huawei.com/repo');
65
+ addBuildscriptRepo(huaweiRepo, 'developer.huawei.com/repo');
66
+ addClasspath("'com.huawei.agconnect:agcp:1.9.3.302'");
67
+ }
68
+ if (validated.android.vendors.honor) {
69
+ const honorRepo = `maven { url 'https://developer.hihonor.com/repo/' }`;
70
+ addAllProjectsRepo(honorRepo, 'developer.hihonor.com/repo');
71
+ addBuildscriptRepo(honorRepo, 'developer.hihonor.com/repo');
72
+ addClasspath("'com.hihonor.mcs:asplugin:2.0.1.300'");
20
73
  }
74
+ // mavenLocal for development.
75
+ addAllProjectsRepo('mavenLocal()', 'mavenLocal()');
21
76
  cfg.modResults.contents = contents;
22
77
  return cfg;
23
78
  });
@@ -0,0 +1,8 @@
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
+ import type { PluginConfig } from '../schema';
3
+ /**
4
+ * Huawei AGC 1.9.x reads Android Gradle Plugin version from a version catalog
5
+ * named `libs`. Expo SDK 54 creates `expoLibs`, so provide the RN catalog under
6
+ * the conventional name as well when HMS is enabled.
7
+ */
8
+ export declare const withDooPushSettingsGradle: ConfigPlugin<PluginConfig>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withDooPushSettingsGradle = void 0;
4
+ const config_plugins_1 = require("@expo/config-plugins");
5
+ function hasLibsVersionCatalog(contents) {
6
+ return /versionCatalogs\s*{[\s\S]*?\blibs\s*{/.test(contents)
7
+ || /versionCatalogs\s*{[\s\S]*?create\(["']libs["']\)/.test(contents);
8
+ }
9
+ function addLibsVersionCatalog(contents) {
10
+ if (hasLibsVersionCatalog(contents))
11
+ return contents;
12
+ const block = `\ndependencyResolutionManagement {\n versionCatalogs {\n libs {\n from(files(new File(\n providers.exec {\n workingDir(rootDir)\n commandLine("node", "--print", "require.resolve('react-native/package.json')")\n }.standardOutput.asText.get().trim()\n ).getParentFile().toPath().resolve("gradle/libs.versions.toml").toFile()))\n }\n }\n}\n`;
13
+ const pluginsBlock = contents.match(/plugins\s*{[\s\S]*?\n}/);
14
+ if ((pluginsBlock === null || pluginsBlock === void 0 ? void 0 : pluginsBlock.index) !== undefined) {
15
+ const insertAt = pluginsBlock.index + pluginsBlock[0].length;
16
+ return `${contents.slice(0, insertAt)}${block}${contents.slice(insertAt)}`;
17
+ }
18
+ return `${contents.trimEnd()}${block}\n`;
19
+ }
20
+ /**
21
+ * Huawei AGC 1.9.x reads Android Gradle Plugin version from a version catalog
22
+ * named `libs`. Expo SDK 54 creates `expoLibs`, so provide the RN catalog under
23
+ * the conventional name as well when HMS is enabled.
24
+ */
25
+ const withDooPushSettingsGradle = (config, validated) => {
26
+ if (!validated.android.vendors.hms)
27
+ return config;
28
+ return (0, config_plugins_1.withSettingsGradle)(config, (cfg) => {
29
+ cfg.modResults.contents = addLibsVersionCatalog(cfg.modResults.contents);
30
+ return cfg;
31
+ });
32
+ };
33
+ exports.withDooPushSettingsGradle = withDooPushSettingsGradle;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withIOS = void 0;
4
4
  const withInfoPlist_1 = require("./withInfoPlist");
5
5
  const withEntitlements_1 = require("./withEntitlements");
6
+ const withPodfile_1 = require("./withPodfile");
6
7
  const withIOS = (config, validated) => {
8
+ config = (0, withPodfile_1.withDooPushPodfile)(config, validated);
7
9
  config = (0, withInfoPlist_1.withDooPushInfoPlist)(config, validated);
8
10
  config = (0, withEntitlements_1.withDooPushEntitlements)(config, validated);
9
11
  return config;
@@ -0,0 +1,8 @@
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
+ import type { PluginConfig } from '../schema';
3
+ /**
4
+ * During monorepo development the native iOS SDK lives at sdk/ios/DooPushSDK,
5
+ * while the RN podspec declares `DooPushSDK` as a normal CocoaPods dependency.
6
+ * Point the generated example Podfile at the local pod when it exists.
7
+ */
8
+ export declare const withDooPushPodfile: ConfigPlugin<PluginConfig>;
@@ -0,0 +1,48 @@
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.withDooPushPodfile = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const config_plugins_1 = require("@expo/config-plugins");
10
+ const LOCAL_IOS_SDK_RELATIVE_PATH = '../../../ios/DooPushSDK';
11
+ const LOCAL_IOS_SDK_POD_LINE = ` pod 'DooPushSDK', :path => '${LOCAL_IOS_SDK_RELATIVE_PATH}'`;
12
+ function addLocalDooPushSDKPod(contents) {
13
+ if (contents.includes("pod 'DooPushSDK'") || contents.includes('pod "DooPushSDK"')) {
14
+ return contents;
15
+ }
16
+ const targetStart = contents.match(/target\s+['"][^'"]+['"]\s+do\s*\n/);
17
+ if ((targetStart === null || targetStart === void 0 ? void 0 : targetStart.index) === undefined) {
18
+ return contents;
19
+ }
20
+ const useExpoModules = contents.indexOf(' use_expo_modules!', targetStart.index);
21
+ if (useExpoModules !== -1) {
22
+ const lineEnd = contents.indexOf('\n', useExpoModules);
23
+ return `${contents.slice(0, lineEnd + 1)}${LOCAL_IOS_SDK_POD_LINE}\n${contents.slice(lineEnd + 1)}`;
24
+ }
25
+ const insertAt = targetStart.index + targetStart[0].length;
26
+ return `${contents.slice(0, insertAt)}${LOCAL_IOS_SDK_POD_LINE}\n${contents.slice(insertAt)}`;
27
+ }
28
+ /**
29
+ * During monorepo development the native iOS SDK lives at sdk/ios/DooPushSDK,
30
+ * while the RN podspec declares `DooPushSDK` as a normal CocoaPods dependency.
31
+ * Point the generated example Podfile at the local pod when it exists.
32
+ */
33
+ const withDooPushPodfile = (config) => {
34
+ return (0, config_plugins_1.withDangerousMod)(config, [
35
+ 'ios',
36
+ async (cfg) => {
37
+ const localPodspec = path_1.default.resolve(cfg.modRequest.projectRoot, LOCAL_IOS_SDK_RELATIVE_PATH, 'DooPushSDK.podspec');
38
+ if (!fs_1.default.existsSync(localPodspec)) {
39
+ return cfg;
40
+ }
41
+ const podfilePath = path_1.default.join(cfg.modRequest.platformProjectRoot, 'Podfile');
42
+ const contents = await fs_1.default.promises.readFile(podfilePath, 'utf8');
43
+ await fs_1.default.promises.writeFile(podfilePath, addLocalDooPushSDKPod(contents));
44
+ return cfg;
45
+ },
46
+ ]);
47
+ };
48
+ exports.withDooPushPodfile = withDooPushPodfile;
@@ -12,7 +12,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
12
12
  mode?: "development" | "production" | undefined;
13
13
  }>>;
14
14
  android: z.ZodDefault<z.ZodObject<{
15
- vendors: z.ZodDefault<z.ZodObject<{
15
+ vendors: z.ZodDefault<z.ZodEffects<z.ZodObject<{
16
16
  fcm: z.ZodOptional<z.ZodObject<{
17
17
  googleServicesFile: z.ZodString;
18
18
  }, "strip", z.ZodTypeAny, {
@@ -20,26 +20,292 @@ export declare const PluginConfigSchema: z.ZodObject<{
20
20
  }, {
21
21
  googleServicesFile: string;
22
22
  }>>;
23
+ hms: z.ZodOptional<z.ZodObject<{
24
+ agconnectServicesFile: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ agconnectServicesFile?: string | undefined;
27
+ }, {
28
+ agconnectServicesFile?: string | undefined;
29
+ }>>;
30
+ honor: z.ZodOptional<z.ZodObject<{
31
+ mcsServicesFile: z.ZodOptional<z.ZodString>;
32
+ clientId: z.ZodOptional<z.ZodString>;
33
+ clientSecret: z.ZodOptional<z.ZodString>;
34
+ appId: z.ZodOptional<z.ZodString>;
35
+ developerId: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ appId?: string | undefined;
38
+ mcsServicesFile?: string | undefined;
39
+ clientId?: string | undefined;
40
+ clientSecret?: string | undefined;
41
+ developerId?: string | undefined;
42
+ }, {
43
+ appId?: string | undefined;
44
+ mcsServicesFile?: string | undefined;
45
+ clientId?: string | undefined;
46
+ clientSecret?: string | undefined;
47
+ developerId?: string | undefined;
48
+ }>>;
49
+ xiaomi: z.ZodOptional<z.ZodObject<{
50
+ servicesFile: z.ZodOptional<z.ZodString>;
51
+ appId: z.ZodOptional<z.ZodString>;
52
+ appKey: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ appId?: string | undefined;
55
+ servicesFile?: string | undefined;
56
+ appKey?: string | undefined;
57
+ }, {
58
+ appId?: string | undefined;
59
+ servicesFile?: string | undefined;
60
+ appKey?: string | undefined;
61
+ }>>;
62
+ oppo: z.ZodOptional<z.ZodObject<{
63
+ servicesFile: z.ZodOptional<z.ZodString>;
64
+ appKey: z.ZodOptional<z.ZodString>;
65
+ appSecret: z.ZodOptional<z.ZodString>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ servicesFile?: string | undefined;
68
+ appKey?: string | undefined;
69
+ appSecret?: string | undefined;
70
+ }, {
71
+ servicesFile?: string | undefined;
72
+ appKey?: string | undefined;
73
+ appSecret?: string | undefined;
74
+ }>>;
75
+ vivo: z.ZodOptional<z.ZodObject<{
76
+ servicesFile: z.ZodOptional<z.ZodString>;
77
+ appId: z.ZodOptional<z.ZodString>;
78
+ apiKey: z.ZodOptional<z.ZodString>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ appId?: string | undefined;
81
+ apiKey?: string | undefined;
82
+ servicesFile?: string | undefined;
83
+ }, {
84
+ appId?: string | undefined;
85
+ apiKey?: string | undefined;
86
+ servicesFile?: string | undefined;
87
+ }>>;
88
+ meizu: z.ZodOptional<z.ZodObject<{
89
+ servicesFile: z.ZodOptional<z.ZodString>;
90
+ appId: z.ZodOptional<z.ZodString>;
91
+ appKey: z.ZodOptional<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ appId?: string | undefined;
94
+ servicesFile?: string | undefined;
95
+ appKey?: string | undefined;
96
+ }, {
97
+ appId?: string | undefined;
98
+ servicesFile?: string | undefined;
99
+ appKey?: string | undefined;
100
+ }>>;
23
101
  }, "strip", z.ZodTypeAny, {
24
102
  fcm?: {
25
103
  googleServicesFile: string;
26
104
  } | undefined;
105
+ hms?: {
106
+ agconnectServicesFile?: string | undefined;
107
+ } | undefined;
108
+ honor?: {
109
+ appId?: string | undefined;
110
+ mcsServicesFile?: string | undefined;
111
+ clientId?: string | undefined;
112
+ clientSecret?: string | undefined;
113
+ developerId?: string | undefined;
114
+ } | undefined;
115
+ xiaomi?: {
116
+ appId?: string | undefined;
117
+ servicesFile?: string | undefined;
118
+ appKey?: string | undefined;
119
+ } | undefined;
120
+ oppo?: {
121
+ servicesFile?: string | undefined;
122
+ appKey?: string | undefined;
123
+ appSecret?: string | undefined;
124
+ } | undefined;
125
+ vivo?: {
126
+ appId?: string | undefined;
127
+ apiKey?: string | undefined;
128
+ servicesFile?: string | undefined;
129
+ } | undefined;
130
+ meizu?: {
131
+ appId?: string | undefined;
132
+ servicesFile?: string | undefined;
133
+ appKey?: string | undefined;
134
+ } | undefined;
27
135
  }, {
28
136
  fcm?: {
29
137
  googleServicesFile: string;
30
138
  } | undefined;
139
+ hms?: {
140
+ agconnectServicesFile?: string | undefined;
141
+ } | undefined;
142
+ honor?: {
143
+ appId?: string | undefined;
144
+ mcsServicesFile?: string | undefined;
145
+ clientId?: string | undefined;
146
+ clientSecret?: string | undefined;
147
+ developerId?: string | undefined;
148
+ } | undefined;
149
+ xiaomi?: {
150
+ appId?: string | undefined;
151
+ servicesFile?: string | undefined;
152
+ appKey?: string | undefined;
153
+ } | undefined;
154
+ oppo?: {
155
+ servicesFile?: string | undefined;
156
+ appKey?: string | undefined;
157
+ appSecret?: string | undefined;
158
+ } | undefined;
159
+ vivo?: {
160
+ appId?: string | undefined;
161
+ apiKey?: string | undefined;
162
+ servicesFile?: string | undefined;
163
+ } | undefined;
164
+ meizu?: {
165
+ appId?: string | undefined;
166
+ servicesFile?: string | undefined;
167
+ appKey?: string | undefined;
168
+ } | undefined;
169
+ }>, {
170
+ fcm?: {
171
+ googleServicesFile: string;
172
+ } | undefined;
173
+ hms?: {
174
+ agconnectServicesFile?: string | undefined;
175
+ } | undefined;
176
+ honor?: {
177
+ appId?: string | undefined;
178
+ mcsServicesFile?: string | undefined;
179
+ clientId?: string | undefined;
180
+ clientSecret?: string | undefined;
181
+ developerId?: string | undefined;
182
+ } | undefined;
183
+ xiaomi?: {
184
+ appId?: string | undefined;
185
+ servicesFile?: string | undefined;
186
+ appKey?: string | undefined;
187
+ } | undefined;
188
+ oppo?: {
189
+ servicesFile?: string | undefined;
190
+ appKey?: string | undefined;
191
+ appSecret?: string | undefined;
192
+ } | undefined;
193
+ vivo?: {
194
+ appId?: string | undefined;
195
+ apiKey?: string | undefined;
196
+ servicesFile?: string | undefined;
197
+ } | undefined;
198
+ meizu?: {
199
+ appId?: string | undefined;
200
+ servicesFile?: string | undefined;
201
+ appKey?: string | undefined;
202
+ } | undefined;
203
+ }, {
204
+ fcm?: {
205
+ googleServicesFile: string;
206
+ } | undefined;
207
+ hms?: {
208
+ agconnectServicesFile?: string | undefined;
209
+ } | undefined;
210
+ honor?: {
211
+ appId?: string | undefined;
212
+ mcsServicesFile?: string | undefined;
213
+ clientId?: string | undefined;
214
+ clientSecret?: string | undefined;
215
+ developerId?: string | undefined;
216
+ } | undefined;
217
+ xiaomi?: {
218
+ appId?: string | undefined;
219
+ servicesFile?: string | undefined;
220
+ appKey?: string | undefined;
221
+ } | undefined;
222
+ oppo?: {
223
+ servicesFile?: string | undefined;
224
+ appKey?: string | undefined;
225
+ appSecret?: string | undefined;
226
+ } | undefined;
227
+ vivo?: {
228
+ appId?: string | undefined;
229
+ apiKey?: string | undefined;
230
+ servicesFile?: string | undefined;
231
+ } | undefined;
232
+ meizu?: {
233
+ appId?: string | undefined;
234
+ servicesFile?: string | undefined;
235
+ appKey?: string | undefined;
236
+ } | undefined;
31
237
  }>>;
32
238
  }, "strip", z.ZodTypeAny, {
33
239
  vendors: {
34
240
  fcm?: {
35
241
  googleServicesFile: string;
36
242
  } | undefined;
243
+ hms?: {
244
+ agconnectServicesFile?: string | undefined;
245
+ } | undefined;
246
+ honor?: {
247
+ appId?: string | undefined;
248
+ mcsServicesFile?: string | undefined;
249
+ clientId?: string | undefined;
250
+ clientSecret?: string | undefined;
251
+ developerId?: string | undefined;
252
+ } | undefined;
253
+ xiaomi?: {
254
+ appId?: string | undefined;
255
+ servicesFile?: string | undefined;
256
+ appKey?: string | undefined;
257
+ } | undefined;
258
+ oppo?: {
259
+ servicesFile?: string | undefined;
260
+ appKey?: string | undefined;
261
+ appSecret?: string | undefined;
262
+ } | undefined;
263
+ vivo?: {
264
+ appId?: string | undefined;
265
+ apiKey?: string | undefined;
266
+ servicesFile?: string | undefined;
267
+ } | undefined;
268
+ meizu?: {
269
+ appId?: string | undefined;
270
+ servicesFile?: string | undefined;
271
+ appKey?: string | undefined;
272
+ } | undefined;
37
273
  };
38
274
  }, {
39
275
  vendors?: {
40
276
  fcm?: {
41
277
  googleServicesFile: string;
42
278
  } | undefined;
279
+ hms?: {
280
+ agconnectServicesFile?: string | undefined;
281
+ } | undefined;
282
+ honor?: {
283
+ appId?: string | undefined;
284
+ mcsServicesFile?: string | undefined;
285
+ clientId?: string | undefined;
286
+ clientSecret?: string | undefined;
287
+ developerId?: string | undefined;
288
+ } | undefined;
289
+ xiaomi?: {
290
+ appId?: string | undefined;
291
+ servicesFile?: string | undefined;
292
+ appKey?: string | undefined;
293
+ } | undefined;
294
+ oppo?: {
295
+ servicesFile?: string | undefined;
296
+ appKey?: string | undefined;
297
+ appSecret?: string | undefined;
298
+ } | undefined;
299
+ vivo?: {
300
+ appId?: string | undefined;
301
+ apiKey?: string | undefined;
302
+ servicesFile?: string | undefined;
303
+ } | undefined;
304
+ meizu?: {
305
+ appId?: string | undefined;
306
+ servicesFile?: string | undefined;
307
+ appKey?: string | undefined;
308
+ } | undefined;
43
309
  } | undefined;
44
310
  }>>;
45
311
  }, "strip", z.ZodTypeAny, {
@@ -53,6 +319,36 @@ export declare const PluginConfigSchema: z.ZodObject<{
53
319
  fcm?: {
54
320
  googleServicesFile: string;
55
321
  } | undefined;
322
+ hms?: {
323
+ agconnectServicesFile?: string | undefined;
324
+ } | undefined;
325
+ honor?: {
326
+ appId?: string | undefined;
327
+ mcsServicesFile?: string | undefined;
328
+ clientId?: string | undefined;
329
+ clientSecret?: string | undefined;
330
+ developerId?: string | undefined;
331
+ } | undefined;
332
+ xiaomi?: {
333
+ appId?: string | undefined;
334
+ servicesFile?: string | undefined;
335
+ appKey?: string | undefined;
336
+ } | undefined;
337
+ oppo?: {
338
+ servicesFile?: string | undefined;
339
+ appKey?: string | undefined;
340
+ appSecret?: string | undefined;
341
+ } | undefined;
342
+ vivo?: {
343
+ appId?: string | undefined;
344
+ apiKey?: string | undefined;
345
+ servicesFile?: string | undefined;
346
+ } | undefined;
347
+ meizu?: {
348
+ appId?: string | undefined;
349
+ servicesFile?: string | undefined;
350
+ appKey?: string | undefined;
351
+ } | undefined;
56
352
  };
57
353
  };
58
354
  baseURL?: string | undefined;
@@ -68,6 +364,36 @@ export declare const PluginConfigSchema: z.ZodObject<{
68
364
  fcm?: {
69
365
  googleServicesFile: string;
70
366
  } | undefined;
367
+ hms?: {
368
+ agconnectServicesFile?: string | undefined;
369
+ } | undefined;
370
+ honor?: {
371
+ appId?: string | undefined;
372
+ mcsServicesFile?: string | undefined;
373
+ clientId?: string | undefined;
374
+ clientSecret?: string | undefined;
375
+ developerId?: string | undefined;
376
+ } | undefined;
377
+ xiaomi?: {
378
+ appId?: string | undefined;
379
+ servicesFile?: string | undefined;
380
+ appKey?: string | undefined;
381
+ } | undefined;
382
+ oppo?: {
383
+ servicesFile?: string | undefined;
384
+ appKey?: string | undefined;
385
+ appSecret?: string | undefined;
386
+ } | undefined;
387
+ vivo?: {
388
+ appId?: string | undefined;
389
+ apiKey?: string | undefined;
390
+ servicesFile?: string | undefined;
391
+ } | undefined;
392
+ meizu?: {
393
+ appId?: string | undefined;
394
+ servicesFile?: string | undefined;
395
+ appKey?: string | undefined;
396
+ } | undefined;
71
397
  } | undefined;
72
398
  } | undefined;
73
399
  }>;
@@ -31,7 +31,88 @@ exports.PluginConfigSchema = zod_1.z.object({
31
31
  .min(1, 'googleServicesFile is required when fcm vendor is enabled'),
32
32
  })
33
33
  .optional(),
34
- // v0.5.0 will add hms / honor / xiaomi / oppo / vivo / meizu here.
34
+ hms: zod_1.z
35
+ .object({
36
+ agconnectServicesFile: zod_1.z.string().min(1).optional(),
37
+ })
38
+ .optional(),
39
+ honor: zod_1.z
40
+ .object({
41
+ mcsServicesFile: zod_1.z.string().min(1).optional(),
42
+ clientId: zod_1.z.string().optional(),
43
+ clientSecret: zod_1.z.string().optional(),
44
+ appId: zod_1.z.string().optional(),
45
+ developerId: zod_1.z.string().optional(),
46
+ })
47
+ .optional(),
48
+ xiaomi: zod_1.z
49
+ .object({
50
+ servicesFile: zod_1.z.string().min(1).optional(),
51
+ appId: zod_1.z.string().optional(),
52
+ appKey: zod_1.z.string().optional(),
53
+ })
54
+ .optional(),
55
+ oppo: zod_1.z
56
+ .object({
57
+ servicesFile: zod_1.z.string().min(1).optional(),
58
+ appKey: zod_1.z.string().optional(),
59
+ appSecret: zod_1.z.string().optional(),
60
+ })
61
+ .optional(),
62
+ vivo: zod_1.z
63
+ .object({
64
+ servicesFile: zod_1.z.string().min(1).optional(),
65
+ appId: zod_1.z.string().optional(),
66
+ apiKey: zod_1.z.string().optional(),
67
+ })
68
+ .optional(),
69
+ meizu: zod_1.z
70
+ .object({
71
+ servicesFile: zod_1.z.string().min(1).optional(),
72
+ appId: zod_1.z.string().optional(),
73
+ appKey: zod_1.z.string().optional(),
74
+ })
75
+ .optional(),
76
+ })
77
+ .superRefine((vendors, ctx) => {
78
+ if (vendors.hms && !vendors.hms.agconnectServicesFile) {
79
+ ctx.addIssue({
80
+ code: zod_1.z.ZodIssueCode.custom,
81
+ path: ['hms', 'agconnectServicesFile'],
82
+ message: 'agconnectServicesFile is required when hms vendor is enabled',
83
+ });
84
+ }
85
+ const requireFileOrPair = (vendorName, pair, fileKey = 'servicesFile') => {
86
+ const vendor = vendors[vendorName];
87
+ if (!vendor)
88
+ return;
89
+ const hasFile = Boolean(vendor[fileKey]);
90
+ const hasPair = Boolean(vendor[pair[0]]) && Boolean(vendor[pair[1]]);
91
+ if (!hasFile && !hasPair) {
92
+ ctx.addIssue({
93
+ code: zod_1.z.ZodIssueCode.custom,
94
+ path: [vendorName],
95
+ message: `${vendorName} requires either ${fileKey} or ${pair[0]} + ${pair[1]}`,
96
+ });
97
+ }
98
+ };
99
+ if (vendors.honor) {
100
+ const honor = vendors.honor;
101
+ const hasFile = Boolean(honor.mcsServicesFile);
102
+ const hasAppPair = Boolean(honor.appId) && Boolean(honor.developerId);
103
+ const hasClientPair = Boolean(honor.clientId) && Boolean(honor.clientSecret);
104
+ if (!hasFile && !hasAppPair && !hasClientPair) {
105
+ ctx.addIssue({
106
+ code: zod_1.z.ZodIssueCode.custom,
107
+ path: ['honor'],
108
+ message: 'honor requires either mcsServicesFile or appId + developerId or clientId + clientSecret',
109
+ });
110
+ }
111
+ }
112
+ requireFileOrPair('xiaomi', ['appId', 'appKey']);
113
+ requireFileOrPair('oppo', ['appKey', 'appSecret']);
114
+ requireFileOrPair('vivo', ['appId', 'apiKey']);
115
+ requireFileOrPair('meizu', ['appId', 'appKey']);
35
116
  })
36
117
  .default({}),
37
118
  })