@tinacms/app 0.0.0-be4681c-20250619070932 → 0.0.0-bebaba8-20251211002320

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,6 +1,144 @@
1
1
  # @tinacms/app
2
2
 
3
- ## 0.0.0-be4681c-20250619070932
3
+ ## 0.0.0-bebaba8-20251211002320
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a125472`](https://github.com/tinacms/tinacms/commit/a125472d3278c140cb416dba5cd1478fb5dfe320), [`3097535`](https://github.com/tinacms/tinacms/commit/3097535275e813db907a592ee96bd8481f0eacc5), [`9fb397d`](https://github.com/tinacms/tinacms/commit/9fb397da515468f72b01f5a7cf881187a9c33d6e)]:
8
+ - tinacms@0.0.0-bebaba8-20251211002320
9
+ - @tinacms/mdx@0.0.0-bebaba8-20251211002320
10
+
11
+ ## 2.3.14
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`5c1e891`](https://github.com/tinacms/tinacms/commit/5c1e89181f595d392ad6cb56ca5fc0b6d9e60a23), [`f717193`](https://github.com/tinacms/tinacms/commit/f717193aa4a1d3205df42d120fd1f6192b5e41e5), [`ac59522`](https://github.com/tinacms/tinacms/commit/ac59522053c71c713057c4c2b6ce610617bce85e)]:
16
+ - tinacms@3.0.2
17
+ - @tinacms/mdx@2.0.0
18
+
19
+ ## 2.3.13
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`50fa9f4`](https://github.com/tinacms/tinacms/commit/50fa9f4bf932a3dc45b88d245e35917efe8d3423), [`428ec7e`](https://github.com/tinacms/tinacms/commit/428ec7eca20603e2cb666d562fd4cc16dda4cbed), [`6946476`](https://github.com/tinacms/tinacms/commit/69464767d339a5df3c6c530ece94ef80049e534f), [`f99bbbc`](https://github.com/tinacms/tinacms/commit/f99bbbc221eead8d714b3791348d415dd8fcd063)]:
24
+ - tinacms@3.0.1
25
+
26
+ ## 2.3.12
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [[`2e1535d`](https://github.com/tinacms/tinacms/commit/2e1535dd5495dc390902f2db6ef1f26afb072396), [`ed6025e`](https://github.com/tinacms/tinacms/commit/ed6025ee87ebe051957fc93e987ba8de8b003995), [`3bf79e1`](https://github.com/tinacms/tinacms/commit/3bf79e19c005dca745a8ddd46546190741b322a5), [`bb1ad6a`](https://github.com/tinacms/tinacms/commit/bb1ad6a11d10976074453ed218b178935ec96fd3)]:
31
+ - @tinacms/mdx@2.0.0
32
+ - tinacms@3.0.0
33
+
34
+ ## 2.3.11
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [[`a76fdb6`](https://github.com/tinacms/tinacms/commit/a76fdb639b94cfefa169ebbd184f55d62e4a8a76), [`dd2089d`](https://github.com/tinacms/tinacms/commit/dd2089dbde4a7b1a0116cce096f50a97fdca9d81)]:
39
+ - tinacms@2.10.1
40
+ - @tinacms/mdx@1.8.3
41
+
42
+ ## 2.3.10
43
+
44
+ ### Patch Changes
45
+
46
+ - [#5822](https://github.com/tinacms/tinacms/pull/5822) [`4b824be`](https://github.com/tinacms/tinacms/commit/4b824be53572f9231753ebd3b5f14fd778fd73d6) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Migrate from react-beautiful-dnd to dnd-kit to fix deprecation error.
47
+
48
+ - Updated dependencies [[`f2577b9`](https://github.com/tinacms/tinacms/commit/f2577b911a97ecc1c3f53a98ae8218cc33bc9867), [`3ffa092`](https://github.com/tinacms/tinacms/commit/3ffa0929e4964f17d5ffa05e0d4cbbff5d9ef4d9), [`38920ce`](https://github.com/tinacms/tinacms/commit/38920ce29a9b63c54b04f39537f19beab62d2c86), [`d1bd1a1`](https://github.com/tinacms/tinacms/commit/d1bd1a1312fa910e237ec06608e7c11830c78346), [`67e1a3d`](https://github.com/tinacms/tinacms/commit/67e1a3d4c52e0acdab0a8dc53956e39f2e3075fa), [`9fb1402`](https://github.com/tinacms/tinacms/commit/9fb1402491f52d16e763c875ee550f7d879c83c8), [`3fa1098`](https://github.com/tinacms/tinacms/commit/3fa109849f552406dd0059041afe0bf09edadb25), [`ccab7a5`](https://github.com/tinacms/tinacms/commit/ccab7a5d0fd1f4167e8f72306e9d32e8750ed9bf), [`4b824be`](https://github.com/tinacms/tinacms/commit/4b824be53572f9231753ebd3b5f14fd778fd73d6), [`d9487bf`](https://github.com/tinacms/tinacms/commit/d9487bff276ba20a84b76944c5a7a333666f4984)]:
49
+ - tinacms@2.10.0
50
+ - @tinacms/mdx@1.8.2
51
+
52
+ ## 2.3.9
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [[`d900f4e`](https://github.com/tinacms/tinacms/commit/d900f4e6c6f0a86c94bba5f0925bbaa54eeb90db)]:
57
+ - tinacms@2.9.5
58
+
59
+ ## 2.3.8
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [[`e1b6d05`](https://github.com/tinacms/tinacms/commit/e1b6d05c6b31c5c0928633064a065ddd331667ca), [`4ee0dd9`](https://github.com/tinacms/tinacms/commit/4ee0dd95913392b0da12dd5c9344909e5292e911), [`27e5ca9`](https://github.com/tinacms/tinacms/commit/27e5ca9b18a90f13f92425ebb2628b143d6a81be)]:
64
+ - tinacms@2.9.4
65
+
66
+ ## 2.3.7
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [[`9e8bc37`](https://github.com/tinacms/tinacms/commit/9e8bc37402c8aa4d408c38e00d4402d596b0d896), [`0f265aa`](https://github.com/tinacms/tinacms/commit/0f265aadf918ae6f5b789e298fc2c406a6df0b16), [`32bd9b2`](https://github.com/tinacms/tinacms/commit/32bd9b21b54462be3e83b2d3e4b4237a48758bb1), [`ce1414c`](https://github.com/tinacms/tinacms/commit/ce1414ce1b82e6755a96c9c12949cd469b43e283)]:
71
+ - tinacms@2.9.3
72
+
73
+ ## 2.3.6
74
+
75
+ ### Patch Changes
76
+
77
+ - [#6087](https://github.com/tinacms/tinacms/pull/6087) [`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca) Thanks [@kulesy](https://github.com/kulesy)! - feat: Enhance branch creation modal with improved UI/UX and dropdown button component
78
+
79
+ - [#6098](https://github.com/tinacms/tinacms/pull/6098) [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb) Thanks [@Pat-Stuart](https://github.com/Pat-Stuart)! - Change from blue accent coloring to orange
80
+
81
+ - Updated dependencies [[`1286e87`](https://github.com/tinacms/tinacms/commit/1286e87323694dc819edc56360613dc654f3d3ca), [`4416a28`](https://github.com/tinacms/tinacms/commit/4416a283ac1cfea5e9c4890cd71f2edf3b704344), [`6cba118`](https://github.com/tinacms/tinacms/commit/6cba118c90f7c7ab6356c0ef83fca18526e47f8d), [`572fb28`](https://github.com/tinacms/tinacms/commit/572fb28236b56db4ede5fe53b177b80323ae7284), [`f224124`](https://github.com/tinacms/tinacms/commit/f224124220811fb44749122d46eb7100af89ee77), [`a2d983e`](https://github.com/tinacms/tinacms/commit/a2d983ed886f66db2c133e902eacaa8d07e88bdb), [`bc35474`](https://github.com/tinacms/tinacms/commit/bc354740d0cb359c372ba287974e7e9db3c5119c)]:
82
+ - tinacms@2.9.2
83
+
84
+ ## 2.3.5
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [[`003e348`](https://github.com/tinacms/tinacms/commit/003e348472ddc08eee63d78190038097542b6311), [`5527e8a`](https://github.com/tinacms/tinacms/commit/5527e8ab5821c8613fcfd1b0b8bc6d93291a6d03), [`5ffd60e`](https://github.com/tinacms/tinacms/commit/5ffd60e7b07b19cde6fab36a911503276c83715f), [`b23aa0c`](https://github.com/tinacms/tinacms/commit/b23aa0c5defc51b8f9fe00a59dd87e1d2f8b9f0b), [`5d13c0d`](https://github.com/tinacms/tinacms/commit/5d13c0d023373692233c8be2127ae6e3d7d68b47)]:
89
+ - tinacms@2.9.1
90
+
91
+ ## 2.3.4
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [[`0bbe080`](https://github.com/tinacms/tinacms/commit/0bbe0804e334238850a4f8f33be5cd123ff68ab3), [`98fbc94`](https://github.com/tinacms/tinacms/commit/98fbc941a07fbc52edafaeb43b49b5ea30ea4172), [`ced9076`](https://github.com/tinacms/tinacms/commit/ced9076d25d7177bd8d9ae3c6133d0560366511c)]:
96
+ - tinacms@2.9.0
97
+
98
+ ## 2.3.3
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [[`ea917dd`](https://github.com/tinacms/tinacms/commit/ea917dd2840c955d462b66b58009d2a16da39377), [`b012b6c`](https://github.com/tinacms/tinacms/commit/b012b6c7fae2674c613fd4c54e1819a86c6d2c3e), [`39e5b05`](https://github.com/tinacms/tinacms/commit/39e5b0562af7bca1e2923fc94b7c8119e12a0133), [`55e018b`](https://github.com/tinacms/tinacms/commit/55e018b9826a540005bbadf8fd51e9bac456d531)]:
103
+ - tinacms@2.8.3
104
+
105
+ ## 2.3.2
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [[`eaa6ed5`](https://github.com/tinacms/tinacms/commit/eaa6ed551c76349c5849cd1e19a8066ecbbe205c), [`60a15d5`](https://github.com/tinacms/tinacms/commit/60a15d533b85a0c3f9f483f6f0f0b6824616284b), [`2fb1c4e`](https://github.com/tinacms/tinacms/commit/2fb1c4e79d1cae5ab29c3f93b0867214e193f59c)]:
110
+ - tinacms@2.8.2
111
+ - @tinacms/mdx@1.8.1
112
+
113
+ ## 2.3.1
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies [[`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752), [`b20a2c4`](https://github.com/tinacms/tinacms/commit/b20a2c4fd64fa2d06711850db63fb317302ee361), [`41359ed`](https://github.com/tinacms/tinacms/commit/41359edaf08def7a5e26969ec114155038c09752)]:
118
+ - tinacms@2.8.1
119
+
120
+ ## 2.3.0
121
+
122
+ ### Minor Changes
123
+
124
+ - [#5744](https://github.com/tinacms/tinacms/pull/5744) [`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be) Thanks [@Ben0189](https://github.com/Ben0189)! - Upgrade Plate editor to v48 beta, integrating latest features and improvements.
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [[`98a61e2`](https://github.com/tinacms/tinacms/commit/98a61e2d263978a7096cc23ac7e94aa0039981be)]:
129
+ - @tinacms/mdx@1.8.0
130
+ - tinacms@2.8.0
131
+
132
+ ## 2.2.10
133
+
134
+ ### Patch Changes
135
+
136
+ - [#5833](https://github.com/tinacms/tinacms/pull/5833) [`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51) Thanks [@JackDevAU](https://github.com/JackDevAU)! - 🐛 FIX - Visual Editor Webpack HMR loading issue
137
+
138
+ - Updated dependencies [[`5269d65`](https://github.com/tinacms/tinacms/commit/5269d6578d361c55326f39375eaa175707342d51), [`3026a2b`](https://github.com/tinacms/tinacms/commit/3026a2b492113a53c036e43d5d85837cea4a6de3), [`28a94a6`](https://github.com/tinacms/tinacms/commit/28a94a602186f48b528b91236007839e5d02a9de)]:
139
+ - tinacms@2.7.10
140
+
141
+ ## 2.2.9
4
142
 
5
143
  ### Patch Changes
6
144
 
@@ -8,10 +146,14 @@
8
146
  Forms header - Adds breadcrumb navigation
9
147
 
10
148
  - [#5784](https://github.com/tinacms/tinacms/pull/5784) [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab) Thanks [@JackDevAU](https://github.com/JackDevAU)! - - Fixed padding issues in FormLists
149
+
11
150
  - Fixed Visual Editing's "Edit" button (Reference Fields)
12
- - Updated dependencies [[`2a3ed6c`](https://github.com/tinacms/tinacms/commit/2a3ed6c3ec3233fd90fd94f3dd3d0243aaad079a), [`bc47f93`](https://github.com/tinacms/tinacms/commit/bc47f938431c400714808613f633b05659a87be1), [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287), [`468f0ee`](https://github.com/tinacms/tinacms/commit/468f0eefc0a15a9a9a23737d29ea9a5cb5c6aef6), [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab), [`dbef36f`](https://github.com/tinacms/tinacms/commit/dbef36f594b949024d5525184b6a9e1b9085b759), [`3ba6d78`](https://github.com/tinacms/tinacms/commit/3ba6d78f35f817d55bfc3d12b750e54b7e0d11f2)]:
13
- - tinacms@0.0.0-be4681c-20250619070932
14
- - @tinacms/mdx@0.0.0-be4681c-20250619070932
151
+
152
+ - [#5789](https://github.com/tinacms/tinacms/pull/5789) [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6) Thanks [@JackDevAU](https://github.com/JackDevAU)! - ✨ Adds click to focus for nested objects
153
+
154
+ - Updated dependencies [[`2a3ed6c`](https://github.com/tinacms/tinacms/commit/2a3ed6c3ec3233fd90fd94f3dd3d0243aaad079a), [`bc47f93`](https://github.com/tinacms/tinacms/commit/bc47f938431c400714808613f633b05659a87be1), [`0e9de37`](https://github.com/tinacms/tinacms/commit/0e9de379dab2970206b9b60eb014808662f67287), [`468f0ee`](https://github.com/tinacms/tinacms/commit/468f0eefc0a15a9a9a23737d29ea9a5cb5c6aef6), [`e27c017`](https://github.com/tinacms/tinacms/commit/e27c0172005797af93b908152d51b2966c0cf059), [`b25c5f0`](https://github.com/tinacms/tinacms/commit/b25c5f0b0e1d3f37870b780230b41dbc56bef1ab), [`5040a6a`](https://github.com/tinacms/tinacms/commit/5040a6aa24e62166d942c47b61a3f18585caded6), [`dbef36f`](https://github.com/tinacms/tinacms/commit/dbef36f594b949024d5525184b6a9e1b9085b759), [`3ba6d78`](https://github.com/tinacms/tinacms/commit/3ba6d78f35f817d55bfc3d12b750e54b7e0d11f2)]:
155
+ - tinacms@2.7.9
156
+ - @tinacms/mdx@1.7.0
15
157
 
16
158
  ## 2.2.8
17
159
 
package/index.html CHANGED
@@ -51,7 +51,7 @@
51
51
  the assets for this page.\
52
52
  </p>\
53
53
  <p>\
54
- Please visit <a href="https://tina.io/docs/tina-cloud/faq/#how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.\
54
+ Please visit <a href="https://tina.io/docs/r/FAQ/#13-how-do-i-resolve-failed-loading-tinacms-assets-error">this doc</a> for help.\
55
55
  </p>\
56
56
  </div>'
57
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "0.0.0-be4681c-20250619070932",
3
+ "version": "0.0.0-bebaba8-20251211002320",
4
4
  "main": "src/main.tsx",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
@@ -21,10 +21,16 @@
21
21
  "graphiql": "3.0.0-alpha.1",
22
22
  "graphql": "15.8.0",
23
23
  "monaco-editor": "0.31.0",
24
+ "react": "^18.3.1",
25
+ "react-dom": "^18.3.1",
24
26
  "react-router-dom": "6.3.0",
25
27
  "typescript": "^5.7.3",
26
28
  "zod": "^3.24.2",
27
- "tinacms": "0.0.0-be4681c-20250619070932",
28
- "@tinacms/mdx": "0.0.0-be4681c-20250619070932"
29
+ "tinacms": "0.0.0-bebaba8-20251211002320",
30
+ "@tinacms/mdx": "0.0.0-bebaba8-20251211002320"
31
+ },
32
+ "repository": {
33
+ "url": "https://github.com/tinacms/tinacms.git",
34
+ "directory": "packages/@tinacms/app"
29
35
  }
30
36
  }
@@ -74,9 +74,7 @@ const Playground = () => {
74
74
  {noAutoQueries
75
75
  ? 'No auto-generated queries found, the Tina config is likely set to client.skip = true'
76
76
  : "Tina's auto-generated queries can be found here as well as any queries you may have defined yourself."}{' '}
77
- <a href='https://tina.io/docs/data-fetching/custom-queries/'>
78
- Learn more here
79
- </a>
77
+ <a href='https://tina.io/docs/r/custom-queries/'>Learn more here</a>
80
78
  </div>
81
79
  <nav className='space-y-1' aria-label='Sidebar'>
82
80
  <ul>
@@ -1,9 +1,4 @@
1
- /**
2
-
3
-
4
-
5
- */
6
-
1
+ import React from 'react';
7
2
  import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react';
8
3
  /**
9
4
  * MDX is built directly to the app because of how we load dependencies.
@@ -11,9 +6,8 @@ import MonacoEditor, { useMonaco, loader } from '@monaco-editor/react';
11
6
  * easily install the current version of the mdx package in all scenarios
12
7
  * (when we're working in the monorepo, or working with a tagged npm version)
13
8
  */
14
- import { parseMDX, stringifyMDX } from '@tinacms/mdx';
9
+ import { parseMDX, serializeMDX } from '@tinacms/mdx';
15
10
  import type * as monaco from 'monaco-editor';
16
- import React from 'react';
17
11
  import { RichTextType } from 'tinacms';
18
12
  import {
19
13
  ErrorMessage,
@@ -34,11 +28,6 @@ export const uuid = () => {
34
28
 
35
29
  type Monaco = typeof monaco;
36
30
 
37
- // 0.33.0 has a bug https://github.com/microsoft/monaco-editor/issues/2947
38
- loader.config({
39
- paths: { vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.31.1/min/vs' },
40
- });
41
-
42
31
  /**
43
32
  * Since monaco lazy-loads we may have a delay from when the block is inserted
44
33
  * to when monaco has intantiated, keep trying to focus on it.
@@ -68,7 +57,7 @@ export const RawEditor = (props: RichTextType) => {
68
57
  const field = props.field;
69
58
  const inputValue = React.useMemo(() => {
70
59
  // @ts-ignore no access to the rich-text type from this package
71
- const res = stringifyMDX(props.input.value, field, (value) => value);
60
+ const res = serializeMDX(props.input.value, field, (value) => value);
72
61
  return typeof props.input.value === 'string' ? props.input.value : res;
73
62
  }, []);
74
63
  const [value, setValue] = React.useState(inputValue);
@@ -149,13 +138,17 @@ export const RawEditor = (props: RichTextType) => {
149
138
  monacoEditor: monaco.editor.IStandaloneCodeEditor,
150
139
  monaco: Monaco
151
140
  ) {
152
- monacoEditorRef.current = monacoEditor;
153
- monacoEditor.onDidContentSizeChange(() => {
154
- // FIXME: if the window is too tall the performance degrades, come up with a nice
155
- // balance between the two
156
- setHeight(Math.min(Math.max(100, monacoEditor.getContentHeight()), 1000));
157
- monacoEditor.layout();
158
- });
141
+ if (monacoEditor) {
142
+ monacoEditorRef.current = monacoEditor;
143
+ monacoEditor.onDidContentSizeChange(() => {
144
+ // FIXME: if the window is too tall the performance degrades, come up with a nice
145
+ // balance between the two
146
+ setHeight(
147
+ Math.min(Math.max(100, monacoEditor.getContentHeight()), 1000)
148
+ );
149
+ monacoEditor.layout();
150
+ });
151
+ }
159
152
  }
160
153
 
161
154
  return (
@@ -168,6 +161,9 @@ export const RawEditor = (props: RichTextType) => {
168
161
  </div>
169
162
  <div style={{ height: `${height}px` }}>
170
163
  <MonacoEditor
164
+ beforeMount={() => {}}
165
+ height='100%'
166
+ width='100%'
171
167
  path={id}
172
168
  onMount={handleEditorDidMount}
173
169
  // Setting a custom theme is kind of buggy because it doesn't get defined until monaco has mounted.
package/src/index.css CHANGED
@@ -13,6 +13,10 @@
13
13
  fill: currentColor;
14
14
  }
15
15
 
16
+ .font-libre-baskerville {
17
+ font-family: "Libre Baskerville", serif;
18
+ }
19
+
16
20
  body {
17
21
  margin: 0;
18
22
  padding: 0;
@@ -382,3 +386,8 @@ td.rdtYear:hover {
382
386
  .tina-date-field .rdtTime td {
383
387
  cursor: default;
384
388
  }
389
+
390
+ /* Override Radix UI Portal wrapper z-index for dropdown menus */
391
+ [data-radix-popper-content-wrapper] {
392
+ z-index: 10800 !important;
393
+ }
@@ -562,12 +562,14 @@ export const useGraphQLReducer = (
562
562
  payload,
563
563
  ]);
564
564
  }
565
- if (event.data.type === 'url-changed') {
566
- cms.dispatch({
567
- type: 'sidebar:set-loading-state',
568
- value: true,
569
- });
570
- }
565
+ // TODO: This is causing a webpack HMR issue - look into refactoring this logic
566
+ // if (event.data.type === 'url-changed') {
567
+ // console.log('[EVENT_TRIGGERED] url-changed: ', event);
568
+ // cms.dispatch({
569
+ // type: 'sidebar:set-loading-state',
570
+ // value: true,
571
+ // });
572
+ // }
571
573
  },
572
574
  [cms, JSON.stringify(results)]
573
575
  );
package/src/lib/util.ts CHANGED
@@ -108,27 +108,22 @@ export const getFormAndFieldNameFromMetadata = (
108
108
  object: object,
109
109
  eventFieldName: string
110
110
  ) => {
111
- let formId;
112
- let n;
113
- const value = getDeepestMetadata(object, eventFieldName);
114
- if (value) {
115
- if (value.prefix) {
116
- const fieldName = eventFieldName.slice(value?.prefix?.length + 1);
117
- const localFieldName = value.name
118
- ? fieldName.slice(value?.name?.length + 1)
119
- : fieldName;
120
- if (localFieldName) {
121
- // If localFieldName is tags.2, just use `tags`
122
- if (!isNaN(Number(localFieldName.split('.')[1]))) {
123
- n = value.fields[localFieldName.split('.')[0]];
124
- } else {
125
- n = value.fields[localFieldName];
126
- }
127
- } else {
128
- n = value.name;
129
- }
130
- formId = value.id;
131
- }
111
+ const metadata = getDeepestMetadata(object, eventFieldName);
112
+
113
+ if (!metadata) {
114
+ console.warn(
115
+ '[getFormAndFieldNameFromMetadata] No metadata found for:',
116
+ eventFieldName
117
+ );
118
+ return { formId: undefined, fieldName: undefined };
132
119
  }
133
- return { formId, fieldName: n };
120
+
121
+ const { id: formId, prefix } = metadata;
122
+ const prefixLength = prefix?.length ?? 0;
123
+ const localFieldName = eventFieldName.slice(prefixLength + 1);
124
+
125
+ return {
126
+ formId,
127
+ fieldName: localFieldName,
128
+ };
134
129
  };