@moonbase.sh/storefront-api 0.1.123 → 0.2.1

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 CHANGED
@@ -138,6 +138,7 @@ var storefrontProductSchema = import_zod3.z.object({
138
138
  name: import_zod3.z.string(),
139
139
  tagline: import_zod3.z.string(),
140
140
  iconUrl: import_zod3.z.string().nullable(),
141
+ website: import_zod3.z.string().nullish(),
141
142
  owned: import_zod3.z.boolean(),
142
143
  currentVersion: import_zod3.z.string().optional(),
143
144
  downloads: downloadSchema.array().optional(),
@@ -170,6 +171,7 @@ var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
170
171
  ActivationRequestStatus2["Requested"] = "Requested";
171
172
  ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
172
173
  ActivationRequestStatus2["Completed"] = "Completed";
174
+ ActivationRequestStatus2["Cancelled"] = "Cancelled";
173
175
  return ActivationRequestStatus2;
174
176
  })(ActivationRequestStatus || {});
175
177
 
@@ -211,6 +213,10 @@ var ActivationRequestEndpoints = class {
211
213
  const response = await this.api.fetch(`/api/customer/activations/${requestId}/trial`, "POST");
212
214
  return activationRequestSchema.parse(response.data);
213
215
  }
216
+ async cancel(requestId) {
217
+ const response = await this.api.fetch(`/api/customer/activations/${requestId}/cancel`, "POST");
218
+ return activationRequestSchema.parse(response.data);
219
+ }
214
220
  };
215
221
 
216
222
  // src/identity/endpoints.ts
@@ -670,8 +676,15 @@ var _TokenStore = class _TokenStore {
670
676
  handleStorageUpdate(event) {
671
677
  switch (event.key) {
672
678
  case _TokenStore.storageKey:
673
- this.tokens = JSON.parse(event.newValue);
674
- this.tokens.expiresAt = new Date(this.tokens.expiresAt);
679
+ this.tokens = event.newValue ? JSON.parse(event.newValue) : null;
680
+ if (this.refreshTimeoutId != null)
681
+ window.clearTimeout(this.refreshTimeoutId);
682
+ if (this.tokens) {
683
+ this.tokens.expiresAt = new Date(this.tokens.expiresAt);
684
+ this.refreshTimeoutId = window.setTimeout(() => {
685
+ this.refreshPromise = this.refreshTokens();
686
+ }, 10 * 60 * 1e3 + (Math.random() + 1) * 60 * 1e3);
687
+ }
675
688
  break;
676
689
  }
677
690
  }