@spscommerce/asst-api 5.2.0 → 5.3.2
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/{SpsItemIdResponse-CSZKx_Tz.d.cts → SpsItemIdResponse-Duo9fy_R.d.ts} +5 -5
- package/dist/{chunk-ZC44MAMI.js → chunk-35CHQUKC.js} +20 -1
- package/dist/index.cjs +848 -14
- package/dist/index.d.ts +36 -6
- package/dist/index.js +1 -1
- package/dist/msw.cjs +21 -1
- package/dist/msw.d.ts +2 -1
- package/dist/msw.js +10 -2
- package/dist/{zod-CFHO1Ktc.d.cts → zod-f4vmP6zY.d.ts} +1 -1
- package/dist/zod.cjs +0 -13
- package/dist/zod.d.ts +2 -2
- package/package.json +8 -9
- package/dist/CompanySearch-7_L0_02Y.d.cts +0 -313
- package/dist/SpsItemIdResponse-CSZKx_Tz.d.ts +0 -102
- package/dist/index.d.cts +0 -964
- package/dist/msw.d.cts +0 -807
- package/dist/zod-DOSs4Eg9.d.ts +0 -5876
- package/dist/zod.d.cts +0 -4
|
@@ -64,12 +64,12 @@ declare class AsstClient {
|
|
|
64
64
|
* @returns Function to unsubscribe to config changes
|
|
65
65
|
*/
|
|
66
66
|
subscribeToConfigChange(listener: Listener): () => boolean;
|
|
67
|
-
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise
|
|
68
|
-
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise
|
|
69
|
-
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise
|
|
70
|
-
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise
|
|
67
|
+
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise<unknown>;
|
|
68
|
+
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise<unknown>;
|
|
69
|
+
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise<unknown>;
|
|
70
|
+
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise<unknown>;
|
|
71
71
|
head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
72
|
-
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise
|
|
72
|
+
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise<unknown>;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
type Hierarchy = {
|
|
@@ -357,6 +357,19 @@ function createWhoAmIApi(client) {
|
|
|
357
357
|
|
|
358
358
|
// lib/companyFeatures/index.ts
|
|
359
359
|
var BASE_URL10 = "feature";
|
|
360
|
+
var companyFeatureSchema = external_exports.object({
|
|
361
|
+
/**
|
|
362
|
+
* Validated as a string at runtime so that unknown feature types returned by the
|
|
363
|
+
* backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
|
|
364
|
+
* type is narrowed to `FeatureType` so callers still get compile-time checking when
|
|
365
|
+
* comparing against known values.
|
|
366
|
+
*/
|
|
367
|
+
type: external_exports.string(),
|
|
368
|
+
display: external_exports.string(),
|
|
369
|
+
active: external_exports.boolean(),
|
|
370
|
+
assortmentSystemInstanceId: external_exports.string().nullish(),
|
|
371
|
+
defaultCatalogId: external_exports.number().nullish()
|
|
372
|
+
});
|
|
360
373
|
function createCompanyFeaturesApi(client, companyType) {
|
|
361
374
|
function getSearchParams() {
|
|
362
375
|
return companyType && { companyType };
|
|
@@ -368,12 +381,17 @@ function createCompanyFeaturesApi(client, companyType) {
|
|
|
368
381
|
}).json();
|
|
369
382
|
return external_exports.boolean().parse(data);
|
|
370
383
|
}
|
|
384
|
+
async function getFeaturesForCompany(companyId, signal) {
|
|
385
|
+
const data = await client.get(`${BASE_URL10}/company/${companyId}`, { signal }).json();
|
|
386
|
+
return external_exports.array(companyFeatureSchema).parse(data);
|
|
387
|
+
}
|
|
371
388
|
async function enableFeatureForCompany(featureKey, companyId) {
|
|
372
389
|
await client.put(`${BASE_URL10}/${featureKey}/company/${companyId}/enable`);
|
|
373
390
|
}
|
|
374
391
|
return {
|
|
375
392
|
checkIfStageItemSetupIsEnabled,
|
|
376
|
-
enableFeatureForCompany
|
|
393
|
+
enableFeatureForCompany,
|
|
394
|
+
getFeaturesForCompany
|
|
377
395
|
};
|
|
378
396
|
}
|
|
379
397
|
|
|
@@ -701,6 +719,7 @@ export {
|
|
|
701
719
|
BASE_URL9,
|
|
702
720
|
createWhoAmIApi,
|
|
703
721
|
BASE_URL10,
|
|
722
|
+
companyFeatureSchema,
|
|
704
723
|
createCompanyFeaturesApi,
|
|
705
724
|
BASE_URL11,
|
|
706
725
|
createFeatureFlagsApi,
|