@10x-media/form-builder 0.1.0-beta.1 → 0.1.0-beta.11
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/CHANGELOG.md +304 -0
- package/README.md +6 -4
- package/dist/actions/assertNoBlockCollision.js +18 -0
- package/dist/actions/assertNoBlockCollision.js.map +1 -0
- package/dist/actions/body/converters.d.ts +20 -0
- package/dist/actions/body/converters.js +57 -0
- package/dist/actions/body/converters.js.map +1 -0
- package/dist/actions/body/escapeHtml.d.ts +6 -0
- package/dist/actions/body/escapeHtml.js +14 -0
- package/dist/actions/body/escapeHtml.js.map +1 -0
- package/dist/actions/body/serializeBody.d.ts +55 -0
- package/dist/actions/body/serializeBody.js +78 -0
- package/dist/actions/body/serializeBody.js.map +1 -0
- package/dist/actions/body/serializeSlate.js +31 -0
- package/dist/actions/body/serializeSlate.js.map +1 -0
- package/dist/actions/body/textOfBody.d.ts +13 -0
- package/dist/actions/body/textOfBody.js +35 -0
- package/dist/actions/body/textOfBody.js.map +1 -0
- package/dist/actions/body/wildcards.d.ts +10 -0
- package/dist/actions/body/wildcards.js +33 -0
- package/dist/actions/body/wildcards.js.map +1 -0
- package/dist/actions/buildActionBlocks.js +12 -9
- package/dist/actions/buildActionBlocks.js.map +1 -1
- package/dist/actions/builtin/confirmation.js +47 -43
- package/dist/actions/builtin/confirmation.js.map +1 -1
- package/dist/actions/builtin/emailAction.d.ts +19 -0
- package/dist/actions/builtin/emailAction.js +114 -0
- package/dist/actions/builtin/emailAction.js.map +1 -0
- package/dist/actions/builtin/emailTeam.js +20 -38
- package/dist/actions/builtin/emailTeam.js.map +1 -1
- package/dist/actions/builtin/index.d.ts +16 -1
- package/dist/actions/builtin/index.js +21 -7
- package/dist/actions/builtin/index.js.map +1 -1
- package/dist/actions/builtin/signedWebhook.js +6 -2
- package/dist/actions/builtin/signedWebhook.js.map +1 -1
- package/dist/actions/defineAction.d.ts +8 -5
- package/dist/actions/defineAction.js.map +1 -1
- package/dist/actions/dispatch.js +3 -2
- package/dist/actions/dispatch.js.map +1 -1
- package/dist/actions/emailRecipients.d.ts +12 -0
- package/dist/actions/emailRecipients.js +143 -0
- package/dist/actions/emailRecipients.js.map +1 -0
- package/dist/actions/fromAddresses.d.ts +21 -0
- package/dist/actions/fromAddresses.js +74 -0
- package/dist/actions/fromAddresses.js.map +1 -0
- package/dist/actions/recipientSources.d.ts +34 -0
- package/dist/actions/recipientSources.js +11 -0
- package/dist/actions/recipientSources.js.map +1 -0
- package/dist/actions/registry.d.ts +2 -1
- package/dist/actions/registry.js +2 -6
- package/dist/actions/registry.js.map +1 -1
- package/dist/actions/runActions.js +10 -1
- package/dist/actions/runActions.js.map +1 -1
- package/dist/actions/task.js +40 -15
- package/dist/actions/task.js.map +1 -1
- package/dist/aggregation/aggregateResponses.d.ts +9 -0
- package/dist/aggregation/aggregateResponses.js +8 -14
- package/dist/aggregation/aggregateResponses.js.map +1 -1
- package/dist/aggregation/resolveResultsRequest.d.ts +35 -6
- package/dist/aggregation/resolveResultsRequest.js +68 -11
- package/dist/aggregation/resolveResultsRequest.js.map +1 -1
- package/dist/calc/computeCalcFields.js +2 -1
- package/dist/calc/computeCalcFields.js.map +1 -1
- package/dist/calc/evaluate.js +1 -2
- package/dist/calc/evaluate.js.map +1 -1
- package/dist/calc/normalizeCalc.js +6 -19
- package/dist/calc/normalizeCalc.js.map +1 -1
- package/dist/calc/types.d.ts +8 -2
- package/dist/calc/types.js +22 -0
- package/dist/calc/types.js.map +1 -0
- package/dist/client/ByteSizeField.d.ts +29 -0
- package/dist/client/ByteSizeField.js +58 -0
- package/dist/client/ByteSizeField.js.map +1 -0
- package/dist/client/ClosePollButton.d.ts +15 -0
- package/dist/client/ClosePollButton.js +80 -0
- package/dist/client/ClosePollButton.js.map +1 -0
- package/dist/client/CondensedArray.d.ts +15 -0
- package/dist/client/CondensedArray.js +97 -0
- package/dist/client/CondensedArray.js.map +1 -0
- package/dist/client/ConditionBuilder.js +2 -1
- package/dist/client/ConditionBuilder.js.map +1 -1
- package/dist/client/ConsentBlockLabel.d.ts +15 -0
- package/dist/client/ConsentBlockLabel.js +71 -0
- package/dist/client/ConsentBlockLabel.js.map +1 -0
- package/dist/client/ConsentSourceRowLabel.d.ts +9 -0
- package/dist/client/ConsentSourceRowLabel.js +21 -0
- package/dist/client/ConsentSourceRowLabel.js.map +1 -0
- package/dist/client/EndpointOptionsSelect.d.ts +46 -0
- package/dist/client/EndpointOptionsSelect.js +106 -0
- package/dist/client/EndpointOptionsSelect.js.map +1 -0
- package/dist/client/FieldBlockLabel.d.ts +18 -0
- package/dist/client/FieldBlockLabel.js +34 -0
- package/dist/client/FieldBlockLabel.js.map +1 -0
- package/dist/client/FieldNameSelect.d.ts +37 -0
- package/dist/client/FieldNameSelect.js +72 -0
- package/dist/client/FieldNameSelect.js.map +1 -0
- package/dist/client/FlowBuilder.d.ts +2 -2
- package/dist/client/FlowBuilder.js +137 -88
- package/dist/client/FlowBuilder.js.map +1 -1
- package/dist/client/FormConditionField.js +1 -4
- package/dist/client/FormConditionField.js.map +1 -1
- package/dist/client/RecipientsSelect.d.ts +35 -0
- package/dist/client/RecipientsSelect.js +193 -0
- package/dist/client/RecipientsSelect.js.map +1 -0
- package/dist/client/RuleDescription.d.ts +21 -0
- package/dist/client/RuleDescription.js +19 -0
- package/dist/client/RuleDescription.js.map +1 -0
- package/dist/client/admin.css +275 -0
- package/dist/client/endpointOptions.js +29 -0
- package/dist/client/endpointOptions.js.map +1 -0
- package/dist/client/flowAuthoring.js +142 -0
- package/dist/client/flowAuthoring.js.map +1 -0
- package/dist/client/synthesizeClientField.js +21 -10
- package/dist/client/synthesizeClientField.js.map +1 -1
- package/dist/client/toStaticLabel.js +13 -0
- package/dist/client/toStaticLabel.js.map +1 -0
- package/dist/collections/buttonFields.d.ts +34 -0
- package/dist/collections/buttonFields.js +35 -0
- package/dist/collections/buttonFields.js.map +1 -0
- package/dist/collections/cells/FieldCountCell.d.ts +15 -0
- package/dist/collections/cells/FieldCountCell.js +18 -0
- package/dist/collections/cells/FieldCountCell.js.map +1 -0
- package/dist/collections/cells/FlowStepsCell.d.ts +14 -0
- package/dist/collections/cells/FlowStepsCell.js +17 -0
- package/dist/collections/cells/FlowStepsCell.js.map +1 -0
- package/dist/collections/formSubmissions.js +133 -47
- package/dist/collections/formSubmissions.js.map +1 -1
- package/dist/collections/forms.js +416 -114
- package/dist/collections/forms.js.map +1 -1
- package/dist/collections/formsEndpoints.js +101 -0
- package/dist/collections/formsEndpoints.js.map +1 -0
- package/dist/collections/redirectFields.d.ts +29 -0
- package/dist/conditions/conditionType.js +9 -2
- package/dist/conditions/conditionType.js.map +1 -1
- package/dist/conditions/evaluate.js +1 -1
- package/dist/conditions/evaluate.js.map +1 -1
- package/dist/conditions/fieldTypes.d.ts +3 -1
- package/dist/conditions/fieldTypes.js +4 -1
- package/dist/conditions/fieldTypes.js.map +1 -1
- package/dist/conditions/normalizeConditions.js +20 -6
- package/dist/conditions/normalizeConditions.js.map +1 -1
- package/dist/consent/applyConsentStatements.d.ts +14 -0
- package/dist/consent/applyConsentStatements.js +17 -0
- package/dist/consent/applyConsentStatements.js.map +1 -0
- package/dist/consent/captureConsent.d.ts +38 -11
- package/dist/consent/captureConsent.js +60 -13
- package/dist/consent/captureConsent.js.map +1 -1
- package/dist/consent/consentSourcesField.d.ts +66 -0
- package/dist/consent/consentSourcesField.js +90 -0
- package/dist/consent/consentSourcesField.js.map +1 -0
- package/dist/consent/resolveConsentEntries.d.ts +24 -0
- package/dist/consent/resolveConsentEntries.js +40 -0
- package/dist/consent/resolveConsentEntries.js.map +1 -0
- package/dist/consent/resolveConsentSourcesRequest.d.ts +37 -0
- package/dist/consent/resolveConsentSourcesRequest.js +54 -0
- package/dist/consent/resolveConsentSourcesRequest.js.map +1 -0
- package/dist/consent/resolveConsentStatements.d.ts +45 -0
- package/dist/consent/resolveConsentStatements.js +44 -0
- package/dist/consent/resolveConsentStatements.js.map +1 -0
- package/dist/consent/resolvePublishedVersionRef.d.ts +17 -11
- package/dist/consent/resolvePublishedVersionRef.js +13 -10
- package/dist/consent/resolvePublishedVersionRef.js.map +1 -1
- package/dist/consent/types.d.ts +61 -0
- package/dist/context/formContext.d.ts +30 -0
- package/dist/context/formContext.js +54 -0
- package/dist/context/formContext.js.map +1 -0
- package/dist/email/departments.d.ts +59 -0
- package/dist/email/departments.js +87 -0
- package/dist/email/departments.js.map +1 -0
- package/dist/email/departmentsField.d.ts +53 -0
- package/dist/email/departmentsField.js +73 -0
- package/dist/email/departmentsField.js.map +1 -0
- package/dist/exports/client.d.ts +13 -1
- package/dist/exports/client.js +13 -1
- package/dist/exports/i18n.d.ts +5 -2
- package/dist/exports/i18n.js +5 -2
- package/dist/exports/react.d.ts +26 -8
- package/dist/exports/react.js +19 -3
- package/dist/exports/rsc.d.ts +9 -1
- package/dist/exports/rsc.js +9 -1
- package/dist/exports/types.d.ts +19 -10
- package/dist/fields/buildFieldBlocks.js +53 -19
- package/dist/fields/buildFieldBlocks.js.map +1 -1
- package/dist/fields/builtin/calculation.js +122 -2
- package/dist/fields/builtin/calculation.js.map +1 -1
- package/dist/fields/builtin/checkbox.js +8 -0
- package/dist/fields/builtin/checkbox.js.map +1 -1
- package/dist/fields/builtin/consent.js +30 -15
- package/dist/fields/builtin/consent.js.map +1 -1
- package/dist/fields/builtin/country.d.ts +13 -0
- package/dist/fields/builtin/country.js +30 -0
- package/dist/fields/builtin/country.js.map +1 -0
- package/dist/fields/builtin/date.js +31 -0
- package/dist/fields/builtin/date.js.map +1 -0
- package/dist/fields/builtin/email.js +1 -1
- package/dist/fields/builtin/email.js.map +1 -1
- package/dist/fields/builtin/file.d.ts +15 -0
- package/dist/fields/builtin/file.js +95 -8
- package/dist/fields/builtin/file.js.map +1 -1
- package/dist/fields/builtin/index.d.ts +26 -0
- package/dist/fields/builtin/index.js +30 -6
- package/dist/fields/builtin/index.js.map +1 -1
- package/dist/fields/builtin/message.js +30 -0
- package/dist/fields/builtin/message.js.map +1 -0
- package/dist/fields/builtin/repeater.js +49 -0
- package/dist/fields/builtin/repeater.js.map +1 -0
- package/dist/fields/builtin/select.js +8 -3
- package/dist/fields/builtin/select.js.map +1 -1
- package/dist/fields/builtin/state.d.ts +13 -0
- package/dist/fields/builtin/state.js +30 -0
- package/dist/fields/builtin/state.js.map +1 -0
- package/dist/fields/data/regions.d.ts +21 -0
- package/dist/fields/data/regions.js +1238 -0
- package/dist/fields/data/regions.js.map +1 -0
- package/dist/fields/fieldKey.d.ts +15 -0
- package/dist/fields/fieldKey.js +16 -0
- package/dist/fields/fieldKey.js.map +1 -0
- package/dist/fields/fieldNamesOfType.js +30 -0
- package/dist/fields/fieldNamesOfType.js.map +1 -0
- package/dist/fields/instanceOptions.js +20 -0
- package/dist/fields/instanceOptions.js.map +1 -0
- package/dist/fields/localizedIf.d.ts +13 -0
- package/dist/fields/localizedIf.js +12 -0
- package/dist/fields/localizedIf.js.map +1 -0
- package/dist/fields/registry.d.ts +3 -1
- package/dist/fields/registry.js +23 -8
- package/dist/fields/registry.js.map +1 -1
- package/dist/fields/sharedConfig.js +120 -58
- package/dist/fields/sharedConfig.js.map +1 -1
- package/dist/fields/types.d.ts +71 -7
- package/dist/flow/engine.d.ts +6 -4
- package/dist/flow/engine.js +11 -6
- package/dist/flow/engine.js.map +1 -1
- package/dist/flow/normalizeFlow.js +28 -9
- package/dist/flow/normalizeFlow.js.map +1 -1
- package/dist/flow/stepLabel.js +15 -0
- package/dist/flow/stepLabel.js.map +1 -0
- package/dist/flow/types.d.ts +12 -3
- package/dist/flow/types.js +11 -0
- package/dist/flow/types.js.map +1 -0
- package/dist/form/pollState.d.ts +22 -0
- package/dist/form/pollState.js +17 -0
- package/dist/form/pollState.js.map +1 -0
- package/dist/form/toFormDocument.d.ts +102 -0
- package/dist/form/toFormDocument.js +87 -0
- package/dist/form/toFormDocument.js.map +1 -0
- package/dist/form/types.d.ts +65 -0
- package/dist/index.d.ts +55 -39
- package/dist/index.js +89 -23
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +236 -0
- package/dist/plugin/applyRegistryConfig.d.ts +11 -0
- package/dist/plugin/applyRegistryConfig.js +20 -0
- package/dist/plugin/applyRegistryConfig.js.map +1 -0
- package/dist/plugin/collectionOverrides.d.ts +22 -0
- package/dist/plugin/customState.js +26 -0
- package/dist/plugin/customState.js.map +1 -0
- package/dist/plugin/registerCollections.js +40 -20
- package/dist/plugin/registerCollections.js.map +1 -1
- package/dist/plugin/uploadsCollection.d.ts +16 -0
- package/dist/plugin/uploadsCollection.js +53 -0
- package/dist/plugin/uploadsCollection.js.map +1 -0
- package/dist/poll/applyPollOptions.js +18 -0
- package/dist/poll/applyPollOptions.js.map +1 -0
- package/dist/poll/buildPollOptionSourceFields.js +50 -0
- package/dist/poll/buildPollOptionSourceFields.js.map +1 -0
- package/dist/poll/closeJob.d.ts +52 -0
- package/dist/poll/closeJob.js +119 -0
- package/dist/poll/closeJob.js.map +1 -0
- package/dist/poll/definePollOptionSource.d.ts +44 -0
- package/dist/poll/definePollOptionSource.js +6 -0
- package/dist/poll/definePollOptionSource.js.map +1 -0
- package/dist/poll/definePollType.d.ts +34 -0
- package/dist/poll/definePollType.js +6 -0
- package/dist/poll/definePollType.js.map +1 -0
- package/dist/poll/effectivePollOptions.d.ts +38 -0
- package/dist/poll/effectivePollOptions.js +64 -0
- package/dist/poll/effectivePollOptions.js.map +1 -0
- package/dist/poll/mostVoted.d.ts +21 -0
- package/dist/poll/mostVoted.js +32 -0
- package/dist/poll/mostVoted.js.map +1 -0
- package/dist/poll/outcomeBeforeChange.js +91 -0
- package/dist/poll/outcomeBeforeChange.js.map +1 -0
- package/dist/poll/outcomeFields.d.ts +38 -0
- package/dist/poll/outcomeFields.js +52 -0
- package/dist/poll/outcomeFields.js.map +1 -0
- package/dist/poll/pollTypeRegistry.d.ts +34 -0
- package/dist/poll/pollTypeRegistry.js +69 -0
- package/dist/poll/pollTypeRegistry.js.map +1 -0
- package/dist/poll/registry.d.ts +17 -0
- package/dist/poll/registry.js +12 -0
- package/dist/poll/registry.js.map +1 -0
- package/dist/poll/resolvePollCloseRequest.js +105 -0
- package/dist/poll/resolvePollCloseRequest.js.map +1 -0
- package/dist/poll/resolvePollOptions.d.ts +29 -0
- package/dist/poll/resolvePollOptions.js +52 -0
- package/dist/poll/resolvePollOptions.js.map +1 -0
- package/dist/poll/resolvePollOptionsRequest.js +50 -0
- package/dist/poll/resolvePollOptionsRequest.js.map +1 -0
- package/dist/poll/resolvePollOutcome.d.ts +34 -0
- package/dist/poll/resolvePollOutcome.js +76 -0
- package/dist/poll/resolvePollOutcome.js.map +1 -0
- package/dist/poll/resultsField.js +21 -0
- package/dist/poll/resultsField.js.map +1 -0
- package/dist/prefill/valuesFromSearchParams.js +5 -9
- package/dist/prefill/valuesFromSearchParams.js.map +1 -1
- package/dist/presentations/types.d.ts +3 -2
- package/dist/react/Form.d.ts +74 -20
- package/dist/react/Form.js +346 -180
- package/dist/react/Form.js.map +1 -1
- package/dist/react/FormContext.d.ts +44 -1
- package/dist/react/FormContext.js.map +1 -1
- package/dist/react/FormControls.d.ts +55 -0
- package/dist/react/FormControls.js +56 -0
- package/dist/react/FormControls.js.map +1 -0
- package/dist/react/FormFields.d.ts +18 -0
- package/dist/react/FormFields.js +114 -0
- package/dist/react/FormFields.js.map +1 -0
- package/dist/react/FormLayout.d.ts +4 -2
- package/dist/react/FormLayout.js +3 -2
- package/dist/react/FormLayout.js.map +1 -1
- package/dist/react/FormResults.d.ts +6 -3
- package/dist/react/FormResults.js +37 -29
- package/dist/react/FormResults.js.map +1 -1
- package/dist/react/FormSteps.d.ts +17 -0
- package/dist/react/FormSteps.js +35 -0
- package/dist/react/FormSteps.js.map +1 -0
- package/dist/react/Poll.d.ts +17 -6
- package/dist/react/Poll.js +79 -21
- package/dist/react/Poll.js.map +1 -1
- package/dist/react/captcha/HcaptchaCaptcha.d.ts +28 -0
- package/dist/react/captcha/HcaptchaCaptcha.js +53 -0
- package/dist/react/captcha/HcaptchaCaptcha.js.map +1 -0
- package/dist/react/captcha/RecaptchaCaptcha.d.ts +41 -0
- package/dist/react/captcha/RecaptchaCaptcha.js +93 -0
- package/dist/react/captcha/RecaptchaCaptcha.js.map +1 -0
- package/dist/react/captcha/TurnstileCaptcha.d.ts +28 -0
- package/dist/react/captcha/TurnstileCaptcha.js +53 -0
- package/dist/react/captcha/TurnstileCaptcha.js.map +1 -0
- package/dist/react/captcha/types.d.ts +8 -0
- package/dist/react/captcha/useCaptchaScript.js +45 -0
- package/dist/react/captcha/useCaptchaScript.js.map +1 -0
- package/dist/react/captcha/vendors.js +8 -0
- package/dist/react/captcha/vendors.js.map +1 -0
- package/dist/react/contract.d.ts +2 -3
- package/dist/react/contract.js.map +1 -1
- package/dist/react/fetchResults.d.ts +1 -1
- package/dist/react/fetchResults.js +1 -1
- package/dist/react/fetchResults.js.map +1 -1
- package/dist/react/presentation/DialogSurface.js +1 -4
- package/dist/react/presentation/DialogSurface.js.map +1 -1
- package/dist/react/primitives/Checkbox.d.ts +4 -2
- package/dist/react/primitives/Checkbox.js +2 -1
- package/dist/react/primitives/Checkbox.js.map +1 -1
- package/dist/react/primitives/FieldShell.d.ts +2 -4
- package/dist/react/primitives/FieldShell.js +12 -19
- package/dist/react/primitives/FieldShell.js.map +1 -1
- package/dist/react/primitives/Input.d.ts +1 -1
- package/dist/react/primitives/Input.js.map +1 -1
- package/dist/react/renderers/calculation.js +1 -4
- package/dist/react/renderers/calculation.js.map +1 -1
- package/dist/react/renderers/checkbox.js +1 -4
- package/dist/react/renderers/checkbox.js.map +1 -1
- package/dist/react/renderers/consent.js +78 -35
- package/dist/react/renderers/consent.js.map +1 -1
- package/dist/react/renderers/date.js +33 -0
- package/dist/react/renderers/date.js.map +1 -0
- package/dist/react/renderers/email.js +1 -4
- package/dist/react/renderers/email.js.map +1 -1
- package/dist/react/renderers/file.js +29 -14
- package/dist/react/renderers/file.js.map +1 -1
- package/dist/react/renderers/index.js +9 -0
- package/dist/react/renderers/index.js.map +1 -1
- package/dist/react/renderers/message.js +41 -0
- package/dist/react/renderers/message.js.map +1 -0
- package/dist/react/renderers/number.js +1 -4
- package/dist/react/renderers/number.js.map +1 -1
- package/dist/react/renderers/region.js +43 -0
- package/dist/react/renderers/region.js.map +1 -0
- package/dist/react/renderers/repeater.js +131 -0
- package/dist/react/renderers/repeater.js.map +1 -0
- package/dist/react/renderers/select.js +1 -4
- package/dist/react/renderers/select.js.map +1 -1
- package/dist/react/renderers/text.js +1 -4
- package/dist/react/renderers/text.js.map +1 -1
- package/dist/react/renderers/textarea.js +1 -4
- package/dist/react/renderers/textarea.js.map +1 -1
- package/dist/react/state.d.ts +40 -3
- package/dist/react/state.js +64 -9
- package/dist/react/state.js.map +1 -1
- package/dist/react/uploadFile.d.ts +2 -2
- package/dist/react/uploadFile.js +1 -1
- package/dist/react/uploadFile.js.map +1 -1
- package/dist/react/useField.d.ts +0 -1
- package/dist/react/useField.js +6 -6
- package/dist/react/useField.js.map +1 -1
- package/dist/react/useFormState.d.ts +1 -1
- package/dist/react/useFormState.js +1 -1
- package/dist/react/useFormState.js.map +1 -1
- package/dist/react/validateField.js +3 -6
- package/dist/react/validateField.js.map +1 -1
- package/dist/recall/interpolate.d.ts +4 -3
- package/dist/recall/interpolate.js +5 -4
- package/dist/recall/interpolate.js.map +1 -1
- package/dist/recall/resolver.d.ts +1 -1
- package/dist/recall/resolver.js +14 -2
- package/dist/recall/resolver.js.map +1 -1
- package/dist/spam/captcha.d.ts +4 -3
- package/dist/spam/captcha.js +4 -3
- package/dist/spam/captcha.js.map +1 -1
- package/dist/spam/clientIp.js +9 -0
- package/dist/spam/clientIp.js.map +1 -0
- package/dist/spam/constants.js +13 -1
- package/dist/spam/constants.js.map +1 -1
- package/dist/spam/identify.js +3 -6
- package/dist/spam/identify.js.map +1 -1
- package/dist/spam/providers/hcaptcha.d.ts +17 -0
- package/dist/spam/providers/hcaptcha.js +18 -0
- package/dist/spam/providers/hcaptcha.js.map +1 -0
- package/dist/spam/providers/recaptcha.d.ts +23 -0
- package/dist/spam/providers/recaptcha.js +23 -0
- package/dist/spam/providers/recaptcha.js.map +1 -0
- package/dist/spam/providers/siteverify.js +34 -0
- package/dist/spam/providers/siteverify.js.map +1 -0
- package/dist/spam/providers/turnstile.d.ts +17 -0
- package/dist/spam/providers/turnstile.js +18 -0
- package/dist/spam/providers/turnstile.js.map +1 -0
- package/dist/spam/resolveSpam.js +2 -1
- package/dist/spam/resolveSpam.js.map +1 -1
- package/dist/spam/spamGuard.js +23 -10
- package/dist/spam/spamGuard.js.map +1 -1
- package/dist/spam/types.d.ts +19 -4
- package/dist/submissions/SubmissionAnswers.d.ts +2 -4
- package/dist/submissions/SubmissionAnswers.js +114 -34
- package/dist/submissions/SubmissionAnswers.js.map +1 -1
- package/dist/submissions/SubmissionAnswersClient.js +178 -0
- package/dist/submissions/SubmissionAnswersClient.js.map +1 -0
- package/dist/submissions/coerceBoolean.js +14 -0
- package/dist/submissions/coerceBoolean.js.map +1 -0
- package/dist/submissions/createSubmission.d.ts +36 -0
- package/dist/submissions/createSubmission.js +26 -0
- package/dist/submissions/createSubmission.js.map +1 -0
- package/dist/submissions/runSubmission.d.ts +10 -0
- package/dist/submissions/runSubmission.js +128 -27
- package/dist/submissions/runSubmission.js.map +1 -1
- package/dist/submissions/types.d.ts +12 -4
- package/dist/submissions/validateSubmission.js +62 -11
- package/dist/submissions/validateSubmission.js.map +1 -1
- package/dist/submissions/verifyContext.js +35 -0
- package/dist/submissions/verifyContext.js.map +1 -0
- package/dist/submissions/votedCookie.d.ts +13 -0
- package/dist/submissions/votedCookie.js +27 -0
- package/dist/submissions/votedCookie.js.map +1 -0
- package/dist/translations/clientRuntimeKeys.d.ts +17 -0
- package/dist/translations/clientRuntimeKeys.js +46 -0
- package/dist/translations/clientRuntimeKeys.js.map +1 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +313 -0
- package/dist/translations/de.js.map +1 -0
- package/dist/translations/en.js +207 -27
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/index.d.ts +14 -5
- package/dist/translations/index.js +14 -3
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/keys.d.ts +203 -23
- package/dist/translations/keys.js +204 -24
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/makeTranslate.d.ts +7 -3
- package/dist/translations/makeTranslate.js +12 -3
- package/dist/translations/makeTranslate.js.map +1 -1
- package/dist/translations/server.js +8 -1
- package/dist/translations/server.js.map +1 -1
- package/dist/uploads/captureFileRef.d.ts +10 -3
- package/dist/uploads/captureFileRef.js +18 -9
- package/dist/uploads/captureFileRef.js.map +1 -1
- package/dist/uploads/formatBytes.d.ts +9 -0
- package/dist/uploads/formatBytes.js +25 -0
- package/dist/uploads/formatBytes.js.map +1 -0
- package/dist/uploads/resolveFileRef.js +3 -2
- package/dist/uploads/resolveFileRef.js.map +1 -1
- package/dist/uploads/types.d.ts +1 -2
- package/dist/validation/buildRuleBlocks.js +18 -17
- package/dist/validation/buildRuleBlocks.js.map +1 -1
- package/dist/validation/builtin/email.js +2 -1
- package/dist/validation/builtin/email.js.map +1 -1
- package/dist/validation/builtin/index.d.ts +14 -0
- package/dist/validation/builtin/index.js +12 -1
- package/dist/validation/builtin/index.js.map +1 -1
- package/dist/validation/builtin/matchesField.js +3 -7
- package/dist/validation/builtin/matchesField.js.map +1 -1
- package/dist/validation/builtin/max.js +1 -0
- package/dist/validation/builtin/max.js.map +1 -1
- package/dist/validation/builtin/maxDate.js +24 -0
- package/dist/validation/builtin/maxDate.js.map +1 -0
- package/dist/validation/builtin/maxLength.js +1 -0
- package/dist/validation/builtin/maxLength.js.map +1 -1
- package/dist/validation/builtin/min.js +1 -0
- package/dist/validation/builtin/min.js.map +1 -1
- package/dist/validation/builtin/minDate.js +24 -0
- package/dist/validation/builtin/minDate.js.map +1 -0
- package/dist/validation/builtin/minLength.js +1 -0
- package/dist/validation/builtin/minLength.js.map +1 -1
- package/dist/validation/builtin/notAlreadySubmitted.js +2 -0
- package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -1
- package/dist/validation/builtin/oneOf.js +1 -0
- package/dist/validation/builtin/oneOf.js.map +1 -1
- package/dist/validation/builtin/pattern.js +11 -2
- package/dist/validation/builtin/pattern.js.map +1 -1
- package/dist/validation/builtin/url.js +1 -0
- package/dist/validation/builtin/url.js.map +1 -1
- package/dist/validation/builtin/validateDateBound.js +18 -0
- package/dist/validation/builtin/validateDateBound.js.map +1 -0
- package/dist/validation/builtin/validateRegexParams.js +44 -0
- package/dist/validation/builtin/validateRegexParams.js.map +1 -0
- package/dist/validation/emailPattern.js +10 -0
- package/dist/validation/emailPattern.js.map +1 -0
- package/dist/validation/fieldTargetParam.d.ts +22 -0
- package/dist/validation/fieldTargetParam.js +38 -0
- package/dist/validation/fieldTargetParam.js.map +1 -0
- package/dist/validation/registry.d.ts +2 -1
- package/dist/validation/registry.js +2 -9
- package/dist/validation/registry.js.map +1 -1
- package/dist/validation/runValidation.js +9 -30
- package/dist/validation/runValidation.js.map +1 -1
- package/dist/validation/types.d.ts +5 -11
- package/dist/validation/validateUrl.js +22 -0
- package/dist/validation/validateUrl.js.map +1 -0
- package/package.json +7 -5
- package/styles/form-builder.css +10 -190
- package/dist/collections/uploads.d.ts +0 -29
- package/dist/collections/uploads.js +0 -46
- package/dist/collections/uploads.js.map +0 -1
- package/dist/consent/buildConsentSourceConfig.js +0 -49
- package/dist/consent/buildConsentSourceConfig.js.map +0 -1
- package/dist/consent/builtin/index.d.ts +0 -7
- package/dist/consent/builtin/index.js +0 -11
- package/dist/consent/builtin/index.js.map +0 -1
- package/dist/consent/builtin/pageReference.js +0 -75
- package/dist/consent/builtin/pageReference.js.map +0 -1
- package/dist/consent/builtin/static.js +0 -44
- package/dist/consent/builtin/static.js.map +0 -1
- package/dist/consent/defineConsentSource.d.ts +0 -35
- package/dist/consent/defineConsentSource.js +0 -6
- package/dist/consent/defineConsentSource.js.map +0 -1
- package/dist/consent/registry.d.ts +0 -16
- package/dist/consent/registry.js +0 -16
- package/dist/consent/registry.js.map +0 -1
- package/dist/consent/resolveConsentLinks.d.ts +0 -19
- package/dist/consent/resolveConsentLinks.js +0 -26
- package/dist/consent/resolveConsentLinks.js.map +0 -1
- package/dist/presentations/registry.d.ts +0 -15
- package/dist/presentations/registry.js +0 -15
- package/dist/presentations/registry.js.map +0 -1
- package/dist/react/toFormDocument.d.ts +0 -24
- package/dist/react/toFormDocument.js +0 -22
- package/dist/react/toFormDocument.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateUrl.js","names":[],"sources":["../../src/validation/validateUrl.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport { keys } from '../translations/keys'\nimport { asTranslate } from '../translations/server'\n\n/**\n * Payload field validator for URL config fields (signed-webhook `url`, response redirect `url`):\n * unset is fine (the consumer enforces presence where it matters), otherwise the value must parse\n * as an absolute http(s) URL.\n */\nexport const validateUrl = (\n\tvalue: unknown,\n\t{ req }: { data?: unknown; req: PayloadRequest }\n): string | true => {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\treturn true\n\t}\n\tlet parsed: URL\n\ttry {\n\t\tparsed = new URL(value)\n\t} catch {\n\t\treturn asTranslate(req.t)(keys.validationUrlInvalid)\n\t}\n\treturn parsed.protocol === 'http:' || parsed.protocol === 'https:'\n\t\t? true\n\t\t: asTranslate(req.t)(keys.validationUrlInvalid)\n}\n"],"mappings":";;;;;;;;AASA,MAAa,eACZ,OACA,EAAE,UACiB;CACnB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GACjD,OAAO;CAER,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,KAAK;CACvB,QAAQ;EACP,OAAO,YAAY,IAAI,CAAC,EAAE,KAAK,oBAAoB;CACpD;CACA,OAAO,OAAO,aAAa,WAAW,OAAO,aAAa,WACvD,OACA,YAAY,IAAI,CAAC,EAAE,KAAK,oBAAoB;AAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@10x-media/form-builder",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.11",
|
|
4
4
|
"description": "End-to-end forms platform for Payload: author, validate, render, collect, aggregate, and act.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"LICENSE"
|
|
63
63
|
],
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@payloadcms/ui": "^3.
|
|
66
|
-
"payload": "^3.
|
|
65
|
+
"@payloadcms/ui": "^3.83.0",
|
|
66
|
+
"payload": "^3.83.0",
|
|
67
67
|
"react": "^19.0.0",
|
|
68
68
|
"react-dom": "^19.0.0"
|
|
69
69
|
},
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"@axe-core/playwright": "^4.11.3",
|
|
75
75
|
"@payloadcms/db-mongodb": "3.85.0",
|
|
76
76
|
"@payloadcms/db-postgres": "3.85.0",
|
|
77
|
+
"@payloadcms/richtext-lexical": "3.85.0",
|
|
77
78
|
"@payloadcms/ui": "3.85.0",
|
|
78
79
|
"@playwright/test": "1.60.0",
|
|
79
80
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"@types/react-dom": "19.2.3",
|
|
84
85
|
"axe-core": "^4.12.1",
|
|
85
86
|
"jsdom": "^25.0.1",
|
|
87
|
+
"msw": "^2.14.6",
|
|
86
88
|
"payload": "3.85.0",
|
|
87
89
|
"playwright": "1.60.0",
|
|
88
90
|
"react": "19.2.6",
|
|
@@ -92,8 +94,8 @@
|
|
|
92
94
|
"typescript": "5.9.3",
|
|
93
95
|
"vitest": "4.1.7",
|
|
94
96
|
"@10x-media/tsconfig": "0.0.0",
|
|
95
|
-
"@10x-media/payload-test-harness": "0.0.0",
|
|
96
97
|
"@10x-media/vitest-config": "0.0.0",
|
|
98
|
+
"@10x-media/payload-test-harness": "0.0.0",
|
|
97
99
|
"@10x-media/tsdown-config": "0.0.0"
|
|
98
100
|
},
|
|
99
101
|
"publishConfig": {
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
"test": "vitest run",
|
|
109
111
|
"test:unit": "vitest run src",
|
|
110
112
|
"test:int": "vitest run tests/int",
|
|
111
|
-
"test:matrix": "DB_MATRIX=mongo vitest run tests/int/matrix.int.spec.ts && DB_MATRIX=postgres vitest run tests/int/matrix.int.spec.ts",
|
|
113
|
+
"test:matrix": "DB_MATRIX=mongo vitest run tests/int/matrix.int.spec.ts tests/int/messageResponse.int.spec.ts tests/int/pollAutoClose.int.spec.ts && DB_MATRIX=postgres vitest run tests/int/matrix.int.spec.ts tests/int/messageResponse.int.spec.ts tests/int/pollAutoClose.int.spec.ts",
|
|
112
114
|
"test:container": "TEST_DB=container DB_MATRIX=mongo vitest run tests/int/matrix.int.spec.ts && TEST_DB=container DB_MATRIX=postgres vitest run tests/int/matrix.int.spec.ts",
|
|
113
115
|
"test:e2e": "bash scripts/e2e.sh",
|
|
114
116
|
"dev": "pnpm --filter @10x-media/form-builder-dev dev",
|
package/styles/form-builder.css
CHANGED
|
@@ -101,198 +101,18 @@
|
|
|
101
101
|
height: 100%;
|
|
102
102
|
background: var(--fb-results-fill, currentColor);
|
|
103
103
|
}
|
|
104
|
-
.fb-
|
|
105
|
-
margin-block-start: 0.5rem;
|
|
106
|
-
opacity: 0.7;
|
|
107
|
-
font-size: 0.875em;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* Flow builder (admin UI only, requires Payload theme variables). */
|
|
111
|
-
.fb-flow-builder {
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: column;
|
|
114
|
-
gap: 0.5rem;
|
|
115
|
-
margin-block-end: 1rem;
|
|
116
|
-
}
|
|
117
|
-
.fb-flow-builder__hint {
|
|
118
|
-
color: var(--theme-elevation-400);
|
|
119
|
-
font-size: 0.875rem;
|
|
120
|
-
margin: 0;
|
|
121
|
-
}
|
|
122
|
-
.fb-flow-builder__steps {
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
gap: 0.5rem;
|
|
126
|
-
}
|
|
127
|
-
.fb-flow-builder__actions {
|
|
128
|
-
margin-block-start: 0.25rem;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.fb-flow-step__header-content {
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
gap: 0.5rem;
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
}
|
|
137
|
-
.fb-flow-step__index {
|
|
138
|
-
font-size: 0.6875rem;
|
|
104
|
+
.fb-results__bucket--winner {
|
|
139
105
|
font-weight: 600;
|
|
140
|
-
text-transform: uppercase;
|
|
141
|
-
letter-spacing: 0.04em;
|
|
142
|
-
color: var(--theme-elevation-400);
|
|
143
|
-
flex-shrink: 0;
|
|
144
|
-
}
|
|
145
|
-
.fb-flow-step__id-preview {
|
|
146
|
-
font-size: 0.875rem;
|
|
147
|
-
overflow: hidden;
|
|
148
|
-
text-overflow: ellipsis;
|
|
149
|
-
white-space: nowrap;
|
|
150
|
-
}
|
|
151
|
-
.fb-flow-step__id-preview em {
|
|
152
|
-
color: var(--theme-elevation-400);
|
|
153
|
-
font-style: italic;
|
|
154
|
-
}
|
|
155
|
-
.fb-flow-step__body {
|
|
156
|
-
padding: 0.75rem;
|
|
157
|
-
display: flex;
|
|
158
|
-
flex-direction: column;
|
|
159
|
-
gap: 0.25rem;
|
|
160
|
-
}
|
|
161
|
-
.fb-flow-step__row {
|
|
162
|
-
display: flex;
|
|
163
|
-
flex-direction: column;
|
|
164
|
-
gap: 0.25rem;
|
|
165
|
-
}
|
|
166
|
-
.fb-flow-step__hint {
|
|
167
|
-
font-size: 0.75rem;
|
|
168
|
-
color: var(--theme-elevation-400);
|
|
169
|
-
margin: 0;
|
|
170
|
-
}
|
|
171
|
-
.fb-flow-step__field-picker {
|
|
172
|
-
display: flex;
|
|
173
|
-
flex-wrap: wrap;
|
|
174
|
-
gap: 0.25rem 1.25rem;
|
|
175
|
-
padding-block: 0.25rem;
|
|
176
106
|
}
|
|
177
|
-
.fb-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
gap: 0.5rem;
|
|
181
|
-
padding-block-start: 0.5rem;
|
|
182
|
-
}
|
|
183
|
-
.fb-flow-step__transitions-header {
|
|
184
|
-
display: flex;
|
|
185
|
-
align-items: baseline;
|
|
186
|
-
gap: 0.5rem;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.fb-flow-transition {
|
|
190
|
-
border: 1px solid var(--theme-border-color);
|
|
191
|
-
border-radius: var(--style-radius-s);
|
|
192
|
-
padding: 0.5rem 0.75rem;
|
|
193
|
-
display: flex;
|
|
194
|
-
flex-direction: column;
|
|
195
|
-
gap: 0.5rem;
|
|
196
|
-
}
|
|
197
|
-
.fb-flow-transition__header {
|
|
198
|
-
display: flex;
|
|
199
|
-
align-items: center;
|
|
200
|
-
gap: 0.5rem;
|
|
201
|
-
}
|
|
202
|
-
.fb-flow-transition__label {
|
|
203
|
-
font-size: 0.6875rem;
|
|
204
|
-
font-weight: 600;
|
|
205
|
-
text-transform: uppercase;
|
|
206
|
-
letter-spacing: 0.04em;
|
|
207
|
-
color: var(--theme-elevation-400);
|
|
208
|
-
flex-shrink: 0;
|
|
209
|
-
}
|
|
210
|
-
.fb-flow-transition__goto {
|
|
211
|
-
flex: 1;
|
|
212
|
-
min-width: 0;
|
|
213
|
-
}
|
|
214
|
-
.fb-flow-transition__actions {
|
|
215
|
-
display: flex;
|
|
216
|
-
align-items: center;
|
|
217
|
-
gap: 0.25rem;
|
|
218
|
-
flex-shrink: 0;
|
|
219
|
-
}
|
|
220
|
-
.fb-flow-transition__when-label {
|
|
221
|
-
font-size: 0.6875rem;
|
|
222
|
-
font-weight: 600;
|
|
223
|
-
text-transform: uppercase;
|
|
224
|
-
letter-spacing: 0.04em;
|
|
225
|
-
color: var(--theme-elevation-400);
|
|
226
|
-
}
|
|
227
|
-
.fb-flow-transition__condition {
|
|
228
|
-
padding-inline-start: 0.25rem;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/* Condition builder (admin UI only, requires Payload theme variables). */
|
|
232
|
-
.fb-condition-builder {
|
|
233
|
-
display: flex;
|
|
234
|
-
flex-direction: column;
|
|
235
|
-
gap: 0.5rem;
|
|
236
|
-
}
|
|
237
|
-
.fb-condition-builder__hint {
|
|
238
|
-
color: var(--theme-elevation-400);
|
|
239
|
-
font-size: 0.875rem;
|
|
240
|
-
margin: 0;
|
|
241
|
-
}
|
|
242
|
-
.fb-condition-builder__group {
|
|
243
|
-
display: flex;
|
|
244
|
-
flex-direction: column;
|
|
245
|
-
gap: 0.375rem;
|
|
246
|
-
padding: 0.75rem;
|
|
247
|
-
border: 1px solid var(--theme-border-color);
|
|
248
|
-
border-radius: var(--style-radius-m);
|
|
249
|
-
}
|
|
250
|
-
.fb-condition-builder__or-label {
|
|
251
|
-
display: inline-block;
|
|
252
|
-
font-size: 11px;
|
|
253
|
-
font-weight: 500;
|
|
107
|
+
.fb-results__winner-badge {
|
|
108
|
+
margin-inline-start: 0.375rem;
|
|
109
|
+
font-size: 0.75em;
|
|
254
110
|
text-transform: uppercase;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
.fb-condition-builder__and-row {
|
|
258
|
-
display: flex;
|
|
259
|
-
flex-direction: column;
|
|
260
|
-
gap: 0.25rem;
|
|
261
|
-
}
|
|
262
|
-
.fb-condition-builder__and-label {
|
|
263
|
-
font-size: 10px;
|
|
264
|
-
font-weight: 500;
|
|
265
|
-
text-transform: uppercase;
|
|
266
|
-
padding-inline-start: 0.125rem;
|
|
267
|
-
}
|
|
268
|
-
.fb-condition-builder__add-condition {
|
|
269
|
-
align-self: flex-start;
|
|
270
|
-
margin-block-start: 0.25rem;
|
|
271
|
-
}
|
|
272
|
-
.fb-condition-builder__actions {
|
|
273
|
-
display: flex;
|
|
274
|
-
gap: 0.5rem;
|
|
275
|
-
margin-top: 0.5rem;
|
|
276
|
-
}
|
|
277
|
-
.fb-condition-row {
|
|
278
|
-
display: flex;
|
|
279
|
-
align-items: flex-start;
|
|
280
|
-
gap: 0.5rem;
|
|
281
|
-
flex-wrap: nowrap;
|
|
282
|
-
}
|
|
283
|
-
.fb-condition-row__field {
|
|
284
|
-
flex: 1 1 9rem;
|
|
285
|
-
min-width: 0;
|
|
286
|
-
}
|
|
287
|
-
.fb-condition-row__operator {
|
|
288
|
-
flex: 0 1 9rem;
|
|
289
|
-
min-width: 0;
|
|
290
|
-
}
|
|
291
|
-
.fb-condition-row__value {
|
|
292
|
-
flex: 1 1 9rem;
|
|
293
|
-
min-width: 0;
|
|
111
|
+
letter-spacing: 0.05em;
|
|
112
|
+
opacity: 0.7;
|
|
294
113
|
}
|
|
295
|
-
.fb-
|
|
296
|
-
|
|
297
|
-
|
|
114
|
+
.fb-results__total {
|
|
115
|
+
margin-block-start: 0.5rem;
|
|
116
|
+
opacity: 0.7;
|
|
117
|
+
font-size: 0.875em;
|
|
298
118
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CollectionConfig } from "payload";
|
|
2
|
-
|
|
3
|
-
//#region src/collections/uploads.d.ts
|
|
4
|
-
declare const FORM_UPLOADS_SLUG = "form-uploads";
|
|
5
|
-
/** Override surface for the built-in upload collection. */
|
|
6
|
-
type UploadsCollectionConfig = {
|
|
7
|
-
slug?: string; /** Merged onto the collection's `upload` config (e.g. `staticDir`, `mimeTypes`). `true` uses Payload defaults. */
|
|
8
|
-
upload?: NonNullable<CollectionConfig['upload']> | true; /** Replace access (defaults: anonymous create, authed read/update/delete). */
|
|
9
|
-
access?: CollectionConfig['access']; /** Append extra fields. */
|
|
10
|
-
fields?: CollectionConfig['fields'];
|
|
11
|
-
};
|
|
12
|
-
type UploadsOption = boolean | UploadsCollectionConfig;
|
|
13
|
-
/**
|
|
14
|
-
* The built-in upload collection backing the `file` field. Anonymous create (public forms upload here),
|
|
15
|
-
* authed read/update/delete (only admins read stored files; submitters cannot enumerate others' uploads).
|
|
16
|
-
* Per-field MIME/size is re-enforced at submit, so the collection stays permissive by default. No
|
|
17
|
-
* `imageSizes`, so it needs no `sharp`. Projects with their own upload collection set `uploads: false` and
|
|
18
|
-
* point the file field's `relationTo` at theirs.
|
|
19
|
-
*/
|
|
20
|
-
declare const buildUploadsCollection: (config?: UploadsCollectionConfig) => CollectionConfig;
|
|
21
|
-
/** Resolve the `uploads` plugin option: `false` disables, `true`/object enables the built-in collection. */
|
|
22
|
-
declare const resolveUploads: (option: UploadsOption | undefined) => {
|
|
23
|
-
enabled: boolean;
|
|
24
|
-
slug: string;
|
|
25
|
-
collection?: CollectionConfig;
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
|
-
export { FORM_UPLOADS_SLUG, UploadsCollectionConfig, UploadsOption, buildUploadsCollection, resolveUploads };
|
|
29
|
-
//# sourceMappingURL=uploads.d.ts.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { isLoggedIn } from "../plugin/access.js";
|
|
2
|
-
//#region src/collections/uploads.ts
|
|
3
|
-
const FORM_UPLOADS_SLUG = "form-uploads";
|
|
4
|
-
/**
|
|
5
|
-
* The built-in upload collection backing the `file` field. Anonymous create (public forms upload here),
|
|
6
|
-
* authed read/update/delete (only admins read stored files; submitters cannot enumerate others' uploads).
|
|
7
|
-
* Per-field MIME/size is re-enforced at submit, so the collection stays permissive by default. No
|
|
8
|
-
* `imageSizes`, so it needs no `sharp`. Projects with their own upload collection set `uploads: false` and
|
|
9
|
-
* point the file field's `relationTo` at theirs.
|
|
10
|
-
*/
|
|
11
|
-
const buildUploadsCollection = (config = {}) => ({
|
|
12
|
-
slug: config.slug ?? "form-uploads",
|
|
13
|
-
access: config.access ?? {
|
|
14
|
-
create: () => true,
|
|
15
|
-
read: isLoggedIn,
|
|
16
|
-
update: isLoggedIn,
|
|
17
|
-
delete: isLoggedIn
|
|
18
|
-
},
|
|
19
|
-
admin: { group: "Forms" },
|
|
20
|
-
upload: config.upload && config.upload !== true ? config.upload : true,
|
|
21
|
-
fields: [{
|
|
22
|
-
name: "owner",
|
|
23
|
-
type: "text",
|
|
24
|
-
admin: {
|
|
25
|
-
readOnly: true,
|
|
26
|
-
hidden: true
|
|
27
|
-
}
|
|
28
|
-
}, ...config.fields ?? []]
|
|
29
|
-
});
|
|
30
|
-
/** Resolve the `uploads` plugin option: `false` disables, `true`/object enables the built-in collection. */
|
|
31
|
-
const resolveUploads = (option) => {
|
|
32
|
-
if (option === false) return {
|
|
33
|
-
enabled: false,
|
|
34
|
-
slug: FORM_UPLOADS_SLUG
|
|
35
|
-
};
|
|
36
|
-
const collection = buildUploadsCollection(option && option !== true ? option : {});
|
|
37
|
-
return {
|
|
38
|
-
enabled: true,
|
|
39
|
-
slug: collection.slug,
|
|
40
|
-
collection
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { FORM_UPLOADS_SLUG, buildUploadsCollection, resolveUploads };
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=uploads.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.js","names":[],"sources":["../../src/collections/uploads.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\nimport { isLoggedIn } from '../plugin/access'\n\nexport const FORM_UPLOADS_SLUG = 'form-uploads'\n\n/** Override surface for the built-in upload collection. */\nexport type UploadsCollectionConfig = {\n\tslug?: string\n\t/** Merged onto the collection's `upload` config (e.g. `staticDir`, `mimeTypes`). `true` uses Payload defaults. */\n\tupload?: NonNullable<CollectionConfig['upload']> | true\n\t/** Replace access (defaults: anonymous create, authed read/update/delete). */\n\taccess?: CollectionConfig['access']\n\t/** Append extra fields. */\n\tfields?: CollectionConfig['fields']\n}\n\nexport type UploadsOption = boolean | UploadsCollectionConfig\n\n/**\n * The built-in upload collection backing the `file` field. Anonymous create (public forms upload here),\n * authed read/update/delete (only admins read stored files; submitters cannot enumerate others' uploads).\n * Per-field MIME/size is re-enforced at submit, so the collection stays permissive by default. No\n * `imageSizes`, so it needs no `sharp`. Projects with their own upload collection set `uploads: false` and\n * point the file field's `relationTo` at theirs.\n */\nexport const buildUploadsCollection = (config: UploadsCollectionConfig = {}): CollectionConfig => ({\n\tslug: config.slug ?? FORM_UPLOADS_SLUG,\n\taccess: config.access ?? {\n\t\tcreate: () => true,\n\t\tread: isLoggedIn,\n\t\tupdate: isLoggedIn,\n\t\tdelete: isLoggedIn,\n\t},\n\tadmin: { group: 'Forms' },\n\tupload: config.upload && config.upload !== true ? config.upload : true,\n\tfields: [\n\t\t{ name: 'owner', type: 'text', admin: { readOnly: true, hidden: true } },\n\t\t...(config.fields ?? []),\n\t],\n})\n\n/** Resolve the `uploads` plugin option: `false` disables, `true`/object enables the built-in collection. */\nexport const resolveUploads = (\n\toption: UploadsOption | undefined\n): { enabled: boolean; slug: string; collection?: CollectionConfig } => {\n\tif (option === false) {\n\t\treturn { enabled: false, slug: FORM_UPLOADS_SLUG }\n\t}\n\tconst config = option && option !== true ? option : {}\n\tconst collection = buildUploadsCollection(config)\n\treturn { enabled: true, slug: collection.slug, collection }\n}\n"],"mappings":";;AAGA,MAAa,oBAAoB;;;;;;;;AAsBjC,MAAa,0BAA0B,SAAkC,CAAC,OAAyB;CAClG,MAAM,OAAO,QAAA;CACb,QAAQ,OAAO,UAAU;EACxB,cAAc;EACd,MAAM;EACN,QAAQ;EACR,QAAQ;CACT;CACA,OAAO,EAAE,OAAO,QAAQ;CACxB,QAAQ,OAAO,UAAU,OAAO,WAAW,OAAO,OAAO,SAAS;CAClE,QAAQ,CACP;EAAE,MAAM;EAAS,MAAM;EAAQ,OAAO;GAAE,UAAU;GAAM,QAAQ;EAAK;CAAE,GACvE,GAAI,OAAO,UAAU,CAAC,CACvB;AACD;;AAGA,MAAa,kBACZ,WACuE;CACvE,IAAI,WAAW,OACd,OAAO;EAAE,SAAS;EAAO,MAAM;CAAkB;CAGlD,MAAM,aAAa,uBADJ,UAAU,WAAW,OAAO,SAAS,CAAC,CACL;CAChD,OAAO;EAAE,SAAS;EAAM,MAAM,WAAW;EAAM;CAAW;AAC3D"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { keys } from "../translations/keys.js";
|
|
2
|
-
import { labelFor } from "../translations/server.js";
|
|
3
|
-
//#region src/consent/buildConsentSourceConfig.ts
|
|
4
|
-
/**
|
|
5
|
-
* Builds the `source` select and `sourceConfig` group for the consent field block.
|
|
6
|
-
* Fields inside `sourceConfig` are annotated with `admin.condition` so only the
|
|
7
|
-
* fields that belong to the currently selected source type are visible in the admin UI.
|
|
8
|
-
*
|
|
9
|
-
* `resolveConsentLinks` reads `field.sourceConfig` as a flat object; field names within
|
|
10
|
-
* that group must be unique across all registered sources. Built-in sources (static,
|
|
11
|
-
* pageReference) have no overlapping names. Custom sources should follow the same rule.
|
|
12
|
-
*/
|
|
13
|
-
const buildConsentSourceConfig = (registry) => {
|
|
14
|
-
const sources = [...registry.values()];
|
|
15
|
-
const firstType = sources[0]?.type ?? "static";
|
|
16
|
-
const sourceConfigFields = sources.flatMap((source) => (source.config ?? []).map((field) => {
|
|
17
|
-
const existingAdmin = typeof field.admin === "object" && field.admin !== null ? field.admin : {};
|
|
18
|
-
return {
|
|
19
|
-
...field,
|
|
20
|
-
admin: {
|
|
21
|
-
...existingAdmin,
|
|
22
|
-
condition: (data) => data?.source === source.type
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}));
|
|
26
|
-
return [{
|
|
27
|
-
name: "source",
|
|
28
|
-
type: "select",
|
|
29
|
-
defaultValue: firstType,
|
|
30
|
-
label: labelFor(keys.consentConfigSource),
|
|
31
|
-
options: sources.map((s) => ({
|
|
32
|
-
label: labelFor(s.label),
|
|
33
|
-
value: s.type
|
|
34
|
-
}))
|
|
35
|
-
}, {
|
|
36
|
-
name: "sourceConfig",
|
|
37
|
-
type: "group",
|
|
38
|
-
label: labelFor(keys.consentConfigSourceConfig),
|
|
39
|
-
fields: sourceConfigFields.length > 0 ? sourceConfigFields : [{
|
|
40
|
-
name: "_placeholder",
|
|
41
|
-
type: "text",
|
|
42
|
-
admin: { hidden: true }
|
|
43
|
-
}]
|
|
44
|
-
}];
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
export { buildConsentSourceConfig };
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=buildConsentSourceConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildConsentSourceConfig.js","names":[],"sources":["../../src/consent/buildConsentSourceConfig.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport { keys } from '../translations/keys'\nimport { labelFor } from '../translations/server'\nimport type { ConsentSourceRegistry } from './registry'\n\n/**\n * Builds the `source` select and `sourceConfig` group for the consent field block.\n * Fields inside `sourceConfig` are annotated with `admin.condition` so only the\n * fields that belong to the currently selected source type are visible in the admin UI.\n *\n * `resolveConsentLinks` reads `field.sourceConfig` as a flat object; field names within\n * that group must be unique across all registered sources. Built-in sources (static,\n * pageReference) have no overlapping names. Custom sources should follow the same rule.\n */\nexport const buildConsentSourceConfig = (registry: ConsentSourceRegistry): Field[] => {\n\tconst sources = [...registry.values()]\n\tconst firstType = sources[0]?.type ?? 'static'\n\n\tconst sourceConfigFields: Field[] = sources.flatMap((source) =>\n\t\t(source.config ?? []).map((field) => {\n\t\t\tconst existingAdmin =\n\t\t\t\ttypeof field.admin === 'object' && field.admin !== null ? field.admin : {}\n\t\t\treturn {\n\t\t\t\t...field,\n\t\t\t\tadmin: {\n\t\t\t\t\t...existingAdmin,\n\t\t\t\t\tcondition: (data: unknown) => (data as Record<string, unknown>)?.source === source.type,\n\t\t\t\t},\n\t\t\t} as Field\n\t\t})\n\t)\n\n\treturn [\n\t\t{\n\t\t\tname: 'source',\n\t\t\ttype: 'select',\n\t\t\tdefaultValue: firstType,\n\t\t\tlabel: labelFor(keys.consentConfigSource),\n\t\t\toptions: sources.map((s) => ({\n\t\t\t\tlabel: labelFor(s.label),\n\t\t\t\tvalue: s.type,\n\t\t\t})),\n\t\t},\n\t\t{\n\t\t\tname: 'sourceConfig',\n\t\t\ttype: 'group',\n\t\t\tlabel: labelFor(keys.consentConfigSourceConfig),\n\t\t\tfields:\n\t\t\t\tsourceConfigFields.length > 0\n\t\t\t\t\t? sourceConfigFields\n\t\t\t\t\t: [{ name: '_placeholder', type: 'text', admin: { hidden: true } }],\n\t\t},\n\t]\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,4BAA4B,aAA6C;CACrF,MAAM,UAAU,CAAC,GAAG,SAAS,OAAO,CAAC;CACrC,MAAM,YAAY,QAAQ,IAAI,QAAQ;CAEtC,MAAM,qBAA8B,QAAQ,SAAS,YACnD,OAAO,UAAU,CAAC,GAAG,KAAK,UAAU;EACpC,MAAM,gBACL,OAAO,MAAM,UAAU,YAAY,MAAM,UAAU,OAAO,MAAM,QAAQ,CAAC;EAC1E,OAAO;GACN,GAAG;GACH,OAAO;IACN,GAAG;IACH,YAAY,SAAmB,MAAkC,WAAW,OAAO;GACpF;EACD;CACD,CAAC,CACF;CAEA,OAAO,CACN;EACC,MAAM;EACN,MAAM;EACN,cAAc;EACd,OAAO,SAAS,KAAK,mBAAmB;EACxC,SAAS,QAAQ,KAAK,OAAO;GAC5B,OAAO,SAAS,EAAE,KAAK;GACvB,OAAO,EAAE;EACV,EAAE;CACH,GACA;EACC,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,yBAAyB;EAC9C,QACC,mBAAmB,SAAS,IACzB,qBACA,CAAC;GAAE,MAAM;GAAgB,MAAM;GAAQ,OAAO,EAAE,QAAQ,KAAK;EAAE,CAAC;CACrE,CACD;AACD"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AnyConsentSource } from "../defineConsentSource.js";
|
|
2
|
-
|
|
3
|
-
//#region src/consent/builtin/index.d.ts
|
|
4
|
-
declare const defaultConsentSources: Record<string, AnyConsentSource>;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { defaultConsentSources };
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { pageReferenceSource } from "./pageReference.js";
|
|
2
|
-
import { staticSource } from "./static.js";
|
|
3
|
-
//#region src/consent/builtin/index.ts
|
|
4
|
-
const defaultConsentSources = {
|
|
5
|
-
static: staticSource,
|
|
6
|
-
pageReference: pageReferenceSource
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { defaultConsentSources };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/consent/builtin/index.ts"],"sourcesContent":["import type { AnyConsentSource } from '../defineConsentSource'\nimport { pageReferenceSource } from './pageReference'\nimport { staticSource } from './static'\n\nexport const defaultConsentSources: Record<string, AnyConsentSource> = {\n\tstatic: staticSource as AnyConsentSource,\n\tpageReference: pageReferenceSource as AnyConsentSource,\n}\n"],"mappings":";;;AAIA,MAAa,wBAA0D;CACtE,QAAQ;CACR,eAAe;AAChB"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { keys } from "../../translations/keys.js";
|
|
2
|
-
import { labelFor } from "../../translations/server.js";
|
|
3
|
-
import { defineConsentSource } from "../defineConsentSource.js";
|
|
4
|
-
import { resolvePublishedVersionRef } from "../resolvePublishedVersionRef.js";
|
|
5
|
-
//#region src/consent/builtin/pageReference.ts
|
|
6
|
-
const pageReferenceSource = defineConsentSource({
|
|
7
|
-
type: "pageReference",
|
|
8
|
-
label: keys.consentSourcePageReference,
|
|
9
|
-
config: [
|
|
10
|
-
{
|
|
11
|
-
name: "relationTo",
|
|
12
|
-
type: "text",
|
|
13
|
-
label: labelFor(keys.consentConfigRelationTo)
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "docId",
|
|
17
|
-
type: "text",
|
|
18
|
-
label: labelFor(keys.consentConfigDocId)
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "urlField",
|
|
22
|
-
type: "text",
|
|
23
|
-
label: labelFor(keys.consentConfigUrlField),
|
|
24
|
-
defaultValue: "slug"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "captureVersion",
|
|
28
|
-
type: "checkbox",
|
|
29
|
-
label: labelFor(keys.consentConfigCaptureVersion)
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
resolve: async ({ config, payload, req, locale }) => {
|
|
33
|
-
const relationTo = String(config.relationTo ?? "");
|
|
34
|
-
const docId = String(config.docId ?? "");
|
|
35
|
-
const urlField = String(config.urlField ?? "slug");
|
|
36
|
-
const captureVersion = Boolean(config.captureVersion);
|
|
37
|
-
if (!relationTo || !docId) return { links: [] };
|
|
38
|
-
const doc = await payload.findByID({
|
|
39
|
-
collection: relationTo,
|
|
40
|
-
id: docId,
|
|
41
|
-
depth: 0,
|
|
42
|
-
locale,
|
|
43
|
-
req
|
|
44
|
-
}).catch(() => null);
|
|
45
|
-
if (!doc) return { links: [{
|
|
46
|
-
label: relationTo,
|
|
47
|
-
url: ""
|
|
48
|
-
}] };
|
|
49
|
-
const docRecord = doc;
|
|
50
|
-
const label = String(docRecord.title ?? docRecord[urlField] ?? relationTo);
|
|
51
|
-
const url = String(docRecord[urlField] ?? "");
|
|
52
|
-
if (!captureVersion) return { links: [{
|
|
53
|
-
label,
|
|
54
|
-
url
|
|
55
|
-
}] };
|
|
56
|
-
const v = await resolvePublishedVersionRef(payload, {
|
|
57
|
-
collection: relationTo,
|
|
58
|
-
id: docId
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
links: [{
|
|
62
|
-
label,
|
|
63
|
-
url
|
|
64
|
-
}],
|
|
65
|
-
...v ? {
|
|
66
|
-
versionRef: v.versionId,
|
|
67
|
-
versionLabel: v.updatedAt
|
|
68
|
-
} : {}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
//#endregion
|
|
73
|
-
export { pageReferenceSource };
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=pageReference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pageReference.js","names":[],"sources":["../../../src/consent/builtin/pageReference.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineConsentSource } from '../defineConsentSource'\nimport { resolvePublishedVersionRef } from '../resolvePublishedVersionRef'\n\ntype PageReferenceConfig = {\n\trelationTo?: string\n\tdocId?: string\n\turlField?: string\n\tcaptureVersion?: boolean\n}\n\nexport const pageReferenceSource = defineConsentSource<PageReferenceConfig>({\n\ttype: 'pageReference',\n\tlabel: keys.consentSourcePageReference,\n\tconfig: [\n\t\t{ name: 'relationTo', type: 'text', label: labelFor(keys.consentConfigRelationTo) },\n\t\t{ name: 'docId', type: 'text', label: labelFor(keys.consentConfigDocId) },\n\t\t{\n\t\t\tname: 'urlField',\n\t\t\ttype: 'text',\n\t\t\tlabel: labelFor(keys.consentConfigUrlField),\n\t\t\tdefaultValue: 'slug',\n\t\t},\n\t\t{\n\t\t\tname: 'captureVersion',\n\t\t\ttype: 'checkbox',\n\t\t\tlabel: labelFor(keys.consentConfigCaptureVersion),\n\t\t},\n\t],\n\tresolve: async ({ config, payload, req, locale }) => {\n\t\tconst relationTo = String(config.relationTo ?? '')\n\t\tconst docId = String(config.docId ?? '')\n\t\tconst urlField = String(config.urlField ?? 'slug')\n\t\tconst captureVersion = Boolean(config.captureVersion)\n\n\t\tif (!relationTo || !docId) {\n\t\t\treturn { links: [] }\n\t\t}\n\n\t\tconst doc = await payload\n\t\t\t.findByID({\n\t\t\t\tcollection: relationTo as never,\n\t\t\t\tid: docId,\n\t\t\t\tdepth: 0,\n\t\t\t\tlocale: locale as never,\n\t\t\t\treq,\n\t\t\t})\n\t\t\t.catch(() => null)\n\n\t\tif (!doc) {\n\t\t\treturn { links: [{ label: relationTo, url: '' }] }\n\t\t}\n\n\t\tconst docRecord = doc as Record<string, unknown>\n\t\tconst label = String(docRecord.title ?? docRecord[urlField] ?? relationTo)\n\t\tconst url = String(docRecord[urlField] ?? '')\n\n\t\tif (!captureVersion) {\n\t\t\treturn { links: [{ label, url }] }\n\t\t}\n\n\t\tconst v = await resolvePublishedVersionRef(payload, { collection: relationTo, id: docId })\n\t\treturn {\n\t\t\tlinks: [{ label, url }],\n\t\t\t...(v ? { versionRef: v.versionId, versionLabel: v.updatedAt } : {}),\n\t\t}\n\t},\n})\n"],"mappings":";;;;;AAYA,MAAa,sBAAsB,oBAAyC;CAC3E,MAAM;CACN,OAAO,KAAK;CACZ,QAAQ;EACP;GAAE,MAAM;GAAc,MAAM;GAAQ,OAAO,SAAS,KAAK,uBAAuB;EAAE;EAClF;GAAE,MAAM;GAAS,MAAM;GAAQ,OAAO,SAAS,KAAK,kBAAkB;EAAE;EACxE;GACC,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,qBAAqB;GAC1C,cAAc;EACf;EACA;GACC,MAAM;GACN,MAAM;GACN,OAAO,SAAS,KAAK,2BAA2B;EACjD;CACD;CACA,SAAS,OAAO,EAAE,QAAQ,SAAS,KAAK,aAAa;EACpD,MAAM,aAAa,OAAO,OAAO,cAAc,EAAE;EACjD,MAAM,QAAQ,OAAO,OAAO,SAAS,EAAE;EACvC,MAAM,WAAW,OAAO,OAAO,YAAY,MAAM;EACjD,MAAM,iBAAiB,QAAQ,OAAO,cAAc;EAEpD,IAAI,CAAC,cAAc,CAAC,OACnB,OAAO,EAAE,OAAO,CAAC,EAAE;EAGpB,MAAM,MAAM,MAAM,QAChB,SAAS;GACT,YAAY;GACZ,IAAI;GACJ,OAAO;GACC;GACR;EACD,CAAC,EACA,YAAY,IAAI;EAElB,IAAI,CAAC,KACJ,OAAO,EAAE,OAAO,CAAC;GAAE,OAAO;GAAY,KAAK;EAAG,CAAC,EAAE;EAGlD,MAAM,YAAY;EAClB,MAAM,QAAQ,OAAO,UAAU,SAAS,UAAU,aAAa,UAAU;EACzE,MAAM,MAAM,OAAO,UAAU,aAAa,EAAE;EAE5C,IAAI,CAAC,gBACJ,OAAO,EAAE,OAAO,CAAC;GAAE;GAAO;EAAI,CAAC,EAAE;EAGlC,MAAM,IAAI,MAAM,2BAA2B,SAAS;GAAE,YAAY;GAAY,IAAI;EAAM,CAAC;EACzF,OAAO;GACN,OAAO,CAAC;IAAE;IAAO;GAAI,CAAC;GACtB,GAAI,IAAI;IAAE,YAAY,EAAE;IAAW,cAAc,EAAE;GAAU,IAAI,CAAC;EACnE;CACD;AACD,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { keys } from "../../translations/keys.js";
|
|
2
|
-
import { labelFor } from "../../translations/server.js";
|
|
3
|
-
import { defineConsentSource } from "../defineConsentSource.js";
|
|
4
|
-
//#region src/consent/builtin/static.ts
|
|
5
|
-
const staticSource = defineConsentSource({
|
|
6
|
-
type: "static",
|
|
7
|
-
label: keys.consentSourceStatic,
|
|
8
|
-
config: [
|
|
9
|
-
{
|
|
10
|
-
name: "label",
|
|
11
|
-
type: "text",
|
|
12
|
-
label: labelFor(keys.consentConfigLabel)
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "url",
|
|
16
|
-
type: "text",
|
|
17
|
-
label: labelFor(keys.consentConfigUrl)
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "version",
|
|
21
|
-
type: "text",
|
|
22
|
-
label: labelFor(keys.consentConfigVersion)
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
resolve({ config }) {
|
|
26
|
-
const label = String(config.label ?? "");
|
|
27
|
-
const url = String(config.url ?? "");
|
|
28
|
-
const version = config.version ? String(config.version) : void 0;
|
|
29
|
-
return {
|
|
30
|
-
links: [{
|
|
31
|
-
label,
|
|
32
|
-
url
|
|
33
|
-
}],
|
|
34
|
-
...version ? {
|
|
35
|
-
versionRef: version,
|
|
36
|
-
versionLabel: version
|
|
37
|
-
} : {}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
//#endregion
|
|
42
|
-
export { staticSource };
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=static.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","names":[],"sources":["../../../src/consent/builtin/static.ts"],"sourcesContent":["import { keys } from '../../translations/keys'\nimport { labelFor } from '../../translations/server'\nimport { defineConsentSource } from '../defineConsentSource'\n\ntype StaticConfig = { label?: string; url?: string; version?: string }\n\nexport const staticSource = defineConsentSource<StaticConfig>({\n\ttype: 'static',\n\tlabel: keys.consentSourceStatic,\n\tconfig: [\n\t\t{ name: 'label', type: 'text', label: labelFor(keys.consentConfigLabel) },\n\t\t{ name: 'url', type: 'text', label: labelFor(keys.consentConfigUrl) },\n\t\t{ name: 'version', type: 'text', label: labelFor(keys.consentConfigVersion) },\n\t],\n\tresolve({ config }) {\n\t\tconst label = String(config.label ?? '')\n\t\tconst url = String(config.url ?? '')\n\t\tconst version = config.version ? String(config.version) : undefined\n\t\treturn {\n\t\t\tlinks: [{ label, url }],\n\t\t\t...(version ? { versionRef: version, versionLabel: version } : {}),\n\t\t}\n\t},\n})\n"],"mappings":";;;;AAMA,MAAa,eAAe,oBAAkC;CAC7D,MAAM;CACN,OAAO,KAAK;CACZ,QAAQ;EACP;GAAE,MAAM;GAAS,MAAM;GAAQ,OAAO,SAAS,KAAK,kBAAkB;EAAE;EACxE;GAAE,MAAM;GAAO,MAAM;GAAQ,OAAO,SAAS,KAAK,gBAAgB;EAAE;EACpE;GAAE,MAAM;GAAW,MAAM;GAAQ,OAAO,SAAS,KAAK,oBAAoB;EAAE;CAC7E;CACA,QAAQ,EAAE,UAAU;EACnB,MAAM,QAAQ,OAAO,OAAO,SAAS,EAAE;EACvC,MAAM,MAAM,OAAO,OAAO,OAAO,EAAE;EACnC,MAAM,UAAU,OAAO,UAAU,OAAO,OAAO,OAAO,IAAI,KAAA;EAC1D,OAAO;GACN,OAAO,CAAC;IAAE;IAAO;GAAI,CAAC;GACtB,GAAI,UAAU;IAAE,YAAY;IAAS,cAAc;GAAQ,IAAI,CAAC;EACjE;CACD;AACD,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Field, Payload, PayloadRequest } from "payload";
|
|
2
|
-
|
|
3
|
-
//#region src/consent/defineConsentSource.d.ts
|
|
4
|
-
type ConsentLink = {
|
|
5
|
-
label: string;
|
|
6
|
-
url: string;
|
|
7
|
-
};
|
|
8
|
-
type ConsentResolved = {
|
|
9
|
-
links: ConsentLink[];
|
|
10
|
-
versionRef?: string;
|
|
11
|
-
versionLabel?: string;
|
|
12
|
-
};
|
|
13
|
-
type ConsentResolveArgs<TConfig extends Record<string, unknown> = Record<string, unknown>> = {
|
|
14
|
-
config: TConfig;
|
|
15
|
-
payload: Payload;
|
|
16
|
-
req?: PayloadRequest;
|
|
17
|
-
locale: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A consent source type, authored once: `config` is the admin `Field[]` for authoring;
|
|
21
|
-
* `resolve` returns localized policy links and an optional version reference at capture time.
|
|
22
|
-
* Built-ins use this same primitive.
|
|
23
|
-
*/
|
|
24
|
-
type ConsentSource<TConfig extends Record<string, unknown> = Record<string, unknown>> = {
|
|
25
|
-
type: string;
|
|
26
|
-
label: string;
|
|
27
|
-
config?: Field[];
|
|
28
|
-
resolve: (args: ConsentResolveArgs<TConfig>) => Promise<ConsentResolved> | ConsentResolved;
|
|
29
|
-
};
|
|
30
|
-
/** Erased shape stored in the registry; config re-narrows per matched type at resolution. */
|
|
31
|
-
type AnyConsentSource = ConsentSource<Record<string, unknown>>;
|
|
32
|
-
declare const defineConsentSource: <TConfig extends Record<string, unknown> = Record<string, unknown>>(source: ConsentSource<TConfig>) => ConsentSource<TConfig>;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { AnyConsentSource, ConsentLink, ConsentResolveArgs, ConsentResolved, ConsentSource, defineConsentSource };
|
|
35
|
-
//# sourceMappingURL=defineConsentSource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineConsentSource.js","names":[],"sources":["../../src/consent/defineConsentSource.ts"],"sourcesContent":["import type { Field, Payload, PayloadRequest } from 'payload'\n\nexport type ConsentLink = { label: string; url: string }\nexport type ConsentResolved = { links: ConsentLink[]; versionRef?: string; versionLabel?: string }\n\nexport type ConsentResolveArgs<TConfig extends Record<string, unknown> = Record<string, unknown>> =\n\t{\n\t\tconfig: TConfig\n\t\tpayload: Payload\n\t\treq?: PayloadRequest\n\t\tlocale: string\n\t}\n\n/**\n * A consent source type, authored once: `config` is the admin `Field[]` for authoring;\n * `resolve` returns localized policy links and an optional version reference at capture time.\n * Built-ins use this same primitive.\n */\nexport type ConsentSource<TConfig extends Record<string, unknown> = Record<string, unknown>> = {\n\ttype: string\n\tlabel: string\n\tconfig?: Field[]\n\tresolve: (args: ConsentResolveArgs<TConfig>) => Promise<ConsentResolved> | ConsentResolved\n}\n\n/** Erased shape stored in the registry; config re-narrows per matched type at resolution. */\nexport type AnyConsentSource = ConsentSource<Record<string, unknown>>\n\nexport const defineConsentSource = <\n\tTConfig extends Record<string, unknown> = Record<string, unknown>,\n>(\n\tsource: ConsentSource<TConfig>\n): ConsentSource<TConfig> => source\n"],"mappings":";AA4BA,MAAa,uBAGZ,WAC4B"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AnyConsentSource } from "./defineConsentSource.js";
|
|
2
|
-
|
|
3
|
-
//#region src/consent/registry.d.ts
|
|
4
|
-
type ConsentSourceRegistry = Map<string, AnyConsentSource>;
|
|
5
|
-
/** `false` removes a built-in, `true` keeps it, a definition adds or replaces one. */
|
|
6
|
-
type ConsentSourceOption = boolean | AnyConsentSource;
|
|
7
|
-
type ConsentSourcesConfig = Record<string, ConsentSourceOption>;
|
|
8
|
-
/**
|
|
9
|
-
* Resolve the active consent-source registry from built-in defaults and a consumer override map.
|
|
10
|
-
* `false` removes a type, `true` keeps the default (no-op when none exists), a definition adds or
|
|
11
|
-
* replaces. Mirrors the action and field-type registry convention.
|
|
12
|
-
*/
|
|
13
|
-
declare const resolveConsentSources: (defaults: Record<string, AnyConsentSource>, config?: ConsentSourcesConfig) => ConsentSourceRegistry;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { ConsentSourceOption, ConsentSourceRegistry, ConsentSourcesConfig, resolveConsentSources };
|
|
16
|
-
//# sourceMappingURL=registry.d.ts.map
|
package/dist/consent/registry.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/consent/registry.ts
|
|
2
|
-
/**
|
|
3
|
-
* Resolve the active consent-source registry from built-in defaults and a consumer override map.
|
|
4
|
-
* `false` removes a type, `true` keeps the default (no-op when none exists), a definition adds or
|
|
5
|
-
* replaces. Mirrors the action and field-type registry convention.
|
|
6
|
-
*/
|
|
7
|
-
const resolveConsentSources = (defaults, config = {}) => {
|
|
8
|
-
const registry = new Map(Object.entries(defaults));
|
|
9
|
-
for (const [type, option] of Object.entries(config)) if (option === false) registry.delete(type);
|
|
10
|
-
else if (option === true) {} else registry.set(type, option);
|
|
11
|
-
return registry;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { resolveConsentSources };
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","names":[],"sources":["../../src/consent/registry.ts"],"sourcesContent":["import type { AnyConsentSource } from './defineConsentSource'\n\nexport type ConsentSourceRegistry = Map<string, AnyConsentSource>\n\n/** `false` removes a built-in, `true` keeps it, a definition adds or replaces one. */\nexport type ConsentSourceOption = boolean | AnyConsentSource\n\nexport type ConsentSourcesConfig = Record<string, ConsentSourceOption>\n\n/**\n * Resolve the active consent-source registry from built-in defaults and a consumer override map.\n * `false` removes a type, `true` keeps the default (no-op when none exists), a definition adds or\n * replaces. Mirrors the action and field-type registry convention.\n */\nexport const resolveConsentSources = (\n\tdefaults: Record<string, AnyConsentSource>,\n\tconfig: ConsentSourcesConfig = {}\n): ConsentSourceRegistry => {\n\tconst registry: ConsentSourceRegistry = new Map(Object.entries(defaults))\n\tfor (const [type, option] of Object.entries(config)) {\n\t\tif (option === false) {\n\t\t\tregistry.delete(type)\n\t\t} else if (option === true) {\n\t\t\t// keep the default; no-op when no default exists for this key\n\t\t} else {\n\t\t\tregistry.set(type, option)\n\t\t}\n\t}\n\treturn registry\n}\n"],"mappings":";;;;;;AAcA,MAAa,yBACZ,UACA,SAA+B,CAAC,MACL;CAC3B,MAAM,WAAkC,IAAI,IAAI,OAAO,QAAQ,QAAQ,CAAC;CACxE,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,MAAM,GACjD,IAAI,WAAW,OACd,SAAS,OAAO,IAAI;MACd,IAAI,WAAW,MAAM,CAE5B,OACC,SAAS,IAAI,MAAM,MAAM;CAG3B,OAAO;AACR"}
|