@adobe/spacecat-shared-brand-client 1.1.13 → 1.1.15
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/CHANGELOG.md +14 -0
- package/README.md +7 -2
- package/package.json +2 -2
- package/src/index.d.ts +7 -2
- package/src/index.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-brand-client-v1.1.15](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-brand-client-v1.1.14...@adobe/spacecat-shared-brand-client-v1.1.15) (2025-07-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Supporting userId in brandConfig ([#838](https://github.com/adobe/spacecat-shared/issues/838)) ([b585ea6](https://github.com/adobe/spacecat-shared/commit/b585ea6e1821925644bac59bbe9e0fcadfaa55be))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-brand-client-v1.1.14](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-brand-client-v1.1.13...@adobe/spacecat-shared-brand-client-v1.1.14) (2025-06-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update external fixes ([#830](https://github.com/adobe/spacecat-shared/issues/830)) ([b98589d](https://github.com/adobe/spacecat-shared/commit/b98589da5c11aa4e63358e98f0c0852b0ef2a02d))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-brand-client-v1.1.13](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-brand-client-v1.1.12...@adobe/spacecat-shared-brand-client-v1.1.13) (2025-06-21)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const brands = await client.getBrandsForOrganization('org123', 'ims-access-token
|
|
|
59
59
|
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
#### getBrandGuidelines(
|
|
62
|
+
#### getBrandGuidelines(brandConfig, imsOrgId, imsConfig)
|
|
63
63
|
|
|
64
64
|
Retrieves brand guidelines for the given brand and IMS Org.
|
|
65
65
|
|
|
@@ -71,7 +71,12 @@ const imsConfig = {
|
|
|
71
71
|
clientSecret: 'client-secret'
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const
|
|
74
|
+
const brandConfig = {
|
|
75
|
+
brandId: 'brand123',
|
|
76
|
+
userId: 'user123'
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const guidelines = await client.getBrandGuidelines(brandConfig, 'org123', imsConfig);
|
|
75
80
|
// Returns BrandGuidelines object:
|
|
76
81
|
// {
|
|
77
82
|
// id: 'brand123',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-brand-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Brand Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"chai": "5.2.0",
|
|
43
43
|
"chai-as-promised": "8.0.1",
|
|
44
|
-
"mocha": "11.7.
|
|
44
|
+
"mocha": "11.7.1",
|
|
45
45
|
"mocha-multi-reporters": "1.5.1",
|
|
46
46
|
"nock": "14.0.5",
|
|
47
47
|
"sinon": "20.0.0",
|
package/src/index.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface BrandClientConfig {
|
|
|
15
15
|
apiKey: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export interface BrandConfig {
|
|
19
|
+
brandId: string;
|
|
20
|
+
userId: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
export interface Brand {
|
|
19
24
|
id: string;
|
|
20
25
|
name: string;
|
|
@@ -67,7 +72,7 @@ export default class BrandClient {
|
|
|
67
72
|
/**
|
|
68
73
|
* Retrieves brand guidelines for the given brand and IMS Org.
|
|
69
74
|
*
|
|
70
|
-
* @param {
|
|
75
|
+
* @param {BrandConfig} brandConfig - The brand configuration including brandId and userId
|
|
71
76
|
* @param {string} imsOrgId - The IMS organization ID that owns the brand
|
|
72
77
|
* @param {ImsConfig} imsConfig - Configuration for IMS authentication
|
|
73
78
|
* @returns {Promise<BrandGuidelines>} The brand guidelines including tone of voice,
|
|
@@ -76,7 +81,7 @@ export default class BrandClient {
|
|
|
76
81
|
* or if the API request fails
|
|
77
82
|
*/
|
|
78
83
|
getBrandGuidelines(
|
|
79
|
-
|
|
84
|
+
brandConfig: BrandConfig,
|
|
80
85
|
imsOrgId: string,
|
|
81
86
|
imsConfig: ImsConfig,
|
|
82
87
|
): Promise<BrandGuidelines>;
|
package/src/index.js
CHANGED
|
@@ -130,9 +130,10 @@ export default class BrandClient {
|
|
|
130
130
|
return this.serviceAccessToken;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
async getBrandGuidelines(
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
async getBrandGuidelines(brandConfig, imsOrgId, imsConfig = {}) {
|
|
134
|
+
const { brandId, userId } = brandConfig;
|
|
135
|
+
if (!hasText(brandId) || !hasText(userId)) {
|
|
136
|
+
throw this.#createError('Invalid brand ID or user ID', HTTP_BAD_REQUEST);
|
|
136
137
|
}
|
|
137
138
|
if (!isValidIMSOrgId(imsOrgId)) {
|
|
138
139
|
throw this.#createError(`Invalid IMS Org ID: ${imsOrgId}`, HTTP_BAD_REQUEST);
|
|
@@ -148,6 +149,7 @@ export default class BrandClient {
|
|
|
148
149
|
'Content-Type': 'application/json',
|
|
149
150
|
Authorization: `Bearer ${imsAccessToken}`,
|
|
150
151
|
'x-api-key': this.apiKey,
|
|
152
|
+
'user-id': userId,
|
|
151
153
|
};
|
|
152
154
|
const response = await fetch(`${this.apiBaseUrl}${API_GET_BRAND_GUIDELINES(brandId)}`, {
|
|
153
155
|
headers,
|