@infuro/cms-core 1.0.14 → 1.0.16

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/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
- import { C as CompanyDetails, T as TemplateContext, E as EmailTemplateResult, a as EmailTemplateName, O as OrderPlacedLineItem, S as StorageService, b as EntityMap$1 } from './index-Be8NLxu-.cjs';
2
- export { A as AnalyticsHandlerConfig, c as AuthHandlersConfig, B as BlogBySlugConfig, d as ChangePasswordConfig, e as CmsApiHandlerConfig, f as CmsGetter, g as CrudHandlerOptions, D as DashboardStatsConfig, F as ForgotPasswordConfig, h as FormBySlugConfig, G as GetPublicSettingsGroupConfig, i as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, j as SetPasswordConfig, k as SettingsApiConfig, l as SocialLinkItem, m as StorefrontApiConfig, n as StorefrontOtpFlags, U as UploadHandlerConfig, o as UserAuthApiConfig, p as UserAvatarConfig, q as UserProfileConfig, r as UsersApiConfig, s as createAnalyticsHandlers, t as createBlogBySlugHandler, u as createChangePasswordHandler, v as createCmsApiHandler, w as createCrudByIdHandler, x as createCrudHandler, y as createDashboardStatsHandler, z as createForgotPasswordHandler, H as createFormBySlugHandler, J as createInviteAcceptHandler, K as createSetPasswordHandler, L as createSettingsApiHandlers, M as createStorefrontApiHandler, N as createUploadHandler, P as createUserAuthApiRouter, Q as createUserAvatarHandler, R as createUserProfileHandler, V as createUsersApiHandlers, W as getCompanyDetailsFromSettings, X as getPublicSettingsGroup, Y as mergeEmailLayoutCompanyDetails } from './index-Be8NLxu-.cjs';
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-h42MoUNq.cjs';
2
+ export { A as AnalyticsHandlerConfig, c as AuthHandlersConfig, B as BlogBySlugConfig, d as ChangePasswordConfig, e as CmsApiHandlerConfig, f as CmsGetter, g as CrudHandlerOptions, D as DashboardStatsConfig, h as EcommerceAnalyticsConfig, F as ForgotPasswordConfig, i as FormBySlugConfig, G as GetPublicSettingsGroupConfig, j as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, k as SetPasswordConfig, l as SettingsApiConfig, m as SocialLinkItem, n as StorefrontApiConfig, o as StorefrontOtpFlags, U as UploadHandlerConfig, p as UserAuthApiConfig, q as UserAvatarConfig, r as UserProfileConfig, s as UsersApiConfig, t as createAnalyticsHandlers, u as createBlogBySlugHandler, v as createChangePasswordHandler, w as createCmsApiHandler, x as createCrudByIdHandler, y as createCrudHandler, z as createDashboardStatsHandler, H as createEcommerceAnalyticsHandler, J as createForgotPasswordHandler, K as createFormBySlugHandler, L as createInviteAcceptHandler, M as createMediaZipExtractHandler, N as createSetPasswordHandler, P as createSettingsApiHandlers, Q as createStorefrontApiHandler, R as createUploadHandler, V as createUserAuthApiRouter, W as createUserAvatarHandler, X as createUserProfileHandler, Y as createUsersApiHandlers, Z as getCompanyDetailsFromSettings, _ as getPublicSettingsGroup, $ as mergeEmailLayoutCompanyDetails } from './index-h42MoUNq.cjs';
3
3
  import { ClassValue } from 'clsx';
4
4
  import * as typeorm from 'typeorm';
5
5
  import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
6
6
  import { Metadata } from 'next';
7
+ import { N as NavbarConfig, F as FooterConfig } from './types-D34wmivy.cjs';
7
8
  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';
8
9
  export { AuthorizeOtpInput, CmsMiddlewareConfig, NextAuthOptionsConfig, NextAuthUser, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, seedAdministratorPermissions } from './auth.cjs';
9
10
  export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.cjs';
