@sitecore-content-sdk/core 1.3.0-canary.9 → 1.4.0-canary.2

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 (342) hide show
  1. package/README.md +7 -7
  2. package/dist/cjs/cache-client.js +55 -54
  3. package/dist/cjs/client/constants.js +7 -7
  4. package/dist/cjs/client/edge-proxy.js +24 -22
  5. package/dist/cjs/client/index.js +15 -15
  6. package/dist/cjs/client/models.js +2 -2
  7. package/dist/cjs/client/sitecore-client.js +421 -419
  8. package/dist/cjs/client/utils.js +47 -46
  9. package/dist/cjs/config/define-config.js +194 -193
  10. package/dist/cjs/config/index.js +7 -7
  11. package/dist/cjs/config/models.js +12 -11
  12. package/dist/cjs/config-cli/define-cli-config.js +23 -22
  13. package/dist/cjs/config-cli/index.js +7 -7
  14. package/dist/cjs/config-cli/models.js +8 -7
  15. package/dist/cjs/constants.js +49 -17
  16. package/dist/cjs/debug.js +48 -46
  17. package/dist/cjs/editing/codegen/index.js +14 -9
  18. package/dist/cjs/editing/codegen/preview.js +277 -193
  19. package/dist/cjs/editing/component-layout-service.js +62 -61
  20. package/dist/cjs/editing/design-library.js +183 -126
  21. package/dist/cjs/editing/editing-service.js +75 -74
  22. package/dist/cjs/editing/index.js +33 -27
  23. package/dist/cjs/editing/metadata.js +42 -42
  24. package/dist/cjs/editing/models.js +44 -38
  25. package/dist/cjs/editing/utils.js +108 -90
  26. package/dist/cjs/form/form.js +81 -78
  27. package/dist/cjs/form/index.js +7 -7
  28. package/dist/cjs/graphql-request-client.js +108 -107
  29. package/dist/cjs/i18n/dictionary-service.js +122 -121
  30. package/dist/cjs/i18n/index.js +7 -7
  31. package/dist/cjs/i18n/utils.js +16 -15
  32. package/dist/cjs/index.js +60 -60
  33. package/dist/cjs/layout/content-styles.js +72 -71
  34. package/dist/cjs/layout/index.js +24 -24
  35. package/dist/cjs/layout/layout-service.js +62 -57
  36. package/dist/cjs/layout/models.js +39 -34
  37. package/dist/cjs/layout/themes.js +76 -75
  38. package/dist/cjs/layout/utils.js +117 -110
  39. package/dist/cjs/media/index.js +38 -38
  40. package/dist/cjs/media/media-api.js +100 -96
  41. package/dist/cjs/models.js +2 -2
  42. package/dist/cjs/native-fetcher.js +194 -179
  43. package/dist/cjs/personalize/index.js +15 -15
  44. package/dist/cjs/personalize/layout-personalizer.js +98 -97
  45. package/dist/cjs/personalize/personalize-service.js +98 -94
  46. package/dist/cjs/personalize/utils.js +143 -136
  47. package/dist/cjs/retries.js +43 -42
  48. package/dist/cjs/site/error-pages-service.js +65 -64
  49. package/dist/cjs/site/index.js +26 -26
  50. package/dist/cjs/site/models.js +2 -2
  51. package/dist/cjs/site/redirects-service.js +94 -81
  52. package/dist/cjs/site/robots-service.js +66 -65
  53. package/dist/cjs/site/site-resolver.js +73 -72
  54. package/dist/cjs/site/siteinfo-service.js +84 -80
  55. package/dist/cjs/site/sitemap-xml-service.js +84 -83
  56. package/dist/cjs/site/sitepath-service.js +165 -164
  57. package/dist/cjs/site/utils.js +55 -47
  58. package/dist/cjs/sitecore-service-base.js +36 -36
  59. package/dist/cjs/tools/auth/flow.js +65 -64
  60. package/dist/cjs/tools/auth/index.js +5 -5
  61. package/dist/cjs/tools/auth/models.js +2 -2
  62. package/dist/cjs/tools/auth/tenant-store.js +38 -38
  63. package/dist/cjs/tools/codegen/component-generation.js +52 -50
  64. package/dist/cjs/tools/codegen/extract-files.js +105 -107
  65. package/dist/cjs/tools/codegen/import-map.js +401 -349
  66. package/dist/cjs/tools/codegen/utils.js +418 -418
  67. package/dist/cjs/tools/generate-map.js +2 -2
  68. package/dist/cjs/tools/generateMetadata.js +36 -35
  69. package/dist/cjs/tools/generateSites.js +59 -58
  70. package/dist/cjs/tools/index.js +75 -73
  71. package/dist/cjs/tools/scaffold.js +60 -59
  72. package/dist/cjs/tools/templating/components.js +96 -266
  73. package/dist/cjs/tools/templating/index.js +11 -14
  74. package/dist/cjs/tools/templating/plugins.js +80 -78
  75. package/dist/cjs/tools/templating/utils.js +67 -66
  76. package/dist/cjs/utils/ensurePath.js +20 -20
  77. package/dist/cjs/utils/env.js +28 -27
  78. package/dist/cjs/utils/globalCache.js +55 -0
  79. package/dist/cjs/utils/index.js +26 -21
  80. package/dist/cjs/utils/is-server.js +11 -10
  81. package/dist/cjs/utils/normalize-url.js +5 -5
  82. package/dist/cjs/utils/timeout-promise.js +31 -31
  83. package/dist/cjs/utils/utils.js +254 -229
  84. package/dist/esm/cache-client.js +51 -50
  85. package/dist/esm/client/constants.js +4 -4
  86. package/dist/esm/client/edge-proxy.js +19 -17
  87. package/dist/esm/client/index.js +5 -5
  88. package/dist/esm/client/models.js +1 -1
  89. package/dist/esm/client/sitecore-client.js +414 -412
  90. package/dist/esm/client/utils.js +43 -42
  91. package/dist/esm/config/define-config.js +188 -187
  92. package/dist/esm/config/index.js +2 -2
  93. package/dist/esm/config/models.js +9 -8
  94. package/dist/esm/config-cli/define-cli-config.js +19 -18
  95. package/dist/esm/config-cli/index.js +2 -2
  96. package/dist/esm/config-cli/models.js +5 -4
  97. package/dist/esm/constants.js +46 -14
  98. package/dist/esm/debug.js +41 -39
  99. package/dist/esm/editing/codegen/index.js +1 -1
  100. package/dist/esm/editing/codegen/preview.js +263 -185
  101. package/dist/esm/editing/component-layout-service.js +55 -54
  102. package/dist/esm/editing/design-library.js +171 -117
  103. package/dist/esm/editing/editing-service.js +68 -67
  104. package/dist/esm/editing/index.js +6 -5
  105. package/dist/esm/editing/metadata.js +39 -39
  106. package/dist/esm/editing/models.js +41 -35
  107. package/dist/esm/editing/utils.js +98 -80
  108. package/dist/esm/form/form.js +72 -69
  109. package/dist/esm/form/index.js +1 -1
  110. package/dist/esm/graphql-request-client.js +101 -100
  111. package/dist/esm/i18n/dictionary-service.js +115 -114
  112. package/dist/esm/i18n/index.js +2 -2
  113. package/dist/esm/i18n/utils.js +13 -12
  114. package/dist/esm/index.js +13 -13
  115. package/dist/esm/layout/content-styles.js +64 -63
  116. package/dist/esm/layout/index.js +6 -6
  117. package/dist/esm/layout/layout-service.js +55 -50
  118. package/dist/esm/layout/models.js +36 -31
  119. package/dist/esm/layout/themes.js +71 -70
  120. package/dist/esm/layout/utils.js +109 -102
  121. package/dist/esm/media/index.js +2 -2
  122. package/dist/esm/media/media-api.js +90 -86
  123. package/dist/esm/models.js +1 -1
  124. package/dist/esm/native-fetcher.js +187 -172
  125. package/dist/esm/personalize/index.js +3 -3
  126. package/dist/esm/personalize/layout-personalizer.js +93 -92
  127. package/dist/esm/personalize/personalize-service.js +91 -87
  128. package/dist/esm/personalize/utils.js +135 -128
  129. package/dist/esm/retries.js +39 -38
  130. package/dist/esm/site/error-pages-service.js +58 -57
  131. package/dist/esm/site/index.js +8 -8
  132. package/dist/esm/site/models.js +1 -1
  133. package/dist/esm/site/redirects-service.js +87 -74
  134. package/dist/esm/site/robots-service.js +59 -58
  135. package/dist/esm/site/site-resolver.js +69 -68
  136. package/dist/esm/site/siteinfo-service.js +77 -73
  137. package/dist/esm/site/sitemap-xml-service.js +77 -76
  138. package/dist/esm/site/sitepath-service.js +157 -156
  139. package/dist/esm/site/utils.js +49 -41
  140. package/dist/esm/sitecore-service-base.js +29 -29
  141. package/dist/esm/tools/auth/flow.js +62 -61
  142. package/dist/esm/tools/auth/index.js +1 -1
  143. package/dist/esm/tools/auth/models.js +1 -1
  144. package/dist/esm/tools/auth/tenant-store.js +35 -35
  145. package/dist/esm/tools/codegen/component-generation.js +44 -42
  146. package/dist/esm/tools/codegen/extract-files.js +99 -101
  147. package/dist/esm/tools/codegen/import-map.js +358 -306
  148. package/dist/esm/tools/codegen/utils.js +373 -373
  149. package/dist/esm/tools/generate-map.js +1 -1
  150. package/dist/esm/tools/generateMetadata.js +29 -28
  151. package/dist/esm/tools/generateSites.js +52 -51
  152. package/dist/esm/tools/index.js +28 -27
  153. package/dist/esm/tools/scaffold.js +52 -51
  154. package/dist/esm/tools/templating/components.js +59 -223
  155. package/dist/esm/tools/templating/index.js +3 -3
  156. package/dist/esm/tools/templating/plugins.js +72 -70
  157. package/dist/esm/tools/templating/utils.js +59 -58
  158. package/dist/esm/utils/ensurePath.js +13 -13
  159. package/dist/esm/utils/env.js +24 -23
  160. package/dist/esm/utils/globalCache.js +49 -0
  161. package/dist/esm/utils/index.js +4 -3
  162. package/dist/esm/utils/is-server.js +9 -8
  163. package/dist/esm/utils/normalize-url.js +1 -1
  164. package/dist/esm/utils/timeout-promise.js +28 -28
  165. package/dist/esm/utils/utils.js +238 -213
  166. package/package.json +73 -5
  167. package/types/cache-client.d.ts +68 -64
  168. package/types/cache-client.d.ts.map +1 -0
  169. package/types/client/constants.d.ts +5 -4
  170. package/types/client/constants.d.ts.map +1 -0
  171. package/types/client/edge-proxy.d.ts +18 -15
  172. package/types/client/edge-proxy.d.ts.map +1 -0
  173. package/types/client/index.d.ts +8 -7
  174. package/types/client/index.d.ts.map +1 -0
  175. package/types/client/models.d.ts +21 -19
  176. package/types/client/models.d.ts.map +1 -0
  177. package/types/client/sitecore-client.d.ts +338 -327
  178. package/types/client/sitecore-client.d.ts.map +1 -0
  179. package/types/client/utils.d.ts +15 -9
  180. package/types/client/utils.d.ts.map +1 -0
  181. package/types/config/define-config.d.ts +20 -18
  182. package/types/config/define-config.d.ts.map +1 -0
  183. package/types/config/index.d.ts +3 -2
  184. package/types/config/index.d.ts.map +1 -0
  185. package/types/config/models.d.ts +287 -268
  186. package/types/config/models.d.ts.map +1 -0
  187. package/types/config-cli/define-cli-config.d.ts +9 -7
  188. package/types/config-cli/define-cli-config.d.ts.map +1 -0
  189. package/types/config-cli/index.d.ts +3 -2
  190. package/types/config-cli/index.d.ts.map +1 -0
  191. package/types/config-cli/models.d.ts +6 -4
  192. package/types/config-cli/models.d.ts.map +1 -0
  193. package/types/constants.d.ts +44 -11
  194. package/types/constants.d.ts.map +1 -0
  195. package/types/debug.d.ts +35 -28
  196. package/types/debug.d.ts.map +1 -0
  197. package/types/editing/codegen/index.d.ts +2 -1
  198. package/types/editing/codegen/index.d.ts.map +1 -0
  199. package/types/editing/codegen/preview.d.ts +256 -195
  200. package/types/editing/codegen/preview.d.ts.map +1 -0
  201. package/types/editing/component-layout-service.d.ts +84 -80
  202. package/types/editing/component-layout-service.d.ts.map +1 -0
  203. package/types/editing/design-library.d.ts +111 -63
  204. package/types/editing/design-library.d.ts.map +1 -0
  205. package/types/editing/editing-service.d.ts +72 -62
  206. package/types/editing/editing-service.d.ts.map +1 -0
  207. package/types/editing/index.d.ts +7 -6
  208. package/types/editing/index.d.ts.map +1 -0
  209. package/types/editing/metadata.d.ts +8 -7
  210. package/types/editing/metadata.d.ts.map +1 -0
  211. package/types/editing/models.d.ts +103 -92
  212. package/types/editing/models.d.ts.map +1 -0
  213. package/types/editing/utils.d.ts +91 -74
  214. package/types/editing/utils.d.ts.map +1 -0
  215. package/types/form/form.d.ts +25 -21
  216. package/types/form/form.d.ts.map +1 -0
  217. package/types/form/index.d.ts +2 -1
  218. package/types/form/index.d.ts.map +1 -0
  219. package/types/graphql-request-client.d.ts +112 -105
  220. package/types/graphql-request-client.d.ts.map +1 -0
  221. package/types/i18n/dictionary-service.d.ts +135 -131
  222. package/types/i18n/dictionary-service.d.ts.map +1 -0
  223. package/types/i18n/index.d.ts +3 -2
  224. package/types/i18n/index.d.ts.map +1 -0
  225. package/types/i18n/utils.d.ts +9 -7
  226. package/types/i18n/utils.d.ts.map +1 -0
  227. package/types/index.d.ts +13 -12
  228. package/types/index.d.ts.map +1 -0
  229. package/types/layout/content-styles.d.ts +20 -18
  230. package/types/layout/content-styles.d.ts.map +1 -0
  231. package/types/layout/index.d.ts +6 -5
  232. package/types/layout/index.d.ts.map +1 -0
  233. package/types/layout/layout-service.d.ts +45 -35
  234. package/types/layout/layout-service.d.ts.map +1 -0
  235. package/types/layout/models.d.ts +174 -151
  236. package/types/layout/models.d.ts.map +1 -0
  237. package/types/layout/themes.d.ts +13 -11
  238. package/types/layout/themes.d.ts.map +1 -0
  239. package/types/layout/utils.d.ts +56 -41
  240. package/types/layout/utils.d.ts.map +1 -0
  241. package/types/media/index.d.ts +3 -2
  242. package/types/media/index.d.ts.map +1 -0
  243. package/types/media/media-api.d.ts +60 -55
  244. package/types/media/media-api.d.ts.map +1 -0
  245. package/types/models.d.ts +94 -84
  246. package/types/models.d.ts.map +1 -0
  247. package/types/native-fetcher.d.ts +124 -114
  248. package/types/native-fetcher.d.ts.map +1 -0
  249. package/types/personalize/index.d.ts +4 -3
  250. package/types/personalize/index.d.ts.map +1 -0
  251. package/types/personalize/layout-personalizer.d.ts +29 -27
  252. package/types/personalize/layout-personalizer.d.ts.map +1 -0
  253. package/types/personalize/personalize-service.d.ts +90 -80
  254. package/types/personalize/personalize-service.d.ts.map +1 -0
  255. package/types/personalize/utils.d.ts +78 -69
  256. package/types/personalize/utils.d.ts.map +1 -0
  257. package/types/retries.d.ts +26 -24
  258. package/types/retries.d.ts.map +1 -0
  259. package/types/site/error-pages-service.d.ts +64 -57
  260. package/types/site/error-pages-service.d.ts.map +1 -0
  261. package/types/site/index.d.ts +10 -9
  262. package/types/site/index.d.ts.map +1 -0
  263. package/types/site/models.d.ts +23 -18
  264. package/types/site/models.d.ts.map +1 -0
  265. package/types/site/redirects-service.d.ts +92 -69
  266. package/types/site/redirects-service.d.ts.map +1 -0
  267. package/types/site/robots-service.d.ts +57 -50
  268. package/types/site/robots-service.d.ts.map +1 -0
  269. package/types/site/site-resolver.d.ts +28 -26
  270. package/types/site/site-resolver.d.ts.map +1 -0
  271. package/types/site/siteinfo-service.d.ts +65 -52
  272. package/types/site/siteinfo-service.d.ts.map +1 -0
  273. package/types/site/sitemap-xml-service.d.ts +63 -56
  274. package/types/site/sitemap-xml-service.d.ts.map +1 -0
  275. package/types/site/sitepath-service.d.ts +137 -134
  276. package/types/site/sitepath-service.d.ts.map +1 -0
  277. package/types/site/utils.d.ts +41 -28
  278. package/types/site/utils.d.ts.map +1 -0
  279. package/types/sitecore-service-base.d.ts +31 -30
  280. package/types/sitecore-service-base.d.ts.map +1 -0
  281. package/types/tools/auth/flow.d.ts +29 -27
  282. package/types/tools/auth/flow.d.ts.map +1 -0
  283. package/types/tools/auth/index.d.ts +2 -1
  284. package/types/tools/auth/index.d.ts.map +1 -0
  285. package/types/tools/auth/models.d.ts +35 -33
  286. package/types/tools/auth/models.d.ts.map +1 -0
  287. package/types/tools/auth/tenant-store.d.ts +12 -11
  288. package/types/tools/auth/tenant-store.d.ts.map +1 -0
  289. package/types/tools/codegen/component-generation.d.ts +50 -47
  290. package/types/tools/codegen/component-generation.d.ts.map +1 -0
  291. package/types/tools/codegen/extract-files.d.ts +24 -22
  292. package/types/tools/codegen/extract-files.d.ts.map +1 -0
  293. package/types/tools/codegen/import-map.d.ts +103 -70
  294. package/types/tools/codegen/import-map.d.ts.map +1 -0
  295. package/types/tools/codegen/utils.d.ts +76 -75
  296. package/types/tools/codegen/utils.d.ts.map +1 -0
  297. package/types/tools/generate-map.d.ts +36 -26
  298. package/types/tools/generate-map.d.ts.map +1 -0
  299. package/types/tools/generateMetadata.d.ts +24 -22
  300. package/types/tools/generateMetadata.d.ts.map +1 -0
  301. package/types/tools/generateSites.d.ts +25 -22
  302. package/types/tools/generateSites.d.ts.map +1 -0
  303. package/types/tools/index.d.ts +22 -20
  304. package/types/tools/index.d.ts.map +1 -0
  305. package/types/tools/scaffold.d.ts +27 -25
  306. package/types/tools/scaffold.d.ts.map +1 -0
  307. package/types/tools/templating/components.d.ts +104 -103
  308. package/types/tools/templating/components.d.ts.map +1 -0
  309. package/types/tools/templating/index.d.ts +4 -3
  310. package/types/tools/templating/index.d.ts.map +1 -0
  311. package/types/tools/templating/plugins.d.ts +71 -67
  312. package/types/tools/templating/plugins.d.ts.map +1 -0
  313. package/types/tools/templating/utils.d.ts +42 -40
  314. package/types/tools/templating/utils.d.ts.map +1 -0
  315. package/types/utils/ensurePath.d.ts +7 -6
  316. package/types/utils/ensurePath.d.ts.map +1 -0
  317. package/types/utils/env.d.ts +9 -7
  318. package/types/utils/env.d.ts.map +1 -0
  319. package/types/utils/globalCache.d.ts +37 -0
  320. package/types/utils/globalCache.d.ts.map +1 -0
  321. package/types/utils/index.d.ts +5 -3
  322. package/types/utils/index.d.ts.map +1 -0
  323. package/types/utils/is-server.d.ts +8 -6
  324. package/types/utils/is-server.d.ts.map +1 -0
  325. package/types/utils/normalize-url.d.ts +2 -1
  326. package/types/utils/normalize-url.d.ts.map +1 -0
  327. package/types/utils/timeout-promise.d.ts +18 -17
  328. package/types/utils/timeout-promise.d.ts.map +1 -0
  329. package/types/utils/utils.d.ts +104 -79
  330. package/types/utils/utils.d.ts.map +1 -0
  331. package/client.js +0 -1
  332. package/codegen.js +0 -1
  333. package/config-cli.js +0 -1
  334. package/config.js +0 -1
  335. package/editing.js +0 -1
  336. package/i18n.js +0 -1
  337. package/layout.js +0 -1
  338. package/media.js +0 -1
  339. package/personalize.js +0 -1
  340. package/site.js +0 -1
  341. package/tools.js +0 -1
  342. package/utils.js +0 -1
