@revenexx/cover 0.2.5 → 0.2.7

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.
@@ -186,6 +186,7 @@
186
186
  "iotDevices": "IoT-Geräte",
187
187
  "catalogs": "Kataloge",
188
188
  "accountSettings": "Stammdaten",
189
+ "organization": "Firmendaten",
189
190
  "addresses": "Adressen",
190
191
  "users": "Benutzer",
191
192
  "roles": "Rollen",
@@ -458,5 +459,69 @@
458
459
  "alwaysActive": "Immer in den aktiven Warenkorb legen",
459
460
  "alwaysActiveHint": "Beim Hinzufügen von Artikeln wird nicht mehr gefragt, in welchen Warenkorb die Position gelegt werden soll.",
460
461
  "saved": "Einstellung gespeichert"
462
+ },
463
+ "organization": {
464
+ "title": "Firmendaten",
465
+ "description": "Daten Ihres Unternehmens ansehen und bearbeiten.",
466
+ "companySection": "Unternehmen",
467
+ "edit": "Bearbeiten",
468
+ "editTitle": "Firmendaten bearbeiten",
469
+ "save": "Speichern",
470
+ "cancel": "Abbrechen",
471
+ "saved": "Firmendaten gespeichert",
472
+ "saveError": "Speichern fehlgeschlagen",
473
+ "errorTitle": "Firmendaten nicht verfügbar",
474
+ "errorDescription": "Die Firmendaten konnten nicht geladen werden.",
475
+ "fields": {
476
+ "name": "Firmenname",
477
+ "vatId": "USt-IdNr.",
478
+ "status": "Status"
479
+ },
480
+ "status": {
481
+ "active": "Aktiv",
482
+ "blocked": "Gesperrt"
483
+ },
484
+ "empty": {
485
+ "title": "Kein Unternehmen",
486
+ "description": "Ihr Konto ist keinem Unternehmen zugeordnet."
487
+ }
488
+ },
489
+ "team": {
490
+ "title": "Benutzer",
491
+ "description": "Verwalten Sie die Benutzer Ihres Unternehmens und deren Rollen.",
492
+ "searchPlaceholder": "Nach Name, E-Mail oder Rolle suchen …",
493
+ "invite": "Benutzer einladen",
494
+ "inviteTitle": "Benutzer einladen",
495
+ "editTitle": "Rolle ändern",
496
+ "primary": "Hauptkontakt",
497
+ "firstName": "Vorname",
498
+ "lastName": "Nachname",
499
+ "save": "Speichern",
500
+ "cancel": "Abbrechen",
501
+ "saved": "Gespeichert",
502
+ "saveError": "Speichern fehlgeschlagen",
503
+ "errorTitle": "Benutzer nicht verfügbar",
504
+ "errorDescription": "Die Benutzer konnten nicht geladen werden.",
505
+ "columns": {
506
+ "name": "Name",
507
+ "email": "E-Mail",
508
+ "role": "Rolle",
509
+ "status": "Status"
510
+ },
511
+ "roles": {
512
+ "buyer": "Einkäufer",
513
+ "approver": "Genehmiger",
514
+ "admin": "Administrator",
515
+ "requester": "Anforderer"
516
+ },
517
+ "statuses": {
518
+ "invited": "Eingeladen",
519
+ "active": "Aktiv",
520
+ "blocked": "Gesperrt"
521
+ },
522
+ "empty": {
523
+ "title": "Keine Benutzer",
524
+ "description": "Laden Sie über „Benutzer einladen“ den ersten Benutzer ein."
525
+ }
461
526
  }
462
527
  }
@@ -186,6 +186,7 @@
186
186
  "iotDevices": "IoT devices",
187
187
  "catalogs": "Catalogs",
188
188
  "accountSettings": "Master data",
189
+ "organization": "Company",
189
190
  "addresses": "Addresses",
190
191
  "users": "Users",
191
192
  "roles": "Roles",
@@ -458,5 +459,69 @@
458
459
  "alwaysActive": "Always add to the active cart",
459
460
  "alwaysActiveHint": "Adding articles no longer asks which cart the item should go to.",
460
461
  "saved": "Setting saved"
