@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.
- package/dist/app/AppConfig.d.ts +41 -0
- package/dist/app/AppConfig.js +93 -0
- package/dist/app/BrandConfig.d.ts +13 -0
- package/dist/app/BrandConfig.js +2 -0
- package/dist/app/FeaturesConfig.d.ts +6 -0
- package/dist/app/FeaturesConfig.js +2 -0
- package/dist/app/RegionsConfig.d.ts +43 -0
- package/dist/app/RegionsConfig.js +113 -0
- package/dist/app/UIConfig.d.ts +4 -0
- package/dist/app/UIConfig.js +2 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.js +21 -0
- package/dist/consent/ConsentCategory.d.ts +12 -0
- package/dist/consent/ConsentCategory.js +28 -0
- package/dist/consent/ConsentService.d.ts +15 -0
- package/dist/consent/ConsentService.js +37 -0
- package/dist/consent/index.d.ts +2 -0
- package/dist/consent/index.js +18 -0
- package/dist/errors/IsometricError.d.ts +19 -0
- package/dist/errors/IsometricError.js +30 -0
- package/dist/errors/IsometricErrorModule.d.ts +11 -0
- package/dist/errors/IsometricErrorModule.js +2 -0
- package/dist/errors/IsometricErrorUtils.d.ts +9 -0
- package/dist/errors/IsometricErrorUtils.js +85 -0
- package/dist/errors/SerializedIsometricError.d.ts +10 -0
- package/dist/errors/SerializedIsometricError.js +15 -0
- package/dist/errors/api/ApiError.d.ts +15 -0
- package/dist/errors/api/ApiError.js +23 -0
- package/dist/errors/api/ApiErrors.d.ts +7 -0
- package/dist/errors/api/ApiErrors.js +67 -0
- package/dist/errors/api/ArgumentError.d.ts +7 -0
- package/dist/errors/api/ArgumentError.js +18 -0
- package/dist/errors/api/ConcurrencyError.d.ts +4 -0
- package/dist/errors/api/ConcurrencyError.js +11 -0
- package/dist/errors/api/ConflictError.d.ts +4 -0
- package/dist/errors/api/ConflictError.js +11 -0
- package/dist/errors/api/DependencyError.d.ts +4 -0
- package/dist/errors/api/DependencyError.js +11 -0
- package/dist/errors/api/IllegalStateError.d.ts +4 -0
- package/dist/errors/api/IllegalStateError.js +11 -0
- package/dist/errors/api/InvalidOperationError.d.ts +4 -0
- package/dist/errors/api/InvalidOperationError.js +11 -0
- package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
- package/dist/errors/api/NotAuthenticatedError.js +11 -0
- package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
- package/dist/errors/api/NotAuthorizedError.js +11 -0
- package/dist/errors/api/NotAvailableError.d.ts +4 -0
- package/dist/errors/api/NotAvailableError.js +11 -0
- package/dist/errors/api/NotFoundError.d.ts +4 -0
- package/dist/errors/api/NotFoundError.js +11 -0
- package/dist/errors/api/NotImplementedError.d.ts +4 -0
- package/dist/errors/api/NotImplementedError.js +11 -0
- package/dist/errors/api/OfflineError.d.ts +4 -0
- package/dist/errors/api/OfflineError.js +11 -0
- package/dist/errors/api/RangeError.d.ts +4 -0
- package/dist/errors/api/RangeError.js +11 -0
- package/dist/errors/api/ServerError.d.ts +4 -0
- package/dist/errors/api/ServerError.js +11 -0
- package/dist/errors/api/TimeoutError.d.ts +4 -0
- package/dist/errors/api/TimeoutError.js +11 -0
- package/dist/errors/api/index.d.ts +16 -0
- package/dist/errors/api/index.js +32 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +26 -0
- package/dist/forms/FormModel.d.ts +47 -0
- package/dist/forms/FormModel.js +149 -0
- package/dist/forms/Forms.d.ts +15 -0
- package/dist/forms/Forms.js +35 -0
- package/dist/forms/IFormService.d.ts +6 -0
- package/dist/forms/IFormService.js +2 -0
- package/dist/forms/TranslateSchema.d.ts +8 -0
- package/dist/forms/TranslateSchema.js +2 -0
- package/dist/forms/index.d.ts +4 -0
- package/dist/forms/index.js +20 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -0
- package/dist/regionalization/Country.d.ts +266 -0
- package/dist/regionalization/Country.js +338 -0
- package/dist/regionalization/Language.d.ts +199 -0
- package/dist/regionalization/Language.js +237 -0
- package/dist/regionalization/Locale.d.ts +28 -0
- package/dist/regionalization/Locale.js +49 -0
- package/dist/regionalization/Localized.d.ts +10 -0
- package/dist/regionalization/Localized.js +36 -0
- package/dist/regionalization/LocalizedCopy.d.ts +9 -0
- package/dist/regionalization/LocalizedCopy.js +26 -0
- package/dist/regionalization/Regionalization.d.ts +50 -0
- package/dist/regionalization/Regionalization.js +260 -0
- package/dist/regionalization/Regions.d.ts +2 -0
- package/dist/regionalization/Regions.js +2 -0
- package/dist/regionalization/index.d.ts +7 -0
- package/dist/regionalization/index.js +23 -0
- package/dist/schema/Asset.d.ts +23 -0
- package/dist/schema/Asset.js +36 -0
- package/dist/schema/AssetScope.d.ts +75 -0
- package/dist/schema/AssetScope.js +146 -0
- package/dist/schema/Block.d.ts +105 -0
- package/dist/schema/Block.js +122 -0
- package/dist/schema/ChangeSet.d.ts +108 -0
- package/dist/schema/ChangeSet.js +187 -0
- package/dist/schema/Collection.d.ts +197 -0
- package/dist/schema/Collection.js +165 -0
- package/dist/schema/CollectionModel.d.ts +30 -0
- package/dist/schema/CollectionModel.js +383 -0
- package/dist/schema/CollectionSnapshot.d.ts +11 -0
- package/dist/schema/CollectionSnapshot.js +12 -0
- package/dist/schema/Fields.d.ts +31 -0
- package/dist/schema/Fields.js +21 -0
- package/dist/schema/Form.d.ts +31 -0
- package/dist/schema/Form.js +23 -0
- package/dist/schema/LinkedCollectionModel.d.ts +9 -0
- package/dist/schema/LinkedCollectionModel.js +19 -0
- package/dist/schema/LinkedData.d.ts +44 -0
- package/dist/schema/LinkedData.js +288 -0
- package/dist/schema/LinkedPageModel.d.ts +11 -0
- package/dist/schema/LinkedPageModel.js +26 -0
- package/dist/schema/Optional.d.ts +23 -0
- package/dist/schema/Optional.js +34 -0
- package/dist/schema/Page.d.ts +299 -0
- package/dist/schema/Page.js +244 -0
- package/dist/schema/PageModel.d.ts +58 -0
- package/dist/schema/PageModel.js +881 -0
- package/dist/schema/PageQuery.d.ts +60 -0
- package/dist/schema/PageQuery.js +116 -0
- package/dist/schema/PageRoute.d.ts +7 -0
- package/dist/schema/PageRoute.js +48 -0
- package/dist/schema/PageSnapshot.d.ts +11 -0
- package/dist/schema/PageSnapshot.js +12 -0
- package/dist/schema/Section.d.ts +71 -0
- package/dist/schema/Section.js +35 -0
- package/dist/schema/Seo.d.ts +13 -0
- package/dist/schema/Seo.js +25 -0
- package/dist/schema/Site.d.ts +40 -0
- package/dist/schema/Site.js +87 -0
- package/dist/schema/SiteModel.d.ts +5 -0
- package/dist/schema/SiteModel.js +10 -0
- package/dist/schema/Tag.d.ts +28 -0
- package/dist/schema/Tag.js +59 -0
- package/dist/schema/TagGroup.d.ts +26 -0
- package/dist/schema/TagGroup.js +64 -0
- package/dist/schema/field/Field.d.ts +179 -0
- package/dist/schema/field/Field.js +309 -0
- package/dist/schema/field/base/AssetField.d.ts +148 -0
- package/dist/schema/field/base/AssetField.js +206 -0
- package/dist/schema/field/base/BooleanField.d.ts +21 -0
- package/dist/schema/field/base/BooleanField.js +38 -0
- package/dist/schema/field/base/CollectionField.d.ts +34 -0
- package/dist/schema/field/base/CollectionField.js +85 -0
- package/dist/schema/field/base/DateField.d.ts +21 -0
- package/dist/schema/field/base/DateField.js +37 -0
- package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
- package/dist/schema/field/base/DynamicPagesField.js +50 -0
- package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
- package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
- package/dist/schema/field/base/EnumField.d.ts +40 -0
- package/dist/schema/field/base/EnumField.js +131 -0
- package/dist/schema/field/base/FormField.d.ts +25 -0
- package/dist/schema/field/base/FormField.js +48 -0
- package/dist/schema/field/base/LinkField.d.ts +103 -0
- package/dist/schema/field/base/LinkField.js +201 -0
- package/dist/schema/field/base/PageField.d.ts +46 -0
- package/dist/schema/field/base/PageField.js +83 -0
- package/dist/schema/field/base/RichTextField.d.ts +71 -0
- package/dist/schema/field/base/RichTextField.js +196 -0
- package/dist/schema/field/base/TextField.d.ts +33 -0
- package/dist/schema/field/base/TextField.js +86 -0
- package/dist/schema/field/base/TimestampField.d.ts +25 -0
- package/dist/schema/field/base/TimestampField.js +41 -0
- package/dist/schema/field/base/index.d.ts +13 -0
- package/dist/schema/field/base/index.js +29 -0
- package/dist/schema/field/composite/ListField.d.ts +47 -0
- package/dist/schema/field/composite/ListField.js +107 -0
- package/dist/schema/field/composite/ObjectField.d.ts +56 -0
- package/dist/schema/field/composite/ObjectField.js +19 -0
- package/dist/schema/field/composite/index.d.ts +2 -0
- package/dist/schema/field/composite/index.js +18 -0
- package/dist/schema/field/index.d.ts +3 -0
- package/dist/schema/field/index.js +19 -0
- package/dist/schema/index.d.ts +25 -0
- package/dist/schema/index.js +41 -0
- package/dist/services/EventBus.d.ts +17 -0
- package/dist/services/EventBus.js +37 -0
- package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
- package/dist/services/humanVerification/IHumanVerification.js +2 -0
- package/dist/services/humanVerification/index.d.ts +1 -0
- package/dist/services/humanVerification/index.js +17 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +19 -0
- package/dist/services/leadGen/Contact.d.ts +40 -0
- package/dist/services/leadGen/Contact.js +38 -0
- package/dist/services/leadGen/ILeadGen.d.ts +16 -0
- package/dist/services/leadGen/ILeadGen.js +2 -0
- package/dist/services/leadGen/index.d.ts +2 -0
- package/dist/services/leadGen/index.js +18 -0
- package/dist/types/BoxedValue.d.ts +3 -0
- package/dist/types/BoxedValue.js +2 -0
- package/dist/types/Callback.d.ts +9 -0
- package/dist/types/Callback.js +2 -0
- package/dist/types/DateString.d.ts +35 -0
- package/dist/types/DateString.js +172 -0
- package/dist/types/FilterConditionally.d.ts +3 -0
- package/dist/types/FilterConditionally.js +2 -0
- package/dist/types/MaybeConditionalValue.d.ts +8 -0
- package/dist/types/MaybeConditionalValue.js +12 -0
- package/dist/types/Ordinal.d.ts +17 -0
- package/dist/types/Ordinal.js +38 -0
- package/dist/types/OverridableStringUnion.d.ts +2 -0
- package/dist/types/OverridableStringUnion.js +2 -0
- package/dist/types/PartialBy.d.ts +1 -0
- package/dist/types/PartialBy.js +2 -0
- package/dist/types/PickData.d.ts +6 -0
- package/dist/types/PickData.js +2 -0
- package/dist/types/Provider.d.ts +4 -0
- package/dist/types/Provider.js +2 -0
- package/dist/types/RequiredBy.d.ts +1 -0
- package/dist/types/RequiredBy.js +2 -0
- package/dist/types/Result.d.ts +16 -0
- package/dist/types/Result.js +2 -0
- package/dist/types/Timestamp.d.ts +17 -0
- package/dist/types/Timestamp.js +57 -0
- package/dist/types/Transform.d.ts +4 -0
- package/dist/types/Transform.js +2 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +30 -0
- package/dist/ui/Accessible.d.ts +5 -0
- package/dist/ui/Accessible.js +15 -0
- package/dist/ui/BlockThemes.d.ts +19 -0
- package/dist/ui/BlockThemes.js +29 -0
- package/dist/ui/ColorMode.d.ts +12 -0
- package/dist/ui/ColorMode.js +49 -0
- package/dist/ui/File.d.ts +43 -0
- package/dist/ui/File.js +55 -0
- package/dist/ui/FileType.d.ts +8 -0
- package/dist/ui/FileType.js +48 -0
- package/dist/ui/ImageSource.d.ts +12 -0
- package/dist/ui/ImageSource.js +48 -0
- package/dist/ui/MimeType.d.ts +28 -0
- package/dist/ui/MimeType.js +110 -0
- package/dist/ui/Placement.d.ts +21 -0
- package/dist/ui/Placement.js +135 -0
- package/dist/ui/Position.d.ts +6 -0
- package/dist/ui/Position.js +42 -0
- package/dist/ui/Selector.d.ts +6 -0
- package/dist/ui/Selector.js +23 -0
- package/dist/ui/SemanticColor.d.ts +8 -0
- package/dist/ui/SemanticColor.js +237 -0
- package/dist/ui/Visual.d.ts +24 -0
- package/dist/ui/Visual.js +66 -0
- package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
- package/dist/ui/block-layout/BlockLayout.js +286 -0
- package/dist/ui/block-layout/index.d.ts +1 -0
- package/dist/ui/block-layout/index.js +17 -0
- package/dist/ui/browser/BlurHasher.d.ts +13 -0
- package/dist/ui/browser/BlurHasher.js +76 -0
- package/dist/ui/browser/Browser.d.ts +107 -0
- package/dist/ui/browser/Browser.js +313 -0
- package/dist/ui/browser/ImageProxy.d.ts +30 -0
- package/dist/ui/browser/ImageProxy.js +132 -0
- package/dist/ui/browser/InputEvent.d.ts +13 -0
- package/dist/ui/browser/InputEvent.js +2 -0
- package/dist/ui/browser/SVGProxy.d.ts +9 -0
- package/dist/ui/browser/SVGProxy.js +59 -0
- package/dist/ui/browser/VideoProxy.d.ts +42 -0
- package/dist/ui/browser/VideoProxy.js +235 -0
- package/dist/ui/browser/index.d.ts +6 -0
- package/dist/ui/browser/index.js +22 -0
- package/dist/ui/fields/Field.d.ts +80 -0
- package/dist/ui/fields/Field.js +298 -0
- package/dist/ui/fields/FieldList.d.ts +80 -0
- package/dist/ui/fields/FieldList.js +421 -0
- package/dist/ui/fields/FieldListValidator.d.ts +9 -0
- package/dist/ui/fields/FieldListValidator.js +37 -0
- package/dist/ui/fields/FieldModel.d.ts +15 -0
- package/dist/ui/fields/FieldModel.js +28 -0
- package/dist/ui/fields/FieldSerializer.d.ts +13 -0
- package/dist/ui/fields/FieldSerializer.js +71 -0
- package/dist/ui/fields/FieldValidator.d.ts +19 -0
- package/dist/ui/fields/FieldValidator.js +98 -0
- package/dist/ui/fields/ObjectField.d.ts +75 -0
- package/dist/ui/fields/ObjectField.js +288 -0
- package/dist/ui/fields/errors.json +44 -0
- package/dist/ui/fields/index.d.ts +7 -0
- package/dist/ui/fields/index.js +23 -0
- package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
- package/dist/ui/fields/validators/AssetValidator.js +25 -0
- package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
- package/dist/ui/fields/validators/DateValidator.js +41 -0
- package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
- package/dist/ui/fields/validators/EnumValidator.js +77 -0
- package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
- package/dist/ui/fields/validators/GenericValidator.js +22 -0
- package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
- package/dist/ui/fields/validators/LinkValidator.js +146 -0
- package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
- package/dist/ui/fields/validators/RichTextValidator.js +35 -0
- package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
- package/dist/ui/fields/validators/TextValidator.js +138 -0
- package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
- package/dist/ui/fields/validators/TimestampValidator.js +41 -0
- package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
- package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
- package/dist/ui/fields/validators/index.d.ts +8 -0
- package/dist/ui/fields/validators/index.js +24 -0
- package/dist/ui/geometry/AspectRatio.d.ts +27 -0
- package/dist/ui/geometry/AspectRatio.js +77 -0
- package/dist/ui/geometry/Bounds.d.ts +4 -0
- package/dist/ui/geometry/Bounds.js +11 -0
- package/dist/ui/geometry/Frame.d.ts +3 -0
- package/dist/ui/geometry/Frame.js +2 -0
- package/dist/ui/geometry/Insets.d.ts +14 -0
- package/dist/ui/geometry/Insets.js +14 -0
- package/dist/ui/geometry/PixelSize.d.ts +1 -0
- package/dist/ui/geometry/PixelSize.js +2 -0
- package/dist/ui/geometry/Point.d.ts +7 -0
- package/dist/ui/geometry/Point.js +15 -0
- package/dist/ui/geometry/Rect.d.ts +19 -0
- package/dist/ui/geometry/Rect.js +68 -0
- package/dist/ui/geometry/ScreenSize.d.ts +1 -0
- package/dist/ui/geometry/ScreenSize.js +2 -0
- package/dist/ui/geometry/Size.d.ts +7 -0
- package/dist/ui/geometry/Size.js +9 -0
- package/dist/ui/geometry/index.d.ts +9 -0
- package/dist/ui/geometry/index.js +25 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.js +34 -0
- package/dist/ui/responsive/Breakpoint.d.ts +8 -0
- package/dist/ui/responsive/Breakpoint.js +24 -0
- package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
- package/dist/ui/responsive/BreakpointObserver.js +104 -0
- package/dist/ui/responsive/Breakpoints.d.ts +5 -0
- package/dist/ui/responsive/Breakpoints.js +15 -0
- package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
- package/dist/ui/responsive/ResponsiveValue.js +26 -0
- package/dist/ui/responsive/index.d.ts +4 -0
- package/dist/ui/responsive/index.js +20 -0
- package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
- package/dist/ui/richtext/LexicalUtils.js +314 -0
- package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
- package/dist/ui/richtext/StyledTextNode.js +101 -0
- package/dist/ui/richtext/index.d.ts +2 -0
- package/dist/ui/richtext/index.js +18 -0
- package/dist/utils/ArrayUtils.d.ts +17 -0
- package/dist/utils/ArrayUtils.js +66 -0
- package/dist/utils/ByteSize.d.ts +19 -0
- package/dist/utils/ByteSize.js +33 -0
- package/dist/utils/DateUtils.d.ts +15 -0
- package/dist/utils/DateUtils.js +100 -0
- package/dist/utils/Deferral.d.ts +28 -0
- package/dist/utils/Deferral.js +107 -0
- package/dist/utils/Duration.d.ts +7 -0
- package/dist/utils/Duration.js +35 -0
- package/dist/utils/Fn.d.ts +14 -0
- package/dist/utils/Fn.js +52 -0
- package/dist/utils/ObjectUtils.d.ts +89 -0
- package/dist/utils/ObjectUtils.js +159 -0
- package/dist/utils/Random.d.ts +15 -0
- package/dist/utils/Random.js +72 -0
- package/dist/utils/StringUtils.d.ts +10 -0
- package/dist/utils/StringUtils.js +51 -0
- package/dist/utils/UrlUtils.d.ts +22 -0
- package/dist/utils/UrlUtils.js +119 -0
- package/dist/utils/Value.d.ts +23 -0
- package/dist/utils/Value.js +122 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/isDefined.d.ts +1 -0
- package/dist/utils/isDefined.js +6 -0
- package/package.json +64 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare namespace StringUtils {
|
|
2
|
+
const vowels: ReadonlyArray<string>;
|
|
3
|
+
function firstChar(value: string): string | undefined;
|
|
4
|
+
function lastChar(value: string): string | undefined;
|
|
5
|
+
function filter(value: string, regex: RegExp): string;
|
|
6
|
+
function articleFor(value: string): "a" | "an";
|
|
7
|
+
function capitalize(value: string): string;
|
|
8
|
+
function toKebabCase(value: string): string;
|
|
9
|
+
function toSnakeCase(value: string): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StringUtils = void 0;
|
|
7
|
+
const to_space_case_1 = __importDefault(require("to-space-case"));
|
|
8
|
+
// namespace
|
|
9
|
+
var StringUtils;
|
|
10
|
+
(function (StringUtils) {
|
|
11
|
+
// vowels
|
|
12
|
+
StringUtils.vowels = ['a', 'e', 'i', 'o', 'u'];
|
|
13
|
+
// helpers
|
|
14
|
+
function firstChar(value) {
|
|
15
|
+
return value.length > 0
|
|
16
|
+
? value[0]
|
|
17
|
+
: undefined;
|
|
18
|
+
}
|
|
19
|
+
StringUtils.firstChar = firstChar;
|
|
20
|
+
function lastChar(value) {
|
|
21
|
+
return value.length > 0
|
|
22
|
+
? value[value.length - 1]
|
|
23
|
+
: undefined;
|
|
24
|
+
}
|
|
25
|
+
StringUtils.lastChar = lastChar;
|
|
26
|
+
function filter(value, regex) {
|
|
27
|
+
return value
|
|
28
|
+
.matchAll(regex)
|
|
29
|
+
.reduce((newValue, [match]) => newValue + match, '');
|
|
30
|
+
}
|
|
31
|
+
StringUtils.filter = filter;
|
|
32
|
+
function articleFor(value) {
|
|
33
|
+
const [firstCharacter = ''] = value;
|
|
34
|
+
return StringUtils.vowels.includes(firstCharacter.toLowerCase()) ? 'an' : 'a';
|
|
35
|
+
}
|
|
36
|
+
StringUtils.articleFor = articleFor;
|
|
37
|
+
function capitalize(value) {
|
|
38
|
+
return value.length > 0
|
|
39
|
+
? value[0].toUpperCase() + value.substring(1)
|
|
40
|
+
: value;
|
|
41
|
+
}
|
|
42
|
+
StringUtils.capitalize = capitalize;
|
|
43
|
+
function toKebabCase(value) {
|
|
44
|
+
return (0, to_space_case_1.default)(value).replace(/\s/g, '-');
|
|
45
|
+
}
|
|
46
|
+
StringUtils.toKebabCase = toKebabCase;
|
|
47
|
+
function toSnakeCase(value) {
|
|
48
|
+
return (0, to_space_case_1.default)(value).replace(/\s/g, '_');
|
|
49
|
+
}
|
|
50
|
+
StringUtils.toSnakeCase = toSnakeCase;
|
|
51
|
+
})(StringUtils || (exports.StringUtils = StringUtils = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare namespace UrlUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Create a URL object if provided url is parsable. This is replacement function for URL.parse() which is not
|
|
4
|
+
* supported in Safari 17 or lower.
|
|
5
|
+
*
|
|
6
|
+
* @param url A string or any other object with a stringifier that represents an absolute URL or a relative reference to a URL.
|
|
7
|
+
* @param base A string representing the base URL to use in cases where url is a relative URL. If not specified, it defaults to undefined.
|
|
8
|
+
*/
|
|
9
|
+
function parse(url: string, base?: URL): URL | null;
|
|
10
|
+
function coerce(valueRaw: string, fallback?: string): string;
|
|
11
|
+
function parseMailto(mailto: string): {
|
|
12
|
+
email: string;
|
|
13
|
+
cc: string | undefined;
|
|
14
|
+
subject: string | undefined;
|
|
15
|
+
body: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
function parseTel(tel: string): string;
|
|
18
|
+
function isRelativeUrl(url: string): boolean;
|
|
19
|
+
function normalizeBase(base: URL | string): string;
|
|
20
|
+
function normalizePath(path: string): string;
|
|
21
|
+
function concat(base: URL | string, path: string): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlUtils = void 0;
|
|
4
|
+
// namespace
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const Value_1 = require("./Value");
|
|
7
|
+
var UrlUtils;
|
|
8
|
+
(function (UrlUtils) {
|
|
9
|
+
/**
|
|
10
|
+
* Create a URL object if provided url is parsable. This is replacement function for URL.parse() which is not
|
|
11
|
+
* supported in Safari 17 or lower.
|
|
12
|
+
*
|
|
13
|
+
* @param url A string or any other object with a stringifier that represents an absolute URL or a relative reference to a URL.
|
|
14
|
+
* @param base A string representing the base URL to use in cases where url is a relative URL. If not specified, it defaults to undefined.
|
|
15
|
+
*/
|
|
16
|
+
function parse(url, base) {
|
|
17
|
+
// if the provided url can be parsed, then create a new URL object
|
|
18
|
+
if (URL.canParse(url, base)) {
|
|
19
|
+
return new URL(url, base);
|
|
20
|
+
}
|
|
21
|
+
// otherwise return null
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
UrlUtils.parse = parse;
|
|
25
|
+
function coerce(valueRaw, fallback) {
|
|
26
|
+
// keep it simple if the format's valid
|
|
27
|
+
const value = valueRaw.trim().toLocaleLowerCase();
|
|
28
|
+
const [valuePrefix] = value.split('?', 1);
|
|
29
|
+
let uri;
|
|
30
|
+
if (URL.canParse(value)) {
|
|
31
|
+
uri = new URL(value).href;
|
|
32
|
+
}
|
|
33
|
+
// or accept relative paths
|
|
34
|
+
else if (isRelativeUrl(value)) {
|
|
35
|
+
uri = value;
|
|
36
|
+
}
|
|
37
|
+
// or handle qualified mailto/tel links
|
|
38
|
+
else if (Value_1.Value.isEmailLink(value) || Value_1.Value.isPhoneNumberLink(value)) {
|
|
39
|
+
uri = value;
|
|
40
|
+
}
|
|
41
|
+
// or handle mailto links
|
|
42
|
+
else if (Value_1.Value.isEmail(valuePrefix)) {
|
|
43
|
+
uri = `mailto:${value}`;
|
|
44
|
+
}
|
|
45
|
+
// or handle tel links
|
|
46
|
+
else if (Value_1.Value.isPhoneNumber(value)) {
|
|
47
|
+
uri = `tel:${value}`;
|
|
48
|
+
}
|
|
49
|
+
// or formalize urls without prefix
|
|
50
|
+
else if (Value_1.Value.isUri(value)) {
|
|
51
|
+
uri = `https://${value}`;
|
|
52
|
+
}
|
|
53
|
+
// otherwise, return original
|
|
54
|
+
else {
|
|
55
|
+
uri = fallback !== null && fallback !== void 0 ? fallback : value;
|
|
56
|
+
}
|
|
57
|
+
// strip any trailing slash
|
|
58
|
+
if (uri.endsWith('/')) {
|
|
59
|
+
uri = uri.substring(0, uri.length - 1);
|
|
60
|
+
}
|
|
61
|
+
// return uri
|
|
62
|
+
return uri;
|
|
63
|
+
}
|
|
64
|
+
UrlUtils.coerce = coerce;
|
|
65
|
+
function parseMailto(mailto) {
|
|
66
|
+
var _a, _b, _c;
|
|
67
|
+
// throw if it's not a mailto link
|
|
68
|
+
const prefix = 'mailto:';
|
|
69
|
+
if (!mailto.startsWith(prefix)) {
|
|
70
|
+
throw new errors_1.ArgumentError(`Invalid "mailto:" link "${mailto}"`);
|
|
71
|
+
}
|
|
72
|
+
// split email/args
|
|
73
|
+
const [email, paramsRaw] = mailto.substring(prefix.length).split('?');
|
|
74
|
+
const params = new URLSearchParams(paramsRaw);
|
|
75
|
+
return {
|
|
76
|
+
email,
|
|
77
|
+
cc: (_a = params.get('cc')) !== null && _a !== void 0 ? _a : undefined,
|
|
78
|
+
subject: (_b = params.get('subject')) !== null && _b !== void 0 ? _b : undefined,
|
|
79
|
+
body: (_c = params.get('body')) !== null && _c !== void 0 ? _c : undefined
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
UrlUtils.parseMailto = parseMailto;
|
|
83
|
+
function parseTel(tel) {
|
|
84
|
+
// throw if it's not a tel link
|
|
85
|
+
const prefix = 'tel:';
|
|
86
|
+
if (!tel.startsWith(prefix)) {
|
|
87
|
+
throw new errors_1.ArgumentError(`Invalid "tel:" link "${tel}"`);
|
|
88
|
+
}
|
|
89
|
+
// return number
|
|
90
|
+
return tel.substring(prefix.length);
|
|
91
|
+
}
|
|
92
|
+
UrlUtils.parseTel = parseTel;
|
|
93
|
+
const relativeUrlRegex = /^(\/[\w\-._~:?#[\]@!$&'()*+,;=%]*)+$/;
|
|
94
|
+
function isRelativeUrl(url) {
|
|
95
|
+
return relativeUrlRegex.test(url);
|
|
96
|
+
}
|
|
97
|
+
UrlUtils.isRelativeUrl = isRelativeUrl;
|
|
98
|
+
function normalizeBase(base) {
|
|
99
|
+
const href = typeof base === 'string' ? base : base.href;
|
|
100
|
+
return href.endsWith('/')
|
|
101
|
+
? href.substring(0, href.length - 1)
|
|
102
|
+
: href;
|
|
103
|
+
}
|
|
104
|
+
UrlUtils.normalizeBase = normalizeBase;
|
|
105
|
+
function normalizePath(path) {
|
|
106
|
+
return path.startsWith('/')
|
|
107
|
+
? path.substring(1)
|
|
108
|
+
: path;
|
|
109
|
+
}
|
|
110
|
+
UrlUtils.normalizePath = normalizePath;
|
|
111
|
+
function concat(base, path) {
|
|
112
|
+
const prefix = normalizeBase(base);
|
|
113
|
+
const suffix = normalizePath(path);
|
|
114
|
+
return suffix.length > 0
|
|
115
|
+
? prefix + '/' + suffix
|
|
116
|
+
: prefix;
|
|
117
|
+
}
|
|
118
|
+
UrlUtils.concat = concat;
|
|
119
|
+
})(UrlUtils || (exports.UrlUtils = UrlUtils = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare namespace Value {
|
|
2
|
+
type TypeOf = 'undefined' | 'null' | 'boolean' | 'string' | 'number' | 'bigint' | 'symbol' | 'object' | 'array' | 'function';
|
|
3
|
+
function typeOf(value: any): TypeOf;
|
|
4
|
+
function parseString(value: any): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* A deep comparison that support arrays, objects, or basic value types.
|
|
7
|
+
* @param lhs any value
|
|
8
|
+
* @param rhs another value
|
|
9
|
+
*/
|
|
10
|
+
function equals(lhs: any, rhs: any): boolean;
|
|
11
|
+
function isDefined<T>(value: T | undefined | null): value is T;
|
|
12
|
+
function isObject(value: any): value is object;
|
|
13
|
+
function isDate(value: any): value is Date;
|
|
14
|
+
function isFormData(value: any): value is FormData;
|
|
15
|
+
function isPhoneNumberLink(value: string): boolean;
|
|
16
|
+
function isPhoneNumber(value: string): boolean;
|
|
17
|
+
function isEmailLink(value: string): boolean;
|
|
18
|
+
function isEmail(value: string): boolean;
|
|
19
|
+
function isUri(value: string): boolean;
|
|
20
|
+
const foreverPromise: Promise<unknown>;
|
|
21
|
+
function isPromise<T = any>(value: any): value is Promise<T>;
|
|
22
|
+
function uuid(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Value = void 0;
|
|
40
|
+
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
41
|
+
const UUID = __importStar(require("uuid"));
|
|
42
|
+
// namespace
|
|
43
|
+
var Value;
|
|
44
|
+
(function (Value) {
|
|
45
|
+
function typeOf(value) {
|
|
46
|
+
const rawType = typeof value;
|
|
47
|
+
switch (rawType) {
|
|
48
|
+
case 'object':
|
|
49
|
+
return value === null
|
|
50
|
+
? 'null'
|
|
51
|
+
: Array.isArray(value)
|
|
52
|
+
? 'array'
|
|
53
|
+
: 'object';
|
|
54
|
+
default:
|
|
55
|
+
return rawType;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
Value.typeOf = typeOf;
|
|
59
|
+
function parseString(value) {
|
|
60
|
+
return typeOf(value) === 'string'
|
|
61
|
+
? value
|
|
62
|
+
: undefined;
|
|
63
|
+
}
|
|
64
|
+
Value.parseString = parseString;
|
|
65
|
+
/**
|
|
66
|
+
* A deep comparison that support arrays, objects, or basic value types.
|
|
67
|
+
* @param lhs any value
|
|
68
|
+
* @param rhs another value
|
|
69
|
+
*/
|
|
70
|
+
function equals(lhs, rhs) {
|
|
71
|
+
return (0, fast_deep_equal_1.default)(lhs, rhs);
|
|
72
|
+
}
|
|
73
|
+
Value.equals = equals;
|
|
74
|
+
// type guards
|
|
75
|
+
function isDefined(value) {
|
|
76
|
+
return value !== undefined && value !== null;
|
|
77
|
+
}
|
|
78
|
+
Value.isDefined = isDefined;
|
|
79
|
+
function isObject(value) {
|
|
80
|
+
return typeOf(value) === 'object';
|
|
81
|
+
}
|
|
82
|
+
Value.isObject = isObject;
|
|
83
|
+
function isDate(value) {
|
|
84
|
+
return value && Object.prototype.toString.call(value) === '[object Date]';
|
|
85
|
+
}
|
|
86
|
+
Value.isDate = isDate;
|
|
87
|
+
function isFormData(value) {
|
|
88
|
+
return value && Object.prototype.toString.call(value) === '[object FormData]';
|
|
89
|
+
}
|
|
90
|
+
Value.isFormData = isFormData;
|
|
91
|
+
function isPhoneNumberLink(value) {
|
|
92
|
+
return /^tel:(?=(?:\D*\d){7,15}\D*$)[\d\s+\-\\]+$/.test(value);
|
|
93
|
+
}
|
|
94
|
+
Value.isPhoneNumberLink = isPhoneNumberLink;
|
|
95
|
+
function isPhoneNumber(value) {
|
|
96
|
+
return /^(?=(?:\D*\d){7,15}\D*$)[\d\s+\-\\]+$/.test(value);
|
|
97
|
+
}
|
|
98
|
+
Value.isPhoneNumber = isPhoneNumber;
|
|
99
|
+
function isEmailLink(value) {
|
|
100
|
+
return /^mailto:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(\?subject=[\w\d%]+)?$/.test(value);
|
|
101
|
+
}
|
|
102
|
+
Value.isEmailLink = isEmailLink;
|
|
103
|
+
function isEmail(value) {
|
|
104
|
+
return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value);
|
|
105
|
+
}
|
|
106
|
+
Value.isEmail = isEmail;
|
|
107
|
+
function isUri(value) {
|
|
108
|
+
return /^((https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w\-._~:/?#[\]@!$&'()*+,;=%]*)?)|(\/[\w\-._~:/?#[\]@!$&'()*+,;=%]*)$/.test(value);
|
|
109
|
+
}
|
|
110
|
+
Value.isUri = isUri;
|
|
111
|
+
Value.foreverPromise = new Promise(() => { });
|
|
112
|
+
function isPromise(value) {
|
|
113
|
+
return value
|
|
114
|
+
&& 'then' in value
|
|
115
|
+
&& typeof value.then === 'function';
|
|
116
|
+
}
|
|
117
|
+
Value.isPromise = isPromise;
|
|
118
|
+
function uuid() {
|
|
119
|
+
return UUID.v7();
|
|
120
|
+
}
|
|
121
|
+
Value.uuid = uuid;
|
|
122
|
+
})(Value || (exports.Value = Value = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './ArrayUtils';
|
|
2
|
+
export * from './ByteSize';
|
|
3
|
+
export * from './DateUtils';
|
|
4
|
+
export * from './Deferral';
|
|
5
|
+
export * from './Duration';
|
|
6
|
+
export * from './Fn';
|
|
7
|
+
export * from './isDefined';
|
|
8
|
+
export * from './ObjectUtils';
|
|
9
|
+
export * from './Random';
|
|
10
|
+
export * from './StringUtils';
|
|
11
|
+
export * from './UrlUtils';
|
|
12
|
+
export * from './Value';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ArrayUtils"), exports);
|
|
18
|
+
__exportStar(require("./ByteSize"), exports);
|
|
19
|
+
__exportStar(require("./DateUtils"), exports);
|
|
20
|
+
__exportStar(require("./Deferral"), exports);
|
|
21
|
+
__exportStar(require("./Duration"), exports);
|
|
22
|
+
__exportStar(require("./Fn"), exports);
|
|
23
|
+
__exportStar(require("./isDefined"), exports);
|
|
24
|
+
__exportStar(require("./ObjectUtils"), exports);
|
|
25
|
+
__exportStar(require("./Random"), exports);
|
|
26
|
+
__exportStar(require("./StringUtils"), exports);
|
|
27
|
+
__exportStar(require("./UrlUtils"), exports);
|
|
28
|
+
__exportStar(require("./Value"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDefinedStrict<T>(value: T | null | undefined): value is T;
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nascentdigital/funnel-core",
|
|
3
|
+
"version": "4.4.4",
|
|
4
|
+
"repository": {
|
|
5
|
+
"url": "https://github.com/nascentdigital/funnel.git",
|
|
6
|
+
"directory": "libs/core"
|
|
7
|
+
},
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.0.0"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -P tsconfig.build.json",
|
|
21
|
+
"clean": "rimraf -I dist",
|
|
22
|
+
"test": "jest"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@lexical/extension": "0.37.0",
|
|
26
|
+
"@lexical/link": "0.37.0",
|
|
27
|
+
"@lexical/list": "0.37.0",
|
|
28
|
+
"@lexical/react": "0.37.0",
|
|
29
|
+
"@lexical/rich-text": "0.37.0",
|
|
30
|
+
"@lexical/selection": "0.37.0",
|
|
31
|
+
"lexical": "0.37.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@nodable/flexible-xml-parser": "^1",
|
|
35
|
+
"blurhash": "^2",
|
|
36
|
+
"byte-size": "^9",
|
|
37
|
+
"clone-deep": "^4",
|
|
38
|
+
"css.escape": "^1",
|
|
39
|
+
"date-fns": "^4",
|
|
40
|
+
"date-fns-tz": "^3",
|
|
41
|
+
"fast-deep-equal": "^3",
|
|
42
|
+
"fast-xml-parser": "^5",
|
|
43
|
+
"lexorank": "^1.0.5",
|
|
44
|
+
"ms": "^3.0.0-canary.1",
|
|
45
|
+
"rxjs": "^7",
|
|
46
|
+
"seedrandom": "^3",
|
|
47
|
+
"to-space-case": "^1",
|
|
48
|
+
"uuid": "^11",
|
|
49
|
+
"zod": "^3"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@tsd/typescript": "^5.8.3",
|
|
53
|
+
"@types/byte-size": "^8",
|
|
54
|
+
"@types/clone-deep": "^4",
|
|
55
|
+
"@types/css.escape": "^1",
|
|
56
|
+
"@types/jest": "^29.5.14",
|
|
57
|
+
"@types/seedrandom": "^3",
|
|
58
|
+
"@types/to-space-case": "^1",
|
|
59
|
+
"jest": "^29.7.0",
|
|
60
|
+
"jest-tsd": "^0.2.2",
|
|
61
|
+
"ts-jest": "^29.3.2"
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "debc0f359106c88e8444638236f7ed7a4f77ec5a"
|
|
64
|
+
}
|