@solvimon/solvimon-web 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +5 -5
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js → BillingInformation.vue_vue_type_script_setup_true_lang-BD3CrJzj.js} +1 -1
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-DQAp1xwu.mjs} +2 -2
- package/dist/{ContentWithAsideLayout-BC-C5Gjt.mjs → ContentWithAsideLayout-CRsFr9TH.mjs} +1 -1
- package/dist/{ContentWithAsideLayout-CIVSoqFr.js → ContentWithAsideLayout-DczcgSrt.js} +1 -1
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-BE3I7Oe1.js} +1 -1
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0ie9Krt.mjs} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DVDOsMnT.mjs} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-sNdlKgdU.js} +1 -1
- package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DJEZEEwZ.mjs} +5 -5
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Sn1Jq19s.js +1 -0
- package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-Bifo4jTH.js +1 -0
- package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-DWp42_G4.mjs +75 -0
- package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs → Skeleton.vue_vue_type_script_setup_true_lang-C-taYlG4.mjs} +5 -4
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-C_BwMlBE.js +1 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-Bp5RvQVS.mjs} +5 -5
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js → SubscriptionsList.vue_vue_type_script_setup_true_lang-yyhwzYSM.js} +1 -1
- package/dist/auto-DzZuCneB.mjs +14387 -0
- package/dist/auto-PpnAChnH.js +6 -0
- package/dist/{cloneDeep-Hs8Pp07F.js → cloneDeep-DranHQkY.js} +1 -1
- package/dist/{component-BkmcE85U.mjs → component-DEo_ndpK.mjs} +92 -78
- package/dist/component-XHQYFLA_.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -1
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +96 -5
- package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +582 -5
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +132 -5
- package/dist/components/Invoice/Invoice.ce.d.ts +1 -1
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +580 -5
- package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +127 -5
- package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -1
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +102 -5
- package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +131 -5
- package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +236 -5
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +150 -5
- package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +132 -5
- package/dist/components/WalletBalances/WalletBalances.ce.d.ts +3 -0
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -0
- package/dist/{InvoiceDetails.entry.ce-Cnpz8CLJ.mjs → components/WalletBalances/WalletBalances.es.js} +41 -51
- package/dist/core/configuration.d.ts +2 -1
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/core/registry.d.ts +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +40 -34
- package/dist/invoices-BW1notiX.js +1 -0
- package/dist/{invoices-C31Wz1Bu.mjs → invoices-M5oYVch6.mjs} +1 -1
- package/dist/{paymentMethods-CzUqDlvc.js → paymentMethods-BX80t2zk.js} +1 -1
- package/dist/{paymentMethods-CrU4G_2Y.mjs → paymentMethods-CqKUfc3w.mjs} +1 -1
- package/dist/{payments-C3LPk9k9.js → payments-BHv4hCeJ.js} +1 -1
- package/dist/{payments-NtWI8KlU.mjs → payments-CosaPZwo.mjs} +1 -1
- package/dist/registry-BwKEYOf7.js +1 -0
- package/dist/registry-Cag1Jj7P.mjs +143 -0
- package/dist/screens/Checkout/Checkout.ce.d.ts +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +5140 -5
- package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +134 -5
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +3 -0
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -0
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +1012 -0
- package/dist/{subscriptions-3R7aMoky.mjs → subscriptions-Bs4DIE8f.mjs} +1 -1
- package/dist/{subscriptions-CqK7t-fF.js → subscriptions-CnxvsBXd.js} +1 -1
- package/dist/{useActionDispatchProvider-CBo_Hwu5.mjs → useActionDispatchProvider-CgRcOqv3.mjs} +1 -1
- package/dist/useActionDispatchProvider-Cru69mAl.js +1 -0
- package/dist/{useCustomer-Dp8sGHI0.js → useCustomer-B0NK96dA.js} +1 -1
- package/dist/{useCustomer-BRY0tuBH.mjs → useCustomer-DlcjY3fP.mjs} +2 -2
- package/dist/{useCustomerPaymentMethodOptions-Fe_dLxfv.mjs → useCustomerPaymentMethodOptions-BzEquyUV.mjs} +7 -6
- package/dist/{useCustomerPaymentMethodOptions-DYpMDnJR.js → useCustomerPaymentMethodOptions-C-8BLzqb.js} +1 -1
- package/dist/{useIncrementalLoading-fHCizCSo.mjs → useIncrementalLoading-C7ToTmZK.mjs} +9 -7
- package/dist/useIncrementalLoading-D60Vttil.js +1 -0
- package/dist/{useInvoiceData-dyvoDwFF.mjs → useInvoiceData-CcueV3We.mjs} +2 -2
- package/dist/{useInvoiceData-DImEH1ca.js → useInvoiceData-DstXfI7t.js} +1 -1
- package/dist/{useInvoicesList-rDvRzMqe.mjs → useInvoicesList-CXng3aUm.mjs} +4 -4
- package/dist/{useInvoicesList-BZQ9Y0qN.js → useInvoicesList-DmzjgMlW.js} +1 -1
- package/dist/{usePaymentMethods-Dbimodf0.js → usePaymentMethods-DCGVRXA4.js} +1 -1
- package/dist/{usePaymentMethods-Bq5fWl1Q.mjs → usePaymentMethods-Db-1R6rI.mjs} +2 -2
- package/dist/{useService-Dz13Nxbi.mjs → useService-B4qv5N2D.mjs} +14 -5
- package/dist/useService-D-CUtlp3.js +1 -0
- package/dist/useWalletBalanceItems-BZyiAhcV.js +1 -0
- package/dist/useWalletBalanceItems-CHkLaccm.mjs +105 -0
- package/package.json +16 -3
- package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +0 -99
- package/dist/BillingInformation.entry.ce-DkrfEvK_.js +0 -1
- package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +0 -1
- package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +0 -579
- package/dist/Checkout.entry.ce-Bif6vR1K.mjs +0 -5185
- package/dist/Checkout.entry.ce-CkQnLAn4.js +0 -1
- package/dist/CustomerOverview.entry.ce-C__omsVl.js +0 -1
- package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +0 -231
- package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +0 -135
- package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +0 -1
- package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +0 -583
- package/dist/Invoice.entry.ce-Cgr43ome.js +0 -1
- package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +0 -1
- package/dist/InvoicesList.entry.ce-38iOW5qh.js +0 -1
- package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +0 -105
- package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +0 -1
- package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +0 -134
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +0 -1
- package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +0 -238
- package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +0 -1
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +0 -1
- package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +0 -1
- package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +0 -153
- package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +0 -1
- package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +0 -135
- package/dist/auto-B_36W1Fc.js +0 -6
- package/dist/auto-BfMZdgp-.mjs +0 -14207
- package/dist/component-Df5eNqYX.js +0 -1
- package/dist/invoices-8M_3ur_U.js +0 -1
- package/dist/registry-By94DXE2.js +0 -1
- package/dist/registry-shRKDl3K.mjs +0 -127
- package/dist/useActionDispatchProvider-DsIljrhi.js +0 -1
- package/dist/useIncrementalLoading-D8oKNxX7.js +0 -1
- package/dist/useService-bNNi4GB8.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as useConfig, c as createRequestService, w as withExpand, s as serializeQueryParams, a as withPagination } from "./component-
|
|
1
|
+
import { u as useConfig, c as createRequestService, w as withExpand, s as serializeQueryParams, a as withPagination } from "./component-DEo_ndpK.mjs";
|
|
2
2
|
const ENDPOINT = "/portal/pricing-plan-subscriptions";
|
|
3
3
|
function createSubscriptionsService() {
|
|
4
4
|
const config = useConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const i=require("./component-
|
|
1
|
+
const i=require("./component-XHQYFLA_.js"),e="/portal/pricing-plan-subscriptions";exports.createSubscriptionsService=function(){const n=i.useConfig(),r=i.createRequestService();return{getSubscription:function({id:_,expanded:c=!1}){const s=c?["pricing_plan_schedule_infos.id","pricing_plan_schedule_infos.pricing_plan_version_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_plan_id","pricing_plan_schedule_infos.pricing_plan_version.credit_types","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.product_category_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.product_ids","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.entitlements.feature_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.configs.conditions.meter_properties.id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.configs.wallet_grants.wallet_type_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_item_ids","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_based.meter_value_calculation_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_metric.meter_value_calculation.meter_value_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_metric.meter_value_calculation.meter_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_values.id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_properties","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_properties.id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.product_ids","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.configs.conditions.meter_properties.id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.configs.wallet_grants.wallet_type_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_item_ids","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_based.meter_value_calculation_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter_value_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_values","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_values.id","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_properties","pricing_plan_schedule_infos.pricing_plan_version.pricing_categories.pricing_groups.pricings.items.product_items.usage_metric.meter_value_calculation.meter.meter_properties.id"]:[];return r({url:`${n.apiUrls.config}${e}/${_}${i.serializeQueryParams(i.withExpand({expandParams:s}))}`})},getActiveSubscriptions:function({customerId:_,pagination:c}){const s=c??{},p=i.withExpand({initialParams:{customer_id:_,statuses:["ACTIVE"],type:"BILLING"},expandParams:["pricing_plan_schedule_infos.pricing_plan_version_id","pricing_plan_schedule_infos.pricing_plan_version.pricing_plan_id"]}),t=i.serializeQueryParams(i.withPagination(p,s));return r({url:`${n.apiUrls.config}${e}${t}`,isCollection:!0})}}};
|
package/dist/{useActionDispatchProvider-CBo_Hwu5.mjs → useActionDispatchProvider-CgRcOqv3.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
|
-
import { A as ACTION_DISPATCHER_PROVIDER_INJECTION_KEY } from "./component-
|
|
2
|
+
import { A as ACTION_DISPATCHER_PROVIDER_INJECTION_KEY } from "./component-DEo_ndpK.mjs";
|
|
3
3
|
function useActionDispatchProvider() {
|
|
4
4
|
const dispatchAction = inject(ACTION_DISPATCHER_PROVIDER_INJECTION_KEY);
|
|
5
5
|
if (!dispatchAction) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=require("vue"),i=require("./component-XHQYFLA_.js");exports.useActionDispatchProvider=function(){const o=t.inject(i.ACTION_DISPATCHER_PROVIDER_INJECTION_KEY);if(!o)throw new Error("dispatchAction is not provided");return{dispatchAction:o}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./component-
|
|
1
|
+
const e=require("vue"),t=require("./component-XHQYFLA_.js"),r=require("./useService-D-CUtlp3.js");exports.useCustomer=function({customerId:u}){const{getCustomer:s,updateCustomer:o}=function(){const e=t.createRequestService(),r=t.useConfig();return{getCustomer:function(t){return e({url:`${r.apiUrls.config}/portal/customers/${t}`})},updateCustomer:function(t,u){return e({url:`${r.apiUrls.config}/portal/customers/${t}`,options:{method:"PATCH"},data:u})}}}(),n=e.ref(),{data:c,...a}=r.useService({service:async()=>{const e=await s(u);return n.value=e,e}}),{data:i,...m}=r.useService({service:async e=>{const t=await o(u,e);return n.value=t,t}});return{customer:n,get:a,update:m}};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
|
-
import { c as createRequestService, u as useConfig } from "./component-
|
|
3
|
-
import { u as useService } from "./useService-
|
|
2
|
+
import { c as createRequestService, u as useConfig } from "./component-DEo_ndpK.mjs";
|
|
3
|
+
import { u as useService } from "./useService-B4qv5N2D.mjs";
|
|
4
4
|
function createCustomerService() {
|
|
5
5
|
const request = createRequestService();
|
|
6
6
|
const config = useConfig();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createBlock, unref, createSlots, withCtx, createElementBlock, Fragment, renderList, createVNode, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
import { b as useIntl, d as _sfc_main$1g, g as _sfc_main$2, _ as _sfc_main$2$1, m as _sfc_main$2H } from "./component-
|
|
3
|
-
import { _ as _sfc_main$3 } from "./Skeleton.vue_vue_type_script_setup_true_lang-
|
|
4
|
-
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-
|
|
5
|
-
import { c as createPaymentMethodsService } from "./paymentMethods-
|
|
6
|
-
import { u as useService } from "./useService-
|
|
2
|
+
import { b as useIntl, d as _sfc_main$1g, g as _sfc_main$2, _ as _sfc_main$2$1, m as _sfc_main$2H } from "./component-DEo_ndpK.mjs";
|
|
3
|
+
import { _ as _sfc_main$3 } from "./Skeleton.vue_vue_type_script_setup_true_lang-C-taYlG4.mjs";
|
|
4
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CgRcOqv3.mjs";
|
|
5
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-CqKUfc3w.mjs";
|
|
6
|
+
import { u as useService } from "./useService-B4qv5N2D.mjs";
|
|
7
7
|
const _hoisted_1 = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "flex flex-col gap-2"
|
|
@@ -153,8 +153,9 @@ function useCustomerPaymentMethodOptions({
|
|
|
153
153
|
amount
|
|
154
154
|
}) {
|
|
155
155
|
const { getPaymentMethodOptions } = createPaymentMethodsService();
|
|
156
|
+
const initialValue = [];
|
|
156
157
|
const { data, execute, error, apiStatus, isPending } = useService({
|
|
157
|
-
initialValue
|
|
158
|
+
initialValue,
|
|
158
159
|
service: async () => {
|
|
159
160
|
const response = await getPaymentMethodOptions({ customerId, amount });
|
|
160
161
|
return response.flatMap((entry) => entry.options ?? []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./component-
|
|
1
|
+
const e=require("vue"),t=require("./component-XHQYFLA_.js"),o=require("./Skeleton.vue_vue_type_script_setup_true_lang-C_BwMlBE.js"),n=require("./useActionDispatchProvider-Cru69mAl.js"),a=require("./paymentMethods-BX80t2zk.js"),i=require("./useService-D-CUtlp3.js"),s={key:0,class:"flex flex-col gap-2"},r=e.defineComponent({__name:"CustomerPaymentMethodsBlock",props:{paymentMethods:{type:Array},limit:{default:2,type:Number},isLoading:{type:Boolean},showViewAllButton:{type:Boolean},showAddButton:{type:Boolean}},emits:["view-all-payment-methods","add-payment-method"],setup(o){const n=o,{$t:a}=t.useIntl(),i=e.computed(()=>n.paymentMethods.length>0);return(n,r)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1g),{"no-spacing":"","no-border":"",title:e.unref(a)({defaultMessage:"{count, plural, one {Payment method} other {Payment methods}}",description:"Title for the payment methods block on the customer overview page",id:"customer_overview.payment_methods.title"},{count:String(o.paymentMethods.length)})},e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",s,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.paymentMethods,o=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1g),{key:o.id},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main),{"payment-method":o},null,8,["payment-method"])]),_:2},1024))),128))])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1g),{key:1},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2),{variant:"body-sm",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add a payment method for recurring invoice payments.",description:"Helper text for adding a payment method when no payment methods are configured",id:"customer_overview.payment_methods_block.add_payment_method_helper_text"})),1)]),_:1}),o.showAddButton?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2H),{key:0,class:"mt-4 w-full",variant:"outline",color:"gray","icon-prefix":"add",type:"button",onClick:r[1]||(r[1]=e=>n.$emit("add-payment-method"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add payment method",description:"Text for the add payment method button that is shown when no payment methods have been configured",id:"customer_overview.payment_methods_block.add_payment_method_button_label"})),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),_:2},[o.showViewAllButton?{name:"right",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2H),{size:"sm",variant:"ghost",color:"gray","icon-suffix":"arrow_right_alt",type:"button",onClick:r[0]||(r[0]=e=>n.$emit("view-all-payment-methods"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"View all",id:"customer_overview.payment_methods_block.view_all_payment_methods_link_label",description:"The link text that links to the overview page of the customer invoices"})),1)]),_:1})]),key:"0"}:void 0]),1032,["title"]))}}),d=e.defineComponent({__name:"CustomerPaymentMethods",props:{isLoading:{type:Boolean},paymentMethods:{type:Array},paymentMethodsOptions:{type:Array},maxPaymentMethods:{type:Number},configuration:{default:()=>({showViewAllButton:!0,showAddButton:!0}),type:Object}},setup(t){const{dispatchAction:a}=n.useActionDispatchProvider();return(n,i)=>{var s,d;return t.isLoading?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,variant:"section",class:"h-72","data-testid":"customer-payment-methods-skeleton"})):(e.openBlock(),e.createBlock(r,{key:1,"is-loading":t.isLoading,"payment-methods":t.paymentMethods,"payment-methods-options":t.paymentMethodsOptions,"show-view-all-button":null==(s=t.configuration)?void 0:s.showViewAllButton,"show-add-button":null==(d=t.configuration)?void 0:d.showAddButton,onViewAllPaymentMethods:i[0]||(i[0]=t=>e.unref(a)({action:"view-all-payment-methods"})),onAddPaymentMethod:i[1]||(i[1]=t=>e.unref(a)({action:"add-payment-method"}))},null,8,["is-loading","payment-methods","payment-methods-options","show-view-all-button","show-add-button"]))}}});exports._sfc_main=d,exports.useCustomerPaymentMethodOptions=function({customerId:e,amount:t}){const{getPaymentMethodOptions:o}=a.createPaymentMethodsService(),{data:n,execute:s,error:r,apiStatus:d,isPending:m}=i.useService({initialValue:[],service:async()=>(await o({customerId:e,amount:t})).flatMap(e=>e.options??[])});return{error:r,apiStatus:d,items:n,fetch:s,isPending:m}};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { A as ApiStatus } from "./_Uint8Array-DHE03FZr.mjs";
|
|
2
|
-
import { i as getPaginatedFullList, j as isApiSuccessCollectionResponse } from "./component-
|
|
3
|
-
import { ref, computed } from "vue";
|
|
2
|
+
import { i as getPaginatedFullList, j as isApiSuccessCollectionResponse } from "./component-DEo_ndpK.mjs";
|
|
3
|
+
import { shallowRef, ref, computed } from "vue";
|
|
4
4
|
import { c as cloneDeep } from "./cloneDeep-sm9cY-u2.mjs";
|
|
5
|
+
function toError(error) {
|
|
6
|
+
return error instanceof Error ? error : new Error("Something went wrong while fetching data.");
|
|
7
|
+
}
|
|
5
8
|
function useIncrementalLoading({
|
|
6
9
|
initialData = [],
|
|
7
10
|
service
|
|
8
11
|
}) {
|
|
9
|
-
const items =
|
|
12
|
+
const items = shallowRef(initialData);
|
|
10
13
|
const status = ref(ApiStatus.Initial);
|
|
11
14
|
const error = ref(null);
|
|
12
15
|
const page = ref(1);
|
|
@@ -23,13 +26,12 @@ function useIncrementalLoading({
|
|
|
23
26
|
status.value = ApiStatus.Done;
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
items.value = [...items.value, ...successResponse.data];
|
|
29
|
+
hasNextBatch.value = !!((_a = response.links) == null ? void 0 : _a.next);
|
|
30
|
+
items.value = [...items.value, ...response.data];
|
|
29
31
|
status.value = ApiStatus.Done;
|
|
30
32
|
page.value = pageNumber;
|
|
31
33
|
} catch (err) {
|
|
32
|
-
error.value = err;
|
|
34
|
+
error.value = toError(err);
|
|
33
35
|
status.value = ApiStatus.Failed;
|
|
34
36
|
}
|
|
35
37
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./_Uint8Array-DxISR7XF.js"),a=require("./component-XHQYFLA_.js"),t=require("vue"),i=require("./cloneDeep-DranHQkY.js");exports.useIncrementalLoading=function({initialData:n=[],service:u}){const l=t.shallowRef(n),s=t.ref(e.ApiStatus.Initial),r=t.ref(null),o=t.ref(1),c=t.ref(!1),v=t.computed(()=>s.value===e.ApiStatus.Loading),p=async t=>{var i;if(!v.value)try{r.value=null,s.value=e.ApiStatus.Loading;const n=await u(t);if(!a.isApiSuccessCollectionResponse(n))return void(s.value=e.ApiStatus.Done);c.value=!!(null==(i=n.links)?void 0:i.next),l.value=[...l.value,...n.data],s.value=e.ApiStatus.Done,o.value=t}catch(n){r.value=function(e){return e instanceof Error?e:new Error("Something went wrong while fetching data.")}(n),s.value=e.ApiStatus.Failed}};return{items:t.computed(()=>i.cloneDeep(l.value)),error:r,fetchInitial:async()=>await p(1),fetchMore:async()=>await p(o.value+1),fetchAll:async()=>{r.value=null,s.value=e.ApiStatus.Loading;const t=await a.getPaginatedFullList(async t=>{const i=await u(t);if(!a.isApiSuccessCollectionResponse(i))throw s.value=e.ApiStatus.Failed,new Error("message"in i?i.message:"Request failed");return i});l.value=t.data,s.value=e.ApiStatus.Done},isPending:v,hasNextBatch:c}};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createInvoicesService } from "./invoices-
|
|
2
|
-
import { c as createPaymentsService } from "./payments-
|
|
1
|
+
import { c as createInvoicesService } from "./invoices-M5oYVch6.mjs";
|
|
2
|
+
import { c as createPaymentsService } from "./payments-CosaPZwo.mjs";
|
|
3
3
|
import { ref, onMounted } from "vue";
|
|
4
4
|
import { w as watchDebounced } from "./index-BFZ0dPh9.mjs";
|
|
5
5
|
const useData = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./invoices-
|
|
1
|
+
const e=require("./invoices-BW1notiX.js"),t=require("./payments-BHv4hCeJ.js"),n=require("vue"),a=require("./index-2jo9BSPM.js");exports.useInvoiceData=function(r){const{getInvoice:c}=e.createInvoicesService(),{getPayments:i}=t.createPaymentsService();return(({getData:e,onError:t,watchValue:r,debounce:c=200})=>{const i=n.ref(),s=n.ref(!0),o=async()=>{try{i.value=await e(r)}catch(n){null==t||t(n)}finally{s.value=!1}};return n.onMounted(async()=>{o(),r&&a.watchDebounced(r,()=>{o()},{debounce:c})}),{data:i,isPending:s}})({getData:async()=>{const[e,t]=await Promise.all([c(r),i(r)]);return{invoice:e,paymentAttempts:t}}})};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, withCtx, createTextVNode, toDisplayString, Fragment, renderList, createBlock, createSlots, createElementVNode, withModifiers, createCommentVNode } from "vue";
|
|
2
|
-
import { b as useIntl,
|
|
3
|
-
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-
|
|
4
|
-
import { u as useIncrementalLoading } from "./useIncrementalLoading-
|
|
5
|
-
import { c as createInvoicesService } from "./invoices-
|
|
2
|
+
import { b as useIntl, r as _sfc_main$1y, T as TableHead, t as TableHeadRow, v as _sfc_main$1r, x as TableBody, y as _sfc_main$1q, z as _sfc_main$1p, _ as _sfc_main$2, B as _sfc_main$2L, e as _sfc_main$3, m as _sfc_main$2H, d as _sfc_main$1g } from "./component-DEo_ndpK.mjs";
|
|
3
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CgRcOqv3.mjs";
|
|
4
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-C7ToTmZK.mjs";
|
|
5
|
+
import { c as createInvoicesService } from "./invoices-M5oYVch6.mjs";
|
|
6
6
|
const _hoisted_1 = { class: "grid-cols-1 gap-4" };
|
|
7
7
|
const _hoisted_2 = ["onClick"];
|
|
8
8
|
const _hoisted_3 = { class: "flex flex-col" };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./component-
|
|
1
|
+
const e=require("vue"),t=require("./component-XHQYFLA_.js"),i=require("./useActionDispatchProvider-Cru69mAl.js"),o=require("./useIncrementalLoading-D60Vttil.js"),n=require("./invoices-BW1notiX.js"),a={class:"grid-cols-1 gap-4"},c=["onClick"],r={class:"flex flex-col"},s={class:"mt-2 flex items-center justify-center"},l=e.defineComponent({__name:"InvoiceTable",props:{invoices:{type:Array},isLoading:{type:Boolean},hasMoreItems:{type:Boolean},configuration:{type:Object}},emits:["view-invoice","pay-invoice","load-more"],setup(i){const o=i,{formatDate:n,$t:l}=t.useIntl(),d=e.computed(()=>o.configuration.showPayButton),u=e.computed(()=>o.configuration.showViewButton),f=e.computed(()=>o.hasMoreItems);return(o,m)=>(e.openBlock(),e.createElementBlock("div",a,[e.createVNode(e.unref(t._sfc_main$1y),{striped:"","no-border":"",rounded:"",hoverable:"","stripe-class":"group-odd:bg-gray-50/50"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.TableHead),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.TableHeadRow),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1r),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Invoice",description:"The title of the invoice number header column of the invoice table",id:"invoice_table.header.invoice_number"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),{class:"hidden md:table-cell"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Date",description:"The title of the invoice date header column of the invoice table",id:"invoice_table.header.date"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Amount",description:"The title of the invoice amount header column of the invoice table",id:"invoice_table.header.amount"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Status",description:"The title of the invoice status header column of the invoice table",id:"invoice_table.header.status"})),1)]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(t.TableBody),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.invoices,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1q),{key:i.id},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1p),{"has-padding":"",class:"h-14"},{default:e.withCtx(()=>[e.createElementVNode("div",r,[e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-sm",class:"md:hidden"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({date:i.invoice_date,format:"date",offsetType:"offsetted",timezone:i.customer.timezone})),1)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.invoice_number),1)]),_:2},1024)])]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"hidden h-14 md:table-cell"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({date:i.invoice_date,format:"date",offsetType:"offsetted",timezone:i.customer.timezone})),1)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"h-14"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2),{tag:"span",weight:"semibold"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2L),{value:i.invoice_amount_including_tax},null,8,["value"])]),_:2},1024)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"h-14 text-right"},{default:e.withCtx(()=>[i.paid?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,color:"green"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Paid",description:"The label of the chip for paid invoices",id:"invoice_table.chip.paid"})),1)]),_:1})):d.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2H),{key:1,variant:"outline",color:"gray",size:"sm",type:"button",onClick:e.withModifiers(e=>o.$emit("pay-invoice",{invoiceId:i.id}),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Pay",description:"The label for the pay invoice button",id:"customer.invoice_table.pay_invoice_button.label"})),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},[u.value?{name:"link",fn:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"absolute inset-0 h-full w-full",onClick:e=>o.$emit("view-invoice",{invoiceId:i.id})},null,8,c)]),key:"0"}:void 0]),1024))),128))]),_:1})]),_:1}),e.createElementVNode("div",s,[f.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2H),{key:0,variant:"outline",color:"gray",size:"sm",class:"w-full",loading:i.isLoading,onClick:m[0]||(m[0]=e=>o.$emit("load-more"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Load more",description:"The label for the load more button",id:"invoice_table.button.load_more"})),1)]),_:1},8,["loading"])):e.createCommentVNode("",!0)])]))}}),d=e.defineComponent({__name:"InvoicesList",props:{invoices:{type:Array},isLoading:{type:Boolean},hasMoreItems:{type:Boolean},configuration:{default:()=>({showPayButton:!0,showViewButton:!0,pagination:{batchSize:15,enabled:!0}}),type:Object}},emits:["load-more"],setup(o){const{$t:n}=t.useIntl(),{dispatchAction:a}=i.useActionDispatchProvider();return(i,c)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1g),{"no-border":"",spacing:"none","content-background":"none",title:e.unref(n)({defaultMessage:"Invoices",description:"Invoices list title",id:"invoices_list.title"})},{default:e.withCtx(()=>[e.createVNode(l,{configuration:o.configuration,"has-more-items":o.hasMoreItems,invoices:o.invoices,"is-loading":o.isLoading,onLoadMore:c[0]||(c[0]=e=>i.$emit("load-more")),onViewInvoice:c[1]||(c[1]=t=>e.unref(a)({action:"view-invoice",data:{invoiceId:t.invoiceId}})),onPayInvoice:c[2]||(c[2]=t=>e.unref(a)({action:"pay-invoice",data:{invoiceId:t.invoiceId}}))},null,8,["configuration","has-more-items","invoices","is-loading"])]),_:1},8,["title"]))}});exports._sfc_main=d,exports.useInvoicesList=function({customerId:e,batchSize:t=15}){const i=n.createInvoicesService();return o.useIncrementalLoading({service:async o=>i.getInvoices({customerId:e,pagination:{page:o,pageSize:t}})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./useIncrementalLoading-
|
|
1
|
+
const e=require("./useIncrementalLoading-D60Vttil.js"),t=require("./paymentMethods-BX80t2zk.js");exports.usePaymentMethods=function({customerId:n,pageSize:s=15}){const{getPaymentMethods:a}=t.createPaymentMethodsService();return e.useIncrementalLoading({service:async e=>a({customerId:n,pagination:{page:e,pageSize:s}})})};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as useIncrementalLoading } from "./useIncrementalLoading-
|
|
2
|
-
import { c as createPaymentMethodsService } from "./paymentMethods-
|
|
1
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-C7ToTmZK.mjs";
|
|
2
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-CqKUfc3w.mjs";
|
|
3
3
|
function usePaymentMethods({
|
|
4
4
|
customerId,
|
|
5
5
|
pageSize = 15
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as MapCache, S as Symbol$1, e as eq, U as Uint8Array, g as getAllKeys, a as getTag, i as isBuffer, b as Stack, c as isTypedArray, d as isArray, f as isObjectLike, A as ApiStatus } from "./_Uint8Array-DHE03FZr.mjs";
|
|
2
|
-
import { ref, computed } from "vue";
|
|
2
|
+
import { shallowRef, ref, computed } from "vue";
|
|
3
3
|
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
4
4
|
function setCacheAdd(value) {
|
|
5
5
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
@@ -238,15 +238,24 @@ function updateRefIfChanged(ref2, value) {
|
|
|
238
238
|
function toError(error) {
|
|
239
239
|
return error instanceof Error ? error : new Error("Something went wrong while fetching data.");
|
|
240
240
|
}
|
|
241
|
-
function isCollectionResponse(response
|
|
242
|
-
return
|
|
241
|
+
function isCollectionResponse(response) {
|
|
242
|
+
return typeof response === "object" && response !== null && "data" in response;
|
|
243
|
+
}
|
|
244
|
+
function getCollectionResponseData(response) {
|
|
245
|
+
if (!isCollectionResponse(response)) {
|
|
246
|
+
throw new Error("Expected collection response.");
|
|
247
|
+
}
|
|
248
|
+
return response.data;
|
|
249
|
+
}
|
|
250
|
+
function mapServiceResponse(response, isCollection) {
|
|
251
|
+
return isCollection ? getCollectionResponseData(response) : response;
|
|
243
252
|
}
|
|
244
253
|
function useService({
|
|
245
254
|
initialValue,
|
|
246
255
|
service,
|
|
247
256
|
isCollection = false
|
|
248
257
|
}) {
|
|
249
|
-
const data =
|
|
258
|
+
const data = shallowRef(initialValue);
|
|
250
259
|
const apiStatus = ref(ApiStatus.Initial);
|
|
251
260
|
const error = ref(null);
|
|
252
261
|
const isPending = computed(() => apiStatus.value === ApiStatus.Loading);
|
|
@@ -255,7 +264,7 @@ function useService({
|
|
|
255
264
|
apiStatus.value = ApiStatus.Loading;
|
|
256
265
|
error.value = null;
|
|
257
266
|
const response = await service(...args);
|
|
258
|
-
const mapped =
|
|
267
|
+
const mapped = mapServiceResponse(response, isCollection);
|
|
259
268
|
updateRefIfChanged(data, mapped);
|
|
260
269
|
apiStatus.value = ApiStatus.Done;
|
|
261
270
|
return mapped;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./_Uint8Array-DxISR7XF.js"),t=require("vue");function r(t){var r=-1,n=null==t?0:t.length;for(this.__data__=new e.MapCache;++r<n;)this.add(t[r])}function n(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}r.prototype.add=r.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},r.prototype.has=function(e){return this.__data__.has(e)};function a(e,t,a,i,o,u){var c=1&a,f=e.length,s=t.length;if(f!=s&&!(c&&s>f))return!1;var l=u.get(e),v=u.get(t);if(l&&v)return l==t&&v==e;var p=-1,b=!0,h=2&a?new r:void 0;for(u.set(e,t),u.set(t,e);++p<f;){var y=e[p],d=t[p];if(i)var g=c?i(d,y,p,t,e,u):i(y,d,p,e,t,u);if(void 0!==g){if(g)continue;b=!1;break}if(h){if(!n(t,function(e,t){if(r=t,!h.has(r)&&(y===e||o(y,e,a,i,u)))return h.push(t);var r})){b=!1;break}}else if(y!==d&&!o(y,d,a,i,u)){b=!1;break}}return u.delete(e),u.delete(t),b}function i(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function o(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var u=e.Symbol?e.Symbol.prototype:void 0,c=u?u.valueOf:void 0;var f=Object.prototype.hasOwnProperty;var s="[object Arguments]",l="[object Array]",v="[object Object]",p=Object.prototype.hasOwnProperty;function b(t,r,n,u,b,h){var y=e.isArray(t),d=e.isArray(r),g=y?l:e.getTag(t),_=d?l:e.getTag(r),j=(g=g==s?v:g)==v,w=(_=_==s?v:_)==v,A=g==_;if(A&&e.isBuffer(t)){if(!e.isBuffer(r))return!1;y=!0,j=!1}if(A&&!j)return h||(h=new e.Stack),y||e.isTypedArray(t)?a(t,r,n,u,b,h):function(t,r,n,u,f,s,l){switch(n){case"[object DataView]":if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)return!1;t=t.buffer,r=r.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=r.byteLength||!s(new e.Uint8Array(t),new e.Uint8Array(r)));case"[object Boolean]":case"[object Date]":case"[object Number]":return e.eq(+t,+r);case"[object Error]":return t.name==r.name&&t.message==r.message;case"[object RegExp]":case"[object String]":return t==r+"";case"[object Map]":var v=i;case"[object Set]":var p=1&u;if(v||(v=o),t.size!=r.size&&!p)return!1;var b=l.get(t);if(b)return b==r;u|=2,l.set(t,r);var h=a(v(t),v(r),u,f,s,l);return l.delete(t),h;case"[object Symbol]":if(c)return c.call(t)==c.call(r)}return!1}(t,r,g,n,u,b,h);if(!(1&n)){var S=j&&p.call(t,"__wrapped__"),m=w&&p.call(r,"__wrapped__");if(S||m){var O=S?t.value():t,k=m?r.value():r;return h||(h=new e.Stack),b(O,k,n,u,h)}}return!!A&&(h||(h=new e.Stack),function(t,r,n,a,i,o){var u=1&n,c=e.getAllKeys(t),s=c.length;if(s!=e.getAllKeys(r).length&&!u)return!1;for(var l=s;l--;){var v=c[l];if(!(u?v in r:f.call(r,v)))return!1}var p=o.get(t),b=o.get(r);if(p&&b)return p==r&&b==t;var h=!0;o.set(t,r),o.set(r,t);for(var y=u;++l<s;){var d=t[v=c[l]],g=r[v];if(a)var _=u?a(g,d,v,r,t,o):a(d,g,v,t,r,o);if(!(void 0===_?d===g||i(d,g,n,a,o):_)){h=!1;break}y||(y="constructor"==v)}if(h&&!y){var j=t.constructor,w=r.constructor;j==w||!("constructor"in t)||!("constructor"in r)||"function"==typeof j&&j instanceof j&&"function"==typeof w&&w instanceof w||(h=!1)}return o.delete(t),o.delete(r),h}(t,r,n,u,b,h))}function h(t,r,n,a,i){return t===r||(null==t||null==r||!e.isObjectLike(t)&&!e.isObjectLike(r)?t!=t&&r!=r:b(t,r,n,a,h,i))}function y(e,t){(function(e,t){return h(e,t)})(e.value,t)||(e.value=t)}function d(e,t){return t?function(e){if(!function(e){return"object"==typeof e&&null!==e&&"data"in e}(e))throw new Error("Expected collection response.");return e.data}(e):e}exports.useService=function({initialValue:r,service:n,isCollection:a=!1}){const i=t.shallowRef(r),o=t.ref(e.ApiStatus.Initial),u=t.ref(null),c=t.computed(()=>o.value===e.ApiStatus.Loading);return{data:i,execute:async(...t)=>{try{o.value=e.ApiStatus.Loading,u.value=null;const r=d(await n(...t),a);return y(i,r),o.value=e.ApiStatus.Done,r}catch(r){return u.value=function(e){return e instanceof Error?e:new Error("Something went wrong while fetching data.")}(r),o.value=e.ApiStatus.Failed,Promise.reject()}},apiStatus:o,isPending:c,error:u}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue"),l=require("./component-XHQYFLA_.js"),a=require("./useService-D-CUtlp3.js"),t=require("./Skeleton.vue_vue_type_script_setup_true_lang-C_BwMlBE.js");const n=e.defineComponent({__name:"CustomerWalletBalancesBlock",props:{walletBalances:{type:Array}},setup(a){const{$t:t}=l.useIntl();return(n,o)=>(e.openBlock(),e.createBlock(e.unref(l._sfc_main$1f),{items:a.walletBalances,title:e.unref(t)({defaultMessage:"{count, plural, one {Wallet} other {Wallets}}",description:"Title for the wallets block on the customer overview page",id:"customer_overview.wallet_balances_block.title"},{count:String(a.walletBalances.length)})},null,8,["items","title"]))}}),o=e.defineComponent({__name:"CustomerWalletBalances",props:{hasError:{type:Boolean},isLoading:{type:Boolean},walletBalances:{type:Array}},setup(a){const{$t:o}=l.useIntl();return(s,r)=>a.isLoading?(e.openBlock(),e.createBlock(t._sfc_main,{key:0,variant:"section",class:"min-h-48","data-testid":"customer-wallet-balances-skeleton"})):a.hasError?(e.openBlock(),e.createBlock(e.unref(l._sfc_main$16),{key:1,title:e.unref(o)({defaultMessage:"Could not load wallet balances",description:"Error shown when wallet balances fail to load",id:"wallet_balance.load_failed"})},null,8,["title"])):a.walletBalances.length>0?(e.openBlock(),e.createBlock(n,{key:2,"wallet-balances":a.walletBalances},null,8,["wallet-balances"])):e.createCommentVNode("",!0)}});exports._sfc_main=o,exports.useCustomerWalletBalances=function({customerId:t}){const{getCustomerWalletBalances:n}=function(){const e=l.createRequestService(),a=l.useConfig();return{getCustomerWalletBalances:function(l){return e({url:`${a.apiUrls.config}/portal/customers/${l}/wallets/balance`,options:{method:"POST"},data:{}})}}}(),{data:o,execute:s,apiStatus:r,error:c,isPending:u}=a.useService({service:()=>n(t)});return{walletBalances:e.computed(()=>o.value??null),apiStatus:r,error:c,fetch:s,isPending:u}},exports.useWalletBalanceItems=function(a){const{$t:t}=l.useIntl();return e.computed(()=>{var e;return((null==(e=a.value)?void 0:e.wallet_balances)??[]).map(e=>{var l;return{walletId:e.wallet_id,title:t({defaultMessage:"Balance",description:"Fallback wallet title in wallet balance components",id:"H5+NAX"}),balance:e.wallet_balance.open_balance,balanceAt:e.wallet_balance.balance_at??(null==(l=a.value)?void 0:l.balance_at)??null}})})};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { computed, defineComponent, openBlock, createBlock, unref, createCommentVNode } from "vue";
|
|
2
|
+
import { c as createRequestService, u as useConfig, b as useIntl, C as _sfc_main$1f, D as _sfc_main$16 } from "./component-DEo_ndpK.mjs";
|
|
3
|
+
import { u as useService } from "./useService-B4qv5N2D.mjs";
|
|
4
|
+
import { _ as _sfc_main$2 } from "./Skeleton.vue_vue_type_script_setup_true_lang-C-taYlG4.mjs";
|
|
5
|
+
function createWalletsService() {
|
|
6
|
+
const request = createRequestService();
|
|
7
|
+
const config = useConfig();
|
|
8
|
+
function getCustomerWalletBalances(customerId) {
|
|
9
|
+
return request({
|
|
10
|
+
url: `${config.apiUrls.config}/portal/customers/${customerId}/wallets/balance`,
|
|
11
|
+
options: { method: "POST" },
|
|
12
|
+
data: {}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
getCustomerWalletBalances
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function useCustomerWalletBalances({ customerId }) {
|
|
20
|
+
const { getCustomerWalletBalances } = createWalletsService();
|
|
21
|
+
const { data, execute, apiStatus, error, isPending } = useService({
|
|
22
|
+
service: () => getCustomerWalletBalances(customerId)
|
|
23
|
+
});
|
|
24
|
+
const walletBalances = computed(
|
|
25
|
+
() => data.value ?? null
|
|
26
|
+
);
|
|
27
|
+
return { walletBalances, apiStatus, error, fetch: execute, isPending };
|
|
28
|
+
}
|
|
29
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
30
|
+
__name: "CustomerWalletBalancesBlock",
|
|
31
|
+
props: {
|
|
32
|
+
walletBalances: { type: Array }
|
|
33
|
+
},
|
|
34
|
+
setup(__props) {
|
|
35
|
+
const { $t } = useIntl();
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
return openBlock(), createBlock(unref(_sfc_main$1f), {
|
|
38
|
+
items: __props.walletBalances,
|
|
39
|
+
title: unref($t)(
|
|
40
|
+
{
|
|
41
|
+
defaultMessage: "{count, plural, one {Wallet} other {Wallets}}",
|
|
42
|
+
description: "Title for the wallets block on the customer overview page",
|
|
43
|
+
id: "customer_overview.wallet_balances_block.title"
|
|
44
|
+
},
|
|
45
|
+
{ count: String(__props.walletBalances.length) }
|
|
46
|
+
)
|
|
47
|
+
}, null, 8, ["items", "title"]);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
52
|
+
__name: "CustomerWalletBalances",
|
|
53
|
+
props: {
|
|
54
|
+
hasError: { type: Boolean },
|
|
55
|
+
isLoading: { type: Boolean },
|
|
56
|
+
walletBalances: { type: Array }
|
|
57
|
+
},
|
|
58
|
+
setup(__props) {
|
|
59
|
+
const { $t } = useIntl();
|
|
60
|
+
return (_ctx, _cache) => {
|
|
61
|
+
return __props.isLoading ? (openBlock(), createBlock(_sfc_main$2, {
|
|
62
|
+
key: 0,
|
|
63
|
+
variant: "section",
|
|
64
|
+
class: "min-h-48",
|
|
65
|
+
"data-testid": "customer-wallet-balances-skeleton"
|
|
66
|
+
})) : __props.hasError ? (openBlock(), createBlock(unref(_sfc_main$16), {
|
|
67
|
+
key: 1,
|
|
68
|
+
title: unref($t)({
|
|
69
|
+
defaultMessage: "Could not load wallet balances",
|
|
70
|
+
description: "Error shown when wallet balances fail to load",
|
|
71
|
+
id: "wallet_balance.load_failed"
|
|
72
|
+
})
|
|
73
|
+
}, null, 8, ["title"])) : __props.walletBalances.length > 0 ? (openBlock(), createBlock(_sfc_main$1, {
|
|
74
|
+
key: 2,
|
|
75
|
+
"wallet-balances": __props.walletBalances
|
|
76
|
+
}, null, 8, ["wallet-balances"])) : createCommentVNode("", true);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
function useWalletBalanceItems(walletBalances) {
|
|
81
|
+
const { $t } = useIntl();
|
|
82
|
+
return computed(
|
|
83
|
+
() => {
|
|
84
|
+
var _a;
|
|
85
|
+
return (((_a = walletBalances.value) == null ? void 0 : _a.wallet_balances) ?? []).map((walletBalance) => {
|
|
86
|
+
var _a2;
|
|
87
|
+
return {
|
|
88
|
+
walletId: walletBalance.wallet_id,
|
|
89
|
+
title: $t({
|
|
90
|
+
defaultMessage: "Balance",
|
|
91
|
+
description: "Fallback wallet title in wallet balance components",
|
|
92
|
+
id: "H5+NAX"
|
|
93
|
+
}),
|
|
94
|
+
balance: walletBalance.wallet_balance.open_balance,
|
|
95
|
+
balanceAt: walletBalance.wallet_balance.balance_at ?? ((_a2 = walletBalances.value) == null ? void 0 : _a2.balance_at) ?? null
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
_sfc_main as _,
|
|
103
|
+
useWalletBalanceItems as a,
|
|
104
|
+
useCustomerWalletBalances as u
|
|
105
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solvimon/solvimon-web",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
4
|
"description": "Solvimon's Front-end SDK provides you with the building blocks to create a billing self serve experience",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -65,6 +65,11 @@
|
|
|
65
65
|
"import": "./dist/screens/CustomerOverview/CustomerOverview.es.js",
|
|
66
66
|
"require": "./dist/screens/CustomerOverview/CustomerOverview.cjs.js"
|
|
67
67
|
},
|
|
68
|
+
"./screens/upgrade-subscription": {
|
|
69
|
+
"types": "./dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts",
|
|
70
|
+
"import": "./dist/screens/UpgradeSubscription/UpgradeSubscription.es.js",
|
|
71
|
+
"require": "./dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js"
|
|
72
|
+
},
|
|
68
73
|
"./components/subscriptions-list": {
|
|
69
74
|
"types": "./dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts",
|
|
70
75
|
"import": "./dist/components/SubscriptionsList/SubscriptionsList.es.js",
|
|
@@ -75,6 +80,11 @@
|
|
|
75
80
|
"import": "./dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js",
|
|
76
81
|
"require": "./dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js"
|
|
77
82
|
},
|
|
83
|
+
"./components/wallet-balances": {
|
|
84
|
+
"types": "./dist/components/WalletBalances/WalletBalances.ce.d.ts",
|
|
85
|
+
"import": "./dist/components/WalletBalances/WalletBalances.es.js",
|
|
86
|
+
"require": "./dist/components/WalletBalances/WalletBalances.cjs.js"
|
|
87
|
+
},
|
|
78
88
|
"./components/billing-information": {
|
|
79
89
|
"types": "./dist/components/BillingInformation/BillingInformation.ce.d.ts",
|
|
80
90
|
"import": "./dist/components/BillingInformation/BillingInformation.es.js",
|
|
@@ -131,12 +141,11 @@
|
|
|
131
141
|
"@formatjs/cli": "^6.6.1",
|
|
132
142
|
"@playwright/test": "^1.57.0",
|
|
133
143
|
"@rushstack/eslint-patch": "^1.2.0",
|
|
134
|
-
"@solvimon/eslint-config": "^1.2.0",
|
|
135
|
-
"@solvimon/tailwind-config": "^1.0.0",
|
|
136
144
|
"@solvimon/solvimon-types": "^1.0.0",
|
|
137
145
|
"@solvimon/solvimon-ui": "^1.0.0",
|
|
138
146
|
"@tsconfig/node22": "^22.0.0",
|
|
139
147
|
"@types/jsdom": "^21.1.7",
|
|
148
|
+
"@types/lodash-es": "^4.17.12",
|
|
140
149
|
"@types/node": "^22.10.2",
|
|
141
150
|
"@typescript-eslint/parser": "^8.46.2",
|
|
142
151
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
@@ -150,6 +159,7 @@
|
|
|
150
159
|
"autoprefixer": "^10.4.20",
|
|
151
160
|
"eslint": "^9.37.0",
|
|
152
161
|
"eslint-import-resolver-typescript": "^3.6.0",
|
|
162
|
+
"eslint-plugin-formatjs": "^6.4.7",
|
|
153
163
|
"eslint-plugin-import-x": "^4.16.1",
|
|
154
164
|
"eslint-plugin-no-relative-import-paths": "^1.5.2",
|
|
155
165
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
@@ -158,7 +168,10 @@
|
|
|
158
168
|
"jsdom": "^26.0.0",
|
|
159
169
|
"npm-run-all2": "^7.0.2",
|
|
160
170
|
"postcss": "^8.5.1",
|
|
171
|
+
"prettier": "^3.8.3",
|
|
172
|
+
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
161
173
|
"tailwindcss": "^3.4.17",
|
|
174
|
+
"terser": "^5.46.2",
|
|
162
175
|
"tsx": "^4.19.3",
|
|
163
176
|
"typescript": "~5.6.3",
|
|
164
177
|
"vite": "^6.4.2",
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { defineComponent, renderSlot, unref, openBlock, createBlock, withCtx, createVNode, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
|
|
2
|
-
import { _ as _sfc_main$3 } from "./BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs";
|
|
3
|
-
import { u as useCustomer } from "./useCustomer-BRY0tuBH.mjs";
|
|
4
|
-
import { o as _sfc_main$2, p as defineCustomElement, n as getComponentName } from "./component-BkmcE85U.mjs";
|
|
5
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6
|
-
__name: "BillingInformation.entry.view",
|
|
7
|
-
props: {
|
|
8
|
-
environment: { type: String },
|
|
9
|
-
locale: { type: String },
|
|
10
|
-
dateLocale: { type: String },
|
|
11
|
-
messages: { type: Object },
|
|
12
|
-
showTimezones: { type: Boolean },
|
|
13
|
-
primaryColor: { type: String },
|
|
14
|
-
secondaryColor: { type: String },
|
|
15
|
-
isShadowRoot: { type: Boolean },
|
|
16
|
-
experimentalFeatures: { type: Array },
|
|
17
|
-
logLevel: { type: String },
|
|
18
|
-
onLog: { type: Function },
|
|
19
|
-
allowedPortalTypes: { type: Array },
|
|
20
|
-
portalObject: { type: Object },
|
|
21
|
-
customElementName: { type: String },
|
|
22
|
-
branding: { type: Object },
|
|
23
|
-
configuration: { type: Object }
|
|
24
|
-
},
|
|
25
|
-
setup(__props) {
|
|
26
|
-
const props = __props;
|
|
27
|
-
const customerId = props.portalObject.customer_id;
|
|
28
|
-
const customer = useCustomer({ customerId });
|
|
29
|
-
return (_ctx, _cache) => {
|
|
30
|
-
return renderSlot(_ctx.$slots, "default", { customer: unref(customer) });
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
35
|
-
__name: "BillingInformation.entry",
|
|
36
|
-
props: {
|
|
37
|
-
environment: { type: String },
|
|
38
|
-
locale: { type: String },
|
|
39
|
-
dateLocale: { type: String },
|
|
40
|
-
messages: { type: Object },
|
|
41
|
-
showTimezones: { type: Boolean },
|
|
42
|
-
primaryColor: { type: String },
|
|
43
|
-
secondaryColor: { type: String },
|
|
44
|
-
isShadowRoot: { type: Boolean },
|
|
45
|
-
experimentalFeatures: { type: Array },
|
|
46
|
-
logLevel: { type: String },
|
|
47
|
-
onLog: { type: Function },
|
|
48
|
-
allowedPortalTypes: { type: Array },
|
|
49
|
-
portalObject: { type: Object },
|
|
50
|
-
customElementName: { type: String },
|
|
51
|
-
branding: { type: Object },
|
|
52
|
-
configuration: { type: Object }
|
|
53
|
-
},
|
|
54
|
-
setup(__props) {
|
|
55
|
-
return (_ctx, _cache) => {
|
|
56
|
-
var _a, _b, _c, _d;
|
|
57
|
-
return openBlock(), createBlock(unref(_sfc_main$2), {
|
|
58
|
-
"custom-element-name": unref(COMPONENT_NAME),
|
|
59
|
-
environment: __props.environment,
|
|
60
|
-
locale: __props.locale,
|
|
61
|
-
"portal-object": __props.portalObject,
|
|
62
|
-
"allowed-portal-types": ["CUSTOMER"],
|
|
63
|
-
"primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
|
|
64
|
-
"secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
|
|
65
|
-
"experimental-features": __props.experimentalFeatures,
|
|
66
|
-
"log-level": __props.logLevel,
|
|
67
|
-
"on-log": __props.onLog,
|
|
68
|
-
onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
|
|
69
|
-
}, {
|
|
70
|
-
default: withCtx(() => [
|
|
71
|
-
createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
|
|
72
|
-
default: withCtx(({ customer }) => [
|
|
73
|
-
customer.customer.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
74
|
-
key: 0,
|
|
75
|
-
"is-loading": customer.get.isPending.value,
|
|
76
|
-
customer: customer.customer.value
|
|
77
|
-
}, null, 8, ["is-loading", "customer"])) : createCommentVNode("", true)
|
|
78
|
-
]),
|
|
79
|
-
_: 1
|
|
80
|
-
}, 16)
|
|
81
|
-
]),
|
|
82
|
-
_: 1
|
|
83
|
-
}, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log"]);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
const SolvimonBillingInformation = defineCustomElement(_sfc_main);
|
|
88
|
-
const COMPONENT_NAME = getComponentName("billing-information");
|
|
89
|
-
const defineSolvimonBillingInformation = () => {
|
|
90
|
-
if (!customElements.get(COMPONENT_NAME)) {
|
|
91
|
-
customElements.define(COMPONENT_NAME, SolvimonBillingInformation);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
export {
|
|
95
|
-
COMPONENT_NAME as C,
|
|
96
|
-
SolvimonBillingInformation as S,
|
|
97
|
-
_sfc_main as _,
|
|
98
|
-
defineSolvimonBillingInformation as d
|
|
99
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("vue"),o=require("./BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js"),t=require("./useCustomer-Dp8sGHI0.js"),n=require("./component-Df5eNqYX.js"),r=e.defineComponent({__name:"BillingInformation.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object},configuration:{type:Object}},setup(o){const n=o.portalObject.customer_id,r=t.useCustomer({customerId:n});return(o,t)=>e.renderSlot(o.$slots,"default",{customer:e.unref(r)})}}),l=e.defineComponent({__name:"BillingInformation.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object},configuration:{type:Object}},setup:t=>(l,i)=>{var p,s,m,c;return e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),{"custom-element-name":e.unref(a),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(p=t.branding)?void 0:p.colors)?void 0:s.primary,"secondary-color":null==(c=null==(m=t.branding)?void 0:m.colors)?void 0:c.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,onError:i[0]||(i[0]=e=>l.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(r,e.normalizeProps(e.guardReactiveProps(l.$props)),{default:e.withCtx(({customer:t})=>[t.customer.value?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,"is-loading":t.get.isPending.value,customer:t.customer.value},null,8,["is-loading","customer"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),i=n.defineCustomElement(l),a=n.getComponentName("billing-information");exports.COMPONENT_NAME=a,exports.SolvimonBillingInformation=i,exports._sfc_main=l,exports.defineSolvimonBillingInformation=()=>{customElements.get(a)||customElements.define(a,i)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./component-Df5eNqYX.js"),a=require("./index-DRdBmZ2-.js"),o=require("./cloneDeep-Hs8Pp07F.js"),r=require("./useCustomer-Dp8sGHI0.js"),l={type:"INDIVIDUAL",email:"",country:"",addressLine1:"",postalCode:"",city:"",state:""};function n({initialState:r={},onSubmit:n}){const{form:s,validation:u,changes:c,hasChanges:m,updateInitialState:p,initialState:f}=(({initialState:a,validationRules:r={},nullifyEmptyValues:l=!1,mode:n="shallow"})=>{const i=e.ref(o.cloneDeep(a)),d=e.ref(o.cloneDeep(a)),s=t.useValidation(r,d),u=e.computed(()=>t.objectDiff({from:i.value,to:d.value,mode:n,nullifyEmptyValues:l})),c=e.computed(()=>Object.entries(u.value).length>0);return{form:d,validation:s,changes:u,hasChanges:c,reset:()=>{d.value=o.cloneDeep(a),s.value.$reset()},updateInitialState:e=>{d.value=o.cloneDeep(e),i.value=o.cloneDeep(e)},initialState:i}})({initialState:{...l,...r},validationRules:{email:{required:a.required,email:a.email}},nullifyEmptyValues:!0,mode:"deep"});return{form:s,isOrganization:t.isOrganization,validation:u,changes:c,hasChanges:m,updateInitialState:e=>{p(i(e))},submit:(e,t=s.value)=>n({customerId:e,payload:d(t)}),initialState:f}}const i=e=>{var a,o;if(t.isIndividual(e)){const t=e.individual.residential_address;return{type:"INDIVIDUAL",email:e.email??"",country:(null==t?void 0:t.country)??"",addressLine1:(null==t?void 0:t.line1)??"",addressLine2:(null==t?void 0:t.line2)??"",postalCode:(null==t?void 0:t.postal_code)??"",city:(null==t?void 0:t.city)??"",state:(null==t?void 0:t.state)??"",firstName:(null==(a=e.individual.name)?void 0:a.first_name)??"",lastName:(null==(o=e.individual.name)?void 0:o.last_name)??""}}const r=e.organization.registered_address;return{type:"ORGANIZATION",email:e.email??"",country:(null==r?void 0:r.country)??"",addressLine1:(null==r?void 0:r.line1)??"",addressLine2:(null==r?void 0:r.line2)??"",postalCode:(null==r?void 0:r.postal_code)??"",city:(null==r?void 0:r.city)??"",state:(null==r?void 0:r.state)??"",companyLegalName:e.organization.legal_name??"",companyVatNumber:e.organization.tax_id??""}},d=e=>"ORGANIZATION"===e.type?{type:"ORGANIZATION",email:e.email,organization:{legal_name:e.companyLegalName??"",tax_id:e.companyVatNumber??"",registered_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}}:{type:"INDIVIDUAL",email:e.email,individual:{name:{first_name:e.firstName??"",last_name:e.lastName??""},residential_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}},s={class:"grid grid-cols-1 gap-4"},u={class:"flex grow flex-col"},c={class:"mt-6 flex items-center justify-between gap-4"},m={class:"flex flex-col gap-2"},p={key:0,class:"grid grid-cols-2 gap-2"},f={class:"grid grid-cols-3 gap-2"},h=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},isLoading:{type:Boolean},apiError:{type:null},updateCustomer:{type:Function}},setup(a){const o=a,{$t:r}=t.useIntl(),{validation:l,form:i,updateInitialState:d,submit:h,hasChanges:g}=n({onSubmit:({customerId:e,payload:t})=>o.updateCustomer({customerId:e,payload:t})}),y=e.ref(!1),_=e.computed(()=>"ORGANIZATION"===i.value.type),v=e.computed(()=>!y.value),b=e.computed({get:()=>_.value,set:e=>i.value.type=e?"ORGANIZATION":"INDIVIDUAL"}),V=async()=>{var e;await l.value.$validate();!l.value.$invalid&&(null==(e=o.customer)?void 0:e.id)&&await h(o.customer.id)};return e.watch(()=>o.customer,e=>{e&&!y.value&&(d(e),y.value=!0)},{immediate:!0}),(o,n)=>{var d,h,y,N,k,C,E,S,I,L,x,T,B;return e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(V,["prevent"])},[e.createVNode(e.unref(t._sfc_main$2),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})),1)]),_:1}),e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).email,"onUpdate:modelValue":n[0]||(n[0]=t=>e.unref(i).email=t),required:"",type:"email",label:e.unref(r)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"}),error:(null==(d=e.unref(l).email)?void 0:d.$errors)||(null==(h=a.apiError)?void 0:h.email)},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$1$),{"single-model-value":e.unref(i).country,"onUpdate:singleModelValue":n[1]||(n[1]=t=>e.unref(i).country=t),label:e.unref(r)({defaultMessage:"Country",id:"checkout.country.label",description:"The country of the customer in the checkout form"}),error:null==(y=a.apiError)?void 0:y.country},null,8,["single-model-value","label","error"]),v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$20),{key:0,modelValue:b.value,"onUpdate:modelValue":n[2]||(n[2]=e=>b.value=e),"label-position":"before"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",u,[e.createVNode(e.unref(t._sfc_main$2),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).companyVatNumber,"onUpdate:modelValue":n[3]||(n[3]=t=>e.unref(i).companyVatNumber=t),name:"vat_number",label:e.unref(r)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:null==(N=a.apiError)?void 0:N.vat_number},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).companyLegalName,"onUpdate:modelValue":n[4]||(n[4]=t=>e.unref(i).companyLegalName=t),required:"",name:"legal_name",label:e.unref(r)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"}),error:null==(k=a.apiError)?void 0:k.legal_name},null,8,["modelValue","label","placeholder","error"])],64)):e.createCommentVNode("",!0)]),e.createElementVNode("div",c,[e.createVNode(e.unref(t._sfc_main$2),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Billing details",id:"checkout.billing_information_block.title",description:"The title of the billing information block in the checkout form"})),1)]),_:1})]),e.createElementVNode("div",m,[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",p,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).firstName,"onUpdate:modelValue":n[5]||(n[5]=t=>e.unref(i).firstName=t),name:"first_name",label:e.unref(r)({defaultMessage:"First name",id:"checkout.first_name.label",description:"The first name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"First name...",id:"checkout.first_name.placeholder",description:"The first name of the customer in the checkout form"}),error:null==(C=a.apiError)?void 0:C.first_name},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).lastName,"onUpdate:modelValue":n[6]||(n[6]=t=>e.unref(i).lastName=t),name:"last_name",label:e.unref(r)({defaultMessage:"Last name",id:"checkout.last_name.label",description:"The last name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Last name...",id:"checkout.last_name.placeholder",description:"The last name of the customer in the checkout form"}),error:null==(E=a.apiError)?void 0:E.last_name},null,8,["modelValue","label","placeholder","error"])])),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).addressLine1,"onUpdate:modelValue":n[7]||(n[7]=t=>e.unref(i).addressLine1=t),name:"address_line_1",label:e.unref(r)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"}),error:null==(S=a.apiError)?void 0:S.address_line_1},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).addressLine2,"onUpdate:modelValue":n[8]||(n[8]=t=>e.unref(i).addressLine2=t),name:"address_line_2",placeholder:e.unref(r)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"}),error:null==(I=a.apiError)?void 0:I.address_line_2},null,8,["modelValue","placeholder","error"]),e.createElementVNode("div",f,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).postalCode,"onUpdate:modelValue":n[9]||(n[9]=t=>e.unref(i).postalCode=t),name:"postal_code",placeholder:e.unref(r)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"}),error:null==(L=a.apiError)?void 0:L.postal_code},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).city,"onUpdate:modelValue":n[10]||(n[10]=t=>e.unref(i).city=t),name:"city",placeholder:e.unref(r)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"}),error:null==(x=a.apiError)?void 0:x.city},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).state,"onUpdate:modelValue":n[11]||(n[11]=t=>e.unref(i).state=t),name:"state",placeholder:e.unref(r)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"}),error:null==(T=a.apiError)?void 0:T.state},null,8,["modelValue","placeholder","error"])])]),(null==(B=a.apiError)?void 0:B._generic)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),{key:0,class:"mt-4",title:a.apiError._generic},null,8,["title"])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$2H),{type:"submit",color:"primary",disabled:!e.unref(g),loading:a.isLoading,class:"mt-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Save changes",id:"billing_information_form.submit_button.label",description:"The label for the submit button of the billing information form"})),1)]),_:1},8,["disabled","loading"])],32)}}}),g=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},apiError:{type:null},updateCustomer:{type:Function},isLoading:{type:Boolean}},setup:t=>(a,o)=>(e.openBlock(),e.createBlock(h,{customer:t.customer,"update-customer":t.updateCustomer,"is-loading":t.isLoading,"api-error":t.apiError},null,8,["customer","update-customer","is-loading","api-error"]))}),y=e.defineComponent({__name:"BillingInformationForm.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object}},setup(a){const o=a.portalObject.customer_id,{customer:l,get:n,update:i}=r.useCustomer({customerId:o});return e.onMounted(async()=>{await n.execute()}),(a,o)=>e.renderSlot(a.$slots,"default",{customer:e.unref(l),isLoading:e.unref(n).isPending.value||e.unref(i).isPending.value,updateCustomer:e.unref(i),apiError:e.unref(t.getApiError)(e.unref(i).error)})}}),_=e.defineComponent({__name:"BillingInformationForm.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object}},emits:["error"],setup:a=>(o,r)=>{var l,n,i,d;return e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"custom-element-name":e.unref(b),environment:a.environment,locale:a.locale,"portal-object":a.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(n=null==(l=a.branding)?void 0:l.colors)?void 0:n.primary,"secondary-color":null==(d=null==(i=a.branding)?void 0:i.colors)?void 0:d.secondary,"experimental-features":a.experimentalFeatures,"log-level":a.logLevel,"on-log":a.onLog,onError:r[0]||(r[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({customer:t,updateCustomer:a,isLoading:o,apiError:r})=>[t?(e.openBlock(),e.createBlock(g,{key:0,customer:t,"is-loading":o,"update-customer":({payload:e})=>a.execute(e),"api-error":r},null,8,["customer","is-loading","update-customer","api-error"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),v=t.defineCustomElement(_),b=t.getComponentName("billing-information-form");exports.COMPONENT_NAME=b,exports.SolvimonBillingInformationForm=v,exports._sfc_main=_,exports.defineSolvimonBillingInformationForm=()=>{customElements.get(b)||customElements.define(b,v)};
|