@swan-admin/swan-ai-measurements 1.1.34 → 1.1.35
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/dist/constants.js +1 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/measurement.d.ts +4 -0
- package/dist/esm/measurement.js +6 -0
- package/dist/esm/tryOn.js +3 -0
- package/dist/measurement.d.ts +4 -0
- package/dist/measurement.js +6 -0
- package/dist/tryOn.js +3 -0
- package/package.json +1 -1
- package/src/constants.ts +1 -0
- package/src/measurement.ts +11 -0
- package/src/tryOn.ts +3 -0
package/dist/constants.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.API_ENDPOINTS = {
|
|
|
38
38
|
SCANNING: "/scanning",
|
|
39
39
|
RECOMMENDATION: "/recommendation",
|
|
40
40
|
TRY_ON_SHARE: "/tryon/share",
|
|
41
|
+
VARIANTS: "/variants",
|
|
41
42
|
};
|
|
42
43
|
exports.requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
|
|
43
44
|
exports.REQUIRED_MESSAGE = "Please verify required parameters";
|
package/dist/esm/constants.js
CHANGED
|
@@ -35,6 +35,7 @@ export const API_ENDPOINTS = {
|
|
|
35
35
|
SCANNING: "/scanning",
|
|
36
36
|
RECOMMENDATION: "/recommendation",
|
|
37
37
|
TRY_ON_SHARE: "/tryon/share",
|
|
38
|
+
VARIANTS: "/variants",
|
|
38
39
|
};
|
|
39
40
|
export const requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
|
|
40
41
|
export const REQUIRED_MESSAGE = "Please verify required parameters";
|
|
@@ -28,5 +28,9 @@ declare class Measurement {
|
|
|
28
28
|
getTryOnMeasurements({ scanId, shopDomain, productName }: TryOnSocketOptions): Promise<AxiosResponse<any>>;
|
|
29
29
|
handleTryOnSocket(options: TryOnSocketOptions): void;
|
|
30
30
|
handleMeasurementSocket(options: MeasurementSocketOptions): void;
|
|
31
|
+
getProductVariants({ shopDomain, productName }: {
|
|
32
|
+
shopDomain: string;
|
|
33
|
+
productName: string;
|
|
34
|
+
}): Promise<AxiosResponse<any, any>>;
|
|
31
35
|
}
|
|
32
36
|
export default Measurement;
|
package/dist/esm/measurement.js
CHANGED
|
@@ -121,6 +121,12 @@ class Measurement {
|
|
|
121
121
|
};
|
|
122
122
|
}, 5000);
|
|
123
123
|
}
|
|
124
|
+
getProductVariants({ shopDomain, productName }) {
|
|
125
|
+
if (!checkParameters(shopDomain, productName)) {
|
|
126
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
127
|
+
}
|
|
128
|
+
return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Measurement_stagingUrl, "f") })}/customers/${shopDomain}/products/${productName}${API_ENDPOINTS.VARIANTS}`);
|
|
129
|
+
}
|
|
124
130
|
}
|
|
125
131
|
_Measurement_tryOnSocketRef = new WeakMap(), _Measurement_measurementSocketRef = new WeakMap(), _Measurement_timerPollingRef = new WeakMap(), _Measurement_timerWaitingRef = new WeakMap(), _Measurement_count = new WeakMap(), _Measurement_accessKey = new WeakMap(), _Measurement_stagingUrl = new WeakMap(), _Measurement_instances = new WeakSet(), _Measurement_getMeasurementsCheck = function _Measurement_getMeasurementsCheck(options) {
|
|
126
132
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/esm/tryOn.js
CHANGED
|
@@ -187,6 +187,9 @@ class TryOn {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
getShareLink(tryonId) {
|
|
190
|
+
if (checkParameters(tryonId.trim()) === false) {
|
|
191
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
192
|
+
}
|
|
190
193
|
return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON_SHARE}`, { tryonId }, {
|
|
191
194
|
headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
|
|
192
195
|
});
|
package/dist/measurement.d.ts
CHANGED
|
@@ -28,5 +28,9 @@ declare class Measurement {
|
|
|
28
28
|
getTryOnMeasurements({ scanId, shopDomain, productName }: TryOnSocketOptions): Promise<AxiosResponse<any>>;
|
|
29
29
|
handleTryOnSocket(options: TryOnSocketOptions): void;
|
|
30
30
|
handleMeasurementSocket(options: MeasurementSocketOptions): void;
|
|
31
|
+
getProductVariants({ shopDomain, productName }: {
|
|
32
|
+
shopDomain: string;
|
|
33
|
+
productName: string;
|
|
34
|
+
}): Promise<AxiosResponse<any, any>>;
|
|
31
35
|
}
|
|
32
36
|
export default Measurement;
|
package/dist/measurement.js
CHANGED
|
@@ -157,5 +157,11 @@ class Measurement {
|
|
|
157
157
|
};
|
|
158
158
|
}, 5000);
|
|
159
159
|
}
|
|
160
|
+
getProductVariants({ shopDomain, productName }) {
|
|
161
|
+
if (!(0, utils_js_1.checkParameters)(shopDomain, productName)) {
|
|
162
|
+
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
163
|
+
}
|
|
164
|
+
return axios_1.default.get(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}/customers/${shopDomain}/products/${productName}${constants_js_1.API_ENDPOINTS.VARIANTS}`);
|
|
165
|
+
}
|
|
160
166
|
}
|
|
161
167
|
exports.default = Measurement;
|
package/dist/tryOn.js
CHANGED
|
@@ -170,6 +170,9 @@ class TryOn {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
getShareLink(tryonId) {
|
|
173
|
+
if ((0, utils_js_1.checkParameters)(tryonId.trim()) === false) {
|
|
174
|
+
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
175
|
+
}
|
|
173
176
|
return axios_1.default.post(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.TRY_ON_SHARE}`, { tryonId }, {
|
|
174
177
|
headers: { "X-Api-Key": this.#accessKey },
|
|
175
178
|
});
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/measurement.ts
CHANGED
|
@@ -221,6 +221,17 @@ class Measurement {
|
|
|
221
221
|
};
|
|
222
222
|
}, 5000);
|
|
223
223
|
}
|
|
224
|
+
|
|
225
|
+
getProductVariants({ shopDomain, productName }: { shopDomain: string; productName: string }) {
|
|
226
|
+
if (!checkParameters(shopDomain, productName)) {
|
|
227
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
228
|
+
}
|
|
229
|
+
return axios.get(
|
|
230
|
+
`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}/customers/${shopDomain}/products/${productName}${
|
|
231
|
+
API_ENDPOINTS.VARIANTS
|
|
232
|
+
}`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
224
235
|
}
|
|
225
236
|
|
|
226
237
|
export default Measurement;
|
package/src/tryOn.ts
CHANGED
|
@@ -230,6 +230,9 @@ class TryOn {
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
getShareLink(tryonId: string) {
|
|
233
|
+
if (checkParameters(tryonId.trim()) === false) {
|
|
234
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
235
|
+
}
|
|
233
236
|
return axios.post(
|
|
234
237
|
`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON_SHARE}`,
|
|
235
238
|
{ tryonId },
|