PageSourceSearch

https://www.accessorize.com/on/demandware.static/Sites-accessorize…/js/loyalty/AppliedVouchers.js

js accessorize.com collected 2026-09-25 15:05:01 UTC 13,039 bytes, 1 lines download raw bytes

1(self.webpackChunkmnsn=self.webpackChunkmnsn||[]).push([[1139,4784],{53303:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var diff_dom__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(92485),squirrelly__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(95153),squirrelly__WEBPACK_IMPORTED_MODULE_1___namespace_object={};function htmlStringToElement(e){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}function getTemplate(e){return document.querySelector("script#".concat(e,'[type="text/x-squirrelly-template"]'))}function update(e,t){if("string"==typeof t&&(t=htmlStringToElement(t)),e instanceof HTMLElement&&t instanceof HTMLElement){var r=new diff_dom__WEBPACK_IMPORTED_MODULE_0__.ad({maxChildCount:!1}),n=r.diff(e,t);n&&n.length&&r.apply(e,n)}}function empty(e){if(e instanceof HTMLElement)for(;e.firstChild;)e.removeChild(e.firstChild)}function append(e,t){"string"==typeof t?e.insertAdjacentHTML("beforeEnd",t):e.append(t)}function prepend(e,t){"string"==typeof t?e.insertAdjacentHTML("afterbegin",t):e.prepend(t)}function escapeQuotes(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/"/g,"&quot;")}function msgfHelper(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.replace(/((?:[^{}]|(?:\{\{)|(?:\}\}))+)|(?:\{([0-9]+)\})/g,function(e,t,n){return t?t.replace(/(?:{{)|(?:}})/g,function(e){return e[0]}):n<r.length?r[n]:""})}function msgfSafeHelper(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return escapeQuotes(msgfHelper.apply(void 0,[e].concat(r)))}function render(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof HTMLElement&&t){var n=getTemplate(t);n&&(squirrelly__WEBPACK_IMPORTED_MODULE_1__.K3(!1),squirrelly__WEBPACK_IMPORTED_MODULE_1__.A8("msgf",msgfHelper),squirrelly__WEBPACK_IMPORTED_MODULE_1__.A8("msgfSafe",msgfSafeHelper),squirrelly__WEBPACK_IMPORTED_MODULE_1__.YZ("escapeQuotes",escapeQuotes),update(e,squirrelly__WEBPACK_IMPORTED_MODULE_1__.Wx(n.innerHTML)(r,squirrelly__WEBPACK_IMPORTED_MODULE_1___namespace_object)))}}function renderElement(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement("div");return render(r,e,t),r}function processScripts(element){for(var scripts=element.getElementsByTagName("script"),i=0,max=scripts.length;i<max;i++)eval(scripts[i].text)}__webpack_require__.r(squirrelly__WEBPACK_IMPORTED_MODULE_1___namespace_object),__webpack_require__.d(squirrelly__WEBPACK_IMPORTED_MODULE_1___namespace_object,{Compile:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.Wx},F:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.F},H:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.H},P:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.P},Render:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.dw},__express:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.H5},autoEscaping:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.K3},defaultTags:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.nK},defineFilter:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.YZ},defineHelper:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.A8},defineNativeHelper:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.Jc},definePartial:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.xl},load:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.Hh},renderFile:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.VB},setDefaultFilters:function(){return squirrelly__WEBPACK_IMPORTED_MODULE_1__.Jx}}),__webpack_exports__.A={append:append,prepend:prepend,render:render,renderElement:renderElement,update:update,empty:empty,processScripts:processScripts}},39114:function(e,t,r){"use strict";r.d(t,{u:function(){return i}});var n="h-loading",i={start:function(e,t){e instanceof HTMLElement&&e.classList.add(t||n)},stop:function(e,t){e instanceof HTMLElement&&(t&&e.classList.contains(t)?e.classList.remove(t):e.classList.contains(n)&&e.classList.remove(n))}}},90301:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return h}});var n=r(29620),i=r(75451),o=r(8207),u=r(53303),s=r(43047);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}function l(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}
1function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(l,e);var t,r,n=function(e){var t=_();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),n.apply(this,arguments)}return t=l,(r=[{key:"render",value:function(e){u.A.render(this.element,"template-applied-vouchers",e)}},{key:"initState",value:function(){this.state.event="voucher:card:removed",this.state.paymentMethodID=this.options.paymentMethodId||"SVS_LOYALTYVOUCHER",this.state.isVoucher=!0}},{key:"bindEvents",value:function(){(0,i.Mm)("click",this.element,s.BTN_REMOVE_SELECTOR,this.remove.bind(this)),o.J.on("voucher:card:edit",this.triggerRemove,this),o.J.on("voucher:card:applied",this.update,this),o.J.on("checkout:shipping:method:submitted",this.update,this),o.J.on("checkout:shipping:store:selected",this.update,this),o.J.on("checkout:coupon:applied",this.update,this),o.J.on("checkout:coupon:removed",this.update,this),o.J.on("checkout:payment:failed",this.highlightFailed,this)}},{key:"destroy",value:function(){(0,i.AU)("click",this.element,this.remove),o.J.off("voucher:card:edit",this.triggerRemove),o.J.off("voucher:card:applied",this.update),o.J.off("checkout:shipping:method:submitted",this.update),o.J.off("checkout:shipping:store:selected",this.update),o.J.off("checkout:coupon:applied",this.update),o.J.off("checkout:coupon:removed",this.update),o.J.off("checkout:payment:failed",this.highlightFailed,this)}},{key:"triggerRemove",value:function(){this.element.querySelector(s.BTN_REMOVE_SELECTOR).click()}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(n.default)},29620:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return m}});var n=r(3273),i=r(91076),o=r(53303),u=r(8207),s=r(45387),c=r(75451),a=r(39114),l=r(43047);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(p,e);var t,r,i=function(e){var t=d();return function(){var r,n=y(e);if(t){var i=y(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}(p);function p(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),i.apply(this,arguments)}return t=p,(r=[{key:"initCache",value:function(){this.selectors.listContainer=this.element.querySelector(l.CONTAINER_SELECTOR),this.selectors.generalError=this.element.querySelector(l.FORM_ERROR_SELECTOR)}},{key:"initState",value:function(){this.state.event="gift:card:removed",this.state.paymentMethodID=this.options.paymentMethodId||"SVS_GIFTCARD",this.state.isVoucher=!1}},{key:"render",value:function(e){o.A.render(this.selectors.listContainer,"template-applied-gift-cards",e)}},{key:"update",value:function(e){e&&e.orderModel&&e.orderModel.billing.payment&&(this.hideErrorMessage(),this.render(e.orderModel.billing.payment))}},{key:"getAppliedGiftCardElement",value:function(e){return e.closest(l.GIFT_CARD_APPLIED_ITEM_SELECTOR)}},{key:"highlightFailed",value:function(e){var t=this;if(e&&e.response&&e.response.failedPaymentMethods){var r=e.response.failedPaymentMethods.some(function(e){return e===t.state.paymentMethodID});this.element.classList.toggle(l.ERROR,r)}}},{key:"showErrorMessage",value:function(e,t){if(t){var r=this.selectors.generalError;e&&(r=this.getAppliedGiftCardElement(e).querySelector(l.FIELD_ERROR_SELECTOR)),r&&(r.innerText=t,this.showElement(r))}}},{key:"hideErrorMessage",value:function(e){var t=this.selectors.generalError;e&&(t=this.getAppliedGiftCardElement(e).querySelector(l.FIELD_ERROR_SELECTOR)),t&&(t.innerText="",this.hideElement(t))}},{key:"removeRequest",value:function(e,t){var r=this;if(this.options.removeUrl&&e){this.hideErrorMessage(t);var i=new URL(this.options.removeUrl,document.location.origin);i.searchParams.append("uuid",e),i.searchParams.append("isVoucher",this.state.isVoucher),a.u.start(this.element),(0,n.R)(i).then(function(e){if(e.error)r.showErrorMessage(t,e.errorMessage);else{var n={orderModel:e.order};r.update(n),u.J.emit(r.state.event,n)}}).finally(function(){return a.u.stop(r.element)})}}},{key:"remove",value:function(e){var t=e.target,r=(0,s.bQ)(t,"uuid",!0);this.removeRequest(r,t)}},{key:"bindEvents",value:function(){(0,c.Mm)("click",this.element,l.BTN_REMOVE_SELECTOR,this.remove.bind(this)),u.J.on("gift:card:applied",this.update,this),u.J.on("checkout:payment:failed",this.update,this),u.J.on("checkout:payment:submitted",this.update,this),u.J.on("checkout:shipping:method:submitted",this.update,this),u.J.on("checkout:shipping:store:selected",this.update,this),u.J.on("checkout:coupon:applied",this.update,this),u.J.on("checkout:coupon:removed",this.update,this),u.J.on("checkout:error",this.update,this),u.J.on("checkout:payment:failed",this.highlightFailed,this)}},{key:"destroy",value:function(){(0,c.AU)("click",this.element,this.remove),u.J.off("gift:card:applied",this.update),u.J.off("checkout:payment:failed",this.update),u.J.off("checkout:payment:submitted",this.update),u.J.off("checkout:shipping:method:submitted",this.update),u.J.off("checkout:shipping:store:selected",this.update),u.J.off("checkout:coupon:applied",this.update),u.J.off("checkout:coupon:removed",this.update),u.J.off("checkout:error",this.update),u.J.off("checkout:payment:failed",this.highlightFailed,this)}}])&&_(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),p}(i.A)},85504:function(){}}]);

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.