@sparkelf/dsh-dataops-managed 0.3.23 → 0.3.25

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/lib/client.js CHANGED
@@ -747,22 +747,22 @@ window.__ModuleLoader__.load({
747
747
  document.head.appendChild(tag);
748
748
  }
749
749
  var ManagedDataOpsSection_module_css_default = {
750
- "actions": "_2dqzjG_actions",
751
- "refusal": "_2dqzjG_refusal",
752
750
  "reviewRow": "_2dqzjG_reviewRow",
751
+ "section": "_2dqzjG_section",
752
+ "status": "_2dqzjG_status",
753
+ "copy": "_2dqzjG_copy",
754
+ "actions": "_2dqzjG_actions",
753
755
  "reviewActions": "_2dqzjG_reviewActions",
754
- "row": "_2dqzjG_row",
755
756
  "heading": "_2dqzjG_heading",
756
- "meta": "_2dqzjG_meta",
757
+ "label": "_2dqzjG_label",
758
+ "row": "_2dqzjG_row",
759
+ "reviewHint": "_2dqzjG_reviewHint",
760
+ "refusal": "_2dqzjG_refusal",
757
761
  "title": "_2dqzjG_title",
758
- "copy": "_2dqzjG_copy",
759
- "section": "_2dqzjG_section",
760
- "status": "_2dqzjG_status",
761
762
  "card": "_2dqzjG_card",
762
- "reviewHint": "_2dqzjG_reviewHint",
763
763
  "reviewRows": "_2dqzjG_reviewRows",
764
- "label": "_2dqzjG_label",
765
- "fields": "_2dqzjG_fields"
764
+ "fields": "_2dqzjG_fields",
765
+ "meta": "_2dqzjG_meta"
766
766
  };
767
767
  //#endregion
768
768
  //#region src/client/ReviewSettingsCard.tsx
@@ -1617,24 +1617,24 @@ window.__ModuleLoader__.load({
1617
1617
  document.head.appendChild(tag);
1618
1618
  }
1619
1619
  var NotificationBell_module_css_default = {
1620
- "list": "tE0trG_list",
1621
- "empty": "tE0trG_empty",
1622
- "dialog": "tE0trG_dialog",
1623
- "dot": "tE0trG_dot",
1624
- "rowBody": "tE0trG_rowBody",
1625
1620
  "bell": "tE0trG_bell",
1626
- "rowText": "tE0trG_rowText",
1621
+ "linkButton": "tE0trG_linkButton",
1622
+ "button": "tE0trG_button",
1623
+ "dialog": "tE0trG_dialog",
1627
1624
  "rowTime": "tE0trG_rowTime",
1628
- "pager": "tE0trG_pager",
1629
- "actions": "tE0trG_actions",
1630
- "rowTitle": "tE0trG_rowTitle",
1625
+ "empty": "tE0trG_empty",
1626
+ "badge": "tE0trG_badge",
1631
1627
  "demo": "tE0trG_demo",
1632
- "linkButton": "tE0trG_linkButton",
1628
+ "rowBody": "tE0trG_rowBody",
1629
+ "list": "tE0trG_list",
1630
+ "rowIcon": "tE0trG_rowIcon",
1633
1631
  "rowMeta": "tE0trG_rowMeta",
1632
+ "actions": "tE0trG_actions",
1633
+ "rowText": "tE0trG_rowText",
1634
+ "rowTitle": "tE0trG_rowTitle",
1635
+ "dot": "tE0trG_dot",
1634
1636
  "row": "tE0trG_row",
1635
- "rowIcon": "tE0trG_rowIcon",
1636
- "button": "tE0trG_button",
1637
- "badge": "tE0trG_badge"
1637
+ "pager": "tE0trG_pager"
1638
1638
  };
1639
1639
  //#endregion
1640
1640
  //#region src/client/NotificationBell.tsx
@@ -1925,62 +1925,62 @@ window.__ModuleLoader__.load({
1925
1925
  document.head.appendChild(tag);
1926
1926
  }
1927
1927
  var SkillPlazaSection_module_css_default = {
1928
- "titleCount": "_9FdZvq_titleCount",
1929
- "auditDialog": "_9FdZvq_auditDialog",
1930
- "sharedTag": "_9FdZvq_sharedTag",
1931
- "section": "_9FdZvq_section",
1932
- "detailValue": "_9FdZvq_detailValue",
1933
- "tabActive": "_9FdZvq_tabActive",
1934
- "pendingTag": "_9FdZvq_pendingTag",
1935
- "tab": "_9FdZvq_tab",
1936
- "audit": "_9FdZvq_audit",
1937
- "headRow": "_9FdZvq_headRow",
1938
- "head": "_9FdZvq_head",
1939
- "auditFooter": "_9FdZvq_auditFooter",
1940
- "detailRow": "_9FdZvq_detailRow",
1941
- "title": "_9FdZvq_title",
1942
- "cardTop": "_9FdZvq_cardTop",
1943
1928
  "detailLabel": "_9FdZvq_detailLabel",
1944
- "emptyText": "_9FdZvq_emptyText",
1945
- "risk": "_9FdZvq_risk",
1946
- "riskEmpty": "_9FdZvq_riskEmpty",
1947
- "riskFailed": "_9FdZvq_riskFailed",
1948
- "findings": "_9FdZvq_findings",
1929
+ "tabActive": "_9FdZvq_tabActive",
1930
+ "noteField": "_9FdZvq_noteField",
1949
1931
  "cardEnd": "_9FdZvq_cardEnd",
1950
- "riskSummary": "_9FdZvq_riskSummary",
1932
+ "titleCount": "_9FdZvq_titleCount",
1933
+ "empty": "_9FdZvq_empty",
1934
+ "tagTop": "_9FdZvq_tagTop",
1935
+ "notice": "_9FdZvq_notice",
1936
+ "emptyText": "_9FdZvq_emptyText",
1937
+ "demoTag": "_9FdZvq_demoTag",
1951
1938
  "severity": "_9FdZvq_severity",
1952
- "findingText": "_9FdZvq_findingText",
1953
- "riskScore": "_9FdZvq_riskScore",
1954
- "reviewError": "_9FdZvq_reviewError",
1955
- "departmentLabel": "_9FdZvq_departmentLabel",
1939
+ "mine": "_9FdZvq_mine",
1940
+ "rejectedTag": "_9FdZvq_rejectedTag",
1941
+ "detailButton": "_9FdZvq_detailButton",
1942
+ "cardTop": "_9FdZvq_cardTop",
1943
+ "cardIcon": "_9FdZvq_cardIcon",
1944
+ "cardDesc": "_9FdZvq_cardDesc",
1945
+ "detailRow": "_9FdZvq_detailRow",
1946
+ "emptyIcon": "_9FdZvq_emptyIcon",
1947
+ "status": "_9FdZvq_status",
1948
+ "cards": "_9FdZvq_cards",
1949
+ "sharedTag": "_9FdZvq_sharedTag",
1950
+ "risk": "_9FdZvq_risk",
1956
1951
  "riskHead": "_9FdZvq_riskHead",
1952
+ "headRow": "_9FdZvq_headRow",
1953
+ "detail": "_9FdZvq_detail",
1954
+ "tabs": "_9FdZvq_tabs",
1955
+ "reviewButton": "_9FdZvq_reviewButton",
1956
+ "tabCount": "_9FdZvq_tabCount",
1957
1957
  "card": "_9FdZvq_card",
1958
+ "reviewNote": "_9FdZvq_reviewNote",
1959
+ "riskScore": "_9FdZvq_riskScore",
1960
+ "riskSummary": "_9FdZvq_riskSummary",
1958
1961
  "finding": "_9FdZvq_finding",
1959
- "empty": "_9FdZvq_empty",
1960
- "mine": "_9FdZvq_mine",
1962
+ "cardTitle": "_9FdZvq_cardTitle",
1963
+ "findingText": "_9FdZvq_findingText",
1964
+ "riskEmpty": "_9FdZvq_riskEmpty",
1965
+ "section": "_9FdZvq_section",
1966
+ "departmentLabel": "_9FdZvq_departmentLabel",
1967
+ "auditFooter": "_9FdZvq_auditFooter",
1968
+ "pendingTag": "_9FdZvq_pendingTag",
1961
1969
  "departmentSelect": "_9FdZvq_departmentSelect",
1970
+ "riskFailed": "_9FdZvq_riskFailed",
1962
1971
  "findingHint": "_9FdZvq_findingHint",
1963
- "noteField": "_9FdZvq_noteField",
1964
- "emptyIcon": "_9FdZvq_emptyIcon",
1965
- "cardDesc": "_9FdZvq_cardDesc",
1966
- "cardMarks": "_9FdZvq_cardMarks",
1967
- "detailButton": "_9FdZvq_detailButton",
1968
- "tagTop": "_9FdZvq_tagTop",
1969
- "demoTag": "_9FdZvq_demoTag",
1970
- "notice": "_9FdZvq_notice",
1971
- "status": "_9FdZvq_status",
1972
- "cardTitle": "_9FdZvq_cardTitle",
1973
- "tabs": "_9FdZvq_tabs",
1974
- "detail": "_9FdZvq_detail",
1975
- "cards": "_9FdZvq_cards",
1976
- "dialog": "_9FdZvq_dialog",
1972
+ "detailValue": "_9FdZvq_detailValue",
1977
1973
  "mark": "_9FdZvq_mark",
1978
- "cardIcon": "_9FdZvq_cardIcon",
1974
+ "reviewError": "_9FdZvq_reviewError",
1975
+ "dialog": "_9FdZvq_dialog",
1976
+ "findings": "_9FdZvq_findings",
1977
+ "head": "_9FdZvq_head",
1978
+ "audit": "_9FdZvq_audit",
1979
+ "auditDialog": "_9FdZvq_auditDialog",
1980
+ "cardMarks": "_9FdZvq_cardMarks",
1979
1981
  "departmentBar": "_9FdZvq_departmentBar",
1980
- "tabCount": "_9FdZvq_tabCount",
1981
- "rejectedTag": "_9FdZvq_rejectedTag",
1982
- "reviewButton": "_9FdZvq_reviewButton",
1983
- "reviewNote": "_9FdZvq_reviewNote"
1982
+ "title": "_9FdZvq_title",
1983
+ "tab": "_9FdZvq_tab"
1984
1984
  };
1985
1985
  //#endregion
1986
1986
  //#region src/client/SkillPlazaSection.tsx
@@ -2645,19 +2645,19 @@ window.__ModuleLoader__.load({
2645
2645
  document.head.appendChild(tag);
2646
2646
  }
2647
2647
  var WanxiangBrand_module_css_default = {
2648
- "mark": "s0HPxG_mark",
2648
+ "unit-core": "s0HPxG_unit-core",
2649
2649
  "unit-left": "s0HPxG_unit-left",
2650
- "harness": "s0HPxG_harness",
2651
- "unitTop": "s0HPxG_unitTop",
2650
+ "unitRight": "s0HPxG_unitRight",
2652
2651
  "sidebarName": "s0HPxG_sidebarName",
2653
- "wordmark": "s0HPxG_wordmark",
2654
- "unitLeft": "s0HPxG_unitLeft",
2652
+ "unitTop": "s0HPxG_unitTop",
2653
+ "animatedMark": "s0HPxG_animatedMark",
2655
2654
  "unitCore": "s0HPxG_unitCore",
2656
- "unitRight": "s0HPxG_unitRight",
2655
+ "mark": "s0HPxG_mark",
2656
+ "wordmark": "s0HPxG_wordmark",
2657
+ "harness": "s0HPxG_harness",
2657
2658
  "unit-top": "s0HPxG_unit-top",
2658
2659
  "unit-right": "s0HPxG_unit-right",
2659
- "unit-core": "s0HPxG_unit-core",
2660
- "animatedMark": "s0HPxG_animatedMark"
2660
+ "unitLeft": "s0HPxG_unitLeft"
2661
2661
  };
2662
2662
  //#endregion
2663
2663
  //#region src/client/WanxiangBrand.tsx
@@ -3074,72 +3074,72 @@ window.__ModuleLoader__.load({
3074
3074
  document.head.appendChild(tag);
3075
3075
  }
3076
3076
  var PermissionCenterSection_module_css_default = {
3077
- "candidates": "PNbOqW_candidates",
3077
+ "search": "PNbOqW_search",
3078
+ "adminTag": "PNbOqW_adminTag",
3079
+ "treeActions": "PNbOqW_treeActions",
3080
+ "panel": "PNbOqW_panel",
3081
+ "matrix": "PNbOqW_matrix",
3082
+ "comboboxSearch": "PNbOqW_comboboxSearch",
3083
+ "comboboxHint": "PNbOqW_comboboxHint",
3084
+ "page": "PNbOqW_page",
3078
3085
  "waiting": "PNbOqW_waiting",
3079
- "onlyAdmin": "PNbOqW_onlyAdmin",
3086
+ "field": "PNbOqW_field",
3087
+ "title": "PNbOqW_title",
3088
+ "demo": "PNbOqW_demo",
3089
+ "protected": "PNbOqW_protected",
3090
+ "candidate": "PNbOqW_candidate",
3091
+ "notice": "PNbOqW_notice",
3092
+ "matrixModule": "PNbOqW_matrixModule",
3080
3093
  "comboboxList": "PNbOqW_comboboxList",
3081
- "matrixPermission": "PNbOqW_matrixPermission",
3082
- "comboboxOption": "PNbOqW_comboboxOption",
3094
+ "tableScroll": "PNbOqW_tableScroll",
3095
+ "table": "PNbOqW_table",
3096
+ "muted": "PNbOqW_muted",
3083
3097
  "departments": "PNbOqW_departments",
3084
- "permCopy": "PNbOqW_permCopy",
3085
- "tab": "PNbOqW_tab",
3086
- "treeName": "PNbOqW_treeName",
3098
+ "comboboxTrigger": "PNbOqW_comboboxTrigger",
3087
3099
  "treeRow": "PNbOqW_treeRow",
3088
- "combobox": "PNbOqW_combobox",
3100
+ "subtitle": "PNbOqW_subtitle",
3101
+ "treeRoot": "PNbOqW_treeRoot",
3089
3102
  "sectionTitle": "PNbOqW_sectionTitle",
3090
- "scopeBadge": "PNbOqW_scopeBadge",
3091
- "comboboxPlaceholder": "PNbOqW_comboboxPlaceholder",
3092
- "table": "PNbOqW_table",
3103
+ "permDescription": "PNbOqW_permDescription",
3093
3104
  "dialogHint": "PNbOqW_dialogHint",
3094
3105
  "rowActions": "PNbOqW_rowActions",
3095
- "matrixModule": "PNbOqW_matrixModule",
3096
- "panel": "PNbOqW_panel",
3097
- "department": "PNbOqW_department",
3098
- "matrix": "PNbOqW_matrix",
3106
+ "panelHead": "PNbOqW_panelHead",
3107
+ "treeSpacer": "PNbOqW_treeSpacer",
3108
+ "permCopy": "PNbOqW_permCopy",
3099
3109
  "tabActive": "PNbOqW_tabActive",
3100
- "notice": "PNbOqW_notice",
3101
- "dialogBody": "PNbOqW_dialogBody",
3102
- "dialog": "PNbOqW_dialog",
3103
- "subtitle": "PNbOqW_subtitle",
3104
- "comboboxEmpty": "PNbOqW_comboboxEmpty",
3105
- "detailGrid": "PNbOqW_detailGrid",
3106
- "copied": "PNbOqW_copied",
3107
- "adminTag": "PNbOqW_adminTag",
3108
- "treeChildren": "PNbOqW_treeChildren",
3110
+ "onlyAdmin": "PNbOqW_onlyAdmin",
3109
3111
  "matrixNote": "PNbOqW_matrixNote",
3110
- "panelHead": "PNbOqW_panelHead",
3112
+ "dialogBody": "PNbOqW_dialogBody",
3111
3113
  "treeToggle": "PNbOqW_treeToggle",
3112
- "empty": "PNbOqW_empty",
3113
- "comboboxCheck": "PNbOqW_comboboxCheck",
3114
- "muted": "PNbOqW_muted",
3115
- "page": "PNbOqW_page",
3116
- "matrixGroup": "PNbOqW_matrixGroup",
3117
- "tableScroll": "PNbOqW_tableScroll",
3118
- "treeRoot": "PNbOqW_treeRoot",
3114
+ "matrixScroll": "PNbOqW_matrixScroll",
3119
3115
  "comboboxOptionActive": "PNbOqW_comboboxOptionActive",
3116
+ "head": "PNbOqW_head",
3117
+ "dialogFooter": "PNbOqW_dialogFooter",
3118
+ "matrixGroup": "PNbOqW_matrixGroup",
3119
+ "comboboxEmpty": "PNbOqW_comboboxEmpty",
3120
+ "panelFoot": "PNbOqW_panelFoot",
3121
+ "treeChildren": "PNbOqW_treeChildren",
3120
3122
  "comboboxMenu": "PNbOqW_comboboxMenu",
3121
- "field": "PNbOqW_field",
3122
- "comboboxSearch": "PNbOqW_comboboxSearch",
3123
+ "comboboxCheck": "PNbOqW_comboboxCheck",
3123
3124
  "tabs": "PNbOqW_tabs",
3124
- "demo": "PNbOqW_demo",
3125
- "panelFoot": "PNbOqW_panelFoot",
3125
+ "combobox": "PNbOqW_combobox",
3126
+ "tab": "PNbOqW_tab",
3127
+ "empty": "PNbOqW_empty",
3128
+ "deptAdmins": "PNbOqW_deptAdmins",
3129
+ "matrixPermission": "PNbOqW_matrixPermission",
3126
3130
  "pager": "PNbOqW_pager",
3127
- "protected": "PNbOqW_protected",
3131
+ "detailGrid": "PNbOqW_detailGrid",
3128
3132
  "permission": "PNbOqW_permission",
3129
- "title": "PNbOqW_title",
3130
- "treeActions": "PNbOqW_treeActions",
3131
- "error": "PNbOqW_error",
3132
- "deptAdmins": "PNbOqW_deptAdmins",
3133
- "comboboxHint": "PNbOqW_comboboxHint",
3134
- "candidate": "PNbOqW_candidate",
3135
- "search": "PNbOqW_search",
3133
+ "copied": "PNbOqW_copied",
3136
3134
  "readOnly": "PNbOqW_readOnly",
3137
- "permDescription": "PNbOqW_permDescription",
3138
- "matrixScroll": "PNbOqW_matrixScroll",
3139
- "comboboxTrigger": "PNbOqW_comboboxTrigger",
3140
- "dialogFooter": "PNbOqW_dialogFooter",
3141
- "head": "PNbOqW_head",
3142
- "treeSpacer": "PNbOqW_treeSpacer"
3135
+ "comboboxOption": "PNbOqW_comboboxOption",
3136
+ "candidates": "PNbOqW_candidates",
3137
+ "department": "PNbOqW_department",
3138
+ "comboboxPlaceholder": "PNbOqW_comboboxPlaceholder",
3139
+ "scopeBadge": "PNbOqW_scopeBadge",
3140
+ "dialog": "PNbOqW_dialog",
3141
+ "treeName": "PNbOqW_treeName",
3142
+ "error": "PNbOqW_error"
3143
3143
  };
3144
3144
  //#endregion
3145
3145
  //#region src/client/combobox.ts
@@ -4568,18 +4568,18 @@ window.__ModuleLoader__.load({
4568
4568
  document.head.appendChild(tag);
4569
4569
  }
4570
4570
  var WorkspaceUpgradePrompt_module_css_default = {
4571
+ "sessionRow": "razUfG_sessionRow",
4572
+ "error": "razUfG_error",
4573
+ "title": "razUfG_title",
4574
+ "body": "razUfG_body",
4571
4575
  "dialogText": "razUfG_dialogText",
4576
+ "dialogBody": "razUfG_dialogBody",
4572
4577
  "banner": "razUfG_banner",
4573
- "body": "razUfG_body",
4574
- "copy": "razUfG_copy",
4578
+ "actions": "razUfG_actions",
4575
4579
  "sessionPath": "razUfG_sessionPath",
4576
- "title": "razUfG_title",
4577
- "sessionRow": "razUfG_sessionRow",
4578
- "sessionTitle": "razUfG_sessionTitle",
4579
- "dialogBody": "razUfG_dialogBody",
4580
+ "copy": "razUfG_copy",
4580
4581
  "sessionList": "razUfG_sessionList",
4581
- "error": "razUfG_error",
4582
- "actions": "razUfG_actions"
4582
+ "sessionTitle": "razUfG_sessionTitle"
4583
4583
  };
4584
4584
  //#endregion
4585
4585
  //#region src/client/WorkspaceUpgradePrompt.tsx
@@ -4755,6 +4755,270 @@ window.__ModuleLoader__.load({
4755
4755
  })] });
4756
4756
  }
4757
4757
  //#endregion
4758
+ //#region src/client/DataOpsResourcesTab.tsx
4759
+ /**
4760
+ * The custom `dataops-resources` sidebar tab.
4761
+ *
4762
+ * It renders the DataOps embed page in a same-origin iframe. The iframe is deliberately not
4763
+ * a generic URL tab: the generic tab sandbox is an opaque origin and cannot use the portal's
4764
+ * sessionStorage. The only parent-child messages are navigation and "add to conversation";
4765
+ * every authorization decision still happens in DataOps.
4766
+ *
4767
+ * @module client/DataOpsResourcesTab
4768
+ */
4769
+ const readMeta = (value) => {
4770
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
4771
+ const record = value;
4772
+ return {
4773
+ resourceId: typeof record.resourceId === "number" && Number.isSafeInteger(record.resourceId) ? record.resourceId : void 0,
4774
+ resourceName: typeof record.resourceName === "string" ? record.resourceName : void 0,
4775
+ mode: typeof record.mode === "string" ? record.mode : void 0,
4776
+ nonce: typeof record.nonce === "string" ? record.nonce : void 0
4777
+ };
4778
+ };
4779
+ const buildEmbedUrl = (config, meta) => {
4780
+ const base = config.embedBaseUrl.replace(/\/+$/u, "");
4781
+ const params = new URLSearchParams();
4782
+ if (meta.resourceId !== void 0) params.set("resourceId", String(meta.resourceId));
4783
+ if (meta.mode === "detail" || meta.mode === "audit") {
4784
+ params.set("tab", meta.mode === "audit" ? "audit" : "overview");
4785
+ const suffix = params.toString();
4786
+ return `${base}/embed/resource-detail${suffix ? "?" + suffix : ""}`;
4787
+ }
4788
+ params.set("mode", meta.mode ?? "focus");
4789
+ if (meta.nonce) params.set("nonce", meta.nonce);
4790
+ const suffix = params.toString();
4791
+ return `${base}/embed/resources${suffix ? "?" + suffix : ""}`;
4792
+ };
4793
+ const frameStyle = {
4794
+ width: "100%",
4795
+ height: "100%",
4796
+ border: "0",
4797
+ display: "block",
4798
+ background: "var(--dsh-sidebar-bg, #f6f7f9)"
4799
+ };
4800
+ const stateStyle = {
4801
+ padding: "24px 16px",
4802
+ fontSize: "12px",
4803
+ color: "var(--dsh-text-secondary, #6b7280)",
4804
+ textAlign: "center"
4805
+ };
4806
+ const noticeStyle = {
4807
+ margin: "0 10px 8px",
4808
+ padding: "7px 10px",
4809
+ borderRadius: "7px",
4810
+ background: "rgba(22, 163, 74, 0.10)",
4811
+ color: "#15803d",
4812
+ fontSize: "11px"
4813
+ };
4814
+ /** Render the embedded DataOps resource page and translate its parent messages. */
4815
+ function DataOpsResourcesTab({ ctx, tab }) {
4816
+ const [config, setConfig] = (0, react.useState)(null);
4817
+ const [error, setError] = (0, react.useState)("");
4818
+ const [loading, setLoading] = (0, react.useState)(true);
4819
+ const [notice, setNotice] = (0, react.useState)("");
4820
+ const [reloadKey, setReloadKey] = (0, react.useState)(0);
4821
+ const iframeRef = (0, react.useRef)(null);
4822
+ const meta = readMeta(tab.meta);
4823
+ const src = (0, react.useMemo)(() => config === null ? "" : buildEmbedUrl(config, meta), [
4824
+ config,
4825
+ meta.resourceId,
4826
+ meta.mode,
4827
+ meta.nonce,
4828
+ reloadKey
4829
+ ]);
4830
+ (0, react.useEffect)(() => {
4831
+ let live = true;
4832
+ const load = async () => {
4833
+ try {
4834
+ const response = await fetch("/integrations/dataops/resource-tab/config", { cache: "no-store" });
4835
+ if (!response.ok) throw new Error("HTTP " + response.status.toString());
4836
+ const body = await response.json();
4837
+ if (!live) return;
4838
+ setConfig({
4839
+ embedBaseUrl: body.embedBaseUrl,
4840
+ sameOrigin: body.sameOrigin === true,
4841
+ tabType: body.tabType
4842
+ });
4843
+ } catch (loadError) {
4844
+ if (!live) return;
4845
+ setError("资源页配置加载失败:" + (loadError instanceof Error ? loadError.message : String(loadError)));
4846
+ }
4847
+ };
4848
+ load();
4849
+ return () => {
4850
+ live = false;
4851
+ };
4852
+ }, []);
4853
+ (0, react.useEffect)(() => {
4854
+ setLoading(true);
4855
+ }, [src, reloadKey]);
4856
+ (0, react.useEffect)(() => {
4857
+ if (config === null) return void 0;
4858
+ let expectedOrigin = "";
4859
+ try {
4860
+ expectedOrigin = new URL(config.embedBaseUrl).origin;
4861
+ } catch {
4862
+ expectedOrigin = "";
4863
+ }
4864
+ const onMessage = (event) => {
4865
+ if (expectedOrigin && event.origin !== expectedOrigin) return;
4866
+ const payload = event.data;
4867
+ if (payload?.type !== "dataops:add-to-conversation") return;
4868
+ const reference = payload.reference ?? {
4869
+ kind: "dataops-resource",
4870
+ resourceId: payload.resource?.id,
4871
+ name: payload.resource?.name,
4872
+ table: payload.resource?.table
4873
+ };
4874
+ const conversation = ctx?.conversation;
4875
+ if (conversation?.send === void 0) {
4876
+ setNotice("当前会话不可用,无法把资源加入对话");
4877
+ return;
4878
+ }
4879
+ const text = "引用数据资源:\n\n```resource-ref\n" + JSON.stringify(reference, null, 2) + "\n```\n";
4880
+ conversation.send(text).then(() => setNotice("已把资源加入当前对话")).catch((sendError) => setNotice("加入对话失败:" + (sendError instanceof Error ? sendError.message : String(sendError))));
4881
+ };
4882
+ window.addEventListener("message", onMessage);
4883
+ return () => window.removeEventListener("message", onMessage);
4884
+ }, [config, ctx]);
4885
+ (0, react.useEffect)(() => {
4886
+ if (!notice) return void 0;
4887
+ const timer = window.setTimeout(() => setNotice(""), 2400);
4888
+ return () => window.clearTimeout(timer);
4889
+ }, [notice]);
4890
+ if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4891
+ style: stateStyle,
4892
+ role: "alert",
4893
+ children: [error, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4894
+ style: { marginTop: 10 },
4895
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4896
+ type: "button",
4897
+ onClick: () => setReloadKey((value) => value + 1),
4898
+ children: "重试"
4899
+ })
4900
+ })]
4901
+ });
4902
+ if (config === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4903
+ style: stateStyle,
4904
+ role: "status",
4905
+ children: "正在准备数据资源页…"
4906
+ });
4907
+ let topOrigin = "";
4908
+ try {
4909
+ topOrigin = window.top?.location.origin ?? "";
4910
+ } catch {
4911
+ topOrigin = "";
4912
+ }
4913
+ let embedOrigin = "";
4914
+ try {
4915
+ embedOrigin = new URL(config.embedBaseUrl).origin;
4916
+ } catch {
4917
+ embedOrigin = "";
4918
+ }
4919
+ const frameIsSameOrigin = config.sameOrigin === true || topOrigin !== "" && topOrigin === embedOrigin;
4920
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4921
+ style: {
4922
+ display: "flex",
4923
+ flexDirection: "column",
4924
+ height: "100%",
4925
+ minHeight: 0
4926
+ },
4927
+ children: [
4928
+ notice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4929
+ style: noticeStyle,
4930
+ role: "status",
4931
+ children: notice
4932
+ }) : null,
4933
+ !frameIsSameOrigin ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4934
+ style: {
4935
+ ...stateStyle,
4936
+ paddingBottom: 6
4937
+ },
4938
+ children: "当前部署不是同源代理,资源页可能无法复用门户登录态。"
4939
+ }) : null,
4940
+ loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4941
+ style: stateStyle,
4942
+ role: "status",
4943
+ children: "正在加载数据资源页…"
4944
+ }) : null,
4945
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
4946
+ ref: iframeRef,
4947
+ src,
4948
+ title: meta.resourceName ? `${meta.resourceName} · 数据资源` : "数据资源",
4949
+ sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-downloads",
4950
+ referrerPolicy: "no-referrer",
4951
+ style: {
4952
+ ...frameStyle,
4953
+ display: loading ? "none" : "block"
4954
+ },
4955
+ onLoad: () => setLoading(false),
4956
+ onError: () => {
4957
+ setLoading(false);
4958
+ setError("数据资源页加载失败");
4959
+ }
4960
+ }, `${src}:${reloadKey}`)
4961
+ ]
4962
+ });
4963
+ }
4964
+ //#endregion
4965
+ //#region src/client/OpenResourceBridge.tsx
4966
+ /**
4967
+ * Always-mounted host→client bridge for the resource tab.
4968
+ *
4969
+ * The Host tool cannot call the browser's tab API. It broadcasts one SSE event; this
4970
+ * component translates that event into `betterSidebar.openTab` plus `updateTab` so a
4971
+ * second import focuses the existing tab and refreshes its target resource.
4972
+ *
4973
+ * @module client/OpenResourceBridge
4974
+ */
4975
+ /** Tab id shared with the client registration. */
4976
+ const RESOURCE_TAB_TYPE = "dataops-resources";
4977
+ const EVENTS_PATH = "/integrations/dataops/open-resource/events";
4978
+ const isOpenResourceEvent = (value) => {
4979
+ if (typeof value !== "object" || value === null) return false;
4980
+ const record = value;
4981
+ return record.type === "open_resource" && typeof record.resourceId === "number" && Number.isSafeInteger(record.resourceId) && (record.mode === "focus" || record.mode === "grant" || record.mode === "detail" || record.mode === "audit");
4982
+ };
4983
+ /** Invisible bridge component; renders nothing. */
4984
+ function OpenResourceBridge({ service, scope }) {
4985
+ (0, react.useEffect)(() => {
4986
+ if (typeof EventSource !== "function") return void 0;
4987
+ const source = new EventSource(EVENTS_PATH);
4988
+ const onEvent = (event) => {
4989
+ let parsed;
4990
+ try {
4991
+ parsed = JSON.parse(String(event.data));
4992
+ } catch {
4993
+ return;
4994
+ }
4995
+ if (!isOpenResourceEvent(parsed)) return;
4996
+ const meta = {
4997
+ resourceId: parsed.resourceId,
4998
+ resourceName: parsed.resourceName,
4999
+ mode: parsed.mode,
5000
+ nonce: parsed.nonce
5001
+ };
5002
+ service.openTab({
5003
+ type: RESOURCE_TAB_TYPE,
5004
+ id: RESOURCE_TAB_TYPE,
5005
+ title: "数据资源",
5006
+ meta
5007
+ }, scope);
5008
+ service.updateTab?.(RESOURCE_TAB_TYPE, {
5009
+ title: "数据资源",
5010
+ meta
5011
+ }, scope?.sessionId);
5012
+ };
5013
+ source.addEventListener("dataops-open-resource", onEvent);
5014
+ return () => {
5015
+ source.removeEventListener("dataops-open-resource", onEvent);
5016
+ source.close();
5017
+ };
5018
+ }, [service, scope]);
5019
+ return null;
5020
+ }
5021
+ //#endregion
4758
5022
  //#region src/client/locales.ts
