@commercengine/storefront-sdk 0.14.0 → 0.14.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.d.mts CHANGED
@@ -12582,7 +12582,7 @@ type StorefrontClientBaseConfig = BaseSDKOptions<SupportedDefaultHeaders> & {
12582
12582
  * decisions to the public and session-specific subclasses.
12583
12583
  */
12584
12584
  declare class StorefrontAPIClientBase extends BaseAPIClient<paths, SupportedDefaultHeaders> {
12585
- protected apiKey?: string;
12585
+ apiKey?: string;
12586
12586
  constructor(config: StorefrontClientBaseConfig);
12587
12587
  setApiKey(apiKey: string): void;
12588
12588
  clearApiKey(): void;
@@ -13972,11 +13972,24 @@ declare class BaseCatalogClient extends StorefrontAPIClientBase {
13972
13972
  listSimilarProducts(options?: ListSimilarProductsQuery, headers?: ListSimilarProductsHeaderParams): Promise<ApiResult<ListSimilarProductsContent>>;
13973
13973
  }
13974
13974
  //#endregion
13975
+ //#region src/lib/public/client.d.ts
13976
+ /**
13977
+ * Storefront API client that always authenticates with `X-Api-Key`.
13978
+ *
13979
+ * This client is used by the public storefront surface where no session or
13980
+ * token lifecycle should be involved.
13981
+ */
13982
+ declare class PublicStorefrontAPIClient extends StorefrontAPIClientBase {
13983
+ constructor(config: StorefrontClientBaseConfig);
13984
+ }
13985
+ //#endregion
13975
13986
  //#region src/lib/public/catalog.d.ts
13976
13987
  /**
13977
13988
  * Client for interacting with catalog endpoints
13978
13989
  */
13979
- declare class PublicCatalogClient extends BaseCatalogClient {}
13990
+ declare class PublicCatalogClient extends BaseCatalogClient {
13991
+ constructor(config: ConstructorParameters<typeof PublicStorefrontAPIClient>[0]);
13992
+ }
13980
13993
  //#endregion
13981
13994
  //#region src/lib/catalog.d.ts
13982
13995
  /**
@@ -15916,7 +15929,9 @@ declare class BaseHelpersClient extends StorefrontAPIClientBase {
15916
15929
  /**
15917
15930
  * Client for interacting with helper endpoints
15918
15931
  */
15919
- declare class PublicHelpersClient extends BaseHelpersClient {}
15932
+ declare class PublicHelpersClient extends BaseHelpersClient {
15933
+ constructor(config: ConstructorParameters<typeof PublicStorefrontAPIClient>[0]);
15934
+ }
15920
15935
  //#endregion
15921
15936
  //#region src/lib/helper.d.ts
15922
15937
  /**
@@ -16276,7 +16291,9 @@ declare class BaseStoreConfigClient extends StorefrontAPIClientBase {
16276
16291
  /**
16277
16292
  * Client for interacting with store config endpoints
16278
16293
  */
16279
- declare class PublicStoreConfigClient extends BaseStoreConfigClient {}
16294
+ declare class PublicStoreConfigClient extends BaseStoreConfigClient {
16295
+ constructor(config: ConstructorParameters<typeof PublicStorefrontAPIClient>[0]);
16296
+ }
16280
16297
  //#endregion
16281
16298
  //#region src/lib/store-config.d.ts
16282
16299
  /**
@@ -16286,18 +16303,6 @@ declare class StoreConfigClient extends BaseStoreConfigClient {
16286
16303
  constructor(config: ConstructorParameters<typeof SessionStorefrontAPIClient>[0]);
16287
16304
  }
16288
16305
  //#endregion
16289
- //#region src/lib/public/client.d.ts
16290
- /**
16291
- * Storefront API client that always authenticates with `X-Api-Key`.
16292
- *
16293
- * This client is used by the public storefront surface where no session or
16294
- * token lifecycle should be involved.
16295
- */
16296
- declare class PublicStorefrontAPIClient extends StorefrontAPIClientBase {
16297
- constructor(config: StorefrontClientBaseConfig);
16298
- private setupPublicAuth;
16299
- }
16300
- //#endregion
16301
16306
  //#region src/index.d.ts
16302
16307
  /**
16303
16308
  * Public SDK class for the Storefront API.
@@ -1582,12 +1582,38 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1582
1582
  }
1583
1583
  };
1584
1584
 
1585
+ //#endregion
1586
+ //#region src/lib/public/client.ts
1587
+ /**
1588
+ * Storefront API client that always authenticates with `X-Api-Key`.
1589
+ *
1590
+ * This client is used by the public storefront surface where no session or
1591
+ * token lifecycle should be involved.
1592
+ */
1593
+ var PublicStorefrontAPIClient = class extends StorefrontAPIClientBase {
1594
+ constructor(config) {
1595
+ super(config);
1596
+ attachPublicAuth(this);
1597
+ }
1598
+ };
1599
+ function attachPublicAuth(client) {
1600
+ client.useMiddleware({ onRequest: async ({ request }) => {
1601
+ if (client.apiKey) request.headers.set("X-Api-Key", client.apiKey);
1602
+ return request;
1603
+ } });
1604
+ }
1605
+
1585
1606
  //#endregion
1586
1607
  //#region src/lib/public/catalog.ts
1587
1608
  /**
1588
1609
  * Client for interacting with catalog endpoints
1589
1610
  */
1590
- var PublicCatalogClient = class extends BaseCatalogClient {};
1611
+ var PublicCatalogClient = class extends BaseCatalogClient {
1612
+ constructor(config) {
1613
+ super(config);
1614
+ attachPublicAuth(this);
1615
+ }
1616
+ };
1591
1617
 
1592
1618
  //#endregion
1593
1619
  //#region src/lib/catalog.ts
@@ -3617,7 +3643,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3617
3643
  /**
3618
3644
  * Client for interacting with helper endpoints
3619
3645
  */
3620
- var PublicHelpersClient = class extends BaseHelpersClient {};
3646
+ var PublicHelpersClient = class extends BaseHelpersClient {
3647
+ constructor(config) {
3648
+ super(config);
3649
+ attachPublicAuth(this);
3650
+ }
3651
+ };
3621
3652
 
3622
3653
  //#endregion
3623
3654
  //#region src/lib/helper.ts
@@ -3761,7 +3792,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3761
3792
  /**
3762
3793
  * Client for interacting with store config endpoints
3763
3794
  */
3764
- var PublicStoreConfigClient = class extends BaseStoreConfigClient {};
3795
+ var PublicStoreConfigClient = class extends BaseStoreConfigClient {
3796
+ constructor(config) {
3797
+ super(config);
3798
+ attachPublicAuth(this);
3799
+ }
3800
+ };
3765
3801
 
3766
3802
  //#endregion
3767
3803
  //#region src/lib/store-config.ts
@@ -4493,27 +4529,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4493
4529
  }
4494
4530
  };
4495
4531
 
4496
- //#endregion
4497
- //#region src/lib/public/client.ts
4498
- /**
4499
- * Storefront API client that always authenticates with `X-Api-Key`.
4500
- *
4501
- * This client is used by the public storefront surface where no session or
4502
- * token lifecycle should be involved.
4503
- */
4504
- var PublicStorefrontAPIClient = class extends StorefrontAPIClientBase {
4505
- constructor(config) {
4506
- super(config);
4507
- this.setupPublicAuth();
4508
- }
4509
- setupPublicAuth() {
4510
- this.client.use({ onRequest: async ({ request }) => {
4511
- if (this.apiKey) request.headers.set("X-Api-Key", this.apiKey);
4512
- return request;
4513
- } });
4514
- }
4515
- };
4516
-
4517
4532
  //#endregion
4518
4533
  //#region src/index.ts
4519
4534
  /**