@enonic/nextjs-adapter 3.2.2 → 3.3.0-B1

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.
Files changed (288) hide show
  1. package/package.json +41 -22
  2. package/src/baseMappings.ts +9 -9
  3. package/src/common/ComponentRegistry.ts +2 -5
  4. package/src/common/constants.ts +4 -4
  5. package/src/common/env.ts +1 -1
  6. package/src/guillotine/applyProcessors.ts +3 -7
  7. package/src/guillotine/buildComponentTree.ts +1 -1
  8. package/src/guillotine/buildErrorResponse.ts +3 -3
  9. package/src/guillotine/buildPage.ts +2 -2
  10. package/src/guillotine/collectComponentDescriptors.ts +6 -13
  11. package/src/guillotine/combineMultipleQueries.ts +3 -6
  12. package/src/guillotine/createMetaData.ts +2 -2
  13. package/src/guillotine/fetchContent.ts +8 -14
  14. package/src/guillotine/fetchContentData.ts +4 -10
  15. package/src/guillotine/fetchContentPathsForAllLocales.ts +3 -3
  16. package/src/guillotine/fetchContentPathsForLocale.ts +7 -7
  17. package/src/guillotine/fetchFromApi.ts +8 -8
  18. package/src/guillotine/fetchGuillotine.ts +8 -8
  19. package/src/guillotine/fetchMetaData.ts +5 -5
  20. package/src/guillotine/getCleanContentPathArrayOrThrow400.ts +2 -2
  21. package/src/guillotine/getParentRegion.ts +2 -2
  22. package/src/guillotine/getQueryAndVariables.ts +5 -9
  23. package/src/guillotine/metadata/configQuery.ts +2 -2
  24. package/src/guillotine/parseComponentPath.ts +4 -7
  25. package/src/guillotine/processComponentConfig.ts +1 -1
  26. package/src/guillotine/restrictComponentsToPath.ts +1 -1
  27. package/src/i18n/LocaleContext.tsx +3 -3
  28. package/src/index.ts +3 -3
  29. package/src/types/component.ts +1 -1
  30. package/src/types/componentProps.ts +4 -3
  31. package/src/types/guillotine.ts +1 -1
  32. package/src/types/index.ts +3 -3
  33. package/src/utils/buildGuillotineRequestHeaders.ts +4 -7
  34. package/src/utils/fixDoubleSlashes.ts +1 -1
  35. package/src/utils/getLocaleMappings.ts +1 -1
  36. package/src/utils/getRenderMode.ts +2 -5
  37. package/src/views/BaseComponent.tsx +5 -5
  38. package/src/views/BaseContent.tsx +1 -1
  39. package/src/views/BaseMacro.tsx +1 -1
  40. package/src/views/PropsView.tsx +1 -1
  41. package/src/views/RichTextView.tsx +68 -25
  42. package/src/views/StaticContent.tsx +1 -1
  43. package/baseMappings.d.ts +0 -1
  44. package/baseMappings.js +0 -43
  45. package/baseMappings.js.map +0 -1
  46. package/client/getClientHydratedHtml.d.ts +0 -1
  47. package/client/getClientHydratedHtml.jsx +0 -9
  48. package/client/getClientHydratedHtml.jsx.map +0 -1
  49. package/client.d.ts +0 -1
  50. package/client.js +0 -3
  51. package/client.js.map +0 -1
  52. package/common/ComponentRegistry.d.ts +0 -34
  53. package/common/ComponentRegistry.js +0 -121
  54. package/common/ComponentRegistry.js.map +0 -1
  55. package/common/UrlProcessor.d.ts +0 -25
  56. package/common/UrlProcessor.js +0 -151
  57. package/common/UrlProcessor.js.map +0 -1
  58. package/common/constants.d.ts +0 -51
  59. package/common/constants.js +0 -86
  60. package/common/constants.js.map +0 -1
  61. package/common/env.d.ts +0 -12
  62. package/common/env.js +0 -30
  63. package/common/env.js.map +0 -1
  64. package/guillotine/applyProcessors.d.ts +0 -2
  65. package/guillotine/applyProcessors.js +0 -33
  66. package/guillotine/applyProcessors.js.map +0 -1
  67. package/guillotine/buildComponentTree.d.ts +0 -2
  68. package/guillotine/buildComponentTree.js +0 -45
  69. package/guillotine/buildComponentTree.js.map +0 -1
  70. package/guillotine/buildErrorResponse.d.ts +0 -3
  71. package/guillotine/buildErrorResponse.js +0 -27
  72. package/guillotine/buildErrorResponse.js.map +0 -1
  73. package/guillotine/buildPage.d.ts +0 -2
  74. package/guillotine/buildPage.js +0 -10
  75. package/guillotine/buildPage.js.map +0 -1
  76. package/guillotine/collectComponentDescriptors.d.ts +0 -6
  77. package/guillotine/collectComponentDescriptors.js +0 -43
  78. package/guillotine/collectComponentDescriptors.js.map +0 -1
  79. package/guillotine/combineMultipleQueries.d.ts +0 -2
  80. package/guillotine/combineMultipleQueries.js +0 -58
  81. package/guillotine/combineMultipleQueries.js.map +0 -1
  82. package/guillotine/createMetaData.d.ts +0 -18
  83. package/guillotine/createMetaData.js +0 -45
  84. package/guillotine/createMetaData.js.map +0 -1
  85. package/guillotine/fetchContent.d.ts +0 -9
  86. package/guillotine/fetchContent.js +0 -222
  87. package/guillotine/fetchContent.js.map +0 -1
  88. package/guillotine/fetchContentData.d.ts +0 -2
  89. package/guillotine/fetchContentData.js +0 -30
  90. package/guillotine/fetchContentData.js.map +0 -1
  91. package/guillotine/fetchContentPathsForAllLocales.d.ts +0 -2
  92. package/guillotine/fetchContentPathsForAllLocales.js +0 -21
  93. package/guillotine/fetchContentPathsForAllLocales.js.map +0 -1
  94. package/guillotine/fetchContentPathsForLocale.d.ts +0 -2
  95. package/guillotine/fetchContentPathsForLocale.js +0 -41
  96. package/guillotine/fetchContentPathsForLocale.js.map +0 -1
  97. package/guillotine/fetchFromApi.d.ts +0 -3
  98. package/guillotine/fetchFromApi.js +0 -76
  99. package/guillotine/fetchFromApi.js.map +0 -1
  100. package/guillotine/fetchGuillotine.d.ts +0 -3
  101. package/guillotine/fetchGuillotine.js +0 -75
  102. package/guillotine/fetchGuillotine.js.map +0 -1
  103. package/guillotine/fetchMetaData.d.ts +0 -2
  104. package/guillotine/fetchMetaData.js +0 -33
  105. package/guillotine/fetchMetaData.js.map +0 -1
  106. package/guillotine/getCleanContentPathArrayOrThrow400.d.ts +0 -2
  107. package/guillotine/getCleanContentPathArrayOrThrow400.js +0 -20
  108. package/guillotine/getCleanContentPathArrayOrThrow400.js.map +0 -1
  109. package/guillotine/getComponentConfig.d.ts +0 -2
  110. package/guillotine/getComponentConfig.js +0 -5
  111. package/guillotine/getComponentConfig.js.map +0 -1
  112. package/guillotine/getContentAndComponentPaths.d.ts +0 -1
  113. package/guillotine/getContentAndComponentPaths.js +0 -12
  114. package/guillotine/getContentAndComponentPaths.js.map +0 -1
  115. package/guillotine/getMetaData.d.ts +0 -2
  116. package/guillotine/getMetaData.js +0 -67
  117. package/guillotine/getMetaData.js.map +0 -1
  118. package/guillotine/getParentRegion.d.ts +0 -2
  119. package/guillotine/getParentRegion.js +0 -40
  120. package/guillotine/getParentRegion.js.map +0 -1
  121. package/guillotine/getQueryAndVariables.d.ts +0 -2
  122. package/guillotine/getQueryAndVariables.js +0 -32
  123. package/guillotine/getQueryAndVariables.js.map +0 -1
  124. package/guillotine/metadata/configQuery.d.ts +0 -2
  125. package/guillotine/metadata/configQuery.js +0 -36
  126. package/guillotine/metadata/configQuery.js.map +0 -1
  127. package/guillotine/metadata/richTextQuery.d.ts +0 -1
  128. package/guillotine/metadata/richTextQuery.js +0 -47
  129. package/guillotine/metadata/richTextQuery.js.map +0 -1
  130. package/guillotine/parseComponentPath.d.ts +0 -2
  131. package/guillotine/parseComponentPath.js +0 -22
  132. package/guillotine/parseComponentPath.js.map +0 -1
  133. package/guillotine/prefixFragmentCmpPath.d.ts +0 -1
  134. package/guillotine/prefixFragmentCmpPath.js +0 -13
  135. package/guillotine/prefixFragmentCmpPath.js.map +0 -1
  136. package/guillotine/processComponentConfig.d.ts +0 -2
  137. package/guillotine/processComponentConfig.js +0 -30
  138. package/guillotine/processComponentConfig.js.map +0 -1
  139. package/guillotine/restrictComponentsToPath.d.ts +0 -2
  140. package/guillotine/restrictComponentsToPath.js +0 -38
  141. package/guillotine/restrictComponentsToPath.js.map +0 -1
  142. package/guillotine/validateData.d.ts +0 -2
  143. package/guillotine/validateData.js +0 -7
  144. package/guillotine/validateData.js.map +0 -1
  145. package/guillotine/validateNotFound.d.ts +0 -2
  146. package/guillotine/validateNotFound.js +0 -16
  147. package/guillotine/validateNotFound.js.map +0 -1
  148. package/guillotine/validateShortcut.d.ts +0 -2
  149. package/guillotine/validateShortcut.js +0 -35
  150. package/guillotine/validateShortcut.js.map +0 -1
  151. package/i18n/LocaleContext.d.ts +0 -7
  152. package/i18n/LocaleContext.jsx +0 -50
  153. package/i18n/LocaleContext.jsx.map +0 -1
  154. package/i18n/i18n.d.ts +0 -12
  155. package/i18n/i18n.js +0 -59
  156. package/i18n/i18n.js.map +0 -1
  157. package/index.d.ts +0 -14
  158. package/index.js +0 -14
  159. package/index.js.map +0 -1
  160. package/query/Shortcut.d.ts +0 -1
  161. package/query/Shortcut.js +0 -19
  162. package/query/Shortcut.js.map +0 -1
  163. package/server/getServerRenderedHtml.d.ts +0 -1
  164. package/server/getServerRenderedHtml.js +0 -4
  165. package/server/getServerRenderedHtml.js.map +0 -1
  166. package/server.d.ts +0 -5
  167. package/server.js +0 -6
  168. package/server.js.map +0 -1
  169. package/types/component.d.ts +0 -92
  170. package/types/component.js +0 -2
  171. package/types/component.js.map +0 -1
  172. package/types/componentProps.d.ts +0 -106
  173. package/types/componentProps.js +0 -2
  174. package/types/componentProps.js.map +0 -1
  175. package/types/guillotine.d.ts +0 -344
  176. package/types/guillotine.js +0 -2
  177. package/types/guillotine.js.map +0 -1
  178. package/types/i18n.d.ts +0 -7
  179. package/types/i18n.js +0 -2
  180. package/types/i18n.js.map +0 -1
  181. package/types/index.d.ts +0 -47
  182. package/types/index.js +0 -3
  183. package/types/index.js.map +0 -1
  184. package/types/next.d.ts +0 -6
  185. package/types/next.js +0 -2
  186. package/types/next.js.map +0 -1
  187. package/types/util.d.ts +0 -3
  188. package/types/util.js +0 -3
  189. package/types/util.js.map +0 -1
  190. package/utils/addLineNumbers.d.ts +0 -1
  191. package/utils/addLineNumbers.js +0 -4
  192. package/utils/addLineNumbers.js.map +0 -1
  193. package/utils/buildGuillotineRequestHeaders.d.ts +0 -7
  194. package/utils/buildGuillotineRequestHeaders.js +0 -16
  195. package/utils/buildGuillotineRequestHeaders.js.map +0 -1
  196. package/utils/commonChars.d.ts +0 -1
  197. package/utils/commonChars.js +0 -17
  198. package/utils/commonChars.js.map +0 -1
  199. package/utils/enonicLog.d.ts +0 -5
  200. package/utils/enonicLog.js +0 -23
  201. package/utils/enonicLog.js.map +0 -1
  202. package/utils/fixDoubleSlashes.d.ts +0 -1
  203. package/utils/fixDoubleSlashes.js +0 -4
  204. package/utils/fixDoubleSlashes.js.map +0 -1
  205. package/utils/getAllLocales.d.ts +0 -1
  206. package/utils/getAllLocales.js +0 -5
  207. package/utils/getAllLocales.js.map +0 -1
  208. package/utils/getContentApiUrl.d.ts +0 -2
  209. package/utils/getContentApiUrl.js +0 -15
  210. package/utils/getContentApiUrl.js.map +0 -1
  211. package/utils/getLocaleMapping.d.ts +0 -2
  212. package/utils/getLocaleMapping.js +0 -19
  213. package/utils/getLocaleMapping.js.map +0 -1
  214. package/utils/getLocaleMappingByLocale.d.ts +0 -2
  215. package/utils/getLocaleMappingByLocale.js +0 -13
  216. package/utils/getLocaleMappingByLocale.js.map +0 -1
  217. package/utils/getLocaleMappingByProjectId.d.ts +0 -2
  218. package/utils/getLocaleMappingByProjectId.js +0 -16
  219. package/utils/getLocaleMappingByProjectId.js.map +0 -1
  220. package/utils/getLocaleMappings.d.ts +0 -2
  221. package/utils/getLocaleMappings.js +0 -30
  222. package/utils/getLocaleMappings.js.map +0 -1
  223. package/utils/getRenderMode.d.ts +0 -3
  224. package/utils/getRenderMode.js +0 -8
  225. package/utils/getRenderMode.js.map +0 -1
  226. package/utils/getRequestLocaleInfo.d.ts +0 -6
  227. package/utils/getRequestLocaleInfo.js +0 -29
  228. package/utils/getRequestLocaleInfo.js.map +0 -1
  229. package/utils/getXpBaseUrl.d.ts +0 -2
  230. package/utils/getXpBaseUrl.js +0 -8
  231. package/utils/getXpBaseUrl.js.map +0 -1
  232. package/utils/indent.d.ts +0 -1
  233. package/utils/indent.js +0 -5
  234. package/utils/indent.js.map +0 -1
  235. package/utils/sanitizeGraphqlName.d.ts +0 -1
  236. package/utils/sanitizeGraphqlName.js +0 -12
  237. package/utils/sanitizeGraphqlName.js.map +0 -1
  238. package/views/BaseComponent.d.ts +0 -20
  239. package/views/BaseComponent.jsx +0 -129
  240. package/views/BaseComponent.jsx.map +0 -1
  241. package/views/BaseContent.d.ts +0 -3
  242. package/views/BaseContent.jsx +0 -38
  243. package/views/BaseContent.jsx.map +0 -1
  244. package/views/BaseLayout.d.ts +0 -3
  245. package/views/BaseLayout.jsx +0 -24
  246. package/views/BaseLayout.jsx.map +0 -1
  247. package/views/BaseMacro.d.ts +0 -6
  248. package/views/BaseMacro.jsx +0 -100
  249. package/views/BaseMacro.jsx.map +0 -1
  250. package/views/BasePage.d.ts +0 -3
  251. package/views/BasePage.jsx +0 -34
  252. package/views/BasePage.jsx.map +0 -1
  253. package/views/BasePart.d.ts +0 -3
  254. package/views/BasePart.jsx +0 -24
  255. package/views/BasePart.jsx.map +0 -1
  256. package/views/Empty.d.ts +0 -2
  257. package/views/Empty.jsx +0 -4
  258. package/views/Empty.jsx.map +0 -1
  259. package/views/Fragment.d.ts +0 -3
  260. package/views/Fragment.jsx +0 -30
  261. package/views/Fragment.jsx.map +0 -1
  262. package/views/MainView.d.ts +0 -3
  263. package/views/MainView.jsx +0 -14
  264. package/views/MainView.jsx.map +0 -1
  265. package/views/PropsView.d.ts +0 -2
  266. package/views/PropsView.jsx +0 -21
  267. package/views/PropsView.jsx.map +0 -1
  268. package/views/Region.d.ts +0 -6
  269. package/views/Region.jsx +0 -52
  270. package/views/Region.jsx.map +0 -1
  271. package/views/RichTextView.d.ts +0 -3
  272. package/views/RichTextView.jsx +0 -39
  273. package/views/RichTextView.jsx.map +0 -1
  274. package/views/SingleComponent.d.ts +0 -4
  275. package/views/SingleComponent.jsx +0 -10
  276. package/views/SingleComponent.jsx.map +0 -1
  277. package/views/StaticContent.d.ts +0 -10
  278. package/views/StaticContent.jsx +0 -37
  279. package/views/StaticContent.jsx.map +0 -1
  280. package/views/Text.d.ts +0 -8
  281. package/views/Text.jsx +0 -4
  282. package/views/Text.jsx.map +0 -1
  283. package/views/macros/DefaultMacro.d.ts +0 -3
  284. package/views/macros/DefaultMacro.jsx +0 -4
  285. package/views/macros/DefaultMacro.jsx.map +0 -1
  286. package/views/macros/DisableMacro.d.ts +0 -3
  287. package/views/macros/DisableMacro.jsx +0 -3
  288. package/views/macros/DisableMacro.jsx.map +0 -1