4759
5023
  /** English managed DataOps Settings copy. */
4760
5024
  const en = {
@@ -5057,8 +5321,12 @@ window.__ModuleLoader__.load({
5057
5321
  const MANAGED_AUTH_PATH = "/integrations/dataops/managed-auth";
5058
5322
  /** Sidebar entry and main page id for the permission centre. */
5059
5323
  const PERMISSION_PANEL_ID = "dataops-permissions";
5060
- /** Required client services for the managed DataOps Settings section. */
5061
- const inject = ["slots", "locale"];
5324
+ /** Required client services for the managed DataOps Settings section and the resource tab bridge. */
5325
+ const inject = [
5326
+ "slots",
5327
+ "locale",
5328
+ "conversation"
5329
+ ];
5062
5330
  /**
5063
5331
  * Bind the four strings the sign-in prompt needs.
5064
5332
  *
@@ -5214,6 +5482,44 @@ window.__ModuleLoader__.load({
5214
5482
  * rather than importing this plugin; the bell therefore joins only when both are installed.
5215
5483
  */
5216
5484
  ctx.slots.inject("workflow-plaza.actions", () => ctx.slots.register({ name: "workflow-plaza.actions" }, WorkflowPlazaBell));
5485
+ /**
5486
+ * The custom DataOps resource tab and the host→client opening bridge.
5487
+ *
5488
+ * Both are optional on the Better Sidebar service: a profile without it keeps the rest of
5489
+ * the managed surfaces and simply has no sidebar resource page. The registration waits for
5490
+ * the service instead of sampling it once, because plugin load order is not ours to choose.
5491
+ */
5492
+ ctx.effect(() => {
5493
+ let disposeTab;
5494
+ let disposeBridge;
5495
+ const inject = ctx.inject;
5496
+ inject?.(["betterSidebar"], (injected) => {
5497
+ const service = injected.betterSidebar;
5498
+ if (service?.registerTab === void 0) return;
5499
+ disposeTab = service.registerTab({
5500
+ id: RESOURCE_TAB_TYPE,
5501
+ title: "数据资源",
5502
+ description: "DataOps 全量资源、授权与操作记录",
5503
+ order: 60,
5504
+ single: true,
5505
+ component: DataOpsResourcesTab
5506
+ });
5507
+ disposeBridge = ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
5508
+ name: "sidebar.footer.action",
5509
+ id: "dataops-resource-bridge",
5510
+ order: 95
5511
+ }, ((props) => OpenResourceBridge({
5512
+ service,
5513
+ scope: props?.scope
5514
+ }))));
5515
+ });
5516
+ return () => {
5517
+ disposeBridge?.();
5518
+ disposeBridge = void 0;
5519
+ disposeTab?.();
5520
+ disposeTab = void 0;
5521
+ };
5522
+ }, "dataops-managed: resource tab and open bridge");
5217
5523
  const synchronizeJwt = async () => {
5218
5524
  const response = await fetch(new URL(MANAGED_AUTH_PATH, window.location.origin), {
5219
5525
  method: "POST",