mori-admin-ui 1.0.3 → 1.0.4

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.
@@ -117,4 +117,4 @@ Error generating stack: `+s.message+`
117
117
  `,children:[o.jsx("div",{className:`
118
118
  w-2.5 h-2.5 rounded-full transition-all
119
119
  ${n===0?"bg-brand-500 animate-pulse-slow":"bg-light-300"}
120
- `}),o.jsx("span",{children:t.label})]},t.id))})]})})})}function mp(){const[e,t]=C.useState("welcome"),[n,r]=C.useState(null),[l,s]=C.useState(null),[i,u]=C.useState(!1),[a,d]=C.useState(null),[g,h]=C.useState(!1),[m,v]=C.useState(!0),[x,k]=C.useState(!1),[M,p]=C.useState(null);C.useEffect(()=>{Promise.all([ne.getStatus(),ne.getOnboardingStatus()]).then(([P,z])=>{Pn(P)&&s(P.data),Pn(z)&&(u(z.data.completed),z.data.completed&&(t("main"),h(!1)))}).catch(P=>{console.error("Failed to initialize app state",P)}).finally(()=>v(!1))},[]);const c=()=>{h(!0),t("signup")},f=P=>{r(P),t("verify")},y=()=>{t("trial")},j=async()=>{if(g){k(!0);try{const P=await ne.getIntegrationId(n||void 0);let z=null;if(Pn(P)?(z=P.data.integrate_id,d(z)):(console.error("Failed to fetch integration ID",P.message),p({type:"warning",message:"خطا در دریافت خودکار کد اتصال. لطفاً کد را به صورت دستی وارد کنید."})),z)try{const Q=await ne.connectStore(z);if(Pn(Q))s(et=>et?{...et,isConnected:!0}:{isConnected:!0,siteUrl:"",woocommerceVersion:null}),await ne.completeOnboarding(),p({type:"success",message:"اتصال به موری با موفقیت برقرار شد!"});else throw new Error(Q.message||"اتصال برقرار نشد")}catch(Q){console.error("Auto-connection failed",Q),p({type:"error",message:`اتصال خودکار ناموفق بود: ${Q.message}. لطفاً به صورت دستی تلاش کنید.`})}}catch(P){console.error("Error during signup completion flow",P),p({type:"error",message:"خطایی در فرآیند نهایی‌سازی حساب کاربری رخ داد."})}finally{k(!1)}}u(!0),t("main")},L=async()=>{},S=()=>{h(!1),t("welcome")};if(m)return o.jsx(pp,{});const E=()=>{switch(e){case"welcome":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(up,{onCreateAccount:c,onAlreadyHaveAccount:L})})});case"signup":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(cp,{onBack:S,onSuccess:f})})});case"verify":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(dp,{userId:n||"",onSuccess:y,onBack:()=>t("signup")})})});case"trial":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(fp,{userId:n||"",onSuccess:j})})});case"main":default:return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsxs(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[768px] mx-auto overflow-hidden",children:[x?o.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white text-center",dir:"rtl",children:[o.jsxs("div",{className:"relative w-20 h-20 mb-8",children:[o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-light-200"}),o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-brand-500 animate-spin"}),o.jsx("div",{className:"absolute inset-2 rounded-full bg-brand-50 flex items-center justify-center",children:o.jsx("svg",{className:"w-8 h-8 text-brand-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})})]}),o.jsx("h3",{className:"text-xl font-bold text-dark-bg mb-3",children:"در حال اتصال خودکار به موری..."}),o.jsx("p",{className:"text-gray-500 mb-0",children:"لطفا چند لحظه صبر کنید، در حال آماده‌سازی فروشگاه شما هستیم."})]}):o.jsx(np,{onConnect:()=>{s(P=>P?{...P,isConnected:!0}:{isConnected:!0,siteUrl:"",woocommerceVersion:null}),u(!0)},isConnected:!!(l!=null&&l.isConnected),onBackToWelcome:S,prefilledIntegrationId:a||void 0}),(l==null?void 0:l.isConnected)&&!x&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-px bg-linear-to-l from-transparent via-light-200 to-transparent mx-6"}),o.jsx(ip,{}),o.jsx("div",{className:"h-px bg-linear-to-l from-transparent via-light-200 to-transparent mx-6"}),o.jsx(lp,{})]})]})})}};return o.jsxs("div",{className:"bg-linear-to-br from-light-50 to-light-100 min-h-screen",dir:"rtl",children:[M&&o.jsx("div",{className:"max-w-[768px] mx-auto px-6 pt-6",children:o.jsx(sn,{type:M.type,message:M.message,onClose:()=>p(null)})}),E()]})}const lu=document.getElementById("mori-admin-ui-root");lu&&ls.createRoot(lu).render(o.jsx(mp,{}));
120
+ `}),o.jsx("span",{children:t.label})]},t.id))})]})})})}function mp(){const[e,t]=C.useState("welcome"),[n,r]=C.useState(null),[l,s]=C.useState(null),[i,u]=C.useState(!1),[a,d]=C.useState(null),[g,h]=C.useState(!1),[m,v]=C.useState(!0),[x,k]=C.useState(!1),[M,p]=C.useState(null);C.useEffect(()=>{Promise.all([ne.getStatus(),ne.getOnboardingStatus()]).then(([P,z])=>{Pn(P)&&s(P.data),Pn(z)&&(u(z.data.completed),z.data.completed&&(t("main"),h(!1)))}).catch(P=>{console.error("Failed to initialize app state",P)}).finally(()=>v(!1))},[]);const c=()=>{h(!0),t("signup")},f=P=>{r(P),t("verify")},y=()=>{t("trial")},j=async()=>{if(g){k(!0);try{const P=await ne.getIntegrationId(n||void 0);let z=null;if(Pn(P)?(z=P.data.integrate_id,d(z)):(console.error("Failed to fetch integration ID",P.message),p({type:"warning",message:"خطا در دریافت خودکار کد اتصال. لطفاً کد را به صورت دستی وارد کنید."})),z)try{const Q=await ne.connectStore(z);if(Pn(Q))s(et=>et?{...et,isConnected:!0}:{isConnected:!0,siteUrl:"",woocommerceVersion:null}),await ne.completeOnboarding(),p({type:"success",message:"اتصال به موری با موفقیت برقرار شد!"});else throw new Error(Q.message||"اتصال برقرار نشد")}catch(Q){console.error("Auto-connection failed",Q),p({type:"error",message:`اتصال خودکار ناموفق بود: ${Q.message}. لطفاً به صورت دستی تلاش کنید.`})}}catch(P){console.error("Error during signup completion flow",P),p({type:"error",message:"خطایی در فرآیند نهایی‌سازی حساب کاربری رخ داد."})}finally{k(!1)}}u(!0),t("main")},L=async()=>{h(!1),t("main")},S=()=>{h(!1),t("welcome")};if(m)return o.jsx(pp,{});const E=()=>{switch(e){case"welcome":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(up,{onCreateAccount:c,onAlreadyHaveAccount:L})})});case"signup":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(cp,{onBack:S,onSuccess:f})})});case"verify":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(dp,{userId:n||"",onSuccess:y,onBack:()=>t("signup")})})});case"trial":return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsx(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[600px] mx-auto overflow-hidden",children:o.jsx(fp,{userId:n||"",onSuccess:j})})});case"main":default:return o.jsx("div",{className:"max-w-[800px] mx-auto px-6 py-12 animate-fade-in",children:o.jsxs(Ct,{variant:"elevated",padding:"none",className:"w-full max-w-[768px] mx-auto overflow-hidden",children:[x?o.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white text-center",dir:"rtl",children:[o.jsxs("div",{className:"relative w-20 h-20 mb-8",children:[o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-light-200"}),o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-brand-500 animate-spin"}),o.jsx("div",{className:"absolute inset-2 rounded-full bg-brand-50 flex items-center justify-center",children:o.jsx("svg",{className:"w-8 h-8 text-brand-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})})]}),o.jsx("h3",{className:"text-xl font-bold text-dark-bg mb-3",children:"در حال اتصال خودکار به موری..."}),o.jsx("p",{className:"text-gray-500 mb-0",children:"لطفا چند لحظه صبر کنید، در حال آماده‌سازی فروشگاه شما هستیم."})]}):o.jsx(np,{onConnect:()=>{s(P=>P?{...P,isConnected:!0}:{isConnected:!0,siteUrl:"",woocommerceVersion:null}),u(!0)},isConnected:!!(l!=null&&l.isConnected),onBackToWelcome:S,prefilledIntegrationId:a||void 0}),(l==null?void 0:l.isConnected)&&!x&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-px bg-linear-to-l from-transparent via-light-200 to-transparent mx-6"}),o.jsx(ip,{}),o.jsx("div",{className:"h-px bg-linear-to-l from-transparent via-light-200 to-transparent mx-6"}),o.jsx(lp,{})]})]})})}};return o.jsxs("div",{className:"bg-linear-to-br from-light-50 to-light-100 min-h-screen",dir:"rtl",children:[M&&o.jsx("div",{className:"max-w-[768px] mx-auto px-6 pt-6",children:o.jsx(sn,{type:M.type,message:M.message,onClose:()=>p(null)})}),E()]})}const lu=document.getElementById("mori-admin-ui-root");lu&&ls.createRoot(lu).render(o.jsx(mp,{}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mori-admin-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "react": "^18.2.0",
package/src/App.tsx CHANGED
@@ -177,7 +177,8 @@ export default function App() {
177
177
  };
178
178
 
179
179
  const handleAlreadyHaveAccount = async () => {
180
- // ... (existing logic)
180
+ setIsSignupFlow(false);
181
+ setCurrentView('main');
181
182
  };
182
183
 
183
184
  const handleBackToWelcome = () => {
package/src/index.tsx CHANGED
@@ -13,7 +13,7 @@ if (import.meta.env.DEV && !window.moriAdminUIData) {
13
13
  isConnected: false,
14
14
  woocommerceVersion: '8.0.0',
15
15
  wpVersion: '6.3',
16
- pluginVersion: '3.3.39',
16
+ pluginVersion: '3.3.41',
17
17
  assetsUrl: 'http://localhost:8000/wp-content/plugins/dori-chatbot/trunk/assets',
18
18
  currentUser: {
19
19
  id: 1,