@infuro/cms-core 1.0.8 → 1.0.10

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 (43) hide show
  1. package/dist/admin.cjs +2562 -1176
  2. package/dist/admin.cjs.map +1 -1
  3. package/dist/admin.d.cts +41 -2
  4. package/dist/admin.d.ts +41 -2
  5. package/dist/admin.js +2596 -1214
  6. package/dist/admin.js.map +1 -1
  7. package/dist/api.cjs +1695 -151
  8. package/dist/api.cjs.map +1 -1
  9. package/dist/api.d.cts +2 -1
  10. package/dist/api.d.ts +2 -1
  11. package/dist/api.js +1689 -146
  12. package/dist/api.js.map +1 -1
  13. package/dist/auth.cjs +153 -9
  14. package/dist/auth.cjs.map +1 -1
  15. package/dist/auth.d.cts +17 -27
  16. package/dist/auth.d.ts +17 -27
  17. package/dist/auth.js +143 -8
  18. package/dist/auth.js.map +1 -1
  19. package/dist/cli.cjs +1 -1
  20. package/dist/cli.cjs.map +1 -1
  21. package/dist/cli.js +1 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/helpers-dlrF_49e.d.cts +60 -0
  24. package/dist/helpers-dlrF_49e.d.ts +60 -0
  25. package/dist/{index-P5ajDo8-.d.ts → index-C_CZLmHD.d.cts} +88 -1
  26. package/dist/{index-P5ajDo8-.d.cts → index-DeO4AnAj.d.ts} +88 -1
  27. package/dist/index.cjs +3340 -715
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +154 -5
  30. package/dist/index.d.ts +154 -5
  31. package/dist/index.js +2821 -223
  32. package/dist/index.js.map +1 -1
  33. package/dist/migrations/1772178563555-ChatAndKnowledgeBase.ts +55 -0
  34. package/dist/migrations/{1731900000000-KnowledgeBaseVector.ts → 1772178563556-KnowledgeBaseVector.ts} +3 -4
  35. package/dist/migrations/1774300000000-RbacSeedGroupsAndPermissionUnique.ts +24 -0
  36. package/dist/migrations/1774300000001-SeedAdministratorUsersPermission.ts +35 -0
  37. package/dist/migrations/1774400000000-CustomerAdminAccessContactUser.ts +37 -0
  38. package/dist/migrations/1774400000001-StorefrontCartWishlist.ts +100 -0
  39. package/dist/migrations/1774400000002-WishlistGuestId.ts +29 -0
  40. package/dist/migrations/1774500000000-ProductCollectionHsn.ts +15 -0
  41. package/package.json +13 -7
  42. package/dist/migrations/1731800000000-ChatAndKnowledgeBase.ts +0 -39
  43. /package/{dist → src/admin}/admin.css +0 -0
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
- import { S as StorageService } from './index-P5ajDo8-.cjs';
2
- export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-P5ajDo8-.cjs';
1
+ import { C as CompanyDetails, T as TemplateContext, E as EmailTemplateResult, a as EmailTemplateName, O as OrderPlacedLineItem, S as StorageService } from './index-C_CZLmHD.cjs';
2
+ export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, k as SocialLinkItem, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, G as createSetPasswordHandler, H as createSettingsApiHandlers, J as createStorefrontApiHandler, K as createUploadHandler, L as createUserAuthApiRouter, M as createUserAvatarHandler, N as createUserProfileHandler, P as createUsersApiHandlers, Q as getCompanyDetailsFromSettings, R as mergeEmailLayoutCompanyDetails } from './index-C_CZLmHD.cjs';
3
3
  import { ClassValue } from 'clsx';
4
4
  import * as typeorm from 'typeorm';
