@revenexx/cover 0.19.0 → 0.21.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.
Files changed (95) hide show
  1. package/app/api/marketing.ts +24 -0
  2. package/app/app.config.ts +22 -0
  3. package/app/components/account/approvals/AccountPendingApprovals.vue +54 -13
  4. package/app/components/account/approvals/AccountPendingOrderDetail.vue +156 -0
  5. package/app/components/account/loyalty/AccountLoyalty.vue +205 -0
  6. package/app/components/account/orders/AccountOrderContents.vue +142 -0
  7. package/app/components/account/orders/AccountOrderDetail.vue +16 -178
  8. package/app/components/account/orders/AccountOrderHead.vue +79 -0
  9. package/app/components/account/orders/AccountOrderPay.vue +13 -3
  10. package/app/components/account/orders/AccountOrdersTable.vue +2 -0
  11. package/app/components/cart/position/CartPosition.vue +6 -6
  12. package/app/components/cart/view/CartSummaryPanel.vue +4 -0
  13. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +20 -8
  14. package/app/components/checkout/onepage/CheckoutSummarySection.vue +4 -0
  15. package/app/components/checkout/return/CheckoutPaymentReturn.vue +209 -0
  16. package/app/components/loyalty/hint/LoyaltyPerkHint.vue +28 -0
  17. package/app/components/newsletter/confirm/NewsletterConfirmation.vue +54 -0
  18. package/app/components/newsletter/preferences/NewsletterPreferenceCentre.vue +183 -0
  19. package/app/components/newsletter/state/NewsletterLinkRefusal.vue +45 -0
  20. package/app/components/review/form/ReviewForm.vue +211 -0
  21. package/app/composables/useAccountDashboard.ts +1 -0
  22. package/app/composables/useCampaignAttribution.ts +120 -0
  23. package/app/composables/useCheckoutOnePage.ts +80 -7
  24. package/app/composables/useLoyaltyAccount.ts +79 -0
  25. package/app/composables/useMarketingConsent.ts +49 -0
  26. package/app/composables/usePendingApprovals.ts +11 -3
  27. package/app/composables/usePspCheckout.ts +130 -29
  28. package/app/config/colorRamp.ts +55 -0
  29. package/app/config/navigation.ts +1 -1
  30. package/app/config/quickActions.ts +1 -0
  31. package/app/interfaces/account/approvals.ts +34 -1
  32. package/app/interfaces/account/order-list.ts +8 -1
  33. package/app/interfaces/cart-calculation.ts +7 -1
  34. package/app/interfaces/cart-item.ts +12 -0
  35. package/app/interfaces/payment.ts +22 -0
  36. package/app/pages/account/points.vue +26 -0
  37. package/app/pages/checkout/payment-return.vue +17 -0
  38. package/app/pages/newsletter/confirm/[token].vue +23 -0
  39. package/app/pages/newsletter/preferences/[token].vue +24 -0
  40. package/app/pages/review/[token].vue +23 -0
  41. package/app/payments/psp/novalnet.ts +255 -0
  42. package/app/payments/psp/registry.ts +7 -3
  43. package/app/payments/psp/rules.ts +99 -0
  44. package/app/payments/psp/stripe.ts +6 -2
  45. package/app/payments/psp/types.ts +72 -6
  46. package/app/plugins/campaign-attribution.client.ts +47 -0
  47. package/app/shared/campaignAttribution.ts +281 -0
  48. package/app/shared/personalisation.ts +107 -0
  49. package/app/shared/pspReturn.ts +62 -0
  50. package/i18n/locales/de/account.json +20 -5
  51. package/i18n/locales/de/cart.json +4 -2
  52. package/i18n/locales/de/checkout.json +32 -0
  53. package/i18n/locales/de/editor.json +10 -0
  54. package/i18n/locales/de/marketing.json +71 -0
  55. package/i18n/locales/en/account.json +20 -5
  56. package/i18n/locales/en/cart.json +4 -2
  57. package/i18n/locales/en/checkout.json +32 -0
  58. package/i18n/locales/en/editor.json +10 -0
  59. package/i18n/locales/en/marketing.json +71 -0
  60. package/package.json +3 -2
  61. package/server/api/account/orders/[id]/pay.post.ts +47 -7
  62. package/server/api/account/pending-approvals/index.get.ts +16 -12
  63. package/server/api/account/pending-approvals/orders/[number]/approve.post.ts +6 -0
  64. package/server/api/account/pending-approvals/orders/[number]/reject.post.ts +6 -0
  65. package/server/api/account/pending-approvals/orders/[number].get.ts +15 -0
  66. package/server/api/campaigns/touches.post.ts +42 -0
  67. package/server/api/cart/attribution.put.ts +31 -0
  68. package/server/api/checkout/payment-return.post.ts +30 -0
  69. package/server/api/loyalty/account.get.ts +27 -0
  70. package/server/api/newsletter/confirm/[token].post.ts +21 -0
  71. package/server/api/newsletter/preferences/[token].get.ts +14 -0
  72. package/server/api/newsletter/preferences/[token].post.ts +36 -0
  73. package/server/api/orders/index.post.ts +47 -12
  74. package/server/api/payment/methods.post.ts +19 -9
  75. package/server/api/payment/psp-config.get.ts +5 -4
  76. package/server/api/reviews/requests/[token].get.ts +14 -0
  77. package/server/api/reviews/submit/[token].post.ts +31 -0
  78. package/server/interfaces/cart.ts +6 -0
  79. package/server/interfaces/marketing.ts +150 -0
  80. package/server/services/ApiCartService.ts +22 -0
  81. package/server/services/ApiMarketingService.ts +292 -0
  82. package/server/services/ApiProductService.ts +6 -2
  83. package/server/services/MockCartCalculationService.ts +29 -0
  84. package/server/services/MockMarketingService.ts +178 -0
  85. package/server/utils/cartItemHints.ts +29 -0
  86. package/server/utils/checkoutSession.ts +16 -0
  87. package/server/utils/liveCatalog.ts +244 -31
  88. package/server/utils/liveOrders.ts +33 -0
  89. package/server/utils/marketingService.ts +63 -0
  90. package/server/utils/orderAttribution.ts +65 -0
  91. package/server/utils/orderPayment.ts +79 -0
  92. package/server/utils/pendingApprovals.ts +157 -2
  93. package/server/utils/personalisationViewer.ts +28 -0
  94. package/server/utils/pspConfig.ts +125 -13
  95. package/server/utils/pspReturn.ts +267 -0
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Where a visit came from (RAD-293): the UTM parameters and the ad click id a
3
+ * visitor landed with, first and last touch, and the consent in force — the
4
+ * `attribution` object the carts and orders apps keep (marketing contracts
5
+ * §4.3). Pure, so the browser that collects it and the BFF that forwards it
6
+ * hold one rule.
7
+ *
8
+ * Nothing here decides consent. The caller only builds or keeps a touch once
9
+ * the visitor allowed the statistics or the marketing purpose; a click id is
10
+ * kept only under the marketing purpose, because it exists to tell an ad
11
+ * platform about the visitor.
12
+ */
13
+
14
+ export const ATTRIBUTION_STORAGE_KEY = "rvx:attribution";
15
+
16
+ /** A first touch older than this starts over: a campaign weeks ago did not bring today's order. */
17
+ export const ATTRIBUTION_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
18
+
19
+ export const UTM_FIELDS = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"] as const;
20
+ export const CLICK_ID_KINDS = ["gclid", "fbclid", "li_fat_id", "msclkid"] as const;
21
+
22
+ export type UtmField = typeof UTM_FIELDS[number];
23
+ export type ClickIdKind = typeof CLICK_ID_KINDS[number];
24
+
25
+ /** What one landing brought: only the fields that were in the address. */
26
+ export interface LandingTouch {
27
+ utm: Partial<Record<UtmField, string>>;
28
+ click_id?: string;
29
+ click_id_kind?: ClickIdKind;
30
+ landing_url: string;
31
+ referrer: string | null;
32
+ at: string;
33
+ }
34
+
35
+ /** What the browser keeps between landings. */
36
+ export interface StoredAttribution {
37
+ utm: Partial<Record<UtmField, string>>;
38
+ click_id?: string;
39
+ click_id_kind?: ClickIdKind;
40
+ landing_url: string;
41
+ referrer: string | null;
42
+ first_touch_at: string;
43
+ last_touch_at: string;
44
+ }
45
+
46
+ /** The consent half of the object, as the consent manager decided it. */
47
+ export interface AttributionConsent {
48
+ ads: boolean;
49
+ analytics: boolean;
50
+ policy_version: string | null;
51
+ purposes: string[];
52
+ }
53
+
54
+ /** The closed shape the carts and orders apps accept. */
55
+ export interface Attribution {
56
+ utm_source: string | null;
57
+ utm_medium: string | null;
58
+ utm_campaign: string | null;
59
+ utm_content: string | null;
60
+ utm_term: string | null;
61
+ campaign_ref: string | null;
62
+ click_id: string | null;
63
+ click_id_kind: ClickIdKind | null;
64
+ landing_url: string | null;
65
+ referrer: string | null;
66
+ first_touch_at: string | null;
67
+ last_touch_at: string | null;
68
+ consent: AttributionConsent | null;
69
+ objection_notice_shown: boolean;
70
+ }
71
+
72
+ const MAX_TEXT = 500;
73
+ const MAX_URL = 2048;
74
+ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
75
+ const PURPOSE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
76
+
77
+ function clip(value: unknown, max: number): string | null {
78
+ if (typeof value !== "string" && typeof value !== "number") {
79
+ return null;
80
+ }
81
+ const text = String(value).trim();
82
+ return text ? text.slice(0, max) : null;
83
+ }
84
+
85
+ /**
86
+ * The address without anything personal a link could carry: no fragment, and
87
+ * only the campaign parameters of the query. A newsletter link may carry a
88
+ * token or an address; the landing URL is copied into every order.
89
+ */
90
+ export function cleanLandingUrl(url: URL): string {
91
+ const clean = new URL(url.origin + url.pathname);
92
+ for (const key of [...UTM_FIELDS, ...CLICK_ID_KINDS]) {
93
+ const value = url.searchParams.get(key);
94
+ if (value) {
95
+ clean.searchParams.set(key, value);
96
+ }
97
+ }
98
+ return clean.toString().slice(0, MAX_URL);
99
+ }
100
+
101
+ /** A referrer reduced to its origin; the shop's own pages are no referrer at all. */
102
+ export function cleanReferrer(referrer: string | null | undefined, ownOrigin: string): string | null {
103
+ if (!referrer) {
104
+ return null;
105
+ }
106
+ try {
107
+ const origin = new URL(referrer).origin;
108
+ return origin === ownOrigin || origin === "null" ? null : origin;
109
+ }
110
+ catch {
111
+ return null;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * The touch an address brings, or null when it carries no campaign: a plain
117
+ * visit to the shop is not a touch, and must not overwrite the last campaign.
118
+ */
119
+ export function landingTouchOf(url: URL, referrer: string | null | undefined, at: Date): LandingTouch | null {
120
+ const utm: Partial<Record<UtmField, string>> = {};
121
+ for (const field of UTM_FIELDS) {
122
+ const value = clip(url.searchParams.get(field), MAX_TEXT);
123
+ if (value) {
124
+ utm[field] = value;
125
+ }
126
+ }
127
+ let click: { click_id: string; click_id_kind: ClickIdKind } | null = null;
128
+ for (const kind of CLICK_ID_KINDS) {
129
+ const value = clip(url.searchParams.get(kind), MAX_TEXT);
130
+ if (value) {
131
+ click = { click_id: value, click_id_kind: kind };
132
+ break;
133
+ }
134
+ }
135
+ if (!Object.keys(utm).length && !click) {
136
+ return null;
137
+ }
138
+ return {
139
+ utm,
140
+ ...(click ?? {}),
141
+ landing_url: cleanLandingUrl(url),
142
+ referrer: cleanReferrer(referrer, url.origin),
143
+ at: at.toISOString(),
144
+ };
145
+ }
146
+
147
+ /**
148
+ * A new touch over what was kept: the campaign fields are the last touch's,
149
+ * the first touch's time survives — unless what was kept is too old to count.
150
+ * A click id only travels when ads are allowed.
151
+ */
152
+ export function mergeTouch(
153
+ stored: StoredAttribution | null,
154
+ touch: LandingTouch,
155
+ options: { allowClickId: boolean },
156
+ ): StoredAttribution {
157
+ const fresh = !stored || Date.parse(touch.at) - Date.parse(stored.first_touch_at) > ATTRIBUTION_MAX_AGE_MS;
158
+ const click = options.allowClickId && touch.click_id && touch.click_id_kind
159
+ ? { click_id: touch.click_id, click_id_kind: touch.click_id_kind }
160
+ : {};
161
+ return {
162
+ utm: { ...touch.utm },
163
+ ...click,
164
+ landing_url: touch.landing_url,
165
+ referrer: touch.referrer,
166
+ first_touch_at: fresh ? touch.at : stored!.first_touch_at,
167
+ last_touch_at: touch.at,
168
+ };
169
+ }
170
+
171
+ /** What is kept, read back defensively: storage is the visitor's, and may hold anything. */
172
+ export function parseStoredAttribution(raw: string | null, now: Date): StoredAttribution | null {
173
+ if (!raw) {
174
+ return null;
175
+ }
176
+ try {
177
+ const value = JSON.parse(raw) as StoredAttribution;
178
+ if (!value || typeof value !== "object" || typeof value.first_touch_at !== "string" || typeof value.last_touch_at !== "string") {
179
+ return null;
180
+ }
181
+ if (now.getTime() - Date.parse(value.first_touch_at) > ATTRIBUTION_MAX_AGE_MS) {
182
+ return null;
183
+ }
184
+ return value;
185
+ }
186
+ catch {
187
+ return null;
188
+ }
189
+ }
190
+
191
+ /** Without the click id — what is left once ads are no longer allowed. */
192
+ export function withoutClickId(stored: StoredAttribution): StoredAttribution {
193
+ const { click_id: _id, click_id_kind: _kind, ...rest } = stored;
194
+ return rest;
195
+ }
196
+
197
+ /** The object the cart and the order are given. */
198
+ export function toAttribution(
199
+ stored: StoredAttribution,
200
+ consent: AttributionConsent,
201
+ options: { objectionNoticeShown?: boolean } = {},
202
+ ): Attribution {
203
+ const click = consent.ads && stored.click_id && stored.click_id_kind
204
+ ? { click_id: stored.click_id, click_id_kind: stored.click_id_kind }
205
+ : { click_id: null, click_id_kind: null };
206
+ return {
207
+ utm_source: stored.utm.utm_source ?? null,
208
+ utm_medium: stored.utm.utm_medium ?? null,
209
+ utm_campaign: stored.utm.utm_campaign ?? null,
210
+ utm_content: stored.utm.utm_content ?? null,
211
+ utm_term: stored.utm.utm_term ?? null,
212
+ campaign_ref: null,
213
+ ...click,
214
+ landing_url: stored.landing_url,
215
+ referrer: stored.referrer,
216
+ first_touch_at: stored.first_touch_at,
217
+ last_touch_at: stored.last_touch_at,
218
+ consent,
219
+ objection_notice_shown: options.objectionNoticeShown === true,
220
+ };
221
+ }
222
+
223
+ /**
224
+ * The attribution as the BFF forwards it, or null. Whatever a browser sent is
225
+ * rebuilt into the closed shape: an unknown key or a malformed value would be
226
+ * a 400 from the carts or orders app, and an order must never fail over where
227
+ * its buyer came from. Without a consent that allows statistics or marketing
228
+ * there is nothing to forward.
229
+ */
230
+ export function sanitizeAttribution(raw: unknown): Attribution | null {
231
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
232
+ return null;
233
+ }
234
+ const input = raw as Record<string, unknown>;
235
+ const consentIn = input.consent && typeof input.consent === "object" && !Array.isArray(input.consent)
236
+ ? input.consent as Record<string, unknown>
237
+ : null;
238
+ if (!consentIn) {
239
+ return null;
240
+ }
241
+ const purposes = Array.isArray(consentIn.purposes)
242
+ ? [...new Set(consentIn.purposes
243
+ .filter((p): p is string => typeof p === "string")
244
+ .map(p => p.trim().toLowerCase())
245
+ .filter(p => PURPOSE.test(p)))].slice(0, 20)
246
+ : [];
247
+ const consent: AttributionConsent = {
248
+ ads: consentIn.ads === true,
249
+ analytics: consentIn.analytics === true,
250
+ policy_version: clip(consentIn.policy_version, 64),
251
+ purposes,
252
+ };
253
+ if (!consent.ads && !consent.analytics) {
254
+ return null;
255
+ }
256
+ const time = (value: unknown): string | null => {
257
+ const text = clip(value, 64);
258
+ return text && !Number.isNaN(Date.parse(text)) ? new Date(text).toISOString() : null;
259
+ };
260
+ const kind = typeof input.click_id_kind === "string" && (CLICK_ID_KINDS as readonly string[]).includes(input.click_id_kind)
261
+ ? input.click_id_kind as ClickIdKind
262
+ : null;
263
+ const clickId = consent.ads && kind ? clip(input.click_id, MAX_TEXT) : null;
264
+ const ref = clip(input.campaign_ref, 64);
265
+ return {
266
+ utm_source: clip(input.utm_source, MAX_TEXT),
267
+ utm_medium: clip(input.utm_medium, MAX_TEXT),
268
+ utm_campaign: clip(input.utm_campaign, MAX_TEXT),
269
+ utm_content: clip(input.utm_content, MAX_TEXT),
270
+ utm_term: clip(input.utm_term, MAX_TEXT),
271
+ campaign_ref: ref && UUID.test(ref) ? ref : null,
272
+ click_id: clickId,
273
+ click_id_kind: clickId ? kind : null,
274
+ landing_url: clip(input.landing_url, MAX_URL),
275
+ referrer: clip(input.referrer, MAX_URL),
276
+ first_touch_at: time(input.first_touch_at),
277
+ last_touch_at: time(input.last_touch_at),
278
+ consent,
279
+ objection_notice_shown: input.objection_notice_shown === true,
280
+ };
281
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Onsite personalisation (RAD-293, marketing contracts §4.5): who may see a
3
+ * content block or a pop-up, decided by the audiences a signed-in contact is
4
+ * in and the purposes the visitor allowed in the cookie choice.
5
+ *
6
+ * The pages app applies the same rule when it delivers a live page; this copy
7
+ * serves the shop's local content, so a demo and a test behave as a deployed
8
+ * shop does.
9
+ */
10
+
11
+ export interface BlockVisibility {
12
+ audiences?: string[];
13
+ exclude_audiences?: string[];
14
+ consent_purpose?: string | null;
15
+ }
16
+
17
+ /** Who is looking: audience codes (empty for anonymous) and allowed purposes. */
18
+ export interface Viewer {
19
+ audiences: string[];
20
+ consents: string[];
21
+ }
22
+
23
+ const CODE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
24
+
25
+ /** A comma list or an array of codes, lower-cased, without anything malformed. */
26
+ export function codeList(value: unknown): string[] {
27
+ if (value === undefined || value === null) {
28
+ return [];
29
+ }
30
+ const list = Array.isArray(value) ? value : String(value).split(",");
31
+ const out: string[] = [];
32
+ for (const raw of list) {
33
+ const code = String(raw ?? "").trim().toLowerCase();
34
+ if (code && CODE.test(code) && !out.includes(code)) {
35
+ out.push(code);
36
+ }
37
+ }
38
+ return out;
39
+ }
40
+
41
+ /** Whether a viewer is shown something with this visibility. No rule — visible to all. */
42
+ export function visibleTo(visibility: unknown, viewer: Viewer): boolean {
43
+ if (!visibility || typeof visibility !== "object" || Array.isArray(visibility)) {
44
+ return true;
45
+ }
46
+ const rule = visibility as BlockVisibility;
47
+ const audiences = codeList(rule.audiences);
48
+ const excluded = codeList(rule.exclude_audiences);
49
+ const purpose = typeof rule.consent_purpose === "string" ? rule.consent_purpose.trim().toLowerCase() : "";
50
+ if (audiences.length && !audiences.some(a => viewer.audiences.includes(a))) {
51
+ return false;
52
+ }
53
+ if (excluded.some(a => viewer.audiences.includes(a))) {
54
+ return false;
55
+ }
56
+ if (purpose && !viewer.consents.includes(purpose)) {
57
+ return false;
58
+ }
59
+ return true;
60
+ }
61
+
62
+ interface TreeNode {
63
+ options?: Record<string, unknown>;
64
+ children?: Record<string, TreeNode[]>;
65
+ }
66
+
67
+ /** The block tree without what this viewer may not see, children included. */
68
+ export function filterBlocksForViewer<T extends TreeNode>(blocks: T[], viewer: Viewer): T[] {
69
+ return blocks
70
+ .filter(block => visibleTo(block.options?.visibility, viewer))
71
+ .map((block) => {
72
+ if (!block.children) {
73
+ return block;
74
+ }
75
+ return {
76
+ ...block,
77
+ children: Object.fromEntries(
78
+ Object.entries(block.children).map(([field, list]) => [field, filterBlocksForViewer(list, viewer)]),
79
+ ),
80
+ };
81
+ });
82
+ }
83
+
84
+ /** The purposes a consent state allows, as the codes the pages app is given. */
85
+ export function grantedPurposes(purposes: Record<string, string> | undefined | null): string[] {
86
+ return codeList(Object.entries(purposes ?? {})
87
+ .filter(([, decision]) => decision === "granted")
88
+ .map(([code]) => code)).sort();
89
+ }
90
+
91
+ export type PopupTrigger = "exit_intent" | "delay_seconds" | "scroll_percent";
92
+ export type PopupFrequency = "once_per_session" | "once_per_day" | "every_page";
93
+
94
+ /** Whether a pop-up with this frequency may open again, given when it last opened. */
95
+ export function popupMayOpen(
96
+ frequency: PopupFrequency,
97
+ lastShown: { session: boolean; at: number | null },
98
+ now: number,
99
+ ): boolean {
100
+ if (frequency === "every_page") {
101
+ return true;
102
+ }
103
+ if (frequency === "once_per_session") {
104
+ return !lastShown.session;
105
+ }
106
+ return lastShown.at === null || now - lastShown.at >= 24 * 60 * 60 * 1000;
107
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * What a buyer coming back from a payment provider is told (FE-5), from the
3
+ * payment's status as the payments app answers it after the confirm. Shared by
4
+ * the BFF route that confirms and the return page that shows the outcome.
5
+ *
6
+ * - `paid` — the money is held or taken: the order confirmation.
7
+ * - `failed` — declined, cancelled at the provider, expired: nothing was
8
+ * taken, the order is not paid, and it can be paid again.
9
+ * - `pending` — the provider has not decided yet (or still waits for the
10
+ * buyer): the payment is being processed.
11
+ * - `retry` — the buyer left the provider's page without paying, and the
12
+ * payment still waits for them with its page (`requires_action`
13
+ * with a redirect): offered again, as the same payment.
14
+ * - `unverified` — the payments app could not verify the return (a checksum
15
+ * that does not match, a transaction for another amount or
16
+ * payment): nothing moved, the order is not paid, and the buyer
17
+ * is told the payment could not be verified. Never decided from a
18
+ * status — only from the payments app refusing the confirm.
19
+ */
20
+ export type PspReturnOutcome = "paid" | "failed" | "pending" | "retry" | "unverified";
21
+
22
+ const PAID = new Set(["authorized", "captured", "succeeded", "paid"]);
23
+ const FAILED = new Set(["failed", "cancelled", "canceled", "expired"]);
24
+
25
+ export function pspReturnOutcome(status: string | null | undefined): Exclude<PspReturnOutcome, "retry" | "unverified"> {
26
+ const s = String(status ?? "").toLowerCase();
27
+ if (PAID.has(s)) {
28
+ return "paid";
29
+ }
30
+ if (FAILED.has(s)) {
31
+ return "failed";
32
+ }
33
+ return "pending";
34
+ }
35
+
36
+ /** The query parameter the payments app appends to the return address: the payment's id. */
37
+ export const PSP_RETURN_PAYMENT_PARAM = "rx_payment";
38
+ /** The query parameter the BFF puts on the return address: the order's number. */
39
+ export const PSP_RETURN_ORDER_PARAM = "order";
40
+
41
+ /**
42
+ * The provider's return parameters as they may travel to the payments app:
43
+ * every query parameter, strings only (the first of a repeated one), bounded
44
+ * in count and length. The provider's own names are kept verbatim — the
45
+ * payments app verifies them (Novalnet: tid, status, checksum, txn_secret).
46
+ */
47
+ export function pspReturnParams(query: Record<string, unknown>): Record<string, string> {
48
+ const out: Record<string, string> = {};
49
+ let count = 0;
50
+ for (const [key, raw] of Object.entries(query)) {
51
+ if (count >= 50 || key.length > 128) {
52
+ continue;
53
+ }
54
+ const value = Array.isArray(raw) ? raw[0] : raw;
55
+ if (typeof value !== "string" || value.length > 4096) {
56
+ continue;
57
+ }
58
+ out[key] = value;
59
+ count += 1;
60
+ }
61
+ return out;
62
+ }
@@ -71,8 +71,18 @@
71
71
  "failed": "Entscheidung nicht möglich",
72
72
  "empty": {
73
73
  "title": "Nichts wartet auf Sie",
74
- "description": "Sobald eine Anfrage Ihre Freigabe braucht, erscheint sie hier."
75
- }
74
+ "description": "Sobald eine Anfrage oder Bestellung Ihre Freigabe braucht, erscheint sie hier."
75
+ },
76
+ "order": "Bestellung {number}",
77
+ "review": "Ansehen",
78
+ "declineOrderTitle": "Bestellung ablehnen",
79
+ "declineOrderIntro": "Die Bestellung wird storniert. Die bestellende Person sieht Ihren Grund.",
80
+ "reasonRequired": "Bitte geben Sie einen Grund an."
81
+ },
82
+ "order": {
83
+ "title": "Bestellung {number}",
84
+ "requestedBy": "Bestellt von {name}",
85
+ "notPending": "Diese Bestellung wartet nicht mehr auf eine Entscheidung."
76
86
  }
77
87
  },
