@soyio/soyio-rn-sdk 0.2.13 → 0.2.15

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/README.md CHANGED
@@ -48,6 +48,7 @@ export default function App() {
48
48
  const options = {
49
49
  userReference: "<company identifier of user>", // OPTIONAL
50
50
  companyId: "<company id>", // Starts with 'com_'
51
+ isSandbox: true, // Optional. Default is false
51
52
  };
52
53
 
53
54
  // For registering a new identity
package/dist/main.es.js CHANGED
@@ -205,15 +205,15 @@ function _waitForRedirectAsync(returnUrl) {
205
205
  _redirectSubscription = Linking.addEventListener("url", redirectHandler);
206
206
  });
207
207
  }
208
- const SOYIO_WEBVIEW_BASE_URL = "https://staging.soyio.id";
208
+ const PRODUCTION_URL = "https://app.soyio.id/widget";
209
+ const SANDBOX_URL = "https://sandbox.soyio.id/widget";
209
210
  const SOYIO_REDIRECT_URL = "demo://";
210
211
  function getFlowUrl(options, flow) {
211
- var _a;
212
- const baseUrl = (_a = options.developmentUrl) != null ? _a : SOYIO_WEBVIEW_BASE_URL;
213
- return `${baseUrl}/widget/${flow}`;
212
+ const baseUrl = options.developmentUrl || (options.isSandBox ? SANDBOX_URL : PRODUCTION_URL);
213
+ return `${baseUrl}/${flow}`;
214
214
  }
