openxiangda 1.0.154 → 1.0.156
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/openxiangda-skills/SKILL.md +1 -0
- package/openxiangda-skills/references/component-guide.md +2 -0
- package/openxiangda-skills/references/pages/page-sdk.md +19 -0
- package/openxiangda-skills/references/troubleshooting.md +17 -5
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +1 -0
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +1 -0
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +2 -1
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +2 -1
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +846 -796
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +1 -1
- package/packages/sdk/dist/runtime/index.d.ts +1 -1
- package/packages/sdk/dist/runtime/index.mjs +232 -182
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +274 -224
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +10 -2
- package/packages/sdk/dist/runtime/react.d.ts +10 -2
- package/packages/sdk/dist/runtime/react.mjs +146 -96
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/AGENTS.md +1 -0
|
@@ -46,6 +46,7 @@ __export(react_exports, {
|
|
|
46
46
|
PublicAccessGate: () => PublicAccessGate,
|
|
47
47
|
RuntimeAuthGuard: () => RuntimeAuthGuard,
|
|
48
48
|
createAuthClient: () => createAuthClient,
|
|
49
|
+
createPageFormRuntimeApi: () => createPageFormRuntimeApi,
|
|
49
50
|
createPageSdk: () => createPageSdk,
|
|
50
51
|
createPublicAccessClient: () => createPublicAccessClient,
|
|
51
52
|
createReactPage: () => createReactPage,
|
|
@@ -66,6 +67,7 @@ __export(react_exports, {
|
|
|
66
67
|
useNavigation: () => useNavigation,
|
|
67
68
|
useOpenXiangda: () => useOpenXiangda,
|
|
68
69
|
usePageContext: () => usePageContext,
|
|
70
|
+
usePageFormRuntimeApi: () => usePageFormRuntimeApi,
|
|
69
71
|
usePageProps: () => usePageProps,
|
|
70
72
|
usePageRoute: () => usePageRoute,
|
|
71
73
|
usePageSdk: () => usePageSdk,
|
|
@@ -2699,9 +2701,8 @@ var usePageRoute = () => {
|
|
|
2699
2701
|
return usePageContext().route;
|
|
2700
2702
|
};
|
|
2701
2703
|
|
|
2702
|
-
// packages/sdk/src/runtime/react/
|
|
2703
|
-
var
|
|
2704
|
-
var import_antd5 = require("antd");
|
|
2704
|
+
// packages/sdk/src/runtime/react/formRuntime.ts
|
|
2705
|
+
var import_react7 = require("react");
|
|
2705
2706
|
|
|
2706
2707
|
// packages/sdk/src/components/core/imageCompression.ts
|
|
2707
2708
|
var DEFAULT_THUMB = {
|
|
@@ -3554,6 +3555,111 @@ function createFormRuntimeApi(config) {
|
|
|
3554
3555
|
return { ...defaults, ...overrides, request };
|
|
3555
3556
|
}
|
|
3556
3557
|
|
|
3558
|
+
// packages/sdk/src/runtime/react/formRuntime.ts
|
|
3559
|
+
var normalizeMethod2 = (method) => {
|
|
3560
|
+
const value = String(method || "get").toLowerCase();
|
|
3561
|
+
return ["get", "post", "put", "delete", "patch"].includes(value) ? value : "get";
|
|
3562
|
+
};
|
|
3563
|
+
var normalizeHeaders = (headers) => {
|
|
3564
|
+
if (!headers) return void 0;
|
|
3565
|
+
return Object.fromEntries(new Headers(headers).entries());
|
|
3566
|
+
};
|
|
3567
|
+
var toPageRequest = (config) => ({
|
|
3568
|
+
path: config.url,
|
|
3569
|
+
method: normalizeMethod2(config.method),
|
|
3570
|
+
query: config.params,
|
|
3571
|
+
body: config.data,
|
|
3572
|
+
headers: normalizeHeaders(config.headers)
|
|
3573
|
+
});
|
|
3574
|
+
var toRuntimeResponse = (response) => {
|
|
3575
|
+
if (response.raw && typeof response.raw === "object") {
|
|
3576
|
+
return response.raw;
|
|
3577
|
+
}
|
|
3578
|
+
return {
|
|
3579
|
+
code: Number(response.code) || 200,
|
|
3580
|
+
success: response.success,
|
|
3581
|
+
message: response.message,
|
|
3582
|
+
data: response.result,
|
|
3583
|
+
result: response.result
|
|
3584
|
+
};
|
|
3585
|
+
};
|
|
3586
|
+
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
3587
|
+
var FILE_URL_KEYS = [
|
|
3588
|
+
"url",
|
|
3589
|
+
"downloadUrl",
|
|
3590
|
+
"publicUrl",
|
|
3591
|
+
"relayUrl",
|
|
3592
|
+
"previewUrl",
|
|
3593
|
+
"metadataUrl",
|
|
3594
|
+
"officeTextPreviewUrl"
|
|
3595
|
+
];
|
|
3596
|
+
var resolveServicePrefix = (sdk) => {
|
|
3597
|
+
const value = sdk.context?.env?.servicePrefix;
|
|
3598
|
+
return typeof value === "string" && value.trim() ? value.trim().replace(/\/+$/, "") : "/service";
|
|
3599
|
+
};
|
|
3600
|
+
var normalizeServiceFileUrl = (value, servicePrefix) => {
|
|
3601
|
+
if (typeof value !== "string" || !value) return value;
|
|
3602
|
+
if (/^(https?:)?\/\//i.test(value) || /^(blob|data):/i.test(value)) return value;
|
|
3603
|
+
if (value === servicePrefix || value.startsWith(`${servicePrefix}/`)) return value;
|
|
3604
|
+
return value.startsWith("/file/") ? `${servicePrefix}${value}` : value;
|
|
3605
|
+
};
|
|
3606
|
+
var normalizeFileTicketResult2 = (payload, servicePrefix) => {
|
|
3607
|
+
if (typeof payload === "string") {
|
|
3608
|
+
return normalizeServiceFileUrl(payload, servicePrefix);
|
|
3609
|
+
}
|
|
3610
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return payload;
|
|
3611
|
+
const normalized = { ...payload };
|
|
3612
|
+
FILE_URL_KEYS.forEach((key) => {
|
|
3613
|
+
normalized[key] = normalizeServiceFileUrl(normalized[key], servicePrefix);
|
|
3614
|
+
});
|
|
3615
|
+
return normalized;
|
|
3616
|
+
};
|
|
3617
|
+
var createPageFormRuntimeApi = (sdk) => {
|
|
3618
|
+
const servicePrefix = resolveServicePrefix(sdk);
|
|
3619
|
+
const request = async (config) => {
|
|
3620
|
+
const options = toPageRequest(config);
|
|
3621
|
+
if (config.responseType === "blob") {
|
|
3622
|
+
const response = await sdk.transport.download(options);
|
|
3623
|
+
return response.blob;
|
|
3624
|
+
}
|
|
3625
|
+
return toRuntimeResponse(await sdk.transport.request(options));
|
|
3626
|
+
};
|
|
3627
|
+
return createFormRuntimeApi({
|
|
3628
|
+
baseUrl: servicePrefix,
|
|
3629
|
+
request,
|
|
3630
|
+
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => normalizeFileTicketResult2(
|
|
3631
|
+
unwrapPageResult(
|
|
3632
|
+
await sdk.createFileAccessTicket(
|
|
3633
|
+
bucketName,
|
|
3634
|
+
objectName,
|
|
3635
|
+
fileName,
|
|
3636
|
+
purpose,
|
|
3637
|
+
options
|
|
3638
|
+
)
|
|
3639
|
+
),
|
|
3640
|
+
servicePrefix
|
|
3641
|
+
),
|
|
3642
|
+
createDownloadTicket: async (bucketName, objectName, fileName) => normalizeFileTicketResult2(
|
|
3643
|
+
unwrapPageResult(
|
|
3644
|
+
await sdk.request({
|
|
3645
|
+
path: "/file/download-ticket",
|
|
3646
|
+
method: "post",
|
|
3647
|
+
body: { bucketName, objectName, fileName }
|
|
3648
|
+
})
|
|
3649
|
+
),
|
|
3650
|
+
servicePrefix
|
|
3651
|
+
)
|
|
3652
|
+
});
|
|
3653
|
+
};
|
|
3654
|
+
var usePageFormRuntimeApi = () => {
|
|
3655
|
+
const sdk = usePageSdk();
|
|
3656
|
+
return (0, import_react7.useMemo)(() => createPageFormRuntimeApi(sdk), [sdk]);
|
|
3657
|
+
};
|
|
3658
|
+
|
|
3659
|
+
// packages/sdk/src/runtime/react/filePreview.tsx
|
|
3660
|
+
var import_react11 = __toESM(require("react"));
|
|
3661
|
+
var import_antd5 = require("antd");
|
|
3662
|
+
|
|
3557
3663
|
// packages/sdk/src/components/fields/shared/fieldFormat.ts
|
|
3558
3664
|
function getUserId(user) {
|
|
3559
3665
|
if (typeof user === "string" || typeof user === "number") return String(user).trim();
|
|
@@ -3977,7 +4083,7 @@ var convertHeicPreview = async (request, url) => {
|
|
|
3977
4083
|
};
|
|
3978
4084
|
|
|
3979
4085
|
// packages/sdk/src/components/file-preview/FilePreviewContent.tsx
|
|
3980
|
-
var
|
|
4086
|
+
var import_react8 = require("react");
|
|
3981
4087
|
var import_antd2 = require("antd");
|
|
3982
4088
|
var import_icons = require("@ant-design/icons");
|
|
3983
4089
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -4061,11 +4167,11 @@ var PayloadPreview = ({
|
|
|
4061
4167
|
url,
|
|
4062
4168
|
mode
|
|
4063
4169
|
}) => {
|
|
4064
|
-
const [payload, setPayload] = (0,
|
|
4065
|
-
const [loading, setLoading] = (0,
|
|
4066
|
-
const [error, setError] = (0,
|
|
4067
|
-
const [reloadKey, setReloadKey] = (0,
|
|
4068
|
-
(0,
|
|
4170
|
+
const [payload, setPayload] = (0, import_react8.useState)(null);
|
|
4171
|
+
const [loading, setLoading] = (0, import_react8.useState)(false);
|
|
4172
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4173
|
+
const [reloadKey, setReloadKey] = (0, import_react8.useState)(0);
|
|
4174
|
+
(0, import_react8.useEffect)(() => {
|
|
4069
4175
|
let disposed = false;
|
|
4070
4176
|
setPayload(null);
|
|
4071
4177
|
setError("");
|
|
@@ -4173,9 +4279,9 @@ var ClientTextPreview = ({
|
|
|
4173
4279
|
request,
|
|
4174
4280
|
url
|
|
4175
4281
|
}) => {
|
|
4176
|
-
const [payload, setPayload] = (0,
|
|
4177
|
-
const [error, setError] = (0,
|
|
4178
|
-
(0,
|
|
4282
|
+
const [payload, setPayload] = (0, import_react8.useState)(null);
|
|
4283
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4284
|
+
(0, import_react8.useEffect)(() => {
|
|
4179
4285
|
let disposed = false;
|
|
4180
4286
|
let textLimit = 1024 * 1024;
|
|
4181
4287
|
loadPreviewBlob(request, url).then(async (blob) => {
|
|
@@ -4211,10 +4317,10 @@ var ClientTextPreview = ({
|
|
|
4211
4317
|
] });
|
|
4212
4318
|
};
|
|
4213
4319
|
var DocxPreview = ({ request, url }) => {
|
|
4214
|
-
const containerRef = (0,
|
|
4215
|
-
const [loading, setLoading] = (0,
|
|
4216
|
-
const [error, setError] = (0,
|
|
4217
|
-
(0,
|
|
4320
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
4321
|
+
const [loading, setLoading] = (0, import_react8.useState)(true);
|
|
4322
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4323
|
+
(0, import_react8.useEffect)(() => {
|
|
4218
4324
|
let disposed = false;
|
|
4219
4325
|
const container = containerRef.current;
|
|
4220
4326
|
if (!container || !url) return () => {
|
|
@@ -4273,9 +4379,9 @@ var HeicImagePreview = ({
|
|
|
4273
4379
|
url,
|
|
4274
4380
|
fileName
|
|
4275
4381
|
}) => {
|
|
4276
|
-
const [src, setSrc] = (0,
|
|
4277
|
-
const [error, setError] = (0,
|
|
4278
|
-
(0,
|
|
4382
|
+
const [src, setSrc] = (0, import_react8.useState)("");
|
|
4383
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4384
|
+
(0, import_react8.useEffect)(() => {
|
|
4279
4385
|
let disposed = false;
|
|
4280
4386
|
let objectUrl = "";
|
|
4281
4387
|
convertHeicPreview(request, url).then((result) => {
|
|
@@ -4304,9 +4410,9 @@ var ClientSpreadsheetPreview = ({
|
|
|
4304
4410
|
request,
|
|
4305
4411
|
url
|
|
4306
4412
|
}) => {
|
|
4307
|
-
const [payload, setPayload] = (0,
|
|
4308
|
-
const [error, setError] = (0,
|
|
4309
|
-
(0,
|
|
4413
|
+
const [payload, setPayload] = (0, import_react8.useState)(null);
|
|
4414
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4415
|
+
(0, import_react8.useEffect)(() => {
|
|
4310
4416
|
let disposed = false;
|
|
4311
4417
|
(async () => {
|
|
4312
4418
|
try {
|
|
@@ -4422,13 +4528,13 @@ var OnlyOfficePreview = ({
|
|
|
4422
4528
|
configUrl,
|
|
4423
4529
|
ticket
|
|
4424
4530
|
}) => {
|
|
4425
|
-
const editorId = (0,
|
|
4531
|
+
const editorId = (0, import_react8.useMemo)(
|
|
4426
4532
|
() => `openxiangda-onlyoffice-${String(ticket || "editor").replace(/[^a-zA-Z0-9_-]/g, "")}`,
|
|
4427
4533
|
[ticket]
|
|
4428
4534
|
);
|
|
4429
|
-
const [loading, setLoading] = (0,
|
|
4430
|
-
const [error, setError] = (0,
|
|
4431
|
-
(0,
|
|
4535
|
+
const [loading, setLoading] = (0, import_react8.useState)(true);
|
|
4536
|
+
const [error, setError] = (0, import_react8.useState)("");
|
|
4537
|
+
(0, import_react8.useEffect)(() => {
|
|
4432
4538
|
let disposed = false;
|
|
4433
4539
|
let editor;
|
|
4434
4540
|
setLoading(true);
|
|
@@ -4611,13 +4717,13 @@ var FilePreviewContent = ({
|
|
|
4611
4717
|
};
|
|
4612
4718
|
|
|
4613
4719
|
// packages/sdk/src/components/file-preview/FilePreviewPage.tsx
|
|
4614
|
-
var
|
|
4720
|
+
var import_react9 = require("react");
|
|
4615
4721
|
var import_antd3 = require("antd");
|
|
4616
4722
|
var import_icons2 = require("@ant-design/icons");
|
|
4617
4723
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4618
4724
|
|
|
4619
4725
|
// packages/sdk/src/components/file-preview/useFilePreview.tsx
|
|
4620
|
-
var
|
|
4726
|
+
var import_react10 = require("react");
|
|
4621
4727
|
var import_antd4 = require("antd");
|
|
4622
4728
|
var import_icons3 = require("@ant-design/icons");
|
|
4623
4729
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -4646,7 +4752,7 @@ var useFilePreviewController = ({
|
|
|
4646
4752
|
enabled = true,
|
|
4647
4753
|
requireServerCapability = true
|
|
4648
4754
|
}) => {
|
|
4649
|
-
const itemSignature = (0,
|
|
4755
|
+
const itemSignature = (0, import_react10.useMemo)(
|
|
4650
4756
|
() => items.map(
|
|
4651
4757
|
(item, index) => [
|
|
4652
4758
|
getPreviewItemKey(item, index),
|
|
@@ -4659,17 +4765,17 @@ var useFilePreviewController = ({
|
|
|
4659
4765
|
).join("|"),
|
|
4660
4766
|
[items]
|
|
4661
4767
|
);
|
|
4662
|
-
const [capabilities, setCapabilities] = (0,
|
|
4768
|
+
const [capabilities, setCapabilities] = (0, import_react10.useState)(
|
|
4663
4769
|
() => buildCapabilityMap(items, requireServerCapability)
|
|
4664
4770
|
);
|
|
4665
|
-
const [openingKey, setOpeningKey] = (0,
|
|
4666
|
-
const [dialogPreview, setDialogPreview] = (0,
|
|
4667
|
-
const [imagePreview, setImagePreview] = (0,
|
|
4771
|
+
const [openingKey, setOpeningKey] = (0, import_react10.useState)("");
|
|
4772
|
+
const [dialogPreview, setDialogPreview] = (0, import_react10.useState)(null);
|
|
4773
|
+
const [imagePreview, setImagePreview] = (0, import_react10.useState)({
|
|
4668
4774
|
open: false,
|
|
4669
4775
|
current: 0,
|
|
4670
4776
|
items: []
|
|
4671
4777
|
});
|
|
4672
|
-
(0,
|
|
4778
|
+
(0, import_react10.useEffect)(() => {
|
|
4673
4779
|
let disposed = false;
|
|
4674
4780
|
const initial = buildCapabilityMap(items, requireServerCapability);
|
|
4675
4781
|
setCapabilities(initial);
|
|
@@ -4714,28 +4820,28 @@ var useFilePreviewController = ({
|
|
|
4714
4820
|
disposed = true;
|
|
4715
4821
|
};
|
|
4716
4822
|
}, [api, enabled, itemSignature, requireServerCapability]);
|
|
4717
|
-
const getCapability = (0,
|
|
4823
|
+
const getCapability = (0, import_react10.useCallback)(
|
|
4718
4824
|
(item) => {
|
|
4719
4825
|
const index = items.indexOf(item);
|
|
4720
4826
|
return capabilities[getPreviewItemKey(item, Math.max(index, 0))];
|
|
4721
4827
|
},
|
|
4722
4828
|
[capabilities, items]
|
|
4723
4829
|
);
|
|
4724
|
-
const canPreview = (0,
|
|
4830
|
+
const canPreview = (0, import_react10.useCallback)(
|
|
4725
4831
|
(item) => enabled && canActOnItem(item) && getCapability(item)?.canPreview === true,
|
|
4726
4832
|
[enabled, getCapability]
|
|
4727
4833
|
);
|
|
4728
|
-
const closeImagePreview = (0,
|
|
4834
|
+
const closeImagePreview = (0, import_react10.useCallback)(() => {
|
|
4729
4835
|
setImagePreview((current) => {
|
|
4730
4836
|
revokeImageItems(current.items);
|
|
4731
4837
|
return { open: false, current: 0, items: [] };
|
|
4732
4838
|
});
|
|
4733
4839
|
}, []);
|
|
4734
|
-
(0,
|
|
4840
|
+
(0, import_react10.useEffect)(
|
|
4735
4841
|
() => () => revokeImageItems(imagePreview.items),
|
|
4736
4842
|
[imagePreview.items]
|
|
4737
4843
|
);
|
|
4738
|
-
const resolvePreparedImageItem = (0,
|
|
4844
|
+
const resolvePreparedImageItem = (0, import_react10.useCallback)(
|
|
4739
4845
|
async (prepared, index) => {
|
|
4740
4846
|
const item = prepared.item;
|
|
4741
4847
|
const metadata = prepared.metadata;
|
|
@@ -4757,14 +4863,14 @@ var useFilePreviewController = ({
|
|
|
4757
4863
|
},
|
|
4758
4864
|
[api]
|
|
4759
4865
|
);
|
|
4760
|
-
const prepareImageItem = (0,
|
|
4866
|
+
const prepareImageItem = (0, import_react10.useCallback)(
|
|
4761
4867
|
async (item, index) => {
|
|
4762
4868
|
const prepared = await prepareFilePreview({ item, api, appType, bucketName });
|
|
4763
4869
|
return resolvePreparedImageItem(prepared, index);
|
|
4764
4870
|
},
|
|
4765
4871
|
[api, appType, bucketName, resolvePreparedImageItem]
|
|
4766
4872
|
);
|
|
4767
|
-
const openPreview = (0,
|
|
4873
|
+
const openPreview = (0, import_react10.useCallback)(
|
|
4768
4874
|
async (item) => {
|
|
4769
4875
|
const itemIndex = Math.max(items.indexOf(item), 0);
|
|
4770
4876
|
const key = getPreviewItemKey(item, itemIndex);
|
|
@@ -4827,7 +4933,7 @@ var useFilePreviewController = ({
|
|
|
4827
4933
|
resolvePreparedImageItem
|
|
4828
4934
|
]
|
|
4829
4935
|
);
|
|
4830
|
-
const downloadItem = (0,
|
|
4936
|
+
const downloadItem = (0, import_react10.useCallback)(
|
|
4831
4937
|
async (item, prepared) => {
|
|
4832
4938
|
let url = prepared?.metadata.downloadUrl || item.downloadUrl || item.publicUrl || item.url;
|
|
4833
4939
|
if (!isDirectStorageItem(item) && item.objectName && !prepared?.metadata.downloadUrl) {
|
|
@@ -4838,7 +4944,8 @@ var useFilePreviewController = ({
|
|
|
4838
4944
|
);
|
|
4839
4945
|
url = typeof ticket === "string" ? ticket : ticket?.downloadUrl || ticket?.relayUrl || ticket?.url || url;
|
|
4840
4946
|
}
|
|
4841
|
-
|
|
4947
|
+
const resolvedUrl = resolvePreviewServiceUrl(url);
|
|
4948
|
+
if (resolvedUrl && typeof window !== "undefined") window.location.assign(resolvedUrl);
|
|
4842
4949
|
},
|
|
4843
4950
|
[api, bucketName]
|
|
4844
4951
|
);
|
|
@@ -4991,63 +5098,6 @@ function FileStatusText({
|
|
|
4991
5098
|
// packages/sdk/src/runtime/react/filePreview.tsx
|
|
4992
5099
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4993
5100
|
var EMPTY_ITEMS = [];
|
|
4994
|
-
var normalizeMethod2 = (method) => {
|
|
4995
|
-
const value = String(method || "get").toLowerCase();
|
|
4996
|
-
return ["get", "post", "put", "delete", "patch"].includes(value) ? value : "get";
|
|
4997
|
-
};
|
|
4998
|
-
var normalizeHeaders = (headers) => {
|
|
4999
|
-
if (!headers) return void 0;
|
|
5000
|
-
return Object.fromEntries(new Headers(headers).entries());
|
|
5001
|
-
};
|
|
5002
|
-
var toPageRequest = (config) => ({
|
|
5003
|
-
path: config.url,
|
|
5004
|
-
method: normalizeMethod2(config.method),
|
|
5005
|
-
query: config.params,
|
|
5006
|
-
body: config.data,
|
|
5007
|
-
headers: normalizeHeaders(config.headers)
|
|
5008
|
-
});
|
|
5009
|
-
var toRuntimeResponse = (response) => {
|
|
5010
|
-
if (response.raw && typeof response.raw === "object") {
|
|
5011
|
-
return response.raw;
|
|
5012
|
-
}
|
|
5013
|
-
return {
|
|
5014
|
-
code: Number(response.code) || 200,
|
|
5015
|
-
success: response.success,
|
|
5016
|
-
message: response.message,
|
|
5017
|
-
data: response.result,
|
|
5018
|
-
result: response.result
|
|
5019
|
-
};
|
|
5020
|
-
};
|
|
5021
|
-
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
5022
|
-
var createPageFileRuntimeApi = (sdk) => {
|
|
5023
|
-
const request = async (config) => {
|
|
5024
|
-
const options = toPageRequest(config);
|
|
5025
|
-
if (config.responseType === "blob") {
|
|
5026
|
-
const response = await sdk.transport.download(options);
|
|
5027
|
-
return response.blob;
|
|
5028
|
-
}
|
|
5029
|
-
return toRuntimeResponse(await sdk.transport.request(options));
|
|
5030
|
-
};
|
|
5031
|
-
return createFormRuntimeApi({
|
|
5032
|
-
request,
|
|
5033
|
-
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => unwrapPageResult(
|
|
5034
|
-
await sdk.createFileAccessTicket(
|
|
5035
|
-
bucketName,
|
|
5036
|
-
objectName,
|
|
5037
|
-
fileName,
|
|
5038
|
-
purpose,
|
|
5039
|
-
options
|
|
5040
|
-
)
|
|
5041
|
-
),
|
|
5042
|
-
createDownloadTicket: async (bucketName, objectName, fileName) => unwrapPageResult(
|
|
5043
|
-
await sdk.request({
|
|
5044
|
-
path: "/file/download-ticket",
|
|
5045
|
-
method: "post",
|
|
5046
|
-
body: { bucketName, objectName, fileName }
|
|
5047
|
-
})
|
|
5048
|
-
)
|
|
5049
|
-
});
|
|
5050
|
-
};
|
|
5051
5101
|
var useFilePreview = ({
|
|
5052
5102
|
items = EMPTY_ITEMS,
|
|
5053
5103
|
appType,
|
|
@@ -5056,7 +5106,7 @@ var useFilePreview = ({
|
|
|
5056
5106
|
requireServerCapability = true
|
|
5057
5107
|
}) => {
|
|
5058
5108
|
const sdk = usePageSdk();
|
|
5059
|
-
const api = (0,
|
|
5109
|
+
const api = (0, import_react11.useMemo)(() => createPageFormRuntimeApi(sdk), [sdk]);
|
|
5060
5110
|
const preview = useFilePreviewController({
|
|
5061
5111
|
items,
|
|
5062
5112
|
api,
|
|
@@ -5148,8 +5198,8 @@ var AttachmentPreviewList = ({
|
|
|
5148
5198
|
};
|
|
5149
5199
|
var PreviewImageThumb = ({ item }) => {
|
|
5150
5200
|
const src = item.thumbUrl || item.previewUrl || item.url;
|
|
5151
|
-
const [failed, setFailed] = (0,
|
|
5152
|
-
|
|
5201
|
+
const [failed, setFailed] = (0, import_react11.useState)(false);
|
|
5202
|
+
import_react11.default.useEffect(() => setFailed(false), [src]);
|
|
5153
5203
|
return src && !failed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src, alt: item.name || "\u56FE\u7247", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sy-image-state", children: item.name || "\u56FE\u7247" });
|
|
5154
5204
|
};
|
|
5155
5205
|
var ImagePreviewGrid = ({
|
|
@@ -5244,12 +5294,12 @@ var ImagePreviewGrid = ({
|
|
|
5244
5294
|
};
|
|
5245
5295
|
|
|
5246
5296
|
// packages/sdk/src/runtime/react/workflow.tsx
|
|
5247
|
-
var
|
|
5297
|
+
var import_react17 = require("react");
|
|
5248
5298
|
var import_antd10 = require("antd");
|
|
5249
5299
|
var import_icons9 = require("@ant-design/icons");
|
|
5250
5300
|
|
|
5251
5301
|
// packages/sdk/src/components/modules/StickyActionBar.tsx
|
|
5252
|
-
var
|
|
5302
|
+
var import_react12 = require("react");
|
|
5253
5303
|
var import_antd6 = require("antd");
|
|
5254
5304
|
var import_icons5 = require("@ant-design/icons");
|
|
5255
5305
|
|
|
@@ -5285,14 +5335,14 @@ var StickyActionBar = ({
|
|
|
5285
5335
|
position = "sticky",
|
|
5286
5336
|
surface = "default"
|
|
5287
5337
|
}) => {
|
|
5288
|
-
const [isMobile, setIsMobile] = (0,
|
|
5289
|
-
(0,
|
|
5338
|
+
const [isMobile, setIsMobile] = (0, import_react12.useState)(false);
|
|
5339
|
+
(0, import_react12.useEffect)(() => {
|
|
5290
5340
|
const update = () => setIsMobile(typeof window !== "undefined" && window.innerWidth <= 768);
|
|
5291
5341
|
update();
|
|
5292
5342
|
window.addEventListener("resize", update);
|
|
5293
5343
|
return () => window.removeEventListener("resize", update);
|
|
5294
5344
|
}, []);
|
|
5295
|
-
const visibleActions = (0,
|
|
5345
|
+
const visibleActions = (0, import_react12.useMemo)(
|
|
5296
5346
|
() => actions.filter((action) => action.visible !== false).sort((left, right) => getActionPriority(left) - getActionPriority(right)),
|
|
5297
5347
|
[actions]
|
|
5298
5348
|
);
|
|
@@ -5361,7 +5411,7 @@ var StickyActionBar = ({
|
|
|
5361
5411
|
};
|
|
5362
5412
|
|
|
5363
5413
|
// packages/sdk/src/components/modules/ApprovalTimeline.tsx
|
|
5364
|
-
var
|
|
5414
|
+
var import_react13 = require("react");
|
|
5365
5415
|
var import_icons6 = require("@ant-design/icons");
|
|
5366
5416
|
|
|
5367
5417
|
// packages/sdk/src/components/core/constants.ts
|
|
@@ -5525,8 +5575,8 @@ var ApprovalTimeline = ({
|
|
|
5525
5575
|
compactMode = false,
|
|
5526
5576
|
showApproverInfo = true
|
|
5527
5577
|
}) => {
|
|
5528
|
-
const taskList = (0,
|
|
5529
|
-
const groups = (0,
|
|
5578
|
+
const taskList = (0, import_react13.useMemo)(() => Array.isArray(tasks) ? tasks : [], [tasks]);
|
|
5579
|
+
const groups = (0, import_react13.useMemo)(() => groupTasks(taskList), [taskList]);
|
|
5530
5580
|
if (taskList.length === 0) {
|
|
5531
5581
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5532
5582
|
"div",
|
|
@@ -5672,7 +5722,7 @@ var ProcessPreview = ({
|
|
|
5672
5722
|
};
|
|
5673
5723
|
|
|
5674
5724
|
// packages/sdk/src/components/modules/InitiatorApproverSelector.tsx
|
|
5675
|
-
var
|
|
5725
|
+
var import_react16 = require("react");
|
|
5676
5726
|
var import_antd9 = require("antd");
|
|
5677
5727
|
|
|
5678
5728
|
// packages/sdk/src/components/core/processApi.ts
|
|
@@ -5717,13 +5767,13 @@ async function getInitiatorSelectCandidates(request, params) {
|
|
|
5717
5767
|
}
|
|
5718
5768
|
|
|
5719
5769
|
// packages/sdk/src/components/fields/shared/UserPicker.tsx
|
|
5720
|
-
var
|
|
5770
|
+
var import_react15 = require("react");
|
|
5721
5771
|
var import_antd8 = require("antd");
|
|
5722
5772
|
var import_icons8 = require("@ant-design/icons");
|
|
5723
5773
|
var MobileAntd = __toESM(require("antd-mobile"));
|
|
5724
5774
|
|
|
5725
5775
|
// packages/sdk/src/components/fields/shared/useLazyDepartmentTree.ts
|
|
5726
|
-
var
|
|
5776
|
+
var import_react14 = require("react");
|
|
5727
5777
|
var toLazyNode = (node) => {
|
|
5728
5778
|
const normalized = normalizeDepartmentNode(node);
|
|
5729
5779
|
const id = getDepartmentId(normalized);
|
|
@@ -5773,15 +5823,15 @@ function buildIndexes(nodes) {
|
|
|
5773
5823
|
return { nodeMap, parentMap, flatNodes };
|
|
5774
5824
|
}
|
|
5775
5825
|
function useLazyDepartmentTree(api, configuredTreeData) {
|
|
5776
|
-
const [treeData, setTreeDataState] = (0,
|
|
5826
|
+
const [treeData, setTreeDataState] = (0, import_react14.useState)(
|
|
5777
5827
|
() => (configuredTreeData || []).map(toLazyNode)
|
|
5778
5828
|
);
|
|
5779
|
-
const [treeLoading, setTreeLoading] = (0,
|
|
5780
|
-
const treeDataRef = (0,
|
|
5781
|
-
const rootsLoadedRef = (0,
|
|
5782
|
-
const rootPromiseRef = (0,
|
|
5783
|
-
const childPromiseRef = (0,
|
|
5784
|
-
const setTreeData = (0,
|
|
5829
|
+
const [treeLoading, setTreeLoading] = (0, import_react14.useState)(false);
|
|
5830
|
+
const treeDataRef = (0, import_react14.useRef)(treeData);
|
|
5831
|
+
const rootsLoadedRef = (0, import_react14.useRef)(Boolean(configuredTreeData?.length));
|
|
5832
|
+
const rootPromiseRef = (0, import_react14.useRef)(null);
|
|
5833
|
+
const childPromiseRef = (0, import_react14.useRef)({});
|
|
5834
|
+
const setTreeData = (0, import_react14.useCallback)(
|
|
5785
5835
|
(next) => {
|
|
5786
5836
|
const resolved = typeof next === "function" ? next(treeDataRef.current) : next;
|
|
5787
5837
|
treeDataRef.current = resolved;
|
|
@@ -5790,13 +5840,13 @@ function useLazyDepartmentTree(api, configuredTreeData) {
|
|
|
5790
5840
|
},
|
|
5791
5841
|
[]
|
|
5792
5842
|
);
|
|
5793
|
-
(0,
|
|
5843
|
+
(0, import_react14.useEffect)(() => {
|
|
5794
5844
|
if (!configuredTreeData) return;
|
|
5795
5845
|
const next = configuredTreeData.map(toLazyNode);
|
|
5796
5846
|
rootsLoadedRef.current = next.length > 0;
|
|
5797
5847
|
setTreeData(next);
|
|
5798
5848
|
}, [configuredTreeData, setTreeData]);
|
|
5799
|
-
const loadRootDepartments = (0,
|
|
5849
|
+
const loadRootDepartments = (0, import_react14.useCallback)(async () => {
|
|
5800
5850
|
if (rootsLoadedRef.current) return treeDataRef.current;
|
|
5801
5851
|
if (rootPromiseRef.current) return rootPromiseRef.current;
|
|
5802
5852
|
setTreeLoading(true);
|
|
@@ -5812,7 +5862,7 @@ function useLazyDepartmentTree(api, configuredTreeData) {
|
|
|
5812
5862
|
rootPromiseRef.current = promise;
|
|
5813
5863
|
return promise;
|
|
5814
5864
|
}, [api, setTreeData]);
|
|
5815
|
-
const loadChildren = (0,
|
|
5865
|
+
const loadChildren = (0, import_react14.useCallback)(
|
|
5816
5866
|
async (parentId) => {
|
|
5817
5867
|
const id = String(parentId || "");
|
|
5818
5868
|
if (!id) return [];
|
|
@@ -5833,8 +5883,8 @@ function useLazyDepartmentTree(api, configuredTreeData) {
|
|
|
5833
5883
|
},
|
|
5834
5884
|
[api, setTreeData]
|
|
5835
5885
|
);
|
|
5836
|
-
const indexes = (0,
|
|
5837
|
-
(0,
|
|
5886
|
+
const indexes = (0, import_react14.useMemo)(() => buildIndexes(treeData), [treeData]);
|
|
5887
|
+
(0, import_react14.useEffect)(() => {
|
|
5838
5888
|
void loadRootDepartments();
|
|
5839
5889
|
}, [loadRootDepartments]);
|
|
5840
5890
|
return {
|
|
@@ -5879,24 +5929,24 @@ function UserPickerPanel({
|
|
|
5879
5929
|
flatNodes,
|
|
5880
5930
|
loadChildren
|
|
5881
5931
|
} = useLazyDepartmentTree(api, treeData);
|
|
5882
|
-
const [departmentKeyword, setDepartmentKeyword] = (0,
|
|
5883
|
-
const [memberKeyword, setMemberKeyword] = (0,
|
|
5884
|
-
const [mobileKeyword, setMobileKeyword] = (0,
|
|
5885
|
-
const [currentDeptId, setCurrentDeptId] = (0,
|
|
5886
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
5887
|
-
const [members, setMembers] = (0,
|
|
5888
|
-
const [memberPage, setMemberPage] = (0,
|
|
5889
|
-
const [memberPageSize, setMemberPageSize] = (0,
|
|
5890
|
-
const [memberTotal, setMemberTotal] = (0,
|
|
5891
|
-
const [memberReloadKey, setMemberReloadKey] = (0,
|
|
5892
|
-
const [loading, setLoading] = (0,
|
|
5893
|
-
const [selected, setSelected] = (0,
|
|
5932
|
+
const [departmentKeyword, setDepartmentKeyword] = (0, import_react15.useState)("");
|
|
5933
|
+
const [memberKeyword, setMemberKeyword] = (0, import_react15.useState)("");
|
|
5934
|
+
const [mobileKeyword, setMobileKeyword] = (0, import_react15.useState)("");
|
|
5935
|
+
const [currentDeptId, setCurrentDeptId] = (0, import_react15.useState)("");
|
|
5936
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react15.useState)([]);
|
|
5937
|
+
const [members, setMembers] = (0, import_react15.useState)(() => normalizeUsers(dataSource));
|
|
5938
|
+
const [memberPage, setMemberPage] = (0, import_react15.useState)(1);
|
|
5939
|
+
const [memberPageSize, setMemberPageSize] = (0, import_react15.useState)(DEFAULT_MEMBER_PAGE_SIZE);
|
|
5940
|
+
const [memberTotal, setMemberTotal] = (0, import_react15.useState)(() => normalizeUsers(dataSource).length);
|
|
5941
|
+
const [memberReloadKey, setMemberReloadKey] = (0, import_react15.useState)(0);
|
|
5942
|
+
const [loading, setLoading] = (0, import_react15.useState)(false);
|
|
5943
|
+
const [selected, setSelected] = (0, import_react15.useState)(() => normalizeUsers(value));
|
|
5894
5944
|
const selectedIds = selected.map(getUserId);
|
|
5895
5945
|
const MobileSearchBar = getMobileComponent("SearchBar");
|
|
5896
5946
|
const activeMemberKeyword = (mobile ? mobileKeyword : memberKeyword).trim();
|
|
5897
|
-
const staticUsers = (0,
|
|
5947
|
+
const staticUsers = (0, import_react15.useMemo)(() => normalizeUsers(dataSource), [dataSource]);
|
|
5898
5948
|
const hasStaticUserSource = staticUsers.length > 0;
|
|
5899
|
-
(0,
|
|
5949
|
+
(0, import_react15.useEffect)(() => {
|
|
5900
5950
|
if (mobile) return;
|
|
5901
5951
|
if (currentDeptId || deptTreeData.length === 0) return;
|
|
5902
5952
|
setExpandedKeys(deptTreeData.map((node) => getDepartmentId(node)));
|
|
@@ -5904,17 +5954,17 @@ function UserPickerPanel({
|
|
|
5904
5954
|
setCurrentDeptId(getDepartmentId(deptTreeData[0]));
|
|
5905
5955
|
}
|
|
5906
5956
|
}, [currentDeptId, deptTreeData, loadAllWhenNoDepartment, mobile]);
|
|
5907
|
-
(0,
|
|
5957
|
+
(0, import_react15.useEffect)(() => {
|
|
5908
5958
|
setMemberPage(1);
|
|
5909
5959
|
}, [activeMemberKeyword, currentDeptId, dataSource, mobile]);
|
|
5910
|
-
const handleDepartmentSelect = (0,
|
|
5960
|
+
const handleDepartmentSelect = (0, import_react15.useCallback)((deptId) => {
|
|
5911
5961
|
const nextDeptId = String(deptId || "");
|
|
5912
5962
|
setCurrentDeptId(nextDeptId);
|
|
5913
5963
|
setMemberKeyword("");
|
|
5914
5964
|
setMemberPage(1);
|
|
5915
5965
|
setMemberReloadKey((current) => current + 1);
|
|
5916
5966
|
}, []);
|
|
5917
|
-
(0,
|
|
5967
|
+
(0, import_react15.useEffect)(() => {
|
|
5918
5968
|
let active = true;
|
|
5919
5969
|
const keyword = activeMemberKeyword;
|
|
5920
5970
|
if (hasStaticUserSource) {
|
|
@@ -5987,7 +6037,7 @@ function UserPickerPanel({
|
|
|
5987
6037
|
memberReloadKey,
|
|
5988
6038
|
staticUsers
|
|
5989
6039
|
]);
|
|
5990
|
-
const currentPath = (0,
|
|
6040
|
+
const currentPath = (0, import_react15.useMemo)(() => {
|
|
5991
6041
|
if (!currentDeptId) return [];
|
|
5992
6042
|
const path = [];
|
|
5993
6043
|
let cursor = currentDeptId;
|
|
@@ -5999,7 +6049,7 @@ function UserPickerPanel({
|
|
|
5999
6049
|
}
|
|
6000
6050
|
return path;
|
|
6001
6051
|
}, [currentDeptId, nodeMap, parentMap]);
|
|
6002
|
-
const mobileDepartments = (0,
|
|
6052
|
+
const mobileDepartments = (0, import_react15.useMemo)(() => {
|
|
6003
6053
|
const keyword = mobileKeyword.trim().toLowerCase();
|
|
6004
6054
|
if (keyword) {
|
|
6005
6055
|
return flatNodes.filter((item) => item.name.toLowerCase().includes(keyword)).map((item) => item.node);
|
|
@@ -6263,19 +6313,19 @@ var RequirementSelect = ({
|
|
|
6263
6313
|
selectedUsers,
|
|
6264
6314
|
onChange
|
|
6265
6315
|
}) => {
|
|
6266
|
-
const [pickerOpen, setPickerOpen] = (0,
|
|
6267
|
-
const initialCandidates = (0,
|
|
6316
|
+
const [pickerOpen, setPickerOpen] = (0, import_react16.useState)(false);
|
|
6317
|
+
const initialCandidates = (0, import_react16.useMemo)(
|
|
6268
6318
|
() => (requirement.candidateUsers || []).map(normalizeCandidate).filter(Boolean),
|
|
6269
6319
|
[requirement.candidateUsers]
|
|
6270
6320
|
);
|
|
6271
|
-
const [optionsSource, setOptionsSource] = (0,
|
|
6272
|
-
const [loading, setLoading] = (0,
|
|
6273
|
-
(0,
|
|
6321
|
+
const [optionsSource, setOptionsSource] = (0, import_react16.useState)(initialCandidates);
|
|
6322
|
+
const [loading, setLoading] = (0, import_react16.useState)(false);
|
|
6323
|
+
(0, import_react16.useEffect)(() => {
|
|
6274
6324
|
setOptionsSource(
|
|
6275
6325
|
(current) => mergeUsers(initialCandidates, mergeUsers(current, selectedUsers))
|
|
6276
6326
|
);
|
|
6277
6327
|
}, [initialCandidates, selectedUsers]);
|
|
6278
|
-
const loadCandidates = (0,
|
|
6328
|
+
const loadCandidates = (0, import_react16.useCallback)(
|
|
6279
6329
|
async (keyword) => {
|
|
6280
6330
|
setLoading(true);
|
|
6281
6331
|
try {
|
|
@@ -6313,12 +6363,12 @@ var RequirementSelect = ({
|
|
|
6313
6363
|
},
|
|
6314
6364
|
[api, appType, formUuid, initialCandidates.length, requirement.nodeId, requirement.scope]
|
|
6315
6365
|
);
|
|
6316
|
-
(0,
|
|
6366
|
+
(0, import_react16.useEffect)(() => {
|
|
6317
6367
|
if (requirement.scope !== "all" && open && formUuid && appType && requirement.nodeId) {
|
|
6318
6368
|
void loadCandidates();
|
|
6319
6369
|
}
|
|
6320
6370
|
}, [appType, formUuid, loadCandidates, open, requirement.nodeId, requirement.scope]);
|
|
6321
|
-
const options = (0,
|
|
6371
|
+
const options = (0, import_react16.useMemo)(
|
|
6322
6372
|
() => optionsSource.map((user) => ({
|
|
6323
6373
|
value: user.id,
|
|
6324
6374
|
label: getUserLabel(user)
|
|
@@ -6403,9 +6453,9 @@ var InitiatorApproverSelector = ({
|
|
|
6403
6453
|
onOk,
|
|
6404
6454
|
onCancel
|
|
6405
6455
|
}) => {
|
|
6406
|
-
const [selected, setSelected] = (0,
|
|
6407
|
-
const wasOpenRef = (0,
|
|
6408
|
-
(0,
|
|
6456
|
+
const [selected, setSelected] = (0, import_react16.useState)({});
|
|
6457
|
+
const wasOpenRef = (0, import_react16.useRef)(false);
|
|
6458
|
+
(0, import_react16.useEffect)(() => {
|
|
6409
6459
|
if (open && !wasOpenRef.current) {
|
|
6410
6460
|
setSelected(value || EMPTY_SELECTED_MAP);
|
|
6411
6461
|
}
|
|
@@ -6463,20 +6513,20 @@ var normalizeCapabilities = (value) => {
|
|
|
6463
6513
|
function useProcessCapabilities(options) {
|
|
6464
6514
|
const { enabled = true, refreshKey, onError, ...params } = options;
|
|
6465
6515
|
const sdk = usePageSdk();
|
|
6466
|
-
const [capabilities, setCapabilities] = (0,
|
|
6516
|
+
const [capabilities, setCapabilities] = (0, import_react17.useState)(
|
|
6467
6517
|
null
|
|
6468
6518
|
);
|
|
6469
|
-
const [loading, setLoading] = (0,
|
|
6470
|
-
const [error, setError] = (0,
|
|
6471
|
-
const mountedRef = (0,
|
|
6519
|
+
const [loading, setLoading] = (0, import_react17.useState)(false);
|
|
6520
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
6521
|
+
const mountedRef = (0, import_react17.useRef)(true);
|
|
6472
6522
|
const paramsKey = JSON.stringify({ ...params, refreshKey });
|
|
6473
|
-
(0,
|
|
6523
|
+
(0, import_react17.useEffect)(() => {
|
|
6474
6524
|
mountedRef.current = true;
|
|
6475
6525
|
return () => {
|
|
6476
6526
|
mountedRef.current = false;
|
|
6477
6527
|
};
|
|
6478
6528
|
}, []);
|
|
6479
|
-
const refresh = (0,
|
|
6529
|
+
const refresh = (0, import_react17.useCallback)(async () => {
|
|
6480
6530
|
if (!enabled) return capabilities;
|
|
6481
6531
|
setLoading(true);
|
|
6482
6532
|
setError(null);
|
|
@@ -6502,7 +6552,7 @@ function useProcessCapabilities(options) {
|
|
|
6502
6552
|
}
|
|
6503
6553
|
}
|
|
6504
6554
|
}, [capabilities, enabled, onError, paramsKey, sdk]);
|
|
6505
|
-
(0,
|
|
6555
|
+
(0, import_react17.useEffect)(() => {
|
|
6506
6556
|
if (!enabled) return;
|
|
6507
6557
|
void refresh();
|
|
6508
6558
|
}, [enabled, paramsKey, refresh]);
|
|
@@ -6527,8 +6577,8 @@ var requireValue = (value, message3) => {
|
|
|
6527
6577
|
function useProcessActions(options) {
|
|
6528
6578
|
const { capabilities, formUuid, appType, getFormValues, onActionComplete } = options;
|
|
6529
6579
|
const sdk = usePageSdk();
|
|
6530
|
-
const [loadingAction, setLoadingAction] = (0,
|
|
6531
|
-
const buildUpdateFormDataJson = (0,
|
|
6580
|
+
const [loadingAction, setLoadingAction] = (0, import_react17.useState)(null);
|
|
6581
|
+
const buildUpdateFormDataJson = (0, import_react17.useCallback)(
|
|
6532
6582
|
(input) => {
|
|
6533
6583
|
if (input?.updateFormDataJson !== void 0) return input.updateFormDataJson;
|
|
6534
6584
|
const values = getFormValues?.();
|
|
@@ -6536,7 +6586,7 @@ function useProcessActions(options) {
|
|
|
6536
6586
|
},
|
|
6537
6587
|
[getFormValues]
|
|
6538
6588
|
);
|
|
6539
|
-
const executeOperation = (0,
|
|
6589
|
+
const executeOperation = (0, import_react17.useCallback)(
|
|
6540
6590
|
async (operation, input = {}) => {
|
|
6541
6591
|
if (!operation.enabled) return false;
|
|
6542
6592
|
setLoadingAction(operation.key);
|
|
@@ -6646,7 +6696,7 @@ function useProcessActions(options) {
|
|
|
6646
6696
|
sdk
|
|
6647
6697
|
]
|
|
6648
6698
|
);
|
|
6649
|
-
const execute = (0,
|
|
6699
|
+
const execute = (0, import_react17.useCallback)(
|
|
6650
6700
|
async (action, input) => {
|
|
6651
6701
|
const operation = (capabilities?.operations || []).find(
|
|
6652
6702
|
(item) => item.key === action
|
|
@@ -6721,7 +6771,7 @@ var ProcessActionBar = ({
|
|
|
6721
6771
|
position = "sticky"
|
|
6722
6772
|
}) => {
|
|
6723
6773
|
const [form] = import_antd10.Form.useForm();
|
|
6724
|
-
const [activeOperation, setActiveOperation] = (0,
|
|
6774
|
+
const [activeOperation, setActiveOperation] = (0, import_react17.useState)(null);
|
|
6725
6775
|
const autoCapabilities = useProcessCapabilities({
|
|
6726
6776
|
...capabilityParams || {},
|
|
6727
6777
|
enabled: Boolean(capabilityParams) && capabilityParams?.enabled !== false
|
|
@@ -6756,7 +6806,7 @@ var ProcessActionBar = ({
|
|
|
6756
6806
|
}
|
|
6757
6807
|
void actions.executeOperation(operation);
|
|
6758
6808
|
};
|
|
6759
|
-
const actionConfigs = (0,
|
|
6809
|
+
const actionConfigs = (0, import_react17.useMemo)(
|
|
6760
6810
|
() => operations.map((operation) => ({
|
|
6761
6811
|
key: operation.key,
|
|
6762
6812
|
label: operation.label || operation.key,
|
|
@@ -6870,7 +6920,7 @@ var ProcessTimeline = ({
|
|
|
6870
6920
|
var ProcessPreviewPanel = ProcessPreview;
|
|
6871
6921
|
|
|
6872
6922
|
// packages/sdk/src/runtime/react/openxiangdaProvider.tsx
|
|
6873
|
-
var
|
|
6923
|
+
var import_react19 = require("react");
|
|
6874
6924
|
|
|
6875
6925
|
// packages/sdk/src/runtime/core/fetch.ts
|
|
6876
6926
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -7095,7 +7145,7 @@ var createBrowserPageContext = (bootstrap, options = {}) => {
|
|
|
7095
7145
|
};
|
|
7096
7146
|
|
|
7097
7147
|
// packages/sdk/src/runtime/react/auth.tsx
|
|
7098
|
-
var
|
|
7148
|
+
var import_react18 = require("react");
|
|
7099
7149
|
var import_antd11 = require("antd");
|
|
7100
7150
|
var import_icons10 = require("@ant-design/icons");
|
|
7101
7151
|
|
|
@@ -7279,7 +7329,7 @@ var getCurrentHref2 = () => typeof window === "undefined" ? "" : window.location
|
|
|
7279
7329
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
7280
7330
|
var useAuth = (options = {}) => {
|
|
7281
7331
|
const runtime = useOpenXiangda();
|
|
7282
|
-
const client = (0,
|
|
7332
|
+
const client = (0, import_react18.useMemo)(
|
|
7283
7333
|
() => createAuthClient({
|
|
7284
7334
|
appType: options.appType || runtime.appType,
|
|
7285
7335
|
servicePrefix: options.servicePrefix || runtime.servicePrefix,
|
|
@@ -7294,7 +7344,7 @@ var useAuth = (options = {}) => {
|
|
|
7294
7344
|
runtime.servicePrefix
|
|
7295
7345
|
]
|
|
7296
7346
|
);
|
|
7297
|
-
return (0,
|
|
7347
|
+
return (0, import_react18.useMemo)(
|
|
7298
7348
|
() => ({
|
|
7299
7349
|
client,
|
|
7300
7350
|
getMethods: client.getMethods,
|
|
@@ -7314,12 +7364,12 @@ var useAuth = (options = {}) => {
|
|
|
7314
7364
|
};
|
|
7315
7365
|
var useLoginMethods = (options = {}) => {
|
|
7316
7366
|
const auth = useAuth(options);
|
|
7317
|
-
const [state, setState] = (0,
|
|
7367
|
+
const [state, setState] = (0, import_react18.useState)({
|
|
7318
7368
|
data: null,
|
|
7319
7369
|
loading: true,
|
|
7320
7370
|
error: null
|
|
7321
7371
|
});
|
|
7322
|
-
const reload = (0,
|
|
7372
|
+
const reload = (0, import_react18.useCallback)(async () => {
|
|
7323
7373
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
7324
7374
|
try {
|
|
7325
7375
|
const data = await auth.getMethods();
|
|
@@ -7332,7 +7382,7 @@ var useLoginMethods = (options = {}) => {
|
|
|
7332
7382
|
});
|
|
7333
7383
|
}
|
|
7334
7384
|
}, [auth]);
|
|
7335
|
-
(0,
|
|
7385
|
+
(0, import_react18.useEffect)(() => {
|
|
7336
7386
|
let disposed = false;
|
|
7337
7387
|
const run = async () => {
|
|
7338
7388
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
@@ -7376,17 +7426,17 @@ var LoginPage = ({
|
|
|
7376
7426
|
const methodsState = useLoginMethods(authOptions);
|
|
7377
7427
|
const [passwordForm] = import_antd11.Form.useForm();
|
|
7378
7428
|
const [phoneForm] = import_antd11.Form.useForm();
|
|
7379
|
-
const [activeMethod, setActiveMethod] = (0,
|
|
7429
|
+
const [activeMethod, setActiveMethod] = (0, import_react18.useState)(
|
|
7380
7430
|
defaultMethod || "password"
|
|
7381
7431
|
);
|
|
7382
|
-
const [phonePurpose, setPhonePurpose] = (0,
|
|
7432
|
+
const [phonePurpose, setPhonePurpose] = (0, import_react18.useState)(
|
|
7383
7433
|
"login"
|
|
7384
7434
|
);
|
|
7385
|
-
const [phoneChallengeId, setPhoneChallengeId] = (0,
|
|
7386
|
-
const [passwordChallenge, setPasswordChallenge] = (0,
|
|
7387
|
-
const [submitting, setSubmitting] = (0,
|
|
7388
|
-
const [sendingCode, setSendingCode] = (0,
|
|
7389
|
-
const [error, setError] = (0,
|
|
7435
|
+
const [phoneChallengeId, setPhoneChallengeId] = (0, import_react18.useState)("");
|
|
7436
|
+
const [passwordChallenge, setPasswordChallenge] = (0, import_react18.useState)(null);
|
|
7437
|
+
const [submitting, setSubmitting] = (0, import_react18.useState)(false);
|
|
7438
|
+
const [sendingCode, setSendingCode] = (0, import_react18.useState)(false);
|
|
7439
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
7390
7440
|
const methods = methodsState.methods.filter((method) => method.enabled !== false);
|
|
7391
7441
|
const passwordMethod = findMethod(methods, "password");
|
|
7392
7442
|
const phoneMethod = findMethod(methods, "phone_code");
|
|
@@ -7394,7 +7444,7 @@ var LoginPage = ({
|
|
|
7394
7444
|
const ssoMethod = findMethod(methods, "sso");
|
|
7395
7445
|
const guestMethod = findMethod(methods, "guest");
|
|
7396
7446
|
const allowRegister = methodsState.data?.registration?.mode !== "reject";
|
|
7397
|
-
const tabItems = (0,
|
|
7447
|
+
const tabItems = (0, import_react18.useMemo)(() => {
|
|
7398
7448
|
const items = [];
|
|
7399
7449
|
if (passwordMethod) {
|
|
7400
7450
|
items.push({
|
|
@@ -7513,7 +7563,7 @@ var LoginPage = ({
|
|
|
7513
7563
|
sendingCode,
|
|
7514
7564
|
submitting
|
|
7515
7565
|
]);
|
|
7516
|
-
(0,
|
|
7566
|
+
(0, import_react18.useEffect)(() => {
|
|
7517
7567
|
const firstKey = tabItems[0]?.key;
|
|
7518
7568
|
if (firstKey && !tabItems.some((item) => item.key === activeMethod)) {
|
|
7519
7569
|
setActiveMethod(firstKey);
|
|
@@ -7853,26 +7903,26 @@ var RuntimeHttpError = class extends Error {
|
|
|
7853
7903
|
this.payload = snapshot.payload;
|
|
7854
7904
|
}
|
|
7855
7905
|
};
|
|
7856
|
-
var OpenXiangdaRuntimeContext = (0,
|
|
7906
|
+
var OpenXiangdaRuntimeContext = (0, import_react19.createContext)(null);
|
|
7857
7907
|
var OpenXiangdaProvider = ({
|
|
7858
7908
|
appType,
|
|
7859
7909
|
servicePrefix = "/service",
|
|
7860
7910
|
fetchImpl,
|
|
7861
7911
|
children
|
|
7862
7912
|
}) => {
|
|
7863
|
-
const resolvedFetch = (0,
|
|
7864
|
-
const resolvedAppType = (0,
|
|
7913
|
+
const resolvedFetch = (0, import_react19.useMemo)(() => createBoundFetch(fetchImpl), [fetchImpl]);
|
|
7914
|
+
const resolvedAppType = (0, import_react19.useMemo)(
|
|
7865
7915
|
() => appType || resolveAppTypeFromLocation(),
|
|
7866
7916
|
[appType]
|
|
7867
7917
|
);
|
|
7868
|
-
const [, setAccessTokenState] = (0,
|
|
7869
|
-
const [authState, setAuthState] = (0,
|
|
7918
|
+
const [, setAccessTokenState] = (0, import_react19.useState)(null);
|
|
7919
|
+
const [authState, setAuthState] = (0, import_react19.useState)({
|
|
7870
7920
|
status: "unknown",
|
|
7871
7921
|
error: null
|
|
7872
7922
|
});
|
|
7873
|
-
const accessTokenRef = (0,
|
|
7874
|
-
const refreshRequestRef = (0,
|
|
7875
|
-
const applyAccessToken = (0,
|
|
7923
|
+
const accessTokenRef = (0, import_react19.useRef)(null);
|
|
7924
|
+
const refreshRequestRef = (0, import_react19.useRef)(null);
|
|
7925
|
+
const applyAccessToken = (0, import_react19.useCallback)(
|
|
7876
7926
|
(nextAccessToken, options = {}) => {
|
|
7877
7927
|
if (!nextAccessToken && options.clearIfToken && accessTokenRef.current?.token !== options.clearIfToken) {
|
|
7878
7928
|
return accessTokenRef.current;
|
|
@@ -7890,7 +7940,7 @@ var OpenXiangdaProvider = ({
|
|
|
7890
7940
|
},
|
|
7891
7941
|
[]
|
|
7892
7942
|
);
|
|
7893
|
-
const setAccessToken = (0,
|
|
7943
|
+
const setAccessToken = (0, import_react19.useCallback)(
|
|
7894
7944
|
(nextAccessToken, options = {}) => {
|
|
7895
7945
|
const previousState = accessTokenRef.current;
|
|
7896
7946
|
const nextState = applyAccessToken(nextAccessToken, options);
|
|
@@ -7906,7 +7956,7 @@ var OpenXiangdaProvider = ({
|
|
|
7906
7956
|
},
|
|
7907
7957
|
[applyAccessToken]
|
|
7908
7958
|
);
|
|
7909
|
-
const markUnauthenticated = (0,
|
|
7959
|
+
const markUnauthenticated = (0, import_react19.useCallback)(
|
|
7910
7960
|
(error) => {
|
|
7911
7961
|
const runtimeError = normalizeRuntimeError(error);
|
|
7912
7962
|
applyAccessToken(null);
|
|
@@ -7914,7 +7964,7 @@ var OpenXiangdaProvider = ({
|
|
|
7914
7964
|
},
|
|
7915
7965
|
[applyAccessToken]
|
|
7916
7966
|
);
|
|
7917
|
-
const refreshAccessToken = (0,
|
|
7967
|
+
const refreshAccessToken = (0, import_react19.useCallback)(async () => {
|
|
7918
7968
|
if (!resolvedAppType) return null;
|
|
7919
7969
|
if (!refreshRequestRef.current) {
|
|
7920
7970
|
setAuthState((prev) => ({ ...prev, status: "refreshing", error: null }));
|
|
@@ -7975,7 +8025,7 @@ var OpenXiangdaProvider = ({
|
|
|
7975
8025
|
}
|
|
7976
8026
|
return refreshRequestRef.current;
|
|
7977
8027
|
}, [applyAccessToken, resolvedAppType, resolvedFetch, servicePrefix]);
|
|
7978
|
-
const authorizedFetch = (0,
|
|
8028
|
+
const authorizedFetch = (0, import_react19.useMemo)(
|
|
7979
8029
|
() => createAuthorizedFetch({
|
|
7980
8030
|
appType: resolvedAppType,
|
|
7981
8031
|
baseFetch: resolvedFetch,
|
|
@@ -7985,18 +8035,18 @@ var OpenXiangdaProvider = ({
|
|
|
7985
8035
|
}),
|
|
7986
8036
|
[markUnauthenticated, refreshAccessToken, resolvedAppType, resolvedFetch]
|
|
7987
8037
|
);
|
|
7988
|
-
const getAuthHeaders = (0,
|
|
8038
|
+
const getAuthHeaders = (0, import_react19.useCallback)(() => {
|
|
7989
8039
|
const state2 = accessTokenRef.current;
|
|
7990
8040
|
if (!state2) return {};
|
|
7991
8041
|
const token = resolveAccessTokenForCurrentRoute(state2);
|
|
7992
8042
|
return token ? { authorization: `Bearer ${token}` } : {};
|
|
7993
8043
|
}, []);
|
|
7994
|
-
const [state, setState] = (0,
|
|
8044
|
+
const [state, setState] = (0, import_react19.useState)({
|
|
7995
8045
|
data: null,
|
|
7996
8046
|
loading: true,
|
|
7997
8047
|
error: null
|
|
7998
8048
|
});
|
|
7999
|
-
const reload = (0,
|
|
8049
|
+
const reload = (0, import_react19.useCallback)(async (options = {}) => {
|
|
8000
8050
|
if (!resolvedAppType) {
|
|
8001
8051
|
setState({
|
|
8002
8052
|
data: null,
|
|
@@ -8060,10 +8110,10 @@ var OpenXiangdaProvider = ({
|
|
|
8060
8110
|
}
|
|
8061
8111
|
}
|
|
8062
8112
|
}, [authorizedFetch, resolvedAppType, resolvedFetch, servicePrefix]);
|
|
8063
|
-
(0,
|
|
8113
|
+
(0, import_react19.useEffect)(() => {
|
|
8064
8114
|
void reload();
|
|
8065
8115
|
}, [reload]);
|
|
8066
|
-
const value = (0,
|
|
8116
|
+
const value = (0, import_react19.useMemo)(
|
|
8067
8117
|
() => ({
|
|
8068
8118
|
...state,
|
|
8069
8119
|
appType: resolvedAppType,
|
|
@@ -8089,7 +8139,7 @@ var OpenXiangdaProvider = ({
|
|
|
8089
8139
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OpenXiangdaRuntimeContext.Provider, { value, children });
|
|
8090
8140
|
};
|
|
8091
8141
|
var useOpenXiangda = () => {
|
|
8092
|
-
const context = (0,
|
|
8142
|
+
const context = (0, import_react19.useContext)(OpenXiangdaRuntimeContext);
|
|
8093
8143
|
if (!context) {
|
|
8094
8144
|
throw new Error("useOpenXiangda must be used inside OpenXiangdaProvider");
|
|
8095
8145
|
}
|
|
@@ -8106,7 +8156,7 @@ var OpenXiangdaPageProvider = ({
|
|
|
8106
8156
|
navigation
|
|
8107
8157
|
}) => {
|
|
8108
8158
|
const runtime = useOpenXiangda();
|
|
8109
|
-
const context = (0,
|
|
8159
|
+
const context = (0, import_react19.useMemo)(() => {
|
|
8110
8160
|
const bootstrap = runtime.data;
|
|
8111
8161
|
const app = toRuntimeRecord(bootstrap?.app);
|
|
8112
8162
|
const user = toRuntimeRecord(bootstrap?.user);
|
|
@@ -8204,12 +8254,12 @@ var usePermission = () => {
|
|
|
8204
8254
|
};
|
|
8205
8255
|
var useCanAccessRoute = (input) => {
|
|
8206
8256
|
const runtime = useOpenXiangda();
|
|
8207
|
-
const [state, setState] = (0,
|
|
8257
|
+
const [state, setState] = (0, import_react19.useState)({
|
|
8208
8258
|
data: null,
|
|
8209
8259
|
loading: true,
|
|
8210
8260
|
error: null
|
|
8211
8261
|
});
|
|
8212
|
-
(0,
|
|
8262
|
+
(0, import_react19.useEffect)(() => {
|
|
8213
8263
|
let disposed = false;
|
|
8214
8264
|
const check = async () => {
|
|
8215
8265
|
const permissions = runtime.data?.permissions;
|
|
@@ -8340,7 +8390,7 @@ var PermissionBoundary = ({
|
|
|
8340
8390
|
};
|
|
8341
8391
|
var useRuntimeAuth = () => {
|
|
8342
8392
|
const runtime = useOpenXiangda();
|
|
8343
|
-
const resolveLoginUrl2 = (0,
|
|
8393
|
+
const resolveLoginUrl2 = (0, import_react19.useCallback)(
|
|
8344
8394
|
async (options = {}) => {
|
|
8345
8395
|
const redirectUri = options.redirectUri || getCurrentHref4();
|
|
8346
8396
|
const domain = options.domain || getCurrentHostname2();
|
|
@@ -8387,7 +8437,7 @@ var useRuntimeAuth = () => {
|
|
|
8387
8437
|
},
|
|
8388
8438
|
[runtime.baseFetchImpl, runtime.data?.app, runtime.servicePrefix]
|
|
8389
8439
|
);
|
|
8390
|
-
const redirectToLogin = (0,
|
|
8440
|
+
const redirectToLogin = (0, import_react19.useCallback)(
|
|
8391
8441
|
async (options = {}) => {
|
|
8392
8442
|
const loginUrl = await resolveLoginUrl2(options);
|
|
8393
8443
|
if (typeof window !== "undefined") {
|
|
@@ -8401,7 +8451,7 @@ var useRuntimeAuth = () => {
|
|
|
8401
8451
|
},
|
|
8402
8452
|
[resolveLoginUrl2]
|
|
8403
8453
|
);
|
|
8404
|
-
const logout = (0,
|
|
8454
|
+
const logout = (0, import_react19.useCallback)(async () => {
|
|
8405
8455
|
const response = await runtime.baseFetchImpl(
|
|
8406
8456
|
buildServiceUrl2(runtime.servicePrefix, "/api/auth/logout"),
|
|
8407
8457
|
{
|
|
@@ -8421,7 +8471,7 @@ var useRuntimeAuth = () => {
|
|
|
8421
8471
|
runtime.setAccessToken(null);
|
|
8422
8472
|
return payload;
|
|
8423
8473
|
}, [runtime.baseFetchImpl, runtime.servicePrefix, runtime.setAccessToken]);
|
|
8424
|
-
const logoutAndRedirect = (0,
|
|
8474
|
+
const logoutAndRedirect = (0, import_react19.useCallback)(
|
|
8425
8475
|
async (options = {}) => {
|
|
8426
8476
|
try {
|
|
8427
8477
|
await logout();
|
|
@@ -8432,7 +8482,7 @@ var useRuntimeAuth = () => {
|
|
|
8432
8482
|
},
|
|
8433
8483
|
[logout, redirectToLogin]
|
|
8434
8484
|
);
|
|
8435
|
-
return (0,
|
|
8485
|
+
return (0, import_react19.useMemo)(
|
|
8436
8486
|
() => ({
|
|
8437
8487
|
logout,
|
|
8438
8488
|
logoutAndRedirect,
|
|
@@ -8451,7 +8501,7 @@ var RuntimeAuthGuard = ({
|
|
|
8451
8501
|
}) => {
|
|
8452
8502
|
const runtime = useOpenXiangda();
|
|
8453
8503
|
const auth = useRuntimeAuth();
|
|
8454
|
-
const redirectedRef = (0,
|
|
8504
|
+
const redirectedRef = (0, import_react19.useRef)(false);
|
|
8455
8505
|
const currentPath = getCurrentPathname();
|
|
8456
8506
|
const excluded = isRuntimeAuthGuardExcluded(
|
|
8457
8507
|
currentPath,
|
|
@@ -8459,7 +8509,7 @@ var RuntimeAuthGuard = ({
|
|
|
8459
8509
|
excludedPaths
|
|
8460
8510
|
);
|
|
8461
8511
|
const shouldRedirect = !disabled && !excluded && !runtime.loading && (runtime.authState.status === "unauthenticated" || runtime.error?.type === "unauthenticated");
|
|
8462
|
-
(0,
|
|
8512
|
+
(0, import_react19.useEffect)(() => {
|
|
8463
8513
|
if (!shouldRedirect || redirectedRef.current) return;
|
|
8464
8514
|
redirectedRef.current = true;
|
|
8465
8515
|
void auth.redirectToLogin({
|
|
@@ -8802,7 +8852,7 @@ var resolveAppTypeFromLocation = () => {
|
|
|
8802
8852
|
};
|
|
8803
8853
|
|
|
8804
8854
|
// packages/sdk/src/runtime/react/publicAccess.tsx
|
|
8805
|
-
var
|
|
8855
|
+
var import_react20 = require("react");
|
|
8806
8856
|
|
|
8807
8857
|
// packages/sdk/src/runtime/core/publicAccess.ts
|
|
8808
8858
|
var PublicAccessClientError = class extends Error {
|
|
@@ -8935,14 +8985,14 @@ var usePublicAccess = (options = {}) => {
|
|
|
8935
8985
|
autoStart = true,
|
|
8936
8986
|
...sessionInput
|
|
8937
8987
|
} = options;
|
|
8938
|
-
const [session, setSession] = (0,
|
|
8939
|
-
const [error, setError] = (0,
|
|
8940
|
-
const [loading, setLoading] = (0,
|
|
8941
|
-
const activeSessionRef = (0,
|
|
8942
|
-
const mountedRef = (0,
|
|
8988
|
+
const [session, setSession] = (0, import_react20.useState)(null);
|
|
8989
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
8990
|
+
const [loading, setLoading] = (0, import_react20.useState)(Boolean(autoStart));
|
|
8991
|
+
const activeSessionRef = (0, import_react20.useRef)(null);
|
|
8992
|
+
const mountedRef = (0, import_react20.useRef)(true);
|
|
8943
8993
|
const sessionInputKey = JSON.stringify(sessionInput);
|
|
8944
|
-
const stableSessionInput = (0,
|
|
8945
|
-
const client = (0,
|
|
8994
|
+
const stableSessionInput = (0, import_react20.useMemo)(() => sessionInput, [sessionInputKey]);
|
|
8995
|
+
const client = (0, import_react20.useMemo)(
|
|
8946
8996
|
() => createPublicAccessClient({
|
|
8947
8997
|
appType,
|
|
8948
8998
|
servicePrefix,
|
|
@@ -8950,7 +9000,7 @@ var usePublicAccess = (options = {}) => {
|
|
|
8950
9000
|
}),
|
|
8951
9001
|
[appType, fetchImpl, servicePrefix]
|
|
8952
9002
|
);
|
|
8953
|
-
const startSession = (0,
|
|
9003
|
+
const startSession = (0, import_react20.useCallback)(
|
|
8954
9004
|
async (input = {}) => {
|
|
8955
9005
|
setLoading(true);
|
|
8956
9006
|
setError(null);
|
|
@@ -8996,11 +9046,11 @@ var usePublicAccess = (options = {}) => {
|
|
|
8996
9046
|
},
|
|
8997
9047
|
[client, reloadRuntime, setAccessToken, stableSessionInput]
|
|
8998
9048
|
);
|
|
8999
|
-
(0,
|
|
9049
|
+
(0, import_react20.useEffect)(() => {
|
|
9000
9050
|
if (!autoStart) return;
|
|
9001
9051
|
void startSession().catch(() => void 0);
|
|
9002
9052
|
}, [autoStart, startSession]);
|
|
9003
|
-
(0,
|
|
9053
|
+
(0, import_react20.useEffect)(
|
|
9004
9054
|
() => {
|
|
9005
9055
|
mountedRef.current = true;
|
|
9006
9056
|
return () => {
|