@moonbase.sh/api 0.4.71 → 0.4.73

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.cjs CHANGED
@@ -84,6 +84,7 @@ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
84
84
  SubscriptionStatus2["Active"] = "Active";
85
85
  SubscriptionStatus2["Expired"] = "Expired";
86
86
  SubscriptionStatus2["Cancelled"] = "Cancelled";
87
+ SubscriptionStatus2["Completed"] = "Completed";
87
88
  return SubscriptionStatus2;
88
89
  })(SubscriptionStatus || {});
89
90
  var CycleLength = /* @__PURE__ */ ((CycleLength2) => {
@@ -472,6 +473,246 @@ var ActivationRequestEndpoints = class {
472
473
  }
473
474
  };
474
475
 
476
+ // src/orders/schemas.ts
477
+ var schemas_exports6 = {};
478
+ __export(schemas_exports6, {
479
+ bundleLineItemFulfillmentSchema: () => bundleLineItemFulfillmentSchema,
480
+ bundleLineItemSchema: () => bundleLineItemSchema,
481
+ couponSnapshotSchema: () => couponSnapshotSchema,
482
+ customerSnapshotSchema: () => customerSnapshotSchema,
483
+ licenseLineItemFulfillmentSchema: () => licenseLineItemFulfillmentSchema,
484
+ lineItemFulfillmentSchema: () => lineItemFulfillmentSchema,
485
+ orderLineItemSchema: () => orderLineItemSchema,
486
+ orderSchema: () => orderSchema,
487
+ orderTotalSchema: () => orderTotalSchema,
488
+ productLineItemSchema: () => productLineItemSchema,
489
+ utmSchema: () => utmSchema
490
+ });
491
+ var import_zod7 = require("zod");
492
+
493
+ // src/orders/models.ts
494
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
495
+ OrderStatus2["Open"] = "Open";
496
+ OrderStatus2["PaymentProcessing"] = "PaymentProcessing";
497
+ OrderStatus2["Completed"] = "Completed";
498
+ OrderStatus2["Failed"] = "Failed";
499
+ return OrderStatus2;
500
+ })(OrderStatus || {});
501
+
502
+ // src/orders/schemas.ts
503
+ var couponSnapshotSchema = import_zod7.z.object({
504
+ id: import_zod7.z.string(),
505
+ code: import_zod7.z.string(),
506
+ name: import_zod7.z.string(),
507
+ description: import_zod7.z.string(),
508
+ combinable: import_zod7.z.boolean(),
509
+ discount: discountSchema,
510
+ applicableProductIds: import_zod7.z.string().array().describe("List of product IDs the coupon can be applied to, empty or missing means all products are applicable"),
511
+ applicableBundleIds: import_zod7.z.string().array().describe("List of bundle IDs the coupon can be applied to, empty or missing means all bundles are applicable"),
512
+ recurringPaymentUseCount: import_zod7.z.number().nullish()
513
+ });
514
+ var licenseLineItemFulfillmentSchema = import_zod7.z.object({
515
+ type: import_zod7.z.literal("License"),
516
+ licenseIds: import_zod7.z.string().array()
517
+ });
518
+ var bundleLineItemFulfillmentSchema = import_zod7.z.object({
519
+ type: import_zod7.z.literal("Bundle"),
520
+ productLicenses: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.object({
521
+ licenseIds: import_zod7.z.string().array()
522
+ }))
523
+ });
524
+ var subscriptionLineItemFulfillmentSchema = import_zod7.z.object({
525
+ type: import_zod7.z.literal("Subscription"),
526
+ subscriptionId: import_zod7.z.string(),
527
+ inner: import_zod7.z.discriminatedUnion("type", [
528
+ licenseLineItemFulfillmentSchema,
529
+ bundleLineItemFulfillmentSchema
530
+ ])
531
+ });
532
+ var noLineItemFulfillmentSchema = import_zod7.z.object({
533
+ type: import_zod7.z.literal("NoFulfillment")
534
+ });
535
+ var lineItemFulfillmentSchema = import_zod7.z.discriminatedUnion("type", [
536
+ licenseLineItemFulfillmentSchema,
537
+ bundleLineItemFulfillmentSchema,
538
+ subscriptionLineItemFulfillmentSchema,
539
+ noLineItemFulfillmentSchema
540
+ ]);
541
+ var lineItemTotalSchema = import_zod7.z.object({
542
+ original: moneySchema,
543
+ discount: moneySchema,
544
+ subtotal: moneySchema,
545
+ due: moneySchema
546
+ });
547
+ var lineItemPayoutSchema = import_zod7.z.object({
548
+ subtotal: moneySchema,
549
+ taxes: moneySchema,
550
+ platformFees: moneySchema,
551
+ due: moneySchema
552
+ });
553
+ var affiliatePayoutSchema = import_zod7.z.object({
554
+ payout: moneySchema,
555
+ affiliateId: import_zod7.z.string(),
556
+ contractId: import_zod7.z.string()
557
+ });
558
+ var productLineItemSchema = import_zod7.z.object({
559
+ type: import_zod7.z.literal("Product"),
560
+ productId: import_zod7.z.string(),
561
+ quantity: import_zod7.z.number(),
562
+ variationId: import_zod7.z.string(),
563
+ price: priceCollectionSchema.optional(),
564
+ total: lineItemTotalSchema.optional(),
565
+ payout: lineItemPayoutSchema.optional(),
566
+ affiliatePayouts: affiliatePayoutSchema.array().optional(),
567
+ variation: pricingVariationSchema.optional(),
568
+ appliedDiscount: pricingDiscountSchema.optional(),
569
+ fulfillment: lineItemFulfillmentSchema.optional()
570
+ });
571
+ var bundleLineItemSchema = import_zod7.z.object({
572
+ type: import_zod7.z.literal("Bundle"),
573
+ bundleId: import_zod7.z.string(),
574
+ quantity: import_zod7.z.number(),
575
+ variationId: import_zod7.z.string(),
576
+ price: priceCollectionSchema.optional(),
577
+ total: lineItemTotalSchema.optional(),
578
+ payout: lineItemPayoutSchema.optional(),
579
+ affiliatePayouts: affiliatePayoutSchema.array().optional(),
580
+ variation: pricingVariationSchema.optional(),
581
+ appliedDiscount: pricingDiscountSchema.optional(),
582
+ fulfillment: lineItemFulfillmentSchema.optional()
583
+ });
584
+ var orderLineItemSchema = import_zod7.z.discriminatedUnion("type", [
585
+ productLineItemSchema,
586
+ bundleLineItemSchema
587
+ ]);
588
+ var orderTotalSchema = import_zod7.z.object({
589
+ original: moneySchema,
590
+ discount: moneySchema,
591
+ subtotal: moneySchema,
592
+ taxes: moneySchema,
593
+ due: moneySchema
594
+ });
595
+ var orderPayoutSchema = import_zod7.z.object({
596
+ subtotal: moneySchema,
597
+ taxes: moneySchema,
598
+ platformFees: moneySchema,
599
+ due: moneySchema,
600
+ feeBreakdown: import_zod7.z.string().array()
601
+ });
602
+ var customerSnapshotSchema = import_zod7.z.object({
603
+ name: import_zod7.z.string().nullish(),
604
+ businessName: import_zod7.z.string().nullish(),
605
+ taxId: import_zod7.z.string().nullish(),
606
+ email: import_zod7.z.string().nullish(),
607
+ address: addressSchema.nullish()
608
+ });
609
+ var utmSchema = import_zod7.z.object({
610
+ referrer: import_zod7.z.string().optional(),
611
+ source: import_zod7.z.string().optional(),
612
+ medium: import_zod7.z.string().optional(),
613
+ campaign: import_zod7.z.string().optional(),
614
+ term: import_zod7.z.string().optional(),
615
+ content: import_zod7.z.string().optional()
616
+ });
617
+ var orderSchema = import_zod7.z.object({
618
+ id: import_zod7.z.string(),
619
+ status: import_zod7.z.nativeEnum(OrderStatus),
620
+ currency: import_zod7.z.string(),
621
+ completedAt: import_zod7.z.coerce.date().optional(),
622
+ isRefunded: import_zod7.z.boolean(),
623
+ refundedAt: import_zod7.z.coerce.date().optional(),
624
+ isDisputed: import_zod7.z.boolean(),
625
+ total: orderTotalSchema.optional(),
626
+ payout: orderPayoutSchema.optional(),
627
+ merchantPayout: moneySchema.optional(),
628
+ affiliatePayouts: affiliatePayoutSchema.array().optional(),
629
+ initialUTM: utmSchema.optional(),
630
+ currentUTM: utmSchema.optional(),
631
+ customer: customerSnapshotSchema.optional(),
632
+ couponsApplied: couponSnapshotSchema.array(),
633
+ items: orderLineItemSchema.array(),
634
+ lastUpdated: entityChangeSchema,
635
+ created: entityChangeSchema,
636
+ checkoutUrl: import_zod7.z.string().optional(),
637
+ embeddedCheckoutUrl: import_zod7.z.string().optional()
638
+ });
639
+
640
+ // src/subscriptions/schemas.ts
641
+ var schemas_exports7 = {};
642
+ __export(schemas_exports7, {
643
+ importSubscriptionRequestSchema: () => importSubscriptionRequestSchema,
644
+ subscriptionSchema: () => subscriptionSchema
645
+ });
646
+ var import_zod8 = require("zod");
647
+ var subscriptionContentSchema = import_zod8.z.discriminatedUnion("type", [
648
+ import_zod8.z.object({
649
+ type: import_zod8.z.literal("Product"),
650
+ productId: import_zod8.z.string(),
651
+ quantity: import_zod8.z.number(),
652
+ fulfillment: licenseLineItemFulfillmentSchema
653
+ }),
654
+ import_zod8.z.object({
655
+ type: import_zod8.z.literal("Bundle"),
656
+ bundleId: import_zod8.z.string(),
657
+ quantity: import_zod8.z.number(),
658
+ fulfillment: bundleLineItemFulfillmentSchema
659
+ })
660
+ ]);
661
+ var subscriptionSchema = import_zod8.z.object({
662
+ id: import_zod8.z.string(),
663
+ externalId: import_zod8.z.string().optional(),
664
+ ownerId: import_zod8.z.string(),
665
+ status: import_zod8.z.nativeEnum(SubscriptionStatus),
666
+ expiresAt: import_zod8.z.coerce.date(),
667
+ startedAt: import_zod8.z.coerce.date(),
668
+ licenseExpiry: import_zod8.z.coerce.date(),
669
+ renewedAt: import_zod8.z.coerce.date().nullable(),
670
+ nextPaymentScheduledAt: import_zod8.z.coerce.date().nullable(),
671
+ total: orderTotalSchema,
672
+ currency: import_zod8.z.string(),
673
+ cycleLength: import_zod8.z.nativeEnum(CycleLength),
674
+ currentCycle: import_zod8.z.number(),
675
+ content: subscriptionContentSchema,
676
+ pricingVariation: pricingVariationSchema,
677
+ lastUpdated: entityChangeSchema,
678
+ created: entityChangeSchema
679
+ });
680
+ var importSubscriptionLicenseSchema = import_zod8.z.object({
681
+ externalId: import_zod8.z.string().optional(),
682
+ maxNumberOfActivations: import_zod8.z.number().optional(),
683
+ offlineActivationsAllowed: import_zod8.z.boolean().optional(),
684
+ activations: import_zod8.z.object({
685
+ activationMethod: import_zod8.z.nativeEnum(ActivationMethod),
686
+ deviceName: import_zod8.z.string(),
687
+ deviceSignature: import_zod8.z.string(),
688
+ lastValidation: import_zod8.z.date().optional()
689
+ }).array().optional()
690
+ });
691
+ var importSubscriptionContentSchema = import_zod8.z.discriminatedUnion("type", [
692
+ import_zod8.z.object({
693
+ type: import_zod8.z.literal("Product"),
694
+ productId: import_zod8.z.string(),
695
+ variationId: import_zod8.z.string().optional(),
696
+ license: importSubscriptionLicenseSchema
697
+ }),
698
+ import_zod8.z.object({
699
+ type: import_zod8.z.literal("Bundle"),
700
+ bundleId: import_zod8.z.string(),
701
+ variationId: import_zod8.z.string().optional(),
702
+ licenses: import_zod8.z.record(import_zod8.z.string(), importSubscriptionLicenseSchema).optional()
703
+ })
704
+ ]);
705
+ var importSubscriptionRequestSchema = import_zod8.z.object({
706
+ ownerId: import_zod8.z.string(),
707
+ externalId: import_zod8.z.string().optional(),
708
+ status: import_zod8.z.nativeEnum(SubscriptionStatus),
709
+ startedAt: import_zod8.z.date(),
710
+ expiresAt: import_zod8.z.date(),
711
+ currentCycle: import_zod8.z.number().optional(),
712
+ currency: import_zod8.z.string().optional(),
713
+ content: importSubscriptionContentSchema
714
+ });
715
+
475
716
  // src/utils/api.ts