@@ -1,27 +1,29 @@
1
- import { LayoutServiceData, ComponentRendering, PlaceholdersData } from '../layout/models';
2
- export type ComponentRenderingWithExperiences = ComponentRendering & {
3
- experiences: {
4
- [name: string]: ComponentRenderingWithExperiences;
5
- };
6
- };
7
- /**
8
- * Apply personalization to layout data. This will recursively go through all placeholders/components, check experiences nodes and replace default with object from specific experience.
9
- * @param {LayoutServiceData} layout Layout data
10
- * @param {string} variantId variant id
11
- * @param {string[]} [componentVariantIds] component variant ids
12
- */
13
- export declare function personalizeLayout(layout: LayoutServiceData, variantId: string, componentVariantIds?: string[]): PlaceholdersData<string> | undefined;
14
- /**
15
- * @param {Array} components components within placeholder
16
- * @param {string[]} variantIds variant ids
17
- * @param {boolean} isEditing indicates if page is rendered in metadata edit mode
18
- * @returns {ComponentRendering[]} components with personalization applied
19
- */
20
- export declare function personalizePlaceholder(components: ComponentRendering[], variantIds: string[], isEditing?: boolean): ComponentRendering[];
21
- /**
22
- * @param {ComponentRenderingWithExperiences} component component with experiences
23
- * @param {string[]} variantIds variant ids
24
- * @param {boolean} isEditing indicates if page is rendered in metadata edit mode
25
- * @returns {ComponentRendering | null} component with personalization applied or null if hidden
26
- */
27
- export declare function personalizeComponent(component: ComponentRenderingWithExperiences, variantIds: string[], isEditing?: boolean): ComponentRendering | null;
1
+ import { LayoutServiceData, ComponentRendering, PlaceholdersData } from '../layout/models';
2
+ export type ComponentRenderingWithExperiences = ComponentRendering & {
3
+ experiences: {
4
+ [name: string]: ComponentRenderingWithExperiences;
5
+ };
6
+ };
7
+ /**
8
+ * Apply personalization to layout data. This will recursively go through all placeholders/components, check experiences nodes and replace default with object from specific experience.
9
+ * @param {LayoutServiceData} layout Layout data
10
+ * @param {string} variantId variant id
11
+ * @param {string[]} [componentVariantIds] component variant ids
12
+ * @public
13
+ */
14
+ export declare function personalizeLayout(layout: LayoutServiceData, variantId: string, componentVariantIds?: string[]): PlaceholdersData<string> | undefined;
15
+ /**
16
+ * @param {Array} components components within placeholder
17
+ * @param {string[]} variantIds variant ids
18
+ * @param {boolean} isEditing indicates if page is rendered in metadata edit mode
19
+ * @returns {ComponentRendering[]} components with personalization applied
20
+ */
21
+ export declare function personalizePlaceholder(components: ComponentRendering[], variantIds: string[], isEditing?: boolean): ComponentRendering[];
22
+ /**
23
+ * @param {ComponentRenderingWithExperiences} component component with experiences
24
+ * @param {string[]} variantIds variant ids
25
+ * @param {boolean} isEditing indicates if page is rendered in metadata edit mode
26
+ * @returns {ComponentRendering | null} component with personalization applied or null if hidden
27
+ */
28
+ export declare function personalizeComponent(component: ComponentRenderingWithExperiences, variantIds: string[], isEditing?: boolean): ComponentRendering | null;
29
+ //# sourceMappingURL=layout-personalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-personalizer.d.ts","sourceRoot":"","sources":["../../src/personalize/layout-personalizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQ3F,MAAM,MAAM,iCAAiC,GAAG,kBAAkB,GAAG;IACnE,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iCAAiC,CAAA;KAAE,CAAC;CACpE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,EACjB,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC7B,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,CAkBtC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,EAAE,EAChC,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,OAAO,GAClB,kBAAkB,EAAE,CA0BtB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,iCAAiC,EAC5C,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,OAAO,GAClB,kBAAkB,GAAG,IAAI,CA2C3B"}
@@ -1,80 +1,90 @@
1
- import { GraphQLClient, GraphQLRequestClientFactory } from '../graphql-request-client';
2
- import { CacheClient, CacheOptions } from '../cache-client';
3
- export type PersonalizeServiceConfig = CacheOptions & {
4
- /**
5
- * Timeout (ms) for the Personalize request. Default is 400.
6
- */
7
- timeout?: number;
8
- /**
9
- * Optional Sitecore Personalize scope identifier allowing you to isolate your personalization data between XM Cloud environments
10
- * @deprecated Will be removed in a future release.
11
- */
12
- scope?: string;
13
- /**
14
- * Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
15
- */
16
- fetch?: typeof fetch;
17
- /**
18
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
19
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
20
- */
21
- clientFactory: GraphQLRequestClientFactory;
22
- };
23
- /**
24
- * Object model of personlize info
25
- */
26
- export type PersonalizeInfo = {
27
- /**
28
- * The page id
29
- */
30
- pageId: string;
31
- /**
32
- * The configured variant ids
33
- */
34
- variantIds: string[];
35
- };
36
- type PersonalizeQueryResult = {
37
- layout: {
38
- item: {
39
- id: string;
40
- version: string;
41
- personalization: {
42
- variantIds: string[];
43
- };
44
- };
45
- };
46
- };
47
- export declare class PersonalizeService {
48
- protected config: PersonalizeServiceConfig;
49
- private graphQLClient;
50
- private cache;
51
- /**
52
- * Fetch personalize data using the Sitecore GraphQL endpoint.
53
- * @param {PersonalizeServiceConfig} config
54
- */
55
- constructor(config: PersonalizeServiceConfig);
56
- protected get query(): string;
57
- /**
58
- * Get personalize information for a route
59
- * @param {string} itemPath page route
60
- * @param {string} language language
61
- * @param {string} siteName site name
62
- * @returns {Promise<PersonalizeInfo | undefined>} the personalize information or undefined (if itemPath / language not found)
63
- */
64
- getPersonalizeInfo(itemPath: string, language: string, siteName: string): Promise<PersonalizeInfo | undefined>;
65
- /**
66
- * Gets cache client implementation
67
- * Override this method if custom cache needs to be used
68
- * @returns CacheClient instance
69
- */
70
- protected getCacheClient(): CacheClient<PersonalizeQueryResult>;
71
- protected getCacheKey(itemPath: string, language: string, siteName: string): string;
72
- /**
73
- * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
74
- * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
75
- * want to use something else.
76
- * @returns {GraphQLClient} implementation
77
- */
78
- protected getGraphQLClient(): GraphQLClient;
79
- }
80
- export {};
1
+ import { GraphQLClient, GraphQLRequestClientFactory } from '../graphql-request-client';
2
+ import { CacheClient, CacheOptions } from '../cache-client';
3
+ /**
4
+ * Configuration for the PersonalizeService.
5
+ * @public
6
+ */
7
+ export type PersonalizeServiceConfig = CacheOptions & {
8
+ /**
9
+ * Timeout (ms) for the Personalize request. Default is 400.
10
+ */
11
+ timeout?: number;
12
+ /**
13
+ * Optional Sitecore Personalize scope identifier allowing you to isolate your personalization data between XM Cloud environments
14
+ * @deprecated Will be removed in a future release.
15
+ */
16
+ scope?: string;
17
+ /**
18
+ * Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
19
+ */
20
+ fetch?: typeof fetch;
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
+ * Object model of personlize info
29
+ * @public
30
+ */
31
+ export type PersonalizeInfo = {
32
+ /**
33
+ * The page id
34
+ */
35
+ pageId: string;
36
+ /**
37
+ * The configured variant ids
38
+ */
39
+ variantIds: string[];
40
+ };
41
+ type PersonalizeQueryResult = {
42
+ layout: {
43
+ item: {
44
+ id: string;
45
+ version: string;
46
+ personalization: {
47
+ variantIds: string[];
48
+ };
49
+ };
50
+ };
51
+ };
52
+ /**
53
+ * Fetch personalize data using the Sitecore GraphQL endpoint.
54
+ * @public
55
+ */
56
+ export declare class PersonalizeService {
57
+ protected config: PersonalizeServiceConfig;
58
+ private graphQLClient;
59
+ private cache;
60
+ /**
61
+ * Fetch personalize data using the Sitecore GraphQL endpoint.
62
+ * @param {PersonalizeServiceConfig} config
63
+ */
64
+ constructor(config: PersonalizeServiceConfig);
65
+ protected get query(): string;
66
+ /**
67
+ * Get personalize information for a route
68
+ * @param {string} itemPath page route
69
+ * @param {string} language language
70
+ * @param {string} siteName site name
71
+ * @returns {Promise<PersonalizeInfo | undefined>} the personalize information or undefined (if itemPath / language not found)
72
+ */
73
+ getPersonalizeInfo(itemPath: string, language: string, siteName: string): Promise<PersonalizeInfo | undefined>;
74
+ /**
75
+ * Gets cache client implementation
76
+ * Override this method if custom cache needs to be used
77
+ * @returns CacheClient instance
78
+ */
79
+ protected getCacheClient(): CacheClient<PersonalizeQueryResult>;
80
+ protected getCacheKey(itemPath: string, language: string, siteName: string): string;
81
+ /**
82
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
83
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
84
+ * want to use something else.
85
+ * @returns {GraphQLClient} implementation
86
+ */
87
+ protected getGraphQLClient(): GraphQLClient;
88
+ }
89
+ export {};
90
+ //# sourceMappingURL=personalize-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalize-service.d.ts","sourceRoot":"","sources":["../../src/personalize/personalize-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAGvF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACpD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE;QAAE,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,EAAE;gBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;CAC9F,CAAC;AAEF;;;GAGG;AACH,qBAAa,kBAAkB;IAQjB,SAAS,CAAC,MAAM,EAAE,wBAAwB;IAPtD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAsC;IAEnD;;;OAGG;gBACmB,MAAM,EAAE,wBAAwB;IAMtD,SAAS,KAAK,KAAK,IAAI,MAAM,CAc5B;IAED;;;;;;OAMG;IACG,kBAAkB,CACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAgCvC;;;;OAIG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW,CAAC,sBAAsB,CAAC;IAO/D,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAI1E;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAW5C"}
@@ -1,69 +1,78 @@
1
- export declare const DEFAULT_VARIANT = "_default";
2
- export declare const VARIANT_PREFIX = "_variantId_";
3
- export type PersonalizedRewriteData = {
4
- variantId: string;
5
- componentVariantIds?: string[];
6
- };
7
- /**
8
- * Get a personalized rewrite path for given pathname
9
- * @param {string} pathname the pathname
10
- * @param {string[]} variantIds the variantIds to include in the rewrite
11
- * @returns {string} the rewrite path
12
- */
13
- export declare function getPersonalizedRewrite(pathname: string, variantIds: string[]): string;
14
- /**
15
- * Get personalize data from the rewrite path
16
- * @param {string} pathname the pathname
17
- * @returns {PersonalizedRewriteData} the personalize data from the rewrite
18
- */
19
- export declare function getPersonalizedRewriteData(pathname: string): PersonalizedRewriteData;
20
- /**
21
- * Parses a list of variantIds and divides into layout and component variants
22
- * @param {string[]} variantIds the list of variant IDs for a page
23
- * @returns {PersonalizedRewriteData} object with variant IDs sorted
24
- */
25
- export declare function getGroomedVariantIds(variantIds: string[]): PersonalizedRewriteData;
26
- /**
27
- * Normalize a personalized rewrite path (remove personalize data)
28
- * @param {string} pathname the pathname
29
- * @returns {string} the pathname with personalize data removed
30
- */
31
- export declare function normalizePersonalizedRewrite(pathname: string): string;
32
- /**
33
- * Static utility class for Sitecore CDP
34
- */
35
- export declare class CdpHelper {
36
- /**
37
- * Gets the page variant id for CDP in the required format
38
- * @param {string} pageId the page id
39
- * @param {string} language the language
40
- * @param {string} variantId the variant id
41
- * @param {string} [scope] the scope value
42
- * @returns {string} the formatted page variant id
43
- */
44
- static getPageVariantId(pageId: string, language: string, variantId: string, scope?: string): string;
45
- /**
46
- * Gets the friendly id for (page-level) Embedded Personalization in the required format `embedded_[<scope>_]<id>_<lang>`
47
- * @param {string} pageId the page id
48
- * @param {string} language the language
49
- * @param {string} [scope] the scope value
50
- * @returns {string} the friendly id
51
- */
52
- static getPageFriendlyId(pageId: string, language: string, scope?: string): string;
53
- /**
54
- * Gets the friendly id for Component A/B Testing in the required format `component_[<scope>_]<pageId>_<componentId>_<language>*`
55
- * @param {string} pageId the page id
56
- * @param {string} componentId the component id
57
- * @param {string} language the language
58
- * @param {string} [scope] the scope value
59
- * @returns {string} the friendly id
60
- */
61
- static getComponentFriendlyId(pageId: string, componentId: string, language: string, scope?: string): string;
62
- /**
63
- * Normalizes the scope from the given string value
64
- * Removes all non-alphanumeric characters
65
- * @param {string} [scope] the scope value
66
- * @returns {string} normalized scope value
67
- */
68
- static normalizeScope(scope?: string): string;
69
- }
1
+ /** @internal */
2
+ export declare const DEFAULT_VARIANT = "_default";
3
+ /** @internal */
4
+ export declare const VARIANT_PREFIX = "_variantId_";
5
+ /** @public */
6
+ export type PersonalizedRewriteData = {
7
+ variantId: string;
8
+ componentVariantIds?: string[];
9
+ };
10
+ /**
11
+ * Get a personalized rewrite path for given pathname
12
+ * @param {string} pathname the pathname
13
+ * @param {string[]} variantIds the variantIds to include in the rewrite
14
+ * @returns {string} the rewrite path
15
+ * @public
16
+ */
17
+ export declare function getPersonalizedRewrite(pathname: string, variantIds: string[]): string;
18
+ /**
19
+ * Get personalize data from the rewrite path
20
+ * @param {string} pathname the pathname
21
+ * @returns {PersonalizedRewriteData} the personalize data from the rewrite
22
+ * @public
23
+ */
24
+ export declare function getPersonalizedRewriteData(pathname: string): PersonalizedRewriteData;
25
+ /**
26
+ * Parses a list of variantIds and divides into layout and component variants
27
+ * @param {string[]} variantIds the list of variant IDs for a page
28
+ * @returns {PersonalizedRewriteData} object with variant IDs sorted
29
+ * @public
30
+ */
31
+ export declare function getGroomedVariantIds(variantIds: string[]): PersonalizedRewriteData;
32
+ /**
33
+ * Normalize a personalized rewrite path (remove personalize data)
34
+ * @param {string} pathname the pathname
35
+ * @returns {string} the pathname with personalize data removed
36
+ * @public
37
+ */
38
+ export declare function normalizePersonalizedRewrite(pathname: string): string;
39
+ /**
40
+ * Static utility class for Sitecore CDP
41
+ * @public
42
+ */
43
+ export declare class CdpHelper {
44
+ /**
45
+ * Gets the page variant id for CDP in the required format
46
+ * @param {string} pageId the page id
47
+ * @param {string} language the language
48
+ * @param {string} variantId the variant id
49
+ * @param {string} [scope] the scope value
50
+ * @returns {string} the formatted page variant id
51
+ */
52
+ static getPageVariantId(pageId: string, language: string, variantId: string, scope?: string): string;
53
+ /**
54
+ * Gets the friendly id for (page-level) Embedded Personalization in the required format `embedded_[<scope>_]<id>_<lang>`
55
+ * @param {string} pageId the page id
56
+ * @param {string} language the language
57
+ * @param {string} [scope] the scope value
58
+ * @returns {string} the friendly id
59
+ */
60
+ static getPageFriendlyId(pageId: string, language: string, scope?: string): string;
61
+ /**
62
+ * Gets the friendly id for Component A/B Testing in the required format `component_[<scope>_]<pageId>_<componentId>_<language>*`
63
+ * @param {string} pageId the page id
64
+ * @param {string} componentId the component id
65
+ * @param {string} language the language
66
+ * @param {string} [scope] the scope value
67
+ * @returns {string} the friendly id
68
+ */
69
+ static getComponentFriendlyId(pageId: string, componentId: string, language: string, scope?: string): string;
70
+ /**
71
+ * Normalizes the scope from the given string value
72
+ * Removes all non-alphanumeric characters
73
+ * @param {string} [scope] the scope value
74
+ * @returns {string} normalized scope value
75
+ */
76
+ static normalizeScope(scope?: string): string;
77
+ }
78
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/personalize/utils.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,gBAAgB;AAChB,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAGrF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAWpF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,2BAmBxD;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASrE;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;;;;OAOG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM;IAWT;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAOlF;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM;IAQT;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;CAG9C"}
@@ -1,24 +1,26 @@
1
- import { RetryStrategy, GenericGraphQLClientError } from './models';
2
- /**
3
- * Represents a default retry strategy for handling retry attempts in case of specific HTTP status codes.
4
- * This class implements the RetryStrategy interface and provides methods to determine whether a request
5
- * should be retried and calculates the delay before the next retry attempt.
6
- */
7
- export declare class DefaultRetryStrategy implements RetryStrategy {
8
- private statusCodes;
9
- private errorCodes;
10
- private factor;
11
- /**
12
- * @param {object} options Configurable options for retry mechanism.
13
- * @param {number[]} [options.statusCodes] HTTP status codes to trigger retries on. Default is [429].
14
- * @param {string[]} [options.errorCodes] Node error codes to trigger retries. Default is ['ECONNRESET', 'ETIMEDOUT', 'EPROTO'].
15
- * @param {number} [options.factor] Factor by which the delay increases with each retry attempt. Default is 2.
16
- */
17
- constructor(options?: {
18
- statusCodes?: number[];
19
- errorCodes?: string[];
20
- factor?: number;
21
- });
22
- shouldRetry(error: GenericGraphQLClientError, attempt: number, retries: number): boolean;
23
- getDelay(error: GenericGraphQLClientError, attempt: number): number;
24
- }
1
+ import { RetryStrategy, GenericGraphQLClientError } from './models';
2
+ /**
3
+ * Represents a default retry strategy for handling retry attempts in case of specific HTTP status codes.
4
+ * This class implements the RetryStrategy interface and provides methods to determine whether a request
5
+ * should be retried and calculates the delay before the next retry attempt.
6
+ * @public
7
+ */
8
+ export declare class DefaultRetryStrategy implements RetryStrategy {
9
+ private statusCodes;
10
+ private errorCodes;
11
+ private factor;
12
+ /**
13
+ * @param {object} options Configurable options for retry mechanism.
14
+ * @param {number[]} [options.statusCodes] HTTP status codes to trigger retries on. Default is [429].
15
+ * @param {string[]} [options.errorCodes] Node error codes to trigger retries. Default is ['ECONNRESET', 'ETIMEDOUT', 'EPROTO'].
16
+ * @param {number} [options.factor] Factor by which the delay increases with each retry attempt. Default is 2.
17
+ */
18
+ constructor(options?: {
19
+ statusCodes?: number[];
20
+ errorCodes?: string[];
21
+ factor?: number;
22
+ });
23
+ shouldRetry(error: GenericGraphQLClientError, attempt: number, retries: number): boolean;
24
+ getDelay(error: GenericGraphQLClientError, attempt: number): number;
25
+ }
26
+ //# sourceMappingURL=retries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retries.d.ts","sourceRoot":"","sources":["../src/retries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;;OAKG;gBACS,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAM5F,WAAW,CAAC,KAAK,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAOxF,QAAQ,CAAC,KAAK,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAepE"}
@@ -1,57 +1,64 @@
1
- import { FetchOptions, GraphQLClient } from '../client';
2
- import { LayoutServiceData } from '../layout';
3
- import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
- import { GraphQLServiceConfig } from '../sitecore-service-base';
5
- export interface ErrorPagesServiceConfig extends GraphQLServiceConfig {
6
- /**
7
- * The language
8
- */
9
- language: string;
10
- /**
11
- * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
12
- * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
13
- */
14
- clientFactory: GraphQLRequestClientFactory;
15
- }
16
- /**
17
- * Object model of Error Pages result
18
- */
19
- export type ErrorPages = {
20
- notFoundPage: {
21
- rendered: LayoutServiceData;
22
- };
23
- notFoundPagePath: string;
24
- serverErrorPage: {
25
- rendered: LayoutServiceData;
26
- };
27
- serverErrorPagePath: string;
28
- };
29
- /**
30
- * Service that fetch the error pages data using Sitecore's GraphQL API.
31
- */
32
- export declare class ErrorPagesService {
33
- options: ErrorPagesServiceConfig;
34
- private graphQLClient;
35
- /**
36
- * Creates an instance of graphQL error pages service with the provided options
37
- * @param {ErrorPagesServiceConfig} options instance
38
- */
39
- constructor(options: ErrorPagesServiceConfig);
40
- protected get query(): string;
41
- /**
42
- * Fetch list of error pages for the site
43
- * @param {string} siteName The site name
44
- * @param {string} locale The language
45
- * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
46
- * @returns {ErrorPages} list of url's error pages
47
- * @throws {Error} if the siteName is empty.
48
- */
49
- fetchErrorPages(siteName: string, locale?: string, fetchOptions?: FetchOptions): Promise<ErrorPages | null>;
50
- /**
51
- * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
52
- * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
53
- * want to use something else.
54
- * @returns {GraphQLClient} implementation
55
- */
56
- protected getGraphQLClient(): GraphQLClient;
57
- }
1
+ import { FetchOptions, GraphQLClient } from '../client';
2
+ import { LayoutServiceData } from '../layout';
3
+ import { GraphQLRequestClientFactory } from '../graphql-request-client';
4
+ import { GraphQLServiceConfig } from '../sitecore-service-base';
5
+ /**
6
+ * Configuration for @see ErrorPagesService instances
7
+ * @public
8
+ */
9
+ export interface ErrorPagesServiceConfig extends GraphQLServiceConfig {
10
+ /**
11
+ * The language
12
+ */
13
+ language: string;
14
+ /**
15
+ * A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
16
+ * This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
17
+ */
18
+ clientFactory: GraphQLRequestClientFactory;
19
+ }
20
+ /**
21
+ * Object model of Error Pages result
22
+ * @public
23
+ */
24
+ export type ErrorPages = {
25
+ notFoundPage: {
26
+ rendered: LayoutServiceData;
27
+ };
28
+ notFoundPagePath: string;
29
+ serverErrorPage: {
30
+ rendered: LayoutServiceData;
31
+ };
32
+ serverErrorPagePath: string;
33
+ };
34
+ /**
35
+ * Service that fetch the error pages data using Sitecore's GraphQL API.
36
+ * @public
37
+ */
38
+ export declare class ErrorPagesService {
39
+ options: ErrorPagesServiceConfig;
40
+ private graphQLClient;
41
+ /**
42
+ * Creates an instance of graphQL error pages service with the provided options
43
+ * @param {ErrorPagesServiceConfig} options instance
44
+ */
45
+ constructor(options: ErrorPagesServiceConfig);
46
+ protected get query(): string;
47
+ /**
48
+ * Fetch list of error pages for the site
49
+ * @param {string} siteName The site name
50
+ * @param {string} locale The language
51
+ * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
52
+ * @returns {ErrorPages} list of url's error pages
53
+ * @throws {Error} if the siteName is empty.
54
+ */
55
+ fetchErrorPages(siteName: string, locale?: string, fetchOptions?: FetchOptions): Promise<ErrorPages | null>;
56
+ /**
57
+ * Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
58
+ * library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
59
+ * want to use something else.
60
+ * @returns {GraphQLClient} implementation
61
+ */
62
+ protected getGraphQLClient(): GraphQLClient;
63
+ }
64
+ //# sourceMappingURL=error-pages-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-pages-service.d.ts","sourceRoot":"","sources":["../../src/site/error-pages-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAsBhE;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAA;KAAE,CAAC;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAA;KAAE,CAAC;IACjD,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AASF;;;GAGG;AACH,qBAAa,iBAAiB;IAOT,OAAO,EAAE,uBAAuB;IANnD,OAAO,CAAC,aAAa,CAAgB;IAErC;;;OAGG;gBACgB,OAAO,EAAE,uBAAuB;IAInD,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IAED;;;;;;;OAOG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAqB7B;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAW5C"}
@@ -1,9 +1,10 @@
1
- export { RobotsQueryResult, RobotsService, RobotsServiceConfig } from './robots-service';
2
- export { RedirectInfo, RedirectsQueryResult, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectsService, RedirectsServiceConfig, } from './redirects-service';
3
- export { SitemapQueryResult, SitemapXmlService, SitemapXmlServiceConfig, } from './sitemap-xml-service';
4
- export { ErrorPages, ErrorPagesService, ErrorPagesServiceConfig } from './error-pages-service';
5
- export { SiteInfoService, SiteInfoServiceConfig } from './siteinfo-service';
6
- export { SitePathService, SitePathServiceConfig } from './sitepath-service';
7
- export { SiteInfo } from './models';
8
- export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SiteRewriteData, SITE_PREFIX, SITE_KEY, } from './utils';
9
- export { SiteResolver } from './site-resolver';
1
+ export { RobotsQueryResult, RobotsService, RobotsServiceConfig } from './robots-service';
2
+ export { RedirectInfo, RedirectsQueryResult, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectsService, RedirectsServiceConfig, } from './redirects-service';
3
+ export { SitemapQueryResult, SitemapXmlService, SitemapXmlServiceConfig, } from './sitemap-xml-service';
4
+ export { ErrorPages, ErrorPagesService, ErrorPagesServiceConfig } from './error-pages-service';
5
+ export { SiteInfoService, SiteInfoServiceConfig } from './siteinfo-service';
6
+ export { SitePathService, SitePathServiceConfig } from './sitepath-service';
7
+ export { SiteInfo } from './models';
8
+ export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SiteRewriteData, SITE_PREFIX, SITE_KEY, } from './utils';
9
+ export { SiteResolver } from './site-resolver';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/site/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}