5
- import { EntityTarget } from 'typeorm';
6
- export { AuthHelpers, CmsMiddlewareConfig, GetSession, NextAuthOptionsConfig, NextAuthUser, OPEN_ENDPOINTS, PERMISSION_REQUIRED_ENDPOINTS, SessionUser, createAuthHelpers, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, getRequiredPermission, isOpenEndpoint, isPublicMethod } from './auth.cjs';
5
+ import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
6
+ export { A as ADMIN_GROUP_NAME, a as AuthHelpers, E as EntityCrudAction, 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.cjs';
7
+ export { CmsMiddlewareConfig, NextAuthOptionsConfig, NextAuthUser, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, seedAdministratorPermissions } from './auth.cjs';
7
8
  export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.cjs';
8
9
  import 'next-auth';
9
10
 
@@ -105,15 +106,34 @@ interface ERPPluginInstance {
105
106
  }
106
107
  declare function erpPlugin(config: ERPPluginConfig): CmsPlugin<ERPPluginInstance>;
107
108
 
109
+ interface RenderEmailOptions {
110
+ renderLayout?: (opts: {
111
+ bodyHtml: string;
112
+ companyDetails: CompanyDetails;
113
+ }) => string;
114
+ getBody?: (templateName: string, ctx: TemplateContext<unknown>) => EmailTemplateResult | null;
115
+ }
116
+ interface RenderedEmail$1 {
117
+ subject: string;
118
+ html: string;
119
+ text?: string;
120
+ }
121
+ declare function renderEmail(templateName: EmailTemplateName, ctx: TemplateContext<unknown>, options?: RenderEmailOptions): RenderedEmail$1;
122
+
108
123
  interface EmailPluginConfig$1 {
109
124
  type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
110
125
  user?: string;
111
126
  password?: string;
112
127
  from: string;
113
128
  to: string;
129
+ /** When type is SMTP, defaults to env SMTP_HOST or undefined (set host for custom relay). */
130
+ host?: string;
131
+ port?: number;
132
+ secure?: boolean;
114
133
  region?: string;
115
134
  accessKeyId?: string;
116
135
  secretAccessKey?: string;
136
+ templateOptions?: RenderEmailOptions;
117
137
  }
118
138
  interface EmailData {
119
139
  subject: string;
@@ -125,12 +145,19 @@ interface EmailData {
125
145
  interface EmailServiceInterface {
126
146
  send(emailData: EmailData): Promise<boolean>;
127
147
  }
148
+ interface RenderedEmail {
149
+ subject: string;
150
+ html: string;
151
+ text?: string;
152
+ }
128
153
  declare class EmailService implements EmailServiceInterface {
129
154
  private config;
155
+ private templateOptions?;
130
156
  private sesClient?;
131
157
  private transporter?;
132
158
  constructor(config: EmailPluginConfig$1);
133
159
  send(emailData: EmailData): Promise<boolean>;
160
+ renderTemplate(templateName: EmailTemplateName, ctx: TemplateContext<unknown>): RenderedEmail;
134
161
  }
135
162
  declare const emailTemplates: {
136
163
  formSubmission: (data: {
@@ -162,15 +189,55 @@ declare const emailTemplates: {
162
189
  };
163
190
  };
164
191
 
192
+ declare function renderLayout(options: {
193
+ bodyHtml: string;
194
+ companyDetails: CompanyDetails;
195
+ }): string;
196
+
197
+ interface CmsAppLike {
198
+ getPlugin(name: string): unknown;
199
+ }
200
+ /** Context for template rendering: at least companyDetails; template-specific fields (formName, etc.) are allowed. */
201
+ interface EmailJobPayload {
202
+ to: string;
203
+ templateName?: EmailTemplateName;
204
+ ctx?: Record<string, unknown> & {
205
+ companyDetails: CompanyDetails;
206
+ };
207
+ subject?: string;
208
+ html?: string;
209
+ text?: string;
210
+ }
211
+ declare function registerEmailQueueProcessor(cms: CmsAppLike): void;
212
+ declare function queueEmail(cms: CmsAppLike, payload: EmailJobPayload): Promise<void>;
213
+ interface OrderPlacedEmailPayload {
214
+ orderNumber: string;
215
+ total?: string | number;
216
+ currency?: string;
217
+ customerName?: string;
218
+ /** Customer receipt; omitted if empty */
219
+ customerEmail?: string | null;
220
+ /** Parsed list from email plugin “Sales team” settings */
221
+ salesTeamEmails: string[];
222
+ companyDetails: CompanyDetails;
223
+ lineItems: OrderPlacedLineItem[];
224
+ }
225
+ /** Queues one `orderPlaced` email per recipient (customer + each unique sales address; skips sales if same as customer). */
226
+ declare function queueOrderPlacedEmails(cms: CmsAppLike, payload: OrderPlacedEmailPayload): Promise<void>;
227
+
165
228
  interface EmailPluginConfig {
166
229
  type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
167
230
  user?: string;
168
231
  password?: string;
169
232
  from: string;
170
233
  to: string;
234
+ host?: string;
235
+ port?: number;
236
+ secure?: boolean;
171
237
  region?: string;
172
238
  accessKeyId?: string;
173
239
  secretAccessKey?: string;
240
+ templateOptions?: RenderEmailOptions;
174
241
  }
175
242
  declare function emailPlugin(config: EmailPluginConfig): CmsPlugin<EmailService>;
176
243
 
@@ -331,6 +398,27 @@ interface LlmPluginConfig {
331
398
  }
332
399
  declare function llmPlugin(config?: LlmPluginConfig): CmsPlugin<LlmService | undefined>;
333
400
 
401
+ interface CacheService {
402
+ get(key: string): Promise<string | null>;
403
+ set(key: string, value: string, ttlSeconds?: number): Promise<void>;
404
+ del(key: string): Promise<void>;
405
+ }
406
+
407
+ interface CachePluginConfig {
408
+ redisUrl?: string;
409
+ }
410
+ declare function cachePlugin(config?: CachePluginConfig): CmsPlugin<CacheService>;
411
+
412
+ interface QueueService {
413
+ add(queueName: string, data: object): Promise<void>;
414
+ registerProcessor(queueName: string, processor: (data: object) => Promise<void>): void;
415
+ }
416
+
417
+ interface QueuePluginConfig {
418
+ redisUrl?: string;
419
+ }
420
+ declare function queuePlugin(config?: QueuePluginConfig): CmsPlugin<QueueService>;
421
+
334
422
  declare function cn(...inputs: ClassValue[]): string;
335
423
  declare function generateSlug(title: string): string;
336
424
  declare function validateSlug(slug: string): boolean;
@@ -339,6 +427,16 @@ declare function formatDateTime(date: Date | string): string;
339
427
  declare function formatDateOnly(date: Date | string): string;
340
428
  declare function truncateText(text: string, maxLength: number): string;
341
429
 
430
+ /** Links an unclaimed contact (same email, no userId) to the new user after signup or invite. */
431
+ declare function linkUnclaimedContactToUser(dataSource: DataSource, contactsEntity: EntityTarget<ObjectLiteral>, userId: number, email: string): Promise<void>;
432
+
433
+ /** Parse stored config value into a list of emails (JSON array, or comma/semicolon-separated string). */
434
+ declare function parseEmailRecipientsFromConfig(raw: string | undefined | null): string[];
435
+ /** Serialize email list for config storage (JSON array in DB). */
436
+ declare function serializeEmailRecipients(emails: string[]): string;
437
+ /** Join for SMTP `to` header (multiple recipients). */
438
+ declare function joinRecipientsForSend(emails: string[]): string | null;
439
+
342
440
  declare class Permission {
343
441
  id: number;
344
442
  groupId: number;
@@ -377,6 +475,7 @@ declare class User {
377
475
  email: string;
378
476
  password: string | null;
379
477
  blocked: boolean;
478
+ adminAccess: boolean;
380
479
  groupId: number | null;
381
480
  createdAt: Date;
382
481
  updatedAt: Date;
@@ -600,6 +699,7 @@ declare class Collection {
600
699
  brandId: number | null;
601
700
  name: string;
602
701
  slug: string;
702
+ hsn: string | null;
603
703
  description: string | null;
604
704
  image: string | null;
605
705
  metadata: Record<string, unknown> | null;
@@ -684,6 +784,7 @@ declare class Product {
684
784
  brandId: number | null;
685
785
  categoryId: number | null;
686
786
  sku: string | null;
787
+ hsn: string | null;
687
788
  slug: string | null;
688
789
  name: string | null;
689
790
  price: number;
@@ -806,6 +907,8 @@ declare class Contact {
806
907
  createdBy: number | null;
807
908
  updatedBy: number | null;
808
909
  deletedBy: number | null;
910
+ userId: number | null;
911
+ user: User | null;
809
912
  form_submissions: FormSubmission[];
810
913
  addresses: Address[];
811
914
  orders: Order[];
@@ -882,7 +985,53 @@ declare class KnowledgeBaseDocument {
882
985
  chunks: KnowledgeBaseChunk[];
883
986
  }
884
987
 
988
+ declare class CartItem {
989
+ id: number;
990
+ cartId: number;
991
+ productId: number;
992
+ quantity: number;
993
+ metadata: Record<string, unknown> | null;
994
+ createdAt: Date;
995
+ updatedAt: Date;
996
+ cart: Cart;
997
+ product: Product;
998
+ }
999
+
1000
+ declare class Cart {
1001
+ id: number;
1002
+ guestToken: string | null;
1003
+ contactId: number | null;
1004
+ currency: string;
1005
+ expiresAt: Date | null;
1006
+ createdAt: Date;
1007
+ updatedAt: Date;
1008
+ contact: Contact | null;
1009
+ items: CartItem[];
1010
+ }
1011
+
1012
+ declare class WishlistItem {
1013
+ id: number;
1014
+ wishlistId: number;
1015
+ productId: number;
1016
+ metadata: Record<string, unknown> | null;
1017
+ createdAt: Date;
1018
+ updatedAt: Date;
1019
+ wishlist: Wishlist;
1020
+ product: Product;
1021
+ }
1022
+
1023
+ declare class Wishlist {
1024
+ id: number;
1025
+ guestId: string | null;
1026
+ contactId: number | null;
1027
+ name: string;
1028
+ createdAt: Date;
1029
+ updatedAt: Date;
1030
+ contact: Contact | null;
1031
+ items: WishlistItem[];
1032
+ }
1033
+
885
1034
  /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
886
1035
  declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
887
1036
 
888
- export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, llmPlugin, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
1037
+ export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, type CachePluginConfig, type CacheService, Cart, CartItem, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, CompanyDetails, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, analyticsPlugin, cachePlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, localStoragePlugin, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueOrderPlacedEmails, queuePlugin, registerEmailQueueProcessor, renderEmail, renderLayout, s3StoragePlugin, serializeEmailRecipients, smsPlugin, truncateText, validateSlug };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { S as StorageService } from './index-P5ajDo8-.js';
2
- export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-P5ajDo8-.js';
1
+ import { C as CompanyDetails, T as TemplateContext, E as EmailTemplateResult, a as EmailTemplateName, O as OrderPlacedLineItem, S as StorageService } from './index-DeO4AnAj.js';
2
+ export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, k as SocialLinkItem, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, G as createSetPasswordHandler, H as createSettingsApiHandlers, J as createStorefrontApiHandler, K as createUploadHandler, L as createUserAuthApiRouter, M as createUserAvatarHandler, N as createUserProfileHandler, P as createUsersApiHandlers, Q as getCompanyDetailsFromSettings, R as mergeEmailLayoutCompanyDetails } from './index-DeO4AnAj.js';
3
3
  import { ClassValue } from 'clsx';
4
4
  import * as typeorm from 'typeorm';
5
- import { EntityTarget } from 'typeorm';
6
- export { AuthHelpers, CmsMiddlewareConfig, GetSession, NextAuthOptionsConfig, NextAuthUser, OPEN_ENDPOINTS, PERMISSION_REQUIRED_ENDPOINTS, SessionUser, createAuthHelpers, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, getRequiredPermission, isOpenEndpoint, isPublicMethod } from './auth.js';
5
+ import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
6
+ export { A as ADMIN_GROUP_NAME, a as AuthHelpers, E as EntityCrudAction, 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';
7
+ export { CmsMiddlewareConfig, NextAuthOptionsConfig, NextAuthUser, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, seedAdministratorPermissions } from './auth.js';
7
8
  export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.js';
8
9
  import 'next-auth';
9
10
 
@@ -105,15 +106,34 @@ interface ERPPluginInstance {
105
106
  }
106
107
  declare function erpPlugin(config: ERPPluginConfig): CmsPlugin<ERPPluginInstance>;
107
108
 
109
+ interface RenderEmailOptions {
110
+ renderLayout?: (opts: {
111
+ bodyHtml: string;
112
+ companyDetails: CompanyDetails;
113
+ }) => string;
114
+ getBody?: (templateName: string, ctx: TemplateContext<unknown>) => EmailTemplateResult | null;
115
+ }
116
+ interface RenderedEmail$1 {
117
+ subject: string;
118
+ html: string;
119
+ text?: string;
120
+ }
121
+ declare function renderEmail(templateName: EmailTemplateName, ctx: TemplateContext<unknown>, options?: RenderEmailOptions): RenderedEmail$1;
122
+
108
123
  interface EmailPluginConfig$1 {
109
124
  type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
110
125
  user?: string;
111
126
  password?: string;
112
127
  from: string;
113
128
  to: string;
129
+ /** When type is SMTP, defaults to env SMTP_HOST or undefined (set host for custom relay). */
130
+ host?: string;
131
+ port?: number;
132
+ secure?: boolean;
114
133
  region?: string;
115
134
  accessKeyId?: string;
116
135
  secretAccessKey?: string;
136
+ templateOptions?: RenderEmailOptions;
117
137
  }
118
138
  interface EmailData {
119
139
  subject: string;
@@ -125,12 +145,19 @@ interface EmailData {
125
145
  interface EmailServiceInterface {
126
146
  send(emailData: EmailData): Promise<boolean>;
127
147
  }
148
+ interface RenderedEmail {
149
+ subject: string;
150
+ html: string;
151
+ text?: string;
152
+ }
128
153
  declare class EmailService implements EmailServiceInterface {
129
154
  private config;
155
+ private templateOptions?;
130
156
  private sesClient?;
131
157
  private transporter?;
132
158
  constructor(config: EmailPluginConfig$1);
133
159
  send(emailData: EmailData): Promise<boolean>;
160
+ renderTemplate(templateName: EmailTemplateName, ctx: TemplateContext<unknown>): RenderedEmail;
134
161
  }
135
162
  declare const emailTemplates: {
136
163
  formSubmission: (data: {
@@ -162,15 +189,55 @@ declare const emailTemplates: {
162
189
  };
163
190
  };
164
191
 
192
+ declare function renderLayout(options: {
193
+ bodyHtml: string;
194
+ companyDetails: CompanyDetails;
195
+ }): string;
196
+
197
+ interface CmsAppLike {
198
+ getPlugin(name: string): unknown;
199
+ }
200
+ /** Context for template rendering: at least companyDetails; template-specific fields (formName, etc.) are allowed. */
201
+ interface EmailJobPayload {
202
+ to: string;
203
+ templateName?: EmailTemplateName;
204
+ ctx?: Record<string, unknown> & {
205
+ companyDetails: CompanyDetails;
206
+ };
207
+ subject?: string;
208
+ html?: string;
209
+ text?: string;
210
+ }
211
+ declare function registerEmailQueueProcessor(cms: CmsAppLike): void;
212
+ declare function queueEmail(cms: CmsAppLike, payload: EmailJobPayload): Promise<void>;
213
+ interface OrderPlacedEmailPayload {
214
+ orderNumber: string;
215
+ total?: string | number;
216
+ currency?: string;
217
+ customerName?: string;
218
+ /** Customer receipt; omitted if empty */
219
+ customerEmail?: string | null;
220
+ /** Parsed list from email plugin “Sales team” settings */
221
+ salesTeamEmails: string[];
222
+ companyDetails: CompanyDetails;
223
+ lineItems: OrderPlacedLineItem[];
224
+ }
225
+ /** Queues one `orderPlaced` email per recipient (customer + each unique sales address; skips sales if same as customer). */
226
+ declare function queueOrderPlacedEmails(cms: CmsAppLike, payload: OrderPlacedEmailPayload): Promise<void>;
227
+
165
228
  interface EmailPluginConfig {
166
229
  type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
167
230
  user?: string;
168
231
  password?: string;
169
232
  from: string;
170
233
  to: string;
234
+ host?: string;
235
+ port?: number;
236
+ secure?: boolean;
171
237
  region?: string;
172
238
  accessKeyId?: string;
173
239
  secretAccessKey?: string;
240
+ templateOptions?: RenderEmailOptions;
174
241
  }
175
242
  declare function emailPlugin(config: EmailPluginConfig): CmsPlugin<EmailService>;
176
243
 
@@ -331,6 +398,27 @@ interface LlmPluginConfig {
331
398
  }
332
399
  declare function llmPlugin(config?: LlmPluginConfig): CmsPlugin<LlmService | undefined>;
333
400
 
401
+ interface CacheService {
402
+ get(key: string): Promise<string | null>;
403
+ set(key: string, value: string, ttlSeconds?: number): Promise<void>;
404
+ del(key: string): Promise<void>;
405
+ }
406
+
407
+ interface CachePluginConfig {
408
+ redisUrl?: string;
409
+ }
410
+ declare function cachePlugin(config?: CachePluginConfig): CmsPlugin<CacheService>;
411
+
412
+ interface QueueService {
413
+ add(queueName: string, data: object): Promise<void>;
414
+ registerProcessor(queueName: string, processor: (data: object) => Promise<void>): void;
415
+ }
416
+
417
+ interface QueuePluginConfig {
418
+ redisUrl?: string;
419
+ }
420
+ declare function queuePlugin(config?: QueuePluginConfig): CmsPlugin<QueueService>;
421
+
334
422
  declare function cn(...inputs: ClassValue[]): string;
335
423
  declare function generateSlug(title: string): string;
336
424
  declare function validateSlug(slug: string): boolean;
@@ -339,6 +427,16 @@ declare function formatDateTime(date: Date | string): string;
339
427
  declare function formatDateOnly(date: Date | string): string;
340
428
  declare function truncateText(text: string, maxLength: number): string;
341
429
 
430
+ /** Links an unclaimed contact (same email, no userId) to the new user after signup or invite. */
431
+ declare function linkUnclaimedContactToUser(dataSource: DataSource, contactsEntity: EntityTarget<ObjectLiteral>, userId: number, email: string): Promise<void>;
432
+
433
+ /** Parse stored config value into a list of emails (JSON array, or comma/semicolon-separated string). */
434
+ declare function parseEmailRecipientsFromConfig(raw: string | undefined | null): string[];
435
+ /** Serialize email list for config storage (JSON array in DB). */
436
+ declare function serializeEmailRecipients(emails: string[]): string;
437
+ /** Join for SMTP `to` header (multiple recipients). */
438
+ declare function joinRecipientsForSend(emails: string[]): string | null;
439
+
342
440
  declare class Permission {
343
441
  id: number;
344
442
  groupId: number;
@@ -377,6 +475,7 @@ declare class User {
377
475
  email: string;
378
476
  password: string | null;
379
477
  blocked: boolean;
478
+ adminAccess: boolean;
380
479
  groupId: number | null;
381
480
  createdAt: Date;
382
481
  updatedAt: Date;
@@ -600,6 +699,7 @@ declare class Collection {
600
699
  brandId: number | null;
601
700
  name: string;
602
701
  slug: string;
702
+ hsn: string | null;
603
703
  description: string | null;
604
704
  image: string | null;
605
705
  metadata: Record<string, unknown> | null;
@@ -684,6 +784,7 @@ declare class Product {
684
784
  brandId: number | null;
685
785
  categoryId: number | null;
686
786
  sku: string | null;
787
+ hsn: string | null;
687
788
  slug: string | null;
688
789
  name: string | null;
689
790
  price: number;
@@ -806,6 +907,8 @@ declare class Contact {
806
907
  createdBy: number | null;
807
908
  updatedBy: number | null;
808
909
  deletedBy: number | null;
910
+ userId: number | null;
911
+ user: User | null;
809
912
  form_submissions: FormSubmission[];
810
913
  addresses: Address[];
811
914
  orders: Order[];
@@ -882,7 +985,53 @@ declare class KnowledgeBaseDocument {
882
985
  chunks: KnowledgeBaseChunk[];
883
986
  }
884
987
 
988
+ declare class CartItem {
989
+ id: number;
990
+ cartId: number;
991
+ productId: number;
992
+ quantity: number;
993
+ metadata: Record<string, unknown> | null;
994
+ createdAt: Date;
995
+ updatedAt: Date;
996
+ cart: Cart;
997
+ product: Product;
998
+ }
999
+
1000
+ declare class Cart {
1001
+ id: number;
1002
+ guestToken: string | null;
1003
+ contactId: number | null;
1004
+ currency: string;
1005
+ expiresAt: Date | null;
1006
+ createdAt: Date;
1007
+ updatedAt: Date;
1008
+ contact: Contact | null;
1009
+ items: CartItem[];
1010
+ }
1011
+
1012
+ declare class WishlistItem {
1013
+ id: number;
1014
+ wishlistId: number;
1015
+ productId: number;
1016
+ metadata: Record<string, unknown> | null;
1017
+ createdAt: Date;
1018
+ updatedAt: Date;
1019
+ wishlist: Wishlist;
1020
+ product: Product;
1021
+ }
1022
+
1023
+ declare class Wishlist {
1024
+ id: number;
1025
+ guestId: string | null;
1026
+ contactId: number | null;
1027
+ name: string;
1028
+ createdAt: Date;
1029
+ updatedAt: Date;
1030
+ contact: Contact | null;
1031
+ items: WishlistItem[];
1032
+ }
1033
+
885
1034
  /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
886
1035
  declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
887
1036
 
888
- export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, llmPlugin, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };
1037
+ export { type AnalyticsPluginConfig, Attribute, Blog, Brand, CMS_ENTITY_MAP, type CachePluginConfig, type CacheService, Cart, CartItem, Category, ChatConversation, ChatMessage, type CmsApp, type CmsPlugin, Collection, Comment, CompanyDetails, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, analyticsPlugin, cachePlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, localStoragePlugin, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueOrderPlacedEmails, queuePlugin, registerEmailQueueProcessor, renderEmail, renderLayout, s3StoragePlugin, serializeEmailRecipients, smsPlugin, truncateText, validateSlug };