@@ -1,30 +0,0 @@
1
- import { sanitizeGraphqlName } from '../utils/sanitizeGraphqlName';
2
- export function processComponentConfig(myAppName, myAppNameDashed, cmp) {
3
- const cmpData = cmp[cmp.type];
4
- if (cmpData && 'descriptor' in cmpData && cmpData.descriptor) {
5
- const [appName, cmpName] = cmpData.descriptor.split(':');
6
- if (appName !== myAppName) {
7
- return;
8
- }
9
- let config;
10
- const configArray = [];
11
- if ('configAsJson' in cmpData && cmpData.configAsJson && cmpData.configAsJson[myAppNameDashed]) {
12
- config = cmpData.configAsJson[myAppNameDashed][cmpName];
13
- if (config) {
14
- configArray.push(config);
15
- delete cmpData.configAsJson;
16
- }
17
- }
18
- const sanitizedAppName = sanitizeGraphqlName(appName);
19
- if ('config' in cmpData && cmpData.config && cmpData.config[sanitizedAppName]) {
20
- config = cmpData.config[sanitizedAppName][sanitizeGraphqlName(cmpName)];
21
- if (config) {
22
- configArray.push(config);
23
- }
24
- }
25
- if (configArray.length) {
26
- cmpData.config = Object.assign({}, ...configArray);
27
- }
28
- }
29
- }
30
- //# sourceMappingURL=processComponentConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processComponentConfig.js","sourceRoot":"","sources":["../src/guillotine/processComponentConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAGjE,MAAM,UAAU,sBAAsB,CAClC,SAAiB,EACjB,eAAuB,EACvB,GAAkB;IAElB,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,OAAO,IAAI,YAAY,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3D,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QACD,IAAI,MAAM,CAAC;QACX,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,IAAI,cAAc,IAAI,OAAO,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,CAAC;YAC7F,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC;YACxD,IAAI,MAAM,EAAE,CAAC;gBACT,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACzB,OAAO,OAAO,CAAC,YAAY,CAAC;YAChC,CAAC;QACL,CAAC;QACD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC5E,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;YACxE,IAAI,MAAM,EAAE,CAAC;gBACT,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7B,CAAC;QACL,CAAC;QACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { PageComponent } from '../types';
2
- export declare function restrictComponentsToPath(contentType: string, components?: PageComponent[], componentPath?: string): PageComponent[];
@@ -1,38 +0,0 @@
1
- import { XP_COMPONENT_TYPE } from '../common/constants';
2
- import { parseComponentPath } from './parseComponentPath';
3
- import { prefixFragmentCmpPath } from './prefixFragmentCmpPath';
4
- export function restrictComponentsToPath(contentType, components, componentPath) {
5
- if (!componentPath || !(components === null || components === void 0 ? void 0 : components.length)) {
6
- return components || [];
7
- }
8
- // filter components to the requested one only
9
- const component = components.find(cmp => {
10
- return cmp.path === componentPath;
11
- });
12
- if (!component) {
13
- return [];
14
- }
15
- let result = [component];
16
- if (component.type !== XP_COMPONENT_TYPE.LAYOUT) {
17
- // remember to include all parent layouts too !
18
- const cmpPath = parseComponentPath(contentType, component.path);
19
- for (let i = cmpPath.length - 2; i >= 0; i--) {
20
- const parentPath = cmpPath[i];
21
- const parentCmp = components.find(cmp => {
22
- return prefixFragmentCmpPath(contentType, cmp.path) === `/${parentPath.region}/${parentPath.index}`;
23
- });
24
- if (parentCmp) {
25
- result.unshift(parentCmp);
26
- }
27
- }
28
- }
29
- else {
30
- // It's a layout, include child components
31
- const childCmps = components.filter(cmp => cmp.path !== component.path && cmp.path.startsWith(component.path));
32
- if (childCmps.length) {
33
- result = result.concat(childCmps);
34
- }
35
- }
36
- return result;
37
- }
38
- //# sourceMappingURL=restrictComponentsToPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"restrictComponentsToPath.js","sourceRoot":"","sources":["../src/guillotine/restrictComponentsToPath.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAG9D,MAAM,UAAU,wBAAwB,CACpC,WAAmB,EACnB,UAA4B,EAC5B,aAAsB;IAEtB,IAAI,CAAC,aAAa,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA,EAAE,CAAC;QACxC,OAAO,UAAU,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,8CAA8C;IAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,E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AC;AAClB,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { FetchContentResult } from '../types';
2
- export declare function validateData(props: FetchContentResult): void;
@@ -1,7 +0,0 @@
1
- import { validateNotFound } from './validateNotFound';
2
- import { validateShortcut } from './validateShortcut';
3
- export function validateData(props) {
4
- validateNotFound(props);
5
- validateShortcut(props);
6
- }
7
- //# sourceMappingURL=validateData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateData.js","sourceRoot":"","sources":["../src/guillotine/validateData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAGpD,MAAM,UAAU,YAAY,CAAC,KAAyB;IAClD,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxB,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { FetchContentResult } from '../types';
2
- export declare function validateNotFound(props: FetchContentResult): void;
@@ -1,16 +0,0 @@
1
- import { notFound } from 'next/navigation';
2
- export function validateNotFound(props) {
3
- const { error } = props;
4
- if (error) {
5
- switch (error.code) {
6
- case '404':
7
- console.warn(error.code, error.message);
8
- notFound();
9
- break;
10
- default:
11
- console.error(error.code, error.message);
12
- throw new Error(error.message);
13
- }
14
- }
15
- }
16
- //# sourceMappingURL=validateNotFound.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateNotFound.js","sourceRoot":"","sources":["../src/guillotine/validateNotFound.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAGzC,MAAM,UAAU,gBAAgB,CAAC,KAAyB;IACtD,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC;IACtB,IAAI,KAAK,EAAE,CAAC;QACR,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACjB,KAAK,KAAK;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBACxC,QAAQ,EAAE,CAAC;gBACX,MAAM;YACV;gBACI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { FetchContentResult } from '../types';
2
- export declare function validateShortcut(props: FetchContentResult): void;
@@ -1,35 +0,0 @@
1
- import { notFound, redirect, RedirectType } from 'next/navigation';
2
- import { RENDER_MODE } from '../common/constants';
3
- import { IS_DEV_MODE } from '../common/env';
4
- import { UrlProcessor } from '../common/UrlProcessor';
5
- export function validateShortcut(props) {
6
- var _a, _b;
7
- const { data, meta, error } = props;
8
- const dataObj = (_a = data === null || data === void 0 ? void 0 : data.get) === null || _a === void 0 ? void 0 : _a.data;
9
- const pageUrl = (_b = dataObj === null || dataObj === void 0 ? void 0 : dataObj.target) === null || _b === void 0 ? void 0 : _b.pageUrl;
10
- const parameters = dataObj === null || dataObj === void 0 ? void 0 : dataObj.parameters;
11
- if (meta.type === 'base:shortcut' && pageUrl) {
12
- if (meta.renderMode !== RENDER_MODE.NEXT) {
13
- // do not show shortcut targets in preview/edit mode
14
- console.warn(404, `Shortcuts are not available in ${meta.renderMode} render mode`);
15
- notFound();
16
- }
17
- let destination = UrlProcessor.process(pageUrl, meta, true);
18
- if (parameters) {
19
- const searchParams = parameters.map(({ name, value }) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`).join('&');
20
- destination += '?' + searchParams;
21
- }
22
- console.debug(`Redirecting shortcut content [${meta.path}] to`, destination);
23
- redirect(destination, RedirectType.replace);
24
- }
25
- // we can not set 418 for static paths,
26
- // but we can show 404 instead to be handled in CS
27
- const canNotRender = meta && !meta.canRender && meta.renderMode !== RENDER_MODE.EDIT;
28
- const catchAllInNextProdMode = meta.renderMode === RENDER_MODE.NEXT && !IS_DEV_MODE && meta.catchAll;
29
- const isNotFound = (error && error.code === '404') || canNotRender || catchAllInNextProdMode;
30
- if (isNotFound) {
31
- console.warn(404, `Can not render content at [${meta.path}]`);
32
- notFound();
33
- }
34
- }
35
- //# sourceMappingURL=validateShortcut.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateShortcut.js","sourceRoot":"","sources":["../src/guillotine/validateShortcut.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAGpD,MAAM,UAAU,gBAAgB,CAAC,KAAyB;;IACtD,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,GAAG,KAAK,CAAC;IAClC,MAAM,OAAO,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,0CAAE,IAAI,CAAC;IAChC,MAAM,OAAO,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,OAAO,CAAC;IACzC,MAAM,UAAU,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC;IACvC,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,IAAI,OAAO,EAAE,CAAC;QAC3C,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,CAAC,IAAI,EAAE,CAAC;YACvC,oDAAoD;YACpD,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,kCAAkC,IAAI,CAAC,UAAU,cAAc,CAAC,CAAC;YACnF,QAAQ,EAAE,CAAC;QACf,CAAC;QAED,IAAI,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,UAAU,EAAE,CAAC;YACb,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE,EAAE,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC7H,WAAW,IAAI,GAAG,GAAG,YAAY,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,MAAM,EAAE,WAAW,CAAC,CAAC;QAC7E,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,uCAAuC;IACvC,kDAAkD;IAClD,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,CAAC,IAAI,CAAC;IAErF,MAAM,sBAAsB,GAAG,IAAI,CAAC,UAAU,KAAK,WAAW,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC;IAErG,MAAM,UAAU,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,YAAY,IAAI,sBAAsB,CAAC;IAE7F,IAAI,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,8BAA8B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAC9D,QAAQ,EAAE,CAAC;IACf,CAAC;AACL,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { LocaleContextType } from '../types';
2
- import React from 'react';
3
- export declare const useLocaleContext: () => LocaleContextType;
4
- export declare const LocaleContextProvider: ({ children, locale: localeProps, }: {
5
- children: any;
6
- locale?: string;
7
- }) => React.JSX.Element;
@@ -1,50 +0,0 @@
1
- 'use client';
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import React, { createContext, useContext, useEffect, useState } from 'react';
12
- import { getPhrase, loadPhrases } from './i18n';
13
- const LocaleContext = createContext({
14
- dictionary: {},
15
- locale: '',
16
- localize: (key, ...args) => key,
17
- setLocale: (locale) => Promise.resolve({}),
18
- });
19
- export const useLocaleContext = () => useContext(LocaleContext);
20
- export const LocaleContextProvider = ({ children, locale: localeProps = '', }) => {
21
- const [currentLocale, setLocaleState] = useState(localeProps);
22
- const [dictionary, setPhrasesState] = useState({});
23
- const [isLoaded, setLoadedState] = useState(false);
24
- const setLocale = (locale) => __awaiter(void 0, void 0, void 0, function* () {
25
- setLocaleState(locale);
26
- setLoadedState(false);
27
- return loadPhrases(locale).then((phrases) => {
28
- setPhrasesState(phrases);
29
- setLoadedState(true);
30
- return phrases;
31
- });
32
- });
33
- useEffect(() => {
34
- if (localeProps) {
35
- void setLocale(localeProps); // void to avoid @typescript-eslint/no-floating-promises
36
- }
37
- }, []);
38
- const localize = (key, ...args) => {
39
- return isLoaded ? getPhrase(currentLocale, dictionary, key, ...args) : key;
40
- };
41
- return (<LocaleContext.Provider value={{
42
- setLocale,
43
- locale: currentLocale,
44
- dictionary,
45
- localize,
46
- }}>
47
- {children}
48
- </LocaleContext.Provider>);
49
- };
50
- //# sourceMappingURL=LocaleContext.jsx.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LocaleContext.jsx","sourceRoot":"","sources":["../src/i18n/LocaleContext.tsx"],"names":[],"m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,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,WAAW,EAAE,CAAC;YACd,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,wDAAwD;QACzF,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,GAAG,IAAW,EAAE,EAAE;QAC7C,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/E,CAAC,CAAC;IAEF,OAAO,CACH,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC3B,SAAS;YACT,MAAM,EAAE,aAAa;YACrB,UAAU;YACV,QAAQ;SACX,CAAC,CACE;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,aAAa,CAAC,QAAQ,CAAC,CAC5B,CAAC;AACN,CAAC,CAAC"}
package/i18n/i18n.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { Dict } from '../types';
2
- export declare class I18n {
3
- private static locale;
4
- private static dictionary;
5
- private static isLoaded;
6
- static setLocale(locale: string): Promise<Dict>;
7
- static localize(key: string, ...args: any[]): string;
8
- static getLocale(): string;
9
- static getDictionary(): Dict;
10
- }
11
- export declare const loadPhrases: (locale: string) => Promise<Dict>;
12
- export declare const getPhrase: (locale: string, dict: Dict, key: string, ...args: any[]) => string;
package/i18n/i18n.js DELETED
@@ -1,59 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export class I18n {
11
- static setLocale(locale) {
12
- return __awaiter(this, void 0, void 0, function* () {
13
- this.locale = locale;
14
- this.isLoaded = false;
15
- return loadPhrases(locale).then((phrases) => {
16
- this.dictionary = phrases;
17
- this.isLoaded = true;
18
- return phrases;
19
- });
20
- });
21
- }
22
- static localize(key, ...args) {
23
- return this.isLoaded ? getPhrase(this.locale, this.dictionary, key, ...args) : key;
24
- }
25
- static getLocale() {
26
- return this.locale;
27
- }
28
- static getDictionary() {
29
- return this.dictionary;
30
- }
31
- }
32
- I18n.locale = '';
33
- I18n.dictionary = {};
34
- I18n.isLoaded = false;
35
- export const loadPhrases = (locale) => __awaiter(void 0, void 0, void 0, function* () {
36
- return import(`@phrases/${locale}.json`)
37
- .then((module) => module.default)
38
- .catch((e) => {
39
- console.error(`Failed to load phrases for locale "${locale}"`, e);
40
- return {};
41
- });
42
- });
43
- export const getPhrase = (locale, dict, key, ...args) => {
44
- const template = dict[key];
45
- if (!template) {
46
- console.warn(`Missing localization phrase for locale "${locale}": <${key}>`);
47
- return `<${key}>`;
48
- }
49
- if (args.length) {
50
- let index = -1;
51
- return template.replace(/{(\d+)?}/g, (match, digit) => {
52
- var _a;
53
- index++;
54
- return (_a = args[digit || index]) !== null && _a !== void 0 ? _a : match;
55
- });
56
- }
57
- return template;
58
- };
59
- //# sourceMappingURL=i18n.js.map
package/i18n/i18n.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n/i18n.ts"],"names":[],"mappings":";;;;;;;;;AAGA,MAAM,OAAO,IAAI;IAKN,MAAM,CAAO,SAAS,CAAC,MAAc;;YACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YAEtB,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,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AI,CAAC,2CAA2C,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC;QAC7E,OAAO,IAAI,GAAG,GAAG,CAAC;IACtB,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;QACf,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;;YAClD,KAAK,EAAE,CAAC;YACR,OAAO,MAAA,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,mCAAI,KAAK,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC"}
package/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export { APP_NAME, APP_NAME_DASHED, APP_NAME_UNDERSCORED, IS_DEV_MODE, } from './common/env';
2
- export type * from './types';
3
- export { ComponentRegistry } from './common/ComponentRegistry';
4
- export { CATCH_ALL, JSESSIONID_HEADER, PORTAL_COMPONENT_ATTRIBUTE, PORTAL_REGION_ATTRIBUTE, PROJECT_ID_HEADER, RENDER_MODE, RENDER_MODE_HEADER, XP_BASE_URL_HEADER, XP_COMPONENT_TYPE, XP_REQUEST_TYPE, } from './common/constants';
5
- export { richTextQuery } from './guillotine/metadata/richTextQuery';
6
- export { validateData } from './guillotine/validateData';
7
- export { I18n } from './i18n/i18n';
8
- export { getContentApiUrl } from './utils/getContentApiUrl';
9
- export { getLocaleMapping } from './utils/getLocaleMapping';
10
- export { getLocaleMappingByProjectId } from './utils/getLocaleMappingByProjectId';
11
- export { getLocaleMappingByLocale } from './utils/getLocaleMappingByLocale';
12
- export { getRequestLocaleInfo } from './utils/getRequestLocaleInfo';
13
- export { sanitizeGraphqlName } from './utils/sanitizeGraphqlName';
14
- export { UrlProcessor, getAsset, getUrl, } from './common/UrlProcessor';
package/index.js DELETED
@@ -1,14 +0,0 @@
1
- export { APP_NAME, APP_NAME_DASHED, APP_NAME_UNDERSCORED, IS_DEV_MODE, } from './common/env';
2
- export { ComponentRegistry } from './common/ComponentRegistry';
3
- export { CATCH_ALL, JSESSIONID_HEADER, PORTAL_COMPONENT_ATTRIBUTE, PORTAL_REGION_ATTRIBUTE, PROJECT_ID_HEADER, RENDER_MODE, RENDER_MODE_HEADER, XP_BASE_URL_HEADER, XP_COMPONENT_TYPE, XP_REQUEST_TYPE, } from './common/constants';
4
- export { richTextQuery } from './guillotine/metadata/richTextQuery';
5
- export { validateData } from './guillotine/validateData';
6
- export { I18n } from './i18n/i18n';
7
- export { getContentApiUrl } from './utils/getContentApiUrl';
8
- export { getLocaleMapping } from './utils/getLocaleMapping';
9
- export { getLocaleMappingByProjectId } from './utils/getLocaleMappingByProjectId';
10
- export { getLocaleMappingByLocale } from './utils/getLocaleMappingByLocale';
11
- export { getRequestLocaleInfo } from './utils/getRequestLocaleInfo';
12
- export { sanitizeGraphqlName } from './utils/sanitizeGraphqlName';
13
- export { UrlProcessor, getAsset, getUrl, } from './common/UrlProcessor';
14
- //# sourceMappingURL=index.js.map
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,WAAW,GACd,MAAM,cAAc,CAAC;AAItB,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAC,aAAa,EAAC,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,2BAA2B,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAC,wBAAwB,EAAC,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,MAAM,GACT,MAAM,uBAAuB,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getShortcutQuery = "\n query($path:ID!){\n guillotine {\n get(key:$path) {\n ... on base_Shortcut {\n data {\n target {\n pageUrl(type: absolute)\n }\n parameters {\n name\n value\n }\n }\n }\n }\n }\n }";
package/query/Shortcut.js DELETED
@@ -1,19 +0,0 @@
1
- export const getShortcutQuery = `
2
- query($path:ID!){
3
- guillotine {
4
- get(key:$path) {
5
- ... on base_Shortcut {
6
- data {
7
- target {
8
- pageUrl(type: absolute)
9
- }
10
- parameters {
11
- name
12
- value
13
- }
14
- }
15
- }
16
- }
17
- }
18
- }`;
19
- //# sourceMappingURL=Shortcut.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Shortcut.js","sourceRoot":"","sources":["../src/query/Shortcut.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;IAiB5B,CAAC"}
@@ -1 +0,0 @@
1
- export declare function getServerRenderedHtml(component: React.ReactNode): string;
@@ -1,4 +0,0 @@
1
- export function getServerRenderedHtml(component) {
2
- return require('react-dom/server').renderToString(component);
3
- }
4
- //# sourceMappingURL=getServerRenderedHtml.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getServerRenderedHtml.js","sourceRoot":"","sources":["../src/server/getServerRenderedHtml.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,SAA0B;IAC5D,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC"}
package/server.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { fetchContent } from './guillotine/fetchContent';
2
- export { fetchContentPathsForAllLocales } from './guillotine/fetchContentPathsForAllLocales';
3
- export { fetchContentPathsForLocale } from './guillotine/fetchContentPathsForLocale';
4
- export { fetchFromApi } from './guillotine/fetchFromApi';
5
- export { fetchGuillotine } from './guillotine/fetchGuillotine';
package/server.js DELETED
@@ -1,6 +0,0 @@
1
- export { fetchContent } from './guillotine/fetchContent';
2
- export { fetchContentPathsForAllLocales } from './guillotine/fetchContentPathsForAllLocales';
3
- export { fetchContentPathsForLocale } from './guillotine/fetchContentPathsForLocale';
4
- export { fetchFromApi } from './guillotine/fetchFromApi';
5
- export { fetchGuillotine } from './guillotine/fetchGuillotine';
6
- //# sourceMappingURL=server.js.map
package/server.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,8BAA8B,EAAC,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAC,0BAA0B,EAAC,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC"}
@@ -1,92 +0,0 @@
1
- import type { XP_COMPONENT_TYPE } from '../common/constants';
2
- import type { Context } from './next';
3
- import type { RichTextData as CompsRichTextData, LinkData as CompsLinkData, ImageData as CompsImageData, MacroData as CompsMacroData } from '@enonic/react-components';
4
- export interface ComponentDefinitionParams {
5
- query?: SelectedQueryMaybeVariablesFunc;
6
- configQuery?: string;
7
- processor?: DataProcessor;
8
- view?: React.FunctionComponent<any>;
9
- }
10
- /**
11
- * Object that configures the handling of a particular content type. All attributes are optional (see examples below), and missing values will fall back to default behavior:
12
- * - 'query' (used in fetchContent.ts) Guillotine query for fetching content data, may also have a function that supplies guillotine variables. So, 'query' can EITHER be only a query string, OR also add a get-guillotine-variables function. In the latter case, 'query' can be an object with 'query' and 'variables' attributes, or an array where the query string is first and the get-variables function is second. Either way, the get-variables function takes two arguments: path (content path, mandatory) and context (next.js-supplied Context from getServerSideProps etc. Optional, and requires that fetchContent is called with the context, of course).
13
- * - 'props' (used in fetchContent.ts) is a function for processing props after fetching them
14
- * - 'view' (used in BasePage.tsx) is a React component: top-level content-type-specific rendering with the props first fetched from guillotine (and then optionally preprocessed with the function in 'props').
15
- */
16
- export interface ComponentDefinition {
17
- catchAll?: boolean;
18
- query?: SelectedQueryMaybeVariablesFunc;
19
- configQuery?: string;
20
- processor?: DataProcessor;
21
- view?: React.FunctionComponent<any>;
22
- }
23
- export interface ComponentDescriptor {
24
- type?: ComponentDefinition;
25
- component?: PageComponent;
26
- queryAndVariables?: QueryAndVariables;
27
- }
28
- export type ComponentDictionary = Record<string, ComponentDefinitionParams>;
29
- export type DataProcessor = (data: any, context?: Context, config?: any) => Promise<Record<string, any>>;
30
- export interface FragmentData {
31
- id: string;
32
- fragment: {
33
- components: PageComponent[];
34
- };
35
- }
36
- export type ImageData = CompsImageData;
37
- export interface LayoutData {
38
- descriptor: string;
39
- config?: any;
40
- [customKeysFromQuery: string]: any;
41
- }
42
- export type LinkData = CompsLinkData;
43
- export type MacroConfig = Record<string, any>;
44
- export type MacroData = CompsMacroData;
45
- export interface PageComponent {
46
- [key: string]: any;
47
- type: XP_COMPONENT_TYPE;
48
- path: string;
49
- page?: PageData;
50
- part?: PartData;
51
- layout?: LayoutData;
52
- fragment?: FragmentData;
53
- text?: TextData;
54
- image?: any;
55
- regions?: RegionTree;
56
- data?: any;
57
- error?: any;
58
- }
59
- export interface PageData {
60
- descriptor: string;
61
- config?: any;
62
- template?: string | null;
63
- regions?: RegionTree;
64
- }
65
- export interface PageRegion {
66
- name: string;
67
- components: PageComponent[];
68
- }
69
- export interface PartData {
70
- descriptor: string;
71
- config: any;
72
- [customKeysFromQuery: string]: any;
73
- }
74
- export interface QueryAndVariables {
75
- query: string;
76
- variables?: Record<string, any>;
77
- }
78
- export type QueryGetter = (path: string, context?: Context, config?: any) => string;
79
- export type SelectedQueryMaybeVariablesFunc = string | QueryGetter | {
80
- query: string | QueryGetter;
81
- variables: VariablesGetter;
82
- } | [string | QueryGetter, VariablesGetter];
83
- export type RegionTree = Record<string, PageRegion>;
84
- export type RichTextData = CompsRichTextData;
85
- export interface TextData {
86
- value: RichTextData;
87
- }
88
- export type VariablesGetter = (path: string, context?: Context, config?: any) => VariablesGetterResult;
89
- export interface VariablesGetterResult {
90
- [variables: string]: any;
91
- path: string;
92
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../src/types/component.ts"],"names":[],"mappings":""}
@@ -1,106 +0,0 @@
1
- import { DOMNode } from 'html-react-parser';
2
- import type { RENDER_MODE, XP_REQUEST_TYPE } from '../common/constants';
3
- import type { FragmentData, LayoutData, MacroConfig, MacroData, PageComponent, PageData, PartData, RichTextData, RegionTree } from './component';
4
- export interface BaseComponentProps {
5
- component: PageComponent;
6
- meta: MetaData;
7
- common?: any;
8
- }
9
- export interface BaseLayoutProps {
10
- component?: LayoutData;
11
- path: string;
12
- regions?: RegionTree;
13
- common?: any;
14
- meta: MetaData;
15
- }
16
- export interface BaseMacroProps {
17
- children: string | React.ReactNode;
18
- data: Omit<MacroData, 'ref'>;
19
- meta: MetaData;
20
- renderInEditMode?: boolean;
21
- }
22
- export interface BasePageProps {
23
- component?: PageData;
24
- path?: string;
25
- common?: any;
26
- data?: any;
27
- error?: string;
28
- meta: MetaData;
29
- }
30
- export interface BasePartProps {
31
- component?: PartData;
32
- path: string;
33
- common?: any;
34
- data?: any;
35
- error?: string;
36
- meta: MetaData;
37
- }
38
- export interface FragmentProps {
39
- page?: PageData;
40
- component?: FragmentData;
41
- common?: any;
42
- meta: MetaData;
43
- }
44
- export interface LayoutProps {
45
- layout: LayoutData;
46
- path: string;
47
- common: any;
48
- meta: MetaData;
49
- }
50
- export interface MacroProps {
51
- name: string;
52
- children: string | React.ReactNode;
53
- config: MacroConfig;
54
- meta: MetaData;
55
- }
56
- export interface MetaData {
57
- id: string;
58
- type: string;
59
- path: string;
60
- requestType: XP_REQUEST_TYPE;
61
- renderMode: RENDER_MODE;
62
- requestedComponent?: PageComponent;
63
- canRender: boolean;
64
- catchAll: boolean;
65
- apiUrl: string;
66
- baseUrl: string;
67
- locale: string;
68
- defaultLocale: string;
69
- }
70
- export interface PageProps {
71
- page: PageData;
72
- path: string;
73
- data?: any;
74
- common?: any;
75
- meta: MetaData;
76
- }
77
- export interface PartProps {
78
- part: PartData;
79
- path: string;
80
- data?: any;
81
- common?: any;
82
- meta: MetaData;
83
- }
84
- export interface RegionProps {
85
- name: string;
86
- components?: PageComponent[];
87
- className?: string;
88
- common?: any;
89
- meta: MetaData;
90
- }
91
- export interface RegionsProps {
92
- page: PageData | null;
93
- name?: string;
94
- common?: any;
95
- meta: MetaData;
96
- }
97
- export type Replacer = (domNode: DOMNode, data: RichTextData, meta: MetaData, renderMacroInEditMode: boolean) => ReplacerResult;
98
- export type ReplacerResult = JSX.Element | DOMNode;
99
- export interface RichTextViewProps {
100
- data: RichTextData;
101
- meta: MetaData;
102
- className?: string;
103
- tag?: string;
104
- renderMacroInEditMode?: boolean;
105
- customReplacer?: Replacer;
106
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=componentProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentProps.js","sourceRoot":"","sources":["../src/types/componentProps.ts"],"names":[],"mappings":""}