affiliate-front-shared 1.3.6 → 1.3.7
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2971,7 +2971,7 @@
|
|
|
2971
2971
|
background: var(--color-bg-opaque-primary, rgba(255, 255, 255, 0.05));
|
|
2972
2972
|
color: var(--color-text-primary, #fff);
|
|
2973
2973
|
cursor: pointer;
|
|
2974
|
-
`,Na=({tableData:n,checked:e,fileName:t})=>{const r=async a=>{try{a==="xlsx"?Sr(n,e,t):wr(n,e,t)}catch(s){console.error("Export failed:",s)}},o=[{key:"1",label:`${B("ExportAs")} ${B("Xlsx")}`,onClick:()=>r("xlsx")},{key:"2",label:`${B("ExportAs")} ${B("Csv")}`,onClick:()=>r("csv")}];return i.jsx(Ra,{menu:{items:o,className:"dropdown-menu"},popupRender:a=>i.jsx(vr,{children:a}),placement:"bottomLeft",children:i.jsx(Fa,{children:B("Export")})})},Va=({value:n,onChange:e,...t})=>{const r=n?br(n):null,o=a=>{a?e==null||e(ee.toISODateString(a.toDate())):e==null||e(null)};return i.jsx(R.DatePicker,{value:r,onChange:o,allowClear:!0,...t})},Aa=({id:n,refetchFormItems:e,redirectPrevPage:t,updateItem:r,addItem:o,getItemById:a,onSetFormValues:s})=>{const l=ne.useNavigate(),[d]=R.Form.useForm(),[c,u]=S.useState(n=="new"),[p,h]=S.useState(null),f=async w=>{const O=window.location.pathname,A=O.substring(0,O.lastIndexOf("/"));try{if(p){let j;return n?j=await r({...w,id:n}):j=await r(w),t!==!1&&j.data.success===!0&&l(A),j}else{const j=await o(w);return t!==!1&&j.data.success===!0&&l(A),j}}catch(j){if(j.status===400){const L=j.response.data,T=ve(L.errors);d.setFields(T)}}},g=async w=>{try{const O=await a(w),A=s?s(O.data):O.data;h(A),d.setFieldsValue(A)}catch(O){console.log(O,"Error in Form Controller.")}};return S.useEffect(()=>{u(n=="new"),n!="new"?g(Number(n)):d.resetFields()},[n,e]),{form:d,item:p,getItemById:a,isAddingForm:c,handleSave:f}},Ba=({id:n,formItem:e,updateItem:t,addItem:r,getItemById:o})=>{const[a]=R.Form.useForm(),[s,l]=S.useState(null),d=async u=>{try{let p;return n?p=await t({...u}):p=await r(u),p}catch(p){if(p.status===400){const h=p.response.data,f=ve(h.errors);a.setFields(f)}throw p}},c=async u=>{try{const h=(await o(u)).data;l(h),a.setFieldsValue(h)}catch(p){console.log(p,"Error in Form Controller.")}};return S.useEffect(()=>{try{if(!e)return;l(e),a.setFieldsValue(e)}catch(u){console.log(u,"Error in Form Controller.")}},[e]),S.useEffect(()=>{n&&c(Number(n))},[n]),{form:a,item:s,handleSave:d}},Ga=()=>{const n=ne.useNavigate(),{setUser:e}=Se(),[t,r]=S.useState({visible:!1,token:""}),o=s=>{e(s),r({visible:!1,token:""}),n("/")};return{handleTwoFactorResponse:(s,l)=>{const{success:d,value:c}=s.data;if(!d)throw new Error("Authentication failed");if(c.isTwoFactorRequired){r({visible:!0,token:c.token,id:c.id,mfaType:c.mfaType});return}l&&o(c)},finalizeLogin:o,twoFactor:t,setTwoFactor:r}};function Ua(n){const{navigator:e}=S.useContext(ne.UNSAFE_NavigationContext),t=ne.useLocation();S.useEffect(()=>{if(!n)return;const r=e.push,o=e.replace,a=s=>(...l)=>{R.Modal.confirm({title:"UnsavedChanges",content:"UnsavedMoveDesc",okText:"Leave",className:"custom-confirm-modal",cancelText:"Save",okButtonProps:{className:"ok-text-btn"},cancelButtonProps:{className:"no-hover-cancel-btn"},onOk:()=>{s(...l)},onCancel:()=>{}})};return e.push=a(r),e.replace=a(o),()=>{e.push=r,e.replace=o}},[n,e,t]),S.useEffect(()=>{const r=o=>{n&&(o.preventDefault(),o.returnValue="")};return window.addEventListener("beforeunload",r),()=>{window.removeEventListener("beforeunload",r)}},[n])}function _a(n){S.useEffect(()=>{const e=t=>{t.animationName==="onAutoFillStart"&&n(t)};return document.addEventListener("animationstart",e,!0),()=>{document.removeEventListener("animationstart",e,!0)}},[])}function Wa(n,e){if(!n)return"";const t=new Date(n);if(isNaN(t.getTime()))return"";const r=t.getDate(),o=t.getMonth(),a=t.getFullYear(),l=`${r} ${o}, ${a}`;if(e!=null&&e.withTime){const d=t.getHours().toString().padStart(2,"0"),c=t.getMinutes().toString().padStart(2,"0");return`${l} ${d}:${c}`}return l}function Ya(n,e="en-US"){return n<1?0:n?n.toLocaleString(e):""}const Ka=(n,e)=>Array.isArray(n)?n.filter(t=>t.type?(Array.isArray(t.type)?t.type:[t.type]).some(o=>e.includes(o)):!1):[],$e=n=>n.replace(/^[A-Z]+/,e=>e.length===n.length?e.toLowerCase():e.length>1?e.slice(0,-1).toLowerCase()+e.slice(-1):e.toLowerCase()),qa=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)\[(\d+)\]\.(\w+)$/,Za=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)$/,Ja=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)\.(\w+)$/,Xa=/^Commissions\[(\d+)\]$/;function Qa(n){const{errors:e}=n.response.data,t=Object.keys(e)[0],r=e[t][0],o=t.match(qa);if(o){const[,l,d,c,u,p]=o;return{brandIndex:Number(l),generalType:$e(d),specificType:$e(c),itemIndex:Number(u),field:$e(p),message:r}}const a=t.match(Za)||t.match(Ja);if(a){const[,l,d,c]=a;return{brandIndex:Number(l),generalType:$e(d),specificType:$e(c),message:r}}const s=t.match(Xa);return s?{brandIndex:Number(s[1]),message:r}:(console.warn("parseCommissionErrors: unrecognized key format from the validations on commissions",t),null)}const ei=m(R.Empty)`
|
|
2974
|
+
`,Na=({tableData:n,checked:e,fileName:t})=>{const r=async a=>{try{a==="xlsx"?Sr(n,e,t+".xlsx"):wr(n,e,t+".csv")}catch(s){console.error("Export failed:",s)}},o=[{key:"1",label:`${B("ExportAs")} ${B("Xlsx")}`,onClick:()=>r("xlsx")},{key:"2",label:`${B("ExportAs")} ${B("Csv")}`,onClick:()=>r("csv")}];return i.jsx(Ra,{menu:{items:o,className:"dropdown-menu"},popupRender:a=>i.jsx(vr,{children:a}),placement:"bottomLeft",children:i.jsx(Fa,{children:B("Export")})})},Va=({value:n,onChange:e,...t})=>{const r=n?br(n):null,o=a=>{a?e==null||e(ee.toISODateString(a.toDate())):e==null||e(null)};return i.jsx(R.DatePicker,{value:r,onChange:o,allowClear:!0,...t})},Aa=({id:n,refetchFormItems:e,redirectPrevPage:t,updateItem:r,addItem:o,getItemById:a,onSetFormValues:s})=>{const l=ne.useNavigate(),[d]=R.Form.useForm(),[c,u]=S.useState(n=="new"),[p,h]=S.useState(null),f=async w=>{const O=window.location.pathname,A=O.substring(0,O.lastIndexOf("/"));try{if(p){let j;return n?j=await r({...w,id:n}):j=await r(w),t!==!1&&j.data.success===!0&&l(A),j}else{const j=await o(w);return t!==!1&&j.data.success===!0&&l(A),j}}catch(j){if(j.status===400){const L=j.response.data,T=ve(L.errors);d.setFields(T)}}},g=async w=>{try{const O=await a(w),A=s?s(O.data):O.data;h(A),d.setFieldsValue(A)}catch(O){console.log(O,"Error in Form Controller.")}};return S.useEffect(()=>{u(n=="new"),n!="new"?g(Number(n)):d.resetFields()},[n,e]),{form:d,item:p,getItemById:a,isAddingForm:c,handleSave:f}},Ba=({id:n,formItem:e,updateItem:t,addItem:r,getItemById:o})=>{const[a]=R.Form.useForm(),[s,l]=S.useState(null),d=async u=>{try{let p;return n?p=await t({...u}):p=await r(u),p}catch(p){if(p.status===400){const h=p.response.data,f=ve(h.errors);a.setFields(f)}throw p}},c=async u=>{try{const h=(await o(u)).data;l(h),a.setFieldsValue(h)}catch(p){console.log(p,"Error in Form Controller.")}};return S.useEffect(()=>{try{if(!e)return;l(e),a.setFieldsValue(e)}catch(u){console.log(u,"Error in Form Controller.")}},[e]),S.useEffect(()=>{n&&c(Number(n))},[n]),{form:a,item:s,handleSave:d}},Ga=()=>{const n=ne.useNavigate(),{setUser:e}=Se(),[t,r]=S.useState({visible:!1,token:""}),o=s=>{e(s),r({visible:!1,token:""}),n("/")};return{handleTwoFactorResponse:(s,l)=>{const{success:d,value:c}=s.data;if(!d)throw new Error("Authentication failed");if(c.isTwoFactorRequired){r({visible:!0,token:c.token,id:c.id,mfaType:c.mfaType});return}l&&o(c)},finalizeLogin:o,twoFactor:t,setTwoFactor:r}};function Ua(n){const{navigator:e}=S.useContext(ne.UNSAFE_NavigationContext),t=ne.useLocation();S.useEffect(()=>{if(!n)return;const r=e.push,o=e.replace,a=s=>(...l)=>{R.Modal.confirm({title:"UnsavedChanges",content:"UnsavedMoveDesc",okText:"Leave",className:"custom-confirm-modal",cancelText:"Save",okButtonProps:{className:"ok-text-btn"},cancelButtonProps:{className:"no-hover-cancel-btn"},onOk:()=>{s(...l)},onCancel:()=>{}})};return e.push=a(r),e.replace=a(o),()=>{e.push=r,e.replace=o}},[n,e,t]),S.useEffect(()=>{const r=o=>{n&&(o.preventDefault(),o.returnValue="")};return window.addEventListener("beforeunload",r),()=>{window.removeEventListener("beforeunload",r)}},[n])}function _a(n){S.useEffect(()=>{const e=t=>{t.animationName==="onAutoFillStart"&&n(t)};return document.addEventListener("animationstart",e,!0),()=>{document.removeEventListener("animationstart",e,!0)}},[])}function Wa(n,e){if(!n)return"";const t=new Date(n);if(isNaN(t.getTime()))return"";const r=t.getDate(),o=t.getMonth(),a=t.getFullYear(),l=`${r} ${o}, ${a}`;if(e!=null&&e.withTime){const d=t.getHours().toString().padStart(2,"0"),c=t.getMinutes().toString().padStart(2,"0");return`${l} ${d}:${c}`}return l}function Ya(n,e="en-US"){return n<1?0:n?n.toLocaleString(e):""}const Ka=(n,e)=>Array.isArray(n)?n.filter(t=>t.type?(Array.isArray(t.type)?t.type:[t.type]).some(o=>e.includes(o)):!1):[],$e=n=>n.replace(/^[A-Z]+/,e=>e.length===n.length?e.toLowerCase():e.length>1?e.slice(0,-1).toLowerCase()+e.slice(-1):e.toLowerCase()),qa=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)\[(\d+)\]\.(\w+)$/,Za=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)$/,Ja=/^Commissions\[(\d+)\]\.(\w+)\.(\w+)\.(\w+)$/,Xa=/^Commissions\[(\d+)\]$/;function Qa(n){const{errors:e}=n.response.data,t=Object.keys(e)[0],r=e[t][0],o=t.match(qa);if(o){const[,l,d,c,u,p]=o;return{brandIndex:Number(l),generalType:$e(d),specificType:$e(c),itemIndex:Number(u),field:$e(p),message:r}}const a=t.match(Za)||t.match(Ja);if(a){const[,l,d,c]=a;return{brandIndex:Number(l),generalType:$e(d),specificType:$e(c),message:r}}const s=t.match(Xa);return s?{brandIndex:Number(s[1]),message:r}:(console.warn("parseCommissionErrors: unrecognized key format from the validations on commissions",t),null)}const ei=m(R.Empty)`
|
|
2975
2975
|
.ant-empty-description {
|
|
2976
2976
|
color: var(--color-text-secondary, rgba(19, 20, 18, 0.75));
|
|
2977
2977
|
}
|