@onairosofficial/onairos-capacitor 0.1.0 → 0.1.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 (202) hide show
  1. package/CAPACITOR_QUICK_START.md +379 -0
  2. package/CONNECTORS.md +122 -0
  3. package/LICENSE +194 -10
  4. package/OnairosofficialOnairosCapacitor.podspec +13 -0
  5. package/Package.swift +26 -0
  6. package/README.md +176 -25
  7. package/dist/onairos.capacitor.esm.js +1 -0
  8. package/dist/onairos.capacitor.esm.turbopack.js +1 -0
  9. package/docs/CAPACITOR_INTEGRATION_GUIDE.md +159 -0
  10. package/docs/CAPACITOR_MOCK_APP_TESTING.md +213 -0
  11. package/docs/CAPACITOR_SDK_FIXES_SUMMARY.md +65 -0
  12. package/docs/CROSS_SDK_PARITY.md +239 -0
  13. package/docs/DATA_FREQUENCY.md +57 -0
  14. package/docs/DEVELOPER_SDK_CHANGES.md +532 -0
  15. package/docs/INCIDENT_ENABLETRAINING_PIN_WEB_8.1.9.md +82 -0
  16. package/docs/ONAIROS_BUTTON_PROPS.md +152 -0
  17. package/docs/PLATFORM_APIS.md +559 -0
  18. package/docs/RAW_MEMORIES_API.md +305 -0
  19. package/docs/RAW_MEMORIES_SDK_UPDATE.md +54 -0
  20. package/docs/SDK_PARITY_ROLLUP_2026_04_24_to_05_02.md +96 -0
  21. package/docs/oldFixes.md +216 -0
  22. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +993 -0
  23. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosNetflixNativePlugin.swift +33 -0
  24. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +1082 -0
  25. package/onairos.d.ts +656 -0
  26. package/package.json +188 -37
  27. package/src/OnairosReconnectButton.jsx +272 -0
  28. package/src/RSA.jsx +57 -0
  29. package/src/assets/NewLogo.png +0 -0
  30. package/src/assets/OnairosNewLogo.png +0 -0
  31. package/src/assets/chatgpt-icon.png +0 -0
  32. package/src/assets/fire-horse.png +0 -0
  33. package/src/assets/fire-horse.transparent.png +0 -0
  34. package/src/assets/latest-firehorse.png +0 -0
  35. package/src/assets/perplexity.png +0 -0
  36. package/src/assets/persona.png +0 -0
  37. package/src/assets/persona1.png +0 -0
  38. package/src/assets/persona2.png +0 -0
  39. package/src/assets/persona3.png +0 -0
  40. package/src/assets/persona4.png +0 -0
  41. package/src/assets/persona5.png +0 -0
  42. package/src/capacitorConnectorCatalog.js +38 -0
  43. package/src/capacitorOAuthConfig.js +52 -0
  44. package/src/chatgptHostedImport/index.js +303 -0
  45. package/src/components/AuthButtons.jsx +48 -0
  46. package/src/components/ConnectChatGPTModal.jsx +666 -0
  47. package/src/components/ConnectClaudeModal.jsx +610 -0
  48. package/src/components/ConnectGeminiModal.jsx +639 -0
  49. package/src/components/ConnectGrokModal.jsx +701 -0
  50. package/src/components/ConnectPerplexityModal.jsx +726 -0
  51. package/src/components/DataExplainerScreen.jsx +349 -0
  52. package/src/components/DataRequest.js +885 -0
  53. package/src/components/DataRequest.jsx +1055 -0
  54. package/src/components/EmailAuth.js +1871 -0
  55. package/src/components/EmailAuth.jsx +2062 -0
  56. package/src/components/ExtensionInstallPrompt.jsx +142 -0
  57. package/src/components/GoogleButton.js +133 -0
  58. package/src/components/LLMConnectorManager.jsx +201 -0
  59. package/src/components/LoadingPage.jsx +19 -0
  60. package/src/components/LoadingScreen.jsx +81 -0
  61. package/src/components/LunarBirthdate.jsx +96 -0
  62. package/src/components/LunarLoadingPage.jsx +251 -0
  63. package/src/components/Notification.jsx +21 -0
  64. package/src/components/OnairosAppButton.jsx +85 -0
  65. package/src/components/OnairosSSO.jsx +645 -0
  66. package/src/components/OnairosTrigger.jsx +61 -0
  67. package/src/components/PerplexityLogo.jsx +43 -0
  68. package/src/components/PinSetup.js +200 -0
  69. package/src/components/PinSetup.jsx +228 -0
  70. package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
  71. package/src/components/SdkErrorBoundary.jsx +36 -0
  72. package/src/components/SecuritySetup.js +81 -0
  73. package/src/components/SessionUserBar.jsx +83 -0
  74. package/src/components/SignUp.js +123 -0
  75. package/src/components/TestTelegramButton.js +53 -0
  76. package/src/components/TrainingComponent.jsx +200 -0
  77. package/src/components/TrainingScreen.jsx +897 -0
  78. package/src/components/UniversalOnboarding.js +306 -0
  79. package/src/components/UniversalOnboarding.jsx +4837 -0
  80. package/src/components/ValentineLoadingPage.jsx +502 -0
  81. package/src/components/ValentineModeSelector.jsx +162 -0
  82. package/src/components/WelcomeScreen.jsx +435 -0
  83. package/src/components/WrappedLoadingPage.jsx +205 -0
  84. package/src/components/connectors/ChatGPTConnector.js +348 -0
  85. package/src/components/connectors/ChatGPTConnector.jsx +348 -0
  86. package/src/components/connectors/ClaudeConnector.js +44 -0
  87. package/src/components/connectors/ClaudeConnector.jsx +44 -0
  88. package/src/components/connectors/GeminiConnector.js +170 -0
  89. package/src/components/connectors/GeminiConnector.jsx +170 -0
  90. package/src/components/connectors/GmailConnector.js +148 -0
  91. package/src/components/connectors/GmailConnector.jsx +148 -0
  92. package/src/components/connectors/GrokConnector.js +16 -0
  93. package/src/components/connectors/GrokConnector.jsx +16 -0
  94. package/src/components/connectors/HingeConnector.js +419 -0
  95. package/src/components/connectors/HingeConnector.jsx +419 -0
  96. package/src/components/connectors/InstagramDataConnector.js +726 -0
  97. package/src/components/connectors/InstagramDataConnector.jsx +726 -0
  98. package/src/components/connectors/LinkedInConnector.js +4 -0
  99. package/src/components/connectors/LinkedInConnector.jsx +296 -0
  100. package/src/components/connectors/PerplexityConnector.jsx +16 -0
  101. package/src/components/connectors/PinterestConnector.js +208 -0
  102. package/src/components/connectors/PinterestConnector.jsx +208 -0
  103. package/src/components/connectors/README.md +292 -0
  104. package/src/components/connectors/RedditConnector.js +229 -0
  105. package/src/components/connectors/RedditConnector.jsx +229 -0
  106. package/src/components/connectors/SephoraConnector.js +482 -0
  107. package/src/components/connectors/SephoraConnector.jsx +482 -0
  108. package/src/components/connectors/TikTokConnector.jsx +430 -0
  109. package/src/components/connectors/YoutubeConnector.js +361 -0
  110. package/src/components/connectors/YoutubeConnector.jsx +361 -0
  111. package/src/components/connectors/index.js +50 -0
  112. package/src/components/icons.jsx +46 -0
  113. package/src/components/icons.tsx +21 -0
  114. package/src/components/ui/PageLayout.jsx +1255 -0
  115. package/src/components/ui/PrimaryButton.jsx +162 -0
  116. package/src/components/ui/button.jsx +49 -0
  117. package/src/components/ui/card.jsx +61 -0
  118. package/src/components/ui/checkbox.jsx +33 -0
  119. package/src/components/ui/label.jsx +29 -0
  120. package/src/components/utils/UpdateConnections.js +45 -0
  121. package/src/components/utils/oauthHelper.js +97 -0
  122. package/src/config/api-config.js +138 -0
  123. package/src/deepLink.jsx +38 -0
  124. package/src/getPin.js +26 -0
  125. package/src/icons/Avatar.png +0 -0
  126. package/src/icons/Sentiment.png +0 -0
  127. package/src/icons/Trait.png +0 -0
  128. package/src/iframe/DataRequestPage.jsx +285 -0
  129. package/src/iframe/OnairosButtonIntegration.md +148 -0
  130. package/src/iframe/components/Box.jsx +56 -0
  131. package/src/iframe/components/IndividualConnection.jsx +88 -0
  132. package/src/iframe/dataRequestHandler.js +714 -0
  133. package/src/iframe/data_request_iframe.html +27 -0
  134. package/src/iframe/data_request_page.js +47 -0
  135. package/src/iframe/icons/Avatar.png +1 -0
  136. package/src/iframe/icons/Avatar2.png +1 -0
  137. package/src/iframe/icons/Sentiment.png +1 -0
  138. package/src/iframe/icons/Trait.png +1 -0
  139. package/src/iframe/icons/onairos_logo.png +0 -0
  140. package/src/iframe/utils/api.js +57 -0
  141. package/src/index.js +274 -0
  142. package/src/laravel/OnairosVue.vue +410 -0
  143. package/src/laravel/blade-helpers.js +320 -0
  144. package/src/laravel/vite-plugin.js +179 -0
  145. package/src/mobile/MobileDataRequestPage.jsx +233 -0
  146. package/src/mobile/components/MobileBox.jsx +71 -0
  147. package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
  148. package/src/mobile/shims/browser-apis.js +78 -0
  149. package/src/mobile/shims/lucide-shim.js +85 -0
  150. package/src/nativeConnectors.js +5 -0
  151. package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
  152. package/src/newUI/PlatformConnectorsStep.tsx +435 -0
  153. package/src/newUI/PrimaryButton.tsx +213 -0
  154. package/src/newUI/SignInStep.tsx +194 -0
  155. package/src/newUI/VerificationStep.tsx +133 -0
  156. package/src/newUI/WelcomeScreen.tsx +311 -0
  157. package/src/newUI/services/connectedAccountsService.js +129 -0
  158. package/src/onairos.capacitor.jsx +15 -0
  159. package/src/onairos.core.jsx +133 -0
  160. package/src/onairos.jsx +14 -0
  161. package/src/onairos.native.jsx +15 -0
  162. package/src/onairosButton.jsx +9000 -0
  163. package/src/overlay/CheckBox.jsx +114 -0
  164. package/src/overlay/IndividualConnection copy.js +86 -0
  165. package/src/overlay/IndividualConnection.js +191 -0
  166. package/src/overlay/IndividualConnectionNew.jsx +157 -0
  167. package/src/overlay/box.js +84 -0
  168. package/src/overlay/overlay.js +437 -0
  169. package/src/styles/onairos-scoped-preflight.css +97 -0
  170. package/src/styles/sdkCssRegistry.js +20 -0
  171. package/src/styles/styleLoaderInsertShadow.js +69 -0
  172. package/src/styles/tailwind.capacitor.css +395 -0
  173. package/src/styles/tailwind.css +395 -0
  174. package/src/theme/colors.js +40 -0
  175. package/src/utils/apiKeyValidation.js +341 -0
  176. package/src/utils/apiResponseLogger.js +316 -0
  177. package/src/utils/authHeaders.js +275 -0
  178. package/src/utils/biometrics.js +26 -0
  179. package/src/utils/bookmarkletUtils.js +28 -0
  180. package/src/utils/capacitorDetection.js +278 -0
  181. package/src/utils/capacitorLLMHelper.js +352 -0
  182. package/src/utils/capacitorPlugins.js +366 -0
  183. package/src/utils/crossDomainSSO.js +587 -0
  184. package/src/utils/deepLinking.js +27 -0
  185. package/src/utils/devLogger.js +46 -0
  186. package/src/utils/extensionDetection.js +418 -0
  187. package/src/utils/extractMemory.js +277 -0
  188. package/src/utils/framerBrandingOverrides.js +40 -0
  189. package/src/utils/googleWebClientId.js +55 -0
  190. package/src/utils/overlayHandler.js +224 -0
  191. package/src/utils/platformDisconnect.js +309 -0
  192. package/src/utils/pollTrainingStatus.js +200 -0
  193. package/src/utils/rawMemoriesAccess.js +211 -0
  194. package/src/utils/resolveBackendAppId.js +47 -0
  195. package/src/utils/responseFormatter.js +140 -0
  196. package/src/utils/sdkDebugStorage.js +113 -0
  197. package/src/utils/sdkInitialization.js +645 -0
  198. package/src/utils/sessionManager.js +1258 -0
  199. package/src/utils/startBackgroundTraining.js +100 -0
  200. package/src/utils/userDataFormatter.js +222 -0
  201. package/index.d.ts +0 -1
  202. package/index.js +0 -1
