@tinacms/app 1.2.29 → 1.2.31

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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @tinacms/app
2
2
 
3
+ ## 1.2.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [a65ca13f2]
8
+ - @tinacms/mdx@1.3.22
9
+ - tinacms@1.5.24
10
+
11
+ ## 1.2.30
12
+
13
+ ### Patch Changes
14
+
15
+ - a937aabf0: Add support for build.basePath to be an environment variable
16
+ - 661239b2a: update final form to fix peer deps issues
17
+ - Updated dependencies [131b4dc55]
18
+ - Updated dependencies [93bfc804a]
19
+ - Updated dependencies [1fc2c4a99]
20
+ - Updated dependencies [693cf5bd6]
21
+ - Updated dependencies [afd1c7c97]
22
+ - Updated dependencies [a937aabf0]
23
+ - Updated dependencies [661239b2a]
24
+ - Updated dependencies [630ab9436]
25
+ - tinacms@1.5.23
26
+ - @tinacms/mdx@1.3.21
27
+
3
28
  ## 1.2.29
4
29
 
5
30
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "main": "src/main.tsx",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
@@ -14,9 +14,9 @@
14
14
  "@headlessui/react": "1.6.6",
15
15
  "@heroicons/react": "1.0.6",
16
16
  "@monaco-editor/react": "4.4.5",
17
- "@tinacms/mdx": "1.3.20",
17
+ "@tinacms/mdx": "1.3.22",
18
18
  "@xstate/react": "3.0.0",
19
- "final-form": "4.20.7",
19
+ "final-form": "4.20.10",
20
20
  "graphiql": "3.0.0-alpha.1",
21
21
  "graphql": "15.8.0",
22
22
  "monaco-editor": "0.31.0",
@@ -25,7 +25,7 @@
25
25
  "react-dom": "17.0.2",
26
26
  "react-router-dom": "6.3.0",
27
27
  "tailwindcss": "^3.2.7",
28
- "tinacms": "1.5.22",
28
+ "tinacms": "1.5.24",
29
29
  "typescript": "^4.6.4",
30
30
  "zod": "^3.14.3"
31
31
  }
package/src/App.tsx CHANGED
@@ -38,10 +38,8 @@ const SetPreview = () => {
38
38
  ...MdxFieldPluginExtendible,
39
39
  Component: Editor,
40
40
  })
41
- let basePath
42
- if (config.build.basePath) {
43
- basePath = config.build.basePath.replace(/^\/|\/$/g, '')
44
- }
41
+ const basePath = __BASE_PATH__.replace(/^\/|\/$/g, '')
42
+ cms.flags.set('tina-basepath', basePath)
45
43
  cms.flags.set(
46
44
  'tina-preview',
47
45
  `${basePath ? `${basePath}/` : ''}${config.build.outputFolder.replace(
@@ -8,11 +8,6 @@ import { queries } from 'CLIENT_IMPORT'
8
8
 
9
9
  import 'graphiql/graphiql.min.css'
10
10
 
11
- const fetcher = createGraphiQLFetcher({
12
- url: __API_URL__,
13
- headers: { 'X-API-KEY': __TOKEN__ },
14
- })
15
-
16
11
  const Playground = () => {
17
12
  const cms = useCMS()
18
13
  const [query, setQuery] = React.useState('')
@@ -61,6 +56,10 @@ const Playground = () => {
61
56
 
62
57
  const ref = React.useRef()
63
58
 
59
+ const getToken = () => {
60
+ return JSON.parse(localStorage.getItem('tinacms-auth') || '{}')?.id_token
61
+ }
62
+
64
63
  if (!autoQueries) {
65
64
  return null
66
65
  }
@@ -130,11 +129,16 @@ const Playground = () => {
130
129
  </div>
131
130
  )
132
131
  }
133
-
134
132
  return (
135
133
  <div style={{ height: '100vh' }}>
136
134
  <GraphiQL
137
- fetcher={fetcher}
135
+ fetcher={async (params, options) => {
136
+ const fetcher = createGraphiQLFetcher({
137
+ url: __API_URL__,
138
+ headers: { Authorization: `Bearer ${getToken()}` },
139
+ })
140
+ return fetcher(params, options)
141
+ }}
138
142
  query={query}
139
143
  defaultEditorToolsVisibility="variables"
140
144
  isHeadersEditorEnabled={false}
package/src/vite-env.d.ts CHANGED
@@ -4,4 +4,5 @@
4
4
 
5
5
  /// <reference types="vite/client" />
6
6
  declare const __API_URL__: string
7
+ declare const __BASE_PATH__: string
7
8
  declare const __TINA_GRAPHQL_VERSION__: string