@10x-media/form-builder 0.1.0-beta.2 → 0.1.0-beta.21
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 +360 -0
- package/README.md +7 -5
- 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 +20 -0
- package/dist/actions/builtin/emailAction.js +120 -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 +17 -5
- package/dist/actions/defineAction.js.map +1 -1
- package/dist/actions/dispatch.js +51 -6
- package/dist/actions/dispatch.js.map +1 -1
- package/dist/actions/dispatchContext.js +13 -0
- package/dist/actions/dispatchContext.js.map +1 -0
- package/dist/actions/emailRecipients.d.ts +12 -0
- package/dist/actions/emailRecipients.js +146 -0
- package/dist/actions/emailRecipients.js.map +1 -0
- package/dist/actions/fromAddresses.d.ts +37 -0
- package/dist/actions/fromAddresses.js +131 -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 +5 -7
- 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 +47 -16
- 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 +41 -6
- package/dist/aggregation/resolveResultsRequest.js +97 -11
- package/dist/aggregation/resolveResultsRequest.js.map +1 -1
- package/dist/calc/computeCalcFields.d.ts +5 -3
- package/dist/calc/computeCalcFields.js +6 -4
- package/dist/calc/computeCalcFields.js.map +1 -1
- package/dist/calc/evaluate.d.ts +26 -3
- package/dist/calc/evaluate.js +34 -13
- package/dist/calc/evaluate.js.map +1 -1
- package/dist/calc/formatCalc.d.ts +11 -0
- package/dist/calc/formatCalc.js +35 -0
- package/dist/calc/formatCalc.js.map +1 -0
- package/dist/calc/formatCalcValue.d.ts +17 -0
- package/dist/calc/formatCalcValue.js +17 -0
- package/dist/calc/formatCalcValue.js.map +1 -0
- package/dist/calc/normalizeCalc.d.ts +17 -3
- package/dist/calc/normalizeCalc.js +42 -33
- package/dist/calc/normalizeCalc.js.map +1 -1
- package/dist/calc/registry.d.ts +43 -0
- package/dist/calc/registry.js +27 -0
- package/dist/calc/registry.js.map +1 -0
- package/dist/calc/resolveCalcContext.d.ts +36 -0
- package/dist/calc/resolveCalcContext.js +87 -0
- package/dist/calc/resolveCalcContext.js.map +1 -0
- package/dist/calc/types.d.ts +25 -4
- package/dist/calc/types.js +23 -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/CalcExpressionBuilder.d.ts +20 -0
- package/dist/client/CalcExpressionBuilder.js +890 -0
- package/dist/client/CalcExpressionBuilder.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 +55 -0
- package/dist/client/EndpointOptionsSelect.js +112 -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 +37 -0
- package/dist/client/RecipientsSelect.js +197 -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 +557 -0
- package/dist/client/endpointOptions.d.ts +11 -0
- package/dist/client/endpointOptions.js +38 -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 +114 -28
- package/dist/collections/formSubmissions.js.map +1 -1
- package/dist/collections/forms.js +449 -112
- package/dist/collections/forms.js.map +1 -1
- package/dist/collections/formsEndpoints.js +106 -0
- package/dist/collections/formsEndpoints.js.map +1 -0
- package/dist/collections/redirectFields.d.ts +29 -0
- package/dist/collections/settingsFields.d.ts +31 -0
- package/dist/collections/settingsFields.js +45 -0
- package/dist/collections/settingsFields.js.map +1 -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 +39 -11
- package/dist/consent/captureConsent.js +63 -13
- package/dist/consent/captureConsent.js.map +1 -1
- package/dist/consent/consentSourcesField.d.ts +66 -0
- package/dist/consent/consentSourcesField.js +98 -0
- package/dist/consent/consentSourcesField.js.map +1 -0
- package/dist/consent/effectiveStatement.js +16 -0
- package/dist/consent/effectiveStatement.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 +46 -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 +69 -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 +14 -1
- package/dist/exports/client.js +14 -1
- package/dist/exports/i18n.d.ts +5 -2
- package/dist/exports/i18n.js +5 -2
- package/dist/exports/react.d.ts +34 -10
- package/dist/exports/react.js +24 -4
- package/dist/exports/rsc.d.ts +10 -1
- package/dist/exports/rsc.js +10 -1
- package/dist/exports/types.d.ts +20 -12
- package/dist/fields/buildFieldBlocks.js +46 -25
- package/dist/fields/buildFieldBlocks.js.map +1 -1
- package/dist/fields/builtin/calculation.d.ts +17 -0
- package/dist/fields/builtin/calculation.js +193 -18
- package/dist/fields/builtin/calculation.js.map +1 -1
- package/dist/fields/builtin/checkbox.js +23 -0
- package/dist/fields/builtin/checkbox.js.map +1 -1
- package/dist/fields/builtin/consent.js +49 -14
- 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 +8 -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 +30 -0
- package/dist/fields/builtin/index.js +37 -10
- 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 +8 -3
- package/dist/fields/builtin/repeater.js.map +1 -1
- package/dist/fields/builtin/select.js +28 -4
- 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/builtin/text.js +7 -0
- package/dist/fields/builtin/text.js.map +1 -1
- 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 +125 -59
- package/dist/fields/sharedConfig.js.map +1 -1
- package/dist/fields/types.d.ts +78 -9
- 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 +23 -0
- package/dist/form/pollState.js +17 -0
- package/dist/form/pollState.js.map +1 -0
- package/dist/form/toFormDocument.d.ts +110 -0
- package/dist/form/toFormDocument.js +89 -0
- package/dist/form/toFormDocument.js.map +1 -0
- package/dist/form/types.d.ts +73 -0
- package/dist/index.d.ts +67 -61
- package/dist/index.js +120 -25
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +281 -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/customState.js +26 -0
- package/dist/plugin/customState.js.map +1 -0
- package/dist/plugin/registerCollections.js +43 -40
- 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 +53 -0
- package/dist/poll/closeJob.js +121 -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 +106 -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 +40 -0
- package/dist/poll/resolvePollOutcome.js +90 -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/poll/votes/aggregateFromVotes.d.ts +27 -0
- package/dist/poll/votes/aggregateFromVotes.js +54 -0
- package/dist/poll/votes/aggregateFromVotes.js.map +1 -0
- package/dist/poll/votes/answerValues.js +16 -0
- package/dist/poll/votes/answerValues.js.map +1 -0
- package/dist/poll/votes/bumpPollVote.js +88 -0
- package/dist/poll/votes/bumpPollVote.js.map +1 -0
- package/dist/poll/votes/recountPollVotes.d.ts +20 -0
- package/dist/poll/votes/recountPollVotes.js +63 -0
- package/dist/poll/votes/recountPollVotes.js.map +1 -0
- package/dist/poll/votes/voteTallyHook.js +76 -0
- package/dist/poll/votes/voteTallyHook.js.map +1 -0
- package/dist/poll/votes/votesCollection.d.ts +19 -0
- package/dist/poll/votes/votesCollection.js +89 -0
- package/dist/poll/votes/votesCollection.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 +77 -35
- package/dist/react/Form.js +368 -222
- package/dist/react/Form.js.map +1 -1
- package/dist/react/FormContext.d.ts +51 -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 +8 -3
- package/dist/react/FormResults.js +50 -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 +40 -6
- package/dist/react/Poll.js +137 -33
- package/dist/react/Poll.js.map +1 -1
- package/dist/react/adapters.d.ts +35 -0
- package/dist/react/adapters.js +11 -0
- package/dist/react/adapters.js.map +1 -0
- package/dist/react/captcha/HcaptchaCaptcha.d.ts +31 -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 +44 -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 +31 -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 +63 -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 +6 -2
- package/dist/react/primitives/Checkbox.js +4 -2
- package/dist/react/primitives/Checkbox.js.map +1 -1
- package/dist/react/primitives/ChoiceGroup.d.ts +40 -0
- package/dist/react/primitives/ChoiceGroup.js +33 -0
- package/dist/react/primitives/ChoiceGroup.js.map +1 -0
- package/dist/react/primitives/FieldShell.d.ts +13 -5
- package/dist/react/primitives/FieldShell.js +35 -32
- package/dist/react/primitives/FieldShell.js.map +1 -1
- package/dist/react/primitives/Input.d.ts +4 -2
- package/dist/react/primitives/Input.js +2 -1
- package/dist/react/primitives/Input.js.map +1 -1
- package/dist/react/renderers/calculation.js +7 -5
- package/dist/react/renderers/calculation.js.map +1 -1
- package/dist/react/renderers/checkbox.js +3 -5
- package/dist/react/renderers/checkbox.js.map +1 -1
- package/dist/react/renderers/consent.js +84 -36
- 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 +4 -5
- 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 +7 -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 +32 -14
- package/dist/react/renderers/repeater.js.map +1 -1
- package/dist/react/renderers/select.js +21 -6
- package/dist/react/renderers/select.js.map +1 -1
- package/dist/react/renderers/text.js +4 -5
- 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 +46 -3
- package/dist/react/state.js +73 -10
- package/dist/react/state.js.map +1 -1
- package/dist/react/submitForm.js +1 -1
- package/dist/react/submitForm.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/useCalcValues.d.ts +10 -0
- package/dist/react/useCalcValues.js +13 -0
- package/dist/react/useCalcValues.js.map +1 -0
- package/dist/react/useField.d.ts +0 -1
- package/dist/react/useField.js +7 -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 +15 -3
- 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 +25 -11
- package/dist/spam/spamGuard.js.map +1 -1
- package/dist/spam/types.d.ts +19 -4
- package/dist/submissions/SubmissionAnswers.js +6 -2
- package/dist/submissions/SubmissionAnswers.js.map +1 -1
- package/dist/submissions/SubmissionAnswersClient.js +100 -64
- package/dist/submissions/SubmissionAnswersClient.js.map +1 -1
- 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/formIdOf.js +13 -0
- package/dist/submissions/formIdOf.js.map +1 -0
- package/dist/submissions/resolveVotedSubmission.d.ts +27 -0
- package/dist/submissions/resolveVotedSubmission.js +51 -0
- package/dist/submissions/resolveVotedSubmission.js.map +1 -0
- package/dist/submissions/runSubmission.d.ts +10 -0
- package/dist/submissions/runSubmission.js +104 -54
- package/dist/submissions/runSubmission.js.map +1 -1
- package/dist/submissions/types.d.ts +11 -4
- package/dist/submissions/validateSubmission.js +99 -13
- 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/voteChangeEndpoint.js +105 -0
- package/dist/submissions/voteChangeEndpoint.js.map +1 -0
- package/dist/submissions/votedCookie.d.ts +15 -0
- package/dist/submissions/votedCookie.js +74 -0
- package/dist/submissions/votedCookie.js.map +1 -0
- package/dist/translations/clientRuntimeKeys.d.ts +17 -0
- package/dist/translations/clientRuntimeKeys.js +48 -0
- package/dist/translations/clientRuntimeKeys.js.map +1 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +380 -0
- package/dist/translations/de.js.map +1 -0
- package/dist/translations/en.js +250 -28
- 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 +245 -23
- package/dist/translations/keys.js +246 -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 +14 -1
- package/dist/validation/builtin/index.js.map +1 -1
- package/dist/validation/builtin/integer.js +15 -0
- package/dist/validation/builtin/integer.js.map +1 -0
- 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 +5 -1
- 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 +8 -29
- 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 +14 -6
- package/styles/form-builder.css +94 -190
- package/dist/collections/uploads.d.ts +0 -30
- package/dist/collections/uploads.js +0 -55
- 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,6 @@
|
|
|
1
|
+
//#region src/actions/body/escapeHtml.d.ts
|
|
2
|
+
/** Escape `&`, `<`, `>`, `"`, `'` for safe embedding in HTML text or attribute values. */
|
|
3
|
+
declare const escapeHtml: (value: string) => string;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { escapeHtml };
|
|
6
|
+
//# sourceMappingURL=escapeHtml.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/actions/body/escapeHtml.ts
|
|
2
|
+
const REPLACEMENTS = {
|
|
3
|
+
"&": "&",
|
|
4
|
+
"<": "<",
|
|
5
|
+
">": ">",
|
|
6
|
+
"\"": """,
|
|
7
|
+
"'": "'"
|
|
8
|
+
};
|
|
9
|
+
/** Escape `&`, `<`, `>`, `"`, `'` for safe embedding in HTML text or attribute values. */
|
|
10
|
+
const escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => REPLACEMENTS[char] ?? char);
|
|
11
|
+
//#endregion
|
|
12
|
+
export { escapeHtml };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=escapeHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeHtml.js","names":[],"sources":["../../../src/actions/body/escapeHtml.ts"],"sourcesContent":["const REPLACEMENTS: Record<string, string> = {\n\t'&': '&',\n\t'<': '<',\n\t'>': '>',\n\t'\"': '"',\n\t\"'\": ''',\n}\n\n/** Escape `&`, `<`, `>`, `\"`, `'` for safe embedding in HTML text or attribute values. */\nexport const escapeHtml = (value: string): string =>\n\tvalue.replace(/[&<>\"']/g, (char) => REPLACEMENTS[char] ?? char)\n"],"mappings":";AAAA,MAAM,eAAuC;CAC5C,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAK;CACL,KAAK;AACN;;AAGA,MAAa,cAAc,UAC1B,MAAM,QAAQ,aAAa,SAAS,aAAa,SAAS,IAAI"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SubmissionDescriptor, SubmissionValue } from "../../submissions/types.js";
|
|
2
|
+
import { BodyConverter } from "./converters.js";
|
|
3
|
+
import { PayloadRequest, RichTextField } from "payload";
|
|
4
|
+
|
|
5
|
+
//#region src/actions/body/serializeBody.d.ts
|
|
6
|
+
/** Minimal form identity threaded alongside a rendered body (e.g. per-tenant template lookups). */
|
|
7
|
+
type SerializeBodyForm = {
|
|
8
|
+
id: number | string;
|
|
9
|
+
title?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Submission data plus optional converter overrides available while serializing a body. */
|
|
12
|
+
type BodyContext = {
|
|
13
|
+
values: SubmissionValue[];
|
|
14
|
+
descriptors: SubmissionDescriptor[];
|
|
15
|
+
converters?: Record<string, BodyConverter>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Args a custom `richText.serialize` replacement receives per rendered body. Always populated by
|
|
19
|
+
* `makeRenderBody` (the action-body pipeline): `form` and `req` enable per-tenant template
|
|
20
|
+
* lookups or handing the body off to a renderer like react-email.
|
|
21
|
+
*/
|
|
22
|
+
type SerializeBodyArgs = {
|
|
23
|
+
body: unknown;
|
|
24
|
+
values: SubmissionValue[];
|
|
25
|
+
descriptors: SubmissionDescriptor[];
|
|
26
|
+
form: SerializeBodyForm;
|
|
27
|
+
req?: PayloadRequest;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Customizes how the plugin's rich text is authored and rendered. `converters` spread over the
|
|
31
|
+
* default Lexical node converters; `serialize` replaces the whole action-body pipeline (for
|
|
32
|
+
* non-HTML channels like chat or plain text, or to hand the body plus the submitted `form`/`req`
|
|
33
|
+
* off to a renderer like react-email). `editor` is the default Lexical/richText editor for every
|
|
34
|
+
* plugin-authored richText field: message content, consent statement, the response message, and
|
|
35
|
+
* the action body fields. `bodyEditor` overrides the action body fields specifically (emailTeam
|
|
36
|
+
* and confirmation), and `responseEditor` overrides the success `response` message field; both fall
|
|
37
|
+
* back to `editor` when absent.
|
|
38
|
+
*/
|
|
39
|
+
type RichTextBodyOption = {
|
|
40
|
+
converters?: Record<string, BodyConverter>;
|
|
41
|
+
serialize?: (args: SerializeBodyArgs) => Promise<string> | string;
|
|
42
|
+
editor?: RichTextField['editor'];
|
|
43
|
+
bodyEditor?: RichTextField['editor'];
|
|
44
|
+
responseEditor?: RichTextField['editor'];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Serialize an action's `body` config into HTML. A legacy string body is interpolated as-is
|
|
48
|
+
* (pre-richText behavior, no escaping); a Lexical state walks the converter registry; a Slate
|
|
49
|
+
* array uses the minimal legacy serializer; anything else yields `''`. Rendered text is
|
|
50
|
+
* HTML-escaped and supports `{{ name|fallback }}`, `{{*}}`, and `{{*:table}}` tokens.
|
|
51
|
+
*/
|
|
52
|
+
declare const serializeBody: (body: unknown, ctx: BodyContext) => string;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { BodyContext, RichTextBodyOption, SerializeBodyArgs, serializeBody };
|
|
55
|
+
//# sourceMappingURL=serializeBody.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { interpolate } from "../../recall/interpolate.js";
|
|
2
|
+
import { escapeHtml } from "./escapeHtml.js";
|
|
3
|
+
import { defaultBodyConverters } from "./converters.js";
|
|
4
|
+
import { serializeSlate } from "./serializeSlate.js";
|
|
5
|
+
import { renderAllValues, renderAllValuesTable } from "./wildcards.js";
|
|
6
|
+
//#region src/actions/body/serializeBody.ts
|
|
7
|
+
/** Recall resolver over submission values: field name to stringified value, `''` when absent. */
|
|
8
|
+
const resolverFor = (values) => (name) => {
|
|
9
|
+
const entry = values.find((value) => value.field === name);
|
|
10
|
+
return entry == null ? "" : String(entry.value ?? "");
|
|
11
|
+
};
|
|
12
|
+
const renderFor = (ctx) => {
|
|
13
|
+
const resolve = resolverFor(ctx.values);
|
|
14
|
+
const htmlResolve = (name) => {
|
|
15
|
+
if (name === "*") return renderAllValues(ctx.values, ctx.descriptors);
|
|
16
|
+
if (name === "*:table") return renderAllValuesTable(ctx.values, ctx.descriptors);
|
|
17
|
+
return escapeHtml(resolve(name));
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
text: (raw) => interpolate(escapeHtml(raw), htmlResolve),
|
|
21
|
+
interpolate: (raw) => interpolate(raw, resolve)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const serializeNodes = (nodes, converters, render) => nodes.map((node) => {
|
|
25
|
+
if (node == null || typeof node !== "object") return "";
|
|
26
|
+
const lexicalNode = node;
|
|
27
|
+
const children = Array.isArray(lexicalNode.children) ? serializeNodes(lexicalNode.children, converters, render) : "";
|
|
28
|
+
const converter = typeof lexicalNode.type === "string" ? converters[lexicalNode.type] : void 0;
|
|
29
|
+
return converter ? converter({
|
|
30
|
+
node: lexicalNode,
|
|
31
|
+
children,
|
|
32
|
+
render
|
|
33
|
+
}) : children;
|
|
34
|
+
}).join("");
|
|
35
|
+
const lexicalRootOf = (body) => {
|
|
36
|
+
if (body == null || typeof body !== "object" || Array.isArray(body)) return null;
|
|
37
|
+
const root = body.root;
|
|
38
|
+
return root != null && typeof root === "object" ? root : null;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Serialize an action's `body` config into HTML. A legacy string body is interpolated as-is
|
|
42
|
+
* (pre-richText behavior, no escaping); a Lexical state walks the converter registry; a Slate
|
|
43
|
+
* array uses the minimal legacy serializer; anything else yields `''`. Rendered text is
|
|
44
|
+
* HTML-escaped and supports `{{ name|fallback }}`, `{{*}}`, and `{{*:table}}` tokens.
|
|
45
|
+
*/
|
|
46
|
+
const serializeBody = (body, ctx) => {
|
|
47
|
+
if (typeof body === "string") return interpolate(body, resolverFor(ctx.values));
|
|
48
|
+
const render = renderFor(ctx);
|
|
49
|
+
if (Array.isArray(body)) return serializeSlate(body, render);
|
|
50
|
+
const root = lexicalRootOf(body);
|
|
51
|
+
if (root) {
|
|
52
|
+
const converters = {
|
|
53
|
+
...defaultBodyConverters,
|
|
54
|
+
...ctx.converters ?? {}
|
|
55
|
+
};
|
|
56
|
+
return serializeNodes(Array.isArray(root.children) ? root.children : [], converters, render);
|
|
57
|
+
}
|
|
58
|
+
return "";
|
|
59
|
+
};
|
|
60
|
+
/** Build the `renderBody` passed to actions, honoring a plugin-level `richText` customization. */
|
|
61
|
+
const makeRenderBody = (args) => async (body) => {
|
|
62
|
+
if (args.richText?.serialize) return await args.richText.serialize({
|
|
63
|
+
body,
|
|
64
|
+
values: args.values,
|
|
65
|
+
descriptors: args.descriptors,
|
|
66
|
+
form: args.form,
|
|
67
|
+
req: args.req
|
|
68
|
+
});
|
|
69
|
+
return serializeBody(body, {
|
|
70
|
+
values: args.values,
|
|
71
|
+
descriptors: args.descriptors,
|
|
72
|
+
converters: args.richText?.converters
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { makeRenderBody, resolverFor, serializeBody };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=serializeBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeBody.js","names":[],"sources":["../../../src/actions/body/serializeBody.ts"],"sourcesContent":["import type { PayloadRequest, RichTextField } from 'payload'\nimport { interpolate } from '../../recall/interpolate'\nimport type { SubmissionDescriptor, SubmissionValue } from '../../submissions/types'\nimport type { BodyConverter, BodyRender } from './converters'\nimport { defaultBodyConverters } from './converters'\nimport { escapeHtml } from './escapeHtml'\nimport { serializeSlate } from './serializeSlate'\nimport { renderAllValues, renderAllValuesTable } from './wildcards'\n\n/** Minimal form identity threaded alongside a rendered body (e.g. per-tenant template lookups). */\ntype SerializeBodyForm = { id: number | string; title?: string }\n\n/** Submission data plus optional converter overrides available while serializing a body. */\nexport type BodyContext = {\n\tvalues: SubmissionValue[]\n\tdescriptors: SubmissionDescriptor[]\n\tconverters?: Record<string, BodyConverter>\n}\n\n/**\n * Args a custom `richText.serialize` replacement receives per rendered body. Always populated by\n * `makeRenderBody` (the action-body pipeline): `form` and `req` enable per-tenant template\n * lookups or handing the body off to a renderer like react-email.\n */\nexport type SerializeBodyArgs = {\n\tbody: unknown\n\tvalues: SubmissionValue[]\n\tdescriptors: SubmissionDescriptor[]\n\tform: SerializeBodyForm\n\treq?: PayloadRequest\n}\n\n/**\n * Customizes how the plugin's rich text is authored and rendered. `converters` spread over the\n * default Lexical node converters; `serialize` replaces the whole action-body pipeline (for\n * non-HTML channels like chat or plain text, or to hand the body plus the submitted `form`/`req`\n * off to a renderer like react-email). `editor` is the default Lexical/richText editor for every\n * plugin-authored richText field: message content, consent statement, the response message, and\n * the action body fields. `bodyEditor` overrides the action body fields specifically (emailTeam\n * and confirmation), and `responseEditor` overrides the success `response` message field; both fall\n * back to `editor` when absent.\n */\nexport type RichTextBodyOption = {\n\tconverters?: Record<string, BodyConverter>\n\tserialize?: (args: SerializeBodyArgs) => Promise<string> | string\n\teditor?: RichTextField['editor']\n\tbodyEditor?: RichTextField['editor']\n\tresponseEditor?: RichTextField['editor']\n}\n\n/** Recall resolver over submission values: field name to stringified value, `''` when absent. */\nexport const resolverFor =\n\t(values: SubmissionValue[]) =>\n\t(name: string): string => {\n\t\tconst entry = values.find((value) => value.field === name)\n\t\treturn entry == null ? '' : String(entry.value ?? '')\n\t}\n\nconst renderFor = (ctx: BodyContext): BodyRender => {\n\tconst resolve = resolverFor(ctx.values)\n\tconst htmlResolve = (name: string): string => {\n\t\tif (name === '*') {\n\t\t\treturn renderAllValues(ctx.values, ctx.descriptors)\n\t\t}\n\t\tif (name === '*:table') {\n\t\t\treturn renderAllValuesTable(ctx.values, ctx.descriptors)\n\t\t}\n\t\treturn escapeHtml(resolve(name))\n\t}\n\treturn {\n\t\ttext: (raw) => interpolate(escapeHtml(raw), htmlResolve),\n\t\tinterpolate: (raw) => interpolate(raw, resolve),\n\t}\n}\n\nconst serializeNodes = (\n\tnodes: unknown[],\n\tconverters: Record<string, BodyConverter>,\n\trender: BodyRender\n): string =>\n\tnodes\n\t\t.map((node) => {\n\t\t\tif (node == null || typeof node !== 'object') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst lexicalNode = node as Record<string, unknown>\n\t\t\tconst children = Array.isArray(lexicalNode.children)\n\t\t\t\t? serializeNodes(lexicalNode.children, converters, render)\n\t\t\t\t: ''\n\t\t\tconst converter =\n\t\t\t\ttypeof lexicalNode.type === 'string' ? converters[lexicalNode.type] : undefined\n\t\t\treturn converter ? converter({ node: lexicalNode, children, render }) : children\n\t\t})\n\t\t.join('')\n\nconst lexicalRootOf = (body: unknown): Record<string, unknown> | null => {\n\tif (body == null || typeof body !== 'object' || Array.isArray(body)) {\n\t\treturn null\n\t}\n\tconst root = (body as { root?: unknown }).root\n\treturn root != null && typeof root === 'object' ? (root as Record<string, unknown>) : null\n}\n\n/**\n * Serialize an action's `body` config into HTML. A legacy string body is interpolated as-is\n * (pre-richText behavior, no escaping); a Lexical state walks the converter registry; a Slate\n * array uses the minimal legacy serializer; anything else yields `''`. Rendered text is\n * HTML-escaped and supports `{{ name|fallback }}`, `{{*}}`, and `{{*:table}}` tokens.\n */\nexport const serializeBody = (body: unknown, ctx: BodyContext): string => {\n\tif (typeof body === 'string') {\n\t\treturn interpolate(body, resolverFor(ctx.values))\n\t}\n\tconst render = renderFor(ctx)\n\tif (Array.isArray(body)) {\n\t\treturn serializeSlate(body, render)\n\t}\n\tconst root = lexicalRootOf(body)\n\tif (root) {\n\t\tconst converters = { ...defaultBodyConverters, ...(ctx.converters ?? {}) }\n\t\treturn serializeNodes(Array.isArray(root.children) ? root.children : [], converters, render)\n\t}\n\treturn ''\n}\n\n/** Build the `renderBody` passed to actions, honoring a plugin-level `richText` customization. */\nexport const makeRenderBody =\n\t(args: {\n\t\tvalues: SubmissionValue[]\n\t\tdescriptors: SubmissionDescriptor[]\n\t\tform: SerializeBodyForm\n\t\treq?: PayloadRequest\n\t\trichText?: RichTextBodyOption\n\t}) =>\n\tasync (body: unknown): Promise<string> => {\n\t\tif (args.richText?.serialize) {\n\t\t\treturn await args.richText.serialize({\n\t\t\t\tbody,\n\t\t\t\tvalues: args.values,\n\t\t\t\tdescriptors: args.descriptors,\n\t\t\t\tform: args.form,\n\t\t\t\treq: args.req,\n\t\t\t})\n\t\t}\n\t\treturn serializeBody(body, {\n\t\t\tvalues: args.values,\n\t\t\tdescriptors: args.descriptors,\n\t\t\tconverters: args.richText?.converters,\n\t\t})\n\t}\n"],"mappings":";;;;;;;AAmDA,MAAa,eACX,YACA,SAAyB;CACzB,MAAM,QAAQ,OAAO,MAAM,UAAU,MAAM,UAAU,IAAI;CACzD,OAAO,SAAS,OAAO,KAAK,OAAO,MAAM,SAAS,EAAE;AACrD;AAED,MAAM,aAAa,QAAiC;CACnD,MAAM,UAAU,YAAY,IAAI,MAAM;CACtC,MAAM,eAAe,SAAyB;EAC7C,IAAI,SAAS,KACZ,OAAO,gBAAgB,IAAI,QAAQ,IAAI,WAAW;EAEnD,IAAI,SAAS,WACZ,OAAO,qBAAqB,IAAI,QAAQ,IAAI,WAAW;EAExD,OAAO,WAAW,QAAQ,IAAI,CAAC;CAChC;CACA,OAAO;EACN,OAAO,QAAQ,YAAY,WAAW,GAAG,GAAG,WAAW;EACvD,cAAc,QAAQ,YAAY,KAAK,OAAO;CAC/C;AACD;AAEA,MAAM,kBACL,OACA,YACA,WAEA,MACE,KAAK,SAAS;CACd,IAAI,QAAQ,QAAQ,OAAO,SAAS,UACnC,OAAO;CAER,MAAM,cAAc;CACpB,MAAM,WAAW,MAAM,QAAQ,YAAY,QAAQ,IAChD,eAAe,YAAY,UAAU,YAAY,MAAM,IACvD;CACH,MAAM,YACL,OAAO,YAAY,SAAS,WAAW,WAAW,YAAY,QAAQ,KAAA;CACvE,OAAO,YAAY,UAAU;EAAE,MAAM;EAAa;EAAU;CAAO,CAAC,IAAI;AACzE,CAAC,EACA,KAAK,EAAE;AAEV,MAAM,iBAAiB,SAAkD;CACxE,IAAI,QAAQ,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GACjE,OAAO;CAER,MAAM,OAAQ,KAA4B;CAC1C,OAAO,QAAQ,QAAQ,OAAO,SAAS,WAAY,OAAmC;AACvF;;;;;;;AAQA,MAAa,iBAAiB,MAAe,QAA6B;CACzE,IAAI,OAAO,SAAS,UACnB,OAAO,YAAY,MAAM,YAAY,IAAI,MAAM,CAAC;CAEjD,MAAM,SAAS,UAAU,GAAG;CAC5B,IAAI,MAAM,QAAQ,IAAI,GACrB,OAAO,eAAe,MAAM,MAAM;CAEnC,MAAM,OAAO,cAAc,IAAI;CAC/B,IAAI,MAAM;EACT,MAAM,aAAa;GAAE,GAAG;GAAuB,GAAI,IAAI,cAAc,CAAC;EAAG;EACzE,OAAO,eAAe,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAK,WAAW,CAAC,GAAG,YAAY,MAAM;CAC5F;CACA,OAAO;AACR;;AAGA,MAAa,kBACX,SAOD,OAAO,SAAmC;CACzC,IAAI,KAAK,UAAU,WAClB,OAAO,MAAM,KAAK,SAAS,UAAU;EACpC;EACA,QAAQ,KAAK;EACb,aAAa,KAAK;EAClB,MAAM,KAAK;EACX,KAAK,KAAK;CACX,CAAC;CAEF,OAAO,cAAc,MAAM;EAC1B,QAAQ,KAAK;EACb,aAAa,KAAK;EAClB,YAAY,KAAK,UAAU;CAC5B,CAAC;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { escapeHtml } from "./escapeHtml.js";
|
|
2
|
+
import { sanitizeUrl } from "./converters.js";
|
|
3
|
+
//#region src/actions/body/serializeSlate.ts
|
|
4
|
+
const leaf = (node, render) => {
|
|
5
|
+
let html = render.text(typeof node.text === "string" ? node.text : "");
|
|
6
|
+
if (node.code === true) html = `<code>${html}</code>`;
|
|
7
|
+
if (node.bold === true) html = `<strong>${html}</strong>`;
|
|
8
|
+
if (node.italic === true) html = `<em>${html}</em>`;
|
|
9
|
+
if (node.underline === true) html = `<u>${html}</u>`;
|
|
10
|
+
return html;
|
|
11
|
+
};
|
|
12
|
+
const serializeNode = (node, render) => {
|
|
13
|
+
if (node == null || typeof node !== "object") return "";
|
|
14
|
+
const slateNode = node;
|
|
15
|
+
if (typeof slateNode.text === "string") return leaf(slateNode, render);
|
|
16
|
+
const children = Array.isArray(slateNode.children) ? slateNode.children.map((child) => serializeNode(child, render)).join("") : "";
|
|
17
|
+
if (slateNode.type === "link") {
|
|
18
|
+
const raw = typeof slateNode.url === "string" ? slateNode.url : "";
|
|
19
|
+
return `<a href="${escapeHtml(sanitizeUrl(render.interpolate(raw)))}">${children}</a>`;
|
|
20
|
+
}
|
|
21
|
+
return `<p>${children}</p>`;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Minimal legacy Slate serializer: paragraph-ish elements, bold/italic/underline/code marks, links.
|
|
25
|
+
* Strikethrough is intentionally unsupported for legacy Slate bodies.
|
|
26
|
+
*/
|
|
27
|
+
const serializeSlate = (nodes, render) => nodes.map((node) => serializeNode(node, render)).join("");
|
|
28
|
+
//#endregion
|
|
29
|
+
export { serializeSlate };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=serializeSlate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeSlate.js","names":[],"sources":["../../../src/actions/body/serializeSlate.ts"],"sourcesContent":["import type { BodyRender } from './converters'\nimport { sanitizeUrl } from './converters'\nimport { escapeHtml } from './escapeHtml'\n\ntype SlateNode = Record<string, unknown>\n\nconst leaf = (node: SlateNode, render: BodyRender): string => {\n\tlet html = render.text(typeof node.text === 'string' ? node.text : '')\n\tif (node.code === true) {\n\t\thtml = `<code>${html}</code>`\n\t}\n\tif (node.bold === true) {\n\t\thtml = `<strong>${html}</strong>`\n\t}\n\tif (node.italic === true) {\n\t\thtml = `<em>${html}</em>`\n\t}\n\tif (node.underline === true) {\n\t\thtml = `<u>${html}</u>`\n\t}\n\treturn html\n}\n\nconst serializeNode = (node: unknown, render: BodyRender): string => {\n\tif (node == null || typeof node !== 'object') {\n\t\treturn ''\n\t}\n\tconst slateNode = node as SlateNode\n\tif (typeof slateNode.text === 'string') {\n\t\treturn leaf(slateNode, render)\n\t}\n\tconst children = Array.isArray(slateNode.children)\n\t\t? slateNode.children.map((child) => serializeNode(child, render)).join('')\n\t\t: ''\n\tif (slateNode.type === 'link') {\n\t\tconst raw = typeof slateNode.url === 'string' ? slateNode.url : ''\n\t\tconst href = escapeHtml(sanitizeUrl(render.interpolate(raw)))\n\t\treturn `<a href=\"${href}\">${children}</a>`\n\t}\n\treturn `<p>${children}</p>`\n}\n\n/**\n * Minimal legacy Slate serializer: paragraph-ish elements, bold/italic/underline/code marks, links.\n * Strikethrough is intentionally unsupported for legacy Slate bodies.\n */\nexport const serializeSlate = (nodes: unknown[], render: BodyRender): string =>\n\tnodes.map((node) => serializeNode(node, render)).join('')\n"],"mappings":";;;AAMA,MAAM,QAAQ,MAAiB,WAA+B;CAC7D,IAAI,OAAO,OAAO,KAAK,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,EAAE;CACrE,IAAI,KAAK,SAAS,MACjB,OAAO,SAAS,KAAK;CAEtB,IAAI,KAAK,SAAS,MACjB,OAAO,WAAW,KAAK;CAExB,IAAI,KAAK,WAAW,MACnB,OAAO,OAAO,KAAK;CAEpB,IAAI,KAAK,cAAc,MACtB,OAAO,MAAM,KAAK;CAEnB,OAAO;AACR;AAEA,MAAM,iBAAiB,MAAe,WAA+B;CACpE,IAAI,QAAQ,QAAQ,OAAO,SAAS,UACnC,OAAO;CAER,MAAM,YAAY;CAClB,IAAI,OAAO,UAAU,SAAS,UAC7B,OAAO,KAAK,WAAW,MAAM;CAE9B,MAAM,WAAW,MAAM,QAAQ,UAAU,QAAQ,IAC9C,UAAU,SAAS,KAAK,UAAU,cAAc,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,IACvE;CACH,IAAI,UAAU,SAAS,QAAQ;EAC9B,MAAM,MAAM,OAAO,UAAU,QAAQ,WAAW,UAAU,MAAM;EAEhE,OAAO,YADM,WAAW,YAAY,OAAO,YAAY,GAAG,CAAC,CACrC,EAAE,IAAI,SAAS;CACtC;CACA,OAAO,MAAM,SAAS;AACvB;;;;;AAMA,MAAa,kBAAkB,OAAkB,WAChD,MAAM,KAAK,SAAS,cAAc,MAAM,MAAM,CAAC,EAAE,KAAK,EAAE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/actions/body/textOfBody.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Plain-text content of a body (Lexical rich text, legacy Slate, or a legacy string): leaf text
|
|
4
|
+
* nodes concatenated in document order, block-level nodes (paragraph, heading, list item, quote)
|
|
5
|
+
* joined by single spaces, whitespace collapsed, so multi-block content flattens to a readable
|
|
6
|
+
* sentence. For accessible names and previews, where formatting and links collapse to their
|
|
7
|
+
* visible words. A plain string passes through untouched; unrecognized shapes yield `''`;
|
|
8
|
+
* never throws.
|
|
9
|
+
*/
|
|
10
|
+
declare const textOfBody: (body: unknown) => string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { textOfBody };
|
|
13
|
+
//# sourceMappingURL=textOfBody.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/actions/body/textOfBody.ts
|
|
2
|
+
const isNode = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
/** Children-bearing block-level node types whose text reads as a separate run. */
|
|
4
|
+
const BLOCK_TYPES = new Set([
|
|
5
|
+
"paragraph",
|
|
6
|
+
"heading",
|
|
7
|
+
"listitem",
|
|
8
|
+
"quote"
|
|
9
|
+
]);
|
|
10
|
+
const textOfNode = (node) => {
|
|
11
|
+
if (!isNode(node)) return "";
|
|
12
|
+
if (typeof node.text === "string") return node.text;
|
|
13
|
+
const children = Array.isArray(node.children) ? node.children.map(textOfNode).join("") : "";
|
|
14
|
+
if (children !== "" && typeof node.type === "string" && BLOCK_TYPES.has(node.type)) return ` ${children} `;
|
|
15
|
+
return children;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Plain-text content of a body (Lexical rich text, legacy Slate, or a legacy string): leaf text
|
|
19
|
+
* nodes concatenated in document order, block-level nodes (paragraph, heading, list item, quote)
|
|
20
|
+
* joined by single spaces, whitespace collapsed, so multi-block content flattens to a readable
|
|
21
|
+
* sentence. For accessible names and previews, where formatting and links collapse to their
|
|
22
|
+
* visible words. A plain string passes through untouched; unrecognized shapes yield `''`;
|
|
23
|
+
* never throws.
|
|
24
|
+
*/
|
|
25
|
+
const textOfBody = (body) => {
|
|
26
|
+
if (typeof body === "string") return body;
|
|
27
|
+
const root = isNode(body) ? body.root : void 0;
|
|
28
|
+
const nodes = Array.isArray(body) ? body : isNode(root) && Array.isArray(root.children) ? root.children : null;
|
|
29
|
+
if (!nodes) return "";
|
|
30
|
+
return nodes.map(textOfNode).join("").replace(/\s+/g, " ").trim();
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { textOfBody };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=textOfBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textOfBody.js","names":[],"sources":["../../../src/actions/body/textOfBody.ts"],"sourcesContent":["type BodyNode = Record<string, unknown>\n\nconst isNode = (value: unknown): value is BodyNode =>\n\tvalue != null && typeof value === 'object' && !Array.isArray(value)\n\n/** Children-bearing block-level node types whose text reads as a separate run. */\nconst BLOCK_TYPES = new Set(['paragraph', 'heading', 'listitem', 'quote'])\n\nconst textOfNode = (node: unknown): string => {\n\tif (!isNode(node)) {\n\t\treturn ''\n\t}\n\tif (typeof node.text === 'string') {\n\t\treturn node.text\n\t}\n\tconst children = Array.isArray(node.children) ? node.children.map(textOfNode).join('') : ''\n\tif (children !== '' && typeof node.type === 'string' && BLOCK_TYPES.has(node.type)) {\n\t\treturn ` ${children} `\n\t}\n\treturn children\n}\n\n/**\n * Plain-text content of a body (Lexical rich text, legacy Slate, or a legacy string): leaf text\n * nodes concatenated in document order, block-level nodes (paragraph, heading, list item, quote)\n * joined by single spaces, whitespace collapsed, so multi-block content flattens to a readable\n * sentence. For accessible names and previews, where formatting and links collapse to their\n * visible words. A plain string passes through untouched; unrecognized shapes yield `''`;\n * never throws.\n */\nexport const textOfBody = (body: unknown): string => {\n\tif (typeof body === 'string') {\n\t\treturn body\n\t}\n\tconst root = isNode(body) ? body.root : undefined\n\tconst nodes = Array.isArray(body)\n\t\t? body\n\t\t: isNode(root) && Array.isArray(root.children)\n\t\t\t? root.children\n\t\t\t: null\n\tif (!nodes) {\n\t\treturn ''\n\t}\n\treturn nodes.map(textOfNode).join('').replace(/\\s+/g, ' ').trim()\n}\n"],"mappings":";AAEA,MAAM,UAAU,UACf,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;;AAGnE,MAAM,cAAc,IAAI,IAAI;CAAC;CAAa;CAAW;CAAY;AAAO,CAAC;AAEzE,MAAM,cAAc,SAA0B;CAC7C,IAAI,CAAC,OAAO,IAAI,GACf,OAAO;CAER,IAAI,OAAO,KAAK,SAAS,UACxB,OAAO,KAAK;CAEb,MAAM,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAK,SAAS,IAAI,UAAU,EAAE,KAAK,EAAE,IAAI;CACzF,IAAI,aAAa,MAAM,OAAO,KAAK,SAAS,YAAY,YAAY,IAAI,KAAK,IAAI,GAChF,OAAO,IAAI,SAAS;CAErB,OAAO;AACR;;;;;;;;;AAUA,MAAa,cAAc,SAA0B;CACpD,IAAI,OAAO,SAAS,UACnB,OAAO;CAER,MAAM,OAAO,OAAO,IAAI,IAAI,KAAK,OAAO,KAAA;CACxC,MAAM,QAAQ,MAAM,QAAQ,IAAI,IAC7B,OACA,OAAO,IAAI,KAAK,MAAM,QAAQ,KAAK,QAAQ,IAC1C,KAAK,WACL;CACJ,IAAI,CAAC,OACJ,OAAO;CAER,OAAO,MAAM,IAAI,UAAU,EAAE,KAAK,EAAE,EAAE,QAAQ,QAAQ,GAAG,EAAE,KAAK;AACjE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SubmissionDescriptor, SubmissionValue } from "../../submissions/types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/actions/body/wildcards.d.ts
|
|
4
|
+
/** All answers as HTML-escaped `Label: value` lines joined with `<br />`. */
|
|
5
|
+
declare const renderAllValues: (values: SubmissionValue[], descriptors: SubmissionDescriptor[]) => string;
|
|
6
|
+
/** All answers as a simple HTML-escaped two-column table. */
|
|
7
|
+
declare const renderAllValuesTable: (values: SubmissionValue[], descriptors: SubmissionDescriptor[]) => string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { renderAllValues, renderAllValuesTable };
|
|
10
|
+
//# sourceMappingURL=wildcards.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { escapeHtml } from "./escapeHtml.js";
|
|
2
|
+
//#region src/actions/body/wildcards.ts
|
|
3
|
+
const displayValue = (value, descriptor) => {
|
|
4
|
+
if (value == null) return "";
|
|
5
|
+
if (Array.isArray(value)) return value.map((entry) => displayValue(entry, descriptor)).join(", ");
|
|
6
|
+
const raw = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
7
|
+
return descriptor?.optionLabels?.[raw] ?? raw;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Descriptors are the submit-time snapshot of real form fields, so when present they gate which
|
|
11
|
+
* values render (internal keys like the honeypot never get a descriptor). Legacy rows without
|
|
12
|
+
* descriptors fall back to rendering every value under its field name.
|
|
13
|
+
*/
|
|
14
|
+
const rowsOf = (values, descriptors) => {
|
|
15
|
+
const byField = new Map(descriptors.map((descriptor) => [descriptor.field, descriptor]));
|
|
16
|
+
return (byField.size > 0 ? values.filter((value) => byField.has(value.field)) : values).map((entry) => {
|
|
17
|
+
const descriptor = byField.get(entry.field);
|
|
18
|
+
return {
|
|
19
|
+
label: descriptor?.label ?? entry.field,
|
|
20
|
+
value: displayValue(entry.value, descriptor)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
/** All answers as HTML-escaped `Label: value` lines joined with `<br />`. */
|
|
25
|
+
const renderAllValues = (values, descriptors) => rowsOf(values, descriptors).map((row) => `${escapeHtml(row.label)}: ${escapeHtml(row.value)}`).join("<br />");
|
|
26
|
+
/** All answers as a simple HTML-escaped two-column table. */
|
|
27
|
+
const renderAllValuesTable = (values, descriptors) => {
|
|
28
|
+
return `<table><tbody>${rowsOf(values, descriptors).map((row) => `<tr><td>${escapeHtml(row.label)}</td><td>${escapeHtml(row.value)}</td></tr>`).join("")}</tbody></table>`;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { renderAllValues, renderAllValuesTable };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=wildcards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wildcards.js","names":[],"sources":["../../../src/actions/body/wildcards.ts"],"sourcesContent":["import type { SubmissionDescriptor, SubmissionValue } from '../../submissions/types'\nimport { escapeHtml } from './escapeHtml'\n\ntype Row = { label: string; value: string }\n\nconst displayValue = (value: unknown, descriptor?: SubmissionDescriptor): string => {\n\tif (value == null) {\n\t\treturn ''\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.map((entry) => displayValue(entry, descriptor)).join(', ')\n\t}\n\tconst raw = typeof value === 'object' ? JSON.stringify(value) : String(value)\n\treturn descriptor?.optionLabels?.[raw] ?? raw\n}\n\n/**\n * Descriptors are the submit-time snapshot of real form fields, so when present they gate which\n * values render (internal keys like the honeypot never get a descriptor). Legacy rows without\n * descriptors fall back to rendering every value under its field name.\n */\nconst rowsOf = (values: SubmissionValue[], descriptors: SubmissionDescriptor[]): Row[] => {\n\tconst byField = new Map(descriptors.map((descriptor) => [descriptor.field, descriptor]))\n\tconst included = byField.size > 0 ? values.filter((value) => byField.has(value.field)) : values\n\treturn included.map((entry) => {\n\t\tconst descriptor = byField.get(entry.field)\n\t\treturn { label: descriptor?.label ?? entry.field, value: displayValue(entry.value, descriptor) }\n\t})\n}\n\n/** All answers as HTML-escaped `Label: value` lines joined with `<br />`. */\nexport const renderAllValues = (\n\tvalues: SubmissionValue[],\n\tdescriptors: SubmissionDescriptor[]\n): string =>\n\trowsOf(values, descriptors)\n\t\t.map((row) => `${escapeHtml(row.label)}: ${escapeHtml(row.value)}`)\n\t\t.join('<br />')\n\n/** All answers as a simple HTML-escaped two-column table. */\nexport const renderAllValuesTable = (\n\tvalues: SubmissionValue[],\n\tdescriptors: SubmissionDescriptor[]\n): string => {\n\tconst rows = rowsOf(values, descriptors)\n\t\t.map((row) => `<tr><td>${escapeHtml(row.label)}</td><td>${escapeHtml(row.value)}</td></tr>`)\n\t\t.join('')\n\treturn `<table><tbody>${rows}</tbody></table>`\n}\n"],"mappings":";;AAKA,MAAM,gBAAgB,OAAgB,eAA8C;CACnF,IAAI,SAAS,MACZ,OAAO;CAER,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,KAAK,UAAU,aAAa,OAAO,UAAU,CAAC,EAAE,KAAK,IAAI;CAEvE,MAAM,MAAM,OAAO,UAAU,WAAW,KAAK,UAAU,KAAK,IAAI,OAAO,KAAK;CAC5E,OAAO,YAAY,eAAe,QAAQ;AAC3C;;;;;;AAOA,MAAM,UAAU,QAA2B,gBAA+C;CACzF,MAAM,UAAU,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,OAAO,UAAU,CAAC,CAAC;CAEvF,QADiB,QAAQ,OAAO,IAAI,OAAO,QAAQ,UAAU,QAAQ,IAAI,MAAM,KAAK,CAAC,IAAI,QACzE,KAAK,UAAU;EAC9B,MAAM,aAAa,QAAQ,IAAI,MAAM,KAAK;EAC1C,OAAO;GAAE,OAAO,YAAY,SAAS,MAAM;GAAO,OAAO,aAAa,MAAM,OAAO,UAAU;EAAE;CAChG,CAAC;AACF;;AAGA,MAAa,mBACZ,QACA,gBAEA,OAAO,QAAQ,WAAW,EACxB,KAAK,QAAQ,GAAG,WAAW,IAAI,KAAK,EAAE,IAAI,WAAW,IAAI,KAAK,GAAG,EACjE,KAAK,QAAQ;;AAGhB,MAAa,wBACZ,QACA,gBACY;CAIZ,OAAO,iBAHM,OAAO,QAAQ,WAAW,EACrC,KAAK,QAAQ,WAAW,WAAW,IAAI,KAAK,EAAE,WAAW,WAAW,IAAI,KAAK,EAAE,WAAW,EAC1F,KAAK,EACoB,EAAE;AAC9B"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveDefinitionLabel } from "../translations/server.js";
|
|
2
2
|
//#region src/actions/buildActionBlocks.ts
|
|
3
3
|
/** One authoring block per registered action type: the action's own config fields. */
|
|
4
4
|
const buildActionBlocks = (registry) => {
|
|
5
5
|
const blocks = [];
|
|
6
|
-
for (const definition of registry.values())
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
for (const definition of registry.values()) {
|
|
7
|
+
const label = resolveDefinitionLabel(definition.label);
|
|
8
|
+
blocks.push({
|
|
9
|
+
slug: definition.type,
|
|
10
|
+
labels: {
|
|
11
|
+
singular: label,
|
|
12
|
+
plural: label
|
|
13
|
+
},
|
|
14
|
+
fields: definition.config ?? []
|
|
15
|
+
});
|
|
16
|
+
}
|
|
14
17
|
return blocks;
|
|
15
18
|
};
|
|
16
19
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildActionBlocks.js","names":[],"sources":["../../src/actions/buildActionBlocks.ts"],"sourcesContent":["import type { Block } from 'payload'\nimport {
|
|
1
|
+
{"version":3,"file":"buildActionBlocks.js","names":[],"sources":["../../src/actions/buildActionBlocks.ts"],"sourcesContent":["import type { Block } from 'payload'\nimport { resolveDefinitionLabel } from '../translations/server'\nimport type { ActionRegistry } from './registry'\n\n/** One authoring block per registered action type: the action's own config fields. */\nexport const buildActionBlocks = (registry: ActionRegistry): Block[] => {\n\tconst blocks: Block[] = []\n\tfor (const definition of registry.values()) {\n\t\tconst label = resolveDefinitionLabel(definition.label)\n\t\tblocks.push({\n\t\t\tslug: definition.type,\n\t\t\tlabels: { singular: label, plural: label },\n\t\t\tfields: definition.config ?? [],\n\t\t})\n\t}\n\treturn blocks\n}\n"],"mappings":";;;AAKA,MAAa,qBAAqB,aAAsC;CACvE,MAAM,SAAkB,CAAC;CACzB,KAAK,MAAM,cAAc,SAAS,OAAO,GAAG;EAC3C,MAAM,QAAQ,uBAAuB,WAAW,KAAK;EACrD,OAAO,KAAK;GACX,MAAM,WAAW;GACjB,QAAQ;IAAE,UAAU;IAAO,QAAQ;GAAM;GACzC,QAAQ,WAAW,UAAU,CAAC;EAC/B,CAAC;CACF;CACA,OAAO;AACR"}
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fieldNamesOfType } from "../../fields/fieldNamesOfType.js";
|
|
2
2
|
import { keys } from "../../translations/keys.js";
|
|
3
|
-
import { labelFor } from "../../translations/server.js";
|
|
4
|
-
import {
|
|
3
|
+
import { asTranslate, labelFor } from "../../translations/server.js";
|
|
4
|
+
import { firstAddress } from "../emailRecipients.js";
|
|
5
|
+
import { buildEmailAction } from "./emailAction.js";
|
|
5
6
|
//#region src/actions/builtin/confirmation.ts
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const TO_FIELD_REF = "@10x-media/form-builder/client#FieldNameSelect";
|
|
8
|
+
/**
|
|
9
|
+
* Validates the confirmation action's `toField`: unset is fine, otherwise it must name an
|
|
10
|
+
* existing `email`-type field on the form. Exported for unit testing.
|
|
11
|
+
*/
|
|
12
|
+
const validateToField = (value, { data, req }) => {
|
|
13
|
+
if (typeof value !== "string" || value.length === 0) return true;
|
|
14
|
+
return fieldNamesOfType(data && typeof data === "object" ? data.fields : void 0, ["email"]).includes(value) ? true : asTranslate(req.t)(keys.validationEmailFieldUnknown);
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The `confirmation` action: its target is `toField`, naming the form's own email field the
|
|
18
|
+
* confirmation is sent to (a `FieldNameSelect`, not a recipient list). The resolved address is
|
|
19
|
+
* sanitized to a single one (dropping CR/LF header injection and any smuggled extra addresses); an
|
|
20
|
+
* unset field or an unresolvable value is a silent skip. Everything else (from/cc/bcc/replyTo,
|
|
21
|
+
* subject, body, localization) is the shared email-action skeleton.
|
|
22
|
+
*/
|
|
23
|
+
const buildConfirmation = (options) => {
|
|
24
|
+
const toField = {
|
|
25
|
+
name: "toField",
|
|
26
|
+
type: "text",
|
|
27
|
+
label: labelFor(keys.actionConfigToField),
|
|
28
|
+
admin: {
|
|
29
|
+
width: "50%",
|
|
30
|
+
components: { Field: {
|
|
31
|
+
path: TO_FIELD_REF,
|
|
32
|
+
clientProps: {
|
|
33
|
+
types: ["email"],
|
|
34
|
+
descriptionKey: keys.actionConfigToFieldDescription
|
|
35
|
+
}
|
|
36
|
+
} }
|
|
14
37
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const { config, values, payload } = args;
|
|
28
|
-
if (!config.toField) return;
|
|
29
|
-
const entry = values.find((v) => v.field === config.toField);
|
|
30
|
-
const to = entry == null ? "" : String(entry.value ?? "");
|
|
31
|
-
if (!to) return;
|
|
32
|
-
if (typeof payload.sendEmail !== "function") throw new Error("confirmation: no email adapter configured");
|
|
33
|
-
const resolve = (name) => {
|
|
34
|
-
const found = values.find((v) => v.field === name);
|
|
35
|
-
return found == null ? "" : String(found.value ?? "");
|
|
36
|
-
};
|
|
37
|
-
const subject = interpolate(config.subject ?? "", resolve);
|
|
38
|
-
const html = interpolate(config.body ?? "", resolve);
|
|
39
|
-
await payload.sendEmail({
|
|
40
|
-
to,
|
|
41
|
-
subject,
|
|
42
|
-
html
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
38
|
+
validate: validateToField
|
|
39
|
+
};
|
|
40
|
+
return buildEmailAction(options, {
|
|
41
|
+
type: "confirmation",
|
|
42
|
+
label: keys.actionConfirmation,
|
|
43
|
+
target: () => toField,
|
|
44
|
+
resolveTo: ({ config, resolve }) => config.toField ? firstAddress(resolve(config.toField)) : "",
|
|
45
|
+
hasTarget: (config) => Boolean(config.toField),
|
|
46
|
+
onMissingTo: "skip"
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
buildConfirmation({ localize: true });
|
|
46
50
|
//#endregion
|
|
47
|
-
export {
|
|
51
|
+
export { buildConfirmation };
|
|
48
52
|
|
|
49
53
|
//# sourceMappingURL=confirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation.js","names":[],"sources":["../../../src/actions/builtin/confirmation.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"confirmation.js","names":[],"sources":["../../../src/actions/builtin/confirmation.ts"],"sourcesContent":["import type { Field, PayloadRequest } from 'payload'\nimport { fieldNamesOfType } from '../../fields/fieldNamesOfType'\nimport { keys } from '../../translations/keys'\nimport { asTranslate, labelFor } from '../../translations/server'\nimport { firstAddress } from '../emailRecipients'\nimport { buildEmailAction, type EmailActionConfig, type EmailActionOptions } from './emailAction'\n\ntype ConfirmationConfig = EmailActionConfig & { toField?: string }\n\nconst TO_FIELD_REF = '@10x-media/form-builder/client#FieldNameSelect'\n\n/**\n * Validates the confirmation action's `toField`: unset is fine, otherwise it must name an\n * existing `email`-type field on the form. Exported for unit testing.\n */\nexport const validateToField = (\n\tvalue: unknown,\n\t{ data, req }: { data?: unknown; req: PayloadRequest }\n): string | true => {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\treturn true\n\t}\n\tconst fields =\n\t\tdata && typeof data === 'object' ? (data as Record<string, unknown>).fields : undefined\n\treturn fieldNamesOfType(fields, ['email']).includes(value)\n\t\t? true\n\t\t: asTranslate(req.t)(keys.validationEmailFieldUnknown)\n}\n\n/**\n * The `confirmation` action: its target is `toField`, naming the form's own email field the\n * confirmation is sent to (a `FieldNameSelect`, not a recipient list). The resolved address is\n * sanitized to a single one (dropping CR/LF header injection and any smuggled extra addresses); an\n * unset field or an unresolvable value is a silent skip. Everything else (from/cc/bcc/replyTo,\n * subject, body, localization) is the shared email-action skeleton.\n */\nexport const buildConfirmation = (options: EmailActionOptions) => {\n\tconst toField: Field = {\n\t\tname: 'toField',\n\t\ttype: 'text',\n\t\tlabel: labelFor(keys.actionConfigToField),\n\t\tadmin: {\n\t\t\twidth: '50%',\n\t\t\tcomponents: {\n\t\t\t\tField: {\n\t\t\t\t\tpath: TO_FIELD_REF,\n\t\t\t\t\tclientProps: { types: ['email'], descriptionKey: keys.actionConfigToFieldDescription },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tvalidate: validateToField,\n\t}\n\treturn buildEmailAction<ConfirmationConfig>(options, {\n\t\ttype: 'confirmation',\n\t\tlabel: keys.actionConfirmation,\n\t\ttarget: () => toField,\n\t\tresolveTo: ({ config, resolve }) =>\n\t\t\tconfig.toField ? firstAddress(resolve(config.toField)) : '',\n\t\thasTarget: (config) => Boolean(config.toField),\n\t\tonMissingTo: 'skip',\n\t})\n}\n\nexport const confirmation = buildConfirmation({ localize: true })\n"],"mappings":";;;;;;AASA,MAAM,eAAe;;;;;AAMrB,MAAa,mBACZ,OACA,EAAE,MAAM,UACW;CACnB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GACjD,OAAO;CAIR,OAAO,iBADN,QAAQ,OAAO,SAAS,WAAY,KAAiC,SAAS,KAAA,GAC/C,CAAC,OAAO,CAAC,EAAE,SAAS,KAAK,IACtD,OACA,YAAY,IAAI,CAAC,EAAE,KAAK,2BAA2B;AACvD;;;;;;;;AASA,MAAa,qBAAqB,YAAgC;CACjE,MAAM,UAAiB;EACtB,MAAM;EACN,MAAM;EACN,OAAO,SAAS,KAAK,mBAAmB;EACxC,OAAO;GACN,OAAO;GACP,YAAY,EACX,OAAO;IACN,MAAM;IACN,aAAa;KAAE,OAAO,CAAC,OAAO;KAAG,gBAAgB,KAAK;IAA+B;GACtF,EACD;EACD;EACA,UAAU;CACX;CACA,OAAO,iBAAqC,SAAS;EACpD,MAAM;EACN,OAAO,KAAK;EACZ,cAAc;EACd,YAAY,EAAE,QAAQ,cACrB,OAAO,UAAU,aAAa,QAAQ,OAAO,OAAO,CAAC,IAAI;EAC1D,YAAY,WAAW,QAAQ,OAAO,OAAO;EAC7C,aAAa;CACd,CAAC;AACF;AAE4B,kBAAkB,EAAE,UAAU,KAAK,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RecipientSourceRegistry } from "../recipientSources.js";
|
|
2
|
+
import { FromAddressSourceRegistry, FromAddressesResolver } from "../fromAddresses.js";
|
|
3
|
+
import { DepartmentEmailsResolver } from "../../email/departments.js";
|
|
4
|
+
import { RecipientsConfig } from "../emailRecipients.js";
|
|
5
|
+
import { Field, RichTextField } from "payload";
|
|
6
|
+
|
|
7
|
+
//#region src/actions/builtin/emailAction.d.ts
|
|
8
|
+
/** The plugin-derived options every built-in email action is built from (was five positional args). */
|
|
9
|
+
type EmailActionOptions = {
|
|
10
|
+
localize: boolean;
|
|
11
|
+
editor?: RichTextField['editor'];
|
|
12
|
+
fromAddresses?: FromAddressesResolver; /** Send-time-resolved senders offered in the from select (plugin option `email.fromSources`). */
|
|
13
|
+
fromSources?: FromAddressSourceRegistry;
|
|
14
|
+
departments?: DepartmentEmailsResolver;
|
|
15
|
+
recipients?: RecipientsConfig; /** Server-resolved recipient sources offered in every recipient list (plugin option `email.recipientSources`). */
|
|
16
|
+
recipientSources?: RecipientSourceRegistry;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { EmailActionOptions };
|
|
20
|
+
//# sourceMappingURL=emailAction.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { keys } from "../../translations/keys.js";
|
|
2
|
+
import { labelFor } from "../../translations/server.js";
|
|
3
|
+
import { localizedIf } from "../../fields/localizedIf.js";
|
|
4
|
+
import { interpolate } from "../../recall/interpolate.js";
|
|
5
|
+
import { buildRecipientField, resolveRecipientEntries } from "../emailRecipients.js";
|
|
6
|
+
import { resolverFor } from "../body/serializeBody.js";
|
|
7
|
+
import { defineAction } from "../defineAction.js";
|
|
8
|
+
import { buildFromField, resolveSendFrom } from "../fromAddresses.js";
|
|
9
|
+
import { sourcesByValue } from "../recipientSources.js";
|
|
10
|
+
//#region src/actions/builtin/emailAction.ts
|
|
11
|
+
/**
|
|
12
|
+
* The shared skeleton of the built-in email actions (`emailTeam`, `confirmation`): an identical
|
|
13
|
+
* config (a first row pairing the action's target with `replyTo`, an optional `from` select, a
|
|
14
|
+
* cc/bcc row, a subject, and a rich text body, content and recipient fields carrying `localized`
|
|
15
|
+
* when `localize`) and an identical send (interpolate the subject, render the body, resolve
|
|
16
|
+
* cc/bcc/replyTo, and hand a single comma-joined string per list to `payload.sendEmail`). Only the
|
|
17
|
+
* primary `to` target and its missing-value behavior differ, threaded through `spec`.
|
|
18
|
+
*/
|
|
19
|
+
const buildEmailAction = (options, spec) => {
|
|
20
|
+
const { localize, editor, fromAddresses, fromSources, departments, recipients, recipientSources } = options;
|
|
21
|
+
const fromSourcesByValue = sourcesByValue(fromSources);
|
|
22
|
+
const endpoint = departments ? "departments" : void 0;
|
|
23
|
+
const recip = (name, labelKey) => buildRecipientField(name, labelKey, localize, {
|
|
24
|
+
endpoint,
|
|
25
|
+
recipients,
|
|
26
|
+
width: "50%",
|
|
27
|
+
departments,
|
|
28
|
+
sources: recipientSources
|
|
29
|
+
});
|
|
30
|
+
return defineAction({
|
|
31
|
+
type: spec.type,
|
|
32
|
+
label: spec.label,
|
|
33
|
+
config: [
|
|
34
|
+
{
|
|
35
|
+
type: "row",
|
|
36
|
+
fields: [spec.target(recip), recip("replyTo", keys.actionConfigReplyTo)]
|
|
37
|
+
},
|
|
38
|
+
...fromAddresses || fromSources ? [buildFromField(fromAddresses, fromSources)] : [],
|
|
39
|
+
{
|
|
40
|
+
type: "row",
|
|
41
|
+
fields: [recip("cc", keys.actionConfigCc), recip("bcc", keys.actionConfigBcc)]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "subject",
|
|
45
|
+
type: "text",
|
|
46
|
+
label: labelFor(keys.actionConfigSubject),
|
|
47
|
+
...localizedIf(localize)
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "body",
|
|
51
|
+
type: "richText",
|
|
52
|
+
label: labelFor(keys.actionConfigBody),
|
|
53
|
+
admin: { description: labelFor(keys.actionConfigBodyDescription) },
|
|
54
|
+
...localizedIf(localize),
|
|
55
|
+
...editor ? { editor } : {}
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
run: async (args) => {
|
|
59
|
+
const { config, values } = args;
|
|
60
|
+
const resolve = resolverFor(values);
|
|
61
|
+
const sources = sourcesByValue(recipientSources);
|
|
62
|
+
const sourceArgs = {
|
|
63
|
+
context: args.context,
|
|
64
|
+
values,
|
|
65
|
+
descriptors: args.descriptors,
|
|
66
|
+
form: args.form,
|
|
67
|
+
submissionId: args.submissionId,
|
|
68
|
+
payload: args.payload,
|
|
69
|
+
req: args.req,
|
|
70
|
+
locale: args.locale
|
|
71
|
+
};
|
|
72
|
+
const to = await spec.resolveTo({
|
|
73
|
+
config,
|
|
74
|
+
resolve,
|
|
75
|
+
sources,
|
|
76
|
+
sourceArgs
|
|
77
|
+
});
|
|
78
|
+
if (!to) {
|
|
79
|
+
if (!spec.hasTarget(config) && spec.onMissingTo === "throw") throw new Error(`${spec.type}: missing "to" address`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (typeof args.payload.sendEmail !== "function") throw new Error(`${spec.type}: no email adapter configured`);
|
|
83
|
+
const subject = interpolate(config.subject ?? "", resolve);
|
|
84
|
+
const html = await args.renderBody(config.body);
|
|
85
|
+
const cc = (await resolveRecipientEntries(config.cc, {
|
|
86
|
+
resolve,
|
|
87
|
+
sources,
|
|
88
|
+
sourceArgs
|
|
89
|
+
})).join(", ");
|
|
90
|
+
const bcc = (await resolveRecipientEntries(config.bcc, {
|
|
91
|
+
resolve,
|
|
92
|
+
sources,
|
|
93
|
+
sourceArgs
|
|
94
|
+
})).join(", ");
|
|
95
|
+
const replyTo = (await resolveRecipientEntries(config.replyTo, {
|
|
96
|
+
resolve,
|
|
97
|
+
sources,
|
|
98
|
+
sourceArgs
|
|
99
|
+
})).join(", ");
|
|
100
|
+
const from = await resolveSendFrom({
|
|
101
|
+
configured: config.from,
|
|
102
|
+
sources: fromSourcesByValue,
|
|
103
|
+
sourceArgs
|
|
104
|
+
});
|
|
105
|
+
await args.payload.sendEmail({
|
|
106
|
+
to,
|
|
107
|
+
subject,
|
|
108
|
+
html,
|
|
109
|
+
...from ? { from } : {},
|
|
110
|
+
...cc ? { cc } : {},
|
|
111
|
+
...bcc ? { bcc } : {},
|
|
112
|
+
...replyTo ? { replyTo } : {}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
export { buildEmailAction };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=emailAction.js.map
|