sizebay-core-sdk 1.13.0-dev.4 → 1.13.0
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/README.dev.md +2 -2
- package/README.md +0 -63
- package/dist/modules/ai-image-service.d.ts +1 -3
- package/dist/sizebay-core-sdk.es.js +8 -149
- package/dist/sizebay-core-sdk.umd.js +1 -1
- package/dist/types/ai-image/index.d.ts +0 -2
- package/dist/types/fashion-looks/params/get-grouped-looks.dto.d.ts +0 -1
- package/package.json +1 -1
- package/dist/types/ai-image/params/get-complementary-by-permalink.dto.d.ts +0 -17
- package/dist/types/ai-image/params/get-similar-by-permalink.dto.d.ts +0 -16
package/README.dev.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Sizebay Core SDK - Development Guide
|
|
2
2
|
|
|
3
3
|
This guide is intended to help developers understand the project structure, how to create and integrate new modules, run tests, and configure automated releases with Semantic Release.
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Project Structure
|
|
8
8
|
|
|
9
|
-
The project is organized as follows:
|
|
9
|
+
The project is organized as follows:
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
📦src
|
package/README.md
CHANGED
|
@@ -318,7 +318,6 @@ Get grouped looks with optional filters and pagination (Public endpoint).
|
|
|
318
318
|
| `ageGroup` | AgeGroup | No | Filter by target age group.<br>Show only looks appropriate for the specified age range. |
|
|
319
319
|
| `style` | Style | No | Filter by style category.<br>Show only looks matching the desired style (casual, formal, party, etc.). |
|
|
320
320
|
| `collection` | Collection | No | Filter by seasonal collection.<br>Show only looks from a specific season (spring, summer, fall, winter). |
|
|
321
|
-
| `status` | GroupedLookStatus | No | Filter by status.<br>Use 'active' to show only active looks, 'inactive' for hidden ones,<br>'processing' for looks being generated, 'error' for failed looks,<br>or 'highlight' for featured looks. |
|
|
322
321
|
<!-- /DOCGEN -->
|
|
323
322
|
|
|
324
323
|
#### Returns
|
|
@@ -573,68 +572,6 @@ ClothType.SHOE_ACCESSORY // For shoes, accessories
|
|
|
573
572
|
| `feedback` | GroupedLookFeedbackResponseDto | No | User feedback for this look, if any has been submitted.<br>Use to display feedback or quality metrics to users. |
|
|
574
573
|
<!-- /DOCGEN -->
|
|
575
574
|
|
|
576
|
-
### `ProductsInfo`
|
|
577
|
-
|
|
578
|
-
Product information organized by garment type. Keys are garment types (e.g., 'top', 'bottom', 'shoe', 'bag'), and values are `ProductInfo` objects.
|
|
579
|
-
|
|
580
|
-
### `ProductInfo`
|
|
581
|
-
|
|
582
|
-
<!-- DOCGEN:params ProductInfo -->
|
|
583
|
-
> _Tipo **ProductInfo** não encontrado._
|
|
584
|
-
<!-- /DOCGEN -->
|
|
585
|
-
|
|
586
|
-
### `BmiGroupDto`
|
|
587
|
-
|
|
588
|
-
<!-- DOCGEN:params BmiGroupDto -->
|
|
589
|
-
| Field | Type | Required | Description |
|
|
590
|
-
| ----- | ---- | :------: | ----------- |
|
|
591
|
-
| `bmi` | BmiCategory | Yes | Body type identifier (BMI category).<br>Use to group or filter try-ons by body type preference. |
|
|
592
|
-
| `skinTones` | SkinToneGroupDto[] | Yes | Try-on groups for different skin tones within this body type.<br>Each skin tone group contains complete try-on details with image URL.<br>Iterate through these to show all skin tone variations for the same body type. |
|
|
593
|
-
<!-- /DOCGEN -->
|
|
594
|
-
|
|
595
|
-
### `SkinToneGroupDto`
|
|
596
|
-
|
|
597
|
-
<!-- DOCGEN:params SkinToneGroupDto -->
|
|
598
|
-
| Field | Type | Required | Description |
|
|
599
|
-
| ----- | ---- | :------: | ----------- |
|
|
600
|
-
| `skinTone` | SkinTone | Yes | Skin tone category for this group.<br>Use to label or filter try-ons by skin tone. |
|
|
601
|
-
| `tryonDetails` | TryonDetailsDto | Yes | Complete try-on details for this skin tone.<br>Contains the image URL and all metadata needed to display the try-on. |
|
|
602
|
-
<!-- /DOCGEN -->
|
|
603
|
-
|
|
604
|
-
### `TryonDetailsDto`
|
|
605
|
-
|
|
606
|
-
<!-- DOCGEN:params TryonDetailsDto -->
|
|
607
|
-
| Field | Type | Required | Description |
|
|
608
|
-
| ----- | ---- | :------: | ----------- |
|
|
609
|
-
| `id` | string | Yes | Unique identifier of this try-on (UUID).<br>Use to reference this try-on in other operations or track it. |
|
|
610
|
-
| `taskId` | string | Yes | Task ID used to generate this try-on.<br>Use to track the generation process or debug issues. |
|
|
611
|
-
| `tenantId` | number | Yes | Tenant ID that owns this try-on. |
|
|
612
|
-
| `gender` | Gender | Yes | Gender of the avatar used in this try-on.<br>Matches the look's target gender. |
|
|
613
|
-
| `ageGroup` | AgeGroup | Yes | Age group of the avatar used in this try-on.<br>Matches the look's target age group. |
|
|
614
|
-
| `bmi` | BmiCategory | Yes | Body type (BMI category) of the avatar.<br>Use to group try-ons by body type or filter by preference. |
|
|
615
|
-
| `skinTone` | SkinTone | Yes | Skin tone of the avatar.<br>Use to group try-ons by skin tone or show diversity. |
|
|
616
|
-
| `avatarImageUrl` | string | No | URL of the avatar image used as base.<br>Use to show the base avatar or for debugging. |
|
|
617
|
-
| `garments` | Garment[] | Yes | Array of garments applied to the avatar.<br>Contains details about each product piece used in the try-on. |
|
|
618
|
-
| `bagImageUrl` | string | No | URL of the bag image if a bag is included.<br>Use to display bag separately or in a product carousel. |
|
|
619
|
-
| `tryonUrl` | string | Yes | URL of the generated try-on image.<br>This is the main image to display showing the outfit on the avatar. |
|
|
620
|
-
| `status` | TryonStatus | Yes | Current status of the try-on generation.<br>Only display try-ons with status 'completed'. Check this before showing the image. |
|
|
621
|
-
| `creditsConsumed` | number | Yes | Number of credits consumed to generate this try-on.<br>Use for billing or quota tracking. |
|
|
622
|
-
| `errorMessage` | string | No | Error message if generation failed.<br>Only present when status is 'failed'. Use to debug or show error to users. |
|
|
623
|
-
| `timestamp` | string | Yes | When this try-on was created (ISO 8601 format).<br>Use to sort by date or show recent try-ons. |
|
|
624
|
-
<!-- /DOCGEN -->
|
|
625
|
-
|
|
626
|
-
### `GroupedLookFeedbackResponseDto`
|
|
627
|
-
|
|
628
|
-
<!-- DOCGEN:params GroupedLookFeedbackResponseDto -->
|
|
629
|
-
| Field | Type | Required | Description |
|
|
630
|
-
| ----- | ---- | :------: | ----------- |
|
|
631
|
-
| `id` | string | Yes | Unique identifier for this feedback record (UUID). |
|
|
632
|
-
| `tenantId` | number | Yes | Tenant ID that owns this feedback. |
|
|
633
|
-
| `groupedLookId` | string | Yes | ID of the fashion look this feedback refers to.<br>Use to link feedback back to the specific look. |
|
|
634
|
-
| `reason` | FeedbackReason | Yes | Category of issue reported by the user.<br>Use to categorize feedback or filter by issue type. |
|
|
635
|
-
| `timestamp` | string | Yes | When this feedback was submitted (ISO 8601 format).<br>Use to sort feedback by date or show recent feedback. |
|
|
636
|
-
<!-- /DOCGEN -->
|
|
637
|
-
|
|
638
575
|
### `GroupedLooksListResponse`
|
|
639
576
|
|
|
640
577
|
<!-- DOCGEN:params GroupedLooksListResponse -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../config';
|
|
2
|
-
import { GetSimilarProductsParams, GetComplementaryProductsParams, GetSimilarByImageBodyDto, GetComplementaryByImageBodyDto,
|
|
2
|
+
import { GetSimilarProductsParams, GetComplementaryProductsParams, GetSimilarByImageBodyDto, GetComplementaryByImageBodyDto, GetSimilarProductsResponse, GetComplementaryProductsResponse, GetComplementaryProductsByImageResponse } from '../types/ai-image';
|
|
3
3
|
export declare class AIImageService {
|
|
4
4
|
private endpoint;
|
|
5
5
|
constructor(config: Config);
|
|
@@ -8,6 +8,4 @@ export declare class AIImageService {
|
|
|
8
8
|
getComplementaryProducts(params: GetComplementaryProductsParams): Promise<GetComplementaryProductsResponse>;
|
|
9
9
|
searchSimilarByImage(payload: GetSimilarByImageBodyDto): Promise<GetSimilarProductsResponse>;
|
|
10
10
|
searchComplementaryByImage(payload: GetComplementaryByImageBodyDto): Promise<GetComplementaryProductsByImageResponse>;
|
|
11
|
-
searchSimilarByPermalink(payload: GetSimilarByPermalinkBodyDto): Promise<GetSimilarProductsResponse>;
|
|
12
|
-
searchComplementaryByPermalink(payload: GetComplementaryByPermalinkBodyDto): Promise<GetComplementaryProductsResponse>;
|
|
13
11
|
}
|
|
@@ -179,147 +179,6 @@ class S {
|
|
|
179
179
|
body: JSON.stringify(t)
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
/**
|
|
183
|
-
* Fetches similar product recommendations by permalink or productId.
|
|
184
|
-
*
|
|
185
|
-
* This method searches for products that are visually similar to a reference product
|
|
186
|
-
* identified by either its permalink URL or productId. The search uses AI-powered
|
|
187
|
-
* image analysis to find products with similar visual characteristics like color,
|
|
188
|
-
* style, pattern, and overall appearance.
|
|
189
|
-
*
|
|
190
|
-
* Sends a POST request to `/image-search/similar-by-permalink` with the search parameters.
|
|
191
|
-
* At least one of permalink or productId must be provided in the payload.
|
|
192
|
-
*
|
|
193
|
-
* @param payload - Search parameters including:
|
|
194
|
-
* - `permalink` (optional): Full URL of the reference product
|
|
195
|
-
* - `productId` (optional): Unique identifier of the reference product
|
|
196
|
-
* - `tenantId`: Client/tenant identifier
|
|
197
|
-
* - `collectionName`: Embeddings collection namespace
|
|
198
|
-
* - `sid`: Session identifier for the user
|
|
199
|
-
* - `sizeSystem`: Size system code (e.g., 'BR', 'EU', 'US')
|
|
200
|
-
* - `locale`: Language and region (e.g., 'en-US', 'pt-BR')
|
|
201
|
-
* - `currency`: Currency code for pricing (e.g., 'USD', 'BRL')
|
|
202
|
-
* - `similarityThreshold`: Minimum similarity score (0-1, default: 0.5)
|
|
203
|
-
* - `page`: Page number for pagination (default: 1)
|
|
204
|
-
* - `perPage`: Items per page (default: 20)
|
|
205
|
-
* - `ageRange`: Target age range (optional)
|
|
206
|
-
* - `gender`: User gender (optional)
|
|
207
|
-
* - `style`: Preferred style hint (optional)
|
|
208
|
-
* - `color`: Main color of interest (optional)
|
|
209
|
-
* - `productClass`: Target product class (optional)
|
|
210
|
-
* - `clothType`: Target cloth type for filtering (optional)
|
|
211
|
-
* - `filterByWhatFitsMe`: Apply What Fits Me logic (optional)
|
|
212
|
-
* - `personaHash`: User persona hash for personalization (optional)
|
|
213
|
-
*
|
|
214
|
-
* @returns Promise resolving to a paginated list of similar products with:
|
|
215
|
-
* - `data`: Array of similar products ordered by similarity score
|
|
216
|
-
* - `page`: Current page number
|
|
217
|
-
* - `perPage`: Number of items per page
|
|
218
|
-
* - `total`: Total number of similar products found
|
|
219
|
-
* - `invalidPersonaHash`: Whether the persona hash is invalid/expired
|
|
220
|
-
*
|
|
221
|
-
* @throws {ApiError} if the HTTP status is not 2xx or on network failure
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* ```typescript
|
|
225
|
-
* const similarProducts = await aiImageService.searchSimilarByPermalink({
|
|
226
|
-
* tenantId: 123,
|
|
227
|
-
* collectionName: "products",
|
|
228
|
-
* sid: "session123",
|
|
229
|
-
* sizeSystem: "BR",
|
|
230
|
-
* locale: "pt-BR",
|
|
231
|
-
* currency: "BRL",
|
|
232
|
-
* permalink: "https://example.com/products/red-dress-456",
|
|
233
|
-
* similarityThreshold: 0.7,
|
|
234
|
-
* page: 1,
|
|
235
|
-
* perPage: 10,
|
|
236
|
-
* style: "Casual",
|
|
237
|
-
* color: "red"
|
|
238
|
-
* });
|
|
239
|
-
* ```
|
|
240
|
-
*/
|
|
241
|
-
searchSimilarByPermalink(t) {
|
|
242
|
-
const e = `${this.endpoint}/image-search/similar-by-permalink`;
|
|
243
|
-
return a(e, {
|
|
244
|
-
method: "POST",
|
|
245
|
-
headers: { "Content-Type": "application/json" },
|
|
246
|
-
body: JSON.stringify(t)
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Fetches complementary product recommendations by permalink or productId.
|
|
251
|
-
*
|
|
252
|
-
* This method finds products that complement a reference product identified by either
|
|
253
|
-
* its permalink URL or productId. Complementary products are items that work well
|
|
254
|
-
* together in an outfit or ensemble, such as tops that go with bottoms, shoes that
|
|
255
|
-
* match a dress, or accessories that complement a main piece.
|
|
256
|
-
*
|
|
257
|
-
* The AI analyzes the reference product's style, color, and category to suggest
|
|
258
|
-
* complementary items that would create cohesive and fashionable combinations.
|
|
259
|
-
*
|
|
260
|
-
* Sends a POST request to `/image-search/complementary-by-permalink` with the search parameters.
|
|
261
|
-
* At least one of permalink or productId must be provided in the payload.
|
|
262
|
-
*
|
|
263
|
-
* @param payload - Search parameters including:
|
|
264
|
-
* - `permalink` (optional): Full URL of the reference product
|
|
265
|
-
* - `productId` (optional): Unique identifier of the reference product
|
|
266
|
-
* - `tenantId`: Client/tenant identifier
|
|
267
|
-
* - `collectionName`: Embeddings collection namespace
|
|
268
|
-
* - `sid`: Session identifier for the user
|
|
269
|
-
* - `sizeSystem`: Size system code (e.g., 'BR', 'EU', 'US')
|
|
270
|
-
* - `locale`: Language and region (e.g., 'en-US', 'pt-BR')
|
|
271
|
-
* - `currency`: Currency code for pricing (e.g., 'USD', 'BRL')
|
|
272
|
-
* - `similarityThreshold`: Minimum similarity score (0-1, default: 0.2)
|
|
273
|
-
* - `baseClothType` (optional): Cloth type of the reference product (e.g., ClothType.BOTTOM)
|
|
274
|
-
* - `targetClothType` (optional): Desired cloth type for complementary products (e.g., ClothType.TOP)
|
|
275
|
-
* - `page`: Page number for pagination (default: 1)
|
|
276
|
-
* - `perPage`: Items per page (default: 20)
|
|
277
|
-
* - `ageRange`: Target age range (optional)
|
|
278
|
-
* - `gender`: User gender (optional)
|
|
279
|
-
* - `style`: Preferred style hint (optional)
|
|
280
|
-
* - `color`: Main color of interest (optional)
|
|
281
|
-
* - `productClass`: Target product class (optional)
|
|
282
|
-
* - `filterByWhatFitsMe`: Apply What Fits Me logic (optional)
|
|
283
|
-
* - `personaHash`: User persona hash for personalization (optional)
|
|
284
|
-
*
|
|
285
|
-
* @returns Promise resolving to complementary product recommendations with:
|
|
286
|
-
* - `baseProduct`: The reference product information
|
|
287
|
-
* - `complementary`: Array of complementary product pairs
|
|
288
|
-
* - `page`: Current page number
|
|
289
|
-
* - `perPage`: Number of items per page
|
|
290
|
-
* - `total`: Total number of complementary products found
|
|
291
|
-
* - `invalidPersonaHash`: Whether the persona hash is invalid/expired
|
|
292
|
-
*
|
|
293
|
-
* @throws {ApiError} if the HTTP status is not 2xx or on network failure
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* ```typescript
|
|
297
|
-
* const complementaryProducts = await aiImageService.searchComplementaryByPermalink({
|
|
298
|
-
* tenantId: 123,
|
|
299
|
-
* collectionName: "products",
|
|
300
|
-
* sid: "session123",
|
|
301
|
-
* sizeSystem: "BR",
|
|
302
|
-
* locale: "pt-BR",
|
|
303
|
-
* currency: "BRL",
|
|
304
|
-
* productId: "12345",
|
|
305
|
-
* similarityThreshold: 0.3,
|
|
306
|
-
* baseClothType: ClothType.BOTTOM,
|
|
307
|
-
* targetClothType: ClothType.TOP,
|
|
308
|
-
* page: 1,
|
|
309
|
-
* perPage: 10,
|
|
310
|
-
* style: "Casual",
|
|
311
|
-
* color: "blue"
|
|
312
|
-
* });
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
searchComplementaryByPermalink(t) {
|
|
316
|
-
const e = `${this.endpoint}/image-search/complementary-by-permalink`;
|
|
317
|
-
return a(e, {
|
|
318
|
-
method: "POST",
|
|
319
|
-
headers: { "Content-Type": "application/json" },
|
|
320
|
-
body: JSON.stringify(t)
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
182
|
}
|
|
324
183
|
class T {
|
|
325
184
|
constructor(t) {
|
|
@@ -377,7 +236,7 @@ class T {
|
|
|
377
236
|
}
|
|
378
237
|
}
|
|
379
238
|
}
|
|
380
|
-
class
|
|
239
|
+
class E {
|
|
381
240
|
constructor(t) {
|
|
382
241
|
this.endpoint = t.getEndpoint("fashionLooks");
|
|
383
242
|
}
|
|
@@ -438,9 +297,9 @@ const O = [
|
|
|
438
297
|
u,
|
|
439
298
|
S,
|
|
440
299
|
T,
|
|
441
|
-
|
|
300
|
+
E
|
|
442
301
|
];
|
|
443
|
-
function
|
|
302
|
+
function m(i = {}) {
|
|
444
303
|
const t = new l(i), e = O.map((n) => new n(t)), s = {};
|
|
445
304
|
return e.forEach((n) => {
|
|
446
305
|
[
|
|
@@ -453,7 +312,7 @@ function E(i = {}) {
|
|
|
453
312
|
});
|
|
454
313
|
}), s;
|
|
455
314
|
}
|
|
456
|
-
const
|
|
315
|
+
const f = {
|
|
457
316
|
TOP: "TOP",
|
|
458
317
|
BOTTOM: "BOTTOM",
|
|
459
318
|
SHOE_ACCESSORY: "SHOE_ACCESSORY",
|
|
@@ -464,7 +323,7 @@ const y = {
|
|
|
464
323
|
WETSUIT_FULL_BODY: "WETSUIT_FULL_BODY",
|
|
465
324
|
WETSUIT_BOTTOM: "WETSUIT_BOTTOM",
|
|
466
325
|
WETSUIT_TOP: "WETSUIT_TOP"
|
|
467
|
-
},
|
|
326
|
+
}, g = {
|
|
468
327
|
T_SHIRT: "t-shirt",
|
|
469
328
|
SHIRT: "shirt",
|
|
470
329
|
BLOUSE: "blouse",
|
|
@@ -506,7 +365,7 @@ const y = {
|
|
|
506
365
|
WETSUIT: "wetsuit"
|
|
507
366
|
};
|
|
508
367
|
export {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
368
|
+
f as ClothType,
|
|
369
|
+
g as ProductClass,
|
|
370
|
+
m as createClient
|
|
512
371
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,
|
|
1
|
+
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["sizebay-core-sdk"]={}))})(this,(function(i){"use strict";const c={tracker:{production:"https://data-event-service.internalsizebay.com",development:"https://data-event-service-dev.internalsizebay.com"},aiImageService:{production:"https://ai-image-service.internalsizebay.com",development:"https://ai-image-service-dev.internalsizebay.com"},session:{production:"https://vfr-v3-production.sizebay.technology/api/me",development:"https://vfr-v3-staging.sizebay.eu/api/me"},fashionLooks:{production:"https://fashion-looks.internalsizebay.com",development:"https://fashion-looks-dev.internalsizebay.com"}};class l{constructor(e){const t=e.env||"development";this.serviceOverrides=e.services||{},this.endpoints={};for(const s in c)if(Object.prototype.hasOwnProperty.call(c,s)){const o=c[s][t];if(!o)continue;this.endpoints[s]=o}}getEndpoint(e){const t=this.endpoints[e];if(!t)throw new Error(`Endpoint for service '${e}' is not configured.`);return t}getServiceConfig(e){return this.serviceOverrides[e]||{}}}class u{constructor(e){this.endpoint=e.getEndpoint("tracker")}async track(e,t){const s={eventName:e,...t},n=new URL(`${this.endpoint}/events`);try{const o=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok){const a=await o.text();throw new Error(`Request error: ${o.status} - ${a}`)}try{return await o.json()}catch{return{statusCode:201,message:"Event successfully created."}}}catch(o){throw o}}}class d extends Error{constructor(e,t){let s;try{const n=JSON.parse(t);s=(n==null?void 0:n.message)||t}catch{s=t}super(s),this.statusCode=e,this.details=t,Object.setPrototypeOf(this,d.prototype)}}async function p(r,e){let t;try{t=await fetch(r,e)}catch(n){throw new d(0,n.message)}const s=await t.text();if(!t.ok)throw new d(t.status,s);return JSON.parse(s)}class S{constructor(e){this.endpoint=e.getEndpoint("aiImageService")}appendQueryParams(e,t){Object.entries(t).forEach(([s,n])=>{n!=null&&e.searchParams.append(s,String(n))})}getSimilarProducts(e){const t=new URL(`${this.endpoint}/recommendations/similar`);return this.appendQueryParams(t,e),p(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}getComplementaryProducts(e){const t=new URL(`${this.endpoint}/recommendations/complementary`);return this.appendQueryParams(t,e),p(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}searchSimilarByImage(e){const t=`${this.endpoint}/image-search/similar`;return p(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}searchComplementaryByImage(e){const t=`${this.endpoint}/image-search/complementary`;return p(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}class T{constructor(e){this.sid=null,this.sessionId=null;const t=e.getEndpoint("session");this.sessionEndpoint=`${t}/`,this.profileEndpoint=`${t}/user/profile`}async getSessionInfo(){if(this.sid&&this.sessionId!==null)return{sid:this.sid,sessionId:this.sessionId};const e=await fetch(this.sessionEndpoint,{credentials:"include"});if(!e.ok){const s=await e.text();throw new Error(`Failed to fetch session info: ${e.status} – ${s}`)}const t=await e.json();return this.sid=t.catalogUser.id,this.sessionId=t.sessionId,{sid:this.sid,sessionId:this.sessionId}}async sendProfile(e,t){const s=t??(await this.getSessionInfo()).sid,n=new URL(this.profileEndpoint);n.searchParams.set("sid",s);const o=await fetch(n.toString(),{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:s,id:null,...e})});if(!o.ok){const a=await o.text();throw new Error(`Failed to send profile: ${o.status} – ${a}`)}}}class f{constructor(e){this.endpoint=e.getEndpoint("fashionLooks")}appendQueryParams(e,t){Object.entries(t).forEach(([s,n])=>{n!=null&&e.searchParams.append(s,String(n))})}getGroupedLooks(e){const t=new URL(`${this.endpoint}/api/public/grouped-looks`);return this.appendQueryParams(t,e),p(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}getGroupedLookById(e,t){const s=new URL(`${this.endpoint}/api/public/grouped-looks/${e}`);return s.searchParams.set("tenantId",String(t)),p(s.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}}const O=[u,S,T,f];function E(r={}){const e=new l(r),t=O.map(n=>new n(e)),s={};return t.forEach(n=>{[...Object.getOwnPropertyNames(n),...Object.getOwnPropertyNames(Object.getPrototypeOf(n))].forEach(a=>{if(a==="constructor")return;const h=n[a];typeof h=="function"&&(s[a]||(s[a]=(...g)=>h.apply(n,g)))})}),s}const m={TOP:"TOP",BOTTOM:"BOTTOM",SHOE_ACCESSORY:"SHOE_ACCESSORY",FULL_BODY:"FULL_BODY",UNDERWEAR_FULL_BODY:"UNDERWEAR_FULL_BODY",UNDERWEAR_BOTTOM:"UNDERWEAR_BOTTOM",UNDERWEAR_TOP:"UNDERWEAR_TOP",WETSUIT_FULL_BODY:"WETSUIT_FULL_BODY",WETSUIT_BOTTOM:"WETSUIT_BOTTOM",WETSUIT_TOP:"WETSUIT_TOP"},y={T_SHIRT:"t-shirt",SHIRT:"shirt",BLOUSE:"blouse",SWEATER:"sweater",HOODIE:"hoodie",JACKET:"jacket",COAT:"coat",CARDIGAN:"cardigan",BLAZER:"blazer",VEST:"vest",SWEATSHIRT:"sweatshirt",POLO_SHIRT:"polo shirt",TANK_TOP:"tank top",SKIRT:"skirt",TROUSERS:"trousers",JEANS:"jeans",SHORTS:"shorts",SNEAKERS:"sneakers",RUNNING_SHOES:"running shoes",BOOTS:"boots",ANKLE_BOOTS:"ankle boots",HIGH_HEELS:"high heels",FLATS:"flats",LOAFERS:"loafers",OXFORDS:"oxfords",SLIPPERS:"slippers",SANDALS:"sandals",DRESS:"dress",JUMPSUIT:"jumpsuit",SUIT:"suit",PANTIES:"panties",BRA:"bra",BIKINI:"bikini",BRIEFS:"briefs",BOXERS:"boxers",THONG:"thong",SWIMSUIT:"swimsuit",ONE_PIECE_SWIMSUIT:"one-piece swimsuit",WETSUIT:"wetsuit"};i.ClothType=m,i.ProductClass=y,i.createClient=E,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -4,8 +4,6 @@ export * from './params/get-similar-products.dto';
|
|
|
4
4
|
export * from './params/get-complementary-products.dto';
|
|
5
5
|
export * from './params/get-similar-by-image.dto';
|
|
6
6
|
export * from './params/get-complementary-by-image.dto';
|
|
7
|
-
export * from './params/get-similar-by-permalink.dto';
|
|
8
|
-
export * from './params/get-complementary-by-permalink.dto';
|
|
9
7
|
export * from './responses/get-similar-products-response.dto';
|
|
10
8
|
export * from './responses/get-complementary-products-response.dto';
|
|
11
9
|
export * from './responses/get-complementary-products-by-image-response.dto';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sizebay-core-sdk",
|
|
3
|
-
"version": "1.13.0
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "A SDK designed for integrating multiple services (such as event tracking, AI services, etc.) into your application.",
|
|
5
5
|
"main": "dist/sizebay-core-sdk.umd.js",
|
|
6
6
|
"module": "dist/sizebay-core-sdk.es.js",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseSearchParams } from '../base/base-search.dto';
|
|
2
|
-
import { ProductClass } from '../../common/product-class.type';
|
|
3
|
-
import { ClothType } from '../../common/cloth-type.type';
|
|
4
|
-
export interface GetComplementaryByPermalinkBodyDto extends BaseSearchParams {
|
|
5
|
-
permalink?: string;
|
|
6
|
-
productId?: string;
|
|
7
|
-
similarityThreshold: number;
|
|
8
|
-
baseClothType?: ClothType;
|
|
9
|
-
targetClothType?: ClothType;
|
|
10
|
-
ageRange?: string;
|
|
11
|
-
gender?: string;
|
|
12
|
-
style?: string;
|
|
13
|
-
color?: string;
|
|
14
|
-
productClass?: ProductClass;
|
|
15
|
-
page?: number;
|
|
16
|
-
perPage?: number;
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseSearchParams } from '../base/base-search.dto';
|
|
2
|
-
import { ProductClass } from '../../common/product-class.type';
|
|
3
|
-
import { ClothType } from '../../common/cloth-type.type';
|
|
4
|
-
export interface GetSimilarByPermalinkBodyDto extends BaseSearchParams {
|
|
5
|
-
permalink?: string;
|
|
6
|
-
productId?: string;
|
|
7
|
-
ageRange?: string;
|
|
8
|
-
gender?: string;
|
|
9
|
-
style?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
productClass?: ProductClass;
|
|
12
|
-
clothType?: ClothType;
|
|
13
|
-
page?: number;
|
|
14
|
-
perPage?: number;
|
|
15
|
-
similarityThreshold?: number;
|
|
16
|
-
}
|