462
+ },
463
+ "organization": {
464
+ "title": "Company",
465
+ "description": "View and edit your company details.",
466
+ "companySection": "Company",
467
+ "edit": "Edit",
468
+ "editTitle": "Edit company details",
469
+ "save": "Save",
470
+ "cancel": "Cancel",
471
+ "saved": "Company details saved",
472
+ "saveError": "Save failed",
473
+ "errorTitle": "Company details unavailable",
474
+ "errorDescription": "The company details could not be loaded.",
475
+ "fields": {
476
+ "name": "Company name",
477
+ "vatId": "VAT ID",
478
+ "status": "Status"
479
+ },
480
+ "status": {
481
+ "active": "Active",
482
+ "blocked": "Blocked"
483
+ },
484
+ "empty": {
485
+ "title": "No company",
486
+ "description": "Your account is not linked to a company."
487
+ }
488
+ },
489
+ "team": {
490
+ "title": "Users",
491
+ "description": "Manage your company's users and their roles.",
492
+ "searchPlaceholder": "Search by name, email or role…",
493
+ "invite": "Invite user",
494
+ "inviteTitle": "Invite user",
495
+ "editTitle": "Change role",
496
+ "primary": "Primary contact",
497
+ "firstName": "First name",
498
+ "lastName": "Last name",
499
+ "save": "Save",
500
+ "cancel": "Cancel",
501
+ "saved": "Saved",
502
+ "saveError": "Save failed",
503
+ "errorTitle": "Users unavailable",
504
+ "errorDescription": "The users could not be loaded.",
505
+ "columns": {
506
+ "name": "Name",
507
+ "email": "Email",
508
+ "role": "Role",
509
+ "status": "Status"
510
+ },
511
+ "roles": {
512
+ "buyer": "Buyer",
513
+ "approver": "Approver",
514
+ "admin": "Admin",
515
+ "requester": "Requester"
516
+ },
517
+ "statuses": {
518
+ "invited": "Invited",
519
+ "active": "Active",
520
+ "blocked": "Blocked"
521
+ },
522
+ "empty": {
523
+ "title": "No users",
524
+ "description": "Invite the first user via “Invite user”."
525
+ }
461
526
  }
462
527
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Cover — revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -38,7 +38,7 @@
38
38
  "@formkit/vue": "^1.6.0",
39
39
  "@iconify-json/lucide": "^1.2.111",
40
40
  "@internationalized/date": "^3.12.0",
41
- "@revenexx/sdk": "^0.0.10",
41
+ "@revenexx/sdk": "^0.0.11",
42
42
  "@revenexx/storage-model-viewer": "^0.3.0",
43
43
  "@vueuse/core": "^14.3.0",
44
44
  "typesense": "^3.0.5"
