@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,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkField = void 0;
4
+ const errors_1 = require("../../../errors");
5
+ const Page_1 = require("../../Page");
6
+ const index_1 = require("../index");
7
+ // class
8
+ class LinkField extends index_1.Field {
9
+ constructor(args) {
10
+ // construct base
11
+ super(args);
12
+ this.type = 'link';
13
+ // initialize instance variables
14
+ this.allowExternal = args.allowExternal;
15
+ this.allowEmail = args.allowEmail;
16
+ this.allowPhone = args.allowPhone;
17
+ this.internalOptions = args.internal;
18
+ this.fileOptions = args.file;
19
+ }
20
+ get allowInternal() {
21
+ return this.internalOptions !== undefined;
22
+ }
23
+ get allowFile() {
24
+ return this.fileOptions !== undefined;
25
+ }
26
+ modify(args) {
27
+ return new LinkField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, allowExternal: this.allowExternal, allowEmail: this.allowEmail, allowPhone: this.allowPhone, internal: this.internalOptions, file: this.fileOptions }, args));
28
+ }
29
+ }
30
+ exports.LinkField = LinkField;
31
+ // extension
32
+ (function (LinkField) {
33
+ let LinkType;
34
+ (function (LinkType) {
35
+ // values
36
+ LinkType.values = [
37
+ 'internal', 'external', 'email', 'phone', 'file'
38
+ ];
39
+ // methods
40
+ function filter(value) {
41
+ return !!value
42
+ && typeof value === 'string'
43
+ && LinkType.values.includes(value);
44
+ }
45
+ LinkType.filter = filter;
46
+ })(LinkType = LinkField.LinkType || (LinkField.LinkType = {}));
47
+ let Value;
48
+ (function (Value) {
49
+ let Internal;
50
+ (function (Internal) {
51
+ // guards
52
+ function filter(data) {
53
+ return data.type === 'internal';
54
+ }
55
+ Internal.filter = filter;
56
+ function fromData(data) {
57
+ // create default if no data is found
58
+ if (!data || !data.value) {
59
+ return {
60
+ type: 'internal',
61
+ page: {
62
+ __ref: 'page',
63
+ type: 'page',
64
+ value: {
65
+ scope: 'link',
66
+ id: Page_1.Page.Id.draft,
67
+ type: Page_1.Page.Type.unknown
68
+ }
69
+ },
70
+ label: ''
71
+ };
72
+ }
73
+ // or throw if value is not expected type
74
+ else if (data.value.type !== 'internal') {
75
+ throw new errors_1.ArgumentError(`Expected "internal" link but found "${data.value.type}"`);
76
+ }
77
+ // otherwise, return value
78
+ else {
79
+ return data.value;
80
+ }
81
+ }
82
+ Internal.fromData = fromData;
83
+ })(Internal = Value.Internal || (Value.Internal = {}));
84
+ let External;
85
+ (function (External) {
86
+ // guard
87
+ function filter(data) {
88
+ return data.type === 'external';
89
+ }
90
+ External.filter = filter;
91
+ function fromData(data) {
92
+ // create default if no data is found
93
+ if (!data || !data.value) {
94
+ return {
95
+ type: 'external',
96
+ url: '',
97
+ label: ''
98
+ };
99
+ }
100
+ // or throw if value is not expected type
101
+ else if (data.value.type !== 'external') {
102
+ throw new errors_1.ArgumentError(`Expected "external" link but found "${data.value.type}"`);
103
+ }
104
+ // otherwise, return value
105
+ else {
106
+ return data.value;
107
+ }
108
+ }
109
+ External.fromData = fromData;
110
+ })(External = Value.External || (Value.External = {}));
111
+ let Email;
112
+ (function (Email) {
113
+ // guard
114
+ function filter(data) {
115
+ return data.type === 'email';
116
+ }
117
+ Email.filter = filter;
118
+ function fromData(data) {
119
+ // create default if no data is found
120
+ if (!data || !data.value) {
121
+ return {
122
+ type: 'email',
123
+ label: '',
124
+ email: '',
125
+ subject: ''
126
+ };
127
+ }
128
+ // or throw if value is not expected type
129
+ else if (data.value.type !== 'email') {
130
+ throw new errors_1.ArgumentError(`Expected "email" link but found "${data.value.type}"`);
131
+ }
132
+ // otherwise, return value
133
+ else {
134
+ return data.value;
135
+ }
136
+ }
137
+ Email.fromData = fromData;
138
+ })(Email = Value.Email || (Value.Email = {}));
139
+ let Phone;
140
+ (function (Phone) {
141
+ // guard
142
+ function filter(data) {
143
+ return data.type === 'phone';
144
+ }
145
+ Phone.filter = filter;
146
+ function fromData(data) {
147
+ // create default if no data is found
148
+ if (!data || !data.value) {
149
+ return {
150
+ type: 'phone',
151
+ label: '',
152
+ number: ''
153
+ };
154
+ }
155
+ // or throw if value is not expected type
156
+ else if (data.value.type !== 'phone') {
157
+ throw new errors_1.ArgumentError(`Expected "phone" link but found "${data.value.type}"`);
158
+ }
159
+ // otherwise, return value
160
+ else {
161
+ return data.value;
162
+ }
163
+ }
164
+ Phone.fromData = fromData;
165
+ })(Phone = Value.Phone || (Value.Phone = {}));
166
+ let File;
167
+ (function (File) {
168
+ function filter(data) {
169
+ return data.type === 'file';
170
+ }
171
+ File.filter = filter;
172
+ })(File = Value.File || (Value.File = {}));
173
+ // serialization
174
+ function fromData(data) {
175
+ return data.value;
176
+ }
177
+ Value.fromData = fromData;
178
+ function toData(value) {
179
+ return {
180
+ type: 'link',
181
+ value
182
+ };
183
+ }
184
+ Value.toData = toData;
185
+ function toUrl(value) {
186
+ switch (value.type) {
187
+ case 'external':
188
+ return value.url;
189
+ case 'email':
190
+ return value.subject
191
+ ? `mailto:${value.email}?subject=${encodeURIComponent(value.subject)}`
192
+ : `mailto:${value.email}`;
193
+ case 'phone':
194
+ return `tel:${value.number}`;
195
+ case 'file':
196
+ return '#';
197
+ }
198
+ }
199
+ Value.toUrl = toUrl;
200
+ })(Value = LinkField.Value || (LinkField.Value = {}));
201
+ })(LinkField || (exports.LinkField = LinkField = {}));
@@ -0,0 +1,46 @@
1
+ import { Page } from '../../Page';
2
+ import { Tag } from '../../Tag';
3
+ import { Field } from '../index';
4
+ export declare class PageField<TScope extends PageField.Scope = PageField.Scope> extends Field<PageField<TScope>> {
5
+ readonly type: "page";
6
+ readonly scope: TScope;
7
+ readonly pageTypes: ReadonlyArray<Page.Type> | 'all';
8
+ readonly tags: ReadonlyArray<Tag>;
9
+ constructor(args: PageField.ConstructorArgs<TScope>);
10
+ modify(args: PageField.ModifyArgs): PageField<TScope>;
11
+ }
12
+ export declare namespace PageField {
13
+ type Link = PageField<'link'>;
14
+ type Preview = PageField<'preview'>;
15
+ type Full = PageField<'full'>;
16
+ type Value<TScope extends Scope = Scope> = Pick<Page.Data, 'id' | 'type'> & {
17
+ scope: TScope;
18
+ };
19
+ namespace Value {
20
+ function empty(): Value;
21
+ function filter(value: any): value is Value;
22
+ function toLinked(value: Value, page: Page.LinkedData): LinkedValue;
23
+ function fromData(data: Field.Data<PageField> | undefined): Value<Scope> | undefined;
24
+ function toData<TScope extends Scope = Scope>(value: Value<TScope>): Field.Data<PageField<TScope>>;
25
+ }
26
+ type LinkedValue<TScope extends Scope = Scope> = TScope extends 'full' ? LinkedValue.Full : TScope extends 'preview' ? LinkedValue.Preview : LinkedValue.Link;
27
+ namespace LinkedValue {
28
+ type Full = Page.LinkedData & {
29
+ scope: Extract<Scope, 'full'>;
30
+ };
31
+ type Preview = Page.LinkedData.AsPreview & {
32
+ scope: Extract<Scope, 'preview'>;
33
+ };
34
+ type Link = Page.LinkedData.AsLink & {
35
+ scope: Extract<Scope, 'link'>;
36
+ };
37
+ function toData({ scope, id, type }: LinkedValue): Field.Data<PageField>;
38
+ }
39
+ type Scope = 'full' | 'preview' | 'link';
40
+ type ConstructorArgs<TScope extends Scope = Scope> = Field.ConstructorArgs & {
41
+ scope: TScope;
42
+ pageTypes?: ReadonlyArray<string> | 'all';
43
+ tags?: ReadonlyArray<Tag>;
44
+ };
45
+ type ModifyArgs = Omit<Partial<ConstructorArgs>, 'scope' | 'required'>;
46
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageField = void 0;
4
+ const Page_1 = require("../../Page");
5
+ const index_1 = require("../index");
6
+ // class
7
+ class PageField extends index_1.Field {
8
+ constructor(args) {
9
+ var _a, _b;
10
+ // construct base
11
+ super(args);
12
+ this.type = 'page';
13
+ // initialize instance variables
14
+ this.scope = args.scope;
15
+ this.pageTypes = (_a = args.pageTypes) !== null && _a !== void 0 ? _a : 'all';
16
+ this.tags = (_b = args.tags) !== null && _b !== void 0 ? _b : [];
17
+ }
18
+ modify(args) {
19
+ return new PageField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, scope: this.scope, pageTypes: this.pageTypes, tags: this.tags }, args));
20
+ }
21
+ }
22
+ exports.PageField = PageField;
23
+ // extension
24
+ (function (PageField) {
25
+ let Value;
26
+ (function (Value) {
27
+ // factory
28
+ function empty() {
29
+ return undefined;
30
+ }
31
+ Value.empty = empty;
32
+ // filter
33
+ function filter(value) {
34
+ return !!value
35
+ && typeof value === 'object'
36
+ && !Array.isArray(value)
37
+ && 'type' in value && typeof value.type === 'string'
38
+ && 'id' in value && typeof value.id === 'string';
39
+ }
40
+ Value.filter = filter;
41
+ function toLinked(value, page) {
42
+ const { scope } = value;
43
+ // full
44
+ if (scope === 'full') {
45
+ return Object.assign(Object.assign({}, value), page);
46
+ }
47
+ // preview
48
+ else if (scope === 'preview') {
49
+ return Object.assign(Object.assign(Object.assign({}, value), Page_1.Page.LinkedData.AsPreview.from(page)), { scope });
50
+ }
51
+ // link
52
+ else {
53
+ return Object.assign(Object.assign(Object.assign({}, value), Page_1.Page.LinkedData.AsLink.from(page)), { scope });
54
+ }
55
+ }
56
+ Value.toLinked = toLinked;
57
+ // serialization
58
+ function fromData(data) {
59
+ return data === null || data === void 0 ? void 0 : data.value;
60
+ }
61
+ Value.fromData = fromData;
62
+ function toData(value) {
63
+ return {
64
+ __ref: 'page',
65
+ type: 'page',
66
+ value
67
+ };
68
+ }
69
+ Value.toData = toData;
70
+ })(Value = PageField.Value || (PageField.Value = {}));
71
+ let LinkedValue;
72
+ (function (LinkedValue) {
73
+ // serialization
74
+ function toData({ scope, id, type }) {
75
+ return {
76
+ __ref: 'page',
77
+ type: 'page',
78
+ value: { id, type, scope }
79
+ };
80
+ }
81
+ LinkedValue.toData = toData;
82
+ })(LinkedValue = PageField.LinkedValue || (PageField.LinkedValue = {}));
83
+ })(PageField || (exports.PageField = PageField = {}));
@@ -0,0 +1,71 @@
1
+ import type { SerializedEditor } from 'lexical';
2
+ import { Tagged } from 'type-fest';
3
+ import { Field } from '../index';
4
+ export declare class RichTextField extends Field<RichTextField> {
5
+ readonly type: "richtext";
6
+ readonly capabilities: Readonly<RichTextField.Capabilities.Options>;
7
+ readonly minLength?: number;
8
+ readonly maxLength?: number;
9
+ readonly size: RichTextField.Size;
10
+ constructor(args: RichTextField.ConstructorArgs);
11
+ modify({ capabilities, ...args }: RichTextField.ModifyArgs): RichTextField;
12
+ }
13
+ export declare namespace RichTextField {
14
+ type Hash = Tagged<string, 'funnel.RichTextField.Hash'>;
15
+ type Value = SerializedEditor & {
16
+ hash: Hash;
17
+ };
18
+ namespace Value {
19
+ function fromData(data: Field.Data<RichTextField> | undefined): Value | undefined;
20
+ function toData(value: Value): Field.Data<RichTextField>;
21
+ function isEmpty(value: Value | undefined): boolean;
22
+ }
23
+ type Capabilities = Capabilities.Preset | Partial<Capabilities.Options>;
24
+ namespace Capabilities {
25
+ type Preset = 'l1' | 'l2' | 'l3';
26
+ type Headings = Partial<Record<Heading, string>>;
27
+ namespace Headings {
28
+ const defaults: Readonly<Headings>;
29
+ function isEmpty(headings: Headings | false | undefined): boolean;
30
+ type Item = {
31
+ id: Heading;
32
+ label: string;
33
+ };
34
+ function toArray(headings: Headings | false | undefined): Item[];
35
+ }
36
+ type Heading = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
37
+ namespace Heading {
38
+ const values: ReadonlyArray<Heading>;
39
+ }
40
+ type Options = {
41
+ bold: boolean;
42
+ italics: boolean;
43
+ underline: boolean;
44
+ strikethrough: boolean;
45
+ superscript: boolean;
46
+ subscript: boolean;
47
+ links: boolean;
48
+ headings: Headings | false;
49
+ lists: boolean;
50
+ quotes: boolean;
51
+ hr: boolean;
52
+ priority: boolean;
53
+ accent: boolean;
54
+ subtle: boolean;
55
+ };
56
+ namespace Options {
57
+ const minimal: Options;
58
+ const article: Options;
59
+ const full: Options;
60
+ }
61
+ function parse(options: Preset | Partial<Options>): Options;
62
+ }
63
+ type ConstructorArgs = Field.ConstructorArgs & {
64
+ capabilities: Capabilities;
65
+ minLength?: number;
66
+ maxLength?: number;
67
+ size?: Size;
68
+ };
69
+ type Size = 'sm' | 'md' | 'lg';
70
+ type ModifyArgs = Omit<Partial<ConstructorArgs>, 'required'>;
71
+ }
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.RichTextField = void 0;
15
+ const index_1 = require("../index");
16
+ // class
17
+ class RichTextField extends index_1.Field {
18
+ constructor(args) {
19
+ // construct base
20
+ super(args);
21
+ this.type = 'richtext';
22
+ // initialize instance variables
23
+ this.capabilities = RichTextField.Capabilities.parse(args.capabilities);
24
+ this.minLength = args.minLength;
25
+ this.maxLength = args.maxLength;
26
+ const intrinsicSize = getSize(args.capabilities);
27
+ this.size = !args.size || intrinsicSize === 'lg'
28
+ ? intrinsicSize
29
+ : args.size;
30
+ }
31
+ modify(_a) {
32
+ var { capabilities = {} } = _a, args = __rest(_a, ["capabilities"]);
33
+ return new RichTextField(Object.assign(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, minLength: this.minLength, maxLength: this.maxLength, size: this.size }, args), { capabilities: typeof capabilities === 'string'
34
+ ? RichTextField.Capabilities.parse(capabilities)
35
+ : Object.assign(Object.assign({}, this.capabilities), capabilities) }));
36
+ }
37
+ }
38
+ exports.RichTextField = RichTextField;
39
+ // extension
40
+ (function (RichTextField) {
41
+ let Value;
42
+ (function (Value) {
43
+ // serialization
44
+ function fromData(data) {
45
+ return data === null || data === void 0 ? void 0 : data.value;
46
+ }
47
+ Value.fromData = fromData;
48
+ function toData(value) {
49
+ return {
50
+ type: 'richtext',
51
+ value
52
+ };
53
+ }
54
+ Value.toData = toData;
55
+ function isEmpty(value) {
56
+ var _a, _b;
57
+ const rootChildren = (_b = (_a = value === null || value === void 0 ? void 0 : value.editorState) === null || _a === void 0 ? void 0 : _a.root) === null || _b === void 0 ? void 0 : _b.children;
58
+ // empty if root node only has a single empty paragraph element
59
+ return rootChildren !== undefined
60
+ && rootChildren.length === 1
61
+ && rootChildren[0].type === 'paragraph'
62
+ && 'children' in rootChildren[0]
63
+ && Array.isArray(rootChildren[0].children)
64
+ && rootChildren[0].children.length === 0;
65
+ }
66
+ Value.isEmpty = isEmpty;
67
+ })(Value = RichTextField.Value || (RichTextField.Value = {}));
68
+ let Capabilities;
69
+ (function (Capabilities) {
70
+ let Headings;
71
+ (function (Headings) {
72
+ // defaults
73
+ Headings.defaults = {
74
+ h1: 'Title',
75
+ h2: 'Subtitle',
76
+ h3: 'Heading 1',
77
+ h4: 'Heading 2',
78
+ h5: 'Heading 3',
79
+ h6: 'Heading 4'
80
+ };
81
+ // helper
82
+ function isEmpty(headings) {
83
+ return !headings || Object.keys(headings).length === 0;
84
+ }
85
+ Headings.isEmpty = isEmpty;
86
+ function toArray(headings) {
87
+ // skip if there are no headings
88
+ if (!headings) {
89
+ return [];
90
+ }
91
+ // or process headings
92
+ return Object.entries(headings)
93
+ .map(([heading, label]) => ({
94
+ id: heading,
95
+ label
96
+ }))
97
+ .sort((lhs, rhs) => Heading.values.indexOf(lhs.id) < Heading.values.indexOf(rhs.id) ? -1 : 1);
98
+ }
99
+ Headings.toArray = toArray;
100
+ })(Headings = Capabilities.Headings || (Capabilities.Headings = {}));
101
+ let Heading;
102
+ (function (Heading) {
103
+ // values
104
+ Heading.values = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
105
+ })(Heading = Capabilities.Heading || (Capabilities.Heading = {}));
106
+ let Options;
107
+ (function (Options) {
108
+ Options.minimal = {
109
+ bold: false,
110
+ italics: false,
111
+ underline: false,
112
+ strikethrough: false,
113
+ superscript: false,
114
+ subscript: false,
115
+ links: false,
116
+ headings: false,
117
+ lists: false,
118
+ quotes: false,
119
+ hr: false,
120
+ priority: false,
121
+ accent: false,
122
+ subtle: false
123
+ };
124
+ Options.article = {
125
+ bold: true,
126
+ italics: true,
127
+ underline: true,
128
+ strikethrough: true,
129
+ superscript: true,
130
+ subscript: true,
131
+ links: true,
132
+ lists: true,
133
+ quotes: false,
134
+ hr: false,
135
+ priority: false,
136
+ accent: false,
137
+ subtle: false,
138
+ headings: {
139
+ h2: 'Title'
140
+ }
141
+ };
142
+ Options.full = {
143
+ bold: true,
144
+ italics: true,
145
+ underline: true,
146
+ strikethrough: true,
147
+ superscript: true,
148
+ subscript: true,
149
+ links: true,
150
+ lists: true,
151
+ quotes: true,
152
+ hr: true,
153
+ priority: true,
154
+ accent: true,
155
+ subtle: true,
156
+ headings: Headings.defaults
157
+ };
158
+ })(Options = Capabilities.Options || (Capabilities.Options = {}));
159
+ // helpers
160
+ function parse(options) {
161
+ switch (options) {
162
+ case 'l1':
163
+ return Object.assign(Object.assign({}, Options.minimal), { bold: true, italics: true, underline: true, superscript: true, subscript: true });
164
+ case 'l2':
165
+ return Object.assign(Object.assign({}, Options.minimal), { bold: true, italics: true, underline: true, superscript: true, subscript: true, links: true });
166
+ case 'l3':
167
+ return Object.assign(Object.assign({}, Options.minimal), { bold: true, italics: true, underline: true, strikethrough: true, superscript: true, subscript: true, links: true, headings: Headings.defaults, lists: true, quotes: true, hr: true });
168
+ default:
169
+ return Object.assign(Object.assign({}, Options.minimal), options);
170
+ }
171
+ }
172
+ Capabilities.parse = parse;
173
+ })(Capabilities = RichTextField.Capabilities || (RichTextField.Capabilities = {}));
174
+ })(RichTextField || (exports.RichTextField = RichTextField = {}));
175
+ // helpers
176
+ function getSize(capabilities) {
177
+ // go with default scaling (if applicable)
178
+ if (capabilities === 'l1') {
179
+ return 'sm';
180
+ }
181
+ else if (capabilities === 'l2') {
182
+ return 'md';
183
+ }
184
+ else if (capabilities === 'l3') {
185
+ return 'lg';
186
+ }
187
+ // or large if there are lists/breaks
188
+ const { headings, lists, quotes, hr } = capabilities;
189
+ if (headings || lists || quotes || hr) {
190
+ return 'lg';
191
+ }
192
+ // otherwise, small
193
+ else {
194
+ return 'sm';
195
+ }
196
+ }
@@ -0,0 +1,33 @@
1
+ import { Field } from '../index';
2
+ export declare class TextField extends Field<TextField> {
3
+ readonly type: "text";
4
+ readonly semantics: TextField.Semantics;
5
+ readonly regex?: RegExp;
6
+ readonly exact?: string;
7
+ readonly minLength?: number;
8
+ readonly maxLength?: number;
9
+ constructor(args: TextField.ConstructorArgs);
10
+ modify(args: TextField.ModifyArgs): TextField;
11
+ }
12
+ export declare namespace TextField {
13
+ type Value = string;
14
+ namespace Value {
15
+ function fromData(data: Field.Data<TextField> | undefined): string | undefined;
16
+ function toData(value: Value): Field.Data<TextField>;
17
+ function coerceData(value: Value | undefined): Field.Data<TextField> | undefined;
18
+ }
19
+ namespace Regex {
20
+ function email(): RegExp;
21
+ function slug(): RegExp;
22
+ function password(): RegExp;
23
+ }
24
+ type ConstructorArgs = Field.ConstructorArgs & {
25
+ semantics?: Semantics;
26
+ regex?: RegExp;
27
+ exact?: string;
28
+ minLength?: number;
29
+ maxLength?: number;
30
+ };
31
+ type Semantics = 'short' | 'long' | 'slug' | 'uri' | 'url' | 'email' | 'phone' | 'phone-intl' | 'password' | 'password-input' | 'integer';
32
+ type ModifyArgs = Omit<Partial<ConstructorArgs>, 'required'>;
33
+ }