@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 +21 -16
- package/dist/index.iife.js +39 -24
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +39 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1202,12 +1202,38 @@ var BaseCatalogClient = class extends StorefrontAPIClientBase {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
};
|
|
1204
1204
|
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/lib/public/client.ts
|
|
1207
|
+
/**
|
|
1208
|
+
* Storefront API client that always authenticates with `X-Api-Key`.
|
|
1209
|
+
*
|
|
1210
|
+
* This client is used by the public storefront surface where no session or
|
|
1211
|
+
* token lifecycle should be involved.
|
|
1212
|
+
*/
|
|
1213
|
+
var PublicStorefrontAPIClient = class extends StorefrontAPIClientBase {
|
|
1214
|
+
constructor(config) {
|
|
1215
|
+
super(config);
|
|
1216
|
+
attachPublicAuth(this);
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
function attachPublicAuth(client) {
|
|
1220
|
+
client.useMiddleware({ onRequest: async ({ request }) => {
|
|
1221
|
+
if (client.apiKey) request.headers.set("X-Api-Key", client.apiKey);
|
|
1222
|
+
return request;
|
|
1223
|
+
} });
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1205
1226
|
//#endregion
|
|
1206
1227
|
//#region src/lib/public/catalog.ts
|
|
1207
1228
|
/**
|
|
1208
1229
|
* Client for interacting with catalog endpoints
|
|
1209
1230
|
*/
|
|
1210
|
-
var PublicCatalogClient = class extends BaseCatalogClient {
|
|
1231
|
+
var PublicCatalogClient = class extends BaseCatalogClient {
|
|
1232
|
+
constructor(config) {
|
|
1233
|
+
super(config);
|
|
1234
|
+
attachPublicAuth(this);
|
|
1235
|
+
}
|
|
1236
|
+
};
|
|
1211
1237
|
|
|
1212
1238
|
//#endregion
|
|
1213
1239
|
//#region src/lib/catalog.ts
|
|
@@ -3237,7 +3263,12 @@ var BaseHelpersClient = class extends StorefrontAPIClientBase {
|
|
|
3237
3263
|
/**
|
|
3238
3264
|
* Client for interacting with helper endpoints
|
|
3239
3265
|
*/
|
|
3240
|
-
var PublicHelpersClient = class extends BaseHelpersClient {
|
|
3266
|
+
var PublicHelpersClient = class extends BaseHelpersClient {
|
|
3267
|
+
constructor(config) {
|
|
3268
|
+
super(config);
|
|
3269
|
+
attachPublicAuth(this);
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3241
3272
|
|
|
3242
3273
|
//#endregion
|
|
3243
3274
|
//#region src/lib/helper.ts
|
|
@@ -3381,7 +3412,12 @@ var BaseStoreConfigClient = class extends StorefrontAPIClientBase {
|
|
|
3381
3412
|
/**
|
|
3382
3413
|
* Client for interacting with store config endpoints
|
|
3383
3414
|
*/
|
|
3384
|
-
var PublicStoreConfigClient = class extends BaseStoreConfigClient {
|
|
3415
|
+
var PublicStoreConfigClient = class extends BaseStoreConfigClient {
|
|
3416
|
+
constructor(config) {
|
|
3417
|
+
super(config);
|
|
3418
|
+
attachPublicAuth(this);
|
|
3419
|
+
}
|
|
3420
|
+
};
|
|
3385
3421
|
|
|
3386
3422
|
//#endregion
|
|
3387
3423
|
//#region src/lib/store-config.ts
|
|
@@ -4113,27 +4149,6 @@ var StorefrontSessionManager = class {
|
|
|
4113
4149
|
}
|
|
4114
4150
|
};
|
|
4115
4151
|
|
|
4116
|
-
//#endregion
|
|
4117
|
-
//#region src/lib/public/client.ts
|
|
4118
|
-
/**
|
|
4119
|
-
* Storefront API client that always authenticates with `X-Api-Key`.
|
|
4120
|
-
*
|
|
4121
|
-
* This client is used by the public storefront surface where no session or
|
|
4122
|
-
* token lifecycle should be involved.
|
|
4123
|
-
*/
|
|
4124
|
-
var PublicStorefrontAPIClient = class extends StorefrontAPIClientBase {
|
|
4125
|
-
constructor(config) {
|
|
4126
|
-
super(config);
|
|
4127
|
-
this.setupPublicAuth();
|
|
4128
|
-
}
|
|
4129
|
-
setupPublicAuth() {
|
|
4130
|
-
this.client.use({ onRequest: async ({ request }) => {
|
|
4131
|
-
if (this.apiKey) request.headers.set("X-Api-Key", this.apiKey);
|
|
4132
|
-
return request;
|
|
4133
|
-
} });
|
|
4134
|
-
}
|
|
4135
|
-
};
|
|
4136
|
-
|
|
4137
4152
|
//#endregion
|
|
4138
4153
|
//#region src/index.ts
|
|
4139
4154
|
/**
|