"use strict";(self.webpackChunk_flagship_io_js_sdk=self.webpackChunk_flagship_io_js_sdk||[]).push([[831],{831:(t,i,s)=>{s.r(i),s.d(i,{CURRENCY_ERROR:()=>a,ERROR_MESSAGE:()=>r,Transaction:()=>p});var e=s(719),n=s(761),o=s(629),h=s(487);const a="{0} must be a string and have exactly 3 letters",r="Transaction Id and Transaction affiliation are required";class p extends h.HitAbstract{_transactionId;_affiliation;_taxes;_currency;_couponCode;_itemCount;_shippingMethod;_paymentMethod;_totalRevenue;_shippingCosts;get transactionId(){return this._transactionId}set transactionId(t){this.isNotEmptyString(t,"transactionId")&&(this._transactionId=t)}get affiliation(){return this._affiliation}set affiliation(t){this.isNotEmptyString(t,"affiliation")&&(this._affiliation=t)}get taxes(){return this._taxes}set taxes(t){this.isNumeric(t,"taxes")&&(this._taxes=t)}get currency(){return this._currency}set currency(t){t&&"string"==typeof t&&3===t.length?this._currency=t:(0,o.logError)(this.config,(0,o.sprintf)(a,"currency"),"currency")}get couponCode(){return this._couponCode}set couponCode(t){this.isNotEmptyString(t,"couponCode")&&(this._couponCode=t)}get itemCount(){return this._itemCount}set itemCount(t){this.isInteger(t,"itemCount")&&(this._itemCount=Math.trunc(t))}get shippingMethod(){return this._shippingMethod}set shippingMethod(t){this.isNotEmptyString(t,"shippingMethod")&&(this._shippingMethod=t)}get paymentMethod(){return this._paymentMethod}set paymentMethod(t){this.isNotEmptyString(t,"paymentMethod")&&(this._paymentMethod=t)}get totalRevenue(){return this._totalRevenue}set totalRevenue(t){this.isNumeric(t,"totalRevenue")&&(this._totalRevenue=t)}get shippingCosts(){return this._shippingCosts}set shippingCosts(t){this.isNumeric(t,"shippingCosts")&&(this._shippingCosts=t)}constructor(t){super({type:n.HitType.TRANSACTION,userIp:t.userIp,screenResolution:t.screenResolution,locale:t.locale,sessionNumber:t.sessionNumber,visitorId:t.visitorId,anonymousId:t.anonymousId,qaMode:t.qaMode,isActionTrackingHit:t.isActionTrackingHit});const{transactionId:i,affiliation:s,taxes:e,currency:o,couponCode:h,itemCount:a,shippingMethod:r,paymentMethod:p,totalRevenue:u,shippingCosts:c}=t;this.transactionId=i,this.affiliation=s,e&&(this.taxes=e),o&&(this.currency=o),h&&(this.couponCode=h),a&&(this.itemCount=a),r&&(this.shippingMethod=r),p&&(this.paymentMethod=p),u&&(this.totalRevenue=u),c&&(this.shippingCosts=c)}isReady(t=!0){return!(t&&!super.isReady()||!this.transactionId||!this.affiliation)}toApiKeys(){const t=super.toApiKeys();return t[e.TID_API_ITEM]=this.transactionId,t[e.TA_API_ITEM]=this.affiliation,this.taxes&&(t[e.TT_API_ITEM]=this.taxes),this.currency&&(t[e.TC_API_ITEM]=this.currency),this.couponCode&&(t[e.TCC_API_ITEM]=this.couponCode),this.itemCount&&(t[e.ICN_API_ITEM]=this.itemCount),this.shippingMethod&&(t[e.SM_API_ITEM]=this.shippingMethod),this.paymentMethod&&(t[e.PM_API_ITEM]=this.paymentMethod),this.totalRevenue&&(t[e.TR_API_ITEM]=this.totalRevenue),this.shippingCosts&&(t[e.TS_API_ITEM]=this.shippingCosts),t}toObject(){return{...super.toObject(),transactionId:this.transactionId,affiliation:this.affiliation,taxes:this.taxes,currency:this.currency,couponCode:this.couponCode,itemCount:this.itemCount,shippingMethod:this.shippingMethod,paymentMethod:this.paymentMethod,totalRevenue:this.totalRevenue,shippingCosts:this.shippingCosts}}getErrorMessage(){return r}}}}]);
//# sourceMappingURL=831.050484d626332271e1b8.js.map