import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { SalesSdkProvider } from "../context/SalesSdkProvider.js";
import { SalesSdkDemoTabShell } from "./components/SalesSdkDemoTabShell.js";
import { FIXTURE_DETAIL, FIXTURE_EDIT } from "./fixtures.js";
import { DemoTabDetail } from "./components/DemoTabDetail.js";
import { DemoTabCreate } from "./components/DemoTabCreate.js";
import { DemoTabEdit } from "./components/DemoTabEdit.js";
import React from "react";
import { Tabs } from "antd";
import "./index.less";
//#region src/plus/salesSdk/demo/index.tsx
const DEFAULT_OS_KEY = "sales-sdk-demo";
/**
* SalesSdkDemo：salesSdk 内部使用的真实 SDK 示例页面。
*
* 不 mock 数据，必须运行在可访问 `appHelper.utils.pisellos` 的业务环境中。
*
* 拆成「详情展示 / 新建 / 编辑」三个 Tab：
*  - 详情 Tab：只读，演示 sales.loadDetail 流程
*  - 新建 Tab：一键串行 createNew → 选客户 → 加车 → recalcSummary → submit
*  - 编辑 Tab：一键串行 loadDetail → 选客户 → 加车 → recalcSummary → submit
*
* 每个 Tab 各自包一层 SalesSdkProvider（osKey 后缀 `-detail / -create / -edit`，外部 osKey
* prop 作前缀），状态完全隔离；切换 Tab 时不活跃 Tab 通过 `destroyInactiveTabPane` 自动卸载，
* 避免同时挂三个 BookingTicket 实例。
*
* 三个 Provider 都关掉 autoBootstrap：业务接口需由用户显式点击「一键」触发，
* 避免「切到 Tab 就调真实接口」的副作用。
*/
function SalesSdkDemo({ osKey = DEFAULT_OS_KEY, orderId, businessCode, otherParams, rulesHooks, className }) {
	var _providerCommon$other;
	const rootClassName = ["sales-sdk-demo", className].filter(Boolean).join(" ");
	const baseOsKey = osKey || DEFAULT_OS_KEY;
	const providerCommon = {
		businessCode,
		otherParams,
		rulesHooks,
		autoBootstrap: false
	};
	if (!((_providerCommon$other = providerCommon.otherParams) === null || _providerCommon$other === void 0 ? void 0 : _providerCommon$other.platform)) providerCommon.otherParams = { platform: "shop" };
	return /* @__PURE__ */ React.createElement("div", { className: rootClassName }, /* @__PURE__ */ React.createElement(Tabs, {
		className: "sales-sdk-demo__tabs",
		defaultActiveKey: "create",
		destroyInactiveTabPane: true,
		items: [
			{
				key: "detail",
				label: "详情展示",
				children: /* @__PURE__ */ React.createElement(SalesSdkProvider, _objectSpread2({ osKey: `${baseOsKey}-detail` }, providerCommon), /* @__PURE__ */ React.createElement(DemoTabDetail, { initialOrderId: orderId !== null && orderId !== void 0 ? orderId : FIXTURE_DETAIL.orderId }))
			},
			{
				key: "create",
				label: "新建",
				children: /* @__PURE__ */ React.createElement(SalesSdkDemoTabShell, _objectSpread2({ osKey: `${baseOsKey}-create` }, providerCommon), /* @__PURE__ */ React.createElement(DemoTabCreate, null))
			},
			{
				key: "edit",
				label: "编辑",
				children: /* @__PURE__ */ React.createElement(SalesSdkDemoTabShell, _objectSpread2({ osKey: `${baseOsKey}-edit` }, providerCommon), /* @__PURE__ */ React.createElement(DemoTabEdit, { initialOrderId: orderId !== null && orderId !== void 0 ? orderId : FIXTURE_EDIT.orderId }))
			}
		]
	}));
}
//#endregion
export { SalesSdkDemo as default };