215
215
  function buildUrlParams(widgetParams, flowParams) {
216
- let baseParams = `isMobile=true&companyId=${widgetParams.companyId}`;
216
+ let baseParams = `platform=rn&companyId=${widgetParams.companyId}`;
217
217
  if (widgetParams.userReference) {
218
218
  baseParams += `&userReference=${widgetParams.userReference}`;
219
219
  }
@@ -1 +1 @@
1
- {"version":3,"file":"main.es.js","sources":["../node_modules/expo-modules-core/build/NativeModulesProxy.js","../node_modules/expo-modules-core/build/errors/CodedError.js","../node_modules/expo-modules-core/build/environment/browser.js","../node_modules/expo-modules-core/build/Platform.js","../node_modules/expo-modules-core/build/errors/UnavailabilityError.js","../node_modules/expo-modules-core/build/requireNativeModule.js","../node_modules/expo-web-browser/build/ExpoWebBrowser.js","../node_modules/expo-web-browser/build/WebBrowser.types.js","../node_modules/expo-web-browser/build/WebBrowser.js","../src/lib/constants.ts","../src/lib/utils.ts","../src/lib/core.tsx"],"sourcesContent":["// We default to an empty object shim wherever we don't have an environment-specific implementation\n/**\n * @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.\n * Use `requireNativeModule` or `requireOptionalNativeModule` instead.\n */\nexport default {};\n//# sourceMappingURL=NativeModulesProxy.js.map","/**\n * A general error class that should be used for all errors in Expo modules.\n * Guarantees a `code` field that can be used to differentiate between different\n * types of errors without further subclassing Error.\n */\nexport class CodedError extends Error {\n code;\n info;\n constructor(code, message) {\n super(message);\n this.code = code;\n }\n}\n//# sourceMappingURL=CodedError.js.map","// In standard node environments there is no DOM API\nexport const isDOMAvailable = false;\nexport const canUseEventListeners = false;\nexport const canUseViewport = false;\nexport let isAsyncDebugging = false;\nif (__DEV__) {\n // These native globals are injected by native React runtimes and not standard browsers\n // we can use them to determine if the JS is being executed in Chrome.\n isAsyncDebugging =\n !global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;\n}\n//# sourceMappingURL=browser.js.map","import { Platform as ReactNativePlatform } from 'react-native';\nimport { isDOMAvailable, canUseEventListeners, canUseViewport, isAsyncDebugging, } from './environment/browser';\nconst Platform = {\n /**\n * Denotes the currently running platform.\n * Can be one of ios, android, web.\n */\n OS: ReactNativePlatform.OS,\n /**\n * Returns the value with the matching platform.\n * Object keys can be any of ios, android, native, web, default.\n *\n * @ios ios, native, default\n * @android android, native, default\n * @web web, default\n */\n select: ReactNativePlatform.select,\n /**\n * Denotes if the DOM API is available in the current environment.\n * The DOM is not available in native React runtimes and Node.js.\n */\n isDOMAvailable,\n /**\n * Denotes if the current environment can attach event listeners\n * to the window. This will return false in native React\n * runtimes and Node.js.\n */\n canUseEventListeners,\n /**\n * Denotes if the current environment can inspect properties of the\n * screen on which the current window is being rendered. This will\n * return false in native React runtimes and Node.js.\n */\n canUseViewport,\n /**\n * If the JavaScript is being executed in a remote JavaScript environment.\n * When `true`, synchronous native invocations cannot be executed.\n */\n isAsyncDebugging,\n};\nexport default Platform;\n//# sourceMappingURL=Platform.js.map","import { CodedError } from './CodedError';\nimport Platform from '../Platform';\n/**\n * A class for errors to be thrown when a property is accessed which is\n * unavailable, unsupported, or not currently implemented on the running\n * platform.\n */\nexport class UnavailabilityError extends CodedError {\n constructor(moduleName, propertyName) {\n super('ERR_UNAVAILABLE', `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`);\n }\n}\n//# sourceMappingURL=UnavailabilityError.js.map","import { NativeModules } from 'react-native';\nimport NativeModulesProxy from './NativeModulesProxy';\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule(moduleName) {\n const nativeModule = requireOptionalNativeModule(moduleName);\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule(moduleName) {\n ensureNativeModulesAreInstalled();\n return (globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName] ??\n null);\n}\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nfunction ensureNativeModulesAreInstalled() {\n if (globalThis.expo) {\n return;\n }\n try {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n//# sourceMappingURL=requireNativeModule.js.map","import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoWebBrowser');\n//# sourceMappingURL=ExpoWebBrowser.js.map","// @needsAudit @docsMissing\nexport var WebBrowserResultType;\n(function (WebBrowserResultType) {\n /**\n * @platform ios\n */\n WebBrowserResultType[\"CANCEL\"] = \"cancel\";\n /**\n * @platform ios\n */\n WebBrowserResultType[\"DISMISS\"] = \"dismiss\";\n /**\n * @platform android\n */\n WebBrowserResultType[\"OPENED\"] = \"opened\";\n WebBrowserResultType[\"LOCKED\"] = \"locked\";\n})(WebBrowserResultType || (WebBrowserResultType = {}));\n// @needsAudit\n/**\n * A browser presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport var WebBrowserPresentationStyle;\n(function (WebBrowserPresentationStyle) {\n /**\n * A presentation style in which the presented browser covers the screen.\n */\n WebBrowserPresentationStyle[\"FULL_SCREEN\"] = \"fullScreen\";\n /**\n * A presentation style that partially covers the underlying content.\n */\n WebBrowserPresentationStyle[\"PAGE_SHEET\"] = \"pageSheet\";\n /**\n * A presentation style that displays the browser centered in the screen.\n */\n WebBrowserPresentationStyle[\"FORM_SHEET\"] = \"formSheet\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"CURRENT_CONTEXT\"] = \"currentContext\";\n /**\n * A presentation style in which the browser view covers the screen.\n */\n WebBrowserPresentationStyle[\"OVER_FULL_SCREEN\"] = \"overFullScreen\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"OVER_CURRENT_CONTEXT\"] = \"overCurrentContext\";\n /**\n * A presentation style where the browser is displayed in a popover view.\n */\n WebBrowserPresentationStyle[\"POPOVER\"] = \"popover\";\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n WebBrowserPresentationStyle[\"AUTOMATIC\"] = \"automatic\";\n})(WebBrowserPresentationStyle || (WebBrowserPresentationStyle = {}));\n//# sourceMappingURL=WebBrowser.types.js.map","import { UnavailabilityError } from 'expo-modules-core';\nimport { AppState, Linking, Platform, processColor, } from 'react-native';\nimport ExponentWebBrowser from './ExpoWebBrowser';\nimport { WebBrowserResultType, WebBrowserPresentationStyle, } from './WebBrowser.types';\nexport { WebBrowserResultType, WebBrowserPresentationStyle, };\nconst emptyCustomTabsPackages = {\n defaultBrowserPackage: undefined,\n preferredBrowserPackage: undefined,\n browserPackages: [],\n servicePackages: [],\n};\n// @needsAudit\n/**\n * Returns a list of applications package names supporting Custom Tabs, Custom Tabs\n * service, user chosen and preferred one. This may not be fully reliable, since it uses\n * `PackageManager.getResolvingActivities` under the hood. (For example, some browsers might not be\n * present in browserPackages list once another browser is set to default.)\n *\n * @return The promise which fulfils with [`WebBrowserCustomTabsResults`](#webbrowsercustomtabsresults) object.\n * @platform android\n */\nexport async function getCustomTabsSupportingBrowsersAsync() {\n if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) {\n throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync');\n }\n if (Platform.OS !== 'android') {\n return emptyCustomTabsPackages;\n }\n else {\n return await ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync();\n }\n}\n// @needsAudit\n/**\n * This method calls `warmUp` method on [CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient.html#warmup(long))\n * for specified package.\n *\n * @param browserPackage Package of browser to be warmed up. If not set, preferred browser will be warmed.\n *\n * @return A promise which fulfils with `WebBrowserWarmUpResult` object.\n * @platform android\n */\nexport async function warmUpAsync(browserPackage) {\n if (!ExponentWebBrowser.warmUpAsync) {\n throw new UnavailabilityError('WebBrowser', 'warmUpAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.warmUpAsync(browserPackage);\n }\n}\n// @needsAudit\n/**\n * This method initiates (if needed) [CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession.html#maylaunchurl)\n * and calls its `mayLaunchUrl` method for browser specified by the package.\n *\n * @param url The url of page that is likely to be loaded first when opening browser.\n * @param browserPackage Package of browser to be informed. If not set, preferred\n * browser will be used.\n *\n * @return A promise which fulfils with `WebBrowserMayInitWithUrlResult` object.\n * @platform android\n */\nexport async function mayInitWithUrlAsync(url, browserPackage) {\n if (!ExponentWebBrowser.mayInitWithUrlAsync) {\n throw new UnavailabilityError('WebBrowser', 'mayInitWithUrlAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.mayInitWithUrlAsync(url, browserPackage);\n }\n}\n// @needsAudit\n/**\n * This methods removes all bindings to services created by [`warmUpAsync`](#webbrowserwarmupasyncbrowserpackage)\n * or [`mayInitWithUrlAsync`](#webbrowsermayinitwithurlasyncurl-browserpackage). You should call\n * this method once you don't need them to avoid potential memory leaks. However, those binding\n * would be cleared once your application is destroyed, which might be sufficient in most cases.\n *\n * @param browserPackage Package of browser to be cooled. If not set, preferred browser will be used.\n *\n * @return The promise which fulfils with ` WebBrowserCoolDownResult` when cooling is performed, or\n * an empty object when there was no connection to be dismissed.\n * @platform android\n */\nexport async function coolDownAsync(browserPackage) {\n if (!ExponentWebBrowser.coolDownAsync) {\n throw new UnavailabilityError('WebBrowser', 'coolDownAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.coolDownAsync(browserPackage);\n }\n}\nlet browserLocked = false;\n// @needsAudit\n/**\n * Opens the url with Safari in a modal on iOS using [`SFSafariViewController`](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller),\n * and Chrome in a new [custom tab](https://developer.chrome.com/multidevice/android/customtabs)\n * on Android. On iOS, the modal Safari will not share cookies with the system Safari. If you need\n * this, use [`openAuthSessionAsync`](#webbrowseropenauthsessionasyncurl-redirecturl-browserparams).\n *\n * @param url The url to open in the web browser.\n * @param browserParams A dictionary of key-value pairs.\n *\n * @return The promise behaves differently based on the platform.\n * On Android promise resolves with `{type: 'opened'}` if we were able to open browser.\n * On iOS:\n * - If the user closed the web browser, the Promise resolves with `{ type: 'cancel' }`.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser), the Promise resolves with `{ type: 'dismiss' }`.\n */\nexport async function openBrowserAsync(url, browserParams = {}) {\n if (!ExponentWebBrowser.openBrowserAsync) {\n throw new UnavailabilityError('WebBrowser', 'openBrowserAsync');\n }\n if (browserLocked) {\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (__DEV__) {\n console.warn('Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time.');\n }\n return { type: WebBrowserResultType.LOCKED };\n }\n browserLocked = true;\n let result;\n try {\n result = await ExponentWebBrowser.openBrowserAsync(url, _processOptions(browserParams));\n }\n finally {\n // WebBrowser session complete, unset lock\n browserLocked = false;\n }\n return result;\n}\n// @needsAudit\n/**\n * Dismisses the presented web browser.\n *\n * @return The `void` on successful attempt, or throws error, if dismiss functionality is not avaiable.\n * @platform ios\n */\nexport function dismissBrowser() {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissBrowser');\n }\n ExponentWebBrowser.dismissBrowser();\n}\n// @needsAudit\n/**\n * # On Android:\n * This will be done using a \"custom Chrome tabs\" browser, [AppState](https://reactnative.dev/docs/appstate),\n * and [Linking](./linking/) APIs.\n *\n * # On iOS:\n * Opens the url with Safari in a modal using `ASWebAuthenticationSession`. The user will be asked\n * whether to allow the app to authenticate using the given url.\n * To handle redirection back to the mobile application, the redirect URI set in the authentication server\n * has to use the protocol provided as the scheme in **app.json** [`expo.scheme`](./../config/app/#scheme).\n * For example, `demo://` not `https://` protocol.\n * Using `Linking.addEventListener` is not needed and can have side effects.\n *\n * # On web:\n * > This API can only be used in a secure environment (`https`). You can use expo `start:web --https`\n * to test this. Otherwise, an error with code [`ERR_WEB_BROWSER_CRYPTO`](#errwebbrowsercrypto) will be thrown.\n * This will use the browser's [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) API.\n * - _Desktop_: This will create a new web popup window in the browser that can be closed later using `WebBrowser.maybeCompleteAuthSession()`.\n * - _Mobile_: This will open a new tab in the browser which can be closed using `WebBrowser.maybeCompleteAuthSession()`.\n *\n * How this works on web:\n * - A crypto state will be created for verifying the redirect.\n * - This means you need to run with `npx expo start --https`\n * - The state will be added to the window's `localstorage`. This ensures that auth cannot complete\n * unless it's done from a page running with the same origin as it was started.\n * Ex: if `openAuthSessionAsync` is invoked on `https://localhost:19006`, then `maybeCompleteAuthSession`\n * must be invoked on a page hosted from the origin `https://localhost:19006`. Using a different\n * website, or even a different host like `https://128.0.0.*:19006` for example will not work.\n * - A timer will be started to check for every 1000 milliseconds (1 second) to detect if the window\n * has been closed by the user. If this happens then a promise will resolve with `{ type: 'dismiss' }`.\n *\n * > On mobile web, Chrome and Safari will block any call to [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open)\n * which takes too long to fire after a user interaction. This method must be invoked immediately\n * after a user interaction. If the event is blocked, an error with code [`ERR_WEB_BROWSER_BLOCKED`](#errwebbrowserblocked) will be thrown.\n *\n * @param url The url to open in the web browser. This should be a login page.\n * @param redirectUrl _Optional_ - The url to deep link back into your app.\n * On web, this defaults to the output of [`Linking.createURL(\"\")`](./linking/#linkingcreateurlpath-namedparameters).\n * @param options _Optional_ - An object extending the [`WebBrowserOpenOptions`](#webbrowseropenoptions).\n * If there is no native AuthSession implementation available (which is the case on Android)\n * these params will be used in the browser polyfill. If there is a native AuthSession implementation,\n * these params will be ignored.\n *\n * @return\n * - If the user does not permit the application to authenticate with the given url, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the user closed the web browser, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser),\n * the Promise fulfills with `{ type: 'dismiss' }` object.\n */\nexport async function openAuthSessionAsync(url, redirectUrl, options = {}) {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.openAuthSessionAsync) {\n throw new UnavailabilityError('WebBrowser', 'openAuthSessionAsync');\n }\n if (['ios', 'web'].includes(Platform.OS)) {\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl, _processOptions(options));\n }\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl);\n }\n else {\n return _openAuthSessionPolyfillAsync(url, redirectUrl, options);\n }\n}\n// @docsMissing\nexport function dismissAuthSession() {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.dismissAuthSession) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissAuthSession();\n }\n else {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissBrowser();\n }\n}\n// @needsAudit\n/**\n * Possibly completes an authentication session on web in a window popup. The method\n * should be invoked on the page that the window redirects to.\n *\n * @param options\n *\n * @return Returns an object with message about why the redirect failed or succeeded:\n *\n * If `type` is set to `failed`, the reason depends on the message:\n * - `Not supported on this platform`: If the platform doesn't support this method (iOS, Android).\n * - `Cannot use expo-web-browser in a non-browser environment`: If the code was executed in an SSR\n * or node environment.\n * - `No auth session is currently in progress`: (the cached state wasn't found in local storage).\n * This can happen if the window redirects to an origin (website) that is different to the initial\n * website origin. If this happens in development, it may be because the auth started on localhost\n * and finished on your computer port (Ex: `128.0.0.*`). This is controlled by the `redirectUrl`\n * and `returnUrl`.\n * - `Current URL \"<URL>\" and original redirect URL \"<URL>\" do not match`: This can occur when the\n * redirect URL doesn't match what was initial defined as the `returnUrl`. You can skip this test\n * in development by passing `{ skipRedirectCheck: true }` to the function.\n *\n * If `type` is set to `success`, the parent window will attempt to close the child window immediately.\n *\n * If the error `ERR_WEB_BROWSER_REDIRECT` was thrown, it may mean that the parent window was\n * reloaded before the auth was completed. In this case you'll need to close the child window manually.\n *\n * @platform web\n */\nexport function maybeCompleteAuthSession(options = {}) {\n if (ExponentWebBrowser.maybeCompleteAuthSession) {\n return ExponentWebBrowser.maybeCompleteAuthSession(options);\n }\n return { type: 'failed', message: 'Not supported on this platform' };\n}\nfunction _processOptions(options) {\n return {\n ...options,\n controlsColor: processColor(options.controlsColor),\n toolbarColor: processColor(options.toolbarColor),\n secondaryToolbarColor: processColor(options.secondaryToolbarColor),\n };\n}\n/* iOS <= 10 and Android polyfill for SFAuthenticationSession flow */\nfunction _authSessionIsNativelySupported() {\n if (Platform.OS === 'android') {\n return false;\n }\n else if (Platform.OS === 'web') {\n return true;\n }\n const versionNumber = parseInt(String(Platform.Version), 10);\n return versionNumber >= 11;\n}\nlet _redirectSubscription = null;\n/*\n * openBrowserAsync on Android doesn't wait until closed, so we need to polyfill\n * it with AppState\n */\n// Store the `resolve` function from a Promise to fire when the AppState\n// returns to active\nlet _onWebBrowserCloseAndroid = null;\n// If the initial AppState.currentState is null, we assume that the first call to\n// AppState#change event is not actually triggered by a real change,\n// is triggered instead by the bridge capturing the current state\n// (https://reactnative.dev/docs/appstate#basic-usage)\nlet _isAppStateAvailable = AppState.currentState !== null;\nfunction _onAppStateChangeAndroid(state) {\n if (!_isAppStateAvailable) {\n _isAppStateAvailable = true;\n return;\n }\n if (state === 'active' && _onWebBrowserCloseAndroid) {\n _onWebBrowserCloseAndroid();\n }\n}\nasync function _openBrowserAndWaitAndroidAsync(startUrl, browserParams = {}) {\n const appStateChangedToActive = new Promise((resolve) => {\n _onWebBrowserCloseAndroid = resolve;\n });\n const stateChangeSubscription = AppState.addEventListener('change', _onAppStateChangeAndroid);\n let result = { type: WebBrowserResultType.CANCEL };\n let type = null;\n try {\n ({ type } = await openBrowserAsync(startUrl, browserParams));\n }\n catch (e) {\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n throw e;\n }\n if (type === 'opened') {\n await appStateChangedToActive;\n result = { type: WebBrowserResultType.DISMISS };\n }\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n return result;\n}\nasync function _openAuthSessionPolyfillAsync(startUrl, returnUrl, browserParams = {}) {\n if (_redirectSubscription) {\n throw new Error(`The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be`);\n }\n if (_onWebBrowserCloseAndroid) {\n throw new Error(`WebBrowser is already open, only one can be open at a time`);\n }\n try {\n if (Platform.OS === 'android') {\n return await Promise.race([\n _openBrowserAndWaitAndroidAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n else {\n return await Promise.race([\n openBrowserAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n }\n finally {\n // We can't dismiss the browser on Android, only call this when it's available.\n // Users on Android need to manually press the 'x' button in Chrome Custom Tabs, sadly.\n if (ExponentWebBrowser.dismissBrowser) {\n ExponentWebBrowser.dismissBrowser();\n }\n _stopWaitingForRedirect();\n }\n}\nfunction _stopWaitingForRedirect() {\n if (!_redirectSubscription) {\n throw new Error(`The WebBrowser auth session is in an invalid state with no redirect handler when one should be set`);\n }\n _redirectSubscription.remove();\n _redirectSubscription = null;\n}\nfunction _waitForRedirectAsync(returnUrl) {\n // Note that this Promise never resolves when `returnUrl` is nullish\n return new Promise((resolve) => {\n const redirectHandler = (event) => {\n if (returnUrl && event.url.startsWith(returnUrl)) {\n resolve({ url: event.url, type: 'success' });\n }\n };\n _redirectSubscription = Linking.addEventListener('url', redirectHandler);\n });\n}\n//# sourceMappingURL=WebBrowser.js.map","export const SOYIO_WEBVIEW_BASE_URL = 'https://staging.soyio.id';\nexport const SOYIO_REDIRECT_URL = 'demo://';\n","import { RegisterParams, AuthenticateParams, SoyioWidgetParams } from '../types';\nimport { SOYIO_WEBVIEW_BASE_URL } from './constants';\n\nexport function getFlowUrl(options: SoyioWidgetParams, flow: 'authenticate' | 'register'): string {\n const baseUrl = options.developmentUrl ?? SOYIO_WEBVIEW_BASE_URL;\n return `${baseUrl}/widget/${flow}`;\n}\n\nexport function buildUrlParams(\n widgetParams: SoyioWidgetParams,\n flowParams: RegisterParams | AuthenticateParams,\n): string {\n let baseParams = `isMobile=true&companyId=${widgetParams.companyId}`;\n if (widgetParams.userReference) {\n baseParams += `&userReference=${widgetParams.userReference}`;\n }\n const dynamicParams = Object.entries(flowParams)\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join('&');\n\n return `${baseParams}&${dynamicParams}`;\n}\n","import { useCallback } from 'react';\nimport * as WebBrowser from 'expo-web-browser';\nimport { getFlowUrl, buildUrlParams } from './utils';\nimport { SOYIO_REDIRECT_URL } from './constants';\n\nimport type { SoyioWidgetViewPropsType, RegisterParams, AuthenticateParams } from '../types';\n\nexport const useSoyioAuth = ({ options, onEventChange }: SoyioWidgetViewPropsType) => {\n const webBrowserOptions: WebBrowser.AuthSessionOpenOptions = {\n dismissButtonStyle: 'cancel',\n createTask: false,\n enableBarCollapsing: true,\n showTitle: true,\n };\n\n const register = useCallback(async (registerParams: RegisterParams) => {\n const registerBaseUri = getFlowUrl(options, 'register');\n const registerUri = `${registerBaseUri}?${buildUrlParams(options, registerParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open register' });\n\n const registerResult = await WebBrowser.openAuthSessionAsync(\n registerUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n\n if (onEventChange) onEventChange(registerResult);\n }, [options, onEventChange]);\n\n const authenticate = useCallback(async (authenticateParams: AuthenticateParams) => {\n const authenticateBaseUri = getFlowUrl(options, 'authenticate');\n const authenticateUri = `${authenticateBaseUri}?${buildUrlParams(options, authenticateParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open authenticate' });\n const authenticateResult = await WebBrowser.openAuthSessionAsync(\n authenticateUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n if (onEventChange) onEventChange(authenticateResult);\n }, [options, onEventChange]);\n\n return { register, authenticate };\n};\n"],"names":["ReactNativePlatform","Platform","WebBrowserResultType","WebBrowserPresentationStyle","useSoyioAuth","options","onEventChange","webBrowserOptions","dismissButtonStyle","createTask","enableBarCollapsing","showTitle","register","useCallback","registerParams","registerBaseUri","getFlowUrl","registerUri","buildUrlParams","type","registerResult","WebBrowser","SOYIO_REDIRECT_URL","authenticate","authenticateParams","authenticateBaseUri","authenticateUri","authenticateResult"],"mappings":";;;;;;;;AAKA,IAAA,qBAAe,CAAE;ACAV,MAAM,mBAAmB,MAAM;AAAA,EAGlC,YAAY,MAAM,SAAS;AACvB,UAAM,OAAO;AAHjB;AACA;AAGI,SAAK,OAAO;AAAA,EACf;AACL;ACXO,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,iBAAiB;AACvB,IAAI,mBAAmB;AAC9B,IAAI,SAAS;AAGT,qBACI,CAAC,OAAO,oBAAoB,CAAC,OAAO,sBAAsB,CAAC,OAAO;AAC1E;ACRA,MAAM,WAAW;AAAA,EAKb,IAAIA,WAAoB;AAAA,EASxB,QAAQA,WAAoB;AAAA,EAK5B;AAAA,EAMA;AAAA,EAMA;AAAA,EAKA;AACJ;AACA,IAAA,aAAe;ACjCR,MAAM,4BAA4B,WAAW;AAAA,EAChD,YAAY,YAAY,cAAc;AAClC,UAAM,mBAAmB,0BAA0B,cAAc,oCAAoCC,WAAS,sEAAsE;AAAA,EACvL;AACL;ACAO,SAAS,oBAAoB,YAAY;AAC5C,QAAM,eAAe,4BAA4B,UAAU;AAC3D,MAAI,CAAC,cAAc;AACf,UAAM,IAAI,MAAM,8BAA8B,aAAa;AAAA,EAC9D;AACD,SAAO;AACX;AAQO,SAAS,4BAA4B,YAAY;;AACpD;AACA,UAAQ,wCAAW,SAAX,mBAAiB,YAAjB,mBAA2B,gBAA3B,aACJ,gBAAW,gBAAX,mBAAyB,gBADrB,YAEJ,mBAAmB,gBAFf,YAGJ;AACR;AAKA,SAAS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f,iBACF;AACID,QAAAA;AAAeA,oBAAcqB,kBAAkB;AAAA,EAAA,GAClD,CAACtB,SAASC,aAAa,CAAC;AAEpB,SAAA;AAAA,IAAEM;AAAAA,IAAUW;AAAAA,EAAAA;AACrB;;"}
1
+ {"version":3,"file":"main.es.js","sources":["../node_modules/expo-modules-core/build/NativeModulesProxy.js","../node_modules/expo-modules-core/build/errors/CodedError.js","../node_modules/expo-modules-core/build/environment/browser.js","../node_modules/expo-modules-core/build/Platform.js","../node_modules/expo-modules-core/build/errors/UnavailabilityError.js","../node_modules/expo-modules-core/build/requireNativeModule.js","../node_modules/expo-web-browser/build/ExpoWebBrowser.js","../node_modules/expo-web-browser/build/WebBrowser.types.js","../node_modules/expo-web-browser/build/WebBrowser.js","../src/lib/constants.ts","../src/lib/utils.ts","../src/lib/core.tsx"],"sourcesContent":["// We default to an empty object shim wherever we don't have an environment-specific implementation\n/**\n * @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.\n * Use `requireNativeModule` or `requireOptionalNativeModule` instead.\n */\nexport default {};\n//# sourceMappingURL=NativeModulesProxy.js.map","/**\n * A general error class that should be used for all errors in Expo modules.\n * Guarantees a `code` field that can be used to differentiate between different\n * types of errors without further subclassing Error.\n */\nexport class CodedError extends Error {\n code;\n info;\n constructor(code, message) {\n super(message);\n this.code = code;\n }\n}\n//# sourceMappingURL=CodedError.js.map","// In standard node environments there is no DOM API\nexport const isDOMAvailable = false;\nexport const canUseEventListeners = false;\nexport const canUseViewport = false;\nexport let isAsyncDebugging = false;\nif (__DEV__) {\n // These native globals are injected by native React runtimes and not standard browsers\n // we can use them to determine if the JS is being executed in Chrome.\n isAsyncDebugging =\n !global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;\n}\n//# sourceMappingURL=browser.js.map","import { Platform as ReactNativePlatform } from 'react-native';\nimport { isDOMAvailable, canUseEventListeners, canUseViewport, isAsyncDebugging, } from './environment/browser';\nconst Platform = {\n /**\n * Denotes the currently running platform.\n * Can be one of ios, android, web.\n */\n OS: ReactNativePlatform.OS,\n /**\n * Returns the value with the matching platform.\n * Object keys can be any of ios, android, native, web, default.\n *\n * @ios ios, native, default\n * @android android, native, default\n * @web web, default\n */\n select: ReactNativePlatform.select,\n /**\n * Denotes if the DOM API is available in the current environment.\n * The DOM is not available in native React runtimes and Node.js.\n */\n isDOMAvailable,\n /**\n * Denotes if the current environment can attach event listeners\n * to the window. This will return false in native React\n * runtimes and Node.js.\n */\n canUseEventListeners,\n /**\n * Denotes if the current environment can inspect properties of the\n * screen on which the current window is being rendered. This will\n * return false in native React runtimes and Node.js.\n */\n canUseViewport,\n /**\n * If the JavaScript is being executed in a remote JavaScript environment.\n * When `true`, synchronous native invocations cannot be executed.\n */\n isAsyncDebugging,\n};\nexport default Platform;\n//# sourceMappingURL=Platform.js.map","import { CodedError } from './CodedError';\nimport Platform from '../Platform';\n/**\n * A class for errors to be thrown when a property is accessed which is\n * unavailable, unsupported, or not currently implemented on the running\n * platform.\n */\nexport class UnavailabilityError extends CodedError {\n constructor(moduleName, propertyName) {\n super('ERR_UNAVAILABLE', `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`);\n }\n}\n//# sourceMappingURL=UnavailabilityError.js.map","import { NativeModules } from 'react-native';\nimport NativeModulesProxy from './NativeModulesProxy';\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule(moduleName) {\n const nativeModule = requireOptionalNativeModule(moduleName);\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule(moduleName) {\n ensureNativeModulesAreInstalled();\n return (globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName] ??\n null);\n}\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nfunction ensureNativeModulesAreInstalled() {\n if (globalThis.expo) {\n return;\n }\n try {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n//# sourceMappingURL=requireNativeModule.js.map","import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoWebBrowser');\n//# sourceMappingURL=ExpoWebBrowser.js.map","// @needsAudit @docsMissing\nexport var WebBrowserResultType;\n(function (WebBrowserResultType) {\n /**\n * @platform ios\n */\n WebBrowserResultType[\"CANCEL\"] = \"cancel\";\n /**\n * @platform ios\n */\n WebBrowserResultType[\"DISMISS\"] = \"dismiss\";\n /**\n * @platform android\n */\n WebBrowserResultType[\"OPENED\"] = \"opened\";\n WebBrowserResultType[\"LOCKED\"] = \"locked\";\n})(WebBrowserResultType || (WebBrowserResultType = {}));\n// @needsAudit\n/**\n * A browser presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport var WebBrowserPresentationStyle;\n(function (WebBrowserPresentationStyle) {\n /**\n * A presentation style in which the presented browser covers the screen.\n */\n WebBrowserPresentationStyle[\"FULL_SCREEN\"] = \"fullScreen\";\n /**\n * A presentation style that partially covers the underlying content.\n */\n WebBrowserPresentationStyle[\"PAGE_SHEET\"] = \"pageSheet\";\n /**\n * A presentation style that displays the browser centered in the screen.\n */\n WebBrowserPresentationStyle[\"FORM_SHEET\"] = \"formSheet\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"CURRENT_CONTEXT\"] = \"currentContext\";\n /**\n * A presentation style in which the browser view covers the screen.\n */\n WebBrowserPresentationStyle[\"OVER_FULL_SCREEN\"] = \"overFullScreen\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"OVER_CURRENT_CONTEXT\"] = \"overCurrentContext\";\n /**\n * A presentation style where the browser is displayed in a popover view.\n */\n WebBrowserPresentationStyle[\"POPOVER\"] = \"popover\";\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n WebBrowserPresentationStyle[\"AUTOMATIC\"] = \"automatic\";\n})(WebBrowserPresentationStyle || (WebBrowserPresentationStyle = {}));\n//# sourceMappingURL=WebBrowser.types.js.map","import { UnavailabilityError } from 'expo-modules-core';\nimport { AppState, Linking, Platform, processColor, } from 'react-native';\nimport ExponentWebBrowser from './ExpoWebBrowser';\nimport { WebBrowserResultType, WebBrowserPresentationStyle, } from './WebBrowser.types';\nexport { WebBrowserResultType, WebBrowserPresentationStyle, };\nconst emptyCustomTabsPackages = {\n defaultBrowserPackage: undefined,\n preferredBrowserPackage: undefined,\n browserPackages: [],\n servicePackages: [],\n};\n// @needsAudit\n/**\n * Returns a list of applications package names supporting Custom Tabs, Custom Tabs\n * service, user chosen and preferred one. This may not be fully reliable, since it uses\n * `PackageManager.getResolvingActivities` under the hood. (For example, some browsers might not be\n * present in browserPackages list once another browser is set to default.)\n *\n * @return The promise which fulfils with [`WebBrowserCustomTabsResults`](#webbrowsercustomtabsresults) object.\n * @platform android\n */\nexport async function getCustomTabsSupportingBrowsersAsync() {\n if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) {\n throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync');\n }\n if (Platform.OS !== 'android') {\n return emptyCustomTabsPackages;\n }\n else {\n return await ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync();\n }\n}\n// @needsAudit\n/**\n * This method calls `warmUp` method on [CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient.html#warmup(long))\n * for specified package.\n *\n * @param browserPackage Package of browser to be warmed up. If not set, preferred browser will be warmed.\n *\n * @return A promise which fulfils with `WebBrowserWarmUpResult` object.\n * @platform android\n */\nexport async function warmUpAsync(browserPackage) {\n if (!ExponentWebBrowser.warmUpAsync) {\n throw new UnavailabilityError('WebBrowser', 'warmUpAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.warmUpAsync(browserPackage);\n }\n}\n// @needsAudit\n/**\n * This method initiates (if needed) [CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession.html#maylaunchurl)\n * and calls its `mayLaunchUrl` method for browser specified by the package.\n *\n * @param url The url of page that is likely to be loaded first when opening browser.\n * @param browserPackage Package of browser to be informed. If not set, preferred\n * browser will be used.\n *\n * @return A promise which fulfils with `WebBrowserMayInitWithUrlResult` object.\n * @platform android\n */\nexport async function mayInitWithUrlAsync(url, browserPackage) {\n if (!ExponentWebBrowser.mayInitWithUrlAsync) {\n throw new UnavailabilityError('WebBrowser', 'mayInitWithUrlAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.mayInitWithUrlAsync(url, browserPackage);\n }\n}\n// @needsAudit\n/**\n * This methods removes all bindings to services created by [`warmUpAsync`](#webbrowserwarmupasyncbrowserpackage)\n * or [`mayInitWithUrlAsync`](#webbrowsermayinitwithurlasyncurl-browserpackage). You should call\n * this method once you don't need them to avoid potential memory leaks. However, those binding\n * would be cleared once your application is destroyed, which might be sufficient in most cases.\n *\n * @param browserPackage Package of browser to be cooled. If not set, preferred browser will be used.\n *\n * @return The promise which fulfils with ` WebBrowserCoolDownResult` when cooling is performed, or\n * an empty object when there was no connection to be dismissed.\n * @platform android\n */\nexport async function coolDownAsync(browserPackage) {\n if (!ExponentWebBrowser.coolDownAsync) {\n throw new UnavailabilityError('WebBrowser', 'coolDownAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.coolDownAsync(browserPackage);\n }\n}\nlet browserLocked = false;\n// @needsAudit\n/**\n * Opens the url with Safari in a modal on iOS using [`SFSafariViewController`](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller),\n * and Chrome in a new [custom tab](https://developer.chrome.com/multidevice/android/customtabs)\n * on Android. On iOS, the modal Safari will not share cookies with the system Safari. If you need\n * this, use [`openAuthSessionAsync`](#webbrowseropenauthsessionasyncurl-redirecturl-browserparams).\n *\n * @param url The url to open in the web browser.\n * @param browserParams A dictionary of key-value pairs.\n *\n * @return The promise behaves differently based on the platform.\n * On Android promise resolves with `{type: 'opened'}` if we were able to open browser.\n * On iOS:\n * - If the user closed the web browser, the Promise resolves with `{ type: 'cancel' }`.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser), the Promise resolves with `{ type: 'dismiss' }`.\n */\nexport async function openBrowserAsync(url, browserParams = {}) {\n if (!ExponentWebBrowser.openBrowserAsync) {\n throw new UnavailabilityError('WebBrowser', 'openBrowserAsync');\n }\n if (browserLocked) {\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (__DEV__) {\n console.warn('Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time.');\n }\n return { type: WebBrowserResultType.LOCKED };\n }\n browserLocked = true;\n let result;\n try {\n result = await ExponentWebBrowser.openBrowserAsync(url, _processOptions(browserParams));\n }\n finally {\n // WebBrowser session complete, unset lock\n browserLocked = false;\n }\n return result;\n}\n// @needsAudit\n/**\n * Dismisses the presented web browser.\n *\n * @return The `void` on successful attempt, or throws error, if dismiss functionality is not avaiable.\n * @platform ios\n */\nexport function dismissBrowser() {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissBrowser');\n }\n ExponentWebBrowser.dismissBrowser();\n}\n// @needsAudit\n/**\n * # On Android:\n * This will be done using a \"custom Chrome tabs\" browser, [AppState](https://reactnative.dev/docs/appstate),\n * and [Linking](./linking/) APIs.\n *\n * # On iOS:\n * Opens the url with Safari in a modal using `ASWebAuthenticationSession`. The user will be asked\n * whether to allow the app to authenticate using the given url.\n * To handle redirection back to the mobile application, the redirect URI set in the authentication server\n * has to use the protocol provided as the scheme in **app.json** [`expo.scheme`](./../config/app/#scheme).\n * For example, `demo://` not `https://` protocol.\n * Using `Linking.addEventListener` is not needed and can have side effects.\n *\n * # On web:\n * > This API can only be used in a secure environment (`https`). You can use expo `start:web --https`\n * to test this. Otherwise, an error with code [`ERR_WEB_BROWSER_CRYPTO`](#errwebbrowsercrypto) will be thrown.\n * This will use the browser's [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) API.\n * - _Desktop_: This will create a new web popup window in the browser that can be closed later using `WebBrowser.maybeCompleteAuthSession()`.\n * - _Mobile_: This will open a new tab in the browser which can be closed using `WebBrowser.maybeCompleteAuthSession()`.\n *\n * How this works on web:\n * - A crypto state will be created for verifying the redirect.\n * - This means you need to run with `npx expo start --https`\n * - The state will be added to the window's `localstorage`. This ensures that auth cannot complete\n * unless it's done from a page running with the same origin as it was started.\n * Ex: if `openAuthSessionAsync` is invoked on `https://localhost:19006`, then `maybeCompleteAuthSession`\n * must be invoked on a page hosted from the origin `https://localhost:19006`. Using a different\n * website, or even a different host like `https://128.0.0.*:19006` for example will not work.\n * - A timer will be started to check for every 1000 milliseconds (1 second) to detect if the window\n * has been closed by the user. If this happens then a promise will resolve with `{ type: 'dismiss' }`.\n *\n * > On mobile web, Chrome and Safari will block any call to [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open)\n * which takes too long to fire after a user interaction. This method must be invoked immediately\n * after a user interaction. If the event is blocked, an error with code [`ERR_WEB_BROWSER_BLOCKED`](#errwebbrowserblocked) will be thrown.\n *\n * @param url The url to open in the web browser. This should be a login page.\n * @param redirectUrl _Optional_ - The url to deep link back into your app.\n * On web, this defaults to the output of [`Linking.createURL(\"\")`](./linking/#linkingcreateurlpath-namedparameters).\n * @param options _Optional_ - An object extending the [`WebBrowserOpenOptions`](#webbrowseropenoptions).\n * If there is no native AuthSession implementation available (which is the case on Android)\n * these params will be used in the browser polyfill. If there is a native AuthSession implementation,\n * these params will be ignored.\n *\n * @return\n * - If the user does not permit the application to authenticate with the given url, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the user closed the web browser, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser),\n * the Promise fulfills with `{ type: 'dismiss' }` object.\n */\nexport async function openAuthSessionAsync(url, redirectUrl, options = {}) {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.openAuthSessionAsync) {\n throw new UnavailabilityError('WebBrowser', 'openAuthSessionAsync');\n }\n if (['ios', 'web'].includes(Platform.OS)) {\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl, _processOptions(options));\n }\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl);\n }\n else {\n return _openAuthSessionPolyfillAsync(url, redirectUrl, options);\n }\n}\n// @docsMissing\nexport function dismissAuthSession() {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.dismissAuthSession) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissAuthSession();\n }\n else {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissBrowser();\n }\n}\n// @needsAudit\n/**\n * Possibly completes an authentication session on web in a window popup. The method\n * should be invoked on the page that the window redirects to.\n *\n * @param options\n *\n * @return Returns an object with message about why the redirect failed or succeeded:\n *\n * If `type` is set to `failed`, the reason depends on the message:\n * - `Not supported on this platform`: If the platform doesn't support this method (iOS, Android).\n * - `Cannot use expo-web-browser in a non-browser environment`: If the code was executed in an SSR\n * or node environment.\n * - `No auth session is currently in progress`: (the cached state wasn't found in local storage).\n * This can happen if the window redirects to an origin (website) that is different to the initial\n * website origin. If this happens in development, it may be because the auth started on localhost\n * and finished on your computer port (Ex: `128.0.0.*`). This is controlled by the `redirectUrl`\n * and `returnUrl`.\n * - `Current URL \"<URL>\" and original redirect URL \"<URL>\" do not match`: This can occur when the\n * redirect URL doesn't match what was initial defined as the `returnUrl`. You can skip this test\n * in development by passing `{ skipRedirectCheck: true }` to the function.\n *\n * If `type` is set to `success`, the parent window will attempt to close the child window immediately.\n *\n * If the error `ERR_WEB_BROWSER_REDIRECT` was thrown, it may mean that the parent window was\n * reloaded before the auth was completed. In this case you'll need to close the child window manually.\n *\n * @platform web\n */\nexport function maybeCompleteAuthSession(options = {}) {\n if (ExponentWebBrowser.maybeCompleteAuthSession) {\n return ExponentWebBrowser.maybeCompleteAuthSession(options);\n }\n return { type: 'failed', message: 'Not supported on this platform' };\n}\nfunction _processOptions(options) {\n return {\n ...options,\n controlsColor: processColor(options.controlsColor),\n toolbarColor: processColor(options.toolbarColor),\n secondaryToolbarColor: processColor(options.secondaryToolbarColor),\n };\n}\n/* iOS <= 10 and Android polyfill for SFAuthenticationSession flow */\nfunction _authSessionIsNativelySupported() {\n if (Platform.OS === 'android') {\n return false;\n }\n else if (Platform.OS === 'web') {\n return true;\n }\n const versionNumber = parseInt(String(Platform.Version), 10);\n return versionNumber >= 11;\n}\nlet _redirectSubscription = null;\n/*\n * openBrowserAsync on Android doesn't wait until closed, so we need to polyfill\n * it with AppState\n */\n// Store the `resolve` function from a Promise to fire when the AppState\n// returns to active\nlet _onWebBrowserCloseAndroid = null;\n// If the initial AppState.currentState is null, we assume that the first call to\n// AppState#change event is not actually triggered by a real change,\n// is triggered instead by the bridge capturing the current state\n// (https://reactnative.dev/docs/appstate#basic-usage)\nlet _isAppStateAvailable = AppState.currentState !== null;\nfunction _onAppStateChangeAndroid(state) {\n if (!_isAppStateAvailable) {\n _isAppStateAvailable = true;\n return;\n }\n if (state === 'active' && _onWebBrowserCloseAndroid) {\n _onWebBrowserCloseAndroid();\n }\n}\nasync function _openBrowserAndWaitAndroidAsync(startUrl, browserParams = {}) {\n const appStateChangedToActive = new Promise((resolve) => {\n _onWebBrowserCloseAndroid = resolve;\n });\n const stateChangeSubscription = AppState.addEventListener('change', _onAppStateChangeAndroid);\n let result = { type: WebBrowserResultType.CANCEL };\n let type = null;\n try {\n ({ type } = await openBrowserAsync(startUrl, browserParams));\n }\n catch (e) {\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n throw e;\n }\n if (type === 'opened') {\n await appStateChangedToActive;\n result = { type: WebBrowserResultType.DISMISS };\n }\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n return result;\n}\nasync function _openAuthSessionPolyfillAsync(startUrl, returnUrl, browserParams = {}) {\n if (_redirectSubscription) {\n throw new Error(`The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be`);\n }\n if (_onWebBrowserCloseAndroid) {\n throw new Error(`WebBrowser is already open, only one can be open at a time`);\n }\n try {\n if (Platform.OS === 'android') {\n return await Promise.race([\n _openBrowserAndWaitAndroidAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n else {\n return await Promise.race([\n openBrowserAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n }\n finally {\n // We can't dismiss the browser on Android, only call this when it's available.\n // Users on Android need to manually press the 'x' button in Chrome Custom Tabs, sadly.\n if (ExponentWebBrowser.dismissBrowser) {\n ExponentWebBrowser.dismissBrowser();\n }\n _stopWaitingForRedirect();\n }\n}\nfunction _stopWaitingForRedirect() {\n if (!_redirectSubscription) {\n throw new Error(`The WebBrowser auth session is in an invalid state with no redirect handler when one should be set`);\n }\n _redirectSubscription.remove();\n _redirectSubscription = null;\n}\nfunction _waitForRedirectAsync(returnUrl) {\n // Note that this Promise never resolves when `returnUrl` is nullish\n return new Promise((resolve) => {\n const redirectHandler = (event) => {\n if (returnUrl && event.url.startsWith(returnUrl)) {\n resolve({ url: event.url, type: 'success' });\n }\n };\n _redirectSubscription = Linking.addEventListener('url', redirectHandler);\n });\n}\n//# sourceMappingURL=WebBrowser.js.map","export const PRODUCTION_URL = 'https://app.soyio.id/widget';\nexport const SANDBOX_URL = 'https://sandbox.soyio.id/widget';\nexport const SOYIO_REDIRECT_URL = 'demo://';\n","import { RegisterParams, AuthenticateParams, SoyioWidgetParams } from '../types';\nimport { PRODUCTION_URL, SANDBOX_URL } from './constants';\n\nexport function getFlowUrl(\n options: SoyioWidgetParams,\n flow: 'authenticate' | 'register',\n): string {\n const baseUrl = options.developmentUrl || (options.isSandBox ? SANDBOX_URL : PRODUCTION_URL);\n return `${baseUrl}/${flow}`;\n}\n\nexport function buildUrlParams(\n widgetParams: SoyioWidgetParams,\n flowParams: RegisterParams | AuthenticateParams,\n): string {\n let baseParams = `platform=rn&companyId=${widgetParams.companyId}`;\n if (widgetParams.userReference) {\n baseParams += `&userReference=${widgetParams.userReference}`;\n }\n const dynamicParams = Object.entries(flowParams)\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join('&');\n\n return `${baseParams}&${dynamicParams}`;\n}\n","import { useCallback } from 'react';\nimport * as WebBrowser from 'expo-web-browser';\nimport { getFlowUrl, buildUrlParams } from './utils';\nimport { SOYIO_REDIRECT_URL } from './constants';\n\nimport type { SoyioWidgetViewPropsType, RegisterParams, AuthenticateParams } from '../types';\n\nexport const useSoyioAuth = ({ options, onEventChange }: SoyioWidgetViewPropsType) => {\n const webBrowserOptions: WebBrowser.AuthSessionOpenOptions = {\n dismissButtonStyle: 'cancel',\n createTask: false,\n enableBarCollapsing: true,\n showTitle: true,\n };\n\n const register = useCallback(async (registerParams: RegisterParams) => {\n const registerBaseUri = getFlowUrl(options, 'register');\n const registerUri = `${registerBaseUri}?${buildUrlParams(options, registerParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open register' });\n\n const registerResult = await WebBrowser.openAuthSessionAsync(\n registerUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n\n if (onEventChange) onEventChange(registerResult);\n }, [options, onEventChange]);\n\n const authenticate = useCallback(async (authenticateParams: AuthenticateParams) => {\n const authenticateBaseUri = getFlowUrl(options, 'authenticate');\n const authenticateUri = `${authenticateBaseUri}?${buildUrlParams(options, authenticateParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open authenticate' });\n const authenticateResult = await WebBrowser.openAuthSessionAsync(\n authenticateUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n if (onEventChange) onEventChange(authenticateResult);\n }, [options, onEventChange]);\n\n return { register, authenticate };\n};\n"],"names":["ReactNativePlatform","Platform","WebBrowserResultType","WebBrowserPresentationStyle","useSoyioAuth","options","onEventChange","webBrowserOptions","dismissButtonStyle","createTask","enableBarCollapsing","showTitle","register","useCallback","registerParams","registerBaseUri","getFlowUrl","registerUri","buildUrlParams","type","registerResult","WebBrowser","SOYIO_REDIRECT_URL","authenticate","authenticateParams","authenticateBaseUri","authenticateUri","authenticateResult"],"mappings":";;;;;;;;AAKA,IAAA,qBAAe,CAAE;ACAV,MAAM,mBAAmB,MAAM;AAAA,EAGlC,YAAY,MAAM,SAAS;AACvB,UAAM,OAAO;AAHjB;AACA;AAGI,SAAK,OAAO;AAAA,EACf;AACL;ACXO,MAAM,iBAAiB;AACvB,MAAM,uBAAuB;AAC7B,MAAM,iBAAiB;AACvB,IAAI,mBAAmB;AAC9B,IAAI,SAAS;AAGT,qBACI,CAAC,OAAO,oBAAoB,CAAC,OAAO,sBAAsB,CAAC,OAAO;AAC1E;ACRA,MAAM,WAAW;AAAA,EAKb,IAAIA,WAAoB;AAAA,EASxB,QAAQA,WAAoB;AAAA,EAK5B;AAAA,EAMA;AAAA,EAMA;AAAA,EAKA;AACJ;AACA,IAAA,aAAe;ACjCR,MAAM,4BAA4B,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AAA;AAAA,QAAEa,MAAM;AAAA,MAAA,CAAiB;AAE1D,UAAMC,iBAAiB,MAAMC,qBAC3BJ,aACAK,oBACAf,iBACF;AAEID,QAAAA;AAAeA,oBAAcc,cAAc;AAAA,EAAA,GAC9C,CAACf,SAASC,aAAa,CAAC;AAErBiB,QAAAA,eAAeV,YAAY,OAAOW,uBAA2C;AAC3EC,UAAAA,sBAAsBT,WAAWX,SAAS,cAAc;AAC9D,UAAMqB,kBAAmB,GAAED,uBAAuBP,eAAeb,SAASmB,kBAAkB;AAExFlB,QAAAA;AAA6B,oBAAA;AAAA,QAAEa,MAAM;AAAA,MAAA,CAAqB;AAC9D,UAAMQ,qBAAqB,MAAMN,qBAC/BK,iBACAJ,oBACAf,iBACF;AACID,QAAAA;AAAeA,oBAAcqB,kBAAkB;AAAA,EAAA,GAClD,CAACtB,SAASC,aAAa,CAAC;AAEpB,SAAA;AAAA,IAAEM;AAAAA,IAAUW;AAAAA,EAAAA;AACrB;;"}
package/dist/main.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(s,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("react"),require("react-native")):typeof define=="function"&&define.amd?define(["exports","react","react-native"],i):(s=typeof globalThis!="undefined"?globalThis:s||self,i(s["soyio-webview-rn"]={},s.React,s.ReactNative))})(this,function(s,i,n){"use strict";var N=Object.defineProperty;var K=(s,i,n)=>i in s?N(s,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[i]=n;var A=(s,i,n)=>(K(s,typeof i!="symbol"?i+"":i,n),n);var g={};class U extends Error{constructor(o,t){super(t);A(this,"code");A(this,"info");this.code=o}}const $=!1,L=!1,M=!1;let S=!1;__DEV__&&(S=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless);var I={OS:n.Platform.OS,select:n.Platform.select,isDOMAvailable:$,canUseEventListeners:L,canUseViewport:M,isAsyncDebugging:S};class b extends U{constructor(r,o){super("ERR_UNAVAILABLE",`The method or property ${r}.${o} is not available on ${I.OS}, are you sure you've linked all the native dependencies properly?`)}}function x(e){const r=P(e);if(!r)throw new Error(`Cannot find native module '${e}'`);return r}function P(e){var r,o,t,a,l,c;return D(),(c=(l=(a=(o=(r=globalThis.expo)==null?void 0:r.modules)==null?void 0:o[e])!=null?a:(t=globalThis.ExpoModules)==null?void 0:t[e])!=null?l:g[e])!=null?c:null}function D(){var e;if(!globalThis.expo)try{(e=n.NativeModules.ExpoModulesCore)==null||e.installModules()}catch(r){console.error(`Unable to install Expo modules: ${r}`)}}var u=x("ExpoWebBrowser"),f;(function(e){e.CANCEL="cancel",e.DISMISS="dismiss",e.OPENED="opened",e.LOCKED="locked"})(f||(f={}));var m;(function(e){e.FULL_SCREEN="fullScreen",e.PAGE_SHEET="pageSheet",e.FORM_SHEET="formSheet",e.CURRENT_CONTEXT="currentContext",e.OVER_FULL_SCREEN="overFullScreen",e.OVER_CURRENT_CONTEXT="overCurrentContext",e.POPOVER="popover",e.AUTOMATIC="automatic"})(m||(m={}));let y=!1;async function E(e,r={}){if(!u.openBrowserAsync)throw new b("WebBrowser","openBrowserAsync");if(y)return __DEV__&&console.warn("Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time."),{type:f.LOCKED};y=!0;let o;try{o=await u.openBrowserAsync(e,C(r))}finally{y=!1}return o}async function _(e,r,o={}){if(V()){if(!u.openAuthSessionAsync)throw new b("WebBrowser","openAuthSessionAsync");return["ios","web"].includes(n.Platform.OS)?u.openAuthSessionAsync(e,r,C(o)):u.openAuthSessionAsync(e,r)}else return W(e,r,o)}function C(e){return{...e,controlsColor:n.processColor(e.controlsColor),toolbarColor:n.processColor(e.toolbarColor),secondaryToolbarColor:n.processColor(e.secondaryToolbarColor)}}function V(){return n.Platform.OS==="android"?!1:n.Platform.OS==="web"?!0:parseInt(String(n.Platform.Version),10)>=11}let p=null,d=null,O=n.AppState.currentState!==null;function k(e){if(!O){O=!0;return}e==="active"&&d&&d()}async function F(e,r={}){const o=new Promise(c=>{d=c}),t=n.AppState.addEventListener("change",k);let a={type:f.CANCEL},l=null;try{({type:l}=await E(e,r))}catch(c){throw t.remove(),d=null,c}return l==="opened"&&(await o,a={type:f.DISMISS}),t.remove(),d=null,a}async function W(e,r,o={}){if(p)throw new Error("The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be");if(d)throw new Error("WebBrowser is already open, only one can be open at a time");try{return n.Platform.OS==="android"?await Promise.race([F(e,o),R(r)]):await Promise.race([E(e,o),R(r)])}finally{u.dismissBrowser&&u.dismissBrowser(),j()}}function j(){if(!p)throw new Error("The WebBrowser auth session is in an invalid state with no redirect handler when one should be set");p.remove(),p=null}function R(e){return new Promise(r=>{const o=t=>{e&&t.url.startsWith(e)&&r({url:t.url,type:"success"})};p=n.Linking.addEventListener("url",o)})}const q="https://staging.soyio.id",v="demo://";function T(e,r){var t;return`${(t=e.developmentUrl)!=null?t:q}/widget/${r}`}function B(e,r){let o=`isMobile=true&companyId=${e.companyId}`;e.userReference&&(o+=`&userReference=${e.userReference}`);const t=Object.entries(r).map(([a,l])=>`${a}=${encodeURIComponent(l)}`).join("&");return`${o}&${t}`}const H=({options:e,onEventChange:r})=>{const o={dismissButtonStyle:"cancel",createTask:!1,enableBarCollapsing:!0,showTitle:!0},t=i.useCallback(async l=>{const h=`${T(e,"register")}?${B(e,l)}`;r&&r({type:"open register"});const w=await _(h,v,o);r&&r(w)},[e,r]),a=i.useCallback(async l=>{const h=`${T(e,"authenticate")}?${B(e,l)}`;r&&r({type:"open authenticate"});const w=await _(h,v,o);r&&r(w)},[e,r]);return{register:t,authenticate:a}};s.useSoyioAuth=H,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(t,s){typeof exports=="object"&&typeof module!="undefined"?s(exports,require("react"),require("react-native")):typeof define=="function"&&define.amd?define(["exports","react","react-native"],s):(t=typeof globalThis!="undefined"?globalThis:t||self,s(t["soyio-webview-rn"]={},t.React,t.ReactNative))})(this,function(t,s,n){"use strict";var X=Object.defineProperty;var K=(t,s,n)=>s in t?X(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var A=(t,s,n)=>(K(t,typeof s!="symbol"?s+"":s,n),n);var U={};class g extends Error{constructor(o,i){super(i);A(this,"code");A(this,"info");this.code=o}}const $=!1,L=!1,x=!1;let S=!1;__DEV__&&(S=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless);var M={OS:n.Platform.OS,select:n.Platform.select,isDOMAvailable:$,canUseEventListeners:L,canUseViewport:x,isAsyncDebugging:S};class b extends g{constructor(r,o){super("ERR_UNAVAILABLE",`The method or property ${r}.${o} is not available on ${M.OS}, are you sure you've linked all the native dependencies properly?`)}}function P(e){const r=I(e);if(!r)throw new Error(`Cannot find native module '${e}'`);return r}function I(e){var r,o,i,a,l,c;return D(),(c=(l=(a=(o=(r=globalThis.expo)==null?void 0:r.modules)==null?void 0:o[e])!=null?a:(i=globalThis.ExpoModules)==null?void 0:i[e])!=null?l:U[e])!=null?c:null}function D(){var e;if(!globalThis.expo)try{(e=n.NativeModules.ExpoModulesCore)==null||e.installModules()}catch(r){console.error(`Unable to install Expo modules: ${r}`)}}var u=P("ExpoWebBrowser"),f;(function(e){e.CANCEL="cancel",e.DISMISS="dismiss",e.OPENED="opened",e.LOCKED="locked"})(f||(f={}));var m;(function(e){e.FULL_SCREEN="fullScreen",e.PAGE_SHEET="pageSheet",e.FORM_SHEET="formSheet",e.CURRENT_CONTEXT="currentContext",e.OVER_FULL_SCREEN="overFullScreen",e.OVER_CURRENT_CONTEXT="overCurrentContext",e.POPOVER="popover",e.AUTOMATIC="automatic"})(m||(m={}));let y=!1;async function E(e,r={}){if(!u.openBrowserAsync)throw new b("WebBrowser","openBrowserAsync");if(y)return __DEV__&&console.warn("Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time."),{type:f.LOCKED};y=!0;let o;try{o=await u.openBrowserAsync(e,C(r))}finally{y=!1}return o}async function _(e,r,o={}){if(k()){if(!u.openAuthSessionAsync)throw new b("WebBrowser","openAuthSessionAsync");return["ios","web"].includes(n.Platform.OS)?u.openAuthSessionAsync(e,r,C(o)):u.openAuthSessionAsync(e,r)}else return N(e,r,o)}function C(e){return{...e,controlsColor:n.processColor(e.controlsColor),toolbarColor:n.processColor(e.toolbarColor),secondaryToolbarColor:n.processColor(e.secondaryToolbarColor)}}function k(){return n.Platform.OS==="android"?!1:n.Platform.OS==="web"?!0:parseInt(String(n.Platform.Version),10)>=11}let p=null,d=null,O=n.AppState.currentState!==null;function V(e){if(!O){O=!0;return}e==="active"&&d&&d()}async function F(e,r={}){const o=new Promise(c=>{d=c}),i=n.AppState.addEventListener("change",V);let a={type:f.CANCEL},l=null;try{({type:l}=await E(e,r))}catch(c){throw i.remove(),d=null,c}return l==="opened"&&(await o,a={type:f.DISMISS}),i.remove(),d=null,a}async function N(e,r,o={}){if(p)throw new Error("The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be");if(d)throw new Error("WebBrowser is already open, only one can be open at a time");try{return n.Platform.OS==="android"?await Promise.race([F(e,o),R(r)]):await Promise.race([E(e,o),R(r)])}finally{u.dismissBrowser&&u.dismissBrowser(),W()}}function W(){if(!p)throw new Error("The WebBrowser auth session is in an invalid state with no redirect handler when one should be set");p.remove(),p=null}function R(e){return new Promise(r=>{const o=i=>{e&&i.url.startsWith(e)&&r({url:i.url,type:"success"})};p=n.Linking.addEventListener("url",o)})}const j="https://app.soyio.id/widget",q="https://sandbox.soyio.id/widget",T="demo://";function v(e,r){return`${e.developmentUrl||(e.isSandBox?q:j)}/${r}`}function B(e,r){let o=`platform=rn&companyId=${e.companyId}`;e.userReference&&(o+=`&userReference=${e.userReference}`);const i=Object.entries(r).map(([a,l])=>`${a}=${encodeURIComponent(l)}`).join("&");return`${o}&${i}`}const H=({options:e,onEventChange:r})=>{const o={dismissButtonStyle:"cancel",createTask:!1,enableBarCollapsing:!0,showTitle:!0},i=s.useCallback(async l=>{const h=`${v(e,"register")}?${B(e,l)}`;r&&r({type:"open register"});const w=await _(h,T,o);r&&r(w)},[e,r]),a=s.useCallback(async l=>{const h=`${v(e,"authenticate")}?${B(e,l)}`;r&&r({type:"open authenticate"});const w=await _(h,T,o);r&&r(w)},[e,r]);return{register:i,authenticate:a}};t.useSoyioAuth=H,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
2
  //# sourceMappingURL=main.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.umd.js","sources":["../node_modules/expo-modules-core/build/NativeModulesProxy.js","../node_modules/expo-modules-core/build/errors/CodedError.js","../node_modules/expo-modules-core/build/environment/browser.js","../node_modules/expo-modules-core/build/Platform.js","../node_modules/expo-modules-core/build/errors/UnavailabilityError.js","../node_modules/expo-modules-core/build/requireNativeModule.js","../node_modules/expo-web-browser/build/ExpoWebBrowser.js","../node_modules/expo-web-browser/build/WebBrowser.types.js","../node_modules/expo-web-browser/build/WebBrowser.js","../src/lib/constants.ts","../src/lib/utils.ts","../src/lib/core.tsx"],"sourcesContent":["// We default to an empty object shim wherever we don't have an environment-specific implementation\n/**\n * @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.\n * Use `requireNativeModule` or `requireOptionalNativeModule` instead.\n */\nexport default {};\n//# sourceMappingURL=NativeModulesProxy.js.map","/**\n * A general error class that should be used for all errors in Expo modules.\n * Guarantees a `code` field that can be used to differentiate between different\n * types of errors without further subclassing Error.\n */\nexport class CodedError extends Error {\n code;\n info;\n constructor(code, message) {\n super(message);\n this.code = code;\n }\n}\n//# sourceMappingURL=CodedError.js.map","// In standard node environments there is no DOM API\nexport const isDOMAvailable = false;\nexport const canUseEventListeners = false;\nexport const canUseViewport = false;\nexport let isAsyncDebugging = false;\nif (__DEV__) {\n // These native globals are injected by native React runtimes and not standard browsers\n // we can use them to determine if the JS is being executed in Chrome.\n isAsyncDebugging =\n !global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;\n}\n//# sourceMappingURL=browser.js.map","import { Platform as ReactNativePlatform } from 'react-native';\nimport { isDOMAvailable, canUseEventListeners, canUseViewport, isAsyncDebugging, } from './environment/browser';\nconst Platform = {\n /**\n * Denotes the currently running platform.\n * Can be one of ios, android, web.\n */\n OS: ReactNativePlatform.OS,\n /**\n * Returns the value with the matching platform.\n * Object keys can be any of ios, android, native, web, default.\n *\n * @ios ios, native, default\n * @android android, native, default\n * @web web, default\n */\n select: ReactNativePlatform.select,\n /**\n * Denotes if the DOM API is available in the current environment.\n * The DOM is not available in native React runtimes and Node.js.\n */\n isDOMAvailable,\n /**\n * Denotes if the current environment can attach event listeners\n * to the window. This will return false in native React\n * runtimes and Node.js.\n */\n canUseEventListeners,\n /**\n * Denotes if the current environment can inspect properties of the\n * screen on which the current window is being rendered. This will\n * return false in native React runtimes and Node.js.\n */\n canUseViewport,\n /**\n * If the JavaScript is being executed in a remote JavaScript environment.\n * When `true`, synchronous native invocations cannot be executed.\n */\n isAsyncDebugging,\n};\nexport default Platform;\n//# sourceMappingURL=Platform.js.map","import { CodedError } from './CodedError';\nimport Platform from '../Platform';\n/**\n * A class for errors to be thrown when a property is accessed which is\n * unavailable, unsupported, or not currently implemented on the running\n * platform.\n */\nexport class UnavailabilityError extends CodedError {\n constructor(moduleName, propertyName) {\n super('ERR_UNAVAILABLE', `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`);\n }\n}\n//# sourceMappingURL=UnavailabilityError.js.map","import { NativeModules } from 'react-native';\nimport NativeModulesProxy from './NativeModulesProxy';\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule(moduleName) {\n const nativeModule = requireOptionalNativeModule(moduleName);\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule(moduleName) {\n ensureNativeModulesAreInstalled();\n return (globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName] ??\n null);\n}\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nfunction ensureNativeModulesAreInstalled() {\n if (globalThis.expo) {\n return;\n }\n try {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n//# sourceMappingURL=requireNativeModule.js.map","import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoWebBrowser');\n//# sourceMappingURL=ExpoWebBrowser.js.map","// @needsAudit @docsMissing\nexport var WebBrowserResultType;\n(function (WebBrowserResultType) {\n /**\n * @platform ios\n */\n WebBrowserResultType[\"CANCEL\"] = \"cancel\";\n /**\n * @platform ios\n */\n WebBrowserResultType[\"DISMISS\"] = \"dismiss\";\n /**\n * @platform android\n */\n WebBrowserResultType[\"OPENED\"] = \"opened\";\n WebBrowserResultType[\"LOCKED\"] = \"locked\";\n})(WebBrowserResultType || (WebBrowserResultType = {}));\n// @needsAudit\n/**\n * A browser presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport var WebBrowserPresentationStyle;\n(function (WebBrowserPresentationStyle) {\n /**\n * A presentation style in which the presented browser covers the screen.\n */\n WebBrowserPresentationStyle[\"FULL_SCREEN\"] = \"fullScreen\";\n /**\n * A presentation style that partially covers the underlying content.\n */\n WebBrowserPresentationStyle[\"PAGE_SHEET\"] = \"pageSheet\";\n /**\n * A presentation style that displays the browser centered in the screen.\n */\n WebBrowserPresentationStyle[\"FORM_SHEET\"] = \"formSheet\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"CURRENT_CONTEXT\"] = \"currentContext\";\n /**\n * A presentation style in which the browser view covers the screen.\n */\n WebBrowserPresentationStyle[\"OVER_FULL_SCREEN\"] = \"overFullScreen\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"OVER_CURRENT_CONTEXT\"] = \"overCurrentContext\";\n /**\n * A presentation style where the browser is displayed in a popover view.\n */\n WebBrowserPresentationStyle[\"POPOVER\"] = \"popover\";\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n WebBrowserPresentationStyle[\"AUTOMATIC\"] = \"automatic\";\n})(WebBrowserPresentationStyle || (WebBrowserPresentationStyle = {}));\n//# sourceMappingURL=WebBrowser.types.js.map","import { UnavailabilityError } from 'expo-modules-core';\nimport { AppState, Linking, Platform, processColor, } from 'react-native';\nimport ExponentWebBrowser from './ExpoWebBrowser';\nimport { WebBrowserResultType, WebBrowserPresentationStyle, } from './WebBrowser.types';\nexport { WebBrowserResultType, WebBrowserPresentationStyle, };\nconst emptyCustomTabsPackages = {\n defaultBrowserPackage: undefined,\n preferredBrowserPackage: undefined,\n browserPackages: [],\n servicePackages: [],\n};\n// @needsAudit\n/**\n * Returns a list of applications package names supporting Custom Tabs, Custom Tabs\n * service, user chosen and preferred one. This may not be fully reliable, since it uses\n * `PackageManager.getResolvingActivities` under the hood. (For example, some browsers might not be\n * present in browserPackages list once another browser is set to default.)\n *\n * @return The promise which fulfils with [`WebBrowserCustomTabsResults`](#webbrowsercustomtabsresults) object.\n * @platform android\n */\nexport async function getCustomTabsSupportingBrowsersAsync() {\n if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) {\n throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync');\n }\n if (Platform.OS !== 'android') {\n return emptyCustomTabsPackages;\n }\n else {\n return await ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync();\n }\n}\n// @needsAudit\n/**\n * This method calls `warmUp` method on [CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient.html#warmup(long))\n * for specified package.\n *\n * @param browserPackage Package of browser to be warmed up. If not set, preferred browser will be warmed.\n *\n * @return A promise which fulfils with `WebBrowserWarmUpResult` object.\n * @platform android\n */\nexport async function warmUpAsync(browserPackage) {\n if (!ExponentWebBrowser.warmUpAsync) {\n throw new UnavailabilityError('WebBrowser', 'warmUpAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.warmUpAsync(browserPackage);\n }\n}\n// @needsAudit\n/**\n * This method initiates (if needed) [CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession.html#maylaunchurl)\n * and calls its `mayLaunchUrl` method for browser specified by the package.\n *\n * @param url The url of page that is likely to be loaded first when opening browser.\n * @param browserPackage Package of browser to be informed. If not set, preferred\n * browser will be used.\n *\n * @return A promise which fulfils with `WebBrowserMayInitWithUrlResult` object.\n * @platform android\n */\nexport async function mayInitWithUrlAsync(url, browserPackage) {\n if (!ExponentWebBrowser.mayInitWithUrlAsync) {\n throw new UnavailabilityError('WebBrowser', 'mayInitWithUrlAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.mayInitWithUrlAsync(url, browserPackage);\n }\n}\n// @needsAudit\n/**\n * This methods removes all bindings to services created by [`warmUpAsync`](#webbrowserwarmupasyncbrowserpackage)\n * or [`mayInitWithUrlAsync`](#webbrowsermayinitwithurlasyncurl-browserpackage). You should call\n * this method once you don't need them to avoid potential memory leaks. However, those binding\n * would be cleared once your application is destroyed, which might be sufficient in most cases.\n *\n * @param browserPackage Package of browser to be cooled. If not set, preferred browser will be used.\n *\n * @return The promise which fulfils with ` WebBrowserCoolDownResult` when cooling is performed, or\n * an empty object when there was no connection to be dismissed.\n * @platform android\n */\nexport async function coolDownAsync(browserPackage) {\n if (!ExponentWebBrowser.coolDownAsync) {\n throw new UnavailabilityError('WebBrowser', 'coolDownAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.coolDownAsync(browserPackage);\n }\n}\nlet browserLocked = false;\n// @needsAudit\n/**\n * Opens the url with Safari in a modal on iOS using [`SFSafariViewController`](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller),\n * and Chrome in a new [custom tab](https://developer.chrome.com/multidevice/android/customtabs)\n * on Android. On iOS, the modal Safari will not share cookies with the system Safari. If you need\n * this, use [`openAuthSessionAsync`](#webbrowseropenauthsessionasyncurl-redirecturl-browserparams).\n *\n * @param url The url to open in the web browser.\n * @param browserParams A dictionary of key-value pairs.\n *\n * @return The promise behaves differently based on the platform.\n * On Android promise resolves with `{type: 'opened'}` if we were able to open browser.\n * On iOS:\n * - If the user closed the web browser, the Promise resolves with `{ type: 'cancel' }`.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser), the Promise resolves with `{ type: 'dismiss' }`.\n */\nexport async function openBrowserAsync(url, browserParams = {}) {\n if (!ExponentWebBrowser.openBrowserAsync) {\n throw new UnavailabilityError('WebBrowser', 'openBrowserAsync');\n }\n if (browserLocked) {\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (__DEV__) {\n console.warn('Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time.');\n }\n return { type: WebBrowserResultType.LOCKED };\n }\n browserLocked = true;\n let result;\n try {\n result = await ExponentWebBrowser.openBrowserAsync(url, _processOptions(browserParams));\n }\n finally {\n // WebBrowser session complete, unset lock\n browserLocked = false;\n }\n return result;\n}\n// @needsAudit\n/**\n * Dismisses the presented web browser.\n *\n * @return The `void` on successful attempt, or throws error, if dismiss functionality is not avaiable.\n * @platform ios\n */\nexport function dismissBrowser() {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissBrowser');\n }\n ExponentWebBrowser.dismissBrowser();\n}\n// @needsAudit\n/**\n * # On Android:\n * This will be done using a \"custom Chrome tabs\" browser, [AppState](https://reactnative.dev/docs/appstate),\n * and [Linking](./linking/) APIs.\n *\n * # On iOS:\n * Opens the url with Safari in a modal using `ASWebAuthenticationSession`. The user will be asked\n * whether to allow the app to authenticate using the given url.\n * To handle redirection back to the mobile application, the redirect URI set in the authentication server\n * has to use the protocol provided as the scheme in **app.json** [`expo.scheme`](./../config/app/#scheme).\n * For example, `demo://` not `https://` protocol.\n * Using `Linking.addEventListener` is not needed and can have side effects.\n *\n * # On web:\n * > This API can only be used in a secure environment (`https`). You can use expo `start:web --https`\n * to test this. Otherwise, an error with code [`ERR_WEB_BROWSER_CRYPTO`](#errwebbrowsercrypto) will be thrown.\n * This will use the browser's [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) API.\n * - _Desktop_: This will create a new web popup window in the browser that can be closed later using `WebBrowser.maybeCompleteAuthSession()`.\n * - _Mobile_: This will open a new tab in the browser which can be closed using `WebBrowser.maybeCompleteAuthSession()`.\n *\n * How this works on web:\n * - A crypto state will be created for verifying the redirect.\n * - This means you need to run with `npx expo start --https`\n * - The state will be added to the window's `localstorage`. This ensures that auth cannot complete\n * unless it's done from a page running with the same origin as it was started.\n * Ex: if `openAuthSessionAsync` is invoked on `https://localhost:19006`, then `maybeCompleteAuthSession`\n * must be invoked on a page hosted from the origin `https://localhost:19006`. Using a different\n * website, or even a different host like `https://128.0.0.*:19006` for example will not work.\n * - A timer will be started to check for every 1000 milliseconds (1 second) to detect if the window\n * has been closed by the user. If this happens then a promise will resolve with `{ type: 'dismiss' }`.\n *\n * > On mobile web, Chrome and Safari will block any call to [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open)\n * which takes too long to fire after a user interaction. This method must be invoked immediately\n * after a user interaction. If the event is blocked, an error with code [`ERR_WEB_BROWSER_BLOCKED`](#errwebbrowserblocked) will be thrown.\n *\n * @param url The url to open in the web browser. This should be a login page.\n * @param redirectUrl _Optional_ - The url to deep link back into your app.\n * On web, this defaults to the output of [`Linking.createURL(\"\")`](./linking/#linkingcreateurlpath-namedparameters).\n * @param options _Optional_ - An object extending the [`WebBrowserOpenOptions`](#webbrowseropenoptions).\n * If there is no native AuthSession implementation available (which is the case on Android)\n * these params will be used in the browser polyfill. If there is a native AuthSession implementation,\n * these params will be ignored.\n *\n * @return\n * - If the user does not permit the application to authenticate with the given url, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the user closed the web browser, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser),\n * the Promise fulfills with `{ type: 'dismiss' }` object.\n */\nexport async function openAuthSessionAsync(url, redirectUrl, options = {}) {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.openAuthSessionAsync) {\n throw new UnavailabilityError('WebBrowser', 'openAuthSessionAsync');\n }\n if (['ios', 'web'].includes(Platform.OS)) {\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl, _processOptions(options));\n }\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl);\n }\n else {\n return _openAuthSessionPolyfillAsync(url, redirectUrl, options);\n }\n}\n// @docsMissing\nexport function dismissAuthSession() {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.dismissAuthSession) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissAuthSession();\n }\n else {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissBrowser();\n }\n}\n// @needsAudit\n/**\n * Possibly completes an authentication session on web in a window popup. The method\n * should be invoked on the page that the window redirects to.\n *\n * @param options\n *\n * @return Returns an object with message about why the redirect failed or succeeded:\n *\n * If `type` is set to `failed`, the reason depends on the message:\n * - `Not supported on this platform`: If the platform doesn't support this method (iOS, Android).\n * - `Cannot use expo-web-browser in a non-browser environment`: If the code was executed in an SSR\n * or node environment.\n * - `No auth session is currently in progress`: (the cached state wasn't found in local storage).\n * This can happen if the window redirects to an origin (website) that is different to the initial\n * website origin. If this happens in development, it may be because the auth started on localhost\n * and finished on your computer port (Ex: `128.0.0.*`). This is controlled by the `redirectUrl`\n * and `returnUrl`.\n * - `Current URL \"<URL>\" and original redirect URL \"<URL>\" do not match`: This can occur when the\n * redirect URL doesn't match what was initial defined as the `returnUrl`. You can skip this test\n * in development by passing `{ skipRedirectCheck: true }` to the function.\n *\n * If `type` is set to `success`, the parent window will attempt to close the child window immediately.\n *\n * If the error `ERR_WEB_BROWSER_REDIRECT` was thrown, it may mean that the parent window was\n * reloaded before the auth was completed. In this case you'll need to close the child window manually.\n *\n * @platform web\n */\nexport function maybeCompleteAuthSession(options = {}) {\n if (ExponentWebBrowser.maybeCompleteAuthSession) {\n return ExponentWebBrowser.maybeCompleteAuthSession(options);\n }\n return { type: 'failed', message: 'Not supported on this platform' };\n}\nfunction _processOptions(options) {\n return {\n ...options,\n controlsColor: processColor(options.controlsColor),\n toolbarColor: processColor(options.toolbarColor),\n secondaryToolbarColor: processColor(options.secondaryToolbarColor),\n };\n}\n/* iOS <= 10 and Android polyfill for SFAuthenticationSession flow */\nfunction _authSessionIsNativelySupported() {\n if (Platform.OS === 'android') {\n return false;\n }\n else if (Platform.OS === 'web') {\n return true;\n }\n const versionNumber = parseInt(String(Platform.Version), 10);\n return versionNumber >= 11;\n}\nlet _redirectSubscription = null;\n/*\n * openBrowserAsync on Android doesn't wait until closed, so we need to polyfill\n * it with AppState\n */\n// Store the `resolve` function from a Promise to fire when the AppState\n// returns to active\nlet _onWebBrowserCloseAndroid = null;\n// If the initial AppState.currentState is null, we assume that the first call to\n// AppState#change event is not actually triggered by a real change,\n// is triggered instead by the bridge capturing the current state\n// (https://reactnative.dev/docs/appstate#basic-usage)\nlet _isAppStateAvailable = AppState.currentState !== null;\nfunction _onAppStateChangeAndroid(state) {\n if (!_isAppStateAvailable) {\n _isAppStateAvailable = true;\n return;\n }\n if (state === 'active' && _onWebBrowserCloseAndroid) {\n _onWebBrowserCloseAndroid();\n }\n}\nasync function _openBrowserAndWaitAndroidAsync(startUrl, browserParams = {}) {\n const appStateChangedToActive = new Promise((resolve) => {\n _onWebBrowserCloseAndroid = resolve;\n });\n const stateChangeSubscription = AppState.addEventListener('change', _onAppStateChangeAndroid);\n let result = { type: WebBrowserResultType.CANCEL };\n let type = null;\n try {\n ({ type } = await openBrowserAsync(startUrl, browserParams));\n }\n catch (e) {\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n throw e;\n }\n if (type === 'opened') {\n await appStateChangedToActive;\n result = { type: WebBrowserResultType.DISMISS };\n }\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n return result;\n}\nasync function _openAuthSessionPolyfillAsync(startUrl, returnUrl, browserParams = {}) {\n if (_redirectSubscription) {\n throw new Error(`The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be`);\n }\n if (_onWebBrowserCloseAndroid) {\n throw new Error(`WebBrowser is already open, only one can be open at a time`);\n }\n try {\n if (Platform.OS === 'android') {\n return await Promise.race([\n _openBrowserAndWaitAndroidAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n else {\n return await Promise.race([\n openBrowserAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n }\n finally {\n // We can't dismiss the browser on Android, only call this when it's available.\n // Users on Android need to manually press the 'x' button in Chrome Custom Tabs, sadly.\n if (ExponentWebBrowser.dismissBrowser) {\n ExponentWebBrowser.dismissBrowser();\n }\n _stopWaitingForRedirect();\n }\n}\nfunction _stopWaitingForRedirect() {\n if (!_redirectSubscription) {\n throw new Error(`The WebBrowser auth session is in an invalid state with no redirect handler when one should be set`);\n }\n _redirectSubscription.remove();\n _redirectSubscription = null;\n}\nfunction _waitForRedirectAsync(returnUrl) {\n // Note that this Promise never resolves when `returnUrl` is nullish\n return new Promise((resolve) => {\n const redirectHandler = (event) => {\n if (returnUrl && event.url.startsWith(returnUrl)) {\n resolve({ url: event.url, type: 'success' });\n }\n };\n _redirectSubscription = Linking.addEventListener('url', redirectHandler);\n });\n}\n//# sourceMappingURL=WebBrowser.js.map","export const SOYIO_WEBVIEW_BASE_URL = 'https://staging.soyio.id';\nexport const SOYIO_REDIRECT_URL = 'demo://';\n","import { RegisterParams, AuthenticateParams, SoyioWidgetParams } from '../types';\nimport { SOYIO_WEBVIEW_BASE_URL } from './constants';\n\nexport function getFlowUrl(options: SoyioWidgetParams, flow: 'authenticate' | 'register'): string {\n const baseUrl = options.developmentUrl ?? SOYIO_WEBVIEW_BASE_URL;\n return `${baseUrl}/widget/${flow}`;\n}\n\nexport function buildUrlParams(\n widgetParams: SoyioWidgetParams,\n flowParams: RegisterParams | AuthenticateParams,\n): string {\n let baseParams = `isMobile=true&companyId=${widgetParams.companyId}`;\n if (widgetParams.userReference) {\n baseParams += `&userReference=${widgetParams.userReference}`;\n }\n const dynamicParams = Object.entries(flowParams)\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join('&');\n\n return `${baseParams}&${dynamicParams}`;\n}\n","import { useCallback } from 'react';\nimport * as WebBrowser from 'expo-web-browser';\nimport { getFlowUrl, buildUrlParams } from './utils';\nimport { SOYIO_REDIRECT_URL } from './constants';\n\nimport type { SoyioWidgetViewPropsType, RegisterParams, AuthenticateParams } from '../types';\n\nexport const useSoyioAuth = ({ options, onEventChange }: SoyioWidgetViewPropsType) => {\n const webBrowserOptions: WebBrowser.AuthSessionOpenOptions = {\n dismissButtonStyle: 'cancel',\n createTask: false,\n enableBarCollapsing: true,\n showTitle: true,\n };\n\n const register = useCallback(async (registerParams: RegisterParams) => {\n const registerBaseUri = getFlowUrl(options, 'register');\n const registerUri = `${registerBaseUri}?${buildUrlParams(options, registerParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open register' });\n\n const registerResult = await WebBrowser.openAuthSessionAsync(\n registerUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n\n if (onEventChange) onEventChange(registerResult);\n }, [options, onEventChange]);\n\n const authenticate = useCallback(async (authenticateParams: AuthenticateParams) => {\n const authenticateBaseUri = getFlowUrl(options, 'authenticate');\n const authenticateUri = `${authenticateBaseUri}?${buildUrlParams(options, authenticateParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open authenticate' });\n const authenticateResult = await WebBrowser.openAuthSessionAsync(\n authenticateUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n if (onEventChange) onEventChange(authenticateResult);\n }, [options, onEventChange]);\n\n return { register, authenticate };\n};\n"],"names":["NativeModulesProxy","CodedError","code","message","__publicField","isDOMAvailable","canUseEventListeners","canUseViewport","isAsyncDebugging","Platform$1","ReactNativePlatform","UnavailabilityError","moduleName","propertyName","Platform","requireNativeModule","nativeModule","requireOptionalNativeModule","ensureNativeModulesAreInstalled","_f","_e","_d","_b","_a","_c","NativeModules","error","ExponentWebBrowser","WebBrowserResultType","WebBrowserPresentationStyle","browserLocked","openBrowserAsync","url","browserParams","result","_processOptions","openAuthSessionAsync","redirectUrl","options","_authSessionIsNativelySupported","_openAuthSessionPolyfillAsync","processColor","_redirectSubscription","_onWebBrowserCloseAndroid","_isAppStateAvailable","AppState","_onAppStateChangeAndroid","state","_openBrowserAndWaitAndroidAsync","startUrl","appStateChangedToActive","resolve","stateChangeSubscription","type","e","returnUrl","_waitForRedirectAsync","_stopWaitingForRedirect","redirectHandler","event","Linking","SOYIO_WEBVIEW_BASE_URL","SOYIO_REDIRECT_URL","getFlowUrl","flow","buildUrlParams","widgetParams","flowParams","baseParams","dynamicParams","key","value","useSoyioAuth","onEventChange","webBrowserOptions","dismissButtonStyle","createTask","enableBarCollapsing","showTitle","register","useCallback","registerParams","registerUri","registerResult","WebBrowser","authenticate","authenticateParams","authenticateUri","authenticateResult"],"mappings":"+fAKA,IAAAA,EAAe,CAAE,ECAV,MAAMC,UAAmB,KAAM,CAGlC,YAAYC,EAAMC,EAAS,CACvB,MAAMA,CAAO,EAHjBC,EAAA,aACAA,EAAA,aAGI,KAAK,KAAOF,CACf,CACL,CCXO,MAAMG,EAAiB,GACjBC,EAAuB,GACvBC,EAAiB,GACvB,IAAIC,EAAmB,GAC1B,UAGAA,EACI,CAAC,OAAO,kBAAoB,CAAC,OAAO,oBAAsB,CAAC,OAAO,eC+B1E,IAAAC,EAtCiB,CAKb,GAAIC,EAAmB,SAAC,GASxB,OAAQA,EAAmB,SAAC,OAK5B,eAAAL,EAMA,qBAAAC,EAMA,eAAAC,EAKA,iBAAAC,CACJ,EChCO,MAAMG,UAA4BV,CAAW,CAChD,YAAYW,EAAYC,EAAc,CAClC,MAAM,kBAAmB,0BAA0BD,KAAcC,yBAAoCC,EAAS,sEAAsE,CACvL,CACL,CCAO,SAASC,EAAoBH,EAAY,CAC5C,MAAMI,EAAeC,EAA4BL,CAAU,EAC3D,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,8BAA8BJ,IAAa,EAE/D,OAAOI,CACX,CAQO,SAASC,EAA4BL,EAAY,iBACpD,OAAAM,KACQC,GAAAC,GAAAC,GAAAC,GAAAC,EAAA,WAAW,OAAX,YAAAA,EAAiB,UAAjB,YAAAD,EAA2BV,KAA3B,KAAAS,GACJG,EAAA,WAAW,cAAX,YAAAA,EAAyBZ,KADrB,KAAAQ,EAEJpB,EAAmBY,KAFf,KAAAO,EAGJ,IACR,CAKA,SAASD,GAAkC,OACvC,GAAI,YAAW,KAGf,GAAI,EAIAO,EAAAA,gBAAc,kBAAdA,MAAAA,EAA+B,gBAClC,OACMC,EAAP,CACI,QAAQ,MAAM,mCAAmCA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B,EAAWzB,EAAS,UAAU,KACZ2B,EAAe3B,EAAS2C,CAAc,IAE5ER,GAA6BA,EAAA,CAAEpB,KAAM,eAAA,CAAiB,EAE1D,MAAM8B,EAAiB,MAAMC,EAC3BF,EACApB,EACAY,CACF,EAEID,GAAeA,EAAcU,CAAc,CAAA,EAC9C,CAAC7C,EAASmC,CAAa,CAAC,EAErBY,EAAeL,cAAY,MAAOM,GAA2C,CAEjF,MAAMC,EAAmB,GADGxB,EAAWzB,EAAS,cAAc,KACZ2B,EAAe3B,EAASgD,CAAkB,IAExFb,GAA6BA,EAAA,CAAEpB,KAAM,mBAAA,CAAqB,EAC9D,MAAMmC,EAAqB,MAAMJ,EAC/BG,EACAzB,EACAY,CACF,EACID,GAAeA,EAAce,CAAkB,CAAA,EAClD,CAAClD,EAASmC,CAAa,CAAC,EAEpB,MAAA,CAAEM,SAAAA,EAAUM,aAAAA,CAAAA,CACrB"}
1
+ {"version":3,"file":"main.umd.js","sources":["../node_modules/expo-modules-core/build/NativeModulesProxy.js","../node_modules/expo-modules-core/build/errors/CodedError.js","../node_modules/expo-modules-core/build/environment/browser.js","../node_modules/expo-modules-core/build/Platform.js","../node_modules/expo-modules-core/build/errors/UnavailabilityError.js","../node_modules/expo-modules-core/build/requireNativeModule.js","../node_modules/expo-web-browser/build/ExpoWebBrowser.js","../node_modules/expo-web-browser/build/WebBrowser.types.js","../node_modules/expo-web-browser/build/WebBrowser.js","../src/lib/constants.ts","../src/lib/utils.ts","../src/lib/core.tsx"],"sourcesContent":["// We default to an empty object shim wherever we don't have an environment-specific implementation\n/**\n * @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.\n * Use `requireNativeModule` or `requireOptionalNativeModule` instead.\n */\nexport default {};\n//# sourceMappingURL=NativeModulesProxy.js.map","/**\n * A general error class that should be used for all errors in Expo modules.\n * Guarantees a `code` field that can be used to differentiate between different\n * types of errors without further subclassing Error.\n */\nexport class CodedError extends Error {\n code;\n info;\n constructor(code, message) {\n super(message);\n this.code = code;\n }\n}\n//# sourceMappingURL=CodedError.js.map","// In standard node environments there is no DOM API\nexport const isDOMAvailable = false;\nexport const canUseEventListeners = false;\nexport const canUseViewport = false;\nexport let isAsyncDebugging = false;\nif (__DEV__) {\n // These native globals are injected by native React runtimes and not standard browsers\n // we can use them to determine if the JS is being executed in Chrome.\n isAsyncDebugging =\n !global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;\n}\n//# sourceMappingURL=browser.js.map","import { Platform as ReactNativePlatform } from 'react-native';\nimport { isDOMAvailable, canUseEventListeners, canUseViewport, isAsyncDebugging, } from './environment/browser';\nconst Platform = {\n /**\n * Denotes the currently running platform.\n * Can be one of ios, android, web.\n */\n OS: ReactNativePlatform.OS,\n /**\n * Returns the value with the matching platform.\n * Object keys can be any of ios, android, native, web, default.\n *\n * @ios ios, native, default\n * @android android, native, default\n * @web web, default\n */\n select: ReactNativePlatform.select,\n /**\n * Denotes if the DOM API is available in the current environment.\n * The DOM is not available in native React runtimes and Node.js.\n */\n isDOMAvailable,\n /**\n * Denotes if the current environment can attach event listeners\n * to the window. This will return false in native React\n * runtimes and Node.js.\n */\n canUseEventListeners,\n /**\n * Denotes if the current environment can inspect properties of the\n * screen on which the current window is being rendered. This will\n * return false in native React runtimes and Node.js.\n */\n canUseViewport,\n /**\n * If the JavaScript is being executed in a remote JavaScript environment.\n * When `true`, synchronous native invocations cannot be executed.\n */\n isAsyncDebugging,\n};\nexport default Platform;\n//# sourceMappingURL=Platform.js.map","import { CodedError } from './CodedError';\nimport Platform from '../Platform';\n/**\n * A class for errors to be thrown when a property is accessed which is\n * unavailable, unsupported, or not currently implemented on the running\n * platform.\n */\nexport class UnavailabilityError extends CodedError {\n constructor(moduleName, propertyName) {\n super('ERR_UNAVAILABLE', `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`);\n }\n}\n//# sourceMappingURL=UnavailabilityError.js.map","import { NativeModules } from 'react-native';\nimport NativeModulesProxy from './NativeModulesProxy';\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule(moduleName) {\n const nativeModule = requireOptionalNativeModule(moduleName);\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule(moduleName) {\n ensureNativeModulesAreInstalled();\n return (globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName] ??\n null);\n}\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nfunction ensureNativeModulesAreInstalled() {\n if (globalThis.expo) {\n return;\n }\n try {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n//# sourceMappingURL=requireNativeModule.js.map","import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoWebBrowser');\n//# sourceMappingURL=ExpoWebBrowser.js.map","// @needsAudit @docsMissing\nexport var WebBrowserResultType;\n(function (WebBrowserResultType) {\n /**\n * @platform ios\n */\n WebBrowserResultType[\"CANCEL\"] = \"cancel\";\n /**\n * @platform ios\n */\n WebBrowserResultType[\"DISMISS\"] = \"dismiss\";\n /**\n * @platform android\n */\n WebBrowserResultType[\"OPENED\"] = \"opened\";\n WebBrowserResultType[\"LOCKED\"] = \"locked\";\n})(WebBrowserResultType || (WebBrowserResultType = {}));\n// @needsAudit\n/**\n * A browser presentation style. Its values are directly mapped to the [`UIModalPresentationStyle`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621355-modalpresentationstyle).\n *\n * @platform ios\n */\nexport var WebBrowserPresentationStyle;\n(function (WebBrowserPresentationStyle) {\n /**\n * A presentation style in which the presented browser covers the screen.\n */\n WebBrowserPresentationStyle[\"FULL_SCREEN\"] = \"fullScreen\";\n /**\n * A presentation style that partially covers the underlying content.\n */\n WebBrowserPresentationStyle[\"PAGE_SHEET\"] = \"pageSheet\";\n /**\n * A presentation style that displays the browser centered in the screen.\n */\n WebBrowserPresentationStyle[\"FORM_SHEET\"] = \"formSheet\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"CURRENT_CONTEXT\"] = \"currentContext\";\n /**\n * A presentation style in which the browser view covers the screen.\n */\n WebBrowserPresentationStyle[\"OVER_FULL_SCREEN\"] = \"overFullScreen\";\n /**\n * A presentation style where the browser is displayed over the app's content.\n */\n WebBrowserPresentationStyle[\"OVER_CURRENT_CONTEXT\"] = \"overCurrentContext\";\n /**\n * A presentation style where the browser is displayed in a popover view.\n */\n WebBrowserPresentationStyle[\"POPOVER\"] = \"popover\";\n /**\n * The default presentation style chosen by the system.\n * On older iOS versions, falls back to `WebBrowserPresentationStyle.FullScreen`.\n *\n * @platform ios 13+\n */\n WebBrowserPresentationStyle[\"AUTOMATIC\"] = \"automatic\";\n})(WebBrowserPresentationStyle || (WebBrowserPresentationStyle = {}));\n//# sourceMappingURL=WebBrowser.types.js.map","import { UnavailabilityError } from 'expo-modules-core';\nimport { AppState, Linking, Platform, processColor, } from 'react-native';\nimport ExponentWebBrowser from './ExpoWebBrowser';\nimport { WebBrowserResultType, WebBrowserPresentationStyle, } from './WebBrowser.types';\nexport { WebBrowserResultType, WebBrowserPresentationStyle, };\nconst emptyCustomTabsPackages = {\n defaultBrowserPackage: undefined,\n preferredBrowserPackage: undefined,\n browserPackages: [],\n servicePackages: [],\n};\n// @needsAudit\n/**\n * Returns a list of applications package names supporting Custom Tabs, Custom Tabs\n * service, user chosen and preferred one. This may not be fully reliable, since it uses\n * `PackageManager.getResolvingActivities` under the hood. (For example, some browsers might not be\n * present in browserPackages list once another browser is set to default.)\n *\n * @return The promise which fulfils with [`WebBrowserCustomTabsResults`](#webbrowsercustomtabsresults) object.\n * @platform android\n */\nexport async function getCustomTabsSupportingBrowsersAsync() {\n if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) {\n throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync');\n }\n if (Platform.OS !== 'android') {\n return emptyCustomTabsPackages;\n }\n else {\n return await ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync();\n }\n}\n// @needsAudit\n/**\n * This method calls `warmUp` method on [CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient.html#warmup(long))\n * for specified package.\n *\n * @param browserPackage Package of browser to be warmed up. If not set, preferred browser will be warmed.\n *\n * @return A promise which fulfils with `WebBrowserWarmUpResult` object.\n * @platform android\n */\nexport async function warmUpAsync(browserPackage) {\n if (!ExponentWebBrowser.warmUpAsync) {\n throw new UnavailabilityError('WebBrowser', 'warmUpAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.warmUpAsync(browserPackage);\n }\n}\n// @needsAudit\n/**\n * This method initiates (if needed) [CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession.html#maylaunchurl)\n * and calls its `mayLaunchUrl` method for browser specified by the package.\n *\n * @param url The url of page that is likely to be loaded first when opening browser.\n * @param browserPackage Package of browser to be informed. If not set, preferred\n * browser will be used.\n *\n * @return A promise which fulfils with `WebBrowserMayInitWithUrlResult` object.\n * @platform android\n */\nexport async function mayInitWithUrlAsync(url, browserPackage) {\n if (!ExponentWebBrowser.mayInitWithUrlAsync) {\n throw new UnavailabilityError('WebBrowser', 'mayInitWithUrlAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.mayInitWithUrlAsync(url, browserPackage);\n }\n}\n// @needsAudit\n/**\n * This methods removes all bindings to services created by [`warmUpAsync`](#webbrowserwarmupasyncbrowserpackage)\n * or [`mayInitWithUrlAsync`](#webbrowsermayinitwithurlasyncurl-browserpackage). You should call\n * this method once you don't need them to avoid potential memory leaks. However, those binding\n * would be cleared once your application is destroyed, which might be sufficient in most cases.\n *\n * @param browserPackage Package of browser to be cooled. If not set, preferred browser will be used.\n *\n * @return The promise which fulfils with ` WebBrowserCoolDownResult` when cooling is performed, or\n * an empty object when there was no connection to be dismissed.\n * @platform android\n */\nexport async function coolDownAsync(browserPackage) {\n if (!ExponentWebBrowser.coolDownAsync) {\n throw new UnavailabilityError('WebBrowser', 'coolDownAsync');\n }\n if (Platform.OS !== 'android') {\n return {};\n }\n else {\n return await ExponentWebBrowser.coolDownAsync(browserPackage);\n }\n}\nlet browserLocked = false;\n// @needsAudit\n/**\n * Opens the url with Safari in a modal on iOS using [`SFSafariViewController`](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller),\n * and Chrome in a new [custom tab](https://developer.chrome.com/multidevice/android/customtabs)\n * on Android. On iOS, the modal Safari will not share cookies with the system Safari. If you need\n * this, use [`openAuthSessionAsync`](#webbrowseropenauthsessionasyncurl-redirecturl-browserparams).\n *\n * @param url The url to open in the web browser.\n * @param browserParams A dictionary of key-value pairs.\n *\n * @return The promise behaves differently based on the platform.\n * On Android promise resolves with `{type: 'opened'}` if we were able to open browser.\n * On iOS:\n * - If the user closed the web browser, the Promise resolves with `{ type: 'cancel' }`.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser), the Promise resolves with `{ type: 'dismiss' }`.\n */\nexport async function openBrowserAsync(url, browserParams = {}) {\n if (!ExponentWebBrowser.openBrowserAsync) {\n throw new UnavailabilityError('WebBrowser', 'openBrowserAsync');\n }\n if (browserLocked) {\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (__DEV__) {\n console.warn('Attempted to call WebBrowser.openBrowserAsync multiple times while already active. Only one WebBrowser controller can be active at any given time.');\n }\n return { type: WebBrowserResultType.LOCKED };\n }\n browserLocked = true;\n let result;\n try {\n result = await ExponentWebBrowser.openBrowserAsync(url, _processOptions(browserParams));\n }\n finally {\n // WebBrowser session complete, unset lock\n browserLocked = false;\n }\n return result;\n}\n// @needsAudit\n/**\n * Dismisses the presented web browser.\n *\n * @return The `void` on successful attempt, or throws error, if dismiss functionality is not avaiable.\n * @platform ios\n */\nexport function dismissBrowser() {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissBrowser');\n }\n ExponentWebBrowser.dismissBrowser();\n}\n// @needsAudit\n/**\n * # On Android:\n * This will be done using a \"custom Chrome tabs\" browser, [AppState](https://reactnative.dev/docs/appstate),\n * and [Linking](./linking/) APIs.\n *\n * # On iOS:\n * Opens the url with Safari in a modal using `ASWebAuthenticationSession`. The user will be asked\n * whether to allow the app to authenticate using the given url.\n * To handle redirection back to the mobile application, the redirect URI set in the authentication server\n * has to use the protocol provided as the scheme in **app.json** [`expo.scheme`](./../config/app/#scheme).\n * For example, `demo://` not `https://` protocol.\n * Using `Linking.addEventListener` is not needed and can have side effects.\n *\n * # On web:\n * > This API can only be used in a secure environment (`https`). You can use expo `start:web --https`\n * to test this. Otherwise, an error with code [`ERR_WEB_BROWSER_CRYPTO`](#errwebbrowsercrypto) will be thrown.\n * This will use the browser's [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) API.\n * - _Desktop_: This will create a new web popup window in the browser that can be closed later using `WebBrowser.maybeCompleteAuthSession()`.\n * - _Mobile_: This will open a new tab in the browser which can be closed using `WebBrowser.maybeCompleteAuthSession()`.\n *\n * How this works on web:\n * - A crypto state will be created for verifying the redirect.\n * - This means you need to run with `npx expo start --https`\n * - The state will be added to the window's `localstorage`. This ensures that auth cannot complete\n * unless it's done from a page running with the same origin as it was started.\n * Ex: if `openAuthSessionAsync` is invoked on `https://localhost:19006`, then `maybeCompleteAuthSession`\n * must be invoked on a page hosted from the origin `https://localhost:19006`. Using a different\n * website, or even a different host like `https://128.0.0.*:19006` for example will not work.\n * - A timer will be started to check for every 1000 milliseconds (1 second) to detect if the window\n * has been closed by the user. If this happens then a promise will resolve with `{ type: 'dismiss' }`.\n *\n * > On mobile web, Chrome and Safari will block any call to [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open)\n * which takes too long to fire after a user interaction. This method must be invoked immediately\n * after a user interaction. If the event is blocked, an error with code [`ERR_WEB_BROWSER_BLOCKED`](#errwebbrowserblocked) will be thrown.\n *\n * @param url The url to open in the web browser. This should be a login page.\n * @param redirectUrl _Optional_ - The url to deep link back into your app.\n * On web, this defaults to the output of [`Linking.createURL(\"\")`](./linking/#linkingcreateurlpath-namedparameters).\n * @param options _Optional_ - An object extending the [`WebBrowserOpenOptions`](#webbrowseropenoptions).\n * If there is no native AuthSession implementation available (which is the case on Android)\n * these params will be used in the browser polyfill. If there is a native AuthSession implementation,\n * these params will be ignored.\n *\n * @return\n * - If the user does not permit the application to authenticate with the given url, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the user closed the web browser, the Promise fulfills with `{ type: 'cancel' }` object.\n * - If the browser is closed using [`dismissBrowser`](#webbrowserdismissbrowser),\n * the Promise fulfills with `{ type: 'dismiss' }` object.\n */\nexport async function openAuthSessionAsync(url, redirectUrl, options = {}) {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.openAuthSessionAsync) {\n throw new UnavailabilityError('WebBrowser', 'openAuthSessionAsync');\n }\n if (['ios', 'web'].includes(Platform.OS)) {\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl, _processOptions(options));\n }\n return ExponentWebBrowser.openAuthSessionAsync(url, redirectUrl);\n }\n else {\n return _openAuthSessionPolyfillAsync(url, redirectUrl, options);\n }\n}\n// @docsMissing\nexport function dismissAuthSession() {\n if (_authSessionIsNativelySupported()) {\n if (!ExponentWebBrowser.dismissAuthSession) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissAuthSession();\n }\n else {\n if (!ExponentWebBrowser.dismissBrowser) {\n throw new UnavailabilityError('WebBrowser', 'dismissAuthSession');\n }\n ExponentWebBrowser.dismissBrowser();\n }\n}\n// @needsAudit\n/**\n * Possibly completes an authentication session on web in a window popup. The method\n * should be invoked on the page that the window redirects to.\n *\n * @param options\n *\n * @return Returns an object with message about why the redirect failed or succeeded:\n *\n * If `type` is set to `failed`, the reason depends on the message:\n * - `Not supported on this platform`: If the platform doesn't support this method (iOS, Android).\n * - `Cannot use expo-web-browser in a non-browser environment`: If the code was executed in an SSR\n * or node environment.\n * - `No auth session is currently in progress`: (the cached state wasn't found in local storage).\n * This can happen if the window redirects to an origin (website) that is different to the initial\n * website origin. If this happens in development, it may be because the auth started on localhost\n * and finished on your computer port (Ex: `128.0.0.*`). This is controlled by the `redirectUrl`\n * and `returnUrl`.\n * - `Current URL \"<URL>\" and original redirect URL \"<URL>\" do not match`: This can occur when the\n * redirect URL doesn't match what was initial defined as the `returnUrl`. You can skip this test\n * in development by passing `{ skipRedirectCheck: true }` to the function.\n *\n * If `type` is set to `success`, the parent window will attempt to close the child window immediately.\n *\n * If the error `ERR_WEB_BROWSER_REDIRECT` was thrown, it may mean that the parent window was\n * reloaded before the auth was completed. In this case you'll need to close the child window manually.\n *\n * @platform web\n */\nexport function maybeCompleteAuthSession(options = {}) {\n if (ExponentWebBrowser.maybeCompleteAuthSession) {\n return ExponentWebBrowser.maybeCompleteAuthSession(options);\n }\n return { type: 'failed', message: 'Not supported on this platform' };\n}\nfunction _processOptions(options) {\n return {\n ...options,\n controlsColor: processColor(options.controlsColor),\n toolbarColor: processColor(options.toolbarColor),\n secondaryToolbarColor: processColor(options.secondaryToolbarColor),\n };\n}\n/* iOS <= 10 and Android polyfill for SFAuthenticationSession flow */\nfunction _authSessionIsNativelySupported() {\n if (Platform.OS === 'android') {\n return false;\n }\n else if (Platform.OS === 'web') {\n return true;\n }\n const versionNumber = parseInt(String(Platform.Version), 10);\n return versionNumber >= 11;\n}\nlet _redirectSubscription = null;\n/*\n * openBrowserAsync on Android doesn't wait until closed, so we need to polyfill\n * it with AppState\n */\n// Store the `resolve` function from a Promise to fire when the AppState\n// returns to active\nlet _onWebBrowserCloseAndroid = null;\n// If the initial AppState.currentState is null, we assume that the first call to\n// AppState#change event is not actually triggered by a real change,\n// is triggered instead by the bridge capturing the current state\n// (https://reactnative.dev/docs/appstate#basic-usage)\nlet _isAppStateAvailable = AppState.currentState !== null;\nfunction _onAppStateChangeAndroid(state) {\n if (!_isAppStateAvailable) {\n _isAppStateAvailable = true;\n return;\n }\n if (state === 'active' && _onWebBrowserCloseAndroid) {\n _onWebBrowserCloseAndroid();\n }\n}\nasync function _openBrowserAndWaitAndroidAsync(startUrl, browserParams = {}) {\n const appStateChangedToActive = new Promise((resolve) => {\n _onWebBrowserCloseAndroid = resolve;\n });\n const stateChangeSubscription = AppState.addEventListener('change', _onAppStateChangeAndroid);\n let result = { type: WebBrowserResultType.CANCEL };\n let type = null;\n try {\n ({ type } = await openBrowserAsync(startUrl, browserParams));\n }\n catch (e) {\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n throw e;\n }\n if (type === 'opened') {\n await appStateChangedToActive;\n result = { type: WebBrowserResultType.DISMISS };\n }\n stateChangeSubscription.remove();\n _onWebBrowserCloseAndroid = null;\n return result;\n}\nasync function _openAuthSessionPolyfillAsync(startUrl, returnUrl, browserParams = {}) {\n if (_redirectSubscription) {\n throw new Error(`The WebBrowser's auth session is in an invalid state with a redirect handler set when it should not be`);\n }\n if (_onWebBrowserCloseAndroid) {\n throw new Error(`WebBrowser is already open, only one can be open at a time`);\n }\n try {\n if (Platform.OS === 'android') {\n return await Promise.race([\n _openBrowserAndWaitAndroidAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n else {\n return await Promise.race([\n openBrowserAsync(startUrl, browserParams),\n _waitForRedirectAsync(returnUrl),\n ]);\n }\n }\n finally {\n // We can't dismiss the browser on Android, only call this when it's available.\n // Users on Android need to manually press the 'x' button in Chrome Custom Tabs, sadly.\n if (ExponentWebBrowser.dismissBrowser) {\n ExponentWebBrowser.dismissBrowser();\n }\n _stopWaitingForRedirect();\n }\n}\nfunction _stopWaitingForRedirect() {\n if (!_redirectSubscription) {\n throw new Error(`The WebBrowser auth session is in an invalid state with no redirect handler when one should be set`);\n }\n _redirectSubscription.remove();\n _redirectSubscription = null;\n}\nfunction _waitForRedirectAsync(returnUrl) {\n // Note that this Promise never resolves when `returnUrl` is nullish\n return new Promise((resolve) => {\n const redirectHandler = (event) => {\n if (returnUrl && event.url.startsWith(returnUrl)) {\n resolve({ url: event.url, type: 'success' });\n }\n };\n _redirectSubscription = Linking.addEventListener('url', redirectHandler);\n });\n}\n//# sourceMappingURL=WebBrowser.js.map","export const PRODUCTION_URL = 'https://app.soyio.id/widget';\nexport const SANDBOX_URL = 'https://sandbox.soyio.id/widget';\nexport const SOYIO_REDIRECT_URL = 'demo://';\n","import { RegisterParams, AuthenticateParams, SoyioWidgetParams } from '../types';\nimport { PRODUCTION_URL, SANDBOX_URL } from './constants';\n\nexport function getFlowUrl(\n options: SoyioWidgetParams,\n flow: 'authenticate' | 'register',\n): string {\n const baseUrl = options.developmentUrl || (options.isSandBox ? SANDBOX_URL : PRODUCTION_URL);\n return `${baseUrl}/${flow}`;\n}\n\nexport function buildUrlParams(\n widgetParams: SoyioWidgetParams,\n flowParams: RegisterParams | AuthenticateParams,\n): string {\n let baseParams = `platform=rn&companyId=${widgetParams.companyId}`;\n if (widgetParams.userReference) {\n baseParams += `&userReference=${widgetParams.userReference}`;\n }\n const dynamicParams = Object.entries(flowParams)\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join('&');\n\n return `${baseParams}&${dynamicParams}`;\n}\n","import { useCallback } from 'react';\nimport * as WebBrowser from 'expo-web-browser';\nimport { getFlowUrl, buildUrlParams } from './utils';\nimport { SOYIO_REDIRECT_URL } from './constants';\n\nimport type { SoyioWidgetViewPropsType, RegisterParams, AuthenticateParams } from '../types';\n\nexport const useSoyioAuth = ({ options, onEventChange }: SoyioWidgetViewPropsType) => {\n const webBrowserOptions: WebBrowser.AuthSessionOpenOptions = {\n dismissButtonStyle: 'cancel',\n createTask: false,\n enableBarCollapsing: true,\n showTitle: true,\n };\n\n const register = useCallback(async (registerParams: RegisterParams) => {\n const registerBaseUri = getFlowUrl(options, 'register');\n const registerUri = `${registerBaseUri}?${buildUrlParams(options, registerParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open register' });\n\n const registerResult = await WebBrowser.openAuthSessionAsync(\n registerUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n\n if (onEventChange) onEventChange(registerResult);\n }, [options, onEventChange]);\n\n const authenticate = useCallback(async (authenticateParams: AuthenticateParams) => {\n const authenticateBaseUri = getFlowUrl(options, 'authenticate');\n const authenticateUri = `${authenticateBaseUri}?${buildUrlParams(options, authenticateParams)}`;\n\n if (onEventChange) onEventChange({ type: 'open authenticate' });\n const authenticateResult = await WebBrowser.openAuthSessionAsync(\n authenticateUri,\n SOYIO_REDIRECT_URL,\n webBrowserOptions,\n );\n if (onEventChange) onEventChange(authenticateResult);\n }, [options, onEventChange]);\n\n return { register, authenticate };\n};\n"],"names":["NativeModulesProxy","CodedError","code","message","__publicField","isDOMAvailable","canUseEventListeners","canUseViewport","isAsyncDebugging","Platform$1","ReactNativePlatform","UnavailabilityError","moduleName","propertyName","Platform","requireNativeModule","nativeModule","requireOptionalNativeModule","ensureNativeModulesAreInstalled","_f","_e","_d","_b","_a","_c","NativeModules","error","ExponentWebBrowser","WebBrowserResultType","WebBrowserPresentationStyle","browserLocked","openBrowserAsync","url","browserParams","result","_processOptions","openAuthSessionAsync","redirectUrl","options","_authSessionIsNativelySupported","_openAuthSessionPolyfillAsync","processColor","_redirectSubscription","_onWebBrowserCloseAndroid","_isAppStateAvailable","AppState","_onAppStateChangeAndroid","state","_openBrowserAndWaitAndroidAsync","startUrl","appStateChangedToActive","resolve","stateChangeSubscription","type","e","returnUrl","_waitForRedirectAsync","_stopWaitingForRedirect","redirectHandler","event","Linking","PRODUCTION_URL","SANDBOX_URL","SOYIO_REDIRECT_URL","getFlowUrl","flow","buildUrlParams","widgetParams","flowParams","baseParams","dynamicParams","key","value","useSoyioAuth","onEventChange","webBrowserOptions","dismissButtonStyle","createTask","enableBarCollapsing","showTitle","register","useCallback","registerParams","registerUri","registerResult","WebBrowser","authenticate","authenticateParams","authenticateUri","authenticateResult"],"mappings":"+fAKA,IAAAA,EAAe,CAAE,ECAV,MAAMC,UAAmB,KAAM,CAGlC,YAAYC,EAAMC,EAAS,CACvB,MAAMA,CAAO,EAHjBC,EAAA,aACAA,EAAA,aAGI,KAAK,KAAOF,CACf,CACL,CCXO,MAAMG,EAAiB,GACjBC,EAAuB,GACvBC,EAAiB,GACvB,IAAIC,EAAmB,GAC1B,UAGAA,EACI,CAAC,OAAO,kBAAoB,CAAC,OAAO,oBAAsB,CAAC,OAAO,eC+B1E,IAAAC,EAtCiB,CAKb,GAAIC,EAAmB,SAAC,GASxB,OAAQA,EAAmB,SAAC,OAK5B,eAAAL,EAMA,qBAAAC,EAMA,eAAAC,EAKA,iBAAAC,CACJ,EChCO,MAAMG,UAA4BV,CAAW,CAChD,YAAYW,EAAYC,EAAc,CAClC,MAAM,kBAAmB,0BAA0BD,KAAcC,yBAAoCC,EAAS,sEAAsE,CACvL,CACL,CCAO,SAASC,EAAoBH,EAAY,CAC5C,MAAMI,EAAeC,EAA4BL,CAAU,EAC3D,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,8BAA8BJ,IAAa,EAE/D,OAAOI,CACX,CAQO,SAASC,EAA4BL,EAAY,iBACpD,OAAAM,KACQC,GAAAC,GAAAC,GAAAC,GAAAC,EAAA,WAAW,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,GAAGD,KAAO,mBAAmBC,CAAK,GAAG,EAC3D,KAAK,GAAG,EAEX,MAAO,GAAGH,KAAcC,GAC1B,CCjBaG,MAAAA,EAAeA,CAAC,CAAEnC,QAAAA,EAASoC,cAAAA,CAAwC,IAAM,CACpF,MAAMC,EAAuD,CAC3DC,mBAAoB,SACpBC,WAAY,GACZC,oBAAqB,GACrBC,UAAW,EAAA,EAGPC,EAAWC,cAAY,MAAOC,GAAmC,CAErE,MAAMC,EAAe,GADGnB,EAAW1B,EAAS,UAAU,KACZ4B,EAAe5B,EAAS4C,CAAc,IAE5ER,GAA6BA,EAAA,CAAErB,KAAM,eAAA,CAAiB,EAE1D,MAAM+B,EAAiB,MAAMC,EAC3BF,EACApB,EACAY,CACF,EAEID,GAAeA,EAAcU,CAAc,CAAA,EAC9C,CAAC9C,EAASoC,CAAa,CAAC,EAErBY,EAAeL,cAAY,MAAOM,GAA2C,CAEjF,MAAMC,EAAmB,GADGxB,EAAW1B,EAAS,cAAc,KACZ4B,EAAe5B,EAASiD,CAAkB,IAExFb,GAA6BA,EAAA,CAAErB,KAAM,mBAAA,CAAqB,EAC9D,MAAMoC,EAAqB,MAAMJ,EAC/BG,EACAzB,EACAY,CACF,EACID,GAAeA,EAAce,CAAkB,CAAA,EAClD,CAACnD,EAASoC,CAAa,CAAC,EAEpB,MAAA,CAAEM,SAAAA,EAAUM,aAAAA,CAAAA,CACrB"}
@@ -1,3 +1,4 @@
1
- export declare const SOYIO_WEBVIEW_BASE_URL = "https://staging.soyio.id";
1
+ export declare const PRODUCTION_URL = "https://app.soyio.id/widget";
2
+ export declare const SANDBOX_URL = "https://sandbox.soyio.id/widget";
2
3
  export declare const SOYIO_REDIRECT_URL = "demo://";
3
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AACjE,eAAO,MAAM,kBAAkB,YAAY,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAC5D,eAAO,MAAM,WAAW,oCAAoC,CAAC;AAC7D,eAAO,MAAM,kBAAkB,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjF,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,GAAG,UAAU,GAAG,MAAM,CAGhG;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,iBAAiB,EAC/B,UAAU,EAAE,cAAc,GAAG,kBAAkB,GAC9C,MAAM,CAUR"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjF,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,cAAc,GAAG,UAAU,GAChC,MAAM,CAGR;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,iBAAiB,EAC/B,UAAU,EAAE,cAAc,GAAG,kBAAkB,GAC9C,MAAM,CAUR"}
@@ -1,6 +1,7 @@
1
1
  export type SoyioWidgetParams = {
2
2
  companyId: string;
3
3
  userReference?: string;
4
+ isSandBox?: boolean;
4
5
  developmentUrl?: string;
5
6
  };
6
7
  export type RegisterParams = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyio/soyio-rn-sdk",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Soyio-id/soyio-webview-rn.git"
@@ -1,2 +1,3 @@
1
- export const SOYIO_WEBVIEW_BASE_URL = 'https://staging.soyio.id';
1
+ export const PRODUCTION_URL = 'https://app.soyio.id/widget';
2
+ export const SANDBOX_URL = 'https://sandbox.soyio.id/widget';
2
3
  export const SOYIO_REDIRECT_URL = 'demo://';
package/src/lib/utils.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import { RegisterParams, AuthenticateParams, SoyioWidgetParams } from '../types';
2
- import { SOYIO_WEBVIEW_BASE_URL } from './constants';
2
+ import { PRODUCTION_URL, SANDBOX_URL } from './constants';
3
3
 
4
- export function getFlowUrl(options: SoyioWidgetParams, flow: 'authenticate' | 'register'): string {
5
- const baseUrl = options.developmentUrl ?? SOYIO_WEBVIEW_BASE_URL;
6
- return `${baseUrl}/widget/${flow}`;
4
+ export function getFlowUrl(
5
+ options: SoyioWidgetParams,
6
+ flow: 'authenticate' | 'register',
7
+ ): string {
8
+ const baseUrl = options.developmentUrl || (options.isSandBox ? SANDBOX_URL : PRODUCTION_URL);
9
+ return `${baseUrl}/${flow}`;
7
10
  }
8
11
 
9
12
  export function buildUrlParams(
10
13
  widgetParams: SoyioWidgetParams,
11
14
  flowParams: RegisterParams | AuthenticateParams,
12
15
  ): string {
13
- let baseParams = `isMobile=true&companyId=${widgetParams.companyId}`;
16
+ let baseParams = `platform=rn&companyId=${widgetParams.companyId}`;
14
17
  if (widgetParams.userReference) {
15
18
  baseParams += `&userReference=${widgetParams.userReference}`;
16
19
  }
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type SoyioWidgetParams = {
2
2
  companyId: string
3
3
  userReference?: string;
4
+ isSandBox?: boolean;
4
5
  developmentUrl?: string;
5
6
  }
6
7