@@ -159,7 +160,7 @@ type ErpPaidOrderDataSource = {
159
160
  type ErpPaidOrderEntityMap = Record<string, unknown>;
160
161
  /**
161
162
  * Enqueues ERP `order.created` only when the order has at least one **completed** payment.
162
- * Include `payments` in the payload per §6 (minor units for typical 2-decimal currencies).
163
+ * Include `payments` in the payload.
163
164
  */
164
165
  declare function queueErpPaidOrderForOrderId(cms: CmsAppLike$2, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, orderId: number): Promise<void>;
165
166
 
@@ -296,6 +297,8 @@ declare function queueEmail(cms: CmsAppLike$1, payload: EmailJobPayload): Promis
296
297
  interface OrderPlacedEmailPayload {
297
298
  orderNumber: string;
298
299
  total?: string | number;
300
+ subtotal?: string | number;
301
+ tax?: string | number;
299
302
  currency?: string;
300
303
  customerName?: string;
301
304
  /** Customer receipt; omitted if empty */
@@ -304,6 +307,8 @@ interface OrderPlacedEmailPayload {
304
307
  salesTeamEmails: string[];
305
308
  companyDetails: CompanyDetails;
306
309
  lineItems: OrderPlacedLineItem[];
310
+ billingAddress?: Record<string, string>;
311
+ shippingAddress?: Record<string, string>;
307
312
  }
308
313
  /** Queues one `orderPlaced` email per recipient (customer + each unique sales address; skips sales if same as customer). */
309
314
  declare function queueOrderPlacedEmails(cms: CmsAppLike$1, payload: OrderPlacedEmailPayload): Promise<void>;
@@ -626,7 +631,7 @@ type SeoMetadataOverrides = {
626
631
  };
627
632
  /** Per-field: join row wins over slug row. */
628
633
  declare function mergeSeoBySlug(join: SeoLike | null | undefined, bySlug: SeoLike | null): SeoLike | null;
629
- declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$1, slug: string): Promise<SeoLike | null>;
634
+ declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$2, slug: string): Promise<SeoLike | null>;
630
635
  /**
631
636
  * Build Next.js Metadata from merged SEO + optional layers.
632
637
  * `overrides` win over SEO; `fallbacks` apply when SEO (and overrides) omit a field.
@@ -634,7 +639,7 @@ declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$1,
634
639
  */
