@infuro/cms-core 1.0.30 → 1.0.33

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 (61) hide show
  1. package/README.md +20 -15
  2. package/dist/admin.cjs +13061 -7814
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +13 -2
  5. package/dist/admin.d.ts +13 -2
  6. package/dist/admin.js +8416 -3167
  7. package/dist/admin.js.map +1 -1
  8. package/dist/api.cjs +5667 -1110
  9. package/dist/api.cjs.map +1 -1
  10. package/dist/api.d.cts +2 -2
  11. package/dist/api.d.ts +2 -2
  12. package/dist/api.js +5418 -855
  13. package/dist/api.js.map +1 -1
  14. package/dist/auth.cjs +620 -76
  15. package/dist/auth.cjs.map +1 -1
  16. package/dist/auth.d.cts +93 -52
  17. package/dist/auth.d.ts +93 -52
  18. package/dist/auth.js +578 -52
  19. package/dist/auth.js.map +1 -1
  20. package/dist/cli.cjs +19 -15
  21. package/dist/cli.cjs.map +1 -1
  22. package/dist/cli.js +19 -15
  23. package/dist/cli.js.map +1 -1
  24. package/dist/{index-BPQSXgXF.d.cts → index-DWd5Gjc4.d.ts} +38 -5
  25. package/dist/{index-D9SdaDJ0.d.ts → index-rZTnpK7y.d.cts} +38 -5
  26. package/dist/index.cjs +5921 -1177
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +334 -59
  29. package/dist/index.d.ts +334 -59
  30. package/dist/index.js +5733 -1026
  31. package/dist/index.js.map +1 -1
  32. package/dist/migrations/1775400000001-AddDiscountAndOrderAddresses.ts +274 -0
  33. package/dist/migrations/1775800000000-VendorsAndVendorUsers.ts +74 -0
  34. package/dist/migrations/1775900000000-StoreVendorIdColumns.ts +124 -0
  35. package/dist/migrations/1775910000000-VendorOwnerRbacSeed.ts +54 -0
  36. package/dist/migrations/1775920000000-VendorOwnerSettingsPermission.ts +25 -0
  37. package/dist/migrations/1775930000000-VendorGroupStorePermissions.ts +54 -0
  38. package/dist/migrations/1775940000000-VendorRls.ts +71 -0
  39. package/dist/migrations/1775950000000-VendorCustomers.ts +87 -0
  40. package/dist/migrations/1775950000001-VendorCustomersPermissions.ts +67 -0
  41. package/dist/migrations/1778652250860-CreateCurrencyTables.ts +16 -0
  42. package/dist/migrations/1778652250861-OrderAddressTables.ts +88 -0
  43. package/dist/migrations/1778652250862-UpdateDiscountandRules.ts +100 -0
  44. package/dist/migrations/1778652250863-MakeCouponCodeNullable.ts +19 -0
  45. package/dist/migrations/1778652250864-RemoveUniqueConstraintFromDiscountCouponCode.ts +22 -0
  46. package/dist/migrations/1778652250865-FixOrdersAddressForeignKeys.ts +71 -0
  47. package/dist/migrations/1778660000000-DiscountVendorId.ts +90 -0
  48. package/dist/migrations/1778660000001-FixOrdersAddressFkToOrderAddresses.ts +79 -0
  49. package/dist/migrations/1778660000002-VendorUserIdInviteStatus.ts +61 -0
  50. package/dist/migrations/1778660000003-AddQrTokenToOrders.ts +32 -0
  51. package/dist/migrations/1779100000000-ChatConversationLeadEmailSent.ts +16 -0
  52. package/dist/migrations/1779200000000-LlmAgentScope.ts +72 -0
  53. package/dist/theme.d.cts +2 -2
  54. package/dist/theme.d.ts +2 -2
  55. package/dist/{types-D34wmivy.d.cts → types-DCVaXlPV.d.cts} +1 -1
  56. package/dist/{types-D34wmivy.d.ts → types-DCVaXlPV.d.ts} +1 -1
  57. package/dist/vendor-scope-DTYhJk_I.d.cts +129 -0
  58. package/dist/vendor-scope-DTYhJk_I.d.ts +129 -0
  59. package/package.json +3 -2
  60. package/dist/helpers-dlrF_49e.d.cts +0 -60
  61. package/dist/helpers-dlrF_49e.d.ts +0 -60
