@moonbase.sh/storefront-api 0.1.123 → 0.2.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.js CHANGED
@@ -91,6 +91,7 @@ var storefrontProductSchema = z3.object({
91
91
  name: z3.string(),
92
92
  tagline: z3.string(),
93
93
  iconUrl: z3.string().nullable(),
94
+ website: z3.string().nullish(),
94
95
  owned: z3.boolean(),
95
96
  currentVersion: z3.string().optional(),
96
97
  downloads: downloadSchema.array().optional(),
@@ -123,6 +124,7 @@ var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
123
124
  ActivationRequestStatus2["Requested"] = "Requested";
124
125
  ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
125
126
  ActivationRequestStatus2["Completed"] = "Completed";
127
+ ActivationRequestStatus2["Cancelled"] = "Cancelled";
126
128
  return ActivationRequestStatus2;
127
129
  })(ActivationRequestStatus || {});
128
130
 
@@ -164,6 +166,10 @@ var ActivationRequestEndpoints = class {
164
166
  const response = await this.api.fetch(`/api/customer/activations/${requestId}/trial`, "POST");
165
167
  return activationRequestSchema.parse(response.data);
166
168
  }
169
+ async cancel(requestId) {
170
+ const response = await this.api.fetch(`/api/customer/activations/${requestId}/cancel`, "POST");
171
+ return activationRequestSchema.parse(response.data);
172
+ }
167
173
  };
168
174
 
169
175
  // src/identity/endpoints.ts
@@ -623,8 +629,15 @@ var _TokenStore = class _TokenStore {
623
629
  handleStorageUpdate(event) {
624
630
  switch (event.key) {
625
631
  case _TokenStore.storageKey:
626
- this.tokens = JSON.parse(event.newValue);
627
- this.tokens.expiresAt = new Date(this.tokens.expiresAt);
632
+ this.tokens = event.newValue ? JSON.parse(event.newValue) : null;
633
+ if (this.refreshTimeoutId != null)
634
+ window.clearTimeout(this.refreshTimeoutId);
635
+ if (this.tokens) {
636
+ this.tokens.expiresAt = new Date(this.tokens.expiresAt);
637
+ this.refreshTimeoutId = window.setTimeout(() => {
638
+ this.refreshPromise = this.refreshTokens();
639
+ }, 10 * 60 * 1e3 + (Math.random() + 1) * 60 * 1e3);
640
+ }
628
641
  break;
629
642
  }
630
643
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "0.1.123",
4
+ "version": "0.2.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",