tinacms 1.5.18 → 1.5.19

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.
@@ -3,6 +3,6 @@ import { NavigateFunction } from 'react-router-dom';
3
3
  import { TinaCMS } from '@tinacms/toolkit';
4
4
  import type { CollectionResponse, DocumentSys } from '../types';
5
5
  import type { Collection } from '@tinacms/schema-tools';
6
- export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => any;
6
+ export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => Promise<any>;
7
7
  declare const CollectionListPage: () => JSX.Element;
8
8
  export default CollectionListPage;
package/dist/client.js CHANGED
@@ -2,7 +2,9 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
3
  })(this, function(exports2, fetchPonyfill) {
4
4
  "use strict";
5
- const { fetch, Headers } = fetchPonyfill();
5
+ const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
6
+ const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
7
+ const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
6
8
  const TINA_HOST = "content.tinajs.io";
7
9
  class TinaClient {
8
10
  constructor({ token, url, queries }) {
@@ -11,7 +13,7 @@
11
13
  this.queries = queries(this);
12
14
  }
13
15
  async request(args) {
14
- const headers = new Headers();
16
+ const headers = new HeadersDefined();
15
17
  if (this.readonlyToken) {
16
18
  headers.append("X-API-KEY", this.readonlyToken);
17
19
  }
@@ -21,7 +23,7 @@
21
23
  variables: (args == null ? void 0 : args.variables) || {}
22
24
  });
23
25
  const url = (args == null ? void 0 : args.url) || this.apiUrl;
24
- const res = await fetch(url, {
26
+ const res = await fetchDefined(url, {
25
27
  method: "POST",
26
28
  headers,
27
29
  body: bodyString,
package/dist/client.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  import fetchPonyfill from "fetch-ponyfill";
2
- const { fetch, Headers } = fetchPonyfill();
2
+ const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
3
+ const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
+ const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
3
5
  const TINA_HOST = "content.tinajs.io";
4
6
  class TinaClient {
5
7
  constructor({ token, url, queries }) {
@@ -8,7 +10,7 @@ class TinaClient {
8
10
  this.queries = queries(this);
9
11
  }
10
12
  async request(args) {
11
- const headers = new Headers();
13
+ const headers = new HeadersDefined();
12
14
  if (this.readonlyToken) {
13
15
  headers.append("X-API-KEY", this.readonlyToken);
14
16
  }
@@ -18,7 +20,7 @@ class TinaClient {
18
20
  variables: (args == null ? void 0 : args.variables) || {}
19
21
  });
20
22
  const url = (args == null ? void 0 : args.url) || this.apiUrl;
21
- const res = await fetch(url, {
23
+ const res = await fetchDefined(url, {
22
24
  method: "POST",
23
25
  headers,
24
26
  body: bodyString,
package/dist/index.js CHANGED
@@ -28776,15 +28776,15 @@ This will work when developing locally but NOT when deployed to production.
28776
28776
  )))))
28777
28777
  )));
28778
28778
  };
28779
- const handleNavigate = (navigate, cms, collection, collectionDefinition, document2) => {
28779
+ const handleNavigate = async (navigate, cms, collection, collectionDefinition, document2) => {
28780
28780
  var _a, _b;
28781
28781
  const plugins2 = cms.plugins.all("tina-admin");
28782
28782
  const routeMapping = plugins2.find(({ name }) => name === "route-mapping");
28783
28783
  const tinaPreview = cms.flags.get("tina-preview") || false;
28784
- let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
28784
+ let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? await ((_b = collectionDefinition.ui) == null ? void 0 : _b.router({
28785
28785
  document: document2,
28786
28786
  collection: collectionDefinition
28787
- }) : routeMapping ? routeMapping.mapper(collection, document2) : void 0;
28787
+ })) : routeMapping ? routeMapping.mapper(collection, document2) : void 0;
28788
28788
  if (routeOverride) {
28789
28789
  if (routeOverride.startsWith("/")) {
28790
28790
  routeOverride = routeOverride.slice(1);
package/dist/index.mjs CHANGED
@@ -28782,15 +28782,15 @@ const TemplateMenu = ({
28782
28782
  )))))
28783
28783
  )));
28784
28784
  };
28785
- const handleNavigate = (navigate, cms, collection, collectionDefinition, document2) => {
28785
+ const handleNavigate = async (navigate, cms, collection, collectionDefinition, document2) => {
28786
28786
  var _a, _b;
28787
28787
  const plugins2 = cms.plugins.all("tina-admin");
28788
28788
  const routeMapping = plugins2.find(({ name }) => name === "route-mapping");
28789
28789
  const tinaPreview = cms.flags.get("tina-preview") || false;
28790
- let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
28790
+ let routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? await ((_b = collectionDefinition.ui) == null ? void 0 : _b.router({
28791
28791
  document: document2,
28792
28792
  collection: collectionDefinition
28793
- }) : routeMapping ? routeMapping.mapper(collection, document2) : void 0;
28793
+ })) : routeMapping ? routeMapping.mapper(collection, document2) : void 0;
28794
28794
  if (routeOverride) {
28795
28795
  if (routeOverride.startsWith("/")) {
28796
28796
  routeOverride = routeOverride.slice(1);
@@ -1,6 +1,3 @@
1
- /**
2
-
3
- */
4
1
  export declare const TINA_HOST = "content.tinajs.io";
5
2
  export interface TinaClientArgs<GenQueries = Record<string, unknown>> {
6
3
  url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.5.18",
3
+ "version": "1.5.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -69,8 +69,8 @@
69
69
  "@react-types/combobox": "^3.2.0",
70
70
  "@react-types/shared": "^3.10.0",
71
71
  "@sambego/storybook-styles": "^1.0.0",
72
- "@tinacms/schema-tools": "1.4.10",
73
- "@tinacms/search": "1.0.8",
72
+ "@tinacms/schema-tools": "1.4.11",
73
+ "@tinacms/search": "1.0.9",
74
74
  "@tinacms/sharedctx": "1.0.2",
75
75
  "@udecode/plate-headless": "^21.4.0",
76
76
  "atob": "2.1.2",