sizebay-core-sdk 1.13.0-dev.4 → 1.13.0-dev.6
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.md
CHANGED
|
@@ -318,7 +318,7 @@ 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
|
-
| `
|
|
321
|
+
| `language` | Language | No | Language/locale for filtering localizations.<br>Use this to get product information in the specified language. |
|
|
322
322
|
<!-- /DOCGEN -->
|
|
323
323
|
|
|
324
324
|
#### Returns
|
|
@@ -345,16 +345,17 @@ console.log(looks.data, looks.total);
|
|
|
345
345
|
|
|
346
346
|
---
|
|
347
347
|
|
|
348
|
-
### `getGroupedLookById(id: string, tenantId: number): Promise<GroupedLookResponseDto>`
|
|
348
|
+
### `getGroupedLookById(id: string, tenantId: number, language: Language): Promise<GroupedLookResponseDto>`
|
|
349
349
|
|
|
350
350
|
Get a specific grouped look by ID (Public endpoint).
|
|
351
351
|
|
|
352
352
|
#### Parameters
|
|
353
353
|
|
|
354
|
-
| Parameter | Type
|
|
355
|
-
| ----------- |
|
|
356
|
-
| `id` | string
|
|
357
|
-
| `tenantId` | number
|
|
354
|
+
| Parameter | Type | Required | Description |
|
|
355
|
+
| ----------- | -------- | :------: | ----------------------------------------------------------------- |
|
|
356
|
+
| `id` | string | Yes | Grouped look UUID |
|
|
357
|
+
| `tenantId` | number | Yes | Tenant ID |
|
|
358
|
+
| `language` | Language | Yes | Language/locale for filtering localizations (e.g., pt-BR, en-US) |
|
|
358
359
|
|
|
359
360
|
#### Returns
|
|
360
361
|
|
|
@@ -379,7 +380,7 @@ Get a specific grouped look by ID (Public endpoint).
|
|
|
379
380
|
#### Example
|
|
380
381
|
|
|
381
382
|
```typescript
|
|
382
|
-
const look = await client.getGroupedLookById('uuid-here', 1);
|
|
383
|
+
const look = await client.getGroupedLookById('uuid-here', 1, 'en-US');
|
|
383
384
|
console.log(look.id, look.style, look.tryons);
|
|
384
385
|
```
|
|
385
386
|
|
|
@@ -573,87 +574,48 @@ ClothType.SHOE_ACCESSORY // For shoes, accessories
|
|
|
573
574
|
| `feedback` | GroupedLookFeedbackResponseDto | No | User feedback for this look, if any has been submitted.<br>Use to display feedback or quality metrics to users. |
|
|
574
575
|
<!-- /DOCGEN -->
|
|
575
576
|
|
|
576
|
-
### `
|
|
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`
|
|
577
|
+
### `GroupedLookProductsDto`
|
|
605
578
|
|
|
606
|
-
<!-- DOCGEN:params
|
|
579
|
+
<!-- DOCGEN:params GroupedLookProductsDto -->
|
|
607
580
|
| Field | Type | Required | Description |
|
|
608
581
|
| ----- | ---- | :------: | ----------- |
|
|
609
|
-
| `
|
|
610
|
-
| `
|
|
611
|
-
| `
|
|
612
|
-
| `
|
|
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. |
|
|
582
|
+
| `top` | FashionLookProductDto | No | Top product information (shirts, blouses, jackets, etc.).<br>Contains complete product details with localizations. |
|
|
583
|
+
| `bottom` | FashionLookProductDto | No | Bottom product information (pants, skirts, shorts, etc.).<br>Contains complete product details with localizations. |
|
|
584
|
+
| `shoe` | FashionLookProductDto | No | Shoe product information.<br>Contains complete product details with localizations. |
|
|
585
|
+
| `bag` | FashionLookProductDto | No | Bag product information (handbags, backpacks, etc.).<br>Contains complete product details with localizations. |
|
|
624
586
|
<!-- /DOCGEN -->
|
|
625
587
|
|
|
626
|
-
### `
|
|
588
|
+
### `FashionLookProductDto`
|
|
627
589
|
|
|
628
|
-
<!-- DOCGEN:params
|
|
590
|
+
<!-- DOCGEN:params FashionLookProductDto -->
|
|
629
591
|
| Field | Type | Required | Description |
|
|
630
592
|
| ----- | ---- | :------: | ----------- |
|
|
631
|
-
| `id` | string | Yes |
|
|
632
|
-
| `
|
|
633
|
-
| `
|
|
634
|
-
| `
|
|
635
|
-
| `
|
|
593
|
+
| `id` | string | Yes | Product ID.<br>Use to identify the product or create product links. |
|
|
594
|
+
| `imageUrl` | string | Yes | Product image URL.<br>Use to display product images in galleries or product cards. |
|
|
595
|
+
| `gender` | string | No | Product gender.<br>Use to filter or categorize products by target gender. |
|
|
596
|
+
| `ageGroup` | string | No | Product age group.<br>Use to filter or categorize products by target age. |
|
|
597
|
+
| `brand` | string | No | Product brand name.<br>Use to display brand information or filter by brand. |
|
|
598
|
+
| `category` | string | No | Product category (e.g., 'TOP', 'BOTTOM', 'SHOE_ACCESSORY').<br>Use to categorize products or filter by type. |
|
|
599
|
+
| `internalData` | ProductInternalData | Yes | Product internal data with localizations.<br>Contains locale-specific information for internationalization.<br>Use to display product information in the user's language. |
|
|
636
600
|
<!-- /DOCGEN -->
|
|
637
601
|
|
|
638
|
-
### `
|
|
602
|
+
### `ProductInternalData`
|
|
639
603
|
|
|
640
|
-
<!-- DOCGEN:params
|
|
604
|
+
<!-- DOCGEN:params ProductInternalData -->
|
|
641
605
|
| Field | Type | Required | Description |
|
|
642
606
|
| ----- | ---- | :------: | ----------- |
|
|
643
|
-
| `
|
|
644
|
-
| `total` | number | Yes | Total number of looks matching your filters across all pages.<br>Use this to show "Showing X of Y looks" or calculate total pages. |
|
|
645
|
-
| `pagination` | PaginationInfo | Yes | Pagination information for navigating between pages.<br>Use this to implement pagination controls in your UI. |
|
|
607
|
+
| `localizations` | { [locale: string]: ProductLocalization; } | No | Product localizations by locale code (e.g., 'en-US', 'pt-BR', 'es-ES', 'it-IT').<br>Each locale contains availability, description, link, and title.<br>Use to display product information in the user's language. |
|
|
646
608
|
<!-- /DOCGEN -->
|
|
647
609
|
|
|
648
|
-
### `
|
|
610
|
+
### `ProductLocalization`
|
|
649
611
|
|
|
650
|
-
<!-- DOCGEN:params
|
|
612
|
+
<!-- DOCGEN:params ProductLocalization -->
|
|
651
613
|
| Field | Type | Required | Description |
|
|
652
614
|
| ----- | ---- | :------: | ----------- |
|
|
653
|
-
| `
|
|
654
|
-
| `
|
|
655
|
-
| `
|
|
656
|
-
| `
|
|
615
|
+
| `availability` | string | No | Product availability status in this locale.<br>Use to show stock status or availability badges. |
|
|
616
|
+
| `description` | string | No | Product description in this locale.<br>Use to display localized product descriptions. |
|
|
617
|
+
| `link` | string | No | Product page URL in this locale.<br>Use to create localized links to product pages. |
|
|
618
|
+
| `title` | string | No | Product title/name in this locale.<br>Use to display localized product names. |
|
|
657
619
|
<!-- /DOCGEN -->
|
|
658
620
|
|
|
659
621
|
### `BmiGroupDto`
|
|
@@ -708,46 +670,23 @@ Product information organized by garment type. Keys are garment types (e.g., 'to
|
|
|
708
670
|
| `timestamp` | string | Yes | When this feedback was submitted (ISO 8601 format).<br>Use to sort feedback by date or show recent feedback. |
|
|
709
671
|
<!-- /DOCGEN -->
|
|
710
672
|
|
|
711
|
-
### `
|
|
712
|
-
|
|
713
|
-
<!-- DOCGEN:params GroupedLookProductsDto -->
|
|
714
|
-
| Field | Type | Required | Description |
|
|
715
|
-
| ----- | ---- | :------: | ----------- |
|
|
716
|
-
| `top` | FashionLookProductDto | No | Top product information (shirts, blouses, jackets, etc.).<br>Contains complete product details with localizations. |
|
|
717
|
-
| `bottom` | FashionLookProductDto | No | Bottom product information (pants, skirts, shorts, etc.).<br>Contains complete product details with localizations. |
|
|
718
|
-
| `shoe` | FashionLookProductDto | No | Shoe product information.<br>Contains complete product details with localizations. |
|
|
719
|
-
| `bag` | FashionLookProductDto | No | Bag product information (handbags, backpacks, etc.).<br>Contains complete product details with localizations. |
|
|
720
|
-
<!-- /DOCGEN -->
|
|
721
|
-
|
|
722
|
-
### `FashionLookProductDto`
|
|
723
|
-
|
|
724
|
-
<!-- DOCGEN:params FashionLookProductDto -->
|
|
725
|
-
| Field | Type | Required | Description |
|
|
726
|
-
| ----- | ---- | :------: | ----------- |
|
|
727
|
-
| `id` | string | Yes | Product ID.<br>Use to identify the product or create product links. |
|
|
728
|
-
| `imageUrl` | string | Yes | Product image URL.<br>Use to display product images in galleries or product cards. |
|
|
729
|
-
| `gender` | string | No | Product gender.<br>Use to filter or categorize products by target gender. |
|
|
730
|
-
| `ageGroup` | string | No | Product age group.<br>Use to filter or categorize products by target age. |
|
|
731
|
-
| `brand` | string | No | Product brand name.<br>Use to display brand information or filter by brand. |
|
|
732
|
-
| `category` | string | No | Product category (e.g., 'TOP', 'BOTTOM', 'SHOE_ACCESSORY').<br>Use to categorize products or filter by type. |
|
|
733
|
-
| `internalData` | ProductInternalData | Yes | Product internal data with localizations.<br>Contains locale-specific information for internationalization.<br>Use to display product information in the user's language. |
|
|
734
|
-
<!-- /DOCGEN -->
|
|
735
|
-
|
|
736
|
-
### `ProductInternalData`
|
|
673
|
+
### `GroupedLooksListResponse`
|
|
737
674
|
|
|
738
|
-
<!-- DOCGEN:params
|
|
675
|
+
<!-- DOCGEN:params GroupedLooksListResponse -->
|
|
739
676
|
| Field | Type | Required | Description |
|
|
740
677
|
| ----- | ---- | :------: | ----------- |
|
|
741
|
-
| `
|
|
678
|
+
| `data` | GroupedLookResponseDto[] | Yes | Fashion looks for the current page.<br>Display these looks to users. Each look contains styled outfits with try-on images. |
|
|
679
|
+
| `total` | number | Yes | Total number of looks matching your filters across all pages.<br>Use this to show "Showing X of Y looks" or calculate total pages. |
|
|
680
|
+
| `pagination` | PaginationInfo | Yes | Pagination information for navigating between pages.<br>Use this to implement pagination controls in your UI. |
|
|
742
681
|
<!-- /DOCGEN -->
|
|
743
682
|
|
|
744
|
-
### `
|
|
683
|
+
### `PaginationInfo`
|
|
745
684
|
|
|
746
|
-
<!-- DOCGEN:params
|
|
685
|
+
<!-- DOCGEN:params PaginationInfo -->
|
|
747
686
|
| Field | Type | Required | Description |
|
|
748
687
|
| ----- | ---- | :------: | ----------- |
|
|
749
|
-
| `
|
|
750
|
-
| `
|
|
751
|
-
| `
|
|
752
|
-
| `
|
|
688
|
+
| `limit` | number | Yes | Number of looks returned in this page.<br>Matches the limit parameter you sent in the request. |
|
|
689
|
+
| `offset` | number | Yes | Number of looks skipped to reach this page.<br>Matches the offset parameter you sent in the request. |
|
|
690
|
+
| `hasNext` | boolean | Yes | Whether there are more looks available after this page.<br>Use this to show/hide "Next" button or load more functionality. |
|
|
691
|
+
| `hasPrevious` | boolean | Yes | Whether there are looks before this page.<br>Use this to show/hide "Previous" button. |
|
|
753
692
|
<!-- /DOCGEN -->
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Config } from '../config';
|
|
2
|
-
import { GetGroupedLooksParams, GroupedLooksListResponse, GroupedLookResponseDto } from '../types/fashion-looks';
|
|
2
|
+
import { GetGroupedLooksParams, GroupedLooksListResponse, GroupedLookResponseDto, Language } from '../types/fashion-looks';
|
|
3
3
|
export declare class FashionLooks {
|
|
4
4
|
private endpoint;
|
|
5
5
|
constructor(config: Config);
|
|
6
6
|
private appendQueryParams;
|
|
7
7
|
getGroupedLooks(params: GetGroupedLooksParams): Promise<GroupedLooksListResponse>;
|
|
8
|
-
getGroupedLookById(id: string, tenantId: number): Promise<GroupedLookResponseDto>;
|
|
8
|
+
getGroupedLookById(id: string, tenantId: number, language: Language): Promise<GroupedLookResponseDto>;
|
|
9
9
|
}
|
|
@@ -21,12 +21,12 @@ class l {
|
|
|
21
21
|
constructor(t) {
|
|
22
22
|
const e = t.env || "development";
|
|
23
23
|
this.serviceOverrides = t.services || {}, this.endpoints = {};
|
|
24
|
-
for (const
|
|
25
|
-
if (Object.prototype.hasOwnProperty.call(p,
|
|
26
|
-
const o = p[
|
|
24
|
+
for (const n in p)
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(p, n)) {
|
|
26
|
+
const o = p[n][e];
|
|
27
27
|
if (!o)
|
|
28
28
|
continue;
|
|
29
|
-
this.endpoints[
|
|
29
|
+
this.endpoints[n] = o;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
getEndpoint(t) {
|
|
@@ -46,15 +46,15 @@ class u {
|
|
|
46
46
|
this.endpoint = t.getEndpoint("tracker");
|
|
47
47
|
}
|
|
48
48
|
async track(t, e) {
|
|
49
|
-
const
|
|
49
|
+
const n = {
|
|
50
50
|
eventName: t,
|
|
51
51
|
...e
|
|
52
|
-
},
|
|
52
|
+
}, s = new URL(`${this.endpoint}/events`);
|
|
53
53
|
try {
|
|
54
|
-
const o = await fetch(
|
|
54
|
+
const o = await fetch(s, {
|
|
55
55
|
method: "POST",
|
|
56
56
|
headers: { "Content-Type": "application/json" },
|
|
57
|
-
body: JSON.stringify(
|
|
57
|
+
body: JSON.stringify(n)
|
|
58
58
|
});
|
|
59
59
|
if (!o.ok) {
|
|
60
60
|
const r = await o.text();
|
|
@@ -75,27 +75,27 @@ class u {
|
|
|
75
75
|
}
|
|
76
76
|
class c extends Error {
|
|
77
77
|
constructor(t, e) {
|
|
78
|
-
let
|
|
78
|
+
let n;
|
|
79
79
|
try {
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const s = JSON.parse(e);
|
|
81
|
+
n = (s == null ? void 0 : s.message) || e;
|
|
82
82
|
} catch {
|
|
83
|
-
|
|
83
|
+
n = e;
|
|
84
84
|
}
|
|
85
|
-
super(
|
|
85
|
+
super(n), this.statusCode = t, this.details = e, Object.setPrototypeOf(this, c.prototype);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
async function a(i, t) {
|
|
89
89
|
let e;
|
|
90
90
|
try {
|
|
91
91
|
e = await fetch(i, t);
|
|
92
|
-
} catch (
|
|
93
|
-
throw new c(0,
|
|
92
|
+
} catch (s) {
|
|
93
|
+
throw new c(0, s.message);
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const n = await e.text();
|
|
96
96
|
if (!e.ok)
|
|
97
|
-
throw new c(e.status,
|
|
98
|
-
return JSON.parse(
|
|
97
|
+
throw new c(e.status, n);
|
|
98
|
+
return JSON.parse(n);
|
|
99
99
|
}
|
|
100
100
|
class S {
|
|
101
101
|
constructor(t) {
|
|
@@ -107,8 +107,8 @@ class S {
|
|
|
107
107
|
* @param params - A record of key/value pairs to serialize.
|
|
108
108
|
*/
|
|
109
109
|
appendQueryParams(t, e) {
|
|
110
|
-
Object.entries(e).forEach(([
|
|
111
|
-
|
|
110
|
+
Object.entries(e).forEach(([n, s]) => {
|
|
111
|
+
s != null && t.searchParams.append(n, String(s));
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
@@ -344,9 +344,9 @@ class T {
|
|
|
344
344
|
credentials: "include"
|
|
345
345
|
});
|
|
346
346
|
if (!t.ok) {
|
|
347
|
-
const
|
|
347
|
+
const n = await t.text();
|
|
348
348
|
throw new Error(
|
|
349
|
-
`Failed to fetch session info: ${t.status} – ${
|
|
349
|
+
`Failed to fetch session info: ${t.status} – ${n}`
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
352
|
const e = await t.json();
|
|
@@ -361,13 +361,13 @@ class T {
|
|
|
361
361
|
* @throws {Error} If the HTTP request fails
|
|
362
362
|
*/
|
|
363
363
|
async sendProfile(t, e) {
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
const o = await fetch(
|
|
364
|
+
const n = e ?? (await this.getSessionInfo()).sid, s = new URL(this.profileEndpoint);
|
|
365
|
+
s.searchParams.set("sid", n);
|
|
366
|
+
const o = await fetch(s.toString(), {
|
|
367
367
|
credentials: "include",
|
|
368
368
|
method: "POST",
|
|
369
369
|
headers: { "Content-Type": "application/json" },
|
|
370
|
-
body: JSON.stringify({ userId:
|
|
370
|
+
body: JSON.stringify({ userId: n, id: null, ...t })
|
|
371
371
|
});
|
|
372
372
|
if (!o.ok) {
|
|
373
373
|
const r = await o.text();
|
|
@@ -387,8 +387,8 @@ class m {
|
|
|
387
387
|
* @param params - A record of key/value pairs to serialize.
|
|
388
388
|
*/
|
|
389
389
|
appendQueryParams(t, e) {
|
|
390
|
-
Object.entries(e).forEach(([
|
|
391
|
-
|
|
390
|
+
Object.entries(e).forEach(([n, s]) => {
|
|
391
|
+
s != null && t.searchParams.append(n, String(s));
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
@@ -423,12 +423,13 @@ class m {
|
|
|
423
423
|
*
|
|
424
424
|
* @param id - Fashion look UUID identifier
|
|
425
425
|
* @param tenantId - Tenant ID
|
|
426
|
+
* @param language - Language/locale for filtering localizations (required)
|
|
426
427
|
* @returns Promise resolving to complete fashion look with all try-on variations
|
|
427
428
|
* @throws {ApiError} if the HTTP status is not 2xx (e.g., 404 if not found) or on network failure (4xx or 5xx)
|
|
428
429
|
*/
|
|
429
|
-
getGroupedLookById(t, e) {
|
|
430
|
+
getGroupedLookById(t, e, n) {
|
|
430
431
|
const s = new URL(`${this.endpoint}/api/public/grouped-looks/${t}`);
|
|
431
|
-
return s.searchParams.set("tenantId", String(e)), a(s.toString(), {
|
|
432
|
+
return s.searchParams.set("tenantId", String(e)), s.searchParams.set("language", n), a(s.toString(), {
|
|
432
433
|
method: "GET",
|
|
433
434
|
headers: { "Content-Type": "application/json" }
|
|
434
435
|
});
|
|
@@ -441,17 +442,17 @@ const O = [
|
|
|
441
442
|
m
|
|
442
443
|
];
|
|
443
444
|
function E(i = {}) {
|
|
444
|
-
const t = new l(i), e = O.map((
|
|
445
|
-
return e.forEach((
|
|
445
|
+
const t = new l(i), e = O.map((s) => new s(t)), n = {};
|
|
446
|
+
return e.forEach((s) => {
|
|
446
447
|
[
|
|
447
|
-
...Object.getOwnPropertyNames(
|
|
448
|
-
...Object.getOwnPropertyNames(Object.getPrototypeOf(
|
|
448
|
+
...Object.getOwnPropertyNames(s),
|
|
449
|
+
...Object.getOwnPropertyNames(Object.getPrototypeOf(s))
|
|
449
450
|
].forEach((r) => {
|
|
450
451
|
if (r === "constructor") return;
|
|
451
|
-
const d =
|
|
452
|
-
typeof d == "function" && (
|
|
452
|
+
const d = s[r];
|
|
453
|
+
typeof d == "function" && (n[r] || (n[r] = (...h) => d.apply(s, h)));
|
|
453
454
|
});
|
|
454
|
-
}),
|
|
455
|
+
}), n;
|
|
455
456
|
}
|
|
456
457
|
const y = {
|
|
457
458
|
TOP: "TOP",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i["sizebay-core-sdk"]={}))})(this,(function(i){"use strict";const p={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
|
|
1
|
+
(function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i["sizebay-core-sdk"]={}))})(this,(function(i){"use strict";const p={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 n in p)if(Object.prototype.hasOwnProperty.call(p,n)){const o=p[n][t];if(!o)continue;this.endpoints[n]=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 n={eventName:e,...t},s=new URL(`${this.endpoint}/events`);try{const o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok){const c=await o.text();throw new Error(`Request error: ${o.status} - ${c}`)}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 n;try{const s=JSON.parse(t);n=(s==null?void 0:s.message)||t}catch{n=t}super(n),this.statusCode=e,this.details=t,Object.setPrototypeOf(this,d.prototype)}}async function r(a,e){let t;try{t=await fetch(a,e)}catch(s){throw new d(0,s.message)}const n=await t.text();if(!t.ok)throw new d(t.status,n);return JSON.parse(n)}class S{constructor(e){this.endpoint=e.getEndpoint("aiImageService")}appendQueryParams(e,t){Object.entries(t).forEach(([n,s])=>{s!=null&&e.searchParams.append(n,String(s))})}getSimilarProducts(e){const t=new URL(`${this.endpoint}/recommendations/similar`);return this.appendQueryParams(t,e),r(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}getComplementaryProducts(e){const t=new URL(`${this.endpoint}/recommendations/complementary`);return this.appendQueryParams(t,e),r(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}searchSimilarByImage(e){const t=`${this.endpoint}/image-search/similar`;return r(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}searchComplementaryByImage(e){const t=`${this.endpoint}/image-search/complementary`;return r(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}searchSimilarByPermalink(e){const t=`${this.endpoint}/image-search/similar-by-permalink`;return r(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}searchComplementaryByPermalink(e){const t=`${this.endpoint}/image-search/complementary-by-permalink`;return r(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 n=await e.text();throw new Error(`Failed to fetch session info: ${e.status} – ${n}`)}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 n=t??(await this.getSessionInfo()).sid,s=new URL(this.profileEndpoint);s.searchParams.set("sid",n);const o=await fetch(s.toString(),{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:n,id:null,...e})});if(!o.ok){const c=await o.text();throw new Error(`Failed to send profile: ${o.status} – ${c}`)}}}class m{constructor(e){this.endpoint=e.getEndpoint("fashionLooks")}appendQueryParams(e,t){Object.entries(t).forEach(([n,s])=>{s!=null&&e.searchParams.append(n,String(s))})}getGroupedLooks(e){const t=new URL(`${this.endpoint}/api/public/grouped-looks`);return this.appendQueryParams(t,e),r(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}getGroupedLookById(e,t,n){const s=new URL(`${this.endpoint}/api/public/grouped-looks/${e}`);return s.searchParams.set("tenantId",String(t)),s.searchParams.set("language",n),r(s.toString(),{method:"GET",headers:{"Content-Type":"application/json"}})}}const O=[u,S,T,m];function f(a={}){const e=new l(a),t=O.map(s=>new s(e)),n={};return t.forEach(s=>{[...Object.getOwnPropertyNames(s),...Object.getOwnPropertyNames(Object.getPrototypeOf(s))].forEach(c=>{if(c==="constructor")return;const h=s[c];typeof h=="function"&&(n[c]||(n[c]=(...g)=>h.apply(s,g)))})}),n}const E={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=E,i.ProductClass=y,i.createClient=f,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -4,6 +4,7 @@ export type Style = 'casual' | 'formal' | 'party' | 'night' | 'sport' | 'beach'
|
|
|
4
4
|
export type Collection = 'spring' | 'summer' | 'fall' | 'winter';
|
|
5
5
|
export type GroupedLookStatus = 'processing' | 'active' | 'inactive' | 'error' | 'highlight';
|
|
6
6
|
export type SortOrder = 'asc' | 'desc';
|
|
7
|
+
export type Language = 'pt-BR' | 'en-US' | 'es-ES' | 'it-IT' | 'fr-FR' | 'de-DE';
|
|
7
8
|
export interface GetGroupedLooksParams {
|
|
8
9
|
tenantId: number;
|
|
9
10
|
limit?: number;
|
|
@@ -14,5 +15,5 @@ export interface GetGroupedLooksParams {
|
|
|
14
15
|
ageGroup?: AgeGroup;
|
|
15
16
|
style?: Style;
|
|
16
17
|
collection?: Collection;
|
|
17
|
-
|
|
18
|
+
language?: Language;
|
|
18
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sizebay-core-sdk",
|
|
3
|
-
"version": "1.13.0-dev.
|
|
3
|
+
"version": "1.13.0-dev.6",
|
|
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",
|