@beabee/beabee-common 0.0.2 → 0.20.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/cjs/data/callout-component-base-type.cjs +35 -0
- package/dist/cjs/data/callout-component-input-selectable-types.cjs +32 -0
- package/dist/cjs/data/callout-component-input-text-types.cjs +32 -0
- package/dist/cjs/data/callout-component-input-types.cjs +46 -0
- package/dist/cjs/data/callout-component-nestable-types.cjs +33 -0
- package/dist/cjs/data/callout-component-type.cjs +50 -0
- package/dist/cjs/data/callout-component-types.cjs +35 -0
- package/dist/cjs/data/contribution-period.cjs +32 -0
- package/dist/cjs/data/contribution-type.cjs +34 -0
- package/dist/cjs/data/index.cjs +48 -0
- package/dist/cjs/data/item-status.cjs +34 -0
- package/dist/cjs/data/membership-status.cjs +34 -0
- package/dist/cjs/data/newsletter-status.cjs +35 -0
- package/dist/cjs/data/payment-method.cjs +34 -0
- package/dist/cjs/data/payment-status.cjs +34 -0
- package/dist/cjs/error/InvalidRule.cjs +35 -0
- package/dist/cjs/error/index.cjs +22 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/search/api-keys.cjs +35 -0
- package/dist/cjs/search/callouts.cjs +131 -0
- package/dist/cjs/search/contacts.cjs +105 -0
- package/dist/cjs/search/index.cjs +32 -0
- package/dist/cjs/search/notices.cjs +61 -0
- package/dist/cjs/search/operators.cjs +89 -0
- package/dist/cjs/search/payments.cjs +51 -0
- package/dist/cjs/types/api-key-filter-name.cjs +16 -0
- package/dist/cjs/types/array-filter-args.cjs +16 -0
- package/dist/cjs/types/base-filter-args.cjs +16 -0
- package/dist/cjs/types/base-validated-rule.cjs +16 -0
- package/dist/cjs/types/callout-component-base-input-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-base-input-selectable-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-base-input-text-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-base-map.cjs +16 -0
- package/dist/cjs/types/callout-component-base-nestable-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-base-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-base-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-content-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-address-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-address-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-checkbox-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-checkbox-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-currency-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-currency-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-date-time-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-date-time-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-email-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-email-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-file-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-file-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-number-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-number-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-phone-number-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-phone-number-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-select-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-select-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-selectable-radio-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-selectable-radio-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-selectable-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-selectable-selectboxes-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-selectable-selectboxes-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-signature-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-signature-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-text-area-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-text-field-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-text-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-text-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-time-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-time-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-input-url-rules.cjs +16 -0
- package/dist/cjs/types/callout-component-input-url-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-map.cjs +16 -0
- package/dist/cjs/types/callout-component-nestable-panel-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-nestable-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-nestable-tabs-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-nestable-well-schema.cjs +16 -0
- package/dist/cjs/types/callout-component-schema.cjs +16 -0
- package/dist/cjs/types/callout-filter-name.cjs +16 -0
- package/dist/cjs/types/callout-form-schema.cjs +16 -0
- package/dist/cjs/types/callout-navigation-schema.cjs +16 -0
- package/dist/cjs/types/callout-response-answer-address.cjs +16 -0
- package/dist/cjs/types/callout-response-answer-file-upload.cjs +16 -0
- package/dist/cjs/types/callout-response-answer.cjs +16 -0
- package/dist/cjs/types/callout-response-answers-nestable.cjs +16 -0
- package/dist/cjs/types/callout-response-answers-slide.cjs +16 -0
- package/dist/cjs/types/callout-response-comment-filter-name.cjs +16 -0
- package/dist/cjs/types/callout-response-filter-name.cjs +16 -0
- package/dist/cjs/types/callout-slide-schema.cjs +16 -0
- package/dist/cjs/types/callout-tag-filter-name.cjs +16 -0
- package/dist/cjs/types/date-unit.cjs +16 -0
- package/dist/cjs/types/duration.cjs +16 -0
- package/dist/cjs/types/enum-filter-args.cjs +16 -0
- package/dist/cjs/types/feeable.cjs +16 -0
- package/dist/cjs/types/filter-args.cjs +16 -0
- package/dist/cjs/types/filter-type.cjs +16 -0
- package/dist/cjs/types/filters.cjs +16 -0
- package/dist/cjs/types/index.cjs +208 -0
- package/dist/cjs/types/notice-filter-name.cjs +16 -0
- package/dist/cjs/types/operators-by-type.cjs +16 -0
- package/dist/cjs/types/other-filter-args.cjs +16 -0
- package/dist/cjs/types/paginated-query.cjs +16 -0
- package/dist/cjs/types/paginated.cjs +16 -0
- package/dist/cjs/types/payment-filter-name.cjs +16 -0
- package/dist/cjs/types/role-type.cjs +16 -0
- package/dist/cjs/types/rule-group.cjs +16 -0
- package/dist/cjs/types/rule-operator.cjs +16 -0
- package/dist/cjs/types/rule-opperator-params.cjs +16 -0
- package/dist/cjs/types/rule-value.cjs +16 -0
- package/dist/cjs/types/rule.cjs +16 -0
- package/dist/cjs/types/stripe-fee-country.cjs +16 -0
- package/dist/cjs/types/text-case.cjs +16 -0
- package/dist/cjs/types/unit-matches.cjs +16 -0
- package/dist/cjs/types/validated-boolean-rule.cjs +16 -0
- package/dist/cjs/types/validated-number-rule.cjs +16 -0
- package/dist/cjs/types/validated-rule-group.cjs +16 -0
- package/dist/cjs/types/validated-rule-value.cjs +16 -0
- package/dist/cjs/types/validated-rule.cjs +16 -0
- package/dist/cjs/types/validated-string-rule.cjs +16 -0
- package/dist/cjs/types/validator-callout-component.cjs +16 -0
- package/dist/cjs/types/validator.cjs +16 -0
- package/dist/cjs/utils/callouts.cjs +175 -0
- package/dist/cjs/utils/conversions.cjs +53 -0
- package/dist/cjs/utils/date.cjs +104 -0
- package/dist/cjs/utils/index.cjs +34 -0
- package/dist/cjs/utils/payments.cjs +53 -0
- package/dist/cjs/utils/rules.cjs +109 -0
- package/dist/cjs/utils/slug.cjs +834 -0
- package/dist/cjs/utils/validations.cjs +177 -0
- package/dist/cjs/validators/callout-component-content.validator.cjs +30 -0
- package/dist/cjs/validators/callout-component-input-address.validator.cjs +36 -0
- package/dist/cjs/validators/callout-component-input-checkbox.validator.cjs +34 -0
- package/dist/cjs/validators/callout-component-input-currency.validator.cjs +35 -0
- package/dist/cjs/validators/callout-component-input-date-time.validator.cjs +38 -0
- package/dist/cjs/validators/callout-component-input-email.validator.cjs +39 -0
- package/dist/cjs/validators/callout-component-input-file.validator.cjs +35 -0
- package/dist/cjs/validators/callout-component-input-number.validator.cjs +38 -0
- package/dist/cjs/validators/callout-component-input-phone-number.validator.cjs +35 -0
- package/dist/cjs/validators/callout-component-input-select.validator.cjs +40 -0
- package/dist/cjs/validators/callout-component-input-selectable.validator.cjs +43 -0
- package/dist/cjs/validators/callout-component-input-signature.validator.cjs +32 -0
- package/dist/cjs/validators/callout-component-input-text.validator.cjs +53 -0
- package/dist/cjs/validators/callout-component-input-time.validator.cjs +36 -0
- package/dist/cjs/validators/callout-component-input-url.validator.cjs +39 -0
- package/dist/cjs/validators/callout-component.validator.cjs +104 -0
- package/dist/cjs/validators/index.cjs +52 -0
- package/dist/esm/data/callout-component-base-type.js +11 -0
- package/dist/esm/data/callout-component-input-selectable-types.js +8 -0
- package/dist/esm/data/callout-component-input-text-types.js +8 -0
- package/dist/esm/data/callout-component-input-types.js +22 -0
- package/dist/esm/data/callout-component-nestable-types.js +9 -0
- package/dist/esm/data/callout-component-type.js +26 -0
- package/dist/esm/data/callout-component-types.js +11 -0
- package/dist/esm/data/contribution-period.js +8 -0
- package/dist/esm/data/contribution-type.js +10 -0
- package/dist/esm/data/index.js +14 -0
- package/dist/esm/data/item-status.js +10 -0
- package/dist/esm/data/membership-status.js +10 -0
- package/dist/esm/data/newsletter-status.js +11 -0
- package/dist/esm/data/payment-method.js +10 -0
- package/dist/esm/data/payment-status.js +10 -0
- package/dist/esm/error/InvalidRule.js +11 -0
- package/dist/esm/error/index.js +1 -0
- package/dist/esm/index.js +5 -3
- package/dist/esm/search/api-keys.js +11 -0
- package/dist/esm/search/callouts.js +104 -0
- package/dist/esm/search/contacts.js +84 -0
- package/dist/esm/search/index.js +6 -0
- package/dist/esm/search/notices.js +37 -0
- package/dist/esm/search/operators.js +62 -0
- package/dist/esm/search/payments.js +27 -0
- package/dist/esm/types/api-key-filter-name.js +0 -0
- package/dist/esm/types/array-filter-args.js +0 -0
- package/dist/esm/types/base-filter-args.js +0 -0
- package/dist/esm/types/base-validated-rule.js +0 -0
- package/dist/esm/types/callout-component-base-input-schema.js +0 -0
- package/dist/esm/types/callout-component-base-input-selectable-schema.js +0 -0
- package/dist/esm/types/callout-component-base-input-text-schema.js +0 -0
- package/dist/esm/types/callout-component-base-map.js +0 -0
- package/dist/esm/types/callout-component-base-nestable-schema.js +0 -0
- package/dist/esm/types/callout-component-base-rules.js +0 -0
- package/dist/esm/types/callout-component-base-schema.js +0 -0
- package/dist/esm/types/callout-component-content-schema.js +0 -0
- package/dist/esm/types/callout-component-input-address-rules.js +0 -0
- package/dist/esm/types/callout-component-input-address-schema.js +0 -0
- package/dist/esm/types/callout-component-input-checkbox-rules.js +0 -0
- package/dist/esm/types/callout-component-input-checkbox-schema.js +0 -0
- package/dist/esm/types/callout-component-input-currency-rules.js +0 -0
- package/dist/esm/types/callout-component-input-currency-schema.js +0 -0
- package/dist/esm/types/callout-component-input-date-time-rules.js +0 -0
- package/dist/esm/types/callout-component-input-date-time-schema.js +0 -0
- package/dist/esm/types/callout-component-input-email-rules.js +0 -0
- package/dist/esm/types/callout-component-input-email-schema.js +0 -0
- package/dist/esm/types/callout-component-input-file-rules.js +0 -0
- package/dist/esm/types/callout-component-input-file-schema.js +0 -0
- package/dist/esm/types/callout-component-input-number-rules.js +0 -0
- package/dist/esm/types/callout-component-input-number-schema.js +0 -0
- package/dist/esm/types/callout-component-input-phone-number-rules.js +0 -0
- package/dist/esm/types/callout-component-input-phone-number-schema.js +0 -0
- package/dist/esm/types/callout-component-input-schema.js +0 -0
- package/dist/esm/types/callout-component-input-select-rules.js +0 -0
- package/dist/esm/types/callout-component-input-select-schema.js +0 -0
- package/dist/esm/types/callout-component-input-selectable-radio-rules.js +0 -0
- package/dist/esm/types/callout-component-input-selectable-radio-schema.js +0 -0
- package/dist/esm/types/callout-component-input-selectable-schema.js +0 -0
- package/dist/esm/types/callout-component-input-selectable-selectboxes-rules.js +0 -0
- package/dist/esm/types/callout-component-input-selectable-selectboxes-schema.js +0 -0
- package/dist/esm/types/callout-component-input-signature-rules.js +0 -0
- package/dist/esm/types/callout-component-input-signature-schema.js +0 -0
- package/dist/esm/types/callout-component-input-text-area-schema.js +0 -0
- package/dist/esm/types/callout-component-input-text-field-schema.js +0 -0
- package/dist/esm/types/callout-component-input-text-rules.js +0 -0
- package/dist/esm/types/callout-component-input-text-schema.js +0 -0
- package/dist/esm/types/callout-component-input-time-rules.js +0 -0
- package/dist/esm/types/callout-component-input-time-schema.js +0 -0
- package/dist/esm/types/callout-component-input-url-rules.js +0 -0
- package/dist/esm/types/callout-component-input-url-schema.js +0 -0
- package/dist/esm/types/callout-component-map.js +0 -0
- package/dist/esm/types/callout-component-nestable-panel-schema.js +0 -0
- package/dist/esm/types/callout-component-nestable-schema.js +0 -0
- package/dist/esm/types/callout-component-nestable-tabs-schema.js +0 -0
- package/dist/esm/types/callout-component-nestable-well-schema.js +0 -0
- package/dist/esm/types/callout-component-schema.js +0 -0
- package/dist/esm/types/callout-filter-name.js +0 -0
- package/dist/esm/types/callout-form-schema.js +0 -0
- package/dist/esm/types/callout-navigation-schema.js +0 -0
- package/dist/esm/types/callout-response-answer-address.js +0 -0
- package/dist/esm/types/callout-response-answer-file-upload.js +0 -0
- package/dist/esm/types/callout-response-answer.js +0 -0
- package/dist/esm/types/callout-response-answers-nestable.js +0 -0
- package/dist/esm/types/callout-response-answers-slide.js +0 -0
- package/dist/esm/types/callout-response-comment-filter-name.js +0 -0
- package/dist/esm/types/callout-response-filter-name.js +0 -0
- package/dist/esm/types/callout-slide-schema.js +0 -0
- package/dist/esm/types/callout-tag-filter-name.js +0 -0
- package/dist/esm/types/date-unit.js +0 -0
- package/dist/esm/types/duration.js +0 -0
- package/dist/esm/types/enum-filter-args.js +0 -0
- package/dist/esm/types/feeable.js +0 -0
- package/dist/esm/types/filter-args.js +0 -0
- package/dist/esm/types/filter-type.js +0 -0
- package/dist/esm/types/filters.js +0 -0
- package/dist/esm/types/index.js +94 -0
- package/dist/esm/types/notice-filter-name.js +0 -0
- package/dist/esm/types/operators-by-type.js +0 -0
- package/dist/esm/types/other-filter-args.js +0 -0
- package/dist/esm/types/paginated-query.js +0 -0
- package/dist/esm/types/paginated.js +0 -0
- package/dist/esm/types/payment-filter-name.js +0 -0
- package/dist/esm/types/role-type.js +0 -0
- package/dist/esm/types/rule-group.js +0 -0
- package/dist/esm/types/rule-operator.js +0 -0
- package/dist/esm/types/rule-opperator-params.js +0 -0
- package/dist/esm/types/rule-value.js +0 -0
- package/dist/esm/types/rule.js +0 -0
- package/dist/esm/types/stripe-fee-country.js +0 -0
- package/dist/esm/types/text-case.js +0 -0
- package/dist/esm/types/unit-matches.js +0 -0
- package/dist/esm/types/validated-boolean-rule.js +0 -0
- package/dist/esm/types/validated-number-rule.js +0 -0
- package/dist/esm/types/validated-rule-group.js +0 -0
- package/dist/esm/types/validated-rule-value.js +0 -0
- package/dist/esm/types/validated-rule.js +0 -0
- package/dist/esm/types/validated-string-rule.js +0 -0
- package/dist/esm/types/validator-callout-component.js +0 -0
- package/dist/esm/types/validator.js +0 -0
- package/dist/esm/utils/callouts.js +149 -0
- package/dist/esm/utils/conversions.js +28 -0
- package/dist/esm/utils/date.js +84 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/payments.js +29 -0
- package/dist/esm/utils/rules.js +80 -0
- package/dist/esm/utils/slug.js +810 -0
- package/dist/esm/utils/validations.js +138 -0
- package/dist/esm/validators/callout-component-content.validator.js +6 -0
- package/dist/esm/validators/callout-component-input-address.validator.js +11 -0
- package/dist/esm/validators/callout-component-input-checkbox.validator.js +9 -0
- package/dist/esm/validators/callout-component-input-currency.validator.js +10 -0
- package/dist/esm/validators/callout-component-input-date-time.validator.js +13 -0
- package/dist/esm/validators/callout-component-input-email.validator.js +14 -0
- package/dist/esm/validators/callout-component-input-file.validator.js +10 -0
- package/dist/esm/validators/callout-component-input-number.validator.js +13 -0
- package/dist/esm/validators/callout-component-input-phone-number.validator.js +10 -0
- package/dist/esm/validators/callout-component-input-select.validator.js +15 -0
- package/dist/esm/validators/callout-component-input-selectable.validator.js +18 -0
- package/dist/esm/validators/callout-component-input-signature.validator.js +8 -0
- package/dist/esm/validators/callout-component-input-text.validator.js +28 -0
- package/dist/esm/validators/callout-component-input-time.validator.js +11 -0
- package/dist/esm/validators/callout-component-input-url.validator.js +14 -0
- package/dist/esm/validators/callout-component.validator.js +79 -0
- package/dist/esm/validators/index.js +16 -0
- package/dist/types/data/callout-component-base-type.d.ts +8 -0
- package/dist/types/data/callout-component-input-selectable-types.d.ts +3 -0
- package/dist/types/data/callout-component-input-text-types.d.ts +3 -0
- package/dist/types/data/callout-component-input-types.d.ts +3 -0
- package/dist/types/data/callout-component-nestable-types.d.ts +3 -0
- package/dist/types/data/callout-component-type.d.ts +23 -0
- package/dist/types/data/callout-component-types.d.ts +3 -0
- package/dist/types/data/contribution-period.d.ts +4 -0
- package/dist/types/data/contribution-type.d.ts +6 -0
- package/dist/types/data/index.d.ts +14 -0
- package/dist/types/data/item-status.d.ts +6 -0
- package/dist/types/data/membership-status.d.ts +6 -0
- package/dist/types/data/newsletter-status.d.ts +7 -0
- package/dist/types/data/payment-method.d.ts +6 -0
- package/dist/types/data/payment-status.d.ts +6 -0
- package/dist/types/error/InvalidRule.d.ts +6 -0
- package/dist/types/error/index.d.ts +1 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/search/api-keys.d.ts +8 -0
- package/dist/types/search/callouts.d.ts +93 -0
- package/dist/types/search/contacts.d.ts +66 -0
- package/dist/types/search/index.d.ts +6 -0
- package/dist/types/search/notices.d.ts +29 -0
- package/dist/types/search/operators.d.ts +128 -0
- package/dist/types/search/payments.d.ts +19 -0
- package/dist/types/types/api-key-filter-name.d.ts +2 -0
- package/dist/types/types/array-filter-args.d.ts +5 -0
- package/dist/types/types/base-filter-args.d.ts +5 -0
- package/dist/types/types/base-validated-rule.d.ts +9 -0
- package/dist/types/types/callout-component-base-input-schema.d.ts +9 -0
- package/dist/types/types/callout-component-base-input-selectable-schema.d.ts +11 -0
- package/dist/types/types/callout-component-base-input-text-schema.d.ts +12 -0
- package/dist/types/types/callout-component-base-map.d.ts +16 -0
- package/dist/types/types/callout-component-base-nestable-schema.d.ts +7 -0
- package/dist/types/types/callout-component-base-rules.d.ts +6 -0
- package/dist/types/types/callout-component-base-schema.d.ts +22 -0
- package/dist/types/types/callout-component-content-schema.d.ts +5 -0
- package/dist/types/types/callout-component-input-address-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-address-schema.d.ts +7 -0
- package/dist/types/types/callout-component-input-checkbox-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-checkbox-schema.d.ts +11 -0
- package/dist/types/types/callout-component-input-currency-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-currency-schema.d.ts +17 -0
- package/dist/types/types/callout-component-input-date-time-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-date-time-schema.d.ts +39 -0
- package/dist/types/types/callout-component-input-email-rules.d.ts +9 -0
- package/dist/types/types/callout-component-input-email-schema.d.ts +11 -0
- package/dist/types/types/callout-component-input-file-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-file-schema.d.ts +19 -0
- package/dist/types/types/callout-component-input-number-rules.d.ts +9 -0
- package/dist/types/types/callout-component-input-number-schema.d.ts +17 -0
- package/dist/types/types/callout-component-input-phone-number-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-phone-number-schema.d.ts +7 -0
- package/dist/types/types/callout-component-input-schema.d.ts +3 -0
- package/dist/types/types/callout-component-input-select-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-select-schema.d.ts +15 -0
- package/dist/types/types/callout-component-input-selectable-radio-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-selectable-radio-schema.d.ts +6 -0
- package/dist/types/types/callout-component-input-selectable-schema.d.ts +3 -0
- package/dist/types/types/callout-component-input-selectable-selectboxes-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-selectable-selectboxes-schema.d.ts +6 -0
- package/dist/types/types/callout-component-input-signature-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-signature-schema.d.ts +7 -0
- package/dist/types/types/callout-component-input-text-area-schema.d.ts +5 -0
- package/dist/types/types/callout-component-input-text-field-schema.d.ts +5 -0
- package/dist/types/types/callout-component-input-text-rules.d.ts +13 -0
- package/dist/types/types/callout-component-input-text-schema.d.ts +3 -0
- package/dist/types/types/callout-component-input-time-rules.d.ts +2 -0
- package/dist/types/types/callout-component-input-time-schema.d.ts +9 -0
- package/dist/types/types/callout-component-input-url-rules.d.ts +9 -0
- package/dist/types/types/callout-component-input-url-schema.d.ts +11 -0
- package/dist/types/types/callout-component-map.d.ts +31 -0
- package/dist/types/types/callout-component-nestable-panel-schema.d.ts +5 -0
- package/dist/types/types/callout-component-nestable-schema.d.ts +2 -0
- package/dist/types/types/callout-component-nestable-tabs-schema.d.ts +5 -0
- package/dist/types/types/callout-component-nestable-well-schema.d.ts +5 -0
- package/dist/types/types/callout-component-schema.d.ts +3 -0
- package/dist/types/types/callout-filter-name.d.ts +2 -0
- package/dist/types/types/callout-form-schema.d.ts +4 -0
- package/dist/types/types/callout-navigation-schema.d.ts +6 -0
- package/dist/types/types/callout-response-answer-address.d.ts +9 -0
- package/dist/types/types/callout-response-answer-file-upload.d.ts +3 -0
- package/dist/types/types/callout-response-answer.d.ts +2 -0
- package/dist/types/types/callout-response-answers-nestable.d.ts +5 -0
- package/dist/types/types/callout-response-answers-slide.d.ts +5 -0
- package/dist/types/types/callout-response-comment-filter-name.d.ts +2 -0
- package/dist/types/types/callout-response-filter-name.d.ts +2 -0
- package/dist/types/types/callout-slide-schema.d.ts +7 -0
- package/dist/types/types/callout-tag-filter-name.d.ts +2 -0
- package/dist/types/types/date-unit.d.ts +2 -0
- package/dist/types/types/duration.d.ts +1 -0
- package/dist/types/types/enum-filter-args.d.ts +5 -0
- package/dist/types/types/feeable.d.ts +6 -0
- package/dist/types/types/filter-args.d.ts +2 -0
- package/dist/types/types/filter-type.d.ts +1 -0
- package/dist/types/types/filters.d.ts +2 -0
- package/dist/types/types/index.d.ts +94 -0
- package/dist/types/types/notice-filter-name.d.ts +2 -0
- package/dist/types/types/operators-by-type.d.ts +2 -0
- package/dist/types/types/other-filter-args.d.ts +4 -0
- package/dist/types/types/paginated-query.d.ts +8 -0
- package/dist/types/types/paginated.d.ts +6 -0
- package/dist/types/types/payment-filter-name.d.ts +2 -0
- package/dist/types/types/role-type.d.ts +2 -0
- package/dist/types/types/rule-group.d.ts +5 -0
- package/dist/types/types/rule-operator.d.ts +2 -0
- package/dist/types/types/rule-opperator-params.d.ts +3 -0
- package/dist/types/types/rule-value.d.ts +1 -0
- package/dist/types/types/rule.d.ts +6 -0
- package/dist/types/types/stripe-fee-country.d.ts +1 -0
- package/dist/types/types/text-case.d.ts +1 -0
- package/dist/types/types/unit-matches.d.ts +2 -0
- package/dist/types/types/validated-boolean-rule.d.ts +2 -0
- package/dist/types/types/validated-number-rule.d.ts +2 -0
- package/dist/types/types/validated-rule-group.d.ts +5 -0
- package/dist/types/types/validated-rule-value.d.ts +2 -0
- package/dist/types/types/validated-rule.d.ts +2 -0
- package/dist/types/types/validated-string-rule.d.ts +2 -0
- package/dist/types/types/validator-callout-component.d.ts +2 -0
- package/dist/types/types/validator.d.ts +1 -0
- package/dist/types/utils/callouts.d.ts +30 -0
- package/dist/types/utils/conversions.d.ts +14 -0
- package/dist/types/utils/date.d.ts +8 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/payments.d.ts +2 -0
- package/dist/types/utils/rules.d.ts +4 -0
- package/dist/types/utils/slug.d.ts +16 -0
- package/dist/types/utils/validations.d.ts +90 -0
- package/dist/types/validators/callout-component-content.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-address.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-checkbox.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-currency.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-date-time.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-email.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-file.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-number.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-phone-number.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-select.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-selectable.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-signature.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-text.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-time.validator.d.ts +2 -0
- package/dist/types/validators/callout-component-input-url.validator.d.ts +2 -0
- package/dist/types/validators/callout-component.validator.d.ts +3 -0
- package/dist/types/validators/index.d.ts +16 -0
- package/package.json +39 -9
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -7
- package/dist/esm/index.d.ts +0 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { slug } from "./slug.js";
|
|
2
|
+
import { ContributionPeriod } from "../data/index.js";
|
|
3
|
+
const isAngle = (value, span = 180) => {
|
|
4
|
+
return typeof value === "number" && value >= span * -1 && value <= span;
|
|
5
|
+
};
|
|
6
|
+
const isEmail = (value) => {
|
|
7
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
11
|
+
return emailRegex.test(value);
|
|
12
|
+
};
|
|
13
|
+
const isLngLat = (value) => {
|
|
14
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const [longitude, latitude] = value;
|
|
18
|
+
if (!isAngle(longitude, 180) || !isAngle(latitude, 90)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
const isMapBounds = (value) => {
|
|
24
|
+
return Array.isArray(value) && value.length === 2 && value.every(isLngLat);
|
|
25
|
+
};
|
|
26
|
+
const isPassword = (value) => {
|
|
27
|
+
return typeof value === "string" && value.length >= 8 && /[a-z]/.test(value) && /[A-Z]/.test(value) && /[0-9]/.test(value);
|
|
28
|
+
};
|
|
29
|
+
const isPeriod = (value) => {
|
|
30
|
+
return value === ContributionPeriod.Monthly || value === ContributionPeriod.Annually;
|
|
31
|
+
};
|
|
32
|
+
const isSlug = (value) => {
|
|
33
|
+
return typeof value === "string" && value === slug(value);
|
|
34
|
+
};
|
|
35
|
+
function isType(types, value) {
|
|
36
|
+
return types.includes(typeof value);
|
|
37
|
+
}
|
|
38
|
+
const isURL = (value) => {
|
|
39
|
+
if (typeof value !== "string" || !value.length) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const urlRegex = /^(https?:\/\/)([\da-z\-]+\.)+[a-z]{2,6}(:[0-9]{1,5})?([\/\w \.-]*)*\/?(\?[a-zA-Z0-9=&]*)?$/;
|
|
43
|
+
return urlRegex.test(value);
|
|
44
|
+
};
|
|
45
|
+
const isNumber = (value) => {
|
|
46
|
+
return typeof value === "number" && !isNaN(value);
|
|
47
|
+
};
|
|
48
|
+
const isAmountOfMoney = (value) => {
|
|
49
|
+
if (!isNumber(value) || value < 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const decimalPart = value.toString().split(".")[1];
|
|
53
|
+
if (decimalPart && decimalPart.length > 2) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
const isPhoneNumber = (value) => {
|
|
59
|
+
if (typeof value !== "string" || !value.length) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (value.length > 15 || value.length < 5) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const phoneRegex = /^(\+?[0-9])\d*$/;
|
|
66
|
+
return phoneRegex.test(value);
|
|
67
|
+
};
|
|
68
|
+
const isValidPayFee = (value, amount, period) => {
|
|
69
|
+
if (typeof value !== "boolean" || typeof amount !== "number" || !isPeriod(period)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (value && period === ContributionPeriod.Annually) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!value && period === ContributionPeriod.Monthly && amount === 1) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
const isNumberInRange = (value, min, max) => {
|
|
81
|
+
if (!isNumber(value)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (typeof min === "number") {
|
|
85
|
+
if (value < min) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (typeof max === "number") {
|
|
90
|
+
if (value > max) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
const isTextInRange = (value, minLength = 0, maxLength) => {
|
|
97
|
+
if (typeof value !== "string") {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (typeof minLength === "number" && value.length < minLength) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (typeof maxLength === "number" && value.length > maxLength) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
const isTextInWordRange = (value, minWordLength = 0, maxWordLength) => {
|
|
109
|
+
if (typeof value !== "string") {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
const words = value.length > 0 ? value.split(" ") : [];
|
|
113
|
+
if (typeof minWordLength === "number" && words.length < minWordLength) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (typeof maxWordLength === "number" && words.length > maxWordLength) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
isAmountOfMoney,
|
|
123
|
+
isAngle,
|
|
124
|
+
isEmail,
|
|
125
|
+
isLngLat,
|
|
126
|
+
isMapBounds,
|
|
127
|
+
isNumber,
|
|
128
|
+
isNumberInRange,
|
|
129
|
+
isPassword,
|
|
130
|
+
isPeriod,
|
|
131
|
+
isPhoneNumber,
|
|
132
|
+
isSlug,
|
|
133
|
+
isTextInRange,
|
|
134
|
+
isTextInWordRange,
|
|
135
|
+
isType,
|
|
136
|
+
isURL,
|
|
137
|
+
isValidPayFee
|
|
138
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const calloutComponentInputAddressValidator = (schema, answer) => {
|
|
2
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
throw new Error(
|
|
6
|
+
`[calloutComponentInputAddressValidator] Not implemented yet`
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
calloutComponentInputAddressValidator
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isAmountOfMoney } from "../utils/index.js";
|
|
2
|
+
const calloutComponentInputCurrencyValidator = (schema, answer) => {
|
|
3
|
+
if (schema.validate?.required && answer === void 0) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
return isAmountOfMoney(answer);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
calloutComponentInputCurrencyValidator
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isDateBetween } from "../utils/index.js";
|
|
2
|
+
const calloutComponentInputDateTimeValidator = (schema, answer) => {
|
|
3
|
+
if (!schema.validate?.required && !answer) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (typeof answer !== "string") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return isDateBetween(answer, schema.widget.minDate, schema.widget.maxDate);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
calloutComponentInputDateTimeValidator
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isCalloutComponentOfType, isEmail } from "../utils/index.js";
|
|
2
|
+
import { CalloutComponentType } from "../data/index.js";
|
|
3
|
+
const calloutComponentInputEmailValidator = (schema, answer) => {
|
|
4
|
+
if (!isCalloutComponentOfType(schema, CalloutComponentType.INPUT_EMAIL)) {
|
|
5
|
+
throw new Error("Schema is not a email component");
|
|
6
|
+
}
|
|
7
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return isEmail(answer);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
calloutComponentInputEmailValidator
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isURL } from "../utils/index.js";
|
|
2
|
+
const calloutComponentInputFileValidator = (schema, answer) => {
|
|
3
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
return isURL(answer);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
calloutComponentInputFileValidator
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isNumber, isNumberInRange } from "../utils/index.js";
|
|
2
|
+
const calloutComponentInputNumberValidator = (schema, answer) => {
|
|
3
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (schema.validate && !isNumberInRange(answer, schema.validate.min, schema.validate.max)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return isNumber(answer);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
calloutComponentInputNumberValidator
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isPhoneNumber } from "../utils/index.js";
|
|
2
|
+
const calloutComponentInputPhoneNumberValidator = (schema, answer) => {
|
|
3
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
return isPhoneNumber(answer);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
calloutComponentInputPhoneNumberValidator
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isCalloutComponentOfType } from "../utils/index.js";
|
|
2
|
+
import { CalloutComponentType } from "../data/index.js";
|
|
3
|
+
const calloutComponentInputSelectValidator = (schema, answer) => {
|
|
4
|
+
if (!isCalloutComponentOfType(schema, CalloutComponentType.INPUT_SELECT)) {
|
|
5
|
+
throw new Error("Schema is not a select component");
|
|
6
|
+
}
|
|
7
|
+
if (!schema.validate?.required && !answer) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
const optionValue = schema.data.values.find((v) => v.value === answer);
|
|
11
|
+
return !!optionValue;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
calloutComponentInputSelectValidator
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isCalloutComponentOfBaseType } from "../utils/index.js";
|
|
2
|
+
import { CalloutComponentBaseType } from "../data/index.js";
|
|
3
|
+
const calloutComponentInputSelectableValidator = (schema, answer) => {
|
|
4
|
+
if (!isCalloutComponentOfBaseType(
|
|
5
|
+
schema,
|
|
6
|
+
CalloutComponentBaseType.INPUT_SELECTABLE
|
|
7
|
+
)) {
|
|
8
|
+
throw new Error("Schema is not a selectable component");
|
|
9
|
+
}
|
|
10
|
+
if (!schema.validate?.required && !answer) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const optionValue = schema.values.find((v) => v.value === answer);
|
|
14
|
+
return !!optionValue;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
calloutComponentInputSelectableValidator
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isTextInRange, isTextInWordRange } from "../utils/index.js";
|
|
2
|
+
const validateRules = (rules, answer) => {
|
|
3
|
+
if (!rules) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (typeof rules.pattern === "string" && rules.pattern.length && !new RegExp(rules.pattern).test(answer)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!isTextInWordRange(answer, rules.minWords, rules.maxWords)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (!isTextInRange(answer, rules.minLength, rules.maxLength)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
const calloutComponentInputTextValidator = (schema, answer) => {
|
|
18
|
+
if (!schema.validate?.required && !answer) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (typeof answer !== "string") {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return validateRules(schema?.validate, answer);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
calloutComponentInputTextValidator
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const calloutComponentInputTimeValidator = (schema, answer) => {
|
|
2
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
throw new Error(
|
|
6
|
+
`[calloutComponentInputTimeValidator] Not implemented yet`
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
calloutComponentInputTimeValidator
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isCalloutComponentOfType, isURL } from "../utils/index.js";
|
|
2
|
+
import { CalloutComponentType } from "../data/index.js";
|
|
3
|
+
const calloutComponentInputUrlValidator = (schema, answer) => {
|
|
4
|
+
if (!isCalloutComponentOfType(schema, CalloutComponentType.INPUT_URL)) {
|
|
5
|
+
throw new Error("Schema is not a url component");
|
|
6
|
+
}
|
|
7
|
+
if (!schema.validate?.required && answer === void 0) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return isURL(answer);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
calloutComponentInputUrlValidator
|
|
14
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { calloutComponentContentValidator } from "./callout-component-content.validator.js";
|
|
2
|
+
import { calloutComponentInputAddressValidator } from "./callout-component-input-address.validator.js";
|
|
3
|
+
import { calloutComponentInputCheckboxValidator } from "./callout-component-input-checkbox.validator.js";
|
|
4
|
+
import { calloutComponentInputCurrencyValidator } from "./callout-component-input-currency.validator.js";
|
|
5
|
+
import { calloutComponentInputDateTimeValidator } from "./callout-component-input-date-time.validator.js";
|
|
6
|
+
import { calloutComponentInputEmailValidator } from "./callout-component-input-email.validator.js";
|
|
7
|
+
import { calloutComponentInputFileValidator } from "./callout-component-input-file.validator.js";
|
|
8
|
+
import { calloutComponentInputNumberValidator } from "./callout-component-input-number.validator.js";
|
|
9
|
+
import { calloutComponentInputSelectValidator } from "./callout-component-input-select.validator.js";
|
|
10
|
+
import { calloutComponentInputPhoneNumberValidator } from "./callout-component-input-phone-number.validator.js";
|
|
11
|
+
import { calloutComponentInputSelectableValidator } from "./callout-component-input-selectable.validator.js";
|
|
12
|
+
import { calloutComponentInputSignatureValidator } from "./callout-component-input-signature.validator.js";
|
|
13
|
+
import { calloutComponentInputTextValidator } from "./callout-component-input-text.validator.js";
|
|
14
|
+
import { calloutComponentInputTimeValidator } from "./callout-component-input-time.validator.js";
|
|
15
|
+
import { calloutComponentInputUrlValidator } from "./callout-component-input-url.validator.js";
|
|
16
|
+
import { CalloutComponentType } from "../data/index.js";
|
|
17
|
+
const calloutComponentNestableValidator = (schema, answerMap) => {
|
|
18
|
+
let valid = true;
|
|
19
|
+
for (const component of schema.components) {
|
|
20
|
+
const answer = answerMap[component.key];
|
|
21
|
+
const answers = Array.isArray(answer) ? answer : [answer];
|
|
22
|
+
if (!answer) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`[calloutComponentNestableValidator] no answer`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
for (const _answersLevel2 of answers) {
|
|
28
|
+
const answersLevel2 = Array.isArray(_answersLevel2) ? _answersLevel2 : [_answersLevel2];
|
|
29
|
+
for (const answer2 of answersLevel2) {
|
|
30
|
+
valid = calloutComponentValidator(component, answer2) && valid;
|
|
31
|
+
if (!valid) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return valid;
|
|
38
|
+
};
|
|
39
|
+
const calloutValidatorsMap = {
|
|
40
|
+
[CalloutComponentType.CONTENT]: calloutComponentContentValidator,
|
|
41
|
+
// Input
|
|
42
|
+
[CalloutComponentType.INPUT_EMAIL]: calloutComponentInputEmailValidator,
|
|
43
|
+
[CalloutComponentType.INPUT_ADDRESS]: calloutComponentInputAddressValidator,
|
|
44
|
+
[CalloutComponentType.INPUT_CHECKBOX]: calloutComponentInputCheckboxValidator,
|
|
45
|
+
[CalloutComponentType.INPUT_CURRENCY]: calloutComponentInputCurrencyValidator,
|
|
46
|
+
[CalloutComponentType.INPUT_DATE_TIME]: calloutComponentInputDateTimeValidator,
|
|
47
|
+
[CalloutComponentType.INPUT_NUMBER]: calloutComponentInputNumberValidator,
|
|
48
|
+
[CalloutComponentType.INPUT_PHONE_NUMBER]: calloutComponentInputPhoneNumberValidator,
|
|
49
|
+
[CalloutComponentType.INPUT_SIGNATURE]: calloutComponentInputSignatureValidator,
|
|
50
|
+
[CalloutComponentType.INPUT_TIME]: calloutComponentInputTimeValidator,
|
|
51
|
+
[CalloutComponentType.INPUT_URL]: calloutComponentInputUrlValidator,
|
|
52
|
+
[CalloutComponentType.INPUT_FILE]: calloutComponentInputFileValidator,
|
|
53
|
+
[CalloutComponentType.INPUT_SELECT]: calloutComponentInputSelectValidator,
|
|
54
|
+
// Text
|
|
55
|
+
[CalloutComponentType.INPUT_TEXT_FIELD]: calloutComponentInputTextValidator,
|
|
56
|
+
[CalloutComponentType.INPUT_TEXT_AREA]: calloutComponentInputTextValidator,
|
|
57
|
+
// Selectable
|
|
58
|
+
[CalloutComponentType.INPUT_SELECTABLE_RADIO]: calloutComponentInputSelectableValidator,
|
|
59
|
+
[CalloutComponentType.INPUT_SELECTABLE_SELECTBOXES]: calloutComponentInputSelectableValidator,
|
|
60
|
+
// NESTABLE
|
|
61
|
+
[CalloutComponentType.NESTABLE_PANEL]: calloutComponentNestableValidator,
|
|
62
|
+
[CalloutComponentType.NESTABLE_WELL]: calloutComponentNestableValidator,
|
|
63
|
+
[CalloutComponentType.NESTABLE_TABS]: calloutComponentNestableValidator
|
|
64
|
+
};
|
|
65
|
+
const calloutComponentValidator = (schema, answer) => {
|
|
66
|
+
const validator = calloutValidatorsMap[schema.type];
|
|
67
|
+
if (!validator) {
|
|
68
|
+
console.error(`No validator found for ${schema.type}`);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return validator(
|
|
72
|
+
schema,
|
|
73
|
+
answer
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
calloutComponentNestableValidator,
|
|
78
|
+
calloutComponentValidator
|
|
79
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./callout-component-content.validator.js";
|
|
2
|
+
export * from "./callout-component-input-address.validator.js";
|
|
3
|
+
export * from "./callout-component-input-checkbox.validator.js";
|
|
4
|
+
export * from "./callout-component-input-currency.validator.js";
|
|
5
|
+
export * from "./callout-component-input-date-time.validator.js";
|
|
6
|
+
export * from "./callout-component-input-email.validator.js";
|
|
7
|
+
export * from "./callout-component-input-file.validator.js";
|
|
8
|
+
export * from "./callout-component-input-number.validator.js";
|
|
9
|
+
export * from "./callout-component-input-phone-number.validator.js";
|
|
10
|
+
export * from "./callout-component-input-select.validator.js";
|
|
11
|
+
export * from "./callout-component-input-selectable.validator.js";
|
|
12
|
+
export * from "./callout-component-input-signature.validator.js";
|
|
13
|
+
export * from "./callout-component-input-text.validator.js";
|
|
14
|
+
export * from "./callout-component-input-time.validator.js";
|
|
15
|
+
export * from "./callout-component-input-url.validator.js";
|
|
16
|
+
export * from "./callout-component.validator.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Enumeration of all possible callout component types */
|
|
2
|
+
export declare enum CalloutComponentType {
|
|
3
|
+
CONTENT = "content",
|
|
4
|
+
INPUT_ADDRESS = "address",
|
|
5
|
+
INPUT_CHECKBOX = "checkbox",
|
|
6
|
+
INPUT_CURRENCY = "currency",
|
|
7
|
+
INPUT_DATE_TIME = "datetime",
|
|
8
|
+
INPUT_EMAIL = "email",
|
|
9
|
+
INPUT_FILE = "file",
|
|
10
|
+
INPUT_NUMBER = "number",
|
|
11
|
+
INPUT_PHONE_NUMBER = "phoneNumber",
|
|
12
|
+
INPUT_SELECT = "select",
|
|
13
|
+
INPUT_SELECTABLE_RADIO = "radio",
|
|
14
|
+
INPUT_SELECTABLE_SELECTBOXES = "selectboxes",
|
|
15
|
+
INPUT_SIGNATURE = "signature",
|
|
16
|
+
INPUT_TEXT_AREA = "textarea",
|
|
17
|
+
INPUT_TEXT_FIELD = "textfield",
|
|
18
|
+
INPUT_TIME = "time",
|
|
19
|
+
INPUT_URL = "url",
|
|
20
|
+
NESTABLE_PANEL = "panel",
|
|
21
|
+
NESTABLE_TABS = "tabs",
|
|
22
|
+
NESTABLE_WELL = "well"
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./callout-component-base-type.ts";
|
|
2
|
+
export * from "./callout-component-input-selectable-types.ts";
|
|
3
|
+
export * from "./callout-component-input-text-types.ts";
|
|
4
|
+
export * from "./callout-component-input-types.ts";
|
|
5
|
+
export * from "./callout-component-nestable-types.ts";
|
|
6
|
+
export * from "./callout-component-type.ts";
|
|
7
|
+
export * from "./callout-component-types.ts";
|
|
8
|
+
export * from "./contribution-period.ts";
|
|
9
|
+
export * from "./contribution-type.ts";
|
|
10
|
+
export * from "./item-status.ts";
|
|
11
|
+
export * from "./membership-status.ts";
|
|
12
|
+
export * from "./newsletter-status.ts";
|
|
13
|
+
export * from "./payment-method.ts";
|
|
14
|
+
export * from "./payment-status.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./InvalidRule.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.ts";
|