@nocode-factory/sanity-kit 2.11.0 → 2.12.0
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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/web-server.js +38 -11
- package/dist/web-server.js.map +1 -1
- package/dist/web.js +44 -3
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useOpenOnline.ts +5 -3
- package/src/web/PreviewBanner.tsx +67 -2
- package/src/web/previewGrant.ts +51 -17
package/dist/index.js
CHANGED
|
@@ -1621,12 +1621,12 @@ function useOpenOnline() {
|
|
|
1621
1621
|
let { projectId, dataset, token } = client.config();
|
|
1622
1622
|
if (!projectId || !dataset) throw Error("unknown_project");
|
|
1623
1623
|
let key = `${config.serviceEndpoint}|${projectId}|${dataset}`, grant = cache.get(key);
|
|
1624
|
-
(!grant || new Date(grant.expiresAt).getTime() - Date.now() <
|
|
1624
|
+
(!grant || new Date(grant.expiresAt).getTime() - Date.now() < 864e5) && (grant = await requestPreviewGrant(config.serviceEndpoint, {
|
|
1625
1625
|
projectId,
|
|
1626
1626
|
dataset,
|
|
1627
1627
|
sanityToken: token ?? "",
|
|
1628
1628
|
label: "Ouverture depuis le Studio",
|
|
1629
|
-
days:
|
|
1629
|
+
days: 30
|
|
1630
1630
|
}), cache.set(key, grant));
|
|
1631
1631
|
let signed = onlineUrl(environment, perspective, {
|
|
1632
1632
|
path: options.path,
|