spine-framework-cortex 0.1.4 → 0.1.5
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Frontend type ID resolution — never hardcode UUIDs in custom app code.
|
|
2
|
+
// IDs differ on every fresh install; always resolve by slug at call time.
|
|
3
|
+
|
|
4
|
+
import { apiFetch } from '@core/lib/api'
|
|
5
|
+
|
|
6
|
+
const cache: Record<string, string> = {}
|
|
7
|
+
|
|
8
|
+
export async function resolveTypeId(slug: string): Promise<string> {
|
|
9
|
+
if (cache[slug]) return cache[slug]
|
|
10
|
+
|
|
11
|
+
const data = await apiFetch(`/.netlify/functions/types?action=getBySlug&slug=${encodeURIComponent(slug)}`)
|
|
12
|
+
if (!data?.id) throw new Error(`Type not found: ${slug}`)
|
|
13
|
+
|
|
14
|
+
cache[slug] = data.id
|
|
15
|
+
return data.id
|
|
16
|
+
}
|
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-framework-cortex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Cortex — AI-powered support, CRM, and knowledge base app for Spine Framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"pages/",
|
|
20
20
|
"components/",
|
|
21
21
|
"functions/",
|
|
22
|
+
"lib/",
|
|
22
23
|
"README.md"
|
|
23
24
|
],
|
|
24
25
|
"spine": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react'
|
|
2
|
-
import { resolveTypeId } from '
|
|
2
|
+
import { resolveTypeId } from '../../lib/resolveTypeId'
|
|
3
3
|
import { useNavigate } from 'react-router-dom'
|
|
4
4
|
import { apiFetch } from '@core/lib/api'
|
|
5
5
|
import { Button } from '@core/components/ui/button'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import { resolveTypeId } from '
|
|
2
|
+
import { resolveTypeId } from '../../lib/resolveTypeId'
|
|
3
3
|
import { useParams, useNavigate } from 'react-router-dom'
|
|
4
4
|
import { apiFetch } from '@core/lib/api'
|
|
5
5
|
import { Button } from '@core/components/ui/button'
|