package/onairos.d.ts ADDED
@@ -0,0 +1,656 @@
1
+ declare module '@onairosofficial/onairos-capacitor' {
2
+ /**
3
+ * Inference formatting options (v6.1.0)
4
+ * Passed to inference endpoints to control result sorting and formatting
5
+ */
6
+ export interface InferenceFormattingOptions {
7
+ sortResults?: 'desc' | 'asc' | false; // Sort results by score
8
+ includeRank?: boolean; // Add rank (1, 2, 3...) to results
9
+ topK?: number; // Return only top K results
10
+ groupByScore?: { precision: number }; // Group items with same score
11
+ responseFormat?: string; // Output structure (e.g., 'ranked', 'grouped')
12
+ includeOriginalIndex?: boolean; // Keep original input index in results
13
+ }
14
+
15
+ /**
16
+ * Data returned when the Onairos flow completes successfully
17
+ */
18
+ export interface OnairosCompleteData {
19
+ // Core response fields
20
+ token: string; // JWT token for authenticated API calls
21
+ apiUrl: string; // Backend API endpoint URL
22
+
23
+ // Request metadata
24
+ userHash?: string; // Unique user identifier
25
+ appName?: string; // Name of the requesting application
26
+ approvedData?: string[]; // Array of approved data types (e.g., ['basic', 'personality'])
27
+ testMode?: boolean; // Whether running in test mode
28
+ timestamp?: string; // ISO timestamp of the request
29
+
30
+ // API response data
31
+ apiResponse?: any; // Raw API response with personality/inference data
32
+ authorizedData?: {
33
+ traits?: boolean;
34
+ personality?: boolean;
35
+ preferences?: boolean;
36
+ /** Authoritative raw-memories gate from handoff (replaces legacy `llmData`). */
37
+ rawMemories?: boolean;
38
+ llmData?: boolean;
39
+ };
40
+ /** UX hint from handoff; security uses `authorizedData.rawMemories`. */
41
+ rawMemoriesPolicy?: { offered: boolean; code?: string; connectorPlatforms?: string[] };
42
+ /** From handoff only — SDK does not call `/api/trait-intents/resolve`. */
43
+ traitIntent?: Record<string, unknown>;
44
+ /** Training gate from URL resolution (`ready`, `statusUrl`, `pollIntervalMs`). */
45
+ training?: { ready: boolean; statusUrl?: string; pollIntervalMs?: number; neverTrained?: boolean };
46
+ usage?: any; // API usage information
47
+
48
+ // User data
49
+ userData?: any; // Complete user profile and session data
50
+
51
+ // Enhanced formatting (added by logFormattedUserData)
52
+ userDataSummary?: { // Structured summary of user data
53
+ requestInfo?: any;
54
+ userProfile?: any;
55
+ connectedAccounts?: any;
56
+ aiData?: any;
57
+ status?: any;
58
+ };
59
+ prettyPrint?: string; // Pretty-printed version for console logging
60
+ connectedSources?: string[]; // Normalized platform/source names (Ascend-friendly)
61
+ ascendContext?: {
62
+ schemaVersion: string;
63
+ generatedAt: string;
64
+ requestData: string[];
65
+ approvedData: string[];
66
+ connectedSources: string[];
67
+ signalSummary: {
68
+ accountsCount: number;
69
+ dataConnectionsCount: number;
70
+ llmInteractionsCount: number;
71
+ hasBehaviorSignals: boolean;
72
+ };
73
+ backendHints: {
74
+ protocol: string;
75
+ authHeader: string;
76
+ preferredEndpoint: string;
77
+ requiredFields: string[];
78
+ };
79
+ };
80
+
81
+ // Status indicators
82
+ success?: boolean; // Whether the request was successful
83
+ simulated?: boolean; // Whether data is simulated (test mode)
84
+ error?: string; // Error message if request failed
85
+ cancelled?: boolean; // Whether user cancelled the flow
86
+
87
+ // v6.1.0 - Inference formatting metadata (present when formatting options are used)
88
+ formattingApplied?: {
89
+ sortResults?: 'desc' | 'asc';
90
+ includeRank?: boolean;
91
+ topK?: number;
92
+ groupByScore?: { precision: number };
93
+ responseFormat?: string;
94
+ includeOriginalIndex?: boolean;
95
+ originalCount?: number; // Original result count before topK
96
+ returnedCount?: number; // Actual returned count after topK
97
+ };
98
+
99
+ [key: string]: any; // Allow additional properties
100
+ }
101
+
102
+ export interface OnairosProps {
103
+ requestData: any; // Consider using a more specific type or interface for request data.
104
+ webpageName: string;
105
+ signupAttribution?: Record<string, any> | string | null;
106
+ inferenceData?: any;
107
+ fastTraits?: boolean;
108
+ onComplete?: (data: OnairosCompleteData, error?: Error) => void;
109
+ alwaysCallOnComplete?: boolean;
110
+ preserveForceRegenerateOnPolling?: boolean;
111
+ autoFetch?: boolean; // Default: true - automatically makes API calls after data approval
112
+ testMode?: boolean;
113
+ proofMode?: boolean;
114
+ textLayout?: 'right' | 'left' | 'below' | 'none';
115
+ textColor?: 'black' | 'white';
116
+ login?: boolean,
117
+ loginReturn?:(data: any, error?: Error) => void;
118
+ loginType?: string;
119
+ visualType?: string;
120
+ buttonType?: 'pill' | 'icon' | 'rectangle';
121
+ appIcon?: string | null;
122
+ dataRequestTitle?: string | null;
123
+ privacyPolicyUrl?: string | null;
124
+ /** Demo/white-label mode: collect consent on UniversalOnboarding and skip the DataRequest screen. */
125
+ combineConsentWithOnboarding?: boolean;
126
+ /** Proof-of-concept mode: show consent UI but do not resolve or fetch user data. */
127
+ demoMode?: boolean;
128
+ priorityPlatform?: string | null;
129
+ rawMemoriesOnly?: boolean;
130
+ rawMemoriesConfig?: any;
131
+ topicFilter?: string | null;
132
+ allowedPlatforms?: string[] | null;
133
+ time?: boolean;
134
+ showIcon?: boolean; // v5.1.4 - Show/hide the Onairos logo on the button (default: true)
135
+ buttonText?: string; // v5.1.4 - Custom button text (overrides default "Connect Data")
136
+ // v5.2.3 - Auto sign-in and redirect props for seamless integration
137
+ redirectUrl?: string; // URL to redirect to after completion (e.g., '/dashboard', '/home')
138
+ autoSignIn?: boolean; // If true, sets localStorage auth key after completion (default: false)
139
+ signInKey?: string; // The localStorage key to set for authentication (default: 'authenticated')
140
+ // v6.1.0 - Inference result formatting options
141
+ // Passed to inference endpoints (inferenceNoProof, mobileInferenceNoProof, combinedInference, combined-training-inference)
142
+ sortResults?: 'desc' | 'asc' | false; // Sort results by score
143
+ includeRank?: boolean; // Add rank (1, 2, 3...) to results
144
+ topK?: number; // Return only top K results
145
+ groupByScore?: { precision: number }; // Group items with same score (precision: decimal places)
146
+ inferenceResponseFormat?: string; // Output structure (e.g., 'ranked', 'grouped')
147
+ includeOriginalIndex?: boolean; // Keep original input index in results
148
+ /** v7.1.2+ — server MBTI 16-type probe when `preferences` is approved; see MBTI_INFERENCE_INPUT_PRESET.md */
149
+ preferencesMbti?: boolean;
150
+ backgroundLoadData?: boolean;
151
+ /**
152
+ * v8.0.0 — `'mock' | 'fast' | 'real' | 'none'`. Defaults to `'fast'`,
153
+ * or `'none'` when `backgroundLoadData` is `true` and the prop is unset.
154
+ * Replaces v7.x `'real'` (now `'fast'`) and `'full'` (now `'real'`).
155
+ */
156
+ trainingScreenMode?: 'mock' | 'fast' | 'real' | 'none';
157
+ /**
158
+ * v8.0.0+ — when `true` (default), the modal closes immediately after
159
+ * consent is accepted. SDK keeps polling /training/status and POSTing
160
+ * apiUrl in the background; `onComplete` fires when the fetch resolves.
161
+ * Set to `false` to keep the modal open until the SDK has the full
162
+ * response (legacy behaviour). No effect on wrapped/valentine/lunar/
163
+ * ascend apps which own their own loading UX.
164
+ */
165
+ closeOnConsent?: boolean;
166
+ /**
167
+ * Optional reasoning shown on the TrainingScreen insufficient-data state.
168
+ * Defaults to "<app name> needs to understand you better for your experience."
169
+ */
170
+ insufficientDataReasoning?: string | null;
171
+ recommendedPlatforms?: string[] | null;
172
+ preferredPlatform?: string | null;
173
+ primaryAuthOnly?: boolean;
174
+ useNewWelcomeFlow?: boolean;
175
+ preCheck?: (() => boolean | Promise<boolean>) | null;
176
+ returnLink?: string | null;
177
+ onRejection?: ((reason?: string) => void) | null;
178
+ /** v7.1.0 — render-props trigger; when a function, replaces the default SDK button. */
179
+ children?: ((props: OnairosTriggerRenderProps) => React.ReactNode) | React.ReactNode;
180
+ }
181
+
182
+ export interface OnairosTriggerRenderProps {
183
+ open: () => void;
184
+ isLoading: boolean;
185
+ isReady: boolean;
186
+ /** True when the host user has an auth session (login/auth-only flows). */
187
+ isSignedIn: boolean;
188
+ /** True when the host user has connected platforms / completed onboarding. */
189
+ isConnected: boolean;
190
+ /** Resolved trigger label (`Signed in`, `Connected`, or default CTA text). */
191
+ triggerLabel: string;
192
+ }
193
+
194
+ export interface TrainingPollResult {
195
+ ready: boolean;
196
+ neverTrained?: boolean;
197
+ lastPayload?: unknown;
198
+ }
199
+
200
+ export function pollTrainingStatus(params: {
201
+ statusUrl: string;
202
+ token: string;
203
+ pollIntervalMs?: number;
204
+ }): Promise<TrainingPollResult>;
205
+
206
+ export function normalizeTrainingFromResolution(training: unknown): {
207
+ ready: boolean;
208
+ statusUrl?: string;
209
+ pollIntervalMs: number;
210
+ neverTrained?: boolean;
211
+ };
212
+
213
+ /**
214
+ * Creates an Onairos component with various configuration options for fetching and displaying user data.
215
+ */
216
+ export function Onairos(props: OnairosProps): JSX.Element;
217
+
218
+ export interface PopupHandlerOptions {
219
+ autoFetch?: boolean;
220
+ onApiResponse?: (response: any) => void;
221
+ }
222
+
223
+ // Popup handler functions
224
+ export function openDataRequestPopup(data?: any): Window | null;
225
+ export function closeDataRequestPopup(windowRef: Window): void;
226
+ export function sendDataToPopup(windowRef: Window, data: any): Promise<void>;
227
+ export function listenForPopupMessages(
228
+ callback: (data: any) => void,
229
+ options?: PopupHandlerOptions
230
+ ): () => void;
231
+
232
+ export function OnairosButton(props: OnairosProps): JSX.Element;
233
+ export default OnairosButton;
234
+
235
+ export interface OnairosConnectorPlatform {
236
+ name: string;
237
+ connector: string;
238
+ endpoint: string | null;
239
+ type: 'llm' | 'oauth' | 'webview' | string;
240
+ url?: string;
241
+ platformId?: string;
242
+ dataType?: string;
243
+ [key: string]: any;
244
+ }
245
+
246
+ export const SUPPORTED_PLATFORMS: OnairosConnectorPlatform[];
247
+ export const CONNECTOR_IDS: string[];
248
+
249
+ /**
250
+ * Data returned when reconnection is complete
251
+ */
252
+ export interface OnairosReconnectCompleteData {
253
+ connectedAccounts: string[]; // Array of connected platform names
254
+ userData: any; // Updated user data object
255
+ timestamp: string; // ISO timestamp of the reconnection
256
+ }
257
+
258
+ /**
259
+ * Props for the OnairosReconnectButton component
260
+ */
261
+ export interface OnairosReconnectButtonProps {
262
+ buttonText?: string; // Text to display on the button (default: "Reconnect Data Sources")
263
+ buttonClass?: string; // Custom CSS classes for the button
264
+ buttonStyle?: React.CSSProperties; // Custom inline styles for the button
265
+ appIcon?: string; // Icon URL for the app (optional)
266
+ appName?: string; // Name of the app (default: "Your App")
267
+ onComplete?: (data: OnairosReconnectCompleteData) => void; // Callback when connection changes are complete
268
+ onNoUserData?: () => void; // Callback when no user data is found
269
+ priorityPlatform?: string; // Platform to prioritize (e.g., 'gmail', 'pinterest', 'linkedin')
270
+ rawMemoriesOnly?: boolean; // Show only LLM connections when true (default: false)
271
+ rawMemoriesConfig?: any; // Configuration for RAW memories collection
272
+ }
273
+
274
+ /**
275
+ * OnairosReconnectButton - A button that allows users to reconnect or change their data sources
276
+ *
277
+ * This button checks if user Onairos data is stored and opens the data connection page
278
+ * to allow users to modify their connected accounts/data sources.
279
+ *
280
+ * @example
281
+ * ```tsx
282
+ * import { OnairosReconnectButton } from 'onairos';
283
+ *
284
+ * function MyComponent() {
285
+ * return (
286
+ * <OnairosReconnectButton
287
+ * buttonText="Manage Data Sources"
288
+ * appName="My App"
289
+ * onComplete={(result) => {
290
+ * console.log('Updated connections:', result.connectedAccounts);
291
+ * }}
292
+ * onNoUserData={() => {
293
+ * console.log('No user data found');
294
+ * }}
295
+ * />
296
+ * );
297
+ * }
298
+ * ```
299
+ */
300
+ export function OnairosReconnectButton(props: OnairosReconnectButtonProps): JSX.Element;
301
+
302
+ // ===============================================
303
+ // Platform Disconnect & Destruct API
304
+ // ===============================================
305
+
306
+ /**
307
+ * Response from disconnectPlatform
308
+ */
309
+ export interface DisconnectPlatformResponse {
310
+ success: boolean;
311
+ platform: string;
312
+ message: string;
313
+ error?: string;
314
+ data?: any;
315
+ }
316
+
317
+ /**
318
+ * Response from disconnectMultiplePlatforms
319
+ */
320
+ export interface DisconnectMultiplePlatformsResponse {
321
+ successful: string[];
322
+ failed: Array<{ platform: string; error: string }>;
323
+ total: number;
324
+ }
325
+
326
+
327
+ /**
328
+ * Disconnect a platform from user's account
329
+ * Removes OAuth tokens and platform data
330
+ *
331
+ * @param platform - Platform name (e.g., 'youtube', 'reddit', 'gmail')
332
+ * @param username - User's email or username
333
+ * @returns Promise resolving to disconnect response
334
+ *
335
+ * @example
336
+ * ```typescript
337
+ * import { disconnectPlatform } from 'onairos';
338
+ *
339
+ * const result = await disconnectPlatform('youtube', 'user@example.com');
340
+ * if (result.success) {
341
+ * console.log('YouTube disconnected successfully');
342
+ * }
343
+ * ```
344
+ */
345
+ export function disconnectPlatform(
346
+ platform: string,
347
+ username: string
348
+ ): Promise<DisconnectPlatformResponse>;
349
+
350
+ /**
351
+ * Disconnect multiple platforms at once
352
+ *
353
+ * @param platforms - Array of platform names
354
+ * @param username - User's email or username
355
+ * @returns Promise resolving to results for all platforms
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * import { disconnectMultiplePlatforms } from 'onairos';
360
+ *
361
+ * const result = await disconnectMultiplePlatforms(
362
+ * ['youtube', 'reddit', 'linkedin'],
363
+ * 'user@example.com'
364
+ * );
365
+ * console.log(`Disconnected ${result.successful.length} platforms`);
366
+ * ```
367
+ */
368
+ export function disconnectMultiplePlatforms(
369
+ platforms: string[],
370
+ username: string
371
+ ): Promise<DisconnectMultiplePlatformsResponse>;
372
+
373
+ /**
374
+ * Update localStorage after disconnecting a platform
375
+ * Removes the platform from connectedAccounts array
376
+ *
377
+ * @param platform - Platform name that was disconnected
378
+ */
379
+ export function updateLocalStorageAfterDisconnect(platform: string): void;
380
+
381
+ /**
382
+ * Check if user has authentication token
383
+ * @returns True if token exists in localStorage
384
+ */
385
+ export function hasAuthToken(): boolean;
386
+
387
+ /**
388
+ * Get list of all supported platforms for disconnection
389
+ * @returns Array of platform names
390
+ */
391
+ export function getSupportedPlatforms(): string[];
392
+
393
+ /**
394
+ * Check if a platform is supported for disconnection
395
+ * @param platform - Platform name
396
+ * @returns True if platform is supported
397
+ */
398
+ export function isPlatformSupported(platform: string): boolean;
399
+
400
+ // ===============================================
401
+ // Google OAuth Configuration
402
+ // ===============================================
403
+
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
+ *
423
+ * @example
424
+ * ```typescript
425
+ * import { updateGoogleClientIds } from '@onairosofficial/onairos-capacitor';
426
+ *
427
+ * // For Capacitor apps - provide YOUR OWN client IDs
428
+ * updateGoogleClientIds({
429
+ * webClientId: 'your-web-client-id.apps.googleusercontent.com',
430
+ * 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
433
+ * });
434
+ * ```
435
+ */
436
+ export function updateGoogleClientIds(clientIds: {
437
+ webClientId?: string;
438
+ iosClientId?: string;
439
+ androidClientId?: string;
440
+ serverClientId?: string;
441
+ }): {
442
+ webClientId: string | null;
443
+ iosClientId: string | null;
444
+ androidClientId: string | null;
445
+ serverClientId: string | null;
446
+ };
447
+
448
+ /**
449
+ * Get currently configured Google OAuth client IDs
450
+ */
451
+ export function getGoogleClientIds(): {
452
+ webClientId: string | null;
453
+ iosClientId: string | null;
454
+ androidClientId: string | null;
455
+ serverClientId: string | null;
456
+ };
457
+
458
+ // ===============================================
459
+ // Capacitor Native Google Sign-In
460
+ // ===============================================
461
+
462
+ /**
463
+ * Check if native Google Auth plugin is available (Capacitor only).
464
+ * Returns true if @codetrix-studio/capacitor-google-auth or similar is installed.
465
+ */
466
+ export function isNativeGoogleAuthAvailable(): boolean;
467
+
468
+ /**
469
+ * Perform native Google Sign-In using Capacitor plugin.
470
+ *
471
+ * REQUIREMENTS:
472
+ * 1. Install @codetrix-studio/capacitor-google-auth: `npm install @codetrix-studio/capacitor-google-auth`
473
+ * 2. Configure with YOUR OWN Google OAuth Client IDs
474
+ * 3. Set up native platform config (Info.plist for iOS, google-services.json for Android)
475
+ *
476
+ * @returns Promise with sign-in result
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * import { performNativeGoogleSignIn, isNativeGoogleAuthAvailable } from 'onairos';
481
+ *
482
+ * if (isNativeGoogleAuthAvailable()) {
483
+ * const result = await performNativeGoogleSignIn();
484
+ * if (result.success) {
485
+ * console.log('User:', result.user);
486
+ * console.log('ID Token:', result.idToken);
487
+ * }
488
+ * }
489
+ * ```
490
+ */
491
+ export function performNativeGoogleSignIn(): Promise<{
492
+ success: boolean;
493
+ user?: {
494
+ email: string;
495
+ name: string;
496
+ familyName?: string;
497
+ id: string;
498
+ imageUrl?: string;
499
+ };
500
+ idToken?: string;
501
+ serverAuthCode?: string;
502
+ rawResponse?: any;
503
+ error?: string;
504
+ }>;
505
+
506
+ /**
507
+ * Sign out from native Google Auth
508
+ */
509
+ export function performNativeGoogleSignOut(): Promise<{
510
+ success: boolean;
511
+ error?: string;
512
+ }>;
513
+
514
+ // ===============================================
515
+ // YouTube OAuth Configuration
516
+ // ===============================================
517
+
518
+ /**
519
+ * Configure YouTube OAuth client ID (separate from Google Sign-In)
520
+ * @param clientId - YouTube-specific Google OAuth client ID
521
+ * @returns Updated client ID
522
+ *
523
+ * @example
524
+ * ```typescript
525
+ * import { updateYoutubeClientId } from '@onairosofficial/onairos-capacitor';
526
+ *
527
+ * updateYoutubeClientId('your-youtube-client-id.apps.googleusercontent.com');
528
+ * ```
529
+ */
530
+ export function updateYoutubeClientId(clientId: string): string | null;
531
+
532
+ /**
533
+ * Get currently configured YouTube OAuth client ID
534
+ */
535
+ export function getYoutubeClientId(): string | null;
536
+
537
+ // ===============================================
538
+ // ChatGPT Hosted Temporary Browser Import
539
+ // ===============================================
540
+
541
+ /** Lifecycle status of a hosted ChatGPT import session. */
542
+ export type ChatGPTHostedImportStatus =
543
+ | 'created'
544
+ | 'browser_starting'
545
+ | 'login_required'
546
+ | 'auth_detected'
547
+ | 'scanning'
548
+ | 'preview_ready'
549
+ | 'approved'
550
+ | 'complete'
551
+ | 'cancelled'
552
+ | 'expired'
553
+ | 'failed';
554
+
555
+ /** A single previewed conversation scanned from the ChatGPT sidebar (v0). */
556
+ export interface ChatGPTHostedImportPreviewItem {
557
+ id?: string;
558
+ title: string;
559
+ url: string;
560
+ source: 'chatgpt_sidebar';
561
+ }
562
+
563
+ export interface ConnectChatGPTHostedImportOptions {
564
+ /** Override the Onairos backend base URL (defaults to the SDK's configured API base). */
565
+ backendBaseUrl?: string;
566
+ /** Called whenever the session status changes. */
567
+ onStatus?: (status: any) => void;
568
+ /** Called once the preview is ready. */
569
+ onPreview?: (preview: ChatGPTHostedImportPreviewItem[]) => void;
570
+ }
571
+
572
+ export interface ChatGPTHostedImportResult {
573
+ provider: 'chatgpt';
574
+ status: 'complete' | 'cancelled' | 'failed' | 'expired';
575
+ sessionId: string;
576
+ preview?: ChatGPTHostedImportPreviewItem[];
577
+ }
578
+
579
+ /**
580
+ * Promise returned by {@link connectChatGPTHostedImport}. Resolves when the
581
+ * import reaches a terminal state. Also exposes programmatic controls for
582
+ * hosts that don't use the built-in viewer buttons.
583
+ */
584
+ export interface ChatGPTHostedImportHandle extends Promise<ChatGPTHostedImportResult> {
585
+ /** Approve selected (or all) previewed items and complete the import. */
586
+ approve(approvedItemIds?: string[]): Promise<any>;
587
+ /** Cancel the import and destroy the disposable browser context. */
588
+ cancel(): Promise<any>;
589
+ /** Current backend session id, if started. */
590
+ getSessionId(): string | null;
591
+ }
592
+
593
+ /**
594
+ * Start a one-time, user-directed ChatGPT historical import using a
595
+ * disposable, server-side browser session. This is NOT official OpenAI
596
+ * OAuth and NOT ongoing sync.
597
+ *
598
+ * @example
599
+ * ```typescript
600
+ * import { connectChatGPTHostedImport } from '@onairosofficial/onairos-capacitor';
601
+ *
602
+ * const result = await connectChatGPTHostedImport({
603
+ * onStatus: (s) => console.log('status', s.status),
604
+ * onPreview: (items) => console.log('preview', items),
605
+ * });
606
+ * console.log(result.status); // 'complete' | 'cancelled' | 'failed' | 'expired'
607
+ * ```
608
+ */
609
+ export function connectChatGPTHostedImport(
610
+ options?: ConnectChatGPTHostedImportOptions
611
+ ): ChatGPTHostedImportHandle;
612
+
613
+ /** Lightweight SDK debug metadata persisted in `localStorage.onairos_sdk_meta`. */
614
+ export interface OnairosSdkDebugMeta {
615
+ version?: string;
616
+ buildTime?: string | null;
617
+ updatedAt?: string;
618
+ webpageName?: string | null;
619
+ currentFlow?: string | null;
620
+ overlayOpen?: boolean;
621
+ trigger?: 'signedIn' | 'connected' | null;
622
+ apiBase?: string | null;
623
+ session?: {
624
+ hasSession?: boolean;
625
+ email?: string | null;
626
+ connectedCount?: number;
627
+ storageUsed?: string | null;
628
+ };
629
+ [key: string]: unknown;
630
+ }
631
+
632
+ export interface OnairosSdkDebugEvent {
633
+ t: number;
634
+ tag: string;
635
+ [key: string]: unknown;
636
+ }
637
+
638
+ export const SDK_VERSION: string;
639
+ export const SDK_BUILD_TIME: string | null;
640
+ export function persistSdkDebugMeta(partial?: Record<string, unknown>): OnairosSdkDebugMeta | null;
641
+ export function getSdkDebugMeta(): OnairosSdkDebugMeta | null;
642
+ export function getSdkDebugRing(): OnairosSdkDebugEvent[];
643
+ export function pushSdkDebugEvent(tag: string, detail?: Record<string, unknown>): void;
644
+ export function maskEmail(email: string | null | undefined): string | null;
645
+ }
646
+
647
+ declare module '@onairosofficial/onairos-capacitor/capacitor' {
648
+ export * from '@onairosofficial/onairos-capacitor';
649
+ export { default } from '@onairosofficial/onairos-capacitor';
650
+ }
651
+
652
+ declare module '@onairosofficial/onairos-capacitor/connectors' {
653
+ export * from '@onairosofficial/onairos-capacitor';
654
+ export { default } from '@onairosofficial/onairos-capacitor';
655
+ }
656
+