78
88
  "payments": {
@@ -123,7 +133,11 @@
123
133
  "approval-pending": "Freigabe ausstehend",
124
134
  "shipped": "Versendet",
125
135
  "delivered": "Geliefert",
126
- "cancelled": "Storniert"
136
+ "cancelled": "Storniert",
137
+ "rejected": "Abgelehnt"
138
+ },
139
+ "rejected": {
140
+ "title": "Diese Bestellung wurde nicht freigegeben"
127
141
  },
128
142
  "payment": {
129
143
  "open": "Zahlung offen",
@@ -270,7 +284,7 @@
270
284
  "orderTemplates": "Bestellvorlagen",
271
285
  "projects": "Projekte",
272
286
  "devices": "Geräte",
273
- "points": "Punkte",
287
+ "points": "Treueprogramm",
274
288
  "configurations": "Konfigurationen",
275
289
  "inquiries": "Anfragen",
276
290
  "quotes": "Angebote",
@@ -339,7 +353,8 @@
339
353
  "organization": { "description": "Ihre Organisation verwalten" },
340
354
  "team": { "description": "Zugänge und Rollen" },
341
355
  "preferences": { "description": "Vorgaben für Ihre Bestellungen" },
342
- "addresses": { "description": "Liefer- und Rechnungsadressen" }
356
+ "addresses": { "description": "Liefer- und Rechnungsadressen" },
357
+ "points": { "description": "Stufe, Vorteile und Bonus" }
343
358
  },
