1import{j as t,r as _}from"./react-BkO-TSe-.js";import{c as m,O as R,d as p,b as E,a1 as j,bi as M,$ as b,cH as L,cI as w,cJ as D,a2 as k,bv as B,T as N,cK as U,c1 as Y,z as A,V,a as x,as as G,R as T,g as I,aQ as v,cq as F,cr as P,aE as h,aN as H}from"./index-CRzCMAIs.js";import{a as W}from"./charts-DbcMHnCc.js";import{u as f}from"./i18-DCpOmQVC.js";import"./sentry-BsLEFSRO.js";import"./vendor-BFGr8E3W.js";import"./print-BY_KsQ5m.js";import"./csv-CPykRu6c.js";import"./algolia-BWtMs80N.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b406b0db-0ee4-4e6a-be28-65d4ffbf4e7f",e._sentryDebugIdIdentifier="sentry-dbid-b406b0db-0ee4-4e6a-be28-65d4ffbf4e7f")}catch{}})();(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},(function(){var a,n=new e.Error().stack,c=e._sentryModuleMetadata[n]||{},d={"_sentryBundlerPluginAppKey:parcel2go-uiz":!0},u={};for(a in c)c.hasOwnProperty(a)&&(u[a]=c[a]);for(a in d)d.hasOwnProperty(a)&&(u[a]=d[a]);e._sentryModuleMetadata[n]=u})()})();const z=({type:e})=>{switch(e){case"integration":return t.jsx(B,{});case"rules":return t.jsx(k,{});case"prepay":return t.jsx(D,{});default:return t.jsx(w,{})}},O=e=>{const a=e.state==="loading",n=e.state==="done";return t.jsx(m,{in:!0,children:t.jsx(R,{variant:n?"success":void 0,children:t.jsx(p,{p:2,sx:{minHeight:{md:"95px",lg:"auto"}},children:t.jsxs(E,{container:!0,justifyContent:"space-between",alignItems:"center",spacing:1,wrap:"nowrap",children:[t.jsx(E,{item:!0,children:t.jsxs(p,{display:"flex",flexDirection:"row",alignItems:"center",gap:2,children:[t.jsx(j,{size:"md",palette:"success",children:n?t.jsx(M,{}):t.jsx(z,{type:e.type})}),t.jsx(p,{display:"flex",flexDirection:"column",gap:1,children:e.children})]})}),(a||e.buttonText)&&t.jsx(E,{item:!0,children:a?t.jsx(b,{}):t.jsx(L,{onClick:e.onClick,variant:"tertiary",children:e.buttonText})})]})})})})},K=()=>{const{t:e}=f(N.SMARTSEND),[a,n]=_.useState([]),{getRules:c}=U(),{getintegrationsummary:d}=Y(),{goTo:u}=A(),{getPrePayBalance:S}=V(),o=(i,r)=>{n(s=>s.some(l=>l.type===i)?r?s.map(l=>l.type===i?r:l):s.filter(l=>l.type!==i):r?[...s,r]:s)};return x(()=>{const i=G.settings.Features.includes("PrePay"),r=[{type:"rules",title:e("TIME_SAVINGS_RULES_LOADING_TITLE",{defaultValue:"Checking your rules"}),content:e("TIME_SAVINGS_RULES_LOADING_CONTENT",{defaultValue:"We're just checking your rules to see if you could save some time."}),state:"loading"},{type:"integration",title:e("TIME_SAVINGS_INTEGRATIONS_LOADING_TITLE",{defaultValue:"Checking your integrations"}),content:e("TIME_SAVINGS_INTEGRATIONS_LOADING_CONTENT",{defaultValue:"We're just checking your integrations to see if you could save some time."}),state:"loading"}];i&&r.push({type:"prepay",title:e("TIME_SAVINGS_PREPAY_LOADING_TITLE",{defaultValue:"Checking your PrePay usage"}),content:e("TIME_SAVINGS_PREPAY_LOADING_CONTENT",{defaultValue:"We're just checking whether you're using PrePay."}),state:"loading"}),n(r),c().then(s=>{var l;((l=s==null?void 0:s.result)==null?void 0:l.length)>0?o("rules",{title:e("TIME_SAVINGS_RULES_DONE_TITLE_SINGLE",{defaultValue:"You're saving time with Rule Manager"}),content:e("TIME_SAVINGS_RULES_DONE_CONTENT",{defaultValue:"You can view your rules in the Rule Manager"}),type:"rules",onClick:()=>u(T.RuleManager),state:"done",buttonText:e("TIME_SAVINGS_RULES_DONE_BUTTON",{defaultValue:"View Rules"})}):o("rules",{title:e("TIME_SAVINGS_RULES_PENDING_TITLE",{defaultValue:"Automate more shipments"}),content:e("TIME_SAVINGS_RULES_PENDING_CONTENT",{defaultValue:'Create rules like "use this courier for orders over 5kg" to automate service selection.'}),type:"rules",onClick:()=>u(T.RuleManager),state:"pending",buttonText:e("TIME_SAVINGS_RULES_PENDING_BUTTON",{defaultValue:"Create Rules"})})}),d().then(s=>{var g;(((g=s==null?void 0:s.result)==null?void 0:g.filter(C=>{var y;return((y=C.accounts)==null?void 0:y.length)>0}))||[]).length>0?o("integration",{title:e("TIME_SAVINGS_INTEGRATIONS_DONE_TITLE_SINGLE",{defaultValue:"You're saving time by connecting your stores"}),content:e("TIME_SAVINGS_INTEGRATIONS_DONE_CONTENT",{defaultValue:"You can view your integrations in the Integrations page"}),type:"integration",onClick:()=>u(T.AccountLinking),state:"done",buttonText:e("TIME_SAVINGS_INTEGRATIONS_DONE_BUTTON",{defaultValue:"View Integrations"})}):o("integration",{title:e("TIME_SAVINGS_INTEGRATIONS_PENDING_TITLE",{defaultValue:"Link your store"}),content:e("TIME_SAVINGS_INTEGRATIONS_PENDING_CONTENT",{defaultValue:"Import orders automatically from Shopify, Etsy, eBay and more."}),type:"integration",onClick:()=>u(T.AccountLinking),state:"pending",buttonText:e("TIME_SAVINGS_INTEGRATIONS_PENDING_BUTTON",{defaultValue:"Connect Store"})})}),i&&S().then(s=>{var l;
1((l=s==null?void 0:s.result)==null?void 0:l.balance)===0?o("prepay",{title:e("TIME_SAVINGS_PREPAY_TITLE",{defaultValue:"Top up your account"}),content:e("TIME_SAVINGS_PREPAY_CONTENT",{defaultValue:"Save time by prepaying for your shipments and avoid delays in processing."}),type:"prepay",onClick:()=>u(T.Billing_PrePay),state:"pending",buttonText:e("TIME_SAVINGS_PREPAY_BUTTON",{defaultValue:"Top Up Balance"})}):o("prepay",{title:e("TIME_SAVINGS_PREPAY_DONE_TITLE",{defaultValue:"You're saving time with PrePay"}),content:e("TIME_SAVINGS_PREPAY_DONE_CONTENT",{defaultValue:"You can view your PrePay balance in the Billing page"}),type:"prepay",onClick:()=>u(T.Billing_PrePay),state:"done",buttonText:e("TIME_SAVINGS_PREPAY_DONE_BUTTON",{defaultValue:"View Balance"})})})}),{savings:a}},q=({wrapper:e})=>{const{savings:a}=K();return a.length===0?null:e(a.map(n=>t.jsxs(O,{onClick:n.onClick,buttonText:n.buttonText,state:n.state,type:n.type,children:[t.jsx(I,{children:t.jsx("strong",{children:n.title})}),t.jsx(I,{children:n.content})]},n.type)))},J=()=>{const{t:e}=f(N.SMARTSEND),[a,n]=_.useState([]),{getPrePayBalance:c}=V(),{goTo:d}=A(),u=(S,o)=>{n(i=>i.some(r=>r.type===S)?o?i.map(r=>r.type===S?o:r):i.filter(r=>r.type!==S):o?[...i,o]:i)};return x(()=>
1{G.settings.Features.includes("PrePay")&&c().then(o=>{const i=o==null?void 0:o.result;(i==null?void 0:i.freePrePayPercentage)>0&&u("prepay",{title:e("COST_SAVINGS_PREPAY_TITLE",{defaultValue:"Top up your account"}),content:e("COST_SAVINGS_PREPAY_CONTENT",{defaultValue:"Get {{percentage}}% off every shipment when you top up {{amount}} or more with PrePay.",percentage:i==null?void 0:i.freePrePayPercentage,amount:v(i.currencyCode,i==null?void 0:i.freePrePayMinimumSpend,0)}),type:"prepay",onClick:()=>d(T.Billing_PrePay),state:i.balance===0?"pending":"done",buttonText:e("COST_SAVINGS_PREPAY_BUTTON",{defaultValue:"Top Up Balance"})})})}),{savings:a}},Q=({wrapper:e})=>{const{savings:a}=J();return a.length===0?null:e(a.map(n=>t.jsxs(O,{onClick:n.onClick,buttonText:n.buttonText,state:n.state,type:n.type,children:[t.jsx(I,{children:t.jsx("strong",{children:n.title})}),t.jsx(I,{children:n.content})]},n.type)))},$=e=>{const{t:a}=f(N.SMARTSEND);return t.jsx(W,{children:t.jsxs(F,{children:[t.jsx(_.Suspense,{children:t.jsx(q,{wrapper:n=>t.jsx(P,{title:a("INSIGHTS_TIME_SAVINGS_TITLE",{defaultValue:"Time Savings"}),children:t.jsx(h,{children:n})})})}),t.jsx(_.Suspense,{children:t.jsx(Q,{wrapper:n=>t.jsx(P,{title:a("INSIGHTS_COST_SAVINGS_TITLE",{defaultValue:"Cost Savings"}),children:t.jsx(h,{children:n})})})})]})})};function X({isXs:e}){const[a]=H();return t.jsx(_.Suspense,{children:t.jsx($,{translationNamespace:N.SMARTSEND,windowInFocus:a,isXs:e,enabledTiles:[]})})}X.displayName="SmartSend";export{X as default}; 2//# sourceMappingURL=insights-CHnXjOVL.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.