@@ -0,0 +1,5 @@
1
+ import type { AccountOrganizationResponse } from "../../../app/interfaces/account/organization";
2
+
3
+ export default defineEventHandler(async (event): Promise<AccountOrganizationResponse> => {
4
+ return { organization: await getOrganizationService(event).get(event) };
5
+ });
@@ -0,0 +1,9 @@
1
+ import type { AccountOrganization, AccountOrganizationFormState } from "../../../app/interfaces/account/organization";
2
+
3
+ export default defineEventHandler(async (event): Promise<AccountOrganization> => {
4
+ const body = await readBody<AccountOrganizationFormState>(event);
5
+ return getOrganizationService(event).update(event, {
6
+ name: String(body?.name ?? "").trim(),
7
+ vatId: String(body?.vatId ?? "").trim(),
8
+ });
9
+ });
@@ -0,0 +1,21 @@
1
+ import type { AccountTeamMember, AccountTeamRole } from "../../../../app/interfaces/account/team";
2
+
3
+ interface TeamUpdateBody {
4
+ readonly role?: unknown;
5
+ }
6
+
7
+ const ROLES: AccountTeamRole[] = ["buyer", "approver", "admin", "requester"];
8
+
9
+ export default defineEventHandler(async (event): Promise<AccountTeamMember> => {
10
+ const id = getRouterParam(event, "id");
11
+ if (!id) {
12
+ throw createError({ statusCode: 400, statusMessage: "Missing member id" });
13
+ }
14
+
15
+ const body = await readBody<TeamUpdateBody>(event);
16
+ if (!ROLES.includes(body.role as AccountTeamRole)) {
17
+ throw createError({ statusCode: 422, statusMessage: "Invalid role" });
18
+ }
19
+
20
+ return getTeamService(event).update(event, id, { role: body.role as AccountTeamRole });
21
+ });
@@ -0,0 +1,5 @@
1
+ import type { AccountTeamResponse } from "../../../app/interfaces/account/team";
2
+
3
+ export default defineEventHandler(async (event): Promise<AccountTeamResponse> => {
4
+ return { members: await getTeamService(event).list(event) };
5
+ });
@@ -0,0 +1,21 @@
1
+ import type { AccountTeamMember, AccountTeamMemberFormState, AccountTeamRole } from "../../../app/interfaces/account/team";
2
+
3
+ const ROLES: AccountTeamRole[] = ["buyer", "approver", "admin", "requester"];
4
+
5
+ function toRole(value: unknown): AccountTeamRole {
6
+ return ROLES.includes(value as AccountTeamRole) ? value as AccountTeamRole : "buyer";
7
+ }
8
+
9
+ export default defineEventHandler(async (event): Promise<AccountTeamMember> => {
10
+ const body = await readBody<Partial<AccountTeamMemberFormState>>(event);
11
+ const email = String(body?.email ?? "").trim();
12
+ if (!email) {
13
+ throw createError({ statusCode: 422, statusMessage: "email is required" });
14
+ }
15
+ return getTeamService(event).invite(event, {
16
+ email,
17
+ firstName: String(body?.firstName ?? "").trim(),
18
+ lastName: String(body?.lastName ?? "").trim(),
19
+ role: toRole(body?.role),
20
+ });
21
+ });
@@ -0,0 +1,16 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { AccountOrganization, AccountOrganizationFormState } from "../../app/interfaces/account/organization";
4
+
5
+ /**
6
+ * Service contract for the buyer's own company (organization) — the account
7
+ * organization page reads and edits it.
8
+ * - "mock" — bundled demo company (account/organization.json)
9
+ * - "api" — the contact's organization in the customers app via the public API
10
+ * Register the active implementation via app.config → organizationService.
11
+ */
12
+ export interface IOrganizationService {
13
+ /** The signed-in contact's organization, or null when the session carries none. */
14
+ get(event: H3Event): Promise<AccountOrganization | null>;
15
+ update(event: H3Event, input: AccountOrganizationFormState): Promise<AccountOrganization>;
16
+ }
@@ -0,0 +1,17 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { AccountTeamMember, AccountTeamMemberFormState, AccountTeamRole } from "../../app/interfaces/account/team";
4
+
5
+ /**
6
+ * Service contract for the buyer's company team (contacts) — the account
7
+ * team page lists members, invites new ones and changes their role.
8
+ * - "mock" — bundled demo members (kept in-memory for the process lifetime)
9
+ * - "api" — the organization's contacts in the customers app via the public API
10
+ * Register the active implementation via app.config → contactsService.
11
+ */
12
+ export interface ITeamService {
13
+ /** The signed-in contact's organization members. */
14
+ list(event: H3Event): Promise<AccountTeamMember[]>;
15
+ invite(event: H3Event, input: AccountTeamMemberFormState): Promise<AccountTeamMember>;
16
+ update(event: H3Event, id: string, patch: { role: AccountTeamRole }): Promise<AccountTeamMember>;
17
+ }
@@ -75,12 +75,12 @@ export class ApiAddressBookService implements IAddressBookService {
75
75
  return [];
76
76
  }
77
77
  try {
78
- // Raw call: the list contract does not declare query params yet.
79
- const { items } = await useRevenexxSdk().call<{ items: ApiAddressRow[] }>(
80
- "GET",
81
- "/v1/customers/addresses",
82
- { query: { contact_id, limit: 200 } },
83
- );
78
+ // Typed list filter (customers.addresses.list declares its query
79
+ // params — @revenexx/sdk >= 0.0.11).
80
+ const { items } = await useRevenexxSdk().customers.customersAddressesList({
81
+ contactId: contact_id,
82
+ limit: 200,
83
+ }) as unknown as { items: ApiAddressRow[] };
84
84
  return items.map(toAccountAddress);
85
85
  }
