1"use strict";(self.webpackChunk_reseller_storefront=self.webpackChunk_reseller_storefront||[]).push([[151],{4151:(e,r,t)=>{t.r(r),t.d(r,{default:()=>h});var n=t(6540),i=t(6442),o=t(8065),s=t(75),a=t(5235),u=t(4877),c=t(8946),l=t(1546),d=t(5583);function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function f(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){m(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function m(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const b=e=>{const r=new Error("Error from /api/v1/redemptionCodes");return r.key=e,r};var g=t(4848);const h=()=>{const{settings:e}=(0,c.NT)(),[r,t]=(0,n.useState)({isSubmitting:!1,error:null}
1),[p,m]=(0,n.useState)(""),h=(0,i.A)(),v=(0,g.jsx)(u.A,{design:"control",id:"redemption-form-submit-button",title:"Redemption Form Submit Button",text:h.formatMessage({id:"redemption.form.submit"}),onClick:()=>{if(r.isSubmitting)return;if(!p)return t({isSubmitting:!1,error:"noRedemptionCode"});t({isSubmitting:!0,error:null});const{privateLabelId:n,envPrefix:i}=e;((e,r)=>new Promise(((t,n)=>{const i=new d.URL(`/api/v1/redemptionCodes/${e}/${r}`),o={headers:{"Content-Type":"application/json"}};d.request.get(i.href,o,((e,r)=>{if(e||!r)return n(b("general"));if("Expired"===r.status)return n(b("expired"));if("Redeemed"===r.status)return n(b("alreadyUsed"));if("Revoked"===r.status)return n(b("revoked"));if(!r.success||"Available"!==r.status)return n(b("general"));const s=f(f({},o),{},{query:{addToCart:!0}});d.request.get(i.href,s,((e,r)=>{if(e||!r||!r.success)return n(b("general"));t({})}))}))})))(n,p).then((()=>{l.A.redirect(`https://cart.${i}secureserver.net/?plid=${n}`)})).catch((e=>{t({isSubmitting:!1,error:e.key||"general"})}))}});return(0,g.jsx)("div",{className:"bg-primary-o-highlight",children:(0,g.jsxs)("div",{className:"container redemption",children:[(0,g.jsx)("h1",{className:"headline-brand text-center",children:(0,g.jsx)(o.A,{id:"redemption.title"})}),r.error&&(0,g.jsx)(a.A,{id:"redemption-error-alert",title:"Redemption Error Alert",emphasis:"warning",dismissible:"false",children:(0,g.jsx)(o.A,{id:`redemption.form.error.${r.error}`})}),(0,g.jsx)(s.default,{id:"redemption-search",title:"Redemption Search",placeholder:h.formatMessage({id:"redemption.form.placeholder"}),button:v,onChange:m})]})})}}}]); 2//# sourceMappingURL=151.606682ad.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.