@infuro/cms-core 1.0.12 → 1.0.15

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.
@@ -26,6 +26,8 @@ interface OrderPlacedLineItem {
26
26
  unitPrice: number | string;
27
27
  lineTotal: number | string;
28
28
  sku?: string | null;
29
+ tax?: number | string | null;
30
+ hsn?: string | null;
29
31
  }
30
32
  /** Merge branding + email plugin settings for layout (email overrides when set). */
31
33
  declare function mergeEmailLayoutCompanyDetails(branding: Record<string, string>, emailSettings: Record<string, string>): CompanyDetails;
@@ -37,7 +39,7 @@ interface EmailTemplateResult {
37
39
  type TemplateContext<T = unknown> = T & {
38
40
  companyDetails: CompanyDetails;
39
41
  };
40
- declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission"];
42
+ declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission", "otp"];
41
43
  type EmailTemplateName = (typeof EMAIL_TEMPLATE_NAMES)[number];
42
44
  declare function getCompanyDetailsFromSettings(settingsGroup: Record<string, string>): CompanyDetails;
43
45
 
@@ -55,6 +57,10 @@ interface CrudHandlerOptions {
55
57
  status?: number;
56
58
  }) => Response;
57
59
  requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
60
+ /** When set, contact create/update enqueues ERP `create-contact` (non-fatal). */
61
+ getCms?: () => Promise<{
62
+ getPlugin: (name: string) => unknown;
63
+ }>;
58
64
  }
59
65
  declare function createCrudHandler(dataSource: DataSource, entityMap: EntityMap, options: CrudHandlerOptions): {
60
66
  GET(req: Request, resource: string): Promise<Response>;
@@ -265,9 +271,17 @@ interface SettingsApiConfig extends CmsHandlersBase {
265
271
  /** Groups in this list are readable without auth (GET returns all keys for the group). */
266
272
  publicGetGroups?: string[];
267
273
  }
274
+ /**
275
+ * Structural types so apps with their own `typeorm` install (e.g. npm link) typecheck without duplicate-package errors.
276
+ */
277
+ type GetPublicSettingsGroupDataSource = {
278
+ getRepository(entity: unknown): {
279
+ find(options: object): Promise<unknown[]>;
280
+ };
281
+ };
268
282
  interface GetPublicSettingsGroupConfig {
269
- dataSource: DataSource;
270
- entityMap: EntityMap;
283
+ dataSource: GetPublicSettingsGroupDataSource;
284
+ entityMap: Record<string, unknown>;
271
285
  encryptionKey?: string;
272
286
  }
273
287
  /** Same rows as unauthenticated GET /api/settings/:group when the group is in publicGetGroups. */
@@ -343,6 +357,11 @@ declare function createCmsApiHandler(config: CmsApiHandlerConfig): {
343
357
  handle(method: string, path: string[], req: Request): Promise<Response>;
344
358
  };
345
359
 
360
+ interface StorefrontOtpFlags {
361
+ login?: boolean;
362
+ verifyEmail?: boolean;
363
+ verifyPhone?: boolean;
364
+ }
346
365
  interface StorefrontApiConfig {
347
366
  dataSource: DataSource;
348
367
  entityMap: EntityMap;
@@ -361,9 +380,16 @@ interface StorefrontApiConfig {
361
380
  getCompanyDetails?: () => Promise<CompanyDetails>;
362
381
  /** Origin for verify links (e.g. process.env.NEXTAUTH_URL). Required with getCms for verification URLs. */
363
382
  publicSiteUrl?: string;
383
+ /** When a flag is true, the corresponding OTP storefront route is enabled. */
384
+ otpFlags?: StorefrontOtpFlags;
385
+ /** Defaults to OTP_PEPPER or NEXTAUTH_SECRET. */
386
+ otpPepper?: string;
387
+ defaultPhoneCountryCode?: string;
388
+ /** When false, login OTP send accepts email only (no phone). Default true. */
389
+ otpAllowPhoneLogin?: boolean;
364
390
  }
365
391
  declare function createStorefrontApiHandler(config: StorefrontApiConfig): {
366
392
  handle(method: string, path: string[], req: Request): Promise<Response>;
367
393
  };
368
394
 
369
- export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type CompanyDetails as C, type DashboardStatsConfig as D, type EmailTemplateResult as E, type ForgotPasswordConfig as F, type GetPublicSettingsGroupConfig as G, createSetPasswordHandler as H, type InviteAcceptConfig as I, createSettingsApiHandlers as J, createStorefrontApiHandler as K, createUploadHandler as L, createUserAuthApiRouter as M, createUserAvatarHandler as N, type OrderPlacedLineItem as O, createUserProfileHandler as P, createUsersApiHandlers as Q, getCompanyDetailsFromSettings as R, type StorageService as S, type TemplateContext as T, type UploadHandlerConfig as U, getPublicSettingsGroup as V, mergeEmailLayoutCompanyDetails as W, type EmailTemplateName as a, type AuthHandlersConfig as b, type ChangePasswordConfig as c, type CmsApiHandlerConfig as d, type CmsGetter as e, type CrudHandlerOptions as f, type EntityMap as g, type FormBySlugConfig as h, type SetPasswordConfig as i, type SettingsApiConfig as j, type SocialLinkItem as k, type StorefrontApiConfig as l, type UserAuthApiConfig as m, type UserAvatarConfig as n, type UserProfileConfig as o, type UsersApiConfig as p, createAnalyticsHandlers as q, createBlogBySlugHandler as r, createChangePasswordHandler as s, createCmsApiHandler as t, createCrudByIdHandler as u, createCrudHandler as v, createDashboardStatsHandler as w, createForgotPasswordHandler as x, createFormBySlugHandler as y, createInviteAcceptHandler as z };
395
+ export { type AnalyticsHandlerConfig as A, type BlogBySlugConfig as B, type CompanyDetails as C, type DashboardStatsConfig as D, type EmailTemplateResult as E, type ForgotPasswordConfig as F, type GetPublicSettingsGroupConfig as G, createFormBySlugHandler as H, type InviteAcceptConfig as I, createInviteAcceptHandler as J, createSetPasswordHandler as K, createSettingsApiHandlers as L, createStorefrontApiHandler as M, createUploadHandler as N, type OrderPlacedLineItem as O, createUserAuthApiRouter as P, createUserAvatarHandler as Q, createUserProfileHandler as R, type StorageService as S, type TemplateContext as T, type UploadHandlerConfig as U, createUsersApiHandlers as V, getCompanyDetailsFromSettings as W, getPublicSettingsGroup as X, mergeEmailLayoutCompanyDetails as Y, type EmailTemplateName as a, type EntityMap as b, type AuthHandlersConfig as c, type ChangePasswordConfig as d, type CmsApiHandlerConfig as e, type CmsGetter as f, type CrudHandlerOptions as g, type FormBySlugConfig as h, type GetPublicSettingsGroupDataSource as i, type SetPasswordConfig as j, type SettingsApiConfig as k, type SocialLinkItem as l, type StorefrontApiConfig as m, type StorefrontOtpFlags as n, type UserAuthApiConfig as o, type UserAvatarConfig as p, type UserProfileConfig as q, type UsersApiConfig as r, createAnalyticsHandlers as s, createBlogBySlugHandler as t, createChangePasswordHandler as u, createCmsApiHandler as v, createCrudByIdHandler as w, createCrudHandler as x, createDashboardStatsHandler as y, createForgotPasswordHandler as z };