sizebay-core-sdk 1.10.0-dev.3 → 1.10.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.md
CHANGED
|
@@ -93,7 +93,8 @@ Fetch products similar to a reference.
|
|
|
93
93
|
<!-- DOCGEN:params GetSimilarProductsParams -->
|
|
94
94
|
| Field | Type | Required | Description |
|
|
95
95
|
| ----- | ---- | :------: | ----------- |
|
|
96
|
-
| `permalink` | string |
|
|
96
|
+
| `permalink` | string | No | The URL permalink of the reference product for the similarity search. |
|
|
97
|
+
| `productId` | string | No | Product ID (either permalink or productId must be provided). |
|
|
97
98
|
| `page` | number | No | The page number for pagination. |
|
|
98
99
|
| `perPage` | number | No | The number of items to return per page. |
|
|
99
100
|
| `similarityThreshold` | number | No | The minimum similarity score (0-1) for the results. |
|
|
@@ -111,13 +112,11 @@ Fetch products similar to a reference.
|
|
|
111
112
|
|
|
112
113
|
<!-- DOCGEN:returns GetSimilarProductsResponse -->
|
|
113
114
|
> **`GetSimilarProductsResponse`**
|
|
114
|
-
> * `data`: `ProductDto[]` — An array of products that are visually similar to the reference item.
|
|
115
|
-
The results are ordered by their similarity score.
|
|
115
|
+
> * `data`: `ProductDto[]` — An array of products that are visually similar to the reference item.<br>The results are ordered by their similarity score.
|
|
116
116
|
> * `page`: `number` — The current page number of the results.
|
|
117
117
|
> * `perPage`: `number` — The number of items per page.
|
|
118
118
|
> * `total`: `number` — The total number of similar products found.
|
|
119
|
-
> * `invalidPersonaHash`: `boolean` — Indicates if the provided persona hash is invalid or expired
|
|
120
|
-
which may affect personalized results.
|
|
119
|
+
> * `invalidPersonaHash`: `boolean` — Indicates if the provided persona hash is invalid or expired,<br>which may affect personalized results.
|
|
121
120
|
<!-- /DOCGEN -->
|
|
122
121
|
|
|
123
122
|
#### Example
|
|
@@ -147,10 +146,9 @@ Retrieve pairs of complementary products.
|
|
|
147
146
|
<!-- DOCGEN:params GetComplementaryProductsParams -->
|
|
148
147
|
| Field | Type | Required | Description |
|
|
149
148
|
| ----- | ---- | :------: | ----------- |
|
|
150
|
-
| `permalink` | string |
|
|
151
|
-
|
|
152
|
-
| `similarityThreshold` | number | Yes | The minimum similarity score (0-1) for recommended products.
|
|
153
|
-
A higher value yields more similar items, while a lower value provides more variety. |
|
|
149
|
+
| `permalink` | string | No | The URL permalink of the reference product.<br>Its style, color, and category are used to find matching items. |
|
|
150
|
+
| `productId` | string | No | Product ID (either permalink or productId must be provided). |
|
|
151
|
+
| `similarityThreshold` | number | Yes | The minimum similarity score (0-1) for recommended products.<br>A higher value yields more similar items, while a lower value provides more variety. |
|
|
154
152
|
| `tenantId` | number | Yes | Tenant (client) ID. |
|
|
155
153
|
| `collectionName` | string | Yes | Embeddings collection name (namespace). |
|
|
156
154
|
| `sid` | string | Yes | Session identifier (`sid`) for the user. |
|
|
@@ -165,11 +163,9 @@ A higher value yields more similar items, while a lower value provides more vari
|
|
|
165
163
|
|
|
166
164
|
<!-- DOCGEN:returns GetComplementaryProductsResponse -->
|
|
167
165
|
> **`GetComplementaryProductsResponse`**
|
|
168
|
-
> * `baseProduct`: `ProductDto` — The reference product used to generate recommendations.
|
|
169
|
-
This is the item that corresponds to the permalink from the request.
|
|
166
|
+
> * `baseProduct`: `ProductDto` — The reference product used to generate recommendations.<br>This is the item that corresponds to the permalink from the request.
|
|
170
167
|
> * `complementary`: `ComplementaryPairDto[]` — A list of recommended pairs of products that are complementary to the base product.
|
|
171
|
-
> * `invalidPersonaHash`: `boolean` — Indicates if the provided persona hash is invalid or has expired.
|
|
172
|
-
If true, personalization may be affected.
|
|
168
|
+
> * `invalidPersonaHash`: `boolean` — Indicates if the provided persona hash is invalid or has expired.<br>If true, personalization may be affected.
|
|
173
169
|
<!-- /DOCGEN -->
|
|
174
170
|
|
|
175
171
|
#### Example
|
|
@@ -342,34 +338,20 @@ Sends user profile data. Uses cached `sid` if not provided.
|
|
|
342
338
|
<!-- DOCGEN:params SessionProfilePayload -->
|
|
343
339
|
| Field | Type | Required | Description |
|
|
344
340
|
| ----- | ---- | :------: | ----------- |
|
|
345
|
-
| `name` | string | Yes | Internal profile identifier or display name for the user.
|
|
346
|
-
|
|
347
|
-
| `
|
|
348
|
-
|
|
349
|
-
| `
|
|
350
|
-
|
|
351
|
-
| `
|
|
352
|
-
|
|
353
|
-
| `age` | string | Yes | User's age for age-appropriate sizing and recommendations.
|
|
354
|
-
Stored as string to accommodate various age formats. |
|
|
355
|
-
| `is3dFeel` | boolean | Yes | Feature flag indicating if advanced 3D fit visualization is enabled.
|
|
356
|
-
Affects the level of detail in size recommendations and fit analysis. |
|
|
357
|
-
| `weight` | string | Yes | User's body weight in the unit system specified by isMetric.
|
|
358
|
-
Used for comprehensive fit analysis and size calculations. |
|
|
359
|
-
| `height` | string | Yes | User's height in the unit system specified by isMetric.
|
|
360
|
-
Critical measurement for accurate size recommendations. |
|
|
341
|
+
| `name` | string | Yes | Internal profile identifier or display name for the user.<br>Typically used for analytics and user identification within Sizebay's system. |
|
|
342
|
+
| `skinType` | number | Yes | Skin tone classification used for color matching and style recommendations.<br>Numerical value representing different skin tone categories. |
|
|
343
|
+
| `footShape` | string | Yes | Foot shape classification for footwear recommendations.<br>Used to provide better shoe fit analysis when available. |
|
|
344
|
+
| `gender` | string | Yes | User's gender for size system selection and fit calculations.<br>Uses single character format as defined by Sizebay's standards. |
|
|
345
|
+
| `age` | string | Yes | User's age for age-appropriate sizing and recommendations.<br>Stored as string to accommodate various age formats. |
|
|
346
|
+
| `is3dFeel` | boolean | Yes | Feature flag indicating if advanced 3D fit visualization is enabled.<br>Affects the level of detail in size recommendations and fit analysis. |
|
|
347
|
+
| `weight` | string | Yes | User's body weight in the unit system specified by isMetric.<br>Used for comprehensive fit analysis and size calculations. |
|
|
348
|
+
| `height` | string | Yes | User's height in the unit system specified by isMetric.<br>Critical measurement for accurate size recommendations. |
|
|
361
349
|
| `measures` | { insoleLength: number; poundWeight: number | null; } | Yes | Additional precise body measurements for enhanced fit accuracy. |
|
|
362
|
-
| `product` | string | Yes | Product context or identifier related to the current profiling session.
|
|
363
|
-
|
|
364
|
-
| `
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
| `bodyShapeChest` | number | Yes | Chest/bust body shape index for clothing fit analysis.
|
|
368
|
-
Numerical value representing body proportions in the chest area. |
|
|
369
|
-
| `bodyShapeHip` | number | Yes | Hip body shape index for lower body clothing fit analysis.
|
|
370
|
-
Numerical value representing body proportions in the hip area. |
|
|
371
|
-
| `bodyShapeWaist` | number | Yes | Waist body shape index for torso fit analysis.
|
|
372
|
-
Numerical value representing body proportions in the waist area. |
|
|
350
|
+
| `product` | string | Yes | Product context or identifier related to the current profiling session.<br>Can link the profile to a specific product being viewed. |
|
|
351
|
+
| `isMetric` | boolean | Yes | Unit system preference for all measurements and recommendations.<br>- true: Metric system (cm, kg)<br>- false: Imperial system (inches, lbs) |
|
|
352
|
+
| `bodyShapeChest` | number | Yes | Chest/bust body shape index for clothing fit analysis.<br>Numerical value representing body proportions in the chest area. |
|
|
353
|
+
| `bodyShapeHip` | number | Yes | Hip body shape index for lower body clothing fit analysis.<br>Numerical value representing body proportions in the hip area. |
|
|
354
|
+
| `bodyShapeWaist` | number | Yes | Waist body shape index for torso fit analysis.<br>Numerical value representing body proportions in the waist area. |
|
|
373
355
|
<!-- /DOCGEN -->
|
|
374
356
|
|
|
375
357
|
#### Example
|
|
@@ -421,8 +403,7 @@ await client.sendProfile(profilePayload);
|
|
|
421
403
|
| `style` | string | Yes | The style classification of the product. |
|
|
422
404
|
| `gtin` | string | Yes | The Global Trade Item Number (GTIN) for the product. |
|
|
423
405
|
| `additionalImageLinks` | string[] | Yes | A list of additional image URLs for the product. |
|
|
424
|
-
| `suitableSizes` | SuitableSizeDto[] | No | Size recommendations from Sizebay's What Fits Me feature, including comfort scores.
|
|
425
|
-
This is populated when personalized sizing is available. |
|
|
406
|
+
| `suitableSizes` | SuitableSizeDto[] | No | Size recommendations from Sizebay's What Fits Me feature, including comfort scores.<br>This is populated when personalized sizing is available. |
|
|
426
407
|
| `clothType` | ClothType | No | The standardized clothing type, used for recommendations and size chart matching. |
|
|
427
408
|
<!-- /DOCGEN -->
|
|
428
409
|
|
|
@@ -442,14 +423,9 @@ This is populated when personalized sizing is available. |
|
|
|
442
423
|
<!-- DOCGEN:params SuitableSizeDto -->
|
|
443
424
|
| Field | Type | Required | Description |
|
|
444
425
|
| ----- | ---- | :------: | ----------- |
|
|
445
|
-
| `size` | string | Yes | Size label as defined in the product catalog (e.g., "M", "42", "8-10").
|
|
446
|
-
|
|
447
|
-
| `
|
|
448
|
-
- 0.0 = Very uncomfortable fit
|
|
449
|
-
- 0.5 = Adequate fit
|
|
450
|
-
- 1.0 = Perfect comfortable fit |
|
|
451
|
-
| `value` | boolean | No | Boolean indicator of whether this size is considered suitable for the user.
|
|
452
|
-
Based on comfort threshold and fit analysis algorithms. |
|
|
426
|
+
| `size` | string | Yes | Size label as defined in the product catalog (e.g., "M", "42", "8-10").<br>Uses the same format as the store's size system. |
|
|
427
|
+
| `comfortable` | number | Yes | AI-calculated comfort score ranging from 0 to 1, where a lower value indicates a better fit:<br>- 0.0 = Perfect, comfortable fit<br>- 0.5 = Adequate, but potentially tight/loose fit<br>- 1.0 = Very uncomfortable fit |
|
|
428
|
+
| `value` | boolean | No | Boolean indicator of whether this size is considered suitable for the user.<br>Based on comfort threshold and fit analysis algorithms. |
|
|
453
429
|
<!-- /DOCGEN -->
|
|
454
430
|
|
|
455
431
|
### `ComplementaryPairDto`
|
|
@@ -457,10 +433,8 @@ Based on comfort threshold and fit analysis algorithms. |
|
|
|
457
433
|
<!-- DOCGEN:params ComplementaryPairDto -->
|
|
458
434
|
| Field | Type | Required | Description |
|
|
459
435
|
| ----- | ---- | :------: | ----------- |
|
|
460
|
-
| `first` | ProductDto | Yes | First recommended product that complements the base product sent in the request.
|
|
461
|
-
|
|
462
|
-
| `secondary` | ProductDto | No | Second recommended product that complements the base product sent in the request.
|
|
463
|
-
May be null if no suitable second complementary item is found. |
|
|
436
|
+
| `first` | ProductDto | Yes | First recommended product that complements the base product sent in the request.<br>This product is selected based on style compatibility and fashion rules. |
|
|
437
|
+
| `secondary` | ProductDto | No | Second recommended product that complements the base product sent in the request.<br>May be null if no suitable second complementary item is found. |
|
|
464
438
|
<!-- /DOCGEN -->
|
|
465
439
|
|
|
466
440
|
### `ClothType`
|
|
@@ -486,4 +460,4 @@ ClothType.TOP // For shirts, blouses, jackets
|
|
|
486
460
|
ClothType.BOTTOM // For pants, skirts, shorts
|
|
487
461
|
ClothType.FULL_BODY // For dresses, jumpsuits
|
|
488
462
|
ClothType.SHOE_ACCESSORY // For shoes, accessories
|
|
489
|
-
```
|
|
463
|
+
```
|
|
@@ -101,11 +101,12 @@ class T {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
-
* Fetches similar product recommendations by permalink.
|
|
104
|
+
* Fetches similar product recommendations by permalink or productId.
|
|
105
105
|
*
|
|
106
|
+
* Get similar products by product permalink or productId (at least one must be provided).
|
|
106
107
|
* Sends a GET to `/recommendations/similar` with the given query parameters.
|
|
107
108
|
*
|
|
108
|
-
* @param params - parameters for the request
|
|
109
|
+
* @param params - parameters for the request. Either permalink or productId must be provided.
|
|
109
110
|
* @returns Promise resolving to the parsed JSON response
|
|
110
111
|
* @throws {ApiError} if the HTTP status is not 2xx or on network failure
|
|
111
112
|
*/
|
|
@@ -117,11 +118,12 @@ class T {
|
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
/**
|
|
120
|
-
* Fetches complementary product recommendation pairs by permalink.
|
|
121
|
+
* Fetches complementary product recommendation pairs by permalink or productId.
|
|
121
122
|
*
|
|
123
|
+
* Get complementary products by product permalink or productId (at least one must be provided).
|
|
122
124
|
* Sends a GET to `/recommendations/complementary` with the given query parameters.
|
|
123
125
|
*
|
|
124
|
-
* @param params - parameters for the request
|
|
126
|
+
* @param params - parameters for the request. Either permalink or productId must be provided.
|
|
125
127
|
* @returns Promise resolving to the parsed JSON response
|
|
126
128
|
* @throws {ApiError} if the HTTP status is not 2xx or on network failure
|
|
127
129
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i["sizebay-core-sdk"]={}))})(this,function(i){"use strict";const a={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"}};class l{constructor(e){const t=e.env||"development";this.serviceOverrides=e.services||{},this.endpoints={};for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){const o=a[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 r=await o.text();throw new Error(`Request error: ${o.status} - ${r}`)}return await o.json()}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(c,e){let t;try{t=await fetch(c,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 r=await o.text();throw new Error(`Failed to send profile: ${o.status} – ${r}`)}}}const O=[u,S,T];function E(c={}){const e=new l(c),t=O.map(n=>new n(e)),s={};return t.forEach(n=>{[...Object.getOwnPropertyNames(n),...Object.getOwnPropertyNames(Object.getPrototypeOf(n))].forEach(r=>{if(r==="constructor")return;const h=n[r];typeof h=="function"&&(s[r]||(s[r]=(...y)=>h.apply(n,y)))})}),s}const f={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"},m={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=f,i.ProductClass=m,i.createClient=E,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i["sizebay-core-sdk"]={}))})(this,(function(i){"use strict";const a={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"}};class l{constructor(e){const t=e.env||"development";this.serviceOverrides=e.services||{},this.endpoints={};for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){const o=a[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 r=await o.text();throw new Error(`Request error: ${o.status} - ${r}`)}return await o.json()}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(c,e){let t;try{t=await fetch(c,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 r=await o.text();throw new Error(`Failed to send profile: ${o.status} – ${r}`)}}}const O=[u,S,T];function E(c={}){const e=new l(c),t=O.map(n=>new n(e)),s={};return t.forEach(n=>{[...Object.getOwnPropertyNames(n),...Object.getOwnPropertyNames(Object.getPrototypeOf(n))].forEach(r=>{if(r==="constructor")return;const h=n[r];typeof h=="function"&&(s[r]||(s[r]=(...y)=>h.apply(n,y)))})}),s}const f={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"},m={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=f,i.ProductClass=m,i.createClient=E,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sizebay-core-sdk",
|
|
3
|
-
"version": "1.10.0
|
|
3
|
+
"version": "1.10.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",
|