@erxes/api-shared 0.0.0-stage → 3.2.19-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +672 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.d.ts +2 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.dev.js +6685 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.js +7 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.prod.js +6685 -0
- package/core-modules/dist/erxes-api-shared-core-modules.esm.js +6298 -0
- package/core-modules/package.json +5 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.d.ts +2 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.dev.js +12 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.js +7 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.prod.js +12 -0
- package/core-types/dist/erxes-api-shared-core-types.esm.js +8 -0
- package/core-types/package.json +5 -0
- package/dist/declarations/src/core-modules/approval/approvalChangeTypes.d.ts +15 -0
- package/dist/declarations/src/core-modules/approval/approvalChangeTypes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/checkApprovalLock.d.ts +7 -0
- package/dist/declarations/src/core-modules/approval/checkApprovalLock.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/constants.d.ts +37 -0
- package/dist/declarations/src/core-modules/approval/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/index.d.ts +7 -0
- package/dist/declarations/src/core-modules/approval/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/initApproval.d.ts +9 -0
- package/dist/declarations/src/core-modules/approval/initApproval.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/types.d.ts +164 -0
- package/dist/declarations/src/core-modules/approval/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/zodSchemas.d.ts +125 -0
- package/dist/declarations/src/core-modules/approval/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/@types/app.d.ts +15 -0
- package/dist/declarations/src/core-modules/apps/@types/app.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/db/definitions/apps.d.ts +13 -0
- package/dist/declarations/src/core-modules/apps/db/definitions/apps.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/apps/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/actionErrorPolicy.d.ts +68 -0
- package/dist/declarations/src/core-modules/automations/actionErrorPolicy.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/actionOutcome.d.ts +51 -0
- package/dist/declarations/src/core-modules/automations/actionOutcome.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/constants.d.ts +101 -0
- package/dist/declarations/src/core-modules/automations/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/aiAgents.d.ts +141 -0
- package/dist/declarations/src/core-modules/automations/definitions/aiAgents.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/automations.d.ts +868 -0
- package/dist/declarations/src/core-modules/automations/definitions/automations.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/executions.d.ts +316 -0
- package/dist/declarations/src/core-modules/automations/definitions/executions.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/index.d.ts +4 -0
- package/dist/declarations/src/core-modules/automations/definitions/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/index.d.ts +14 -0
- package/dist/declarations/src/core-modules/automations/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts +67 -0
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/reEnrollment.d.ts +23 -0
- package/dist/declarations/src/core-modules/automations/reEnrollment.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/segmentMembership.d.ts +19 -0
- package/dist/declarations/src/core-modules/automations/segmentMembership.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/sendAutomationMessage.d.ts +51 -0
- package/dist/declarations/src/core-modules/automations/sendAutomationMessage.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/setupAutomationProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/automations/setupAutomationProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/typeUtils.d.ts +2 -0
- package/dist/declarations/src/core-modules/automations/typeUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/types.d.ts +474 -0
- package/dist/declarations/src/core-modules/automations/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/utils.d.ts +38 -0
- package/dist/declarations/src/core-modules/automations/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/workflowValidation.d.ts +3 -0
- package/dist/declarations/src/core-modules/automations/workflowValidation.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/zodTypes.d.ts +2366 -0
- package/dist/declarations/src/core-modules/automations/zodTypes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/clientPortal.d.ts +375 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/clientPortal.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/comment.d.ts +53 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/comment.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpNotification.d.ts +110 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpNotification.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpUser.d.ts +828 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpUser.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/client-portals/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/db/definitions/common.d.ts +77 -0
- package/dist/declarations/src/core-modules/common/db/definitions/common.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/createEventHandlers.d.ts +8 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/createEventHandlers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/generateEventHandlers.d.ts +4 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/generateEventHandlers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/runtimeContext.d.ts +9 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/runtimeContext.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/schemas.d.ts +82 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/schemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/types.d.ts +87 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/common/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/getRecordReferenceFields.d.ts +57 -0
- package/dist/declarations/src/core-modules/common/references/getRecordReferenceFields.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/index.d.ts +6 -0
- package/dist/declarations/src/core-modules/common/references/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/initRecordReferences.d.ts +4 -0
- package/dist/declarations/src/core-modules/common/references/initRecordReferences.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferencePlaceholders.d.ts +12 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferencePlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferenceValue.d.ts +6 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferenceValue.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/types.d.ts +63 -0
- package/dist/declarations/src/core-modules/common/references/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/routeToModuleProducer.d.ts +55 -0
- package/dist/declarations/src/core-modules/common/routeToModuleProducer.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/blocksToHtml.d.ts +72 -0
- package/dist/declarations/src/core-modules/email-content/blocksToHtml.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/constants.d.ts +5 -0
- package/dist/declarations/src/core-modules/email-content/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/emailFooter.d.ts +5 -0
- package/dist/declarations/src/core-modules/email-content/emailFooter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/expandRepeatRows.d.ts +9 -0
- package/dist/declarations/src/core-modules/email-content/expandRepeatRows.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/index.d.ts +9 -0
- package/dist/declarations/src/core-modules/email-content/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/renderEmailContent.d.ts +19 -0
- package/dist/declarations/src/core-modules/email-content/renderEmailContent.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/replacePlaceholders.d.ts +36 -0
- package/dist/declarations/src/core-modules/email-content/replacePlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/types.d.ts +48 -0
- package/dist/declarations/src/core-modules/email-content/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/unresolvedPlaceholders.d.ts +4 -0
- package/dist/declarations/src/core-modules/email-content/unresolvedPlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/forms/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/types.d.ts +55 -0
- package/dist/declarations/src/core-modules/forms/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/utils.d.ts +4 -0
- package/dist/declarations/src/core-modules/forms/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/index.d.ts +8 -0
- package/dist/declarations/src/core-modules/import-export/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/types.d.ts +181 -0
- package/dist/declarations/src/core-modules/import-export/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/exportCursor.d.ts +14 -0
- package/dist/declarations/src/core-modules/import-export/utils/exportCursor.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/headerMatcher.d.ts +32 -0
- package/dist/declarations/src/core-modules/import-export/utils/headerMatcher.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/importExportRuntime.d.ts +32 -0
- package/dist/declarations/src/core-modules/import-export/utils/importExportRuntime.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/importUtils.d.ts +25 -0
- package/dist/declarations/src/core-modules/import-export/utils/importUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/worker.d.ts +8 -0
- package/dist/declarations/src/core-modules/import-export/worker.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/zodSchemas.d.ts +111 -0
- package/dist/declarations/src/core-modules/import-export/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/index.d.ts +16 -0
- package/dist/declarations/src/core-modules/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/builder.d.ts +3 -0
- package/dist/declarations/src/core-modules/logs/activityLog/builder.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/logs/activityLog/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/sharedBuilders.d.ts +18 -0
- package/dist/declarations/src/core-modules/logs/activityLog/sharedBuilders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/types.d.ts +21 -0
- package/dist/declarations/src/core-modules/logs/activityLog/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/utils.d.ts +10 -0
- package/dist/declarations/src/core-modules/logs/activityLog/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLogUtils.d.ts +72 -0
- package/dist/declarations/src/core-modules/logs/activityLogUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/definitions/activityLog.d.ts +84 -0
- package/dist/declarations/src/core-modules/logs/definitions/activityLog.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/definitions/logs.d.ts +39 -0
- package/dist/declarations/src/core-modules/logs/definitions/logs.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/index.d.ts +6 -0
- package/dist/declarations/src/core-modules/logs/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/types.d.ts +15 -0
- package/dist/declarations/src/core-modules/logs/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts +73 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailDeliveries.d.ts +115 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailDeliveries.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailRamp.d.ts +65 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailRamp.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailSenders.d.ts +58 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailSenders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts +66 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notifications.d.ts +89 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notifications.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/index.d.ts +8 -0
- package/dist/declarations/src/core-modules/notifications/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/utils.d.ts +85 -0
- package/dist/declarations/src/core-modules/notifications/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/db/definitions/permissions.d.ts +60 -0
- package/dist/declarations/src/core-modules/permissions/db/definitions/permissions.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/index.d.ts +4 -0
- package/dist/declarations/src/core-modules/permissions/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/user-actions-map.d.ts +4 -0
- package/dist/declarations/src/core-modules/permissions/user-actions-map.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/utils.d.ts +22 -0
- package/dist/declarations/src/core-modules/permissions/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/filter.d.ts +5 -0
- package/dist/declarations/src/core-modules/properties/filter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/importExport.d.ts +18 -0
- package/dist/declarations/src/core-modules/properties/importExport.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/index.d.ts +10 -0
- package/dist/declarations/src/core-modules/properties/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/keys.d.ts +46 -0
- package/dist/declarations/src/core-modules/properties/keys.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/mergeRows.d.ts +8 -0
- package/dist/declarations/src/core-modules/properties/mergeRows.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/operators.d.ts +6 -0
- package/dist/declarations/src/core-modules/properties/operators.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/options.d.ts +10 -0
- package/dist/declarations/src/core-modules/properties/options.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/setupPropertyProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/properties/setupPropertyProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/types.d.ts +14 -0
- package/dist/declarations/src/core-modules/properties/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/valueUsage.d.ts +56 -0
- package/dist/declarations/src/core-modules/properties/valueUsage.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/dependencies.d.ts +6 -0
- package/dist/declarations/src/core-modules/segments/dependencies.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluate.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/evaluate.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateBatch.d.ts +42 -0
- package/dist/declarations/src/core-modules/segments/evaluateBatch.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateFieldsRouter.d.ts +29 -0
- package/dist/declarations/src/core-modules/segments/evaluateFieldsRouter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateOwned.d.ts +27 -0
- package/dist/declarations/src/core-modules/segments/evaluateOwned.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/events.d.ts +45 -0
- package/dist/declarations/src/core-modules/segments/events.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldBuilders.d.ts +35 -0
- package/dist/declarations/src/core-modules/segments/fieldBuilders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldMeta.d.ts +62 -0
- package/dist/declarations/src/core-modules/segments/fieldMeta.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldRequests.d.ts +33 -0
- package/dist/declarations/src/core-modules/segments/fieldRequests.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fingerprint.d.ts +6 -0
- package/dist/declarations/src/core-modules/segments/fingerprint.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/index.d.ts +31 -0
- package/dist/declarations/src/core-modules/segments/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/joinChanges.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/joinChanges.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/materialized.d.ts +9 -0
- package/dist/declarations/src/core-modules/segments/materialized.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/measureRelations.d.ts +18 -0
- package/dist/declarations/src/core-modules/segments/measureRelations.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/memberQuery.d.ts +13 -0
- package/dist/declarations/src/core-modules/segments/memberQuery.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/membership.d.ts +24 -0
- package/dist/declarations/src/core-modules/segments/membership.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/mongoFilter.d.ts +15 -0
- package/dist/declarations/src/core-modules/segments/mongoFilter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/nodeRefs.d.ts +5 -0
- package/dist/declarations/src/core-modules/segments/nodeRefs.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/nodes.d.ts +42 -0
- package/dist/declarations/src/core-modules/segments/nodes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/operators.d.ts +46 -0
- package/dist/declarations/src/core-modules/segments/operators.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/ownedSource.d.ts +7 -0
- package/dist/declarations/src/core-modules/segments/ownedSource.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/plan.d.ts +35 -0
- package/dist/declarations/src/core-modules/segments/plan.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/relationRegistry.d.ts +33 -0
- package/dist/declarations/src/core-modules/segments/relationRegistry.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/setupSegmentProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/segments/setupSegmentProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/subjectsReachedBy.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/subjectsReachedBy.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/timeZone.d.ts +2 -0
- package/dist/declarations/src/core-modules/segments/timeZone.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/types.d.ts +67 -0
- package/dist/declarations/src/core-modules/segments/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/utils.d.ts +4 -0
- package/dist/declarations/src/core-modules/segments/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/walkNodes.d.ts +9 -0
- package/dist/declarations/src/core-modules/segments/walkNodes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/zodSchemas.d.ts +532 -0
- package/dist/declarations/src/core-modules/segments/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/zonedTime.d.ts +25 -0
- package/dist/declarations/src/core-modules/segments/zonedTime.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/templates/index.d.ts +2 -0
- package/dist/declarations/src/core-modules/templates/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/templates/utils.d.ts +11 -0
- package/dist/declarations/src/core-modules/templates/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/constants.d.ts +114 -0
- package/dist/declarations/src/core-modules/users/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/db/definitions/users.d.ts +24 -0
- package/dist/declarations/src/core-modules/users/db/definitions/users.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/users/index.d.ts.map +1 -0
- package/dist/declarations/src/core-types/common.d.ts +149 -0
- package/dist/declarations/src/core-types/common.d.ts.map +1 -0
- package/dist/declarations/src/core-types/index.d.ts +20 -0
- package/dist/declarations/src/core-types/index.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/app/app.d.ts +12 -0
- package/dist/declarations/src/core-types/modules/app/app.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/automations/automations.d.ts +19 -0
- package/dist/declarations/src/core-types/modules/automations/automations.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/company.d.ts +53 -0
- package/dist/declarations/src/core-types/modules/contacts/company.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/contacts-common.d.ts +32 -0
- package/dist/declarations/src/core-types/modules/contacts/contacts-common.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/customer.d.ts +74 -0
- package/dist/declarations/src/core-types/modules/contacts/customer.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/emailTemplates/emailTemplate.d.ts +18 -0
- package/dist/declarations/src/core-types/modules/emailTemplates/emailTemplate.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/logs/logs.d.ts +28 -0
- package/dist/declarations/src/core-types/modules/logs/logs.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/permissions/permission.d.ts +56 -0
- package/dist/declarations/src/core-types/modules/permissions/permission.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/permissions/role.d.ts +21 -0
- package/dist/declarations/src/core-types/modules/permissions/role.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/product.d.ts +76 -0
- package/dist/declarations/src/core-types/modules/products/product.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/productCategory.d.ts +26 -0
- package/dist/declarations/src/core-types/modules/products/productCategory.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/productConfig.d.ts +9 -0
- package/dist/declarations/src/core-types/modules/products/productConfig.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/uom.d.ts +11 -0
- package/dist/declarations/src/core-types/modules/products/uom.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/relations/relations.d.ts +13 -0
- package/dist/declarations/src/core-types/modules/relations/relations.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/saas/organization.d.ts +8 -0
- package/dist/declarations/src/core-types/modules/saas/organization.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/tags/tag.d.ts +16 -0
- package/dist/declarations/src/core-types/modules/tags/tag.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/team-member/structure.d.ts +19 -0
- package/dist/declarations/src/core-types/modules/team-member/structure.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/team-member/user.d.ts +90 -0
- package/dist/declarations/src/core-types/modules/team-member/user.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/auth.d.ts +18 -0
- package/dist/declarations/src/utils/agent-tools/auth.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/endpoints.d.ts +16 -0
- package/dist/declarations/src/utils/agent-tools/endpoints.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/index.d.ts +6 -0
- package/dist/declarations/src/utils/agent-tools/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/manifest.d.ts +11 -0
- package/dist/declarations/src/utils/agent-tools/manifest.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/responseLimit.d.ts +26 -0
- package/dist/declarations/src/utils/agent-tools/responseLimit.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/types.d.ts +48 -0
- package/dist/declarations/src/utils/agent-tools/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/beforeResolvers.d.ts +41 -0
- package/dist/declarations/src/utils/apollo/beforeResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/commonTypeDefs.d.ts +7 -0
- package/dist/declarations/src/utils/apollo/commonTypeDefs.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/constants.d.ts +3 -0
- package/dist/declarations/src/utils/apollo/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/customScalars.d.ts +6 -0
- package/dist/declarations/src/utils/apollo/customScalars.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/expectedErrorPlugin.d.ts +11 -0
- package/dist/declarations/src/utils/apollo/expectedErrorPlugin.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/index.d.ts +10 -0
- package/dist/declarations/src/utils/apollo/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/runBeforeResolvers.d.ts +27 -0
- package/dist/declarations/src/utils/apollo/runBeforeResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/utils.d.ts +5 -0
- package/dist/declarations/src/utils/apollo/utils.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/wrapperMutations.d.ts +8 -0
- package/dist/declarations/src/utils/apollo/wrapperMutations.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/wrapperResolvers.d.ts +8 -0
- package/dist/declarations/src/utils/apollo/wrapperResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/bulkUtils.d.ts +7 -0
- package/dist/declarations/src/utils/bulkUtils.d.ts.map +1 -0
- package/dist/declarations/src/utils/constants.d.ts +40 -0
- package/dist/declarations/src/utils/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/editor.d.ts +45 -0
- package/dist/declarations/src/utils/editor.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/address.d.ts +10 -0
- package/dist/declarations/src/utils/email/address.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/attachments.d.ts +12 -0
- package/dist/declarations/src/utils/email/attachments.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/config.d.ts +10 -0
- package/dist/declarations/src/utils/email/config.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/constants.d.ts +6 -0
- package/dist/declarations/src/utils/email/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/index.d.ts +12 -0
- package/dist/declarations/src/utils/email/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/sendgrid.d.ts +17 -0
- package/dist/declarations/src/utils/email/providers/sendgrid.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/sendgridEvents.d.ts +18 -0
- package/dist/declarations/src/utils/email/providers/sendgridEvents.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/ses.d.ts +19 -0
- package/dist/declarations/src/utils/email/providers/ses.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/smtp.d.ts +14 -0
- package/dist/declarations/src/utils/email/providers/smtp.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/resolveProvider.d.ts +6 -0
- package/dist/declarations/src/utils/email/resolveProvider.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/service.d.ts +50 -0
- package/dist/declarations/src/utils/email/service.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/types.d.ts +87 -0
- package/dist/declarations/src/utils/email/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/errorClassifier.d.ts +56 -0
- package/dist/declarations/src/utils/errorClassifier.d.ts.map +1 -0
- package/dist/declarations/src/utils/file/read.d.ts +14 -0
- package/dist/declarations/src/utils/file/read.d.ts.map +1 -0
- package/dist/declarations/src/utils/file/upload.d.ts +10 -0
- package/dist/declarations/src/utils/file/upload.d.ts.map +1 -0
- package/dist/declarations/src/utils/graphqlPubSub.d.ts +3 -0
- package/dist/declarations/src/utils/graphqlPubSub.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/get-hostname.d.ts +5 -0
- package/dist/declarations/src/utils/headers/get-hostname.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/index.d.ts +5 -0
- package/dist/declarations/src/utils/headers/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/sanitize.d.ts +3 -0
- package/dist/declarations/src/utils/headers/sanitize.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/subdomain.d.ts +4 -0
- package/dist/declarations/src/utils/headers/subdomain.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/user.d.ts +14 -0
- package/dist/declarations/src/utils/headers/user.d.ts.map +1 -0
- package/dist/declarations/src/utils/index.d.ts +28 -0
- package/dist/declarations/src/utils/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/knowledge.d.ts +50 -0
- package/dist/declarations/src/utils/knowledge.d.ts.map +1 -0
- package/dist/declarations/src/utils/logs/index.d.ts +103 -0
- package/dist/declarations/src/utils/logs/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/cursor-util.d.ts +41 -0
- package/dist/declarations/src/utils/mongo/cursor-util.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/generate-models.d.ts +4 -0
- package/dist/declarations/src/utils/mongo/generate-models.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/index.d.ts +6 -0
- package/dist/declarations/src/utils/mongo/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongo-connection.d.ts +5 -0
- package/dist/declarations/src/utils/mongo/mongo-connection.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongoose-types.d.ts +22 -0
- package/dist/declarations/src/utils/mongo/mongoose-types.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongoose-utils.d.ts +30 -0
- package/dist/declarations/src/utils/mongo/mongoose-utils.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/search-tokens.d.ts +21 -0
- package/dist/declarations/src/utils/mongo/search-tokens.d.ts.map +1 -0
- package/dist/declarations/src/utils/mq-worker.d.ts +19 -0
- package/dist/declarations/src/utils/mq-worker.d.ts.map +1 -0
- package/dist/declarations/src/utils/random.d.ts +3 -0
- package/dist/declarations/src/utils/random.d.ts.map +1 -0
- package/dist/declarations/src/utils/redis.d.ts +4 -0
- package/dist/declarations/src/utils/redis.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/index.d.ts +3 -0
- package/dist/declarations/src/utils/saas/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/saas-mongo-connection.d.ts +59 -0
- package/dist/declarations/src/utils/saas/saas-mongo-connection.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/types.d.ts +96 -0
- package/dist/declarations/src/utils/saas/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/sanitize.d.ts +3 -0
- package/dist/declarations/src/utils/sanitize.d.ts.map +1 -0
- package/dist/declarations/src/utils/sentry-init.d.ts +15 -0
- package/dist/declarations/src/utils/sentry-init.d.ts.map +1 -0
- package/dist/declarations/src/utils/sentry-instrument.d.ts +2 -0
- package/dist/declarations/src/utils/sentry-instrument.d.ts.map +1 -0
- package/dist/declarations/src/utils/serializablePayload.d.ts +11 -0
- package/dist/declarations/src/utils/serializablePayload.d.ts.map +1 -0
- package/dist/declarations/src/utils/service-discovery.d.ts +25 -0
- package/dist/declarations/src/utils/service-discovery.d.ts.map +1 -0
- package/dist/declarations/src/utils/start-plugin.d.ts +85 -0
- package/dist/declarations/src/utils/start-plugin.d.ts.map +1 -0
- package/dist/declarations/src/utils/string.d.ts +82 -0
- package/dist/declarations/src/utils/string.d.ts.map +1 -0
- package/dist/declarations/src/utils/trpc/index.d.ts +79 -0
- package/dist/declarations/src/utils/trpc/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/trpc/sendCoreModuleProducer.d.ts +53 -0
- package/dist/declarations/src/utils/trpc/sendCoreModuleProducer.d.ts.map +1 -0
- package/dist/declarations/src/utils/utils.d.ts +69 -0
- package/dist/declarations/src/utils/utils.d.ts.map +1 -0
- package/dist/erxes-api-shared.cjs.d.ts +3 -0
- package/dist/erxes-api-shared.cjs.dev.js +7 -0
- package/dist/erxes-api-shared.cjs.js +7 -0
- package/dist/erxes-api-shared.cjs.prod.js +7 -0
- package/dist/erxes-api-shared.esm.js +3 -0
- package/dist/start-plugin-576e707d.cjs.prod.js +23223 -0
- package/dist/start-plugin-6e76556c.esm.js +22742 -0
- package/dist/start-plugin-89fa2bd2.cjs.dev.js +23225 -0
- package/package.json +105 -4
- package/src/common-modules/payment/worker.ts +53 -0
- package/src/core-modules/approval/approvalChangeTypes.ts +31 -0
- package/src/core-modules/approval/checkApprovalLock.ts +85 -0
- package/src/core-modules/approval/constants.ts +45 -0
- package/src/core-modules/approval/index.ts +6 -0
- package/src/core-modules/approval/initApproval.ts +59 -0
- package/src/core-modules/approval/types.ts +206 -0
- package/src/core-modules/approval/zodSchemas.ts +55 -0
- package/src/core-modules/apps/@types/app.ts +15 -0
- package/src/core-modules/apps/db/definitions/apps.ts +30 -0
- package/src/core-modules/apps/index.ts +2 -0
- package/src/core-modules/automations/actionErrorPolicy.test.ts +125 -0
- package/src/core-modules/automations/actionErrorPolicy.ts +162 -0
- package/src/core-modules/automations/actionInputs.test.ts +70 -0
- package/src/core-modules/automations/actionOutcome.test.ts +87 -0
- package/src/core-modules/automations/actionOutcome.ts +128 -0
- package/src/core-modules/automations/constants.ts +181 -0
- package/src/core-modules/automations/definitions/aiAgents.ts +343 -0
- package/src/core-modules/automations/definitions/automations.ts +207 -0
- package/src/core-modules/automations/definitions/executions.ts +190 -0
- package/src/core-modules/automations/definitions/index.ts +3 -0
- package/src/core-modules/automations/getValueByPath.test.ts +49 -0
- package/src/core-modules/automations/index.ts +13 -0
- package/src/core-modules/automations/outputResolvers.test.ts +97 -0
- package/src/core-modules/automations/outputResolvers.ts +1238 -0
- package/src/core-modules/automations/reEnrollment.ts +34 -0
- package/src/core-modules/automations/segmentMembership.ts +34 -0
- package/src/core-modules/automations/sendAutomationMessage.ts +219 -0
- package/src/core-modules/automations/setPropertyOutcome.test.ts +105 -0
- package/src/core-modules/automations/setPropertyRows.test.ts +61 -0
- package/src/core-modules/automations/setupAutomationProducers.ts +187 -0
- package/src/core-modules/automations/typeUtils.ts +3 -0
- package/src/core-modules/automations/types.ts +577 -0
- package/src/core-modules/automations/utils.ts +1128 -0
- package/src/core-modules/automations/workflowValidation.ts +32 -0
- package/src/core-modules/automations/zodTypes.ts +221 -0
- package/src/core-modules/client-portals/definitions/clientPortal.ts +230 -0
- package/src/core-modules/client-portals/definitions/comment.ts +26 -0
- package/src/core-modules/client-portals/definitions/cpNotification.ts +112 -0
- package/src/core-modules/client-portals/definitions/cpUser.ts +236 -0
- package/src/core-modules/client-portals/index.ts +4 -0
- package/src/core-modules/common/db/definitions/common.ts +43 -0
- package/src/core-modules/common/eventHandlers/createEventHandlers.ts +236 -0
- package/src/core-modules/common/eventHandlers/generateEventHandlers.ts +37 -0
- package/src/core-modules/common/eventHandlers/index.ts +11 -0
- package/src/core-modules/common/eventHandlers/runtimeContext.ts +36 -0
- package/src/core-modules/common/eventHandlers/schemas.ts +53 -0
- package/src/core-modules/common/eventHandlers/types.ts +97 -0
- package/src/core-modules/common/eventHandlers/utils.ts +113 -0
- package/src/core-modules/common/index.ts +4 -0
- package/src/core-modules/common/references/fetchRecordReferenceTargets.ts +43 -0
- package/src/core-modules/common/references/getRecordReferenceFields.ts +243 -0
- package/src/core-modules/common/references/index.ts +9 -0
- package/src/core-modules/common/references/initRecordReferences.ts +84 -0
- package/src/core-modules/common/references/normalizeRecordReferenceConfig.ts +59 -0
- package/src/core-modules/common/references/resolveRecordReferencePath.ts +473 -0
- package/src/core-modules/common/references/resolveRecordReferencePlaceholders.ts +173 -0
- package/src/core-modules/common/references/resolveRecordReferenceValue.ts +41 -0
- package/src/core-modules/common/references/resolveRecordRelationIds.ts +57 -0
- package/src/core-modules/common/references/types.ts +78 -0
- package/src/core-modules/common/references/utils.ts +60 -0
- package/src/core-modules/common/references/zodInputs.ts +13 -0
- package/src/core-modules/common/routeToModuleProducer.ts +118 -0
- package/src/core-modules/email-content/blocksToHtml.ts +551 -0
- package/src/core-modules/email-content/constants.ts +4 -0
- package/src/core-modules/email-content/emailFooter.ts +17 -0
- package/src/core-modules/email-content/expandRepeatRows.test.ts +36 -0
- package/src/core-modules/email-content/expandRepeatRows.ts +59 -0
- package/src/core-modules/email-content/index.ts +8 -0
- package/src/core-modules/email-content/renderEmailContent.ts +88 -0
- package/src/core-modules/email-content/replacePlaceholders.ts +143 -0
- package/src/core-modules/email-content/types.ts +49 -0
- package/src/core-modules/email-content/unresolvedPlaceholders.ts +27 -0
- package/src/core-modules/forms/index.ts +2 -0
- package/src/core-modules/forms/types.ts +86 -0
- package/src/core-modules/forms/utils.ts +34 -0
- package/src/core-modules/import-export/index.ts +7 -0
- package/src/core-modules/import-export/types.ts +204 -0
- package/src/core-modules/import-export/utils/createCoreImportClient.ts +131 -0
- package/src/core-modules/import-export/utils/exportBatchProcess.ts +560 -0
- package/src/core-modules/import-export/utils/exportCursor.ts +47 -0
- package/src/core-modules/import-export/utils/headerMatcher.test.ts +90 -0
- package/src/core-modules/import-export/utils/headerMatcher.ts +229 -0
- package/src/core-modules/import-export/utils/importBatchProcess.ts +780 -0
- package/src/core-modules/import-export/utils/importExportError.ts +71 -0
- package/src/core-modules/import-export/utils/importExportRuntime.ts +96 -0
- package/src/core-modules/import-export/utils/importUtils.ts +59 -0
- package/src/core-modules/import-export/utils/progressUpdate.ts +25 -0
- package/src/core-modules/import-export/utils/tempWorkspace.ts +34 -0
- package/src/core-modules/import-export/worker.ts +215 -0
- package/src/core-modules/import-export/zodSchemas.ts +63 -0
- package/src/core-modules/index.ts +15 -0
- package/src/core-modules/logs/activityLog/builder.ts +232 -0
- package/src/core-modules/logs/activityLog/index.ts +4 -0
- package/src/core-modules/logs/activityLog/sharedBuilders.ts +95 -0
- package/src/core-modules/logs/activityLog/types.ts +26 -0
- package/src/core-modules/logs/activityLog/utils.ts +61 -0
- package/src/core-modules/logs/activityLogUtils.ts +677 -0
- package/src/core-modules/logs/definitions/activityLog.ts +71 -0
- package/src/core-modules/logs/definitions/logs.ts +49 -0
- package/src/core-modules/logs/index.ts +5 -0
- package/src/core-modules/logs/types.ts +16 -0
- package/src/core-modules/notifications/definitions/emailAddresses.ts +105 -0
- package/src/core-modules/notifications/definitions/emailDeliveries.ts +188 -0
- package/src/core-modules/notifications/definitions/emailRamp.ts +83 -0
- package/src/core-modules/notifications/definitions/emailSenders.ts +84 -0
- package/src/core-modules/notifications/definitions/notificationConfigs.ts +110 -0
- package/src/core-modules/notifications/definitions/notificationSettings.ts +67 -0
- package/src/core-modules/notifications/definitions/notifications.ts +130 -0
- package/src/core-modules/notifications/emailUtils.ts +88 -0
- package/src/core-modules/notifications/index.ts +7 -0
- package/src/core-modules/notifications/utils.ts +143 -0
- package/src/core-modules/permissions/db/definitions/permissions.ts +82 -0
- package/src/core-modules/permissions/index.ts +3 -0
- package/src/core-modules/permissions/oauth-scopes.test.ts +102 -0
- package/src/core-modules/permissions/user-actions-map.ts +170 -0
- package/src/core-modules/permissions/utils.ts +317 -0
- package/src/core-modules/properties/README.md +161 -0
- package/src/core-modules/properties/filter.test.ts +74 -0
- package/src/core-modules/properties/filter.ts +156 -0
- package/src/core-modules/properties/importExport.ts +159 -0
- package/src/core-modules/properties/index.ts +9 -0
- package/src/core-modules/properties/keys.test.ts +71 -0
- package/src/core-modules/properties/keys.ts +128 -0
- package/src/core-modules/properties/mergePropertyData.test.ts +65 -0
- package/src/core-modules/properties/mergeRows.ts +93 -0
- package/src/core-modules/properties/operators.ts +91 -0
- package/src/core-modules/properties/options.test.ts +119 -0
- package/src/core-modules/properties/options.ts +55 -0
- package/src/core-modules/properties/setupPropertyProducers.ts +32 -0
- package/src/core-modules/properties/types.ts +31 -0
- package/src/core-modules/properties/valueUsage.test.ts +158 -0
- package/src/core-modules/properties/valueUsage.ts +153 -0
- package/src/core-modules/segments/anniversary.test.ts +122 -0
- package/src/core-modules/segments/dependencies.test.ts +173 -0
- package/src/core-modules/segments/dependencies.ts +70 -0
- package/src/core-modules/segments/evaluate.test.ts +339 -0
- package/src/core-modules/segments/evaluate.ts +388 -0
- package/src/core-modules/segments/evaluateBatch.test.ts +233 -0
- package/src/core-modules/segments/evaluateBatch.ts +263 -0
- package/src/core-modules/segments/evaluateFieldsRouter.test.ts +148 -0
- package/src/core-modules/segments/evaluateFieldsRouter.ts +94 -0
- package/src/core-modules/segments/evaluateOwned.ts +162 -0
- package/src/core-modules/segments/events.ts +142 -0
- package/src/core-modules/segments/fieldBuilders.ts +152 -0
- package/src/core-modules/segments/fieldMeta.ts +96 -0
- package/src/core-modules/segments/fieldRequests.test.ts +302 -0
- package/src/core-modules/segments/fieldRequests.ts +172 -0
- package/src/core-modules/segments/fieldSources.test.ts +99 -0
- package/src/core-modules/segments/fingerprint.test.ts +111 -0
- package/src/core-modules/segments/fingerprint.ts +70 -0
- package/src/core-modules/segments/index.ts +30 -0
- package/src/core-modules/segments/joinChanges.test.ts +96 -0
- package/src/core-modules/segments/joinChanges.ts +67 -0
- package/src/core-modules/segments/materialized.ts +23 -0
- package/src/core-modules/segments/measureRelations.test.ts +222 -0
- package/src/core-modules/segments/measureRelations.ts +322 -0
- package/src/core-modules/segments/memberQuery.test.ts +60 -0
- package/src/core-modules/segments/memberQuery.ts +45 -0
- package/src/core-modules/segments/membership.ts +170 -0
- package/src/core-modules/segments/mongoFilter.test.ts +326 -0
- package/src/core-modules/segments/mongoFilter.ts +355 -0
- package/src/core-modules/segments/nodeRefs.ts +29 -0
- package/src/core-modules/segments/nodes.ts +48 -0
- package/src/core-modules/segments/operators.ts +243 -0
- package/src/core-modules/segments/ownedSource.ts +16 -0
- package/src/core-modules/segments/plan.test.ts +172 -0
- package/src/core-modules/segments/plan.ts +155 -0
- package/src/core-modules/segments/relationRegistry.test.ts +64 -0
- package/src/core-modules/segments/relationRegistry.ts +198 -0
- package/src/core-modules/segments/segmentReference.test.ts +142 -0
- package/src/core-modules/segments/setupSegmentProducers.ts +77 -0
- package/src/core-modules/segments/subjectsReachedBy.ts +70 -0
- package/src/core-modules/segments/timeZone.ts +56 -0
- package/src/core-modules/segments/types.ts +97 -0
- package/src/core-modules/segments/utils.ts +122 -0
- package/src/core-modules/segments/walkNodes.ts +76 -0
- package/src/core-modules/segments/zodSchemas.ts +130 -0
- package/src/core-modules/segments/zonedTime.test.ts +163 -0
- package/src/core-modules/segments/zonedTime.ts +198 -0
- package/src/core-modules/templates/index.ts +1 -0
- package/src/core-modules/templates/utils.ts +91 -0
- package/src/core-modules/users/constants.ts +318 -0
- package/src/core-modules/users/db/definitions/users.ts +226 -0
- package/src/core-modules/users/index.ts +2 -0
- package/src/core-types/common.ts +183 -0
- package/src/core-types/index.ts +19 -0
- package/src/core-types/modules/app/app.ts +13 -0
- package/src/core-types/modules/automations/automations.ts +23 -0
- package/src/core-types/modules/contacts/company.ts +70 -0
- package/src/core-types/modules/contacts/contacts-common.ts +32 -0
- package/src/core-types/modules/contacts/customer.ts +94 -0
- package/src/core-types/modules/emailTemplates/emailTemplate.ts +19 -0
- package/src/core-types/modules/emailTemplates/index.ts +1 -0
- package/src/core-types/modules/logs/logs.ts +30 -0
- package/src/core-types/modules/permissions/permission.ts +63 -0
- package/src/core-types/modules/permissions/role.ts +24 -0
- package/src/core-types/modules/products/product.ts +100 -0
- package/src/core-types/modules/products/productCategory.ts +27 -0
- package/src/core-types/modules/products/productConfig.ts +10 -0
- package/src/core-types/modules/products/uom.ts +12 -0
- package/src/core-types/modules/relations/relations.ts +14 -0
- package/src/core-types/modules/saas/organization.ts +7 -0
- package/src/core-types/modules/structure/structure.ts +29 -0
- package/src/core-types/modules/tags/tag.ts +17 -0
- package/src/core-types/modules/team-member/structure.ts +23 -0
- package/src/core-types/modules/team-member/user.ts +93 -0
- package/src/index.ts +1 -0
- package/src/utils/agent-tools/auth.ts +129 -0
- package/src/utils/agent-tools/endpoints.ts +274 -0
- package/src/utils/agent-tools/index.ts +5 -0
- package/src/utils/agent-tools/manifest.ts +152 -0
- package/src/utils/agent-tools/responseLimit.test.ts +99 -0
- package/src/utils/agent-tools/responseLimit.ts +66 -0
- package/src/utils/agent-tools/types.ts +52 -0
- package/src/utils/apollo/beforeResolvers.ts +117 -0
- package/src/utils/apollo/commonTypeDefs.ts +78 -0
- package/src/utils/apollo/constants.ts +16 -0
- package/src/utils/apollo/customScalars.ts +69 -0
- package/src/utils/apollo/expectedErrorPlugin.ts +83 -0
- package/src/utils/apollo/index.ts +10 -0
- package/src/utils/apollo/runBeforeResolvers.ts +214 -0
- package/src/utils/apollo/utils.ts +80 -0
- package/src/utils/apollo/wrapperMutations.ts +75 -0
- package/src/utils/apollo/wrapperResolvers.ts +182 -0
- package/src/utils/bulkUtils.ts +62 -0
- package/src/utils/constants.ts +99 -0
- package/src/utils/editor.ts +412 -0
- package/src/utils/email/address.ts +42 -0
- package/src/utils/email/attachments.ts +74 -0
- package/src/utils/email/config.ts +46 -0
- package/src/utils/email/constants.ts +25 -0
- package/src/utils/email/index.ts +11 -0
- package/src/utils/email/providers/sendgrid.ts +280 -0
- package/src/utils/email/providers/sendgridEvents.ts +48 -0
- package/src/utils/email/providers/ses.ts +250 -0
- package/src/utils/email/providers/smtp.ts +99 -0
- package/src/utils/email/resolveProvider.ts +75 -0
- package/src/utils/email/service.ts +192 -0
- package/src/utils/email/types.ts +127 -0
- package/src/utils/errorClassifier.test.ts +231 -0
- package/src/utils/errorClassifier.ts +458 -0
- package/src/utils/file/read.ts +464 -0
- package/src/utils/file/upload.ts +531 -0
- package/src/utils/graphqlPubSub.ts +28 -0
- package/src/utils/headers/get-hostname.ts +18 -0
- package/src/utils/headers/index.ts +4 -0
- package/src/utils/headers/sanitize.ts +9 -0
- package/src/utils/headers/subdomain.ts +13 -0
- package/src/utils/headers/user.test.ts +76 -0
- package/src/utils/headers/user.ts +113 -0
- package/src/utils/index.ts +27 -0
- package/src/utils/knowledge.ts +107 -0
- package/src/utils/logs/index.ts +247 -0
- package/src/utils/mongo/cursor-util.ts +153 -0
- package/src/utils/mongo/generate-models.ts +97 -0
- package/src/utils/mongo/index.ts +5 -0
- package/src/utils/mongo/mongo-connection.ts +42 -0
- package/src/utils/mongo/mongoose-types.ts +26 -0
- package/src/utils/mongo/mongoose-utils.ts +329 -0
- package/src/utils/mongo/search-tokens.ts +193 -0
- package/src/utils/mq-worker.ts +150 -0
- package/src/utils/random.ts +6 -0
- package/src/utils/redis.ts +23 -0
- package/src/utils/saas/constants.ts +32 -0
- package/src/utils/saas/definition.ts +318 -0
- package/src/utils/saas/index.ts +2 -0
- package/src/utils/saas/saas-mongo-connection.ts +595 -0
- package/src/utils/saas/types.ts +107 -0
- package/src/utils/sanitize.ts +73 -0
- package/src/utils/sentry-init.ts +128 -0
- package/src/utils/sentry-instrument.ts +5 -0
- package/src/utils/serializablePayload.test.ts +65 -0
- package/src/utils/serializablePayload.ts +44 -0
- package/src/utils/service-discovery.ts +256 -0
- package/src/utils/start-plugin.ts +482 -0
- package/src/utils/string.ts +159 -0
- package/src/utils/trpc/index.ts +278 -0
- package/src/utils/trpc/sendCoreModuleProducer.ts +146 -0
- package/src/utils/trpc/trpc-setup.ts +91 -0
- package/src/utils/utils.ts +669 -0
- package/utils/dist/erxes-api-shared-utils.cjs.d.ts +2 -0
- package/utils/dist/erxes-api-shared-utils.cjs.dev.js +3066 -0
- package/utils/dist/erxes-api-shared-utils.cjs.js +7 -0
- package/utils/dist/erxes-api-shared-utils.cjs.prod.js +3066 -0
- package/utils/dist/erxes-api-shared-utils.esm.js +2776 -0
- package/utils/package.json +5 -0
- package/README.md +0 -3
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape this renderer reads off a block. Structural on purpose: the
|
|
3
|
+
* editor's own types live in a frontend package, and nothing here needs them.
|
|
4
|
+
*/
|
|
5
|
+
export type TEmailBlock = {
|
|
6
|
+
id?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
props?: Record<string, any>;
|
|
9
|
+
content?: any;
|
|
10
|
+
children?: TEmailBlock[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const COLORS_DEFAULT = {
|
|
14
|
+
gray: { text: '#9b9a97', background: '#ebeced' },
|
|
15
|
+
brown: { text: '#64473a', background: '#e9e5e3' },
|
|
16
|
+
red: { text: '#e03e3e', background: '#fbe4e4' },
|
|
17
|
+
orange: { text: '#d9730d', background: '#f6e9d9' },
|
|
18
|
+
yellow: { text: '#dfab01', background: '#fbf3db' },
|
|
19
|
+
green: { text: '#4d6461', background: '#ddedea' },
|
|
20
|
+
blue: { text: '#0b6e99', background: '#ddebf1' },
|
|
21
|
+
purple: { text: '#6940a5', background: '#eae4f2' },
|
|
22
|
+
pink: { text: '#ad1a72', background: '#f4dfeb' },
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
type ColorConfig = Record<string, { text: string; background: string }>;
|
|
26
|
+
|
|
27
|
+
export interface TBlocksToHtmlConfig {
|
|
28
|
+
colors?: ColorConfig;
|
|
29
|
+
baseFont?: string;
|
|
30
|
+
baseFontSize?: string;
|
|
31
|
+
baseLineHeight?: string;
|
|
32
|
+
baseColor?: string;
|
|
33
|
+
maxWidth?: number;
|
|
34
|
+
resolveImageUrl?: (url: string) => string;
|
|
35
|
+
wrapper?: {
|
|
36
|
+
email?: boolean;
|
|
37
|
+
unsubscribeUrl?: string;
|
|
38
|
+
postalAddress?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const DEFAULTS = {
|
|
43
|
+
baseFont:
|
|
44
|
+
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
45
|
+
baseFontSize: '16px',
|
|
46
|
+
baseLineHeight: '1.6',
|
|
47
|
+
baseColor: '#000000',
|
|
48
|
+
maxWidth: 600,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getColor = (
|
|
52
|
+
colorName: string,
|
|
53
|
+
type: 'text' | 'background',
|
|
54
|
+
config?: TBlocksToHtmlConfig,
|
|
55
|
+
): string => {
|
|
56
|
+
const colors: ColorConfig = config?.colors || COLORS_DEFAULT;
|
|
57
|
+
const color = colors[colorName]?.[type];
|
|
58
|
+
|
|
59
|
+
if (!color) {
|
|
60
|
+
console.warn(`Color not found: ${colorName}.${type}`);
|
|
61
|
+
return type === 'text' ? '#000000' : 'transparent';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return color;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const escapeHtml = (text: string): string => {
|
|
68
|
+
return text
|
|
69
|
+
.replace(/&/g, '&')
|
|
70
|
+
.replace(/</g, '<')
|
|
71
|
+
.replace(/>/g, '>')
|
|
72
|
+
.replace(/"/g, '"')
|
|
73
|
+
.replace(/'/g, ''');
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const stylesToCss = (styles?: Record<string, any>, config?: TBlocksToHtmlConfig): string => {
|
|
77
|
+
if (!styles) return '';
|
|
78
|
+
|
|
79
|
+
const cssProps: string[] = [];
|
|
80
|
+
|
|
81
|
+
for (const [key, value] of Object.entries(styles)) {
|
|
82
|
+
if (!value || value === 'default') continue;
|
|
83
|
+
|
|
84
|
+
switch (key) {
|
|
85
|
+
case 'bold':
|
|
86
|
+
cssProps.push('font-weight: bold');
|
|
87
|
+
break;
|
|
88
|
+
case 'italic':
|
|
89
|
+
cssProps.push('font-style: italic');
|
|
90
|
+
break;
|
|
91
|
+
case 'underline':
|
|
92
|
+
cssProps.push('text-decoration: underline');
|
|
93
|
+
break;
|
|
94
|
+
case 'strikethrough':
|
|
95
|
+
case 'strike':
|
|
96
|
+
cssProps.push('text-decoration: line-through');
|
|
97
|
+
break;
|
|
98
|
+
case 'code':
|
|
99
|
+
cssProps.push('font-family: Courier, monospace');
|
|
100
|
+
cssProps.push('background-color: #f4f4f4');
|
|
101
|
+
cssProps.push('padding: 2px 4px');
|
|
102
|
+
cssProps.push('border-radius: 3px');
|
|
103
|
+
cssProps.push('font-size: 90%');
|
|
104
|
+
break;
|
|
105
|
+
case 'textColor':
|
|
106
|
+
if (value !== 'default') {
|
|
107
|
+
cssProps.push(`color: ${getColor(value, 'text', config)}`);
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case 'backgroundColor':
|
|
111
|
+
if (value !== 'default') {
|
|
112
|
+
cssProps.push(
|
|
113
|
+
`background-color: ${getColor(value, 'background', config)}`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
case 'textAlignment':
|
|
118
|
+
cssProps.push(`text-align: ${value}`);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return cssProps.join('; ');
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const renderInlineContent = (content: any[], config?: TBlocksToHtmlConfig): string => {
|
|
127
|
+
if (!Array.isArray(content) || content.length === 0) return '';
|
|
128
|
+
|
|
129
|
+
return content
|
|
130
|
+
.map((item) => {
|
|
131
|
+
const { type, text, styles, href, content: nestedContent } = item;
|
|
132
|
+
|
|
133
|
+
// Handle links - email-safe with full inline styles
|
|
134
|
+
if (type === 'link') {
|
|
135
|
+
const children = renderInlineContent(nestedContent || [], config);
|
|
136
|
+
const linkStyles = 'color: #0066cc; text-decoration: underline';
|
|
137
|
+
return `<a href="${escapeHtml(
|
|
138
|
+
href || '#',
|
|
139
|
+
)}" style="${linkStyles}">${children}</a>`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (type === 'rawHtml') {
|
|
143
|
+
return item.props?.html || '';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// A field chip carries no text of its own; it becomes the placeholder
|
|
147
|
+
// the sender fills per recipient.
|
|
148
|
+
if (type === 'attribute') {
|
|
149
|
+
const value = item.props?.value || item.props?.name || '';
|
|
150
|
+
|
|
151
|
+
return value ? `{{ ${value} }}` : '';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const escapedText = escapeHtml(text || '')
|
|
155
|
+
.replace(/\n/g, '<br />')
|
|
156
|
+
.replace(/ {2,}/g, (spaces) => ' '.repeat(spaces.length));
|
|
157
|
+
const cssStyle = stylesToCss(styles, config);
|
|
158
|
+
|
|
159
|
+
if (cssStyle) {
|
|
160
|
+
return `<span style="${cssStyle}">${escapedText}</span>`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return escapedText;
|
|
164
|
+
})
|
|
165
|
+
.join('');
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const getBaseStyles = (config?: TBlocksToHtmlConfig) => {
|
|
169
|
+
return {
|
|
170
|
+
p: `margin: 0 0 16px 0; font-family: ${
|
|
171
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
172
|
+
}; font-size: ${
|
|
173
|
+
config?.baseFontSize || DEFAULTS.baseFontSize
|
|
174
|
+
}; line-height: ${
|
|
175
|
+
config?.baseLineHeight || DEFAULTS.baseLineHeight
|
|
176
|
+
}; color: ${config?.baseColor || DEFAULTS.baseColor}`,
|
|
177
|
+
h1: `margin: 24px 0 16px 0; font-family: ${
|
|
178
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
179
|
+
}; font-size: 32px; font-weight: bold; line-height: 1.2; color: ${
|
|
180
|
+
config?.baseColor || DEFAULTS.baseColor
|
|
181
|
+
}`,
|
|
182
|
+
h2: `margin: 20px 0 12px 0; font-family: ${
|
|
183
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
184
|
+
}; font-size: 24px; font-weight: bold; line-height: 1.3; color: ${
|
|
185
|
+
config?.baseColor || DEFAULTS.baseColor
|
|
186
|
+
}`,
|
|
187
|
+
h3: `margin: 16px 0 8px 0; font-family: ${
|
|
188
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
189
|
+
}; font-size: 20px; font-weight: bold; line-height: 1.4; color: ${
|
|
190
|
+
config?.baseColor || DEFAULTS.baseColor
|
|
191
|
+
}`,
|
|
192
|
+
ul: `margin: 0 0 16px 0; padding: 0 0 0 24px; font-family: ${
|
|
193
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
194
|
+
}`,
|
|
195
|
+
ol: `margin: 0 0 16px 0; padding: 0 0 0 24px; font-family: ${
|
|
196
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
197
|
+
}`,
|
|
198
|
+
li: `margin: 0 0 8px 0; font-size: ${
|
|
199
|
+
config?.baseFontSize || DEFAULTS.baseFontSize
|
|
200
|
+
}; line-height: ${config?.baseLineHeight || DEFAULTS.baseLineHeight}`,
|
|
201
|
+
blockquote: `margin: 16px 0; padding: 8px 16px; border-left: 4px solid #ddd; background-color: #f9f9f9; font-family: ${
|
|
202
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
203
|
+
}; font-style: italic`,
|
|
204
|
+
table: `border-collapse: collapse; width: 100%; margin: 16px 0; font-family: ${
|
|
205
|
+
config?.baseFont || DEFAULTS.baseFont
|
|
206
|
+
}`,
|
|
207
|
+
pre: `margin: 16px 0; padding: 16px; background-color: #f4f4f4; border: 1px solid #ddd; border-radius: 4px; overflow-x: auto; font-family: Courier, monospace; font-size: 14px; line-height: 1.5`,
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const mergeStyles = (baseStyle: string, customStyle?: string): string => {
|
|
212
|
+
if (!customStyle) return baseStyle;
|
|
213
|
+
return `${baseStyle}; ${customStyle}`;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const resolveSrc = (url: string, config?: TBlocksToHtmlConfig): string =>
|
|
217
|
+
config?.resolveImageUrl ? config.resolveImageUrl(url) : url;
|
|
218
|
+
|
|
219
|
+
const renderBlock = (block: TEmailBlock, config?: TBlocksToHtmlConfig): string => {
|
|
220
|
+
const { type, props, content } = block as any;
|
|
221
|
+
const baseStyles = getBaseStyles(config);
|
|
222
|
+
const customStyle = stylesToCss(props, config);
|
|
223
|
+
|
|
224
|
+
switch (type) {
|
|
225
|
+
case 'paragraph': {
|
|
226
|
+
const html = renderInlineContent(content || [], config);
|
|
227
|
+
if (!html.trim()) return '<p style="' + baseStyles.p + '"> </p>';
|
|
228
|
+
return `<p style="${mergeStyles(baseStyles.p, customStyle)}">${html}</p>`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
case 'heading': {
|
|
232
|
+
const level = Math.min(Math.max(props?.level || 1, 1), 3);
|
|
233
|
+
const html = renderInlineContent(content || [], config);
|
|
234
|
+
const headingStyle = baseStyles[`h${level}` as 'h1' | 'h2' | 'h3'];
|
|
235
|
+
return `<h${level} style="${mergeStyles(
|
|
236
|
+
headingStyle,
|
|
237
|
+
customStyle,
|
|
238
|
+
)}">${html}</h${level}>`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
case 'bulletListItem': {
|
|
242
|
+
const html = renderInlineContent(content || [], config);
|
|
243
|
+
return `<li style="${mergeStyles(
|
|
244
|
+
baseStyles.li,
|
|
245
|
+
customStyle,
|
|
246
|
+
)}">${html}</li>`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
case 'numberedListItem': {
|
|
250
|
+
const html = renderInlineContent(content || [], config);
|
|
251
|
+
return `<li style="${mergeStyles(
|
|
252
|
+
baseStyles.li,
|
|
253
|
+
customStyle,
|
|
254
|
+
)}">${html}</li>`;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
case 'checkListItem': {
|
|
258
|
+
const html = renderInlineContent(content || [], config);
|
|
259
|
+
const checked = props?.checked;
|
|
260
|
+
const checkbox = checked ? '☑' : '☐';
|
|
261
|
+
return `<div style="${mergeStyles(
|
|
262
|
+
baseStyles.p,
|
|
263
|
+
customStyle,
|
|
264
|
+
)}">${checkbox} ${html}</div>`;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
case 'codeBlock': {
|
|
268
|
+
const code =
|
|
269
|
+
content?.map((c: any) => escapeHtml(c.text || '')).join('\n') || '';
|
|
270
|
+
return `<pre style="${mergeStyles(
|
|
271
|
+
baseStyles.pre,
|
|
272
|
+
customStyle,
|
|
273
|
+
)}"><code>${code}</code></pre>`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
case 'image': {
|
|
277
|
+
const { url, caption, name, previewWidth } = props || {};
|
|
278
|
+
|
|
279
|
+
if (!url) {
|
|
280
|
+
return '';
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const width = Math.min(previewWidth || 600, 600);
|
|
284
|
+
const imgStyle = `max-width: 100%; height: auto; display: block; margin: 0`;
|
|
285
|
+
const src = resolveSrc(url, config);
|
|
286
|
+
|
|
287
|
+
let html = `<div style="margin: 16px 0;">
|
|
288
|
+
<img src="${escapeHtml(src)}" alt="${escapeHtml(
|
|
289
|
+
name || '',
|
|
290
|
+
)}" width="${width}" style="${imgStyle}" />`;
|
|
291
|
+
|
|
292
|
+
if (caption) {
|
|
293
|
+
html += `<div style="margin-top: 8px; font-size: 14px; color: #666; font-style: italic;">${escapeHtml(
|
|
294
|
+
caption,
|
|
295
|
+
)}</div>`;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
html += `</div>`;
|
|
299
|
+
return html;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
case 'documentPlaceholder': {
|
|
303
|
+
const { documentId } = props || {};
|
|
304
|
+
|
|
305
|
+
if (!documentId) {
|
|
306
|
+
return '';
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return `<div class="erxes-document-placeholder" data-document-id="${escapeHtml(
|
|
310
|
+
documentId,
|
|
311
|
+
)}">{{ document.${escapeHtml(documentId)} }}</div>`;
|
|
312
|
+
}
|
|
313
|
+
case 'gallery': {
|
|
314
|
+
let images: { url?: string; caption?: string }[] = [];
|
|
315
|
+
try {
|
|
316
|
+
const parsed = JSON.parse(props?.images || '[]');
|
|
317
|
+
images = Array.isArray(parsed) ? parsed : [];
|
|
318
|
+
} catch {
|
|
319
|
+
images = [];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
images = images.filter((img) => img?.url);
|
|
323
|
+
if (images.length === 0) return '';
|
|
324
|
+
|
|
325
|
+
const columns = Math.max(2, Math.min(4, parseInt(props?.columns) || 3));
|
|
326
|
+
const cellWidth = `${Math.floor(100 / columns)}%`;
|
|
327
|
+
const imgStyle = `width: 100%; height: auto; display: block; border: 0`;
|
|
328
|
+
|
|
329
|
+
const rows: string[] = [];
|
|
330
|
+
const cellList = images.map((img) => {
|
|
331
|
+
const src = resolveSrc(img.url || '', config);
|
|
332
|
+
let cell = `<img src="${escapeHtml(src)}" alt="${escapeHtml(
|
|
333
|
+
img.caption || '',
|
|
334
|
+
)}" style="${imgStyle}" />`;
|
|
335
|
+
|
|
336
|
+
if (img.caption) {
|
|
337
|
+
cell += `<div style="margin-top: 4px; font-size: 12px; color: #666; font-style: italic;">${escapeHtml(
|
|
338
|
+
img.caption,
|
|
339
|
+
)}</div>`;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return `<td valign="top" width="${cellWidth}" style="padding: 4px; vertical-align: top;">${cell}</td>`;
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
for (let r = 0; r < cellList.length; r += columns) {
|
|
346
|
+
rows.push(`<tr>${cellList.slice(r, r + columns).join('')}</tr>`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return `<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; margin: 16px 0;"><tbody>${rows.join(
|
|
350
|
+
'',
|
|
351
|
+
)}</tbody></table>`;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
case 'table': {
|
|
355
|
+
const { rows, columnWidths } = content || {};
|
|
356
|
+
if (!rows || !Array.isArray(rows)) return '';
|
|
357
|
+
|
|
358
|
+
const widths: number[] = (columnWidths || []).map(
|
|
359
|
+
(columnWidth: unknown) => Number(columnWidth) || 0,
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const totalWidth = widths.reduce((sum, width) => sum + width, 0);
|
|
363
|
+
|
|
364
|
+
const colgroup =
|
|
365
|
+
totalWidth > 0 && widths.every((width) => width > 0)
|
|
366
|
+
? `<colgroup>${widths
|
|
367
|
+
.map(
|
|
368
|
+
(width) =>
|
|
369
|
+
`<col style="width: ${
|
|
370
|
+
Math.round((width / totalWidth) * 10000) / 100
|
|
371
|
+
}%" />`,
|
|
372
|
+
)
|
|
373
|
+
.join('')}</colgroup>`
|
|
374
|
+
: '';
|
|
375
|
+
|
|
376
|
+
const tableRows = rows
|
|
377
|
+
.map((row: any, rowIndex: number) => {
|
|
378
|
+
const cells = (row.cells || [])
|
|
379
|
+
.map((cell: any) => {
|
|
380
|
+
const cellData = Array.isArray(cell) ? { content: cell } : cell;
|
|
381
|
+
|
|
382
|
+
const cellContent = renderInlineContent(
|
|
383
|
+
cellData?.content || [],
|
|
384
|
+
config,
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
const colspan = Number(cellData?.props?.colspan) || 1;
|
|
388
|
+
const rowspan = Number(cellData?.props?.rowspan) || 1;
|
|
389
|
+
|
|
390
|
+
const spanAttrs = `${colspan > 1 ? ` colspan="${colspan}"` : ''}${
|
|
391
|
+
rowspan > 1 ? ` rowspan="${rowspan}"` : ''
|
|
392
|
+
}`;
|
|
393
|
+
|
|
394
|
+
const cellStyle = `padding: 8px; border: 1px solid #ddd; ${
|
|
395
|
+
rowIndex === 0
|
|
396
|
+
? 'font-weight: bold; background-color: #f4f4f4;'
|
|
397
|
+
: ''
|
|
398
|
+
}`;
|
|
399
|
+
|
|
400
|
+
return `<td${spanAttrs} style="${cellStyle}">${
|
|
401
|
+
cellContent || ' '
|
|
402
|
+
}</td>`;
|
|
403
|
+
})
|
|
404
|
+
.join('');
|
|
405
|
+
return `<tr>${cells}</tr>`;
|
|
406
|
+
})
|
|
407
|
+
.join('');
|
|
408
|
+
|
|
409
|
+
return `<table style="${mergeStyles(baseStyles.table, customStyle)}">
|
|
410
|
+
${colgroup}<tbody>${tableRows}</tbody>
|
|
411
|
+
</table>`;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
case 'quote': {
|
|
415
|
+
const html = renderInlineContent(content || [], config);
|
|
416
|
+
return `<blockquote style="${mergeStyles(
|
|
417
|
+
baseStyles.blockquote,
|
|
418
|
+
customStyle,
|
|
419
|
+
)}">${html}</blockquote>`;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
case 'rawHtml': {
|
|
423
|
+
return props?.html || '';
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
default: {
|
|
427
|
+
const html = renderInlineContent(content || [], config);
|
|
428
|
+
return html ? `<p style="${baseStyles.p}">${html}</p>` : '';
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const groupListBlocks = (
|
|
434
|
+
blocks: TEmailBlock[],
|
|
435
|
+
config?: TBlocksToHtmlConfig,
|
|
436
|
+
): string => {
|
|
437
|
+
const result: string[] = [];
|
|
438
|
+
const baseStyles = getBaseStyles(config);
|
|
439
|
+
let i = 0;
|
|
440
|
+
|
|
441
|
+
while (i < blocks.length) {
|
|
442
|
+
const block = blocks[i] as any;
|
|
443
|
+
|
|
444
|
+
if (block.type === 'bulletListItem') {
|
|
445
|
+
const items: string[] = [];
|
|
446
|
+
while (
|
|
447
|
+
i < blocks.length &&
|
|
448
|
+
(blocks[i] as any).type === 'bulletListItem'
|
|
449
|
+
) {
|
|
450
|
+
items.push(renderBlock(blocks[i], config));
|
|
451
|
+
i++;
|
|
452
|
+
}
|
|
453
|
+
result.push(`<ul style="${baseStyles.ul}">${items.join('')}</ul>`);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (block.type === 'numberedListItem') {
|
|
458
|
+
const items: string[] = [];
|
|
459
|
+
while (
|
|
460
|
+
i < blocks.length &&
|
|
461
|
+
(blocks[i] as any).type === 'numberedListItem'
|
|
462
|
+
) {
|
|
463
|
+
items.push(renderBlock(blocks[i], config));
|
|
464
|
+
i++;
|
|
465
|
+
}
|
|
466
|
+
result.push(`<ol style="${baseStyles.ol}">${items.join('')}</ol>`);
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
result.push(renderBlock(block, config));
|
|
471
|
+
i++;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return result.join('\n');
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export const blocksToHtml = (
|
|
478
|
+
blocks: TEmailBlock[] | string,
|
|
479
|
+
config?: TBlocksToHtmlConfig,
|
|
480
|
+
): string => {
|
|
481
|
+
const { wrapper } = config || {};
|
|
482
|
+
|
|
483
|
+
try {
|
|
484
|
+
const parsedBlocks =
|
|
485
|
+
typeof blocks === 'string' ? JSON.parse(blocks) : blocks;
|
|
486
|
+
|
|
487
|
+
if (!Array.isArray(parsedBlocks) || parsedBlocks.length === 0) {
|
|
488
|
+
return '';
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (wrapper?.email) {
|
|
492
|
+
return emailHtmlWrapper(groupListBlocks(parsedBlocks, config), config);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return groupListBlocks(parsedBlocks, config);
|
|
496
|
+
} catch (error) {
|
|
497
|
+
console.error('Error converting blocks to HTML:', error);
|
|
498
|
+
return '';
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
export const emailHtmlWrapper = (html: string, config?: TBlocksToHtmlConfig) => {
|
|
503
|
+
const maxWidth = Math.min(config?.maxWidth || DEFAULTS.maxWidth, 600);
|
|
504
|
+
const unsubscribeUrl = config?.wrapper?.unsubscribeUrl;
|
|
505
|
+
const postalAddress = config?.wrapper?.postalAddress;
|
|
506
|
+
|
|
507
|
+
const unsubscribeRow = unsubscribeUrl
|
|
508
|
+
? `<tr>
|
|
509
|
+
<td style="padding: 10px; color: #ccc; text-align: center; font-size: 12px; border-top: 1px solid #f0f0f0;">
|
|
510
|
+
You are receiving this email because you have signed up for our services.
|
|
511
|
+
<br />
|
|
512
|
+
<a style="text-decoration: underline; color: #ccc;" rel="noopener" target="_blank" href="${unsubscribeUrl}">Unsubscribe</a>
|
|
513
|
+
</td>
|
|
514
|
+
</tr>`
|
|
515
|
+
: '';
|
|
516
|
+
|
|
517
|
+
const postalAddressRow = postalAddress
|
|
518
|
+
? `<tr>
|
|
519
|
+
<td style="padding: 0 10px 10px; color: #ccc; text-align: center; font-size: 12px;">
|
|
520
|
+
${postalAddress}
|
|
521
|
+
</td>
|
|
522
|
+
</tr>`
|
|
523
|
+
: '';
|
|
524
|
+
|
|
525
|
+
return `
|
|
526
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
527
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
528
|
+
<head>
|
|
529
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
530
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
531
|
+
</head>
|
|
532
|
+
<body style="margin: 0; padding: 0;">
|
|
533
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: #f4f4f4;">
|
|
534
|
+
<tr>
|
|
535
|
+
<td align="center" style="padding: 20px 0;">
|
|
536
|
+
<table border="0" cellpadding="0" cellspacing="0" width="${maxWidth}" style="background-color: #ffffff;">
|
|
537
|
+
<tr>
|
|
538
|
+
<td style="padding: 20px;">
|
|
539
|
+
${html}
|
|
540
|
+
</td>
|
|
541
|
+
</tr>
|
|
542
|
+
${unsubscribeRow}
|
|
543
|
+
${postalAddressRow}
|
|
544
|
+
</table>
|
|
545
|
+
</td>
|
|
546
|
+
</tr>
|
|
547
|
+
</table>
|
|
548
|
+
</body>
|
|
549
|
+
</html>
|
|
550
|
+
`;
|
|
551
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const appendUnsubscribeFooter = (
|
|
2
|
+
html: string,
|
|
3
|
+
{
|
|
4
|
+
unsubscribeUrl,
|
|
5
|
+
postalAddress,
|
|
6
|
+
}: { unsubscribeUrl: string; postalAddress?: string },
|
|
7
|
+
): string => {
|
|
8
|
+
const footer = `<table role="presentation" width="100%" style="max-width:600px;margin:0 auto;"><tr><td style="padding:24px 24px 0 24px;text-align:center;font-size:12px;line-height:18px;color:#8898aa;">${
|
|
9
|
+
postalAddress ? `${postalAddress}<br/>` : ''
|
|
10
|
+
}You are receiving this email because you have signed up for our services.<br/><a href="${unsubscribeUrl}" style="color:#8898aa;text-decoration:underline;" rel="noopener" target="_blank">Unsubscribe</a></td></tr></table>`;
|
|
11
|
+
|
|
12
|
+
if (html.includes('</body>')) {
|
|
13
|
+
return html.replace('</body>', `${footer}</body>`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return `${html}${footer}`;
|
|
17
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { expandRepeatRows } from './expandRepeatRows';
|
|
2
|
+
|
|
3
|
+
const TABLE =
|
|
4
|
+
'<table><tr><th>Name</th><th>Qty</th></tr>' +
|
|
5
|
+
'<tr><td>{{ trigger.productsData.$.name }}</td><td>{{ trigger.productsData.$.quantity }}</td></tr>' +
|
|
6
|
+
'</table><p>{{ trigger.name }}</p>';
|
|
7
|
+
|
|
8
|
+
describe('expandRepeatRows', () => {
|
|
9
|
+
it('writes the row once per item with the item index', async () => {
|
|
10
|
+
const html = await expandRepeatRows(TABLE, async () => 2);
|
|
11
|
+
|
|
12
|
+
expect(html).toBe(
|
|
13
|
+
'<table><tr><th>Name</th><th>Qty</th></tr>' +
|
|
14
|
+
'<tr><td>{{ trigger.productsData.0.name }}</td><td>{{ trigger.productsData.0.quantity }}</td></tr>' +
|
|
15
|
+
'<tr><td>{{ trigger.productsData.1.name }}</td><td>{{ trigger.productsData.1.quantity }}</td></tr>' +
|
|
16
|
+
'</table><p>{{ trigger.name }}</p>',
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('drops the row for an empty list and asks each list once', async () => {
|
|
21
|
+
const countOf = jest.fn(async () => 0);
|
|
22
|
+
const html = await expandRepeatRows(TABLE + TABLE, countOf);
|
|
23
|
+
|
|
24
|
+
expect(html).not.toContain('productsData');
|
|
25
|
+
expect(countOf).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(countOf).toHaveBeenCalledWith('trigger.productsData');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('leaves html without item placeholders untouched', async () => {
|
|
30
|
+
const countOf = jest.fn(async () => 3);
|
|
31
|
+
const html = '<table><tr><td>{{ trigger.name }}</td></tr></table>';
|
|
32
|
+
|
|
33
|
+
expect(await expandRepeatRows(html, countOf)).toBe(html);
|
|
34
|
+
expect(countOf).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** A table row: cells never hold another table in what the editors write. */
|
|
2
|
+
const ROW = /<tr\b[^>]*>[\s\S]*?<\/tr>/gi;
|
|
3
|
+
|
|
4
|
+
/** `{{ list.$.field }}`: one field of each item in `list`. */
|
|
5
|
+
const ITEM_PLACEHOLDER = /\{\{\s*([^{}|]+?)\.\$\.[^{}]*?\}\}/;
|
|
6
|
+
|
|
7
|
+
/** How many items a list holds, asked as `list.$count`. */
|
|
8
|
+
export type TRepeatCounter = (listPath: string) => Promise<number>;
|
|
9
|
+
|
|
10
|
+
const itemsOf = async (
|
|
11
|
+
listPath: string,
|
|
12
|
+
countOf: TRepeatCounter,
|
|
13
|
+
counts: Map<string, number>,
|
|
14
|
+
) => {
|
|
15
|
+
if (!counts.has(listPath)) {
|
|
16
|
+
counts.set(listPath, Math.max(0, Math.floor((await countOf(listPath)) || 0)));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return counts.get(listPath) || 0;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A row whose cells read `{{ list.$.field }}` is written once per item of the
|
|
24
|
+
* list, `$` becoming the item's index, so the usual placeholder pass fills
|
|
25
|
+
* each copy from its own item. An empty list leaves no row.
|
|
26
|
+
*/
|
|
27
|
+
export const expandRepeatRows = async (
|
|
28
|
+
html: string | undefined,
|
|
29
|
+
countOf: TRepeatCounter,
|
|
30
|
+
): Promise<string> => {
|
|
31
|
+
if (!html || !html.includes('.$.')) {
|
|
32
|
+
return html || '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const counts = new Map<string, number>();
|
|
36
|
+
const rows = [...html.matchAll(ROW)];
|
|
37
|
+
let expanded = '';
|
|
38
|
+
let cursor = 0;
|
|
39
|
+
|
|
40
|
+
for (const match of rows) {
|
|
41
|
+
const row = match[0];
|
|
42
|
+
const listPath = row.match(ITEM_PLACEHOLDER)?.[1]?.trim();
|
|
43
|
+
|
|
44
|
+
if (!listPath) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const count = await itemsOf(listPath, countOf, counts);
|
|
49
|
+
const marker = `${listPath}.$.`;
|
|
50
|
+
|
|
51
|
+
expanded += html.slice(cursor, match.index);
|
|
52
|
+
expanded += Array.from({ length: count }, (_, index) =>
|
|
53
|
+
row.split(marker).join(`${listPath}.${index}.`),
|
|
54
|
+
).join('');
|
|
55
|
+
cursor = (match.index || 0) + row.length;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return expanded + html.slice(cursor);
|
|
59
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './blocksToHtml';
|
|
2
|
+
export * from './constants';
|
|
3
|
+
export * from './emailFooter';
|
|
4
|
+
export * from './expandRepeatRows';
|
|
5
|
+
export * from './renderEmailContent';
|
|
6
|
+
export * from './replacePlaceholders';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './unresolvedPlaceholders';
|