@mindbill/react 0.28.0 → 0.28.1

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 CHANGED
@@ -20,6 +20,11 @@ import { ConnectedBillLifecycle } from "@mindbill/react";
20
20
  />
21
21
  ```
22
22
 
23
+ Sandbox and live responses use the same component contract. Simulation controls
24
+ are hidden by default, including when the connected organization is a sandbox.
25
+ Only a dedicated developer playground should opt in with
26
+ `sandboxControls={true}`; production applications should omit the prop.
27
+
23
28
  ## Appearance
24
29
 
25
30
  Choose a complete preset, then override only the tokens your design system owns. The preset applies to review, payer search, attachments, submission, status, EOR, payment, denial, resubmission, and close states.
package/dist/index.d.ts CHANGED
@@ -844,13 +844,19 @@ type UseBillLifecycleResult = {
844
844
  declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
845
845
  type ConnectedBillLifecycleProps = UseBillLifecycleOptions & {
846
846
  appearance?: MindBillReactAppearance;
847
+ /**
848
+ * Exposes payer-response simulation controls for an explicit sandbox
849
+ * playground. Sandbox responses remain indistinguishable from live
850
+ * lifecycle responses to ordinary host applications.
851
+ */
852
+ sandboxControls?: boolean;
847
853
  className?: string;
848
854
  style?: CSSProperties;
849
855
  loadingFallback?: ReactNode;
850
856
  errorFallback?: (error: Error, retry: () => Promise<void>) => ReactNode;
851
857
  onChanged?: (data: BillLifecycleData) => void;
852
858
  };
853
- declare function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }: ConnectedBillLifecycleProps): ReactElement;
859
+ declare function ConnectedBillLifecycle({ appearance, sandboxControls, className, style, loadingFallback, errorFallback, onChanged, ...options }: ConnectedBillLifecycleProps): ReactElement;
854
860
 
855
861
  type MindBillWidgetProps = {
856
862
  sessionToken: string;
package/dist/index.js CHANGED
@@ -3566,7 +3566,10 @@ function sandboxScenarios(state) {
3566
3566
  ];
3567
3567
  return [];
3568
3568
  }
3569
- function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
3569
+ function shouldShowSandboxControls(environment, enabled = false) {
3570
+ return enabled && environment === "sandbox";
3571
+ }
3572
+ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
3570
3573
  const lifecycle = useBillLifecycle(options);
3571
3574
  const { data } = lifecycle;
3572
3575
  const [tab, setTab] = useState6("details");
@@ -3615,7 +3618,8 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
3615
3618
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
3616
3619
  const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
3617
3620
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
3618
- const simulations = data.environment === "sandbox" ? sandboxScenarios(data.lifecycle.state) : [];
3621
+ const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
3622
+ const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
3619
3623
  return /* @__PURE__ */ jsxs7("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
3620
3624
  /* @__PURE__ */ jsx7("style", { children: CONNECTED_LIFECYCLE_STYLES }),
3621
3625
  /* @__PURE__ */ jsx7(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
@@ -3639,7 +3643,7 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
3639
3643
  ] }),
3640
3644
  tab === "details" ? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
3641
3645
  data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx7(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
3642
- data.environment === "sandbox" ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
3646
+ showSandboxControls ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
3643
3647
  /* @__PURE__ */ jsxs7("div", { children: [
3644
3648
  /* @__PURE__ */ jsx7("span", { children: "Sandbox demo controls" }),
3645
3649
  /* @__PURE__ */ jsx7("h3", { children: "Simulate the next payer response" }),