onairos 4.2.0 → 4.2.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.
@@ -1,276 +1,276 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>OAuth Callback - Onairos</title>
7
- <style>
8
- /* Make the callback visually minimal and auto-close quickly.
9
- The real UX is handled by the parent window via postMessage. */
10
- body {
11
- margin: 0;
12
- padding: 20px;
13
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
14
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
15
- display: flex;
16
- align-items: center;
17
- justify-content: center;
18
- min-height: 100vh;
19
- color: white;
20
- }
21
- .container {
22
- text-align: center;
23
- background: rgba(255, 255, 255, 0.95);
24
- padding: 40px 30px;
25
- border-radius: 16px;
26
- box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
27
- max-width: 400px;
28
- color: #333;
29
- }
30
- .success-icon, .error-icon {
31
- font-size: 48px;
32
- margin-bottom: 20px;
33
- }
34
- .message {
35
- font-size: 20px;
36
- font-weight: 600;
37
- margin-bottom: 10px;
38
- }
39
- .details {
40
- font-size: 14px;
41
- color: #666;
42
- margin-bottom: 20px;
43
- }
44
- .spinner {
45
- border: 3px solid #f3f3f3;
46
- border-top: 3px solid #667eea;
47
- border-radius: 50%;
48
- width: 40px;
49
- height: 40px;
50
- animation: spin 1s linear infinite;
51
- margin: 0 auto 20px;
52
- }
53
- @keyframes spin {
54
- 0% { transform: rotate(0deg); }
55
- 100% { transform: rotate(360deg); }
56
- }
57
- </style>
58
- </head>
59
- <body>
60
- <div class="container">
61
- <div id="loading-state">
62
- <div class="spinner"></div>
63
- <div class="message">Processing your connection...</div>
64
- <div class="details">Please wait while we complete the setup.</div>
65
- </div>
66
-
67
- <div id="success-state" style="display: none;">
68
- <div class="success-icon">✅</div>
69
- <div class="message">Successfully Connected!</div>
70
- <div class="details" id="success-details">You can close this tab now.</div>
71
- </div>
72
-
73
- <div id="error-state" style="display: none;">
74
- <div class="error-icon">❌</div>
75
- <div class="message">Connection Failed</div>
76
- <div class="details" id="error-details">Please try again.</div>
77
- </div>
78
- </div>
79
-
80
- <script>
81
- // Parse URL parameters
82
- const urlParams = new URLSearchParams(window.location.search);
83
- const success = urlParams.get('success');
84
- const error = urlParams.get('error');
85
- const platform = urlParams.get('platform');
86
- const details = urlParams.get('details');
87
- const email = urlParams.get('email'); // Extract email from URL params
88
-
89
- // Get elements
90
- const loadingState = document.getElementById('loading-state');
91
- const successState = document.getElementById('success-state');
92
- const errorState = document.getElementById('error-state');
93
- const errorDetails = document.getElementById('error-details');
94
- const successDetails = document.getElementById('success-details');
95
-
96
- // Detect if we're in a popup or tab
97
- const isInPopup = window.opener !== null && !window.opener.closed;
98
- const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
99
-
100
- console.log('🔄 OAuth callback received:', { success, error, platform, details, email, isInPopup, isMobile });
101
-
102
- if (success === 'true' && platform) {
103
- // Success flow
104
- console.log(`✅ OAuth success for platform: ${platform}`);
105
-
106
- // Show success state
107
- loadingState.style.display = 'none';
108
- successState.style.display = 'block';
109
-
110
- // Signal success to parent window via localStorage (works across tabs)
111
- localStorage.setItem(`onairos_${platform}_success`, 'true');
112
- localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
113
-
114
- // Store email if provided (for Gmail OAuth)
115
- if (email) {
116
- localStorage.setItem(`onairos_${platform}_email`, email);
117
- // Also store as generic oauth_email for compatibility
118
- localStorage.setItem('onairos_oauth_email', email);
119
- localStorage.setItem('onairos_gmail_email', email); // Direct key for Gmail
120
- console.log(`📧 Stored ${platform} email in localStorage:`, email);
121
- }
122
-
123
- // Try to close the Capacitor Browser automatically
124
- try {
125
- if (window.Capacitor && window.Capacitor.Plugins && window.Capacitor.Plugins.Browser) {
126
- console.log('🚪 Attempting to close Capacitor Browser automatically...');
127
- window.Capacitor.Plugins.Browser.close();
128
- console.log('✅ Called Browser.close()');
129
- }
130
- } catch (e) {
131
- console.log('⚠️ Could not close Capacitor Browser:', e.message);
132
- }
133
-
134
- // Try to notify parent via postMessage (works for popups)
135
- try {
136
- if (window.opener && !window.opener.closed) {
137
- window.opener.postMessage({
138
- type: 'oauth-success',
139
- platform: platform,
140
- email: email,
141
- gmailEmail: email, // Alias for Gmail
142
- success: true
143
- }, '*');
144
- console.log('📤 Sent onairos oauth-success postMessage to parent window');
145
- }
146
- } catch (e) {
147
- console.log('⚠️ Could not send postMessage (cross-origin or no opener):', e.message);
148
- }
149
-
150
- // Redirect behavior:
151
- // - For popups: close immediately
152
- // - For same-page redirects (mobile): redirect back to stored return URL
153
- if (isInPopup) {
154
- // Popup window - close immediately
155
- setTimeout(() => {
156
- console.log('🚪 Closing OAuth popup window (success)');
157
- try {
158
- window.close();
159
- } catch (e) {
160
- console.log('⚠️ Could not close popup:', e.message);
161
- }
162
- }, 100);
163
- } else {
164
- // Same-page redirect (mobile) - redirect back to stored return URL
165
- const returnUrl = localStorage.getItem('onairos_return_url');
166
- const oauthContext = localStorage.getItem('onairos_oauth_context');
167
-
168
- if (returnUrl && (oauthContext === 'gmail-auth' || oauthContext === 'platform-connector')) {
169
- console.log('🔄 Redirecting back to:', returnUrl);
170
- successDetails.textContent = 'Redirecting back...';
171
-
172
- // Build redirect URL with success params
173
- const redirectUrl = new URL(returnUrl);
174
- redirectUrl.searchParams.set('onairos_oauth_success', 'true');
175
- redirectUrl.searchParams.set('onairos_oauth_platform', platform);
176
- if (email) {
177
- redirectUrl.searchParams.set('onairos_oauth_email', email);
178
- }
179
-
180
- // Clean up return URL from localStorage (component will handle other cleanup)
181
- localStorage.removeItem('onairos_return_url');
182
-
183
- // Redirect immediately
184
- console.log('📍 Redirecting to:', redirectUrl.toString());
185
- window.location.replace(redirectUrl.toString());
186
- } else {
187
- // Fallback: show message and try to close
188
- successDetails.textContent = isMobile
189
- ? 'You can close this tab and return to the app.'
190
- : 'This tab will close automatically.';
191
-
192
- setTimeout(() => {
193
- console.log('🚪 Attempting to close OAuth tab (success, no return URL)');
194
- try {
195
- window.close();
196
- setTimeout(() => {
197
- if (!document.hidden) {
198
- successDetails.textContent = 'Please close this tab and return to the app.';
199
- console.log('⚠️ Tab could not be auto-closed (mobile limitation)');
200
- }
201
- }, 500);
202
- } catch (e) {
203
- console.log('⚠️ Could not close tab:', e.message);
204
- successDetails.textContent = 'Please close this tab and return to the app.';
205
- }
206
- }, isMobile ? 2000 : 1500);
207
- }
208
- }
209
-
210
- } else if (error || success === 'false') {
211
- // Error flow
212
- console.log(`❌ OAuth error for platform: ${platform}`, error);
213
-
214
- // Show error state
215
- loadingState.style.display = 'none';
216
- errorState.style.display = 'block';
217
- if (errorDetails) {
218
- errorDetails.textContent = error || details || 'Please try again.';
219
- }
220
-
221
- // Signal error to parent window
222
- localStorage.setItem(`onairos_${platform}_error`, error || 'Unknown error');
223
- localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
224
-
225
- // Try to close on error (works better for popups than tabs)
226
- setTimeout(() => {
227
- console.log('🚪 Attempting to close OAuth window (error)');
228
- try {
229
- window.close();
230
- } catch (e) {
231
- console.log('⚠️ Could not close window:', e.message);
232
- }
233
- }, 2000);
234
-
235
- } else {
236
- // No clear success or error - treat as potential success
237
- console.log('🤔 Ambiguous OAuth callback, treating as success');
238
-
239
- loadingState.style.display = 'none';
240
- successState.style.display = 'block';
241
- successDetails.textContent = 'Processing...';
242
-
243
- if (platform) {
244
- localStorage.setItem(`onairos_${platform}_success`, 'true');
245
- localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
246
- }
247
-
248
- // Best-effort close after a short delay
249
- setTimeout(() => {
250
- console.log('🚪 Attempting to close OAuth window (ambiguous result)');
251
- try {
252
- window.close();
253
- } catch (e) {
254
- console.log('⚠️ Could not close window:', e.message);
255
- }
256
- }, 2000);
257
- }
258
-
259
- // Fallback: try to close window if no action taken after a longer time
260
- setTimeout(() => {
261
- console.log('🚪 Fallback: Attempting to close OAuth window');
262
- try {
263
- window.close();
264
- } catch (e) {
265
- console.log('⚠️ Fallback: Could not close window:', e.message);
266
- }
267
- }, 5000);
268
-
269
- // Handle cases where window.close() might not work
270
- window.addEventListener('beforeunload', () => {
271
- console.log('🚪 OAuth popup window closing');
272
- });
273
- </script>
274
- </body>
275
- </html>
276
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>OAuth Callback - Onairos</title>
7
+ <style>
8
+ /* Make the callback visually minimal and auto-close quickly.
9
+ The real UX is handled by the parent window via postMessage. */
10
+ body {
11
+ margin: 0;
12
+ padding: 20px;
13
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
14
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ min-height: 100vh;
19
+ color: white;
20
+ }
21
+ .container {
22
+ text-align: center;
23
+ background: rgba(255, 255, 255, 0.95);
24
+ padding: 40px 30px;
25
+ border-radius: 16px;
26
+ box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
27
+ max-width: 400px;
28
+ color: #333;
29
+ }
30
+ .success-icon, .error-icon {
31
+ font-size: 48px;
32
+ margin-bottom: 20px;
33
+ }
34
+ .message {
35
+ font-size: 20px;
36
+ font-weight: 600;
37
+ margin-bottom: 10px;
38
+ }
39
+ .details {
40
+ font-size: 14px;
41
+ color: #666;
42
+ margin-bottom: 20px;
43
+ }
44
+ .spinner {
45
+ border: 3px solid #f3f3f3;
46
+ border-top: 3px solid #667eea;
47
+ border-radius: 50%;
48
+ width: 40px;
49
+ height: 40px;
50
+ animation: spin 1s linear infinite;
51
+ margin: 0 auto 20px;
52
+ }
53
+ @keyframes spin {
54
+ 0% { transform: rotate(0deg); }
55
+ 100% { transform: rotate(360deg); }
56
+ }
57
+ </style>
58
+ </head>
59
+ <body>
60
+ <div class="container">
61
+ <div id="loading-state">
62
+ <div class="spinner"></div>
63
+ <div class="message">Processing your connection...</div>
64
+ <div class="details">Please wait while we complete the setup.</div>
65
+ </div>
66
+
67
+ <div id="success-state" style="display: none;">
68
+ <div class="success-icon">✅</div>
69
+ <div class="message">Successfully Connected!</div>
70
+ <div class="details" id="success-details">You can close this tab now.</div>
71
+ </div>
72
+
73
+ <div id="error-state" style="display: none;">
74
+ <div class="error-icon">❌</div>
75
+ <div class="message">Connection Failed</div>
76
+ <div class="details" id="error-details">Please try again.</div>
77
+ </div>
78
+ </div>
79
+
80
+ <script>
81
+ // Parse URL parameters
82
+ const urlParams = new URLSearchParams(window.location.search);
83
+ const success = urlParams.get('success');
84
+ const error = urlParams.get('error');
85
+ const platform = urlParams.get('platform');
86
+ const details = urlParams.get('details');
87
+ const email = urlParams.get('email'); // Extract email from URL params
88
+
89
+ // Get elements
90
+ const loadingState = document.getElementById('loading-state');
91
+ const successState = document.getElementById('success-state');
92
+ const errorState = document.getElementById('error-state');
93
+ const errorDetails = document.getElementById('error-details');
94
+ const successDetails = document.getElementById('success-details');
95
+
96
+ // Detect if we're in a popup or tab
97
+ const isInPopup = window.opener !== null && !window.opener.closed;
98
+ const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
99
+
100
+ console.log('🔄 OAuth callback received:', { success, error, platform, details, email, isInPopup, isMobile });
101
+
102
+ if (success === 'true' && platform) {
103
+ // Success flow
104
+ console.log(`✅ OAuth success for platform: ${platform}`);
105
+
106
+ // Show success state
107
+ loadingState.style.display = 'none';
108
+ successState.style.display = 'block';
109
+
110
+ // Signal success to parent window via localStorage (works across tabs)
111
+ localStorage.setItem(`onairos_${platform}_success`, 'true');
112
+ localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
113
+
114
+ // Store email if provided (for Gmail OAuth)
115
+ if (email) {
116
+ localStorage.setItem(`onairos_${platform}_email`, email);
117
+ // Also store as generic oauth_email for compatibility
118
+ localStorage.setItem('onairos_oauth_email', email);
119
+ localStorage.setItem('onairos_gmail_email', email); // Direct key for Gmail
120
+ console.log(`📧 Stored ${platform} email in localStorage:`, email);
121
+ }
122
+
123
+ // Try to close the Capacitor Browser automatically
124
+ try {
125
+ if (window.Capacitor && window.Capacitor.Plugins && window.Capacitor.Plugins.Browser) {
126
+ console.log('🚪 Attempting to close Capacitor Browser automatically...');
127
+ window.Capacitor.Plugins.Browser.close();
128
+ console.log('✅ Called Browser.close()');
129
+ }
130
+ } catch (e) {
131
+ console.log('⚠️ Could not close Capacitor Browser:', e.message);
132
+ }
133
+
134
+ // Try to notify parent via postMessage (works for popups)
135
+ try {
136
+ if (window.opener && !window.opener.closed) {
137
+ window.opener.postMessage({
138
+ type: 'oauth-success',
139
+ platform: platform,
140
+ email: email,
141
+ gmailEmail: email, // Alias for Gmail
142
+ success: true
143
+ }, '*');
144
+ console.log('📤 Sent onairos oauth-success postMessage to parent window');
145
+ }
146
+ } catch (e) {
147
+ console.log('⚠️ Could not send postMessage (cross-origin or no opener):', e.message);
148
+ }
149
+
150
+ // Redirect behavior:
151
+ // - For popups: close immediately
152
+ // - For same-page redirects (mobile): redirect back to stored return URL
153
+ if (isInPopup) {
154
+ // Popup window - close immediately
155
+ setTimeout(() => {
156
+ console.log('🚪 Closing OAuth popup window (success)');
157
+ try {
158
+ window.close();
159
+ } catch (e) {
160
+ console.log('⚠️ Could not close popup:', e.message);
161
+ }
162
+ }, 100);
163
+ } else {
164
+ // Same-page redirect (mobile) - redirect back to stored return URL
165
+ const returnUrl = localStorage.getItem('onairos_return_url');
166
+ const oauthContext = localStorage.getItem('onairos_oauth_context');
167
+
168
+ if (returnUrl && (oauthContext === 'gmail-auth' || oauthContext === 'platform-connector')) {
169
+ console.log('🔄 Redirecting back to:', returnUrl);
170
+ successDetails.textContent = 'Redirecting back...';
171
+
172
+ // Build redirect URL with success params
173
+ const redirectUrl = new URL(returnUrl);
174
+ redirectUrl.searchParams.set('onairos_oauth_success', 'true');
175
+ redirectUrl.searchParams.set('onairos_oauth_platform', platform);
176
+ if (email) {
177
+ redirectUrl.searchParams.set('onairos_oauth_email', email);
178
+ }
179
+
180
+ // Clean up return URL from localStorage (component will handle other cleanup)
181
+ localStorage.removeItem('onairos_return_url');
182
+
183
+ // Redirect immediately
184
+ console.log('📍 Redirecting to:', redirectUrl.toString());
185
+ window.location.replace(redirectUrl.toString());
186
+ } else {
187
+ // Fallback: show message and try to close
188
+ successDetails.textContent = isMobile
189
+ ? 'You can close this tab and return to the app.'
190
+ : 'This tab will close automatically.';
191
+
192
+ setTimeout(() => {
193
+ console.log('🚪 Attempting to close OAuth tab (success, no return URL)');
194
+ try {
195
+ window.close();
196
+ setTimeout(() => {
197
+ if (!document.hidden) {
198
+ successDetails.textContent = 'Please close this tab and return to the app.';
199
+ console.log('⚠️ Tab could not be auto-closed (mobile limitation)');
200
+ }
201
+ }, 500);
202
+ } catch (e) {
203
+ console.log('⚠️ Could not close tab:', e.message);
204
+ successDetails.textContent = 'Please close this tab and return to the app.';
205
+ }
206
+ }, isMobile ? 2000 : 1500);
207
+ }
208
+ }
209
+
210
+ } else if (error || success === 'false') {
211
+ // Error flow
212
+ console.log(`❌ OAuth error for platform: ${platform}`, error);
213
+
214
+ // Show error state
215
+ loadingState.style.display = 'none';
216
+ errorState.style.display = 'block';
217
+ if (errorDetails) {
218
+ errorDetails.textContent = error || details || 'Please try again.';
219
+ }
220
+
221
+ // Signal error to parent window
222
+ localStorage.setItem(`onairos_${platform}_error`, error || 'Unknown error');
223
+ localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
224
+
225
+ // Try to close on error (works better for popups than tabs)
226
+ setTimeout(() => {
227
+ console.log('🚪 Attempting to close OAuth window (error)');
228
+ try {
229
+ window.close();
230
+ } catch (e) {
231
+ console.log('⚠️ Could not close window:', e.message);
232
+ }
233
+ }, 2000);
234
+
235
+ } else {
236
+ // No clear success or error - treat as potential success
237
+ console.log('🤔 Ambiguous OAuth callback, treating as success');
238
+
239
+ loadingState.style.display = 'none';
240
+ successState.style.display = 'block';
241
+ successDetails.textContent = 'Processing...';
242
+
243
+ if (platform) {
244
+ localStorage.setItem(`onairos_${platform}_success`, 'true');
245
+ localStorage.setItem(`onairos_${platform}_timestamp`, Date.now().toString());
246
+ }
247
+
248
+ // Best-effort close after a short delay
249
+ setTimeout(() => {
250
+ console.log('🚪 Attempting to close OAuth window (ambiguous result)');
251
+ try {
252
+ window.close();
253
+ } catch (e) {
254
+ console.log('⚠️ Could not close window:', e.message);
255
+ }
256
+ }, 2000);
257
+ }
258
+
259
+ // Fallback: try to close window if no action taken after a longer time
260
+ setTimeout(() => {
261
+ console.log('🚪 Fallback: Attempting to close OAuth window');
262
+ try {
263
+ window.close();
264
+ } catch (e) {
265
+ console.log('⚠️ Fallback: Could not close window:', e.message);
266
+ }
267
+ }, 5000);
268
+
269
+ // Handle cases where window.close() might not work
270
+ window.addEventListener('beforeunload', () => {
271
+ console.log('🚪 OAuth popup window closing');
272
+ });
273
+ </script>
274
+ </body>
275
+ </html>
276
+ </html>
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@capacitor/browser"),require("@capacitor/core")):"function"==typeof define&&define.amd?define("OnairosLaravel",["@capacitor/browser","@capacitor/core"],t):"object"==typeof exports?exports.OnairosLaravel=t(require("@capacitor/browser"),require("@capacitor/core")):e.OnairosLaravel=t(e["@capacitor/browser"],e["@capacitor/core"])}(this,(e,t)=>(()=>{"use strict";var n,o,r,i,a={550:e=>{e.exports=t},895:t=>{t.exports=e}},c={};function s(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e].call(n.exports,n,n.exports,s),n.exports}s.m=a,s.amdO={},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};n=n||[null,o({}),o([]),o(o)];for(var a=2&t&&e;("object"==typeof a||"function"==typeof a)&&!~n.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,n)=>(s.f[n](e,t),t),[])),s.u=e=>e+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},i="OnairosLaravel:",s.l=(e,t,n,o)=>{if(r[e])r[e].push(t);else{var a,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==i+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",i+n),a.src=e),r[e]=[t];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var o=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(e=>e(n)),t)return t(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),c&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),(()=>{var e={930:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,r)=>o=e[t]=[n,r]);n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,c]=n,l=0;if(i.some(t=>0!==e[t])){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);if(c)c(s)}for(t&&t(n);l<i.length;l++)r=i[l],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var l={};function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}s.r(l),s.d(l,{createOnairosButton:()=>b,initializeOnairosForBlade:()=>f,renderOnairosDirective:()=>g});function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};window.OnairosConfig=u(u({},{apiKey:null,baseUrl:"https://api2.onairos.uk",testMode:!1,autoDetectMobile:!0,globalStyles:!0}),e),window.OnairosConfig.globalStyles&&function(){if(document.getElementById("onairos-styles"))return;const e="\n <style id=\"onairos-styles\">\n .onairos-button-container {\n display: inline-block;\n margin: 10px 0;\n }\n \n .onairos-btn {\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n border: none;\n border-radius: 25px;\n padding: 12px 24px;\n color: white;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s ease;\n box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);\n }\n \n .onairos-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);\n }\n \n .onairos-btn-pill {\n border-radius: 25px;\n }\n \n .onairos-btn-icon {\n border-radius: 50%;\n width: 45px;\n height: 45px;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .onairos-btn-loading {\n color: #888;\n }\n \n @media (max-width: 768px) {\n .onairos-btn {\n width: 100%;\n padding: 15px 20px;\n font-size: 16px;\n }\n }\n </style>\n ";document.head.insertAdjacentHTML("beforeend",e)}(),window.OnairosUtils={isMobile:y(),detectMobile:y},console.log("🔥 Onairos initialized for Laravel Blade templates")}function b(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=document.getElementById(e);if(!o){if(!window.OnairosUtils||!window.OnairosUtils.isMobile)return void console.error('❌ Element with ID "'.concat(e,'" not found'));{const t=document.createElement("div");t.id=e,document.body.appendChild(t),o=t}}const r=u(u({},{requestData:["email","profile"],webpageName:"Laravel App",testMode:(null===(t=window.OnairosConfig)||void 0===t?void 0:t.testMode)||!1,autoFetch:!0,buttonType:"pill",textColor:"black"}),n);o.innerHTML='\n <div class="onairos-button-container">\n <button \n id="'.concat(e,'-btn" \n class="onairos-btn onairos-btn-').concat(r.buttonType,"\"\n data-onairos-config='").concat(JSON.stringify(r),'\'\n >\n <span class="onairos-btn-text" style="color: ').concat(r.textColor,'">\n Connect with Onairos\n </span>\n <span class="onairos-btn-loading" style="display: none;">\n Loading...\n </span>\n </button>\n </div>\n ');const i=document.getElementById("".concat(e,"-btn"));i.onclick=()=>m(r),i.addEventListener("click",()=>m(r))}function m(e){!async function(e){try{const t="onairos-react-".concat(Math.random().toString(36).substr(2,9)),n=document.createElement("div");n.id=t,document.body.appendChild(n);const o=(await s.e(540).then(s.t.bind(s,540,19))).default||await s.e(540).then(s.t.bind(s,540,19)),r=(await s.e(961).then(s.t.bind(s,961,19))).default||await s.e(961).then(s.t.bind(s,961,19)),{OnairosButton:i}=await Promise.all([s.e(961),s.e(345),s.e(373)]).then(s.bind(s,373)),a=t=>{e.onComplete&&"function"==typeof e.onComplete&&e.onComplete(t),setTimeout(()=>{n&&n.parentNode&&n.parentNode.removeChild(n)},0)},c=o.createElement(i,{requestData:e.requestData,webpageName:e.webpageName,autoFetch:e.autoFetch,testMode:e.testMode,textColor:e.textColor||"white",buttonType:e.buttonType||"pill",onComplete:a});r.render(c,n),setTimeout(()=>{const e=n.querySelector("button");e&&e.click()},0)}catch(e){console.error("Failed to mount React overlay for Laravel:",e)}}(e)}function y(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768}function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t="onairos-".concat(Math.random().toString(36).substr(2,9));return'\n <div id="'.concat(t,"\"></div>\n <script>\n document.addEventListener('DOMContentLoaded', function() {\n if (window.createOnairosButton) {\n window.createOnairosButton('").concat(t,"', ").concat(JSON.stringify(e),");\n }\n });\n <\/script>\n ")}return"undefined"!=typeof window&&(window.initializeOnairosForBlade=f,window.createOnairosButton=b,window.renderOnairosDirective=g),l})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@capacitor/browser"),require("@capacitor/core")):"function"==typeof define&&define.amd?define("OnairosLaravel",["@capacitor/browser","@capacitor/core"],t):"object"==typeof exports?exports.OnairosLaravel=t(require("@capacitor/browser"),require("@capacitor/core")):e.OnairosLaravel=t(e["@capacitor/browser"],e["@capacitor/core"])}(this,((e,t)=>(()=>{"use strict";var n,o,r,i,a={478:t=>{t.exports=e},283:e=>{e.exports=t}},c={};function s(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e].call(n.exports,n,n.exports,s),n.exports}s.m=a,s.amdO={},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};n=n||[null,o({}),o([]),o(o)];for(var a=2&t&&e;"object"==typeof a&&!~n.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>e+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},i="OnairosLaravel:",s.l=(e,t,n,o)=>{if(r[e])r[e].push(t);else{var a,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==i+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",i+n),a.src=e),r[e]=[t];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var o=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),c&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&!e;)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),(()=>{var e={787:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,i=n[0],a=n[1],c=n[2],l=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);if(c)c(s)}for(t&&t(n);l<i.length;l++)r=i[l],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var l={};return(()=>{function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?e(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}s.r(l),s.d(l,{createOnairosButton:()=>r,initializeOnairosForBlade:()=>o,renderOnairosDirective:()=>c});function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};window.OnairosConfig=t(t({},{apiKey:null,baseUrl:"https://api2.onairos.uk",testMode:!1,autoDetectMobile:!0,globalStyles:!0}),e),window.OnairosConfig.globalStyles&&function(){if(document.getElementById("onairos-styles"))return;const e="\n <style id=\"onairos-styles\">\n .onairos-button-container {\n display: inline-block;\n margin: 10px 0;\n }\n \n .onairos-btn {\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n border: none;\n border-radius: 25px;\n padding: 12px 24px;\n color: white;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s ease;\n box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);\n }\n \n .onairos-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);\n }\n \n .onairos-btn-pill {\n border-radius: 25px;\n }\n \n .onairos-btn-icon {\n border-radius: 50%;\n width: 45px;\n height: 45px;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .onairos-btn-loading {\n color: #888;\n }\n \n @media (max-width: 768px) {\n .onairos-btn {\n width: 100%;\n padding: 15px 20px;\n font-size: 16px;\n }\n }\n </style>\n ";document.head.insertAdjacentHTML("beforeend",e)}(),window.OnairosUtils={isMobile:a(),detectMobile:a},console.log("🔥 Onairos initialized for Laravel Blade templates")}function r(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.getElementById(e);if(!r){if(!window.OnairosUtils||!window.OnairosUtils.isMobile)return void console.error('❌ Element with ID "'.concat(e,'" not found'));{const t=document.createElement("div");t.id=e,document.body.appendChild(t),r=t}}const a=t(t({},{requestData:["email","profile"],webpageName:"Laravel App",testMode:(null===(n=window.OnairosConfig)||void 0===n?void 0:n.testMode)||!1,autoFetch:!0,buttonType:"pill",textColor:"black"}),o);r.innerHTML='\n <div class="onairos-button-container">\n <button \n id="'.concat(e,'-btn" \n class="onairos-btn onairos-btn-').concat(a.buttonType,"\"\n data-onairos-config='").concat(JSON.stringify(a),'\'\n >\n <span class="onairos-btn-text" style="color: ').concat(a.textColor,'">\n Connect with Onairos\n </span>\n <span class="onairos-btn-loading" style="display: none;">\n Loading...\n </span>\n </button>\n </div>\n ');const c=document.getElementById("".concat(e,"-btn"));c.onclick=()=>i(a),c.addEventListener("click",(()=>i(a)))}function i(e){!async function(e){try{const t="onairos-react-".concat(Math.random().toString(36).substr(2,9)),n=document.createElement("div");n.id=t,document.body.appendChild(n);const o=(await s.e(294).then(s.t.bind(s,294,19))).default||await s.e(294).then(s.t.bind(s,294,19)),r=(await s.e(935).then(s.t.bind(s,935,19))).default||await s.e(935).then(s.t.bind(s,935,19)),{OnairosButton:i}=await Promise.all([s.e(935),s.e(811),s.e(670)]).then(s.bind(s,670)),a=t=>{e.onComplete&&"function"==typeof e.onComplete&&e.onComplete(t),setTimeout((()=>{n&&n.parentNode&&n.parentNode.removeChild(n)}),0)},c=o.createElement(i,{requestData:e.requestData,webpageName:e.webpageName,autoFetch:e.autoFetch,testMode:e.testMode,textColor:e.textColor||"white",buttonType:e.buttonType||"pill",onComplete:a});r.render(c,n),setTimeout((()=>{const e=n.querySelector("button");e&&e.click()}),0)}catch(e){console.error("Failed to mount React overlay for Laravel:",e)}}(e)}function a(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t="onairos-".concat(Math.random().toString(36).substr(2,9));return'\n <div id="'.concat(t,"\"></div>\n <script>\n document.addEventListener('DOMContentLoaded', function() {\n if (window.createOnairosButton) {\n window.createOnairosButton('").concat(t,"', ").concat(JSON.stringify(e),");\n }\n });\n <\/script>\n ")}"undefined"!=typeof window&&(window.initializeOnairosForBlade=o,window.createOnairosButton=r,window.renderOnairosDirective=c)})(),l})()));
2
2
  //# sourceMappingURL=onairos-laravel.js.map