@sitecore-content-sdk/content 1.5.0-canary.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +7 -0
  3. package/client.d.ts +1 -0
  4. package/codegen.d.ts +1 -0
  5. package/config-cli.d.ts +1 -0
  6. package/config.d.ts +1 -0
  7. package/dist/cjs/client/edge-proxy.js +24 -0
  8. package/dist/cjs/client/index.js +14 -0
  9. package/dist/cjs/client/models.js +2 -0
  10. package/dist/cjs/client/sitecore-client.js +420 -0
  11. package/dist/cjs/client/utils.js +53 -0
  12. package/dist/cjs/config/define-config.js +195 -0
  13. package/dist/cjs/config/index.js +7 -0
  14. package/dist/cjs/config/models.js +12 -0
  15. package/dist/cjs/config-cli/define-cli-config.js +23 -0
  16. package/dist/cjs/config-cli/index.js +7 -0
  17. package/dist/cjs/config-cli/models.js +8 -0
  18. package/dist/cjs/constants.js +12 -0
  19. package/dist/cjs/debug.js +21 -0
  20. package/dist/cjs/editing/codegen/index.js +14 -0
  21. package/dist/cjs/editing/codegen/preview.js +277 -0
  22. package/dist/cjs/editing/component-layout-service.js +62 -0
  23. package/dist/cjs/editing/design-library.js +184 -0
  24. package/dist/cjs/editing/editing-service.js +81 -0
  25. package/dist/cjs/editing/index.js +33 -0
  26. package/dist/cjs/editing/models.js +44 -0
  27. package/dist/cjs/editing/utils.js +105 -0
  28. package/dist/cjs/form/form.js +81 -0
  29. package/dist/cjs/form/index.js +7 -0
  30. package/dist/cjs/i18n/dictionary-service.js +144 -0
  31. package/dist/cjs/i18n/index.js +7 -0
  32. package/dist/cjs/i18n/utils.js +16 -0
  33. package/dist/cjs/index.js +47 -0
  34. package/dist/cjs/layout/content-styles.js +73 -0
  35. package/dist/cjs/layout/index.js +24 -0
  36. package/dist/cjs/layout/layout-service.js +68 -0
  37. package/dist/cjs/layout/models.js +39 -0
  38. package/dist/cjs/layout/themes.js +77 -0
  39. package/dist/cjs/layout/utils.js +117 -0
  40. package/dist/cjs/media/index.js +38 -0
  41. package/dist/cjs/media/media-api.js +100 -0
  42. package/dist/cjs/models.js +2 -0
  43. package/dist/cjs/personalize/index.js +15 -0
  44. package/dist/cjs/personalize/layout-personalizer.js +98 -0
  45. package/dist/cjs/personalize/personalize-service.js +109 -0
  46. package/dist/cjs/personalize/utils.js +143 -0
  47. package/dist/cjs/site/error-pages-service.js +82 -0
  48. package/dist/cjs/site/index.js +26 -0
  49. package/dist/cjs/site/models.js +2 -0
  50. package/dist/cjs/site/redirects-service.js +109 -0
  51. package/dist/cjs/site/robots-service.js +74 -0
  52. package/dist/cjs/site/site-resolver.js +73 -0
  53. package/dist/cjs/site/siteinfo-service.js +94 -0
  54. package/dist/cjs/site/sitemap-xml-service.js +92 -0
  55. package/dist/cjs/site/sitepath-service.js +201 -0
  56. package/dist/cjs/site/utils.js +55 -0
  57. package/dist/cjs/sitecore-service-base.js +33 -0
  58. package/dist/cjs/tools/codegen/component-generation.js +49 -0
  59. package/dist/cjs/tools/codegen/extract-files.js +105 -0
  60. package/dist/cjs/tools/codegen/import-map.js +411 -0
  61. package/dist/cjs/tools/codegen/utils.js +418 -0
  62. package/dist/cjs/tools/generate-map.js +2 -0
  63. package/dist/cjs/tools/generateSites.js +59 -0
  64. package/dist/cjs/tools/index.js +30 -0
  65. package/dist/cjs/tools/scaffold.js +62 -0
  66. package/dist/cjs/tools/templating/components.js +96 -0
  67. package/dist/cjs/tools/templating/index.js +6 -0
  68. package/dist/esm/client/edge-proxy.js +19 -0
  69. package/dist/esm/client/index.js +4 -0
  70. package/dist/esm/client/models.js +1 -0
  71. package/dist/esm/client/sitecore-client.js +416 -0
  72. package/dist/esm/client/utils.js +49 -0
  73. package/dist/esm/config/define-config.js +189 -0
  74. package/dist/esm/config/index.js +2 -0
  75. package/dist/esm/config/models.js +9 -0
  76. package/dist/esm/config-cli/define-cli-config.js +19 -0
  77. package/dist/esm/config-cli/index.js +2 -0
  78. package/dist/esm/config-cli/models.js +5 -0
  79. package/dist/esm/constants.js +9 -0
  80. package/dist/esm/debug.js +19 -0
  81. package/dist/esm/editing/codegen/index.js +1 -0
  82. package/dist/esm/editing/codegen/preview.js +263 -0
  83. package/dist/esm/editing/component-layout-service.js +55 -0
  84. package/dist/esm/editing/design-library.js +172 -0
  85. package/dist/esm/editing/editing-service.js +74 -0
  86. package/dist/esm/editing/index.js +6 -0
  87. package/dist/esm/editing/models.js +41 -0
  88. package/dist/esm/editing/utils.js +98 -0
  89. package/dist/esm/form/form.js +72 -0
  90. package/dist/esm/form/index.js +1 -0
  91. package/dist/esm/i18n/dictionary-service.js +137 -0
  92. package/dist/esm/i18n/index.js +2 -0
  93. package/dist/esm/i18n/utils.js +13 -0
  94. package/dist/esm/index.js +5 -0
  95. package/dist/esm/layout/content-styles.js +65 -0
  96. package/dist/esm/layout/index.js +6 -0
  97. package/dist/esm/layout/layout-service.js +61 -0
  98. package/dist/esm/layout/models.js +36 -0
  99. package/dist/esm/layout/themes.js +72 -0
  100. package/dist/esm/layout/utils.js +109 -0
  101. package/dist/esm/media/index.js +2 -0
  102. package/dist/esm/media/media-api.js +90 -0
  103. package/dist/esm/models.js +1 -0
  104. package/dist/esm/personalize/index.js +3 -0
  105. package/dist/esm/personalize/layout-personalizer.js +93 -0
  106. package/dist/esm/personalize/personalize-service.js +102 -0
  107. package/dist/esm/personalize/utils.js +135 -0
  108. package/dist/esm/site/error-pages-service.js +75 -0
  109. package/dist/esm/site/index.js +8 -0
  110. package/dist/esm/site/models.js +1 -0
  111. package/dist/esm/site/redirects-service.js +102 -0
  112. package/dist/esm/site/robots-service.js +67 -0
  113. package/dist/esm/site/site-resolver.js +69 -0
  114. package/dist/esm/site/siteinfo-service.js +87 -0
  115. package/dist/esm/site/sitemap-xml-service.js +85 -0
  116. package/dist/esm/site/sitepath-service.js +193 -0
  117. package/dist/esm/site/utils.js +49 -0
  118. package/dist/esm/sitecore-service-base.js +29 -0
  119. package/dist/esm/tools/codegen/component-generation.js +44 -0
  120. package/dist/esm/tools/codegen/extract-files.js +99 -0
  121. package/dist/esm/tools/codegen/import-map.js +368 -0
  122. package/dist/esm/tools/codegen/utils.js +373 -0
  123. package/dist/esm/tools/generate-map.js +1 -0
  124. package/dist/esm/tools/generateSites.js +52 -0
  125. package/dist/esm/tools/index.js +6 -0
  126. package/dist/esm/tools/scaffold.js +54 -0
  127. package/dist/esm/tools/templating/components.js +59 -0
  128. package/dist/esm/tools/templating/index.js +1 -0
  129. package/editing.d.ts +1 -0
  130. package/i18n.d.ts +1 -0
  131. package/layout.d.ts +1 -0
  132. package/media.d.ts +1 -0
  133. package/package.json +157 -0
  134. package/personalize.d.ts +1 -0
  135. package/site.d.ts +1 -0
  136. package/tools.d.ts +1 -0
  137. package/types/client/edge-proxy.d.ts +17 -0
  138. package/types/client/edge-proxy.d.ts.map +1 -0
  139. package/types/client/index.d.ts +7 -0
  140. package/types/client/index.d.ts.map +1 -0
  141. package/types/client/models.d.ts +21 -0
  142. package/types/client/models.d.ts.map +1 -0
  143. package/types/client/sitecore-client.d.ts +338 -0
  144. package/types/client/sitecore-client.d.ts.map +1 -0
  145. package/types/client/utils.d.ts +15 -0
  146. package/types/client/utils.d.ts.map +1 -0
  147. package/types/config/define-config.d.ts +20 -0
  148. package/types/config/define-config.d.ts.map +1 -0
  149. package/types/config/index.d.ts +3 -0
  150. package/types/config/index.d.ts.map +1 -0
  151. package/types/config/models.d.ts +287 -0
  152. package/types/config/models.d.ts.map +1 -0
  153. package/types/config-cli/define-cli-config.d.ts +9 -0
  154. package/types/config-cli/define-cli-config.d.ts.map +1 -0
  155. package/types/config-cli/index.d.ts +3 -0
  156. package/types/config-cli/index.d.ts.map +1 -0
  157. package/types/config-cli/models.d.ts +6 -0
  158. package/types/config-cli/models.d.ts.map +1 -0
  159. package/types/constants.d.ts +10 -0
  160. package/types/constants.d.ts.map +1 -0
  161. package/types/debug.d.ts +19 -0
  162. package/types/debug.d.ts.map +1 -0
  163. package/types/editing/codegen/index.d.ts +2 -0
  164. package/types/editing/codegen/index.d.ts.map +1 -0
  165. package/types/editing/codegen/preview.d.ts +256 -0
  166. package/types/editing/codegen/preview.d.ts.map +1 -0
  167. package/types/editing/component-layout-service.d.ts +84 -0
  168. package/types/editing/component-layout-service.d.ts.map +1 -0
  169. package/types/editing/design-library.d.ts +111 -0
  170. package/types/editing/design-library.d.ts.map +1 -0
  171. package/types/editing/editing-service.d.ts +71 -0
  172. package/types/editing/editing-service.d.ts.map +1 -0
  173. package/types/editing/index.d.ts +7 -0
  174. package/types/editing/index.d.ts.map +1 -0
  175. package/types/editing/models.d.ts +103 -0
  176. package/types/editing/models.d.ts.map +1 -0
  177. package/types/editing/utils.d.ts +82 -0
  178. package/types/editing/utils.d.ts.map +1 -0
  179. package/types/form/form.d.ts +25 -0
  180. package/types/form/form.d.ts.map +1 -0
  181. package/types/form/index.d.ts +2 -0
  182. package/types/form/index.d.ts.map +1 -0
  183. package/types/i18n/dictionary-service.d.ts +133 -0
  184. package/types/i18n/dictionary-service.d.ts.map +1 -0
  185. package/types/i18n/index.d.ts +3 -0
  186. package/types/i18n/index.d.ts.map +1 -0
  187. package/types/i18n/utils.d.ts +9 -0
  188. package/types/i18n/utils.d.ts.map +1 -0
  189. package/types/index.d.ts +7 -0
  190. package/types/index.d.ts.map +1 -0
  191. package/types/layout/content-styles.d.ts +20 -0
  192. package/types/layout/content-styles.d.ts.map +1 -0
  193. package/types/layout/index.d.ts +6 -0
  194. package/types/layout/index.d.ts.map +1 -0
  195. package/types/layout/layout-service.d.ts +45 -0
  196. package/types/layout/layout-service.d.ts.map +1 -0
  197. package/types/layout/models.d.ts +174 -0
  198. package/types/layout/models.d.ts.map +1 -0
  199. package/types/layout/themes.d.ts +13 -0
  200. package/types/layout/themes.d.ts.map +1 -0
  201. package/types/layout/utils.d.ts +56 -0
  202. package/types/layout/utils.d.ts.map +1 -0
  203. package/types/media/index.d.ts +3 -0
  204. package/types/media/index.d.ts.map +1 -0
  205. package/types/media/media-api.d.ts +60 -0
  206. package/types/media/media-api.d.ts.map +1 -0
  207. package/types/models.d.ts +32 -0
  208. package/types/models.d.ts.map +1 -0
  209. package/types/personalize/index.d.ts +4 -0
  210. package/types/personalize/index.d.ts.map +1 -0
  211. package/types/personalize/layout-personalizer.d.ts +29 -0
  212. package/types/personalize/layout-personalizer.d.ts.map +1 -0
  213. package/types/personalize/personalize-service.d.ts +89 -0
  214. package/types/personalize/personalize-service.d.ts.map +1 -0
  215. package/types/personalize/utils.d.ts +78 -0
  216. package/types/personalize/utils.d.ts.map +1 -0
  217. package/types/site/error-pages-service.d.ts +64 -0
  218. package/types/site/error-pages-service.d.ts.map +1 -0
  219. package/types/site/index.d.ts +10 -0
  220. package/types/site/index.d.ts.map +1 -0
  221. package/types/site/models.d.ts +23 -0
  222. package/types/site/models.d.ts.map +1 -0
  223. package/types/site/redirects-service.d.ts +91 -0
  224. package/types/site/redirects-service.d.ts.map +1 -0
  225. package/types/site/robots-service.d.ts +57 -0
  226. package/types/site/robots-service.d.ts.map +1 -0
  227. package/types/site/site-resolver.d.ts +28 -0
  228. package/types/site/site-resolver.d.ts.map +1 -0
  229. package/types/site/siteinfo-service.d.ts +64 -0
  230. package/types/site/siteinfo-service.d.ts.map +1 -0
  231. package/types/site/sitemap-xml-service.d.ts +63 -0
  232. package/types/site/sitemap-xml-service.d.ts.map +1 -0
  233. package/types/site/sitepath-service.d.ts +137 -0
  234. package/types/site/sitepath-service.d.ts.map +1 -0
  235. package/types/site/utils.d.ts +41 -0
  236. package/types/site/utils.d.ts.map +1 -0
  237. package/types/sitecore-service-base.d.ts +31 -0
  238. package/types/sitecore-service-base.d.ts.map +1 -0
  239. package/types/tools/codegen/component-generation.d.ts +50 -0
  240. package/types/tools/codegen/component-generation.d.ts.map +1 -0
  241. package/types/tools/codegen/extract-files.d.ts +24 -0
  242. package/types/tools/codegen/extract-files.d.ts.map +1 -0
  243. package/types/tools/codegen/import-map.d.ts +103 -0
  244. package/types/tools/codegen/import-map.d.ts.map +1 -0
  245. package/types/tools/codegen/utils.d.ts +76 -0
  246. package/types/tools/codegen/utils.d.ts.map +1 -0
  247. package/types/tools/generate-map.d.ts +36 -0
  248. package/types/tools/generate-map.d.ts.map +1 -0
  249. package/types/tools/generateSites.d.ts +25 -0
  250. package/types/tools/generateSites.d.ts.map +1 -0
  251. package/types/tools/index.d.ts +8 -0
  252. package/types/tools/index.d.ts.map +1 -0
  253. package/types/tools/scaffold.d.ts +27 -0
  254. package/types/tools/scaffold.d.ts.map +1 -0
  255. package/types/tools/templating/components.d.ts +104 -0
  256. package/types/tools/templating/components.d.ts.map +1 -0
  257. package/types/tools/templating/index.d.ts +2 -0
  258. package/types/tools/templating/index.d.ts.map +1 -0
