@uniformdev/canvas-next-rsc 19.96.1-alpha.13 → 19.99.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/package.json +11 -11
- package/dist/UniformComposition-38e22896.d.ts +0 -74
- package/dist/UniformComposition-d178d865.d.ts +0 -77
- package/dist/actions/updateContext.d.ts +0 -2
- package/dist/actions/updateContext.js +0 -17
- package/dist/client/canvasClient.d.ts +0 -5
- package/dist/client/canvasClient.js +0 -53
- package/dist/client/manifestClient.d.ts +0 -209
- package/dist/client/manifestClient.js +0 -33
- package/dist/client/projectMapClient.d.ts +0 -5
- package/dist/client/projectMapClient.js +0 -17
- package/dist/client/routeClient.d.ts +0 -5
- package/dist/client/routeClient.js +0 -68
- package/dist/components/DefaultNotImplementedComponent.d.ts +0 -4
- package/dist/components/DefaultNotImplementedComponent.js +0 -45
- package/dist/components/GoogleTagManagerAnalytics.d.ts +0 -3
- package/dist/components/GoogleTagManagerAnalytics.js +0 -44
- package/dist/components/UniformComponent.d.ts +0 -35
- package/dist/components/UniformComponent.js +0 -14
- package/dist/components/UniformComposition.d.ts +0 -47
- package/dist/components/UniformComposition.js +0 -35
- package/dist/components/UniformContext.d.ts +0 -13
- package/dist/components/UniformContext.js +0 -19
- package/dist/components/UniformRichText.d.ts +0 -42
- package/dist/components/UniformRichText.js +0 -15
- package/dist/components/UniformRichTextNode.d.ts +0 -14
- package/dist/components/UniformRichTextNode.js +0 -49
- package/dist/components/UniformScript.d.ts +0 -5
- package/dist/components/UniformScript.js +0 -49
- package/dist/components/UniformSlot.d.ts +0 -48
- package/dist/components/UniformSlot.js +0 -38
- package/dist/components/UniformText.d.ts +0 -10
- package/dist/components/UniformText.js +0 -5
- package/dist/components/__tests__/evaluateComposition.spec.d.ts +0 -1
- package/dist/components/__tests__/evaluateComposition.spec.js +0 -80
- package/dist/components/convertComponentToProps.d.ts +0 -18
- package/dist/components/convertComponentToProps.js +0 -22
- package/dist/components/evaluateComposition.d.ts +0 -32
- package/dist/components/evaluateComposition.js +0 -183
- package/dist/components/getEnrichmentTags.d.ts +0 -5
- package/dist/components/getEnrichmentTags.js +0 -13
- package/dist/components/getUniformContext.d.ts +0 -10
- package/dist/components/getUniformContext.js +0 -17
- package/dist/components/nodes/HeadingRichTextNode.d.ts +0 -2
- package/dist/components/nodes/HeadingRichTextNode.js +0 -6
- package/dist/components/nodes/LinebreakRichTextNode.d.ts +0 -2
- package/dist/components/nodes/LinebreakRichTextNode.js +0 -4
- package/dist/components/nodes/LinkRichTextNode.d.ts +0 -2
- package/dist/components/nodes/LinkRichTextNode.js +0 -6
- package/dist/components/nodes/ListItemRichTextNode.d.ts +0 -2
- package/dist/components/nodes/ListItemRichTextNode.js +0 -5
- package/dist/components/nodes/ListRichTextNode.d.ts +0 -2
- package/dist/components/nodes/ListRichTextNode.js +0 -6
- package/dist/components/nodes/ParagraphRichTextNode.d.ts +0 -2
- package/dist/components/nodes/ParagraphRichTextNode.js +0 -6
- package/dist/components/nodes/TabRichTextNode.d.ts +0 -2
- package/dist/components/nodes/TabRichTextNode.js +0 -4
- package/dist/components/nodes/TextRichTextNode.d.ts +0 -2
- package/dist/components/nodes/TextRichTextNode.js +0 -9
- package/dist/components/renderComponent.d.ts +0 -26
- package/dist/components/renderComponent.js +0 -52
- package/dist/components/resolvePath.d.ts +0 -5
- package/dist/components/resolvePath.js +0 -34
- package/dist/components/retrieveRoute.d.ts +0 -198
- package/dist/components/retrieveRoute.js +0 -146
- package/dist/components/types.d.ts +0 -15
- package/dist/components/types.js +0 -1
- package/dist/config/helpers.d.ts +0 -23
- package/dist/config/helpers.js +0 -34
- package/dist/config/models.d.ts +0 -51
- package/dist/config/models.js +0 -1
- package/dist/cookie/index.d.ts +0 -12
- package/dist/cookie/index.js +0 -21
- package/dist/handler/createPreviewGETRouteHandler.d.ts +0 -1
- package/dist/handler/createPreviewGETRouteHandler.js +0 -43
- package/dist/handler/createPreviewPOSTRouteHandler.d.ts +0 -1
- package/dist/handler/createPreviewPOSTRouteHandler.js +0 -88
- package/dist/handler/createUniformRouteHandler.d.ts +0 -4
- package/dist/handler/createUniformRouteHandler.js +0 -10
- package/dist/handler/helpers.d.ts +0 -17
- package/dist/handler/helpers.js +0 -148
- package/dist/handler/messages/handleCompositionChanged.d.ts +0 -2
- package/dist/handler/messages/handleCompositionChanged.js +0 -9
- package/dist/handler/messages/handleCompositionDeleted.d.ts +0 -2
- package/dist/handler/messages/handleCompositionDeleted.js +0 -9
- package/dist/handler/messages/handleCompositionPublished.d.ts +0 -2
- package/dist/handler/messages/handleCompositionPublished.js +0 -9
- package/dist/handler/messages/handleManifestPublished.d.ts +0 -2
- package/dist/handler/messages/handleManifestPublished.js +0 -10
- package/dist/handler/messages/handleProjectMapNodeDelete.d.ts +0 -2
- package/dist/handler/messages/handleProjectMapNodeDelete.js +0 -21
- package/dist/handler/messages/handleProjectMapNodeInsert.d.ts +0 -2
- package/dist/handler/messages/handleProjectMapNodeInsert.js +0 -21
- package/dist/handler/messages/handleProjectMapNodeUpdate.d.ts +0 -2
- package/dist/handler/messages/handleProjectMapNodeUpdate.js +0 -22
- package/dist/handler/messages/handleRedirectDelete.d.ts +0 -2
- package/dist/handler/messages/handleRedirectDelete.js +0 -15
- package/dist/handler/messages/handleRedirectInsert.d.ts +0 -2
- package/dist/handler/messages/handleRedirectInsert.js +0 -15
- package/dist/handler/messages/handleRedirectUpdate.d.ts +0 -2
- package/dist/handler/messages/handleRedirectUpdate.js +0 -15
- package/dist/hooks/useForgetMe.d.ts +0 -4
- package/dist/hooks/useForgetMe.js +0 -10
- package/dist/hooks/useToggleConsent.d.ts +0 -7
- package/dist/hooks/useToggleConsent.js +0 -22
- package/dist/hooks/useUniformContext.d.ts +0 -1
- package/dist/hooks/useUniformContext.js +0 -3
- package/dist/models/index.d.ts +0 -30
- package/dist/models/index.js +0 -1
- package/dist/register/componentStore.d.ts +0 -1
- package/dist/register/componentStore.js +0 -2
- package/dist/register/componentStoreResolver.d.ts +0 -4
- package/dist/register/componentStoreResolver.js +0 -5
- package/dist/register/createComponentStore.d.ts +0 -12
- package/dist/register/createComponentStore.js +0 -13
- package/dist/register/createComponentStoreResolver.d.ts +0 -12
- package/dist/register/createComponentStoreResolver.js +0 -9
- package/dist/register/getTypeWithVariant.d.ts +0 -1
- package/dist/register/getTypeWithVariant.js +0 -1
- package/dist/register/registerUniformComponent.d.ts +0 -10
- package/dist/register/registerUniformComponent.js +0 -8
- package/dist/resolve/resolveChildren.d.ts +0 -17
- package/dist/resolve/resolveChildren.js +0 -20
- package/dist/score/index.d.ts +0 -3
- package/dist/score/index.js +0 -114
- package/dist/utils/__tests__/apply.spec.d.ts +0 -1
- package/dist/utils/__tests__/apply.spec.js +0 -358
- package/dist/utils/__tests__/diff.spec.d.ts +0 -1
- package/dist/utils/__tests__/diff.spec.js +0 -394
- package/dist/utils/apply.d.ts +0 -10
- package/dist/utils/apply.js +0 -124
- package/dist/utils/comp.d.ts +0 -25
- package/dist/utils/comp.js +0 -65
- package/dist/utils/diff.d.ts +0 -58
- package/dist/utils/diff.js +0 -144
- package/dist/utils/draft.d.ts +0 -20
- package/dist/utils/draft.js +0 -22
- package/dist/utils/tag.d.ts +0 -2
- package/dist/utils/tag.js +0 -7
- package/dist/utils/url.d.ts +0 -1
- package/dist/utils/url.js +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.99.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"react-dom": "18.2.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@uniformdev/canvas": "19.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^19.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.
|
|
67
|
-
"@uniformdev/canvas-react": "19.
|
|
68
|
-
"@uniformdev/context": "19.
|
|
69
|
-
"@uniformdev/project-map": "19.
|
|
70
|
-
"@uniformdev/redirect": "19.
|
|
71
|
-
"@uniformdev/richtext": "19.
|
|
72
|
-
"@uniformdev/webhooks": "19.
|
|
64
|
+
"@uniformdev/canvas": "19.99.0",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^19.99.0",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.99.0",
|
|
67
|
+
"@uniformdev/canvas-react": "19.99.0",
|
|
68
|
+
"@uniformdev/context": "19.99.0",
|
|
69
|
+
"@uniformdev/project-map": "19.99.0",
|
|
70
|
+
"@uniformdev/redirect": "19.99.0",
|
|
71
|
+
"@uniformdev/richtext": "19.99.0",
|
|
72
|
+
"@uniformdev/webhooks": "19.99.0",
|
|
73
73
|
"@vercel/edge-config": "^0.4.0",
|
|
74
74
|
"encoding": "^0.1.13",
|
|
75
75
|
"server-only": "^0.0.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "f867c1229e8dc020c099534be72396792748c300"
|
|
90
90
|
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ComponentInstance, CompositionResolvedGetResponse } from '@uniformdev/canvas';
|
|
2
|
-
import {
|
|
3
|
-
AppDirectoryServerContext,
|
|
4
|
-
ComponentProps,
|
|
5
|
-
CompositionContext,
|
|
6
|
-
PageParameters,
|
|
7
|
-
} from '@uniformdev/canvas-next-rsc-shared';
|
|
8
|
-
import * as React$1 from 'react';
|
|
9
|
-
import { ComponentType, ReactNode } from 'react';
|
|
10
|
-
|
|
11
|
-
type UniformStaticCompositionProps = {
|
|
12
|
-
/**
|
|
13
|
-
* How to render the composition.
|
|
14
|
-
*/
|
|
15
|
-
mode: 'static';
|
|
16
|
-
};
|
|
17
|
-
type UniformServerCompositionProps = {
|
|
18
|
-
/**
|
|
19
|
-
* How to render the composition.
|
|
20
|
-
*/
|
|
21
|
-
mode: 'server';
|
|
22
|
-
/**
|
|
23
|
-
* The Context instance to use for server-side rendering.
|
|
24
|
-
*/
|
|
25
|
-
serverContext?: AppDirectoryServerContext;
|
|
26
|
-
};
|
|
27
|
-
type UniformCompositionProps = PageParameters & {
|
|
28
|
-
composition?: CompositionResolvedGetResponse;
|
|
29
|
-
/**
|
|
30
|
-
* Function to map composition components to React components.
|
|
31
|
-
*/
|
|
32
|
-
resolveComponent: ResolveComponentFunction;
|
|
33
|
-
} & (UniformStaticCompositionProps | UniformServerCompositionProps);
|
|
34
|
-
declare const UniformComposition: React.FC<UniformCompositionProps>;
|
|
35
|
-
type ResolveComponentFunction = (options: { component: ComponentInstance }) => ResolveComponentResult;
|
|
36
|
-
type ResolveComponentResult = {
|
|
37
|
-
component: ComponentType<ComponentProps<any, any>> | null;
|
|
38
|
-
includeContext?: boolean;
|
|
39
|
-
};
|
|
40
|
-
declare const resolveComposition: (
|
|
41
|
-
props: Omit<ResolveComponentsOptions, 'slotName' | 'slotIndex' | 'target'> & {
|
|
42
|
-
composition: ComponentInstance;
|
|
43
|
-
compositionContext: CompositionContext;
|
|
44
|
-
}
|
|
45
|
-
) => React$1.FunctionComponentElement<{
|
|
46
|
-
children?: ReactNode;
|
|
47
|
-
}> | null;
|
|
48
|
-
type ResolveComponentsOptions = {
|
|
49
|
-
serverContext?: AppDirectoryServerContext;
|
|
50
|
-
target:
|
|
51
|
-
| {
|
|
52
|
-
type: 'root';
|
|
53
|
-
composition: ComponentInstance;
|
|
54
|
-
}
|
|
55
|
-
| {
|
|
56
|
-
type: 'slot';
|
|
57
|
-
components: ComponentInstance[];
|
|
58
|
-
parent: ComponentInstance;
|
|
59
|
-
root: ComponentInstance;
|
|
60
|
-
};
|
|
61
|
-
slotName: string | undefined;
|
|
62
|
-
slotIndex: number | undefined;
|
|
63
|
-
resolveComponent: ResolveComponentFunction;
|
|
64
|
-
compositionContext: CompositionContext;
|
|
65
|
-
mode: UniformCompositionProps['mode'];
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
UniformComposition as a,
|
|
70
|
-
ResolveComponentResult as b,
|
|
71
|
-
ResolveComponentFunction as R,
|
|
72
|
-
resolveComposition as r,
|
|
73
|
-
UniformCompositionProps as U,
|
|
74
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ComponentInstance, ResolvedRouteGetResponse } from '@uniformdev/canvas';
|
|
2
|
-
import {
|
|
3
|
-
AppDirectoryServerContext,
|
|
4
|
-
ComponentProps,
|
|
5
|
-
CompositionContext,
|
|
6
|
-
PageParameters,
|
|
7
|
-
} from '@uniformdev/canvas-next-rsc-shared';
|
|
8
|
-
import * as React$1 from 'react';
|
|
9
|
-
import { ComponentType, ReactNode } from 'react';
|
|
10
|
-
|
|
11
|
-
type UniformStaticCompositionProps = {
|
|
12
|
-
/**
|
|
13
|
-
* How to render the composition.
|
|
14
|
-
*/
|
|
15
|
-
mode: 'static';
|
|
16
|
-
};
|
|
17
|
-
type UniformServerCompositionProps = {
|
|
18
|
-
/**
|
|
19
|
-
* How to render the composition.
|
|
20
|
-
*/
|
|
21
|
-
mode: 'server';
|
|
22
|
-
/**
|
|
23
|
-
* The Context instance to use for server-side rendering.
|
|
24
|
-
*/
|
|
25
|
-
serverContext?: AppDirectoryServerContext;
|
|
26
|
-
};
|
|
27
|
-
type UniformCompositionProps = PageParameters & {
|
|
28
|
-
/**
|
|
29
|
-
* The route data to render.
|
|
30
|
-
*/
|
|
31
|
-
route: ResolvedRouteGetResponse | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Function to map composition components to React components.
|
|
34
|
-
*/
|
|
35
|
-
resolveComponent: ResolveComponentFunction;
|
|
36
|
-
} & (UniformStaticCompositionProps | UniformServerCompositionProps);
|
|
37
|
-
declare const UniformComposition: React.FC<UniformCompositionProps>;
|
|
38
|
-
type ResolveComponentFunction = (options: { component: ComponentInstance }) => ResolveComponentResult;
|
|
39
|
-
type ResolveComponentResult = {
|
|
40
|
-
component: ComponentType<ComponentProps<any, any>> | null;
|
|
41
|
-
includeContext?: boolean;
|
|
42
|
-
};
|
|
43
|
-
declare const resolveComposition: (
|
|
44
|
-
props: Omit<ResolveComponentsOptions, 'slotName' | 'slotIndex' | 'target'> & {
|
|
45
|
-
composition: ComponentInstance;
|
|
46
|
-
compositionContext: CompositionContext;
|
|
47
|
-
}
|
|
48
|
-
) => React$1.FunctionComponentElement<{
|
|
49
|
-
children?: ReactNode;
|
|
50
|
-
}> | null;
|
|
51
|
-
type ResolveComponentsOptions = {
|
|
52
|
-
serverContext?: AppDirectoryServerContext;
|
|
53
|
-
target:
|
|
54
|
-
| {
|
|
55
|
-
type: 'root';
|
|
56
|
-
composition: ComponentInstance;
|
|
57
|
-
}
|
|
58
|
-
| {
|
|
59
|
-
type: 'slot';
|
|
60
|
-
components: ComponentInstance[];
|
|
61
|
-
parent: ComponentInstance;
|
|
62
|
-
root: ComponentInstance;
|
|
63
|
-
};
|
|
64
|
-
slotName: string | undefined;
|
|
65
|
-
slotIndex: number | undefined;
|
|
66
|
-
resolveComponent: ResolveComponentFunction;
|
|
67
|
-
compositionContext: CompositionContext;
|
|
68
|
-
mode: UniformCompositionProps['mode'];
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export {
|
|
72
|
-
UniformComposition as a,
|
|
73
|
-
ResolveComponentResult as b,
|
|
74
|
-
ResolveComponentFunction as R,
|
|
75
|
-
resolveComposition as r,
|
|
76
|
-
UniformCompositionProps as U,
|
|
77
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
import { UNIFORM_DEFAULT_COOKIE_NAME } from '@uniformdev/context';
|
|
3
|
-
import { cookies } from 'next/headers';
|
|
4
|
-
import { getUniformContext } from '../components/getUniformContext';
|
|
5
|
-
import { serializeCookie } from '../score';
|
|
6
|
-
export const updateContextAction = async (options) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const context = await getUniformContext({
|
|
9
|
-
cookieValue: (_a = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) === null || _a === void 0 ? void 0 : _a.value,
|
|
10
|
-
});
|
|
11
|
-
if (!context.storage.data.consent) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
await context.update(options);
|
|
15
|
-
const scoreCookie = serializeCookie(context.storage.data);
|
|
16
|
-
cookies().set(UNIFORM_DEFAULT_COOKIE_NAME, scoreCookie);
|
|
17
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CanvasClient } from '@uniformdev/canvas';
|
|
2
|
-
import { isDevelopmentEnvironment } from '../utils/draft';
|
|
3
|
-
import { buildCompositionTag } from '../utils/tag';
|
|
4
|
-
export const getCanvasClient = (options) => {
|
|
5
|
-
return new CanvasClient({
|
|
6
|
-
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
7
|
-
apiHost: process.env.UNIFORM_API_HOST,
|
|
8
|
-
apiKey: process.env.UNIFORM_API_KEY,
|
|
9
|
-
edgeApiHost: process.env.UNIFORM_EDGE_API_HOST,
|
|
10
|
-
fetch: (req, init) => {
|
|
11
|
-
let requestedUrl;
|
|
12
|
-
if (typeof req === 'string') {
|
|
13
|
-
requestedUrl = new URL(req);
|
|
14
|
-
}
|
|
15
|
-
else if (req instanceof URL) {
|
|
16
|
-
requestedUrl = req;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
requestedUrl = new URL(req.url);
|
|
20
|
-
}
|
|
21
|
-
const tags = [];
|
|
22
|
-
if (requestedUrl) {
|
|
23
|
-
// this is here so this code breaks if parameters change here
|
|
24
|
-
const compositionIdKey = 'compositionId';
|
|
25
|
-
const compositionIdsKey = 'compositionIDs';
|
|
26
|
-
const compositionId = requestedUrl.searchParams.get(compositionIdKey);
|
|
27
|
-
const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
|
|
28
|
-
if (compositionId) {
|
|
29
|
-
tags.push(buildCompositionTag(compositionId));
|
|
30
|
-
}
|
|
31
|
-
if (compositionIds) {
|
|
32
|
-
const ids = compositionIds.split(',');
|
|
33
|
-
for (let i = 0; i < ids.length; i++) {
|
|
34
|
-
tags.push(buildCompositionTag(ids[i]));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
let revalidate = options === null || options === void 0 ? void 0 : options.revalidate;
|
|
39
|
-
let noCache = false;
|
|
40
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
41
|
-
noCache = true;
|
|
42
|
-
revalidate = undefined;
|
|
43
|
-
}
|
|
44
|
-
return fetch(req, {
|
|
45
|
-
...init,
|
|
46
|
-
cache: noCache ? 'no-cache' : 'force-cache',
|
|
47
|
-
next: {
|
|
48
|
-
revalidate,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
};
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { ManifestClient } from '@uniformdev/context/api';
|
|
2
|
-
export type GetManifestClientOptions = {
|
|
3
|
-
revalidate?: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const getManifestClient: (options?: GetManifestClientOptions) => ManifestClient;
|
|
6
|
-
export declare const getManifestFromApi: (options: {
|
|
7
|
-
searchParams:
|
|
8
|
-
| {
|
|
9
|
-
[key: string]: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
| undefined;
|
|
12
|
-
}) => Promise<{
|
|
13
|
-
project: {
|
|
14
|
-
id?: string | undefined;
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
ui_version?: number | undefined;
|
|
17
|
-
pz?:
|
|
18
|
-
| {
|
|
19
|
-
sig?:
|
|
20
|
-
| {
|
|
21
|
-
[key: string]: {
|
|
22
|
-
str: number;
|
|
23
|
-
cap: number;
|
|
24
|
-
dur: 'p' | 's' | 't';
|
|
25
|
-
crit: {
|
|
26
|
-
type: 'G';
|
|
27
|
-
op?: '&' | '|' | undefined;
|
|
28
|
-
clauses: (
|
|
29
|
-
| {
|
|
30
|
-
type: 'G';
|
|
31
|
-
op?: '&' | '|' | undefined;
|
|
32
|
-
clauses: (
|
|
33
|
-
| any
|
|
34
|
-
| {
|
|
35
|
-
type: 'CK';
|
|
36
|
-
cookieName: string;
|
|
37
|
-
match:
|
|
38
|
-
| {
|
|
39
|
-
rhs: string;
|
|
40
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
41
|
-
cs?: boolean | undefined;
|
|
42
|
-
}
|
|
43
|
-
| {
|
|
44
|
-
op: '*' | '!*';
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
| {
|
|
48
|
-
type: 'QS';
|
|
49
|
-
queryName: string;
|
|
50
|
-
match:
|
|
51
|
-
| {
|
|
52
|
-
rhs: string;
|
|
53
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
54
|
-
cs?: boolean | undefined;
|
|
55
|
-
}
|
|
56
|
-
| {
|
|
57
|
-
op: '*' | '!*';
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
| {
|
|
61
|
-
type: 'QK';
|
|
62
|
-
key: string;
|
|
63
|
-
match:
|
|
64
|
-
| {
|
|
65
|
-
rhs: string;
|
|
66
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
67
|
-
cs?: boolean | undefined;
|
|
68
|
-
}
|
|
69
|
-
| {
|
|
70
|
-
op: '*' | '!*';
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
| {
|
|
74
|
-
type: 'EVT';
|
|
75
|
-
event:
|
|
76
|
-
| {
|
|
77
|
-
rhs: string;
|
|
78
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
79
|
-
cs?: boolean | undefined;
|
|
80
|
-
}
|
|
81
|
-
| {
|
|
82
|
-
op: '*' | '!*';
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
| {
|
|
86
|
-
type: 'PV';
|
|
87
|
-
path:
|
|
88
|
-
| {
|
|
89
|
-
rhs: string;
|
|
90
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
91
|
-
cs?: boolean | undefined;
|
|
92
|
-
}
|
|
93
|
-
| {
|
|
94
|
-
op: '*' | '!*';
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
| {
|
|
98
|
-
type: 'PVC';
|
|
99
|
-
match: {
|
|
100
|
-
rhs: number;
|
|
101
|
-
op: '=' | '!=' | '<' | '>';
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
)[];
|
|
105
|
-
}
|
|
106
|
-
| {
|
|
107
|
-
type: 'CK';
|
|
108
|
-
cookieName: string;
|
|
109
|
-
match:
|
|
110
|
-
| {
|
|
111
|
-
rhs: string;
|
|
112
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
113
|
-
cs?: boolean | undefined;
|
|
114
|
-
}
|
|
115
|
-
| {
|
|
116
|
-
op: '*' | '!*';
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
| {
|
|
120
|
-
type: 'QS';
|
|
121
|
-
queryName: string;
|
|
122
|
-
match:
|
|
123
|
-
| {
|
|
124
|
-
rhs: string;
|
|
125
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
126
|
-
cs?: boolean | undefined;
|
|
127
|
-
}
|
|
128
|
-
| {
|
|
129
|
-
op: '*' | '!*';
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
| {
|
|
133
|
-
type: 'QK';
|
|
134
|
-
key: string;
|
|
135
|
-
match:
|
|
136
|
-
| {
|
|
137
|
-
rhs: string;
|
|
138
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
139
|
-
cs?: boolean | undefined;
|
|
140
|
-
}
|
|
141
|
-
| {
|
|
142
|
-
op: '*' | '!*';
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
| {
|
|
146
|
-
type: 'EVT';
|
|
147
|
-
event:
|
|
148
|
-
| {
|
|
149
|
-
rhs: string;
|
|
150
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
151
|
-
cs?: boolean | undefined;
|
|
152
|
-
}
|
|
153
|
-
| {
|
|
154
|
-
op: '*' | '!*';
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
| {
|
|
158
|
-
type: 'PV';
|
|
159
|
-
path:
|
|
160
|
-
| {
|
|
161
|
-
rhs: string;
|
|
162
|
-
op: '~' | '=' | '//' | '!=' | '!~' | '!//';
|
|
163
|
-
cs?: boolean | undefined;
|
|
164
|
-
}
|
|
165
|
-
| {
|
|
166
|
-
op: '*' | '!*';
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
| {
|
|
170
|
-
type: 'PVC';
|
|
171
|
-
match: {
|
|
172
|
-
rhs: number;
|
|
173
|
-
op: '=' | '!=' | '<' | '>';
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
)[];
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
| undefined;
|
|
181
|
-
enr?:
|
|
182
|
-
| {
|
|
183
|
-
[key: string]: {
|
|
184
|
-
cap: number;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
| undefined;
|
|
188
|
-
agg?:
|
|
189
|
-
| {
|
|
190
|
-
[key: string]: {
|
|
191
|
-
inputs: {
|
|
192
|
-
dim: string;
|
|
193
|
-
sign?: '-' | '+' | 'c' | undefined;
|
|
194
|
-
}[];
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
| undefined;
|
|
198
|
-
control?: number | undefined;
|
|
199
|
-
}
|
|
200
|
-
| undefined;
|
|
201
|
-
test?:
|
|
202
|
-
| {
|
|
203
|
-
[key: string]: {
|
|
204
|
-
wv?: string | undefined;
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
| undefined;
|
|
208
|
-
};
|
|
209
|
-
}>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ManifestClient } from '@uniformdev/context/api';
|
|
2
|
-
import { getManifestRevalidateInterval } from '../config/helpers';
|
|
3
|
-
import { isDevelopmentEnvironment } from '../utils/draft';
|
|
4
|
-
export const getManifestClient = (options) => {
|
|
5
|
-
const manifestClient = new ManifestClient({
|
|
6
|
-
apiHost: process.env.UNIFORM_API_HOST || process.env.UNIFORM_CLI_BASE_URL,
|
|
7
|
-
apiKey: process.env.UNIFORM_API_KEY,
|
|
8
|
-
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
9
|
-
fetch: (req, init) => {
|
|
10
|
-
let revalidate = options === null || options === void 0 ? void 0 : options.revalidate;
|
|
11
|
-
let noCache = false;
|
|
12
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
13
|
-
noCache = true;
|
|
14
|
-
revalidate = undefined;
|
|
15
|
-
}
|
|
16
|
-
return fetch(req, {
|
|
17
|
-
...init,
|
|
18
|
-
cache: noCache ? 'no-cache' : 'force-cache',
|
|
19
|
-
next: {
|
|
20
|
-
revalidate,
|
|
21
|
-
tags: ['manifest'],
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return manifestClient;
|
|
27
|
-
};
|
|
28
|
-
export const getManifestFromApi = (options) => {
|
|
29
|
-
const manifestClient = getManifestClient({
|
|
30
|
-
revalidate: getManifestRevalidateInterval(options),
|
|
31
|
-
});
|
|
32
|
-
return manifestClient.get();
|
|
33
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
2
|
-
export const getProjectMapClient = (options) => {
|
|
3
|
-
const manifestClient = new ProjectMapClient({
|
|
4
|
-
apiHost: process.env.UNIFORM_API_HOST || process.env.UNIFORM_CLI_BASE_URL,
|
|
5
|
-
apiKey: process.env.UNIFORM_API_KEY,
|
|
6
|
-
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
7
|
-
fetch: (req, init) => {
|
|
8
|
-
return fetch(req, {
|
|
9
|
-
...init,
|
|
10
|
-
next: {
|
|
11
|
-
revalidate: options === null || options === void 0 ? void 0 : options.revalidate,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
return manifestClient;
|
|
17
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { CANVAS_EDITOR_STATE, RouteClient } from '@uniformdev/canvas';
|
|
2
|
-
import { isDevelopmentEnvironment } from '../utils/draft';
|
|
3
|
-
import { buildPathTag } from '../utils/tag';
|
|
4
|
-
export const getRouteClient = (options) => {
|
|
5
|
-
const client = new RouteClient({
|
|
6
|
-
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
7
|
-
apiKey: process.env.UNIFORM_API_KEY,
|
|
8
|
-
edgeApiHost: process.env.UNIFORM_EDGE_API_HOST,
|
|
9
|
-
fetch: (req, init) => {
|
|
10
|
-
let requestedUrl;
|
|
11
|
-
if (typeof req === 'string') {
|
|
12
|
-
requestedUrl = new URL(req);
|
|
13
|
-
}
|
|
14
|
-
else if (req instanceof URL) {
|
|
15
|
-
requestedUrl = req;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
requestedUrl = new URL(req.url);
|
|
19
|
-
}
|
|
20
|
-
const tags = [];
|
|
21
|
-
let state;
|
|
22
|
-
if (requestedUrl) {
|
|
23
|
-
// this is here so this code breaks if parameters change here
|
|
24
|
-
const pathKey = 'path';
|
|
25
|
-
const stateKey = 'state';
|
|
26
|
-
const path = requestedUrl.searchParams.get(pathKey);
|
|
27
|
-
state = parseInt(requestedUrl.searchParams.get(stateKey) || '', 10);
|
|
28
|
-
if (path) {
|
|
29
|
-
// at this point, we do not know if this path is dynamic or not
|
|
30
|
-
// so apply each segment as a tag so we can clear any segment, ie:
|
|
31
|
-
// /authors/alex would add /authors and /authors/alex as tags
|
|
32
|
-
const pieces = path.split('/');
|
|
33
|
-
for (let i = 0; i < pieces.length; i++) {
|
|
34
|
-
const segmentPieces = pieces.slice(0, i + 1);
|
|
35
|
-
const segment = segmentPieces.join('/');
|
|
36
|
-
tags.push(buildPathTag(segment));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
let revalidate;
|
|
41
|
-
let noCache = false;
|
|
42
|
-
if (options === null || options === void 0 ? void 0 : options.revalidate) {
|
|
43
|
-
revalidate = options.revalidate;
|
|
44
|
-
}
|
|
45
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
46
|
-
noCache = true;
|
|
47
|
-
revalidate = undefined;
|
|
48
|
-
}
|
|
49
|
-
const extraHeaders = {};
|
|
50
|
-
if (state === CANVAS_EDITOR_STATE) {
|
|
51
|
-
extraHeaders['x-bypass-cache'] = 'true';
|
|
52
|
-
}
|
|
53
|
-
return fetch(req, {
|
|
54
|
-
...init,
|
|
55
|
-
cache: noCache ? 'no-cache' : 'force-cache',
|
|
56
|
-
next: {
|
|
57
|
-
revalidate,
|
|
58
|
-
tags: tags.length ? tags : undefined,
|
|
59
|
-
},
|
|
60
|
-
headers: {
|
|
61
|
-
...((init === null || init === void 0 ? void 0 : init.headers) || {}),
|
|
62
|
-
...extraHeaders,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
return client;
|
|
68
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CANVAS_LOCALIZATION_TYPE } from '@uniformdev/canvas';
|
|
3
|
-
const wrapperStyles = {
|
|
4
|
-
display: 'flex',
|
|
5
|
-
flexDirection: 'column',
|
|
6
|
-
gap: '0.5rem',
|
|
7
|
-
borderLeft: '4px solid #e42535',
|
|
8
|
-
padding: '16px',
|
|
9
|
-
fontSize: '16px',
|
|
10
|
-
borderRadius: '0 8px 8px 0',
|
|
11
|
-
margin: '8px',
|
|
12
|
-
backgroundColor: 'rgba(255, 255, 255, 0.45)',
|
|
13
|
-
color: '#1d3557',
|
|
14
|
-
};
|
|
15
|
-
export function DefaultNotImplementedComponent(props) {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
const componentType = (_a = props.component) === null || _a === void 0 ? void 0 : _a.type;
|
|
18
|
-
if (!componentType) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
if (componentType === CANVAS_LOCALIZATION_TYPE) {
|
|
22
|
-
return (_jsx("div", { style: wrapperStyles, children: _jsxs("p", { children: ["Seems like localization is not enabled in your application. Please read our documentation on how to", ' ', _jsx("a", { href: "https://docs.uniform.app/guides/composition/localization#activate-front-end", target: "_blank", style: { fontWeight: 'bolder', textDecoration: 'underline' }, rel: "noreferrer", children: "enable localization in your front-end application." })] }) }));
|
|
23
|
-
}
|
|
24
|
-
const proposedFileName = `${componentType[0].toUpperCase()}${componentType.substring(1)}`;
|
|
25
|
-
const probableProps = Object.keys((_b = props.component.parameters) !== null && _b !== void 0 ? _b : {});
|
|
26
|
-
const probableSlots = Object.keys((_c = props.component.slots) !== null && _c !== void 0 ? _c : {});
|
|
27
|
-
return (_jsxs("div", { style: wrapperStyles, children: [_jsx("h2", { style: { fontSize: '1.2rem' }, children: "Unknown Component" }), _jsxs("p", { children: ["Received request from Uniform to render a component with the public ID: ", _jsx("code", { children: componentType }), "."] }), _jsxs("p", { children: [_jsx("code", { children: "<UniformComposition />" }), " does not have ", _jsx("code", { children: componentType }), " mapped to a React component yet."] }), _jsx("p", { children: "To teach your app how to render this component:" }), ' ', _jsxs("ul", { style: {
|
|
28
|
-
listStyleType: 'disc',
|
|
29
|
-
marginLeft: '1rem',
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexDirection: 'column',
|
|
32
|
-
gap: '0.5rem',
|
|
33
|
-
}, children: [_jsxs("li", { children: ["Create a React component and register it with Uniform, for example", _jsx("pre", { children: `function ${proposedFileName}(${probableProps.length > 0 ? `{ ${probableProps.join(', ')} }` : ''}) {
|
|
34
|
-
return (
|
|
35
|
-
<div>
|
|
36
|
-
${proposedFileName}!
|
|
37
|
-
${probableSlots.length > 0
|
|
38
|
-
? probableSlots.map((slot) => `<UniformSlot name="${slot}" />`).join('\n ')
|
|
39
|
-
: ''}
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
registerUniformComponent({ type: "${componentType}", component: ${proposedFileName} })` }), _jsxs("details", { children: [_jsx("summary", { style: { cursor: 'pointer' }, children: "Props that your React component will receive" }), _jsx("pre", { children: JSON.stringify(props, null, 2) })] })] }), _jsxs("li", { children: ["Import the component into the file where ", _jsx("code", { children: "<UniformComposition />" }), " is defined, for example ", _jsx("pre", { children: `import "../components/${proposedFileName}.tsx"` })] })] }), ' ', _jsxs("p", { children: ["Need more help?", ' ', _jsx("a", { href: "https://docs.uniform.app/docs/guides/composition/rendering", target: "_blank", rel: "noreferrer", style: { textDecoration: 'underline' }, children: "Check out the documentation." })] })] }));
|
|
45
|
-
}
|