1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var tslib_1 = require("tslib");
|
4 | var page_type_1 = require("../../commons/types/page-type");
|
5 | var vtex_runner_1 = require("../../event/runners/vtex-runner");
|
6 | var confirmation_1 = require("../../event/types/page/confirmation");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var MartinsRunner = (function (_super) {
|
14 | tslib_1.__extends(MartinsRunner, _super);
|
15 | function MartinsRunner() {
|
16 | return _super !== null && _super.apply(this, arguments) || this;
|
17 | }
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | MartinsRunner.prototype.getPageInfo = function (item) {
|
27 | if (item && item.event) {
|
28 | if (item.event.toUpperCase() === "PURCHASE") {
|
29 | return {
|
30 | item: item,
|
31 | pageType: page_type_1.PageType.Confirmation,
|
32 | };
|
33 | }
|
34 | else if (item.event.toUpperCase() === "CART") {
|
35 | return {
|
36 | item: item,
|
37 | pageType: page_type_1.PageType.Cart,
|
38 | };
|
39 | }
|
40 | }
|
41 | return undefined;
|
42 | };
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | MartinsRunner.prototype.sendOrderEvent = function (orderItem) {
|
51 | var orderId = orderItem.transactionId;
|
52 | var products = [];
|
53 | if (orderItem.transactionProducts) {
|
54 | for (var _i = 0, _a = orderItem.transactionProducts; _i < _a.length; _i++) {
|
55 | var transactionProduct = _a[_i];
|
56 | products.push({
|
57 | product: transactionProduct.sku,
|
58 | quantity: transactionProduct.quantity,
|
59 | price: transactionProduct.price,
|
60 | });
|
61 | }
|
62 | }
|
63 | var event = new confirmation_1.PageConfirmationEvent(orderId).withProducts(products);
|
64 | event.push();
|
65 | };
|
66 | return MartinsRunner;
|
67 | }(vtex_runner_1.VTEXRunner));
|
68 | exports.MartinsRunner = MartinsRunner;
|
69 |
|
\ | No newline at end of file |