xactsize-webcomponents 1.0.43 → 1.0.45

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
@@ -107,3 +107,75 @@ To enable this feature, provide the following properties to the `<body-measurer>
107
107
  skus='[{"dimensions":{"Size":"M"},"measures":{"height":50,"length":70,"width":40}}]'
108
108
  ></body-measurer>
109
109
  ```
110
+
111
+ ## Usage and Implementation Guide
112
+
113
+ The `<body-measurer>` component is highly customizable and accepts various attributes to control its behavior, appearance, and integration with the Xactsize backend.
114
+
115
+ ### Properties (Attributes)
116
+
117
+ Here is a list of all supported attributes that can be passed to the `<body-measurer>` element:
118
+
119
+ | Attribute | Type | Default | Description |
120
+ | ------------- | ------- | ----------- | ------------------------------------------------------------------------------- |
121
+ | `api-key` | string | `""` | Your Xactsize API key for backend authentication. |
122
+ | `tenant-id` | string | `"1"` | Your tenant identifier. |
123
+ | `product-sku` | string | `"123456"` | The unique SKU of the product being sized. This is required for API resolution. |
124
+ | `base-url` | string | _default_ | The base URL for the Xactsize service API. |
125
+ | `api-url` | string | _default_ | The endpoint for the main sizing API. |
126
+ | `vton` | boolean | `false` | Enables the Virtual Try-On (VTON) feature. |
127
+ | `vton-url` | string | _default_ | The API endpoint for generating VTON images. |
128
+ | `garment-url` | string | `""` | The URL of the garment image used for Virtual Try-On. |
129
+ | `brand-name` | string | `undefined` | Displays your brand's name in the component (e.g., "Xactsize x YourBrand"). |
130
+ | `button-text` | string | `""` | Custom text for the "Find My Size" launch button. |
131
+ | `culture` | string | `"en"` | The active locale for the UI. Supported options: `"en"`, `"pt-BR"`, `"es-MX"`. |
132
+
133
+ > **Note:** While older integration examples might show `skus` or `product-name` attributes, modern implementations rely on the `product-sku` attribute which the backend uses to resolve product sizing rules.
134
+
135
+ ### Events
136
+
137
+ The component emits standard DOM custom events that you can listen to in your application logic:
138
+
139
+ - **`measurementAccepted`**: Fired when the user accepts the recommended size.
140
+ - `event.detail` contains the sizing result payload (e.g., `{ size: "M" }`).
141
+ - **`measurementCanceled`**: Fired when the user closes the modal or explicitly aborts the process.
142
+
143
+ ### Localization (i18n)
144
+
145
+ The component fully supports internationalization. To change the language, simply update the `culture` attribute on the element.
146
+ Available cultures:
147
+
148
+ - `en` (English)
149
+ - `pt-BR` (Portuguese - Brazil)
150
+ - `es-MX` (Spanish - Mexico)
151
+
152
+ The localization engine will automatically apply the translated strings to all steps in the flow.
153
+
154
+ ### Example Implementation
155
+
156
+ ```html
157
+ <body-measurer
158
+ api-key="YOUR_API_KEY_HERE"
159
+ tenant-id="123"
160
+ product-sku="SHIRT-001"
161
+ brand-name="My Store"
162
+ culture="es-MX"
163
+ button-text="Encontrar mi talla"
164
+ vton
165
+ garment-url="https://example.com/shirt-image.jpg"
166
+ >
167
+ </body-measurer>
168
+
169
+ <script>
170
+ const measurer = document.querySelector("body-measurer");
171
+
172
+ measurer.addEventListener("measurementAccepted", (e) => {
173
+ console.log("User accepted size:", e.detail.size);
174
+ // Logic to add the selected size to the shopping cart
175
+ });
176
+
177
+ measurer.addEventListener("measurementCanceled", () => {
178
+ console.log("User closed the measurer");
179
+ });
180
+ </script>
181
+ ```