const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_SalesSdkProvider = require("../context/SalesSdkProvider.js");
const require_SalesSdkDemoTabShell = require("./components/SalesSdkDemoTabShell.js");
const require_fixtures = require("./fixtures.js");
const require_DemoTabDetail = require("./components/DemoTabDetail.js");
const require_DemoTabCreate = require("./components/DemoTabCreate.js");
const require_DemoTabEdit = require("./components/DemoTabEdit.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
require("./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.default.createElement("div", { className: rootClassName }, /* @__PURE__ */ react.default.createElement(antd.Tabs, {
		className: "sales-sdk-demo__tabs",
		defaultActiveKey: "create",
		destroyInactiveTabPane: true,
		items: [
			{
				key: "detail",
				label: "详情展示",
				children: /* @__PURE__ */ react.default.createElement(require_SalesSdkProvider.SalesSdkProvider, require_objectSpread2._objectSpread2({ osKey: `${baseOsKey}-detail` }, providerCommon), /* @__PURE__ */ react.default.createElement(require_DemoTabDetail.DemoTabDetail, { initialOrderId: orderId !== null && orderId !== void 0 ? orderId : require_fixtures.FIXTURE_DETAIL.orderId }))
			},
			{
				key: "create",
				label: "新建",
				children: /* @__PURE__ */ react.default.createElement(require_SalesSdkDemoTabShell.SalesSdkDemoTabShell, require_objectSpread2._objectSpread2({ osKey: `${baseOsKey}-create` }, providerCommon), /* @__PURE__ */ react.default.createElement(require_DemoTabCreate.DemoTabCreate, null))
			},
			{
				key: "edit",
				label: "编辑",
				children: /* @__PURE__ */ react.default.createElement(require_SalesSdkDemoTabShell.SalesSdkDemoTabShell, require_objectSpread2._objectSpread2({ osKey: `${baseOsKey}-edit` }, providerCommon), /* @__PURE__ */ react.default.createElement(require_DemoTabEdit.DemoTabEdit, { initialOrderId: orderId !== null && orderId !== void 0 ? orderId : require_fixtures.FIXTURE_EDIT.orderId }))
			}
		]
	}));
}
//#endregion
exports.default = SalesSdkDemo;
