@infuro/cms-core 1.0.11 → 1.0.14

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.
@@ -37,7 +37,7 @@ interface EmailTemplateResult {
37
37
  type TemplateContext<T = unknown> = T & {
38
38
  companyDetails: CompanyDetails;
39
39
  };
40
- declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission"];
40
+ declare const EMAIL_TEMPLATE_NAMES: readonly ["signup", "passwordReset", "passwordChange", "orderPlaced", "returnInitiated", "shippingUpdate", "invite", "formSubmission", "otp"];
41
41
  type EmailTemplateName = (typeof EMAIL_TEMPLATE_NAMES)[number];
42
42
  declare function getCompanyDetailsFromSettings(settingsGroup: Record<string, string>): CompanyDetails;
43
43
 
@@ -55,6 +55,10 @@ interface CrudHandlerOptions {
55
55
  status?: number;
56
56
  }) => Response;
57
57
  requireEntityPermission?: (req: Request, entity: string, action: EntityCrudAction) => Promise<Response | null>;
58
+ /** When set, contact create/update enqueues ERP `create-contact` (non-fatal). */
59
+ getCms?: () => Promise<{
60
+ getPlugin: (name: string) => unknown;
61
+ }>;
58
62
  }
59
63
  declare function createCrudHandler(dataSource: DataSource, entityMap: EntityMap, options: CrudHandlerOptions): {
60
64
  GET(req: Request, resource: string): Promise<Response>;
@@ -265,6 +269,21 @@ interface SettingsApiConfig extends CmsHandlersBase {
265
269
  /** Groups in this list are readable without auth (GET returns all keys for the group). */
266
270
  publicGetGroups?: string[];
267
271
  }
272
+ /**
273
+ * Structural types so apps with their own `typeorm` install (e.g. npm link) typecheck without duplicate-package errors.
274
+ */
275
+ type GetPublicSettingsGroupDataSource = {
276
+ getRepository(entity: unknown): {
277
+ find(options: object): Promise<unknown[]>;
278
+ };
279
+ };
280
+ interface GetPublicSettingsGroupConfig {
281
+ dataSource: GetPublicSettingsGroupDataSource;
282
+ entityMap: Record<string, unknown>;
283
+ encryptionKey?: string;
284
+ }
285
+ /** Same rows as unauthenticated GET /api/settings/:group when the group is in publicGetGroups. */
286
+ declare function getPublicSettingsGroup(config: GetPublicSettingsGroupConfig, group: string): Promise<Record<string, string>>;
268
287
  declare function createSettingsApiHandlers(config: SettingsApiConfig): {
269
288
  GET(req: Request, group: string): Promise<Response>;
270
289
  PUT(req: Request, group: string): Promise<Response>;
@@ -336,6 +355,11 @@ declare function createCmsApiHandler(config: CmsApiHandlerConfig): {
336
355
  handle(method: string, path: string[], req: Request): Promise<Response>;
337
356
  };
338
357
 
358
+ interface StorefrontOtpFlags {
359
+ login?: boolean;
360
+ verifyEmail?: boolean;
361
+ verifyPhone?: boolean;
362
+ }
339
363
  interface StorefrontApiConfig {
340
364
  dataSource: DataSource;
341
365
  entityMap: EntityMap;
@@ -354,9 +378,16 @@ interface StorefrontApiConfig {
354
378
  getCompanyDetails?: () => Promise<CompanyDetails>;
355
379
  /** Origin for verify links (e.g. process.env.NEXTAUTH_URL). Required with getCms for verification URLs. */
356
380
  publicSiteUrl?: string;
381
+ /** When a flag is true, the corresponding OTP storefront route is enabled. */
382
+ otpFlags?: StorefrontOtpFlags;
383
+ /** Defaults to OTP_PEPPER or NEXTAUTH_SECRET. */
384
+ otpPepper?: string;
385
+ defaultPhoneCountryCode?: string;
386
+ /** When false, login OTP send accepts email only (no phone). Default true. */
387
+ otpAllowPhoneLogin?: boolean;
357
388
  }
358
389
  declare function createStorefrontApiHandler(config: StorefrontApiConfig): {
359
390
  handle(method: string, path: string[], req: Request): Promise<Response>;
360
391
  };
361
392
 
362
- 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, createSetPasswordHandler as G, createSettingsApiHandlers as H, type InviteAcceptConfig as I, createStorefrontApiHandler as J, createUploadHandler as K, createUserAuthApiRouter as L, createUserAvatarHandler as M, createUserProfileHandler as N, type OrderPlacedLineItem as O, createUsersApiHandlers as P, getCompanyDetailsFromSettings as Q, mergeEmailLayoutCompanyDetails as R, type StorageService as S, type TemplateContext as T, type UploadHandlerConfig as U, 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 };
393
+ 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 };