@infuro/cms-core 1.0.44 → 1.0.46

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 (66) hide show
  1. package/README.md +19 -2
  2. package/dist/admin.cjs +1413 -620
  3. package/dist/admin.d.cts +8 -2
  4. package/dist/admin.d.ts +8 -2
  5. package/dist/admin.js +1414 -621
  6. package/dist/api.cjs +40 -37
  7. package/dist/api.d.cts +3 -1
  8. package/dist/api.d.ts +3 -1
  9. package/dist/api.js +8 -5
  10. package/dist/auth.cjs +23 -23
  11. package/dist/auth.d.cts +1 -0
  12. package/dist/auth.d.ts +1 -0
  13. package/dist/auth.js +2 -2
  14. package/dist/chunk-2KUCQVAQ.js +936 -0
  15. package/dist/chunk-3K5AIEIZ.js +256 -0
  16. package/dist/{chunk-I6NH72MO.js → chunk-57O3HZPG.js} +9 -1
  17. package/dist/chunk-7PMHZRF3.cjs +872 -0
  18. package/dist/chunk-BXYZDMTZ.cjs +953 -0
  19. package/dist/chunk-CQHXW4TR.js +107 -0
  20. package/dist/{chunk-NNQBWDCI.js → chunk-CRYKVJTO.js} +55 -959
  21. package/dist/chunk-DBPSJYLZ.js +47 -0
  22. package/dist/{chunk-TAHX46EI.cjs → chunk-FBKDMRQL.cjs} +9 -1
  23. package/dist/chunk-GUSHM5HN.js +862 -0
  24. package/dist/chunk-HY3AXLOI.cjs +265 -0
  25. package/dist/chunk-L3525VXI.js +243 -0
  26. package/dist/{chunk-ZMRQ72F6.cjs → chunk-NBY4NVTY.cjs} +3 -3
  27. package/dist/chunk-OY2YTBMP.cjs +50 -0
  28. package/dist/{chunk-BLR6H5GL.js → chunk-SF2XKMCI.js} +3 -3
  29. package/dist/{chunk-22FFHLTO.cjs → chunk-TCSGFAWB.cjs} +56 -970
  30. package/dist/{chunk-P2IWWBJV.cjs → chunk-UDVLFVEC.cjs} +1314 -601
  31. package/dist/{chunk-SQGBHYJF.js → chunk-UKC3HYXI.js} +1245 -548
  32. package/dist/chunk-V25RDUOU.cjs +248 -0
  33. package/dist/chunk-XMRMZ6NQ.cjs +109 -0
  34. package/dist/cli.cjs +9 -4
  35. package/dist/cli.js +9 -4
  36. package/dist/{email-queue-TPZWLTIV.cjs → email-queue-6NJY6HNM.cjs} +7 -5
  37. package/dist/email-queue-OI2HSCGE.js +4 -0
  38. package/dist/erp-order-invoice-3GXDE443.js +3 -0
  39. package/dist/erp-order-invoice-EYYNR526.cjs +24 -0
  40. package/dist/index.cjs +426 -359
  41. package/dist/index.d.cts +308 -20
  42. package/dist/index.d.ts +308 -20
  43. package/dist/index.js +31 -110
  44. package/dist/migrations/1781800000000-CustomerPhoneNullable.ts +53 -0
  45. package/dist/migrations/1781810000000-OrderItemsVariantId.ts +44 -0
  46. package/dist/migrations/1781900000000-UserInviteStatusToken.ts +46 -0
  47. package/dist/migrations/1782000000000-ComboSlug.ts +58 -0
  48. package/dist/migrations/1782100000000-DiscountDeviceType.ts +20 -0
  49. package/dist/order-inventory-2MYRKEPC.cjs +39 -0
  50. package/dist/order-inventory-76V4XIGW.js +2 -0
  51. package/dist/order-notification-dispatcher-SBQAMM5V.cjs +21 -0
  52. package/dist/{order-notification-dispatcher-XWIJYDGA.js → order-notification-dispatcher-ZJZB2HUN.js} +5 -2
  53. package/dist/retire-soft-deleted-unique-5VXBA5XX.cjs +15 -0
  54. package/dist/retire-soft-deleted-unique-NXQIH4BC.js +2 -0
  55. package/dist/send-order-placed-emails-B5ZVJT7T.cjs +15 -0
  56. package/dist/send-order-placed-emails-WPI37KRZ.js +6 -0
  57. package/package.json +5 -4
  58. package/src/admin/admin.css +27 -24
  59. package/dist/chunk-5ELSW2UP.js +0 -150
  60. package/dist/chunk-PNOKNSG2.cjs +0 -222
  61. package/dist/chunk-WEMDMVHQ.js +0 -216
  62. package/dist/chunk-XW5ATPRW.cjs +0 -155
  63. package/dist/email-queue-CGZBVVAS.js +0 -2
  64. package/dist/erp-order-invoice-3YISSOWW.js +0 -3
  65. package/dist/erp-order-invoice-ZR5F2KTA.cjs +0 -12
  66. package/dist/order-notification-dispatcher-RU7BTGGX.cjs +0 -18
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import PgBoss from 'pg-boss';
2
2
  import * as typeorm from 'typeorm';
3
- import { DataSource, EntityTarget, ObjectLiteral, EntityManager, SelectQueryBuilder } from 'typeorm';
3
+ import { DataSource, EntityManager, EntityTarget, ObjectLiteral, Repository, SelectQueryBuilder } from 'typeorm';
4
4
  import { ClassValue } from 'clsx';
5
5
  import { Metadata } from 'next';
6
6
  import { EventEmitter } from 'events';
@@ -121,7 +121,7 @@ declare class ERPSubmissionService {
121
121
  }[]): ContactFormData | null;
122
122
  }
123
123
 
