@dotdev/next-components
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -16,2 +16,3 @@ export declare class Cart { | ||
private getLocationFromPostcode; | ||
getProductRecommendations: (id: number, limit: number) => Promise<void>; | ||
toggleFreeShipping: (event: any) => void; | ||
@@ -18,0 +19,0 @@ toggleUpsells: (event: any) => void; |
@@ -286,2 +286,39 @@ "use strict"; | ||
}); }; | ||
this.getProductRecommendations = function (id, limit) { return __awaiter(_this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
try { | ||
fetch("/recommendations/products.json?product_id=" + id + "&limit=" + (limit ? limit : 4), { | ||
credentials: "same-origin", | ||
headers: { | ||
"X-Requested-With": "XMLHttpRequest", | ||
"Content-Type": "application/json;" | ||
}, | ||
method: "GET" | ||
}) | ||
.then(function (response) { return response.json(); }) | ||
.then(function (_a) { | ||
var products = _a.products; | ||
if (products.length > 0) { | ||
_this.context.update({ | ||
recommedations: products, | ||
message: "PRODUCT_RECOMMENDATIONS_SUCCESS" | ||
}); | ||
} | ||
else { | ||
_this.context.update({ | ||
message: "PRODUCT_RECOMMENDATIONS_NOTFOUND" | ||
}); | ||
} | ||
}); | ||
} | ||
catch (err) { | ||
this.context.update({ | ||
message: "PRODUCT_RECOMMENDATIONS_FAILED", | ||
error: err.message | ||
}); | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
}); }; | ||
this.toggleFreeShipping = function (event) { }; | ||
@@ -288,0 +325,0 @@ this.toggleUpsells = function (event) { }; |
{ | ||
"name": "@dotdev/next-components", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"license": "UNLICENSED", | ||
@@ -5,0 +5,0 @@ "description": "Common components for Next projects", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77221
1163
4