@swan-admin/swan-ai-measurements 1.1.33 → 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 +2 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/measurement.d.ts +4 -0
- package/dist/esm/measurement.js +6 -0
- package/dist/esm/tryOn.d.ts +1 -0
- package/dist/esm/tryOn.js +8 -0
- package/dist/measurement.d.ts +4 -0
- package/dist/measurement.js +6 -0
- package/dist/tryOn.d.ts +1 -0
- package/dist/tryOn.js +8 -0
- package/package.json +1 -1
- package/src/constants.ts +2 -0
- package/src/measurement.ts +11 -0
- package/src/tryOn.ts +13 -0
package/dist/constants.js
CHANGED
|
@@ -37,6 +37,8 @@ exports.API_ENDPOINTS = {
|
|
|
37
37
|
AUTH: "/auth",
|
|
38
38
|
SCANNING: "/scanning",
|
|
39
39
|
RECOMMENDATION: "/recommendation",
|
|
40
|
+
TRY_ON_SHARE: "/tryon/share",
|
|
41
|
+
VARIANTS: "/variants",
|
|
40
42
|
};
|
|
41
43
|
exports.requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
|
|
42
44
|
exports.REQUIRED_MESSAGE = "Please verify required parameters";
|
package/dist/esm/constants.js
CHANGED
|
@@ -34,6 +34,8 @@ export const API_ENDPOINTS = {
|
|
|
34
34
|
AUTH: "/auth",
|
|
35
35
|
SCANNING: "/scanning",
|
|
36
36
|
RECOMMENDATION: "/recommendation",
|
|
37
|
+
TRY_ON_SHARE: "/tryon/share",
|
|
38
|
+
VARIANTS: "/variants",
|
|
37
39
|
};
|
|
38
40
|
export const requiredMetaData = ["gender", "focal_length", "height", "customer_store_url", "callback_url", "clothes_fit"];
|
|
39
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.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare class TryOn {
|
|
|
38
38
|
deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
|
|
39
39
|
handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
|
|
40
40
|
handleTryOnSubmit({ userEmail, shopDomain, productName, firstImageName, secondImageName, }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
41
|
+
getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
|
|
41
42
|
getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
|
|
42
43
|
}
|
|
43
44
|
export default TryOn;
|
package/dist/esm/tryOn.js
CHANGED
|
@@ -186,6 +186,14 @@ class TryOn {
|
|
|
186
186
|
headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
+
getShareLink(tryonId) {
|
|
190
|
+
if (checkParameters(tryonId.trim()) === false) {
|
|
191
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
192
|
+
}
|
|
193
|
+
return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _TryOn_stagingUrl, "f") })}${API_ENDPOINTS.TRY_ON_SHARE}`, { tryonId }, {
|
|
194
|
+
headers: { "X-Api-Key": __classPrivateFieldGet(this, _TryOn_accessKey, "f") },
|
|
195
|
+
});
|
|
196
|
+
}
|
|
189
197
|
}
|
|
190
198
|
_TryOn_tryOnSocketRef = new WeakMap(), _TryOn_timerWaitingRef = new WeakMap(), _TryOn_accessKey = new WeakMap(), _TryOn_stagingUrl = new WeakMap(), _TryOn_disconnectSocket = new WeakMap(), _TryOn_handleTimeOut = new WeakMap(), _TryOn_handleGetTryOnResult = new WeakMap(), _TryOn_instances = new WeakSet(), _TryOn_getSignedUrl = function _TryOn_getSignedUrl(payload) {
|
|
191
199
|
if (checkParameters(payload) === false) {
|
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.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare class TryOn {
|
|
|
38
38
|
deleteImage({ userEmail, fileName }: DeleteImageParams): Promise<AxiosResponse<any>>;
|
|
39
39
|
handleTryOnWebSocket: ({ userEmail, shopDomain, tryonId, productName, onError, onSuccess, onClose, onOpen }: HandleTryOnWebSocketParams) => void;
|
|
40
40
|
handleTryOnSubmit({ userEmail, shopDomain, productName, firstImageName, secondImageName, }: HandleForLatestImageParams): Promise<AxiosResponse<any>>;
|
|
41
|
+
getShareLink(tryonId: string): Promise<AxiosResponse<any, any>>;
|
|
41
42
|
getTryOnResult: ({ userEmail, shopDomain, productName }: GetTryOnResultParams) => Promise<AxiosResponse<any>>;
|
|
42
43
|
}
|
|
43
44
|
export default TryOn;
|
package/dist/tryOn.js
CHANGED
|
@@ -169,6 +169,14 @@ class TryOn {
|
|
|
169
169
|
onError?.(error);
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
+
getShareLink(tryonId) {
|
|
173
|
+
if ((0, utils_js_1.checkParameters)(tryonId.trim()) === false) {
|
|
174
|
+
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
175
|
+
}
|
|
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 }, {
|
|
177
|
+
headers: { "X-Api-Key": this.#accessKey },
|
|
178
|
+
});
|
|
179
|
+
}
|
|
172
180
|
getTryOnResult = ({ userEmail, shopDomain, productName }) => {
|
|
173
181
|
if ((0, utils_js_1.checkParameters)(shopDomain, userEmail, productName) === false) {
|
|
174
182
|
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
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
|
@@ -229,6 +229,19 @@ class TryOn {
|
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
+
getShareLink(tryonId: string) {
|
|
233
|
+
if (checkParameters(tryonId.trim()) === false) {
|
|
234
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
235
|
+
}
|
|
236
|
+
return axios.post(
|
|
237
|
+
`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.TRY_ON_SHARE}`,
|
|
238
|
+
{ tryonId },
|
|
239
|
+
{
|
|
240
|
+
headers: { "X-Api-Key": this.#accessKey },
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
232
245
|
getTryOnResult = ({ userEmail, shopDomain, productName }: GetTryOnResultParams): Promise<AxiosResponse<any>> => {
|
|
233
246
|
if (checkParameters(shopDomain, userEmail, productName) === false) {
|
|
234
247
|
throw new Error(REQUIRED_MESSAGE);
|