PageSourceSearch

https://www.letoile.kz/dist/PromoCodesModal-00575549.js

js letoile.kz collected 2026-09-29 22:49:27 UTC 6,981 bytes, 8 lines download raw bytes

1import{b as i,c as a}from"./vendor-vue-15488850.js";import{bf as d,s as l}from"./integrations-segmentstream-d01b6c8e.js";import{a as n}from"./index-e3a5a1c2.js";import m from"./PromoCodeCard-68a72c43.js";import p from"./PromoCodeCardSkeleton-d1b1cee1.js";import c from"./PromoCodesEmpty-809c923a.js";import{n as C}from"./vendor-splide-d9a079dc.js";import"./vendor-a9303273.js";import"./locales-ru-bba83fc0.js";import"./locales-cn-79b85608.js";import"./config-mapping-47fd6e48.js";import"./vendor-lodash-59d95206.js";import"./vendor-date-fns-8fd1b05b.js";import"./vendor-pswp-a811abc6.js";import"./storage-cbd59dc5.js";import"./svg-icons-1599cbf9.js";import"./UsagePeriod-9121b864.js";import"./Countdown-476e04a5.js";import"./CopyButton-4715d141.js";import"./SpinnerCircular-83ba99c8.js";const h=4,P={name:"PromoCodesModal",components:{PromoCodesEmpty:c,PromoCodeCardSkeleton:p,PromoCodeCard:m,LeIcon:n},props:{payload:{type:Object,default:()=>({})}},data(){return{isLoading:!0,appliedPromoCodes:[],generalPromoCodes:[],counter:0,loadingPromoCode:null,applicablePromoCodesKey:0,hasPromoCodes:!1}},computed:{...i("profile/coupons",["promoCodesCopyTime","titleForAppliedPromoCodes","titleForGeneralPromoCodes"]),promoCodesSkeletonList(){return Array(h).fill({})},modalClasses(){return{"promo-codes-modal--only-applicable":this.showOnlyApplicablePromoCodes,"promo-codes-modal--empty":!this.hasPromoCodes&&!this.isLoading}},localTitleForAppliedPromoCodes(){return this.showOnlyApplicablePromoCodes?"":this.titleForAppliedPromoCodes?this.titleForAppliedPromoCodes:this.$t("checkout:heading.titleForAppliedPromoCodes")},localTitleForGeneralPromoCodes(){return this.titleForGeneralPromoCodes?this.titleForGeneralPromoCodes:this.$t("checkout:heading.titleForGeneralPromoCodes")},hasPromoCodesApplied(){return!!this.appliedPromoCodes.length},hasGeneralPromoCodes(){return this.localTitleForGeneralPromoCodes&&this.generalPromoCodes.length},isPromoCodeCardHasNotLink(){return!this.payload.needLink},place(){return this.payload.place||""},showOnlyApplicablePromoCodes(){return this.payload.showOnlyApplicablePromoCodes??!1}},mounted(){this.$emit("modalContentLoaded"),this.getPromoCodes(this.payload.selectedSkuId)},beforeDestroy(){this.setShouldGetUnavailablePromoCodesOnCheckout(!0),this.setShouldGetUnavailablePromoCodesOnCart(!0)},methods:{...a("checkout",["setShouldGetPersonalPromotions"]),...a("checkout",{setShouldGetUnavailablePromoCodesOnCheckout:"setShouldGetUnavailablePromoCodes"}),...a("cart",{setShouldGetUnavailablePromoCodesOnCart:"setShouldGetUnavailablePromoCodes"}),closeModal(){this.$modal.close()},async getPromoCodes(r){var o,e;try{const s=await this.$service(d).getPromoCodes({skuId:r});if(this.generalPromoCodes=s.filter(t=>t.endUsable),this.generalPromoCodes.length)this.hasPromoCodes=!0;else{this.hasPromoCodes=!1;return}this.getApplicablePromoCodes()}catch(s){const t=((e=(o=s.errors)==null?void 0:o[0])==null?void 0:e.message)||this.$t("base:errorMessages.generalErrorMessage");this.$snackbar.open(t,2e3,l.error)}finally{this.isLoading=!1,this.applicablePromoCodesKey++}},getApplicablePromoCodes(){const r=[],o=[];this.generalPromoCodes.forEach((e,s)=>{e.itemId=`${e.promoId}-${s}`,e.isPromoCodeCopying=!1,e.isPromoApplicable?r.push(e):o.push(e)}),this.appliedPromoCodes=r,this.generalPromoCodes=o},async copyContent(r,o){try{await navigator.clipboard.writeText(r),this.setPromoCodeCopying(o),this.resetCopyingContent(o),this.sendGA4Event(r)}catch(e){console.error(e),this.$snackbar.open(e,0,l.error,{canClose:!0})}},setPromoCodeCopying(r){this.generalPromoCodes.forEach(o=>{o.isPromoCodeCopying=o.itemId===r}),this.appliedPromoCodes.forEach(o=>{o.isPromoCodeCopying=o.itemId===r}),this.counter++},resetCopyingContent(r){const o=this.promoCodesCopyTime*1e3;setTimeout(()=>{this.generalPromoCodes.forEach(e=>{e.itemId===r&&(e.isPromoCodeCopying=!1)}),this.appliedPromoCodes.forEach(e=>{e.itemId===r&&(e.isPromoCodeCopying=!1)}),this.counter++},o)},sendGA4Event(r){this.$sendGA4Event({name:"click_copy_promocode",promocode:r,place:"promocodes",sku_id:null})},onPromoCodeApply(r){this.sendPromoCodeApplyEvent(null,r.promoCode),this.getPromoCodes(this.payload.selectedSkuId),this.setShouldGetPersonalPromotions(!0),this.setShouldGetUnavailablePromoCodesOnCheckout(!0),this.setShouldGetUnavailablePromoCodesOnCart(!0)},onPromoCodeLoading(r,o){this.loadingPromoCode=r?o:null},isPromoCodeDisabled(r){return this.loadingPromoCode?r.itemId!==this.loadingPromoCode.itemId:!1},onPromoCodeApplyError(r,o){this.sendPromoCodeApplyEvent(r,o.promoCode)},sendPromoCodeApplyEvent(r,o){this.$sendGA4Event({name:"click_apply_promocode",is_error:r,promocode:o,place:this.place})}}};var u=function(){var o=this,e=o._self._c;return e("div",{staticClass:"letu-modal promo-codes-modal",class:o.modalClasses},[e("div",{staticClass:"promo-codes-modal__header"},[e("h3",{staticClass:"promo-codes-modal__header-title"},[o._v(`
2      `+o._s(o.$t("checkout:heading.allPromoCodesModalTitle"))+`
3    `)]),o._v(" "),e("LeIcon",{attrs:{iconClass:"promo-codes-modal__close",n
3ame:"close"},on:{click:o.closeModal}})],1),o._v(" "),e("div",{staticClass:"promo-codes-modal__body"},[o.isLoading?[e("div",{staticClass:"promo-codes-modal__container"},o._l(o.promoCodesSkeletonList,function(s,t){return e("PromoCodeCardSkeleton",{key:`promo-code-card-skeleton-${t}`})}),1)]:[o.hasPromoCodes?[o.hasPromoCodesApplied?e("div",{staticClass:"promo-codes-modal__wrapper"},[o.localTitleForAppliedPromoCodes?e("h3",{staticClass:"promo-codes-modal__title promo-codes-modal__title--applied"},[e("LeIcon",{directives:[{name:"fragment",rawName:"v-fragment"}],attrs:{iconClass:"promo-codes-modal__title-icon",isStroke:"",name:"checkbox-mark"}}),o._v(`
4            `+o._s(o.localTitleForAppliedPromoCodes)+`
5          `)],1):o._e(),o._v(" "),e("div",{staticClass:"promo-codes-modal__container"},o._l(o.appliedPromoCodes,function(s){return e("PromoCodeCard",{key:`${s.itemId}_${o.counter}_${o.applicablePromoCodesKey}`,attrs:{isNotLink:o.isPromoCodeCardHasNotLink,item:s,isDisabled:o.isPromoCodeDisabled(s),place:o.place},on:{copyClick:o.copyContent,"apply:success":o.onPromoCodeApply,"apply:loading":o.onPromoCodeLoading,"apply:error":o.onPromoCodeApplyError}})}),1)]):o._e(),o._v(" "),o.showOnlyApplicablePromoCodes?o._e():e("div",[o.hasGeneralPromoCodes?e("h3",{staticClass:"promo-codes-modal__title"},[o._v(`
6            `+o._s(o.localTitleForGeneralPromoCodes)+`
7          `)]):o._e(),o._v(" "),e("div",{staticClass:"promo-codes-modal__container"},o._l(o.generalPromoCodes,function(s){return e("PromoCodeCard",{key:`${s.itemId}_${o.counter}`,attrs:{isNotLink:o.isPromoCodeCardHasNotLink,item:s,place:o.place},on:{copyClick:o.copyContent,"apply:success":o.onPromoCodeApply,"apply:loading":o.onPromoCodeLoading,"apply:error":o.onPromoCodeApplyError}})}),1)])]:e("PromoCodesEmpty")]],2)])},_=[],y=C(P,u,_,!1,null,null,null,null);const D=y.exports;export{D as default};
8//# sourceMappingURL=PromoCodesModal-00575549.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.