@moonbase.sh/storefront-api 0.2.83 → 0.2.86

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.js CHANGED
@@ -70,17 +70,25 @@ var Platform = /* @__PURE__ */ ((Platform2) => {
70
70
  })(Platform || {});
71
71
 
72
72
  // src/inventory/products/schemas.ts
73
+ var manifestSchema = z2.object({
74
+ files: z2.object({
75
+ name: z2.string(),
76
+ path: z2.string()
77
+ }).array()
78
+ });
73
79
  var downloadSchema = z2.object({
74
80
  name: z2.string(),
75
81
  key: z2.string(),
76
82
  platform: z2.nativeEnum(Platform),
77
83
  size: z2.number(),
78
- path: z2.string().nullable()
84
+ path: z2.string().nullable(),
85
+ manifest: manifestSchema.optional()
79
86
  });
80
87
  var productSummarySchema = z2.object({
81
88
  id: z2.string(),
82
89
  name: z2.string(),
83
90
  tagline: z2.string(),
91
+ description: z2.string().nullish(),
84
92
  website: z2.string().optional(),
85
93
  iconUrl: z2.string().optional(),
86
94
  numberOfLicenses: z2.number().optional(),
@@ -101,6 +109,7 @@ var storefrontProductSchema = z3.object({
101
109
  id: z3.string(),
102
110
  name: z3.string(),
103
111
  tagline: z3.string(),
112
+ description: z3.string(),
104
113
  iconUrl: z3.string().nullable(),
105
114
  website: z3.string().nullish(),
106
115
  owned: z3.boolean(),
@@ -114,6 +123,7 @@ var storefrontBundleSchema = z3.object({
114
123
  id: z3.string(),
115
124
  name: z3.string(),
116
125
  tagline: z3.string(),
126
+ description: z3.string(),
117
127
  iconUrl: z3.string().nullable(),
118
128
  owned: z3.boolean(),
119
129
  partial: z3.boolean(),
@@ -568,11 +578,15 @@ function utmToObject(utm) {
568
578
 
569
579
  // src/storefront/endpoints.ts
570
580
  var StorefrontEndpoints = class {
571
- constructor(api) {
581
+ constructor(api, configuration) {
572
582
  this.api = api;
583
+ this.configuration = configuration;
573
584
  }
574
585
  async get(utm) {
575
- const query = new URLSearchParams(utmToObject(utm));
586
+ const query = new URLSearchParams(this.configuration.includeManifests ? {
587
+ includeManifests: "true",
588
+ ...utmToObject(utm)
589
+ } : utmToObject(utm));
576
590
  const response = await this.api.fetch(`/api/customer/storefront?${query.toString()}`, storefrontSchema);
577
591
  return response.data;
578
592
  }
@@ -809,11 +823,12 @@ var activationSchema = z10.object({
809
823
 
810
824
  // src/inventory/activation/endpoints.ts
811
825
  var ActivationEndpoints = class {
812
- constructor(api) {
826
+ constructor(api, configuration) {
813
827
  this.api = api;
828
+ this.configuration = configuration;
814
829
  }
815
830
  async activate(deviceToken, activationMethod) {
816
- const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}`, licenseSchema, {
831
+ const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}${this.configuration.includeManifests ? "&includeManifests=true" : ""}`, licenseSchema, {
817
832
  method: "POST",
818
833
  body: deviceToken,
819
834
  contentType: "text/plain"
@@ -827,11 +842,12 @@ var ActivationEndpoints = class {
827
842
 
828
843
  // src/inventory/licenses/endpoints.ts
829
844
  var LicenseEndpoints = class {
830
- constructor(api) {
845
+ constructor(api, configuration) {
831
846
  this.api = api;
847
+ this.configuration = configuration;
832
848
  }
833
849
  async get(nextUrl) {
834
- const response = await this.api.authenticatedFetch(nextUrl || "/api/customer/inventory/licenses", paged(licenseSchema));
850
+ const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
835
851
  return response.data;
836
852
  }
837
853
  async getActivations(licenseId, nextUrl) {
@@ -849,19 +865,20 @@ var LicenseEndpoints = class {
849
865
  // src/inventory/products/endpoints.ts
850
866
  import { z as z12 } from "zod";
851
867
  var ProductEndpoints = class {
852
- constructor(api) {
868
+ constructor(api, configuration) {
853
869
  this.api = api;
870
+ this.configuration = configuration;
854
871
  }
855
872
  async get(productId, version) {
856
- const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}` : ""}`, productSummarySchema);
873
+ const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}${this.configuration.includeManifests ? "&includeManifests=true" : ""}` : this.configuration.includeManifests ? "?includeManifests=true" : ""}`, productSummarySchema);
857
874
  return response.data;
858
875
  }
859
876
  async getOwned(nextUrl) {
860
- const response = await this.api.authenticatedFetch(nextUrl || "/api/customer/inventory/products", paged(productSummarySchema));
877
+ const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(productSummarySchema));
861
878
  return response.data;
862
879
  }
863
880
  async getLicenses(productId, nextUrl) {
864
- const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses`, paged(licenseSchema));
881
+ const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
865
882
  return response.data;
866
883
  }
867
884
  async getActivations(productId, nextUrl) {
@@ -880,10 +897,10 @@ var ProductEndpoints = class {
880
897
 
881
898
  // src/inventory/index.ts
882
899
  var InventoryEndpoints = class {
883
- constructor(api) {
884
- this.licenses = new LicenseEndpoints(api);
885
- this.products = new ProductEndpoints(api);
886
- this.activation = new ActivationEndpoints(api);
900
+ constructor(api, configuration) {
901
+ this.licenses = new LicenseEndpoints(api, configuration);
902
+ this.products = new ProductEndpoints(api, configuration);
903
+ this.activation = new ActivationEndpoints(api, configuration);
887
904
  }
888
905
  };
889
906
 
@@ -919,11 +936,11 @@ var MoonbaseClient = class {
919
936
  this.configuration.endpoint = this.configuration.endpoint.replace(/\/$/, "");
920
937
  this.tokenStore = new TokenStore(configuration);
921
938
  const api = new MoonbaseApi(this.configuration.endpoint, this.tokenStore);
922
- this.storefront = new StorefrontEndpoints(api);
939
+ this.storefront = new StorefrontEndpoints(api, this.configuration);
923
940
  this.identity = new IdentityEndpoints(api, this.tokenStore);
924
941
  this.vouchers = new VoucherEndpoints(api);
925
942
  this.orders = new OrderEndpoints(api);
926
- this.inventory = new InventoryEndpoints(api);
943
+ this.inventory = new InventoryEndpoints(api, this.configuration);
927
944
  this.activationRequests = new ActivationRequestEndpoints(api);
928
945
  this.vendor = new VendorEndpoints(api);
929
946
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "0.2.83",
4
+ "version": "0.2.86",
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",