@onairosofficial/onairos-capacitor 0.1.1 → 0.1.3

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.
package/onairos.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare module 'onairos-npm-capacitor' {
1
+ declare module '@onairosofficial/onairos-capacitor' {
2
2
  /**
3
3
  * Inference formatting options (v6.1.0)
4
4
  * Passed to inference endpoints to control result sorting and formatting
@@ -402,38 +402,28 @@ declare module 'onairos-npm-capacitor' {
402
402
  // ===============================================
403
403
 
404
404
  /**
405
- * Configure Google OAuth client IDs for all platforms
406
- *
407
- * IMPORTANT FOR CAPACITOR APPS:
408
- * Capacitor apps MUST provide their own Google OAuth credentials because:
409
- * 1. Google does not allow `capacitor://` scheme in redirect URIs
410
- * 2. Google blocks OAuth in embedded WebViews (disallowed_useragent)
411
- * 3. Native apps require platform-specific client IDs (iOS bundle ID, Android package + SHA-1)
412
- *
413
- * To create your credentials:
414
- * 1. Go to Google Cloud Console (https://console.cloud.google.com)
415
- * 2. Create OAuth 2.0 credentials for each platform:
416
- * - Web application (for web browsers)
417
- * - iOS (with your bundle identifier)
418
- * - Android (with your package name and SHA-1 fingerprint)
419
- *
420
- * @param clientIds - Object containing platform-specific client IDs
421
- * @returns Updated client IDs object
422
- *
405
+ * Configure developer-owned native Google OAuth client IDs.
406
+ *
407
+ * A Capacitor build is a native app even before store publication. Create
408
+ * an iOS client for the exact bundle ID and/or an Android client for the
409
+ * exact package name and signing SHA-1.
410
+ *
411
+ * The SDK supplies the Onairos web/server OAuth client used as the ID-token
412
+ * audience. Do not pass an iOS or Android client ID as `webClientId` or
413
+ * `serverClientId`, or backend verification will fail with an audience
414
+ * mismatch. Those two fields remain optional for advanced deployments whose
415
+ * backend explicitly verifies a different web OAuth client.
416
+ *
423
417
  * @example
424
418
  * ```typescript
425
- * import { updateGoogleClientIds } from 'onairos-npm-capacitor';
426
- *
427
- * // For Capacitor apps - provide YOUR OWN client IDs
419
+ * import { updateGoogleClientIds } from '@onairosofficial/onairos-capacitor';
420
+ *
428
421
  * updateGoogleClientIds({
429
- * webClientId: 'your-web-client-id.apps.googleusercontent.com',
430
422
  * iosClientId: 'your-ios-client-id.apps.googleusercontent.com',
431
- * androidClientId: 'your-android-client-id.apps.googleusercontent.com',
432
- * serverClientId: 'your-server-client-id.apps.googleusercontent.com' // For backend token verification
423
+ * androidClientId: 'your-android-client-id.apps.googleusercontent.com'
433
424
  * });
434
425
  * ```
435
- */
436
- export function updateGoogleClientIds(clientIds: {
426
+ */ export function updateGoogleClientIds(clientIds: {
437
427
  webClientId?: string;
438
428
  iosClientId?: string;
439
429
  androidClientId?: string;
@@ -470,7 +460,7 @@ declare module 'onairos-npm-capacitor' {
470
460
  *
471
461
  * REQUIREMENTS:
472
462
  * 1. Install @codetrix-studio/capacitor-google-auth: `npm install @codetrix-studio/capacitor-google-auth`
473
- * 2. Configure with YOUR OWN Google OAuth Client IDs
463
+ * 2. Configure with your own native iOS and/or Android OAuth client ID
474
464
  * 3. Set up native platform config (Info.plist for iOS, google-services.json for Android)
475
465
  *
476
466
  * @returns Promise with sign-in result
@@ -522,7 +512,7 @@ declare module 'onairos-npm-capacitor' {
522
512
  *
523
513
  * @example
524
514
  * ```typescript
525
- * import { updateYoutubeClientId } from 'onairos-npm-capacitor';
515
+ * import { updateYoutubeClientId } from '@onairosofficial/onairos-capacitor';
526
516
  *
527
517
  * updateYoutubeClientId('your-youtube-client-id.apps.googleusercontent.com');
528
518
  * ```
@@ -597,7 +587,7 @@ declare module 'onairos-npm-capacitor' {
597
587
  *
598
588
  * @example
599
589
  * ```typescript
600
- * import { connectChatGPTHostedImport } from 'onairos-npm-capacitor';
590
+ * import { connectChatGPTHostedImport } from '@onairosofficial/onairos-capacitor';
601
591
  *
602
592
  * const result = await connectChatGPTHostedImport({
603
593
  * onStatus: (s) => console.log('status', s.status),
@@ -644,13 +634,13 @@ declare module 'onairos-npm-capacitor' {
644
634
  export function maskEmail(email: string | null | undefined): string | null;
645
635
  }
646
636
 
647
- declare module 'onairos-npm-capacitor/capacitor' {
648
- export * from 'onairos-npm-capacitor';
649
- export { default } from 'onairos-npm-capacitor';
637
+ declare module '@onairosofficial/onairos-capacitor/capacitor' {
638
+ export * from '@onairosofficial/onairos-capacitor';
639
+ export { default } from '@onairosofficial/onairos-capacitor';
650
640
  }
651
641
 
652
- declare module 'onairos-npm-capacitor/connectors' {
653
- export * from 'onairos-npm-capacitor';
654
- export { default } from 'onairos-npm-capacitor';
642
+ declare module '@onairosofficial/onairos-capacitor/connectors' {
643
+ export * from '@onairosofficial/onairos-capacitor';
644
+ export { default } from '@onairosofficial/onairos-capacitor';
655
645
  }
656
646
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onairosofficial/onairos-capacitor",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "engines": {
5
5
  "node": ">=20 <26"
6
6
  },
@@ -69,7 +69,6 @@
69
69
  "@babel/plugin-transform-runtime": "^7.23.7",
70
70
  "@babel/preset-env": "^7.28.5",
71
71
  "@babel/preset-react": "^7.27.1",
72
- "@onairosofficial/capacitor-llm-onairos": "file:packages/capacitor-llm-onairos",
73
72
  "@playwright/test": "^1.59.1",
74
73
  "@radix-ui/react-checkbox": "^1.3.1",
75
74
  "@radix-ui/react-label": "^2.1.6",
@@ -124,15 +123,11 @@
124
123
  "webpack-obfuscator": "^3.6.0"
125
124
  },
126
125
  "peerDependencies": {
127
- "@onairosofficial/capacitor-llm-onairos": "^0.1.5",
128
126
  "react": "^18.2.0 || ^19.0.0",
129
127
  "react-dom": "^18.2.0 || ^19.0.0",
130
128
  "tailwindcss": ">=3.0.0"
131
129
  },
132
130
  "peerDependenciesMeta": {
133
- "@onairosofficial/capacitor-llm-onairos": {
134
- "optional": true
135
- },
136
131
  "tailwindcss": {
137
132
  "optional": true
138
133
  }
@@ -187,6 +182,11 @@
187
182
  ],
188
183
  "author": "Zion Darko",
189
184
  "license": "Apache-2.0",
185
+ "capacitor": {
186
+ "ios": {
187
+ "src": "ios"
188
+ }
189
+ },
190
190
  "bugs": {
191
191
  "url": "https://github.com/zd819/onairos-capacitor/issues"
192
192
  },
@@ -194,6 +194,9 @@
194
194
  "files": [
195
195
  "dist",
196
196
  "src",
197
+ "ios",
198
+ "Package.swift",
199
+ "OnairosofficialOnairosCapacitor.podspec",
197
200
  "onairos.d.ts",
198
201
  "package.json",
199
202
  "README.md",
@@ -1,13 +1,15 @@
1
+ import { DEFAULT_ONAIROS_GOOGLE_WEB_CLIENT_ID } from './utils/googleWebClientId.js';
2
+
1
3
  const pick = (value) => {
2
4
  const s = typeof value === 'string' ? value.trim() : '';
3
5
  return s && s !== 'undefined' && s !== 'null' ? s : null;
4
6
  };
5
7
 
6
8
  let googleClientIds = {
7
- webClientId: null,
9
+ webClientId: DEFAULT_ONAIROS_GOOGLE_WEB_CLIENT_ID,
8
10
  iosClientId: null,
9
11
  androidClientId: null,
10
- serverClientId: null,
12
+ serverClientId: DEFAULT_ONAIROS_GOOGLE_WEB_CLIENT_ID,
11
13
  };
12
14
 
13
15
  let youtubeClientId = null;
@@ -18,22 +20,31 @@ export const updateGoogleClientIds = (clientIds = {}) => {
18
20
  const androidClientId = pick(clientIds.androidClientId);
19
21
  const serverClientId = pick(clientIds.serverClientId);
20
22
 
23
+ // Google native clients identify the installed app, but Onairos verifies the
24
+ // ID token against the web OAuth client. Keep those concerns separate so the
25
+ // native client ID can never accidentally become the backend token audience.
26
+ const nextWebClientId =
27
+ webClientId || googleClientIds.webClientId || DEFAULT_ONAIROS_GOOGLE_WEB_CLIENT_ID;
28
+ const nextServerClientId =
29
+ serverClientId || webClientId || googleClientIds.serverClientId || nextWebClientId;
30
+
21
31
  googleClientIds = {
22
- ...googleClientIds,
23
- ...(webClientId ? { webClientId } : {}),
24
- ...(iosClientId ? { iosClientId } : {}),
25
- ...(androidClientId ? { androidClientId } : {}),
26
- ...(serverClientId ? { serverClientId } : {}),
32
+ webClientId: nextWebClientId,
33
+ iosClientId: iosClientId || googleClientIds.iosClientId,
34
+ androidClientId: androidClientId || googleClientIds.androidClientId,
35
+ serverClientId: nextServerClientId,
27
36
  };
28
37
 
29
38
  if (typeof window !== 'undefined') {
30
- if (webClientId) {
31
- window.onairosGoogleClientId = webClientId;
32
- window.onairosGoogleWebClientId = webClientId;
39
+ window.onairosGoogleClientId = googleClientIds.webClientId;
40
+ window.onairosGoogleWebClientId = googleClientIds.webClientId;
41
+ window.onairosGoogleServerClientId = googleClientIds.serverClientId;
42
+ if (googleClientIds.iosClientId) {
43
+ window.onairosGoogleIosClientId = googleClientIds.iosClientId;
44
+ }
45
+ if (googleClientIds.androidClientId) {
46
+ window.onairosGoogleAndroidClientId = googleClientIds.androidClientId;
33
47
  }
34
- if (iosClientId) window.onairosGoogleIosClientId = iosClientId;
35
- if (androidClientId) window.onairosGoogleAndroidClientId = androidClientId;
36
- if (serverClientId) window.onairosGoogleServerClientId = serverClientId;
37
48
  }
38
49
 
39
50
  return googleClientIds;
@@ -501,6 +501,8 @@ function EmailAuthComponent({ onSuccess, testMode = false, preVerifiedEmail = nu
501
501
  (typeof window !== 'undefined' && window.onairosGoogleClientId) || '';
502
502
  const iosClientId =
503
503
  (typeof window !== 'undefined' && window.onairosGoogleIosClientId) || '';
504
+ const serverClientId =
505
+ (typeof window !== 'undefined' && window.onairosGoogleServerClientId) || webClientId;
504
506
 
505
507
  if (!webClientId || !iosClientId) {
506
508
  setGoogleHint('To enable Google sign-in in this iOS app, set updateGoogleClientIds({ webClientId, iosClientId }) in the host app. Otherwise use email login.');
@@ -515,7 +517,7 @@ function EmailAuthComponent({ onSuccess, testMode = false, preVerifiedEmail = nu
515
517
  iOSClientId: iosClientId,
516
518
  // If your backend verifies tokens / you need server-side validation, set this to the web client id.
517
519
  // (Safe default here.)
518
- iOSServerClientId: webClientId,
520
+ iOSServerClientId: serverClientId,
519
521
  mode: 'online',
520
522
  },
521
523
  });
@@ -700,6 +700,8 @@ function EmailAuthComponent({
700
700
  (typeof window !== 'undefined' && window.onairosGoogleClientId) || '';
701
701
  const iosClientId =
702
702
  (typeof window !== 'undefined' && window.onairosGoogleIosClientId) || '';
703
+ const serverClientId =
704
+ (typeof window !== 'undefined' && window.onairosGoogleServerClientId) || webClientId;
703
705
 
704
706
  if (!webClientId || !iosClientId) {
705
707
  setGoogleHint('To enable Google sign-in in this iOS app, set updateGoogleClientIds({ webClientId, iosClientId }) in the host app. Otherwise use email login.');
@@ -714,7 +716,7 @@ function EmailAuthComponent({
714
716
  iOSClientId: iosClientId,
715
717
  // If your backend verifies tokens / you need server-side validation, set this to the web client id.
716
718
  // (Safe default here.)
717
- iOSServerClientId: webClientId,
719
+ iOSServerClientId: serverClientId,
718
720
  mode: 'online',
719
721
  },
720
722
  });
@@ -0,0 +1,5 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+
3
+ export const OnairosChatGPTNative = registerPlugin('OnairosChatGPTNative');
4
+ export const OnairosSpotifyNative = registerPlugin('OnairosSpotifyNative');
5
+ export const OnairosNetflixNative = registerPlugin('OnairosNetflixNative');
@@ -4,7 +4,7 @@
4
4
  // This build avoids global Tailwind preflight (which can pollute the host app),
5
5
  // but includes a minimal scoped reset inside `.onairos-modal` so the SDK UI
6
6
  // still renders correctly.
7
- import '@onairosofficial/capacitor-llm-onairos';
7
+ import './nativeConnectors.js';
8
8
  import cssText from './styles/tailwind.capacitor.css?inline';
9
9
  import { registerOnairosCssText } from './styles/sdkCssRegistry.js';
10
10
 
@@ -13,4 +13,3 @@ registerOnairosCssText(cssText);
13
13
 
14
14
  export * from './onairos.core.jsx';
15
15
  export { default } from './onairos.core.jsx';
16
-
package/src/onairos.jsx CHANGED
@@ -1,7 +1,7 @@
1
1
  // IMPORTANT:
2
2
  // `package.json#exports.import` points at `dist/onairos.esm.js` built from this file.
3
3
  // This is the default web entrypoint and includes full Tailwind (including preflight).
4
- import '@onairosofficial/capacitor-llm-onairos';
4
+ import './nativeConnectors.js';
5
5
  import './styles/tailwind.css';
6
6
  import cssText from './styles/tailwind.css?inline';
7
7
  import { registerOnairosCssText } from './styles/sdkCssRegistry.js';