@remkoj/optimizely-cms-react 2.1.0 → 3.0.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/README.md +36 -2
- package/dist/components/client.d.ts +42 -0
- package/dist/components/client.js +52 -0
- package/dist/components/client.js.map +1 -0
- package/dist/components/cms-content/client.d.ts +11 -0
- package/dist/components/cms-content/client.js +72 -0
- package/dist/components/cms-content/client.js.map +1 -0
- package/dist/components/cms-content/get-content-type.d.ts +13 -0
- package/dist/components/cms-content/get-content-type.js +70 -0
- package/dist/components/cms-content/get-content-type.js.map +1 -0
- package/dist/components/cms-content/get-content.d.ts +4 -0
- package/dist/components/cms-content/get-content.js +91 -0
- package/dist/components/cms-content/get-content.js.map +1 -0
- package/dist/components/cms-content/resolve-component.d.ts +18 -0
- package/dist/components/cms-content/resolve-component.js +53 -0
- package/dist/components/cms-content/resolve-component.js.map +1 -0
- package/dist/components/cms-content/resolve-content-type.d.ts +15 -0
- package/dist/components/cms-content/resolve-content-type.js +29 -0
- package/dist/components/cms-content/resolve-content-type.js.map +1 -0
- package/dist/components/cms-content/rsc.d.ts +11 -0
- package/dist/components/cms-content/rsc.js +50 -0
- package/dist/components/cms-content/rsc.js.map +1 -0
- package/dist/components/cms-content/types.d.ts +54 -0
- package/dist/components/cms-content/types.js +2 -0
- package/dist/components/cms-content/types.js.map +1 -0
- package/dist/components/cms-content/utils.d.ts +3 -0
- package/dist/components/cms-content/utils.js +6 -0
- package/dist/components/cms-content/utils.js.map +1 -0
- package/dist/components/cms-content-area/index.d.ts +17 -0
- package/dist/{server/components/cms-content-area.js → components/cms-content-area/index.js} +27 -36
- package/dist/components/cms-content-area/index.js.map +1 -0
- package/dist/{server/components → components/cms-content-area}/types.d.ts +7 -94
- package/dist/components/cms-content-area/types.js.map +1 -0
- package/dist/{server/components/cms-editable.d.ts → components/cms-editable/index.d.ts} +5 -3
- package/dist/components/cms-editable/index.js +15 -0
- package/dist/components/cms-editable/index.js.map +1 -0
- package/dist/components/{cms-styles.js → cms-styles/index.js} +1 -1
- package/dist/components/cms-styles/index.js.map +1 -0
- package/dist/components/rich-text/components.d.ts +14 -0
- package/dist/components/rich-text/components.js +63 -0
- package/dist/components/rich-text/components.js.map +1 -0
- package/dist/components/rich-text/index.d.ts +4 -0
- package/dist/components/rich-text/index.js +47 -0
- package/dist/components/rich-text/index.js.map +1 -0
- package/dist/components/{rich-text.d.ts → rich-text/types.d.ts} +13 -18
- package/dist/components/rich-text/types.js +2 -0
- package/dist/components/rich-text/types.js.map +1 -0
- package/dist/components/rich-text/utils.d.ts +5 -0
- package/dist/components/rich-text/utils.js +24 -0
- package/dist/components/rich-text/utils.js.map +1 -0
- package/dist/components/rsc.d.ts +47 -0
- package/dist/components/rsc.js +55 -0
- package/dist/components/rsc.js.map +1 -0
- package/dist/{server → components}/type-utils.js.map +1 -1
- package/dist/{server/components → components}/visual-builder/functions.d.ts +7 -2
- package/dist/{server/components → components}/visual-builder/functions.js +8 -3
- package/dist/components/visual-builder/functions.js.map +1 -0
- package/dist/{server/components/visual-builder/Composition.d.ts → components/visual-builder/index.d.ts} +4 -3
- package/dist/{server/components/visual-builder/Composition.js → components/visual-builder/index.js} +9 -18
- package/dist/components/visual-builder/index.js.map +1 -0
- package/dist/{server/components → components}/visual-builder/types.d.ts +6 -1
- package/dist/components/visual-builder/types.js.map +1 -0
- package/dist/components.d.ts +27 -0
- package/dist/components.js +20 -0
- package/dist/components.js.map +1 -0
- package/dist/context/client.d.ts +70 -0
- package/dist/context/client.js +78 -0
- package/dist/context/client.js.map +1 -0
- package/dist/context/rsc.d.ts +33 -0
- package/dist/context/rsc.js +75 -0
- package/dist/context/rsc.js.map +1 -0
- package/dist/context/types.d.ts +15 -0
- package/dist/context/types.js +2 -0
- package/dist/{server/components → context}/types.js.map +1 -1
- package/dist/{server/components → data}/queries.js +121 -121
- package/dist/data/queries.js.map +1 -0
- package/dist/{factory.d.ts → factory/default.d.ts} +0 -18
- package/dist/{factory.js → factory/default.js} +1 -33
- package/dist/factory/default.js.map +1 -0
- package/dist/factory/index.d.ts +12 -0
- package/dist/factory/index.js +16 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/factory/types.d.ts +51 -0
- package/dist/factory/types.js +2 -0
- package/dist/factory/types.js.map +1 -0
- package/dist/factory/undef.d.ts +9 -0
- package/dist/factory/undef.js +19 -0
- package/dist/factory/undef.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{server/is-debug.d.ts → rsc-utilities.d.ts} +0 -1
- package/dist/{server/is-debug.js → rsc-utilities.js} +1 -2
- package/dist/{server/is-debug.js.map → rsc-utilities.js.map} +1 -1
- package/dist/rsc.d.ts +11 -0
- package/dist/rsc.js +14 -0
- package/dist/rsc.js.map +1 -0
- package/dist/types.d.ts +10 -56
- package/package.json +12 -24
- package/dist/browser/context.d.ts +0 -6
- package/dist/browser/context.js +0 -15
- package/dist/browser/context.js.map +0 -1
- package/dist/browser/index.d.ts +0 -1
- package/dist/browser/index.js +0 -2
- package/dist/browser/index.js.map +0 -1
- package/dist/components/cms-styles.js.map +0 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +0 -3
- package/dist/components/index.js.map +0 -1
- package/dist/components/rich-text.js +0 -138
- package/dist/components/rich-text.js.map +0 -1
- package/dist/factory.js.map +0 -1
- package/dist/server/components/cms-content-area.d.ts +0 -13
- package/dist/server/components/cms-content-area.js.map +0 -1
- package/dist/server/components/cms-content.d.ts +0 -11
- package/dist/server/components/cms-content.js +0 -154
- package/dist/server/components/cms-content.js.map +0 -1
- package/dist/server/components/cms-editable.js +0 -18
- package/dist/server/components/cms-editable.js.map +0 -1
- package/dist/server/components/get-content-type.d.ts +0 -12
- package/dist/server/components/get-content-type.js +0 -51
- package/dist/server/components/get-content-type.js.map +0 -1
- package/dist/server/components/index.d.ts +0 -4
- package/dist/server/components/index.js +0 -5
- package/dist/server/components/index.js.map +0 -1
- package/dist/server/components/queries.js.map +0 -1
- package/dist/server/components/visual-builder/Composition.js.map +0 -1
- package/dist/server/components/visual-builder/functions.js.map +0 -1
- package/dist/server/components/visual-builder/index.d.ts +0 -4
- package/dist/server/components/visual-builder/index.js +0 -4
- package/dist/server/components/visual-builder/index.js.map +0 -1
- package/dist/server/components/visual-builder/types.js.map +0 -1
- package/dist/server/context.d.ts +0 -22
- package/dist/server/context.js +0 -81
- package/dist/server/context.js.map +0 -1
- package/dist/server/factory.d.ts +0 -10
- package/dist/server/factory.js +0 -18
- package/dist/server/factory.js.map +0 -1
- package/dist/server/index.d.ts +0 -6
- package/dist/server/index.js +0 -6
- package/dist/server/index.js.map +0 -1
- /package/dist/{server/components → components/cms-content-area}/types.js +0 -0
- /package/dist/components/{cms-styles.d.ts → cms-styles/index.d.ts} +0 -0
- /package/dist/{server → components}/type-utils.d.ts +0 -0
- /package/dist/{server → components}/type-utils.js +0 -0
- /package/dist/{server/components → components}/visual-builder/types.js +0 -0
- /package/dist/{server/components → data}/queries.d.ts +0 -0
|
@@ -1,142 +1,142 @@
|
|
|
1
1
|
import { gql } from 'graphql-request';
|
|
2
2
|
export const CmsContentFragments = {
|
|
3
3
|
IContentDataProps: ["_metadata", "_type", "__typename"],
|
|
4
|
-
ContentLink: gql `fragment ContentLink on ContentModelReference {
|
|
5
|
-
id: Id,
|
|
6
|
-
workId: WorkId,
|
|
7
|
-
guidValue: GuidValue
|
|
4
|
+
ContentLink: gql `fragment ContentLink on ContentModelReference {
|
|
5
|
+
id: Id,
|
|
6
|
+
workId: WorkId,
|
|
7
|
+
guidValue: GuidValue
|
|
8
8
|
}`,
|
|
9
|
-
ContentLinkSearch: gql `fragment ContentLinkSearch on ContentModelReferenceSearch {
|
|
10
|
-
id: Id,
|
|
11
|
-
workId: WorkId,
|
|
12
|
-
guidValue: GuidValue
|
|
9
|
+
ContentLinkSearch: gql `fragment ContentLinkSearch on ContentModelReferenceSearch {
|
|
10
|
+
id: Id,
|
|
11
|
+
workId: WorkId,
|
|
12
|
+
guidValue: GuidValue
|
|
13
13
|
}`,
|
|
14
|
-
IContentData: gql `fragment IContentData on IContent {
|
|
15
|
-
contentType: ContentType
|
|
16
|
-
id: ContentLink {
|
|
17
|
-
...ContentLink
|
|
18
|
-
}
|
|
19
|
-
locale: Language {
|
|
20
|
-
name: Name
|
|
21
|
-
}
|
|
22
|
-
path:RelativePath
|
|
14
|
+
IContentData: gql `fragment IContentData on IContent {
|
|
15
|
+
contentType: ContentType
|
|
16
|
+
id: ContentLink {
|
|
17
|
+
...ContentLink
|
|
18
|
+
}
|
|
19
|
+
locale: Language {
|
|
20
|
+
name: Name
|
|
21
|
+
}
|
|
22
|
+
path:RelativePath
|
|
23
23
|
}`,
|
|
24
|
-
ContentAreaItemData: gql `fragment ContentAreaItemData on ContentAreaItemModelSearch {
|
|
25
|
-
item: ContentLink {
|
|
26
|
-
...ContentLinkSearch
|
|
27
|
-
data: Expanded {
|
|
28
|
-
...BlockData
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
displayOption:DisplayOption
|
|
24
|
+
ContentAreaItemData: gql `fragment ContentAreaItemData on ContentAreaItemModelSearch {
|
|
25
|
+
item: ContentLink {
|
|
26
|
+
...ContentLinkSearch
|
|
27
|
+
data: Expanded {
|
|
28
|
+
...BlockData
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
displayOption:DisplayOption
|
|
32
32
|
}`,
|
|
33
|
-
BlockContentAreaItemSearchData: gql `fragment BlockContentAreaItemSearchData on ContentAreaItemModelSearch {
|
|
34
|
-
item: ContentLink {
|
|
35
|
-
...ContentLinkSearch
|
|
36
|
-
data: Expanded {
|
|
37
|
-
...IContentData
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
displayOption:DisplayOption
|
|
33
|
+
BlockContentAreaItemSearchData: gql `fragment BlockContentAreaItemSearchData on ContentAreaItemModelSearch {
|
|
34
|
+
item: ContentLink {
|
|
35
|
+
...ContentLinkSearch
|
|
36
|
+
data: Expanded {
|
|
37
|
+
...IContentData
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
displayOption:DisplayOption
|
|
41
41
|
}`,
|
|
42
|
-
BlockContentAreaItemData: gql `fragment BlockContentAreaItemData on ContentAreaItemModel {
|
|
43
|
-
item: ContentLink {
|
|
44
|
-
...ContentLink
|
|
45
|
-
data: Expanded {
|
|
46
|
-
...IContentData
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
displayOption:DisplayOption
|
|
42
|
+
BlockContentAreaItemData: gql `fragment BlockContentAreaItemData on ContentAreaItemModel {
|
|
43
|
+
item: ContentLink {
|
|
44
|
+
...ContentLink
|
|
45
|
+
data: Expanded {
|
|
46
|
+
...IContentData
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
displayOption:DisplayOption
|
|
50
50
|
}`,
|
|
51
|
-
LinkItemData: gql `fragment LinkItemData on LinkItemNode {
|
|
52
|
-
children: Text
|
|
53
|
-
title: Title
|
|
54
|
-
href: Href
|
|
55
|
-
target: Target
|
|
56
|
-
content: ContentLink {
|
|
57
|
-
href: Url
|
|
58
|
-
data: Expanded {
|
|
59
|
-
path: RelativePath
|
|
60
|
-
}
|
|
61
|
-
}
|
|
51
|
+
LinkItemData: gql `fragment LinkItemData on LinkItemNode {
|
|
52
|
+
children: Text
|
|
53
|
+
title: Title
|
|
54
|
+
href: Href
|
|
55
|
+
target: Target
|
|
56
|
+
content: ContentLink {
|
|
57
|
+
href: Url
|
|
58
|
+
data: Expanded {
|
|
59
|
+
path: RelativePath
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
62
|
}`,
|
|
63
|
-
ImageData: gql `fragment ImageData on ContentModelReference {
|
|
64
|
-
...ContentLink
|
|
65
|
-
url: Url
|
|
66
|
-
data: Expanded {
|
|
67
|
-
...IContentData
|
|
68
|
-
url: Url
|
|
69
|
-
alt: Name
|
|
70
|
-
path: RelativePath
|
|
71
|
-
}
|
|
63
|
+
ImageData: gql `fragment ImageData on ContentModelReference {
|
|
64
|
+
...ContentLink
|
|
65
|
+
url: Url
|
|
66
|
+
data: Expanded {
|
|
67
|
+
...IContentData
|
|
68
|
+
url: Url
|
|
69
|
+
alt: Name
|
|
70
|
+
path: RelativePath
|
|
71
|
+
}
|
|
72
72
|
}`,
|
|
73
|
-
ImageDataSearch: gql `fragment ImageDataSearch on ContentModelReferenceSearch {
|
|
74
|
-
...ContentLinkSearch
|
|
75
|
-
url: Url
|
|
76
|
-
data: Expanded {
|
|
77
|
-
...IContentData
|
|
78
|
-
url: Url
|
|
79
|
-
alt: Name
|
|
80
|
-
path: RelativePath
|
|
81
|
-
}
|
|
73
|
+
ImageDataSearch: gql `fragment ImageDataSearch on ContentModelReferenceSearch {
|
|
74
|
+
...ContentLinkSearch
|
|
75
|
+
url: Url
|
|
76
|
+
data: Expanded {
|
|
77
|
+
...IContentData
|
|
78
|
+
url: Url
|
|
79
|
+
alt: Name
|
|
80
|
+
path: RelativePath
|
|
81
|
+
}
|
|
82
82
|
}`,
|
|
83
|
-
BlockData: gql `fragment BlockData on IContent {
|
|
84
|
-
...IContentData
|
|
83
|
+
BlockData: gql `fragment BlockData on IContent {
|
|
84
|
+
...IContentData
|
|
85
85
|
}`,
|
|
86
|
-
PageData: gql `fragment PageData on IContent {
|
|
87
|
-
...IContentData
|
|
86
|
+
PageData: gql `fragment PageData on IContent {
|
|
87
|
+
...IContentData
|
|
88
88
|
}`
|
|
89
89
|
};
|
|
90
90
|
export const ContentAreaFragments = {
|
|
91
|
-
ContentAreaItemBase: gql `fragment ContentAreaItemBase on ContentAreaItemModelSearch {
|
|
92
|
-
contentLink:ContentLink {
|
|
93
|
-
id:Id
|
|
94
|
-
workId:WorkId
|
|
95
|
-
guidValue:GuidValue
|
|
96
|
-
component:Expanded {
|
|
97
|
-
path:RelativePath
|
|
98
|
-
type:ContentType
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
displayOption:DisplayOption
|
|
91
|
+
ContentAreaItemBase: gql `fragment ContentAreaItemBase on ContentAreaItemModelSearch {
|
|
92
|
+
contentLink:ContentLink {
|
|
93
|
+
id:Id
|
|
94
|
+
workId:WorkId
|
|
95
|
+
guidValue:GuidValue
|
|
96
|
+
component:Expanded {
|
|
97
|
+
path:RelativePath
|
|
98
|
+
type:ContentType
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
displayOption:DisplayOption
|
|
102
102
|
}`
|
|
103
103
|
};
|
|
104
|
-
export const getContentById = gql `query getContentById($id: Int, $workId: Int, $guidValue: String, $locale: [Locales!], $isCommonDraft: Boolean) {
|
|
105
|
-
content:_Content(
|
|
106
|
-
where: {
|
|
107
|
-
ContentLink: {
|
|
108
|
-
Id: { eq: $id },
|
|
109
|
-
WorkId: { eq: $workId },
|
|
110
|
-
GuidValue: { eq: $guidValue }
|
|
111
|
-
}
|
|
112
|
-
IsCommonDraft: { eq: $isCommonDraft }
|
|
113
|
-
}
|
|
114
|
-
locale: $locale
|
|
115
|
-
) {
|
|
116
|
-
total
|
|
117
|
-
items {
|
|
118
|
-
...IContentData
|
|
119
|
-
...PageData
|
|
120
|
-
...BlockData
|
|
121
|
-
}
|
|
122
|
-
}
|
|
104
|
+
export const getContentById = gql `query getContentById($id: Int, $workId: Int, $guidValue: String, $locale: [Locales!], $isCommonDraft: Boolean) {
|
|
105
|
+
content:_Content(
|
|
106
|
+
where: {
|
|
107
|
+
ContentLink: {
|
|
108
|
+
Id: { eq: $id },
|
|
109
|
+
WorkId: { eq: $workId },
|
|
110
|
+
GuidValue: { eq: $guidValue }
|
|
111
|
+
}
|
|
112
|
+
IsCommonDraft: { eq: $isCommonDraft }
|
|
113
|
+
}
|
|
114
|
+
locale: $locale
|
|
115
|
+
) {
|
|
116
|
+
total
|
|
117
|
+
items {
|
|
118
|
+
...IContentData
|
|
119
|
+
...PageData
|
|
120
|
+
...BlockData
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
123
|
}`;
|
|
124
|
-
export const getContentByPath = gql `query getContentByPath($path: String!, $locale: [Locales], $siteId: String)
|
|
125
|
-
{
|
|
126
|
-
content: _Content(
|
|
127
|
-
where: {
|
|
128
|
-
RelativePath: {
|
|
129
|
-
eq: $path
|
|
130
|
-
}
|
|
131
|
-
SiteId: {
|
|
132
|
-
eq: $siteId
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
locale: $locale
|
|
136
|
-
) {
|
|
137
|
-
items {
|
|
138
|
-
...PageData
|
|
139
|
-
}
|
|
140
|
-
}
|
|
124
|
+
export const getContentByPath = gql `query getContentByPath($path: String!, $locale: [Locales], $siteId: String)
|
|
125
|
+
{
|
|
126
|
+
content: _Content(
|
|
127
|
+
where: {
|
|
128
|
+
RelativePath: {
|
|
129
|
+
eq: $path
|
|
130
|
+
}
|
|
131
|
+
SiteId: {
|
|
132
|
+
eq: $siteId
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
locale: $locale
|
|
136
|
+
) {
|
|
137
|
+
items {
|
|
138
|
+
...PageData
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
141
|
}`;
|
|
142
142
|
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/data/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,iBAAiB,EAAE,CAAC,WAAW,EAAC,OAAO,EAAC,YAAY,CAAC;IACrD,WAAW,EAAE,GAAG,CAAA;;;;MAId;IACF,iBAAiB,EAAE,GAAG,CAAA;;;;MAIpB;IACF,YAAY,EAAE,GAAG,CAAA;;;;;;;;;MASf;IACF,mBAAmB,EAAE,GAAG,CAAA;;;;;;;;MAQtB;IACF,8BAA8B,EAAE,GAAG,CAAA;;;;;;;;MAQjC;IACF,wBAAwB,EAAE,GAAG,CAAA;;;;;;;;MAQ3B;IACF,YAAY,EAAE,GAAG,CAAA;;;;;;;;;;;MAWf;IACF,SAAS,EAAE,GAAG,CAAA;;;;;;;;;MASZ;IACF,eAAe,EAAE,GAAG,CAAA;;;;;;;;;MASlB;IACF,SAAS,EAAE,GAAG,CAAA;;MAEZ;IACF,QAAQ,EAAE,GAAG,CAAA;;MAEX;CACL,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,mBAAmB,EAAE,GAAG,CAAA;;;;;;;;;;;IAWtB;CACH,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;EAmB/B,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;EAiBjC,CAAA"}
|
|
@@ -20,21 +20,3 @@ export declare class DefaultComponentFactory implements ComponentFactory {
|
|
|
20
20
|
resolve(type: ComponentTypeHandle): undefined | ComponentType;
|
|
21
21
|
extract(): ComponentTypeDictionary;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Retrieve the currently staticly cached ComponentFactory instance, if there's no
|
|
25
|
-
* currently staticly cached ComponentFactory, the default ComponentFactory will be
|
|
26
|
-
* returned
|
|
27
|
-
*
|
|
28
|
-
* @returns The ComponentFactory
|
|
29
|
-
*/
|
|
30
|
-
export declare const getFactory: () => ComponentFactory;
|
|
31
|
-
/**
|
|
32
|
-
* Update the staticly cached Component Factory, which will be returned by all future
|
|
33
|
-
* "getFactory" calls
|
|
34
|
-
*
|
|
35
|
-
* @param newFactory The ComponentFactory to set as staticly cached instance
|
|
36
|
-
* @returns void
|
|
37
|
-
*/
|
|
38
|
-
export declare const setFactory: (newFactory: ComponentFactory) => void;
|
|
39
|
-
declare const _default: ComponentFactory;
|
|
40
|
-
export default _default;
|
|
@@ -62,36 +62,4 @@ function processComponentTypeHandle(handle) {
|
|
|
62
62
|
.join(MERGE_SYMBOL); // Types are processed as a string
|
|
63
63
|
throw new Error(`Invalid component type handle: ${typeof (handle)}`);
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Retrieve the currently staticly cached ComponentFactory instance, if there's no
|
|
68
|
-
* currently staticly cached ComponentFactory, the default ComponentFactory will be
|
|
69
|
-
* returned
|
|
70
|
-
*
|
|
71
|
-
* @returns The ComponentFactory
|
|
72
|
-
*/
|
|
73
|
-
export const getFactory = () => {
|
|
74
|
-
const DBG = process.env.OPTIMIZELY_DEBUG == '1';
|
|
75
|
-
if (!_static.factory) {
|
|
76
|
-
if (DBG)
|
|
77
|
-
console.log("⚪ [ComponentFactory] Creating new Component Factory");
|
|
78
|
-
_static.factory = new DefaultComponentFactory();
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
if (DBG)
|
|
82
|
-
console.log("⚪ [ComponentFactory] Reusing existing Component Factory");
|
|
83
|
-
}
|
|
84
|
-
return _static.factory;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Update the staticly cached Component Factory, which will be returned by all future
|
|
88
|
-
* "getFactory" calls
|
|
89
|
-
*
|
|
90
|
-
* @param newFactory The ComponentFactory to set as staticly cached instance
|
|
91
|
-
* @returns void
|
|
92
|
-
*/
|
|
93
|
-
export const setFactory = (newFactory) => {
|
|
94
|
-
_static.factory = newFactory;
|
|
95
|
-
};
|
|
96
|
-
export default getFactory();
|
|
97
|
-
//# sourceMappingURL=factory.js.map
|
|
65
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentFactory } from "./types.js";
|
|
2
|
+
export type * from "./types.js";
|
|
3
|
+
export { DefaultComponentFactory } from "./default.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create a new instance of the included DefaultComponentFactory, which should
|
|
6
|
+
* be wrapped in a form of caching provided by your project.
|
|
7
|
+
*
|
|
8
|
+
* @returns The ComponentFactory
|
|
9
|
+
*/
|
|
10
|
+
export declare const getFactory: () => ComponentFactory;
|
|
11
|
+
declare const _default: ComponentFactory;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DefaultComponentFactory } from "./default.js";
|
|
2
|
+
export { DefaultComponentFactory } from "./default.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a new instance of the included DefaultComponentFactory, which should
|
|
5
|
+
* be wrapped in a form of caching provided by your project.
|
|
6
|
+
*
|
|
7
|
+
* @returns The ComponentFactory
|
|
8
|
+
*/
|
|
9
|
+
export const getFactory = () => {
|
|
10
|
+
const DBG = process.env.OPTIMIZELY_DEBUG == '1';
|
|
11
|
+
if (DBG)
|
|
12
|
+
console.log("⚪ [ComponentFactory] Creating new Component Factory");
|
|
13
|
+
return new DefaultComponentFactory();
|
|
14
|
+
};
|
|
15
|
+
export default getFactory();
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAGtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAA4B,GAAG,EAAE;IACpD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAA;IAC/C,IAAI,GAAG;QAAE,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAA;IAC3E,OAAO,IAAI,uBAAuB,EAAE,CAAA;AACxC,CAAC,CAAA;AAED,eAAe,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ComponentType as ReactComponentType, ExoticComponent as ReactExoticComponent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Basic Component Type descriptor for the Component Factory
|
|
4
|
+
*/
|
|
5
|
+
export type ComponentType = (ReactComponentType<any>) | (ReactExoticComponent<any>) | (keyof JSX.IntrinsicElements);
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export type ComponentTypeHandle = string | string[];
|
|
10
|
+
export type ComponentTypeDictionary = {
|
|
11
|
+
type: ComponentTypeHandle;
|
|
12
|
+
component: ComponentType;
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* Component Factory
|
|
16
|
+
*/
|
|
17
|
+
export interface ComponentFactory {
|
|
18
|
+
/**
|
|
19
|
+
* Check if the component type has been registered within the factory
|
|
20
|
+
*
|
|
21
|
+
* @param type The component type to check for
|
|
22
|
+
* @returns Whether or not the type exists within the factory
|
|
23
|
+
*/
|
|
24
|
+
has(type: ComponentTypeHandle): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Register an individual component
|
|
27
|
+
* @param type The component type to register
|
|
28
|
+
* @param componentType The component to bind to the type
|
|
29
|
+
*/
|
|
30
|
+
register(type: ComponentTypeHandle, componentType: ComponentType): void;
|
|
31
|
+
/**
|
|
32
|
+
* Register all components provided through the dictionary
|
|
33
|
+
*
|
|
34
|
+
* @param components The components to register
|
|
35
|
+
*/
|
|
36
|
+
registerAll(components: ComponentTypeDictionary): void;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a component type
|
|
39
|
+
*
|
|
40
|
+
* @param type The type to search the component for
|
|
41
|
+
* @returns The component that was resolved for the provided type
|
|
42
|
+
*/
|
|
43
|
+
resolve(type: ComponentTypeHandle): ComponentType | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve the registered components as a dictionary that can be used to
|
|
46
|
+
* be imported in a new instance.
|
|
47
|
+
*
|
|
48
|
+
* @returns The dictionary
|
|
49
|
+
*/
|
|
50
|
+
extract(): ComponentTypeDictionary;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/factory/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType, ComponentTypeDictionary, ComponentTypeHandle, type ComponentFactory } from "./types.js";
|
|
2
|
+
export declare class UndefinedComponentFactory implements ComponentFactory {
|
|
3
|
+
has(type: ComponentTypeHandle): boolean;
|
|
4
|
+
register(type: ComponentTypeHandle, componentType: ComponentType): void;
|
|
5
|
+
registerAll(components: ComponentTypeDictionary): void;
|
|
6
|
+
resolve(type: ComponentTypeHandle): ComponentType | undefined;
|
|
7
|
+
extract(): ComponentTypeDictionary;
|
|
8
|
+
}
|
|
9
|
+
export default UndefinedComponentFactory;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class UndefinedComponentFactory {
|
|
2
|
+
has(type) {
|
|
3
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
4
|
+
}
|
|
5
|
+
register(type, componentType) {
|
|
6
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
7
|
+
}
|
|
8
|
+
registerAll(components) {
|
|
9
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
10
|
+
}
|
|
11
|
+
resolve(type) {
|
|
12
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
13
|
+
}
|
|
14
|
+
extract() {
|
|
15
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default UndefinedComponentFactory;
|
|
19
|
+
//# sourceMappingURL=undef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undef.js","sourceRoot":"","sources":["../../src/factory/undef.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAAyB;IAClC,GAAG,CAAC,IAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,QAAQ,CAAC,IAAyB,EAAE,aAA4B;QAC5D,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,WAAW,CAAC,UAAmC;QAC3C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,CAAC,IAAyB;QAC7B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO;QACH,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;CACJ;AAED,eAAe,yBAAyB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The version of the current Optimizely DXP React SDK
|
|
3
3
|
*/
|
|
4
|
-
export declare const Version = "
|
|
4
|
+
export declare const Version = "3.0.0";
|
|
5
5
|
export * from './types.js';
|
|
6
6
|
export * as Errors from './errors.js';
|
|
7
7
|
export * as Utils from './utilities.js';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './context/client.js';
|
|
9
|
+
export * from './factory/index.js';
|
|
10
|
+
export * from './components/client.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The version of the current Optimizely DXP React SDK
|
|
3
3
|
*/
|
|
4
|
-
export const Version = '
|
|
4
|
+
export const Version = '3.0.0';
|
|
5
5
|
// Export library
|
|
6
6
|
export * from './types.js';
|
|
7
7
|
export * as Errors from './errors.js';
|
|
8
8
|
export * as Utils from './utilities.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './context/client.js';
|
|
10
|
+
export * from './factory/index.js';
|
|
11
|
+
export * from './components/client.js';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAE9B,iBAAiB;AACjB,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAE9B,iBAAiB;AACjB,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"rsc-utilities.js","sourceRoot":"","sources":["../src/rsc-utilities.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO;IAEnB,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,gBAAgB,IAAI,OAAO,EAAE,GAAG,EAAE,SAAS,CAAA;QACvE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA;IACxE,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa;IAEzB,IAAI,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;IAChD,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|
package/dist/rsc.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version of the current Optimizely DXP React SDK
|
|
3
|
+
*/
|
|
4
|
+
export declare const Version = "3.0.0";
|
|
5
|
+
export * as Errors from './errors.js';
|
|
6
|
+
export * as Utils from './utilities.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './factory/index.js';
|
|
9
|
+
export * from './context/rsc.js';
|
|
10
|
+
export * from './components/rsc.js';
|
|
11
|
+
export * from './rsc-utilities.js';
|
package/dist/rsc.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version of the current Optimizely DXP React SDK
|
|
3
|
+
*/
|
|
4
|
+
export const Version = '3.0.0';
|
|
5
|
+
// Export library
|
|
6
|
+
export * as Errors from './errors.js';
|
|
7
|
+
export * as Utils from './utilities.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * from './factory/index.js';
|
|
10
|
+
// Export React Server Components
|
|
11
|
+
export * from './context/rsc.js';
|
|
12
|
+
export * from './components/rsc.js';
|
|
13
|
+
export * from './rsc-utilities.js';
|
|
14
|
+
//# sourceMappingURL=rsc.js.map
|
package/dist/rsc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../src/rsc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAE9B,iBAAiB;AACjB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAElC,iCAAiC;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { PropsWithChildren, ComponentType as ReactComponentType
|
|
1
|
+
import type { PropsWithChildren, ComponentType as ReactComponentType } from "react";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
3
|
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
4
|
-
import type { IOptiGraphClient } from "@remkoj/optimizely-graph-client";
|
|
5
4
|
import type { ContentLinkWithLocale, InlineContentLinkWithLocale } from "@remkoj/optimizely-graph-client";
|
|
6
5
|
export type ContentType = string[];
|
|
7
|
-
export type {
|
|
6
|
+
export type {
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use the export from `@remkoj/optimizely-graph-client` directly
|
|
9
|
+
*/
|
|
10
|
+
ContentLink,
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use the export from `@remkoj/optimizely-graph-client` directly
|
|
13
|
+
*/
|
|
14
|
+
ContentLinkWithLocale } from "@remkoj/optimizely-graph-client";
|
|
8
15
|
export type CmsComponentProps<T, L extends Record<string, any> = Record<string, any>> = PropsWithChildren<{
|
|
9
16
|
/**
|
|
10
17
|
* The identifier of the content item
|
|
@@ -66,56 +73,3 @@ export type CmsComponent<T = DocumentNode, L extends Record<string, any> = Recor
|
|
|
66
73
|
[key: string]: any;
|
|
67
74
|
}, L> : T extends GraphQLFragmentBase ? CmsComponentWithFragment<T, L> : T extends GraphQLQueryBase ? CmsComponentWithQuery<T, L> : CmsComponentWithOptionalQuery<T, L>;
|
|
68
75
|
export type CmsLayoutComponent<L extends Record<string, any> = Record<string, any>, T = never> = ReactComponentType<CmsComponentProps<T, L>>;
|
|
69
|
-
export type ComponentType = (ReactComponentType<any>) | (ReactExoticComponent<any>) | (keyof JSX.IntrinsicElements);
|
|
70
|
-
export type ComponentTypeHandle = string | string[];
|
|
71
|
-
export type ComponentTypeDictionary = {
|
|
72
|
-
type: ComponentTypeHandle;
|
|
73
|
-
component: ComponentType;
|
|
74
|
-
}[];
|
|
75
|
-
/**
|
|
76
|
-
* Component Factory
|
|
77
|
-
*/
|
|
78
|
-
export interface ComponentFactory {
|
|
79
|
-
/**
|
|
80
|
-
* Check if the component type has been registered within the factory
|
|
81
|
-
*
|
|
82
|
-
* @param type The component type to check for
|
|
83
|
-
* @returns Whether or not the type exists within the factory
|
|
84
|
-
*/
|
|
85
|
-
has(type: ComponentTypeHandle): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Register an individual component
|
|
88
|
-
* @param type The component type to register
|
|
89
|
-
* @param componentType The component to bind to the type
|
|
90
|
-
*/
|
|
91
|
-
register(type: ComponentTypeHandle, componentType: ComponentType): void;
|
|
92
|
-
/**
|
|
93
|
-
* Register all components provided through the dictionary
|
|
94
|
-
*
|
|
95
|
-
* @param components The components to register
|
|
96
|
-
*/
|
|
97
|
-
registerAll(components: ComponentTypeDictionary): void;
|
|
98
|
-
/**
|
|
99
|
-
* Resolve a component type
|
|
100
|
-
*
|
|
101
|
-
* @param type The type to search the component for
|
|
102
|
-
* @returns The component that was resolved for the provided type
|
|
103
|
-
*/
|
|
104
|
-
resolve(type: ComponentTypeHandle): ComponentType | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* Retrieve the registered components as a dictionary that can be used to
|
|
107
|
-
* be imported in a new instance.
|
|
108
|
-
*
|
|
109
|
-
* @returns The dictionary
|
|
110
|
-
*/
|
|
111
|
-
extract(): ComponentTypeDictionary;
|
|
112
|
-
}
|
|
113
|
-
export interface GenericContext {
|
|
114
|
-
readonly client?: IOptiGraphClient;
|
|
115
|
-
readonly factory?: ComponentFactory;
|
|
116
|
-
readonly locale?: string;
|
|
117
|
-
readonly inEditMode: Readonly<boolean>;
|
|
118
|
-
readonly isDevelopment: boolean;
|
|
119
|
-
readonly isDebug: boolean;
|
|
120
|
-
readonly isDebugOrDevelopment: boolean;
|
|
121
|
-
}
|