PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | assets/chunks/SubscriptionModeManager.js +1 -1 1.6.2 → 1.6.5 View file →
@@ -1 +1 @@
1 -import{h as w,l as d,r as V,e as p,o as _,d as e,a as u,b as A,t as l,u as o,F as G,g as N,f,w as c,n as P}from"./vue.esm-bundler.js?ver=1.6.2";import{t as a}from"./Translator.js?ver=1.6.2";import{B as Y}from"./Badge.js?ver=1.6.2";import{T}from"./TransitionAccordion.js?ver=1.6.2";import{R as H}from"./Rest.js?ver=1.6.2";import{n as j}from"./Notify.js?ver=1.6.2";import"./Arr.js?ver=1.6.2";import"./Model.js?ver=1.6.2";import"./common.js?ver=1.6.2";import"./dayjs.min.js?ver=1.6.2";import"./Str.js?ver=1.6.2";import"./timezone.js?ver=1.6.2";import"./index.js?ver=1.6.2";import"./vue-router.js?ver=1.6.2";import"./Url.js?ver=1.6.2";import"./DynamicIcon.js?ver=1.6.2";import"./_plugin-vue_export-helper.js?ver=1.6.2";import"./index3.js?ver=1.6.2";import"./IconButton.js?ver=1.6.2";import"./Utils.js?ver=1.6.2";import"./CurrencyFormatter.js?ver=1.6.2";const I={class:"fct-subscription-mode-manager"},J={class:"flex items-start justify-between gap-4 rounded border border-gray-divider bg-gray-25 p-4 dark:border-slate-700 dark:bg-slate-800"},Q={class:"flex items-center gap-2"},X={class:"mt-2 text-sm text-system-mid dark:text-slate-300"},Z={key:0,class:"mt-1 text-xs text-system-dark-light dark:text-slate-400"},ee={key:1,class:"mt-2 pl-4 text-xs list-disc text-system-dark-light dark:text-slate-400"},te={class:"-ml-4 mb-1 list-none font-medium text-system-mid dark:text-slate-300"},ae=["aria-label"],se=["aria-checked","tabindex"],le={class:"fct-subscription-mode-card__header"},oe={class:"fct-subscription-mode-card__title"},re={class:"fct-subscription-mode-recommended"},ne={class:"fct-subscription-mode-card__desc"},ie={class:"fct-subscription-mode-card__extras"},ce={class:"fct-subscription-mode-note"},de=["aria-checked","tabindex"],ue={class:"fct-subscription-mode-card__header"},me={class:"fct-subscription-mode-card__title"},pe={class:"fct-subscription-mode-card__desc"},_e={class:"fct-subscription-mode-card__extras"},ge={class:"fct-subscription-mode-note"},fe={key:0,class:"fct-subscription-mode-support"},be={key:0,class:"fct-subscription-mode-card__schedule-link"},ve={class:"fct-schedule-tooltip__title"},ye={class:"fct-schedule-tooltip__list"},he={class:"fct-subscription-mode-card__schedule-trigger"},we={class:"fct-subscription-mode-safety-note"},Ue={__name:"SubscriptionModeManager",props:{name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},label:{type:String},attribute:{type:Object},callback:{type:Function}},setup(q){const m=q,v=w(!1),y=w(!1),n=w("gateway_managed"),k=w(!1),x=w(!1),O=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_management_mode)||"gateway_managed"}),R=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_system_charge)==="yes"}),M=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_manual_fallback)==="yes"}),C=d(()=>O.value==="store_managed"),S=d(()=>{var t;return((t=m.field)==null?void 0:t.schedule_items)||[]}),z=d(()=>{var t;return((t=m.field)==null?void 0:t.system_charge_gateways)||[]}),F=d(()=>{const t=z.value.map(s=>s.label);return t.length?a("Supported by %1$s.",t.join(", ")):""}),$=d(()=>C.value?R.value?{label:a("Store Billing · Auto-charge"),type:"warning"}:{label:a("Store Billing"),type:"warning"}:M.value?{label:a("Gateway Billing · All methods"),type:"success"}:{label:a("Gateway Billing"),type:"success"}),K=d(()=>a("Gateways without built-in recurring billing can still sell subscriptions. Their renewals are invoiced by email before each due date.")),U=d(()=>C.value?R.value?a("Your store creates renewal invoices and charges saved payment methods automatically."):a("Your store creates renewal invoices before each due date. Customers pay via email link."):a("Stripe, PayPal, and other subscription-ready gateways charge renewals automatically.")),E=()=>{n.value=O.value,k.value=R.value,x.value=M.value,v.value=!0},L=()=>{const t=m.statePath||"",s=n.value,i=k.value?"yes":"no",g=x.value?"yes":"no";y.value=!0,H.post("settings/store",{subscription_management_mode:s,subscription_system_charge:i,subscription_manual_fallback:g}).then(()=>{m.form.setValue(`${t}subscription_management_mode`,s),m.form.setValue(`${t}subscription_system_charge`,i),m.form.setValue(`${t}subscription_manual_fallback`,g),j.success(a("Renewal billing updated")),v.value=!1}).catch(b=>{var B;j.error(((B=b.data)==null?void 0:B.message)||a("Could not save the subscription billing mode."))}).finally(()=>{y.value=!1})},W=t=>{y.value||t()},h=["gateway_managed","store_managed"],D=t=>{var g,b;const s=h.indexOf(n.value);let i=-1;if(t.key==="ArrowDown"||t.key==="ArrowRight")i=(s+1)%h.length;else if(t.key==="ArrowUp"||t.key==="ArrowLeft")i=(s-1+h.length)%h.length;else if(t.key===" "||t.key==="Enter"){t.preventDefault();return}else return;t.preventDefault(),n.value=h[i],(b=(g=t.currentTarget.closest('[role="radiogroup"]'))==null?void 0:g.querySelectorAll('[role="radio"]')[i])==null||b.focus()};return(t,s)=>{const i=V("el-button"),g=V("el-checkbox"),b=V("el-tooltip"),B=V("el-dialog");return _(),p("div",I,[e("div",J,[e("div",null,[e("div",Q,[u(Y,{type:$.value.type,text:$.value.label},null,8,["type","text"])]),e("p",X,l(U.value),1),!C.value&&M.value?(_(),p("p",Z,l(K.value),1)):A("",!0),C.value&&S.value.length?(_(),p("ul",ee,[e("li",te,l(o(a)("Renewal invoices created"))+":",1),(_(!0),p(G,null,N(S.value,r=>(_(),p("li",{key:r.label,class:"mb-0.5"},[e("strong",null,l(r.label)+":",1),f(" "+l(r.when),1)]))),128))])):A("",!0)]),u(i,{plain:"",size:"small",onClick:E},{default:c(()=>[f(l(o(a)("Change")),1)]),_:1})]),u(B,{modelValue:v.value,"onUpdate:modelValue":s[5]||(s[5]=r=>v.value=r),title:o(a)("Renewal Billing"),width:"560px","append-to-body":"","before-close":W,class:"fct-subscription-mode-dialog"},{footer:c(()=>[u(i,{disabled:y.value,onClick:s[4]||(s[4]=r=>v.value=!1)},{default:c(()=>[f(l(o(a)("Cancel")),1)]),_:1},8,["disabled"]),u(i,{type:"primary",loading:y.value,onClick:L},{default:c(()=>[f(l(o(a)("Apply")),1)]),_:1},8,["loading"])]),default:c(()=>[e("div",{class:"fct-subscription-mode-cards",role:"radiogroup","aria-label":o(a)("Renewal Billing")},[e("div",{class:P(["fct-subscription-mode-card",{"is-selected":n.value==="gateway_managed"}]),role:"radio","aria-checked":n.value==="gateway_managed",tabindex:n.value==="gateway_managed"?0:-1,onClick:s[1]||(s[1]=r=>n.value="gateway_managed"),onKeydown:D},[e("div",le,[s[6]||(s[6]=e("span",{class:"fct-subscription-mode-card__radio"},null,-1)),e("span",oe,l(o(a)("Gateway Billing")),1),e("span",re,l(o(a)("Recommended")),1)]),e("p",ne,l(o(a)("Stripe, PayPal, and other subscription-ready gateways charge customers automatically each cycle.")),1),u(T,{visible:n.value==="gateway_managed"},{default:c(()=>[e("div",ie,[u(g,{modelValue:x.value,"onUpdate:modelValue":s[0]||(s[0]=r=>x.value=r)},{default:c(()=>[f(l(o(a)("Allow all payment methods")),1)]),_:1},8,["modelValue"]),e("p",ce,l(o(a)("Gateways without built-in recurring billing (SSLCommerz, Authorize.Net, bank transfer, etc.) can still sell subscriptions. Their renewals are invoiced by email before each due date.")),1)])]),_:1},8,["visible"])],42,se),e("div",{class:P(["fct-subscription-mode-card",{"is-selected":n.value==="store_managed"}]),role:"radio","aria-checked":n.value==="store_managed",tabindex:n.value==="store_managed"?0:-1,onClick:s[3]||(s[3]=r=>n.value="store_managed"),onKeydown:D},[e("div",ue,[s[7]||(s[7]=e("span",{class:"fct-subscription-mode-card__radio"},null,-1)),e("span",me,l(o(a)("Store Billing")),1)]),e("p",pe,l(o(a)("Your store creates a renewal invoice before each due date. Customers pay via a link in the email.")),1),u(T,{visible:n.value==="store_managed"},{default:c(()=>[e("div",_e,[u(g,{modelValue:k.value,"onUpdate:modelValue":s[2]||(s[2]=r=>k.value=r)},{default:c(()=>[f(l(o(a)("Auto-charge saved payment methods")),1)]),_:1},8,["modelValue"]),e("p",ge,l(o(a)("When supported, the customer's saved payment method is charged automatically on each renewal due date.")),1),F.value?(_(),p("p",fe,l(F.value),1)):A("",!0)]),S.value.length?(_(),p("div",be,[u(b,{placement:"bottom-start",effect:"dark","popper-class":"fct-tooltip fct-schedule-tooltip"},{content:c(()=>[e("p",ve,l(o(a)("When are renewal orders created?")),1),e("ul",ye,[(_(!0),p(G,null,N(S.value,r=>(_(),p("li",{key:r.label},[e("strong",null,l(r.label)+":",1),f(" "+l(r.when),1)]))),128))])]),default:c(()=>[e("span",he,[s[8]||(s[8]=e("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor","stroke-width":"1.5"}),e("path",{d:"M8 5v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("circle",{cx:"8",cy:"11",r:".75",fill:"currentColor"})],-1)),f(" "+l(o(a)("When are renewal orders created?")),1)])]),_:1})])):A("",!0)]),_:1},8,["visible"])],42,de)],8,ae),e("div",we,[s[9]||(s[9]=e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor","stroke-width":"1.5"}),e("path",{d:"M8 5v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("circle",{cx:"8",cy:"11",r:".75",fill:"currentColor"})],-1)),e("span",null,l(o(a)("Only affects new subscriptions. Existing ones keep their current billing method.")),1)])]),_:1},8,["modelValue","title"])])}}};export{Ue as default};
1 +import{h as w,l as d,r as V,e as p,o as _,d as e,a as u,b as A,t as l,u as o,F as G,g as N,f,w as c,n as P}from"./vue.esm-bundler.js?ver=1.6.5";import{t as a}from"./Translator.js?ver=1.6.5";import{B as Y}from"./Badge.js?ver=1.6.5";import{T}from"./TransitionAccordion.js?ver=1.6.5";import{R as H}from"./Rest.js?ver=1.6.5";import{n as j}from"./Notify.js?ver=1.6.5";import"./Arr.js?ver=1.6.5";import"./Model.js?ver=1.6.5";import"./common.js?ver=1.6.5";import"./dayjs.min.js?ver=1.6.5";import"./Str.js?ver=1.6.5";import"./timezone.js?ver=1.6.5";import"./weekOfYear.js?ver=1.6.5";import"./Utils.js?ver=1.6.5";import"./CurrencyFormatter.js?ver=1.6.5";import"./index.js?ver=1.6.5";import"./vue-router.js?ver=1.6.5";import"./Url.js?ver=1.6.5";import"./DynamicIcon.js?ver=1.6.5";import"./preload-helper.js?ver=1.6.5";import"./_plugin-vue_export-helper.js?ver=1.6.5";import"./index3.js?ver=1.6.5";import"./IconButton.js?ver=1.6.5";const I={class:"fct-subscription-mode-manager"},J={class:"flex items-start justify-between gap-4 rounded border border-gray-divider bg-gray-25 p-4 dark:border-slate-700 dark:bg-slate-800"},Q={class:"flex items-center gap-2"},X={class:"mt-2 text-sm text-system-mid dark:text-slate-300"},Z={key:0,class:"mt-1 text-xs text-system-dark-light dark:text-slate-400"},ee={key:1,class:"mt-2 pl-4 text-xs list-disc text-system-dark-light dark:text-slate-400"},te={class:"-ml-4 mb-1 list-none font-medium text-system-mid dark:text-slate-300"},ae=["aria-label"],se=["aria-checked","tabindex"],le={class:"fct-subscription-mode-card__header"},oe={class:"fct-subscription-mode-card__title"},re={class:"fct-subscription-mode-recommended"},ne={class:"fct-subscription-mode-card__desc"},ie={class:"fct-subscription-mode-card__extras"},ce={class:"fct-subscription-mode-note"},de=["aria-checked","tabindex"],ue={class:"fct-subscription-mode-card__header"},me={class:"fct-subscription-mode-card__title"},pe={class:"fct-subscription-mode-card__desc"},_e={class:"fct-subscription-mode-card__extras"},ge={class:"fct-subscription-mode-note"},fe={key:0,class:"fct-subscription-mode-support"},be={key:0,class:"fct-subscription-mode-card__schedule-link"},ve={class:"fct-schedule-tooltip__title"},ye={class:"fct-schedule-tooltip__list"},he={class:"fct-subscription-mode-card__schedule-trigger"},we={class:"fct-subscription-mode-safety-note"},Le={__name:"SubscriptionModeManager",props:{name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},label:{type:String},attribute:{type:Object},callback:{type:Function}},setup(q){const m=q,v=w(!1),y=w(!1),n=w("gateway_managed"),k=w(!1),x=w(!1),O=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_management_mode)||"gateway_managed"}),R=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_system_charge)==="yes"}),M=d(()=>{var t;return((t=m.value)==null?void 0:t.subscription_manual_fallback)==="yes"}),C=d(()=>O.value==="store_managed"),S=d(()=>{var t;return((t=m.field)==null?void 0:t.schedule_items)||[]}),z=d(()=>{var t;return((t=m.field)==null?void 0:t.system_charge_gateways)||[]}),F=d(()=>{const t=z.value.map(s=>s.label);return t.length?a("Supported by %1$s.",t.join(", ")):""}),$=d(()=>C.value?R.value?{label:a("Store Billing · Auto-charge"),type:"warning"}:{label:a("Store Billing"),type:"warning"}:M.value?{label:a("Gateway Billing · All methods"),type:"success"}:{label:a("Gateway Billing"),type:"success"}),K=d(()=>a("Gateways without built-in recurring billing can still sell subscriptions. Their renewals are invoiced by email before each due date.")),U=d(()=>C.value?R.value?a("Your store creates renewal invoices and charges saved payment methods automatically."):a("Your store creates renewal invoices before each due date. Customers pay via email link."):a("Stripe, PayPal, and other subscription-ready gateways charge renewals automatically.")),E=()=>{n.value=O.value,k.value=R.value,x.value=M.value,v.value=!0},L=()=>{const t=m.statePath||"",s=n.value,i=k.value?"yes":"no",g=x.value?"yes":"no";y.value=!0,H.post("settings/store",{subscription_management_mode:s,subscription_system_charge:i,subscription_manual_fallback:g}).then(()=>{m.form.setValue(`${t}subscription_management_mode`,s),m.form.setValue(`${t}subscription_system_charge`,i),m.form.setValue(`${t}subscription_manual_fallback`,g),j.success(a("Renewal billing updated")),v.value=!1}).catch(b=>{var B;j.error(((B=b.data)==null?void 0:B.message)||a("Could not save the subscription billing mode."))}).finally(()=>{y.value=!1})},W=t=>{y.value||t()},h=["gateway_managed","store_managed"],D=t=>{var g,b;const s=h.indexOf(n.value);let i=-1;if(t.key==="ArrowDown"||t.key==="ArrowRight")i=(s+1)%h.length;else if(t.key==="ArrowUp"||t.key==="ArrowLeft")i=(s-1+h.length)%h.length;else if(t.key===" "||t.key==="Enter"){t.preventDefault();return}else return;t.preventDefault(),n.value=h[i],(b=(g=t.currentTarget.closest('[role="radiogroup"]'))==null?void 0:g.querySelectorAll('[role="radio"]')[i])==null||b.focus()};return(t,s)=>{const i=V("el-button"),g=V("el-checkbox"),b=V("el-tooltip"),B=V("el-dialog");return _(),p("div",I,[e("div",J,[e("div",null,[e("div",Q,[u(Y,{type:$.value.type,text:$.value.label},null,8,["type","text"])]),e("p",X,l(U.value),1),!C.value&&M.value?(_(),p("p",Z,l(K.value),1)):A("",!0),C.value&&S.value.length?(_(),p("ul",ee,[e("li",te,l(o(a)("Renewal invoices created"))+":",1),(_(!0),p(G,null,N(S.value,r=>(_(),p("li",{key:r.label,class:"mb-0.5"},[e("strong",null,l(r.label)+":",1),f(" "+l(r.when),1)]))),128))])):A("",!0)]),u(i,{plain:"",size:"small",onClick:E},{default:c(()=>[f(l(o(a)("Change")),1)]),_:1})]),u(B,{modelValue:v.value,"onUpdate:modelValue":s[5]||(s[5]=r=>v.value=r),title:o(a)("Renewal Billing"),width:"560px","append-to-body":"","before-close":W,class:"fct-subscription-mode-dialog"},{footer:c(()=>[u(i,{disabled:y.value,onClick:s[4]||(s[4]=r=>v.value=!1)},{default:c(()=>[f(l(o(a)("Cancel")),1)]),_:1},8,["disabled"]),u(i,{type:"primary",loading:y.value,onClick:L},{default:c(()=>[f(l(o(a)("Apply")),1)]),_:1},8,["loading"])]),default:c(()=>[e("div",{class:"fct-subscription-mode-cards",role:"radiogroup","aria-label":o(a)("Renewal Billing")},[e("div",{class:P(["fct-subscription-mode-card",{"is-selected":n.value==="gateway_managed"}]),role:"radio","aria-checked":n.value==="gateway_managed",tabindex:n.value==="gateway_managed"?0:-1,onClick:s[1]||(s[1]=r=>n.value="gateway_managed"),onKeydown:D},[e("div",le,[s[6]||(s[6]=e("span",{class:"fct-subscription-mode-card__radio"},null,-1)),e("span",oe,l(o(a)("Gateway Billing")),1),e("span",re,l(o(a)("Recommended")),1)]),e("p",ne,l(o(a)("Stripe, PayPal, and other subscription-ready gateways charge customers automatically each cycle.")),1),u(T,{visible:n.value==="gateway_managed"},{default:c(()=>[e("div",ie,[u(g,{modelValue:x.value,"onUpdate:modelValue":s[0]||(s[0]=r=>x.value=r)},{default:c(()=>[f(l(o(a)("Allow all payment methods")),1)]),_:1},8,["modelValue"]),e("p",ce,l(o(a)("Gateways without built-in recurring billing (SSLCommerz, Authorize.Net, bank transfer, etc.) can still sell subscriptions. Their renewals are invoiced by email before each due date.")),1)])]),_:1},8,["visible"])],42,se),e("div",{class:P(["fct-subscription-mode-card",{"is-selected":n.value==="store_managed"}]),role:"radio","aria-checked":n.value==="store_managed",tabindex:n.value==="store_managed"?0:-1,onClick:s[3]||(s[3]=r=>n.value="store_managed"),onKeydown:D},[e("div",ue,[s[7]||(s[7]=e("span",{class:"fct-subscription-mode-card__radio"},null,-1)),e("span",me,l(o(a)("Store Billing")),1)]),e("p",pe,l(o(a)("Your store creates a renewal invoice before each due date. Customers pay via a link in the email.")),1),u(T,{visible:n.value==="store_managed"},{default:c(()=>[e("div",_e,[u(g,{modelValue:k.value,"onUpdate:modelValue":s[2]||(s[2]=r=>k.value=r)},{default:c(()=>[f(l(o(a)("Auto-charge saved payment methods")),1)]),_:1},8,["modelValue"]),e("p",ge,l(o(a)("When supported, the customer's saved payment method is charged automatically on each renewal due date.")),1),F.value?(_(),p("p",fe,l(F.value),1)):A("",!0)]),S.value.length?(_(),p("div",be,[u(b,{placement:"bottom-start",effect:"dark","popper-class":"fct-tooltip fct-schedule-tooltip"},{content:c(()=>[e("p",ve,l(o(a)("When are renewal orders created?")),1),e("ul",ye,[(_(!0),p(G,null,N(S.value,r=>(_(),p("li",{key:r.label},[e("strong",null,l(r.label)+":",1),f(" "+l(r.when),1)]))),128))])]),default:c(()=>[e("span",he,[s[8]||(s[8]=e("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor","stroke-width":"1.5"}),e("path",{d:"M8 5v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("circle",{cx:"8",cy:"11",r:".75",fill:"currentColor"})],-1)),f(" "+l(o(a)("When are renewal orders created?")),1)])]),_:1})])):A("",!0)]),_:1},8,["visible"])],42,de)],8,ae),e("div",we,[s[9]||(s[9]=e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor","stroke-width":"1.5"}),e("path",{d:"M8 5v3",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("circle",{cx:"8",cy:"11",r:".75",fill:"currentColor"})],-1)),e("span",null,l(o(a)("Only affects new subscriptions. Existing ones keep their current billing method.")),1)])]),_:1},8,["modelValue","title"])])}}};export{Le as default};