@loyal-ix/loyalix-shared-types 1.3.0 → 1.4.0

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.mts CHANGED
@@ -74,6 +74,32 @@ declare enum OAuthProvider {
74
74
  FACEBOOK = "facebook"
75
75
  }
76
76
 
77
+ /**
78
+ * Subscription-related enums shared between backend and frontend.
79
+ */
80
+ declare enum SubscriptionStatus {
81
+ TRIALING = "trialing",
82
+ ACTIVE = "active",
83
+ PAST_DUE = "past_due",
84
+ CANCELLED = "cancelled",
85
+ EXPIRED = "expired"
86
+ }
87
+ declare enum BillingCycle {
88
+ MONTHLY = "monthly",
89
+ YEARLY = "yearly"
90
+ }
91
+ declare enum InvoiceStatus {
92
+ DRAFT = "draft",
93
+ OPEN = "open",
94
+ PAID = "paid",
95
+ VOID = "void",
96
+ UNCOLLECTIBLE = "uncollectible"
97
+ }
98
+ declare enum PaymentProviderType {
99
+ STRIPE = "stripe",
100
+ FLUTTERWAVE = "flutterwave"
101
+ }
102
+
77
103
  interface SuccessResponse<T> {
78
104
  success: true;
79
105
  data: T;
@@ -317,6 +343,7 @@ interface UpdateBusinessDto {
317
343
  address?: string;
318
344
  description?: string;
319
345
  industryType?: string;
346
+ status?: BusinessStatus;
320
347
  }
321
348
  interface BusinessDto {
322
349
  id: string;
@@ -338,6 +365,8 @@ interface BusinessListItemDto {
338
365
  name: string;
339
366
  description?: string;
340
367
  address?: string;
368
+ email?: string;
369
+ phone?: string;
341
370
  status: string;
342
371
  industryType?: string;
343
372
  activeProgramCount?: number;
@@ -348,10 +377,9 @@ interface BusinessListItemDto {
348
377
  /**
349
378
  * Detailed business DTO for admin views
350
379
  * Excludes: qrSecret (never exposed)
380
+ * Contact fields (email, phone) are inherited from BusinessListItemDto.
351
381
  */
352
382
  interface BusinessDetailDto extends BusinessListItemDto {
353
- email?: string;
354
- phone?: string;
355
383
  staffCount?: number;
356
384
  programCount?: number;
357
385
  createdAt: string;
@@ -424,4 +452,105 @@ interface LoyaltyProgramDto {
424
452
  coverImage?: ImageRefDto;
425
453
  }
426
454
 
427
- export { type ApiResponse, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type ImageDto, type ImageRefDto, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
455
+ interface PlanFeatures {
456
+ maxPrograms: number;
457
+ maxCustomers: number;
458
+ maxStaff: number;
459
+ promotions: boolean;
460
+ advancedAnalytics: boolean;
461
+ prioritySupport: boolean;
462
+ customBranding: boolean;
463
+ }
464
+ interface SubscriptionPlanDto {
465
+ id: string;
466
+ name: string;
467
+ displayName: string;
468
+ description: string | null;
469
+ monthlyPriceUsd: number;
470
+ yearlyPriceUsd: number;
471
+ features: PlanFeatures;
472
+ trialDays: number;
473
+ stripePriceIdMonthly: string | null;
474
+ stripePriceIdYearly: string | null;
475
+ flutterwavePlanIdMonthly: string | null;
476
+ flutterwavePlanIdYearly: string | null;
477
+ isActive: boolean;
478
+ position: number;
479
+ createdAt: string;
480
+ updatedAt: string;
481
+ }
482
+ interface CreateSubscriptionPlanDto {
483
+ name: string;
484
+ displayName: string;
485
+ description?: string;
486
+ monthlyPriceUsd: number;
487
+ yearlyPriceUsd: number;
488
+ features: PlanFeatures;
489
+ trialDays?: number;
490
+ stripePriceIdMonthly?: string;
491
+ stripePriceIdYearly?: string;
492
+ flutterwavePlanIdMonthly?: string;
493
+ flutterwavePlanIdYearly?: string;
494
+ isActive?: boolean;
495
+ position?: number;
496
+ }
497
+ interface UpdateSubscriptionPlanDto {
498
+ name?: string;
499
+ displayName?: string;
500
+ description?: string;
501
+ monthlyPriceUsd?: number;
502
+ yearlyPriceUsd?: number;
503
+ features?: Partial<PlanFeatures>;
504
+ trialDays?: number;
505
+ stripePriceIdMonthly?: string;
506
+ stripePriceIdYearly?: string;
507
+ flutterwavePlanIdMonthly?: string;
508
+ flutterwavePlanIdYearly?: string;
509
+ isActive?: boolean;
510
+ position?: number;
511
+ }
512
+ interface BusinessSubscriptionDto {
513
+ id: string;
514
+ businessId: string;
515
+ planId: string;
516
+ status: SubscriptionStatus;
517
+ billingCycle: BillingCycle;
518
+ currentPeriodStart: string;
519
+ currentPeriodEnd: string | null;
520
+ trialEndsAt: string | null;
521
+ cancelledAt: string | null;
522
+ providerSubscriptionId: string | null;
523
+ providerType: PaymentProviderType | null;
524
+ plan?: SubscriptionPlanDto;
525
+ createdAt: string;
526
+ updatedAt: string;
527
+ }
528
+ interface CreateBusinessSubscriptionDto {
529
+ businessId: string;
530
+ planId: string;
531
+ billingCycle: BillingCycle;
532
+ providerType: PaymentProviderType;
533
+ phoneNumber?: string;
534
+ }
535
+ interface UpgradeSubscriptionDto {
536
+ planId?: string;
537
+ billingCycle?: BillingCycle;
538
+ }
539
+ interface InvoiceDto {
540
+ id: string;
541
+ businessId: string;
542
+ subscriptionId: string | null;
543
+ paymentId: string | null;
544
+ invoiceNumber: string;
545
+ amount: number;
546
+ currency: string;
547
+ status: InvoiceStatus;
548
+ periodStart: string;
549
+ periodEnd: string;
550
+ dueDate: string;
551
+ paidAt: string | null;
552
+ providerInvoiceId: string | null;
553
+ createdAt: string;
554
+ }
555
+
556
+ export { type ApiResponse, BillingCycle, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type BusinessSubscriptionDto, type CreateBusinessDto, type CreateBusinessSubscriptionDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateSubscriptionPlanDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type ImageDto, type ImageRefDto, type InvoiceDto, InvoiceStatus, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, PaymentProviderType, Permission, type PlanFeatures, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SubscriptionPlanDto, SubscriptionStatus, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateSubscriptionPlanDto, type UpdateUserDto, type UpgradeSubscriptionDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
package/dist/index.d.ts CHANGED
@@ -74,6 +74,32 @@ declare enum OAuthProvider {
74
74
  FACEBOOK = "facebook"
75
75
  }
76
76
 
77
+ /**
78
+ * Subscription-related enums shared between backend and frontend.
79
+ */
80
+ declare enum SubscriptionStatus {
81
+ TRIALING = "trialing",
82
+ ACTIVE = "active",
83
+ PAST_DUE = "past_due",
84
+ CANCELLED = "cancelled",
85
+ EXPIRED = "expired"
86
+ }
87
+ declare enum BillingCycle {
88
+ MONTHLY = "monthly",
89
+ YEARLY = "yearly"
90
+ }
91
+ declare enum InvoiceStatus {
92
+ DRAFT = "draft",
93
+ OPEN = "open",
94
+ PAID = "paid",
95
+ VOID = "void",
96
+ UNCOLLECTIBLE = "uncollectible"
97
+ }
98
+ declare enum PaymentProviderType {
99
+ STRIPE = "stripe",
100
+ FLUTTERWAVE = "flutterwave"
101
+ }
102
+
77
103
  interface SuccessResponse<T> {
78
104
  success: true;
79
105
  data: T;
@@ -317,6 +343,7 @@ interface UpdateBusinessDto {
317
343
  address?: string;
318
344
  description?: string;
319
345
  industryType?: string;
346
+ status?: BusinessStatus;
320
347
  }
321
348
  interface BusinessDto {
322
349
  id: string;
@@ -338,6 +365,8 @@ interface BusinessListItemDto {
338
365
  name: string;
339
366
  description?: string;
340
367
  address?: string;
368
+ email?: string;
369
+ phone?: string;
341
370
  status: string;
342
371
  industryType?: string;
343
372
  activeProgramCount?: number;
@@ -348,10 +377,9 @@ interface BusinessListItemDto {
348
377
  /**
349
378
  * Detailed business DTO for admin views
350
379
  * Excludes: qrSecret (never exposed)
380
+ * Contact fields (email, phone) are inherited from BusinessListItemDto.
351
381
  */
352
382
  interface BusinessDetailDto extends BusinessListItemDto {
353
- email?: string;
354
- phone?: string;
355
383
  staffCount?: number;
356
384
  programCount?: number;
357
385
  createdAt: string;
@@ -424,4 +452,105 @@ interface LoyaltyProgramDto {
424
452
  coverImage?: ImageRefDto;
425
453
  }
426
454
 
427
- export { type ApiResponse, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type ImageDto, type ImageRefDto, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
455
+ interface PlanFeatures {
456
+ maxPrograms: number;
457
+ maxCustomers: number;
458
+ maxStaff: number;
459
+ promotions: boolean;
460
+ advancedAnalytics: boolean;
461
+ prioritySupport: boolean;
462
+ customBranding: boolean;
463
+ }
464
+ interface SubscriptionPlanDto {
465
+ id: string;
466
+ name: string;
467
+ displayName: string;
468
+ description: string | null;
469
+ monthlyPriceUsd: number;
470
+ yearlyPriceUsd: number;
471
+ features: PlanFeatures;
472
+ trialDays: number;
473
+ stripePriceIdMonthly: string | null;
474
+ stripePriceIdYearly: string | null;
475
+ flutterwavePlanIdMonthly: string | null;
476
+ flutterwavePlanIdYearly: string | null;
477
+ isActive: boolean;
478
+ position: number;
479
+ createdAt: string;
480
+ updatedAt: string;
481
+ }
482
+ interface CreateSubscriptionPlanDto {
483
+ name: string;
484
+ displayName: string;
485
+ description?: string;
486
+ monthlyPriceUsd: number;
487
+ yearlyPriceUsd: number;
488
+ features: PlanFeatures;
489
+ trialDays?: number;
490
+ stripePriceIdMonthly?: string;
491
+ stripePriceIdYearly?: string;
492
+ flutterwavePlanIdMonthly?: string;
493
+ flutterwavePlanIdYearly?: string;
494
+ isActive?: boolean;
495
+ position?: number;
496
+ }
497
+ interface UpdateSubscriptionPlanDto {
498
+ name?: string;
499
+ displayName?: string;
500
+ description?: string;
501
+ monthlyPriceUsd?: number;
502
+ yearlyPriceUsd?: number;
503
+ features?: Partial<PlanFeatures>;
504
+ trialDays?: number;
505
+ stripePriceIdMonthly?: string;
506
+ stripePriceIdYearly?: string;
507
+ flutterwavePlanIdMonthly?: string;
508
+ flutterwavePlanIdYearly?: string;
509
+ isActive?: boolean;
510
+ position?: number;
511
+ }
512
+ interface BusinessSubscriptionDto {
513
+ id: string;
514
+ businessId: string;
515
+ planId: string;
516
+ status: SubscriptionStatus;
517
+ billingCycle: BillingCycle;
518
+ currentPeriodStart: string;
519
+ currentPeriodEnd: string | null;
520
+ trialEndsAt: string | null;
521
+ cancelledAt: string | null;
522
+ providerSubscriptionId: string | null;
523
+ providerType: PaymentProviderType | null;
524
+ plan?: SubscriptionPlanDto;
525
+ createdAt: string;
526
+ updatedAt: string;
527
+ }
528
+ interface CreateBusinessSubscriptionDto {
529
+ businessId: string;
530
+ planId: string;
531
+ billingCycle: BillingCycle;
532
+ providerType: PaymentProviderType;
533
+ phoneNumber?: string;
534
+ }
535
+ interface UpgradeSubscriptionDto {
536
+ planId?: string;
537
+ billingCycle?: BillingCycle;
538
+ }
539
+ interface InvoiceDto {
540
+ id: string;
541
+ businessId: string;
542
+ subscriptionId: string | null;
543
+ paymentId: string | null;
544
+ invoiceNumber: string;
545
+ amount: number;
546
+ currency: string;
547
+ status: InvoiceStatus;
548
+ periodStart: string;
549
+ periodEnd: string;
550
+ dueDate: string;
551
+ paidAt: string | null;
552
+ providerInvoiceId: string | null;
553
+ createdAt: string;
554
+ }
555
+
556
+ export { type ApiResponse, BillingCycle, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type BusinessSubscriptionDto, type CreateBusinessDto, type CreateBusinessSubscriptionDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateSubscriptionPlanDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type ImageDto, type ImageRefDto, type InvoiceDto, InvoiceStatus, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, PaymentProviderType, Permission, type PlanFeatures, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SubscriptionPlanDto, SubscriptionStatus, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateSubscriptionPlanDto, type UpdateUserDto, type UpgradeSubscriptionDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
package/dist/index.js CHANGED
@@ -20,10 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ BillingCycle: () => BillingCycle,
23
24
  BusinessStatus: () => BusinessStatus,
25
+ InvoiceStatus: () => InvoiceStatus,
24
26
  OAuthProvider: () => OAuthProvider,
27
+ PaymentProviderType: () => PaymentProviderType,
25
28
  Permission: () => Permission,
26
- Role: () => Role
29
+ Role: () => Role,
30
+ SubscriptionStatus: () => SubscriptionStatus
27
31
  });
28
32
  module.exports = __toCommonJS(index_exports);
29
33
 
@@ -106,10 +110,42 @@ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
106
110
  OAuthProvider2["FACEBOOK"] = "facebook";
107
111
  return OAuthProvider2;
108
112
  })(OAuthProvider || {});
113
+
114
+ // src/enums/subscription.enum.ts
115
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
116
+ SubscriptionStatus2["TRIALING"] = "trialing";
117
+ SubscriptionStatus2["ACTIVE"] = "active";
118
+ SubscriptionStatus2["PAST_DUE"] = "past_due";
119
+ SubscriptionStatus2["CANCELLED"] = "cancelled";
120
+ SubscriptionStatus2["EXPIRED"] = "expired";
121
+ return SubscriptionStatus2;
122
+ })(SubscriptionStatus || {});
123
+ var BillingCycle = /* @__PURE__ */ ((BillingCycle2) => {
124
+ BillingCycle2["MONTHLY"] = "monthly";
125
+ BillingCycle2["YEARLY"] = "yearly";
126
+ return BillingCycle2;
127
+ })(BillingCycle || {});
128
+ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus2) => {
129
+ InvoiceStatus2["DRAFT"] = "draft";
130
+ InvoiceStatus2["OPEN"] = "open";
131
+ InvoiceStatus2["PAID"] = "paid";
132
+ InvoiceStatus2["VOID"] = "void";
133
+ InvoiceStatus2["UNCOLLECTIBLE"] = "uncollectible";
134
+ return InvoiceStatus2;
135
+ })(InvoiceStatus || {});
136
+ var PaymentProviderType = /* @__PURE__ */ ((PaymentProviderType2) => {
137
+ PaymentProviderType2["STRIPE"] = "stripe";
138
+ PaymentProviderType2["FLUTTERWAVE"] = "flutterwave";
139
+ return PaymentProviderType2;
140
+ })(PaymentProviderType || {});
109
141
  // Annotate the CommonJS export names for ESM import in node:
110
142
  0 && (module.exports = {
143
+ BillingCycle,
111
144
  BusinessStatus,
145
+ InvoiceStatus,
112
146
  OAuthProvider,
147
+ PaymentProviderType,
113
148
  Permission,
114
- Role
149
+ Role,
150
+ SubscriptionStatus
115
151
  });
package/dist/index.mjs CHANGED
@@ -77,9 +77,41 @@ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
77
77
  OAuthProvider2["FACEBOOK"] = "facebook";
78
78
  return OAuthProvider2;
79
79
  })(OAuthProvider || {});
80
+
81
+ // src/enums/subscription.enum.ts
82
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
83
+ SubscriptionStatus2["TRIALING"] = "trialing";
84
+ SubscriptionStatus2["ACTIVE"] = "active";
85
+ SubscriptionStatus2["PAST_DUE"] = "past_due";
86
+ SubscriptionStatus2["CANCELLED"] = "cancelled";
87
+ SubscriptionStatus2["EXPIRED"] = "expired";
88
+ return SubscriptionStatus2;
89
+ })(SubscriptionStatus || {});
90
+ var BillingCycle = /* @__PURE__ */ ((BillingCycle2) => {
91
+ BillingCycle2["MONTHLY"] = "monthly";
92
+ BillingCycle2["YEARLY"] = "yearly";
93
+ return BillingCycle2;
94
+ })(BillingCycle || {});
95
+ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus2) => {
96
+ InvoiceStatus2["DRAFT"] = "draft";
97
+ InvoiceStatus2["OPEN"] = "open";
98
+ InvoiceStatus2["PAID"] = "paid";
99
+ InvoiceStatus2["VOID"] = "void";
100
+ InvoiceStatus2["UNCOLLECTIBLE"] = "uncollectible";
101
+ return InvoiceStatus2;
102
+ })(InvoiceStatus || {});
103
+ var PaymentProviderType = /* @__PURE__ */ ((PaymentProviderType2) => {
104
+ PaymentProviderType2["STRIPE"] = "stripe";
105
+ PaymentProviderType2["FLUTTERWAVE"] = "flutterwave";
106
+ return PaymentProviderType2;
107
+ })(PaymentProviderType || {});
80
108
  export {
109
+ BillingCycle,
81
110
  BusinessStatus,
111
+ InvoiceStatus,
82
112
  OAuthProvider,
113
+ PaymentProviderType,
83
114
  Permission,
84
- Role
115
+ Role,
116
+ SubscriptionStatus
85
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loyal-ix/loyalix-shared-types",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Shared TypeScript types for Loyalix frontend and backend",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",