86
86
  catch (err) {
@@ -58,10 +58,6 @@ function resolveOwner(event: H3Event): CartOwner {
58
58
  return { contactId, sessionKey: getOrCreateCartSessionId(event) };
59
59
  }
60
60
 
61
- function ownerQuery(owner: CartOwner): Record<string, string> {
62
- return owner.contactId ? { contact_id: owner.contactId } : { session_key: owner.sessionKey };
63
- }
64
-
65
61
  /** Storefront CartItem → carts-app line. The snapshot is the loose product copy. */
66
62
  function toApiLine(item: CartItem, position: number): Record<string, unknown> {
67
63
  return {
@@ -138,16 +134,13 @@ function toSummary(cart: ApiCart): CartSummaryRow {
138
134
  */
139
135
  export class ApiCartService implements ICartService, ICartManager {
140
136
  private async listActive(owner: CartOwner): Promise<ApiCart[]> {
141
- // Raw call: carts.list does not declare its query parameters in the
142
- // contract yet, so the generated cartsList() cannot filter by owner.
143
- const { items } = await useRevenexxSdk().call<{ items: ApiCart[] }>("GET", "/v1/carts", {
144
- query: {
145
- ...ownerQuery(owner),
146
- status: "active",
147
- limit: 100,
148
- order: "updated_at.desc",
149
- },
150
- });
137
+ // Typed list filter (carts.list declares its query params — @revenexx/sdk >= 0.0.11).
138
+ const { items } = await useRevenexxSdk().carts.cartsList({
139
+ ...(owner.contactId ? { contactId: owner.contactId } : { sessionKey: owner.sessionKey }),
140
+ status: "active",
141
+ limit: 100,
142
+ order: "updated_at.desc",
143
+ }) as unknown as { items: ApiCart[] };
151
144
  return items;
152
145
  }
153
146
 
@@ -0,0 +1,68 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { AccountOrganization, AccountOrganizationFormState } from "../../app/interfaces/account/organization";
4
+
5
+ import type { IOrganizationService } from "../interfaces/organization";
6
+
7
+ /** Raw organization row from the customers app (snake_case API shape). */
8
+ interface ApiOrgRow {
9
+ id: string;
10
+ name: string | null;
11
+ vat_id: string | null;
12
+ status: string | null;
13
+ }
14
+
15
+ function toAccountOrganization(row: ApiOrgRow): AccountOrganization {
16
+ return {
17
+ id: row.id,
18
+ name: row.name ?? "",
19
+ vatId: row.vat_id ?? "",
20
+ status: row.status === "blocked" ? "blocked" : "active",
21
+ };
22
+ }
23
+
24
+ /**
25
+ * Live company data: the signed-in contact's organization in the customers
26
+ * app. The organization id comes from the session cookie (auth/me link);
27
+ * contacts without an organization (private buyers) have none.
28
+ */
29
+ export class ApiOrganizationService implements IOrganizationService {
30
+ async get(event: H3Event): Promise<AccountOrganization | null> {
31
+ const { organization_id } = sessionOrderRefs(event);
32
+ if (!organization_id) {
33
+ return null;
34
+ }
35
+ try {
36
+ const row = await useRevenexxSdk().customers.customersOrganizationsGet({
37
+ id: organization_id,
38
+ }) as unknown as ApiOrgRow;
39
+ return toAccountOrganization(row);
40
+ }
41
+ catch (err) {
42
+ getLogService().error("API request failed: organization/get", apiErrorContext(err));
43
+ throw createError({ statusCode: 502, statusMessage: "Organization service unavailable" });
44
+ }
45
+ }
46
+
47
+ async update(event: H3Event, input: AccountOrganizationFormState): Promise<AccountOrganization> {
48
+ const { organization_id } = sessionOrderRefs(event);
49
+ if (!organization_id) {
50
+ throw createError({ statusCode: 401, statusMessage: "No organization in session" });
51
+ }
52
+ try {
53
+ const row = await useRevenexxSdk().customers.customersOrganizationsUpdate({
54
+ id: organization_id,
55
+ name: input.name,
56
+ vatId: input.vatId || undefined,
57
+ }) as unknown as ApiOrgRow;
58
+ return toAccountOrganization(row);
59
+ }
60
+ catch (err) {
61
+ if (err instanceof RevenexxException && (err.code === 400 || err.code === 422)) {
62
+ throw createError({ statusCode: 422, message: err.message });
63
+ }
64
+ getLogService().error("API request failed: organization/update", apiErrorContext(err));
65
+ throw createError({ statusCode: 502, statusMessage: "Organization service unavailable" });
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,106 @@
1
+ import type { ContactRole } from "@revenexx/sdk";
2
+ import type { H3Event } from "h3";
3
+
4
+ import type { AccountTeamMember, AccountTeamMemberFormState, AccountTeamRole, AccountTeamStatus } from "../../app/interfaces/account/team";
5
+
6
+ import type { ITeamService } from "../interfaces/team";
7
+
8
+ /** Raw contact row from the customers app (snake_case API shape). */
9
+ interface ApiContactRow {
10
+ id?: string;
11
+ organization_id?: string | null;
12
+ email?: string;
13
+ first_name?: string | null;
14
+ last_name?: string | null;
15
+ role?: string;
16
+ status?: string;
17
+ is_primary?: boolean;
18
+ }
19
+
20
+ const ROLES: AccountTeamRole[] = ["buyer", "approver", "admin", "requester"];
21
+ const STATUSES: AccountTeamStatus[] = ["invited", "active", "blocked"];
22
+
23
+ function toRole(value: string | undefined): AccountTeamRole {
24
+ return ROLES.includes(value as AccountTeamRole) ? value as AccountTeamRole : "buyer";
25
+ }
26
+
27
+ function toStatus(value: string | undefined): AccountTeamStatus {
28
+ return STATUSES.includes(value as AccountTeamStatus) ? value as AccountTeamStatus : "active";
29
+ }
30
+
31
+ function toAccountTeamMember(row: ApiContactRow): AccountTeamMember {
32
+ return {
33
+ id: row.id ?? "",
34
+ firstName: row.first_name ?? "",
35
+ lastName: row.last_name ?? "",
36
+ email: row.email ?? "",
37
+ role: toRole(row.role),
38
+ status: toStatus(row.status),
39
+ isPrimary: row.is_primary === true,
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Live team data: the contacts of the signed-in contact's organization in the
45
+ * customers app. The organization id comes from the session cookie (auth/me
46
+ * link); contacts without an organization (private buyers) get an empty list.
47
+ */
48
+ export class ApiTeamService implements ITeamService {
49
+ async list(event: H3Event): Promise<AccountTeamMember[]> {
50
+ const { organization_id } = sessionOrderRefs(event);
51
+ if (!organization_id) {
52
+ return [];
53
+ }
54
+ try {
55
+ const { items } = await useRevenexxSdk().customers.customersContactsList() as unknown as { items: ApiContactRow[] };
56
+ return (items ?? [])
57
+ .filter(row => row.organization_id === organization_id)
58
+ .map(toAccountTeamMember);
59
+ }
60
+ catch (err) {
61
+ getLogService().error("API request failed: team/list", apiErrorContext(err));
62
+ throw createError({ statusCode: 502, statusMessage: "Team service unavailable" });
63
+ }
64
+ }
65
+
66
+ async invite(event: H3Event, input: AccountTeamMemberFormState): Promise<AccountTeamMember> {
67
+ const { organization_id } = sessionOrderRefs(event);
68
+ if (!organization_id) {
69
+ throw createError({ statusCode: 401, statusMessage: "No organization in session" });
70
+ }
71
+ try {
72
+ const row = await useRevenexxSdk().customers.customersContactsCreate({
73
+ email: input.email,
74
+ firstName: input.firstName || undefined,
75
+ lastName: input.lastName || undefined,
76
+ role: input.role as ContactRole,
77
+ organizationId: organization_id,
78
+ }) as unknown as ApiContactRow;
79
+ return toAccountTeamMember(row);
80
+ }
81
+ catch (err) {
82
+ if (err instanceof RevenexxException && (err.code === 400 || err.code === 422)) {
83
+ throw createError({ statusCode: 422, message: err.message });
84
+ }
85
+ getLogService().error("API request failed: team/invite", apiErrorContext(err));
86
+ throw createError({ statusCode: 502, statusMessage: "Team service unavailable" });
87
+ }
88
+ }
89
+
90
+ async update(_event: H3Event, id: string, patch: { role: AccountTeamRole }): Promise<AccountTeamMember> {
91
+ try {
92
+ const row = await useRevenexxSdk().customers.customersContactsUpdate({
93
+ id,
94
+ role: patch.role as ContactRole,
95
+ }) as unknown as ApiContactRow;
96
+ return toAccountTeamMember(row);
97
+ }
98
+ catch (err) {
99
+ if (err instanceof RevenexxException && (err.code === 400 || err.code === 422)) {
100
+ throw createError({ statusCode: 422, message: err.message });
101
+ }
102
+ getLogService().error("API request failed: team/update", apiErrorContext(err));
103
+ throw createError({ statusCode: 502, statusMessage: "Team service unavailable" });
104
+ }
105
+ }
106
+ }
@@ -0,0 +1,29 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { AccountOrganization, AccountOrganizationFormState } from "../../app/interfaces/account/organization";
4
+
5
+ import type { IOrganizationService } from "../interfaces/organization";
6
+
7
+ /**
8
+ * Demo company: seeded from the bundled organization config, with edits kept
9
+ * in-memory for the process lifetime so the demo "save" round-trips visibly
10
+ * (the registry holds this as a singleton).
11
+ */
12
+ export class MockOrganizationService implements IOrganizationService {
13
+ private override: Partial<AccountOrganizationFormState> = {};
14
+
15
+ async get(_event: H3Event): Promise<AccountOrganization> {
16
+ const cfg = await readCoverConfigJson<{ name?: string }>("account/organization.json");
17
+ return {
18
+ id: "demo-org",
19
+ name: this.override.name ?? cfg.name ?? "Demo GmbH",
20
+ vatId: this.override.vatId ?? "DE123456789",
21
+ status: "active",
22
+ };
23
+ }
24
+
25
+ async update(event: H3Event, input: AccountOrganizationFormState): Promise<AccountOrganization> {
26
+ this.override = { name: input.name, vatId: input.vatId };
27
+ return this.get(event);
28
+ }
29
+ }
@@ -0,0 +1,48 @@
1
+ import type { H3Event } from "h3";
2
+
3
+ import type { AccountTeamMember, AccountTeamMemberFormState, AccountTeamRole } from "../../app/interfaces/account/team";
4
+
5
+ import type { ITeamService } from "../interfaces/team";
6
+
7
+ /**
8
+ * Demo team: a small set of seeded members kept in-memory for the process
9
+ * lifetime so the demo "invite" / "change role" round-trip visibly (the
10
+ * registry holds this as a singleton).
11
+ */
12
+ export class MockTeamService implements ITeamService {
13
+ private members: AccountTeamMember[] = [
14
+ { id: "demo-1", firstName: "Anna", lastName: "Berger", email: "anna.berger@demo-gmbh.de", role: "admin", status: "active", isPrimary: true },
15
+ { id: "demo-2", firstName: "Tobias", lastName: "Klein", email: "tobias.klein@demo-gmbh.de", role: "approver", status: "active", isPrimary: false },
16
+ { id: "demo-3", firstName: "Sara", lastName: "Vogel", email: "sara.vogel@demo-gmbh.de", role: "buyer", status: "invited", isPrimary: false },
17
+ ];
18
+
19
+ private nextId = 4;
20
+
21
+ async list(_event: H3Event): Promise<AccountTeamMember[]> {
22
+ return this.members;
23
+ }
24
+
25
+ async invite(_event: H3Event, input: AccountTeamMemberFormState): Promise<AccountTeamMember> {
26
+ const member: AccountTeamMember = {
27
+ id: `demo-${this.nextId++}`,
28
+ firstName: input.firstName,
29
+ lastName: input.lastName,
30
+ email: input.email,
31
+ role: input.role,
32
+ status: "invited",
33
+ isPrimary: false,
34
+ };
35
+ this.members = [...this.members, member];
36
+ return member;
37
+ }
38
+
39
+ async update(_event: H3Event, id: string, patch: { role: AccountTeamRole }): Promise<AccountTeamMember> {
40
+ const existing = this.members.find(m => m.id === id);
41
+ if (!existing) {
42
+ throw createError({ statusCode: 404, statusMessage: "Member not found" });
43
+ }
44
+ const updated: AccountTeamMember = { ...existing, role: patch.role };
45
+ this.members = this.members.map(m => (m.id === id ? updated : m));
46
+ return updated;
47
+ }
48
+ }
@@ -189,12 +189,13 @@ async function loadLiveCategoryRows(): Promise<LiveCategoryRow[]> {
189
189
  const rows: LiveCategoryRow[] = [];
190
190
  let offset = 0;
191
191
  // Paginate defensively — the demo tenant has a few hundred categories.
192
- // Raw call: the categories list contract does not declare limit/offset
193
- // yet, so the generated productsCategoriesList() cannot paginate.
192
+ // Typed list (products.categories.list declares limit/offset/order —
193
+ // @revenexx/sdk >= 0.0.11).
194
194
  for (let pageIndex = 0; pageIndex < 25; pageIndex++) {
195
- const page = await sdk.call<LiveCategoryPage>("GET", "/v1/products/categories", {
196
- query: { limit: CATEGORY_PAGE_LIMIT, offset },
197
- });
195
+ const page = await sdk.products.productsCategoriesList({
196
+ limit: CATEGORY_PAGE_LIMIT,
197
+ offset,
198
+ }) as unknown as LiveCategoryPage;
198
199
  rows.push(...page.items);
199
200
  if (!page.page.hasMore) {
200
201
  break;
@@ -9,9 +9,8 @@ import type { OrderList, OrderListPosition } from "../../app/interfaces/account/
9
9
  * service. Request params are camelCase (the SDK maps to the gateway's
10
10
  * snake_case); responses come back snake_case.
11
11
  *
12
- * Only the visibility-filtered LIST still uses the `sdk.call()` escape
13
- * hatch: `orderlistsList()` declares no query parameters in the contract
14
- * yet, so it cannot filter by owner/organization. Everything else is typed.
12
+ * The visibility-filtered LIST is typed too (orderlists.list declares
13
+ * owner_id/organization_id/kind since @revenexx/sdk >= 0.0.11).
15
14
  *
16
15
  * Identity: the app stores `owner_id`/`organization_id` and `GET /orderlists`
17
16
  * returns the owner's own lists ∪ the organization's shared lists. We supply
@@ -118,11 +117,12 @@ function toCoverList(row: AppList): OrderList {
118
117
  export async function listOrderLists(event: H3Event): Promise<OrderList[]> {
119
118
  const me = await actor(event);
120
119
  const sdk = useRevenexxSdk();
121
- // Escape hatch: orderlistsList() declares no query params, so it cannot
122
- // filter by owner/organization. The fan-out to full lists is typed.
123
- const { items } = await sdk.call<{ items: AppList[] }>("GET", "/v1/orderlists", {
124
- query: { owner_id: me.contactId, ...(me.organizationId ? { organization_id: me.organizationId } : {}) },
125
- });
120
+ // Typed list filter (orderlists.list declares owner_id/organization_id —
121
+ // @revenexx/sdk >= 0.0.11). The fan-out to full lists is typed too.
122
+ const { items } = await sdk.orderlists.orderlistsList({
123
+ ownerId: me.contactId,
124
+ ...(me.organizationId ? { organizationId: me.organizationId } : {}),
125
+ }) as unknown as { items: AppList[] };
126
126
  const full = await Promise.all(items.map(async row => sdk.orderlists.orderlistsGet({ id: row.id })));
127
127
  return full.map(row => toCoverList(row as unknown as AppList));
128
128
  }