@nascentdigital/funnel-core 4.4.4

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 (368) hide show
  1. package/dist/app/AppConfig.d.ts +41 -0
  2. package/dist/app/AppConfig.js +93 -0
  3. package/dist/app/BrandConfig.d.ts +13 -0
  4. package/dist/app/BrandConfig.js +2 -0
  5. package/dist/app/FeaturesConfig.d.ts +6 -0
  6. package/dist/app/FeaturesConfig.js +2 -0
  7. package/dist/app/RegionsConfig.d.ts +43 -0
  8. package/dist/app/RegionsConfig.js +113 -0
  9. package/dist/app/UIConfig.d.ts +4 -0
  10. package/dist/app/UIConfig.js +2 -0
  11. package/dist/app/index.d.ts +5 -0
  12. package/dist/app/index.js +21 -0
  13. package/dist/consent/ConsentCategory.d.ts +12 -0
  14. package/dist/consent/ConsentCategory.js +28 -0
  15. package/dist/consent/ConsentService.d.ts +15 -0
  16. package/dist/consent/ConsentService.js +37 -0
  17. package/dist/consent/index.d.ts +2 -0
  18. package/dist/consent/index.js +18 -0
  19. package/dist/errors/IsometricError.d.ts +19 -0
  20. package/dist/errors/IsometricError.js +30 -0
  21. package/dist/errors/IsometricErrorModule.d.ts +11 -0
  22. package/dist/errors/IsometricErrorModule.js +2 -0
  23. package/dist/errors/IsometricErrorUtils.d.ts +9 -0
  24. package/dist/errors/IsometricErrorUtils.js +85 -0
  25. package/dist/errors/SerializedIsometricError.d.ts +10 -0
  26. package/dist/errors/SerializedIsometricError.js +15 -0
  27. package/dist/errors/api/ApiError.d.ts +15 -0
  28. package/dist/errors/api/ApiError.js +23 -0
  29. package/dist/errors/api/ApiErrors.d.ts +7 -0
  30. package/dist/errors/api/ApiErrors.js +67 -0
  31. package/dist/errors/api/ArgumentError.d.ts +7 -0
  32. package/dist/errors/api/ArgumentError.js +18 -0
  33. package/dist/errors/api/ConcurrencyError.d.ts +4 -0
  34. package/dist/errors/api/ConcurrencyError.js +11 -0
  35. package/dist/errors/api/ConflictError.d.ts +4 -0
  36. package/dist/errors/api/ConflictError.js +11 -0
  37. package/dist/errors/api/DependencyError.d.ts +4 -0
  38. package/dist/errors/api/DependencyError.js +11 -0
  39. package/dist/errors/api/IllegalStateError.d.ts +4 -0
  40. package/dist/errors/api/IllegalStateError.js +11 -0
  41. package/dist/errors/api/InvalidOperationError.d.ts +4 -0
  42. package/dist/errors/api/InvalidOperationError.js +11 -0
  43. package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
  44. package/dist/errors/api/NotAuthenticatedError.js +11 -0
  45. package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
  46. package/dist/errors/api/NotAuthorizedError.js +11 -0
  47. package/dist/errors/api/NotAvailableError.d.ts +4 -0
  48. package/dist/errors/api/NotAvailableError.js +11 -0
  49. package/dist/errors/api/NotFoundError.d.ts +4 -0
  50. package/dist/errors/api/NotFoundError.js +11 -0
  51. package/dist/errors/api/NotImplementedError.d.ts +4 -0
  52. package/dist/errors/api/NotImplementedError.js +11 -0
  53. package/dist/errors/api/OfflineError.d.ts +4 -0
  54. package/dist/errors/api/OfflineError.js +11 -0
  55. package/dist/errors/api/RangeError.d.ts +4 -0
  56. package/dist/errors/api/RangeError.js +11 -0
  57. package/dist/errors/api/ServerError.d.ts +4 -0
  58. package/dist/errors/api/ServerError.js +11 -0
  59. package/dist/errors/api/TimeoutError.d.ts +4 -0
  60. package/dist/errors/api/TimeoutError.js +11 -0
  61. package/dist/errors/api/index.d.ts +16 -0
  62. package/dist/errors/api/index.js +32 -0
  63. package/dist/errors/index.d.ts +5 -0
  64. package/dist/errors/index.js +26 -0
  65. package/dist/forms/FormModel.d.ts +47 -0
  66. package/dist/forms/FormModel.js +149 -0
  67. package/dist/forms/Forms.d.ts +15 -0
  68. package/dist/forms/Forms.js +35 -0
  69. package/dist/forms/IFormService.d.ts +6 -0
  70. package/dist/forms/IFormService.js +2 -0
  71. package/dist/forms/TranslateSchema.d.ts +8 -0
  72. package/dist/forms/TranslateSchema.js +2 -0
  73. package/dist/forms/index.d.ts +4 -0
  74. package/dist/forms/index.js +20 -0
  75. package/dist/index.d.ts +10 -0
  76. package/dist/index.js +49 -0
  77. package/dist/regionalization/Country.d.ts +266 -0
  78. package/dist/regionalization/Country.js +338 -0
  79. package/dist/regionalization/Language.d.ts +199 -0
  80. package/dist/regionalization/Language.js +237 -0
  81. package/dist/regionalization/Locale.d.ts +28 -0
  82. package/dist/regionalization/Locale.js +49 -0
  83. package/dist/regionalization/Localized.d.ts +10 -0
  84. package/dist/regionalization/Localized.js +36 -0
  85. package/dist/regionalization/LocalizedCopy.d.ts +9 -0
  86. package/dist/regionalization/LocalizedCopy.js +26 -0
  87. package/dist/regionalization/Regionalization.d.ts +50 -0
  88. package/dist/regionalization/Regionalization.js +260 -0
  89. package/dist/regionalization/Regions.d.ts +2 -0
  90. package/dist/regionalization/Regions.js +2 -0
  91. package/dist/regionalization/index.d.ts +7 -0
  92. package/dist/regionalization/index.js +23 -0
  93. package/dist/schema/Asset.d.ts +23 -0
  94. package/dist/schema/Asset.js +36 -0
  95. package/dist/schema/AssetScope.d.ts +75 -0
  96. package/dist/schema/AssetScope.js +146 -0
  97. package/dist/schema/Block.d.ts +105 -0
  98. package/dist/schema/Block.js +122 -0
  99. package/dist/schema/ChangeSet.d.ts +108 -0
  100. package/dist/schema/ChangeSet.js +187 -0
  101. package/dist/schema/Collection.d.ts +197 -0
  102. package/dist/schema/Collection.js +165 -0
  103. package/dist/schema/CollectionModel.d.ts +30 -0
  104. package/dist/schema/CollectionModel.js +383 -0
  105. package/dist/schema/CollectionSnapshot.d.ts +11 -0
  106. package/dist/schema/CollectionSnapshot.js +12 -0
  107. package/dist/schema/Fields.d.ts +31 -0
  108. package/dist/schema/Fields.js +21 -0
  109. package/dist/schema/Form.d.ts +31 -0
  110. package/dist/schema/Form.js +23 -0
  111. package/dist/schema/LinkedCollectionModel.d.ts +9 -0
  112. package/dist/schema/LinkedCollectionModel.js +19 -0
  113. package/dist/schema/LinkedData.d.ts +44 -0
  114. package/dist/schema/LinkedData.js +288 -0
  115. package/dist/schema/LinkedPageModel.d.ts +11 -0
  116. package/dist/schema/LinkedPageModel.js +26 -0
  117. package/dist/schema/Optional.d.ts +23 -0
  118. package/dist/schema/Optional.js +34 -0
  119. package/dist/schema/Page.d.ts +299 -0
  120. package/dist/schema/Page.js +244 -0
  121. package/dist/schema/PageModel.d.ts +58 -0
  122. package/dist/schema/PageModel.js +881 -0
  123. package/dist/schema/PageQuery.d.ts +60 -0
  124. package/dist/schema/PageQuery.js +116 -0
  125. package/dist/schema/PageRoute.d.ts +7 -0
  126. package/dist/schema/PageRoute.js +48 -0
  127. package/dist/schema/PageSnapshot.d.ts +11 -0
  128. package/dist/schema/PageSnapshot.js +12 -0
  129. package/dist/schema/Section.d.ts +71 -0
  130. package/dist/schema/Section.js +35 -0
  131. package/dist/schema/Seo.d.ts +13 -0
  132. package/dist/schema/Seo.js +25 -0
  133. package/dist/schema/Site.d.ts +40 -0
  134. package/dist/schema/Site.js +87 -0
  135. package/dist/schema/SiteModel.d.ts +5 -0
  136. package/dist/schema/SiteModel.js +10 -0
  137. package/dist/schema/Tag.d.ts +28 -0
  138. package/dist/schema/Tag.js +59 -0
  139. package/dist/schema/TagGroup.d.ts +26 -0
  140. package/dist/schema/TagGroup.js +64 -0
  141. package/dist/schema/field/Field.d.ts +179 -0
  142. package/dist/schema/field/Field.js +309 -0
  143. package/dist/schema/field/base/AssetField.d.ts +148 -0
  144. package/dist/schema/field/base/AssetField.js +206 -0
  145. package/dist/schema/field/base/BooleanField.d.ts +21 -0
  146. package/dist/schema/field/base/BooleanField.js +38 -0
  147. package/dist/schema/field/base/CollectionField.d.ts +34 -0
  148. package/dist/schema/field/base/CollectionField.js +85 -0
  149. package/dist/schema/field/base/DateField.d.ts +21 -0
  150. package/dist/schema/field/base/DateField.js +37 -0
  151. package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
  152. package/dist/schema/field/base/DynamicPagesField.js +50 -0
  153. package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
  154. package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
  155. package/dist/schema/field/base/EnumField.d.ts +40 -0
  156. package/dist/schema/field/base/EnumField.js +131 -0
  157. package/dist/schema/field/base/FormField.d.ts +25 -0
  158. package/dist/schema/field/base/FormField.js +48 -0
  159. package/dist/schema/field/base/LinkField.d.ts +103 -0
  160. package/dist/schema/field/base/LinkField.js +201 -0
  161. package/dist/schema/field/base/PageField.d.ts +46 -0
  162. package/dist/schema/field/base/PageField.js +83 -0
  163. package/dist/schema/field/base/RichTextField.d.ts +71 -0
  164. package/dist/schema/field/base/RichTextField.js +196 -0
  165. package/dist/schema/field/base/TextField.d.ts +33 -0
  166. package/dist/schema/field/base/TextField.js +86 -0
  167. package/dist/schema/field/base/TimestampField.d.ts +25 -0
  168. package/dist/schema/field/base/TimestampField.js +41 -0
  169. package/dist/schema/field/base/index.d.ts +13 -0
  170. package/dist/schema/field/base/index.js +29 -0
  171. package/dist/schema/field/composite/ListField.d.ts +47 -0
  172. package/dist/schema/field/composite/ListField.js +107 -0
  173. package/dist/schema/field/composite/ObjectField.d.ts +56 -0
  174. package/dist/schema/field/composite/ObjectField.js +19 -0
  175. package/dist/schema/field/composite/index.d.ts +2 -0
  176. package/dist/schema/field/composite/index.js +18 -0
  177. package/dist/schema/field/index.d.ts +3 -0
  178. package/dist/schema/field/index.js +19 -0
  179. package/dist/schema/index.d.ts +25 -0
  180. package/dist/schema/index.js +41 -0
  181. package/dist/services/EventBus.d.ts +17 -0
  182. package/dist/services/EventBus.js +37 -0
  183. package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
  184. package/dist/services/humanVerification/IHumanVerification.js +2 -0
  185. package/dist/services/humanVerification/index.d.ts +1 -0
  186. package/dist/services/humanVerification/index.js +17 -0
  187. package/dist/services/index.d.ts +3 -0
  188. package/dist/services/index.js +19 -0
  189. package/dist/services/leadGen/Contact.d.ts +40 -0
  190. package/dist/services/leadGen/Contact.js +38 -0
  191. package/dist/services/leadGen/ILeadGen.d.ts +16 -0
  192. package/dist/services/leadGen/ILeadGen.js +2 -0
  193. package/dist/services/leadGen/index.d.ts +2 -0
  194. package/dist/services/leadGen/index.js +18 -0
  195. package/dist/types/BoxedValue.d.ts +3 -0
  196. package/dist/types/BoxedValue.js +2 -0
  197. package/dist/types/Callback.d.ts +9 -0
  198. package/dist/types/Callback.js +2 -0
  199. package/dist/types/DateString.d.ts +35 -0
  200. package/dist/types/DateString.js +172 -0
  201. package/dist/types/FilterConditionally.d.ts +3 -0
  202. package/dist/types/FilterConditionally.js +2 -0
  203. package/dist/types/MaybeConditionalValue.d.ts +8 -0
  204. package/dist/types/MaybeConditionalValue.js +12 -0
  205. package/dist/types/Ordinal.d.ts +17 -0
  206. package/dist/types/Ordinal.js +38 -0
  207. package/dist/types/OverridableStringUnion.d.ts +2 -0
  208. package/dist/types/OverridableStringUnion.js +2 -0
  209. package/dist/types/PartialBy.d.ts +1 -0
  210. package/dist/types/PartialBy.js +2 -0
  211. package/dist/types/PickData.d.ts +6 -0
  212. package/dist/types/PickData.js +2 -0
  213. package/dist/types/Provider.d.ts +4 -0
  214. package/dist/types/Provider.js +2 -0
  215. package/dist/types/RequiredBy.d.ts +1 -0
  216. package/dist/types/RequiredBy.js +2 -0
  217. package/dist/types/Result.d.ts +16 -0
  218. package/dist/types/Result.js +2 -0
  219. package/dist/types/Timestamp.d.ts +17 -0
  220. package/dist/types/Timestamp.js +57 -0
  221. package/dist/types/Transform.d.ts +4 -0
  222. package/dist/types/Transform.js +2 -0
  223. package/dist/types/index.d.ts +14 -0
  224. package/dist/types/index.js +30 -0
  225. package/dist/ui/Accessible.d.ts +5 -0
  226. package/dist/ui/Accessible.js +15 -0
  227. package/dist/ui/BlockThemes.d.ts +19 -0
  228. package/dist/ui/BlockThemes.js +29 -0
  229. package/dist/ui/ColorMode.d.ts +12 -0
  230. package/dist/ui/ColorMode.js +49 -0
  231. package/dist/ui/File.d.ts +43 -0
  232. package/dist/ui/File.js +55 -0
  233. package/dist/ui/FileType.d.ts +8 -0
  234. package/dist/ui/FileType.js +48 -0
  235. package/dist/ui/ImageSource.d.ts +12 -0
  236. package/dist/ui/ImageSource.js +48 -0
  237. package/dist/ui/MimeType.d.ts +28 -0
  238. package/dist/ui/MimeType.js +110 -0
  239. package/dist/ui/Placement.d.ts +21 -0
  240. package/dist/ui/Placement.js +135 -0
  241. package/dist/ui/Position.d.ts +6 -0
  242. package/dist/ui/Position.js +42 -0
  243. package/dist/ui/Selector.d.ts +6 -0
  244. package/dist/ui/Selector.js +23 -0
  245. package/dist/ui/SemanticColor.d.ts +8 -0
  246. package/dist/ui/SemanticColor.js +237 -0
  247. package/dist/ui/Visual.d.ts +24 -0
  248. package/dist/ui/Visual.js +66 -0
  249. package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
  250. package/dist/ui/block-layout/BlockLayout.js +286 -0
  251. package/dist/ui/block-layout/index.d.ts +1 -0
  252. package/dist/ui/block-layout/index.js +17 -0
  253. package/dist/ui/browser/BlurHasher.d.ts +13 -0
  254. package/dist/ui/browser/BlurHasher.js +76 -0
  255. package/dist/ui/browser/Browser.d.ts +107 -0
  256. package/dist/ui/browser/Browser.js +313 -0
  257. package/dist/ui/browser/ImageProxy.d.ts +30 -0
  258. package/dist/ui/browser/ImageProxy.js +132 -0
  259. package/dist/ui/browser/InputEvent.d.ts +13 -0
  260. package/dist/ui/browser/InputEvent.js +2 -0
  261. package/dist/ui/browser/SVGProxy.d.ts +9 -0
  262. package/dist/ui/browser/SVGProxy.js +59 -0
  263. package/dist/ui/browser/VideoProxy.d.ts +42 -0
  264. package/dist/ui/browser/VideoProxy.js +235 -0
  265. package/dist/ui/browser/index.d.ts +6 -0
  266. package/dist/ui/browser/index.js +22 -0
  267. package/dist/ui/fields/Field.d.ts +80 -0
  268. package/dist/ui/fields/Field.js +298 -0
  269. package/dist/ui/fields/FieldList.d.ts +80 -0
  270. package/dist/ui/fields/FieldList.js +421 -0
  271. package/dist/ui/fields/FieldListValidator.d.ts +9 -0
  272. package/dist/ui/fields/FieldListValidator.js +37 -0
  273. package/dist/ui/fields/FieldModel.d.ts +15 -0
  274. package/dist/ui/fields/FieldModel.js +28 -0
  275. package/dist/ui/fields/FieldSerializer.d.ts +13 -0
  276. package/dist/ui/fields/FieldSerializer.js +71 -0
  277. package/dist/ui/fields/FieldValidator.d.ts +19 -0
  278. package/dist/ui/fields/FieldValidator.js +98 -0
  279. package/dist/ui/fields/ObjectField.d.ts +75 -0
  280. package/dist/ui/fields/ObjectField.js +288 -0
  281. package/dist/ui/fields/errors.json +44 -0
  282. package/dist/ui/fields/index.d.ts +7 -0
  283. package/dist/ui/fields/index.js +23 -0
  284. package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
  285. package/dist/ui/fields/validators/AssetValidator.js +25 -0
  286. package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
  287. package/dist/ui/fields/validators/DateValidator.js +41 -0
  288. package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
  289. package/dist/ui/fields/validators/EnumValidator.js +77 -0
  290. package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
  291. package/dist/ui/fields/validators/GenericValidator.js +22 -0
  292. package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
  293. package/dist/ui/fields/validators/LinkValidator.js +146 -0
  294. package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
  295. package/dist/ui/fields/validators/RichTextValidator.js +35 -0
  296. package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
  297. package/dist/ui/fields/validators/TextValidator.js +138 -0
  298. package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
  299. package/dist/ui/fields/validators/TimestampValidator.js +41 -0
  300. package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
  301. package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
  302. package/dist/ui/fields/validators/index.d.ts +8 -0
  303. package/dist/ui/fields/validators/index.js +24 -0
  304. package/dist/ui/geometry/AspectRatio.d.ts +27 -0
  305. package/dist/ui/geometry/AspectRatio.js +77 -0
  306. package/dist/ui/geometry/Bounds.d.ts +4 -0
  307. package/dist/ui/geometry/Bounds.js +11 -0
  308. package/dist/ui/geometry/Frame.d.ts +3 -0
  309. package/dist/ui/geometry/Frame.js +2 -0
  310. package/dist/ui/geometry/Insets.d.ts +14 -0
  311. package/dist/ui/geometry/Insets.js +14 -0
  312. package/dist/ui/geometry/PixelSize.d.ts +1 -0
  313. package/dist/ui/geometry/PixelSize.js +2 -0
  314. package/dist/ui/geometry/Point.d.ts +7 -0
  315. package/dist/ui/geometry/Point.js +15 -0
  316. package/dist/ui/geometry/Rect.d.ts +19 -0
  317. package/dist/ui/geometry/Rect.js +68 -0
  318. package/dist/ui/geometry/ScreenSize.d.ts +1 -0
  319. package/dist/ui/geometry/ScreenSize.js +2 -0
  320. package/dist/ui/geometry/Size.d.ts +7 -0
  321. package/dist/ui/geometry/Size.js +9 -0
  322. package/dist/ui/geometry/index.d.ts +9 -0
  323. package/dist/ui/geometry/index.js +25 -0
  324. package/dist/ui/index.d.ts +18 -0
  325. package/dist/ui/index.js +34 -0
  326. package/dist/ui/responsive/Breakpoint.d.ts +8 -0
  327. package/dist/ui/responsive/Breakpoint.js +24 -0
  328. package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
  329. package/dist/ui/responsive/BreakpointObserver.js +104 -0
  330. package/dist/ui/responsive/Breakpoints.d.ts +5 -0
  331. package/dist/ui/responsive/Breakpoints.js +15 -0
  332. package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
  333. package/dist/ui/responsive/ResponsiveValue.js +26 -0
  334. package/dist/ui/responsive/index.d.ts +4 -0
  335. package/dist/ui/responsive/index.js +20 -0
  336. package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
  337. package/dist/ui/richtext/LexicalUtils.js +314 -0
  338. package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
  339. package/dist/ui/richtext/StyledTextNode.js +101 -0
  340. package/dist/ui/richtext/index.d.ts +2 -0
  341. package/dist/ui/richtext/index.js +18 -0
  342. package/dist/utils/ArrayUtils.d.ts +17 -0
  343. package/dist/utils/ArrayUtils.js +66 -0
  344. package/dist/utils/ByteSize.d.ts +19 -0
  345. package/dist/utils/ByteSize.js +33 -0
  346. package/dist/utils/DateUtils.d.ts +15 -0
  347. package/dist/utils/DateUtils.js +100 -0
  348. package/dist/utils/Deferral.d.ts +28 -0
  349. package/dist/utils/Deferral.js +107 -0
  350. package/dist/utils/Duration.d.ts +7 -0
  351. package/dist/utils/Duration.js +35 -0
  352. package/dist/utils/Fn.d.ts +14 -0
  353. package/dist/utils/Fn.js +52 -0
  354. package/dist/utils/ObjectUtils.d.ts +89 -0
  355. package/dist/utils/ObjectUtils.js +159 -0
  356. package/dist/utils/Random.d.ts +15 -0
  357. package/dist/utils/Random.js +72 -0
  358. package/dist/utils/StringUtils.d.ts +10 -0
  359. package/dist/utils/StringUtils.js +51 -0
  360. package/dist/utils/UrlUtils.d.ts +22 -0
  361. package/dist/utils/UrlUtils.js +119 -0
  362. package/dist/utils/Value.d.ts +23 -0
  363. package/dist/utils/Value.js +122 -0
  364. package/dist/utils/index.d.ts +12 -0
  365. package/dist/utils/index.js +28 -0
  366. package/dist/utils/isDefined.d.ts +1 -0
  367. package/dist/utils/isDefined.js +6 -0
  368. package/package.json +64 -0
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkedData = void 0;
4
+ const app_1 = require("../app");
5
+ const utils_1 = require("../utils");
6
+ const Asset_1 = require("./Asset");
7
+ const Collection_1 = require("./Collection");
8
+ const field_1 = require("./field");
9
+ const Page_1 = require("./Page");
10
+ // namespace
11
+ var LinkedData;
12
+ (function (LinkedData) {
13
+ /**
14
+ * Link data, only resolving static links
15
+ */
16
+ function resolveStatic(args) {
17
+ // base transform (only static linking)
18
+ const { data } = baseTransform(args);
19
+ // return statically linked data
20
+ return data;
21
+ }
22
+ LinkedData.resolveStatic = resolveStatic;
23
+ /**
24
+ * Link data, resolving static and dynamic links
25
+ */
26
+ async function resolve(args) {
27
+ // base transform (only static linking)
28
+ const { data, unlinkedReferences } = baseTransform(args);
29
+ // resolve dynamic links (mutates data)
30
+ await resolveDynamicLinks({ unlinkedReferences, resolvers: args.resolvers });
31
+ // return linked data
32
+ return data;
33
+ }
34
+ LinkedData.resolve = resolve;
35
+ // base transform
36
+ function baseTransform(args) {
37
+ // clone unlinked data (this will be mutated)
38
+ const unlinkedData = utils_1.ObjectUtils.clone(args.unlinkedData);
39
+ // resolve persona values (mutates data)
40
+ resolvePersonas({ data: unlinkedData, persona: args.persona });
41
+ // find all references in data
42
+ const references = findReferences(unlinkedData);
43
+ // load references from store (mutates references)
44
+ if (args.stores) {
45
+ loadStores({ stores: args.stores, references });
46
+ }
47
+ // find all unlinked references
48
+ const unlinkedReferences = findUnlinkedReferences(unlinkedData);
49
+ // resolve static links (mutates data)
50
+ resolveStaticLinks({ references, unlinkedReferences });
51
+ // return
52
+ return {
53
+ references, unlinkedReferences, data: unlinkedData
54
+ };
55
+ }
56
+ // load stores
57
+ function loadStores({ stores, references }) {
58
+ const { assets = [], collections = [] } = stores;
59
+ // load assets
60
+ assets.forEach(asset => {
61
+ references.assets.set(asset.value.id, asset);
62
+ });
63
+ // load collections
64
+ collections.forEach(collection => {
65
+ references.collections.set(collection.id, collection);
66
+ });
67
+ }
68
+ // find references
69
+ function findReferences(unlinkedData) {
70
+ // create empty references
71
+ const pages = new Map();
72
+ const collections = new Map();
73
+ const assets = new Map();
74
+ // walk unlinked data
75
+ utils_1.ObjectUtils.walk(unlinkedData, ({ value }) => {
76
+ // page data
77
+ if (Page_1.Page.Data.filter(value)) {
78
+ if (!pages.has(value.id)) {
79
+ pages.set(value.id, value);
80
+ }
81
+ if ('snapshots' in value) {
82
+ delete value.snapshots;
83
+ }
84
+ // pages can have other page/collection data
85
+ return true;
86
+ }
87
+ // collection data
88
+ else if (Collection_1.Collection.Data.filter(value)) {
89
+ if (!collections.has(value.id)) {
90
+ collections.set(value.id, value);
91
+ }
92
+ if ('snapshots' in value) {
93
+ delete value.snapshots;
94
+ }
95
+ // collections can have other page/collection data
96
+ return true;
97
+ }
98
+ // asset data
99
+ else if (Asset_1.Asset.Linked.filter(value)) {
100
+ // replace system setting in videos
101
+ const assetValue = value.value;
102
+ if (field_1.AssetField.LinkedValue.Video.filter(assetValue) && assetValue.metadata.accessible === 'system') {
103
+ assetValue.metadata.accessible = app_1.AppConfig.get().accessible;
104
+ }
105
+ const assetId = Asset_1.Asset.getId(value);
106
+ if (!assets.has(assetId)) {
107
+ assets.set(assetId, value);
108
+ }
109
+ // assets don't have any nested data
110
+ return false;
111
+ }
112
+ // otherwise just keep walking
113
+ return true;
114
+ });
115
+ // return references
116
+ return { pages, collections, assets };
117
+ }
118
+ // find unlinked references
119
+ function findUnlinkedReferences(unlinkedData) {
120
+ // create empty unlinked references
121
+ const pageRefs = new Map();
122
+ const collectionRefs = new Map();
123
+ const assetRefs = new Map();
124
+ const dynamicPages = [];
125
+ // helper
126
+ const upsertRef = (id, value, map) => {
127
+ const refs = map.get(id);
128
+ if (refs) {
129
+ refs.push(value);
130
+ }
131
+ else {
132
+ map.set(id, [value]);
133
+ }
134
+ };
135
+ // walk unlinked data
136
+ utils_1.ObjectUtils.walk(unlinkedData, ({ value }) => {
137
+ // page ref
138
+ if (field_1.Field.Data.Page.filter(value)) {
139
+ const pageId = field_1.Field.Data.Page.getId(value);
140
+ upsertRef(pageId, value, pageRefs);
141
+ return false;
142
+ }
143
+ // collection ref
144
+ else if (field_1.Field.Data.Collection.Ref.filter(value)) {
145
+ const collectionId = field_1.Field.Data.Collection.Ref.getId(value);
146
+ upsertRef(collectionId, value, collectionRefs);
147
+ return false;
148
+ }
149
+ // asset ref
150
+ else if (Asset_1.Asset.filter(value)) {
151
+ const assetId = Asset_1.Asset.getId(value);
152
+ upsertRef(assetId, value, assetRefs);
153
+ return false;
154
+ }
155
+ // dynamic ref
156
+ else if (field_1.Field.Data.DynamicPages.filter(value)) {
157
+ dynamicPages.push(value);
158
+ return true;
159
+ }
160
+ // otherwise just keep walking
161
+ return true;
162
+ });
163
+ // return unlinked references
164
+ return { pageRefs, collectionRefs, assetRefs, dynamicPages };
165
+ }
166
+ // resolve static links
167
+ function resolveStaticLinks({ references, unlinkedReferences }) {
168
+ // setup
169
+ const { pages, collections, assets } = references;
170
+ const { pageRefs, collectionRefs, assetRefs } = unlinkedReferences;
171
+ // resolve page refs
172
+ pageRefs.forEach((refs, id) => {
173
+ const pageData = pages.get(id);
174
+ // for each reference, fill in the data
175
+ refs.forEach(ref => {
176
+ ref.value = pageData
177
+ ? field_1.PageField.Value.toLinked(ref.value, pageData) // pageData is now linked
178
+ : ref.value;
179
+ // @ts-expect-error no longer a ref
180
+ delete ref.__ref;
181
+ });
182
+ });
183
+ // resolve collection refs
184
+ collectionRefs.forEach((refs, id) => {
185
+ const collectionData = collections.get(id);
186
+ // for each reference, fill in the data
187
+ refs.forEach(ref => {
188
+ ref.value = Object.assign(Object.assign({}, ref.value), collectionData);
189
+ // @ts-expect-error no longer a ref
190
+ delete ref.__ref;
191
+ });
192
+ });
193
+ // resolve asset refs
194
+ assetRefs.forEach((refs, id) => {
195
+ const assetData = assets.get(id);
196
+ // for each reference, fill in the data
197
+ refs.forEach(ref => {
198
+ ref.value = assetData
199
+ ? field_1.AssetField.Value.toLinked(ref.value, assetData)
200
+ : ref.value;
201
+ // @ts-expect-error no longer a ref
202
+ delete ref.__ref;
203
+ });
204
+ });
205
+ }
206
+ function resolvePersonas({ data, persona }) {
207
+ var _a;
208
+ // guard to test fields with personas
209
+ function fieldWithPersonaValues(value) {
210
+ return !!value
211
+ && utils_1.Value.typeOf(value) === 'object'
212
+ && 'type' in value
213
+ && 'value' in value
214
+ && 'personas' in value
215
+ && utils_1.Value.typeOf(value.personas) === 'object';
216
+ }
217
+ // keep track of all fields with persona data
218
+ const unresolvedFields = [];
219
+ // find all fields with persona values
220
+ utils_1.ObjectUtils.walk(data, ({ value }) => {
221
+ // track field
222
+ if (fieldWithPersonaValues(value)) {
223
+ unresolvedFields.push(value);
224
+ }
225
+ // always recurse
226
+ return true;
227
+ });
228
+ // resolve each field
229
+ for (const field of unresolvedFields) {
230
+ field.value = persona
231
+ ? (_a = field.personas[persona]) !== null && _a !== void 0 ? _a : field.value
232
+ : field.value;
233
+ // @ts-expect-error no longer needed
234
+ delete field.personas;
235
+ }
236
+ }
237
+ // resolve dynamic links
238
+ async function resolveDynamicLinks({ unlinkedReferences, resolvers: { page: pageResolver } }) {
239
+ // TODO: get limit from some meta data in content, assuming 3 for now
240
+ const TEMP_LIMIT = 3;
241
+ // setup
242
+ const { dynamicPages } = unlinkedReferences;
243
+ // go through each dynamic ref and resolve query
244
+ await Promise.all(dynamicPages.map(async (dynamicPages) => {
245
+ const { types, sort, staticPages: staticPagesRaw = [] } = dynamicPages.value;
246
+ const staticPages = staticPagesRaw.map(item => item.value);
247
+ // if we have enough static items, linked value becomes static values
248
+ // TODO: remove hardcoded schema in value
249
+ if (staticPages.length >= TEMP_LIMIT) {
250
+ dynamicPages.value = {
251
+ // @ts-expect-error changing type on purpose
252
+ __schema: {
253
+ types: ['case-study'],
254
+ size: TEMP_LIMIT
255
+ },
256
+ pages: staticPages
257
+ };
258
+ }
259
+ // otherwise we need to fetch items, combining
260
+ else {
261
+ // get ids to exclude
262
+ const excludeIds = staticPages.map(page => page.id);
263
+ // fetch only needed amount
264
+ const limit = TEMP_LIMIT - staticPages.length;
265
+ // fetch dynamic items
266
+ const resolvedPages = await pageResolver({ types, excludeIds, sort, limit });
267
+ const linkedResolvedPages = resolveStatic({
268
+ unlinkedData: resolvedPages
269
+ });
270
+ console.debug('[LinkData] dynamic pages', resolvedPages);
271
+ // stitch static and dynamic items
272
+ // TODO: remove hardcoded schema in value
273
+ dynamicPages.value = {
274
+ // @ts-expect-error changing type on purpose
275
+ __schema: {
276
+ types: ['case-study'],
277
+ size: TEMP_LIMIT
278
+ },
279
+ pages: [
280
+ ...staticPages,
281
+ ...linkedResolvedPages
282
+ ]
283
+ };
284
+ console.debug('[LinkData] final value', dynamicPages.value);
285
+ }
286
+ }));
287
+ }
288
+ })(LinkedData || (exports.LinkedData = LinkedData = {}));
@@ -0,0 +1,11 @@
1
+ import { LinkedData } from './LinkedData';
2
+ import { Page } from './Page';
3
+ /**
4
+ * Page model with refs resolved to values
5
+ */
6
+ export declare class LinkedPageModel<TPage extends Page> {
7
+ readonly data: Page.LinkedData<TPage>;
8
+ constructor(data: Page.LinkedData<TPage>);
9
+ get seo(): import("./Seo").Seo.LinkedData;
10
+ static fromPageData<TPage extends Page>(unlinkedData: Page.Data<TPage> | Page.Data.AsPreview<TPage>, resolvers: LinkedData.DynamicResolvers): Promise<LinkedPageModel<TPage>>;
11
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkedPageModel = void 0;
4
+ const LinkedData_1 = require("./LinkedData");
5
+ /**
6
+ * Page model with refs resolved to values
7
+ */
8
+ class LinkedPageModel {
9
+ constructor(data) {
10
+ this.data = data;
11
+ }
12
+ get seo() {
13
+ var _a;
14
+ return (_a = this.data.discover) === null || _a === void 0 ? void 0 : _a.seo;
15
+ }
16
+ static async fromPageData(unlinkedData, resolvers) {
17
+ // transform
18
+ const linkedData = await LinkedData_1.LinkedData.resolve({
19
+ unlinkedData,
20
+ resolvers
21
+ });
22
+ // return linked page model
23
+ return new LinkedPageModel(linkedData);
24
+ }
25
+ }
26
+ exports.LinkedPageModel = LinkedPageModel;
@@ -0,0 +1,23 @@
1
+ import { Block } from './Block';
2
+ import { Field } from './field';
3
+ export declare class Optional<T extends Optional.Content = Optional.Content> {
4
+ readonly type = "optional";
5
+ readonly schema: T;
6
+ constructor(schema: T);
7
+ get name(): string;
8
+ get required(): boolean;
9
+ unwrap(): T;
10
+ require(): T;
11
+ }
12
+ export declare namespace Optional {
13
+ type Content = Field.Type | Block;
14
+ type Maybe<T extends Content> = T | Optional<T>;
15
+ type InnerType<T extends Content | Optional<Content>> = T extends Optional<Content> ? T['schema'] : T;
16
+ function unwrap<T extends Content = any>(maybeOptional: Maybe<T>): unwrap.Result<T>;
17
+ namespace unwrap {
18
+ type Result<T extends Content = any> = {
19
+ isOptional: boolean;
20
+ schema: T;
21
+ };
22
+ }
23
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Optional = void 0;
4
+ // class
5
+ class Optional {
6
+ constructor(schema) {
7
+ this.type = 'optional';
8
+ // initialize instance variables
9
+ this.schema = schema.modify({ required: false });
10
+ }
11
+ get name() {
12
+ return this.schema.name;
13
+ }
14
+ get required() {
15
+ return false;
16
+ }
17
+ unwrap() {
18
+ return this.schema;
19
+ }
20
+ require() {
21
+ return this.schema.modify({ required: true });
22
+ }
23
+ }
24
+ exports.Optional = Optional;
25
+ // extension
26
+ (function (Optional) {
27
+ // helpers
28
+ function unwrap(maybeOptional) {
29
+ return maybeOptional instanceof Optional
30
+ ? { isOptional: maybeOptional.schema.required !== true, schema: maybeOptional.schema }
31
+ : { isOptional: false, schema: maybeOptional };
32
+ }
33
+ Optional.unwrap = unwrap;
34
+ })(Optional || (exports.Optional = Optional = {}));
@@ -0,0 +1,299 @@
1
+ import { StringKeyOf, Tagged } from 'type-fest';
2
+ import { Language, Localized } from '../regionalization';
3
+ import { PartialBy } from '../types';
4
+ import { Asset } from './Asset';
5
+ import { Block } from './Block';
6
+ import type { ChangeSet } from './ChangeSet';
7
+ import { Collection } from './Collection';
8
+ import { Field, ListField, ObjectField } from './field';
9
+ import { Fields } from './Fields';
10
+ import { Optional } from './Optional';
11
+ import { PageRoute } from './PageRoute';
12
+ import type { PageSnapshot } from './PageSnapshot';
13
+ import { Section } from './Section';
14
+ import type { Seo } from './Seo';
15
+ import { TagGroup } from './TagGroup';
16
+ export declare class Page<TContent extends Page.Content = Page.Content, TPreview extends Page.PreviewTarget<TContent> = Page.PreviewTarget<TContent>> {
17
+ private _type?;
18
+ readonly variant: Page.Variant;
19
+ readonly route: Localized.Maybe<PageRoute>;
20
+ readonly tags: ReadonlyArray<TagGroup>;
21
+ readonly name: string;
22
+ readonly description?: string;
23
+ readonly displayName?: Page.DisplayName<TContent>;
24
+ readonly optional: boolean;
25
+ readonly preview?: TPreview;
26
+ readonly content: TContent;
27
+ readonly parent?: string;
28
+ private constructor();
29
+ get type(): Page.Type;
30
+ bind(type: Page.Type): void;
31
+ static static<TContent extends Page.Content, TPreview extends Page.PreviewTarget<TContent>>({ route, ...args }: Page.FactoryArgs.Static<TContent, TPreview>): Page<TContent, TPreview>;
32
+ static dynamic<TContent extends Page.Content, TPreview extends Page.PreviewTarget<TContent>>(args: Page.FactoryArgs.Dynamic<TContent, TPreview>): Page<TContent, TPreview>;
33
+ }
34
+ export declare namespace Page {
35
+ type Content = Record<string, Content.Item>;
36
+ namespace Content {
37
+ type Item = Optional.Maybe<Block> | Section;
38
+ type Blocks<TContent extends Content = Content> = {
39
+ [TKey in StringKeyOf<TContent>]: TContent[TKey] extends Block ? TContent[TKey] : never;
40
+ };
41
+ }
42
+ type PreviewTarget<TContent extends Content = Content> = StringKeyOf<Content.Blocks<TContent>>;
43
+ type DisplayName<TContent extends Content = Content> = DisplayName.For<TContent>;
44
+ namespace DisplayName {
45
+ type For<TContent extends Content> = {
46
+ [TKey in StringKeyOf<Content.Blocks<TContent>>]: TContent[TKey] extends Block<infer TId, infer TFields> ? `${TKey}.${keyof Fields.TextLikeFields<TFields>}` : never;
47
+ }[StringKeyOf<Content.Blocks<TContent>>];
48
+ }
49
+ type Update = Update.Tags | Update.BlockCreate | Update.BlockDelete | Update.SectionInsert | Update.SectionDelete | Update.SectionReorder | Update.SectionBlockName | Update.ObjectInsert | Update.ArrayInsert | Update.ArrayDelete | Update.ArrayReorder | Update.Value;
50
+ namespace Update {
51
+ type Tags = {
52
+ type: 'tags';
53
+ tags: TagGroup.Data;
54
+ };
55
+ type BlockCreate = {
56
+ type: 'block.create';
57
+ path: [string, string];
58
+ block: Block.Data;
59
+ };
60
+ type BlockDelete = {
61
+ type: 'block.delete';
62
+ path: [string, string];
63
+ };
64
+ type Value = {
65
+ type: 'value';
66
+ path: string[];
67
+ value: Field.Data | ListField.Value.ForItem;
68
+ persona?: string;
69
+ };
70
+ type ObjectInsert = {
71
+ type: 'object.insert';
72
+ path: string[];
73
+ value: Field.Data<ObjectField>;
74
+ };
75
+ type ArrayInsert = {
76
+ type: 'array.insert';
77
+ path: string[];
78
+ index: number;
79
+ id: string;
80
+ value: ListField.Value.ForItem;
81
+ };
82
+ type ArrayDelete = {
83
+ type: 'array.delete';
84
+ path: string[];
85
+ id: string;
86
+ };
87
+ type ArrayReorder = {
88
+ type: 'array.reorder';
89
+ path: string[];
90
+ ids: string[];
91
+ };
92
+ type SectionInsert = {
93
+ type: 'section.insert';
94
+ path: string[];
95
+ index: number;
96
+ section: Omit<Section.Data, 'blocks'>;
97
+ block: Section.Data.ForBlock;
98
+ };
99
+ type SectionDelete = {
100
+ type: 'section.delete';
101
+ path: string[];
102
+ id: string;
103
+ };
104
+ type SectionReorder = {
105
+ type: 'section.reorder';
106
+ path: string[];
107
+ ids: string[];
108
+ };
109
+ type SectionBlockName = {
110
+ type: 'section.blockName';
111
+ path: string[];
112
+ id: string;
113
+ value: string | null;
114
+ };
115
+ }
116
+ type Data<TPage extends Page = Page, TRegion extends string = string> = {
117
+ __root: 'page';
118
+ id: Id;
119
+ groupId: GroupId;
120
+ brand: string;
121
+ type: Type;
122
+ tags: TagGroup.Data;
123
+ slug?: string;
124
+ url: string;
125
+ region: TRegion;
126
+ language: Language;
127
+ name: string;
128
+ discover: Data.Discover;
129
+ preview?: Data.Preview<TPage>;
130
+ content: Data.Content<TPage>;
131
+ files: Asset.Linked[];
132
+ pages: Data.AsPreview[];
133
+ collections: Collection.Data[];
134
+ state: State;
135
+ errors: boolean;
136
+ changeSetId?: ChangeSet.Id;
137
+ snapshotId?: PageSnapshot.Id;
138
+ snapshot?: PageSnapshot;
139
+ createdOn: number;
140
+ updatedOn: number;
141
+ publishedOn?: number;
142
+ publication?: number;
143
+ };
144
+ namespace Data {
145
+ namespace Props {
146
+ type Id = Extract<All, 'id' | 'groupId' | 'brand' | 'type' | 'tags' | 'region' | 'language' | 'slug' | 'url' | 'name'>;
147
+ const id: ReadonlyArray<Id>;
148
+ type Content = Extract<All, 'discover' | 'preview' | 'content'>;
149
+ const content: ReadonlyArray<Content>;
150
+ type Links = Extract<All, 'files' | 'pages' | 'collections'>;
151
+ const links: ReadonlyArray<Links>;
152
+ type Audit = Extract<All, 'state' | 'errors' | 'changeSetId' | 'snapshotId' | 'createdOn' | 'updatedOn' | 'publishedOn' | 'publication'>;
153
+ const audit: ReadonlyArray<Audit>;
154
+ type Backup = Extract<All, 'snapshot'>;
155
+ const backup: ReadonlyArray<Backup>;
156
+ type All = keyof Data;
157
+ const all: ReadonlyArray<All>;
158
+ }
159
+ type AsDraft<TPage extends Page = Page, TRegion extends string = string> = PartialBy<Pick<Data<TPage, TRegion>, AsDraft.Prop | 'discover'>, 'discover'>;
160
+ namespace AsDraft {
161
+ type Prop = Exclude<Props.Id, 'id'> | Extract<Props.Audit, 'changeSetId'>;
162
+ const props: ReadonlyArray<Prop>;
163
+ }
164
+ type AsNew<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, AsNew.Prop>;
165
+ namespace AsNew {
166
+ type Prop = Exclude<Props.Id, 'id' | 'groupId' | 'url'> | Extract<Props.Audit, 'changeSetId'>;
167
+ const props: ReadonlyArray<Prop>;
168
+ }
169
+ type AsNewLanguage<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, AsNewLanguage.Prop>;
170
+ namespace AsNewLanguage {
171
+ type Prop = Extract<Props.Id, 'brand' | 'groupId' | 'slug' | 'language'>;
172
+ const props: ReadonlyArray<Prop>;
173
+ function filter<TPage extends Page = Page, TRegion extends string = string>(page: AsNew<TPage, TRegion> | AsNewLanguage<TPage, TRegion>): page is AsNewLanguage<TPage, TRegion>;
174
+ }
175
+ type AsRef<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, AsRef.Prop>;
176
+ namespace AsRef {
177
+ type Prop = Extract<Props.Id, 'id' | 'url'>;
178
+ const props: ReadonlyArray<Prop>;
179
+ }
180
+ type AsLink<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, AsLink.Prop>;
181
+ namespace AsLink {
182
+ type Prop = Props.Id | Props.Audit;
183
+ const props: ReadonlyArray<Prop>;
184
+ function from(data: Data): AsLink;
185
+ }
186
+ type AsPreview<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, AsPreview.Prop>;
187
+ namespace AsPreview {
188
+ type Prop = Props.Id | Extract<Props.Content, 'preview'> | Props.Links | Props.Audit;
189
+ const props: ReadonlyArray<Prop>;
190
+ function from(data: Data): AsPreview;
191
+ function filter(data: Data | AsPreview): data is Preview;
192
+ }
193
+ type AsGroup<TPage extends Page = Page, TRegion extends string = string> = {
194
+ group: {
195
+ groupId: GroupId;
196
+ brand: string;
197
+ region: TRegion;
198
+ type: Type;
199
+ slug?: string;
200
+ preset?: string;
201
+ instances: AsGroup.Instance[];
202
+ };
203
+ page?: Data<TPage, TRegion>;
204
+ };
205
+ namespace AsGroup {
206
+ type Instance<TPage extends Page = Page, TRegion extends string = string> = Pick<Data<TPage, TRegion>, Instance.Prop>;
207
+ namespace Instance {
208
+ type Prop = Extract<Props.Id, 'id' | 'name' | 'language' | 'url' | 'slug' | 'tags'> | Exclude<Props.Audit, 'publication'>;
209
+ const props: ReadonlyArray<Prop>;
210
+ }
211
+ }
212
+ type Discover = {
213
+ seo: Seo.Data;
214
+ };
215
+ type Preview<TPage extends Page = Page> = Content<TPage>[Exclude<TPage['preview'], undefined>];
216
+ type Content<TPage extends Page = Page<any>> = {
217
+ [key in keyof TPage['content']]: TPage['content'][key] extends Section ? Section.Data<TPage['content'][key]> : TPage['content'][key] extends Optional.Maybe<Block> ? Block.Data.ForOptional<TPage['content'][key]> : never;
218
+ };
219
+ function filter(value: any): value is Data;
220
+ }
221
+ type LinkedData<TPage extends Page = Page> = Omit<Data<TPage>, 'discover' | 'preview' | 'content' | 'snapshots'> & {
222
+ discover: LinkedData.Discover;
223
+ preview?: LinkedData.Preview<TPage>;
224
+ content: LinkedData.Content<TPage>;
225
+ };
226
+ namespace LinkedData {
227
+ type Discover = {
228
+ seo: Seo.LinkedData;
229
+ };
230
+ type Preview<TPage extends Page = Page> = Content<TPage>[Exclude<TPage['preview'], undefined>];
231
+ type Content<TPage extends Page = Page<any>> = {
232
+ [key in keyof TPage['content']]: TPage['content'][key] extends Section ? Section.LinkedData<TPage['content'][key]> : TPage['content'][key] extends Optional.Maybe<Block> ? Block.LinkedData.ForOptional<TPage['content'][key]> : never;
233
+ };
234
+ type AsLink<TPage extends Page = Page> = Pick<LinkedData<TPage>, Data.AsLink.Prop>;
235
+ namespace AsLink {
236
+ function from(data: LinkedData): AsLink;
237
+ }
238
+ type AsPreview<TPage extends Page = Page> = Pick<LinkedData<TPage>, Data.AsPreview.Prop>;
239
+ namespace AsPreview {
240
+ function from(data: LinkedData): AsPreview;
241
+ }
242
+ }
243
+ type Id = Tagged<string, 'funnel.Page.Id'> | Id.Draft;
244
+ namespace Id {
245
+ type Draft = '__draft.id__';
246
+ const draft: Draft;
247
+ }
248
+ type Type = Tagged<string, 'funnel.Page.Type'> | Type.Unknown;
249
+ namespace Type {
250
+ type Unknown = '__unknown.type__';
251
+ const unknown: Unknown;
252
+ }
253
+ type GroupId = Tagged<string, 'funnel.Page.GroupId'> | GroupId.Empty;
254
+ namespace GroupId {
255
+ type Empty = '__draft.group__';
256
+ const empty: Empty;
257
+ }
258
+ type Variant = 'static' | 'dynamic';
259
+ type State = 'draft' | 'published' | 'unpublished';
260
+ namespace State {
261
+ const values: ReadonlyArray<State>;
262
+ function coerce(value: string | undefined): State;
263
+ function coerceLive(value: string | undefined): Exclude<State, 'unpublished'>;
264
+ }
265
+ type ConstructorArgs<TContent extends Content = Content, TPreview extends PreviewTarget<TContent> = PreviewTarget<TContent>> = ConstructorArgs.Static<TContent, TPreview> | ConstructorArgs.Dynamic<TContent, TPreview>;
266
+ namespace ConstructorArgs {
267
+ type Base<TContent extends Content = Content, TPreview extends PreviewTarget<TContent> = PreviewTarget<TContent>> = {
268
+ route: Localized.Maybe<PageRoute>;
269
+ tags?: ReadonlyArray<TagGroup>;
270
+ name: string;
271
+ description?: string;
272
+ displayName?: DisplayName<TContent>;
273
+ optional?: boolean;
274
+ preview?: TPreview;
275
+ content: TContent;
276
+ };
277
+ type Static<TContent extends Content = Content, TPreview extends PreviewTarget<TContent> = PreviewTarget<TContent>> = Base<TContent, TPreview> & {
278
+ variant: Extract<Variant, 'static'>;
279
+ };
280
+ namespace Static {
281
+ function filter<TContent extends Content, TPreview extends PreviewTarget<TContent>>(args: ConstructorArgs<TContent, TPreview>): args is Static<TContent, TPreview>;
282
+ }
283
+ type Dynamic<TContent extends Content = Content, TPreview extends PreviewTarget<TContent> = PreviewTarget<TContent>> = Base<TContent, TPreview> & {
284
+ variant: Extract<Variant, 'dynamic'>;
285
+ parent?: string;
286
+ };
287
+ namespace Dynamic {
288
+ function filter<TContent extends Content, TPreview extends PreviewTarget<TContent>>(args: ConstructorArgs<TContent, TPreview>): args is Dynamic<TContent, TPreview>;
289
+ }
290
+ }
291
+ namespace FactoryArgs {
292
+ type Base<TContent extends Content, TPreview extends PreviewTarget<TContent>> = Omit<ConstructorArgs.Base<TContent, TPreview>, 'route'> & {
293
+ route: Localized.Maybe<string>;
294
+ };
295
+ export type Static<TContent extends Content, TPreview extends PreviewTarget<TContent>> = Base<TContent, TPreview>;
296
+ export type Dynamic<TContent extends Content, TPreview extends PreviewTarget<TContent>> = Base<TContent, TPreview> & Pick<ConstructorArgs.Dynamic<TContent, TPreview>, 'parent'>;
297
+ export {};
298
+ }
299
+ }