package/dist/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
- import { C as CompanyDetails, T as TemplateContext, E as EmailTemplateResult, a as EmailTemplateName, O as OrderPlacedLineItem, S as StorageService, b as EntityMap$2 } from './index-D9SdaDJ0.js';
2
- export { A as AnalyticsHandlerConfig, c as AuthHandlersConfig, B as BlogBySlugConfig, d as ChangePasswordConfig, e as ChatPublicConfig, f as CmsApiHandlerConfig, g as CmsGetter, h as CrudHandlerOptions, D as DashboardStatsConfig, i as EcommerceAnalyticsConfig, F as ForgotPasswordConfig, j as FormBySlugConfig, G as GetPublicSettingsGroupConfig, k as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, J as JobScheduleApiConfig, L as LlmAgentKnowledgeApiConfig, l as LlmAgentValidationRulesJson, P as ParsedLlmAgentValidation, m as SetPasswordConfig, n as SettingsApiConfig, o as SocialLinkItem, p as StorefrontApiConfig, q as StorefrontOtpFlags, U as UploadHandlerConfig, r as UserAuthApiConfig, s as UserAvatarConfig, t as UserProfileConfig, u as UsersApiConfig, v as createAnalyticsHandlers, w as createBlogBySlugHandler, x as createChangePasswordHandler, y as createCmsApiHandler, z as createCrudByIdHandler, H as createCrudHandler, K as createDashboardStatsHandler, M as createEcommerceAnalyticsHandler, N as createForgotPasswordHandler, Q as createFormBySlugHandler, R as createInviteAcceptHandler, V as createJobScheduleHandlers, W as createLlmAgentKnowledgeHandlers, X as createMediaZipExtractHandler, Y as createSetPasswordHandler, Z as createSettingsApiHandlers, _ as createStorefrontApiHandler, $ as createUploadHandler, a0 as createUserAuthApiRouter, a1 as createUserAvatarHandler, a2 as createUserProfileHandler, a3 as createUsersApiHandlers, a4 as getCompanyDetailsFromSettings, a5 as getPublicSettingsGroup, a6 as mergeEmailLayoutCompanyDetails, a7 as mergeGuardrailsIntoSystemPrompt, a8 as parseLlmAgentValidationRules, a9 as simpleDecrypt, aa as simpleEncrypt, ab as validateUserMessageAgainstAgentRules, ac as validateUserMessageAgainstStructuredRules } from './index-D9SdaDJ0.js';
1
+ import { e as CompanyDetails, T as TemplateContext, h as EmailTemplateResult, g as EmailTemplateName, O as OrderPlacedLineItem, o as StorageService, i as EntityMap$2 } from './index-DWd5Gjc4.js';
2
+ export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as ChatPublicConfig, c as CmsApiHandlerConfig, d as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, E as EcommerceAnalyticsConfig, F as ForgotPasswordConfig, j as FormBySlugConfig, G as GetPublicSettingsGroupConfig, k as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, J as JobScheduleApiConfig, L as LlmAgentKnowledgeApiConfig, l as LlmAgentValidationRulesJson, P as ParsedLlmAgentValidation, S as SetPasswordConfig, m as SettingsApiConfig, n as SocialLinkItem, p as StorefrontApiConfig, q as StorefrontOtpFlags, U as UploadHandlerConfig, r as UserAuthApiConfig, s as UserAvatarConfig, t as UserProfileConfig, u as UsersApiConfig, V as VendorOnboardHandlersConfig, v as VendorOwnerActivation, w as createAnalyticsHandlers, x as createBlogBySlugHandler, y as createChangePasswordHandler, z as createCmsApiHandler, H as createCrudByIdHandler, K as createCrudHandler, M as createDashboardStatsHandler, N as createEcommerceAnalyticsHandler, Q as createForgotPasswordHandler, R as createFormBySlugHandler, W as createInviteAcceptHandler, X as createJobScheduleHandlers, Y as createLlmAgentKnowledgeHandlers, Z as createMediaZipExtractHandler, _ as createSetPasswordHandler, $ as createSettingsApiHandlers, a0 as createStorefrontApiHandler, a1 as createUploadHandler, a2 as createUserAuthApiRouter, a3 as createUserAvatarHandler, a4 as createUserProfileHandler, a5 as createUsersApiHandlers, a6 as createVendorOnboardHandlers, a7 as getCompanyDetailsFromSettings, a8 as getPublicSettingsGroup, a9 as mergeEmailLayoutCompanyDetails, aa as mergeGuardrailsIntoSystemPrompt, ab as parseLlmAgentValidationRules, ac as simpleDecrypt, ad as simpleEncrypt, ae as validateUserMessageAgainstAgentRules, af as validateUserMessageAgainstStructuredRules } from './index-DWd5Gjc4.js';
3
3
  import PgBoss from 'pg-boss';
4
4
  import * as typeorm from 'typeorm';
5
- import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
5
+ import { DataSource, EntityTarget, ObjectLiteral, SelectQueryBuilder } from 'typeorm';
6
6
  import { ClassValue } from 'clsx';
7
7
  import { Metadata } from 'next';
