PageSourceSearch

https://www.faber-castell.com.my/dist/FC.Ecom/modules/Shop-components-CouponsAdd.d9801b93.js

js faber-castell.com.my collected 2026-10-04 04:07:29 UTC 4,194 bytes, 1 lines download raw bytes

1"use strict";(self["FC.EcomwebpackJsonp"]=self["FC.EcomwebpackJsonp"]||[]).push([[9033],{15211:(e,t,n)=>{n.r(t),n.d(t,{default:()=>o});var r=n(27378);const o=function(e){var t=e.showWhen,n=e.children;return t?r.createElement(r.Fragment,null,n):r.createElement(r.Fragment,null)}},88030:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var r=n(27378),o=n(68780),a=n(15211),u=n(93628),l=n(47012),c=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function u(e){try{c(r.next(e))}catch(e){a(e)}}function l(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,l)}c((r=r.apply(e,t||[])).next())}))},i=function(e,t){var n,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},s=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return u};const f=function(e){var t=e.commonTexts,n=(0,o.I0)(),f=(0,o.v9)((function(e){return e.coupons})),d=s((0,r.useState)(""),2),m=d[0],p=d[1],v=s((0,r.useState)(null),2),y=v[0],b=v[1],h=s((0,r.useState)(!1),2),w=h[0],E=h[1],g=function(e){var t=e.target.value;p(t)},x=function(e){var n=e.target.value;E(!!m),f.coupons.some((function(e){return!!e.code}))&&b((null==t?void 0:t.maximumExceeded)||""),""===n&&e.target.required?b(e.target.dataset.msg):b(null)};return r.createElement("div",{className:"cart-summary__coupon-field"},r.createElement("div",{className:"cp-alpaca-form"},r.createElement("form",{onSubmit:function(e){return c(void 0,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:if(e.preventDefault(),b(""),f.coupons.some((function(e){return!!e.code})))return b((null==t?void 0:t.maximumExceeded)||""),[2];if(!m)return b((null==t?void 0:t.emptyPromoCode)||""),[2];o.label=1;case 1:return o.trys.push([1,3,,4]),(r=document.getElementById("coupon-apply-button")).disabled=!0,[4,n((0,u.addCouponAsync)(m,(function(){b(null==t?void 0:t.invalidPromoCode)})))];case 2:return o.sent(),p(""),E(!1),r.disabled=!1,r.focus(),[3,4];case 3:return o.sent(),b("An error occurred while applying the coupon."),[3,4];case 4:return[2]}}
1))}))},noValidate:!0},function(e,n,u,c){void 0===u&&(u=!0),void 0===c&&(c="");var i="".concat(e,"_").concat(Date.now()),s=["form-field field text",c,u&&"required",w&&"focused",y&&"error"].filter(Boolean).join(" ");return r.createElement("div",{className:s},r.createElement(a.default,{showWhen:!(0,l.isNullOrEmpty)(null==t?void 0:t.inputLabel)},r.createElement("label",{htmlFor:i},null==t?void 0:t.inputLabel)),r.createElement("input",{id:i,name:e,className:"input-text text".concat(u?" required":""),type:"text",required:u,"data-msg":u?null==t?void 0:t.emptyPromoCode:void 0,value:n((0,o.v9)((function(e){return e}))),onChange:g,onFocus:function(){return E(!0)},onBlur:x}),r.createElement("p",{className:"error message-info",role:"alert"},y))}("CouponCode",(function(){return m})),r.createElement("button",{id:"coupon-apply-button",className:"btn btn--primary",type:"submit"},null==t?void 0:t.applyButtonLabel))))}}}]);

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.