@owostack/types 0.1.2 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +44 -2
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -425,7 +425,7 @@ interface UsageRecord {
425
425
  * Used by metered(), boolean(), and plan() builder functions.
426
426
  */
427
427
  /** Union of all catalog entries passed to OwostackConfig.catalog */
428
- type CatalogEntry = PlanDefinition | CreditSystemDefinition;
428
+ type CatalogEntry = PlanDefinition | CreditSystemDefinition | CreditPackDefinition;
429
429
  /** Configuration for a metered feature within a plan */
430
430
  interface MeteredFeatureConfig {
431
431
  /** Limit for this plan (null = unlimited) */
@@ -491,6 +491,10 @@ interface PlanDefinition {
491
491
  provider?: string;
492
492
  /** Custom metadata */
493
493
  metadata?: Record<string, unknown>;
494
+ /** Auto-assign this plan to new customers */
495
+ autoEnable?: boolean;
496
+ /** Optional: Is this an add-on plan? */
497
+ isAddon?: boolean;
494
498
  }
495
499
  /** A feature entry within a credit system */
496
500
  interface CreditSystemFeatureEntry {
@@ -512,6 +516,29 @@ interface CreditSystemDefinition {
512
516
  /** Features that consume credits from this system with their credit costs */
513
517
  features: CreditSystemFeatureEntry[];
514
518
  }
519
+ /** A credit pack definition in the catalog */
520
+ interface CreditPackDefinition {
521
+ /** @internal */
522
+ _type: "credit_pack";
523
+ /** Credit pack slug (used as unique identifier) */
524
+ slug: string;
525
+ /** Human-readable credit pack name */
526
+ name: string;
527
+ /** Credit pack description */
528
+ description?: string;
529
+ /** Number of credits included in this pack */
530
+ credits: number;
531
+ /** Price in minor currency units (e.g. kobo) */
532
+ price: number;
533
+ /** Currency code */
534
+ currency: Currency;
535
+ /** Credit system this pack is tied to (required) */
536
+ creditSystem: string;
537
+ /** Provider for this pack (overrides default) */
538
+ provider?: string;
539
+ /** Custom metadata */
540
+ metadata?: Record<string, unknown>;
541
+ }
515
542
  /**
516
543
  * wallet() - Payment Methods
517
544
  */
@@ -644,6 +671,7 @@ interface SyncPayload {
644
671
  slug: string;
645
672
  type: "metered" | "boolean";
646
673
  name: string;
674
+ meterType?: "consumable" | "non_consumable";
647
675
  }>;
648
676
  creditSystems: Array<{
649
677
  slug: string;
@@ -654,6 +682,17 @@ interface SyncPayload {
654
682
  creditCost: number;
655
683
  }>;
656
684
  }>;
685
+ creditPacks: Array<{
686
+ slug: string;
687
+ name: string;
688
+ description?: string;
689
+ credits: number;
690
+ price: number;
691
+ currency: Currency;
692
+ creditSystem: string;
693
+ provider?: string;
694
+ metadata?: Record<string, unknown>;
695
+ }>;
657
696
  plans: Array<{
658
697
  slug: string;
659
698
  name: string;
@@ -665,6 +704,8 @@ interface SyncPayload {
665
704
  trialDays?: number;
666
705
  provider?: string;
667
706
  metadata?: Record<string, unknown>;
707
+ autoEnable?: boolean;
708
+ isAddon?: boolean;
668
709
  features: Array<{
669
710
  slug: string;
670
711
  enabled: boolean;
@@ -689,6 +730,7 @@ interface SyncResult {
689
730
  success: boolean;
690
731
  features: SyncChanges;
691
732
  creditSystems: SyncChanges;
733
+ creditPacks: SyncChanges;
692
734
  plans: SyncChanges;
693
735
  warnings: string[];
694
736
  }
@@ -803,4 +845,4 @@ interface ListEntitiesResult {
803
845
  total: number;
804
846
  }
805
847
 
806
- export type { AddEntityParams, AddEntityResult, AddonParams, AddonResult, AttachParams, AttachResult, BillingFeatureUsage, BillingUsageParams, BillingUsageResult, BooleanFeatureConfig, CardInfo, CatalogEntry, CheckCode, CheckParams, CheckResult, CreditSystemDefinition, CreditSystemFeatureEntry, Currency, Customer, CustomerData, CustomerParams, CustomerResult, Entitlement, Entity, Feature, FeatureLimit, Invoice, InvoiceLineItem, InvoiceParams, InvoiceResult, InvoicesParams, InvoicesResult, ListEntitiesParams, ListEntitiesResult, MeteredFeatureConfig, OverageDetails, OwostackConfig, PayInvoiceParams, PayInvoiceResult, PaymentChannel, PaymentMethodInfo, Plan, PlanCredits, PlanDefinition, PlanFeatureEntry, PlanInterval, PlansParams, PlansResult, PublicPlan, PublicPlanFeature, RemoveEntityParams, RemoveEntityResult, ResetInterval, ResponseDetails, Subscription, SubscriptionStatus, SyncChanges, SyncPayload, SyncResult, TrackCode, TrackParams, TrackResult, UsageRecord, WalletRemoveResult, WalletResult, WalletSetupParams, WalletSetupResult };
848
+ export type { AddEntityParams, AddEntityResult, AddonParams, AddonResult, AttachParams, AttachResult, BillingFeatureUsage, BillingUsageParams, BillingUsageResult, BooleanFeatureConfig, CardInfo, CatalogEntry, CheckCode, CheckParams, CheckResult, CreditPackDefinition, CreditSystemDefinition, CreditSystemFeatureEntry, Currency, Customer, CustomerData, CustomerParams, CustomerResult, Entitlement, Entity, Feature, FeatureLimit, Invoice, InvoiceLineItem, InvoiceParams, InvoiceResult, InvoicesParams, InvoicesResult, ListEntitiesParams, ListEntitiesResult, MeteredFeatureConfig, OverageDetails, OwostackConfig, PayInvoiceParams, PayInvoiceResult, PaymentChannel, PaymentMethodInfo, Plan, PlanCredits, PlanDefinition, PlanFeatureEntry, PlanInterval, PlansParams, PlansResult, PublicPlan, PublicPlanFeature, RemoveEntityParams, RemoveEntityResult, ResetInterval, ResponseDetails, Subscription, SubscriptionStatus, SyncChanges, SyncPayload, SyncResult, TrackCode, TrackParams, TrackResult, UsageRecord, WalletRemoveResult, WalletResult, WalletSetupParams, WalletSetupResult };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@owostack/types",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Shared TypeScript types for Owostack",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/Abdulmumin1/owostack.git",
8
+ "url": "https://github.com/Abdulmumin1/owostack",
9
9
  "directory": "packages/types"
10
10
  },
11
11
  "type": "module",