xactsize-webcomponents 1.0.32 → 1.0.34
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 +79 -47
- package/dist/{body-measurer-ChFzze5h.mjs → body-measurer-DR6CDvtW.mjs} +407 -364
- package/dist/body-measurer.d.ts +6 -0
- package/dist/body-measurer.es.js +1 -1
- package/dist/body-measurer.umd.js +40 -31
- package/dist/components/xact-step-result.d.ts +1 -0
- package/dist/generated/locales/pt-BR.d.ts +1 -0
- package/dist/{pt-BR-CNbEJn4b.mjs → pt-BR-BSI-rRix.mjs} +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,65 +13,97 @@ npm install xactsize-webcomponent
|
|
|
13
13
|
|
|
14
14
|
```html
|
|
15
15
|
<body-measurer
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
culture="pt-BR"
|
|
17
|
+
product-name="Shirt"
|
|
18
|
+
skus='[{"dimensions":{"Size":"M"},"measures":{"height":50,"length":70,"width":40}}]'
|
|
19
19
|
></body-measurer>
|
|
20
20
|
<script>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
import { BodyMeasurer } from "xactsize-webcomponent";
|
|
22
|
+
|
|
23
|
+
// Select the body-measurer element
|
|
24
|
+
const bodyMeasurer = document.querySelector("body-measurer");
|
|
25
|
+
|
|
26
|
+
// Check if the element exists
|
|
27
|
+
if (bodyMeasurer) {
|
|
28
|
+
// Add event listener for measurementAccepted
|
|
29
|
+
bodyMeasurer.addEventListener("measurementAccepted", (e) => {
|
|
30
|
+
const size = e.detail.size;
|
|
31
|
+
alert(`Size selected: ${size}`);
|
|
32
|
+
console.log("Measurement accepted:", e.detail);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Add event listener for measurementCanceled
|
|
36
|
+
bodyMeasurer.addEventListener("measurementCanceled", (e) => {
|
|
37
|
+
alert("Measurement canceled");
|
|
38
|
+
console.log("Measurement canceled");
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
console.error("body-measurer element not found");
|
|
42
|
+
}
|
|
43
43
|
</script>
|
|
44
44
|
```
|
|
45
|
+
|
|
45
46
|
</details>
|
|
46
47
|
|
|
47
48
|
<details>
|
|
48
49
|
<summary>With CDN</summary>
|
|
49
50
|
|
|
50
51
|
```html
|
|
51
|
-
<body-measurer
|
|
52
|
-
|
|
52
|
+
<body-measurer
|
|
53
|
+
culture="pt-BR"
|
|
54
|
+
product-name="Calça Legging"
|
|
55
|
+
skus='[{"dimensions":{"Size":"S"},"measures":{"height":39,"length":78,"width":78}},{"dimensions":{"Size":"M"},"measures":{"height":40,"length":82,"width":82}}]'
|
|
56
|
+
></body-measurer>
|
|
57
|
+
<script
|
|
58
|
+
type="module"
|
|
59
|
+
src="https://cdn.jsdelivr.net/npm/xactsize-webcomponents@1.0.6/dist/body-measurer.es.js"
|
|
60
|
+
></script>
|
|
53
61
|
|
|
54
62
|
<script>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
// Select the body-measurer element
|
|
64
|
+
const bodyMeasurer = document.querySelector("body-measurer");
|
|
65
|
+
|
|
66
|
+
// Check if the element exists
|
|
67
|
+
if (bodyMeasurer) {
|
|
68
|
+
// Add event listener for measurementAccepted
|
|
69
|
+
bodyMeasurer.addEventListener("measurementAccepted", (e) => {
|
|
70
|
+
const size = e.detail.size;
|
|
71
|
+
alert(`Size selected: ${size}`);
|
|
72
|
+
console.log("Measurement accepted:", e.detail);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Add event listener for measurementCanceled
|
|
76
|
+
bodyMeasurer.addEventListener("measurementCanceled", (e) => {
|
|
77
|
+
alert("Measurement canceled");
|
|
78
|
+
console.log("Measurement canceled");
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
console.error("body-measurer element not found");
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
75
84
|
</script>
|
|
76
85
|
```
|
|
86
|
+
|
|
77
87
|
</details>
|
|
88
|
+
|
|
89
|
+
## Virtual Try-On (VTON)
|
|
90
|
+
|
|
91
|
+
The component supports generating a Virtual Try-On image of the user wearing a specific garment. The generated image will be shown on the final results step alongside the size recommendation.
|
|
92
|
+
|
|
93
|
+
To enable this feature, provide the following properties to the `<body-measurer>` element:
|
|
94
|
+
|
|
95
|
+
- `vton` (boolean): Set this attribute to enable the Virtual Try-On flow.
|
|
96
|
+
- `garment-url` (string): The URL of the garment image you want the user to try on.
|
|
97
|
+
- `vton-url` (string, optional): The API endpoint for generating the VTON image. Defaults to `https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/VirtualTryOn/generate`.
|
|
98
|
+
|
|
99
|
+
### Example
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<body-measurer
|
|
103
|
+
culture="pt-BR"
|
|
104
|
+
product-name="Shirt"
|
|
105
|
+
vton
|
|
106
|
+
garment-url="https://example.com/images/shirt.jpg"
|
|
107
|
+
skus='[{"dimensions":{"Size":"M"},"measures":{"height":50,"length":70,"width":40}}]'
|
|
108
|
+
></body-measurer>
|
|
109
|
+
```
|