sanity 5.29.1-next.1 → 5.30.0-next.3
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/lib/_chunks-es/version.js +2 -2
- package/lib/index.js +59 -31
- package/lib/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "5.
|
|
1
|
+
var version = "5.30.0-next.3+2ae1370ae1";
|
|
2
2
|
let buildVersion;
|
|
3
3
|
try {
|
|
4
4
|
buildVersion = process.env.PKG_BUILD_VERSION;
|
|
@@ -7,7 +7,7 @@ try {
|
|
|
7
7
|
try {
|
|
8
8
|
buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
|
|
9
9
|
// and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
|
|
10
|
-
"5.
|
|
10
|
+
"5.30.0-next.3+2ae1370ae1";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -4806,6 +4806,7 @@ function createLoginComponent({
|
|
|
4806
4806
|
loginMethod,
|
|
4807
4807
|
redirectOnSingle,
|
|
4808
4808
|
wasLogout,
|
|
4809
|
+
isHandlingCallback,
|
|
4809
4810
|
...providerOptions
|
|
4810
4811
|
}) {
|
|
4811
4812
|
function LoginComponent(t0) {
|
|
@@ -4853,7 +4854,7 @@ function createLoginComponent({
|
|
|
4853
4854
|
providers: providers_1,
|
|
4854
4855
|
lastUsedProvider: lastUsedProvider_0,
|
|
4855
4856
|
isLoading
|
|
4856
|
-
} = providerData, redirectUrlForRedirectOnSingle = redirectOnSingle && !wasLogout() && providers_1?.length === 1 && providers_1?.[0] && createHrefForProvider({
|
|
4857
|
+
} = providerData, redirectUrlForRedirectOnSingle = redirectOnSingle && !wasLogout() && !isHandlingCallback() && providers_1?.length === 1 && providers_1?.[0] && createHrefForProvider({
|
|
4857
4858
|
loginMethod,
|
|
4858
4859
|
projectId,
|
|
4859
4860
|
url: providers_1[0].url,
|
|
@@ -5114,7 +5115,7 @@ function _createAuthStore({
|
|
|
5114
5115
|
}))).pipe(shareReplay({
|
|
5115
5116
|
bufferSize: 1,
|
|
5116
5117
|
refCount: !0
|
|
5117
|
-
}))), dualClient$ =
|
|
5118
|
+
}))), dualClient$ = merge(hashTokenChange, tokenStorage.value).pipe(map((nextTokenState) => clientFactory({
|
|
5118
5119
|
...AUTH_CLIENT_OPTIONS,
|
|
5119
5120
|
...hostOptions,
|
|
5120
5121
|
projectId,
|
|
@@ -5125,12 +5126,12 @@ function _createAuthStore({
|
|
|
5125
5126
|
} : {
|
|
5126
5127
|
withCredentials: !0
|
|
5127
5128
|
}
|
|
5128
|
-
}))
|
|
5129
|
+
})), shareReplay({
|
|
5129
5130
|
bufferSize: 1,
|
|
5130
5131
|
refCount: !0
|
|
5131
5132
|
})), cookieAuthChanged$ = cookieAuthState.value.pipe(filter((v) => v?.authenticated !== "pending"), distinctUntilChanged(isEqual$1)), cookieWorkspaceClient$ = cookieAuthChanged$.pipe(map(({
|
|
5132
5133
|
authenticated
|
|
5133
|
-
}) => authenticated ? cookieClient : void 0)), workspaceClient$ = (loginMethod === "dual" ? dualClient$ : loginMethod === "cookie" ? cookieWorkspaceClient$ : tokenClient$).pipe(distinctUntilChanged()), dualCookieRecheck$ = loginMethod === "dual" ? cookieAuthChanged$.pipe(skip(1), switchMap(() => dualClient$)) : EMPTY$5, authState$ = concat(initial$, merge(workspaceClient$.pipe(skip(1)), dualCookieRecheck$).pipe(mergeMap(async (client) => {
|
|
5134
|
+
}) => authenticated ? cookieClient : void 0)), workspaceClient$ = (loginMethod === "dual" ? dualClient$ : loginMethod === "cookie" ? cookieWorkspaceClient$ : tokenClient$).pipe(distinctUntilChanged()), dualCookieRecheck$ = loginMethod === "dual" ? cookieAuthChanged$.pipe(skip(1), switchMap(() => dualClient$)) : EMPTY$5, initialToken = currentTokenState?.token ?? null, dualTokenRecheck$ = loginMethod === "dual" ? tokenStorage.value.pipe(map((state) => state?.token ?? null), distinctUntilChanged(), filter((token) => typeof token == "string" && token !== initialToken), switchMap(() => dualClient$)) : EMPTY$5, authState$ = concat(initial$, merge(workspaceClient$.pipe(skip(1)), dualCookieRecheck$, dualTokenRecheck$).pipe(mergeMap(async (client) => {
|
|
5134
5135
|
if (!client)
|
|
5135
5136
|
return {
|
|
5136
5137
|
client: cookieClient,
|
|
@@ -5156,6 +5157,7 @@ function _createAuthStore({
|
|
|
5156
5157
|
resetOnRefCountZero: () => timer(1e3)
|
|
5157
5158
|
})
|
|
5158
5159
|
);
|
|
5160
|
+
let _isHandlingCallback = !1;
|
|
5159
5161
|
async function handleCallbackUrl() {
|
|
5160
5162
|
const startTime = performance.now(), sessionId2 = getSessionId2();
|
|
5161
5163
|
if (clearHashSessionId(), !sessionId2)
|
|
@@ -5165,6 +5167,14 @@ function _createAuthStore({
|
|
|
5165
5167
|
success: !0,
|
|
5166
5168
|
durationMs: Math.round(performance.now() - startTime)
|
|
5167
5169
|
};
|
|
5170
|
+
_isHandlingCallback = !0;
|
|
5171
|
+
try {
|
|
5172
|
+
return await processCallback(sessionId2, startTime);
|
|
5173
|
+
} finally {
|
|
5174
|
+
_isHandlingCallback = !1;
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
async function processCallback(sessionId2, startTime) {
|
|
5168
5178
|
const exchangeClient = clientFactory({
|
|
5169
5179
|
...AUTH_CLIENT_OPTIONS,
|
|
5170
5180
|
...hostOptions,
|
|
@@ -5190,34 +5200,51 @@ function _createAuthStore({
|
|
|
5190
5200
|
};
|
|
5191
5201
|
}
|
|
5192
5202
|
const exchangeDurationMs = Math.round(performance.now() - exchangeStart);
|
|
5193
|
-
if (loginMethod === "dual"
|
|
5203
|
+
if (loginMethod === "dual") {
|
|
5204
|
+
tokenStorage.update({
|
|
5205
|
+
token
|
|
5206
|
+
});
|
|
5194
5207
|
const probeStart = performance.now(), authProbe = await probeCurrentUser(exchangeClient), probeDurationMs = Math.round(performance.now() - probeStart), durationMs = Math.round(performance.now() - startTime);
|
|
5195
|
-
|
|
5208
|
+
return cookieAuthState.update({
|
|
5196
5209
|
authenticated: authProbe.authenticated
|
|
5197
|
-
}),
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5210
|
+
}), {
|
|
5211
|
+
flow: "exchange",
|
|
5212
|
+
loginMethod,
|
|
5213
|
+
success: !!token,
|
|
5214
|
+
durationMs,
|
|
5215
|
+
exchangeDurationMs,
|
|
5216
|
+
probeDurationMs,
|
|
5217
|
+
// Report cookie as the transport when the probe passed, otherwise token —
|
|
5218
|
+
// either way the token is stored and available as a fallback.
|
|
5219
|
+
authMethod: authProbe.authenticated ? "cookie" : "token",
|
|
5220
|
+
failureReason: token ? void 0 : "token exchange returned empty token"
|
|
5221
|
+
};
|
|
5222
|
+
}
|
|
5223
|
+
if (loginMethod === "cookie") {
|
|
5224
|
+
const probeStart = performance.now(), authProbe = await probeCurrentUser(exchangeClient), probeDurationMs = Math.round(performance.now() - probeStart), durationMs = Math.round(performance.now() - startTime);
|
|
5225
|
+
return cookieAuthState.update({
|
|
5226
|
+
authenticated: authProbe.authenticated
|
|
5227
|
+
}), authProbe.authenticated ? {
|
|
5228
|
+
flow: "exchange",
|
|
5229
|
+
loginMethod,
|
|
5230
|
+
success: !0,
|
|
5231
|
+
durationMs,
|
|
5232
|
+
exchangeDurationMs,
|
|
5233
|
+
probeDurationMs,
|
|
5234
|
+
authMethod: "cookie"
|
|
5235
|
+
} : {
|
|
5236
|
+
loginMethod,
|
|
5237
|
+
flow: "exchange",
|
|
5238
|
+
success: !1,
|
|
5239
|
+
durationMs,
|
|
5240
|
+
exchangeDurationMs,
|
|
5241
|
+
probeDurationMs,
|
|
5242
|
+
failureReason: "cookie probe failed in cookie-only mode",
|
|
5243
|
+
error: {
|
|
5244
|
+
type: "cookie-blocked",
|
|
5245
|
+
message: "Authentication could not be completed because this browser appears to block third-party cookies. This studio is configured to use cookie-based authentication only. Try using a different browser, disabling strict cookie blocking, or ask the studio administrator to enable token-based authentication."
|
|
5246
|
+
}
|
|
5247
|
+
};
|
|
5221
5248
|
}
|
|
5222
5249
|
return tokenStorage.update({
|
|
5223
5250
|
token
|
|
@@ -5255,7 +5282,8 @@ function _createAuthStore({
|
|
|
5255
5282
|
...providerOptions,
|
|
5256
5283
|
client$: authState$.pipe(map((state) => state.client)),
|
|
5257
5284
|
loginMethod,
|
|
5258
|
-
wasLogout: () => _didLogOut
|
|
5285
|
+
wasLogout: () => _didLogOut,
|
|
5286
|
+
isHandlingCallback: () => _isHandlingCallback
|
|
5259
5287
|
});
|
|
5260
5288
|
return {
|
|
5261
5289
|
handleCallbackUrl,
|