@revenexx/cover 0.5.0 → 0.7.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/app/app.config.ts +12 -0
- package/app/components/account/address/AccountAddressView.vue +12 -1
- package/app/components/account/orderlists/AccountOrderListDetail.vue +16 -2
- package/app/components/account/orderlists/AccountOrderListsTable.vue +9 -1
- package/app/components/account/quotes/AccountQuoteDetail.vue +77 -3
- package/app/components/auth/AuthLoginPanel.vue +31 -0
- package/app/components/auth/AuthRegisterPanel.vue +71 -3
- package/app/components/cart/drawer/CartDrawer.vue +2 -1
- package/app/components/cart/item/CartItem.vue +4 -1
- package/app/components/cart/position/CartPosition.vue +7 -2
- package/app/components/cart/quote/CartQuoteRequestModal.vue +9 -0
- package/app/components/cart/view/CartSummaryPanel.vue +42 -5
- package/app/components/category/info/CategoryPrice.vue +4 -2
- package/app/components/layout/header/TopBar.vue +13 -4
- package/app/components/product/card/Compact.vue +4 -2
- package/app/components/product/detail/ProductDetailAddToCart.vue +8 -3
- package/app/composables/useCartLimits.ts +54 -0
- package/app/composables/useCartStore.ts +39 -6
- package/app/composables/useCartSummaryFormatting.ts +21 -3
- package/app/composables/useDeliveryPromise.ts +112 -0
- package/app/composables/useOrderListRules.ts +72 -0
- package/app/composables/useProduct.ts +5 -2
- package/app/composables/useRegistrationConfig.ts +27 -6
- package/app/composables/useShopSettings.ts +66 -0
- package/app/config/navigation.ts +16 -2
- package/app/interfaces/account/quotes.ts +20 -0
- package/app/interfaces/cart-calculation.ts +9 -1
- package/app/interfaces/shopSettings.ts +246 -0
- package/app/plugins/shop-settings.ts +52 -0
- package/i18n/locales/de/account.json +6 -0
- package/i18n/locales/de/auth.json +12 -0
- package/i18n/locales/de/cart.json +12 -3
- package/i18n/locales/de/common.json +3 -2
- package/i18n/locales/en/account.json +6 -0
- package/i18n/locales/en/auth.json +12 -0
- package/i18n/locales/en/cart.json +12 -3
- package/i18n/locales/en/common.json +3 -2
- package/nuxt.config.ts +0 -1
- package/package.json +1 -1
- package/server/api/account/quotes/[id]/decline.post.ts +1 -1
- package/server/api/account/quotes/[id]/order.post.ts +25 -5
- package/server/api/account/quotes/[id].get.ts +1 -1
- package/server/api/account/quotes.get.ts +10 -3
- package/server/api/auth/registration-config.get.ts +19 -33
- package/server/api/cart/calculate.post.ts +35 -18
- package/server/api/orders/index.post.ts +68 -2
- package/server/api/shop/settings.get.ts +14 -0
- package/server/config/shop/app-settings.json +54 -0
- package/server/interfaces/cartCalculation.ts +22 -0
- package/server/services/MockB2BContextService.ts +52 -2
- package/server/services/MockCartCalculationService.ts +117 -11
- package/server/utils/appSettings.ts +242 -0
- package/server/utils/b2bService.ts +1 -1
- package/server/utils/livePrices.ts +24 -2
- package/server/utils/procurementCheckout.ts +98 -0
- package/server/utils/quotesService.ts +109 -16
- package/server/utils/shopSettings.ts +130 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { H3Event } from "h3";
|
|
2
|
+
import type { ShopSettings } from "../../app/interfaces/shopSettings";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The shop's configured behaviour, assembled from the apps that own it.
|
|
6
|
+
*
|
|
7
|
+
* Eleven apps are asked in one round — carts, orders, shipping, prices, markets,
|
|
8
|
+
* promotions, quotes, orderlists, customers, inventories and procurement — and
|
|
9
|
+
* their answers are folded into the one shape the storefront reads
|
|
10
|
+
* (app/interfaces/shopSettings.ts).
|
|
11
|
+
*
|
|
12
|
+
* Every fallback below is the app's OWN declared default, copied from its
|
|
13
|
+
* settings.json. That is deliberate: it means the demo tenant and a live tenant
|
|
14
|
+
* that never touched a setting behave identically, and it means the value in
|
|
15
|
+
* this file can be checked against the app that owns it. Where an app declares
|
|
16
|
+
* no default the fallback is null, and the surface says nothing rather than
|
|
17
|
+
* inventing a figure.
|
|
18
|
+
*
|
|
19
|
+
* Only settings a code path READS are here. A field nothing acts on is the same
|
|
20
|
+
* lie as a setting nothing enforces, one layer further out — so a key that
|
|
21
|
+
* looks useful but reaches no surface stays in the apps until a surface needs
|
|
22
|
+
* it, and the specs record what is still unanswered.
|
|
23
|
+
*
|
|
24
|
+
* Keep this file boring. It maps keys to fields and nothing else; anything that
|
|
25
|
+
* decides something belongs where the deciding is done.
|
|
26
|
+
*/
|
|
27
|
+
export async function getShopSettings(event?: H3Event): Promise<ShopSettings> {
|
|
28
|
+
const live = isAppSettingsLive(event);
|
|
29
|
+
const s = await readAppSettingsMany(event, [
|
|
30
|
+
"carts",
|
|
31
|
+
"orders",
|
|
32
|
+
"shipping",
|
|
33
|
+
"prices",
|
|
34
|
+
"markets",
|
|
35
|
+
"promotions",
|
|
36
|
+
"quotes",
|
|
37
|
+
"orderlists",
|
|
38
|
+
"customers",
|
|
39
|
+
"inventories",
|
|
40
|
+
"procurement",
|
|
41
|
+
] as const);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
cart: {
|
|
45
|
+
multipleCarts: boolSetting(s.carts, "multi_cart_enabled", true),
|
|
46
|
+
maxLines: numberSetting(s.carts, "max_items_per_cart", 0),
|
|
47
|
+
maxQuantityPerLine: numberSetting(s.carts, "max_quantity_per_line", 0),
|
|
48
|
+
},
|
|
49
|
+
orders: {
|
|
50
|
+
approvalAboveValue: numberSetting(s.orders, "require_approval_above_value", 0),
|
|
51
|
+
maxPositions: numberSetting(s.orders, "max_items_per_order", 500),
|
|
52
|
+
onUnorderablePosition: enumSetting(
|
|
53
|
+
s.orders,
|
|
54
|
+
"on_unorderable_position",
|
|
55
|
+
["place", "drop", "refuse"] as const,
|
|
56
|
+
"place",
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
shipping: {
|
|
60
|
+
// No default in the app, and none invented here.
|
|
61
|
+
freeThreshold: optionalNumberSetting(s.shipping, "free_shipping_threshold"),
|
|
62
|
+
freeCompares: enumSetting(s.shipping, "free_above_compares", ["net", "gross"] as const, "gross"),
|
|
63
|
+
cutoffTime: stringSetting(s.shipping, "cutoff_time", "14:00"),
|
|
64
|
+
handlingDays: numberSetting(s.shipping, "handling_days", 1),
|
|
65
|
+
},
|
|
66
|
+
prices: {
|
|
67
|
+
stored: enumSetting(s.prices, "tax_inclusive_default", ["net", "gross"] as const, "net"),
|
|
68
|
+
marketIncludesTax: optionalBoolSetting(s.markets, "prices_include_tax"),
|
|
69
|
+
anonymousAllowed: boolSetting(s.prices, "anonymous_resolve_allowed", true),
|
|
70
|
+
precision: numberSetting(s.prices, "price_precision", 2),
|
|
71
|
+
},
|
|
72
|
+
promotions: {
|
|
73
|
+
maxCodesPerCart: numberSetting(s.promotions, "max_codes_per_cart", 1),
|
|
74
|
+
codeCaseSensitive: boolSetting(s.promotions, "code_case_sensitive", false),
|
|
75
|
+
anonymousAllowed: boolSetting(s.promotions, "anonymous_promotions_allowed", true),
|
|
76
|
+
},
|
|
77
|
+
quotes: {
|
|
78
|
+
partialAcceptance: boolSetting(s.quotes, "partial_acceptance_enabled", true),
|
|
79
|
+
acceptanceScope: enumSetting(s.quotes, "acceptance_scope", ["requester", "organization"] as const, "organization"),
|
|
80
|
+
defaultValidityDays: numberSetting(s.quotes, "default_validity_days", 30),
|
|
81
|
+
expiryGraceHours: numberSetting(s.quotes, "expiry_grace_hours", 0),
|
|
82
|
+
expiryWarningDays: numberSetting(s.quotes, "expiry_warning_days", 3),
|
|
83
|
+
},
|
|
84
|
+
orderLists: {
|
|
85
|
+
maxItems: numberSetting(s.orderlists, "max_items_per_list", 200),
|
|
86
|
+
maxLists: numberSetting(s.orderlists, "max_lists_per_owner", 100),
|
|
87
|
+
sharedEditable: boolSetting(s.orderlists, "shared_lists_editable", false),
|
|
88
|
+
cartMergeMode: enumSetting(s.orderlists, "cart_merge_mode", ["append", "replace"] as const, "append"),
|
|
89
|
+
defaultKind: nullableEnum(s.orderlists, "default_kind", ["shopping", "label"] as const),
|
|
90
|
+
},
|
|
91
|
+
registration: {
|
|
92
|
+
b2b: boolSetting(s.customers, "b2b_registration_enabled", true),
|
|
93
|
+
b2c: boolSetting(s.customers, "b2c_registration_enabled", true),
|
|
94
|
+
vatRequired: boolSetting(s.customers, "organization_vat_id_required", false),
|
|
95
|
+
mode: enumSetting(s.customers, "registration_mode", ["open", "approval_required"] as const, "open"),
|
|
96
|
+
vatValidation: enumSetting(s.customers, "vat_id_validation", ["off", "format", "vies"] as const, "off"),
|
|
97
|
+
},
|
|
98
|
+
signIn: {
|
|
99
|
+
password: boolSetting(s.customers, "login_password", true),
|
|
100
|
+
magicLink: boolSetting(s.customers, "login_magic_link", false),
|
|
101
|
+
emailOtp: boolSetting(s.customers, "login_email_otp", false),
|
|
102
|
+
emailVerification: enumSetting(
|
|
103
|
+
s.customers,
|
|
104
|
+
"email_verification",
|
|
105
|
+
["off", "on_registration", "required_for_login"] as const,
|
|
106
|
+
"off",
|
|
107
|
+
),
|
|
108
|
+
},
|
|
109
|
+
account: {
|
|
110
|
+
singleDefaultAddressPerType: boolSetting(s.customers, "single_default_address_per_type", true),
|
|
111
|
+
},
|
|
112
|
+
inventory: {
|
|
113
|
+
backorders: enumSetting(s.inventories, "backorder_policy", ["deny", "allow", "allow_per_sku"] as const, "deny"),
|
|
114
|
+
},
|
|
115
|
+
procurement: {
|
|
116
|
+
gate: enumSetting(s.procurement, "approval_gate", ["none", "booking_account"] as const, "none"),
|
|
117
|
+
},
|
|
118
|
+
source: live ? "apps" : "demo",
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** An enum the app leaves unset — absent means unset, not the first value. */
|
|
123
|
+
function nullableEnum<T extends string>(
|
|
124
|
+
settings: Record<string, unknown>,
|
|
125
|
+
key: string,
|
|
126
|
+
allowed: readonly T[],
|
|
127
|
+
): T | null {
|
|
128
|
+
const raw = settings[key];
|
|
129
|
+
return typeof raw === "string" && (allowed as readonly string[]).includes(raw) ? raw as T : null;
|
|
130
|
+
}
|