Advertisement
Guest User

frito

a guest
Jul 15th, 2019
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*! CheckOut - Oechsle
  2.  * Uploaded on: (2 Julio, 2019 - 13:1pm)  
  3.  * Version: 1.1
  4.  * @requires jQuery v1.5 or later
  5.  * Autor: Antony tasayco {[email protected]} */
  6. !function(t) {
  7.     function e(n) {
  8.         if (i[n])
  9.             return i[n].exports;
  10.         var a = i[n] = {
  11.             i: n,
  12.             l: !1,
  13.             exports: {}
  14.         };
  15.         return t[n].call(a.exports, a, a.exports, e),
  16.         a.l = !0,
  17.         a.exports
  18.     }
  19.     var i = {};
  20.     e.m = t,
  21.     e.c = i,
  22.     e.i = function(t) {
  23.         return t
  24.     }
  25.     ,
  26.     e.d = function(t, i, n) {
  27.         e.o(t, i) || Object.defineProperty(t, i, {
  28.             configurable: !1,
  29.             enumerable: !0,
  30.             get: n
  31.         })
  32.     }
  33.     ,
  34.     e.n = function(t) {
  35.         var i = t && t.__esModule ? function() {
  36.             return t.default
  37.         }
  38.         : function() {
  39.             return t
  40.         }
  41.         ;
  42.         return e.d(i, "a", i),
  43.         i
  44.     }
  45.     ,
  46.     e.o = function(t, e) {
  47.         return Object.prototype.hasOwnProperty.call(t, e)
  48.     }
  49.     ,
  50.     e.p = "",
  51.     e(e.s = 7)
  52. }([function(t, e, i) {
  53.     "use strict";
  54.     Object.defineProperty(e, "__esModule", {
  55.         value: !0
  56.     });
  57.     var n = {}
  58.       , a = {}
  59.       , o = {
  60.         cart: [],
  61.         email: [],
  62.         profile: [],
  63.         shipping: [],
  64.         payment: [],
  65.         cartLoaded: [],
  66.         orderPlaced: [],
  67.         itemsUpdated: []
  68.     }
  69.       , r = {
  70.         waitVtexJs: function(t) {
  71.             var e = 0
  72.               , i = setInterval(function() {
  73.                 window.vtexjs.checkout.orderForm && (t(),
  74.                 clearInterval(i)),
  75.                 e++ >= 300 && clearInterval(i)
  76.             }, 1e3)
  77.         },
  78.         waitForEl: function(t, e) {
  79.             $(t).length ? e(t) : setTimeout(function() {
  80.                 r.waitForEl(t, e)
  81.             }, 100)
  82.         },
  83.         cachedAjax: function(t) {
  84.             return n[t] || (n[t] = $.Deferred(function(e) {
  85.                 $.ajax(t).then(function(t) {
  86.                     return e.resolve(t)
  87.                 })
  88.             }).promise()),
  89.             n[t]
  90.         },
  91.         groupBy: function(t, e) {
  92.             return t.reduce(function(t, i) {
  93.                 return (t[i[e]] = t[i[e]] || []).push(i),
  94.                 t
  95.             }, {})
  96.         },
  97.         debounce: function(t, e) {
  98.             var i;
  99.             return i = null,
  100.             function() {
  101.                 var n, a;
  102.                 return a = this,
  103.                 n = arguments,
  104.                 clearTimeout(i),
  105.                 i = setTimeout(function() {
  106.                     return t.apply(a, n)
  107.                 }, e)
  108.             }()
  109.         },
  110.         runStep: function() {
  111.             for (var t = Array.prototype.shift.call(arguments).split(" "), e = Array.prototype.slice.call(arguments), i = window.location.hash.toLowerCase(), n = 0, a = t.length; n < a; n++)
  112.                 if (t[n]in o && (o[t[n]] = o[t[n]].concat(e),
  113.                 ~i.indexOf(t[n])))
  114.                     for (var r = e.length; r--; )
  115.                         e[r].call(null, t[n])
  116.         },
  117.         hashForStep: function() {
  118.             var t = 0;
  119.             switch (window.location.hash) {
  120.             case "#/cart":
  121.                 t = 1;
  122.                 break;
  123.             case "#/email":
  124.                 t = 2;
  125.                 break;
  126.             case "#/profile":
  127.                 t = 3;
  128.                 break;
  129.             case "#/shipping":
  130.                 t = 4;
  131.                 break;
  132.             case "#/payment":
  133.                 t = 5;
  134.                 break;
  135.             default:
  136.                 t = void 0
  137.             }
  138.             return t
  139.         },
  140.         addAnimation: function(t, e) {
  141.             Object.keys(a).length || (document.addEventListener("animationstart", function(t) {
  142.                 if (t.animationName in a)
  143.                     for (var e = 0, i = a[t.animationName].length; e < i; e++)
  144.                         a[t.animationName][e].call(null, t)
  145.             }),
  146.             document.addEventListener("webkitAnimationStart", function(t) {
  147.                 if (t.animationName in a)
  148.                     for (var e = 0, i = a[t.animationName].length; e < i; e++)
  149.                         a[t.animationName][e].call(null, t)
  150.             }),
  151.             document.addEventListener("MSAnimationStart", function(t) {
  152.                 if (t.animationName in a)
  153.                     for (var e = 0, i = a[t.animationName].length; e < i; e++)
  154.                         a[t.animationName][e].call(null, t)
  155.             }),
  156.             document.addEventListener("oAnimationStart", function(t) {
  157.                 if (t.animationName in a)
  158.                     for (var e = 0, i = a[t.animationName].length; e < i; e++)
  159.                         a[t.animationName][e].call(null, t)
  160.             }),
  161.             document.addEventListener("mozAnimationStart", function(t) {
  162.                 if (t.animationName in a)
  163.                     for (var e = 0, i = a[t.animationName].length; e < i; e++)
  164.                         a[t.animationName][e].call(null, t)
  165.             })),
  166.             a[t]instanceof Array || (a[t] = []),
  167.             a[t].push(e)
  168.         },
  169.         percentDiscount: function(t, e) {
  170.             return (e - e * (t / 100)).toFixed(2)
  171.         },
  172.         formatPrice: function(t) {
  173.             return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
  174.         },
  175.         bigTicketProduct: function() {
  176.             var t = new Date
  177.               , e = t.getTime()
  178.               , i = []
  179.               , n = vtexjs.checkout.orderForm.items;
  180.             if (n)
  181.                 for (var a = 0; a < n.length; a++)
  182.                     i.push(n[a].id);
  183.             $.ajax({
  184.                 async: "true",
  185.                 crossDomain: !0,
  186.                 url: "https://tienda.oechsle.pe/api-resource/?fn=checkBigTicket&v=" + e,
  187.                 type: "POST",
  188.                 data: {
  189.                     skus: i
  190.                 },
  191.                 "cache-control": "no-cache",
  192.                 "Content-Type": "application/json",
  193.                 error: function(t, e, i) {
  194.                     console.log(t + "--" + e + "--" + i)
  195.                 }
  196.             }).done(function(t) {
  197.                 sessionStorage.setItem("bigTicketSku", t)
  198.             })
  199.         }
  200.     };
  201.     e.publicMethod = r
  202. }
  203. , function(t, e, i) {
  204.     "use strict";
  205.     Object.defineProperty(e, "__esModule", {
  206.         value: !0
  207.     }),
  208.     e.setPriceOh = void 0;
  209.     var n, a = i(0), o = i(3), r = [], s = [], c = 1, l = {
  210.         startLoadCount: 0,
  211.         endLoadCount: 19
  212.     }, d = {
  213.         startLoadCount: 0,
  214.         endLoadCount: 19
  215.     }, u = {
  216.         init: function() {
  217.             return n = this,
  218.             n.initialize()
  219.         },
  220.         initialize: function() {
  221.             n.getInfoProduct(),
  222.             $(".cart-template.full-cart .cart").addClass("show-items"),
  223.             $(document).on("click", ".deleteRow", n.deleteRow),
  224.             $(window).on("beforeunload", function() {
  225.                 sessionStorage.removeItem("product")
  226.             })
  227.         },
  228.         getApiToSku: function(t) {
  229.             var e = $.Deferred()
  230.               , i = "/api/catalog_system/pub/products/search?fq=" + t + "&_from=0&_to=49";
  231.             return $.ajax({
  232.                 url: i,
  233.                 async: !1
  234.             }).done(function(t) {
  235.                 e.resolve(t)
  236.             }).fail(e.reject),
  237.             e.promise()
  238.         },
  239.         getItem: function(t, e) {
  240.             var i, a = 1 == e ? n.getAllProduct() : vtexjs.checkout.orderForm.items;
  241.             return $.each(a, function() {
  242.                 return (1 == e ? this.sku : this.id) == t ? (i = this,
  243.                 !1) : void 0
  244.             }),
  245.             i
  246.         },
  247.         readyLoadPrice: function(t) {
  248.             window.Rad1UsOh ? t() : setTimeout(function() {
  249.                 n.readyLoadPrice(t)
  250.             }, 100)
  251.         },
  252.         trAddProductInfo: function(t) {
  253.             n.readyLoadPrice(function() {
  254.                 var e = $(t.target)
  255.                   , i = e.closest("tr.product-item, li.item")
  256.                   , r = (e.closest("tr.product-item"),
  257.                 i.data("sku"))
  258.                   , s = n.getItem(r, !1)
  259.                   , c = n.getItem(r, !0)
  260.                   , l = 0
  261.                   , d = 0;
  262.                 if (null != c && "" != c && void 0 !== c.priceOh && null !== c.priceOh && 0 !== c.priceOh && c.price > c.priceOh) {
  263.                     var u = c.priceOh.toFixed(2);
  264.                     d = (u * s.quantity).toFixed(2),
  265.                     e.find(".product-price .new-product-real-price-per-unit").addClass("block tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(u)),
  266.                     e.find(".quantity-price .total-selling-price").removeClass("hide").addClass("block tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(d)),
  267.                     e.find(".description .price").css("display", "block").addClass("tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(u)),
  268.                     l = 0 != d ? (c.price - u) * s.quantity : d
  269.                 }
  270.                 i.attr("data-discountOh", l),
  271.                 e.find(".product-name .deleteRow").length || e.find(".product-name .brand").after("<a class='deleteRow' href='#'>X <span>Eliminar</span</a>"),
  272.                 e.find(".quantity-price .total-price").removeClass("hide").addClass("block").parents("td").addClass("none-bg"),
  273.                 o.marketPlace.cartLogo(s, e),
  274.                 n.setHtmlSku(e)
  275.             })
  276.         },
  277.         setHtmlSku: function(t) {
  278.             var e = t.closest("tr.product-item")
  279.               , i = "";
  280.             e.find(".sku").length || (i = "<span class='sku'>SKU: " + e.data("sku") + "</span>",
  281.             e.find(".brand").append(i))
  282.         },
  283.         blockProducts: function(t) {
  284.             var e = t;
  285.             void 0 !== e && e && (c >= d.startLoadCount && c <= d.endLoadCount ? s.push(e) : (r.push(s),
  286.             s = [],
  287.             d.startLoadCount = d.endLoadCount,
  288.             d.endLoadCount = d.endLoadCount + l.endLoadCount,
  289.             n.blockProducts(t),
  290.             c--)),
  291.             c++
  292.         },
  293.         getAllProduct: function() {
  294.             var t = sessionStorage.getItem("product");
  295.             return null != t ? JSON.parse(t) : 0
  296.         },
  297.         setSavePrice: function(t) {
  298.             for (var e = vtexjs.checkout.orderForm.items, i = 0; i < e.length; i++)
  299.                 for (var a = 0; a < t.length; a++)
  300.                     if (e[i].productId == t[a].productId) {
  301.                         var o = new Object
  302.                           , r = n.getAllProduct()
  303.                           , s = null
  304.                           , c = n.identificarDataPromoBySku(t[a].items, e[i].id)
  305.                           , l = n.determineOH(c[0].promotion);
  306.                         s = r.length ? r : [],
  307.                         o.sku = c[0].sku,
  308.                         o.priceOh = l.priceOh,
  309.                         o.price = l.regularPrice,
  310.                         s.push(o),
  311.                         sessionStorage.setItem("product", JSON.stringify(s))
  312.                     }
  313.         },
  314.         identificarDataPromoBySku: function(t, e) {
  315.             for (var i = new Object, n = [], a = 0; a < t.length; a++)
  316.                 if (t[a].itemId == e) {
  317.                     i.sku = e,
  318.                     i.promotion = t[a].sellers[0].commertialOffer,
  319.                     n.push(i);
  320.                     break
  321.                 }
  322.             return n
  323.         },
  324.         determineOH: function(t) {
  325.             var e = t.Price
  326.               , i = []
  327.               , n = []
  328.               , a = 0
  329.               , o = 0
  330.               , r = 0;
  331.             return void 0 !== t.Teasers && null != t.Teasers && $(t.Teasers).each(function(t, r) {
  332.                 var s = r["<Name>k__BackingField"].toString().toLowerCase()
  333.                   , c = r["<Effects>k__BackingField"]["<Parameters>k__BackingField"][0];
  334.                 "PercentualDiscount" == c["<Name>k__BackingField"] && s.indexOf("tarjeta oh!") >= 0 && (a = (e - e * Number(c["<Value>k__BackingField"]) / 100).toFixed(2),
  335.                 i.push(Number(a))),
  336.                 "MaximumUnitPriceDiscount" == c["<Name>k__BackingField"] && s.indexOf("#maxprice") >= 0 && (o = Number(c["<Value>k__BackingField"]) / 100,
  337.                 n.push(Number(o))),
  338.                 "PromotionalPriceTableItemsIds" == c["<Name>k__BackingField"] && s.indexOf("#maxprice") >= 0 && (c = r["<Effects>k__BackingField"]["<Parameters>k__BackingField"][1],
  339.                 o = (e - Number(c["<Value>k__BackingField"])).toFixed(2),
  340.                 n.push(Number(o)))
  341.             }),
  342.             r = Math.min.apply(null, n.concat(i)),
  343.             {
  344.                 priceOh: r,
  345.                 regularPrice: t.Price
  346.             }
  347.         },
  348.         getInfoProduct: function() {
  349.             var t = []
  350.               , e = vtexjs.checkout.orderForm.items;
  351.             void 0 !== e && e && $.when($.each(e, function(t, e) {
  352.                 var i = e.productId;
  353.                 n.blockProducts(i)
  354.             })).then(function() {
  355.                 s.length && (r.push(s),
  356.                 s = []),
  357.                 $(r).each(function(e, i) {
  358.                     var a = $.map(i, function(t) {
  359.                         return "productId%3A" + t
  360.                     }).join("%2C");
  361.                     t.push(n.getApiToSku(a))
  362.                 }),
  363.                 $.when.apply($, t).done(function() {
  364.                     $.when($.each(arguments, function(t, e) {
  365.                         n.setSavePrice(e)
  366.                     })).then(function() {
  367.                         console.log("i.getAllProduct", n.getAllProduct()),
  368.                         window.Rad1UsOh = !0
  369.                     })
  370.                 })
  371.             })
  372.         },
  373.         deleteRow: function(t) {
  374.             var e = $(this).parents("tr").attr("data-sku")
  375.               , i = JSON.parse(sessionStorage.getItem("bigTicketSku"))
  376.               , n = [];
  377.             if (i) {
  378.                 for (var a = 0; a < i.length; a++)
  379.                     e != i[a] && n.push(i[a]);
  380.                 sessionStorage.setItem("bigTicketSku", JSON.stringify(n))
  381.             }
  382.             $(this).parents("tr").find("td.item-remove a.item-link-remove").trigger("click"),
  383.             t.preventDefault()
  384.         },
  385.         removeService: function() {
  386.             $("#tblOne > tbody  > tr.item-service").each(function() {})
  387.         }
  388.     };
  389.     e.setPriceOh = u
  390. }
  391. , function(t, e, i) {
  392.     "use strict";
  393.     Object.defineProperty(e, "__esModule", {
  394.         value: !0
  395.     }),
  396.     e.cart = void 0;
  397.     var n, a = i(0), o = i(1), r = {
  398.         init: function() {
  399.             return n = this,
  400.             n.initialize()
  401.         },
  402.         initialize: function() {
  403.             3 == a.publicMethod.hashForStep() && console.log("cart"),
  404.             $("#client-profile-data").on("componentValidated.vtex", function(t, e) {
  405.                 $(document).on("click", "#client-profile-data form.form-step p.submit", n.checkTermsAndConditions)
  406.             })
  407.         },
  408.         formatHtml: function(t) {
  409.             var e = $(t.target)
  410.               , i = e.find(".product-name")
  411.               , o = e.find(".product-name .product-service")
  412.               , r = e.attr("data-sku");
  413.             a.publicMethod.waitForEl(o, function(t) {
  414.                 n.servicios(t, r)
  415.             }),
  416.             a.publicMethod.waitForEl(i, function(t) {
  417.                 n.oneService(t, r)
  418.             })
  419.         },
  420.         oneService: function(t, e) {
  421.             for (var i = vtexjs.checkout.orderForm.items, n = [], a = [], o = "", r = "", s = "", c = 0, l = 0, d = 0, u = 0, p = !1, m = 0; m < i.length; m++) {
  422.                 if (o = i[m].id,
  423.                 o == e && (a = i[m].offerings,
  424.                 n = i[m].bundleItems,
  425.                 p = !0),
  426.                 a.length > 0)
  427.                     for (var f = 0; f < a.length; f++)
  428.                         s = a[f].type.toString().toLowerCase(),
  429.                         (s.indexOf("reem") >= 0 || s.indexOf("rep") >= 0) && d++,
  430.                         s.indexOf("armado") >= 0 && u++;
  431.                 if (n.length > 0)
  432.                     for (var f = 0; f < n.length; f++)
  433.                         r = n[f].additionalInfo.offeringType,
  434.                         r = r.toString().toLowerCase(),
  435.                         (r.indexOf("reem") >= 0 || r.indexOf("rep") >= 0) && c++,
  436.                         r.indexOf("armado") >= 0 && l++;
  437.                 if (p)
  438.                     break
  439.             }
  440.             1 == c && d > 1 && 0 == u && t.find(".add-service-container").css("display", "none"),
  441.             1 == l && u > 1 && 0 == d && t.find(".add-service-container").css("display", "none"),
  442.             1 == c && 1 == l && t.find(".add-service-container").css("display", "none")
  443.         },
  444.         servicios: function(t, e) {
  445.             var i = t
  446.               , n = 0
  447.               , a = 0;
  448.             $(t).prepend('<div class="ctrls-tooltip-checkout"><i>!</i> Selecciona un tipo de servicio</div>'),
  449.             $(document).on("click", ".bundle-item-add-button", function(t) {
  450.                 var e = $(this)
  451.                   , i = e.parent().find(".btn-mini").val()
  452.                   , n = e.parent().parent().parent().find(".ctrls-tooltip-checkout")
  453.                   , a = $(document).scrollTop()
  454.                   , o = e.parents(".product-item").height();
  455.                 if (console.log(n, "tooltip"),
  456.                 "nd" == i)
  457.                     return n.addClass("active"),
  458.                     setTimeout(function() {
  459.                         n.removeClass("active")
  460.                     }, 3e3),
  461.                     !1;
  462.                 $(".show-items").stop(!0, !0).animate({
  463.                     scrollTop: a + o + 150
  464.                 }, 3e3)
  465.             }),
  466.             $(t).find("select").each(function(t, i) {
  467.                 var o = $(this);
  468.                 o.find("option.op0").length || o.prepend($("<option>", {
  469.                     text: "Súper Garantía y/o Armado",
  470.                     class: "op0",
  471.                     val: "nd"
  472.                 }).attr("selected", "selected")),
  473.                 o.find("option").each(function(t, e) {
  474.                     var i = $(this).text().toLowerCase()
  475.                       , n = i.charAt(0).toUpperCase() + i.slice(1);
  476.                     (i.indexOf("reem") >= 0 || i.indexOf("rep") >= 0) && $(this).addClass("opSuperGarantia"),
  477.                     i.indexOf("armado") >= 0 && !$(this).hasClass("op0") && $(this).addClass("opArmado"),
  478.                     $(this).text(n)
  479.                 });
  480.                 var r = vtexjs.checkout.orderForm.items
  481.                   , s = {}
  482.                   , c = ""
  483.                   , l = "";
  484.                 o.find(".opSuperGarantia").css("display", "block"),
  485.                 o.find(".opArmado").css("display", "block");
  486.                 for (var d = 0; d < r.length; d++)
  487.                     if (c = r[d].id,
  488.                     c == e && (s = r[d].bundleItems),
  489.                     s.length > 0)
  490.                         for (var u = 0; u < s.length; u++)
  491.                             l = s[u].additionalInfo.offeringType,
  492.                             l = l.toString().toLowerCase(),
  493.                             (l.indexOf("reem") >= 0 || l.indexOf("rep") >= 0) && (o.find(".opSuperGarantia").css("display", "none"),
  494.                             n++),
  495.                             l.indexOf("armado") >= 0 && (o.find(".opArmado").css("display", "none"),
  496.                             a++)
  497.             }),
  498.             n > 0 && a > 0 && i.css("display", "none")
  499.         },
  500.         habilitarServicio: function() {
  501.             "nd" == $(this).val() ? $(this).parent().find("input[type=submit]").prop("disabled", !0) : $(this).parent().find("input[type=submit]").prop("disabled", !1),
  502.             $(document).on("change", "select.btn-mini", n.habilitarServicio)
  503.         },
  504.         listServiceProduct: function(t) {
  505.             var e = $(t.target);
  506.             e.closest("tr").prev().find(".product-name .product-service"),
  507.             e.find("td.bundle-quantity-price").addClass("none-bg"),
  508.             0 == e.find(".bundle-item-image .deleteService").length && (e.find(".bundle-item-image span").after("<a class='deleteService' href='#'>X <span>Eliminar</span</a>"),
  509.             $(document).on("click", ".deleteService", n.deleteService))
  510.         },
  511.         subTotal: function(t) {
  512.             var e = $(t.target);
  513.             o.setPriceOh.readyLoadPrice(function() {
  514.                 var t = 0;
  515.                 $(".cart-items > tbody > tr.product-item").each(function() {
  516.                     var e = $(this).attr("data-discountOh");
  517.                     t += Number(e)
  518.                 }).promise().done(function() {
  519.                     if (t > 0) {
  520.                         var i = e.parent().find("tr:first td.monetary").text()
  521.                           , n = parseFloat(i.substring(3).replace(/[^0-9\.-]+/g, ""))
  522.                           , o = (n - t).toFixed(2)
  523.                           , r = '<tr class="orderPriceOh">\n                  <td class="info"><p class="info-text-cart">Total pagando con &nbsp;</p></td>\n                  <td class="space"></td>  \n                  <td class="monetary tarjeta-oh">S/. ' + a.publicMethod.formatPrice(o) + '</td>\n                  <td class="empty"></td>\n                </tr>';
  524.                         0 == $(".totalizers-list tr.orderPriceOh").length ? $(".totalizers-list tr.Items").after(r) : $(".totalizers-list tr.orderPriceOh").get(0).innerHTML = r
  525.                     }
  526.                     $(".summary-template-holder .row-fluid .btnSeguirComprando").length || $(".summary-template-holder .row-fluid").append('<a href="/" class="btnSeguirComprando">Seguir comprando</a>')
  527.                 })
  528.             }),
  529.             e.parents("table").addClass("show-price").find("tbody").css({
  530.                 opacity: "1"
  531.             })
  532.         },
  533.         readyAllPriceOh: function(t) {
  534.             var e = 0;
  535.             return $(".cart-items > tbody > tr.product-item, .cart-items > li.item").each(function() {
  536.                 if (void 0 === $(this).attr("data-discountOh"))
  537.                     return e++,
  538.                     !1
  539.             }),
  540.             e
  541.         },
  542.         waitDiscountOh: function(t) {
  543.             1 == n.readyAllPriceOh() ? setTimeout(function() {
  544.                 n.waitDiscountOh(t)
  545.             }, 100) : t()
  546.         },
  547.         deleteService: function(t) {
  548.             $(this).parents("tr").find("td.item-remove a.item-link-remove").trigger("click"),
  549.             t.preventDefault()
  550.         },
  551.         checkTermsAndConditions: function() {
  552.             return $("#client-profile-data .terms-conditions input:checked").length ? ($("#client-profile-data .terms-conditions").removeClass("error"),
  553.             !0) : ($("#client-profile-data .terms-conditions").removeClass("error").addClass("error"),
  554.             !1)
  555.         },
  556.         cartFixed: function(t) {
  557.             var e = $(t.target)
  558.               , i = "";
  559.             e.find(".Rad1UsCupon").length || (i = '<div class=\'Rad1UsCupon\'>\n            <div class="txtCupon"><a href="#" class="showInputCupon">¿Tienes un cupón de descuento?</a></div>\n            <div class="inputCupon"> <a href="#" class="backCupon">Volver</a> <input type="text" name="txtCodeCupon"> <a href="#" class="txtCoupon"></a></div>\n          </div>',
  560.             e.find("h2").before(i),
  561.             n.cartFixedEvent())
  562.         },
  563.         applyOrRemove: function(t) {
  564.             null != t && null != t.coupon ? ($("div.Rad1UsCupon").find(".inputCupon input").val(t.coupon),
  565.             $("div.Rad1UsCupon").find(".inputCupon .txtCoupon").text("Borrar cupón")) : ($("div.Rad1UsCupon").find(".inputCupon input").val(""),
  566.             $("div.Rad1UsCupon").find(".inputCupon .txtCoupon").text("Aplicar cupón"))
  567.         },
  568.         cartFixedEvent: function() {
  569.             $(".Rad1UsCupon .txtCupon .showInputCupon").unbind("click").bind("click", function(t) {
  570.                 var e = vtexjs.checkout.orderForm.marketingData;
  571.                 $(this).parent().hide().next().show(),
  572.                 n.applyOrRemove(e),
  573.                 t.preventDefault()
  574.             }),
  575.             $(".Rad1UsCupon .inputCupon .backCupon").unbind("click").bind("click", function(t) {
  576.                 $(this).parent().hide().parents(".Rad1UsCupon").find(".txtCupon").show(),
  577.                 t.preventDefault()
  578.             }),
  579.             $(".Rad1UsCupon .inputCupon .txtCoupon").unbind("click").bind("click", function(t) {
  580.                 var e = ""
  581.                   , i = vtexjs.checkout.orderForm.marketingData;
  582.                 null != i && null != i.coupon ? $("#cart-coupon-remove").trigger("click") : (e = $(this).closest("div").find("input").val(),
  583.                 $("#cart-coupon").val(e).trigger("change"),
  584.                 $("#cart-coupon-add").trigger("click")),
  585.                 $(this).closest("div").addClass("loadCupon"),
  586.                 n.onLoadCoupon(),
  587.                 t.preventDefault()
  588.             })
  589.         },
  590.         onLoadCoupon: function() {
  591.             $(document).ajaxSuccess(function(t, e, i) {
  592.                 try {
  593.                     if (i.url.match(vtexjs.checkout._getAddCouponURL()) && void 0 !== e.responseText) {
  594.                         var a = $.parseJSON(e.responseText)
  595.                           , o = a.marketingData;
  596.                         n.applyOrRemove(o),
  597.                         $(".txtCoupon").closest("div").removeClass("loadCupon")
  598.                     }
  599.                 } catch (t) {}
  600.             })
  601.         }
  602.     };
  603.     e.cart = r
  604. }
  605. , function(t, e, i) {
  606.     "use strict";
  607.     Object.defineProperty(e, "__esModule", {
  608.         value: !0
  609.     }),
  610.     e.marketPlace = void 0;
  611.     var n = (i(0),
  612.     {
  613.         initialize: function() {},
  614.         cartLogo: function(t, e) {
  615.             var i;
  616.             "Promart" == t.seller ? (e.addClass("row-promart"),
  617.             i = "promart") : (e.addClass("row-oechsle"),
  618.             i = "oechsle");
  619.             var n = '<div class="despacho-row conten-despacho-' + i + '">\n          <ul class="list">\n            <li>Delivery</li>\n            <li>Retiro en tienda</li>\n            <li class="modalidad">(*) Recuerda que la modalidad que elijas estara sujeta a la direccion que escojas posteriormete.</li>\n          </ul>\n          <div class="logoDespacho">Producto vendido y despachado por: </div>\n        </div>';
  620.             0 == e.find(".product-image .despacho-row").length && e.find(".product-image a").after(n)
  621.         },
  622.         setLogistics: function(t) {
  623.             var e = $(t.target);
  624.             $(".shipping-options .product-list").each(function(t, e) {
  625.                 var i = $(this);
  626.                 if ("oechsle" == i.closest("table").prev().find(".products-from-seller-container .products-from-seller-name").text() && !$("body").hasClass("mktPlcSetLogistics")) {
  627.                     var n = i.closest("table").next().find(".btn-group-vertical select");
  628.                     n.val("Despacho a Domicilio"),
  629.                     n.trigger("change"),
  630.                     $("body").addClass("mktPlcSetLogistics")
  631.                 }
  632.             }).promise().done(function() {
  633.                 e.addClass("logisticsMarketPlace")
  634.             })
  635.         },
  636.         hashPayment: function(t) {
  637.             document.location.href.indexOf("#/payment") > -1 && ($("body").hasClass("oepr") || $("body").hasClass("onlyPromart")) && setTimeout(function t() {
  638.                 1 == $("#payment-group-PagoEfectivoPaymentGroup").length ? $("#payment-group-PagoEfectivoPaymentGroup").remove() : setTimeout(t, 300)
  639.             }, 300)
  640.         },
  641.         openModal: function(t) {
  642.             t.preventDefault(),
  643.             $(".js-condiciones").fadeIn(),
  644.             $("body, html").css({
  645.                 overflow: "hidden"
  646.             })
  647.         },
  648.         cerrarModal: function(t) {
  649.             t.preventDefault(),
  650.             $(".js-condiciones").fadeOut(),
  651.             $("body, html").removeAttr("style")
  652.         }
  653.     });
  654.     e.marketPlace = n
  655. }
  656. , function(t, e, i) {
  657.     "use strict";
  658.     Object.defineProperty(e, "__esModule", {
  659.         value: !0
  660.     }),
  661.     e.payment = void 0;
  662.     var n, a = i(0), o = i(1), r = i(2), s = [4.1, 4, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2], c = ["454775", "454776", "491337", "411090", "411091", "411093", "473244", "473245", "422224", "477290", "377753", "377752", "377754", "544402", "544359", "549161", "477289"], l = {
  663.         init: function() {
  664.             return n = this,
  665.             n.initialize()
  666.         },
  667.         initialize: function() {
  668.             n.fns(),
  669.             vtexjs.checkout.getOrderForm().done(function(t) {
  670.                 n.checkBinInterbank(t),
  671.                 n.initCalculadora(t)
  672.             }),
  673.             sessionStorage.setItem("estado", "0"),
  674.             vtex.events.actions.onHashChange(function(t) {
  675.                 var e;
  676.                 e = t.substring(t.indexOf(location.pathname));
  677.                 var i = location.origin + location.pathname;
  678.                 "/checkout#/payment" == e && (n.validStoreSelec(),
  679.                 n.hideTotalTarjetaOh());
  680.                 var a = sessionStorage.getItem("estado");
  681.                 "/checkout#/payment" == e && "0" == a && (location.href = i + "#/shipping",
  682.                 sessionStorage.setItem("estado", "1"))
  683.             }),
  684.             $(window).on("orderFormUpdated.vtex", function(t, e) {
  685.                 n.checkBinInterbank(e),
  686.                 n.initCalculadora(e)
  687.             })
  688.         },
  689.         validStoreSelec: function() {
  690.             var t = location.origin + location.pathname
  691.               , e = vtexjs.checkout.orderForm.shippingData.logisticsInfo[0].selectedSla
  692.               , i = vtexjs.checkout.orderForm.clientProfileData.email;
  693.             null != e && (e = e.replace(/ /g, "")),
  694.             "Retiroentienda" === e ? location.href = t + "#/shipping" : (sessionStorage.setItem("staEnv", "1"),
  695.             sessionStorage.setItem("email", i))
  696.         },
  697.         hideTotalTarjetaOh: function() {
  698.             var t = $(".payment-group a.payment-group-item.active").text().toLowerCase();
  699.             console.log(t, "initHide"),
  700.             -1 !== t.indexOf("tarjeta oh") && ($("#totalOh").hide(),
  701.             $("#totalOh").prev().addClass("beforeOh")),
  702.             $(".payment-group a.payment-group-item").click(function() {
  703.                 var t = $(this).text().toLowerCase();
  704.                 console.log(t, "getTextOh"),
  705.                 -1 !== t.indexOf("tarjeta oh") ? ($("#totalOh").hide(),
  706.                 $("#totalOh").prev().addClass("beforeOh")) : ($("#totalOh").prev().removeClass("beforeOh"),
  707.                 $("#totalOh").show())
  708.             })
  709.         },
  710.         resetInstallment: function() {
  711.             $(".info-cuota").remove()
  712.         },
  713.         generateInstallments: function(t) {
  714.             var e = t.paymentData.payments[0].paymentSystem;
  715.             $.each(t.paymentData.installmentOptions, function(t) {
  716.                 this.paymentSystem == e && this.installments.length > 1 && $(".card-data.active .box-installments select option").each(function(t) {
  717.                     $(this).text($(this).text().split("S/.")[0].replace("de", "").replace("-", "").replace("seas", "deseas").replace("cuantas", "cuántas"))
  718.                 }),
  719.                 this.installments.length > 1 ? $(".box-installments").show() : $(".box-installments").hide()
  720.             })
  721.         },
  722.         calcEachInstallment: function(t) {
  723.             var e = t.paymentData.payments[0]
  724.               , i = s[e.installments - 2]
  725.               , n = e.referenceValue
  726.               , a = n * (i / 100) * Math.pow(1 + i / 100, e.installments) / (Math.pow(1 + i / 100, e.installments) - 1)
  727.               , a = (a / 100).toFixed(2);
  728.             return a
  729.         },
  730.         insertObs: function(t, e) {
  731.             if (t.paymentData.payments[0].installments > 1) {
  732.                 var i = "<div class='ctnListPayment'>"
  733.                   , n = "";
  734.                 n = '(*) El monto de la cuota mensual podrá ser igual o menor al valor que proyecte la calculadora virtual al realizar el cálculo. TCEA calculada en base a cuotas de 12 meses, a un año de 360 días. TCEA 79.67%. Ejemplo explicativo: Por un consumo de S/. 1000 pagará 12 cuotas de S/. 100.40 que incluye el total de intereses de S/. 204.83. Costo de seguro de desgravamen S/. 5 Comisión de membresía anual de S/. 39. Cuando corresponda, se cobrará comisión por envío físico de estado de cuenta de S/ 5. Aplica penalidad por pago fuera de fecha según tarifario vigente. Pagos a cuotas sujetos a ITF (0.005%). Mayor información sobre términos y condiciones en <a href="http://www.tarjetaoh.com.pe/" target="_blank">www.tarjetaoh.com.pe</a>. Información difundida de acuerdo a la ley N° 28587 y Res. SBS N° 8181-2012',
  735.                 i += "<div class='total'> <div class='nrocuotas'>" + t.paymentData.payments[0].installments + "</div> <div class='conten-cuotas'>cuotas mensuales de</div> <div class='monto-cuota'> S/ " + e + " </div></div>",
  736.                 i += "<div class='legal'>" + n + "</div>",
  737.                 i += "</div>",
  738.                 $(".card-data.active:visible .ctnListPayment").length > 0 && $(".card-data.active:visible .ctnListPayment").remove(),
  739.                 $(".card-data.active:visible").append(i),
  740.                 $(".steps-view iframe").length > 0 && ($(".steps-view > div > div:visible .ctnListPayment").length > 0 && $(".steps-view > div > div:visible .ctnListPayment").remove(),
  741.                 $(".steps-view > div > div:visible").append(i))
  742.             } else
  743.                 $(".card-data.active:visible .ctnListPayment").length > 0 && $(".card-data.active:visible .ctnListPayment").remove(),
  744.                 $(".steps-view > div > div:visible .ctnListPayment").length > 0 && $(".steps-view > div > div:visible .ctnListPayment").remove()
  745.         },
  746.         total: function(t) {
  747.             var e = $(t.target);
  748.             $(e).is(":visible") && o.setPriceOh.readyLoadPrice(function() {
  749.                 r.cart.waitDiscountOh(function() {
  750.                     var t = 0;
  751.                     $("ul.cart-items li.item").each(function() {
  752.                         var e = $(this).attr("data-discountOh");
  753.                         t += Number(e)
  754.                     }).promise().done(function() {
  755.                         if (console.log("setDiscountAll - Lencho v25", t),
  756.                         0 != t) {
  757.                             var e = 0
  758.                               , i = $(".summary:eq(0)")
  759.                               , n = i.find(".totalizers-list .Shipping .monetary").text()
  760.                               , o = i.find(".totalizers-list .Items .monetary").text()
  761.                               , r = "";
  762.                             "Gratis" != n ? (n = parseFloat(n.substring(3).replace(/[^0-9\.-]+/g, "")),
  763.                             o = parseFloat(o.substring(3).replace(/[^0-9\.-]+/g, "")),
  764.                             e = o + n - t) : (o = parseFloat(o.substring(3).replace(/[^0-9\.-]+/g, "")),
  765.                             e = o - t),
  766.                             e = e.toFixed(2),
  767.                             $("#totalOh").length ? $("#totalOh").find(".monetary").text("S/. " + e) : (r = '<tr id="totalOh">\n                    <td class="info">Total </td>\n                    <td class="space"></td>\n                    <td class="monetary">S/. ' + a.publicMethod.formatPrice(e) + '</td>\n                    <td class="empty"></td>\n                  </tr>',
  768.                             $(".cart-fixed .summary-totalizers .table tfoot").append(r))
  769.                         } else
  770.                             $("#totalOh").prev().removeClass("beforeOh"),
  771.                             $("#totalOh").remove()
  772.                     })
  773.                 })
  774.             })
  775.         },
  776.         insertValue: function(t, e) {
  777.             n.resetInstallment(),
  778.             n.insertObs(t, e),
  779.             t.paymentData.payments[0].installments > 1 && $(".box-installments").append('<p class="info-cuota">*Cada cuota es S/ ' + e + "</p>")
  780.         },
  781.         fns: function() {
  782.             $("body").on("click", ".payment-group-item:not('.active')", function() {
  783.                 $(".ctnListPayment").remove()
  784.             })
  785.         },
  786.         initCalculadora: function(t) {
  787.             if (t.paymentData.payments.length >= 1)
  788.                 if ("502" == t.paymentData.payments[0].paymentSystem || "501" == t.paymentData.payments[0].paymentSystem) {
  789.                     n.generateInstallments(t);
  790.                     var e = n.calcEachInstallment(t);
  791.                     n.insertValue(t, e)
  792.                 } else
  793.                     n.resetInstallment()
  794.         },
  795.         checkBinInterbank: function(t) {
  796.             if (t.paymentData.payments.length >= 1) {
  797.                 var e = $(".mini-cart .cart-fixed .summary-template-holder .summary-totalizers tfoot tr:nth-child(1)")
  798.                   , i = t.paymentData.payments[0].bin
  799.                   , n = ["1", "2", "4"]
  800.                   , a = t.paymentData.payments[0].paymentSystem;
  801.                 -1 != n.indexOf(a) && -1 != c.indexOf(i) ? (e.find(".info").hide(),
  802.                 e.find(".interbank").length || e.prepend('<td class="interbank" >Total pagando con </td>')) : (e.find(".info").show(),
  803.                 e.find(".interbank").remove())
  804.             }
  805.         }
  806.     };
  807.     e.payment = l
  808. }
  809. , function(t, e, i) {
  810.     "use strict";
  811.     Object.defineProperty(e, "__esModule", {
  812.         value: !0
  813.     }),
  814.     e.shipping = void 0;
  815.     var n, a = (i(0),
  816.     i(6)), o = i(3), r = {
  817.         init: function() {
  818.             return n = this,
  819.             n.initialize()
  820.         },
  821.         initialize: function() {},
  822.         shippingOptLoader: function(t) {
  823.             $(".shipping-options .product-list").length > 1 ? (console.log("MarketPlace"),
  824.             o.marketPlace.setLogistics(t)) : (console.log("PickOnStoreOn"),
  825.             a.pickStore.init())
  826.         }
  827.     };
  828.     e.shipping = r
  829. }
  830. , function(t, e, i) {
  831.     "use strict";
  832.     Object.defineProperty(e, "__esModule", {
  833.         value: !0
  834.     }),
  835.     e.pickStore = void 0;
  836.     var n, a, o, r = i(0), s = !1, c = 1, l = {
  837.         init: function() {
  838.             return n = this,
  839.             a = {
  840.                 typeSla: ["Domicilio", "Tienda"]
  841.             },
  842.             n.initialize()
  843.         },
  844.         initialize: function() {
  845.             var t = (sessionStorage.getItem("staEnv"),
  846.             sessionStorage.getItem("email"),
  847.             vtexjs.checkout.orderForm.clientProfileData.email,
  848.             vtexjs.checkout.orderForm.shippingData.logisticsInfo[0].selectedSla);
  849.             4 == r.publicMethod.hashForStep() && (n.activeStore(t.replace(/ /g, "")),
  850.             r.publicMethod.debounce(function(t) {
  851.                 n.activeMenu()
  852.             }, 200)),
  853.             $(document).on("click", ".listStores .list-store", function(t) {
  854.                 c = 0
  855.             }),
  856.             $(document).on("click", ".domicilio", n.listClickHouse).on("click", ".tienda", n.listClickStores).on("change", "select[name='cboStores']", n.formatOffices)
  857.         },
  858.         activeMenu: function() {
  859.             r.publicMethod.waitForEl(".address-shipping-options .shipping-options .btn-group-vertical", function(t) {
  860.                 n.pickOnStore(t)
  861.             })
  862.         },
  863.         pickOnStore: function(t) {
  864.             var e = a.typeSla[1];
  865.             if ("1" == sessionStorage.getItem("islocker") && (e = "Locker"),
  866.             $("#Rad1Us-pickStore").length)
  867.                 $(".shipping-options").css("css", "none"),
  868.                 $(".btn-go-to-payment").css("display", "none"),
  869.                 $("#msgBtnGoPay").css("display", "block");
  870.             else {
  871.                 $(".btn-go-to-payment").css("display", "block"),
  872.                 $("#msgBtnGoPay").css("display", "none");
  873.                 var i = vtexjs.checkout.orderForm.items
  874.                   , n = "Retiro en tienda no disponible en Lima para este producto.";
  875.                 i.length > 1 && (n = "Retiro en tienda no disponible en Lima para esta combinación de productos.");
  876.                 var o = '<div class="selectStore">Seleccione uno de los tipos de envío.</div>';
  877.                 o += '<div class="box-picking-store">',
  878.                 o += '<div class="box-ico-info"></div>',
  879.                 o += '<div class="box-message-picking">' + n + '<br>Seleccione la opción de Delivery y aproveche el <span class="text-bold">envío gratis</span> si tu compra <span class="text-bold">es mayor a S./599.</span></div>',
  880.                 o += "</div>",
  881.                 $(t).after(o);
  882.                 var r = [];
  883.                 sessionStorage.getItem("bigTicketSku") && (r = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
  884.                 0 == r.length && $(".box-picking-store").hide(),
  885.                 "Lima" != vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].city && "Lim*" != vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].city && $(".box-picking-store").hide();
  886.                 var s = (vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].postalCode,
  887.                 $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first())
  888.                   , c = s.text().split("-")[1]
  889.                   , l = 0 != $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').length ? '<a href="#" class="domicilio">Despacho a Domicilio - ' + c + "</a>" : ""
  890.                   , d = 0 != $('.sla-items-list label[for*="' + e + '"]').length ? '<a href="#" class="tienda">Retiro en tienda</a>' : ""
  891.                   , u = '<div id="Rad1Us-pickStore">\n\t\t\t\t\t\t\t' + l + "\n\t\t\t\t\t\t\t" + d + '\n\t\t\t\t\t\t\t<div class="br"></div>\n\t\t\t\t\t\t</div>';
  892.                 $(".sla-items-list .box-picking-store").after(u)
  893.             }
  894.         },
  895.         listClickHouse: function(t) {
  896.             if (c = 0,
  897.             $(".sla-items-list > .scheduled-sla, .conten-domicilio").show(),
  898.             $(".conten-tienda, .active-store").remove(),
  899.             $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').trigger("click"),
  900.             $("#Rad1Us-pickStore .tienda").removeClass("active"),
  901.             $("#Rad1Us-pickStore .tienda").attr("onClick", ""),
  902.             !$("#Rad1Us-pickStore .domicilio").hasClass("active")) {
  903.                 $("#Rad1Us-pickStore .domicilio").addClass("active"),
  904.                 $("#Rad1Us-pickStore .domicilio").attr("onClick", "return false");
  905.                 var e = $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first()
  906.                   , i = e.text().split("-")[1];
  907.                 $(".conten-domicilio").length || ($("body").removeClass("despachoElegido").addClass("despachoElegido"),
  908.                 r.publicMethod.waitForEl(".shipping-option-0", function(t) {
  909.                     var e = '<div class="conten-domicilio">\n\t\t\t\t\t\t\t\t\t\t\t<span>Despacho a Domicilio</span>\n\t\t\t\t\t\t\t\t\t\t\t<span class="price">' + i + "</span>\n\t\t\t\t\t\t\t\t\t\t</div>";
  910.                     $(t).before(e),
  911.                     s = !0
  912.                 }))
  913.             }
  914.             return $("body").removeClass("despachoElegido").addClass("despachoElegido"),
  915.             !1
  916.         },
  917.         listClickStores: function(t) {
  918.             c = 1,
  919.             $(".sla-items-list > .scheduled-sla, .conten-domicilio").hide(),
  920.             $("#Rad1Us-pickStore .domicilio").removeClass("active"),
  921.             $("#Rad1Us-pickStore .domicilio").attr("onClick", ""),
  922.             $("#Rad1Us-pickStore .tienda").hasClass("active") || ($("#Rad1Us-pickStore .tienda").addClass("active"),
  923.             $("#Rad1Us-pickStore .tienda").attr("onClick", "return false")),
  924.             $.when(n.listStoresAvailable(), n.getStores()).done(function(t, e) {
  925.                 var i = n.compareStore(t, e);
  926.                 n.formatStores(i),
  927.                 $(".domicilio").length && $(".domicilio").hasClass("active") && $(".conten-tienda").remove(),
  928.                 $(".tienda").length && $(".tienda").hasClass("active") && $(".conten-domicilio").remove()
  929.             }),
  930.             $("body").removeClass("despachoElegido").addClass("despachoElegido"),
  931.             t.preventDefault()
  932.         },
  933.         listStoresAvailable: function() {
  934.             var t = $.Deferred();
  935.             return vtexjs.checkout.getOrderForm().then(function(e) {
  936.                 t.resolve(e.shippingData.logisticsInfo[0].slas)
  937.             }),
  938.             t.promise()
  939.         },
  940.         listStoresChange: function() {
  941.             $(".changeStore").unbind().bind("click", function(t) {
  942.                 $("#Rad1Us-pickStore .tienda").trigger("click"),
  943.                 t.preventDefault()
  944.             });
  945.             var t = (vtexjs.checkout.orderForm.loggedIn,
  946.             $(".sla-items-list #seller-1-sla-Retiroentienda"));
  947.             1 == c && (sessionStorage.setItem("estado", "1"),
  948.             t.parent().trigger("click")),
  949.             $(".tienda").hasClass("active") && $(".conten-tienda").remove()
  950.         },
  951.         clickSelectStore: function() {
  952.             $(".listStores .list-store").unbind().bind("click", function(t) {
  953.                 t.preventDefault();
  954.                 var e = $(this).data("id");
  955.                 c = 0;
  956.                 var i = a.typeSla[1];
  957.                 149 == e || 152 == e || 153 == e ? (i = "Locker",
  958.                 sessionStorage.setItem("islocker", "1")) : sessionStorage.setItem("islocker", "0"),
  959.                 $('.sla-items-list label[for*="' + i + '"][for*="' + e + '"]').trigger("click"),
  960.                 $(".tienda").hasClass("active") && r.publicMethod.waitForEl(".conten-tienda", function(t) {
  961.                     $(t).remove()
  962.                 })
  963.             })
  964.         },
  965.         getStores: function() {
  966.             return r.publicMethod.cachedAjax("./../arquivos/locales.js?v=1.3")
  967.         },
  968.         formatStores: function(t) {
  969.             n.checkBigTicket(),
  970.             t.length && !$(".conten-tienda").length && r.publicMethod.waitForEl(".sla-items-list", function(e) {
  971.                 var i = vtexjs.checkout.orderForm.items
  972.                   , n = ["Lima"]
  973.                   , a = []
  974.                   , r = 0;
  975.                 if (sessionStorage.getItem("bigTicketSku") && (a = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
  976.                 0 == a.length && $(".box-picking-store").hide(),
  977.                 i)
  978.                     for (var s = 0; s < i.length; s++)
  979.                         -1 != a.indexOf(i[s].id) && r++;
  980.                 0 == r && (a = []);
  981.                 var c = '<option value="" selected> -- Seleccione -- </option>' + $.map(t, function(t) {
  982.                     return a.length ? -1 == n.indexOf(t.name) ? '<option value="' + t.name + '">' + t.name + "</option>" : void 0 : '<option value="' + t.name + '">' + t.name + "</option>"
  983.                 }).join("")
  984.                   , l = '<div class="conten-tienda">\n\t\t\t\t\t\t\t\t\t\t<span class="storeRecall">Retiro en Tienda Gratis</span>\n\t\t\t\t\t\t\t\t\t\t<label for="provincia-store" class="provincia-store">Provincia</label>\n\t\t\t\t\t\t\t\t\t\t<select name="cboStores" id="">\n\t\t\t\t\t\t\t\t\t\t\t' + c + '\n\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t<div class="txt-tiendas">\n\t\t\t\t\t\t\t\t\t\t\tConoce la tienda en la que podrás retirar tu(s) producto(s)\n\t\t\t\t\t\t\t\t\t\t\t<ul class="listStores">\n\t\t\t\t\t\t\t\t\t\t\t\t<li class="list-store" data-id="Rad1Us">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input class="radio-store" type="radio" name="store" value="store" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<label for="" class="label-store">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="chk-store"></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="name-store">Rad1Us - pickStore {[email protected]}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="address-store"></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t</ul> \n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>';
  985.                 $(e).after(l),
  986.                 o = t
  987.             })
  988.         },
  989.         formatOffices: function(t) {
  990.             var e = $(this).val();
  991.             o.forEach(function(t) {
  992.                 if (t.name == e) {
  993.                     var i = $("ul.listStores li:first").clone()
  994.                       , a = $.map(t.offices, function(t) {
  995.                         return i.attr("data-id", t.id).find(".label-store .name-store").text(t.name).parents("li").find(".label-store .address-store").text(t.address).end()[0].outerHTML
  996.                     }).join("");
  997.                     return $("ul.listStores").html(a),
  998.                     void n.clickSelectStore()
  999.                 }
  1000.             })
  1001.         },
  1002.         getAvailable: function(t, e) {
  1003.             var i = [];
  1004.             e = $.parseJSON(e);
  1005.             var o = new RegExp("(^|\\W)" + a.typeSla[0] + "($|\\W)");
  1006.             return $.each(t, function(t, a) {
  1007.                 var r = a.name;
  1008.                 if (r.length > 0 && !o.test(r)) {
  1009.                     var s = r.replace(/\./g, "").split("-")[2]
  1010.                       , c = $.trim(s);
  1011.                     "" != c && $.each(e, function(t, e) {
  1012.                         $.each(e.offices, function(t, a) {
  1013.                             i.some(function(t) {
  1014.                                 return t.name === e.name
  1015.                             }) || a.id !== c || i.push({
  1016.                                 name: e.name,
  1017.                                 lat: e.lat,
  1018.                                 lng: e.lng,
  1019.                                 zoom: e.zoom,
  1020.                                 offices: n.removeDuplicates(e.offices)
  1021.                             })
  1022.                         })
  1023.                     })
  1024.                 }
  1025.             }),
  1026.             i
  1027.         },
  1028.         removeDuplicates: function(t) {
  1029.             var e = [];
  1030.             return $.each(t, function(t, i) {
  1031.                 e.some(function(t) {
  1032.                     return t.id === i.id
  1033.                 }) || e.push(i)
  1034.             }),
  1035.             e
  1036.         },
  1037.         activeStore: function(t) {
  1038.             var e = a.typeSla[1];
  1039.             "1" == sessionStorage.getItem("islocker") && (e = "Locker"),
  1040.             r.publicMethod.debounce(function(i) {
  1041.                 r.publicMethod.waitForEl(".sla-items-list label", function() {
  1042.                     t.indexOf(a.typeSla[0]) > -1 ? $(".conten-domicilio").length || ($("body").removeClass("despachoElegido").addClass("despachoElegido"),
  1043.                     r.publicMethod.waitForEl(".shipping-option-0", function(t) {
  1044.                         var e = $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first()
  1045.                           , i = e.text().split("-")[1]
  1046.                           , n = '<div class="conten-domicilio">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span>Despacho a Domicilio</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="price">' + i + "</span>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>";
  1047.                         $(t).before(n),
  1048.                         s = !0
  1049.                     }),
  1050.                     r.publicMethod.waitForEl("#Rad1Us-pickStore .domicilio", function(t) {
  1051.                         $(".sla-items-list #seller-1-sla-Retiroentienda");
  1052.                         0 == c && ($(t).addClass("active"),
  1053.                         $(t).attr("onClick", "return false"))
  1054.                     })) : t.indexOf(e) > -1 && r.publicMethod.waitForEl("#Rad1Us-pickStore", function(e) {
  1055.                         if (!$(".active-tienda").length) {
  1056.                             var i = '<div class="active-tienda">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for="provincia-store" class="provincia-store">Tienda seleccionada</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ul class="active-store">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li class="list-store" data-id="activeTienda">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input class="radio-store" type="radio" checked="checked" name="store" value="store" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for="" class="label-store">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="chk-store"></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="name-store">' + t + '</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="change-store"><a href="#" class="changeStore">Cambiar</a></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class="address-store"></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ul> \n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>';
  1057.                             $(e).after(i),
  1058.                             $("#Rad1Us-pickStore .tienda").addClass("active"),
  1059.                             $("#Rad1Us-pickStore .tienda").attr("onClick", "return false"),
  1060.                             s = !0,
  1061.                             n.listStoresChange()
  1062.                         }
  1063.                     })
  1064.                 })
  1065.             }, 200)
  1066.         },
  1067.         compareStore: function(t, e) {
  1068.             var i = n.getAvailable(t, e)
  1069.               , a = r.publicMethod.groupBy(i, "name")
  1070.               , o = [];
  1071.             for (var s in a)
  1072.                 if (a.hasOwnProperty(s) && a[s].length) {
  1073.                     var c = {}
  1074.                       , l = [];
  1075.                     c = a[s][0];
  1076.                     for (var d = 0; d < a[s].length; d++)
  1077.                         l = a[s][d].offices,
  1078.                         c.offices = [],
  1079.                         t.forEach(function(t) {
  1080.                             var e = t.name.replace(/\./g, "").split("-")[2]
  1081.                               , i = $.trim(e);
  1082.                             if ("" != i && l.length) {
  1083.                                 var n = !0
  1084.                                   , a = !1
  1085.                                   , o = void 0;
  1086.                                 try {
  1087.                                     for (var r, s = l[Symbol.iterator](); !(n = (r = s.next()).done); n = !0)
  1088.                                         !function() {
  1089.                                             var t = r.value;
  1090.                                             c.offices.some(function(e) {
  1091.                                                 return e.id === t.id
  1092.                                             }) || t.id !== i || c.offices.push(t)
  1093.                                         }()
  1094.                                 } catch (t) {
  1095.                                     a = !0,
  1096.                                     o = t
  1097.                                 } finally {
  1098.                                     try {
  1099.                                         !n && s.return && s.return()
  1100.                                     } finally {
  1101.                                         if (a)
  1102.                                             throw o
  1103.                                     }
  1104.                                 }
  1105.                             }
  1106.                         });
  1107.                     o.push(c)
  1108.                 }
  1109.             return o
  1110.         },
  1111.         checkBigTicket: function() {
  1112.             var t = JSON.parse(sessionStorage.getItem("product"))
  1113.               , e = vtexjs.checkout.orderForm.items
  1114.               , i = []
  1115.               , n = []
  1116.               , a = !1;
  1117.             if (t.length > 0)
  1118.                 for (var o = 0; o < t.length; o++)
  1119.                     i.push(t[o].sku);
  1120.             if (e.length > 0)
  1121.                 for (var o = 0; o < e.length; o++)
  1122.                     n.push(e[o].id);
  1123.             if (e.length > 0 && i.length > 0)
  1124.                 for (var o = 0; o < e.length; o++)
  1125.                     if (-1 == i.indexOf(e[o].id)) {
  1126.                         a = !0;
  1127.                         break
  1128.                     }
  1129.             a && location.reload();
  1130.             var r = []
  1131.               , s = !1;
  1132.             if (sessionStorage.getItem("bigTicketSku") && (r = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
  1133.             r.length > 0)
  1134.                 for (var o = 0; o < r.length; o++)
  1135.                     if (-1 == n.indexOf(r[o])) {
  1136.                         s = !0;
  1137.                         break
  1138.                     }
  1139.             s && location.reload()
  1140.         }
  1141.     };
  1142.     e.pickStore = l
  1143. }
  1144. , function(t, e, i) {
  1145.     "use strict";
  1146.     var n = i(2)
  1147.       , a = i(5)
  1148.       , o = i(4)
  1149.       , r = i(1)
  1150.       , s = i(0);
  1151.     !function(t, e, i) {
  1152.         var c;
  1153.         ({
  1154.             initialize: function() {
  1155.                 return c = this,
  1156.                 t(document).ready(c.documentReady),
  1157.                 t(document).on("vtexjsReady", c.onLoad),
  1158.                 t(window).on({
  1159.                     load: function() {},
  1160.                     hashchange: function() {
  1161.                         vtex.events.actions.onHashChange(function(e) {
  1162.                             var i;
  1163.                             i = e.substring(e.indexOf(location.pathname)),
  1164.                             console.log(i, "path"),
  1165.                             "/checkout#/cart" == i || "/checkout/#/cart" == i ? (s.publicMethod.addAnimation("productInfo", n.cart.formatHtml),
  1166.                             t(".summary-template-holder .row-fluid .btnSeguirComprando").length || t(".summary-template-holder .row-fluid").append('<a href="/" class="btnSeguirComprando">Seguir comprando</a>'),
  1167.                             t(".link-volver-carrito").css("display", "none"),
  1168.                             t(".btnSeguirComprando").css("display", "block")) : (t(".link-volver-carrito").css("display", "inline-block"),
  1169.                             t(".btnSeguirComprando").css("display", "none")),
  1170.                             window.matchMedia("(max-width: 700px)").matches && t("#orderform-to-cart").css("display", "none")
  1171.                         })
  1172.                     }
  1173.                 }),
  1174.                 function() {
  1175.                     s.publicMethod.waitVtexJs(function() {
  1176.                         t(document).trigger("vtexjsReady")
  1177.                     })
  1178.                 }()
  1179.             },
  1180.             documentReady: function() {
  1181.                 vtex.i18n.es.clientProfileData.includeCo = "¿Deseas factura?",
  1182.                 vtex.i18n.es.clientProfileData.excludeCo = "Regresar",
  1183.                 vtex.i18n.es.global.backToCart = "< Volver al carrito",
  1184.                 n.cart.init(),
  1185.                 a.shipping.init(),
  1186.                 o.payment.init(),
  1187.                 t(document).on("scroll mouseover", function(e) {
  1188.                     var i, n, a = t(document).scrollTop(), o = t(window).height(), r = (t(window).width(),
  1189.                     t(".row-fluid .mini-cart .cart-fixed")), s = window.matchMedia("(max-width: 700px)");
  1190.                     t("#vtexIdContainer").length && (i = t("#vtexIdContainer .vtexIdUI").height(),
  1191.                     n = a + o / 2 - i / 2,
  1192.                     t("#vtexIdContainer .vtexIdUI").css("top", n)),
  1193.                     s.matches || (a < 136 ? r.css("top", 222) : r.css("top", 85),
  1194.                     r.hasClass("affix-top") && r.css("top", 20))
  1195.                 })
  1196.             },
  1197.             onLoad: function() {
  1198.                 if (r.setPriceOh.init(),
  1199.                 s.publicMethod.addAnimation("productInfo", r.setPriceOh.trAddProductInfo),
  1200.                 s.publicMethod.addAnimation("productInfo", n.cart.formatHtml),
  1201.                 s.publicMethod.addAnimation("serviceInfo", n.cart.listServiceProduct),
  1202.                 s.publicMethod.addAnimation("cartPrice", n.cart.subTotal),
  1203.                 s.publicMethod.addAnimation("totalOh", o.payment.total),
  1204.                 s.publicMethod.addAnimation("delivertyOptionsLoaded", a.shipping.shippingOptLoader),
  1205.                 s.publicMethod.addAnimation("cartFixed", n.cart.cartFixed),
  1206.                 s.publicMethod.addAnimation("validStoreSelec", o.payment.validStoreSelec),
  1207.                 !/mail/.test(e.location.hash)) {
  1208.                     s.publicMethod.waitForEl("#orderform-minicart-to-cart", function(e) {
  1209.                         var i = t(e).clone();
  1210.                         i.addClass("link-volver-carrito"),
  1211.                         t("#orderform-title").after(i),
  1212.                         window.matchMedia("(max-width: 700px)").matches || t("#orderform-to-cart").css("display", "none"),
  1213.                         1 != s.publicMethod.hashForStep() && void 0 != s.publicMethod.hashForStep() && 0 != s.publicMethod.hashForStep() || (t(".link-volver-carrito").css("display", "none"),
  1214.                         t(".btnSeguirComprando").css("display", "block"))
  1215.                     }),
  1216.                     s.publicMethod.waitForEl(".address-list-placeholder .address-list", function(e) {
  1217.                         t("#msgBtnGoPay").length || t(e).append('<span id="msgBtnGoPay" style="margin-top: 30px;color: red;display: block;text-align:left;">Por favor espere un momento...</span>')
  1218.                     });
  1219.                     var i = t(".orderform-template");
  1220.                     i.length && (i.hide(),
  1221.                     setTimeout(function() {
  1222.                         i.show()
  1223.                     }, 10))
  1224.                 }
  1225.                 t(document).on("keypress input focus blur", "#ship-street", function(t) {
  1226.                     var e = this;
  1227.                     return 8 == e.keyCode || !(e.value.length >= 80) && void 0
  1228.                 }),
  1229.                 t(document).on("cut copy paste", "#ship-street", function(t) {
  1230.                     return t.preventDefault(),
  1231.                     !1
  1232.                 }),
  1233.                 s.publicMethod.bigTicketProduct()
  1234.             }
  1235.         }).initialize()
  1236.     }(jQuery, window)
  1237. }
  1238. ]);
  1239.  
  1240. $(document).ready(function(){
  1241.     console.log('loading')
  1242. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement