@hartl-services/medusa-base 2.11.0 → 4.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/admin-components/features/plugin-features/components/PluginActionsSection.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/components/PluginFeaturesCard.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/components/PluginHubCard.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/components/PluginSettingsForm.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/components/PluginStatusChips.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/components/ShopMasterDataBanner.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/hooks/usePluginFeatureEnabled.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/hooks/usePluginSettingsForm.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/hooks/usePluginSwitch.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/action-runs.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/plugin-features-admin-client.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/plugin-features-admin-client.js +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/plugin-view.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/settings-draft.d.ts +1 -1
- package/.medusa/server/src/admin/admin-components/features/plugin-features/lib/settings-layout.d.ts +1 -1
- package/.medusa/server/src/admin/index.js +4 -4
- package/.medusa/server/src/admin/index.mjs +4 -4
- package/.medusa/server/src/api/admin/draft-orders/[id]/order-confirmation/route.js +2 -2
- package/.medusa/server/src/api/admin/email/attachments/[id]/mail-kinds/route.js +2 -2
- package/.medusa/server/src/api/admin/email/attachments/[id]/route.js +2 -2
- package/.medusa/server/src/api/admin/email/attachments/[id]/versions/route.js +2 -2
- package/.medusa/server/src/api/admin/email/attachments/route.js +2 -2
- package/.medusa/server/src/api/admin/email/messages/[id]/resends/route.js +2 -2
- package/.medusa/server/src/api/admin/email/messages/[id]/route.js +2 -2
- package/.medusa/server/src/api/admin/email/messages/route.js +2 -2
- package/.medusa/server/src/api/admin/email/templates/[kind]/preview/route.js +2 -2
- package/.medusa/server/src/api/admin/email/templates/[kind]/route.js +2 -2
- package/.medusa/server/src/api/admin/email/templates/[kind]/send-test/route.js +2 -2
- package/.medusa/server/src/api/admin/email/templates/[kind]/test-sources/route.js +2 -2
- package/.medusa/server/src/api/admin/email/templates/route.js +2 -2
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/actions/[action_key]/route.js +2 -2
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/actions/[action_key]/runs/route.js +2 -2
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/route.js +2 -2
- package/.medusa/server/src/api/admin/plugin-features/[plugin_key]/settings/route.js +2 -2
- package/.medusa/server/src/api/admin/plugin-features/route.js +2 -2
- package/.medusa/server/src/api/admin/tax-compliance/customer-addresses/[address_id]/tax-identification/route.js +15 -0
- package/.medusa/server/src/api/admin-first-login-password-policy.js +2 -2
- package/.medusa/server/src/api/answer-code-provider-route-not-found.js +2 -2
- package/.medusa/server/src/api/check-customer-address-tax-identification.js +93 -0
- package/.medusa/server/src/api/code-account-password-routes.js +2 -2
- package/.medusa/server/src/api/customer-address-identification-response.js +14 -0
- package/.medusa/server/src/api/middlewares.js +61 -7
- package/.medusa/server/src/api/password-policy.js +2 -2
- package/.medusa/server/src/api/plugin-actions.js +2 -2
- package/.medusa/server/src/api/plugin-features-http.js +2 -2
- package/.medusa/server/src/api/require-login-code-customer-email.js +2 -2
- package/.medusa/server/src/api/store/carts/[id]/completion-check/route.js +2 -2
- package/.medusa/server/src/api/store/carts/[id]/tax-identification/route.js +179 -0
- package/.medusa/server/src/api/store/customer-auth/password-policy/route.js +2 -2
- package/.medusa/server/src/api/store/customers/me/addresses/[address_id]/tax-identification/route.js +12 -0
- package/.medusa/server/src/api/store/customers/me/tax-identifications/route.js +14 -0
- package/.medusa/server/src/api/store/plugin-features/[plugin_key]/route.js +2 -2
- package/.medusa/server/src/api/store/plugin-features/route.js +2 -2
- package/.medusa/server/src/api/store/tax-identification-policy/route.js +21 -0
- package/.medusa/server/src/api/tax-identification-message.js +9 -0
- package/.medusa/server/src/api/to-response-amount.js +19 -0
- package/.medusa/server/src/customer-auth/application/prepare-code-account-password-reset.js +2 -2
- package/.medusa/server/src/customer-auth/application/request-login-code.js +2 -2
- package/.medusa/server/src/customer-auth/customer-password-policy.js +2 -2
- package/.medusa/server/src/customer-auth/domain/auth-methods.js +2 -2
- package/.medusa/server/src/customer-auth/domain/login-code.js +2 -2
- package/.medusa/server/src/customer-auth/login-code-state.js +2 -2
- package/.medusa/server/src/customer-auth/plugin-features.js +2 -2
- package/.medusa/server/src/documents/paths/documents.js +2 -2
- package/.medusa/server/src/documents/schemas/documents.js +2 -2
- package/.medusa/server/src/email/application/deliver-login-code.js +2 -2
- package/.medusa/server/src/email/domain/business-keys.js +2 -2
- package/.medusa/server/src/email/templates/blocks/render-document.js +2 -2
- package/.medusa/server/src/email/templates/render.js +2 -2
- package/.medusa/server/src/email/templates/validate.js +2 -2
- package/.medusa/server/src/email/types/template-data.js +2 -2
- package/.medusa/server/src/jobs/tax-compliance-state-sync.js +26 -0
- package/.medusa/server/src/modules/documents/service.js +2 -2
- package/.medusa/server/src/modules/email/domain/attachment.js +2 -2
- package/.medusa/server/src/modules/email/service.js +3 -3
- package/.medusa/server/src/modules/tax-compliance/domain/validation-policy.js +48 -0
- package/.medusa/server/src/modules/tax-compliance/index.js +15 -0
- package/.medusa/server/src/modules/tax-compliance/migrations/Migration20260814120459.js +18 -0
- package/.medusa/server/src/modules/tax-compliance/migrations/Migration20260814121724.js +14 -0
- package/.medusa/server/src/modules/tax-compliance/migrations/Migration20260814153410.js +14 -0
- package/.medusa/server/src/modules/tax-compliance/migrations/Migration20260929091620.js +27 -0
- package/.medusa/server/src/modules/tax-compliance/migrations/Migration20261011090147.js +16 -0
- package/.medusa/server/src/modules/tax-compliance/models/tax-compliance-state.js +29 -0
- package/.medusa/server/src/modules/tax-compliance/models/tax-compliance-validation.js +74 -0
- package/.medusa/server/src/modules/tax-compliance/runtime-settings.js +43 -0
- package/.medusa/server/src/modules/tax-compliance/service.js +693 -0
- package/.medusa/server/src/providers/email-otp/service.js +2 -2
- package/.medusa/server/src/providers/tax-compliance/index.js +11 -0
- package/.medusa/server/src/providers/tax-compliance/service.js +179 -0
- package/.medusa/server/src/public/constants.js +4 -2
- package/.medusa/server/src/public/index.js +6 -2
- package/.medusa/server/src/public/shop-config.js +6 -6
- package/.medusa/server/src/public/tax-compliance.js +22 -0
- package/.medusa/server/src/shared/lib/index.js +2 -1
- package/.medusa/server/src/shared/lib/optional-registration.js +34 -0
- package/.medusa/server/src/shop-config/{build-food-shop-config.js → build-shop-config.js} +15 -18
- package/.medusa/server/src/shop-config/options.js +4 -4
- package/.medusa/server/src/subscribers/affiliate-application-submitted.js +2 -2
- package/.medusa/server/src/subscribers/affiliate-consignment-reminder-due.js +2 -2
- package/.medusa/server/src/subscribers/documents-order-cancellation-ready.js +2 -2
- package/.medusa/server/src/subscribers/documents-refund-ready.js +2 -2
- package/.medusa/server/src/subscribers/documents-shipment-invoice-assignment-decided.js +2 -2
- package/.medusa/server/src/subscribers/packing-list-allocation-revised.js +2 -2
- package/.medusa/server/src/subscribers/tax-compliance-plugin-features-updated.js +25 -0
- package/.medusa/server/src/tax-compliance/complete-cart-hooks.js +26 -0
- package/.medusa/server/src/tax-compliance/integrations/finanzonline/client.js +222 -0
- package/.medusa/server/src/tax-compliance/integrations/finanzonline/validator.js +50 -0
- package/.medusa/server/src/tax-compliance/integrations/registry.js +26 -0
- package/.medusa/server/src/tax-compliance/integrations/validator.js +19 -0
- package/.medusa/server/src/tax-compliance/lib/order-tax-context.js +100 -0
- package/.medusa/server/src/tax-compliance/lib/tax-compliance-state.js +59 -0
- package/.medusa/server/src/tax-compliance/lib/tax-runtime-settings.js +79 -0
- package/.medusa/server/src/tax-compliance/plugin-features.js +73 -0
- package/.medusa/server/src/tax-compliance/resolve-services.js +7 -0
- package/.medusa/server/src/tax-compliance/types/tax-compliance.js +6 -0
- package/.medusa/server/src/workflows/documents/issue-invoice-after-shipment.js +25 -30
- package/.medusa/server/src/workflows/documents/issue-packing-list.js +3 -14
- package/.medusa/server/src/workflows/hooks/cart-tax-context.js +78 -0
- package/.medusa/server/src/workflows/hooks/order-tax-context.js +7 -0
- package/.medusa/server/src/workflows/hooks/shipping-tax-apportionment.js +145 -0
- package/.medusa/server/src/workflows/tax-compliance/apportion-order-shipping-tax.js +72 -0
- package/.medusa/server/src/workflows/tax-compliance/domain/requires-frozen-tax-evidence.js +27 -0
- package/.medusa/server/src/workflows/tax-compliance/freeze-order-evidence.js +125 -0
- package/.medusa/server/src/workflows/tax-compliance/submit-customer-address-tax-identification.js +18 -0
- package/.medusa/server/src/workflows/tax-compliance/submit-tax-identification.js +18 -0
- package/README.md +393 -61
- package/dist/customer-auth/domain/auth-methods.js +1 -1
- package/dist/customer-auth/plugin-features.js +1 -1
- package/dist/documents/types/admin-api.d.ts +1 -1
- package/dist/documents/types/document-summary.d.ts +1 -1
- package/dist/documents/types/store-api.d.ts +1 -1
- package/dist/email/types/template-data.js +1 -1
- package/dist/public/constants.d.ts +2 -0
- package/dist/public/constants.js +3 -1
- package/dist/public/index.d.ts +2 -1
- package/dist/public/index.js +5 -1
- package/dist/public/shop-config.d.ts +4 -4
- package/dist/public/shop-config.js +5 -5
- package/dist/public/tax-compliance.d.ts +30 -0
- package/dist/public/tax-compliance.js +21 -0
- package/dist/shared/lib/index.d.ts +1 -0
- package/dist/shared/lib/index.js +1 -0
- package/dist/shared/lib/optional-registration.d.ts +18 -0
- package/dist/shared/lib/optional-registration.js +33 -0
- package/dist/shop-config/{build-food-shop-config.d.ts → build-shop-config.d.ts} +12 -12
- package/dist/shop-config/{build-food-shop-config.js → build-shop-config.js} +14 -17
- package/dist/shop-config/options.d.ts +3 -3
- package/dist/shop-config/options.js +3 -3
- package/package.json +7 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultCustomerAuthMethods = exports.deriveCustomerAuthMethods = exports.EMAIL_PASSWORD_AUTH_PROVIDER = void 0;
|
|
4
|
-
const customer_auth_1 = require("@hartl-services/medusa-
|
|
4
|
+
const customer_auth_1 = require("@hartl-services/medusa-contracts/schemas/customer-auth");
|
|
5
5
|
/** Medusa's built-in e-mail + password provider. */
|
|
6
6
|
exports.EMAIL_PASSWORD_AUTH_PROVIDER = "emailpass";
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customerAuthPluginFeatures = void 0;
|
|
4
|
-
const customer_auth_1 = require("@hartl-services/medusa-
|
|
4
|
+
const customer_auth_1 = require("@hartl-services/medusa-contracts/schemas/customer-auth");
|
|
5
5
|
const descriptor_1 = require("../public/descriptor");
|
|
6
6
|
const PASSWORD_RULES = "Passwort-Regeln";
|
|
7
7
|
exports.customerAuthPluginFeatures = (0, descriptor_1.definePluginFeatures)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type * from "@hartl-services/medusa-
|
|
1
|
+
export type * from "@hartl-services/medusa-contracts/types/documents-admin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { StoreDocument as DocumentSummary } from "@hartl-services/medusa-
|
|
1
|
+
export type { StoreDocument as DocumentSummary } from "@hartl-services/medusa-contracts/types/documents-store";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type * from "@hartl-services/medusa-
|
|
1
|
+
export type * from "@hartl-services/medusa-contracts/types/documents-store";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailRenderDataSchemas = exports.EmailPersistedDataSchemas = exports.RefundSummarySchema = exports.ReturnReceivedSummarySchema = exports.ReturnSummarySchema = exports.ShipmentSummarySchema = exports.OrderSummarySchema = void 0;
|
|
4
4
|
const zod_1 = require("@medusajs/framework/zod");
|
|
5
|
-
const affiliate_1 = require("@hartl-services/medusa-
|
|
5
|
+
const affiliate_1 = require("@hartl-services/medusa-contracts/schemas/affiliate");
|
|
6
6
|
const NonEmptyStringSchema = zod_1.z.string().trim().min(1);
|
|
7
7
|
const NullableLocaleSchema = NonEmptyStringSchema.max(35).nullable();
|
|
8
8
|
const DocumentsFactFingerprintSchema = zod_1.z
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/** Container key of the base plugin's module (`Module("plugin_features", …)`). */
|
|
2
2
|
export declare const PLUGIN_FEATURES_MODULE: "plugin_features";
|
|
3
|
+
/** Container key of the base plugin's Steuer-Compliance module (`Module("tax_compliance", …)`). */
|
|
4
|
+
export declare const TAX_COMPLIANCE_MODULE: "tax_compliance";
|
package/dist/public/constants.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PLUGIN_FEATURES_MODULE = void 0;
|
|
3
|
+
exports.TAX_COMPLIANCE_MODULE = exports.PLUGIN_FEATURES_MODULE = void 0;
|
|
4
4
|
/** Container key of the base plugin's module (`Module("plugin_features", …)`). */
|
|
5
5
|
exports.PLUGIN_FEATURES_MODULE = "plugin_features";
|
|
6
|
+
/** Container key of the base plugin's Steuer-Compliance module (`Module("tax_compliance", …)`). */
|
|
7
|
+
exports.TAX_COMPLIANCE_MODULE = "tax_compliance";
|
package/dist/public/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { PLUGIN_FEATURES_MODULE } from "./constants";
|
|
1
|
+
export { PLUGIN_FEATURES_MODULE, TAX_COMPLIANCE_MODULE } from "./constants";
|
|
2
|
+
export { listCustomerAddressTaxIdentifications, TAX_COMPLIANCE_STATUSES, type AddressSnapshot, type CustomerAddressTaxIdentification, type TaxComplianceStatus, } from "./tax-compliance";
|
|
2
3
|
export { definePluginFeatures } from "./descriptor";
|
|
3
4
|
export { resolveEffectivePluginFeatures } from "./effective-features";
|
|
4
5
|
export { isOwnPluginEvent, isPluginFeatureEnabled, isPluginFeatureEnabledByKey, pluginFeatureGate, requirePluginFeature, } from "./enforcement";
|
package/dist/public/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reportPluginActionProgress = exports.shopMasterDataDescriptor = exports.getShopMasterData = exports.getShopAppearance = exports.getPluginSettings = exports.PLUGIN_ICON_NAMES = exports.resolveBaseModule = exports.isBasePluginRegistered = exports.requirePluginFeature = exports.pluginFeatureGate = exports.isPluginFeatureEnabledByKey = exports.isPluginFeatureEnabled = exports.isOwnPluginEvent = exports.resolveEffectivePluginFeatures = exports.definePluginFeatures = exports.PLUGIN_FEATURES_MODULE = void 0;
|
|
3
|
+
exports.reportPluginActionProgress = exports.shopMasterDataDescriptor = exports.getShopMasterData = exports.getShopAppearance = exports.getPluginSettings = exports.PLUGIN_ICON_NAMES = exports.resolveBaseModule = exports.isBasePluginRegistered = exports.requirePluginFeature = exports.pluginFeatureGate = exports.isPluginFeatureEnabledByKey = exports.isPluginFeatureEnabled = exports.isOwnPluginEvent = exports.resolveEffectivePluginFeatures = exports.definePluginFeatures = exports.TAX_COMPLIANCE_STATUSES = exports.listCustomerAddressTaxIdentifications = exports.TAX_COMPLIANCE_MODULE = exports.PLUGIN_FEATURES_MODULE = void 0;
|
|
4
4
|
var constants_1 = require("./constants");
|
|
5
5
|
Object.defineProperty(exports, "PLUGIN_FEATURES_MODULE", { enumerable: true, get: function () { return constants_1.PLUGIN_FEATURES_MODULE; } });
|
|
6
|
+
Object.defineProperty(exports, "TAX_COMPLIANCE_MODULE", { enumerable: true, get: function () { return constants_1.TAX_COMPLIANCE_MODULE; } });
|
|
7
|
+
var tax_compliance_1 = require("./tax-compliance");
|
|
8
|
+
Object.defineProperty(exports, "listCustomerAddressTaxIdentifications", { enumerable: true, get: function () { return tax_compliance_1.listCustomerAddressTaxIdentifications; } });
|
|
9
|
+
Object.defineProperty(exports, "TAX_COMPLIANCE_STATUSES", { enumerable: true, get: function () { return tax_compliance_1.TAX_COMPLIANCE_STATUSES; } });
|
|
6
10
|
var descriptor_1 = require("./descriptor");
|
|
7
11
|
Object.defineProperty(exports, "definePluginFeatures", { enumerable: true, get: function () { return descriptor_1.definePluginFeatures; } });
|
|
8
12
|
var effective_features_1 = require("./effective-features");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Entry of `@hartl-services/medusa-base/shop-config`: the turnkey
|
|
3
|
-
* `medusa-config.ts` of a
|
|
3
|
+
* `medusa-config.ts` of a shop. Separate from `./config` because it loads
|
|
4
4
|
* the Sentry logger wrapper and with it `@sentry/node`.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
6
|
+
export { buildShopConfig, defineShopConfig, } from "../shop-config/build-shop-config";
|
|
7
|
+
export type { ShopConfigInput, ShopModule, ShopPlugin, } from "../shop-config/build-shop-config";
|
|
8
|
+
export type { ShopConfigOptions } from "../shop-config/options";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.defineShopConfig = exports.buildShopConfig = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Entry of `@hartl-services/medusa-base/shop-config`: the turnkey
|
|
6
|
-
* `medusa-config.ts` of a
|
|
6
|
+
* `medusa-config.ts` of a shop. Separate from `./config` because it loads
|
|
7
7
|
* the Sentry logger wrapper and with it `@sentry/node`.
|
|
8
8
|
*/
|
|
9
|
-
var
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "
|
|
9
|
+
var build_shop_config_1 = require("../shop-config/build-shop-config");
|
|
10
|
+
Object.defineProperty(exports, "buildShopConfig", { enumerable: true, get: function () { return build_shop_config_1.buildShopConfig; } });
|
|
11
|
+
Object.defineProperty(exports, "defineShopConfig", { enumerable: true, get: function () { return build_shop_config_1.defineShopConfig; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MedusaContainer } from "@medusajs/framework/types";
|
|
2
|
+
export declare const TAX_COMPLIANCE_STATUSES: readonly ["eligible", "ineligible", "invalid", "unavailable"];
|
|
3
|
+
export type TaxComplianceStatus = (typeof TAX_COMPLIANCE_STATUSES)[number];
|
|
4
|
+
export type AddressSnapshot = {
|
|
5
|
+
address1: string;
|
|
6
|
+
address2?: string | null;
|
|
7
|
+
city: string;
|
|
8
|
+
countryCode: string;
|
|
9
|
+
postalCode: string;
|
|
10
|
+
};
|
|
11
|
+
/** Status of the current UID check of a saved customer address whose facts still match it. */
|
|
12
|
+
export type CustomerAddressTaxIdentification = {
|
|
13
|
+
customer_address_id: string;
|
|
14
|
+
status: TaxComplianceStatus;
|
|
15
|
+
customer_vat_number: string;
|
|
16
|
+
company_name: string;
|
|
17
|
+
validated_at: Date;
|
|
18
|
+
/** `eligible` or `ineligible`: the UID is real and matches company and address. */
|
|
19
|
+
verified: boolean;
|
|
20
|
+
/** The billing address the UID was checked against (`countryCode` lowercase, `address2` only when set). */
|
|
21
|
+
billing_address: AddressSnapshot;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The current UID check of each saved address of the customer that still
|
|
25
|
+
* matches the address as it is now, whatever its status (also `unavailable`
|
|
26
|
+
* and `invalid`). For other plugins, e.g. the Affiliate partner registration;
|
|
27
|
+
* the caller decides whether the `vat_validation` feature of `tax_compliance`
|
|
28
|
+
* is on (`isPluginFeatureEnabledByKey`).
|
|
29
|
+
*/
|
|
30
|
+
export declare const listCustomerAddressTaxIdentifications: (container: MedusaContainer, customerId: string) => Promise<CustomerAddressTaxIdentification[]>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listCustomerAddressTaxIdentifications = exports.TAX_COMPLIANCE_STATUSES = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
exports.TAX_COMPLIANCE_STATUSES = [
|
|
6
|
+
"eligible",
|
|
7
|
+
"ineligible",
|
|
8
|
+
"invalid",
|
|
9
|
+
"unavailable",
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* The current UID check of each saved address of the customer that still
|
|
13
|
+
* matches the address as it is now, whatever its status (also `unavailable`
|
|
14
|
+
* and `invalid`). For other plugins, e.g. the Affiliate partner registration;
|
|
15
|
+
* the caller decides whether the `vat_validation` feature of `tax_compliance`
|
|
16
|
+
* is on (`isPluginFeatureEnabledByKey`).
|
|
17
|
+
*/
|
|
18
|
+
const listCustomerAddressTaxIdentifications = (container, customerId) => container
|
|
19
|
+
.resolve(constants_1.TAX_COMPLIANCE_MODULE)
|
|
20
|
+
.listCustomerAddressIdentifications(customerId);
|
|
21
|
+
exports.listCustomerAddressTaxIdentifications = listCustomerAddressTaxIdentifications;
|
package/dist/shared/lib/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./errors"), exports);
|
|
|
23
23
|
__exportStar(require("./hash"), exports);
|
|
24
24
|
__exportStar(require("./logging"), exports);
|
|
25
25
|
__exportStar(require("./money"), exports);
|
|
26
|
+
__exportStar(require("./optional-registration"), exports);
|
|
26
27
|
__exportStar(require("./refreshing-snapshot"), exports);
|
|
27
28
|
__exportStar(require("./shipping-tax"), exports);
|
|
28
29
|
__exportStar(require("./text"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ResolvingContainer = {
|
|
2
|
+
resolve<TValue = unknown>(name: string): TValue;
|
|
3
|
+
hasRegistration?: (name: string) => boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Whether `error` is the container saying `name` is not registered: the
|
|
7
|
+
* awilix message Medusa throws ("Could not resolve 'name'. ...", only for the
|
|
8
|
+
* requested name itself, never a failing dependency further down the chain)
|
|
9
|
+
* or the older "Missing registration" wording.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isMissingRegistrationError: (error: unknown, name: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves an optional plugin's module service by its container key, or null
|
|
14
|
+
* while that plugin is not installed. A known-absent registration returns
|
|
15
|
+
* null without resolving; any other resolution failure is rethrown.
|
|
16
|
+
*/
|
|
17
|
+
export declare const tryResolveOptional: <T>(container: ResolvingContainer, name: string) => T | null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryResolveOptional = exports.isMissingRegistrationError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Whether `error` is the container saying `name` is not registered: the
|
|
6
|
+
* awilix message Medusa throws ("Could not resolve 'name'. ...", only for the
|
|
7
|
+
* requested name itself, never a failing dependency further down the chain)
|
|
8
|
+
* or the older "Missing registration" wording.
|
|
9
|
+
*/
|
|
10
|
+
const isMissingRegistrationError = (error, name) => error instanceof Error &&
|
|
11
|
+
(error.message.includes("Missing registration") ||
|
|
12
|
+
error.message.startsWith(`Could not resolve '${name}'`));
|
|
13
|
+
exports.isMissingRegistrationError = isMissingRegistrationError;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves an optional plugin's module service by its container key, or null
|
|
16
|
+
* while that plugin is not installed. A known-absent registration returns
|
|
17
|
+
* null without resolving; any other resolution failure is rethrown.
|
|
18
|
+
*/
|
|
19
|
+
const tryResolveOptional = (container, name) => {
|
|
20
|
+
if (container.hasRegistration?.(name) === false) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return container.resolve(name);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if ((0, exports.isMissingRegistrationError)(error, name)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.tryResolveOptional = tryResolveOptional;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { defineConfig } from "@medusajs/framework/utils";
|
|
2
2
|
import { withSentryErrorReporting } from "../public/sentry-logger";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ShopConfigOptions } from "./options";
|
|
4
4
|
type ConfigInput = Parameters<typeof defineConfig>[0];
|
|
5
5
|
type ProjectConfigInput = NonNullable<Extract<NonNullable<ConfigInput>, {
|
|
6
6
|
projectConfig?: unknown;
|
|
7
7
|
}>["projectConfig"]>;
|
|
8
8
|
/** A plugin registration of the returned configuration. */
|
|
9
|
-
export type
|
|
9
|
+
export type ShopPlugin = {
|
|
10
10
|
resolve: string;
|
|
11
11
|
options: Record<string, unknown>;
|
|
12
12
|
};
|
|
13
13
|
/** A module registration of the returned configuration. */
|
|
14
|
-
export type
|
|
14
|
+
export type ShopModule = {
|
|
15
15
|
key?: string;
|
|
16
16
|
resolve: string;
|
|
17
17
|
options?: Record<string, unknown>;
|
|
@@ -20,25 +20,25 @@ export type FoodShopModule = {
|
|
|
20
20
|
* The configuration input before `defineConfig`. `modules` and `plugins` are
|
|
21
21
|
* plain arrays so a caller (for example a test harness) can adjust them.
|
|
22
22
|
*/
|
|
23
|
-
export type
|
|
23
|
+
export type ShopConfigInput = {
|
|
24
24
|
admin: {
|
|
25
25
|
path: `/${string}`;
|
|
26
26
|
};
|
|
27
27
|
logger: ReturnType<typeof withSentryErrorReporting>;
|
|
28
28
|
projectConfig: ProjectConfigInput;
|
|
29
|
-
modules:
|
|
30
|
-
plugins:
|
|
29
|
+
modules: ShopModule[];
|
|
30
|
+
plugins: ShopPlugin[];
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* Builds the plain `medusa-config.ts` input of a
|
|
33
|
+
* Builds the plain `medusa-config.ts` input of a shop: Medusa core
|
|
34
34
|
* settings, the Redis event bus, the mail provider (set up in the Admin), S3 file storage, tax and
|
|
35
35
|
* Stripe payment providers, and the Hartl Services plugins (the base plugin
|
|
36
|
-
* with its E-Mail, Documents and file storage modules plus
|
|
37
|
-
* plugins). Deployment
|
|
36
|
+
* with its E-Mail, Documents, Steuer-Compliance and file storage modules plus
|
|
37
|
+
* four feature plugins). Deployment
|
|
38
38
|
* values are read and validated from `environment`; a missing or invalid one
|
|
39
39
|
* fails with its name.
|
|
40
40
|
*/
|
|
41
|
-
export declare function
|
|
42
|
-
/** `defineConfig(
|
|
43
|
-
export declare function
|
|
41
|
+
export declare function buildShopConfig(options: ShopConfigOptions, environment?: NodeJS.ProcessEnv): ShopConfigInput;
|
|
42
|
+
/** `defineConfig(buildShopConfig(options))` for `module.exports`. */
|
|
43
|
+
export declare function defineShopConfig(options: ShopConfigOptions, environment?: NodeJS.ProcessEnv): ReturnType<typeof defineConfig>;
|
|
44
44
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.buildShopConfig = buildShopConfig;
|
|
4
|
+
exports.defineShopConfig = defineShopConfig;
|
|
5
5
|
const logger_1 = require("@medusajs/framework/logger");
|
|
6
|
-
const customer_auth_1 = require("@hartl-services/medusa-
|
|
6
|
+
const customer_auth_1 = require("@hartl-services/medusa-contracts/schemas/customer-auth");
|
|
7
7
|
const utils_1 = require("@medusajs/framework/utils");
|
|
8
8
|
const config_1 = require("../public/config");
|
|
9
9
|
const customer_auth_methods_snapshot_1 = require("../customer-auth/customer-auth-methods-snapshot");
|
|
@@ -11,16 +11,16 @@ const customer_verification_snapshot_1 = require("../email/customer-verification
|
|
|
11
11
|
const sentry_logger_1 = require("../public/sentry-logger");
|
|
12
12
|
const options_1 = require("./options");
|
|
13
13
|
/**
|
|
14
|
-
* Builds the plain `medusa-config.ts` input of a
|
|
14
|
+
* Builds the plain `medusa-config.ts` input of a shop: Medusa core
|
|
15
15
|
* settings, the Redis event bus, the mail provider (set up in the Admin), S3 file storage, tax and
|
|
16
16
|
* Stripe payment providers, and the Hartl Services plugins (the base plugin
|
|
17
|
-
* with its E-Mail, Documents and file storage modules plus
|
|
18
|
-
* plugins). Deployment
|
|
17
|
+
* with its E-Mail, Documents, Steuer-Compliance and file storage modules plus
|
|
18
|
+
* four feature plugins). Deployment
|
|
19
19
|
* values are read and validated from `environment`; a missing or invalid one
|
|
20
20
|
* fails with its name.
|
|
21
21
|
*/
|
|
22
|
-
function
|
|
23
|
-
(0, options_1.
|
|
22
|
+
function buildShopConfig(options, environment = process.env) {
|
|
23
|
+
(0, options_1.assertShopConfigOptions)(options);
|
|
24
24
|
if (options.loadEnvFile !== false) {
|
|
25
25
|
(0, utils_1.loadEnv)(process.env.NODE_ENV || "development", process.cwd());
|
|
26
26
|
}
|
|
@@ -130,7 +130,7 @@ function buildFoodShopConfig(options, environment = process.env) {
|
|
|
130
130
|
options: {
|
|
131
131
|
providers: [
|
|
132
132
|
{
|
|
133
|
-
resolve: "@hartl-services/medusa-
|
|
133
|
+
resolve: "@hartl-services/medusa-base/providers/tax-compliance",
|
|
134
134
|
},
|
|
135
135
|
],
|
|
136
136
|
},
|
|
@@ -162,7 +162,8 @@ function buildFoodShopConfig(options, environment = process.env) {
|
|
|
162
162
|
const plugins = [
|
|
163
163
|
{
|
|
164
164
|
// Always first: owns the plugin feature toggles the other plugins gate
|
|
165
|
-
// on, and carries E-Mail, Documents and the /files
|
|
165
|
+
// on, and carries E-Mail, Documents, Steuer-Compliance and the /files
|
|
166
|
+
// gateway.
|
|
166
167
|
resolve: "@hartl-services/medusa-base",
|
|
167
168
|
options: {
|
|
168
169
|
email: {
|
|
@@ -209,10 +210,6 @@ function buildFoodShopConfig(options, environment = process.env) {
|
|
|
209
210
|
files: { gateway: s3CacheStorage.gateway },
|
|
210
211
|
},
|
|
211
212
|
},
|
|
212
|
-
{
|
|
213
|
-
resolve: "@hartl-services/medusa-tax-compliance",
|
|
214
|
-
options: {},
|
|
215
|
-
},
|
|
216
213
|
{
|
|
217
214
|
resolve: "@hartl-services/medusa-free-shipping",
|
|
218
215
|
options: {},
|
|
@@ -299,7 +296,7 @@ function buildFoodShopConfig(options, environment = process.env) {
|
|
|
299
296
|
plugins,
|
|
300
297
|
};
|
|
301
298
|
}
|
|
302
|
-
/** `defineConfig(
|
|
303
|
-
function
|
|
304
|
-
return (0, utils_1.defineConfig)(
|
|
299
|
+
/** `defineConfig(buildShopConfig(options))` for `module.exports`. */
|
|
300
|
+
function defineShopConfig(options, environment = process.env) {
|
|
301
|
+
return (0, utils_1.defineConfig)(buildShopConfig(options, environment));
|
|
305
302
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DocumentHtmlFactory } from "../documents/types";
|
|
2
2
|
/**
|
|
3
|
-
* The shop-specific facts of a
|
|
3
|
+
* The shop-specific facts of a shop. Deployment values and secrets are
|
|
4
4
|
* not options: they come from the environment (see the README).
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type ShopConfigOptions = Readonly<{
|
|
7
7
|
/**
|
|
8
8
|
* Shop name in the branding of the default e-mail templates (and the store
|
|
9
9
|
* name of a shop's initial seed). Company name, address and UID are not
|
|
@@ -43,4 +43,4 @@ export type FoodShopConfigOptions = Readonly<{
|
|
|
43
43
|
* Throws a `TypeError` naming the first invalid option, so a misconfigured
|
|
44
44
|
* shop fails at boot.
|
|
45
45
|
*/
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function assertShopConfigOptions(options: unknown): asserts options is ShopConfigOptions;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.assertShopConfigOptions = assertShopConfigOptions;
|
|
4
4
|
const lib_1 = require("../shared/lib");
|
|
5
5
|
const fail = (name, expectation) => {
|
|
6
|
-
throw new TypeError(`
|
|
6
|
+
throw new TypeError(`Shop option "${name}" must be ${expectation}.`);
|
|
7
7
|
};
|
|
8
8
|
const requireText = (value, name) => {
|
|
9
9
|
if (typeof value !== "string" || value.trim() === "") {
|
|
@@ -41,7 +41,7 @@ const requireObject = (value, name) => {
|
|
|
41
41
|
* Throws a `TypeError` naming the first invalid option, so a misconfigured
|
|
42
42
|
* shop fails at boot.
|
|
43
43
|
*/
|
|
44
|
-
function
|
|
44
|
+
function assertShopConfigOptions(options) {
|
|
45
45
|
const candidate = requireObject(options, "options");
|
|
46
46
|
requireText(candidate.displayName, "displayName");
|
|
47
47
|
requireEmail(candidate.orderNotificationEmail, "orderNotificationEmail");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hartl-services/medusa-base",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Base plugin for Hartl Services Medusa shops: per-plugin feature toggles with a generic Admin settings page, a Store endpoint for storefronts, enforcement helpers, the complete-cart hook composition, the root redirect, cart-promotion link repair, the built-in E-Mail, Documents and S3 file storage modules, config helpers with the turnkey
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Base plugin for Hartl Services Medusa shops: per-plugin feature toggles with a generic Admin settings page, a Store endpoint for storefronts, enforcement helpers, the complete-cart hook composition, the root redirect, cart-promotion link repair, the built-in E-Mail, Documents, Steuer-Compliance (UID check, Tax provider) and S3 file storage modules, config helpers with the turnkey shop-config preset, and the Sentry logger wrapper and instrumentation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
".medusa/server",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://gitlab.com/hartl-services-gmbh/services/
|
|
14
|
+
"url": "git+https://gitlab.com/hartl-services-gmbh/services/medusa-plugins.git",
|
|
15
15
|
"directory": "plugins/base"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"@aws-sdk/client-s3": "^3.948.0",
|
|
93
93
|
"@aws-sdk/lib-storage": "^3.954.0",
|
|
94
94
|
"@floating-ui/dom": "1.7.4",
|
|
95
|
+
"soap": "1.10.0",
|
|
95
96
|
"@tiptap/extension-link": "3.31.4",
|
|
96
97
|
"@tiptap/pm": "3.31.4",
|
|
97
98
|
"@tiptap/react": "3.31.4",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"mime-types": "3.0.1",
|
|
102
103
|
"nodemailer": "6.10.1",
|
|
103
104
|
"ulid": "^2.4.0",
|
|
104
|
-
"@hartl-services/medusa-
|
|
105
|
+
"@hartl-services/medusa-contracts": "^1.0.0"
|
|
105
106
|
},
|
|
106
107
|
"devDependencies": {
|
|
107
108
|
"@medusajs/admin-sdk": "2.19.0",
|
|
@@ -152,9 +153,9 @@
|
|
|
152
153
|
"build": "medusa plugin:build && tsc -p tsconfig.public.json && tsc -p tsconfig.admin-components.json",
|
|
153
154
|
"dev": "medusa plugin:develop",
|
|
154
155
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.type-tests.json --noEmit && tsc -p tsconfig.component-tests.json",
|
|
155
|
-
"pretest:unit": "pnpm --filter @hartl-services/medusa-
|
|
156
|
+
"pretest:unit": "pnpm --filter @hartl-services/medusa-contracts build",
|
|
156
157
|
"test:unit": "sh ../../scripts/dev-capped.sh jest",
|
|
157
|
-
"pretest:contract": "pnpm --filter @hartl-services/medusa-
|
|
158
|
+
"pretest:contract": "pnpm --filter @hartl-services/medusa-contracts build",
|
|
158
159
|
"test:contract": "jest --config jest.contract.config.js --runInBand",
|
|
159
160
|
"test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --config jest.integration.config.js --silent=false --runInBand --forceExit"
|
|
160
161
|
}
|