<commit_before>(function() {
  var CheckoutAPI, _base,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  window.vtex || (window.vtex = {});

  (_base = window.vtex).checkout || (_base.checkout = {});

  CheckoutAPI = (function() {
    function CheckoutAPI() {
      this._getProfileURL = __bind(this._getProfileURL, this);
      this._getPostalCodeURL = __bind(this._getPostalCodeURL, this);
      this._getUpdateItemURL = __bind(this._getUpdateItemURL, this);
      this._startTransactionURL = __bind(this._startTransactionURL, this);
      this._getOrdersURL = __bind(this._getOrdersURL, this);
      this._getAddCouponURL = __bind(this._getAddCouponURL, this);
      this._getRemoveOfferingsURL = __bind(this._getRemoveOfferingsURL, this);
      this._getAddOfferingsURL = __bind(this._getAddOfferingsURL, this);
      this._getSaveAttachmentURL = __bind(this._getSaveAttachmentURL, this);
      this._getOrderFormURL = __bind(this._getOrderFormURL, this);
      this._getOrderFormIdFromURL = __bind(this._getOrderFormIdFromURL, this);
      this._getOrderFormIdFromCookie = __bind(this._getOrderFormIdFromCookie, this);
      this._getOrderFormId = __bind(this._getOrderFormId, this);
      this.getOrders = __bind(this.getOrders, this);
      this.startTransaction = __bind(this.startTransaction, this);
      this.getProfileByEmail = __bind(this.getProfileByEmail, this);
      this.getAddressInformation = __bind(this.getAddressInformation, this);
      this.calculateShipping = __bind(this.calculateShipping, this);
      this.removeGiftRegistry = __bind(this.removeGiftRegistry, this);
      this.removeDiscountCoupon = __bind(this.removeDiscountCoupon, this);
      this.addDiscountCoupon = __bind(this.addDiscountCoupon, this);
      this.removeItems = __bind(this.removeItems, this);
      this.updateItems = __bind(this.updateItems, this);
      this.removeOffering = __bind(this.removeOffering, this);
      this.addOffering = __bind(this.addOffering, this);
      this.addOfferingWithInfo = __bind(this.addOfferingWithInfo, this);
      this.sendLocale = __bind(this.sendLocale, this);
      this.sendAttachment = __bind(this.sendAttachment, this);
      this.getOrderForm = __bind(this.getOrderForm, this);
      this.CHECKOUT_ID = 'checkout';
      this.HOST_URL = $.url().attr('base');
      this.HOST_ORDER_FORM_URL = this.HOST_URL + '/api/checkout/pub/orderForm/';
      this.HOST_CART_URL = this.HOST_URL + '/' + $.url().segment(-2) + '/cart/';
      this.COOKIE_NAME = 'checkout.vtex.com';
      this.COOKIE_ORDER_FORM_ID_KEY = '__ofid';
      this.POSTALCODE_URL = this.HOST_URL + '/api/checkout/pub/postal-code/';
      this.GATEWAY_CALLBACK_URL = this.HOST_URL + '/checkout/gatewayCallback/{0}/{1}/{2}';
      this.requestingItem = void 0;
      this.stateRequestHashToResponseMap = {};
      this.subjectToJqXHRMap = {};
    }

    CheckoutAPI.prototype.expectedFormSections = function() {
      return ['items', 'totalizers', 'clientProfileData', 'shippingData', 'paymentData', 'sellers', 'messages', 'marketingData', 'clientPreferencesData', 'storePreferencesData', 'giftRegistryData'];
    };

    CheckoutAPI.prototype.getOrderForm = function(expectedFormSections) {
      var checkoutRequest;
      if (expectedFormSections == null) {
        expectedFormSections = this.expectedFormSections();
      }
      checkoutRequest = {
        expectedOrderFormSections: expectedFormSections
      };
      return $.ajaxQueue({
        url: this._getOrderFormURL(),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(checkoutRequest)
      });
    };

    CheckoutAPI.prototype.sendAttachment = function(attachmentId, serializedAttachment, expectedOrderFormSections, options) {
      var d, deferred, orderAttachmentRequest, requestHash, stateRequestHash, xhr, _ref,
        _this = this;
      if (expectedOrderFormSections == null) {
        expectedOrderFormSections = this.expectedFormSections();
      }
      if (options == null) {
        options = {};
      }
      orderAttachmentRequest = {
        expectedOrderFormSections: expectedOrderFormSections
      };
      if (attachmentId === void 0 || serializedAttachment === void 0) {
        d = $.Deferred();
        d.reject("Invalid arguments");
        return d.promise();
      }
      _.extend(orderAttachmentRequest, JSON.parse(serializedAttachment));
      if (options.cache && options.currentStateHash) {
        requestHash = _.hash(attachmentId + JSON.stringify(orderAttachmentRequest));
        stateRequestHash = options.currentStateHash.toString() + ':' + requestHash.toString();
        if (this.stateRequestHashToResponseMap[stateRequestHash]) {
          deferred = $.Deferred();
          deferred.resolve(this.stateRequestHashToResponseMap[stateRequestHash]);
          return deferred.promise();
        }
      }
      xhr = $.ajaxQueue({
        url: this._getSaveAttachmentURL(attachmentId),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(orderAttachmentRequest)
      });
      if (options.abort && options.subject) {
        if ((_ref = this.subjectToJqXHRMap[options.subject]) != null) {
          _ref.abort();
        }
        this.subjectToJqXHRMap[options.subject] = xhr;
      }
      if (options.cache && options.currentStateHash) {
        xhr.done(function(data) {
          return _this.stateRequestHashToResponseMap[stateRequestHash] = data;
        });
      }
      return xhr;
    };

    CheckoutAPI.prototype.sendLocale = function(locale) {
      var attachmentId, serializedAttachment;
      if (locale == null) {
        locale = 'pt-BR';
      }
      attachmentId = 'clientPreferencesData';
      serializedAttachment = JSON.stringify({
        locale: locale
      });
      return this.sendAttachment(attachmentId, serializedAttachment, []);
    };

    CheckoutAPI.prototype.addOfferingWithInfo = function(offeringId, offeringInfo, itemIndex, expectedOrderFormSections) {
      var updateItemsRequest;
      updateItemsRequest = {
        id: offeringId,
        info: offeringInfo,
        expectedOrderFormSections: expectedOrderFormSections != null ? expectedOrderFormSections : this.expectedFormSections()
      };
      return $.ajaxQueue({
        url: this._getAddOfferingsURL(itemIndex),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(updateItemsRequest)
      });
    };

    CheckoutAPI.prototype.addOffering = function(offeringId, itemIndex, expectedOrderFormSections) {
      return this.addOfferingWithInfo(offeringId, null, itemIndex, expectedOrderFormSections);
    };

    CheckoutAPI.prototype.removeOffering = function(offeringId, itemIndex, expectedOrderFormSections) {
      var updateItemsRequest;
      updateItemsRequest = {
        Id: offeringId,
        expectedOrderFormSections: expectedOrderFormSections != null ? expectedOrderFormSections : this.expectedFormSections()
      };
      return $.ajaxQueue({
        url: this._getRemoveOfferingsURL(itemIndex, offeringId),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(updateItemsRequest)
      });
    };

    CheckoutAPI.prototype.updateItems = function(itemsJS, expectedOrderFormSections) {
      var updateItemsRequest,
        _this = this;
      if (expectedOrderFormSections == null) {
        expectedOrderFormSections = this.expectedFormSections();
      }
      updateItemsRequest = {
        orderItems: itemsJS,
        expectedOrderFormSections: expectedOrderFormSections
      };
      if (this.requestingItem !== void 0) {
        this.requestingItem.abort();
        console.log('Abortando', this.requestingItem);
      }
      return this.requestingItem = $.ajaxQueue({
        url: this._getUpdateItemURL(),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(updateItemsRequest)
      }).done(function() {<commit_msg>Adiciona um novo parametro ao método "CheckoutAPI.prototype.updateItems"<commit_after>(function() {
  var CheckoutAPI, _base,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  window.vtex || (window.vtex = {});

  (_base = window.vtex).checkout || (_base.checkout = {});

  CheckoutAPI = (function() {
    function CheckoutAPI() {
      this._getProfileURL = __bind(this._getProfileURL, this);
      this._getPostalCodeURL = __bind(this._getPostalCodeURL, this);
      this._getUpdateItemURL = __bind(this._getUpdateItemURL, this);
      this._startTransactionURL = __bind(this._startTransactionURL, this);
      this._getOrdersURL = __bind(this._getOrdersURL, this);
      this._getAddCouponURL = __bind(this._getAddCouponURL, this);
      this._getRemoveOfferingsURL = __bind(this._getRemoveOfferingsURL, this);
      this._getAddOfferingsURL = __bind(this._getAddOfferingsURL, this);
      this._getSaveAttachmentURL = __bind(this._getSaveAttachmentURL, this);
      this._getOrderFormURL = __bind(this._getOrderFormURL, this);
      this._getOrderFormIdFromURL = __bind(this._getOrderFormIdFromURL, this);
      this._getOrderFormIdFromCookie = __bind(this._getOrderFormIdFromCookie, this);
      this._getOrderFormId = __bind(this._getOrderFormId, this);
      this.getOrders = __bind(this.getOrders, this);
      this.startTransaction = __bind(this.startTransaction, this);
      this.getProfileByEmail = __bind(this.getProfileByEmail, this);
      this.getAddressInformation = __bind(this.getAddressInformation, this);
      this.calculateShipping = __bind(this.calculateShipping, this);
      this.removeGiftRegistry = __bind(this.removeGiftRegistry, this);
      this.removeDiscountCoupon = __bind(this.removeDiscountCoupon, this);
      this.addDiscountCoupon = __bind(this.addDiscountCoupon, this);
      this.removeItems = __bind(this.removeItems, this);
      this.updateItems = __bind(this.updateItems, this);
      this.removeOffering = __bind(this.removeOffering, this);
      this.addOffering = __bind(this.addOffering, this);
      this.addOfferingWithInfo = __bind(this.addOfferingWithInfo, this);
      this.sendLocale = __bind(this.sendLocale, this);
      this.sendAttachment = __bind(this.sendAttachment, this);
      this.getOrderForm = __bind(this.getOrderForm, this);
      this.CHECKOUT_ID = 'checkout';
      this.HOST_URL = $.url().attr('base');
      this.HOST_ORDER_FORM_URL = this.HOST_URL + '/api/checkout/pub/orderForm/';
      this.HOST_CART_URL = this.HOST_URL + '/' + $.url().segment(-2) + '/cart/';
      this.COOKIE_NAME = 'checkout.vtex.com';
      this.COOKIE_ORDER_FORM_ID_KEY = '__ofid';
      this.POSTALCODE_URL = this.HOST_URL + '/api/checkout/pub/postal-code/';
      this.GATEWAY_CALLBACK_URL = this.HOST_URL + '/checkout/gatewayCallback/{0}/{1}/{2}';
      this.requestingItem = void 0;
      this.stateRequestHashToResponseMap = {};
      this.subjectToJqXHRMap = {};
    }

    CheckoutAPI.prototype.expectedFormSections = function() {
      return ['items', 'totalizers', 'clientProfileData', 'shippingData', 'paymentData', 'sellers', 'messages', 'marketingData', 'clientPreferencesData', 'storePreferencesData', 'giftRegistryData'];
    };

    CheckoutAPI.prototype.getOrderForm = function(expectedFormSections) {
      var checkoutRequest;
      if (expectedFormSections == null) {
        expectedFormSections = this.expectedFormSections();
      }
      checkoutRequest = {
        expectedOrderFormSections: expectedFormSections
      };
      return $.ajaxQueue({
        url: this._getOrderFormURL(),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(checkoutRequest)
      });
    };

    CheckoutAPI.prototype.sendAttachment = function(attachmentId, serializedAttachment, expectedOrderFormSections, options) {
      var d, deferred, orderAttachmentRequest, requestHash, stateRequestHash, xhr, _ref,
        _this = this;
      if (expectedOrderFormSections == null) {
        expectedOrderFormSections = this.expectedFormSections();
      }
      if (options == null) {
        options = {};
      }
      orderAttachmentRequest = {
        expectedOrderFormSections: expectedOrderFormSections
      };
      if (attachmentId === void 0 || serializedAttachment === void 0) {
        d = $.Deferred();
        d.reject("Invalid arguments");
        return d.promise();
      }
      _.extend(orderAttachmentRequest, JSON.parse(serializedAttachment));
      if (options.cache && options.currentStateHash) {
        requestHash = _.hash(attachmentId + JSON.stringify(orderAttachmentRequest));
        stateRequestHash = options.currentStateHash.toString() + ':' + requestHash.toString();
        if (this.stateRequestHashToResponseMap[stateRequestHash]) {
          deferred = $.Deferred();
          deferred.resolve(this.stateRequestHashToResponseMap[stateRequestHash]);
          return deferred.promise();
        }
      }
      xhr = $.ajaxQueue({
        url: this._getSaveAttachmentURL(attachmentId),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(orderAttachmentRequest)
      });
      if (options.abort && options.subject) {
        if ((_ref = this.subjectToJqXHRMap[options.subject]) != null) {
          _ref.abort();
        }
        this.subjectToJqXHRMap[options.subject] = xhr;
      }
      if (options.cache && options.currentStateHash) {
        xhr.done(function(data) {
          return _this.stateRequestHashToResponseMap[stateRequestHash] = data;
        });
      }
      return xhr;
    };

    CheckoutAPI.prototype.sendLocale = function(locale) {
      var attachmentId, serializedAttachment;
      if (locale == null) {
        locale = 'pt-BR';
      }
      attachmentId = 'clientPreferencesData';
      serializedAttachment = JSON.stringify({
        locale: locale
      });
      return this.sendAttachment(attachmentId, serializedAttachment, []);
    };

    CheckoutAPI.prototype.addOfferingWithInfo = function(offeringId, offeringInfo, itemIndex, expectedOrderFormSections) {
      var updateItemsRequest;
      updateItemsRequest = {
        id: offeringId,
        info: offeringInfo,
        expectedOrderFormSections: expectedOrderFormSections != null ? expectedOrderFormSections : this.expectedFormSections()
      };
      return $.ajaxQueue({
        url: this._getAddOfferingsURL(itemIndex),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(updateItemsRequest)
      });
    };

    CheckoutAPI.prototype.addOffering = function(offeringId, itemIndex, expectedOrderFormSections) {
      return this.addOfferingWithInfo(offeringId, null, itemIndex, expectedOrderFormSections);
    };

    CheckoutAPI.prototype.removeOffering = function(offeringId, itemIndex, expectedOrderFormSections) {
      var updateItemsRequest;
      updateItemsRequest = {
        Id: offeringId,
        expectedOrderFormSections: expectedOrderFormSections != null ? expectedOrderFormSections : this.expectedFormSections()
      };
      return $.ajaxQueue({
        url: this._getRemoveOfferingsURL(itemIndex, offeringId),
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(updateItemsRequest)
      });
    };

    CheckoutAPI.prototype.updateItems = function(itemsJS, expectedOrderFormSections, ajaxOptions) {
      var updateItemsRequest,
        _this = this;
      if (expectedOrderFormSections == null) {
        expectedOrderFormSections = this.expectedFormSections();
      }
      updateItemsRequest = {
        orderItems: itemsJS,
        expectedOrderFormSections: expectedOrderFormSections
      };
      if (this.requestingItem !== void 0) {
        this.requestingItem.abort();
        console.log('Abortando', this.requestingItem);
      }
      return this.requestingItem = $.ajaxQueue($.extend(
        {
          url: this._getUpdateItemURL(),
          type: 'POST',
          contentType: 'application/json; charset=utf-8',
          dataType: 'json',
          data: JSON.stringify(updateItemsRequest)
        },
        ajaxOptions
      )).done(function() {
{'fraction_non_alphanumeric': 0.11603311778570134, 'fraction_numerical': 0.001571281803348039, 'mean_word_length': 3.284826514759192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1736336', 'n_tokens_mistral': 4799, 'n_tokens_neox': 4793, 'n_words': 784}