635
640
  declare function resolvePublicMetadata(args: {
636
641
  dataSource: DataSource;
637
- entityMap: EntityMap$1;
642
+ entityMap: EntityMap$2;
638
643
  slug: string;
639
644
  seoFromJoin?: SeoLike | null;
640
645
  overrides?: SeoMetadataOverrides;
@@ -660,9 +665,9 @@ declare function verifyOtpCodeHash(code: string, storedHash: string, purpose: st
660
665
  declare function generateNumericOtp(length?: number): string;
661
666
  /** Normalize to E.164-like +digits */
662
667
  declare function normalizePhoneE164(raw: string, defaultCountryCode?: string): string | null;
663
- type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
664
- declare function countRecentOtpSends(dataSource: DataSource, entityMap: EntityMap, purpose: OtpPurpose, identifier: string, since: Date): Promise<number>;
665
- declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap, input: {
668
+ type EntityMap$1 = Record<string, EntityTarget<ObjectLiteral>>;
669
+ declare function countRecentOtpSends(dataSource: DataSource, entityMap: EntityMap$1, purpose: OtpPurpose, identifier: string, since: Date): Promise<number>;
670
+ declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap$1, input: {
666
671
  purpose: OtpPurpose;
667
672
  channel: OtpChannel;
668
673
  identifier: string;
@@ -675,7 +680,7 @@ declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap
675
680
  error: string;
676
681
  status: number;
677
682
  }>;
678
- declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap: EntityMap, input: {
683
+ declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap: EntityMap$1, input: {
679
684
  purpose: OtpPurpose;
680
685
  identifier: string;
681
686
  code: string;
@@ -688,6 +693,79 @@ declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap:
688
693
  status: number;
689
694
  }>;
690
695
 
696
+ /** Returns true if request is allowed; false if rate limited. */
697
+ declare function allowRateLimit(key: string): Promise<boolean>;
698
+ type ExtraPublicWriteRule = (method: string, segments: string[]) => boolean;
699
+ /** Segments are path parts after `/api/` (e.g. `['form-submissions']`). */
700
+ declare function shouldRateLimitPublicWrite(method: string, segments: string[], extraRule?: ExtraPublicWriteRule): boolean;
701
+ declare function rateLimitKeyForApiRequest(req: Request, segments: string[]): string;
702
+ declare function rateLimitPublicApiIfNeeded(req: Request, method: string, segments: string[], options?: {
703
+ extraRule?: ExtraPublicWriteRule;
704
+ }): Promise<Response | null>;
705
+ declare function rateLimitCheckoutPost(req: Request): Promise<Response | null>;
706
+
707
+ interface EntityMapLike {
708
+ configs: unknown;
709
+ orders: unknown;
710
+ order_items: unknown;
711
+ }
712
+ interface SendOrderPlacedEmailDeps {
713
+ getDataSource: () => Promise<DataSource>;
714
+ entityMap: EntityMapLike;
715
+ getCms: () => Promise<CmsApp>;
716
+ }
717
+ /** After payment confirmation: email customer + each sales team address from plugin settings. */
718
+ declare function sendOrderPlacedEmailsAfterConfirmation(orderId: number, deps: SendOrderPlacedEmailDeps): Promise<void>;
719
+
720
+ interface DataSourceManager {
721
+ getDataSource: () => DataSource;
722
+ getDataSourceInitialized: () => Promise<DataSource>;
723
+ resetDataSource: () => void;
724
+ registerOnReset: (cb: () => void) => void;
725
+ isConnectionError: (e: unknown) => boolean;
726
+ }
727
+ declare function createDataSourceManager(entityMap: Record<string, unknown>, options?: {
728
+ databaseUrl?: string;
729
+ idleTimeoutMillis?: number;
730
+ }): DataSourceManager;
731
+
732
+ interface SeedEntityMap {
733
+ users: unknown;
734
+ user_groups: unknown;
735
+ }
736
+ declare function seedDefaultAdmin(ds: DataSource, entityMap: SeedEntityMap, opts?: {
737
+ email?: string;
738
+ password?: string;
739
+ }): Promise<void>;
740
+
741
+ interface PublicThemeSettingsPayload {
742
+ activeThemeId: string;
743
+ primaryColor: string;
744
+ secondaryColor: string;
745
+ navbarConfig: NavbarConfig;
746
+ footerOverrides: Partial<FooterConfig>;
747
+ }
748
+ declare function loadPublicThemeSettings(config: {
749
+ dataSource: DataSource;
750
+ entityMap: EntityMap$2;
751
+ encryptionKey?: string;
752
+ defaultActiveThemeId?: string;
753
+ defaultPrimaryColor?: string;
754
+ defaultSecondaryColor?: string;
755
+ }): Promise<PublicThemeSettingsPayload>;
756
+
757
+ /** Normalize a logical media folder path: no leading/trailing slashes, no ".." segments, max length. */
758
+ declare function sanitizeMediaFolderPath(input: unknown): string;
759
+ /** Single path segment for storage (folder name or legacy path segment). */
760
+ declare function sanitizeStorageSegment(name: string): string;
761
+
762
+ type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
763
+ /** Build `a/b/c` path under `uploads/` from the chain of folder rows up to root. */
764
+ declare function relativePathFromMediaParentId(dataSource: DataSource, entityMap: EntityMap, parentId: number | null): Promise<string>;
765
+
766
+ declare const ZIP_MIME_TYPES: Set<string>;
767
+ declare function isZipMedia(mime: string | null | undefined, filename: string): boolean;
768
+
691
769
  declare class Permission {
692
770
  id: number;
693
771
  groupId: number;
@@ -1052,6 +1130,9 @@ declare class Product {
1052
1130
  categoryId: number | null;
1053
1131
  sku: string | null;
1054
1132
  hsn: string | null;
1133
+ /** Unit of measure, e.g. pcs, kg, hrs */
1134
+ uom: string | null;
1135
+ type: 'product' | 'service';
1055
1136
  slug: string | null;
1056
1137
  name: string | null;
1057
1138
  price: number;
@@ -1084,6 +1165,13 @@ declare class OrderItem {
1084
1165
  unitPrice: number;
1085
1166
  tax: number;
1086
1167
  total: number;
1168
+ /** Snapshot at order time */
1169
+ hsn: string | null;
1170
+ uom: string | null;
1171
+ productType: string | null;
1172
+ taxRate: number | null;
1173
+ /** Tax slug snapshot (from taxes.slug) */
1174
+ taxCode: string | null;
1087
1175
  metadata: Record<string, unknown> | null;
1088
1176
  createdAt: Date;
1089
1177
  updatedAt: Date;
@@ -1225,9 +1313,13 @@ declare class MessageTemplate {
1225
1313
 
1226
1314
  declare class Media {
1227
1315
  id: number;
1316
+ kind: 'file' | 'folder';
1317
+ parentId: number | null;
1318
+ parent: Media | null;
1319
+ children: Media[];
1228
1320
  filename: string;
1229
- url: string;
1230
- mimeType: string;
1321
+ url: string | null;
1322
+ mimeType: string | null;
1231
1323
  size: number;
1232
1324
  alt: string | null;
1233
1325
  isPublic: boolean;
@@ -1325,4 +1417,4 @@ declare class Wishlist {
1325
1417
  /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
1326
1418
  declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
1327
1419
 
1328
- export { type AnalyticsPluginConfig, Attribute, Blog, 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 ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, EntityMap$1 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, analyticsPlugin, assertCaptchaOk, buildCaptchaPublicConfig, cachePlugin, captchaPlugin, cn, countRecentOtpSends, createCmsApp, createOtpChallenge, emailPlugin, emailTemplates, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, hashOtpCode, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, localStoragePlugin, mergeSeoBySlug, normalizePhoneE164, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueOrderPlacedEmails, queuePlugin, queueSms, registerEmailQueueProcessor, registerErpQueueProcessor, registerSmsQueueProcessor, renderEmail, renderLayout, resolvePublicMetadata, s3StoragePlugin, serializeEmailRecipients, smsPlugin, truncateText, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash };
1420
+ export { Address, type AnalyticsPluginConfig, Attribute, Blog, 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, EntityMap$2 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, type ExtraPublicWriteRule, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, ZIP_MIME_TYPES, allowRateLimit, analyticsPlugin, assertCaptchaOk, buildCaptchaPublicConfig, cachePlugin, captchaPlugin, cn, countRecentOtpSends, createCmsApp, createDataSourceManager, createOtpChallenge, emailPlugin, emailTemplates, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, hashOtpCode, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, loadPublicThemeSettings, localStoragePlugin, mergeSeoBySlug, normalizePhoneE164, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueOrderPlacedEmails, queuePlugin, queueSms, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, registerEmailQueueProcessor, registerErpQueueProcessor, registerSmsQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resolvePublicMetadata, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, serializeEmailRecipients, shouldRateLimitPublicWrite, smsPlugin, truncateText, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { C as CompanyDetails, T as TemplateContext, E as EmailTemplateResult, a as EmailTemplateName, O as OrderPlacedLineItem, S as StorageService, b as EntityMap$1 } from './index-CjBf9dAb.js';
2
- export { A as AnalyticsHandlerConfig, c as AuthHandlersConfig, B as BlogBySlugConfig, d as ChangePasswordConfig, e as CmsApiHandlerConfig, f as CmsGetter, g as CrudHandlerOptions, D as DashboardStatsConfig, F as ForgotPasswordConfig, h as FormBySlugConfig, G as GetPublicSettingsGroupConfig, i as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, j as SetPasswordConfig, k as SettingsApiConfig, l as SocialLinkItem, m as StorefrontApiConfig, n as StorefrontOtpFlags, U as UploadHandlerConfig, o as UserAuthApiConfig, p as UserAvatarConfig, q as UserProfileConfig, r as UsersApiConfig, s as createAnalyticsHandlers, t as createBlogBySlugHandler, u as createChangePasswordHandler, v as createCmsApiHandler, w as createCrudByIdHandler, x as createCrudHandler, y as createDashboardStatsHandler, z as createForgotPasswordHandler, H as createFormBySlugHandler, J as createInviteAcceptHandler, K as createSetPasswordHandler, L as createSettingsApiHandlers, M as createStorefrontApiHandler, N as createUploadHandler, P as createUserAuthApiRouter, Q as createUserAvatarHandler, R as createUserProfileHandler, V as createUsersApiHandlers, W as getCompanyDetailsFromSettings, X as getPublicSettingsGroup, Y as mergeEmailLayoutCompanyDetails } from './index-CjBf9dAb.js';
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-C85X7cc7.js';
2
+ export { A as AnalyticsHandlerConfig, c as AuthHandlersConfig, B as BlogBySlugConfig, d as ChangePasswordConfig, e as CmsApiHandlerConfig, f as CmsGetter, g as CrudHandlerOptions, D as DashboardStatsConfig, h as EcommerceAnalyticsConfig, F as ForgotPasswordConfig, i as FormBySlugConfig, G as GetPublicSettingsGroupConfig, j as GetPublicSettingsGroupDataSource, I as InviteAcceptConfig, k as SetPasswordConfig, l as SettingsApiConfig, m as SocialLinkItem, n as StorefrontApiConfig, o as StorefrontOtpFlags, U as UploadHandlerConfig, p as UserAuthApiConfig, q as UserAvatarConfig, r as UserProfileConfig, s as UsersApiConfig, t as createAnalyticsHandlers, u as createBlogBySlugHandler, v as createChangePasswordHandler, w as createCmsApiHandler, x as createCrudByIdHandler, y as createCrudHandler, z as createDashboardStatsHandler, H as createEcommerceAnalyticsHandler, J as createForgotPasswordHandler, K as createFormBySlugHandler, L as createInviteAcceptHandler, M as createMediaZipExtractHandler, N as createSetPasswordHandler, P as createSettingsApiHandlers, Q as createStorefrontApiHandler, R as createUploadHandler, V as createUserAuthApiRouter, W as createUserAvatarHandler, X as createUserProfileHandler, Y as createUsersApiHandlers, Z as getCompanyDetailsFromSettings, _ as getPublicSettingsGroup, $ as mergeEmailLayoutCompanyDetails } from './index-C85X7cc7.js';
3
3
  import { ClassValue } from 'clsx';
4
4
  import * as typeorm from 'typeorm';
5
5
  import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
6
6
  import { Metadata } from 'next';
7
+ import { N as NavbarConfig, F as FooterConfig } from './types-D34wmivy.js';
7
8
  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';
8
9
  export { AuthorizeOtpInput, CmsMiddlewareConfig, NextAuthOptionsConfig, NextAuthUser, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, seedAdministratorPermissions } from './auth.js';
9
10
  export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.js';
@@ -159,7 +160,7 @@ type ErpPaidOrderDataSource = {
159
160
  type ErpPaidOrderEntityMap = Record<string, unknown>;
160
161
  /**
161
162
  * Enqueues ERP `order.created` only when the order has at least one **completed** payment.
162
- * Include `payments` in the payload per §6 (minor units for typical 2-decimal currencies).
163
+ * Include `payments` in the payload.
163
164
  */
164
165
  declare function queueErpPaidOrderForOrderId(cms: CmsAppLike$2, dataSource: ErpPaidOrderDataSource, entityMap: ErpPaidOrderEntityMap, orderId: number): Promise<void>;
165
166
 
@@ -296,6 +297,8 @@ declare function queueEmail(cms: CmsAppLike$1, payload: EmailJobPayload): Promis
296
297
  interface OrderPlacedEmailPayload {
297
298
  orderNumber: string;
298
299
  total?: string | number;
300
+ subtotal?: string | number;
301
+ tax?: string | number;
299
302
  currency?: string;
300
303
  customerName?: string;
301
304
  /** Customer receipt; omitted if empty */
@@ -304,6 +307,8 @@ interface OrderPlacedEmailPayload {
304
307
  salesTeamEmails: string[];
305
308
  companyDetails: CompanyDetails;
306
309
  lineItems: OrderPlacedLineItem[];
310
+ billingAddress?: Record<string, string>;
311
+ shippingAddress?: Record<string, string>;
307
312
  }
308
313
  /** Queues one `orderPlaced` email per recipient (customer + each unique sales address; skips sales if same as customer). */
309
314
  declare function queueOrderPlacedEmails(cms: CmsAppLike$1, payload: OrderPlacedEmailPayload): Promise<void>;
@@ -626,7 +631,7 @@ type SeoMetadataOverrides = {
626
631
  };
627
632
  /** Per-field: join row wins over slug row. */
628
633
  declare function mergeSeoBySlug(join: SeoLike | null | undefined, bySlug: SeoLike | null): SeoLike | null;
629
- declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$1, slug: string): Promise<SeoLike | null>;
634
+ declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$2, slug: string): Promise<SeoLike | null>;
630
635
  /**
631
636
  * Build Next.js Metadata from merged SEO + optional layers.
632
637
  * `overrides` win over SEO; `fallbacks` apply when SEO (and overrides) omit a field.
@@ -634,7 +639,7 @@ declare function fetchSeoBySlug(dataSource: DataSource, entityMap: EntityMap$1,
634
639
  */
635
640
  declare function resolvePublicMetadata(args: {
636
641
  dataSource: DataSource;
637
- entityMap: EntityMap$1;
642
+ entityMap: EntityMap$2;
638
643
  slug: string;
639
644
  seoFromJoin?: SeoLike | null;
640
645
  overrides?: SeoMetadataOverrides;
@@ -660,9 +665,9 @@ declare function verifyOtpCodeHash(code: string, storedHash: string, purpose: st
660
665
  declare function generateNumericOtp(length?: number): string;
661
666
  /** Normalize to E.164-like +digits */
662
667
  declare function normalizePhoneE164(raw: string, defaultCountryCode?: string): string | null;
663
- type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
664
- declare function countRecentOtpSends(dataSource: DataSource, entityMap: EntityMap, purpose: OtpPurpose, identifier: string, since: Date): Promise<number>;
665
- declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap, input: {
668
+ type EntityMap$1 = Record<string, EntityTarget<ObjectLiteral>>;
669
+ declare function countRecentOtpSends(dataSource: DataSource, entityMap: EntityMap$1, purpose: OtpPurpose, identifier: string, since: Date): Promise<number>;
670
+ declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap$1, input: {
666
671
  purpose: OtpPurpose;
667
672
  channel: OtpChannel;
668
673
  identifier: string;
@@ -675,7 +680,7 @@ declare function createOtpChallenge(dataSource: DataSource, entityMap: EntityMap
675
680
  error: string;
676
681
  status: number;
677
682
  }>;
678
- declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap: EntityMap, input: {
683
+ declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap: EntityMap$1, input: {
679
684
  purpose: OtpPurpose;
680
685
  identifier: string;
681
686
  code: string;
@@ -688,6 +693,79 @@ declare function verifyAndConsumeOtpChallenge(dataSource: DataSource, entityMap:
688
693
  status: number;
689
694
  }>;
690
695
 
696
+ /** Returns true if request is allowed; false if rate limited. */
697
+ declare function allowRateLimit(key: string): Promise<boolean>;
698
+ type ExtraPublicWriteRule = (method: string, segments: string[]) => boolean;
699
+ /** Segments are path parts after `/api/` (e.g. `['form-submissions']`). */
700
+ declare function shouldRateLimitPublicWrite(method: string, segments: string[], extraRule?: ExtraPublicWriteRule): boolean;
701
+ declare function rateLimitKeyForApiRequest(req: Request, segments: string[]): string;
702
+ declare function rateLimitPublicApiIfNeeded(req: Request, method: string, segments: string[], options?: {
703
+ extraRule?: ExtraPublicWriteRule;
704
+ }): Promise<Response | null>;
705
+ declare function rateLimitCheckoutPost(req: Request): Promise<Response | null>;
706
+
707
+ interface EntityMapLike {
708
+ configs: unknown;
709
+ orders: unknown;
710
+ order_items: unknown;
711
+ }
712
+ interface SendOrderPlacedEmailDeps {
713
+ getDataSource: () => Promise<DataSource>;
714
+ entityMap: EntityMapLike;
715
+ getCms: () => Promise<CmsApp>;
716
+ }
717
+ /** After payment confirmation: email customer + each sales team address from plugin settings. */
718
+ declare function sendOrderPlacedEmailsAfterConfirmation(orderId: number, deps: SendOrderPlacedEmailDeps): Promise<void>;
719
+
720
+ interface DataSourceManager {
721
+ getDataSource: () => DataSource;
722
+ getDataSourceInitialized: () => Promise<DataSource>;
723
+ resetDataSource: () => void;
724
+ registerOnReset: (cb: () => void) => void;
725
+ isConnectionError: (e: unknown) => boolean;
726
+ }
727
+ declare function createDataSourceManager(entityMap: Record<string, unknown>, options?: {
728
+ databaseUrl?: string;
729
+ idleTimeoutMillis?: number;
730
+ }): DataSourceManager;
731
+
732
+ interface SeedEntityMap {
733
+ users: unknown;
734
+ user_groups: unknown;
735
+ }
736
+ declare function seedDefaultAdmin(ds: DataSource, entityMap: SeedEntityMap, opts?: {
737
+ email?: string;
738
+ password?: string;
739
+ }): Promise<void>;
740
+
741
+ interface PublicThemeSettingsPayload {
742
+ activeThemeId: string;
743
+ primaryColor: string;
744
+ secondaryColor: string;
745
+ navbarConfig: NavbarConfig;
746
+ footerOverrides: Partial<FooterConfig>;
747
+ }
748
+ declare function loadPublicThemeSettings(config: {
749
+ dataSource: DataSource;
750
+ entityMap: EntityMap$2;
751
+ encryptionKey?: string;
752
+ defaultActiveThemeId?: string;
753
+ defaultPrimaryColor?: string;
754
+ defaultSecondaryColor?: string;
755
+ }): Promise<PublicThemeSettingsPayload>;
756
+
757
+ /** Normalize a logical media folder path: no leading/trailing slashes, no ".." segments, max length. */
758
+ declare function sanitizeMediaFolderPath(input: unknown): string;
759
+ /** Single path segment for storage (folder name or legacy path segment). */
760
+ declare function sanitizeStorageSegment(name: string): string;
761
+
762
+ type EntityMap = Record<string, EntityTarget<ObjectLiteral>>;
763
+ /** Build `a/b/c` path under `uploads/` from the chain of folder rows up to root. */
764
+ declare function relativePathFromMediaParentId(dataSource: DataSource, entityMap: EntityMap, parentId: number | null): Promise<string>;
765
+
766
+ declare const ZIP_MIME_TYPES: Set<string>;
767
+ declare function isZipMedia(mime: string | null | undefined, filename: string): boolean;
768
+
691
769
  declare class Permission {
692
770
  id: number;
693
771
  groupId: number;
@@ -1052,6 +1130,9 @@ declare class Product {
1052
1130
  categoryId: number | null;
1053
1131
  sku: string | null;
1054
1132
  hsn: string | null;
1133
+ /** Unit of measure, e.g. pcs, kg, hrs */
1134
+ uom: string | null;
1135
+ type: 'product' | 'service';
1055
1136
  slug: string | null;
1056
1137
  name: string | null;
1057
1138
  price: number;
@@ -1084,6 +1165,13 @@ declare class OrderItem {
1084
1165
  unitPrice: number;
1085
1166
  tax: number;
1086
1167
  total: number;
1168
+ /** Snapshot at order time */
1169
+ hsn: string | null;
1170
+ uom: string | null;
1171
+ productType: string | null;
1172
+ taxRate: number | null;
1173
+ /** Tax slug snapshot (from taxes.slug) */
1174
+ taxCode: string | null;
1087
1175
  metadata: Record<string, unknown> | null;
1088
1176
  createdAt: Date;
1089
1177
  updatedAt: Date;
@@ -1225,9 +1313,13 @@ declare class MessageTemplate {
1225
1313
 
1226
1314
  declare class Media {
1227
1315
  id: number;
1316
+ kind: 'file' | 'folder';
1317
+ parentId: number | null;
1318
+ parent: Media | null;
1319
+ children: Media[];
1228
1320
  filename: string;
1229
- url: string;
1230
- mimeType: string;
1321
+ url: string | null;
1322
+ mimeType: string | null;
1231
1323
  size: number;
1232
1324
  alt: string | null;
1233
1325
  isPublic: boolean;
@@ -1325,4 +1417,4 @@ declare class Wishlist {
1325
1417
  /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
1326
1418
  declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
1327
1419
 
1328
- export { type AnalyticsPluginConfig, Attribute, Blog, 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 ERPPluginConfig, type ERPPluginInstance, ERPSubmissionService, type EmailData, type EmailJobPayload, type EmailPluginConfig, EmailService, type EmailServiceInterface, EmailTemplateName, EmailTemplateResult, EntityMap$1 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, analyticsPlugin, assertCaptchaOk, buildCaptchaPublicConfig, cachePlugin, captchaPlugin, cn, countRecentOtpSends, createCmsApp, createOtpChallenge, emailPlugin, emailTemplates, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, hashOtpCode, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, localStoragePlugin, mergeSeoBySlug, normalizePhoneE164, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueOrderPlacedEmails, queuePlugin, queueSms, registerEmailQueueProcessor, registerErpQueueProcessor, registerSmsQueueProcessor, renderEmail, renderLayout, resolvePublicMetadata, s3StoragePlugin, serializeEmailRecipients, smsPlugin, truncateText, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash };
1420
+ export { Address, type AnalyticsPluginConfig, Attribute, Blog, 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, EntityMap$2 as EntityMap, type ErpContactSyncInput, type ErpCreateContactPayload, type ErpJobPayload, type ErpPaidOrderDataSource, type ErpPaidOrderEntityMap, type ExtraPublicWriteRule, Form, FormField, FormSubmission, KnowledgeBaseChunk, KnowledgeBaseDocument, type LlmChatOptions, type LlmMessage, type LlmPluginConfig, LlmService, type LlmServiceInterface, type LocalStoragePluginConfig, type Logger, Media, MessageTemplate, Order, OrderItem, type OrderPlacedEmailPayload, OrderPlacedLineItem, OtpChallenge, type OtpChannel, type OtpPurpose, Page, PasswordResetToken, Payment, type PaymentIntent, type PaymentPluginConfig, type PaymentServiceInterface, Permission, type PipelineNames, type PluginContext, Product, ProductAttribute, ProductCategory, ProductTax, type PublicThemeSettingsPayload, type QueuePluginConfig, type QueueService, type RenderEmailOptions, type RenderedEmail, type S3StoragePluginConfig, Seo, type SeoLike, type SeoMetadataOverrides, type SmsJobPayload, type SmsPluginConfig, type SmsProviderChoice, type SmsProviderId, type SmsServiceConfig, type SmsServiceInterface, StorageService, Tag, Tax, TemplateContext, User, UserGroup, Wishlist, WishlistItem, ZIP_MIME_TYPES, allowRateLimit, analyticsPlugin, assertCaptchaOk, buildCaptchaPublicConfig, cachePlugin, captchaPlugin, cn, countRecentOtpSends, createCmsApp, createDataSourceManager, createOtpChallenge, emailPlugin, emailTemplates, erpPlugin, fetchSeoBySlug, formatDate, formatDateOnly, formatDateTime, generateNumericOtp, generateSlug, hashOtpCode, isZipMedia, joinRecipientsForSend, linkUnclaimedContactToUser, llmPlugin, loadPublicThemeSettings, localStoragePlugin, mergeSeoBySlug, normalizePhoneE164, parseEmailRecipientsFromConfig, paymentPlugin, queueEmail, queueErp, queueErpCreateContactIfEnabled, queueErpPaidOrderForOrderId, queueOrderPlacedEmails, queuePlugin, queueSms, rateLimitCheckoutPost, rateLimitKeyForApiRequest, rateLimitPublicApiIfNeeded, registerEmailQueueProcessor, registerErpQueueProcessor, registerSmsQueueProcessor, relativePathFromMediaParentId, renderEmail, renderLayout, resolvePublicMetadata, s3StoragePlugin, sanitizeMediaFolderPath, sanitizeStorageSegment, seedDefaultAdmin, sendOrderPlacedEmailsAfterConfirmation, serializeEmailRecipients, shouldRateLimitPublicWrite, smsPlugin, truncateText, validateSlug, verifyAndConsumeOtpChallenge, verifyOtpCodeHash };