dexie-cloud-addon 4.3.6 → 4.3.7

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.3.6, Wed Jan 28 2026
11
+ * Version 4.3.7, Wed Jan 28 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -2817,7 +2817,21 @@
2817
2817
  }
2818
2818
  // Handle OAuth provider login via redirect
2819
2819
  if (hints === null || hints === void 0 ? void 0 : hints.provider) {
2820
- initiateOAuthRedirect(db, hints.provider);
2820
+ let resolvedRedirectUri = undefined;
2821
+ if (hints.redirectPath) {
2822
+ // If redirectPath is absolute, use as is. If relative, resolve against current location
2823
+ if (/^https?:\/\//i.test(hints.redirectPath)) {
2824
+ resolvedRedirectUri = hints.redirectPath;
2825
+ }
2826
+ else if (typeof window !== 'undefined' && window.location) {
2827
+ // Use URL constructor to resolve relative path
2828
+ resolvedRedirectUri = new URL(hints.redirectPath, window.location.href).toString();
2829
+ }
2830
+ else if (typeof location !== 'undefined' && location.href) {
2831
+ resolvedRedirectUri = new URL(hints.redirectPath, location.href).toString();
2832
+ }
2833
+ }
2834
+ initiateOAuthRedirect(db, hints.provider, resolvedRedirectUri);
2821
2835
  // This function never returns - page navigates away
2822
2836
  throw new OAuthRedirectError(hints.provider);
2823
2837
  }
@@ -2962,12 +2976,13 @@
2962
2976
  * the user is redirected back with a dxc-auth query parameter that is
2963
2977
  * automatically detected by db.cloud.configure().
2964
2978
  */
2965
- function initiateOAuthRedirect(db, provider) {
2979
+ function initiateOAuthRedirect(db, provider, redirectUriOverride) {
2966
2980
  var _a, _b;
2967
2981
  const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
2968
2982
  if (!url)
2969
2983
  throw new Error(`No database URL given.`);
2970
- const redirectUri = ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
2984
+ const redirectUri = redirectUriOverride ||
2985
+ ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthRedirectUri) ||
2971
2986
  (typeof location !== 'undefined' ? location.href : undefined);
2972
2987
  // CodeRabbit suggested to fail fast here, but the only situation where
2973
2988
  // redirectUri would be undefined is in non-browser environments, and
@@ -18089,7 +18104,7 @@
18089
18104
  const syncComplete = new rxjs.Subject();
18090
18105
  dexie.cloud = {
18091
18106
  // @ts-ignore
18092
- version: "4.3.6",
18107
+ version: "4.3.7",
18093
18108
  options: Object.assign({}, DEFAULT_OPTIONS),
18094
18109
  schema: null,
18095
18110
  get currentUserId() {
@@ -18474,7 +18489,7 @@
18474
18489
  }
18475
18490
  }
18476
18491
  // @ts-ignore
18477
- dexieCloud.version = "4.3.6";
18492
+ dexieCloud.version = "4.3.7";
18478
18493
  Dexie.Cloud = dexieCloud;
18479
18494
 
18480
18495
  exports.default = dexieCloud;