@moonbase.sh/api 0.4.71 → 0.4.72
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 +264 -247
- package/dist/index.d.cts +660 -655
- package/dist/index.d.ts +660 -655
- package/dist/index.js +264 -247
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
|
36
36
|
SubscriptionStatus2["Active"] = "Active";
|
|
37
37
|
SubscriptionStatus2["Expired"] = "Expired";
|
|
38
38
|
SubscriptionStatus2["Cancelled"] = "Cancelled";
|
|
39
|
+
SubscriptionStatus2["Completed"] = "Completed";
|
|
39
40
|
return SubscriptionStatus2;
|
|
40
41
|
})(SubscriptionStatus || {});
|
|
41
42
|
var CycleLength = /* @__PURE__ */ ((CycleLength2) => {
|
|
@@ -424,6 +425,246 @@ var ActivationRequestEndpoints = class {
|
|
|
424
425
|
}
|
|
425
426
|
};
|
|
426
427
|
|
|
428
|
+
// src/orders/schemas.ts
|
|
429
|
+
var schemas_exports6 = {};
|
|
430
|
+
__export(schemas_exports6, {
|
|
431
|
+
bundleLineItemFulfillmentSchema: () => bundleLineItemFulfillmentSchema,
|
|
432
|
+
bundleLineItemSchema: () => bundleLineItemSchema,
|
|
433
|
+
couponSnapshotSchema: () => couponSnapshotSchema,
|
|
434
|
+
customerSnapshotSchema: () => customerSnapshotSchema,
|
|
435
|
+
licenseLineItemFulfillmentSchema: () => licenseLineItemFulfillmentSchema,
|
|
436
|
+
lineItemFulfillmentSchema: () => lineItemFulfillmentSchema,
|
|
437
|
+
orderLineItemSchema: () => orderLineItemSchema,
|
|
438
|
+
orderSchema: () => orderSchema,
|
|
439
|
+
orderTotalSchema: () => orderTotalSchema,
|
|
440
|
+
productLineItemSchema: () => productLineItemSchema,
|
|
441
|
+
utmSchema: () => utmSchema
|
|
442
|
+
});
|
|
443
|
+
import { z as z7 } from "zod";
|
|
444
|
+
|
|
445
|
+
// src/orders/models.ts
|
|
446
|
+
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
447
|
+
OrderStatus2["Open"] = "Open";
|
|
448
|
+
OrderStatus2["PaymentProcessing"] = "PaymentProcessing";
|
|
449
|
+
OrderStatus2["Completed"] = "Completed";
|
|
450
|
+
OrderStatus2["Failed"] = "Failed";
|
|
451
|
+
return OrderStatus2;
|
|
452
|
+
})(OrderStatus || {});
|
|
453
|
+
|
|
454
|
+
// src/orders/schemas.ts
|
|
455
|
+
var couponSnapshotSchema = z7.object({
|
|
456
|
+
id: z7.string(),
|
|
457
|
+
code: z7.string(),
|
|
458
|
+
name: z7.string(),
|
|
459
|
+
description: z7.string(),
|
|
460
|
+
combinable: z7.boolean(),
|
|
461
|
+
discount: discountSchema,
|
|
462
|
+
applicableProductIds: z7.string().array().describe("List of product IDs the coupon can be applied to, empty or missing means all products are applicable"),
|
|
463
|
+
applicableBundleIds: z7.string().array().describe("List of bundle IDs the coupon can be applied to, empty or missing means all bundles are applicable"),
|
|
464
|
+
recurringPaymentUseCount: z7.number().nullish()
|
|
465
|
+
});
|
|
466
|
+
var licenseLineItemFulfillmentSchema = z7.object({
|
|
467
|
+
type: z7.literal("License"),
|
|
468
|
+
licenseIds: z7.string().array()
|
|
469
|
+
});
|
|
470
|
+
var bundleLineItemFulfillmentSchema = z7.object({
|
|
471
|
+
type: z7.literal("Bundle"),
|
|
472
|
+
productLicenses: z7.record(z7.string(), z7.object({
|
|
473
|
+
licenseIds: z7.string().array()
|
|
474
|
+
}))
|
|
475
|
+
});
|
|
476
|
+
var subscriptionLineItemFulfillmentSchema = z7.object({
|
|
477
|
+
type: z7.literal("Subscription"),
|
|
478
|
+
subscriptionId: z7.string(),
|
|
479
|
+
inner: z7.discriminatedUnion("type", [
|
|
480
|
+
licenseLineItemFulfillmentSchema,
|
|
481
|
+
bundleLineItemFulfillmentSchema
|
|
482
|
+
])
|
|
483
|
+
});
|
|
484
|
+
var noLineItemFulfillmentSchema = z7.object({
|
|
485
|
+
type: z7.literal("NoFulfillment")
|
|
486
|
+
});
|
|
487
|
+
var lineItemFulfillmentSchema = z7.discriminatedUnion("type", [
|
|
488
|
+
licenseLineItemFulfillmentSchema,
|
|
489
|
+
bundleLineItemFulfillmentSchema,
|
|
490
|
+
subscriptionLineItemFulfillmentSchema,
|
|
491
|
+
noLineItemFulfillmentSchema
|
|
492
|
+
]);
|
|
493
|
+
var lineItemTotalSchema = z7.object({
|
|
494
|
+
original: moneySchema,
|
|
495
|
+
discount: moneySchema,
|
|
496
|
+
subtotal: moneySchema,
|
|
497
|
+
due: moneySchema
|
|
498
|
+
});
|
|
499
|
+
var lineItemPayoutSchema = z7.object({
|
|
500
|
+
subtotal: moneySchema,
|
|
501
|
+
taxes: moneySchema,
|
|
502
|
+
platformFees: moneySchema,
|
|
503
|
+
due: moneySchema
|
|
504
|
+
});
|
|
505
|
+
var affiliatePayoutSchema = z7.object({
|
|
506
|
+
payout: moneySchema,
|
|
507
|
+
affiliateId: z7.string(),
|
|
508
|
+
contractId: z7.string()
|
|
509
|
+
});
|
|
510
|
+
var productLineItemSchema = z7.object({
|
|
511
|
+
type: z7.literal("Product"),
|
|
512
|
+
productId: z7.string(),
|
|
513
|
+
quantity: z7.number(),
|
|
514
|
+
variationId: z7.string(),
|
|
515
|
+
price: priceCollectionSchema.optional(),
|
|
516
|
+
total: lineItemTotalSchema.optional(),
|
|
517
|
+
payout: lineItemPayoutSchema.optional(),
|
|
518
|
+
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
519
|
+
variation: pricingVariationSchema.optional(),
|
|
520
|
+
appliedDiscount: pricingDiscountSchema.optional(),
|
|
521
|
+
fulfillment: lineItemFulfillmentSchema.optional()
|
|
522
|
+
});
|
|
523
|
+
var bundleLineItemSchema = z7.object({
|
|
524
|
+
type: z7.literal("Bundle"),
|
|
525
|
+
bundleId: z7.string(),
|
|
526
|
+
quantity: z7.number(),
|
|
527
|
+
variationId: z7.string(),
|
|
528
|
+
price: priceCollectionSchema.optional(),
|
|
529
|
+
total: lineItemTotalSchema.optional(),
|
|
530
|
+
payout: lineItemPayoutSchema.optional(),
|
|
531
|
+
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
532
|
+
variation: pricingVariationSchema.optional(),
|
|
533
|
+
appliedDiscount: pricingDiscountSchema.optional(),
|
|
534
|
+
fulfillment: lineItemFulfillmentSchema.optional()
|
|
535
|
+
});
|
|
536
|
+
var orderLineItemSchema = z7.discriminatedUnion("type", [
|
|
537
|
+
productLineItemSchema,
|
|
538
|
+
bundleLineItemSchema
|
|
539
|
+
]);
|
|
540
|
+
var orderTotalSchema = z7.object({
|
|
541
|
+
original: moneySchema,
|
|
542
|
+
discount: moneySchema,
|
|
543
|
+
subtotal: moneySchema,
|
|
544
|
+
taxes: moneySchema,
|
|
545
|
+
due: moneySchema
|
|
546
|
+
});
|
|
547
|
+
var orderPayoutSchema = z7.object({
|
|
548
|
+
subtotal: moneySchema,
|
|
549
|
+
taxes: moneySchema,
|
|
550
|
+
platformFees: moneySchema,
|
|
551
|
+
due: moneySchema,
|
|
552
|
+
feeBreakdown: z7.string().array()
|
|
553
|
+
});
|
|
554
|
+
var customerSnapshotSchema = z7.object({
|
|
555
|
+
name: z7.string().nullish(),
|
|
556
|
+
businessName: z7.string().nullish(),
|
|
557
|
+
taxId: z7.string().nullish(),
|
|
558
|
+
email: z7.string().nullish(),
|
|
559
|
+
address: addressSchema.nullish()
|
|
560
|
+
});
|
|
561
|
+
var utmSchema = z7.object({
|
|
562
|
+
referrer: z7.string().optional(),
|
|
563
|
+
source: z7.string().optional(),
|
|
564
|
+
medium: z7.string().optional(),
|
|
565
|
+
campaign: z7.string().optional(),
|
|
566
|
+
term: z7.string().optional(),
|
|
567
|
+
content: z7.string().optional()
|
|
568
|
+
});
|
|
569
|
+
var orderSchema = z7.object({
|
|
570
|
+
id: z7.string(),
|
|
571
|
+
status: z7.nativeEnum(OrderStatus),
|
|
572
|
+
currency: z7.string(),
|
|
573
|
+
completedAt: z7.coerce.date().optional(),
|
|
574
|
+
isRefunded: z7.boolean(),
|
|
575
|
+
refundedAt: z7.coerce.date().optional(),
|
|
576
|
+
isDisputed: z7.boolean(),
|
|
577
|
+
total: orderTotalSchema.optional(),
|
|
578
|
+
payout: orderPayoutSchema.optional(),
|
|
579
|
+
merchantPayout: moneySchema.optional(),
|
|
580
|
+
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
581
|
+
initialUTM: utmSchema.optional(),
|
|
582
|
+
currentUTM: utmSchema.optional(),
|
|
583
|
+
customer: customerSnapshotSchema.optional(),
|
|
584
|
+
couponsApplied: couponSnapshotSchema.array(),
|
|
585
|
+
items: orderLineItemSchema.array(),
|
|
586
|
+
lastUpdated: entityChangeSchema,
|
|
587
|
+
created: entityChangeSchema,
|
|
588
|
+
checkoutUrl: z7.string().optional(),
|
|
589
|
+
embeddedCheckoutUrl: z7.string().optional()
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
// src/subscriptions/schemas.ts
|
|
593
|
+
var schemas_exports7 = {};
|
|
594
|
+
__export(schemas_exports7, {
|
|
595
|
+
importSubscriptionRequestSchema: () => importSubscriptionRequestSchema,
|
|
596
|
+
subscriptionSchema: () => subscriptionSchema
|
|
597
|
+
});
|
|
598
|
+
import { z as z8 } from "zod";
|
|
599
|
+
var subscriptionContentSchema = z8.discriminatedUnion("type", [
|
|
600
|
+
z8.object({
|
|
601
|
+
type: z8.literal("Product"),
|
|
602
|
+
productId: z8.string(),
|
|
603
|
+
quantity: z8.number(),
|
|
604
|
+
fulfillment: licenseLineItemFulfillmentSchema
|
|
605
|
+
}),
|
|
606
|
+
z8.object({
|
|
607
|
+
type: z8.literal("Bundle"),
|
|
608
|
+
bundleId: z8.string(),
|
|
609
|
+
quantity: z8.number(),
|
|
610
|
+
fulfillment: bundleLineItemFulfillmentSchema
|
|
611
|
+
})
|
|
612
|
+
]);
|
|
613
|
+
var subscriptionSchema = z8.object({
|
|
614
|
+
id: z8.string(),
|
|
615
|
+
externalId: z8.string().optional(),
|
|
616
|
+
ownerId: z8.string(),
|
|
617
|
+
status: z8.nativeEnum(SubscriptionStatus),
|
|
618
|
+
expiresAt: z8.coerce.date(),
|
|
619
|
+
startedAt: z8.coerce.date(),
|
|
620
|
+
licenseExpiry: z8.coerce.date(),
|
|
621
|
+
renewedAt: z8.coerce.date().nullable(),
|
|
622
|
+
nextPaymentScheduledAt: z8.coerce.date().nullable(),
|
|
623
|
+
total: orderTotalSchema,
|
|
624
|
+
currency: z8.string(),
|
|
625
|
+
cycleLength: z8.nativeEnum(CycleLength),
|
|
626
|
+
currentCycle: z8.number(),
|
|
627
|
+
content: subscriptionContentSchema,
|
|
628
|
+
pricingVariation: pricingVariationSchema,
|
|
629
|
+
lastUpdated: entityChangeSchema,
|
|
630
|
+
created: entityChangeSchema
|
|
631
|
+
});
|
|
632
|
+
var importSubscriptionLicenseSchema = z8.object({
|
|
633
|
+
externalId: z8.string().optional(),
|
|
634
|
+
maxNumberOfActivations: z8.number().optional(),
|
|
635
|
+
offlineActivationsAllowed: z8.boolean().optional(),
|
|
636
|
+
activations: z8.object({
|
|
637
|
+
activationMethod: z8.nativeEnum(ActivationMethod),
|
|
638
|
+
deviceName: z8.string(),
|
|
639
|
+
deviceSignature: z8.string(),
|
|
640
|
+
lastValidation: z8.date().optional()
|
|
641
|
+
}).array().optional()
|
|
642
|
+
});
|
|
643
|
+
var importSubscriptionContentSchema = z8.discriminatedUnion("type", [
|
|
644
|
+
z8.object({
|
|
645
|
+
type: z8.literal("Product"),
|
|
646
|
+
productId: z8.string(),
|
|
647
|
+
variationId: z8.string().optional(),
|
|
648
|
+
license: importSubscriptionLicenseSchema
|
|
649
|
+
}),
|
|
650
|
+
z8.object({
|
|
651
|
+
type: z8.literal("Bundle"),
|
|
652
|
+
bundleId: z8.string(),
|
|
653
|
+
variationId: z8.string().optional(),
|
|
654
|
+
licenses: z8.record(z8.string(), importSubscriptionLicenseSchema).optional()
|
|
655
|
+
})
|
|
656
|
+
]);
|
|
657
|
+
var importSubscriptionRequestSchema = z8.object({
|
|
658
|
+
ownerId: z8.string(),
|
|
659
|
+
externalId: z8.string().optional(),
|
|
660
|
+
status: z8.nativeEnum(SubscriptionStatus),
|
|
661
|
+
startedAt: z8.date(),
|
|
662
|
+
expiresAt: z8.date(),
|
|
663
|
+
currentCycle: z8.number().optional(),
|
|
664
|
+
currency: z8.string().optional(),
|
|
665
|
+
content: importSubscriptionContentSchema
|
|
666
|
+
});
|
|
667
|
+
|
|
427
668
|
// src/utils/api.ts
|
|
428
669
|
import fetch from "cross-fetch";
|
|
429
670
|
|
|
@@ -467,13 +708,13 @@ var ConflictError = class extends MoonbaseError {
|
|
|
467
708
|
};
|
|
468
709
|
|
|
469
710
|
// src/utils/problemHandler.ts
|
|
470
|
-
import { z as
|
|
471
|
-
var problemDetailsSchema =
|
|
472
|
-
type:
|
|
473
|
-
title:
|
|
474
|
-
detail:
|
|
475
|
-
instance:
|
|
476
|
-
status:
|
|
711
|
+
import { z as z9 } from "zod";
|
|
712
|
+
var problemDetailsSchema = z9.object({
|
|
713
|
+
type: z9.string(),
|
|
714
|
+
title: z9.string(),
|
|
715
|
+
detail: z9.string().optional(),
|
|
716
|
+
instance: z9.string().optional(),
|
|
717
|
+
status: z9.number()
|
|
477
718
|
});
|
|
478
719
|
async function handleResponseProblem(response) {
|
|
479
720
|
let problemDetails;
|
|
@@ -554,6 +795,22 @@ var CustomerEndpoints = class {
|
|
|
554
795
|
const response = await this.api.fetch(`/api/customers/import`, "POST", request);
|
|
555
796
|
return customerSchema.parse(response.data);
|
|
556
797
|
}
|
|
798
|
+
async getOrders(customerId, status) {
|
|
799
|
+
const response = await this.api.fetch(`/api/customers/${customerId}/orders?status=${status}`);
|
|
800
|
+
return paged(orderSchema, this.api).parse(response.data);
|
|
801
|
+
}
|
|
802
|
+
async getSubscriptions(customerId, status) {
|
|
803
|
+
const response = await this.api.fetch(`/api/customers/${customerId}/subscriptions?status=${status}`);
|
|
804
|
+
return paged(subscriptionSchema, this.api).parse(response.data);
|
|
805
|
+
}
|
|
806
|
+
async getLicenses(customerId) {
|
|
807
|
+
const response = await this.api.fetch(`/api/customers/${customerId}/licenses`);
|
|
808
|
+
return paged(licenseSchema, this.api).parse(response.data);
|
|
809
|
+
}
|
|
810
|
+
async getTrials(customerId) {
|
|
811
|
+
const response = await this.api.fetch(`/api/customers/${customerId}/trials`);
|
|
812
|
+
return paged(trialSchema, this.api).parse(response.data);
|
|
813
|
+
}
|
|
557
814
|
};
|
|
558
815
|
|
|
559
816
|
// src/licenses/endpoints.ts
|
|
@@ -605,170 +862,6 @@ var LicenseEndpoints = class {
|
|
|
605
862
|
}
|
|
606
863
|
};
|
|
607
864
|
|
|
608
|
-
// src/orders/schemas.ts
|
|
609
|
-
var schemas_exports6 = {};
|
|
610
|
-
__export(schemas_exports6, {
|
|
611
|
-
bundleLineItemFulfillmentSchema: () => bundleLineItemFulfillmentSchema,
|
|
612
|
-
bundleLineItemSchema: () => bundleLineItemSchema,
|
|
613
|
-
couponSnapshotSchema: () => couponSnapshotSchema,
|
|
614
|
-
customerSnapshotSchema: () => customerSnapshotSchema,
|
|
615
|
-
licenseLineItemFulfillmentSchema: () => licenseLineItemFulfillmentSchema,
|
|
616
|
-
lineItemFulfillmentSchema: () => lineItemFulfillmentSchema,
|
|
617
|
-
orderLineItemSchema: () => orderLineItemSchema,
|
|
618
|
-
orderSchema: () => orderSchema,
|
|
619
|
-
orderTotalSchema: () => orderTotalSchema,
|
|
620
|
-
productLineItemSchema: () => productLineItemSchema,
|
|
621
|
-
utmSchema: () => utmSchema
|
|
622
|
-
});
|
|
623
|
-
import { z as z8 } from "zod";
|
|
624
|
-
|
|
625
|
-
// src/orders/models.ts
|
|
626
|
-
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
627
|
-
OrderStatus2["Open"] = "Open";
|
|
628
|
-
OrderStatus2["PaymentProcessing"] = "PaymentProcessing";
|
|
629
|
-
OrderStatus2["Completed"] = "Completed";
|
|
630
|
-
OrderStatus2["Failed"] = "Failed";
|
|
631
|
-
return OrderStatus2;
|
|
632
|
-
})(OrderStatus || {});
|
|
633
|
-
|
|
634
|
-
// src/orders/schemas.ts
|
|
635
|
-
var couponSnapshotSchema = z8.object({
|
|
636
|
-
id: z8.string(),
|
|
637
|
-
code: z8.string(),
|
|
638
|
-
name: z8.string(),
|
|
639
|
-
description: z8.string(),
|
|
640
|
-
combinable: z8.boolean(),
|
|
641
|
-
discount: discountSchema,
|
|
642
|
-
applicableProductIds: z8.string().array().describe("List of product IDs the coupon can be applied to, empty or missing means all products are applicable"),
|
|
643
|
-
applicableBundleIds: z8.string().array().describe("List of bundle IDs the coupon can be applied to, empty or missing means all bundles are applicable"),
|
|
644
|
-
recurringPaymentUseCount: z8.number().nullish()
|
|
645
|
-
});
|
|
646
|
-
var licenseLineItemFulfillmentSchema = z8.object({
|
|
647
|
-
type: z8.literal("License"),
|
|
648
|
-
licenseIds: z8.string().array()
|
|
649
|
-
});
|
|
650
|
-
var bundleLineItemFulfillmentSchema = z8.object({
|
|
651
|
-
type: z8.literal("Bundle"),
|
|
652
|
-
productLicenses: z8.record(z8.string(), z8.object({
|
|
653
|
-
licenseIds: z8.string().array()
|
|
654
|
-
}))
|
|
655
|
-
});
|
|
656
|
-
var subscriptionLineItemFulfillmentSchema = z8.object({
|
|
657
|
-
type: z8.literal("Subscription"),
|
|
658
|
-
subscriptionId: z8.string(),
|
|
659
|
-
inner: z8.discriminatedUnion("type", [
|
|
660
|
-
licenseLineItemFulfillmentSchema,
|
|
661
|
-
bundleLineItemFulfillmentSchema
|
|
662
|
-
])
|
|
663
|
-
});
|
|
664
|
-
var noLineItemFulfillmentSchema = z8.object({
|
|
665
|
-
type: z8.literal("NoFulfillment")
|
|
666
|
-
});
|
|
667
|
-
var lineItemFulfillmentSchema = z8.discriminatedUnion("type", [
|
|
668
|
-
licenseLineItemFulfillmentSchema,
|
|
669
|
-
bundleLineItemFulfillmentSchema,
|
|
670
|
-
subscriptionLineItemFulfillmentSchema,
|
|
671
|
-
noLineItemFulfillmentSchema
|
|
672
|
-
]);
|
|
673
|
-
var lineItemTotalSchema = z8.object({
|
|
674
|
-
original: moneySchema,
|
|
675
|
-
discount: moneySchema,
|
|
676
|
-
subtotal: moneySchema,
|
|
677
|
-
due: moneySchema
|
|
678
|
-
});
|
|
679
|
-
var lineItemPayoutSchema = z8.object({
|
|
680
|
-
subtotal: moneySchema,
|
|
681
|
-
taxes: moneySchema,
|
|
682
|
-
platformFees: moneySchema,
|
|
683
|
-
due: moneySchema
|
|
684
|
-
});
|
|
685
|
-
var affiliatePayoutSchema = z8.object({
|
|
686
|
-
payout: moneySchema,
|
|
687
|
-
affiliateId: z8.string(),
|
|
688
|
-
contractId: z8.string()
|
|
689
|
-
});
|
|
690
|
-
var productLineItemSchema = z8.object({
|
|
691
|
-
type: z8.literal("Product"),
|
|
692
|
-
productId: z8.string(),
|
|
693
|
-
quantity: z8.number(),
|
|
694
|
-
variationId: z8.string(),
|
|
695
|
-
price: priceCollectionSchema.optional(),
|
|
696
|
-
total: lineItemTotalSchema.optional(),
|
|
697
|
-
payout: lineItemPayoutSchema.optional(),
|
|
698
|
-
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
699
|
-
variation: pricingVariationSchema.optional(),
|
|
700
|
-
appliedDiscount: pricingDiscountSchema.optional(),
|
|
701
|
-
fulfillment: lineItemFulfillmentSchema.optional()
|
|
702
|
-
});
|
|
703
|
-
var bundleLineItemSchema = z8.object({
|
|
704
|
-
type: z8.literal("Bundle"),
|
|
705
|
-
bundleId: z8.string(),
|
|
706
|
-
quantity: z8.number(),
|
|
707
|
-
variationId: z8.string(),
|
|
708
|
-
price: priceCollectionSchema.optional(),
|
|
709
|
-
total: lineItemTotalSchema.optional(),
|
|
710
|
-
payout: lineItemPayoutSchema.optional(),
|
|
711
|
-
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
712
|
-
variation: pricingVariationSchema.optional(),
|
|
713
|
-
appliedDiscount: pricingDiscountSchema.optional(),
|
|
714
|
-
fulfillment: lineItemFulfillmentSchema.optional()
|
|
715
|
-
});
|
|
716
|
-
var orderLineItemSchema = z8.discriminatedUnion("type", [
|
|
717
|
-
productLineItemSchema,
|
|
718
|
-
bundleLineItemSchema
|
|
719
|
-
]);
|
|
720
|
-
var orderTotalSchema = z8.object({
|
|
721
|
-
original: moneySchema,
|
|
722
|
-
discount: moneySchema,
|
|
723
|
-
subtotal: moneySchema,
|
|
724
|
-
taxes: moneySchema,
|
|
725
|
-
due: moneySchema
|
|
726
|
-
});
|
|
727
|
-
var orderPayoutSchema = z8.object({
|
|
728
|
-
subtotal: moneySchema,
|
|
729
|
-
taxes: moneySchema,
|
|
730
|
-
platformFees: moneySchema,
|
|
731
|
-
due: moneySchema,
|
|
732
|
-
feeBreakdown: z8.string().array()
|
|
733
|
-
});
|
|
734
|
-
var customerSnapshotSchema = z8.object({
|
|
735
|
-
name: z8.string().nullish(),
|
|
736
|
-
businessName: z8.string().nullish(),
|
|
737
|
-
taxId: z8.string().nullish(),
|
|
738
|
-
email: z8.string().nullish(),
|
|
739
|
-
address: addressSchema.nullish()
|
|
740
|
-
});
|
|
741
|
-
var utmSchema = z8.object({
|
|
742
|
-
referrer: z8.string().optional(),
|
|
743
|
-
source: z8.string().optional(),
|
|
744
|
-
medium: z8.string().optional(),
|
|
745
|
-
campaign: z8.string().optional(),
|
|
746
|
-
term: z8.string().optional(),
|
|
747
|
-
content: z8.string().optional()
|
|
748
|
-
});
|
|
749
|
-
var orderSchema = z8.object({
|
|
750
|
-
id: z8.string(),
|
|
751
|
-
status: z8.nativeEnum(OrderStatus),
|
|
752
|
-
currency: z8.string(),
|
|
753
|
-
completedAt: z8.coerce.date().optional(),
|
|
754
|
-
isRefunded: z8.boolean(),
|
|
755
|
-
refundedAt: z8.coerce.date().optional(),
|
|
756
|
-
isDisputed: z8.boolean(),
|
|
757
|
-
total: orderTotalSchema.optional(),
|
|
758
|
-
payout: orderPayoutSchema.optional(),
|
|
759
|
-
merchantPayout: moneySchema.optional(),
|
|
760
|
-
affiliatePayouts: affiliatePayoutSchema.array().optional(),
|
|
761
|
-
initialUTM: utmSchema.optional(),
|
|
762
|
-
currentUTM: utmSchema.optional(),
|
|
763
|
-
customer: customerSnapshotSchema.optional(),
|
|
764
|
-
couponsApplied: couponSnapshotSchema.array(),
|
|
765
|
-
items: orderLineItemSchema.array(),
|
|
766
|
-
lastUpdated: entityChangeSchema,
|
|
767
|
-
created: entityChangeSchema,
|
|
768
|
-
checkoutUrl: z8.string().optional(),
|
|
769
|
-
embeddedCheckoutUrl: z8.string().optional()
|
|
770
|
-
});
|
|
771
|
-
|
|
772
865
|
// src/orders/endpoints.ts
|
|
773
866
|
var OrderEndpoints = class {
|
|
774
867
|
constructor(api) {
|
|
@@ -811,82 +904,6 @@ var ProductEndpoints = class {
|
|
|
811
904
|
}
|
|
812
905
|
};
|
|
813
906
|
|
|
814
|
-
// src/subscriptions/schemas.ts
|
|
815
|
-
var schemas_exports7 = {};
|
|
816
|
-
__export(schemas_exports7, {
|
|
817
|
-
importSubscriptionRequestSchema: () => importSubscriptionRequestSchema,
|
|
818
|
-
subscriptionSchema: () => subscriptionSchema
|
|
819
|
-
});
|
|
820
|
-
import { z as z9 } from "zod";
|
|
821
|
-
var subscriptionContentSchema = z9.discriminatedUnion("type", [
|
|
822
|
-
z9.object({
|
|
823
|
-
type: z9.literal("Product"),
|
|
824
|
-
productId: z9.string(),
|
|
825
|
-
quantity: z9.number(),
|
|
826
|
-
fulfillment: licenseLineItemFulfillmentSchema
|
|
827
|
-
}),
|
|
828
|
-
z9.object({
|
|
829
|
-
type: z9.literal("Bundle"),
|
|
830
|
-
bundleId: z9.string(),
|
|
831
|
-
quantity: z9.number(),
|
|
832
|
-
fulfillment: bundleLineItemFulfillmentSchema
|
|
833
|
-
})
|
|
834
|
-
]);
|
|
835
|
-
var subscriptionSchema = z9.object({
|
|
836
|
-
id: z9.string(),
|
|
837
|
-
externalId: z9.string().optional(),
|
|
838
|
-
ownerId: z9.string(),
|
|
839
|
-
status: z9.nativeEnum(SubscriptionStatus),
|
|
840
|
-
expiresAt: z9.coerce.date(),
|
|
841
|
-
startedAt: z9.coerce.date(),
|
|
842
|
-
licenseExpiry: z9.coerce.date(),
|
|
843
|
-
renewedAt: z9.coerce.date().nullable(),
|
|
844
|
-
nextPaymentScheduledAt: z9.coerce.date().nullable(),
|
|
845
|
-
total: orderTotalSchema,
|
|
846
|
-
currency: z9.string(),
|
|
847
|
-
cycleLength: z9.nativeEnum(CycleLength),
|
|
848
|
-
currentCycle: z9.number(),
|
|
849
|
-
content: subscriptionContentSchema,
|
|
850
|
-
pricingVariation: pricingVariationSchema,
|
|
851
|
-
lastUpdated: entityChangeSchema,
|
|
852
|
-
created: entityChangeSchema
|
|
853
|
-
});
|
|
854
|
-
var importSubscriptionLicenseSchema = z9.object({
|
|
855
|
-
externalId: z9.string().optional(),
|
|
856
|
-
maxNumberOfActivations: z9.number().optional(),
|
|
857
|
-
offlineActivationsAllowed: z9.boolean().optional(),
|
|
858
|
-
activations: z9.object({
|
|
859
|
-
activationMethod: z9.nativeEnum(ActivationMethod),
|
|
860
|
-
deviceName: z9.string(),
|
|
861
|
-
deviceSignature: z9.string(),
|
|
862
|
-
lastValidation: z9.date().optional()
|
|
863
|
-
}).array().optional()
|
|
864
|
-
});
|
|
865
|
-
var importSubscriptionContentSchema = z9.discriminatedUnion("type", [
|
|
866
|
-
z9.object({
|
|
867
|
-
type: z9.literal("Product"),
|
|
868
|
-
productId: z9.string(),
|
|
869
|
-
variationId: z9.string().optional(),
|
|
870
|
-
license: importSubscriptionLicenseSchema
|
|
871
|
-
}),
|
|
872
|
-
z9.object({
|
|
873
|
-
type: z9.literal("Bundle"),
|
|
874
|
-
bundleId: z9.string(),
|
|
875
|
-
variationId: z9.string().optional(),
|
|
876
|
-
licenses: z9.record(z9.string(), importSubscriptionLicenseSchema).optional()
|
|
877
|
-
})
|
|
878
|
-
]);
|
|
879
|
-
var importSubscriptionRequestSchema = z9.object({
|
|
880
|
-
ownerId: z9.string(),
|
|
881
|
-
externalId: z9.string().optional(),
|
|
882
|
-
status: z9.nativeEnum(SubscriptionStatus),
|
|
883
|
-
startedAt: z9.date(),
|
|
884
|
-
expiresAt: z9.date(),
|
|
885
|
-
currentCycle: z9.number().optional(),
|
|
886
|
-
currency: z9.string().optional(),
|
|
887
|
-
content: importSubscriptionContentSchema
|
|
888
|
-
});
|
|
889
|
-
|
|
890
907
|
// src/subscriptions/endpoints.ts
|
|
891
908
|
var SubscriptionEndpoints = class {
|
|
892
909
|
constructor(api) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.72",
|
|
5
5
|
"description": "Package to let you integrate backends with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|