124
- interface CmsAppLike$4 {
124
+ interface CmsAppLike$5 {
125
125
  getPlugin(name: string): unknown;
126
126
  }
127
127
  type ErpJobPayload = {
@@ -140,8 +140,8 @@ type ErpJobPayload = {
140
140
  kind: 'productUpsert';
141
141
  product: Record<string, unknown>;
142
142
  };
143
- declare function queueErp(cms: CmsAppLike$4, payload: ErpJobPayload): Promise<void>;
144
- declare function registerErpQueueProcessor(cms: CmsAppLike$4): void;
143
+ declare function queueErp(cms: CmsAppLike$5, payload: ErpJobPayload): Promise<void>;
144
+ declare function registerErpQueueProcessor(cms: CmsAppLike$5): void;
145
145
 
146
146
  /**
147
147
  * Duck-typed DataSource so host apps (e.g. Next) can pass their own TypeORM instance
@@ -162,7 +162,7 @@ type ErpPaidOrderEntityMap = Record<string, unknown>;
162
162
  * Enqueues ERP `order.created` only when the order has at least one **completed** payment.
163
163
  * Include `payments` in the payload.
164
164
  */
165
- declare function queueErpPaidOrderForOrderId(cms: CmsAppLike$4, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, orderId: number): Promise<void>;
165
+ declare function queueErpPaidOrderForOrderId(cms: CmsAppLike$5, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, orderId: number): Promise<void>;
166
166
 
167
167
  interface ErpContactSyncInput {
168
168
  name: string;
@@ -178,7 +178,43 @@ interface ErpContactSyncInput {
178
178
  * When ERP is enabled and plugin loaded, enqueue `create-contact` (non-fatal on failure).
179
179
  * Used for admin CRUD and storefront contact paths — not form submissions (those use lead/opportunity).
180
180
  */
181
- declare function queueErpCreateContactIfEnabled(cms: CmsAppLike$4, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, input: ErpContactSyncInput): Promise<void>;
181
+ declare function queueErpCreateContactIfEnabled(cms: CmsAppLike$5, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, input: ErpContactSyncInput): Promise<void>;
182
+
183
+ type CmsAppLike$4 = {
184
+ getPlugin(name: string): unknown;
185
+ };
186
+ type ErpConfigDataSource = {
187
+ getRepository(entity: unknown): {
188
+ find(options?: object): Promise<unknown[]>;
189
+ };
190
+ };
191
+
192
+ type ResolvedOrderInvoicePdf = {
193
+ bytes: Uint8Array;
194
+ filename: string;
195
+ contentType: string;
196
+ source: 'erp' | 'local';
197
+ };
198
+ type ResolveOrderInvoicePdfError = {
199
+ error: string;
200
+ status: number;
201
+ };
202
+ declare function isOrderEligibleForInvoiceEmail(status: string | null | undefined, orderKind?: string | null): boolean;
203
+ /**
204
+ * Resolve invoice PDF bytes for a **sale** order (ERP prefer → local).
205
+ * Shared by HTTP download and order-confirmation email attachment.
206
+ */
207
+ declare function resolveOrderInvoicePdfBytes(cms: CmsAppLike$4, dataSource: ErpConfigDataSource, entityMap: Record<string, unknown>, orderId: number, options?: {
208
+ ownerContactId?: number;
209
+ }): Promise<ResolvedOrderInvoicePdf | ResolveOrderInvoicePdfError>;
210
+ /**
211
+ * Streams invoice PDF for a **sale** order.
212
+ * Prefer ERP tax invoice when configured + ready; otherwise generate a local PDF
213
+ * using the store `invoiceTemplate` setting.
214
+ */
215
+ declare function streamOrderInvoicePdf(cms: CmsAppLike$4, dataSource: ErpConfigDataSource, entityMap: Record<string, unknown>, orderId: number, options: {
216
+ ownerContactId?: number;
217
+ }): Promise<Response>;
182
218
 
183
219
  interface ERPPluginConfig {
184
220
  webhookUrl: string;
@@ -261,12 +297,18 @@ interface EmailPluginConfig$1 {
261
297
  secretAccessKey?: string;
262
298
  templateOptions?: RenderEmailOptions;
263
299
  }
300
+ interface EmailAttachment {
301
+ filename: string;
302
+ content: Buffer | Uint8Array;
303
+ contentType?: string;
304
+ }
264
305
  interface EmailData {
265
306
  subject: string;
266
307
  html: string;
267
308
  text?: string;
268
309
  to?: string;
269
310
  from?: string;
311
+ attachments?: EmailAttachment[];
270
312
  }
271
313
  interface EmailServiceInterface {
272
314
  send(emailData: EmailData): Promise<boolean>;
@@ -284,6 +326,7 @@ declare class EmailService implements EmailServiceInterface {
284
326
  /** AWS via SMTP (nodemailer) vs SES API SDK. */
285
327
  private awsViaSmtp;
286
328
  constructor(config: EmailPluginConfig$1);
329
+ private nodemailerAttachments;
287
330
  send(emailData: EmailData): Promise<boolean>;
288
331
  renderTemplate(templateName: EmailTemplateName, ctx: TemplateContext<unknown>): RenderedEmail;
289
332
  /** Default notification recipient from plugin config (SMTP_TO / plugin `to`). */
@@ -326,6 +369,7 @@ declare function renderLayout(options: {
326
369
 
327
370
  interface CmsAppLike$3 {
328
371
  getPlugin(name: string): unknown;
372
+ dataSource?: unknown;
329
373
  }
330
374
  /** Context for template rendering: at least companyDetails; template-specific fields (formName, etc.) are allowed. */
331
375
  interface EmailJobPayload {
@@ -337,8 +381,18 @@ interface EmailJobPayload {
337
381
  subject?: string;
338
382
  html?: string;
339
383
  text?: string;
340
- }
341
- declare function registerEmailQueueProcessor(cms: CmsAppLike$3): void;
384
+ /** When set with attachInvoice, processor builds PDF in-worker (not stored in queue). */
385
+ orderId?: number;
386
+ /** Customer order-confirmed mail only — attach order invoice PDF when eligible. */
387
+ attachInvoice?: boolean;
388
+ attachments?: EmailAttachment[];
389
+ }
390
+ interface EmailQueueProcessorOptions {
391
+ /** Prefer explicit getter (host apps); falls back to `cms.dataSource`. */
392
+ getDataSource?: () => Promise<DataSource>;
393
+ entityMap?: Record<string, unknown>;
394
+ }
395
+ declare function registerEmailQueueProcessor(cms: CmsAppLike$3, options?: EmailQueueProcessorOptions): void;
342
396
  declare function queueEmail(cms: CmsAppLike$3, payload: EmailJobPayload): Promise<void>;
343
397
  interface OrderPlacedEmailPayload {
344
398
  orderNumber: string;
@@ -355,6 +409,15 @@ interface OrderPlacedEmailPayload {
355
409
  lineItems: OrderPlacedLineItem[];
356
410
  billingAddress?: Record<string, string>;
357
411
  shippingAddress?: Record<string, string>;
412
+ /**
413
+ * When set, customer email may attach order invoice (processor checks status eligibility).
414
+ * Sales emails never attach.
415
+ */
416
+ orderId?: number;
417
+ /**
418
+ * Default true when orderId is set. Set false to skip invoice PDF on customer mail.
419
+ */
420
+ attachInvoiceToCustomer?: boolean;
358
421
  }
359
422
  /** Queues one `orderPlaced` email per recipient (customer + each unique sales address; skips sales if same as customer). */
360
423
  declare function queueOrderPlacedEmails(cms: CmsAppLike$3, payload: OrderPlacedEmailPayload): Promise<void>;
@@ -857,6 +920,50 @@ declare function vendorPortalFlagsFromUser(input: {
857
920
  isVendorOwner: boolean;
858
921
  };
859
922
 
923
+ type EntityMapLike$3 = Record<string, EntityTarget<ObjectLiteral> | undefined>;
924
+ type InventoryOrderLine = {
925
+ productId: number;
926
+ quantity: number;
927
+ variantId?: number | null;
928
+ };
929
+ type OrderInventorySnapshot = {
930
+ status: string;
931
+ lines: InventoryOrderLine[];
932
+ };
933
+ declare function orderStatusHoldsStock(status: string | null | undefined): boolean;
934
+ declare function orderInventorySnapshotFromRow(order: {
935
+ status?: string;
936
+ items?: Array<{
937
+ productId: number;
938
+ quantity: unknown;
939
+ variantId?: number | null;
940
+ metadata?: Record<string, unknown> | null;
941
+ }>;
942
+ }): OrderInventorySnapshot;
943
+ /** Merge lines by product+variant so duplicate lines net correctly. */
944
+ declare function mergeInventoryLines(lines: InventoryOrderLine[]): Map<string, InventoryOrderLine>;
945
+ type EmOrDs$1 = DataSource | EntityManager;
946
+ /**
947
+ * Validate stock for lines that will hold inventory (confirmed/completed).
948
+ * Checks product.quantity (summed across variants) and per-variant inventory.
949
+ */
950
+ declare function validateInventoryForConfirmedOrderLines(ds: EmOrDs$1, entityMap: EntityMapLike$3, lines: InventoryOrderLine[]): Promise<string | null>;
951
+ /**
952
+ * When an order may already hold stock: available = DB qty + prior held qty for that key.
953
+ */
954
+ declare function validateInventoryForOrderBecomingConfirmed(ds: EmOrDs$1, entityMap: EntityMapLike$3, prevSnap: OrderInventorySnapshot | null, nextLines: InventoryOrderLine[]): Promise<string | null>;
955
+ /**
956
+ * Restore stock when leaving a held status; deduct when entering a held status.
957
+ * Restore runs before deduct so line edits while staying held net correctly.
958
+ */
959
+ declare function reconcileOrderInventoryBetweenSnapshots(ds: EmOrDs$1, entityMap: EntityMapLike$3, prev: OrderInventorySnapshot, next: OrderInventorySnapshot): Promise<string | null>;
960
+ /** Convenience: deduct stock for a newly confirmed/completed order. */
961
+ declare function deductInventoryForConfirmedOrder(ds: EmOrDs$1, entityMap: EntityMapLike$3, lines: InventoryOrderLine[], options?: {
962
+ validate?: boolean;
963
+ }): Promise<string | null>;
964
+ /** Convenience: restore stock when cancelling a held order. */
965
+ declare function restoreInventoryForCancelledOrder(ds: EmOrDs$1, entityMap: EntityMapLike$3, lines: InventoryOrderLine[]): Promise<string | null>;
966
+
860
967
  type EntityMap$2 = Record<string, typeorm.EntityTarget<typeorm.ObjectLiteral>>;
861
968
  interface CrudHandlerOptions {
862
969
  requireAuth: (req: Request) => Promise<Response | null>;
@@ -1275,7 +1382,7 @@ declare function createUsersApiHandlers(config: UsersApiConfig): {
1275
1382
  getById(_req: Request, id: string): Promise<Response>;
1276
1383
  update(req: Request, id: string): Promise<Response>;
1277
1384
  delete(_req: Request, id: string): Promise<Response>;
1278
- regenerateInvite(_req: Request, id: string): Promise<Response>;
1385
+ regenerateInvite(req: Request, id: string): Promise<Response>;
1279
1386
  };
1280
1387
  interface UserAvatarConfig extends CmsHandlersBase {
1281
1388
  getSession: () => Promise<{
@@ -1559,8 +1666,34 @@ type EnsureCustomerUserInput = {
1559
1666
  email: string;
1560
1667
  phone?: string | null;
1561
1668
  };
1562
- /** Stable unique placeholder when no phone is available (customer.phone is NOT NULL + UNIQUE). */
1563
- declare function customerPhoneForUser(userId: number, phone?: string | null): string;
1669
+ /** Trimmed phone or null never invents placeholders. */
1670
+ declare function normalizeCustomerPhone(phone?: string | null): string | null;
1671
+ /** True for seed/login placeholders that were used when phone was NOT NULL. */
1672
+ declare function isSyntheticCustomerPhone(phone: string | null | undefined): boolean;
1673
+ /**
1674
+ * Prefer a real phone; otherwise null.
1675
+ * @deprecated Prefer {@link normalizeCustomerPhone}; kept for call-site compatibility.
1676
+ */
1677
+ declare function customerPhoneForUser(_userId: number, phone?: string | null): string | null;
1678
+ /**
1679
+ * Prefer a real phone; otherwise null.
1680
+ * @deprecated Prefer {@link normalizeCustomerPhone}; kept for call-site compatibility.
1681
+ */
1682
+ declare function customerPhoneForEmail(_email: string, phone?: string | null): string | null;
1683
+ type EnsureCustomerRecordInput = {
1684
+ name: string;
1685
+ email: string;
1686
+ phone?: string | null;
1687
+ /** When set, claims/links the customer to this user (signup / login-capable). */
1688
+ userId?: number | null;
1689
+ };
1690
+ /**
1691
+ * Ensures a `customer` row by email. Does not create a `users` row.
1692
+ * Pass `userId` only when the person already has (or is getting) login.
1693
+ */
1694
+ declare function ensureCustomerRecord(dsOrEm: DataSource | EntityManager, customerEntity: EntityTarget<ObjectLiteral>, input: EnsureCustomerRecordInput): Promise<{
1695
+ id: number;
1696
+ } | null>;
1564
1697
  /**
1565
1698
  * Ensures a `customer` row exists for the given user (idempotent by userId / email).
1566
1699
  * Returns null when customer entity is missing or email belongs to another user.
@@ -1603,6 +1736,8 @@ declare class UserGroup {
1603
1736
  users: User[];
1604
1737
  }
1605
1738
 
1739
+ /** Invite lifecycle for CMS users (separate from `blocked`). */
1740
+ type UserInviteStatus = 'pending' | 'active';
1606
1741
  declare class User {
1607
1742
  id: number;
1608
1743
  name: string;
@@ -1612,6 +1747,13 @@ declare class User {
1612
1747
  phoneVerifiedAt: Date | null;
1613
1748
  emailVerifiedAt: Date | null;
1614
1749
  password: string | null;
1750
+ /**
1751
+ * `pending` = invite outstanding (cannot sign in until password is set).
1752
+ * `active` = invite accepted / account usable (subject to `blocked`).
1753
+ */
1754
+ inviteStatus: UserInviteStatus;
1755
+ /** Rotating invite token; null when active or no invite outstanding. */
1756
+ inviteToken: string | null;
1615
1757
  blocked: boolean;
1616
1758
  adminAccess: boolean;
1617
1759
  groupId: number | null;
@@ -1719,6 +1861,19 @@ declare function findVendorByInviteToken(dataSource: DataSource, vendorEntity: E
1719
1861
  metadata: Record<string, unknown> | null;
1720
1862
  } | null>;
1721
1863
 
1864
+ /** Same URL shape as vendor invites: `/admin/invite?token=…`. */
1865
+ declare function buildUserInviteLink(baseUrl: string, token: string): string;
1866
+ declare function newUserInviteToken(): string;
1867
+ declare function findUserByInviteToken(dataSource: DataSource, userEntity: EntityTarget<ObjectLiteral>, token: string): Promise<{
1868
+ id: number;
1869
+ email: string;
1870
+ blocked: boolean;
1871
+ password: string | null;
1872
+ inviteStatus: UserInviteStatus;
1873
+ inviteToken: string | null;
1874
+ } | null>;
1875
+ declare function completeUserInviteAccept(dataSource: DataSource, userEntity: EntityTarget<ObjectLiteral>, userId: number, passwordHash: string): Promise<void>;
1876
+
1722
1877
  /** Parse stored config value into a list of emails (JSON array, or comma/semicolon-separated string). */
1723
1878
  declare function parseEmailRecipientsFromConfig(raw: string | undefined | null): string[];
1724
1879
  /** Serialize email list for config storage (JSON array in DB). */
@@ -1772,19 +1927,103 @@ declare function rateLimitPublicApiIfNeeded(req: Request, method: string, segmen
1772
1927
  }): Promise<Response | null>;
1773
1928
  declare function rateLimitCheckoutPost(req: Request): Promise<Response | null>;
1774
1929
 
1775
- interface EntityMapLike$1 {
1930
+ interface EntityMapLike$2 {
1776
1931
  configs: unknown;
1777
1932
  orders: unknown;
1778
1933
  order_items: unknown;
1779
1934
  }
1780
1935
  interface SendOrderPlacedEmailDeps {
1781
1936
  getDataSource: () => Promise<DataSource>;
1782
- entityMap: EntityMapLike$1;
1783
- getCms: () => Promise<CmsApp>;
1937
+ entityMap: EntityMapLike$2;
1938
+ /** Minimal CMS handle used to queue emails (matches storefront `getCms`). */
1939
+ getCms: () => Promise<{
1940
+ getPlugin: (name: string) => unknown;
1941
+ dataSource?: unknown;
1942
+ }>;
1784
1943
  }
1785
1944
  /** After payment confirmation: email customer + each sales team address from plugin settings. */
1786
1945
  declare function sendOrderPlacedEmailsAfterConfirmation(orderId: number, deps: SendOrderPlacedEmailDeps): Promise<void>;
1787
1946
 
1947
+ /** Built-in invoice layout ids selectable in Store settings. */
1948
+ declare const INVOICE_TEMPLATE_IDS: readonly ["classic", "modern", "compact", "bold"];
1949
+ type InvoiceTemplateId = (typeof INVOICE_TEMPLATE_IDS)[number];
1950
+ declare const INVOICE_TEMPLATE_OPTIONS: Array<{
1951
+ id: InvoiceTemplateId;
1952
+ label: string;
1953
+ description: string;
1954
+ }>;
1955
+ declare function normalizeInvoiceTemplateId(raw: string | null | undefined): InvoiceTemplateId;
1956
+
1957
+ type InvoiceLineItem = {
1958
+ name: string;
1959
+ quantity: number;
1960
+ unitPrice: number;
1961
+ tax?: number;
1962
+ total: number;
1963
+ sku?: string | null;
1964
+ };
1965
+ type InvoiceAddress = {
1966
+ line1?: string;
1967
+ line2?: string | null;
1968
+ city?: string;
1969
+ state?: string;
1970
+ postalCode?: string;
1971
+ country?: string;
1972
+ };
1973
+ type InvoiceCompany = {
1974
+ name: string;
1975
+ logoUrl?: string | null;
1976
+ supportEmail?: string;
1977
+ supportPhone?: string;
1978
+ address?: string;
1979
+ };
1980
+ type InvoicePdfInput = {
1981
+ templateId?: string | null;
1982
+ orderNumber: string;
1983
+ orderDate: Date | string;
1984
+ currency: string;
1985
+ customerName: string;
1986
+ customerEmail?: string | null;
1987
+ customerPhone?: string | null;
1988
+ billingAddress?: InvoiceAddress | null;
1989
+ shippingAddress?: InvoiceAddress | null;
1990
+ lineItems: InvoiceLineItem[];
1991
+ subtotal: number;
1992
+ tax: number;
1993
+ discount: number;
1994
+ total: number;
1995
+ company: InvoiceCompany;
1996
+ };
1997
+ /**
1998
+ * Generate a local tax invoice PDF using the selected store template.
1999
+ */
2000
+ declare function generateLocalInvoicePdf(input: InvoicePdfInput): Promise<Uint8Array>;
2001
+
2002
+ type EmOrDs = DataSource | EntityManager;
2003
+ type EntityMapLike$1 = Record<string, EntityTarget<ObjectLiteral> | undefined>;
2004
+ /** Build local invoice PDF bytes for an order (store template + branding). */
2005
+ declare function buildLocalInvoicePdfForOrder(ds: EmOrDs, entityMap: EntityMapLike$1, orderId: number): Promise<{
2006
+ bytes: Uint8Array;
2007
+ filename: string;
2008
+ } | {
2009
+ error: string;
2010
+ status: number;
2011
+ }>;
2012
+
2013
+ /**
2014
+ * Resolve branding/logo URLs for invoice PDFs.
2015
+ * Absolute http(s) URLs pass through; site-relative paths use public base URL env.
2016
+ */
2017
+ declare function resolveInvoiceAssetUrl(raw: string | null | undefined): string | null;
2018
+
2019
+ /**
2020
+ * Soft-deleted rows still occupy UNIQUE columns (email/slug). Rename them so a new
2021
+ * active row can reuse the original value without dropping the DB unique constraint.
2022
+ */
2023
+ declare function retireSoftDeletedUniqueValue(repo: Repository<ObjectLiteral>, column: string, value: string): Promise<void>;
2024
+ /** True when an active (non-deleted) row already holds this unique value. */
2025
+ declare function activeUniqueValueExists(repo: Repository<ObjectLiteral>, column: string, value: string, excludeId?: number): Promise<boolean>;
2026
+
1788
2027
  declare class FormField {
1789
2028
  id: number;
1790
2029
  formId: number;
@@ -2163,6 +2402,8 @@ declare class OrderItem {
2163
2402
  id: number;
2164
2403
  orderId: number;
2165
2404
  productId: number;
2405
+ /** Selected product variant at order time (optional). */
2406
+ variantId: number | null;
2166
2407
  discountIds: number[];
2167
2408
  vendorId: number | null;
2168
2409
  vendor: Vendor | null;
@@ -2241,11 +2482,13 @@ declare class OrderAddresses {
2241
2482
 
2242
2483
  declare class Customer {
2243
2484
  id: number;
2244
- userId: number;
2485
+ /** Set only when the customer can log in (linked `users` row). Admin/guest customers stay null. */
2486
+ userId: number | null;
2245
2487
  user: User | null;
2246
2488
  name: string;
2247
2489
  email: string;
2248
- phone: string;
2490
+ /** Optional; multiple customers may have null (PostgreSQL UNIQUE allows multiple NULLs). */
2491
+ phone: string | null;
2249
2492
  createdAt: Date;
2250
2493
  updatedAt: Date;
2251
2494
  deletedAt: Date | null;
@@ -2682,6 +2925,7 @@ interface NextAuthUser {
2682
2925
  name: string | null;
2683
2926
  password: string | null;
2684
2927
  blocked?: boolean;
2928
+ inviteStatus?: 'pending' | 'active';
2685
2929
  deleted?: boolean;
2686
2930
  groupId?: number | null;
2687
2931
  adminAccess?: boolean;
@@ -2844,10 +3088,15 @@ declare function contactIsVendorCustomer(dataSource: DataSource, entityMap: Enti
2844
3088
  declare function assertContactAllowedForVendorOrder(dataSource: DataSource, entityMap: EntityMap$2, vendorId: number, contactId: number): Promise<string | null>;
2845
3089
  declare function resolveVendorIdForContactCheck(scope: VendorScope, bodyOrRow: Record<string, unknown>): number | null;
2846
3090
  /**
2847
- * When an order is placed for a manually entered customer, ensure they appear in
2848
- * vendor customers: customer row, vendor_customers link, and contact type.
3091
+ * Ensure contact type + customer row (no user) + vendor_customers link for one vendor.
3092
+ * Login-capable users are created only via signup / explicit invite — never here.
2849
3093
  */
2850
3094
  declare function ensureVendorCustomerForOrderContact(dataSource: DataSource, entityMap: EntityMap$2, vendorId: number, contactId: number, details: EnsureVendorCustomerDetails): Promise<void>;
3095
+ /**
3096
+ * When an order is placed, link the order contact (and customer by email) to each vendor
3097
+ * whose products appear on the order. Creates a customer without a user when needed.
3098
+ */
3099
+ declare function ensureVendorCustomersForOrder(dataSource: DataSource, entityMap: EntityMap$2, vendorIds: Array<number | null | undefined>, contactId: number, details: EnsureVendorCustomerDetails): Promise<void>;
2851
3100
 
2852
3101
  /** One band: refund % when cancellation falls N days before event start. */
2853
3102
  type RefundPolicyTier = {
@@ -2905,6 +3154,41 @@ declare function calculateOrderRefundPreview(dataSource: DataSource, entityMap:
2905
3154
  /** @deprecated Use event-attached policy via calculateOrderRefundPreview. */
2906
3155
  declare function findActiveRefundPolicyForVendor(dataSource: DataSource, entityMap: EntityMap$2, vendorId: number | null | undefined): Promise<PolicyRow | null>;
2907
3156
 
3157
+ /** Minimal entity map keys needed for discount usage accounting. */
3158
+ type DiscountUsageEntityMap = {
3159
+ discounts?: EntityTarget<ObjectLiteral>;
3160
+ order_discounts?: EntityTarget<ObjectLiteral>;
3161
+ order_items: EntityTarget<ObjectLiteral>;
3162
+ };
3163
+ /**
3164
+ * `order_discounts.userId` stores the contact id (historical column name).
3165
+ */
3166
+ declare function countDiscountOrdersForContact(dataSource: DataSource, discountId: number, contactId: number): Promise<number>;
3167
+ declare function isMaxTotalUsageReached(discount: {
3168
+ maxTotalUsage?: number | null;
3169
+ usedCount?: number | null;
3170
+ }): boolean;
3171
+ declare function isMaxPerUserUsageReached(dataSource: DataSource, discount: {
3172
+ id: number;
3173
+ maxUsagePerUser?: number | null;
3174
+ }, contactId: number | null | undefined): Promise<boolean>;
3175
+ /**
3176
+ * Enforce per-user + total limits, then atomically increment `usedCount`.
3177
+ * Returns an error message, or null on success.
3178
+ */
3179
+ declare function checkAndIncrementDiscountUsage(dataSource: DataSource, entityMap: DiscountUsageEntityMap, discountId: number, contactId: number): Promise<string | null>;
3180
+ declare function decrementDiscountUsage(dataSource: DataSource, entityMap: DiscountUsageEntityMap, discountId: number, orderId: number): Promise<void>;
3181
+ declare function recordDiscountUsage(dataSource: DataSource, entityMap: DiscountUsageEntityMap, orderId: number, discountId: number, contactId: number, discountAmount: number): Promise<void>;
3182
+ type AppliedDiscountUsage = {
3183
+ id: number;
3184
+ calculatedDiscount: number;
3185
+ };
3186
+ /**
3187
+ * For each applied discount: enforce limits, increment usedCount, write order_discounts.
3188
+ * Stops on first error and returns that message (caller may roll back).
3189
+ */
3190
+ declare function consumeAppliedDiscountUsages(dataSource: DataSource, entityMap: DiscountUsageEntityMap, orderId: number, contactId: number, applied: AppliedDiscountUsage[]): Promise<string | null>;
3191
+
2908
3192
  type CaptchaProviderId = 'turnstile' | 'recaptcha_v3';
2909
3193
  interface CaptchaPublicConfig {
2910
3194
  enabled: boolean;
@@ -3418,6 +3702,7 @@ declare enum Type {
3418
3702
  CATEGORY = "category",
3419
3703
  CART = "cart",
3420
3704
  PAYMENT_METHOD = "paymentMethod",
3705
+ DEVICE_TYPE = "deviceType",
3421
3706
  ORDER = "order",
3422
3707
  QUANTITY = "quantity",
3423
3708
  TIME = "time",
@@ -3589,6 +3874,7 @@ declare class Combo {
3589
3874
  vendorId: number;
3590
3875
  vendor: Vendor;
3591
3876
  name: string;
3877
+ slug: string;
3592
3878
  desc?: string;
3593
3879
  eventId?: number | null;
3594
3880
  event?: Event | null;
@@ -3782,6 +4068,8 @@ interface VendorOnboardHandlersConfig {
3782
4068
  minPasswordLength?: number;
3783
4069
  }
3784
4070
  declare function createVendorOnboardHandlers(config: VendorOnboardHandlersConfig): {
4071
+ /** GET /api/admin/vendor/profile — current user's store (server-resolved vendor id). */
4072
+ getProfile(): Promise<Response>;
3785
4073
  /** POST /api/admin/vendors/onboard — create vendor + owner user + vendor_users + invite */
3786
4074
  onboard(req: Request): Promise<Response>;
3787
4075
  /** POST /api/admin/vendors/:id/resend-invite — rotate owner invite token and resend email */
@@ -3944,7 +4232,7 @@ declare function resolveSettingsEncryptionKey(config?: Record<string, string>):
3944
4232
  declare function loadSettingsGroupFromDb(dataSource: DataSource, entityMap: EntityMap$2, group: string, encryptionKey?: string): Promise<Record<string, string>>;
3945
4233
  declare function createMessageTemplateRowLoader(dataSource: DataSource, entityMap: EntityMap$2): MessageTemplateRowLoader;
3946
4234
  /** Register email + WhatsApp queue processors when a queue plugin is present. */
3947
- declare function registerMessagingQueueProcessors(cms: CmsApp): void;
4235
+ declare function registerMessagingQueueProcessors(cms: CmsApp, entityMap?: EntityMap$2): void;
3948
4236
  /**
3949
4237
  * Ensures queue, email, and WhatsApp plugins exist on the CMS app (lazy overlay).
3950
4238
  * Consumer apps that omit `whatsappPlugin()` / `queuePlugin()` still get order notifications when env/DB is configured.
@@ -3958,4 +4246,4 @@ type CreateCmsAppWithMessagingOptions = CreateCmsAppOptions & EnsureMessagingPlu
3958
4246
  /** `createCmsApp` + messaging plugins + queue processor registration. */
3959
4247
  declare function createCmsAppWithMessaging(options: CreateCmsAppWithMessagingOptions): Promise<CmsApp>;
3960
4248
 
3961
- export { ADMIN_GROUP_NAME, Address, type AdminNavItem, type AnalyticsHandlerConfig, type AnalyticsPluginConfig, Attendee, Attribute, type AuthHandlersConfig, type AuthHelpers, type AuthorizeOtpInput, BLOG_GENERATOR_AGENT_NAME, BLOG_GENERATOR_DEFAULT_SYSTEM_INSTRUCTION, BLOG_GENERATOR_DEFAULT_VALIDATION_RULES, BLOG_GENERATOR_LLM_AGENT_SLUG, BLOG_GENERATOR_MARKDOWN_ARTICLE_SEPARATOR, BLOG_METADATA_ENRICHER_AGENT_NAME, BLOG_METADATA_ENRICHER_DEFAULT_SYSTEM_INSTRUCTION, BLOG_METADATA_ENRICHER_DEFAULT_VALIDATION_RULES, BLOG_METADATA_ENRICHER_LLM_AGENT_SLUG, Blog, type BlogBySlugConfig, type BlogGeneratorBlogDraft, type BlogGeneratorDraftParseMode, type BlogGeneratorPluginConfig, type BlogGeneratorSeoDraft, BlogGeneratorService, Brand, CMS_ENTITY_MAP, type CachePluginConfig, type CacheService, type CaptchaProviderId, type CaptchaPublicConfig, CaptchaService, type CaptchaVerifyResult, Cart, CartItem, Category, type ChangePasswordConfig, ChatConversation, ChatMessage, type ChatPublicConfig, type CmsApiHandlerConfig, type CmsApp, type CmsGetter, type CmsMiddlewareConfig, type CmsMiddlewareRequest, type CmsPlugin, Collection, Combo, ComboItem, Comment, type CompanyDetails, Config, Contact, type CreateCmsAppOptions, type CreateCmsAppWithMessagingOptions, type CrudHandlerOptions, Currency, CurrencyExchange, Customer, Customer_Contacts, DEFAULT_ADMIN_NAV, DEFAULT_ORDER_NOTIFICATION_TRIGGER_SEEDS, type DashboardStatsConfig, type DataSourceManager, Discount, DiscountRules, type ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS, EVENT_ORDER_TEMPLATE_KEY, EVENT_ORDER_TEMPLATE_VARIABLES, type EcommerceAnalyticsConfig, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, type EmailTemplateName, type EmailTemplateResult, type EmitOrderNotificationTriggerDeps, type EnsureCustomerUserInput, type EnsureMessagingPluginsOptions, type EnsureVendorCustomerDetails, type EntityCrudAction, type EntityMap$2 as EntityMap, type EntityPermissionFlags, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, Event, type EventApprovalStatus, type EventOrderMessageTemplateHandlersConfig, type EventOrderNotificationChannel, type EventOrderNotificationTemplates, type EventOrderTemplateOverride, EventProduct, type ExtraPublicWriteRule, type FacebookMeAccountsResponse, type FacebookPageAccount, type ForgotPasswordConfig, Form, type FormBySlugConfig, FormField, FormSubmission, type GetPublicSettingsGroupConfig, type GetPublicSettingsGroupDataSource, type GetSession, type InviteAcceptConfig, JOB_RUNNER_QUEUE, type CmsAppLike as JobRunnerCmsAppLike, type JobRunnerDeps, type JobRunnerPayload, JobSchedule, type JobScheduleApiConfig, JobScheduleRun, KNOWN_NOTIFICATION_TRIGGERS, KnowledgeBaseChunk, KnowledgeBaseDocument, type LatestArticleFromFeed, LlmAgent, type LlmAgentKnowledgeApiConfig, type LlmAgentOptions, type LlmAgentValidationRulesJson, type LlmChatOptions, type LlmEmbeddingProvider, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceEmbedOptions, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, type MetaGraphMutationResponse, type NextAuthOptionsConfig, type NextAuthUser, OPEN_ENDPOINTS, ORDER_NOTIFICATION_TRIGGERS, Order, OrderAddresses, OrderDiscounts, OrderItem, OrderNotificationBinding, OrderNotificationTrigger, type OrderNotificationTriggerKey, type OrderPlacedEmailPayload, type OrderPlacedLineItem, type OrderTriggerPayload, OtpChallenge, type OtpChannel, type OtpPurpose, PERMISSION_REQUIRED_ENDPOINTS, Page, type ParsedLlmAgentValidation, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PgBossPluginConfig, PgBossService, type PipelineNames, type PluginContext, Product, type ProductApprovalStatus, ProductAttribute, ProductCategory, ProductConfig, ProductVariant, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, RBAC_ADMIN_ONLY_ENTITIES, type RefundCalculationResult, RefundPolicy, type RefundPolicyLike, type RefundPolicyTier, RefundRequest, type RenderEmailOptions, type RenderedEmail, RssArticle, RssFeed, type S3StoragePluginConfig, SUPER_ADMIN_GROUP_ID, type SendVendorOnboardEmailInput, Seo, type SeoLike, type SeoMetadataOverrides, type SessionUser, type SetPasswordConfig, type SettingsApiConfig, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, type SocialLinkItem, type SocialMediaPluginConfig, type StorageService, type StorefrontApiConfig, type StorefrontOtpFlags, Tag, Tax, type TemplateContext, type UploadHandlerConfig, User, type UserAuthApiConfig, type UserAvatarConfig, UserGroup, type UserProfileConfig, type UsersApiConfig, VENDOR_ADMIN_GROUP_ID, VENDOR_OWNER_GROUP_NAME, VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, Vendor, type VendorCatalogCreateFlags, VendorCustomer, type VendorDashboardConfig, type VendorOnboardHandlersConfig, type VendorOwnerActivation, VendorRole, VendorRolePermission, VendorUser, type WhatsAppJobPayload, type WhatsAppPluginConfig, type WhatsAppServiceConfig, type WhatsAppServiceInterface, Wishlist, WishlistItem, ZIP_MIME_TYPES, allowRateLimit, analyticsPlugin, applyApprovalStatusSideEffects, applyEventApprovalStatusSideEffects, applyRotatingVendorInvite, applyVendorCustomersContactFilter, applyVendorEventCreateApproval, applyVendorProductCreateApproval, assertCaptchaOk, assertContactAllowedForVendorOrder, assertEventApprovalUpdate, assertProductApprovalUpdate, blogGeneratorPlugin, buildBlogMetadataUserPrompt, buildCaptchaPublicConfig, buildCronFromSchedule, buildEventOrderTemplateVariables, buildRssUserPromptFromFeeds, buildVendorInviteLink, cachePlugin, calculateOrderRefundPreview, calculateRefundFromPolicy, canManageRoles, canManageVendorRoles, canManageVendorTeam, canOnboardVendors, captchaPlugin, checkEventsEnabled, checkMultiVendorEnabled, cn, contactIsVendorCustomer, countRecentOtpSends, createAnalyticsHandlers, createAuthHelpers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCmsApp, createCmsAppWithMessaging, createCmsAuthBundle, createCmsMiddleware, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createDataSourceManager, createEcommerceAnalyticsHandler, createEventOrderMessageTemplateHandlers, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createMessageTemplateRowLoader, createOtpChallenge, createSetPasswordHandler, createSettingsApiHandlers, createSocialMediaHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, customerPhoneForUser, daysBeforeEventStart, defaultPublicApiMethods, describeEventTierPolicy, emailPlugin, emailTemplates, emitOrderNotificationTrigger, enrichUserWithVendorContext, ensureCustomerForUser, ensureMessagingPluginsOnCms, ensureScheduleQueueWorker, ensureVendorCustomerForOrderContact, erpPlugin, explainSessionEntityAccess, fetchSeoBySlug, findActiveRefundPolicyForVendor, findVendorByInviteToken, fireOrderNotificationTrigger, formatDate, formatDateOnly, formatDateTime, formatTierRange, generateNumericOtp, generateSlug, getCompanyDetailsFromSettings, getNextAuthOptions, getPermissionableEntityKeys, getPublicSettingsGroup, getRequireEventApproval, getRequireProductApproval, getRequiredPermission, getRssArticleSummaryFromItem, getStorefrontNextAuthOptions, getVendorCatalogCreateFlags, hasEntityPermission, hashOtpCode, hydrateVendorSessionUser, initWhatsappTriggerDispatcher, invalidateEventsCache, invalidateMultiVendorCache, invalidateRequireEventApprovalCache, invalidateRequireProductApprovalCache, invalidateVendorCatalogCreateFlagsCache, isAuthDebugClientEnabled, isAuthDebugEnabled, isCustomerTypeContact, isOpenEndpoint, isPlatformAdministrator, isPublicMethod, isRbacDebugEnabled, isSuperAdmin, isSuperAdminGroupName, isVendorAdmin, isVendorGroupName, isVendorOwner, isVendorPortalUser, isVendorStaff, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, llmPlugin, loadPublicThemeSettings, loadSettingsGroupFromDb, loadUserVendorContext, localStoragePlugin, logAuth, logAuthClient, logEntityAccessDecision, logRbac, mergeEmailLayoutCompanyDetails, mergeGuardrailsIntoSystemPrompt, mergeSeoBySlug, messagingPlugins, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, nextAuthCookieDebugInfo, normalizePhoneE164, normalizeRefundTiers, notificationTriggerEmitter, overlayCmsPlugins, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseEmailRecipientsFromConfig, parseHfInferenceEmbeddingBody, parseLlmAgentValidationRules, paymentPlugin, permissionRowsToRecord, pgBossPlugin, pgBossScheduleNameForId, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueJobScheduleNow, queueOrderPlacedEmails, queuePlugin, queueSms, queueVendorOnboardEmails, queueWhatsApp, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, registerEmailQueueProcessor, registerErpQueueProcessor, registerJobRunnerWorker, registerMessagingQueueProcessors, registerSmsQueueProcessor, registerWhatsAppQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resendOrderNotification, resolveBlogCategoryIdByName, resolveEventOrderTemplate, resolvePublicMetadata, resolveSettingsEncryptionKey, resolveVendorIdForContactCheck, resolveVendorScopeFromSessionUser, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedAdministratorPermissions, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, sendVendorOnboardEmails, serializeEmailRecipients, sessionHasEntityAccess, shouldRateLimitPublicWrite, simpleDecrypt, simpleEncrypt, smsPlugin, socialMediaPlugin, summarizeEntityPerms, summarizeSessionUserForLog, syncJobScheduleToPgBoss, truncateText, validateRefundTiers, validateScheduleInput, validateSlug, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules, vendorPortalFlagsFromUser, verifyAndConsumeOtpChallenge, verifyOtpCodeHash, whatsappPlugin, withAdminRlsContext, withVendorRlsContext, wrapGetCmsWithMessaging };
4249
+ export { ADMIN_GROUP_NAME, Address, type AdminNavItem, type AnalyticsHandlerConfig, type AnalyticsPluginConfig, type AppliedDiscountUsage, Attendee, Attribute, type AuthHandlersConfig, type AuthHelpers, type AuthorizeOtpInput, BLOG_GENERATOR_AGENT_NAME, BLOG_GENERATOR_DEFAULT_SYSTEM_INSTRUCTION, BLOG_GENERATOR_DEFAULT_VALIDATION_RULES, BLOG_GENERATOR_LLM_AGENT_SLUG, BLOG_GENERATOR_MARKDOWN_ARTICLE_SEPARATOR, BLOG_METADATA_ENRICHER_AGENT_NAME, BLOG_METADATA_ENRICHER_DEFAULT_SYSTEM_INSTRUCTION, BLOG_METADATA_ENRICHER_DEFAULT_VALIDATION_RULES, BLOG_METADATA_ENRICHER_LLM_AGENT_SLUG, Blog, type BlogBySlugConfig, type BlogGeneratorBlogDraft, type BlogGeneratorDraftParseMode, type BlogGeneratorPluginConfig, type BlogGeneratorSeoDraft, BlogGeneratorService, Brand, CMS_ENTITY_MAP, type CachePluginConfig, type CacheService, type CaptchaProviderId, type CaptchaPublicConfig, CaptchaService, type CaptchaVerifyResult, Cart, CartItem, Category, type ChangePasswordConfig, ChatConversation, ChatMessage, type ChatPublicConfig, type CmsApiHandlerConfig, type CmsApp, type CmsGetter, type CmsMiddlewareConfig, type CmsMiddlewareRequest, type CmsPlugin, Collection, Combo, ComboItem, Comment, type CompanyDetails, Config, Contact, type CreateCmsAppOptions, type CreateCmsAppWithMessagingOptions, type CrudHandlerOptions, Currency, CurrencyExchange, Customer, Customer_Contacts, DEFAULT_ADMIN_NAV, DEFAULT_ORDER_NOTIFICATION_TRIGGER_SEEDS, type DashboardStatsConfig, type DataSourceManager, Discount, DiscountRules, type DiscountUsageEntityMap, type ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS, EVENT_ORDER_TEMPLATE_KEY, EVENT_ORDER_TEMPLATE_VARIABLES, type EcommerceAnalyticsConfig, type EmailAttachment, type EmailData, type EmailJobPayload, type EmailPluginConfig, type EmailQueueProcessorOptions, EmailService, type EmailServiceInterface, type EmailTemplateName, type EmailTemplateResult, type EmitOrderNotificationTriggerDeps, type EnsureCustomerRecordInput, type EnsureCustomerUserInput, type EnsureMessagingPluginsOptions, type EnsureVendorCustomerDetails, type EntityCrudAction, type EntityMap$2 as EntityMap, type EntityPermissionFlags, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, Event, type EventApprovalStatus, type EventOrderMessageTemplateHandlersConfig, type EventOrderNotificationChannel, type EventOrderNotificationTemplates, type EventOrderTemplateOverride, EventProduct, type ExtraPublicWriteRule, type FacebookMeAccountsResponse, type FacebookPageAccount, type ForgotPasswordConfig, Form, type FormBySlugConfig, FormField, FormSubmission, type GetPublicSettingsGroupConfig, type GetPublicSettingsGroupDataSource, type GetSession, INVOICE_TEMPLATE_IDS, INVOICE_TEMPLATE_OPTIONS, type InventoryOrderLine, type InviteAcceptConfig, type InvoiceAddress, type InvoiceCompany, type InvoiceLineItem, type InvoicePdfInput, type InvoiceTemplateId, JOB_RUNNER_QUEUE, type CmsAppLike as JobRunnerCmsAppLike, type JobRunnerDeps, type JobRunnerPayload, JobSchedule, type JobScheduleApiConfig, JobScheduleRun, KNOWN_NOTIFICATION_TRIGGERS, KnowledgeBaseChunk, KnowledgeBaseDocument, type LatestArticleFromFeed, LlmAgent, type LlmAgentKnowledgeApiConfig, type LlmAgentOptions, type LlmAgentValidationRulesJson, type LlmChatOptions, type LlmEmbeddingProvider, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceEmbedOptions, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, type MetaGraphMutationResponse, type NextAuthOptionsConfig, type NextAuthUser, OPEN_ENDPOINTS, ORDER_NOTIFICATION_TRIGGERS, Order, OrderAddresses, OrderDiscounts, type OrderInventorySnapshot, OrderItem, OrderNotificationBinding, OrderNotificationTrigger, type OrderNotificationTriggerKey, type OrderPlacedEmailPayload, type OrderPlacedLineItem, type OrderTriggerPayload, OtpChallenge, type OtpChannel, type OtpPurpose, PERMISSION_REQUIRED_ENDPOINTS, Page, type ParsedLlmAgentValidation, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PgBossPluginConfig, PgBossService, type PipelineNames, type PluginContext, Product, type ProductApprovalStatus, ProductAttribute, ProductCategory, ProductConfig, ProductVariant, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, RBAC_ADMIN_ONLY_ENTITIES, type RefundCalculationResult, RefundPolicy, type RefundPolicyLike, type RefundPolicyTier, RefundRequest, type RenderEmailOptions, type RenderedEmail, type ResolveOrderInvoicePdfError, type ResolvedOrderInvoicePdf, RssArticle, RssFeed, type S3StoragePluginConfig, SUPER_ADMIN_GROUP_ID, type SendVendorOnboardEmailInput, Seo, type SeoLike, type SeoMetadataOverrides, type SessionUser, type SetPasswordConfig, type SettingsApiConfig, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, type SocialLinkItem, type SocialMediaPluginConfig, type StorageService, type StorefrontApiConfig, type StorefrontOtpFlags, Tag, Tax, type TemplateContext, type UploadHandlerConfig, User, type UserAuthApiConfig, type UserAvatarConfig, UserGroup, type UserInviteStatus, type UserProfileConfig, type UsersApiConfig, VENDOR_ADMIN_GROUP_ID, VENDOR_OWNER_GROUP_NAME, VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, Vendor, type VendorCatalogCreateFlags, VendorCustomer, type VendorDashboardConfig, type VendorOnboardHandlersConfig, type VendorOwnerActivation, VendorRole, VendorRolePermission, VendorUser, type WhatsAppJobPayload, type WhatsAppPluginConfig, type WhatsAppServiceConfig, type WhatsAppServiceInterface, Wishlist, WishlistItem, ZIP_MIME_TYPES, activeUniqueValueExists, allowRateLimit, analyticsPlugin, applyApprovalStatusSideEffects, applyEventApprovalStatusSideEffects, applyRotatingVendorInvite, applyVendorCustomersContactFilter, applyVendorEventCreateApproval, applyVendorProductCreateApproval, assertCaptchaOk, assertContactAllowedForVendorOrder, assertEventApprovalUpdate, assertProductApprovalUpdate, blogGeneratorPlugin, buildBlogMetadataUserPrompt, buildCaptchaPublicConfig, buildCronFromSchedule, buildEventOrderTemplateVariables, buildLocalInvoicePdfForOrder, buildRssUserPromptFromFeeds, buildUserInviteLink, buildVendorInviteLink, cachePlugin, calculateOrderRefundPreview, calculateRefundFromPolicy, canManageRoles, canManageVendorRoles, canManageVendorTeam, canOnboardVendors, captchaPlugin, checkAndIncrementDiscountUsage, checkEventsEnabled, checkMultiVendorEnabled, cn, completeUserInviteAccept, consumeAppliedDiscountUsages, contactIsVendorCustomer, countDiscountOrdersForContact, countRecentOtpSends, createAnalyticsHandlers, createAuthHelpers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCmsApp, createCmsAppWithMessaging, createCmsAuthBundle, createCmsMiddleware, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createDataSourceManager, createEcommerceAnalyticsHandler, createEventOrderMessageTemplateHandlers, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createMessageTemplateRowLoader, createOtpChallenge, createSetPasswordHandler, createSettingsApiHandlers, createSocialMediaHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, customerPhoneForEmail, customerPhoneForUser, daysBeforeEventStart, decrementDiscountUsage, deductInventoryForConfirmedOrder, defaultPublicApiMethods, describeEventTierPolicy, emailPlugin, emailTemplates, emitOrderNotificationTrigger, enrichUserWithVendorContext, ensureCustomerForUser, ensureCustomerRecord, ensureMessagingPluginsOnCms, ensureScheduleQueueWorker, ensureVendorCustomerForOrderContact, ensureVendorCustomersForOrder, erpPlugin, explainSessionEntityAccess, fetchSeoBySlug, findActiveRefundPolicyForVendor, findUserByInviteToken, findVendorByInviteToken, fireOrderNotificationTrigger, formatDate, formatDateOnly, formatDateTime, formatTierRange, generateLocalInvoicePdf, generateNumericOtp, generateSlug, getCompanyDetailsFromSettings, getNextAuthOptions, getPermissionableEntityKeys, getPublicSettingsGroup, getRequireEventApproval, getRequireProductApproval, getRequiredPermission, getRssArticleSummaryFromItem, getStorefrontNextAuthOptions, getVendorCatalogCreateFlags, hasEntityPermission, hashOtpCode, hydrateVendorSessionUser, initWhatsappTriggerDispatcher, invalidateEventsCache, invalidateMultiVendorCache, invalidateRequireEventApprovalCache, invalidateRequireProductApprovalCache, invalidateVendorCatalogCreateFlagsCache, isAuthDebugClientEnabled, isAuthDebugEnabled, isCustomerTypeContact, isMaxPerUserUsageReached, isMaxTotalUsageReached, isOpenEndpoint, isOrderEligibleForInvoiceEmail, isPlatformAdministrator, isPublicMethod, isRbacDebugEnabled, isSuperAdmin, isSuperAdminGroupName, isSyntheticCustomerPhone, isVendorAdmin, isVendorGroupName, isVendorOwner, isVendorPortalUser, isVendorStaff, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, llmPlugin, loadPublicThemeSettings, loadSettingsGroupFromDb, loadUserVendorContext, localStoragePlugin, logAuth, logAuthClient, logEntityAccessDecision, logRbac, mergeEmailLayoutCompanyDetails, mergeGuardrailsIntoSystemPrompt, mergeInventoryLines, mergeSeoBySlug, messagingPlugins, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, newUserInviteToken, nextAuthCookieDebugInfo, normalizeCustomerPhone, normalizeInvoiceTemplateId, normalizePhoneE164, normalizeRefundTiers, notificationTriggerEmitter, orderInventorySnapshotFromRow, orderStatusHoldsStock, overlayCmsPlugins, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseEmailRecipientsFromConfig, parseHfInferenceEmbeddingBody, parseLlmAgentValidationRules, paymentPlugin, permissionRowsToRecord, pgBossPlugin, pgBossScheduleNameForId, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueJobScheduleNow, queueOrderPlacedEmails, queuePlugin, queueSms, queueVendorOnboardEmails, queueWhatsApp, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, reconcileOrderInventoryBetweenSnapshots, recordDiscountUsage, registerEmailQueueProcessor, registerErpQueueProcessor, registerJobRunnerWorker, registerMessagingQueueProcessors, registerSmsQueueProcessor, registerWhatsAppQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resendOrderNotification, resolveBlogCategoryIdByName, resolveEventOrderTemplate, resolveInvoiceAssetUrl, resolveOrderInvoicePdfBytes, resolvePublicMetadata, resolveSettingsEncryptionKey, resolveVendorIdForContactCheck, resolveVendorScopeFromSessionUser, restoreInventoryForCancelledOrder, retireSoftDeletedUniqueValue, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedAdministratorPermissions, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, sendVendorOnboardEmails, serializeEmailRecipients, sessionHasEntityAccess, shouldRateLimitPublicWrite, simpleDecrypt, simpleEncrypt, smsPlugin, socialMediaPlugin, streamOrderInvoicePdf, summarizeEntityPerms, summarizeSessionUserForLog, syncJobScheduleToPgBoss, truncateText, validateInventoryForConfirmedOrderLines, validateInventoryForOrderBecomingConfirmed, validateRefundTiers, validateScheduleInput, validateSlug, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules, vendorPortalFlagsFromUser, verifyAndConsumeOtpChallenge, verifyOtpCodeHash, whatsappPlugin, withAdminRlsContext, withVendorRlsContext, wrapGetCmsWithMessaging };