@infuro/cms-core 1.0.9 → 1.0.11
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.
- package/dist/admin.cjs +2568 -1184
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +41 -2
- package/dist/admin.d.ts +41 -2
- package/dist/admin.js +2594 -1214
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +1695 -151
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +2 -1
- package/dist/api.d.ts +2 -1
- package/dist/api.js +1689 -146
- package/dist/api.js.map +1 -1
- package/dist/auth.cjs +153 -9
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +17 -27
- package/dist/auth.d.ts +17 -27
- package/dist/auth.js +143 -8
- package/dist/auth.js.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/helpers-dlrF_49e.d.cts +60 -0
- package/dist/helpers-dlrF_49e.d.ts +60 -0
- package/dist/{index-P5ajDo8-.d.ts → index-C_CZLmHD.d.cts} +88 -1
- package/dist/{index-P5ajDo8-.d.cts → index-DeO4AnAj.d.ts} +88 -1
- package/dist/index.cjs +3340 -715
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -5
- package/dist/index.d.ts +154 -5
- package/dist/index.js +2821 -223
- package/dist/index.js.map +1 -1
- package/dist/migrations/1772178563555-ChatAndKnowledgeBase.ts +33 -17
- package/dist/migrations/1774300000000-RbacSeedGroupsAndPermissionUnique.ts +24 -0
- package/dist/migrations/1774300000001-SeedAdministratorUsersPermission.ts +35 -0
- package/dist/migrations/1774400000000-CustomerAdminAccessContactUser.ts +37 -0
- package/dist/migrations/1774400000001-StorefrontCartWishlist.ts +100 -0
- package/dist/migrations/1774400000002-WishlistGuestId.ts +29 -0
- package/dist/migrations/1774500000000-ProductCollectionHsn.ts +15 -0
- package/package.json +13 -7
- /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-
|
|
2
|
-
export { A as AnalyticsHandlerConfig,
|
|
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 {
|
|
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-
|
|
2
|
-
export { A as AnalyticsHandlerConfig,
|
|
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 {
|
|
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 };
|