@hartl-services/medusa-base 0.3.0 → 1.0.0
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/.medusa/server/src/admin/index.js +2164 -29
- package/.medusa/server/src/admin/index.mjs +2166 -31
- package/.medusa/server/src/api/admin/email/messages/[id]/resends/route.js +24 -0
- package/.medusa/server/src/api/admin/email/messages/[id]/route.js +12 -0
- package/.medusa/server/src/api/admin/email/messages/route.js +12 -0
- package/.medusa/server/src/api/admin/email/terms-versions/[id]/download/route.js +16 -0
- package/.medusa/server/src/api/admin/email/terms-versions/route.js +47 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/download/route.js +21 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/[document_id]/regenerate/route.js +38 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/regenerate/route.js +32 -0
- package/.medusa/server/src/api/admin/orders/[id]/documents/route.js +36 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/download/route.js +24 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/[fulfillment_id]/retry/route.js +44 -0
- package/.medusa/server/src/api/admin/orders/[id]/packing-lists/route.js +82 -0
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/actions/[action_key]/route.js +31 -0
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/actions/[action_key]/runs/route.js +16 -0
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/route.js +14 -0
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/settings/route.js +22 -0
- package/.medusa/server/src/api/admin/plugin-features/route.js +6 -4
- package/.medusa/server/src/api/document-download-response.js +16 -0
- package/.medusa/server/src/api/document-response.js +23 -0
- package/.medusa/server/src/api/files/[asset]/route.js +24 -0
- package/.medusa/server/src/api/files/file-response.js +43 -0
- package/.medusa/server/src/api/files/gateway-options.js +31 -0
- package/.medusa/server/src/api/files/private/[token]/route.js +29 -0
- package/.medusa/server/src/api/files/upload/[token]/route.js +66 -0
- package/.medusa/server/src/api/middlewares.js +186 -5
- package/.medusa/server/src/api/packing-list-response.js +22 -0
- package/.medusa/server/src/api/plugin-actions.js +221 -0
- package/.medusa/server/src/api/plugin-features-http.js +67 -8
- package/.medusa/server/src/api/route.js +27 -0
- package/.medusa/server/src/api/store/documents/[id]/download/route.js +21 -0
- package/.medusa/server/src/api/store/documents/[id]/route.js +15 -0
- package/.medusa/server/src/api/store/documents/route.js +11 -0
- package/.medusa/server/src/api/terms-download-response.js +12 -0
- package/.medusa/server/src/documents/config/index.js +18 -0
- package/.medusa/server/src/documents/paths/documents.js +6 -0
- package/.medusa/server/src/documents/paths/index.js +18 -0
- package/.medusa/server/src/documents/plugin-features.js +24 -0
- package/.medusa/server/src/documents/schemas/documents.js +18 -0
- package/.medusa/server/src/documents/schemas/index.js +18 -0
- package/.medusa/server/src/documents/scripts/verify-documents-file-storage.js +55 -0
- package/.medusa/server/src/documents/templates/financial-document.js +142 -0
- package/.medusa/server/src/documents/templates/format.js +31 -0
- package/.medusa/server/src/documents/templates/html-factory.js +40 -0
- package/.medusa/server/src/documents/templates/html-utils.js +13 -0
- package/.medusa/server/src/documents/templates/layout.js +97 -0
- package/.medusa/server/src/documents/templates/packing-list.js +50 -0
- package/.medusa/server/src/documents/types/admin-api.js +3 -0
- package/.medusa/server/src/documents/types/document-summary.js +3 -0
- package/.medusa/server/src/documents/types/documents.js +3 -0
- package/.medusa/server/src/documents/types/html-factory.js +6 -0
- package/.medusa/server/src/documents/types/index.js +22 -0
- package/.medusa/server/src/documents/types/store-api.js +3 -0
- package/.medusa/server/src/documents/utils/document-merchant.js +22 -0
- package/.medusa/server/src/documents/utils/html-to-pdf.js +61 -0
- package/.medusa/server/src/documents/utils/private-file-storage.js +64 -0
- package/.medusa/server/src/documents/utils/resolve-services.js +7 -0
- package/.medusa/server/src/email/application/handle-invite-event.js +312 -0
- package/.medusa/server/src/email/application/handle-password-reset-event.js +354 -0
- package/.medusa/server/src/email/config/index.js +84 -0
- package/.medusa/server/src/email/config/notification-module.js +20 -0
- package/.medusa/server/src/email/domain/business-keys.js +50 -0
- package/.medusa/server/src/email/domain/documents-fact-fingerprint.js +7 -0
- package/.medusa/server/src/email/domain/event-schemas.js +36 -0
- package/.medusa/server/src/email/domain/failure-classification.js +53 -0
- package/.medusa/server/src/email/plugin-features.js +31 -0
- package/.medusa/server/src/email/rendering/default-templates.js +91 -0
- package/.medusa/server/src/email/rendering/render-email.js +37 -0
- package/.medusa/server/src/email/rendering/resolve-shop-configuration.js +48 -0
- package/.medusa/server/src/email/types/email-kinds.js +18 -0
- package/.medusa/server/src/email/types/index.js +21 -0
- package/.medusa/server/src/email/types/shop-configuration.js +3 -0
- package/.medusa/server/src/email/types/smtp-configuration.js +3 -0
- package/.medusa/server/src/email/types/template-data.js +79 -0
- package/.medusa/server/src/files/config/index.js +256 -0
- package/.medusa/server/src/files/gateway/index.js +115 -0
- package/.medusa/server/src/files/types/index.js +6 -0
- package/.medusa/server/src/files/types/public.js +6 -0
- package/.medusa/server/src/jobs/document-fact-publication-reconciliation.js +18 -0
- package/.medusa/server/src/jobs/document-resolution-reconciliation.js +20 -0
- package/.medusa/server/src/jobs/packing-list-reconciliation.js +49 -0
- package/.medusa/server/src/jobs/reconcile-email-attempts.js +63 -0
- package/.medusa/server/src/jobs/reconcile-pending-email-messages.js +41 -0
- package/.medusa/server/src/jobs/retry-email-messages.js +27 -0
- package/.medusa/server/src/migration-scripts/dismiss-orphaned-cart-promotion-links.js +26 -0
- package/.medusa/server/src/modules/documents/domain/cancellation-snapshot.js +97 -0
- package/.medusa/server/src/modules/documents/domain/document-number.js +36 -0
- package/.medusa/server/src/modules/documents/domain/document-resolution.js +24 -0
- package/.medusa/server/src/modules/documents/domain/issuance-rules.js +37 -0
- package/.medusa/server/src/modules/documents/domain/merchant.js +86 -0
- package/.medusa/server/src/modules/documents/domain/options.js +40 -0
- package/.medusa/server/src/modules/documents/domain/packing-list.js +90 -0
- package/.medusa/server/src/modules/documents/domain/snapshot-normalization.js +17 -0
- package/.medusa/server/src/modules/documents/domain/tax-breakdown.js +66 -0
- package/.medusa/server/src/modules/documents/index.js +15 -0
- package/.medusa/server/src/modules/documents/loaders/assert-private-file-storage.js +20 -0
- package/.medusa/server/src/modules/documents/migrations/Migration20260827061749.js +75 -0
- package/.medusa/server/src/modules/documents/migrations/Migration20260830111207.js +28 -0
- package/.medusa/server/src/modules/documents/models/document-artifact.js +25 -0
- package/.medusa/server/src/modules/documents/models/document-number-sequence.js +29 -0
- package/.medusa/server/src/modules/documents/models/document.js +82 -0
- package/.medusa/server/src/modules/documents/models/order-cancellation-resolution.js +51 -0
- package/.medusa/server/src/modules/documents/models/packing-list-revision.js +36 -0
- package/.medusa/server/src/modules/documents/models/packing-list.js +27 -0
- package/.medusa/server/src/modules/documents/models/refund-document-resolution.js +66 -0
- package/.medusa/server/src/modules/documents/models/shipment-invoice-assignment.js +51 -0
- package/.medusa/server/src/modules/documents/models/shipment-invoice-coordinator.js +44 -0
- package/.medusa/server/src/modules/documents/service.js +1701 -0
- package/.medusa/server/src/modules/email/domain/attachment.js +25 -0
- package/.medusa/server/src/modules/email/domain/message-state.js +69 -0
- package/.medusa/server/src/modules/email/index.js +13 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260826173422.js +32 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260827172945.js +16 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260827194804.js +22 -0
- package/.medusa/server/src/modules/email/migrations/Migration20260906195205.js +16 -0
- package/.medusa/server/src/modules/email/models/email-attempt.js +56 -0
- package/.medusa/server/src/modules/email/models/email-message.js +71 -0
- package/.medusa/server/src/modules/email/models/email-terms-version.js +37 -0
- package/.medusa/server/src/modules/email/service.js +1285 -0
- package/.medusa/server/src/modules/plugin-features/domain/plugin-action-runs.js +92 -0
- package/.medusa/server/src/modules/plugin-features/domain/plugin-settings.js +213 -0
- package/.medusa/server/src/modules/plugin-features/domain/secret-box.js +56 -0
- package/.medusa/server/src/modules/plugin-features/migrations/Migration20260928205031.js +16 -0
- package/.medusa/server/src/modules/plugin-features/migrations/Migration20260928215428.js +17 -0
- package/.medusa/server/src/modules/plugin-features/models/plugin-action-run.js +43 -0
- package/.medusa/server/src/modules/plugin-features/models/plugin-setting-state.js +32 -0
- package/.medusa/server/src/modules/plugin-features/service.js +419 -17
- package/.medusa/server/src/providers/s3-cache/cache/atomic-write.js +25 -0
- package/.medusa/server/src/providers/s3-cache/cache/cache-manager.js +115 -0
- package/.medusa/server/src/providers/s3-cache/cache/keyed-lock.js +28 -0
- package/.medusa/server/src/providers/s3-cache/index.js +8 -0
- package/.medusa/server/src/providers/s3-cache/object-key.js +53 -0
- package/.medusa/server/src/providers/s3-cache/s3-cache-file.js +229 -0
- package/.medusa/server/src/providers/s3-cache/s3-object-store.js +86 -0
- package/.medusa/server/src/providers/smtp/index.js +8 -0
- package/.medusa/server/src/providers/smtp/service.js +236 -0
- package/.medusa/server/src/providers/smtp/types.js +11 -0
- package/.medusa/server/src/public/action-progress.js +67 -0
- package/.medusa/server/src/public/config.js +186 -0
- package/.medusa/server/src/public/descriptor.js +199 -2
- package/.medusa/server/src/public/effective-features.js +9 -5
- package/.medusa/server/src/public/enforcement.js +18 -8
- package/.medusa/server/src/public/gateway.js +19 -0
- package/.medusa/server/src/public/index.js +10 -2
- package/.medusa/server/src/public/instrumentation.js +56 -0
- package/.medusa/server/src/public/module-access.js +14 -0
- package/.medusa/server/src/public/settings.js +17 -0
- package/.medusa/server/src/public/shop-config.js +12 -0
- package/.medusa/server/src/public/shop-master-data.js +95 -0
- package/.medusa/server/src/public/shop-types.js +24 -0
- package/.medusa/server/src/shop-config/build-food-shop-config.js +248 -0
- package/.medusa/server/src/shop-config/options.js +71 -0
- package/.medusa/server/src/subscribers/affiliate-consignment-reminder-due.js +26 -0
- package/.medusa/server/src/subscribers/documents-order-canceled.js +24 -0
- package/.medusa/server/src/subscribers/documents-order-cancellation-ready.js +26 -0
- package/.medusa/server/src/subscribers/documents-refund-ready.js +24 -0
- package/.medusa/server/src/subscribers/documents-shipment-created.js +36 -0
- package/.medusa/server/src/subscribers/documents-shipment-invoice-assignment-decided.js +26 -0
- package/.medusa/server/src/subscribers/email-order-canceled.js +28 -0
- package/.medusa/server/src/subscribers/email-shipment-created.js +32 -0
- package/.medusa/server/src/subscribers/order-placed.js +27 -0
- package/.medusa/server/src/subscribers/packing-list-allocation-revised.js +32 -0
- package/.medusa/server/src/subscribers/packing-list-fulfillment-canceled.js +54 -0
- package/.medusa/server/src/subscribers/packing-list-fulfillment-created.js +31 -0
- package/.medusa/server/src/subscribers/password-reset.js +23 -0
- package/.medusa/server/src/subscribers/payment-refunded.js +38 -0
- package/.medusa/server/src/subscribers/return-received.js +27 -0
- package/.medusa/server/src/subscribers/return-requested.js +27 -0
- package/.medusa/server/src/subscribers/user-invite.js +23 -0
- package/.medusa/server/src/utils/cart-promotion-links.js +101 -0
- package/.medusa/server/src/utils/discover-complete-cart-participants.js +9 -2
- package/.medusa/server/src/utils/discover-plugin-features.js +47 -9
- package/.medusa/server/src/workflows/documents/issue-cancellation-after-refund.js +246 -0
- package/.medusa/server/src/workflows/documents/issue-document.js +163 -0
- package/.medusa/server/src/workflows/documents/issue-invoice-after-shipment.js +521 -0
- package/.medusa/server/src/workflows/documents/issue-packing-list.js +384 -0
- package/.medusa/server/src/workflows/documents/publish-document-facts.js +53 -0
- package/.medusa/server/src/workflows/documents/reconcile-document-resolutions.js +48 -0
- package/.medusa/server/src/workflows/documents/reconcile-order-cancellation.js +92 -0
- package/.medusa/server/src/workflows/documents/regenerate-issued-document.js +61 -0
- package/.medusa/server/src/workflows/email/dispatch-email-message.js +299 -0
- package/.medusa/server/src/workflows/email/documents-required-facts.js +30 -0
- package/.medusa/server/src/workflows/email/prepare-affiliate-reminder-email.js +58 -0
- package/.medusa/server/src/workflows/email/prepare-order-canceled-email.js +64 -0
- package/.medusa/server/src/workflows/email/prepare-order-received-email.js +56 -0
- package/.medusa/server/src/workflows/email/prepare-refund-email.js +47 -0
- package/.medusa/server/src/workflows/email/prepare-return-email.js +75 -0
- package/.medusa/server/src/workflows/email/prepare-shipment-email.js +82 -0
- package/.medusa/server/src/workflows/email/retry-email-messages.js +31 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-participants.js +28 -16
- package/.medusa/server/src/workflows/hooks/dismiss-deleted-promotion-cart-links.js +23 -0
- package/README.md +2004 -11
- package/dist/admin-components/features/plugin-features/components/PluginActionsSection.d.ts +6 -0
- package/dist/admin-components/features/plugin-features/components/PluginActionsSection.js +66 -0
- package/dist/admin-components/features/plugin-features/components/PluginDetailPage.d.ts +2 -0
- package/dist/admin-components/features/plugin-features/components/PluginDetailPage.js +9 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeatureGate.d.ts +22 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeatureGate.js +18 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeatureSections.d.ts +11 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeatureSections.js +19 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeaturesCard.d.ts +12 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeaturesCard.js +34 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeaturesSettingsPage.d.ts +5 -0
- package/dist/admin-components/features/plugin-features/components/PluginFeaturesSettingsPage.js +16 -0
- package/dist/admin-components/features/plugin-features/components/PluginHubCard.d.ts +7 -0
- package/dist/admin-components/features/plugin-features/components/PluginHubCard.js +21 -0
- package/dist/admin-components/features/plugin-features/components/PluginPageShell.d.ts +13 -0
- package/dist/admin-components/features/plugin-features/components/PluginPageShell.js +20 -0
- package/dist/admin-components/features/plugin-features/components/PluginSettingsForm.d.ts +7 -0
- package/dist/admin-components/features/plugin-features/components/PluginSettingsForm.js +39 -0
- package/dist/admin-components/features/plugin-features/components/PluginStatusChips.d.ts +5 -0
- package/dist/admin-components/features/plugin-features/components/PluginStatusChips.js +8 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginFeatureEnabled.d.ts +114 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginFeatureEnabled.js +40 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginFeatures.d.ts +392 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginFeatures.js +128 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginSettingsForm.d.ts +93 -0
- package/dist/admin-components/features/plugin-features/hooks/usePluginSettingsForm.js +44 -0
- package/dist/admin-components/features/plugin-features/lib/action-runs.d.ts +19 -0
- package/dist/admin-components/features/plugin-features/lib/action-runs.js +74 -0
- package/dist/admin-components/features/plugin-features/lib/plugin-features-admin-client.d.ts +363 -0
- package/dist/admin-components/features/plugin-features/lib/plugin-features-admin-client.js +9 -0
- package/dist/admin-components/features/plugin-features/lib/plugin-paths.d.ts +4 -0
- package/dist/admin-components/features/plugin-features/lib/plugin-paths.js +4 -0
- package/dist/admin-components/features/plugin-features/lib/settings-draft.d.ts +28 -0
- package/dist/admin-components/features/plugin-features/lib/settings-draft.js +86 -0
- package/dist/admin-components/features/plugin-features/queries/pluginFeatureKeys.d.ts +7 -0
- package/dist/admin-components/features/plugin-features/queries/pluginFeatureKeys.js +7 -0
- package/dist/admin-components/i18n/texts.d.ts +90 -0
- package/dist/admin-components/i18n/texts.js +90 -0
- package/dist/admin-components/index.d.ts +14 -0
- package/dist/admin-components/index.js +14 -0
- package/dist/admin-components/lib/errors.d.ts +6 -0
- package/dist/admin-components/lib/errors.js +27 -0
- package/dist/admin-components/lib/sdk.d.ts +2 -0
- package/dist/admin-components/lib/sdk.js +13 -0
- package/dist/documents/config/index.d.ts +11 -0
- package/dist/documents/config/index.js +17 -0
- package/dist/documents/templates/financial-document.d.ts +3 -0
- package/dist/documents/templates/financial-document.js +141 -0
- package/dist/documents/templates/format.d.ts +16 -0
- package/dist/documents/templates/format.js +30 -0
- package/dist/documents/templates/html-factory.d.ts +11 -0
- package/dist/documents/templates/html-factory.js +39 -0
- package/dist/documents/templates/html-utils.d.ts +2 -0
- package/dist/documents/templates/html-utils.js +12 -0
- package/dist/documents/templates/layout.d.ts +17 -0
- package/dist/documents/templates/layout.js +96 -0
- package/dist/documents/templates/packing-list.d.ts +3 -0
- package/dist/documents/templates/packing-list.js +49 -0
- package/dist/documents/types/admin-api.d.ts +1 -0
- package/dist/documents/types/admin-api.js +2 -0
- package/dist/documents/types/document-summary.d.ts +1 -0
- package/dist/documents/types/document-summary.js +2 -0
- package/dist/documents/types/documents.d.ts +174 -0
- package/dist/documents/types/documents.js +2 -0
- package/dist/documents/types/html-factory.d.ts +7 -0
- package/dist/documents/types/html-factory.js +5 -0
- package/dist/documents/types/index.d.ts +5 -0
- package/dist/documents/types/index.js +21 -0
- package/dist/documents/types/store-api.d.ts +1 -0
- package/dist/documents/types/store-api.js +2 -0
- package/dist/email/config/index.d.ts +17 -0
- package/dist/email/config/index.js +83 -0
- package/dist/email/config/notification-module.d.ts +22 -0
- package/dist/email/config/notification-module.js +19 -0
- package/dist/email/types/email-kinds.d.ts +15 -0
- package/dist/email/types/email-kinds.js +17 -0
- package/dist/email/types/index.d.ts +4 -0
- package/dist/email/types/index.js +20 -0
- package/dist/email/types/shop-configuration.d.ts +43 -0
- package/dist/email/types/shop-configuration.js +2 -0
- package/dist/email/types/smtp-configuration.d.ts +9 -0
- package/dist/email/types/smtp-configuration.js +2 -0
- package/dist/email/types/template-data.d.ts +100 -0
- package/dist/email/types/template-data.js +78 -0
- package/dist/files/config/index.d.ts +32 -0
- package/dist/files/config/index.js +255 -0
- package/dist/files/gateway/index.d.ts +30 -0
- package/dist/files/gateway/index.js +114 -0
- package/dist/files/types/index.d.ts +2 -0
- package/dist/files/types/index.js +5 -0
- package/dist/files/types/public.d.ts +90 -0
- package/dist/files/types/public.js +5 -0
- package/dist/modules/documents/domain/merchant.d.ts +22 -0
- package/dist/modules/documents/domain/merchant.js +85 -0
- package/dist/modules/documents/domain/options.d.ts +34 -0
- package/dist/modules/documents/domain/options.js +39 -0
- package/dist/public/action-progress.d.ts +25 -0
- package/dist/public/action-progress.js +66 -0
- package/dist/public/config.d.ts +59 -0
- package/dist/public/config.js +185 -0
- package/dist/public/descriptor.d.ts +3 -2
- package/dist/public/descriptor.js +198 -1
- package/dist/public/effective-features.d.ts +2 -1
- package/dist/public/effective-features.js +8 -4
- package/dist/public/enforcement.d.ts +7 -0
- package/dist/public/enforcement.js +17 -7
- package/dist/public/gateway.d.ts +2 -0
- package/dist/public/gateway.js +18 -0
- package/dist/public/index.d.ts +5 -2
- package/dist/public/index.js +9 -1
- package/dist/public/instrumentation.d.ts +12 -0
- package/dist/public/instrumentation.js +55 -0
- package/dist/public/module-access.d.ts +3 -0
- package/dist/public/module-access.js +13 -0
- package/dist/public/settings.d.ts +11 -0
- package/dist/public/settings.js +16 -0
- package/dist/public/shop-config.d.ts +8 -0
- package/dist/public/shop-config.js +11 -0
- package/dist/public/shop-master-data.d.ts +25 -0
- package/dist/public/shop-master-data.js +94 -0
- package/dist/public/shop-types.d.ts +7 -0
- package/dist/public/shop-types.js +23 -0
- package/dist/public/types.d.ts +113 -1
- package/dist/shop-config/build-food-shop-config.d.ts +44 -0
- package/dist/shop-config/build-food-shop-config.js +247 -0
- package/dist/shop-config/options.d.ts +41 -0
- package/dist/shop-config/options.js +70 -0
- package/dist/utils/discover-plugin-features.d.ts +28 -0
- package/dist/utils/discover-plugin-features.js +96 -0
- package/package.json +53 -6
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export type DocumentKind = "invoice" | "cancellation" | "credit_note";
|
|
2
|
+
export type DocumentStatus = "processing" | "issued" | "failed";
|
|
3
|
+
export type ShipmentInvoiceDecision = "pending" | "carrier" | "non_carrier";
|
|
4
|
+
export type RefundResolutionState = "pending_source" | "processing" | "ready" | "not_applicable" | "failed";
|
|
5
|
+
export type RefundCommunicationOwner = "standalone" | "cancellation";
|
|
6
|
+
export type OrderCancellationResolutionState = "pending" | "processing" | "ready" | "failed";
|
|
7
|
+
export type DocumentMoney = {
|
|
8
|
+
amount: string;
|
|
9
|
+
currency_code: string;
|
|
10
|
+
};
|
|
11
|
+
export type DocumentAddress = {
|
|
12
|
+
first_name: string | null;
|
|
13
|
+
last_name: string | null;
|
|
14
|
+
company: string | null;
|
|
15
|
+
address_1: string | null;
|
|
16
|
+
address_2: string | null;
|
|
17
|
+
postal_code: string | null;
|
|
18
|
+
city: string | null;
|
|
19
|
+
country_code: string | null;
|
|
20
|
+
};
|
|
21
|
+
export type DocumentBatchAllocationDTO = {
|
|
22
|
+
batch_id: string;
|
|
23
|
+
lot_number: string;
|
|
24
|
+
expiry_date: string;
|
|
25
|
+
quantity: number;
|
|
26
|
+
};
|
|
27
|
+
export type DocumentTaxComplianceDTO = {
|
|
28
|
+
customer_company_name: string;
|
|
29
|
+
customer_vat_number: string;
|
|
30
|
+
exemption_wording: "steuerfreie_innergemeinschaftliche_lieferung";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Tax amount of one configured tax rate (name and percentage as calculated on
|
|
34
|
+
* the order's tax lines). Amounts are rounded to the currency's minor unit and
|
|
35
|
+
* sum up exactly to the rounded document tax total.
|
|
36
|
+
*/
|
|
37
|
+
export type DocumentTaxBreakdownEntry = {
|
|
38
|
+
name: string;
|
|
39
|
+
code: string | null;
|
|
40
|
+
rate: number;
|
|
41
|
+
tax_total: DocumentMoney;
|
|
42
|
+
};
|
|
43
|
+
export type DocumentTemplateLine = {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
sku: string | null;
|
|
47
|
+
quantity: number;
|
|
48
|
+
unit_price: DocumentMoney;
|
|
49
|
+
subtotal: DocumentMoney;
|
|
50
|
+
tax_total: DocumentMoney;
|
|
51
|
+
total: DocumentMoney;
|
|
52
|
+
batch_allocations: DocumentBatchAllocationDTO[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Stable input contract for the project-owned HTML factory. It is a value
|
|
56
|
+
* snapshot, never a live Medusa order model, so rendering stays isolated from
|
|
57
|
+
* Medusa internals and the Storefront can import the types safely.
|
|
58
|
+
*/
|
|
59
|
+
export type DocumentTemplateInput = {
|
|
60
|
+
document: {
|
|
61
|
+
id: string;
|
|
62
|
+
kind: DocumentKind;
|
|
63
|
+
number: string;
|
|
64
|
+
issued_at: string;
|
|
65
|
+
source_document_number: string | null;
|
|
66
|
+
};
|
|
67
|
+
order: {
|
|
68
|
+
id: string;
|
|
69
|
+
display_id: number | null;
|
|
70
|
+
email: string;
|
|
71
|
+
currency_code: string;
|
|
72
|
+
billing_address: DocumentAddress | null;
|
|
73
|
+
tax_compliance: DocumentTaxComplianceDTO | null;
|
|
74
|
+
};
|
|
75
|
+
lines: DocumentTemplateLine[];
|
|
76
|
+
totals: {
|
|
77
|
+
subtotal: DocumentMoney;
|
|
78
|
+
tax_total: DocumentMoney;
|
|
79
|
+
/** Empty for documents without tax lines and for legacy snapshots. */
|
|
80
|
+
tax_breakdown: DocumentTaxBreakdownEntry[];
|
|
81
|
+
shipping_total: DocumentMoney;
|
|
82
|
+
discount_total: DocumentMoney;
|
|
83
|
+
total: DocumentMoney;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type DocumentSnapshot = DocumentTemplateInput;
|
|
87
|
+
export type PackingListLifecycleStatus = "active" | "canceled";
|
|
88
|
+
export type PackingListGenerationStatus = "processing" | "ready" | "failed";
|
|
89
|
+
export type PackingListBatchAllocation = {
|
|
90
|
+
batch_id: string;
|
|
91
|
+
lot_number: string;
|
|
92
|
+
expiry_date: string;
|
|
93
|
+
quantity: number;
|
|
94
|
+
};
|
|
95
|
+
export type PackingListTemplateLine = {
|
|
96
|
+
line_item_id: string;
|
|
97
|
+
inventory_item_id: string | null;
|
|
98
|
+
title: string;
|
|
99
|
+
sku: string | null;
|
|
100
|
+
quantity: number;
|
|
101
|
+
batch_allocations: PackingListBatchAllocation[];
|
|
102
|
+
};
|
|
103
|
+
export type PackingListTemplateInput = {
|
|
104
|
+
document: {
|
|
105
|
+
kind: "packing_list";
|
|
106
|
+
id: string;
|
|
107
|
+
number: string;
|
|
108
|
+
source_revision: number;
|
|
109
|
+
generated_at: string;
|
|
110
|
+
};
|
|
111
|
+
order: {
|
|
112
|
+
id: string;
|
|
113
|
+
display_id: number | null;
|
|
114
|
+
};
|
|
115
|
+
fulfillment: {
|
|
116
|
+
id: string;
|
|
117
|
+
created_at: string;
|
|
118
|
+
location_id: string;
|
|
119
|
+
location_name: string;
|
|
120
|
+
};
|
|
121
|
+
lines: PackingListTemplateLine[];
|
|
122
|
+
};
|
|
123
|
+
export type PackingListSnapshot = PackingListTemplateInput;
|
|
124
|
+
/**
|
|
125
|
+
* The shop's legal sender facts, read from the base plugin's shop master
|
|
126
|
+
* data ("Shop-Stammdaten") when a document is rendered. Not part of the
|
|
127
|
+
* stored snapshot. Optional fields are `null` when not set; the development
|
|
128
|
+
* UID placeholder `ATU00000000` arrives as `vat_number: null`.
|
|
129
|
+
*/
|
|
130
|
+
export type DocumentMerchant = {
|
|
131
|
+
legal_name: string;
|
|
132
|
+
address_line1: string;
|
|
133
|
+
address_line2: string | null;
|
|
134
|
+
postal_code: string;
|
|
135
|
+
city: string;
|
|
136
|
+
/** Lower-case ISO 3166-1 alpha-2 code. */
|
|
137
|
+
country_code: string;
|
|
138
|
+
vat_number: string | null;
|
|
139
|
+
email: string | null;
|
|
140
|
+
phone: string | null;
|
|
141
|
+
website: string | null;
|
|
142
|
+
iban: string | null;
|
|
143
|
+
bic: string | null;
|
|
144
|
+
company_register_number: string | null;
|
|
145
|
+
company_register_court: string | null;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Optional `merchant` plugin option: used per field only where the shop
|
|
149
|
+
* master data in the base plugin has no value (same shape as the demo shop's
|
|
150
|
+
* `merchant` constant in medusa-config).
|
|
151
|
+
*/
|
|
152
|
+
export type DocumentMerchantOption = {
|
|
153
|
+
countryCode: string;
|
|
154
|
+
legalName: string;
|
|
155
|
+
registeredAddress: {
|
|
156
|
+
address1: string;
|
|
157
|
+
address2?: string;
|
|
158
|
+
city: string;
|
|
159
|
+
countryCode: string;
|
|
160
|
+
postalCode: string;
|
|
161
|
+
};
|
|
162
|
+
vatNumber?: string;
|
|
163
|
+
};
|
|
164
|
+
export type FinancialDocumentRenderInput = DocumentTemplateInput & {
|
|
165
|
+
merchant: DocumentMerchant;
|
|
166
|
+
};
|
|
167
|
+
export type PackingListRenderInput = PackingListTemplateInput & {
|
|
168
|
+
merchant: DocumentMerchant;
|
|
169
|
+
};
|
|
170
|
+
export type DocumentRenderInput = FinancialDocumentRenderInput | PackingListRenderInput;
|
|
171
|
+
export type DocumentPdfOptions = {
|
|
172
|
+
/** Absolute executable path or command name for the bundled Chromium renderer. */
|
|
173
|
+
executablePath?: string;
|
|
174
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentRenderInput } from "./documents";
|
|
2
|
+
/**
|
|
3
|
+
* The only project-specific document extension point. PDF rendering and file
|
|
4
|
+
* storage stay inside the plugin; projects control semantic markup and CSS.
|
|
5
|
+
*/
|
|
6
|
+
export type DocumentHtmlFactory = (input: DocumentRenderInput) => string | Promise<string>;
|
|
7
|
+
export declare const defineDocumentHtmlFactory: (factory: DocumentHtmlFactory) => DocumentHtmlFactory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./admin-api"), exports);
|
|
18
|
+
__exportStar(require("./documents"), exports);
|
|
19
|
+
__exportStar(require("./document-summary"), exports);
|
|
20
|
+
__exportStar(require("./html-factory"), exports);
|
|
21
|
+
__exportStar(require("./store-api"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from "@hartl-services/medusa-food-supplements-contracts/types/documents-store";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ResolvedSmtpConfiguration, ShopEmailConfiguration } from "../types";
|
|
2
|
+
export { createSmtpNotificationModuleConfig } from "./notification-module";
|
|
3
|
+
export declare const defineShopEmailConfiguration: <Configuration extends ShopEmailConfiguration>(configuration: Configuration) => Configuration;
|
|
4
|
+
export type { ResolvedSmtpConfiguration, ShopEmailConfiguration, } from "../types";
|
|
5
|
+
export declare const SMTP_ENVIRONMENT_VARIABLES: readonly ["SMTP_HOST", "SMTP_PORT", "SMTP_SECURE", "SMTP_USER", "SMTP_PASSWORD", "SMTP_FROM", "SMTP_REQUIRE_TLS"];
|
|
6
|
+
/**
|
|
7
|
+
* `medusa build` loads the configuration without deployment secrets. These
|
|
8
|
+
* placeholders only satisfy the required-variable checks of a build; they
|
|
9
|
+
* never reach a running server.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SMTP_BUILD_PLACEHOLDERS: Readonly<Record<string, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Validates the SMTP environment values and returns the transport
|
|
14
|
+
* configuration. `allowInsecure` permits plain SMTP for development, tests
|
|
15
|
+
* and builds; otherwise `SMTP_SECURE` or `SMTP_REQUIRE_TLS` must be `true`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const resolveSmtp: (values: Readonly<Record<(typeof SMTP_ENVIRONMENT_VARIABLES)[number], string>>, allowInsecure: boolean) => ResolvedSmtpConfiguration;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSmtp = exports.SMTP_BUILD_PLACEHOLDERS = exports.SMTP_ENVIRONMENT_VARIABLES = exports.defineShopEmailConfiguration = exports.createSmtpNotificationModuleConfig = void 0;
|
|
4
|
+
var notification_module_1 = require("./notification-module");
|
|
5
|
+
Object.defineProperty(exports, "createSmtpNotificationModuleConfig", { enumerable: true, get: function () { return notification_module_1.createSmtpNotificationModuleConfig; } });
|
|
6
|
+
const defineShopEmailConfiguration = (configuration) => configuration;
|
|
7
|
+
exports.defineShopEmailConfiguration = defineShopEmailConfiguration;
|
|
8
|
+
exports.SMTP_ENVIRONMENT_VARIABLES = [
|
|
9
|
+
"SMTP_HOST",
|
|
10
|
+
"SMTP_PORT",
|
|
11
|
+
"SMTP_SECURE",
|
|
12
|
+
"SMTP_USER",
|
|
13
|
+
"SMTP_PASSWORD",
|
|
14
|
+
"SMTP_FROM",
|
|
15
|
+
"SMTP_REQUIRE_TLS",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* `medusa build` loads the configuration without deployment secrets. These
|
|
19
|
+
* placeholders only satisfy the required-variable checks of a build; they
|
|
20
|
+
* never reach a running server.
|
|
21
|
+
*/
|
|
22
|
+
exports.SMTP_BUILD_PLACEHOLDERS = {
|
|
23
|
+
SMTP_FROM: "no-reply@smtp.build.invalid",
|
|
24
|
+
SMTP_HOST: "smtp.build.invalid",
|
|
25
|
+
SMTP_PASSWORD: "build-password",
|
|
26
|
+
SMTP_PORT: "2525",
|
|
27
|
+
SMTP_REQUIRE_TLS: "false",
|
|
28
|
+
SMTP_SECURE: "false",
|
|
29
|
+
SMTP_USER: "build-user",
|
|
30
|
+
};
|
|
31
|
+
const optionalValue = (values, name) => {
|
|
32
|
+
const value = values[name]?.trim();
|
|
33
|
+
return value ? value : undefined;
|
|
34
|
+
};
|
|
35
|
+
const integerValue = (values, name, minimum, maximum) => {
|
|
36
|
+
const value = optionalValue(values, name);
|
|
37
|
+
if (value === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const parsed = Number(value);
|
|
41
|
+
if (!Number.isInteger(parsed) || parsed < minimum || parsed > maximum) {
|
|
42
|
+
throw new TypeError(`${name} must be an integer from ${minimum} through ${maximum}.`);
|
|
43
|
+
}
|
|
44
|
+
return parsed;
|
|
45
|
+
};
|
|
46
|
+
const booleanValue = (values, name, defaultValue) => {
|
|
47
|
+
const value = optionalValue(values, name);
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
return defaultValue;
|
|
50
|
+
}
|
|
51
|
+
if (value !== "true" && value !== "false") {
|
|
52
|
+
throw new TypeError(`${name} must be either "true" or "false".`);
|
|
53
|
+
}
|
|
54
|
+
return value === "true";
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Validates the SMTP environment values and returns the transport
|
|
58
|
+
* configuration. `allowInsecure` permits plain SMTP for development, tests
|
|
59
|
+
* and builds; otherwise `SMTP_SECURE` or `SMTP_REQUIRE_TLS` must be `true`.
|
|
60
|
+
*/
|
|
61
|
+
const resolveSmtp = (values, allowInsecure) => {
|
|
62
|
+
const port = integerValue(values, "SMTP_PORT", 1, 65535);
|
|
63
|
+
if (port === undefined) {
|
|
64
|
+
throw new TypeError("SMTP_PORT is required.");
|
|
65
|
+
}
|
|
66
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(values.SMTP_FROM)) {
|
|
67
|
+
throw new TypeError("SMTP_FROM must be a valid email address.");
|
|
68
|
+
}
|
|
69
|
+
const smtp = {
|
|
70
|
+
from: values.SMTP_FROM,
|
|
71
|
+
host: values.SMTP_HOST,
|
|
72
|
+
password: values.SMTP_PASSWORD,
|
|
73
|
+
port,
|
|
74
|
+
requireTls: booleanValue(values, "SMTP_REQUIRE_TLS", false),
|
|
75
|
+
secure: booleanValue(values, "SMTP_SECURE", false),
|
|
76
|
+
user: values.SMTP_USER,
|
|
77
|
+
};
|
|
78
|
+
if (!smtp.secure && !smtp.requireTls && !allowInsecure) {
|
|
79
|
+
throw new TypeError("SMTP must use SMTP_SECURE=true or SMTP_REQUIRE_TLS=true outside development and test.");
|
|
80
|
+
}
|
|
81
|
+
return smtp;
|
|
82
|
+
};
|
|
83
|
+
exports.resolveSmtp = resolveSmtp;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResolvedSmtpConfiguration } from "../types";
|
|
2
|
+
export declare const createSmtpNotificationModuleConfig: (smtp: ResolvedSmtpConfiguration) => {
|
|
3
|
+
resolve: string;
|
|
4
|
+
options: {
|
|
5
|
+
providers: {
|
|
6
|
+
id: string;
|
|
7
|
+
options: {
|
|
8
|
+
channels: string[];
|
|
9
|
+
smtp: Readonly<{
|
|
10
|
+
from: string;
|
|
11
|
+
host: string;
|
|
12
|
+
password: string;
|
|
13
|
+
port: number;
|
|
14
|
+
requireTls: boolean;
|
|
15
|
+
secure: boolean;
|
|
16
|
+
user: string;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
resolve: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSmtpNotificationModuleConfig = void 0;
|
|
4
|
+
const createSmtpNotificationModuleConfig = (smtp) => ({
|
|
5
|
+
resolve: "@medusajs/medusa/notification",
|
|
6
|
+
options: {
|
|
7
|
+
providers: [
|
|
8
|
+
{
|
|
9
|
+
id: "smtp",
|
|
10
|
+
options: {
|
|
11
|
+
channels: ["email"],
|
|
12
|
+
smtp,
|
|
13
|
+
},
|
|
14
|
+
resolve: "@hartl-services/medusa-base/providers/smtp",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
exports.createSmtpNotificationModuleConfig = createSmtpNotificationModuleConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "@medusajs/framework/zod";
|
|
2
|
+
export declare const EMAIL_KINDS: readonly ["order.received", "order.received.admin", "order.shipped", "order.canceled", "order.return_requested", "order.return_received", "order.refunded", "auth.password_reset", "affiliate.consignment_report_due", "user.invite"];
|
|
3
|
+
export declare const EmailKindSchema: z.ZodEnum<{
|
|
4
|
+
"order.received": "order.received";
|
|
5
|
+
"order.received.admin": "order.received.admin";
|
|
6
|
+
"order.shipped": "order.shipped";
|
|
7
|
+
"order.canceled": "order.canceled";
|
|
8
|
+
"order.return_requested": "order.return_requested";
|
|
9
|
+
"order.return_received": "order.return_received";
|
|
10
|
+
"order.refunded": "order.refunded";
|
|
11
|
+
"auth.password_reset": "auth.password_reset";
|
|
12
|
+
"affiliate.consignment_report_due": "affiliate.consignment_report_due";
|
|
13
|
+
"user.invite": "user.invite";
|
|
14
|
+
}>;
|
|
15
|
+
export type EmailKind = (typeof EMAIL_KINDS)[number];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailKindSchema = exports.EMAIL_KINDS = void 0;
|
|
4
|
+
const zod_1 = require("@medusajs/framework/zod");
|
|
5
|
+
exports.EMAIL_KINDS = [
|
|
6
|
+
"order.received",
|
|
7
|
+
"order.received.admin",
|
|
8
|
+
"order.shipped",
|
|
9
|
+
"order.canceled",
|
|
10
|
+
"order.return_requested",
|
|
11
|
+
"order.return_received",
|
|
12
|
+
"order.refunded",
|
|
13
|
+
"auth.password_reset",
|
|
14
|
+
"affiliate.consignment_report_due",
|
|
15
|
+
"user.invite",
|
|
16
|
+
];
|
|
17
|
+
exports.EmailKindSchema = zod_1.z.enum(exports.EMAIL_KINDS);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./email-kinds"), exports);
|
|
18
|
+
__exportStar(require("./shop-configuration"), exports);
|
|
19
|
+
__exportStar(require("./smtp-configuration"), exports);
|
|
20
|
+
__exportStar(require("./template-data"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { EmailKind } from "./email-kinds";
|
|
2
|
+
import type { EmailRenderDataMap } from "./template-data";
|
|
3
|
+
export type EmailTemplateContent = Readonly<{
|
|
4
|
+
bodyHtml: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
text: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type EmailLayout = (input: Readonly<{
|
|
9
|
+
bodyHtml: string;
|
|
10
|
+
preheader: string;
|
|
11
|
+
subject: string;
|
|
12
|
+
}>) => string;
|
|
13
|
+
export type EmailRendererMap = {
|
|
14
|
+
readonly [Kind in EmailKind]: (data: EmailRenderDataMap[Kind]) => EmailTemplateContent;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* What a shop configures. `layout` and `renderers` are optional overrides of
|
|
18
|
+
* the plugin's neutral German defaults (branded with `displayName`); a
|
|
19
|
+
* partial `renderers` map replaces only the listed kinds.
|
|
20
|
+
*/
|
|
21
|
+
export type ShopEmailConfiguration = Readonly<{
|
|
22
|
+
affiliatePortalUrl: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
inviteUrl: (input: Readonly<{
|
|
25
|
+
token: string;
|
|
26
|
+
}>) => string;
|
|
27
|
+
layout?: EmailLayout;
|
|
28
|
+
orderNotificationEmail: string;
|
|
29
|
+
passwordResetUrl: (input: Readonly<{
|
|
30
|
+
locale: string | null;
|
|
31
|
+
}>) => string;
|
|
32
|
+
renderers?: Partial<EmailRendererMap>;
|
|
33
|
+
}>;
|
|
34
|
+
/** A `ShopEmailConfiguration` with the defaults merged in; used internally. */
|
|
35
|
+
export type ResolvedShopEmailConfiguration = Readonly<Omit<ShopEmailConfiguration, "layout" | "renderers"> & {
|
|
36
|
+
layout: EmailLayout;
|
|
37
|
+
renderers: EmailRendererMap;
|
|
38
|
+
}>;
|
|
39
|
+
/** The `email` namespace of the base plugin options. */
|
|
40
|
+
export type EmailPluginOptions = Readonly<{
|
|
41
|
+
jwtSecret: string;
|
|
42
|
+
shop: ShopEmailConfiguration;
|
|
43
|
+
}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "@medusajs/framework/zod";
|
|
2
|
+
import type { EmailKind } from "./email-kinds";
|
|
3
|
+
export declare const EmailPersistedDataSchemas: {
|
|
4
|
+
readonly "order.received": z.ZodObject<{
|
|
5
|
+
order_id: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
readonly "order.received.admin": z.ZodObject<{
|
|
8
|
+
order_id: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
readonly "order.shipped": z.ZodObject<{
|
|
11
|
+
order_id: z.ZodString;
|
|
12
|
+
fulfillment_id: z.ZodString;
|
|
13
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
readonly "order.canceled": z.ZodObject<{
|
|
16
|
+
order_id: z.ZodString;
|
|
17
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
readonly "order.return_requested": z.ZodObject<{
|
|
20
|
+
order_id: z.ZodString;
|
|
21
|
+
return_id: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
readonly "order.return_received": z.ZodObject<{
|
|
24
|
+
order_id: z.ZodString;
|
|
25
|
+
return_id: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
readonly "order.refunded": z.ZodObject<{
|
|
28
|
+
order_id: z.ZodString;
|
|
29
|
+
refund_id: z.ZodString;
|
|
30
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
readonly "auth.password_reset": z.ZodObject<{
|
|
33
|
+
locale: z.ZodNullable<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
readonly "affiliate.consignment_report_due": z.ZodObject<{
|
|
36
|
+
affiliate_display_name: z.ZodString;
|
|
37
|
+
period_start: z.ZodString;
|
|
38
|
+
due_date: z.ZodString;
|
|
39
|
+
locale: z.ZodNullable<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
readonly "user.invite": z.ZodObject<{}, z.core.$strict>;
|
|
42
|
+
};
|
|
43
|
+
export declare const EmailRenderDataSchemas: {
|
|
44
|
+
readonly "auth.password_reset": z.ZodObject<{
|
|
45
|
+
locale: z.ZodNullable<z.ZodString>;
|
|
46
|
+
reset_url: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
readonly "user.invite": z.ZodObject<{
|
|
49
|
+
invite_url: z.ZodString;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
readonly "order.received": z.ZodObject<{
|
|
52
|
+
order_id: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
readonly "order.received.admin": z.ZodObject<{
|
|
55
|
+
order_id: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
readonly "order.shipped": z.ZodObject<{
|
|
58
|
+
order_id: z.ZodString;
|
|
59
|
+
fulfillment_id: z.ZodString;
|
|
60
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
readonly "order.canceled": z.ZodObject<{
|
|
63
|
+
order_id: z.ZodString;
|
|
64
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
readonly "order.return_requested": z.ZodObject<{
|
|
67
|
+
order_id: z.ZodString;
|
|
68
|
+
return_id: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
readonly "order.return_received": z.ZodObject<{
|
|
71
|
+
order_id: z.ZodString;
|
|
72
|
+
return_id: z.ZodString;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
readonly "order.refunded": z.ZodObject<{
|
|
75
|
+
order_id: z.ZodString;
|
|
76
|
+
refund_id: z.ZodString;
|
|
77
|
+
documents_fact_fingerprint: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
readonly "affiliate.consignment_report_due": z.ZodObject<{
|
|
80
|
+
affiliate_display_name: z.ZodString;
|
|
81
|
+
period_start: z.ZodString;
|
|
82
|
+
due_date: z.ZodString;
|
|
83
|
+
locale: z.ZodNullable<z.ZodString>;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
};
|
|
86
|
+
export type EmailPersistedDataMap = {
|
|
87
|
+
readonly [Kind in EmailKind]: Readonly<z.infer<(typeof EmailPersistedDataSchemas)[Kind]>>;
|
|
88
|
+
};
|
|
89
|
+
type EmptyRenderContext = Readonly<Record<never, never>>;
|
|
90
|
+
export type EmailEphemeralRenderContextMap = {
|
|
91
|
+
readonly [Kind in EmailKind]: Kind extends "auth.password_reset" ? Readonly<{
|
|
92
|
+
reset_url: string;
|
|
93
|
+
}> : Kind extends "user.invite" ? Readonly<{
|
|
94
|
+
invite_url: string;
|
|
95
|
+
}> : EmptyRenderContext;
|
|
96
|
+
};
|
|
97
|
+
export type EmailRenderDataMap = {
|
|
98
|
+
readonly [Kind in EmailKind]: Readonly<z.infer<(typeof EmailRenderDataSchemas)[Kind]> & EmailEphemeralRenderContextMap[Kind]>;
|
|
99
|
+
};
|
|
100
|
+
export {};
|