umwd-components 0.1.406 → 0.1.408
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/auth/SigninForm.js +2 -1
- package/dist/src/components/common/Address.js +1 -0
- package/dist/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
- package/dist/src/components/e-commerce/customer/CustomerProfileEditForm.js +1 -1
- package/dist/src/data/services/get-user-me-loader.js +1 -1
- package/dist/src/lib/isCustomerProfileComplete.js +1 -1
- package/dist/src/lib/isVATValid.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/auth/SigninForm.d.ts +1 -1
- package/dist/types/components/e-commerce/customer/CustomerProfileDisplay.d.ts +1 -1
- package/dist/types/components/e-commerce/customer/CustomerProfileEditForm.d.ts +4 -17
- package/dist/types/lib/isCustomerProfileComplete.d.ts +1 -0
- package/dist/types/types/e-commerce/customer/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/auth/SigninForm.tsx +3 -1
- package/src/components/common/Address.tsx +2 -0
- package/src/components/e-commerce/customer/CustomerProfileDisplay.tsx +40 -17
- package/src/components/e-commerce/customer/CustomerProfileEditForm.tsx +12 -5
- package/src/data/services/get-user-me-loader.ts +6 -1
- package/src/lib/isCustomerProfileComplete.ts +12 -7
- package/src/lib/isVATValid.ts +3 -3
- package/src/types/e-commerce/customer/types.ts +5 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
/*
|
|
2
3
|
* UMWD-Components
|
|
3
4
|
* @copyright Jelle Paulus
|
|
4
5
|
* @license MIT
|
|
5
6
|
*/
|
|
6
|
-
import{
|
|
7
|
+
import{__read as r,__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import i from"next/link";import{useFormState as o}from"react-dom";import{loginUserAction as a}from"../../data/actions/auth-actions.js";import{setOpacity as l}from"../../lib/utils.js";import n from"@mui/material/CardHeader";import m from"@mui/material/CardContent";import d from"@mui/material/CardActions";import s from"@mui/material/Card";import u from"@mui/material/TextField";import p from"@mui/material/Stack";import c from"@mui/material/Container";import v from"@mui/material/Typography";import{SubmitButton as f}from"../SubmitButton.js";import{StrapiErrors as E}from"../StrapiErrors.js";import{useTheme as g}from"@mui/material/styles";var b={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var h,y,C,w,S=x.data,j=S.title,k=void 0===j?"Sign In":j,z=S.subtitle,T=void 0===z?"Enter your details to sign in to your account":z,_=S.maxWidth,F=void 0===_?"lg":_,I=S.sx,W=void 0===I?{}:I,A=S.glass,B=void 0!==A&&A,D=S.registration_url,H=void 0===D?"/signup":D,L=S.redirect_url,U=void 0===L?"/":L,q=r(o(a,b),2),G=q[0],J=q[1],K=g();return t.createElement(c,{maxWidth:F||"lg",sx:e({my:1},W)},t.createElement("form",{action:J},t.createElement("input",{type:"hidden",name:"redirect",value:U}),t.createElement(s,{sx:{backdropFilter:"blur(3px)",backgroundColor:l(K.palette.background.paper,B?.1:1),border:B?"1px solid rgba(255, 255, 255, 0.15)":"none"}},t.createElement(n,{title:k,subheader:T}),t.createElement(m,null,t.createElement(p,{spacing:2},t.createElement(u,{id:"identifier",name:"identifier",label:"identifier",variant:"outlined",error:null!=(null===(h=null==G?void 0:G.zodErrors)||void 0===h?void 0:h.identifier),helperText:null===(y=null==G?void 0:G.zodErrors)||void 0===y?void 0:y.identifier}),t.createElement(u,{id:"password",name:"password",label:"password",type:"password",variant:"outlined",error:null!=(null===(C=null==G?void 0:G.zodErrors)||void 0===C?void 0:C.password),helperText:null===(w=null==G?void 0:G.zodErrors)||void 0===w?void 0:w.password}))),t.createElement(d,null,t.createElement(f,{text:"Sign In",loadingText:"Loading"}),t.createElement(E,{error:null==G?void 0:G.strapiErrors}))),t.createElement(v,{sx:{pt:2},variant:"body2"},"Don't have an account?"),t.createElement(i,{href:H},"Sign Up")))}export{x as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__assign as e}from"../../../../node_modules/tslib/tslib.es6.js";import t from"@mui/material/Paper";import
|
|
6
|
+
import{__assign as e}from"../../../../node_modules/tslib/tslib.es6.js";import t from"react";import r from"@mui/material/Paper";import a from"@mui/material/Stack";import l from"@mui/material/Box";import m from"@mui/material/Typography";import i from"@mui/material/Button";import n from"@mui/material/Divider";import o from"@mui/material/Grid";import s from"@mui/icons-material/Person";import c from"@mui/icons-material/Email";import d from"@mui/icons-material/Phone";import p from"../../common/Address.js";import E from"./BusinessCredentials.js";import{StyledLink as u}from"../../StyledLink.js";import{Alert as f}from"@mui/material";import{isCustomerProfileComplete as v}from"../../../lib/isCustomerProfileComplete.js";function y(y){var b=y.data;console.log(b);var _=b.first_name,g=b.last_name,h=b.email,x=b.phone,j=b.company_address,A=b.billing_address,w=b.delivery_address,B=b.business_credentials,C=b.editProfileUrl,P=void 0===C?"/user/profile/edit":C;return t.createElement(r,{sx:{p:2}},t.createElement(a,{spacing:2},v({first_name:_,last_name:g,email:h,phone:x,company_address:j,billing_address:A,delivery_address:w,business_credentials:B})?t.createElement(a,{direction:"row",justifyContent:"flex-end"},t.createElement(u,{href:P,target:"_self"},t.createElement(i,{variant:"contained"},"edit profile"))):t.createElement(f,{severity:"warning",action:t.createElement(u,{href:P,target:"_self"},t.createElement(i,{variant:"contained"},"complete profile"))},"Your profile is not complete. Please complete your profile to enjoy all the benefits of our services"),B?t.createElement(E,{data:B}):t.createElement(m,null,"Business credentials not available"),t.createElement(n,null),t.createElement(a,{spacing:2,direction:"row"},t.createElement(s,null),t.createElement(l,null,t.createElement(m,{variant:"body1",component:"p"},_," ",g," ",!_&&!g&&"N/A"))),t.createElement(a,{spacing:2,direction:"row"},t.createElement(c,null),t.createElement(l,null,t.createElement(m,{variant:"body1",component:"p"},h," ",!h&&"N/A"))),t.createElement(a,{spacing:2,direction:"row"},t.createElement(d,null),t.createElement(l,null,t.createElement(m,{variant:"body1",component:"p"},x," ",!x&&"N/A"))),t.createElement(n,null),t.createElement(o,{container:!0,sx:{width:"100%"}},j?t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,{variant:"h6"},"Company Address"),t.createElement(p,{data:e({},j)})):t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,null,"Company address not available")),w?t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,{variant:"h6"},"Delivery Address"),t.createElement(p,{data:e({},w)})):t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,null,"Delivery address not available")),A?t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,{variant:"h6"},"Billing Address"),t.createElement(p,{data:e({},A)})):t.createElement(o,{item:!0,xs:12,md:4},t.createElement(m,null,"Billing address not available")))))}export{y as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import
|
|
7
|
+
import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import a from"@mui/material/Divider";import t from"@mui/material/Paper";import n from"@mui/material/Box";import m from"@mui/material/Stack";import l from"@mui/material/Alert";import i from"@mui/material/TextField";import o from"@mui/material/Typography";import s from"@mui/material/Checkbox";import{AddressFields as c}from"../../common/Address.js";import{SubmitButton as d}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{updateCustomerProfileAction as p}from"../../../data/actions/profile-actions.js";import{StrapiErrors as f}from"../../StrapiErrors.js";import{BusinessCredentialsFields as E}from"./BusinessCredentials.js";import v,{useState as g}from"react";var h={zodErrors:null,strapiErrors:null,data:null,message:null};function b(b){var _=b.data,y=b.sx,x=_.id;_.uuid,_.customer_number;var A=_.first_name,j=_.last_name,C=_.email,N=_.phone,B=_.company_address,k=_.delivery_address,R=_.billing_address,V=_.business_credentials;console.log(_);var w=e(u(p,h),2),D=w[0],I=w[1],P=e(g(null!=k),2),S=P[0],T=P[1],F=e(g(null!=R),2),U=F[0],z=F[1];return v.createElement(n,{sx:r([{p:2}],e(Array.isArray(y)?y:[y]),!1),component:t},v.createElement("form",{action:I},v.createElement(m,{spacing:2},v.createElement("input",{type:"hidden",name:"id",value:x}),v.createElement(o,{variant:"h6"},"Personal Details"),v.createElement(a,null),v.createElement(i,{id:"first_name",name:"first_name",label:"First Name",defaultValue:A}),v.createElement(i,{id:"last_name",name:"last_name",label:"Last Name",defaultValue:j}),v.createElement(i,{id:"email",name:"email",label:"Email",defaultValue:C,disabled:!0}),v.createElement(i,{id:"phone",name:"phone",label:"Phone",defaultValue:N}),v.createElement(o,{variant:"h6"},"Business Credentials"),v.createElement(a,null),v.createElement(E,{componentName:"business_credentials",componentReference:"business.credentials",data:V}),v.createElement(o,{variant:"h6"},"Company Address"),v.createElement(a,null),v.createElement(c,{componentName:"company_address",componentReference:"common.address",data:B}),v.createElement(o,{variant:"h6"},"Delivery Address"),v.createElement(a,null),v.createElement(m,{direction:"row",spacing:2,alignItems:"center"},v.createElement(s,{value:S,checked:S,onChange:function(){return T(!S)}}),v.createElement(o,null,"Use a different address for delivery")),S&&v.createElement(c,{componentName:"delivery_address",componentReference:"common.address",data:k}),v.createElement(o,{variant:"h6"},"Billing Address"),v.createElement(a,null),v.createElement(m,{direction:"row",spacing:2,alignItems:"center"},v.createElement(s,{value:U,checked:U,onChange:function(){return z(!U)}}),v.createElement(o,null,"Use a different address for billing")),U&&v.createElement(c,{componentName:"billing_address",componentReference:"common.address",data:R}),v.createElement(m,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},v.createElement(d,{text:"save changes",loadingText:"loading"}),v.createElement(f,{error:null==D?void 0:D.strapiErrors}),(null==D?void 0:D.message)&&v.createElement(l,{severity:"error"},null==D?void 0:D.message)))))}export{b as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import n from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as o}from"../../lib/utils.js";var s=o(),a=n.stringify({populate:{customer_profile:{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0}}}}),i=n.stringify({populate:"role"});function
|
|
7
|
+
import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import n from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as o}from"../../lib/utils.js";var s=o(),a=n.stringify({populate:{customer_profile:{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:{populate:{vat_validate_response:!0,eori_validate_response:!0}}}}}}),i=n.stringify({populate:"role"});function l(){return e(this,void 0,void 0,(function(){var e,n,o,i;return r(this,(function(r){switch(r.label){case 0:return(e=new URL("/api/users/me",s)).search=a,[4,t()];case 1:if(!(n=r.sent()))return[2,{ok:!1,data:null,error:null}];r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)},cache:"no-cache"})];case 3:return[4,r.sent().json()];case 4:return(o=r.sent()).error?[2,{ok:!1,data:null,error:o.error}]:[2,{ok:!0,data:o,error:null}];case 5:return i=r.sent(),console.log(i),[2,{ok:!1,data:null,error:i}];case 6:return[2]}}))}))}function u(t){return e(this,void 0,void 0,(function(){var e,n,o;return r(this,(function(r){switch(r.label){case 0:(e=new URL("/api/users/me",s)).search=a,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})];case 2:if((n=r.sent()).ok)return[2,n.json()];throw new Error("Failed to fetch user details");case 3:return o=r.sent(),console.error("getUserMeLoader Error:",o),[2,null];case 4:return[2]}}))}))}function c(){return e(this,void 0,void 0,(function(){var e,n,o,a;return r(this,(function(r){switch(r.label){case 0:return(e=new URL("/api/users/me",s)).search=i,[4,t()];case 1:if(!(n=r.sent()))return[2,{ok:!1,data:null,error:null}];r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)},cache:"no-cache"})];case 3:return[4,r.sent().json()];case 4:return(o=r.sent()).error?[2,{ok:!1,data:null,error:o.error}]:[2,{ok:!0,data:o,error:null}];case 5:return a=r.sent(),console.log(a),[2,{ok:!1,data:null,error:a}];case 6:return[2]}}))}))}export{l as getExtendedUserMeLoader,u as getUserMeLoader,c as getUserRole};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{isAddressComplete as
|
|
6
|
+
import{isAddressComplete as s}from"./isAddressComplete.js";import{areBusinessCredentailsComplete as e}from"./areBusinessCredentialsComplete.js";import r from"./isVATValid.js";import i from"./isEORIValid.js";var o=function(o){return!!o&&(!!s(o.company_address)&&(!!e(o.business_credentials)&&!(!r(o.business_credentials)&&!i(o.business_credentials))))};export{o as isCustomerProfileComplete};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
function
|
|
6
|
+
function a(a){return!!(null==a?void 0:a.vat_number)&&((null==a?void 0:a.vat_validate_response)||{valid:!1}).valid}export{a as default};
|