344
359
  "comingSoon": {
345
360
  "title": "In Entwicklung",
@@ -276,13 +276,15 @@
276
276
  "place": "Nur {available} Stück verfügbar. Der Rest wird nachgeliefert.",
277
277
  "drop": "Nur {available} Stück verfügbar. Diese Position entfällt bei der Bestellung.",
278
278
  "refuse": "Nur {available} Stück verfügbar. Solange diese Position im Warenkorb liegt, kann nicht bestellt werden."
279
- }
279
+ },
280
+ "unitChanged": "{sku} ist nicht in {sent} erhältlich. Auf {unit} umgestellt."
280
281
  },
281
282
  "messages": {
282
283
  "costCentersUnassigned": "Sie haben keine Kostenstellen, bitte wenden Sie sich an Ihren Organisationsadministrator.",
283
284
  "positionsNotOrderable": "{count} Position(en) sind derzeit nicht bestellbar. Bitte passen Sie die Menge an oder entfernen Sie sie.",
284
285
  "positionsWillBeDropped": "{count} Position(en) sind nicht bestellbar und entfallen bei der Bestellung.",
285
- "costCenterRequired": "Bitte wählen Sie für alle Positionen eine Kostenstelle aus."
286
+ "costCenterRequired": "Bitte wählen Sie für alle Positionen eine Kostenstelle aus.",
287
+ "unitsChanged": "Bei einigen Positionen wurde die Einheit umgestellt. Bitte prüfen Sie deren Mengen."
286
288
  },