8
- import { N as NavbarConfig, F as FooterConfig } from './types-D34wmivy.js';
9
- import { E as EntityCrudAction } from './helpers-dlrF_49e.js';
10
- export { A as ADMIN_GROUP_NAME, a as AuthHelpers, b as EntityPermissionFlags, G as GetSession, O as OPEN_ENDPOINTS, P as PERMISSION_REQUIRED_ENDPOINTS, R as RBAC_ADMIN_ONLY_ENTITIES, S as SessionUser, c as canManageRoles, d as createAuthHelpers, g as getPermissionableEntityKeys, e as getRequiredPermission, h as hasEntityPermission, i as isOpenEndpoint, f as isPublicMethod, j as isSuperAdminGroupName, p as permissionRowsToRecord, s as sessionHasEntityAccess } from './helpers-dlrF_49e.js';
11
- export { AuthorizeOtpInput, CmsMiddlewareConfig, NextAuthOptionsConfig, NextAuthUser, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, seedAdministratorPermissions } from './auth.js';
8
+ import { NextAuthUser } from './auth.js';
9
+ export { AuthorizeOtpInput, CmsMiddlewareConfig, CmsMiddlewareRequest, NextAuthOptionsConfig, createCmsMiddleware, defaultPublicApiMethods, explainSessionEntityAccess, getNextAuthOptions, isAuthDebugClientEnabled, isAuthDebugEnabled, isRbacDebugEnabled, logAuth, logAuthClient, logEntityAccessDecision, logRbac, nextAuthCookieDebugInfo, seedAdministratorPermissions, summarizeEntityPerms, summarizeSessionUserForLog } from './auth.js';
10
+ import { E as EntityCrudAction, S as SessionUser, e as VendorScope } from './vendor-scope-DTYhJk_I.js';
11
+ export { A as ADMIN_GROUP_NAME, a as AuthHelpers, b as EntityPermissionFlags, G as GetSession, O as OPEN_ENDPOINTS, P as PERMISSION_REQUIRED_ENDPOINTS, R as RBAC_ADMIN_ONLY_ENTITIES, V as VENDOR_OWNER_GROUP_NAME, c as VENDOR_SCOPED_STORE_ENTITIES, d as VENDOR_STORE_RBAC_ENTITIES, f as canManageRoles, g as canManageVendorRoles, h as canManageVendorTeam, i as canOnboardVendors, j as createAuthHelpers, k as createCmsAuthBundle, l as getPermissionableEntityKeys, m as getRequiredPermission, n as hasEntityPermission, o as isOpenEndpoint, p as isPlatformAdministrator, q as isPublicMethod, r as isSuperAdminGroupName, s as isVendorGroupName, t as isVendorOwner, u as isVendorPortalUser, v as isVendorStaff, w as permissionRowsToRecord, x as resolveVendorScopeFromSessionUser, y as sessionHasEntityAccess, z as vendorPortalFlagsFromUser } from './vendor-scope-DTYhJk_I.js';
12
+ import { a as NavbarConfig, F as FooterConfig } from './types-DCVaXlPV.js';
12
13
  export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.js';
14
+ import 'next-auth/jwt';
13
15
  import 'next-auth';
14
16
 