476
717
  var import_cross_fetch = __toESM(require("cross-fetch"), 1);
477
718
 
@@ -515,13 +756,13 @@ var ConflictError = class extends MoonbaseError {
515
756
  };
516
757
 
517
758
  // src/utils/problemHandler.ts
518
- var import_zod7 = require("zod");
519
- var problemDetailsSchema = import_zod7.z.object({
520
- type: import_zod7.z.string(),
521
- title: import_zod7.z.string(),
522
- detail: import_zod7.z.string().optional(),
523
- instance: import_zod7.z.string().optional(),
524
- status: import_zod7.z.number()
759
+ var import_zod9 = require("zod");
760
+ var problemDetailsSchema = import_zod9.z.object({
761
+ type: import_zod9.z.string(),
762
+ title: import_zod9.z.string(),
763
+ detail: import_zod9.z.string().optional(),
764
+ instance: import_zod9.z.string().optional(),
765
+ status: import_zod9.z.number()
525
766
  });
526
767
  async function handleResponseProblem(response) {
527
768
  let problemDetails;
@@ -602,6 +843,22 @@ var CustomerEndpoints = class {
602
843
  const response = await this.api.fetch(`/api/customers/import`, "POST", request);
603
844
  return customerSchema.parse(response.data);
604
845
  }
846
+ async getOrders(customerId, status) {
847
+ const response = await this.api.fetch(`/api/customers/${customerId}/orders?status=${status}`);
848
+ return paged(orderSchema, this.api).parse(response.data);
849
+ }
850
+ async getSubscriptions(customerId, status) {
851
+ const response = await this.api.fetch(`/api/customers/${customerId}/subscriptions?status=${status}`);
852
+ return paged(subscriptionSchema, this.api).parse(response.data);
853
+ }
854
+ async getLicenses(customerId) {
855
+ const response = await this.api.fetch(`/api/customers/${customerId}/licenses`);
856
+ return paged(licenseSchema, this.api).parse(response.data);
857
+ }
858
+ async getTrials(customerId) {
859
+ const response = await this.api.fetch(`/api/customers/${customerId}/trials`);
860
+ return paged(trialSchema, this.api).parse(response.data);
861
+ }
605
862
  };
606
863
 
607
864
  // src/licenses/endpoints.ts
@@ -653,170 +910,6 @@ var LicenseEndpoints = class {
653
910
  }
654
911
  };
655
912
 
656
- // src/orders/schemas.ts
657
- var schemas_exports6 = {};
658
- __export(schemas_exports6, {
659
- bundleLineItemFulfillmentSchema: () => bundleLineItemFulfillmentSchema,
660
- bundleLineItemSchema: () => bundleLineItemSchema,
661
- couponSnapshotSchema: () => couponSnapshotSchema,
662
- customerSnapshotSchema: () => customerSnapshotSchema,
663
- licenseLineItemFulfillmentSchema: () => licenseLineItemFulfillmentSchema,
664
- lineItemFulfillmentSchema: () => lineItemFulfillmentSchema,
665
- orderLineItemSchema: () => orderLineItemSchema,
666
- orderSchema: () => orderSchema,
667
- orderTotalSchema: () => orderTotalSchema,
668
- productLineItemSchema: () => productLineItemSchema,
669
- utmSchema: () => utmSchema
670
- });
671
- var import_zod8 = require("zod");
672
-
673
- // src/orders/models.ts
674
- var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
675
- OrderStatus2["Open"] = "Open";
676
- OrderStatus2["PaymentProcessing"] = "PaymentProcessing";
677
- OrderStatus2["Completed"] = "Completed";
678
- OrderStatus2["Failed"] = "Failed";
679
- return OrderStatus2;
680
- })(OrderStatus || {});
681
-
682
- // src/orders/schemas.ts
683
- var couponSnapshotSchema = import_zod8.z.object({
684
- id: import_zod8.z.string(),
685
- code: import_zod8.z.string(),
686
- name: import_zod8.z.string(),
687
- description: import_zod8.z.string(),
688
- combinable: import_zod8.z.boolean(),
689
- discount: discountSchema,
690
- applicableProductIds: import_zod8.z.string().array().describe("List of product IDs the coupon can be applied to, empty or missing means all products are applicable"),
691
- applicableBundleIds: import_zod8.z.string().array().describe("List of bundle IDs the coupon can be applied to, empty or missing means all bundles are applicable"),
692
- recurringPaymentUseCount: import_zod8.z.number().nullish()
693
- });
694
- var licenseLineItemFulfillmentSchema = import_zod8.z.object({
695
- type: import_zod8.z.literal("License"),
696
- licenseIds: import_zod8.z.string().array()
697
- });
698
- var bundleLineItemFulfillmentSchema = import_zod8.z.object({
699
- type: import_zod8.z.literal("Bundle"),
700
- productLicenses: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.object({
701
- licenseIds: import_zod8.z.string().array()
702
- }))
703
- });
704
- var subscriptionLineItemFulfillmentSchema = import_zod8.z.object({
705
- type: import_zod8.z.literal("Subscription"),
706
- subscriptionId: import_zod8.z.string(),
707
- inner: import_zod8.z.discriminatedUnion("type", [
708
- licenseLineItemFulfillmentSchema,
709
- bundleLineItemFulfillmentSchema
710
- ])
711
- });
712
- var noLineItemFulfillmentSchema = import_zod8.z.object({
713
- type: import_zod8.z.literal("NoFulfillment")
714
- });
715
- var lineItemFulfillmentSchema = import_zod8.z.discriminatedUnion("type", [
716
- licenseLineItemFulfillmentSchema,
717
- bundleLineItemFulfillmentSchema,
718
- subscriptionLineItemFulfillmentSchema,
719
- noLineItemFulfillmentSchema
720
- ]);
721
- var lineItemTotalSchema = import_zod8.z.object({
722
- original: moneySchema,
723
- discount: moneySchema,
724
- subtotal: moneySchema,
725
- due: moneySchema
726
- });
727
- var lineItemPayoutSchema = import_zod8.z.object({
728
- subtotal: moneySchema,
729
- taxes: moneySchema,
730
- platformFees: moneySchema,
731
- due: moneySchema
732
- });
733
- var affiliatePayoutSchema = import_zod8.z.object({
734
- payout: moneySchema,
735
- affiliateId: import_zod8.z.string(),
736
- contractId: import_zod8.z.string()
737
- });
738
- var productLineItemSchema = import_zod8.z.object({
739
- type: import_zod8.z.literal("Product"),
740
- productId: import_zod8.z.string(),
741
- quantity: import_zod8.z.number(),
742
- variationId: import_zod8.z.string(),
743
- price: priceCollectionSchema.optional(),
744
- total: lineItemTotalSchema.optional(),
745
- payout: lineItemPayoutSchema.optional(),
746
- affiliatePayouts: affiliatePayoutSchema.array().optional(),
747
- variation: pricingVariationSchema.optional(),
748
- appliedDiscount: pricingDiscountSchema.optional(),
749
- fulfillment: lineItemFulfillmentSchema.optional()
750
- });
751
- var bundleLineItemSchema = import_zod8.z.object({
752
- type: import_zod8.z.literal("Bundle"),
753
- bundleId: import_zod8.z.string(),
754
- quantity: import_zod8.z.number(),
755
- variationId: import_zod8.z.string(),
756
- price: priceCollectionSchema.optional(),
757
- total: lineItemTotalSchema.optional(),
758
- payout: lineItemPayoutSchema.optional(),
759
- affiliatePayouts: affiliatePayoutSchema.array().optional(),
760
- variation: pricingVariationSchema.optional(),
761
- appliedDiscount: pricingDiscountSchema.optional(),
762
- fulfillment: lineItemFulfillmentSchema.optional()
763
- });
764
- var orderLineItemSchema = import_zod8.z.discriminatedUnion("type", [
765
- productLineItemSchema,
766
- bundleLineItemSchema
767
- ]);
768
- var orderTotalSchema = import_zod8.z.object({
769
- original: moneySchema,
770
- discount: moneySchema,
771
- subtotal: moneySchema,
772
- taxes: moneySchema,
773
- due: moneySchema
774
- });
775
- var orderPayoutSchema = import_zod8.z.object({
776
- subtotal: moneySchema,
777
- taxes: moneySchema,
778
- platformFees: moneySchema,
779
- due: moneySchema,
780
- feeBreakdown: import_zod8.z.string().array()
781
- });
782
- var customerSnapshotSchema = import_zod8.z.object({
783
- name: import_zod8.z.string().nullish(),
784
- businessName: import_zod8.z.string().nullish(),
785
- taxId: import_zod8.z.string().nullish(),
786
- email: import_zod8.z.string().nullish(),
787
- address: addressSchema.nullish()
788
- });
789
- var utmSchema = import_zod8.z.object({
790
- referrer: import_zod8.z.string().optional(),
791
- source: import_zod8.z.string().optional(),
792
- medium: import_zod8.z.string().optional(),
793
- campaign: import_zod8.z.string().optional(),
794
- term: import_zod8.z.string().optional(),
795
- content: import_zod8.z.string().optional()
796
- });
797
- var orderSchema = import_zod8.z.object({
798
- id: import_zod8.z.string(),
799
- status: import_zod8.z.nativeEnum(OrderStatus),
800
- currency: import_zod8.z.string(),
801
- completedAt: import_zod8.z.coerce.date().optional(),
802
- isRefunded: import_zod8.z.boolean(),
803
- refundedAt: import_zod8.z.coerce.date().optional(),
804
- isDisputed: import_zod8.z.boolean(),
805
- total: orderTotalSchema.optional(),
806
- payout: orderPayoutSchema.optional(),
807
- merchantPayout: moneySchema.optional(),
808
- affiliatePayouts: affiliatePayoutSchema.array().optional(),
809
- initialUTM: utmSchema.optional(),
810
- currentUTM: utmSchema.optional(),
811
- customer: customerSnapshotSchema.optional(),
812
- couponsApplied: couponSnapshotSchema.array(),
813
- items: orderLineItemSchema.array(),
814
- lastUpdated: entityChangeSchema,
815
- created: entityChangeSchema,
816
- checkoutUrl: import_zod8.z.string().optional(),
817
- embeddedCheckoutUrl: import_zod8.z.string().optional()
818
- });
819
-
820
913
  // src/orders/endpoints.ts
