Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*! CheckOut - Oechsle
- * Uploaded on: (2 Julio, 2019 - 13:1pm)
- * Version: 1.1
- * @requires jQuery v1.5 or later
- * Autor: Antony tasayco {[email protected]} */
- !function(t) {
- function e(n) {
- if (i[n])
- return i[n].exports;
- var a = i[n] = {
- i: n,
- l: !1,
- exports: {}
- };
- return t[n].call(a.exports, a, a.exports, e),
- a.l = !0,
- a.exports
- }
- var i = {};
- e.m = t,
- e.c = i,
- e.i = function(t) {
- return t
- }
- ,
- e.d = function(t, i, n) {
- e.o(t, i) || Object.defineProperty(t, i, {
- configurable: !1,
- enumerable: !0,
- get: n
- })
- }
- ,
- e.n = function(t) {
- var i = t && t.__esModule ? function() {
- return t.default
- }
- : function() {
- return t
- }
- ;
- return e.d(i, "a", i),
- i
- }
- ,
- e.o = function(t, e) {
- return Object.prototype.hasOwnProperty.call(t, e)
- }
- ,
- e.p = "",
- e(e.s = 7)
- }([function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- });
- var n = {}
- , a = {}
- , o = {
- cart: [],
- email: [],
- profile: [],
- shipping: [],
- payment: [],
- cartLoaded: [],
- orderPlaced: [],
- itemsUpdated: []
- }
- , r = {
- waitVtexJs: function(t) {
- var e = 0
- , i = setInterval(function() {
- window.vtexjs.checkout.orderForm && (t(),
- clearInterval(i)),
- e++ >= 300 && clearInterval(i)
- }, 1e3)
- },
- waitForEl: function(t, e) {
- $(t).length ? e(t) : setTimeout(function() {
- r.waitForEl(t, e)
- }, 100)
- },
- cachedAjax: function(t) {
- return n[t] || (n[t] = $.Deferred(function(e) {
- $.ajax(t).then(function(t) {
- return e.resolve(t)
- })
- }).promise()),
- n[t]
- },
- groupBy: function(t, e) {
- return t.reduce(function(t, i) {
- return (t[i[e]] = t[i[e]] || []).push(i),
- t
- }, {})
- },
- debounce: function(t, e) {
- var i;
- return i = null,
- function() {
- var n, a;
- return a = this,
- n = arguments,
- clearTimeout(i),
- i = setTimeout(function() {
- return t.apply(a, n)
- }, e)
- }()
- },
- runStep: function() {
- 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++)
- if (t[n]in o && (o[t[n]] = o[t[n]].concat(e),
- ~i.indexOf(t[n])))
- for (var r = e.length; r--; )
- e[r].call(null, t[n])
- },
- hashForStep: function() {
- var t = 0;
- switch (window.location.hash) {
- case "#/cart":
- t = 1;
- break;
- case "#/email":
- t = 2;
- break;
- case "#/profile":
- t = 3;
- break;
- case "#/shipping":
- t = 4;
- break;
- case "#/payment":
- t = 5;
- break;
- default:
- t = void 0
- }
- return t
- },
- addAnimation: function(t, e) {
- Object.keys(a).length || (document.addEventListener("animationstart", function(t) {
- if (t.animationName in a)
- for (var e = 0, i = a[t.animationName].length; e < i; e++)
- a[t.animationName][e].call(null, t)
- }),
- document.addEventListener("webkitAnimationStart", function(t) {
- if (t.animationName in a)
- for (var e = 0, i = a[t.animationName].length; e < i; e++)
- a[t.animationName][e].call(null, t)
- }),
- document.addEventListener("MSAnimationStart", function(t) {
- if (t.animationName in a)
- for (var e = 0, i = a[t.animationName].length; e < i; e++)
- a[t.animationName][e].call(null, t)
- }),
- document.addEventListener("oAnimationStart", function(t) {
- if (t.animationName in a)
- for (var e = 0, i = a[t.animationName].length; e < i; e++)
- a[t.animationName][e].call(null, t)
- }),
- document.addEventListener("mozAnimationStart", function(t) {
- if (t.animationName in a)
- for (var e = 0, i = a[t.animationName].length; e < i; e++)
- a[t.animationName][e].call(null, t)
- })),
- a[t]instanceof Array || (a[t] = []),
- a[t].push(e)
- },
- percentDiscount: function(t, e) {
- return (e - e * (t / 100)).toFixed(2)
- },
- formatPrice: function(t) {
- return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
- },
- bigTicketProduct: function() {
- var t = new Date
- , e = t.getTime()
- , i = []
- , n = vtexjs.checkout.orderForm.items;
- if (n)
- for (var a = 0; a < n.length; a++)
- i.push(n[a].id);
- $.ajax({
- async: "true",
- crossDomain: !0,
- url: "https://tienda.oechsle.pe/api-resource/?fn=checkBigTicket&v=" + e,
- type: "POST",
- data: {
- skus: i
- },
- "cache-control": "no-cache",
- "Content-Type": "application/json",
- error: function(t, e, i) {
- console.log(t + "--" + e + "--" + i)
- }
- }).done(function(t) {
- sessionStorage.setItem("bigTicketSku", t)
- })
- }
- };
- e.publicMethod = r
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.setPriceOh = void 0;
- var n, a = i(0), o = i(3), r = [], s = [], c = 1, l = {
- startLoadCount: 0,
- endLoadCount: 19
- }, d = {
- startLoadCount: 0,
- endLoadCount: 19
- }, u = {
- init: function() {
- return n = this,
- n.initialize()
- },
- initialize: function() {
- n.getInfoProduct(),
- $(".cart-template.full-cart .cart").addClass("show-items"),
- $(document).on("click", ".deleteRow", n.deleteRow),
- $(window).on("beforeunload", function() {
- sessionStorage.removeItem("product")
- })
- },
- getApiToSku: function(t) {
- var e = $.Deferred()
- , i = "/api/catalog_system/pub/products/search?fq=" + t + "&_from=0&_to=49";
- return $.ajax({
- url: i,
- async: !1
- }).done(function(t) {
- e.resolve(t)
- }).fail(e.reject),
- e.promise()
- },
- getItem: function(t, e) {
- var i, a = 1 == e ? n.getAllProduct() : vtexjs.checkout.orderForm.items;
- return $.each(a, function() {
- return (1 == e ? this.sku : this.id) == t ? (i = this,
- !1) : void 0
- }),
- i
- },
- readyLoadPrice: function(t) {
- window.Rad1UsOh ? t() : setTimeout(function() {
- n.readyLoadPrice(t)
- }, 100)
- },
- trAddProductInfo: function(t) {
- n.readyLoadPrice(function() {
- var e = $(t.target)
- , i = e.closest("tr.product-item, li.item")
- , r = (e.closest("tr.product-item"),
- i.data("sku"))
- , s = n.getItem(r, !1)
- , c = n.getItem(r, !0)
- , l = 0
- , d = 0;
- if (null != c && "" != c && void 0 !== c.priceOh && null !== c.priceOh && 0 !== c.priceOh && c.price > c.priceOh) {
- var u = c.priceOh.toFixed(2);
- d = (u * s.quantity).toFixed(2),
- e.find(".product-price .new-product-real-price-per-unit").addClass("block tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(u)),
- e.find(".quantity-price .total-selling-price").removeClass("hide").addClass("block tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(d)),
- e.find(".description .price").css("display", "block").addClass("tarjeta-oh").html("S/. " + a.publicMethod.formatPrice(u)),
- l = 0 != d ? (c.price - u) * s.quantity : d
- }
- i.attr("data-discountOh", l),
- e.find(".product-name .deleteRow").length || e.find(".product-name .brand").after("<a class='deleteRow' href='#'>X <span>Eliminar</span</a>"),
- e.find(".quantity-price .total-price").removeClass("hide").addClass("block").parents("td").addClass("none-bg"),
- o.marketPlace.cartLogo(s, e),
- n.setHtmlSku(e)
- })
- },
- setHtmlSku: function(t) {
- var e = t.closest("tr.product-item")
- , i = "";
- e.find(".sku").length || (i = "<span class='sku'>SKU: " + e.data("sku") + "</span>",
- e.find(".brand").append(i))
- },
- blockProducts: function(t) {
- var e = t;
- void 0 !== e && e && (c >= d.startLoadCount && c <= d.endLoadCount ? s.push(e) : (r.push(s),
- s = [],
- d.startLoadCount = d.endLoadCount,
- d.endLoadCount = d.endLoadCount + l.endLoadCount,
- n.blockProducts(t),
- c--)),
- c++
- },
- getAllProduct: function() {
- var t = sessionStorage.getItem("product");
- return null != t ? JSON.parse(t) : 0
- },
- setSavePrice: function(t) {
- for (var e = vtexjs.checkout.orderForm.items, i = 0; i < e.length; i++)
- for (var a = 0; a < t.length; a++)
- if (e[i].productId == t[a].productId) {
- var o = new Object
- , r = n.getAllProduct()
- , s = null
- , c = n.identificarDataPromoBySku(t[a].items, e[i].id)
- , l = n.determineOH(c[0].promotion);
- s = r.length ? r : [],
- o.sku = c[0].sku,
- o.priceOh = l.priceOh,
- o.price = l.regularPrice,
- s.push(o),
- sessionStorage.setItem("product", JSON.stringify(s))
- }
- },
- identificarDataPromoBySku: function(t, e) {
- for (var i = new Object, n = [], a = 0; a < t.length; a++)
- if (t[a].itemId == e) {
- i.sku = e,
- i.promotion = t[a].sellers[0].commertialOffer,
- n.push(i);
- break
- }
- return n
- },
- determineOH: function(t) {
- var e = t.Price
- , i = []
- , n = []
- , a = 0
- , o = 0
- , r = 0;
- return void 0 !== t.Teasers && null != t.Teasers && $(t.Teasers).each(function(t, r) {
- var s = r["<Name>k__BackingField"].toString().toLowerCase()
- , c = r["<Effects>k__BackingField"]["<Parameters>k__BackingField"][0];
- "PercentualDiscount" == c["<Name>k__BackingField"] && s.indexOf("tarjeta oh!") >= 0 && (a = (e - e * Number(c["<Value>k__BackingField"]) / 100).toFixed(2),
- i.push(Number(a))),
- "MaximumUnitPriceDiscount" == c["<Name>k__BackingField"] && s.indexOf("#maxprice") >= 0 && (o = Number(c["<Value>k__BackingField"]) / 100,
- n.push(Number(o))),
- "PromotionalPriceTableItemsIds" == c["<Name>k__BackingField"] && s.indexOf("#maxprice") >= 0 && (c = r["<Effects>k__BackingField"]["<Parameters>k__BackingField"][1],
- o = (e - Number(c["<Value>k__BackingField"])).toFixed(2),
- n.push(Number(o)))
- }),
- r = Math.min.apply(null, n.concat(i)),
- {
- priceOh: r,
- regularPrice: t.Price
- }
- },
- getInfoProduct: function() {
- var t = []
- , e = vtexjs.checkout.orderForm.items;
- void 0 !== e && e && $.when($.each(e, function(t, e) {
- var i = e.productId;
- n.blockProducts(i)
- })).then(function() {
- s.length && (r.push(s),
- s = []),
- $(r).each(function(e, i) {
- var a = $.map(i, function(t) {
- return "productId%3A" + t
- }).join("%2C");
- t.push(n.getApiToSku(a))
- }),
- $.when.apply($, t).done(function() {
- $.when($.each(arguments, function(t, e) {
- n.setSavePrice(e)
- })).then(function() {
- console.log("i.getAllProduct", n.getAllProduct()),
- window.Rad1UsOh = !0
- })
- })
- })
- },
- deleteRow: function(t) {
- var e = $(this).parents("tr").attr("data-sku")
- , i = JSON.parse(sessionStorage.getItem("bigTicketSku"))
- , n = [];
- if (i) {
- for (var a = 0; a < i.length; a++)
- e != i[a] && n.push(i[a]);
- sessionStorage.setItem("bigTicketSku", JSON.stringify(n))
- }
- $(this).parents("tr").find("td.item-remove a.item-link-remove").trigger("click"),
- t.preventDefault()
- },
- removeService: function() {
- $("#tblOne > tbody > tr.item-service").each(function() {})
- }
- };
- e.setPriceOh = u
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.cart = void 0;
- var n, a = i(0), o = i(1), r = {
- init: function() {
- return n = this,
- n.initialize()
- },
- initialize: function() {
- 3 == a.publicMethod.hashForStep() && console.log("cart"),
- $("#client-profile-data").on("componentValidated.vtex", function(t, e) {
- $(document).on("click", "#client-profile-data form.form-step p.submit", n.checkTermsAndConditions)
- })
- },
- formatHtml: function(t) {
- var e = $(t.target)
- , i = e.find(".product-name")
- , o = e.find(".product-name .product-service")
- , r = e.attr("data-sku");
- a.publicMethod.waitForEl(o, function(t) {
- n.servicios(t, r)
- }),
- a.publicMethod.waitForEl(i, function(t) {
- n.oneService(t, r)
- })
- },
- oneService: function(t, e) {
- 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++) {
- if (o = i[m].id,
- o == e && (a = i[m].offerings,
- n = i[m].bundleItems,
- p = !0),
- a.length > 0)
- for (var f = 0; f < a.length; f++)
- s = a[f].type.toString().toLowerCase(),
- (s.indexOf("reem") >= 0 || s.indexOf("rep") >= 0) && d++,
- s.indexOf("armado") >= 0 && u++;
- if (n.length > 0)
- for (var f = 0; f < n.length; f++)
- r = n[f].additionalInfo.offeringType,
- r = r.toString().toLowerCase(),
- (r.indexOf("reem") >= 0 || r.indexOf("rep") >= 0) && c++,
- r.indexOf("armado") >= 0 && l++;
- if (p)
- break
- }
- 1 == c && d > 1 && 0 == u && t.find(".add-service-container").css("display", "none"),
- 1 == l && u > 1 && 0 == d && t.find(".add-service-container").css("display", "none"),
- 1 == c && 1 == l && t.find(".add-service-container").css("display", "none")
- },
- servicios: function(t, e) {
- var i = t
- , n = 0
- , a = 0;
- $(t).prepend('<div class="ctrls-tooltip-checkout"><i>!</i> Selecciona un tipo de servicio</div>'),
- $(document).on("click", ".bundle-item-add-button", function(t) {
- var e = $(this)
- , i = e.parent().find(".btn-mini").val()
- , n = e.parent().parent().parent().find(".ctrls-tooltip-checkout")
- , a = $(document).scrollTop()
- , o = e.parents(".product-item").height();
- if (console.log(n, "tooltip"),
- "nd" == i)
- return n.addClass("active"),
- setTimeout(function() {
- n.removeClass("active")
- }, 3e3),
- !1;
- $(".show-items").stop(!0, !0).animate({
- scrollTop: a + o + 150
- }, 3e3)
- }),
- $(t).find("select").each(function(t, i) {
- var o = $(this);
- o.find("option.op0").length || o.prepend($("<option>", {
- text: "Súper Garantía y/o Armado",
- class: "op0",
- val: "nd"
- }).attr("selected", "selected")),
- o.find("option").each(function(t, e) {
- var i = $(this).text().toLowerCase()
- , n = i.charAt(0).toUpperCase() + i.slice(1);
- (i.indexOf("reem") >= 0 || i.indexOf("rep") >= 0) && $(this).addClass("opSuperGarantia"),
- i.indexOf("armado") >= 0 && !$(this).hasClass("op0") && $(this).addClass("opArmado"),
- $(this).text(n)
- });
- var r = vtexjs.checkout.orderForm.items
- , s = {}
- , c = ""
- , l = "";
- o.find(".opSuperGarantia").css("display", "block"),
- o.find(".opArmado").css("display", "block");
- for (var d = 0; d < r.length; d++)
- if (c = r[d].id,
- c == e && (s = r[d].bundleItems),
- s.length > 0)
- for (var u = 0; u < s.length; u++)
- l = s[u].additionalInfo.offeringType,
- l = l.toString().toLowerCase(),
- (l.indexOf("reem") >= 0 || l.indexOf("rep") >= 0) && (o.find(".opSuperGarantia").css("display", "none"),
- n++),
- l.indexOf("armado") >= 0 && (o.find(".opArmado").css("display", "none"),
- a++)
- }),
- n > 0 && a > 0 && i.css("display", "none")
- },
- habilitarServicio: function() {
- "nd" == $(this).val() ? $(this).parent().find("input[type=submit]").prop("disabled", !0) : $(this).parent().find("input[type=submit]").prop("disabled", !1),
- $(document).on("change", "select.btn-mini", n.habilitarServicio)
- },
- listServiceProduct: function(t) {
- var e = $(t.target);
- e.closest("tr").prev().find(".product-name .product-service"),
- e.find("td.bundle-quantity-price").addClass("none-bg"),
- 0 == e.find(".bundle-item-image .deleteService").length && (e.find(".bundle-item-image span").after("<a class='deleteService' href='#'>X <span>Eliminar</span</a>"),
- $(document).on("click", ".deleteService", n.deleteService))
- },
- subTotal: function(t) {
- var e = $(t.target);
- o.setPriceOh.readyLoadPrice(function() {
- var t = 0;
- $(".cart-items > tbody > tr.product-item").each(function() {
- var e = $(this).attr("data-discountOh");
- t += Number(e)
- }).promise().done(function() {
- if (t > 0) {
- var i = e.parent().find("tr:first td.monetary").text()
- , n = parseFloat(i.substring(3).replace(/[^0-9\.-]+/g, ""))
- , o = (n - t).toFixed(2)
- , r = '<tr class="orderPriceOh">\n <td class="info"><p class="info-text-cart">Total pagando con </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>';
- 0 == $(".totalizers-list tr.orderPriceOh").length ? $(".totalizers-list tr.Items").after(r) : $(".totalizers-list tr.orderPriceOh").get(0).innerHTML = r
- }
- $(".summary-template-holder .row-fluid .btnSeguirComprando").length || $(".summary-template-holder .row-fluid").append('<a href="/" class="btnSeguirComprando">Seguir comprando</a>')
- })
- }),
- e.parents("table").addClass("show-price").find("tbody").css({
- opacity: "1"
- })
- },
- readyAllPriceOh: function(t) {
- var e = 0;
- return $(".cart-items > tbody > tr.product-item, .cart-items > li.item").each(function() {
- if (void 0 === $(this).attr("data-discountOh"))
- return e++,
- !1
- }),
- e
- },
- waitDiscountOh: function(t) {
- 1 == n.readyAllPriceOh() ? setTimeout(function() {
- n.waitDiscountOh(t)
- }, 100) : t()
- },
- deleteService: function(t) {
- $(this).parents("tr").find("td.item-remove a.item-link-remove").trigger("click"),
- t.preventDefault()
- },
- checkTermsAndConditions: function() {
- return $("#client-profile-data .terms-conditions input:checked").length ? ($("#client-profile-data .terms-conditions").removeClass("error"),
- !0) : ($("#client-profile-data .terms-conditions").removeClass("error").addClass("error"),
- !1)
- },
- cartFixed: function(t) {
- var e = $(t.target)
- , i = "";
- 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>',
- e.find("h2").before(i),
- n.cartFixedEvent())
- },
- applyOrRemove: function(t) {
- null != t && null != t.coupon ? ($("div.Rad1UsCupon").find(".inputCupon input").val(t.coupon),
- $("div.Rad1UsCupon").find(".inputCupon .txtCoupon").text("Borrar cupón")) : ($("div.Rad1UsCupon").find(".inputCupon input").val(""),
- $("div.Rad1UsCupon").find(".inputCupon .txtCoupon").text("Aplicar cupón"))
- },
- cartFixedEvent: function() {
- $(".Rad1UsCupon .txtCupon .showInputCupon").unbind("click").bind("click", function(t) {
- var e = vtexjs.checkout.orderForm.marketingData;
- $(this).parent().hide().next().show(),
- n.applyOrRemove(e),
- t.preventDefault()
- }),
- $(".Rad1UsCupon .inputCupon .backCupon").unbind("click").bind("click", function(t) {
- $(this).parent().hide().parents(".Rad1UsCupon").find(".txtCupon").show(),
- t.preventDefault()
- }),
- $(".Rad1UsCupon .inputCupon .txtCoupon").unbind("click").bind("click", function(t) {
- var e = ""
- , i = vtexjs.checkout.orderForm.marketingData;
- null != i && null != i.coupon ? $("#cart-coupon-remove").trigger("click") : (e = $(this).closest("div").find("input").val(),
- $("#cart-coupon").val(e).trigger("change"),
- $("#cart-coupon-add").trigger("click")),
- $(this).closest("div").addClass("loadCupon"),
- n.onLoadCoupon(),
- t.preventDefault()
- })
- },
- onLoadCoupon: function() {
- $(document).ajaxSuccess(function(t, e, i) {
- try {
- if (i.url.match(vtexjs.checkout._getAddCouponURL()) && void 0 !== e.responseText) {
- var a = $.parseJSON(e.responseText)
- , o = a.marketingData;
- n.applyOrRemove(o),
- $(".txtCoupon").closest("div").removeClass("loadCupon")
- }
- } catch (t) {}
- })
- }
- };
- e.cart = r
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.marketPlace = void 0;
- var n = (i(0),
- {
- initialize: function() {},
- cartLogo: function(t, e) {
- var i;
- "Promart" == t.seller ? (e.addClass("row-promart"),
- i = "promart") : (e.addClass("row-oechsle"),
- i = "oechsle");
- 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>';
- 0 == e.find(".product-image .despacho-row").length && e.find(".product-image a").after(n)
- },
- setLogistics: function(t) {
- var e = $(t.target);
- $(".shipping-options .product-list").each(function(t, e) {
- var i = $(this);
- if ("oechsle" == i.closest("table").prev().find(".products-from-seller-container .products-from-seller-name").text() && !$("body").hasClass("mktPlcSetLogistics")) {
- var n = i.closest("table").next().find(".btn-group-vertical select");
- n.val("Despacho a Domicilio"),
- n.trigger("change"),
- $("body").addClass("mktPlcSetLogistics")
- }
- }).promise().done(function() {
- e.addClass("logisticsMarketPlace")
- })
- },
- hashPayment: function(t) {
- document.location.href.indexOf("#/payment") > -1 && ($("body").hasClass("oepr") || $("body").hasClass("onlyPromart")) && setTimeout(function t() {
- 1 == $("#payment-group-PagoEfectivoPaymentGroup").length ? $("#payment-group-PagoEfectivoPaymentGroup").remove() : setTimeout(t, 300)
- }, 300)
- },
- openModal: function(t) {
- t.preventDefault(),
- $(".js-condiciones").fadeIn(),
- $("body, html").css({
- overflow: "hidden"
- })
- },
- cerrarModal: function(t) {
- t.preventDefault(),
- $(".js-condiciones").fadeOut(),
- $("body, html").removeAttr("style")
- }
- });
- e.marketPlace = n
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.payment = void 0;
- 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 = {
- init: function() {
- return n = this,
- n.initialize()
- },
- initialize: function() {
- n.fns(),
- vtexjs.checkout.getOrderForm().done(function(t) {
- n.checkBinInterbank(t),
- n.initCalculadora(t)
- }),
- sessionStorage.setItem("estado", "0"),
- vtex.events.actions.onHashChange(function(t) {
- var e;
- e = t.substring(t.indexOf(location.pathname));
- var i = location.origin + location.pathname;
- "/checkout#/payment" == e && (n.validStoreSelec(),
- n.hideTotalTarjetaOh());
- var a = sessionStorage.getItem("estado");
- "/checkout#/payment" == e && "0" == a && (location.href = i + "#/shipping",
- sessionStorage.setItem("estado", "1"))
- }),
- $(window).on("orderFormUpdated.vtex", function(t, e) {
- n.checkBinInterbank(e),
- n.initCalculadora(e)
- })
- },
- validStoreSelec: function() {
- var t = location.origin + location.pathname
- , e = vtexjs.checkout.orderForm.shippingData.logisticsInfo[0].selectedSla
- , i = vtexjs.checkout.orderForm.clientProfileData.email;
- null != e && (e = e.replace(/ /g, "")),
- "Retiroentienda" === e ? location.href = t + "#/shipping" : (sessionStorage.setItem("staEnv", "1"),
- sessionStorage.setItem("email", i))
- },
- hideTotalTarjetaOh: function() {
- var t = $(".payment-group a.payment-group-item.active").text().toLowerCase();
- console.log(t, "initHide"),
- -1 !== t.indexOf("tarjeta oh") && ($("#totalOh").hide(),
- $("#totalOh").prev().addClass("beforeOh")),
- $(".payment-group a.payment-group-item").click(function() {
- var t = $(this).text().toLowerCase();
- console.log(t, "getTextOh"),
- -1 !== t.indexOf("tarjeta oh") ? ($("#totalOh").hide(),
- $("#totalOh").prev().addClass("beforeOh")) : ($("#totalOh").prev().removeClass("beforeOh"),
- $("#totalOh").show())
- })
- },
- resetInstallment: function() {
- $(".info-cuota").remove()
- },
- generateInstallments: function(t) {
- var e = t.paymentData.payments[0].paymentSystem;
- $.each(t.paymentData.installmentOptions, function(t) {
- this.paymentSystem == e && this.installments.length > 1 && $(".card-data.active .box-installments select option").each(function(t) {
- $(this).text($(this).text().split("S/.")[0].replace("de", "").replace("-", "").replace("seas", "deseas").replace("cuantas", "cuántas"))
- }),
- this.installments.length > 1 ? $(".box-installments").show() : $(".box-installments").hide()
- })
- },
- calcEachInstallment: function(t) {
- var e = t.paymentData.payments[0]
- , i = s[e.installments - 2]
- , n = e.referenceValue
- , a = n * (i / 100) * Math.pow(1 + i / 100, e.installments) / (Math.pow(1 + i / 100, e.installments) - 1)
- , a = (a / 100).toFixed(2);
- return a
- },
- insertObs: function(t, e) {
- if (t.paymentData.payments[0].installments > 1) {
- var i = "<div class='ctnListPayment'>"
- , n = "";
- 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',
- 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>",
- i += "<div class='legal'>" + n + "</div>",
- i += "</div>",
- $(".card-data.active:visible .ctnListPayment").length > 0 && $(".card-data.active:visible .ctnListPayment").remove(),
- $(".card-data.active:visible").append(i),
- $(".steps-view iframe").length > 0 && ($(".steps-view > div > div:visible .ctnListPayment").length > 0 && $(".steps-view > div > div:visible .ctnListPayment").remove(),
- $(".steps-view > div > div:visible").append(i))
- } else
- $(".card-data.active:visible .ctnListPayment").length > 0 && $(".card-data.active:visible .ctnListPayment").remove(),
- $(".steps-view > div > div:visible .ctnListPayment").length > 0 && $(".steps-view > div > div:visible .ctnListPayment").remove()
- },
- total: function(t) {
- var e = $(t.target);
- $(e).is(":visible") && o.setPriceOh.readyLoadPrice(function() {
- r.cart.waitDiscountOh(function() {
- var t = 0;
- $("ul.cart-items li.item").each(function() {
- var e = $(this).attr("data-discountOh");
- t += Number(e)
- }).promise().done(function() {
- if (console.log("setDiscountAll - Lencho v25", t),
- 0 != t) {
- var e = 0
- , i = $(".summary:eq(0)")
- , n = i.find(".totalizers-list .Shipping .monetary").text()
- , o = i.find(".totalizers-list .Items .monetary").text()
- , r = "";
- "Gratis" != n ? (n = parseFloat(n.substring(3).replace(/[^0-9\.-]+/g, "")),
- o = parseFloat(o.substring(3).replace(/[^0-9\.-]+/g, "")),
- e = o + n - t) : (o = parseFloat(o.substring(3).replace(/[^0-9\.-]+/g, "")),
- e = o - t),
- e = e.toFixed(2),
- $("#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>',
- $(".cart-fixed .summary-totalizers .table tfoot").append(r))
- } else
- $("#totalOh").prev().removeClass("beforeOh"),
- $("#totalOh").remove()
- })
- })
- })
- },
- insertValue: function(t, e) {
- n.resetInstallment(),
- n.insertObs(t, e),
- t.paymentData.payments[0].installments > 1 && $(".box-installments").append('<p class="info-cuota">*Cada cuota es S/ ' + e + "</p>")
- },
- fns: function() {
- $("body").on("click", ".payment-group-item:not('.active')", function() {
- $(".ctnListPayment").remove()
- })
- },
- initCalculadora: function(t) {
- if (t.paymentData.payments.length >= 1)
- if ("502" == t.paymentData.payments[0].paymentSystem || "501" == t.paymentData.payments[0].paymentSystem) {
- n.generateInstallments(t);
- var e = n.calcEachInstallment(t);
- n.insertValue(t, e)
- } else
- n.resetInstallment()
- },
- checkBinInterbank: function(t) {
- if (t.paymentData.payments.length >= 1) {
- var e = $(".mini-cart .cart-fixed .summary-template-holder .summary-totalizers tfoot tr:nth-child(1)")
- , i = t.paymentData.payments[0].bin
- , n = ["1", "2", "4"]
- , a = t.paymentData.payments[0].paymentSystem;
- -1 != n.indexOf(a) && -1 != c.indexOf(i) ? (e.find(".info").hide(),
- e.find(".interbank").length || e.prepend('<td class="interbank" >Total pagando con </td>')) : (e.find(".info").show(),
- e.find(".interbank").remove())
- }
- }
- };
- e.payment = l
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.shipping = void 0;
- var n, a = (i(0),
- i(6)), o = i(3), r = {
- init: function() {
- return n = this,
- n.initialize()
- },
- initialize: function() {},
- shippingOptLoader: function(t) {
- $(".shipping-options .product-list").length > 1 ? (console.log("MarketPlace"),
- o.marketPlace.setLogistics(t)) : (console.log("PickOnStoreOn"),
- a.pickStore.init())
- }
- };
- e.shipping = r
- }
- , function(t, e, i) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.pickStore = void 0;
- var n, a, o, r = i(0), s = !1, c = 1, l = {
- init: function() {
- return n = this,
- a = {
- typeSla: ["Domicilio", "Tienda"]
- },
- n.initialize()
- },
- initialize: function() {
- var t = (sessionStorage.getItem("staEnv"),
- sessionStorage.getItem("email"),
- vtexjs.checkout.orderForm.clientProfileData.email,
- vtexjs.checkout.orderForm.shippingData.logisticsInfo[0].selectedSla);
- 4 == r.publicMethod.hashForStep() && (n.activeStore(t.replace(/ /g, "")),
- r.publicMethod.debounce(function(t) {
- n.activeMenu()
- }, 200)),
- $(document).on("click", ".listStores .list-store", function(t) {
- c = 0
- }),
- $(document).on("click", ".domicilio", n.listClickHouse).on("click", ".tienda", n.listClickStores).on("change", "select[name='cboStores']", n.formatOffices)
- },
- activeMenu: function() {
- r.publicMethod.waitForEl(".address-shipping-options .shipping-options .btn-group-vertical", function(t) {
- n.pickOnStore(t)
- })
- },
- pickOnStore: function(t) {
- var e = a.typeSla[1];
- if ("1" == sessionStorage.getItem("islocker") && (e = "Locker"),
- $("#Rad1Us-pickStore").length)
- $(".shipping-options").css("css", "none"),
- $(".btn-go-to-payment").css("display", "none"),
- $("#msgBtnGoPay").css("display", "block");
- else {
- $(".btn-go-to-payment").css("display", "block"),
- $("#msgBtnGoPay").css("display", "none");
- var i = vtexjs.checkout.orderForm.items
- , n = "Retiro en tienda no disponible en Lima para este producto.";
- i.length > 1 && (n = "Retiro en tienda no disponible en Lima para esta combinación de productos.");
- var o = '<div class="selectStore">Seleccione uno de los tipos de envío.</div>';
- o += '<div class="box-picking-store">',
- o += '<div class="box-ico-info"></div>',
- 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>',
- o += "</div>",
- $(t).after(o);
- var r = [];
- sessionStorage.getItem("bigTicketSku") && (r = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
- 0 == r.length && $(".box-picking-store").hide(),
- "Lima" != vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].city && "Lim*" != vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].city && $(".box-picking-store").hide();
- var s = (vtexjs.checkout.orderForm.shippingData.selectedAddresses[0].postalCode,
- $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first())
- , c = s.text().split("-")[1]
- , l = 0 != $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').length ? '<a href="#" class="domicilio">Despacho a Domicilio - ' + c + "</a>" : ""
- , d = 0 != $('.sla-items-list label[for*="' + e + '"]').length ? '<a href="#" class="tienda">Retiro en tienda</a>' : ""
- , 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>';
- $(".sla-items-list .box-picking-store").after(u)
- }
- },
- listClickHouse: function(t) {
- if (c = 0,
- $(".sla-items-list > .scheduled-sla, .conten-domicilio").show(),
- $(".conten-tienda, .active-store").remove(),
- $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').trigger("click"),
- $("#Rad1Us-pickStore .tienda").removeClass("active"),
- $("#Rad1Us-pickStore .tienda").attr("onClick", ""),
- !$("#Rad1Us-pickStore .domicilio").hasClass("active")) {
- $("#Rad1Us-pickStore .domicilio").addClass("active"),
- $("#Rad1Us-pickStore .domicilio").attr("onClick", "return false");
- var e = $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first()
- , i = e.text().split("-")[1];
- $(".conten-domicilio").length || ($("body").removeClass("despachoElegido").addClass("despachoElegido"),
- r.publicMethod.waitForEl(".shipping-option-0", function(t) {
- 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>";
- $(t).before(e),
- s = !0
- }))
- }
- return $("body").removeClass("despachoElegido").addClass("despachoElegido"),
- !1
- },
- listClickStores: function(t) {
- c = 1,
- $(".sla-items-list > .scheduled-sla, .conten-domicilio").hide(),
- $("#Rad1Us-pickStore .domicilio").removeClass("active"),
- $("#Rad1Us-pickStore .domicilio").attr("onClick", ""),
- $("#Rad1Us-pickStore .tienda").hasClass("active") || ($("#Rad1Us-pickStore .tienda").addClass("active"),
- $("#Rad1Us-pickStore .tienda").attr("onClick", "return false")),
- $.when(n.listStoresAvailable(), n.getStores()).done(function(t, e) {
- var i = n.compareStore(t, e);
- n.formatStores(i),
- $(".domicilio").length && $(".domicilio").hasClass("active") && $(".conten-tienda").remove(),
- $(".tienda").length && $(".tienda").hasClass("active") && $(".conten-domicilio").remove()
- }),
- $("body").removeClass("despachoElegido").addClass("despachoElegido"),
- t.preventDefault()
- },
- listStoresAvailable: function() {
- var t = $.Deferred();
- return vtexjs.checkout.getOrderForm().then(function(e) {
- t.resolve(e.shippingData.logisticsInfo[0].slas)
- }),
- t.promise()
- },
- listStoresChange: function() {
- $(".changeStore").unbind().bind("click", function(t) {
- $("#Rad1Us-pickStore .tienda").trigger("click"),
- t.preventDefault()
- });
- var t = (vtexjs.checkout.orderForm.loggedIn,
- $(".sla-items-list #seller-1-sla-Retiroentienda"));
- 1 == c && (sessionStorage.setItem("estado", "1"),
- t.parent().trigger("click")),
- $(".tienda").hasClass("active") && $(".conten-tienda").remove()
- },
- clickSelectStore: function() {
- $(".listStores .list-store").unbind().bind("click", function(t) {
- t.preventDefault();
- var e = $(this).data("id");
- c = 0;
- var i = a.typeSla[1];
- 149 == e || 152 == e || 153 == e ? (i = "Locker",
- sessionStorage.setItem("islocker", "1")) : sessionStorage.setItem("islocker", "0"),
- $('.sla-items-list label[for*="' + i + '"][for*="' + e + '"]').trigger("click"),
- $(".tienda").hasClass("active") && r.publicMethod.waitForEl(".conten-tienda", function(t) {
- $(t).remove()
- })
- })
- },
- getStores: function() {
- return r.publicMethod.cachedAjax("./../arquivos/locales.js?v=1.3")
- },
- formatStores: function(t) {
- n.checkBigTicket(),
- t.length && !$(".conten-tienda").length && r.publicMethod.waitForEl(".sla-items-list", function(e) {
- var i = vtexjs.checkout.orderForm.items
- , n = ["Lima"]
- , a = []
- , r = 0;
- if (sessionStorage.getItem("bigTicketSku") && (a = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
- 0 == a.length && $(".box-picking-store").hide(),
- i)
- for (var s = 0; s < i.length; s++)
- -1 != a.indexOf(i[s].id) && r++;
- 0 == r && (a = []);
- var c = '<option value="" selected> -- Seleccione -- </option>' + $.map(t, function(t) {
- return a.length ? -1 == n.indexOf(t.name) ? '<option value="' + t.name + '">' + t.name + "</option>" : void 0 : '<option value="' + t.name + '">' + t.name + "</option>"
- }).join("")
- , 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>';
- $(e).after(l),
- o = t
- })
- },
- formatOffices: function(t) {
- var e = $(this).val();
- o.forEach(function(t) {
- if (t.name == e) {
- var i = $("ul.listStores li:first").clone()
- , a = $.map(t.offices, function(t) {
- 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
- }).join("");
- return $("ul.listStores").html(a),
- void n.clickSelectStore()
- }
- })
- },
- getAvailable: function(t, e) {
- var i = [];
- e = $.parseJSON(e);
- var o = new RegExp("(^|\\W)" + a.typeSla[0] + "($|\\W)");
- return $.each(t, function(t, a) {
- var r = a.name;
- if (r.length > 0 && !o.test(r)) {
- var s = r.replace(/\./g, "").split("-")[2]
- , c = $.trim(s);
- "" != c && $.each(e, function(t, e) {
- $.each(e.offices, function(t, a) {
- i.some(function(t) {
- return t.name === e.name
- }) || a.id !== c || i.push({
- name: e.name,
- lat: e.lat,
- lng: e.lng,
- zoom: e.zoom,
- offices: n.removeDuplicates(e.offices)
- })
- })
- })
- }
- }),
- i
- },
- removeDuplicates: function(t) {
- var e = [];
- return $.each(t, function(t, i) {
- e.some(function(t) {
- return t.id === i.id
- }) || e.push(i)
- }),
- e
- },
- activeStore: function(t) {
- var e = a.typeSla[1];
- "1" == sessionStorage.getItem("islocker") && (e = "Locker"),
- r.publicMethod.debounce(function(i) {
- r.publicMethod.waitForEl(".sla-items-list label", function() {
- t.indexOf(a.typeSla[0]) > -1 ? $(".conten-domicilio").length || ($("body").removeClass("despachoElegido").addClass("despachoElegido"),
- r.publicMethod.waitForEl(".shipping-option-0", function(t) {
- var e = $('.sla-items-list label[for*="' + a.typeSla[0] + '"]').first()
- , i = e.text().split("-")[1]
- , 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>";
- $(t).before(n),
- s = !0
- }),
- r.publicMethod.waitForEl("#Rad1Us-pickStore .domicilio", function(t) {
- $(".sla-items-list #seller-1-sla-Retiroentienda");
- 0 == c && ($(t).addClass("active"),
- $(t).attr("onClick", "return false"))
- })) : t.indexOf(e) > -1 && r.publicMethod.waitForEl("#Rad1Us-pickStore", function(e) {
- if (!$(".active-tienda").length) {
- 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>';
- $(e).after(i),
- $("#Rad1Us-pickStore .tienda").addClass("active"),
- $("#Rad1Us-pickStore .tienda").attr("onClick", "return false"),
- s = !0,
- n.listStoresChange()
- }
- })
- })
- }, 200)
- },
- compareStore: function(t, e) {
- var i = n.getAvailable(t, e)
- , a = r.publicMethod.groupBy(i, "name")
- , o = [];
- for (var s in a)
- if (a.hasOwnProperty(s) && a[s].length) {
- var c = {}
- , l = [];
- c = a[s][0];
- for (var d = 0; d < a[s].length; d++)
- l = a[s][d].offices,
- c.offices = [],
- t.forEach(function(t) {
- var e = t.name.replace(/\./g, "").split("-")[2]
- , i = $.trim(e);
- if ("" != i && l.length) {
- var n = !0
- , a = !1
- , o = void 0;
- try {
- for (var r, s = l[Symbol.iterator](); !(n = (r = s.next()).done); n = !0)
- !function() {
- var t = r.value;
- c.offices.some(function(e) {
- return e.id === t.id
- }) || t.id !== i || c.offices.push(t)
- }()
- } catch (t) {
- a = !0,
- o = t
- } finally {
- try {
- !n && s.return && s.return()
- } finally {
- if (a)
- throw o
- }
- }
- }
- });
- o.push(c)
- }
- return o
- },
- checkBigTicket: function() {
- var t = JSON.parse(sessionStorage.getItem("product"))
- , e = vtexjs.checkout.orderForm.items
- , i = []
- , n = []
- , a = !1;
- if (t.length > 0)
- for (var o = 0; o < t.length; o++)
- i.push(t[o].sku);
- if (e.length > 0)
- for (var o = 0; o < e.length; o++)
- n.push(e[o].id);
- if (e.length > 0 && i.length > 0)
- for (var o = 0; o < e.length; o++)
- if (-1 == i.indexOf(e[o].id)) {
- a = !0;
- break
- }
- a && location.reload();
- var r = []
- , s = !1;
- if (sessionStorage.getItem("bigTicketSku") && (r = JSON.parse(sessionStorage.getItem("bigTicketSku"))),
- r.length > 0)
- for (var o = 0; o < r.length; o++)
- if (-1 == n.indexOf(r[o])) {
- s = !0;
- break
- }
- s && location.reload()
- }
- };
- e.pickStore = l
- }
- , function(t, e, i) {
- "use strict";
- var n = i(2)
- , a = i(5)
- , o = i(4)
- , r = i(1)
- , s = i(0);
- !function(t, e, i) {
- var c;
- ({
- initialize: function() {
- return c = this,
- t(document).ready(c.documentReady),
- t(document).on("vtexjsReady", c.onLoad),
- t(window).on({
- load: function() {},
- hashchange: function() {
- vtex.events.actions.onHashChange(function(e) {
- var i;
- i = e.substring(e.indexOf(location.pathname)),
- console.log(i, "path"),
- "/checkout#/cart" == i || "/checkout/#/cart" == i ? (s.publicMethod.addAnimation("productInfo", n.cart.formatHtml),
- t(".summary-template-holder .row-fluid .btnSeguirComprando").length || t(".summary-template-holder .row-fluid").append('<a href="/" class="btnSeguirComprando">Seguir comprando</a>'),
- t(".link-volver-carrito").css("display", "none"),
- t(".btnSeguirComprando").css("display", "block")) : (t(".link-volver-carrito").css("display", "inline-block"),
- t(".btnSeguirComprando").css("display", "none")),
- window.matchMedia("(max-width: 700px)").matches && t("#orderform-to-cart").css("display", "none")
- })
- }
- }),
- function() {
- s.publicMethod.waitVtexJs(function() {
- t(document).trigger("vtexjsReady")
- })
- }()
- },
- documentReady: function() {
- vtex.i18n.es.clientProfileData.includeCo = "¿Deseas factura?",
- vtex.i18n.es.clientProfileData.excludeCo = "Regresar",
- vtex.i18n.es.global.backToCart = "< Volver al carrito",
- n.cart.init(),
- a.shipping.init(),
- o.payment.init(),
- t(document).on("scroll mouseover", function(e) {
- var i, n, a = t(document).scrollTop(), o = t(window).height(), r = (t(window).width(),
- t(".row-fluid .mini-cart .cart-fixed")), s = window.matchMedia("(max-width: 700px)");
- t("#vtexIdContainer").length && (i = t("#vtexIdContainer .vtexIdUI").height(),
- n = a + o / 2 - i / 2,
- t("#vtexIdContainer .vtexIdUI").css("top", n)),
- s.matches || (a < 136 ? r.css("top", 222) : r.css("top", 85),
- r.hasClass("affix-top") && r.css("top", 20))
- })
- },
- onLoad: function() {
- if (r.setPriceOh.init(),
- s.publicMethod.addAnimation("productInfo", r.setPriceOh.trAddProductInfo),
- s.publicMethod.addAnimation("productInfo", n.cart.formatHtml),
- s.publicMethod.addAnimation("serviceInfo", n.cart.listServiceProduct),
- s.publicMethod.addAnimation("cartPrice", n.cart.subTotal),
- s.publicMethod.addAnimation("totalOh", o.payment.total),
- s.publicMethod.addAnimation("delivertyOptionsLoaded", a.shipping.shippingOptLoader),
- s.publicMethod.addAnimation("cartFixed", n.cart.cartFixed),
- s.publicMethod.addAnimation("validStoreSelec", o.payment.validStoreSelec),
- !/mail/.test(e.location.hash)) {
- s.publicMethod.waitForEl("#orderform-minicart-to-cart", function(e) {
- var i = t(e).clone();
- i.addClass("link-volver-carrito"),
- t("#orderform-title").after(i),
- window.matchMedia("(max-width: 700px)").matches || t("#orderform-to-cart").css("display", "none"),
- 1 != s.publicMethod.hashForStep() && void 0 != s.publicMethod.hashForStep() && 0 != s.publicMethod.hashForStep() || (t(".link-volver-carrito").css("display", "none"),
- t(".btnSeguirComprando").css("display", "block"))
- }),
- s.publicMethod.waitForEl(".address-list-placeholder .address-list", function(e) {
- 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>')
- });
- var i = t(".orderform-template");
- i.length && (i.hide(),
- setTimeout(function() {
- i.show()
- }, 10))
- }
- t(document).on("keypress input focus blur", "#ship-street", function(t) {
- var e = this;
- return 8 == e.keyCode || !(e.value.length >= 80) && void 0
- }),
- t(document).on("cut copy paste", "#ship-street", function(t) {
- return t.preventDefault(),
- !1
- }),
- s.publicMethod.bigTicketProduct()
- }
- }).initialize()
- }(jQuery, window)
- }
- ]);
- $(document).ready(function(){
- console.log('loading')
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement