@burdenoff/microfe-billing 2026.1005.3 → 2026.1005.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.js +82 -0
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.js.map +1 -0
- package/dist/billing/modules/checkout/components/index.js +1 -0
- package/dist/billing/modules/checkout/index.js +1 -0
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +498 -485
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +133 -92
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
- package/dist/billing/modules/plans/utils/planSelector.js +16 -0
- package/dist/billing/modules/plans/utils/planSelector.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useBilling as e } from "../../../providers/BillingProvider.js";
|
|
2
|
+
import { nativeOpenUrl as t } from "../../../../utils/nativeBridge.js";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
import { ArrowRight as r, ExternalLink as i, Globe as a, ShoppingBag as o } from "lucide-react";
|
|
5
|
+
import { useAppShell as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/billing/modules/checkout/components/WebCheckoutRedirectView.tsx
|
|
8
|
+
function u(e, t) {
|
|
9
|
+
return `${t.toLowerCase().includes("alpha") ? "alphaapp" : "app"}.${{
|
|
10
|
+
botlit: "botlit.ai",
|
|
11
|
+
healthybowl: "gethealthybowl.com",
|
|
12
|
+
workspaces: "burdenoff.com"
|
|
13
|
+
}[e] ?? `${e}.com`}`;
|
|
14
|
+
}
|
|
15
|
+
function d(e) {
|
|
16
|
+
switch (e) {
|
|
17
|
+
case "CREDITS": return {
|
|
18
|
+
title: "Continue on the web to buy credits",
|
|
19
|
+
body: "Credit purchases use flexible pricing, so you can choose the exact amount you need on the FluidGrids web app.",
|
|
20
|
+
icon: a
|
|
21
|
+
};
|
|
22
|
+
case "ORDER": return {
|
|
23
|
+
title: "Continue on the web to place your order",
|
|
24
|
+
body: "Store orders use web checkout for shipping, tax, location-based pricing, and the available payment methods.",
|
|
25
|
+
icon: o
|
|
26
|
+
};
|
|
27
|
+
default: return {
|
|
28
|
+
title: "Continue on the web to complete your purchase",
|
|
29
|
+
body: "This purchase uses the existing secure web checkout.",
|
|
30
|
+
icon: i
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var f = ({ purchaseType: i, path: a, billingAccountId: o, onBack: f }) => {
|
|
35
|
+
let { apiGatewayUrl: p } = e(), { productSlug: m } = s(), h = n(() => d(i), [i]), g = h.icon, _ = n(() => {
|
|
36
|
+
let e = u(m ?? "fluidgrids", p ?? ""), t = new URL(`https://${e}${a.startsWith("/") ? a : `/${a}`}`);
|
|
37
|
+
return o && t.searchParams.set("billingAccountId", o), t.toString();
|
|
38
|
+
}, [
|
|
39
|
+
p,
|
|
40
|
+
o,
|
|
41
|
+
a,
|
|
42
|
+
m
|
|
43
|
+
]);
|
|
44
|
+
return /* @__PURE__ */ l("div", {
|
|
45
|
+
className: "mx-auto flex max-w-lg flex-col items-center gap-6 px-6 py-16 text-center",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ c("div", {
|
|
48
|
+
className: "flex size-16 items-center justify-center rounded-full bg-[--color-primary-subtle]",
|
|
49
|
+
children: /* @__PURE__ */ c(g, { className: "size-8 text-[--color-primary]" })
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h1", {
|
|
52
|
+
className: "text-xl font-semibold text-[--color-text-primary]",
|
|
53
|
+
children: h.title
|
|
54
|
+
}), /* @__PURE__ */ c("p", {
|
|
55
|
+
className: "mt-3 text-sm leading-relaxed text-[--color-text-secondary]",
|
|
56
|
+
children: h.body
|
|
57
|
+
})] }),
|
|
58
|
+
/* @__PURE__ */ c("div", {
|
|
59
|
+
className: "w-full rounded-xl border border-[--color-border] bg-[--color-surface] px-4 py-3 text-left text-xs leading-relaxed text-[--color-text-secondary]",
|
|
60
|
+
children: "The web checkout will open securely in your browser. Your account and billing details will remain associated with this purchase."
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ l("div", {
|
|
63
|
+
className: "flex w-full flex-col gap-3 sm:flex-row sm:justify-center",
|
|
64
|
+
children: [/* @__PURE__ */ l("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
onClick: () => void t(_),
|
|
67
|
+
className: "inline-flex items-center justify-center gap-2 rounded-xl bg-[--color-primary] px-6 py-3 text-sm font-semibold text-[--color-primary-foreground]",
|
|
68
|
+
children: ["Open web checkout", /* @__PURE__ */ c(r, { className: "size-4" })]
|
|
69
|
+
}), /* @__PURE__ */ c("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: f,
|
|
72
|
+
className: "rounded-xl border border-[--color-border] px-6 py-3 text-sm font-medium text-[--color-text-primary]",
|
|
73
|
+
children: "Go back"
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { f as WebCheckoutRedirectView };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=WebCheckoutRedirectView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebCheckoutRedirectView.js","names":[],"sources":["../../../../../src/billing/modules/checkout/components/WebCheckoutRedirectView.tsx"],"sourcesContent":["/**\n * Native-app handoff for purchases that require runtime pricing or a web order\n * flow. Native StoreKit/Play Billing is reserved for fixed-price plans; credits,\n * add-ons, and store orders continue through the existing web checkout.\n */\nimport { type FC, useMemo } from 'react';\nimport { ArrowRight, ExternalLink, Globe, ShoppingBag } from 'lucide-react';\nimport { nativeOpenUrl } from '../../../../utils/nativeBridge';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { useAppShell } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { PurchaseType } from '../types';\n\ninterface WebCheckoutRedirectViewProps {\n purchaseType: PurchaseType;\n path: string;\n billingAccountId?: string;\n onBack: () => void;\n}\n\nfunction getProductHost(productSlug: string, apiGatewayUrl: string): string {\n const isAlpha = apiGatewayUrl.toLowerCase().includes('alpha');\n const prefix = isAlpha ? 'alphaapp' : 'app';\n const domainByProduct: Record<string, string> = {\n botlit: 'botlit.ai',\n healthybowl: 'gethealthybowl.com',\n workspaces: 'burdenoff.com',\n };\n const domain = domainByProduct[productSlug] ?? `${productSlug}.com`;\n return `${prefix}.${domain}`;\n}\n\nfunction copyForPurchaseType(purchaseType: PurchaseType): {\n title: string;\n body: string;\n icon: FC<{ className?: string }>;\n} {\n switch (purchaseType) {\n case 'CREDITS':\n return {\n title: 'Continue on the web to buy credits',\n body: 'Credit purchases use flexible pricing, so you can choose the exact amount you need on the FluidGrids web app.',\n icon: Globe,\n };\n case 'ORDER':\n return {\n title: 'Continue on the web to place your order',\n body: 'Store orders use web checkout for shipping, tax, location-based pricing, and the available payment methods.',\n icon: ShoppingBag,\n };\n default:\n return {\n title: 'Continue on the web to complete your purchase',\n body: 'This purchase uses the existing secure web checkout.',\n icon: ExternalLink,\n };\n }\n}\n\nexport const WebCheckoutRedirectView: FC<WebCheckoutRedirectViewProps> = ({\n purchaseType,\n path,\n billingAccountId,\n onBack,\n}) => {\n const { apiGatewayUrl } = useBilling();\n const { productSlug } = useAppShell();\n const copy = useMemo(() => copyForPurchaseType(purchaseType), [purchaseType]);\n const Icon = copy.icon;\n const webCheckoutUrl = useMemo(() => {\n const host = getProductHost(productSlug ?? 'fluidgrids', apiGatewayUrl ?? '');\n const url = new URL(`https://${host}${path.startsWith('/') ? path : `/${path}`}`);\n if (billingAccountId) url.searchParams.set('billingAccountId', billingAccountId);\n return url.toString();\n }, [apiGatewayUrl, billingAccountId, path, productSlug]);\n\n return (\n <div className=\"mx-auto flex max-w-lg flex-col items-center gap-6 px-6 py-16 text-center\">\n <div className=\"flex size-16 items-center justify-center rounded-full bg-[--color-primary-subtle]\">\n <Icon className=\"size-8 text-[--color-primary]\" />\n </div>\n <div>\n <h1 className=\"text-xl font-semibold text-[--color-text-primary]\">{copy.title}</h1>\n <p className=\"mt-3 text-sm leading-relaxed text-[--color-text-secondary]\">{copy.body}</p>\n </div>\n <div className=\"w-full rounded-xl border border-[--color-border] bg-[--color-surface] px-4 py-3 text-left text-xs leading-relaxed text-[--color-text-secondary]\">\n The web checkout will open securely in your browser. Your account and billing details will\n remain associated with this purchase.\n </div>\n <div className=\"flex w-full flex-col gap-3 sm:flex-row sm:justify-center\">\n <button\n type=\"button\"\n onClick={() => void nativeOpenUrl(webCheckoutUrl)}\n className=\"inline-flex items-center justify-center gap-2 rounded-xl bg-[--color-primary] px-6 py-3 text-sm font-semibold text-[--color-primary-foreground]\"\n >\n Open web checkout\n <ArrowRight className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={onBack}\n className=\"rounded-xl border border-[--color-border] px-6 py-3 text-sm font-medium text-[--color-text-primary]\"\n >\n Go back\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAmBA,SAAS,EAAe,GAAqB,GAA+B;CAS1E,OAAO,GARS,EAAc,YAAY,EAAE,SAAS,OACtC,IAAU,aAAa,MAOrB,GADF;EAJb,QAAQ;EACR,aAAa;EACb,YAAY;CAEC,EAAgB,MAAgB,GAAG,EAAY;AAEhE;AAEA,SAAS,EAAoB,GAI3B;CACA,QAAQ,GAAR;EACE,KAAK,WACH,OAAO;GACL,OAAO;GACP,MAAM;GACN,MAAM;EACR;EACF,KAAK,SACH,OAAO;GACL,OAAO;GACP,MAAM;GACN,MAAM;EACR;EACF,SACE,OAAO;GACL,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACJ;AACF;AAEA,IAAa,KAA6D,EACxE,iBACA,SACA,qBACA,gBACI;CACJ,IAAM,EAAE,qBAAkB,EAAW,GAC/B,EAAE,mBAAgB,EAAY,GAC9B,IAAO,QAAc,EAAoB,CAAY,GAAG,CAAC,CAAY,CAAC,GACtE,IAAO,EAAK,MACZ,IAAiB,QAAc;EACnC,IAAM,IAAO,EAAe,KAAe,cAAc,KAAiB,EAAE,GACtE,IAAM,IAAI,IAAI,WAAW,IAAO,EAAK,WAAW,GAAG,IAAI,IAAO,IAAI,KAAQ;EAEhF,OADI,KAAkB,EAAI,aAAa,IAAI,oBAAoB,CAAgB,GACxE,EAAI,SAAS;CACtB,GAAG;EAAC;EAAe;EAAkB;EAAM;CAAW,CAAC;CAEvD,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD,EAAM,WAAU,gCAAiC,CAAA;GAC9C,CAAA;GACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cAAqD,EAAK;GAAU,CAAA,GAClF,kBAAC,KAAD;IAAG,WAAU;cAA8D,EAAK;GAAQ,CAAA,CACrF,EAAA,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;cAAkJ;GAG5J,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,KAAK,EAAc,CAAc;KAChD,WAAU;eAHZ,CAIC,qBAEC,kBAAC,GAAD,EAAY,WAAU,SAAU,CAAA,CAC1B;QACR,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;eACX;IAEO,CAAA,CACL;;EACF;;AAET"}
|
|
@@ -4,6 +4,7 @@ import "./hooks/usePaymentProviders.js";
|
|
|
4
4
|
import "./hooks/usePaymentStatusPolling.js";
|
|
5
5
|
import "./hooks/index.js";
|
|
6
6
|
import "./components/NativeCheckoutView.js";
|
|
7
|
+
import "./components/WebCheckoutRedirectView.js";
|
|
7
8
|
import "./components/BillingAccountSelector.js";
|
|
8
9
|
import "./components/OrderSummary.js";
|
|
9
10
|
import "./components/PromoCodeInput.js";
|