821
914
  var OrderEndpoints = class {
822
915
  constructor(api) {
@@ -859,82 +952,6 @@ var ProductEndpoints = class {
859
952
  }
860
953
  };
861
954
 
862
- // src/subscriptions/schemas.ts
863
- var schemas_exports7 = {};
864
- __export(schemas_exports7, {
865
- importSubscriptionRequestSchema: () => importSubscriptionRequestSchema,
866
- subscriptionSchema: () => subscriptionSchema
867
- });
868
- var import_zod9 = require("zod");
869
- var subscriptionContentSchema = import_zod9.z.discriminatedUnion("type", [
870
- import_zod9.z.object({
871
- type: import_zod9.z.literal("Product"),
872
- productId: import_zod9.z.string(),
873
- quantity: import_zod9.z.number(),
874
- fulfillment: licenseLineItemFulfillmentSchema
875
- }),
876
- import_zod9.z.object({
877
- type: import_zod9.z.literal("Bundle"),
878
- bundleId: import_zod9.z.string(),
879
- quantity: import_zod9.z.number(),
880
- fulfillment: bundleLineItemFulfillmentSchema
881
- })
882
- ]);
883
- var subscriptionSchema = import_zod9.z.object({
884
- id: import_zod9.z.string(),
885
- externalId: import_zod9.z.string().optional(),
886
- ownerId: import_zod9.z.string(),
887
- status: import_zod9.z.nativeEnum(SubscriptionStatus),
888
- expiresAt: import_zod9.z.coerce.date(),
889
- startedAt: import_zod9.z.coerce.date(),
890
- licenseExpiry: import_zod9.z.coerce.date(),
891
- renewedAt: import_zod9.z.coerce.date().nullable(),
892
- nextPaymentScheduledAt: import_zod9.z.coerce.date().nullable(),
893
- total: orderTotalSchema,
894
- currency: import_zod9.z.string(),
895
- cycleLength: import_zod9.z.nativeEnum(CycleLength),
896
- currentCycle: import_zod9.z.number(),
897
- content: subscriptionContentSchema,
898
- pricingVariation: pricingVariationSchema,
899
- lastUpdated: entityChangeSchema,
900
- created: entityChangeSchema
901
- });
902
- var importSubscriptionLicenseSchema = import_zod9.z.object({
903
- externalId: import_zod9.z.string().optional(),
904
- maxNumberOfActivations: import_zod9.z.number().optional(),
905
- offlineActivationsAllowed: import_zod9.z.boolean().optional(),
906
- activations: import_zod9.z.object({
907
- activationMethod: import_zod9.z.nativeEnum(ActivationMethod),
908
- deviceName: import_zod9.z.string(),
909
- deviceSignature: import_zod9.z.string(),
910
- lastValidation: import_zod9.z.date().optional()
911
- }).array().optional()
912
- });
913
- var importSubscriptionContentSchema = import_zod9.z.discriminatedUnion("type", [
914
- import_zod9.z.object({
915
- type: import_zod9.z.literal("Product"),
916
- productId: import_zod9.z.string(),
917
- variationId: import_zod9.z.string().optional(),
918
- license: importSubscriptionLicenseSchema
919
- }),
920
- import_zod9.z.object({
921
- type: import_zod9.z.literal("Bundle"),
922
- bundleId: import_zod9.z.string(),
923
- variationId: import_zod9.z.string().optional(),
924
- licenses: import_zod9.z.record(import_zod9.z.string(), importSubscriptionLicenseSchema).optional()
925
- })
926
- ]);
927
- var importSubscriptionRequestSchema = import_zod9.z.object({
928
- ownerId: import_zod9.z.string(),
929
- externalId: import_zod9.z.string().optional(),
930
- status: import_zod9.z.nativeEnum(SubscriptionStatus),
931
- startedAt: import_zod9.z.date(),
932
- expiresAt: import_zod9.z.date(),
933
- currentCycle: import_zod9.z.number().optional(),
934
- currency: import_zod9.z.string().optional(),
935
- content: importSubscriptionContentSchema
936
- });
937
-
938
955
  // src/subscriptions/endpoints.ts
939
956
  var SubscriptionEndpoints = class {
940
957
  constructor(api) {