@moonbase.sh/storefront-api 3.12.0 → 3.13.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/README.md +16 -0
- package/dist/index.cjs +49 -31
- package/dist/index.d.cts +1596 -1584
- package/dist/index.d.ts +1596 -1584
- package/dist/index.js +49 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,34 +7,6 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/activationRequests/endpoints.ts
|
|
8
8
|
import { z as z5 } from "zod";
|
|
9
9
|
|
|
10
|
-
// src/activationRequests/schemas.ts
|
|
11
|
-
var schemas_exports3 = {};
|
|
12
|
-
__export(schemas_exports3, {
|
|
13
|
-
activationRequestSchema: () => activationRequestSchema
|
|
14
|
-
});
|
|
15
|
-
import { z as z4 } from "zod";
|
|
16
|
-
|
|
17
|
-
// src/storefront/schemas.ts
|
|
18
|
-
var schemas_exports2 = {};
|
|
19
|
-
__export(schemas_exports2, {
|
|
20
|
-
offerConditionSchema: () => offerConditionSchema,
|
|
21
|
-
offerScopeSchema: () => offerScopeSchema,
|
|
22
|
-
storefrontBundleSchema: () => storefrontBundleSchema,
|
|
23
|
-
storefrontLicenseUpgradeSchema: () => storefrontLicenseUpgradeSchema,
|
|
24
|
-
storefrontOfferSchema: () => storefrontOfferSchema,
|
|
25
|
-
storefrontOfferTargetSchema: () => storefrontOfferTargetSchema,
|
|
26
|
-
storefrontProductSchema: () => storefrontProductSchema,
|
|
27
|
-
storefrontPromotionCtaSchema: () => storefrontPromotionCtaSchema,
|
|
28
|
-
storefrontPromotionSchema: () => storefrontPromotionSchema,
|
|
29
|
-
storefrontPromotionTargetSchema: () => storefrontPromotionTargetSchema,
|
|
30
|
-
storefrontSchema: () => storefrontSchema,
|
|
31
|
-
taxEstimateSchema: () => taxEstimateSchema
|
|
32
|
-
});
|
|
33
|
-
import { z as z3 } from "zod";
|
|
34
|
-
|
|
35
|
-
// src/globalSchemas.ts
|
|
36
|
-
import { z } from "zod";
|
|
37
|
-
|
|
38
10
|
// src/globalModels.ts
|
|
39
11
|
var CycleLength = /* @__PURE__ */ ((CycleLength2) => {
|
|
40
12
|
CycleLength2["Daily"] = "Daily";
|
|
@@ -72,7 +44,33 @@ function utmToObject(utm) {
|
|
|
72
44
|
}), {});
|
|
73
45
|
}
|
|
74
46
|
|
|
47
|
+
// src/activationRequests/schemas.ts
|
|
48
|
+
var schemas_exports3 = {};
|
|
49
|
+
__export(schemas_exports3, {
|
|
50
|
+
activationRequestSchema: () => activationRequestSchema
|
|
51
|
+
});
|
|
52
|
+
import { z as z4 } from "zod";
|
|
53
|
+
|
|
54
|
+
// src/storefront/schemas.ts
|
|
55
|
+
var schemas_exports2 = {};
|
|
56
|
+
__export(schemas_exports2, {
|
|
57
|
+
offerConditionSchema: () => offerConditionSchema,
|
|
58
|
+
offerScopeSchema: () => offerScopeSchema,
|
|
59
|
+
storefrontBundleSchema: () => storefrontBundleSchema,
|
|
60
|
+
storefrontLicenseUpgradeSchema: () => storefrontLicenseUpgradeSchema,
|
|
61
|
+
storefrontOfferSchema: () => storefrontOfferSchema,
|
|
62
|
+
storefrontOfferTargetSchema: () => storefrontOfferTargetSchema,
|
|
63
|
+
storefrontProductSchema: () => storefrontProductSchema,
|
|
64
|
+
storefrontPromotionCtaSchema: () => storefrontPromotionCtaSchema,
|
|
65
|
+
storefrontPromotionSchema: () => storefrontPromotionSchema,
|
|
66
|
+
storefrontPromotionTargetSchema: () => storefrontPromotionTargetSchema,
|
|
67
|
+
storefrontSchema: () => storefrontSchema,
|
|
68
|
+
taxEstimateSchema: () => taxEstimateSchema
|
|
69
|
+
});
|
|
70
|
+
import { z as z3 } from "zod";
|
|
71
|
+
|
|
75
72
|
// src/globalSchemas.ts
|
|
73
|
+
import { z } from "zod";
|
|
76
74
|
var priceCollectionSchema = z.record(z.number());
|
|
77
75
|
var discountPromotionFields = {
|
|
78
76
|
promotionId: z.string().optional(),
|
|
@@ -506,8 +504,14 @@ var ActivationRequestEndpoints = class {
|
|
|
506
504
|
const response = await this.api.authenticatedFetch(`/api/customer/activations/${requestId}/license`, activationRequestSchema, { method: "POST" });
|
|
507
505
|
return response.data;
|
|
508
506
|
}
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
/**
|
|
508
|
+
* Starts the trial the request's app asked for. `utm` is the tracking the visitor arrived with, which the
|
|
509
|
+
* trial is put down to, as a sign-up or an order is, so trials can be told apart by the marketing that
|
|
510
|
+
* brought them.
|
|
511
|
+
*/
|
|
512
|
+
async fulfillTrial(requestId, utm) {
|
|
513
|
+
const query = new URLSearchParams(utmToObject(utm)).toString();
|
|
514
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}/trial${query ? `?${query}` : ""}`, activationRequestSchema, { method: "POST" });
|
|
511
515
|
return response.data;
|
|
512
516
|
}
|
|
513
517
|
async cancel(requestId) {
|
|
@@ -990,6 +994,20 @@ var IdentityEndpoints = class {
|
|
|
990
994
|
user: response.data
|
|
991
995
|
};
|
|
992
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Saves the signed-in customer's address, which their next checkout starts from. A checkout
|
|
999
|
+
* they have already entered billing details in keeps those. Rejects with a `MoonbaseError` for
|
|
1000
|
+
* an address the store can't use: it needs a known country, a street address, a city or a
|
|
1001
|
+
* region, and in the US a postal code.
|
|
1002
|
+
*/
|
|
1003
|
+
async updateAddress(address) {
|
|
1004
|
+
const response = await this.api.authenticatedFetch("/api/customer/identity", userSchema, {
|
|
1005
|
+
method: "PATCH",
|
|
1006
|
+
body: { address }
|
|
1007
|
+
});
|
|
1008
|
+
this.tokenStore.setUser(response.data);
|
|
1009
|
+
return response.data;
|
|
1010
|
+
}
|
|
993
1011
|
async setPassword(currentPassword, newPassword) {
|
|
994
1012
|
await this.api.authenticatedFetch(`/api/customer/identity/set-password`, null, {
|
|
995
1013
|
method: "POST",
|
|
@@ -1235,7 +1253,7 @@ var ProductEndpoints = class {
|
|
|
1235
1253
|
import { z as z15 } from "zod";
|
|
1236
1254
|
|
|
1237
1255
|
// package.json
|
|
1238
|
-
var version = "3.
|
|
1256
|
+
var version = "3.13.0";
|
|
1239
1257
|
|
|
1240
1258
|
// src/utils/client.ts
|
|
1241
1259
|
function buildClientHeader(sdk) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/storefront-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.13.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",
|