1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[81032],{163856:function(r,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/creator-marketplace/account/info/change-password",function(){return t(278243)}])},278243:function(r,e,t){"use strict";t.r(e),t.d(e,{__N_SSP:function(){return A},default:function(){return X}});var n,a,o=t(687800),s=t(827378),c=t(934301),u=t(504555),i=t(888149),l=t(222579),d=t(768587),p=t(581340),f=t(224358),h=t(537850),w=t(187923),b=t(439808),g=t(671948),m=t(456552),y=t(671718),v=t(447178),x=t(140224);function P(r,e,t,n,a,o,s){try{var c=r[o](s),u=c.value}catch(r){t(r);return}c.done?e(u):Promise.resolve(u).then(n,a)}function _(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.forEach(function(e){var n;n=t[e],e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n})}return r}var k=(n=function(r,e){var t,n,a,o,s,c=arguments;return function(r,e){var t,n,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(t)throw TypeError("Generator is already executing.");for(;s;)try{if(t=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(r,s)}catch(r){o=[6,r],n=0}finally{t=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,function(u){switch(u.label){case 0:return t=r.userId,n=r.currentPassword,a=r.password,o=r.systemCountry,s=r.locale,[4,(c.length>2&&void 0!==c[2]?c[2]:y.Z)("/gw/users/set_password/".concat(t),e,{method:"PUT",data:{currentPassword:n,password:a},query:{country:o,locale:s},headers:{"Content-Type":"application/json"},fetchSpanAttributes:{"request.backend_service":"auth-service","request.backend_action":"change-password"}})];case 1:return[2,u.sent().json()]}})},a=function(){var r=this,e=arguments;return new Promise(function(t,a){var o=n.apply(r,e);function s(r){P(o,t,a,s,c,"next",r)}function c(r){P(o,t,a,s,c,"throw",r)}s(void 0)})},function(r,e){return a.apply(this,arguments)}),C=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,x.O)(),t=(0,v.Z)().fetch,n=["creator-marketplace.changePassword"];return(0,m.useMutation)(function(r){return k(_({},r,e),n,t)},_({},r))};function Z(r,e,t,n,a,o,s){try{var c=r[o](s),u=c.value}catch(r){t(r);return}c.done?e(u):Promise.resolve(u).then(n,a)}var S=function(){var r,e,t=(0,f.H)().data,n=C();return{changePassword:(r=function(r){return function(r,e){var t,n,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(t)throw TypeError("Generator is already executing.");for(;s;)try{if(t=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(r,s)}catch(r){o=[6,r],n=0}finally{t=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,function(e){switch(e.label){case 0:if(!(null==t?void 0:t.userId)
1)return[2,!1];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.mutateAsync({userId:t.userId,currentPassword:r.currentPassword,password:r.newPassword})];case 2:return e.sent(),[2,!0];case 3:return e.sent(),[2,!1];case 4:return[2]}})},e=function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function s(r){Z(o,n,a,s,c,"next",r)}function c(r){Z(o,n,a,s,c,"throw",r)}s(void 0)})},function(r){return e.apply(this,arguments)}),isChanging:n.isLoading,error:n.error}},T=function(){var r=(0,h.H)().translateRaw;return{validateForm:function(e){var t={};return e.currentPassword||(t.currentPassword=r("creator_marketplace.account.change_password.error.current_required")||"Current password is required"),e.newPassword?e.newPassword.length<8&&(t.newPassword=r("creator_marketplace.account.change_password.error.too_short")||"Password must be at least 8 characters"):t.newPassword=r("creator_marketplace.account.change_password.error.new_required")||"New password is required",e.confirmPassword?e.newPassword!==e.confirmPassword&&(t.confirmPassword=r("creator_marketplace.account.change_password.error.no_match")||"Passwords do not match"):t.confirmPassword=r("creator_marketplace.account.change_password.error.confirm_required")||"Please confirm your new password",t}}},I=t(625251),N=function(){return(0,o.tZ)(d.xu,{"data-test-id":"account-change-password-page",children:(0,o.BX)(d.xu,{display:"flex",flexDirection:"column",gap:"global.md-1",marginX:"auto",padding:"global.md-1",borderStyle:"solid",borderColor:"shared-alias.neutral.border.default",borderWidth:"1px",marginTop:["global.none","global.md-1"],children:[(0,o.tZ)(I.K,{width:"180px",height:"32px",backgroundColor:"neutral.300",borderRadius:"border-radius-sm"}),[1,2,3].map(function(r){return(0,o.BX)(d.xu,{display:"flex",flexDirection:"column",gap:"global.xs",children:[(0,o.tZ)(I.K,{width:"100px",height:"20px",backgroundColor:"neutral.300",borderRadius:"border-radius-sm"}),(0,o.tZ)(I.K,{width:"100%",height:"48px",backgroundColor:"neutral.200",borderRadius:"border-radius-sm"})]},r)}),(0,o.BX)(d.xu,{display:"flex",gap:"global.sm-2",marginTop:"global.md-1",children:[(0,o.tZ)(I.K,{width:"120px",height:"48px",backgroundColor:"neutral.200",borderRadius:"border-radius-sm"}),(0,o.tZ)(I.K,{width:"120px",height:"48px",backgroundColor:"neutral.200",borderRadius:"border-radius-sm"})]})]})})};function O(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function j(r,e,t,n,a,o,s){try{var c=r[o](s),u=c.value}catch(r){t(r);return}c.done?e(u):Promise.resolve(u).then(n,a)}function q(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t,n,a=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=a){var o=[],s=!0,c=!1;try{for(a=a.call(r);!(s=(t=a.next()).done)&&(o.push(t.value),!e||o.length!==e);s=!0);}catch(r){c=!0,n=r}finally{try{s||null==a.return||a.return()}finally{if(c)throw n}}return o}}(r,e)||function(r,e){if(r){if("string"==typeof r)return O(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if("Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return O(r,e)}}(r,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E=function(){var r,e,t=(0,h.H)().translateRaw,n=(0,p.t)(),a=(0,f.H)(),c=a.data,u=a.isLoading,l=a.isError,m=S(),y=m.changePassword,v=m.isChanging,x=T().validateForm,P=q((0,s.useState)(""),2),_=P[0],k=P[1],C=q((0,s.useState)(""),2),Z=C[0],I=C[1],O=q((0,s.useState)(""),2),E=O[0],R=O[1],A=q((0,s.useState)({}),2),X=A[0],B=A[1],F=(null==c?void 0:c.subscriptionStatus)!==null,z=(r=function(){var r;return function(r,e){var t,n,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;
1function c(o){return function(c){return function(o){if(t)throw TypeError("Generator is already executing.");for(;s;)try{if(t=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(r,s)}catch(r){o=[6,r],n=0}finally{t=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,function(e){switch(e.label){case 0:if(B(r=x({currentPassword:_,newPassword:Z,confirmPassword:E})),Object.keys(r).length>0)return[2];return[4,y({currentPassword:_,newPassword:Z})];case 1:return e.sent()?(0,w.Z)(n,"".concat((0,i.zk)(),"?updated=password-success")):(0,w.Z)(n,"".concat((0,i.zk)(),"?updated=password-error")),[2]}})},e=function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function s(r){j(o,n,a,s,c,"next",r)}function c(r){j(o,n,a,s,c,"throw",r)}s(void 0)})},function(){return e.apply(this,arguments)}),D=function(){(0,w.Z)(n,(0,i.zk)())};return u?(0,o.tZ)(N,{}):l?(0,o.tZ)(d.xu,{"data-test-id":"account-change-password-page",children:(0,o.tZ)(b.o,{message:t("creator_marketplace.account.change_password.load_error")||"Failed to load your account information. Please try again.",onBack:D,backButtonText:t("creator_marketplace.account.change_password.back")||"Back to Account Info"})}):(0,o.tZ)(d.xu,{"data-test-id":"account-change-password-page",children:(0,o.BX)(d.xu,{display:"flex",flexDirection:"column",gap:"global.md-1",marginX:"auto",padding:"global.md-1",borderStyle:"solid",borderColor:"shared-alias.neutral.border.default",borderWidth:"1px",marginTop:["global.none","global.md-1"],children:[(0,o.tZ)(d.xv,{as:"h1",styleAs:"h3",children:t("creator_marketplace.account.change_password.title")||"Change Password"}),F&&(0,o.tZ)(g.Z,{message:t("creator_marketplace.account.change_password.hf_subscriber_warning")||"This will also update your password for your HelloFresh account."}),(0,o.BX)(d.xu,{display:"flex",flexDirection:"column",gap:"global.md-1",children:[(0,o.tZ)(d.NI,{labelText:t("creator_marketplace.account.change_password.current")||"Current Password",isRequired:!0,children:(0,o.tZ)(d.NI.TextInput,{type:"password",autoComplete:"current-password",value:_,onChange:function(r){return k(r.target.value)},error:!!X.currentPassword,errorText:X.currentPassword,"data-test-id":"change-password-current-input"})}),(0,o.tZ)(d.NI,{labelText:t("creator_marketplace.account.change_password.new")||"New Password",isRequired:!0,children:(0,o.tZ)(d.NI.TextInput,{type:"password",autoComplete:"new-password",value:Z,onChange:function(r){return I(r.target.value)},error:!!X.newPassword,errorText:X.newPassword,"data-test-id":"change-password-new-input"})}),(0,o.tZ)(d.NI,{labelText:t("creator_marketplace.account.change_password.confirm")||"Confirm New Password",isRequired:!0,children:(0,o.tZ)(d.NI.TextInput,{type:"password",autoComplete:"new-password",value:E,onChange:function(r){return R(r.target.value)},error:!!X.confirmPassword,errorText:X.confirmPassword,"data-test-id":"change-password-confirm-input"})})]}),(0,o.BX)(d.xu,{display:"flex",gap:"global.sm-2",marginTop:"global.md-1",children:[(0,o.tZ)(d.zx.Secondary,{onClick:D,disabled:v,children:t("creator_marketplace.account.change_password.cancel")||"Cancel"}),(0,o.tZ)(d.zx.Primary,{onClick:z,disabled:v,children:t("creator_marketplace.account.change_password.save")||"Save Changes"})]})]})})},R=function(r){return r.ssrPayload,(0,o.tZ)(u.F,{redirectPathIfGuest:(0,i.sF)(),children:(0,o.tZ)(l.R,{children:(0,o.tZ)(E,{})})})};R.customLayout=c.C;var A=!0,X=R}},function(r){r.O(0,[38579,94924,10198,17925,49461,78255,24007,68368,68127,92888,49774,40179],function(){return r(r.s=163856)}),_N_E=r.O()}]);
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.