@moonbase.sh/storefront-api 0.2.144 → 0.3.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.cjs +37 -15
- package/dist/index.d.cts +2666 -331
- package/dist/index.d.ts +2666 -331
- package/dist/index.js +36 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,31 @@ import { z as z3 } from "zod";
|
|
|
15
15
|
|
|
16
16
|
// src/globalSchemas.ts
|
|
17
17
|
import { z } from "zod";
|
|
18
|
+
|
|
19
|
+
// src/globalModels.ts
|
|
20
|
+
var CycleLength = /* @__PURE__ */ ((CycleLength2) => {
|
|
21
|
+
CycleLength2["Daily"] = "Daily";
|
|
22
|
+
CycleLength2["Weekly"] = "Weekly";
|
|
23
|
+
CycleLength2["Monthly"] = "Monthly";
|
|
24
|
+
CycleLength2["Quarterly"] = "Quarterly";
|
|
25
|
+
CycleLength2["Yearly"] = "Yearly";
|
|
26
|
+
return CycleLength2;
|
|
27
|
+
})(CycleLength || {});
|
|
28
|
+
function utmToObject(utm) {
|
|
29
|
+
return Object.entries({
|
|
30
|
+
utm_source: utm == null ? void 0 : utm.source,
|
|
31
|
+
utm_medium: utm == null ? void 0 : utm.medium,
|
|
32
|
+
utm_campaign: utm == null ? void 0 : utm.campaign,
|
|
33
|
+
utm_term: utm == null ? void 0 : utm.term,
|
|
34
|
+
utm_content: utm == null ? void 0 : utm.content,
|
|
35
|
+
utm_referrer: utm == null ? void 0 : utm.referrer
|
|
36
|
+
}).filter(([_, value]) => value !== void 0).reduce((obj, [key, value]) => ({
|
|
37
|
+
...obj,
|
|
38
|
+
[key]: value
|
|
39
|
+
}), {});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/globalSchemas.ts
|
|
18
43
|
var priceCollectionSchema = z.record(z.number());
|
|
19
44
|
var percentageOffDiscountSchema = z.object({
|
|
20
45
|
type: z.literal("PercentageOffDiscount"),
|
|
@@ -35,6 +60,10 @@ var discountSchema = z.discriminatedUnion("type", [
|
|
|
35
60
|
percentageOffDiscountSchema,
|
|
36
61
|
flatAmountOffDiscountSchema
|
|
37
62
|
]);
|
|
63
|
+
var recurrenceSchema = z.discriminatedUnion("type", [
|
|
64
|
+
z.object({ type: z.literal("OneOff") }),
|
|
65
|
+
z.object({ type: z.literal("Recurring"), cycleLength: z.nativeEnum(CycleLength) })
|
|
66
|
+
]);
|
|
38
67
|
var pricingTierSchema = z.object({
|
|
39
68
|
minQuantity: z.number(),
|
|
40
69
|
originalPrice: priceCollectionSchema,
|
|
@@ -47,6 +76,7 @@ var pricingVariationSchema = z.object({
|
|
|
47
76
|
price: priceCollectionSchema,
|
|
48
77
|
hasDiscount: z.boolean(),
|
|
49
78
|
discount: discountSchema.optional(),
|
|
79
|
+
recurrence: recurrenceSchema,
|
|
50
80
|
pricingTiers: z.array(pricingTierSchema).nullish()
|
|
51
81
|
});
|
|
52
82
|
function paged(itemSchema) {
|
|
@@ -466,6 +496,7 @@ var activationSchema = z8.object({
|
|
|
466
496
|
name: z8.string(),
|
|
467
497
|
status: z8.nativeEnum(ActivationStatus),
|
|
468
498
|
activationMethod: z8.nativeEnum(ActivationMethod),
|
|
499
|
+
firstValidatedAt: z8.coerce.date(),
|
|
469
500
|
lastValidatedAt: z8.coerce.date().nullable()
|
|
470
501
|
});
|
|
471
502
|
|
|
@@ -592,6 +623,8 @@ var openProductLineItem = z11.object({
|
|
|
592
623
|
productId: z11.string(),
|
|
593
624
|
quantity: z11.number(),
|
|
594
625
|
variationId: z11.string(),
|
|
626
|
+
isDefaultVariation: z11.boolean().nullish(),
|
|
627
|
+
isSubcriptionPayment: z11.boolean().nullish(),
|
|
595
628
|
price: priceCollectionSchema.optional(),
|
|
596
629
|
variation: pricingVariationSchema.optional(),
|
|
597
630
|
product: lineItemProductSchema.optional(),
|
|
@@ -613,6 +646,8 @@ var openBundleLineItem = z11.object({
|
|
|
613
646
|
quantity: z11.number(),
|
|
614
647
|
variationId: z11.string(),
|
|
615
648
|
partial: z11.boolean().optional(),
|
|
649
|
+
isDefaultVariation: z11.boolean().nullish(),
|
|
650
|
+
isSubcriptionPayment: z11.boolean().nullish(),
|
|
616
651
|
price: priceCollectionSchema.optional(),
|
|
617
652
|
variation: pricingVariationSchema.optional(),
|
|
618
653
|
bundle: lineItemBundleSchema.optional(),
|
|
@@ -711,21 +746,6 @@ var OrderEndpoints = class {
|
|
|
711
746
|
}
|
|
712
747
|
};
|
|
713
748
|
|
|
714
|
-
// src/globalModels.ts
|
|
715
|
-
function utmToObject(utm) {
|
|
716
|
-
return Object.entries({
|
|
717
|
-
utm_source: utm == null ? void 0 : utm.source,
|
|
718
|
-
utm_medium: utm == null ? void 0 : utm.medium,
|
|
719
|
-
utm_campaign: utm == null ? void 0 : utm.campaign,
|
|
720
|
-
utm_term: utm == null ? void 0 : utm.term,
|
|
721
|
-
utm_content: utm == null ? void 0 : utm.content,
|
|
722
|
-
utm_referrer: utm == null ? void 0 : utm.referrer
|
|
723
|
-
}).filter(([_, value]) => value !== void 0).reduce((obj, [key, value]) => ({
|
|
724
|
-
...obj,
|
|
725
|
-
[key]: value
|
|
726
|
-
}), {});
|
|
727
|
-
}
|
|
728
|
-
|
|
729
749
|
// src/storefront/endpoints.ts
|
|
730
750
|
var StorefrontEndpoints = class {
|
|
731
751
|
constructor(api, configuration) {
|
|
@@ -977,6 +997,7 @@ export {
|
|
|
977
997
|
ActivationRequestFulfillmentType,
|
|
978
998
|
ActivationRequestStatus,
|
|
979
999
|
ActivationStatus,
|
|
1000
|
+
CycleLength,
|
|
980
1001
|
LicenseStatus,
|
|
981
1002
|
MoonbaseClient,
|
|
982
1003
|
MoonbaseError,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/storefront-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"description": "Package to let you build storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|