@frontegg/ionic-capacitor 2.0.11-alpha.21904007461 → 2.0.11-alpha.22584795706

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.
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency "FronteggSwift", "1.2.23"
16
+ s.dependency "FronteggSwift", "1.2.76"
17
17
  s.swift_version = '5.1'
18
18
  s.pod_target_xcconfig = {
19
19
  'CODE_SIGNING_ALLOWED' => 'YES'
@@ -11,7 +11,7 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.0.0'
14
+ classpath 'com.android.tools.build:gradle:8.6.0'
15
15
  }
16
16
  }
17
17
 
@@ -26,6 +26,13 @@ android {
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29
+
30
+
31
+ manifestPlaceholders = [
32
+ package_name : "com.frontegg.demo",
33
+ frontegg_domain : "auth.davidantoon.me",
34
+ frontegg_client_id: "b6adfe4c-d695-4c04-b95f-3ec9fd0c6cca"
35
+ ]
29
36
  }
30
37
  buildTypes {
31
38
  release {
@@ -55,7 +62,7 @@ dependencies {
55
62
  implementation "androidx.browser:browser:1.8.0"
56
63
  implementation 'io.reactivex.rxjava3:rxkotlin:3.0.1'
57
64
  implementation 'com.google.code.gson:gson:2.10'
58
- implementation 'com.frontegg.sdk:android:1.2.28'
65
+ implementation 'com.frontegg.sdk:android:1.3.18'
59
66
 
60
67
  testImplementation "junit:junit:$junitVersion"
61
68
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -0,0 +1,9 @@
1
+ // Resolve path: repo root (../node_modules) or plugin inside app's node_modules (../../../node_modules)
2
+ def capacitorAndroidDir = new File(settingsDir, '../node_modules/@capacitor/android/capacitor')
3
+ if (!capacitorAndroidDir.exists()) {
4
+ capacitorAndroidDir = new File(settingsDir, '../../../node_modules/@capacitor/android/capacitor')
5
+ }
6
+ if (capacitorAndroidDir.exists()) {
7
+ include ':capacitor-android'
8
+ project(':capacitor-android').projectDir = capacitorAndroidDir
9
+ }
@@ -5,7 +5,10 @@ import android.os.Handler;
5
5
  import android.os.Looper;
6
6
  import android.util.Log;
7
7
 
8
+ import kotlin.Unit;
9
+
8
10
  import com.frontegg.android.FronteggApp;
11
+ import com.frontegg.android.FronteggAppKt;
9
12
  import com.frontegg.android.FronteggAuth;
10
13
  import com.frontegg.android.models.User;
11
14
  import com.frontegg.android.regions.RegionConfig;
@@ -43,11 +46,21 @@ public class FronteggNativePlugin extends Plugin {
43
46
  Log.d("FronteggNative", "Loading FronteggNativePlugin");
44
47
  // for regions initialization
45
48
  List<RegionConfig> regions = new ArrayList<>();
46
- boolean useAssetLinks = this.getConfig().getBoolean("useAssetLinks", true);
47
- boolean useChromeCustomTabs = this.getConfig().getBoolean("useChromeCustomTabs", false);
49
+ boolean useAssetLinks = false;
50
+ boolean useChromeCustomTabs = false;
48
51
  JSONArray array;
49
52
  try {
50
- array = this.getConfig().getConfigJSON().optJSONArray("regions");
53
+ JSONObject configJson = this.getConfig().getConfigJSON();
54
+
55
+ useAssetLinks = configJson.has("useAssetLinks")
56
+ ? configJson.optBoolean("useAssetLinks", false)
57
+ : false;
58
+
59
+ useChromeCustomTabs = configJson.has("useChromeCustomTabs")
60
+ ? configJson.optBoolean("useChromeCustomTabs", false)
61
+ : false;
62
+
63
+ array = configJson.optJSONArray("regions");
51
64
 
52
65
  if (array == null) {
53
66
  array = new JSONArray();
@@ -70,6 +83,18 @@ public class FronteggNativePlugin extends Plugin {
70
83
  throw new RuntimeException(e);
71
84
  }
72
85
 
86
+ Class<?> mainActivityClass = resolveMainActivityClass();
87
+ String deepLinkScheme;
88
+ if (useAssetLinks) {
89
+ deepLinkScheme = null;
90
+ } else {
91
+ deepLinkScheme = this.getConfig().getString("deepLinkScheme");
92
+ if (deepLinkScheme == null || deepLinkScheme.isEmpty()) {
93
+ deepLinkScheme = this.getContext().getPackageName();
94
+ }
95
+ }
96
+ boolean useDiskCacheWebView = this.getConfig().getBoolean("useDiskCacheWebView", false);
97
+
73
98
  if (regions.isEmpty()) {
74
99
  PluginConfig config = this.getConfig();
75
100
  String baseUrl = config.getString("baseUrl");
@@ -82,13 +107,18 @@ public class FronteggNativePlugin extends Plugin {
82
107
  if (baseUrl.startsWith("https://")) {
83
108
  baseUrl = baseUrl.substring(baseUrl.indexOf("://") + 3);
84
109
  }
85
- FronteggApp.Companion.init(
110
+ FronteggApp.Companion.init$android_release(
86
111
  baseUrl,
87
112
  clientId,
88
113
  this.getContext(),
89
114
  applicationId,
90
115
  useAssetLinks,
91
116
  useChromeCustomTabs,
117
+ mainActivityClass,
118
+ deepLinkScheme,
119
+ useDiskCacheWebView,
120
+ false,
121
+ false,
92
122
  null
93
123
  );
94
124
  } else {
@@ -97,11 +127,15 @@ public class FronteggNativePlugin extends Plugin {
97
127
  this.getContext(),
98
128
  useAssetLinks,
99
129
  useChromeCustomTabs,
130
+ mainActivityClass,
131
+ useDiskCacheWebView,
132
+ false,
133
+ false,
100
134
  null
101
135
  );
102
136
  }
103
137
 
104
- FronteggAuth auth = FronteggAuth.Companion.getInstance();
138
+ FronteggAuth auth = FronteggAppKt.getFronteggAuth(this.getContext());
105
139
 
106
140
  if (this.disposable != null) {
107
141
  this.disposable.dispose();
@@ -122,20 +156,33 @@ public class FronteggNativePlugin extends Plugin {
122
156
  sendEvent();
123
157
  }
124
158
 
159
+ private Class<?> resolveMainActivityClass() {
160
+ String className = this.getConfig().getString("mainActivityClass");
161
+ if (className == null || className.isEmpty()) {
162
+ className = this.getContext().getPackageName() + ".MainActivity";
163
+ }
164
+ try {
165
+ return Class.forName(className);
166
+ } catch (ClassNotFoundException e) {
167
+ Log.w("FronteggNative", "MainActivity class not found: " + className + ", using null");
168
+ return null;
169
+ }
170
+ }
171
+
125
172
  private void sendEvent() {
126
173
  JSObject data = getData();
127
174
  notifyListeners("onFronteggAuthEvent", data);
128
175
  }
129
176
 
130
177
  private JSObject getData() {
131
- FronteggAuth auth = FronteggAuth.Companion.getInstance();
178
+ FronteggAuth auth = FronteggAppKt.getFronteggAuth(this.getContext());
132
179
  String accessToken = auth.getAccessToken().getValue();
133
180
  String refreshToken = auth.getRefreshToken().getValue();
134
181
  User user = auth.getUser().getValue();
135
182
  boolean isAuthenticated = auth.isAuthenticated().getValue();
136
- boolean isLoading = auth.isLoading().getValue();
137
- boolean initializing = auth.getInitializing().getValue();
138
183
  boolean showLoader = auth.getShowLoader().getValue();
184
+ boolean isLoading = showLoader;
185
+ boolean initializing = auth.getInitializing().getValue();
139
186
  boolean refreshingToken = auth.getRefreshingToken().getValue();
140
187
  RegionConfig selectedRegion = auth.getSelectedRegion();
141
188
 
@@ -160,9 +207,9 @@ public class FronteggNativePlugin extends Plugin {
160
207
  @PluginMethod
161
208
  public void login(PluginCall call) {
162
209
  String loginHint = call.getString("loginHint");
163
- FronteggApp.Companion.getInstance().getAuth().login(this.getActivity(), loginHint, ()-> {
210
+ FronteggAppKt.getFronteggAuth(this.getContext()).login(this.getActivity(), loginHint != null ? loginHint : "", null, (Exception e) -> {
164
211
  call.resolve();
165
- return null;
212
+ return Unit.INSTANCE;
166
213
  });
167
214
  }
168
215
 
@@ -175,15 +222,15 @@ public class FronteggNativePlugin extends Plugin {
175
222
  call.reject("No type or data provided");
176
223
  return;
177
224
  }
178
- FronteggApp.Companion.getInstance().getAuth().directLoginAction(this.getActivity(), type, data, () -> {
225
+ FronteggAppKt.getFronteggAuth(this.getContext()).directLoginAction(this.getActivity(), type, data, (Exception e) -> {
179
226
  call.resolve();
180
- return null;
227
+ return Unit.INSTANCE;
181
228
  });
182
229
  }
183
230
 
184
231
  @PluginMethod
185
232
  public void logout(PluginCall call) {
186
- FronteggApp.Companion.getInstance().getAuth().logout(() -> {
233
+ FronteggAppKt.getFronteggAuth(this.getContext()).logout(() -> {
187
234
  call.resolve();
188
235
  return null;
189
236
  });
@@ -196,7 +243,7 @@ public class FronteggNativePlugin extends Plugin {
196
243
  call.reject("No tenantId provided");
197
244
  return;
198
245
  }
199
- FronteggApp.Companion.getInstance().getAuth().switchTenant(tenantId, (success) -> {
246
+ FronteggAppKt.getFronteggAuth(this.getContext()).switchTenant(tenantId, (success) -> {
200
247
  JSObject result = new JSObject();
201
248
  result.put("success", success);
202
249
  call.resolve((JSObject) result);
@@ -214,7 +261,7 @@ public class FronteggNativePlugin extends Plugin {
214
261
  }
215
262
  ExecutorService executor = Executors.newSingleThreadExecutor();
216
263
  executor.submit(() -> {
217
- FronteggApp.Companion.getInstance().initWithRegion(regionKey);
264
+ FronteggApp.Companion.getInstance$android_release().initWithRegion(regionKey);
218
265
  Handler handler = new Handler(Looper.getMainLooper());
219
266
  handler.post(call::resolve);
220
267
  });
@@ -226,7 +273,7 @@ public class FronteggNativePlugin extends Plugin {
226
273
  ExecutorService executor = Executors.newSingleThreadExecutor();
227
274
  executor.submit(() -> {
228
275
  Handler handler = new Handler(Looper.getMainLooper());
229
- FronteggAuth fronteggAuth = FronteggAuth.Companion.getInstance();
276
+ FronteggAuth fronteggAuth = FronteggAppKt.getFronteggAuth(this.getContext());
230
277
  if (!fronteggAuth.refreshTokenIfNeeded()) {
231
278
  fronteggAuth.logout(() -> {
232
279
  handler.post(call::resolve);
@@ -248,12 +295,12 @@ public class FronteggNativePlugin extends Plugin {
248
295
  @PluginMethod
249
296
  public void getConstants(PluginCall call) {
250
297
 
251
- String baseUrl = FronteggAuth.Companion.getInstance().getBaseUrl();
252
- String clientId = FronteggAuth.Companion.getInstance().getClientId();
253
- String applicationId = FronteggAuth.Companion.getInstance().getApplicationId();
298
+ String baseUrl = FronteggAppKt.getFronteggAuth(this.getContext()).getBaseUrl();
299
+ String clientId = FronteggAppKt.getFronteggAuth(this.getContext()).getClientId();
300
+ String applicationId = FronteggAppKt.getFronteggAuth(this.getContext()).getApplicationId();
254
301
  String packageName = getContext().getPackageName();
255
302
 
256
- List<RegionConfig> regionsData = FronteggApp.Companion.getInstance().getRegions();
303
+ List<RegionConfig> regionsData = FronteggAppKt.getFronteggAuth(this.getContext()).getRegions();
257
304
 
258
305
  JSObject resultMap = new JSObject();
259
306
  resultMap.put("baseUrl", baseUrl);
@@ -256,6 +256,21 @@ declare type FronteggNativeOptions = (FronteggNativeStandardOptions | FronteggNa
256
256
  * @default true
257
257
  */
258
258
  useChromeCustomTabs?: boolean;
259
+ /**
260
+ * Android only. Full class name of the MainActivity for deep links (e.g. "com.example.app.MainActivity").
261
+ * If not set, defaults to {packageName}.MainActivity.
262
+ */
263
+ mainActivityClass?: string;
264
+ /**
265
+ * Android only. Custom deep link scheme for OAuth callback (e.g. "myapp").
266
+ * If not set, asset links or default scheme is used.
267
+ */
268
+ deepLinkScheme?: string;
269
+ /**
270
+ * Android only. Enable WebView disk cache.
271
+ * @default false
272
+ */
273
+ useDiskCacheWebView?: boolean;
259
274
  };
260
275
  export interface FronteggServiceOptions {
261
276
  logLevel: LogLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { ListenerCallback, PluginListenerHandle } from '@capacitor/core';\nimport type { ITenantsResponse, IUserProfile } from '@frontegg/rest-api';\n\nimport type { LogLevel } from './logger';\n\nexport type User = IUserProfile & {\n tenants: ITenantsResponse[];\n activeTenant: ITenantsResponse;\n};\n\n/**\n * Represents the state of the Frontegg authentication.\n */\nexport interface FronteggState {\n /**\n * The access token used for authenticating API requests.\n * This token is typically a JWT and should be refreshed periodically before it expires.\n * It is `null` when the user is not authenticated.\n */\n accessToken: string | null;\n\n /**\n * The refresh token used to obtain a new access token.\n * This token is used when the access token has expired and a new token is required.\n * It is `null` when the user is not authenticated.\n */\n refreshToken: string | null;\n\n /**\n * Indicates whether the user is currently authenticated.\n * It is `true` if the user has successfully logged in and holds a valid access token; otherwise, `false`.\n */\n isAuthenticated: boolean;\n\n /**\n * Represents the current authenticated user.\n * It is an object containing user details if the user is authenticated; otherwise, `null`.\n */\n user: User | null;\n\n /**\n * Controls whether the loader or spinner should be displayed.\n * This is `true` when the application is loading or performing an action that requires user feedback.\n * @deprecated use isLoading instead\n */\n showLoader: boolean;\n\n /**\n * Controls whether the loader or spinner should be displayed.\n * This is `true` when the application is loading or performing an action that requires user feedback.\n */\n isLoading: boolean;\n\n /**\n * The selected region configuration.\n * This is typically used in multi-regional setups where different regions have different configurations.\n * It is `null` if no region is selected or if the application is not configured for multiple regions.\n */\n selectedRegion: string | null;\n\n /**\n * Indicates whether a token refresh operation is currently in progress.\n * This is `true` when the refresh token is being used to obtain a new access token.\n */\n refreshingToken: boolean;\n\n /**\n * Indicates whether the application is in the initialization phase.\n * This is `true` when the application is initializing, such as during the initial load or when setting up the authentication state.\n */\n initializing: boolean;\n}\n\nexport type SubscribeFunc<T, K extends keyof T> = (value: T[K]) => void;\nexport type SubscribeMap<T> = {\n [K in keyof T]: Set<SubscribeFunc<T, K>>;\n};\n\n/**\n * Represents the constant configuration values used by the Frontegg authentication module.\n */\nexport interface FronteggConstants {\n /**\n * The base URL of the Frontegg API.\n * This is the primary endpoint for all API requests.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests.\n * This is a unique identifier for the client application.\n */\n clientId: string;\n\n /**\n * The application ID associated with the Frontegg setup.\n * It may be `null` if the application ID is not required.\n */\n applicationId: string | null;\n\n /**\n * The bundle ID of the application.\n * This is typically used to uniquely identify the application in a multi-app environment.\n */\n bundleId: string;\n\n /**\n * Indicates whether the application is configured for regional deployment.\n * This is `true` if the application supports multiple regions, otherwise `false`.\n */\n isRegional: boolean;\n\n /**\n * The data associated with each region.\n * This is an optional array containing configuration details for each region, including the region key, base URL, and client ID.\n * It is present only if `isRegional` is `true`.\n */\n regionData?: { key: string; baseUrl: string; clientId: string }[];\n}\n\n/**\n * Represents the Frontegg Native Plugin interface that provides methods for interacting with the Frontegg authentication system.\n */\nexport interface FronteggNativePlugin {\n /**\n * Adds an event listener for the specified event name.\n * @param eventName - The name of the event to listen for.\n * @param listenerFunc - The callback function that will be called when the event is triggered.\n * @returns A promise that resolves to a PluginListenerHandle, which can be used to manage the listener.\n */\n addListener(\n eventName: string,\n listenerFunc: ListenerCallback,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Retrieves the constant configuration values used by the Frontegg authentication module.\n * @returns A promise that resolves to an object containing the FronteggConstants.\n */\n getConstants(): Promise<FronteggConstants>;\n\n /**\n * Retrieves the current authentication state.\n * @returns A promise that resolves to an object containing the current FronteggState.\n */\n getAuthState(): Promise<FronteggState>;\n\n /**\n * Initiates the login process.\n * @returns A promise that resolves when the login process is completed.\n */\n login(payload: { loginHint?: string }): Promise<void>;\n\n /**\n * Used to log in with a social login provider directly without visiting the login page.\n * @param payload - The payload containing the details for the direct login action.\n * @param payload.type - The direct login type (e.g., direct, social-login, custom-social-login).\n * @param payload.data - The direct login data (e.g., SAML URL request, provider name, provider entity ID).\n * @param payload.ephemeralSession - If true, the session will be ephemeral and will not be saved in the browser.\n * @returns A promise that resolves when the direct login action is completed.\n */\n directLoginAction(payload: {\n type: string;\n data: string;\n ephemeralSession: boolean;\n }): Promise<boolean>;\n\n /**\n * Logs out the current user.\n * This method does not return a promise, and the logout process is performed asynchronously.\n */\n logout(): void;\n\n /**\n * Switches the current tenant in the application.\n * @param payload - The payload containing the tenant ID to switch to.\n * @returns A promise that resolves when the tenant switch is completed.\n */\n switchTenant(payload: { tenantId: string }): Promise<void>;\n\n /**\n * Initializes the plugin with the specified region.\n * This method is used to set up the plugin for multi-region support.\n * For more information, see the documentation for iOS and Android multi-region support.\n * @param payload - The payload containing the region key to initialize.\n * @returns A promise that resolves when the initialization with the region is completed.\n */\n initWithRegion(payload: { regionKey: string }): Promise<void>;\n\n /**\n * Refreshes the authentication token.\n * @returns A promise that resolves when the token refresh is completed.\n */\n refreshToken(): Promise<void>;\n}\n\n/**\n * Represents the configuration for a specific region.\n * This is used in multi-regional setups where different regions have different configurations.\n */\nexport type RegionConfig = {\n /**\n * The unique key identifying the region.\n */\n key: string;\n\n /**\n * The base URL for the API endpoint in this region.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests in this region.\n */\n clientId: string;\n\n /**\n * The application ID associated with this region.\n * This is optional and may be undefined.\n */\n applicationId?: string;\n};\n\n/**\n * Represents the standard options for initializing the Frontegg Native Plugin.\n */\ntype FronteggNativeStandardOptions = {\n /**\n * The base URL of the Frontegg API.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests.\n */\n clientId: string;\n\n /**\n * The application ID associated with the Frontegg setup.\n * This is optional and may be undefined.\n */\n applicationId?: string;\n};\n\ntype FronteggNativeRegionOptions = {\n /**\n * This is an array of regions to be used as frontegg app.\n *\n * @since 1.0.0\n * @example [{key: \"us\", baseUrl: \"https://us-api.frontegg.com\", clientId: \"us-client-id\"}]\n */\n regions: RegionConfig[];\n};\ntype FronteggNativeOptions = (\n | FronteggNativeStandardOptions\n | FronteggNativeRegionOptions\n) & {\n /**\n * Weather to handle login with social login in external browser.\n * If set to false, the plugin will navigate to the social login page with application webview.\n *\n * NOTE: some of the social login providers prevent login from embedded webview.\n *\n * @default true\n */\n handleLoginWithSocialLogin?: boolean;\n /**\n * Weather to handle login with SSO in external browser.\n * If set to false, the plugin will navigate to the sso page with application webview.\n *\n * @default false\n */\n handleLoginWithSSO?: boolean;\n /**\n * Weather to use the assetlinks to for oauth/callback, this is the default behavior.\n * disabling this will cause the plugin to use custom url scheme for oauth/callback.\n *\n * NOTE: custom url scheme require user interaction to return to the app.\n * @default true\n */\n useAssetLinks?: boolean;\n\n /**\n * Weather to To enable social login via Chrome Custom Tabs, set the useChromeCustomTabs flag to true.\n * By default, the SDK uses the Chrome browser for social login.\n *\n * NOTE: custom url scheme require user interaction to return to the app.\n * @default true\n */\n useChromeCustomTabs?: boolean;\n};\n\nexport interface FronteggServiceOptions {\n logLevel: LogLevel;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * You can configure the way the push notifications are displayed when the app is in foreground.\n */\n FronteggNative?: FronteggNativeOptions;\n }\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { ListenerCallback, PluginListenerHandle } from '@capacitor/core';\nimport type { ITenantsResponse, IUserProfile } from '@frontegg/rest-api';\n\nimport type { LogLevel } from './logger';\n\nexport type User = IUserProfile & {\n tenants: ITenantsResponse[];\n activeTenant: ITenantsResponse;\n};\n\n/**\n * Represents the state of the Frontegg authentication.\n */\nexport interface FronteggState {\n /**\n * The access token used for authenticating API requests.\n * This token is typically a JWT and should be refreshed periodically before it expires.\n * It is `null` when the user is not authenticated.\n */\n accessToken: string | null;\n\n /**\n * The refresh token used to obtain a new access token.\n * This token is used when the access token has expired and a new token is required.\n * It is `null` when the user is not authenticated.\n */\n refreshToken: string | null;\n\n /**\n * Indicates whether the user is currently authenticated.\n * It is `true` if the user has successfully logged in and holds a valid access token; otherwise, `false`.\n */\n isAuthenticated: boolean;\n\n /**\n * Represents the current authenticated user.\n * It is an object containing user details if the user is authenticated; otherwise, `null`.\n */\n user: User | null;\n\n /**\n * Controls whether the loader or spinner should be displayed.\n * This is `true` when the application is loading or performing an action that requires user feedback.\n * @deprecated use isLoading instead\n */\n showLoader: boolean;\n\n /**\n * Controls whether the loader or spinner should be displayed.\n * This is `true` when the application is loading or performing an action that requires user feedback.\n */\n isLoading: boolean;\n\n /**\n * The selected region configuration.\n * This is typically used in multi-regional setups where different regions have different configurations.\n * It is `null` if no region is selected or if the application is not configured for multiple regions.\n */\n selectedRegion: string | null;\n\n /**\n * Indicates whether a token refresh operation is currently in progress.\n * This is `true` when the refresh token is being used to obtain a new access token.\n */\n refreshingToken: boolean;\n\n /**\n * Indicates whether the application is in the initialization phase.\n * This is `true` when the application is initializing, such as during the initial load or when setting up the authentication state.\n */\n initializing: boolean;\n}\n\nexport type SubscribeFunc<T, K extends keyof T> = (value: T[K]) => void;\nexport type SubscribeMap<T> = {\n [K in keyof T]: Set<SubscribeFunc<T, K>>;\n};\n\n/**\n * Represents the constant configuration values used by the Frontegg authentication module.\n */\nexport interface FronteggConstants {\n /**\n * The base URL of the Frontegg API.\n * This is the primary endpoint for all API requests.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests.\n * This is a unique identifier for the client application.\n */\n clientId: string;\n\n /**\n * The application ID associated with the Frontegg setup.\n * It may be `null` if the application ID is not required.\n */\n applicationId: string | null;\n\n /**\n * The bundle ID of the application.\n * This is typically used to uniquely identify the application in a multi-app environment.\n */\n bundleId: string;\n\n /**\n * Indicates whether the application is configured for regional deployment.\n * This is `true` if the application supports multiple regions, otherwise `false`.\n */\n isRegional: boolean;\n\n /**\n * The data associated with each region.\n * This is an optional array containing configuration details for each region, including the region key, base URL, and client ID.\n * It is present only if `isRegional` is `true`.\n */\n regionData?: { key: string; baseUrl: string; clientId: string }[];\n}\n\n/**\n * Represents the Frontegg Native Plugin interface that provides methods for interacting with the Frontegg authentication system.\n */\nexport interface FronteggNativePlugin {\n /**\n * Adds an event listener for the specified event name.\n * @param eventName - The name of the event to listen for.\n * @param listenerFunc - The callback function that will be called when the event is triggered.\n * @returns A promise that resolves to a PluginListenerHandle, which can be used to manage the listener.\n */\n addListener(\n eventName: string,\n listenerFunc: ListenerCallback,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Retrieves the constant configuration values used by the Frontegg authentication module.\n * @returns A promise that resolves to an object containing the FronteggConstants.\n */\n getConstants(): Promise<FronteggConstants>;\n\n /**\n * Retrieves the current authentication state.\n * @returns A promise that resolves to an object containing the current FronteggState.\n */\n getAuthState(): Promise<FronteggState>;\n\n /**\n * Initiates the login process.\n * @returns A promise that resolves when the login process is completed.\n */\n login(payload: { loginHint?: string }): Promise<void>;\n\n /**\n * Used to log in with a social login provider directly without visiting the login page.\n * @param payload - The payload containing the details for the direct login action.\n * @param payload.type - The direct login type (e.g., direct, social-login, custom-social-login).\n * @param payload.data - The direct login data (e.g., SAML URL request, provider name, provider entity ID).\n * @param payload.ephemeralSession - If true, the session will be ephemeral and will not be saved in the browser.\n * @returns A promise that resolves when the direct login action is completed.\n */\n directLoginAction(payload: {\n type: string;\n data: string;\n ephemeralSession: boolean;\n }): Promise<boolean>;\n\n /**\n * Logs out the current user.\n * This method does not return a promise, and the logout process is performed asynchronously.\n */\n logout(): void;\n\n /**\n * Switches the current tenant in the application.\n * @param payload - The payload containing the tenant ID to switch to.\n * @returns A promise that resolves when the tenant switch is completed.\n */\n switchTenant(payload: { tenantId: string }): Promise<void>;\n\n /**\n * Initializes the plugin with the specified region.\n * This method is used to set up the plugin for multi-region support.\n * For more information, see the documentation for iOS and Android multi-region support.\n * @param payload - The payload containing the region key to initialize.\n * @returns A promise that resolves when the initialization with the region is completed.\n */\n initWithRegion(payload: { regionKey: string }): Promise<void>;\n\n /**\n * Refreshes the authentication token.\n * @returns A promise that resolves when the token refresh is completed.\n */\n refreshToken(): Promise<void>;\n}\n\n/**\n * Represents the configuration for a specific region.\n * This is used in multi-regional setups where different regions have different configurations.\n */\nexport type RegionConfig = {\n /**\n * The unique key identifying the region.\n */\n key: string;\n\n /**\n * The base URL for the API endpoint in this region.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests in this region.\n */\n clientId: string;\n\n /**\n * The application ID associated with this region.\n * This is optional and may be undefined.\n */\n applicationId?: string;\n};\n\n/**\n * Represents the standard options for initializing the Frontegg Native Plugin.\n */\ntype FronteggNativeStandardOptions = {\n /**\n * The base URL of the Frontegg API.\n */\n baseUrl: string;\n\n /**\n * The client ID used for authenticating API requests.\n */\n clientId: string;\n\n /**\n * The application ID associated with the Frontegg setup.\n * This is optional and may be undefined.\n */\n applicationId?: string;\n};\n\ntype FronteggNativeRegionOptions = {\n /**\n * This is an array of regions to be used as frontegg app.\n *\n * @since 1.0.0\n * @example [{key: \"us\", baseUrl: \"https://us-api.frontegg.com\", clientId: \"us-client-id\"}]\n */\n regions: RegionConfig[];\n};\ntype FronteggNativeOptions = (\n | FronteggNativeStandardOptions\n | FronteggNativeRegionOptions\n) & {\n /**\n * Weather to handle login with social login in external browser.\n * If set to false, the plugin will navigate to the social login page with application webview.\n *\n * NOTE: some of the social login providers prevent login from embedded webview.\n *\n * @default true\n */\n handleLoginWithSocialLogin?: boolean;\n /**\n * Weather to handle login with SSO in external browser.\n * If set to false, the plugin will navigate to the sso page with application webview.\n *\n * @default false\n */\n handleLoginWithSSO?: boolean;\n /**\n * Weather to use the assetlinks to for oauth/callback, this is the default behavior.\n * disabling this will cause the plugin to use custom url scheme for oauth/callback.\n *\n * NOTE: custom url scheme require user interaction to return to the app.\n * @default true\n */\n useAssetLinks?: boolean;\n\n /**\n * Weather to To enable social login via Chrome Custom Tabs, set the useChromeCustomTabs flag to true.\n * By default, the SDK uses the Chrome browser for social login.\n *\n * NOTE: custom url scheme require user interaction to return to the app.\n * @default true\n */\n useChromeCustomTabs?: boolean;\n\n /**\n * Android only. Full class name of the MainActivity for deep links (e.g. \"com.example.app.MainActivity\").\n * If not set, defaults to {packageName}.MainActivity.\n */\n mainActivityClass?: string;\n\n /**\n * Android only. Custom deep link scheme for OAuth callback (e.g. \"myapp\").\n * If not set, asset links or default scheme is used.\n */\n deepLinkScheme?: string;\n\n /**\n * Android only. Enable WebView disk cache.\n * @default false\n */\n useDiskCacheWebView?: boolean;\n};\n\nexport interface FronteggServiceOptions {\n logLevel: LogLevel;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * You can configure the way the push notifications are displayed when the app is in foreground.\n */\n FronteggNative?: FronteggNativeOptions;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/ionic-capacitor",
3
- "version": "2.0.11-alpha.21904007461",
3
+ "version": "2.0.11-alpha.22584795706",
4
4
  "description": "Frontegg Ionic Capacitor SDK",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
+ "android/settings.gradle",
12
13
  "dist/",
13
14
  "ios/Plugin/",
14
15
  "FronteggIonicCapacitor.podspec"
@@ -44,11 +45,11 @@
44
45
  "prepublishOnly": "npm run build",
45
46
  "prepack": "npm run build",
46
47
  "sync": "npm run verify && npm pack && node scripts/postpack.js && cd example && ionic capacitor sync",
47
- "start:android": "cd example && ionic capacitor run android --livereload --external",
48
- "start:ios": "cd example && ionic capacitor run ios --livereload --external"
48
+ "start:android": "cd example && npx cap run android --livereload --external",
49
+ "start:ios": "cd example && npx cap run ios --livereload --external"
49
50
  },
50
51
  "dependencies": {
51
- "@frontegg/rest-api": "^3.1.56"
52
+ "@frontegg/rest-api": "^7.0.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@angular-eslint/builder": "^16.0.0",