287
289
  "incentives": {
288
290
  "freeShipping": "versandkostenfreie Lieferung",
@@ -1,4 +1,34 @@
1
1
  {
2
+ "paymentReturn": {
3
+ "title": "Zahlung",
4
+ "checking": "Wir prüfen Ihre Zahlung …",
5
+ "toShop": "Zum Shop",
6
+ "toOrder": "Zur Bestellung",
7
+ "failed": {
8
+ "title": "Die Zahlung ist nicht durchgegangen",
9
+ "text": "Ihre Bestellung {id} wurde nicht bezahlt. Es wurde nichts abgebucht.",
10
+ "payAgain": "Erneut bezahlen",
11
+ "guestHint": "Bitte kontaktieren Sie uns mit Ihrer Bestellnummer, wenn Sie die Bestellung bezahlen möchten."
12
+ },
13
+ "retry": {
14
+ "title": "Zahlung nicht abgeschlossen",
15
+ "text": "Sie haben die Zahlung für Ihre Bestellung {id} nicht abgeschlossen. Es wurde nichts abgebucht. Sie können sie jetzt erneut beim Zahlungsanbieter vornehmen.",
16
+ "again": "Erneut zur Zahlung"
17
+ },
18
+ "pending": {
19
+ "title": "Ihre Zahlung wird verarbeitet",
20
+ "text": "Der Zahlungsanbieter hat die Zahlung für Ihre Bestellung {id} noch nicht abgeschlossen. Sie erhalten eine Bestätigung, sobald sie eingegangen ist.",
21
+ "checkAgain": "Erneut prüfen"
22
+ },
23
+ "unverified": {
24
+ "title": "Ihre Zahlung konnte nicht bestätigt werden",
25
+ "text": "Wir konnten die Zahlung für Ihre Bestellung {id} nicht bestätigen. Die Bestellung ist nicht als bezahlt vermerkt. Bitte kontaktieren Sie uns mit Ihrer Bestellnummer."
26
+ },
27
+ "error": {
28
+ "title": "Wir konnten Ihre Zahlung nicht prüfen",
29
+ "text": "Bitte versuchen Sie es später erneut oder kontaktieren Sie uns. Eine erfolgreiche Zahlung geht dadurch nicht verloren."
30
+ }
31
+ },
2
32
  "confirmation": {
3
33
  "order": {
4
34
  "title": "Bestellung bestätigt!",
@@ -131,6 +161,8 @@
131
161
  "poNumberPlaceholder": "Bestellnummer eingeben...",
132
162
  "costCenter": "Kostenstelle",
133
163
  "cardDetails": "Kartendaten",
164
+ "cardOnProviderPage": "Sie geben Ihre Kartendaten nach dem Absenden auf der Zahlungsseite des Anbieters ein.",
165
+ "cardFieldUnavailable": "Das Kartenfeld ist gerade nicht verfügbar. Bitte versuchen Sie es erneut oder wählen Sie eine andere Zahlungsart.",
134
166
  "change": "Ändern",
135
167
  "noMethod": "Keine Zahlungsmethode ausgewählt",
136
168
  "confirm": "Bestätigen",
@@ -124,6 +124,16 @@
124
124
  },
125
125
  "design": {
126
126
  "title": "Shop-Design",
127
+ "logo": "Logo",
128
+ "logoHint": "URL oder Pfad im Medienspeicher. Erscheint in Header, Footer und Checkout; leer lässt das Theme-Logo stehen.",
129
+ "favicon": "Favicon",
130
+ "faviconHint": "Quadratisches Bild, mindestens 180 × 180 px. Daraus entstehen die Icons für Browser-Tabs und Homescreens; leer lässt das Theme-Favicon stehen.",
131
+ "upload": "Bild hochladen",
132
+ "uploading": "Lädt hoch …",
133
+ "uploadFailed": "Das Bild konnte nicht hochgeladen werden.",
134
+ "uploadUnavailable": "Hochladen ist hier nicht verfügbar: Es ist kein Medienspeicher konfiguriert. Bitte eine URL eintragen.",
135
+ "logoRejected": "Gespeichert, aber nicht verwendet: Das ist weder eine URL noch ein Storage-Pfad. Der Shop zeigt weiter das bisherige Logo.",
136
+ "faviconRejected": "Gespeichert, aber nicht verwendet: Das ist weder eine URL noch ein Storage-Pfad. Der Shop behält das Theme-Favicon.",
127
137
  "brand": "Markenfarbe",
128
138
  "neutral": "Neutralfarbe",
129
139
  "radius": "Eckenradius",
@@ -0,0 +1,71 @@
1
+ {
2
+ "marketing": {
3
+ "link": {
4
+ "unknownTitle": "Dieser Link funktioniert nicht",
5
+ "unknownText": "Wir kennen diesen Link nicht. Prüfen Sie, ob er vollständig kopiert wurde, oder nehmen Sie den Link aus der neuesten E-Mail.",
6
+ "expiredTitle": "Dieser Link ist abgelaufen",
7
+ "errorTitle": "Das hat nicht geklappt",
8
+ "errorText": "Bitte versuchen Sie es in ein paar Minuten noch einmal.",
9
+ "toShop": "Zum Shop"
10
+ },
11
+ "confirm": {
12
+ "title": "Anmeldung bestätigen",
13
+ "working": "Wir bestätigen Ihre Anmeldung …",
14
+ "doneTitle": "Anmeldung bestätigt",
15
+ "doneText": "Danke. Ab jetzt erhalten Sie unsere E-Mails. Abmelden können Sie sich jederzeit über den Link in jeder E-Mail.",
16
+ "alreadyText": "Diese Anmeldung war schon bestätigt. Sie müssen nichts weiter tun.",
17
+ "expiredText": "Bestätigungslinks gelten nur einige Tage. Melden Sie sich bitte noch einmal an, dann schicken wir Ihnen einen neuen."
18
+ },
19
+ "preferences": {
20
+ "title": "E-Mail-Einstellungen",
21
+ "intro": "Hier legen Sie fest, welche E-Mails wir an {address} schicken.",
22
+ "save": "Einstellungen speichern",
23
+ "saved": "Ihre Einstellungen sind gespeichert.",
24
+ "requested": "Für {types} schicken wir Ihnen eine E-Mail. Erst wenn Sie den Link darin bestätigen, ist die Anmeldung aktiv.",
25
+ "unsubscribeAll": "Von allen E-Mails abmelden",
26
+ "unsubscribedAll": "Sie sind von allen E-Mails abgemeldet. Sie erhalten nur noch Nachrichten zu Ihren Bestellungen.",
27
+ "empty": "Für diese Adresse gibt es keine E-Mails, die Sie wählen können.",
28
+ "expiredText": "Nehmen Sie den Link aus der neuesten E-Mail, die Sie von uns bekommen haben."
29
+ },
30
+ "review": {
31
+ "title": "Ihre Bewertung",
32
+ "intro": "Wie zufrieden sind Sie mit den Artikeln aus Bestellung {order}? Bewerten Sie so viele, wie Sie möchten.",
33
+ "introNoOrder": "Wie zufrieden sind Sie mit Ihren Artikeln? Bewerten Sie so viele, wie Sie möchten.",
34
+ "rating": "Bewertung für {name}",
35
+ "star": "{count} von 5 Sternen",
36
+ "titleField": "Überschrift (optional)",
37
+ "bodyField": "Ihre Erfahrung (optional)",
38
+ "reviewed": "Schon bewertet",
39
+ "submit": "Bewertungen senden",
40
+ "nothingRated": "Wählen Sie für mindestens einen Artikel eine Sternebewertung.",
41
+ "doneTitle": "Danke für Ihre Bewertung",
42
+ "doneText": "Wir prüfen jede Bewertung, bevor sie im Shop erscheint.",
43
+ "partlyRejected": "{count} Bewertung(en) konnten wir nicht annehmen, zum Beispiel weil der Artikel schon bewertet war.",
44
+ "allDone": "Sie haben alle Artikel dieser Bestellung bewertet. Danke!",
45
+ "expiredText": "Bewertungslinks gelten nur eine Zeit lang. Sie können den Artikel weiterhin auf seiner Produktseite finden."
46
+ },
47
+ "loyalty": {
48
+ "title": "Treueprogramm",
49
+ "description": "Ihre Stufe, Ihre Vorteile und wie weit Sie in diesem Jahr sind.",
50
+ "none": "Sie nehmen an keinem Treueprogramm teil.",
51
+ "error": "Ihr Treueprogramm lässt sich gerade nicht laden.",
52
+ "tier": "Ihre Stufe",
53
+ "perks": "Ihre Vorteile",
54
+ "points": "Punktestand",
55
+ "pointsValue": "{points} Punkte",
56
+ "progressTitle": "Bonus {period}",
57
+ "turnoverYtd": "Umsatz bisher",
58
+ "projected": "Hochrechnung zum Jahresende",
59
+ "bonusNow": "Bonus nach heutigem Stand",
60
+ "expectedBonus": "Erwarteter Bonus",
61
+ "nextTier": "Noch {gap} bis {tier} ({percent} % Bonus).",
62
+ "topTier": "Sie haben die höchste Stufe erreicht.",
63
+ "stage": "{tier}: ab {threshold}, {percent} % Bonus",
64
+ "reached": "erreicht",
65
+ "current": "aktuell",
66
+ "rules": "Der Bonus gilt für den gesamten Jahresumsatz in der erreichten Stufe, nicht gestaffelt. Ausgezahlt wird nach Abschluss des Geschäftsjahres.",
67
+ "rulesOverdue": "Voraussetzung ist, dass alle fälligen Rechnungen bezahlt sind.",
68
+ "perkHint": "Ihr Vorteil als {tier}:"
69
+ }
70
+ }
71
+ }