@@ -0,0 +1,84 @@
1
+ import { FetchOptions } from '@sitecore-content-sdk/core';
2
+ import { LayoutServiceData } from '../layout/models';
3
+ import { DesignLibraryMode, DesignLibraryVariantGeneration } from './models';
4
+ /**
5
+ * Params for requesting component data in Design Library mode
6
+ * @public
7
+ */
8
+ export interface ComponentLayoutRequestParams {
9
+ /**
10
+ * Item id to be used as context for rendering the component
11
+ */
12
+ itemId: string;
13
+ /**
14
+ * Component identifier. Can be either taken from item's layout details or
15
+ * an arbitrary one (component renderingId and datasource would be used for identification then)
16
+ */
17
+ componentUid: string;
18
+ /**
19
+ * site name to be used as context for rendering the component
20
+ */
21
+ siteName: string;
22
+ /**
23
+ * language to render component in
24
+ */
25
+ language?: string;
26
+ /**
27
+ * optional component datasource
28
+ */
29
+ dataSourceId?: string;
30
+ /**
31
+ * ID of the component definition rendering item in Sitecore
32
+ */
33
+ renderingId?: string;
34
+ /**
35
+ * version of the context item (latest by default)
36
+ */
37
+ version?: string;
38
+ /**
39
+ * mode to be used for rendering the component
40
+ */
41
+ mode?: DesignLibraryMode;
42
+ /**
43
+ * design library variant generation mode
44
+ */
45
+ generation?: DesignLibraryVariantGeneration;
46
+ }
47
+ /**
48
+ * Config for ComponentLayoutService.
49
+ * Provide contextId (server) and optionally clientContextId (browser).
50
+ * @public
51
+ */
52
+ export interface ComponentLayoutServiceConfig {
53
+ /**
54
+ * A unified identifier used to connect and retrieve data from XM Cloud instance used on the client
55
+ */
56
+ clientContextId?: string;
57
+ /**
58
+ * A unified identifier used to connect and retrieve data from XM Cloud instance used on the server
59
+ */
60
+ contextId: string;
61
+ /**
62
+ * XM Cloud endpoint that the app will communicate and retrieve data from
63
+ * @default https://edge-platform.sitecorecloud.io
64
+ */
65
+ edgeUrl?: string;
66
+ }
67
+ /**
68
+ * REST service that enables Design Library functionality.
69
+ * Returns layout data for a single rendered component.
70
+ * @public
71
+ */
72
+ export declare class ComponentLayoutService {
73
+ private config;
74
+ constructor(config: ComponentLayoutServiceConfig);
75
+ fetchComponentData(params: ComponentLayoutRequestParams, fetchOptions?: FetchOptions): Promise<LayoutServiceData>;
76
+ protected getComponentFetchParams(params: ComponentLayoutRequestParams): any;
77
+ /**
78
+ * Get the fetch URL for the partial layout data endpoint
79
+ * @param {ComponentLayoutRequestParams} params - The parameters for the request
80
+ * @returns {string} The fetch URL for the component data
81
+ */
82
+ private getFetchUrl;
83
+ }
84
+ //# sourceMappingURL=component-layout-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-layout-service.d.ts","sourceRoot":"","sources":["../../src/editing/component-layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAExF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAI7E;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,8BAA8B,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,sBAAsB;IACrB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,4BAA4B;IAExD,kBAAkB,CAChB,MAAM,EAAE,4BAA4B,EACpC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;IAwC7B,SAAS,CAAC,uBAAuB,CAAC,MAAM,EAAE,4BAA4B;IAetE;;;;OAIG;IACH,OAAO,CAAC,WAAW;CAMpB"}
@@ -0,0 +1,111 @@
1
+ import { ComponentFields, ComponentParams, ComponentRendering, Field, GenericFieldValue } from '../layout/models';
2
+ import { DesignLibraryMode } from './models';
3
+ /**
4
+ * Event to be sent when report status to design library
5
+ */
6
+ declare const DESIGN_LIBRARY_STATUS_EVENT_NAME = "component:status";
7
+ /**
8
+ * Prefix for component update cache keys
9
+ * @internal
10
+ */
11
+ export declare const COMPONENT_UPDATE_CACHE_KEY_PREFIX = "component-update-";
12
+ /**
13
+ * Base interface for all Design Library events.
14
+ */
15
+ export interface DesignLibraryEvent {
16
+ /**
17
+ * The name of the event.
18
+ */
19
+ name: string;
20
+ /**
21
+ * The message payload for the event.
22
+ */
23
+ message: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * Represents an event indicating the status of a component in the library.
27
+ * @internal
28
+ */
29
+ export interface DesignLibraryStatusEvent extends DesignLibraryEvent {
30
+ name: typeof DESIGN_LIBRARY_STATUS_EVENT_NAME;
31
+ message: {
32
+ status: 'ready' | 'rendered';
33
+ uid: string;
34
+ };
35
+ }
36
+ /**
37
+ * Enumeration of statuses for the design library.
38
+ * @internal
39
+ */
40
+ export declare enum DesignLibraryStatus {
41
+ READY = "ready",
42
+ RENDERED = "rendered"
43
+ }
44
+ /**
45
+ * Event args for Design Library `update` event
46
+ * @internal
47
+ */
48
+ export interface ComponentUpdateEventArgs extends DesignLibraryEvent {
49
+ name: string;
50
+ details?: {
51
+ uid: string;
52
+ params?: Record<string, string>;
53
+ fields?: Record<string, Field<GenericFieldValue>>;
54
+ };
55
+ }
56
+ /**
57
+ * Adds the browser-side event handler for 'component:update' message used in Design Library
58
+ * The event should update a component on page by uid, with fields and params from event args
59
+ * @param {ComponentRendering} rootComponent root component displayed for Design Library page
60
+ * @param {Function} successCallback callback to be called after successful component update
61
+ * @internal
62
+ */
63
+ export declare const addComponentUpdateHandler: (rootComponent: ComponentRendering, successCallback?: (updatedRootComponent: ComponentRendering) => void) => (() => void) | undefined;
64
+ export declare const validateOrigin: (event: MessageEvent) => boolean;
65
+ /**
66
+ * Validates that a MessageEvent has the expected event name and required data.
67
+ * Logs debug information when validation fails due to invalid origin.
68
+ * @param {MessageEvent} e - The message event to validate.
69
+ * @param {string} eventName - The expected event name to match against e.data.name.
70
+ * @returns {boolean} True if the event has a valid origin, data object, and matching event name; otherwise false.
71
+ */
72
+ export declare const validateEvent: (e: MessageEvent, eventName: string) => boolean;
73
+ export declare const updateComponentHandler: (e: MessageEvent, rootComponent: ComponentRendering, successCallback?: (updatedRootComponent: ComponentRendering) => void) => ComponentRendering<ComponentFields> | undefined;
74
+ /**
75
+ * Updates a component's fields and params with the provided values.
76
+ * @param {ComponentRendering<ComponentFields>} component - The component to update.
77
+ * @param {ComponentFields | undefined} fields - The fields to merge into the component.
78
+ * @param {ComponentParams | undefined} params - The params to merge into the component.
79
+ * @internal
80
+ */
81
+ export declare const updateComponent: (component: ComponentRendering<ComponentFields>, fields: ComponentFields | undefined, params: ComponentParams | undefined) => void;
82
+ /**
83
+ * Generates a DesignLibraryStatusEvent with the given status and uid.
84
+ * @param {DesignLibraryStatus} status - The status of rendering.
85
+ * @param {string} uid - The unique identifier for the event.
86
+ * @returns An object representing the DesignLibraryStatusEvent.
87
+ * @internal
88
+ */
89
+ export declare function getDesignLibraryStatusEvent(status: DesignLibraryStatus, uid: string): DesignLibraryStatusEvent;
90
+ /**
91
+ * Generates the URL for the design library script link.
92
+ * @param {string} [sitecoreEdgeUrl] Sitecore Edge Platform URL. Default is https://edge-platform.sitecorecloud.io
93
+ * @returns The full URL to the design library script.
94
+ * @internal
95
+ */
96
+ export declare function getDesignLibraryScriptLink(sitecoreEdgeUrl?: string): string;
97
+ /**
98
+ * Checks if the given mode is a Design Library mode.
99
+ * @param {unknown} mode - The mode to check.
100
+ * @returns {boolean} True if the mode is a Design Library mode, false otherwise.
101
+ * @internal
102
+ */
103
+ export declare function isDesignLibraryMode(mode: unknown): mode is DesignLibraryMode;
104
+ /**
105
+ * Sends an event to the Design Library
106
+ * @param {DesignLibraryEvent} evt - The event object to send.
107
+ * @internal
108
+ */
109
+ export declare const postToDesignLibrary: (evt: DesignLibraryEvent) => void;
110
+ export {};
111
+ //# sourceMappingURL=design-library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-library.d.ts","sourceRoot":"","sources":["../../src/editing/design-library.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,KAAK,EACL,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C;;GAEG;AACH,QAAA,MAAM,gCAAgC,qBAAqB,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,iCAAiC,sBAAsB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAClE,IAAI,EAAE,OAAO,gCAAgC,CAAC;IAC9C,OAAO,EAAE;QACP,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC;QAC7B,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACnD,CAAC;CACH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,eAAe,kBAAkB,EACjC,kBAAkB,CAAC,oBAAoB,EAAE,kBAAkB,KAAK,IAAI,6BAUrE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,YASjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,YAAY,EAAE,WAAW,MAAM,KAAG,OAelE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,GAAG,YAAY,EACf,eAAe,kBAAkB,EACjC,kBAAkB,CAAC,oBAAoB,EAAE,kBAAkB,KAAK,IAAI,oDAkDrE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,kBAAkB,CAAC,eAAe,CAAC,EAC9C,QAAQ,eAAe,GAAG,SAAS,EACnC,QAAQ,eAAe,GAAG,SAAS,SAQpC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,mBAAmB,EAC3B,GAAG,EAAE,MAAM,GACV,wBAAwB,CAQ1B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,SAA4B,GAAG,MAAM,CAE9F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,iBAAiB,CAE5E;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,kBAAkB,SAW1D,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { GraphQLClient, GraphQLRequestClientFactory, FetchOptions } from '@sitecore-content-sdk/core';
2
+ import { LayoutServiceData, LayoutServicePageState } from '../layout';
3
+ import { LayoutKind } from './models';
4
+ /**
5
+ * GraphQL query for fetching editing data.
6
+ */
7
+ export declare const query = "\n query EditingQuery($itemId: String!, $language: String!, $version: String) {\n item(path: $itemId, language: $language, version: $version) {\n rendered\n }\n }\n";
8
+ /**
9
+ * Response from the GraphQL Editing query.
10
+ */
11
+ export type GraphQLEditingQueryResponse = {
12
+ item: {
13
+ rendered: LayoutServiceData;
14
+ };
15
+ };
16
+ /**
17
+ * Configuration for the EditingService
18
+ * @public
19
+ */
20
+ export interface EditingServiceConfig {
21
+ /**
22
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
23
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
24
+ */
25
+ clientFactory: GraphQLRequestClientFactory;
26
+ }
27
+ /**
28
+ * Options for fetching editing data
29
+ * @public
30
+ */
31
+ export type EditingOptions = {
32
+ itemId: string;
33
+ language: string;
34
+ version?: string;
35
+ layoutKind?: LayoutKind;
36
+ mode: Exclude<LayoutServicePageState, 'Normal'>;
37
+ };
38
+ /**
39
+ * Service for fetching editing data from Sitecore using the Sitecore's GraphQL API.
40
+ * Expected to be used in XMCloud Pages preview (editing) Metadata Edit Mode.
41
+ * @public
42
+ */
43
+ export declare class EditingService {
44
+ serviceConfig: EditingServiceConfig;
45
+ private graphQLClient;
46
+ /**
47
+ * Fetch layout data using the Sitecore GraphQL endpoint.
48
+ * @param {EditingServiceConfig} serviceConfig configuration
49
+ */
50
+ constructor(serviceConfig: EditingServiceConfig);
51
+ /**
52
+ * Fetches editing data. Provides the layout data and dictionary phrases
53
+ * @param {object} variables - The parameters for fetching editing data.
54
+ * @param {string} variables.itemId - The item id (path) to fetch layout data for.
55
+ * @param {string} variables.language - The language to fetch layout data for.
56
+ * @param {string} variables.mode - The editing mode to fetch layout data for.
57
+ * @param {string} [variables.version] - The version of the item (optional).
58
+ * @param {LayoutKind} [variables.layoutKind] - The final or shared layout variant.
59
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
60
+ * @returns {Promise} The layout data and dictionary phrases.
61
+ */
62
+ fetchEditingData({ itemId, language, version, layoutKind, mode }: EditingOptions, fetchOptions?: FetchOptions): Promise<{
63
+ layoutData: LayoutServiceData;
64
+ }>;
65
+ /**
66
+ * Gets a GraphQL client that can make requests to the API.
67
+ * @returns {GraphQLClient} implementation
68
+ */
69
+ protected getGraphQLClient(): GraphQLClient;
70
+ }
71
+ //# sourceMappingURL=editing-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editing-service.d.ts","sourceRoot":"","sources":["../../src/editing/editing-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEtG,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,KAAK,sLAMjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAA;KAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAc;IAON,aAAa,EAAE,oBAAoB;IANtD,OAAO,CAAC,aAAa,CAAgB;IAErC;;;OAGG;gBACgB,aAAa,EAAE,oBAAoB;IAItD;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAA6B,EAAE,IAAI,EAAE,EAAE,cAAc,EAClF,YAAY,CAAC,EAAE,YAAY;;;IAoC7B;;;OAGG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAS5C"}
@@ -0,0 +1,7 @@
1
+ export { EditingService, EditingOptions, EditingServiceConfig } from './editing-service';
2
+ export { DEFAULT_PLACEHOLDER_UID, PagesEditor, isEditorActive, resetEditorChromes, getContentSdkPagesClientData, EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET, INVALID_SECRET_HTML_MESSAGE, PAGES_EDITING_MARKER, ComponentUpdateEventArgs, PREVIEW_KEY, } from './utils';
3
+ export { ComponentLayoutService, ComponentLayoutRequestParams, ComponentLayoutServiceConfig, } from './component-layout-service';
4
+ export { EditingRenderQueryParams, RenderComponentQueryParams, DesignLibraryVariantGeneration, } from './models';
5
+ export { LayoutKind, MetadataKind, EditingPreviewData, DesignLibraryRenderPreviewData, DesignLibraryMode, } from './models';
6
+ export { addComponentUpdateHandler, DesignLibraryStatus, DesignLibraryStatusEvent, getDesignLibraryStatusEvent, getDesignLibraryScriptLink, isDesignLibraryMode, postToDesignLibrary, COMPONENT_UPDATE_CACHE_KEY_PREFIX, updateComponent, } from './design-library';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,iCAAiC,EACjC,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { LayoutServicePageState } from '../layout';
2
+ /**
3
+ * Query parameters appended to the page route URL
4
+ * Appended when XMCloud Pages preview (editing) mode is used
5
+ * `mode` is a special case as it serves editing and component library both
6
+ * @internal
7
+ */
8
+ export interface EditingRenderQueryParams {
9
+ [key: string]: unknown;
10
+ secret: string;
11
+ sc_lang: string;
12
+ sc_itemid: string;
13
+ sc_site: string;
14
+ route: string;
15
+ mode: Exclude<LayoutServicePageState, 'normal'> | DesignLibraryMode;
16
+ sc_layoutKind?: LayoutKind;
17
+ sc_variant?: string;
18
+ sc_version?: string;
19
+ }
20
+ /**
21
+ * Query parameters appended for Component Library functionaity.
22
+ * Used when a single component is rendered in Pages.
23
+ * @internal
24
+ */
25
+ export interface RenderComponentQueryParams {
26
+ [key: string]: unknown;
27
+ secret: string;
28
+ sc_lang: string;
29
+ sc_itemid: string;
30
+ sc_renderingId: string;
31
+ sc_uid: string;
32
+ sc_site: string;
33
+ mode: DesignLibraryMode;
34
+ sc_variant?: string;
35
+ sc_version?: string;
36
+ }
37
+ /**
38
+ * Represents the Editing Layout variant.
39
+ * - shared - shared layout
40
+ * - final - final layout
41
+ * @public
42
+ */
43
+ export declare enum LayoutKind {
44
+ Final = "final",
45
+ Shared = "shared"
46
+ }
47
+ /**
48
+ * Represents the kind of metadata element.
49
+ * - open - starting chrome element
50
+ * - close - closing chrome element
51
+ * @internal
52
+ */
53
+ export declare enum MetadataKind {
54
+ Open = "open",
55
+ Close = "close"
56
+ }
57
+ /**
58
+ * Data for Preview (Editing) Mode.
59
+ * @public
60
+ */
61
+ export type EditingPreviewData = {
62
+ site: string;
63
+ itemId: string;
64
+ language: string;
65
+ mode: Exclude<LayoutServicePageState, 'Normal'>;
66
+ variantIds: string[] | string;
67
+ version?: string;
68
+ layoutKind?: LayoutKind;
69
+ };
70
+ /**
71
+ * Represents the mode of the Design Library
72
+ * @public
73
+ */
74
+ export declare enum DesignLibraryMode {
75
+ /** Normal mode */
76
+ Normal = "library",
77
+ /** Metadata mode */
78
+ Metadata = "library-metadata"
79
+ }
80
+ /**
81
+ * Variant generation mode for Design Library
82
+ * @public
83
+ */
84
+ export declare enum DesignLibraryVariantGeneration {
85
+ Variant = "variant"
86
+ }
87
+ /**
88
+ * Data for Design Library rendering mode
89
+ * @public
90
+ */
91
+ export interface DesignLibraryRenderPreviewData {
92
+ site: string;
93
+ itemId: string;
94
+ renderingId: string;
95
+ componentUid: string;
96
+ language: string;
97
+ mode: DesignLibraryMode;
98
+ variant?: string;
99
+ version?: string;
100
+ dataSourceId?: string;
101
+ generation?: DesignLibraryVariantGeneration;
102
+ }
103
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/editing/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,GAAG,iBAAiB,CAAC;IACpE,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;IAChD,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,kBAAkB;IAClB,MAAM,YAAY;IAClB,oBAAoB;IACpB,QAAQ,qBAAqB;CAC9B;AAED;;;GAGG;AACH,oBAAY,8BAA8B;IACxC,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,8BAA8B,CAAC;CAC7C"}
@@ -0,0 +1,82 @@
1
+ import { Field, GenericFieldValue } from '../layout/models';
2
+ /**
3
+ * Default value of uid for root placeholder when uid is not present.
4
+ * @internal
5
+ */
6
+ export declare const DEFAULT_PLACEHOLDER_UID = "00000000-0000-0000-0000-000000000000";
7
+ /**
8
+ * Query parameter for editing secret
9
+ * @internal
10
+ */
11
+ export declare const QUERY_PARAM_EDITING_SECRET = "secret";
12
+ /**
13
+ * HTML returned for invalid or missing secret
14
+ * @internal
15
+ */
16
+ export declare const INVALID_SECRET_HTML_MESSAGE = "<html><body>Missing or invalid secret</body></html>";
17
+ /**
18
+ * Key to identify whether the app is running in Sitecore Preview mode
19
+ * @internal
20
+ */
21
+ export declare const PREVIEW_KEY = "sc_preview";
22
+ /**
23
+ * ID to be used as a marker for a script rendered in XMC Pages
24
+ * Should identify app is in XM Cloud Pages editing mode
25
+ * @internal
26
+ */
27
+ export declare const PAGES_EDITING_MARKER = "jss-hrz-editing";
28
+ /**
29
+ * Default allowed origins for editing requests. This is used to enforce CORS, CSP headers.
30
+ * @internal
31
+ */
32
+ export declare const EDITING_ALLOWED_ORIGINS: string[];
33
+ /**
34
+ * Event args for Design Library `update` event
35
+ * @internal
36
+ */
37
+ export interface ComponentUpdateEventArgs {
38
+ name: string;
39
+ details?: {
40
+ uid: string;
41
+ params?: Record<string, string>;
42
+ fields?: Record<string, Field<GenericFieldValue>>;
43
+ };
44
+ }
45
+ /**
46
+ * Copy of chrome rediscovery contract from Horizon (chrome-rediscovery.contract.ts)
47
+ */
48
+ export declare const ChromeRediscoveryGlobalFunctionName: {
49
+ name: string;
50
+ };
51
+ /**
52
+ * Static utility class for Sitecore Pages Editor
53
+ * @public
54
+ */
55
+ export declare class PagesEditor {
56
+ /**
57
+ * Determines whether the current execution context is within a Pages Editor.
58
+ * Pages Editor environment can be identified only in the browser
59
+ * @returns true if executing within a Pages Editor
60
+ */
61
+ static isActive(): boolean;
62
+ static resetChromes(): void;
63
+ }
64
+ /**
65
+ * Determines whether the current execution context is within a Sitecore editor.
66
+ * Sitecore Editor environment can be identified only in the browser
67
+ * @returns true if executing within a Sitecore editor
68
+ * @public
69
+ */
70
+ export declare const isEditorActive: () => boolean;
71
+ /**
72
+ * Resets Sitecore editor "chromes"
73
+ * @public
74
+ */
75
+ export declare const resetEditorChromes: () => void;
76
+ /**
77
+ * Gets extra Content SDK clientData scripts to render in XMC Pages in addition to clientData from Pages itself
78
+ * @returns {Record} collection of clientData
79
+ * @internal
80
+ */
81
+ export declare const getContentSdkPagesClientData: () => Record<string, Record<string, unknown>>;
82
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/editing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG5D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yCAAyC,CAAC;AAE9E;;;GAGG;AACH,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wDAAwD,CAAC;AAEjG;;;GAGG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,UAInC,CAAC;AAcF;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACnD,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,mCAAmC;;CAE/C,CAAC;AAEF;;;GAGG;AACH,qBAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,IAAI,OAAO;IAS1B,MAAM,CAAC,YAAY,IAAI,IAAI;CAQ5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAO,OAEjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,+CAKxC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Fetches the form markup from the Sitecore Edge service and renders it in the component's template.
3
+ * @param {string} contextId - The unique identifier of the current context
4
+ * @param {string} formId - The unique identifier of the form
5
+ * @param {string} [edgeUrl] - The URL of the Sitecore Edge Platform
6
+ * @internal
7
+ */
8
+ export declare const loadForm: (contextId: string, formId: string, edgeUrl?: string) => Promise<string>;
9
+ /**
10
+ * When you set the innerHTML property of an element, the browser does not execute any <script> tags included in the HTML string
11
+ * This method ensures that any <script> elements within the loaded HTML are executed.
12
+ * It re-creates the script elements and appends the to the component's template, then removes old script elements to avoid duplication.
13
+ * @param {HTMLElement} rootElement - The root element to execute script elements within
14
+ * @internal
15
+ */
16
+ export declare const executeScriptElements: (rootElement: HTMLElement) => void;
17
+ /**
18
+ * Subscribes to the Form event
19
+ * This listener captures interactions such as form views or submissions
20
+ * @param {HTMLElement} formElement - The form element to subscribe to events on
21
+ * @param {string} [componentId] - The unique identifier of the component
22
+ * @internal
23
+ */
24
+ export declare const subscribeToFormSubmitEvent: (formElement: HTMLElement, componentId?: string) => void;
25
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form/form.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAU,WAAW,MAAM,EAAE,QAAQ,MAAM,EAAE,UAAU,MAAM,oBA+BjF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,WAAW,SAkB7D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,aAAa,WAAW,EAAE,cAAc,MAAM,SAYxF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { executeScriptElements, loadForm, subscribeToFormSubmitEvent } from './form';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { FetchOptions, GraphQLClient, GraphQLRequestClientFactory, CacheClient, CacheOptions } from '@sitecore-content-sdk/core';
2
+ import { PageInfo } from '../client';
3
+ import { GraphQLServiceConfig } from '../sitecore-service-base';
4
+ /** @private */
5
+ export declare const queryError = "Valid value for rootItemId not provided and failed to auto-resolve app root item.";
6
+ /**
7
+ * Query variables for dictionary graphql query
8
+ */
9
+ export interface DictionaryQueryVariables {
10
+ /**
11
+ * Optional. The ID of the search root item. Fetch items that have this item as an ancestor.
12
+ */
13
+ rootItemId?: string;
14
+ /**
15
+ * Optional. Sitecore template ID(s). Fetch items that inherit from this template(s).
16
+ */
17
+ templates?: string;
18
+ /**
19
+ * common variable for all GraphQL queries
20
+ * it will be used for every type of query to regulate result batch size
21
+ * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
22
+ * @default 10
23
+ */
24
+ pageSize?: number;
25
+ }
26
+ /**
27
+ * Object model for Sitecore dictionary phrases
28
+ * @public
29
+ */
30
+ export interface DictionaryPhrases {
31
+ [k: string]: string;
32
+ }
33
+ /**
34
+ * Configuration options for @see DictionaryService instances
35
+ * @public
36
+ */
37
+ export interface DictionaryServiceConfig extends CacheOptions, GraphQLServiceConfig {
38
+ /**
39
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
40
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
41
+ */
42
+ clientFactory: GraphQLRequestClientFactory;
43
+ /**
44
+ * Optional. The template ID to use when searching for dictionary entries.
45
+ * @default '6d1cd89719364a3aa511289a94c2a7b1' (/sitecore/templates/System/Dictionary/Dictionary entry)
46
+ */
47
+ dictionaryEntryTemplateId?: string;
48
+ /**
49
+ * common variable for all GraphQL queries
50
+ * it will be used for every type of query to regulate result batch size
51
+ * Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
52
+ * @default 10
53
+ */
54
+ pageSize?: number;
55
+ }
56
+ /**
57
+ * The schema of data returned in response to a dictionary query request.
58
+ */
59
+ export type DictionaryQueryResult = {
60
+ key: {
61
+ value: string;
62
+ };
63
+ phrase: {
64
+ value: string;
65
+ };
66
+ };
67
+ export type DictionarySiteQueryResponse = {
68
+ site: {
69
+ siteInfo: {
70
+ dictionary: {
71
+ results: {
72
+ key: string;
73
+ value: string;
74
+ }[];
75
+ pageInfo: PageInfo;
76
+ };
77
+ };
78
+ };
79
+ };
80
+ /**
81
+ * Service that fetch dictionary data using Sitecore's GraphQL API.
82
+ * @augments DictionaryServiceBase
83
+ * @mixes SearchQueryService<DictionaryQueryResult>
84
+ * @public
85
+ */
86
+ export declare class DictionaryService implements CacheClient<DictionaryPhrases> {
87
+ options: DictionaryServiceConfig;
88
+ private graphQLClient;
89
+ private cache;
90
+ /**
91
+ * Creates an instance of graphQL dictionary service with the provided options
92
+ * @param {DictionaryService} options instance
93
+ */
94
+ constructor(options: DictionaryServiceConfig);
95
+ /**
96
+ * Fetches dictionary data for internalization. Uses search query by default
97
+ * @param {string} language the language to fetch
98
+ * @param {string} site site name to fetch data for.
99
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
100
+ * @returns {Promise<DictionaryPhrases>} dictionary phrases
101
+ * @throws {Error} if the app root was not found for the specified site and language.
102
+ */
103
+ fetchDictionaryData(language: string, site: string, fetchOptions?: FetchOptions): Promise<DictionaryPhrases>;
104
+ /**
105
+ * Caches a @see DictionaryPhrases value for the specified cache key.
106
+ * @param {string} key The cache key.
107
+ * @param {DictionaryPhrases} value The value to cache.
108
+ * @returns The value added to the cache.
109
+ * @mixes CacheClient<DictionaryPhrases>
110
+ */
111
+ setCacheValue(key: string, value: DictionaryPhrases): DictionaryPhrases;
112
+ /**
113
+ * Retrieves a @see DictionaryPhrases value from the cache.
114
+ * @param {string} key The cache key.
115
+ * @returns The @see DictionaryPhrases value, or null if the specified key is not found in the cache.
116
+ */
117
+ getCacheValue(key: string): DictionaryPhrases | null;
118
+ /**
119
+ * Gets a cache client that can cache data. Uses memory-cache as the default
120
+ * library for caching (@see MemoryCacheClient). Override this method if you
121
+ * want to use something else.
122
+ * @returns {CacheClient} implementation
123
+ */
124
+ protected getCacheClient(): CacheClient<DictionaryPhrases>;
125
+ /**
126
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
127
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
128
+ * want to use something else.
129
+ * @returns {GraphQLClient} implementation
130
+ */
131
+ protected getGraphQLClient(): GraphQLClient;
132
+ }
133
+ //# sourceMappingURL=dictionary-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary-service.d.ts","sourceRoot":"","sources":["../../src/i18n/dictionary-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,2BAA2B,EAC3B,WAAW,EACX,YAAY,EAEb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,eAAe;AACf,eAAO,MAAM,UAAU,sFAC8D,CAAC;AA2BtF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,YAAY,EAAE,oBAAoB;IACjF;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;IAE3C;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,OAAO,EAAE;oBAAE,GAAG,EAAE,MAAM,CAAC;oBAAC,KAAK,EAAE,MAAM,CAAA;iBAAE,EAAE,CAAC;gBAC1C,QAAQ,EAAE,QAAQ,CAAC;aACpB,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,WAAW,CAAC,iBAAiB,CAAC;IAOnD,OAAO,EAAE,uBAAuB;IANnD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAiC;IAC9C;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;IAKnD;;;;;;;OAOG;IACG,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;IAiD7B;;;;;;OAMG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,iBAAiB;IAIvE;;;;OAIG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;IAIpD;;;;;OAKG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW,CAAC,iBAAiB,CAAC;IAI1D;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAU5C"}