@moonbase.sh/storefront-api 0.3.22 → 0.3.24

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
@@ -35,7 +35,9 @@ __export(index_exports, {
35
35
  ActivationRequestStatus: () => ActivationRequestStatus,
36
36
  ActivationStatus: () => ActivationStatus,
37
37
  CycleLength: () => CycleLength,
38
+ InMemoryStore: () => InMemoryStore,
38
39
  LicenseStatus: () => LicenseStatus,
40
+ LocalStorageStore: () => LocalStorageStore,
39
41
  MoonbaseApi: () => MoonbaseApi,
40
42
  MoonbaseClient: () => MoonbaseClient,
41
43
  MoonbaseError: () => MoonbaseError,
@@ -1068,7 +1070,7 @@ var _TokenStore = class _TokenStore {
1068
1070
  this.refreshTimeoutId = null;
1069
1071
  this.refreshPromise = null;
1070
1072
  var _a;
1071
- this.store = ((_a = configuration.store) != null ? _a : localStorage) ? new LocalStorageStore() : new InMemoryStore();
1073
+ this.store = (_a = configuration.store) != null ? _a : typeof window !== "undefined" && localStorage ? new LocalStorageStore() : new InMemoryStore();
1072
1074
  const storedToken = this.store.get(_TokenStore.storageKey);
1073
1075
  if (storedToken) {
1074
1076
  this.tokens = {
@@ -1238,7 +1240,9 @@ var MoonbaseClient = class {
1238
1240
  ActivationRequestStatus,
1239
1241
  ActivationStatus,
1240
1242
  CycleLength,
1243
+ InMemoryStore,
1241
1244
  LicenseStatus,
1245
+ LocalStorageStore,
1242
1246
  MoonbaseApi,
1243
1247
  MoonbaseClient,
1244
1248
  MoonbaseError,
package/dist/index.d.cts CHANGED
@@ -18545,6 +18545,20 @@ interface IStore {
18545
18545
  remove(key: string): void;
18546
18546
  listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18547
18547
  }
18548
+ declare class LocalStorageStore implements IStore {
18549
+ get<TItem>(key: string): TItem | null;
18550
+ set<TItem>(key: string, item: TItem): void;
18551
+ remove(key: string): void;
18552
+ listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18553
+ }
18554
+ declare class InMemoryStore implements IStore {
18555
+ private readonly store;
18556
+ private readonly listeners;
18557
+ get<TItem>(key: string): TItem | null;
18558
+ set<TItem>(key: string, item: TItem): void;
18559
+ remove(key: string): void;
18560
+ listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18561
+ }
18548
18562
 
18549
18563
  declare namespace schemas {
18550
18564
  export { schemas$2 as identity, schemas$1 as orders };
@@ -22663,4 +22677,4 @@ declare class MoonbaseClient {
22663
22677
  orders: OrderEndpoints;
22664
22678
  }
22665
22679
 
22666
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, CycleLength, type Discount, type Download, type DownloadManifest, type IRecurrence, type ITokenStore, type License, LicenseStatus, type LineItem, type Money, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type Subscription, SubscriptionStatus, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, problemDetailsSchema, schemas, utmToObject };
22680
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, CycleLength, type Discount, type Download, type DownloadManifest, type IRecurrence, type IStore, type ITokenStore, InMemoryStore, type License, LicenseStatus, type LineItem, LocalStorageStore, type Money, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type Subscription, SubscriptionStatus, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, problemDetailsSchema, schemas, utmToObject };
package/dist/index.d.ts CHANGED
@@ -18545,6 +18545,20 @@ interface IStore {
18545
18545
  remove(key: string): void;
18546
18546
  listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18547
18547
  }
18548
+ declare class LocalStorageStore implements IStore {
18549
+ get<TItem>(key: string): TItem | null;
18550
+ set<TItem>(key: string, item: TItem): void;
18551
+ remove(key: string): void;
18552
+ listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18553
+ }
18554
+ declare class InMemoryStore implements IStore {
18555
+ private readonly store;
18556
+ private readonly listeners;
18557
+ get<TItem>(key: string): TItem | null;
18558
+ set<TItem>(key: string, item: TItem): void;
18559
+ remove(key: string): void;
18560
+ listen<TItem>(key: string, callback: (item: TItem | null) => void): void;
18561
+ }
18548
18562
 
18549
18563
  declare namespace schemas {
18550
18564
  export { schemas$2 as identity, schemas$1 as orders };
@@ -22663,4 +22677,4 @@ declare class MoonbaseClient {
22663
22677
  orders: OrderEndpoints;
22664
22678
  }
22665
22679
 
22666
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, CycleLength, type Discount, type Download, type DownloadManifest, type IRecurrence, type ITokenStore, type License, LicenseStatus, type LineItem, type Money, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type Subscription, SubscriptionStatus, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, problemDetailsSchema, schemas, utmToObject };
22680
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, CycleLength, type Discount, type Download, type DownloadManifest, type IRecurrence, type IStore, type ITokenStore, InMemoryStore, type License, LicenseStatus, type LineItem, LocalStorageStore, type Money, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type Subscription, SubscriptionStatus, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, problemDetailsSchema, schemas, utmToObject };
package/dist/index.js CHANGED
@@ -1020,7 +1020,7 @@ var _TokenStore = class _TokenStore {
1020
1020
  this.refreshTimeoutId = null;
1021
1021
  this.refreshPromise = null;
1022
1022
  var _a;
1023
- this.store = ((_a = configuration.store) != null ? _a : localStorage) ? new LocalStorageStore() : new InMemoryStore();
1023
+ this.store = (_a = configuration.store) != null ? _a : typeof window !== "undefined" && localStorage ? new LocalStorageStore() : new InMemoryStore();
1024
1024
  const storedToken = this.store.get(_TokenStore.storageKey);
1025
1025
  if (storedToken) {
1026
1026
  this.tokens = {
@@ -1189,7 +1189,9 @@ export {
1189
1189
  ActivationRequestStatus,
1190
1190
  ActivationStatus,
1191
1191
  CycleLength,
1192
+ InMemoryStore,
1192
1193
  LicenseStatus,
1194
+ LocalStorageStore,
1193
1195
  MoonbaseApi,
1194
1196
  MoonbaseClient,
1195
1197
  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.3.22",
4
+ "version": "0.3.24",
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",