15
17
  interface PluginContext {
@@ -245,6 +247,8 @@ declare class EmailService implements EmailServiceInterface {
245
247
  constructor(config: EmailPluginConfig$1);
246
248
  send(emailData: EmailData): Promise<boolean>;
247
249
  renderTemplate(templateName: EmailTemplateName, ctx: TemplateContext<unknown>): RenderedEmail;
250
+ /** Default notification recipient from plugin config (SMTP_TO / plugin `to`). */
251
+ getDefaultTo(): string;
248
252
  }
249
253
  declare const emailTemplates: {
250
254
  formSubmission: (data: {
@@ -614,6 +618,38 @@ declare class LlmService implements LlmServiceInterface {
614
618
  streamChat(messages: LlmMessage[], options?: LlmChatOptions): AsyncIterable<string>;
615
619
  }
616
620
 
621
+ declare class LlmAgent {
622
+ id: number;
623
+ name: string;
624
+ /** Stable key for API / widgets (e.g. `support`, `sales`). */
625
+ slug: string;
626
+ /**
627
+ * Logical role for this agent (`chatbot`, `blog_creation`, `social_media_post`, `email_intent_chatbot`, …).
628
+ * At most one active row per scope; resolve agents by scope in application code.
629
+ */
630
+ scope: string | null;
631
+ /** Passed as `systemPrompt` to `LlmService.chatAgent`. */
632
+ systemInstruction: string;
633
+ model: string | null;
634
+ temperature: number | null;
635
+ maxTokens: number | null;
636
+ /**
637
+ * Rules string: plain prose → appended to system prompt as output guardrails; JSON → see `parseLlmAgentValidationRules` in cms-handlers
638
+ * (structural checks + optional `guardrails` / `outputRules` / `outputInstructions` for the model).
639
+ */
640
+ validationRules: string | null;
641
+ enabled: boolean;
642
+ createdAt: Date;
643
+ updatedAt: Date;
644
+ deletedAt: Date | null;
645
+ deleted: boolean;
646
+ createdBy: number | null;
647
+ updatedBy: number | null;
648
+ deletedBy: number | null;
649
+ }
650
+ /** Partial {@link LlmAgentOptions} for merging with `userPrompt` / `history` / `context`. */
651
+ declare function llmAgentToChatAgentOptions(agent: LlmAgent): Pick<LlmAgentOptions, 'systemPrompt' | 'model' | 'temperature' | 'max_tokens'>;
652
+
617
653
  interface LlmPluginConfig {
618
654
  baseURL?: string;
619
655
  apiKey?: string;
@@ -1209,33 +1245,29 @@ declare function seedDefaultAdmin(ds: DataSource, entityMap: SeedEntityMap, opts
1209
1245
  password?: string;
1210
1246
  }): Promise<void>;
1211
1247
 
1212
- interface PublicThemeSettingsPayload {
1213
- activeThemeId: string;
1214
- primaryColor: string;
1215
- secondaryColor: string;
1216
- navbarConfig: NavbarConfig;
1217
- footerOverrides: Partial<FooterConfig>;
1248
+ type VendorInviteStatus = 'none' | 'pending' | 'expired' | 'accepted';
1249
+ declare class Vendor {
1250
+ id: number;
1251
+ name: string;
1252
+ slug: string;
1253
+ email: string | null;
1254
+ phone: string | null;
1255
+ logo: string | null;
1256
+ description: string | null;
1257
+ metadata: Record<string, unknown> | null;
1258
+ active: boolean;
1259
+ /** Primary owner user for this vendor (set on onboard). */
1260
+ userId: number | null;
1261
+ inviteStatus: VendorInviteStatus;
1262
+ createdAt: Date;
1263
+ updatedAt: Date;
1264
+ deletedAt: Date | null;
1265
+ deleted: boolean;
1266
+ createdBy: number | null;
1267
+ updatedBy: number | null;
1268
+ deletedBy: number | null;
1269
+ vendorUsers: VendorUser[];
1218
1270
  }
1219
- declare function loadPublicThemeSettings(config: {
1220
- dataSource: DataSource;
1221
- entityMap: EntityMap$2;
1222
- encryptionKey?: string;
1223
- defaultActiveThemeId?: string;
1224
- defaultPrimaryColor?: string;
1225
- defaultSecondaryColor?: string;
1226
- }): Promise<PublicThemeSettingsPayload>;
1227
-
1228
- /** Normalize a logical media folder path: no leading/trailing slashes, no ".." segments, max length. */
1229
- declare function sanitizeMediaFolderPath(input: unknown): string;
1230
- /** Single path segment for storage (folder name or legacy path segment). */
1231
- declare function sanitizeStorageSegment(name: string): string;
1232
-
1233
- type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
1234
- /** Build `a/b/c` path under `uploads/` from the chain of folder rows up to root. */
1235
- declare function relativePathFromMediaParentId(dataSource: DataSource, entityMap: EntityMap, parentId: number | null): Promise<string>;
1236
-
1237
- declare const ZIP_MIME_TYPES: Set<string>;
1238
- declare function isZipMedia(mime: string | null | undefined, filename: string): boolean;
1239
1271
 
1240
1272
  declare class Permission {
1241
1273
  id: number;
@@ -1291,6 +1323,94 @@ declare class User {
1291
1323
  group: UserGroup | null;
1292
1324
  }
1293
1325
 
1326
+ /** Links a staff user to a vendor store. */
1327
+ type VendorUserRole = 'owner' | 'staff';
1328
+ declare class VendorUser {
1329
+ id: number;
1330
+ vendorId: number;
1331
+ userId: number;
1332
+ role: VendorUserRole;
1333
+ createdAt: Date;
1334
+ updatedAt: Date;
1335
+ vendor: Vendor;
1336
+ user: User;
1337
+ }
1338
+
1339
+ /** Load vendor membership for session (call from app `getUserByEmail`).
1340
+ *
1341
+ * Uses a raw SQL query so it works even when the consuming app's DataSource
1342
+ * does not explicitly register the VendorUser entity.
1343
+ */
1344
+ declare function loadUserVendorContext(dataSource: DataSource, userId: number, preferredVendorId?: number | null): Promise<{
1345
+ vendorIds: number[];
1346
+ activeVendorId: number | null;
1347
+ vendorRole: VendorUserRole | null;
1348
+ }>;
1349
+
1350
+ /** Attach vendorIds / activeVendorId / vendorRole for NextAuth (use in app getUserByEmail). */
1351
+ declare function enrichUserWithVendorContext(dataSource: DataSource, user: NextAuthUser | null): Promise<NextAuthUser | null>;
1352
+
1353
+ /** Merge DB group + vendor_users into session (JWT often missing these). Server/API only. */
1354
+ declare function hydrateVendorSessionUser(dataSource: DataSource, user: SessionUser | null | undefined): Promise<SessionUser | null | undefined>;
1355
+
1356
+ interface PublicThemeSettingsPayload {
1357
+ activeThemeId: string;
1358
+ primaryColor: string;
1359
+ secondaryColor: string;
1360
+ navbarConfig: NavbarConfig;
1361
+ footerOverrides: Partial<FooterConfig>;
1362
+ }
1363
+ declare function loadPublicThemeSettings(config: {
1364
+ dataSource: DataSource;
1365
+ entityMap: EntityMap$2;
1366
+ encryptionKey?: string;
1367
+ defaultActiveThemeId?: string;
1368
+ defaultPrimaryColor?: string;
1369
+ defaultSecondaryColor?: string;
1370
+ }): Promise<PublicThemeSettingsPayload>;
1371
+
1372
+ /** Normalize a logical media folder path: no leading/trailing slashes, no ".." segments, max length. */
1373
+ declare function sanitizeMediaFolderPath(input: unknown): string;
1374
+ /** Single path segment for storage (folder name or legacy path segment). */
1375
+ declare function sanitizeStorageSegment(name: string): string;
1376
+
1377
+ type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
1378
+ /** Build `a/b/c` path under `uploads/` from the chain of folder rows up to root. */
1379
+ declare function relativePathFromMediaParentId(dataSource: DataSource, entityMap: EntityMap, parentId: number | null): Promise<string>;
1380
+
1381
+ declare const ZIP_MIME_TYPES: Set<string>;
1382
+ declare function isZipMedia(mime: string | null | undefined, filename: string): boolean;
1383
+
1384
+ /**
1385
+ * Executes `fn` inside a transaction where the PostgreSQL GUC
1386
+ * `app.vendor_id` is set for the duration of that transaction.
1387
+ *
1388
+ * This activates the `vendor_isolation` RLS policy added by the
1389
+ * `VendorRls1775940000000` migration.
1390
+ *
1391
+ * vendorId = 0 → admin / all-access (policy allows everything)
1392
+ * vendorId > 0 → only rows whose `vendorId` column matches
1393
+ *
1394
+ * Example:
1395
+ * const orders = await withVendorRlsContext(dataSource, 4, (ds) =>
1396
+ * ds.getRepository(Order).find({ where: { deleted: false } })
1397
+ * );
1398
+ */
1399
+ declare function withVendorRlsContext<T>(dataSource: DataSource, vendorId: number, fn: (dataSource: DataSource) => Promise<T>): Promise<T>;
1400
+ /**
1401
+ * Convenience wrapper: sets admin mode (vendor_id = '0') so all rows are
1402
+ * visible regardless of their vendorId. Use for platform-admin queries.
1403
+ */
1404
+ declare function withAdminRlsContext<T>(dataSource: DataSource, fn: (dataSource: DataSource) => Promise<T>): Promise<T>;
1405
+
1406
+ declare function isCustomerTypeContact(type: unknown): boolean;
1407
+ /** Restrict contact list to rows linked in `vendor_customers` with type customer. */
1408
+ declare function applyVendorCustomersContactFilter(qb: SelectQueryBuilder<typeorm.ObjectLiteral>, contactAlias: string, scope: VendorScope, vendorIdFilter: number | null): void;
1409
+ declare function contactIsVendorCustomer(dataSource: DataSource, entityMap: EntityMap$2, vendorId: number, contactId: number): Promise<boolean>;
1410
+ /** Returns an error message when the contact is not a vendor-linked customer; otherwise null. */
1411
+ declare function assertContactAllowedForVendorOrder(dataSource: DataSource, entityMap: EntityMap$2, vendorId: number, contactId: number): Promise<string | null>;
1412
+ declare function resolveVendorIdForContactCheck(scope: VendorScope, bodyOrRow: Record<string, unknown>): number | null;
1413
+
1294
1414
  declare class OtpChallenge {
1295
1415
  id: number;
1296
1416
  purpose: string;
@@ -1468,6 +1588,7 @@ declare class Address {
1468
1588
 
1469
1589
  declare class ProductCategory {
1470
1590
  id: number;
1591
+ vendorId: number;
1471
1592
  name: string;
1472
1593
  slug: string;
1473
1594
  parentId: number | null;
@@ -1483,6 +1604,7 @@ declare class ProductCategory {
1483
1604
  createdBy: number | null;
1484
1605
  updatedBy: number | null;
1485
1606
  deletedBy: number | null;
1607
+ vendor: Vendor;
1486
1608
  parent: ProductCategory | null;
1487
1609
  children: ProductCategory[];
1488
1610
  products: Product[];
@@ -1491,6 +1613,7 @@ declare class ProductCategory {
1491
1613
 
1492
1614
  declare class Brand {
1493
1615
  id: number;
1616
+ vendorId: number;
1494
1617
  name: string;
1495
1618
  slug: string;
1496
1619
  logo: string | null;
@@ -1506,6 +1629,7 @@ declare class Brand {
1506
1629
  updatedBy: number | null;
1507
1630
  deletedBy: number | null;
1508
1631
  seoId: number | null;
1632
+ vendor: Vendor;
1509
1633
  seo: Seo | null;
1510
1634
  products: Product[];
1511
1635
  collections: Collection[];
@@ -1513,6 +1637,7 @@ declare class Brand {
1513
1637
 
1514
1638
  declare class Collection {
1515
1639
  id: number;
1640
+ vendorId: number;
1516
1641
  categoryId: number | null;
1517
1642
  brandId: number | null;
1518
1643
  name: string;
@@ -1532,6 +1657,7 @@ declare class Collection {
1532
1657
  updatedBy: number | null;
1533
1658
  deletedBy: number | null;
1534
1659
  seoId: number | null;
1660
+ vendor: Vendor;
1535
1661
  seo: Seo | null;
1536
1662
  category: ProductCategory | null;
1537
1663
  brand: Brand | null;
@@ -1540,6 +1666,7 @@ declare class Collection {
1540
1666
 
1541
1667
  declare class Attribute {
1542
1668
  id: number;
1669
+ vendorId: number;
1543
1670
  name: string;
1544
1671
  slug: string;
1545
1672
  type: 'text' | 'number' | 'select' | 'boolean';
@@ -1554,6 +1681,7 @@ declare class Attribute {
1554
1681
  createdBy: number | null;
1555
1682
  updatedBy: number | null;
1556
1683
  deletedBy: number | null;
1684
+ vendor: Vendor;
1557
1685
  }
1558
1686
 
1559
1687
  declare class ProductAttribute {
@@ -1570,6 +1698,7 @@ declare class ProductAttribute {
1570
1698
 
1571
1699
  declare class Tax {
1572
1700
  id: number;
1701
+ vendorId: number;
1573
1702
  name: string;
1574
1703
  slug: string;
1575
1704
  rate: number;
@@ -1584,6 +1713,7 @@ declare class Tax {
1584
1713
  createdBy: number | null;
1585
1714
  updatedBy: number | null;
1586
1715
  deletedBy: number | null;
1716
+ vendor: Vendor;
1587
1717
  }
1588
1718
 
1589
1719
  declare class ProductTax {
@@ -1599,6 +1729,7 @@ declare class ProductTax {
1599
1729
 
1600
1730
  declare class Product {
1601
1731
  id: number;
1732
+ vendorId: number;
1602
1733
  collectionId: number | null;
1603
1734
  brandId: number | null;
1604
1735
  categoryId: number | null;
@@ -1623,6 +1754,7 @@ declare class Product {
1623
1754
  updatedBy: number | null;
1624
1755
  deletedBy: number | null;
1625
1756
  seoId: number | null;
1757
+ vendor: Vendor;
1626
1758
  seo: Seo | null;
1627
1759
  collection: Collection | null;
1628
1760
  brand: Brand | null;
@@ -1635,8 +1767,12 @@ declare class OrderItem {
1635
1767
  id: number;
1636
1768
  orderId: number;
1637
1769
  productId: number;
1770
+ discountIds: number[];
1638
1771
  quantity: number;
1639
1772
  unitPrice: number;
1773
+ subTotal: number;
1774
+ discount: number;
1775
+ discountedAmount: number;
1640
1776
  tax: number;
1641
1777
  total: number;
1642
1778
  /** Snapshot at order time */
@@ -1655,6 +1791,7 @@ declare class OrderItem {
1655
1791
 
1656
1792
  declare class Payment {
1657
1793
  id: number;
1794
+ vendorId: number;
1658
1795
  orderId: number;
1659
1796
  contactId: number | null;
1660
1797
  amount: number;
@@ -1671,14 +1808,38 @@ declare class Payment {
1671
1808
  createdBy: number | null;
1672
1809
  updatedBy: number | null;
1673
1810
  deletedBy: number | null;
1811
+ vendor: Vendor;
1674
1812
  order: Order;
1675
1813
  contact: Contact | null;
1676
1814
  }
1677
1815
 
1816
+ declare enum AddressType {
1817
+ SHIPPING_ADDRESS = "shipping_address",
1818
+ BILLING_ADDRESS = "billing_address"
1819
+ }
1820
+ declare class OrderAddresses {
1821
+ id: number;
1822
+ contactId: number;
1823
+ addressType: AddressType;
1824
+ line1: string;
1825
+ line2: string | null;
1826
+ city: string;
1827
+ state: string;
1828
+ postalCode: string;
1829
+ country: string;
1830
+ createdAt: Date;
1831
+ updatedAt: Date;
1832
+ contact: Contact;
1833
+ billingOrders: Order[];
1834
+ shippingOrders: Order[];
1835
+ }
1836
+
1678
1837
  type OrderKind = 'sale' | 'return' | 'replacement';
1679
1838
  declare class Order {
1680
1839
  id: number;
1840
+ vendorId: number;
1681
1841
  orderNumber: string;
1842
+ qrToken: string | null;
1682
1843
  orderKind: OrderKind;
1683
1844
  parentOrderId: number | null;
1684
1845
  contactId: number;
@@ -1698,11 +1859,12 @@ declare class Order {
1698
1859
  createdBy: number | null;
1699
1860
  updatedBy: number | null;
1700
1861
  deletedBy: number | null;
1862
+ vendor: Vendor;
1701
1863
  parentOrder: Order | null;
1702
1864
  children: Order[];
1703
1865
  contact: Contact;
1704
- billingAddress: Address | null;
1705
- shippingAddress: Address | null;
1866
+ billingAddress: OrderAddresses | null;
1867
+ shippingAddress: OrderAddresses | null;
1706
1868
  items: OrderItem[];
1707
1869
  payments: Payment[];
1708
1870
  }
@@ -1721,6 +1883,8 @@ declare class ChatConversation {
1721
1883
  contactId: number;
1722
1884
  createdAt: Date;
1723
1885
  updatedAt: Date;
1886
+ /** Set when a chat lead email was sent for this conversation (intent tool). */
1887
+ leadEmailSentAt: Date | null;
1724
1888
  contact: Contact;
1725
1889
  messages: ChatMessage[];
1726
1890
  }
@@ -1748,6 +1912,7 @@ declare class Contact {
1748
1912
  orders: Order[];
1749
1913
  payments: Payment[];
1750
1914
  chatConversations: ChatConversation[];
1915
+ orderAddresses: OrderAddresses[];
1751
1916
  }
1752
1917
 
1753
1918
  declare class Config {
@@ -1888,32 +2053,127 @@ declare class Wishlist {
1888
2053
  items: WishlistItem[];
1889
2054
  }
1890
2055
 
1891
- declare class LlmAgent {
2056
+ declare class Currency {
1892
2057
  id: number;
2058
+ code: string;
1893
2059
  name: string;
1894
- /** Stable key for API / widgets (e.g. `support`, `sales`). */
1895
- slug: string;
1896
- /** Passed as `systemPrompt` to `LlmService.chatAgent`. */
1897
- systemInstruction: string;
1898
- model: string | null;
1899
- temperature: number | null;
1900
- maxTokens: number | null;
1901
- /**
1902
- * Rules string: plain prose → appended to system prompt as output guardrails; JSON → see `parseLlmAgentValidationRules` in cms-handlers
1903
- * (structural checks + optional `guardrails` / `outputRules` / `outputInstructions` for the model).
1904
- */
1905
- validationRules: string | null;
1906
- enabled: boolean;
1907
- createdAt: Date;
1908
- updatedAt: Date;
1909
- deletedAt: Date | null;
1910
- deleted: boolean;
1911
- createdBy: number | null;
1912
- updatedBy: number | null;
1913
- deletedBy: number | null;
2060
+ symbol: string;
2061
+ isActive: boolean;
2062
+ isBaseCurrency: boolean;
2063
+ }
2064
+
2065
+ declare class CurrencyExchange {
2066
+ id: number;
2067
+ fromCurrency: string;
2068
+ toCurrency: string;
2069
+ rate: number;
2070
+ }
2071
+
2072
+ declare enum Type {
2073
+ MIN_AMOUNT = "minAmount",
2074
+ USER = "user",
2075
+ PRODUCT = "product",
2076
+ CATEGORY = "category",
2077
+ CART = "cart",
2078
+ PAYMENT_METHOD = "paymentMethod",
2079
+ ORDER = "order",
2080
+ QUANTITY = "quantity",
2081
+ TIME = "time",
2082
+ SHIPPING = "shipping",
2083
+ REFERRAL = "referral",
2084
+ REWARD = "reward"
2085
+ }
2086
+ declare enum SubType {
2087
+ USER_TYPE = "userType",
2088
+ USER_ID = "userId",
2089
+ PRODUCT_ID = "productId",
2090
+ CATEGORY_ID = "categoryId",
2091
+ CART_ID = "cartId",
2092
+ ORDER_ID = "orderId",
2093
+ FIRST_ORDER = "firstOrder",
2094
+ NTH_ORDER = "nthOrder",
2095
+ DATE_RANGE = "dateRange",
2096
+ DAY_OF_WEEK = "dayOfWeek",
2097
+ TIME_RANGE = "timeRange"
2098
+ }
2099
+ declare enum ConditionType {
2100
+ GROUP = "group",
2101
+ RULE = "rule"
2102
+ }
2103
+ declare enum ConditionOperator {
2104
+ AND = "and",
2105
+ OR = "or"
2106
+ }
2107
+ declare enum ComparisonOperator {
2108
+ EQ = "eq",
2109
+ NEQ = "neq",
2110
+ GT = "gt",
2111
+ GTE = "gte",
2112
+ LT = "lt",
2113
+ LTE = "lte",
2114
+ IN = "in",
2115
+ NOT_IN = "notIn",
2116
+ BETWEEN = "between"
2117
+ }
2118
+ declare class DiscountRules {
2119
+ id: number;
2120
+ discount: Discount;
2121
+ discountId: number;
2122
+ parent?: DiscountRules;
2123
+ children: DiscountRules[];
2124
+ parentId?: number;
2125
+ conditionType: ConditionType;
2126
+ conditionOperator?: ConditionOperator;
2127
+ type?: Type;
2128
+ subType?: SubType;
2129
+ comparisonOperator?: ComparisonOperator;
2130
+ value: Record<string, any>;
2131
+ }
2132
+
2133
+ declare enum DiscountType {
2134
+ PERCENTAGE = "PERCENTAGE",
2135
+ FLAT = "FLAT"
2136
+ }
2137
+ declare enum DiscountStatus {
2138
+ ACTIVE = "ACTIVE",
2139
+ INACTIVE = "INACTIVE",
2140
+ EXPIRED = "EXPIRED"
2141
+ }
2142
+ declare class Discount {
2143
+ id: number;
2144
+ vendorId: number;
2145
+ vendor: Vendor;
2146
+ name: string;
2147
+ couponCode: string;
2148
+ description?: string;
2149
+ discountType: DiscountType;
2150
+ value: number;
2151
+ maxDiscountAmount?: number;
2152
+ maxTotalUsage?: number;
2153
+ maxUsagePerUser?: number;
2154
+ usedCount: number;
2155
+ validFrom: Date;
2156
+ validUntil: Date;
2157
+ status: DiscountStatus;
2158
+ canCombineWithOtherDiscounts: boolean;
2159
+ isAutomatic: boolean;
2160
+ currency: string;
2161
+ rules: DiscountRules[];
2162
+ }
2163
+
2164
+ declare class OrderDiscounts {
2165
+ id: number;
2166
+ order: Order;
2167
+ orderId: number;
2168
+ orderItem: OrderItem;
2169
+ orderItemId: number;
2170
+ userId: number;
2171
+ discount?: Discount;
2172
+ discountId: number;
2173
+ discountCode: string;
2174
+ discountAmount: number;
2175
+ metaData?: Record<string, any>;
1914
2176
  }
1915
- /** Partial {@link LlmAgentOptions} for merging with `userPrompt` / `history` / `context`. */
1916
- declare function llmAgentToChatAgentOptions(agent: LlmAgent): Pick<LlmAgentOptions, 'systemPrompt' | 'model' | 'temperature' | 'max_tokens'>;
1917
2177
 
1918
2178
  declare class RssArticle {
1919
2179
  id: string;
@@ -1947,7 +2207,22 @@ declare class RssFeed {
1947
2207
  updatedAt: Date;
1948
2208
  }
1949
2209
 
2210
+ /** Links a contact (customer) to a vendor store. One contact can belong to multiple vendors. */
2211
+ declare class VendorCustomer {
2212
+ id: number;
2213
+ vendorId: number;
2214
+ contactId: number;
2215
+ /** Optional vendor-specific notes about this customer. */
2216
+ notes: string | null;
2217
+ /** Optional vendor-specific tags/labels. */
2218
+ tags: string[] | null;
2219
+ createdAt: Date;
2220
+ updatedAt: Date;
2221
+ vendor: Vendor;
2222
+ contact: Contact;
2223
+ }
2224
+
1950
2225
  /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
1951
2226
  declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
1952
2227
 
1953
- export { Address, type AnalyticsPluginConfig, Attribute, 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 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, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, CompanyDetails, Config, Contact, type CreateCmsAppOptions, type DataSourceManager, type ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, EntityCrudAction, EntityMap$2 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, type ExtraPublicWriteRule, type FacebookMeAccountsResponse, type FacebookPageAccount, Form, FormField, FormSubmission, JOB_RUNNER_QUEUE, type CmsAppLike as JobRunnerCmsAppLike, type JobRunnerDeps, type JobRunnerPayload, JobSchedule, JobScheduleRun, KnowledgeBaseChunk, KnowledgeBaseDocument, type LatestArticleFromFeed, LlmAgent, type LlmAgentOptions, type LlmChatOptions, type LlmEmbeddingProvider, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceEmbedOptions, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, type MetaGraphMutationResponse, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PgBossPluginConfig, PgBossService, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, RssArticle, RssFeed, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, type SocialMediaPluginConfig, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, ZIP_MIME_TYPES, allowRateLimit, analyticsPlugin, assertCaptchaOk, blogGeneratorPlugin, buildBlogMetadataUserPrompt, buildCaptchaPublicConfig, buildCronFromSchedule, buildRssUserPromptFromFeeds, cachePlugin, captchaPlugin, cn, countRecentOtpSends, createCmsApp, createDataSourceManager, createOtpChallenge, createSocialMediaHandlers, emailPlugin, emailTemplates, ensureScheduleQueueWorker, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, getRssArticleSummaryFromItem, hashOtpCode, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, llmPlugin, loadPublicThemeSettings, localStoragePlugin, mergeSeoBySlug, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, normalizePhoneE164, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseEmailRecipientsFromConfig, parseHfInferenceEmbeddingBody, paymentPlugin, pgBossPlugin, pgBossScheduleNameForId, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueJobScheduleNow, queueOrderPlacedEmails, queuePlugin, queueSms, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, registerEmailQueueProcessor, registerErpQueueProcessor, registerJobRunnerWorker, registerSmsQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resolveBlogCategoryIdByName, resolvePublicMetadata, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, serializeEmailRecipients, shouldRateLimitPublicWrite, smsPlugin, socialMediaPlugin, syncJobScheduleToPgBoss, truncateText, validateScheduleInput, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash };
2228
+ export { Address, type AnalyticsPluginConfig, Attribute, 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 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, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, CompanyDetails, Config, Contact, type CreateCmsAppOptions, Currency, CurrencyExchange, type DataSourceManager, Discount, DiscountRules, type ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, EntityCrudAction, EntityMap$2 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, type ExtraPublicWriteRule, type FacebookMeAccountsResponse, type FacebookPageAccount, Form, FormField, FormSubmission, JOB_RUNNER_QUEUE, type CmsAppLike as JobRunnerCmsAppLike, type JobRunnerDeps, type JobRunnerPayload, JobSchedule, JobScheduleRun, KnowledgeBaseChunk, KnowledgeBaseDocument, type LatestArticleFromFeed, LlmAgent, type LlmAgentOptions, type LlmChatOptions, type LlmEmbeddingProvider, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceEmbedOptions, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, type MetaGraphMutationResponse, NextAuthUser, Order, OrderAddresses, OrderDiscounts, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PgBossPluginConfig, PgBossService, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, RssArticle, RssFeed, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, SessionUser, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, type SocialMediaPluginConfig, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Vendor, VendorCustomer, VendorUser, Wishlist, WishlistItem, ZIP_MIME_TYPES, allowRateLimit, analyticsPlugin, applyVendorCustomersContactFilter, assertCaptchaOk, assertContactAllowedForVendorOrder, blogGeneratorPlugin, buildBlogMetadataUserPrompt, buildCaptchaPublicConfig, buildCronFromSchedule, buildRssUserPromptFromFeeds, cachePlugin, captchaPlugin, cn, contactIsVendorCustomer, countRecentOtpSends, createCmsApp, createDataSourceManager, createOtpChallenge, createSocialMediaHandlers, emailPlugin, emailTemplates, enrichUserWithVendorContext, ensureScheduleQueueWorker, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, getRssArticleSummaryFromItem, hashOtpCode, hydrateVendorSessionUser, isCustomerTypeContact, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, llmPlugin, loadPublicThemeSettings, loadUserVendorContext, localStoragePlugin, mergeSeoBySlug, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, normalizePhoneE164, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseEmailRecipientsFromConfig, parseHfInferenceEmbeddingBody, paymentPlugin, pgBossPlugin, pgBossScheduleNameForId, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueJobScheduleNow, queueOrderPlacedEmails, queuePlugin, queueSms, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, registerEmailQueueProcessor, registerErpQueueProcessor, registerJobRunnerWorker, registerSmsQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resolveBlogCategoryIdByName, resolvePublicMetadata, resolveVendorIdForContactCheck, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, serializeEmailRecipients, shouldRateLimitPublicWrite, smsPlugin, socialMediaPlugin, syncJobScheduleToPgBoss, truncateText, validateScheduleInput, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash, withAdminRlsContext, withVendorRlsContext };