@revenexx/cover 0.7.1 → 0.11.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/api/account.ts +4 -0
- package/app/api/forms.ts +1 -0
- package/app/app.config.ts +17 -12
- package/app/assets/css/cover.css +9 -0
- package/app/components/RevenexxForm.vue +84 -12
- package/app/components/account/AccountShell.vue +18 -0
- package/app/components/account/AccountSidebar.vue +2 -5
- package/app/components/account/approvals/AccountPendingApprovals.vue +178 -0
- package/app/components/account/dashboard/AccountDashboardKpis.vue +74 -34
- package/app/components/account/dashboard/AccountDashboardQuickActions.vue +24 -6
- package/app/components/account/orderlists/AccountOrderListDetail.vue +47 -4
- package/app/components/account/orders/AccountOrderDetail.vue +186 -1
- package/app/components/account/organization/AccountOrganization.vue +3 -1
- package/app/components/account/payments/AccountPayments.vue +129 -0
- package/app/components/account/quotes/AccountQuoteDetail.vue +48 -16
- package/app/components/account/team/AccountTeam.vue +32 -7
- package/app/components/auth/AuthForgotPasswordPanel.vue +9 -4
- package/app/components/auth/AuthLoginPanel.vue +136 -18
- package/app/components/auth/AuthMagicLinkPanel.vue +70 -0
- package/app/components/cart/actions/CartSaveToListModal.vue +5 -0
- package/app/components/cart/item/CartItem.vue +17 -75
- package/app/components/cart/position/CartPosition.vue +17 -30
- package/app/components/cart/quote/CartQuoteRequestModal.vue +9 -1
- package/app/components/cart/view/CartSummaryPanel.vue +54 -0
- package/app/components/category/view/GridView.vue +10 -1
- package/app/components/category/view/ListView.vue +10 -1
- package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +2 -0
- package/app/components/checkout/onepage/CheckoutAddressSection.vue +4 -4
- package/app/components/checkout/onepage/CheckoutDeliverySection.vue +31 -3
- package/app/components/checkout/onepage/CheckoutGate.vue +10 -7
- package/app/components/checkout/onepage/CheckoutOnePageView.vue +1 -1
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +10 -0
- package/app/components/checkout/onepage/CheckoutSummarySection.vue +7 -1
- package/app/components/form/FormPage.vue +40 -0
- package/app/components/layout/Region.vue +13 -0
- package/app/components/layout/footer/Footer.vue +8 -0
- package/app/components/layout/header/AppBar.vue +11 -4
- package/app/components/layout/header/MainNav.vue +26 -4
- package/app/components/layout/header/MobileMenu.vue +12 -0
- package/app/components/listing/ListingResults.vue +3 -1
- package/app/components/product/card/Compact.vue +10 -1
- package/app/components/product/detail/ProductDetailAddToCart.vue +51 -18
- package/app/components/product/detail/ProductDetailIdentity.vue +1 -1
- package/app/components/product/detail/ProductDetailPriceRequest.vue +39 -0
- package/app/components/product/detail/ProductDetailSaveToList.vue +10 -0
- package/app/components/product/detail/ProductDetailView.vue +57 -0
- package/app/composables/useAccountDashboard.ts +0 -10
- package/app/composables/useAccountHold.ts +45 -0
- package/app/composables/useAccountNavigation.ts +35 -0
- package/app/composables/useAccountPayments.ts +21 -0
- package/app/composables/useAccountQuotes.ts +15 -2
- package/app/composables/useAuthStore.ts +84 -2
- package/app/composables/useAuthoredForms.ts +26 -0
- package/app/composables/useAvailableOffers.ts +42 -0
- package/app/composables/useCategoryListing.ts +6 -0
- package/app/composables/useCheckoutOnePage.ts +21 -2
- package/app/composables/useGuestOrdering.ts +28 -0
- package/app/composables/useMasterDataEditable.ts +45 -7
- package/app/composables/useOrderListRules.ts +21 -1
- package/app/composables/usePendingApprovals.ts +37 -0
- package/app/composables/useProductCard.ts +29 -2
- package/app/composables/useProductListing.ts +79 -0
- package/app/composables/useQuantityStepper.ts +90 -0
- package/app/composables/useQuickActions.ts +35 -0
- package/app/composables/useRoleGrants.ts +32 -0
- package/app/composables/useSearchListing.ts +4 -0
- package/app/composables/useThemeEvents.ts +144 -0
- package/app/config/accountDashboard.ts +26 -0
- package/app/config/icons.ts +2 -0
- package/app/config/navigation.ts +2 -2
- package/app/config/quickActions.ts +40 -5
- package/app/formkit.config.ts +14 -0
- package/app/interfaces/account/approvals.ts +37 -0
- package/app/interfaces/account/dashboard.ts +2 -0
- package/app/interfaces/account/order-list.ts +29 -0
- package/app/interfaces/account/order-lists.ts +9 -0
- package/app/interfaces/account/payments.ts +48 -0
- package/app/interfaces/auth.ts +24 -2
- package/app/interfaces/b2b.ts +8 -8
- package/app/interfaces/offers.ts +35 -0
- package/app/interfaces/quantity-stepper.ts +17 -0
- package/app/interfaces/shopSettings.ts +77 -0
- package/app/layouts/default.vue +19 -10
- package/app/layouts/focus.vue +28 -7
- package/app/middleware/checkout-guard.ts +7 -1
- package/app/pages/punchout/transfer.vue +22 -0
- package/app/plugins/account-hold.client.ts +20 -0
- package/app/plugins/shop-settings.ts +27 -12
- package/app/plugins/theme-events.client.ts +132 -0
- package/app/shared/themeEvents.ts +445 -0
- package/i18n/locales/de/account.json +87 -0
- package/i18n/locales/de/auth.json +30 -0
- package/i18n/locales/de/cart.json +9 -1
- package/i18n/locales/de/checkout.json +4 -2
- package/i18n/locales/de/common.json +4 -0
- package/i18n/locales/de/cover.json +44 -0
- package/i18n/locales/de/editor.json +47 -1
- package/i18n/locales/de/forms.json +27 -0
- package/i18n/locales/en/account.json +87 -0
- package/i18n/locales/en/auth.json +30 -0
- package/i18n/locales/en/cart.json +9 -1
- package/i18n/locales/en/checkout.json +4 -2
- package/i18n/locales/en/common.json +4 -0
- package/i18n/locales/en/cover.json +44 -0
- package/i18n/locales/en/editor.json +47 -1
- package/i18n/locales/en/forms.json +27 -0
- package/nuxt.config.ts +15 -1
- package/package.json +6 -2
- package/server/api/account/address/[id].delete.ts +1 -1
- package/server/api/account/address/[id].put.ts +1 -1
- package/server/api/account/address/index.post.ts +1 -1
- package/server/api/account/order-lists/[id].get.ts +37 -3
- package/server/api/account/orders/[id]/cancel.post.ts +54 -0
- package/server/api/account/orders/[id]/messages.get.ts +63 -0
- package/server/api/account/orders/[id]/messages.post.ts +44 -0
- package/server/api/account/orders/[id]/return.post.ts +1 -0
- package/server/api/account/orders/[id].get.ts +1 -1
- package/server/api/account/organization.put.ts +1 -1
- package/server/api/account/payments.get.ts +54 -0
- package/server/api/account/pending-approvals/[id]/approve.post.ts +10 -0
- package/server/api/account/pending-approvals/[id]/decline.post.ts +10 -0
- package/server/api/account/pending-approvals/index.get.ts +26 -0
- package/server/api/account/profile.get.ts +3 -1
- package/server/api/account/profile.put.ts +1 -1
- package/server/api/account/quotes/[id]/decline.post.ts +35 -6
- package/server/api/account/team/[id].put.ts +1 -1
- package/server/api/account/team.post.ts +1 -1
- package/server/api/auth/login.post.ts +6 -0
- package/server/api/auth/magic-link.post.ts +32 -0
- package/server/api/auth/magic-link.put.ts +35 -0
- package/server/api/auth/otp.post.ts +33 -0
- package/server/api/auth/otp.put.ts +33 -0
- package/server/api/carts/[id]/activate.post.ts +1 -0
- package/server/api/carts/[id]/index.delete.ts +1 -0
- package/server/api/carts/[id]/index.put.ts +1 -0
- package/server/api/carts/[id]/items.post.ts +1 -0
- package/server/api/checkout/profile.get.ts +6 -3
- package/server/api/forms/[slug]/submit.post.ts +27 -16
- package/server/api/forms/[slug].get.ts +9 -1
- package/server/api/forms/index.get.ts +23 -0
- package/server/api/orders/index.post.ts +41 -0
- package/server/api/promotions/available.post.ts +37 -0
- package/server/api/quick-actions.get.ts +6 -38
- package/server/config/account/organization.json +0 -4
- package/server/config/shop/app-settings.json +4 -0
- package/server/data/forms/authored.json +337 -0
- package/server/interfaces/forms.ts +51 -0
- package/server/middleware/buyer-principal.ts +18 -0
- package/server/routes/punchout/start.get.ts +2 -2
- package/server/services/ApiAddressBookService.ts +43 -1
- package/server/services/ApiAuthService.ts +101 -10
- package/server/services/ApiCartService.ts +3 -10
- package/server/services/ApiFormsService.ts +56 -0
- package/server/services/ApiOrganizationService.ts +7 -2
- package/server/services/ApiTeamService.ts +93 -21
- package/server/services/MockB2BContextService.ts +1 -5
- package/server/services/MockFormsService.ts +63 -0
- package/server/utils/accountPayments.ts +45 -0
- package/server/utils/appSettings.ts +69 -4
- package/server/utils/buyerIdentity.ts +168 -0
- package/server/utils/cartOwnership.ts +27 -0
- package/server/utils/forms.ts +62 -14
- package/server/utils/formsService.ts +29 -0
- package/server/utils/liveOrderLists.ts +50 -23
- package/server/utils/liveOrders.ts +65 -24
- package/server/utils/livePrices.ts +7 -15
- package/server/utils/masterData.ts +60 -11
- package/server/utils/passwordlessSignIn.ts +82 -0
- package/server/utils/pendingApprovals.ts +175 -0
- package/server/utils/procurementCheckout.ts +2 -0
- package/server/utils/promotionsService.ts +90 -0
- package/server/utils/quickActionCatalogue.ts +53 -0
- package/server/utils/quotesService.ts +15 -0
- package/server/utils/revenexxSdk.ts +116 -2
- package/server/utils/shopSettings.ts +35 -4
|
@@ -8,6 +8,7 @@ export default defineEventHandler(async (event) => {
|
|
|
8
8
|
if (!id || !name?.trim()) {
|
|
9
9
|
throw createError({ statusCode: 400, message: "Cart id and name are required" });
|
|
10
10
|
}
|
|
11
|
+
await assertOwnCart(event, manager, id);
|
|
11
12
|
try {
|
|
12
13
|
await manager.renameCart(event, id, name);
|
|
13
14
|
return { ok: true };
|
|
@@ -10,6 +10,7 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
if (!id || !item) {
|
|
11
11
|
throw createError({ statusCode: 400, message: "Cart id and item are required" });
|
|
12
12
|
}
|
|
13
|
+
await assertOwnCart(event, manager, id);
|
|
13
14
|
try {
|
|
14
15
|
await manager.addItemToCart(event, id, item);
|
|
15
16
|
return { ok: true };
|
|
@@ -3,10 +3,13 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
// receive the guest checkout options when guest ordering is enabled.
|
|
4
4
|
const user = await getAuthService(event).me(event);
|
|
5
5
|
|
|
6
|
+
// A visitor with no account reaches the checkout only where the merchant takes
|
|
7
|
+
// such an order. The orders app holds that answer and refuses the placement
|
|
8
|
+
// itself, so this is the matching UX rather than the rule — but it has to
|
|
9
|
+
// agree with it, or a guest fills a whole checkout to be turned away at the end.
|
|
6
10
|
if (!user) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
if (!guest.b2b && !guest.b2c) {
|
|
11
|
+
const { orders } = await getShopSettings(event);
|
|
12
|
+
if (orders.guestOrdering === "none") {
|
|
10
13
|
throw createError({ statusCode: 401, message: "Unauthorized" });
|
|
11
14
|
}
|
|
12
15
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Records a form submission. Resolves the live form by slug,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Records a form submission. Resolves the live form by slug, drops anything the
|
|
3
|
+
* form never asked for, then hands it to the active forms service — live, that
|
|
4
|
+
* writes a row the platform emits `form.submitted` for, which is what an
|
|
5
|
+
* Integration Studio workflow or a notification email listens to.
|
|
6
|
+
*
|
|
7
|
+
* `rejected` is not an error: it is the tenant who configured `spam_handling:
|
|
8
|
+
* reject` and a submission that filled the decoy field in. Nothing was stored,
|
|
9
|
+
* on purpose, so the visitor is told that rather than thanked.
|
|
6
10
|
*/
|
|
7
11
|
export default defineEventHandler(async (event) => {
|
|
8
12
|
const slug = getRouterParam(event, "slug");
|
|
@@ -17,24 +21,31 @@ export default defineEventHandler(async (event) => {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
try {
|
|
20
|
-
const form = await
|
|
24
|
+
const [form, policy] = await Promise.all([
|
|
25
|
+
getFormsService(event).resolve(slug),
|
|
26
|
+
resolveFormSpamPolicy(event),
|
|
27
|
+
]);
|
|
21
28
|
if (!form) {
|
|
22
29
|
throw createError({ statusCode: 404, message: "Form not found" });
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
form_slug: form.slug,
|
|
29
|
-
data,
|
|
30
|
-
source: body?.source ?? null,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
32
|
+
const definition = Array.isArray(form.definition) ? form.definition : [];
|
|
33
|
+
const source = body?.source ?? null;
|
|
34
|
+
const clean = sanitizeSubmission(definition, data, policy.honeypotField);
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const result = await getFormsService(event).submit(form, clean, source, policy);
|
|
37
|
+
if (result.outcome === "rejected") {
|
|
38
|
+
return { ok: false, outcome: result.outcome, success_message: null };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// The operator-configured post-submit actions (webhook / entity write).
|
|
42
|
+
// A submission the tenant keeps as spam is still a submission, but it is
|
|
43
|
+
// not one to fire an integration for.
|
|
44
|
+
if (result.outcome === "stored") {
|
|
45
|
+
await runFormActions(form, clean, source);
|
|
46
|
+
}
|
|
36
47
|
|
|
37
|
-
return { ok: true,
|
|
48
|
+
return { ok: true, outcome: result.outcome, success_message: result.successMessage ?? null };
|
|
38
49
|
}
|
|
39
50
|
catch (err) {
|
|
40
51
|
if (err !== null && typeof err === "object" && "statusCode" in err) {
|
|
@@ -13,7 +13,10 @@ export default defineEventHandler(async (event): Promise<FormPublic> => {
|
|
|
13
13
|
const locale = resolveLocale(event);
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const form = await
|
|
16
|
+
const [form, policy] = await Promise.all([
|
|
17
|
+
getFormsService(event).resolve(slug),
|
|
18
|
+
resolveFormSpamPolicy(event),
|
|
19
|
+
]);
|
|
17
20
|
if (!form) {
|
|
18
21
|
throw createError({ statusCode: 404, message: "Form not found" });
|
|
19
22
|
}
|
|
@@ -25,6 +28,11 @@ export default defineEventHandler(async (event): Promise<FormPublic> => {
|
|
|
25
28
|
settings: form.settings
|
|
26
29
|
? { submit_label: form.settings.submit_label, success_message: form.settings.success_message }
|
|
27
30
|
: null,
|
|
31
|
+
// Never a name the form itself declares: a decoy that collides with a
|
|
32
|
+
// real field would drop the visitor's own answer.
|
|
33
|
+
honeypot: policy.honeypotField && !namedFields(definition).has(policy.honeypotField)
|
|
34
|
+
? policy.honeypotField
|
|
35
|
+
: null,
|
|
28
36
|
};
|
|
29
37
|
}
|
|
30
38
|
catch (err) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FormSummary } from "../../interfaces/forms";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The live forms, by slug and name.
|
|
5
|
+
*
|
|
6
|
+
* A surface that OFFERS a form — the price-request link on a product page, a
|
|
7
|
+
* return request beside a delivered order — has to know whether the merchant
|
|
8
|
+
* published one, or it links to a page that renders nothing. One cached read
|
|
9
|
+
* answers that for every such surface instead of a probe per link.
|
|
10
|
+
*
|
|
11
|
+
* Never more than the catalogue: no definition, no settings, no draft.
|
|
12
|
+
*/
|
|
13
|
+
export default defineEventHandler(async (event): Promise<{ forms: FormSummary[] }> => {
|
|
14
|
+
try {
|
|
15
|
+
return { forms: await getFormsService(event).list() };
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
// A storefront must not lose its product page because the forms app is
|
|
19
|
+
// unreachable: an empty catalogue hides the optional link and nothing else.
|
|
20
|
+
getLogService().error("Service error: forms/list", apiErrorContext(err));
|
|
21
|
+
return { forms: [] };
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -367,6 +367,14 @@ export default defineEventHandler(async (event) => {
|
|
|
367
367
|
const submission = {
|
|
368
368
|
...(contactId ? { contactId } : {}),
|
|
369
369
|
...(organizationId ? { organizationId } : {}),
|
|
370
|
+
// Which kind of shopper this is, stated only where nobody is
|
|
371
|
+
// signed in — that is when it decides anything. The orders app
|
|
372
|
+
// cannot see it: a guest carries no contact and no organisation,
|
|
373
|
+
// so a company shopper and a private one look identical there.
|
|
374
|
+
// Saying it is also what makes the placement a shopper's rather
|
|
375
|
+
// than a system's, which is the difference between being held to
|
|
376
|
+
// the merchant's guest rule and being an ERP nobody gates.
|
|
377
|
+
...(contactId ? {} : { customer_type: customerType === "private" ? "b2c" : "b2b" }),
|
|
370
378
|
...(cartId ? { cartId } : {}),
|
|
371
379
|
...(discounts.length ? { discounts } : {}),
|
|
372
380
|
currency: selectedCurrency ?? calculation.currency,
|
|
@@ -442,6 +450,27 @@ export default defineEventHandler(async (event) => {
|
|
|
442
450
|
}
|
|
443
451
|
|
|
444
452
|
const placed = outcome.order;
|
|
453
|
+
|
|
454
|
+
// An attributed buyer (RAD-155) whose role only REQUESTS orders,
|
|
455
|
+
// or whose order is above the merchant's approval threshold, gets
|
|
456
|
+
// a pending order back rather than a placed one. Nothing is bought
|
|
457
|
+
// yet: no payment is taken and no promotion is spent until
|
|
458
|
+
// somebody approves it — the same answer a procurement request
|
|
459
|
+
// gets above.
|
|
460
|
+
if (placed.status === "pending") {
|
|
461
|
+
if (reserved === "held" && cartId) {
|
|
462
|
+
await releaseRedemption(event, { cartId, reason: PromotionsRedemptionsReleaseReason.CartReleased });
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
orderId: placed.number,
|
|
466
|
+
status: "approval-pending",
|
|
467
|
+
createdAt: new Date().toISOString(),
|
|
468
|
+
payment,
|
|
469
|
+
approvalRequired: true,
|
|
470
|
+
approvers: [],
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
445
474
|
orderId = placed.number;
|
|
446
475
|
liveOrderUuid = placed.id;
|
|
447
476
|
liveOrderTotal = typeof placed.grand_total === "number" ? placed.grand_total : null;
|
|
@@ -471,6 +500,18 @@ export default defineEventHandler(async (event) => {
|
|
|
471
500
|
if (err instanceof RevenexxException && (err.code === 400 || err.code === 422)) {
|
|
472
501
|
throw createError({ status: 422, message: err.message });
|
|
473
502
|
}
|
|
503
|
+
// The buyer's role neither places nor requests orders (a viewer,
|
|
504
|
+
// a blocked contact, a role the merchant narrowed). The gateway or
|
|
505
|
+
// the orders app says so with a 403 once the call is attributed
|
|
506
|
+
// (RAD-155) — that is the buyer's answer, not an outage.
|
|
507
|
+
if (err instanceof RevenexxException && err.code === 403) {
|
|
508
|
+
throw createError({
|
|
509
|
+
status: 403,
|
|
510
|
+
statusMessage: "Your account may not place orders",
|
|
511
|
+
message: "Your account may not place orders.",
|
|
512
|
+
data: { type: "permission_missing", permission: "orders.create" },
|
|
513
|
+
});
|
|
514
|
+
}
|
|
474
515
|
getLogService().error("Order placement failed", apiErrorContext(err));
|
|
475
516
|
throw createError({ status: 502, message: "Order service unavailable" });
|
|
476
517
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AvailableOffersResponse } from "../../../app/interfaces/offers";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What this buyer could still get, for the cart they are holding.
|
|
5
|
+
*
|
|
6
|
+
* The shop has always been able to say what a cart IS owed. This says what it
|
|
7
|
+
* could be owed — each offer with how far away it is — which is the only version
|
|
8
|
+
* of the question that can change what a buyer does next.
|
|
9
|
+
*
|
|
10
|
+
* Answers an empty list rather than an error wherever it cannot ask: an offer
|
|
11
|
+
* nobody sees costs a larger order, an error costs the order.
|
|
12
|
+
*/
|
|
13
|
+
export default defineEventHandler(async (event): Promise<AvailableOffersResponse> => {
|
|
14
|
+
const body = await readBody<{ subtotal?: number; itemCount?: number }>(event)
|
|
15
|
+
.catch(() => ({} as { subtotal?: number; itemCount?: number }));
|
|
16
|
+
|
|
17
|
+
if (resolvePromotionsServiceKey(event) !== "api") {
|
|
18
|
+
// The demo has no promotions app behind it, and a made-up offer would be
|
|
19
|
+
// the shop inventing a term of sale — exactly what it stopped doing.
|
|
20
|
+
return { offers: [], total: 0 };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const user = await getAuthService(event).me(event);
|
|
24
|
+
const refs = sessionOrderRefs(event);
|
|
25
|
+
const { cart } = await getShopSettings(event);
|
|
26
|
+
|
|
27
|
+
const { offers, total } = await liveAvailableOffers(event, {
|
|
28
|
+
currency: resolveSelectedCurrency(event) ?? cart.currency,
|
|
29
|
+
subtotal: Math.max(0, Number(body?.subtotal) || 0),
|
|
30
|
+
...(typeof body?.itemCount === "number" ? { itemCount: body.itemCount } : {}),
|
|
31
|
+
...(user?.contactId ?? refs?.contact_id ? { contactId: (user?.contactId ?? refs?.contact_id) as string } : {}),
|
|
32
|
+
...(user?.organizationId ?? refs?.organization_id
|
|
33
|
+
? { organizationId: (user?.organizationId ?? refs?.organization_id) as string }
|
|
34
|
+
: {}),
|
|
35
|
+
});
|
|
36
|
+
return { offers, total };
|
|
37
|
+
});
|
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
import { quickActions } from "../../app/config/quickActions";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* The shortcut catalogue behind the `quick_actions` block, with its i18n
|
|
5
|
-
* already resolved
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* nor `useI18n()` and cannot translate a key itself. The block on the page does
|
|
10
|
-
* NOT call this — it holds the same registry and resolves the keys through
|
|
11
|
-
* `useI18n()` with no round-trip.
|
|
2
|
+
* The full shortcut catalogue behind the `quick_actions` block, with its i18n
|
|
3
|
+
* keys already resolved — see `loadQuickActionCatalogue`. Themes that know a
|
|
4
|
+
* tenant's account navigation serve a narrowed catalogue of their own (the
|
|
5
|
+
* Blokkli theme: /api/blokkli/quick-actions); this one is the unfiltered layer
|
|
6
|
+
* default.
|
|
12
7
|
*
|
|
13
8
|
* Static config, not a BFF domain: no service interface, no app.config registry
|
|
14
9
|
* key, nothing to switch between mock and live.
|
|
15
10
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* `serverT` scopes a key to one locale FILE, but the registry's keys span two
|
|
19
|
-
* (`header.cart` lives in common.json, the rest in account.json). A miss
|
|
20
|
-
* returns the key unchanged, which is the signal to try the next namespace.
|
|
21
|
-
*/
|
|
22
|
-
const NAMESPACES = ["account", "common"];
|
|
23
|
-
|
|
24
|
-
function translate(key: string, locale: string): string {
|
|
25
|
-
for (const namespace of NAMESPACES) {
|
|
26
|
-
const value = serverT(key, locale, namespace);
|
|
27
|
-
if (value !== key) {
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return key;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default defineEventHandler(async (event) => {
|
|
35
|
-
const locale = resolveLocale(event);
|
|
36
|
-
await preloadLocaleNamespaces(locale, NAMESPACES);
|
|
37
|
-
|
|
38
|
-
return quickActions.map(action => ({
|
|
39
|
-
id: action.id,
|
|
40
|
-
label: translate(action.labelKey, locale),
|
|
41
|
-
description: translate(action.descriptionKey, locale),
|
|
42
|
-
}));
|
|
43
|
-
});
|
|
11
|
+
export default defineEventHandler(event => loadQuickActionCatalogue(event));
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "demo-form-contact",
|
|
4
|
+
"name": "Kontaktanfrage",
|
|
5
|
+
"slug": "contact",
|
|
6
|
+
"status": "live",
|
|
7
|
+
"definition": [
|
|
8
|
+
{
|
|
9
|
+
"$el": "p",
|
|
10
|
+
"children": "Wir antworten an Werktagen innerhalb von 24 Stunden.",
|
|
11
|
+
"attrs": {
|
|
12
|
+
"class": "text-sm text-muted"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"$formkit": "text",
|
|
17
|
+
"name": "company",
|
|
18
|
+
"label": "Firma",
|
|
19
|
+
"autocomplete": "organization"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"$formkit": "text",
|
|
23
|
+
"name": "name",
|
|
24
|
+
"label": "Name",
|
|
25
|
+
"validation": "required",
|
|
26
|
+
"autocomplete": "name"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"$formkit": "email",
|
|
30
|
+
"name": "email",
|
|
31
|
+
"label": "E-Mail",
|
|
32
|
+
"validation": "required|email",
|
|
33
|
+
"autocomplete": "email"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"$formkit": "tel",
|
|
37
|
+
"name": "phone",
|
|
38
|
+
"label": "Telefon",
|
|
39
|
+
"help": "Optional — falls ein Rückruf schneller geht.",
|
|
40
|
+
"autocomplete": "tel"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"$formkit": "select",
|
|
44
|
+
"name": "topic",
|
|
45
|
+
"label": "Worum geht es?",
|
|
46
|
+
"placeholder": "Bitte wählen",
|
|
47
|
+
"validation": "required",
|
|
48
|
+
"options": [
|
|
49
|
+
{
|
|
50
|
+
"value": "product",
|
|
51
|
+
"label": "Produkt oder Verfügbarkeit"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"value": "order",
|
|
55
|
+
"label": "Eine bestehende Bestellung"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"value": "invoice",
|
|
59
|
+
"label": "Rechnung oder Zahlung"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"value": "other",
|
|
63
|
+
"label": "Etwas anderes"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"$formkit": "textarea",
|
|
69
|
+
"name": "message",
|
|
70
|
+
"label": "Nachricht",
|
|
71
|
+
"validation": "required",
|
|
72
|
+
"rows": 5
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"$formkit": "checkbox",
|
|
76
|
+
"name": "consent",
|
|
77
|
+
"label": "Ich bin damit einverstanden, dass meine Angaben zur Bearbeitung der Anfrage gespeichert werden.",
|
|
78
|
+
"validation": "accepted"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"settings": {
|
|
82
|
+
"submit_label": "Nachricht senden",
|
|
83
|
+
"success_message": "Danke — wir melden uns in Kürze.",
|
|
84
|
+
"default_locale": "de",
|
|
85
|
+
"locales": [
|
|
86
|
+
"de",
|
|
87
|
+
"en"
|
|
88
|
+
],
|
|
89
|
+
"i18n": {
|
|
90
|
+
"en": {
|
|
91
|
+
"company": {
|
|
92
|
+
"label": "Company"
|
|
93
|
+
},
|
|
94
|
+
"name": {
|
|
95
|
+
"label": "Name"
|
|
96
|
+
},
|
|
97
|
+
"email": {
|
|
98
|
+
"label": "Email"
|
|
99
|
+
},
|
|
100
|
+
"phone": {
|
|
101
|
+
"label": "Phone",
|
|
102
|
+
"help": "Optional — if a call back is quicker."
|
|
103
|
+
},
|
|
104
|
+
"topic": {
|
|
105
|
+
"label": "What is it about?",
|
|
106
|
+
"placeholder": "Please choose"
|
|
107
|
+
},
|
|
108
|
+
"message": {
|
|
109
|
+
"label": "Message"
|
|
110
|
+
},
|
|
111
|
+
"consent": {
|
|
112
|
+
"label": "I agree to my details being stored to answer this enquiry."
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "demo-form-price-request",
|
|
120
|
+
"name": "Preisanfrage",
|
|
121
|
+
"slug": "price-request",
|
|
122
|
+
"status": "live",
|
|
123
|
+
"definition": [
|
|
124
|
+
{
|
|
125
|
+
"$el": "p",
|
|
126
|
+
"children": "Für einen Artikel und eine Frage. Ganze Warenkörbe gehen als Angebotsanfrage.",
|
|
127
|
+
"attrs": {
|
|
128
|
+
"class": "text-sm text-muted"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"$formkit": "text",
|
|
133
|
+
"name": "product",
|
|
134
|
+
"label": "Artikel",
|
|
135
|
+
"rxKind": "product",
|
|
136
|
+
"validation": "required",
|
|
137
|
+
"placeholder": "Artikelnummer",
|
|
138
|
+
"help": "Vorbelegt, wenn Sie von einer Artikelseite kommen."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"$formkit": "number",
|
|
142
|
+
"name": "quantity",
|
|
143
|
+
"label": "Menge",
|
|
144
|
+
"validation": "required|min:1",
|
|
145
|
+
"value": 1,
|
|
146
|
+
"min": 1
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"$formkit": "radio",
|
|
150
|
+
"name": "reply_via",
|
|
151
|
+
"label": "Wie sollen wir antworten?",
|
|
152
|
+
"validation": "required",
|
|
153
|
+
"value": "email",
|
|
154
|
+
"options": [
|
|
155
|
+
{
|
|
156
|
+
"value": "email",
|
|
157
|
+
"label": "Per E-Mail"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"value": "phone",
|
|
161
|
+
"label": "Per Telefon"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"$formkit": "email",
|
|
167
|
+
"name": "email",
|
|
168
|
+
"label": "E-Mail",
|
|
169
|
+
"validation": "required|email",
|
|
170
|
+
"autocomplete": "email"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"$formkit": "tel",
|
|
174
|
+
"name": "phone",
|
|
175
|
+
"label": "Telefon",
|
|
176
|
+
"autocomplete": "tel"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"$formkit": "textarea",
|
|
180
|
+
"name": "note",
|
|
181
|
+
"label": "Anmerkung",
|
|
182
|
+
"rows": 4
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"settings": {
|
|
186
|
+
"submit_label": "Preis anfragen",
|
|
187
|
+
"success_message": "Danke — wir rechnen das durch und melden uns mit einem Preis.",
|
|
188
|
+
"default_locale": "de",
|
|
189
|
+
"locales": [
|
|
190
|
+
"de",
|
|
191
|
+
"en"
|
|
192
|
+
],
|
|
193
|
+
"i18n": {
|
|
194
|
+
"en": {
|
|
195
|
+
"product": {
|
|
196
|
+
"label": "Article",
|
|
197
|
+
"placeholder": "Article number",
|
|
198
|
+
"help": "Pre-filled when you come from an article page."
|
|
199
|
+
},
|
|
200
|
+
"quantity": {
|
|
201
|
+
"label": "Quantity"
|
|
202
|
+
},
|
|
203
|
+
"reply_via": {
|
|
204
|
+
"label": "How should we answer?"
|
|
205
|
+
},
|
|
206
|
+
"email": {
|
|
207
|
+
"label": "Email"
|
|
208
|
+
},
|
|
209
|
+
"phone": {
|
|
210
|
+
"label": "Phone"
|
|
211
|
+
},
|
|
212
|
+
"note": {
|
|
213
|
+
"label": "Note"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"id": "demo-form-callback",
|
|
221
|
+
"name": "Rückruf-Wunsch",
|
|
222
|
+
"slug": "callback",
|
|
223
|
+
"status": "live",
|
|
224
|
+
"definition": [
|
|
225
|
+
{
|
|
226
|
+
"$formkit": "text",
|
|
227
|
+
"name": "name",
|
|
228
|
+
"label": "Name",
|
|
229
|
+
"validation": "required",
|
|
230
|
+
"autocomplete": "name"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"$formkit": "text",
|
|
234
|
+
"name": "company",
|
|
235
|
+
"label": "Firma",
|
|
236
|
+
"autocomplete": "organization"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"$formkit": "tel",
|
|
240
|
+
"name": "phone",
|
|
241
|
+
"label": "Telefonnummer",
|
|
242
|
+
"validation": "required",
|
|
243
|
+
"autocomplete": "tel"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"$rxStep": {
|
|
247
|
+
"id": "step_2",
|
|
248
|
+
"kind": "fields",
|
|
249
|
+
"title": "Wann passt es Ihnen?"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"$formkit": "date",
|
|
254
|
+
"name": "day",
|
|
255
|
+
"label": "Tag",
|
|
256
|
+
"validation": "required"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"$formkit": "radio",
|
|
260
|
+
"name": "window",
|
|
261
|
+
"label": "Uhrzeit",
|
|
262
|
+
"validation": "required",
|
|
263
|
+
"options": [
|
|
264
|
+
{
|
|
265
|
+
"value": "morning",
|
|
266
|
+
"label": "Vormittags (8–12 Uhr)"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"value": "afternoon",
|
|
270
|
+
"label": "Nachmittags (12–17 Uhr)"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"value": "any",
|
|
274
|
+
"label": "Egal"
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"$formkit": "textarea",
|
|
280
|
+
"name": "topic",
|
|
281
|
+
"label": "Worum geht es?",
|
|
282
|
+
"rows": 4
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"$rxStep": {
|
|
286
|
+
"id": "step_thanks",
|
|
287
|
+
"kind": "thankyou"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"$el": "h3",
|
|
292
|
+
"children": "Ihr Rückruf ist notiert.",
|
|
293
|
+
"attrs": {
|
|
294
|
+
"class": "text-base font-semibold text-highlighted"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"$el": "p",
|
|
299
|
+
"children": "Wir rufen im gewünschten Zeitfenster an. Passt es doch nicht, schreiben Sie uns einfach.",
|
|
300
|
+
"attrs": {
|
|
301
|
+
"class": "text-sm text-muted"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
"settings": {
|
|
306
|
+
"submit_label": "Rückruf anfordern",
|
|
307
|
+
"success_message": "Danke — wir rufen im gewünschten Zeitfenster an.",
|
|
308
|
+
"default_locale": "de",
|
|
309
|
+
"locales": [
|
|
310
|
+
"de",
|
|
311
|
+
"en"
|
|
312
|
+
],
|
|
313
|
+
"i18n": {
|
|
314
|
+
"en": {
|
|
315
|
+
"name": {
|
|
316
|
+
"label": "Name"
|
|
317
|
+
},
|
|
318
|
+
"company": {
|
|
319
|
+
"label": "Company"
|
|
320
|
+
},
|
|
321
|
+
"phone": {
|
|
322
|
+
"label": "Phone number"
|
|
323
|
+
},
|
|
324
|
+
"day": {
|
|
325
|
+
"label": "Day"
|
|
326
|
+
},
|
|
327
|
+
"window": {
|
|
328
|
+
"label": "Time"
|
|
329
|
+
},
|
|
330
|
+
"topic": {
|
|
331
|
+
"label": "What is it about?"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
]
|