@trops/dash-core 0.1.451 → 0.1.453

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/dist/index.esm.js CHANGED
@@ -9294,7 +9294,7 @@ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBu
9294
9294
  var hasPropertyDescriptors_1 = hasPropertyDescriptors;
9295
9295
 
9296
9296
  var keys = objectKeys$2;
9297
- var hasSymbols$4 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
9297
+ var hasSymbols$5 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
9298
9298
 
9299
9299
  var toStr$4 = Object.prototype.toString;
9300
9300
  var concat = Array.prototype.concat;
@@ -9327,7 +9327,7 @@ var defineProperty$1 = function (object, name, value, predicate) {
9327
9327
  var defineProperties$1 = function (object, map) {
9328
9328
  var predicates = arguments.length > 2 ? arguments[2] : {};
9329
9329
  var props = keys(map);
9330
- if (hasSymbols$4) {
9330
+ if (hasSymbols$5) {
9331
9331
  props = concat.call(props, Object.getOwnPropertySymbols(map));
9332
9332
  }
9333
9333
  for (var i = 0; i < props.length; i += 1) {
@@ -9393,11 +9393,11 @@ var sign$1 = function sign(number) {
9393
9393
  };
9394
9394
 
9395
9395
  var shams$1;
9396
- var hasRequiredShams$1;
9396
+ var hasRequiredShams;
9397
9397
 
9398
- function requireShams$1 () {
9399
- if (hasRequiredShams$1) return shams$1;
9400
- hasRequiredShams$1 = 1;
9398
+ function requireShams () {
9399
+ if (hasRequiredShams) return shams$1;
9400
+ hasRequiredShams = 1;
9401
9401
 
9402
9402
  /** @type {import('./shams')} */
9403
9403
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -9446,10 +9446,10 @@ function requireShams$1 () {
9446
9446
  }
9447
9447
 
9448
9448
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
9449
- var hasSymbolSham = requireShams$1();
9449
+ var hasSymbolSham = requireShams();
9450
9450
 
9451
9451
  /** @type {import('.')} */
9452
- var hasSymbols$3 = function hasNativeSymbols() {
9452
+ var hasSymbols$4 = function hasNativeSymbols() {
9453
9453
  if (typeof origSymbol !== 'function') { return false; }
9454
9454
  if (typeof Symbol !== 'function') { return false; }
9455
9455
  if (typeof origSymbol('foo') !== 'symbol') { return false; }
@@ -9753,7 +9753,7 @@ var ThrowTypeError = $gOPD$1
9753
9753
  }())
9754
9754
  : throwTypeError;
9755
9755
 
9756
- var hasSymbols$2 = hasSymbols$3();
9756
+ var hasSymbols$3 = hasSymbols$4();
9757
9757
 
9758
9758
  var getProto$2 = getProto$3;
9759
9759
  var $ObjectGPO = requireObject_getPrototypeOf();
@@ -9771,7 +9771,7 @@ var INTRINSICS = {
9771
9771
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
9772
9772
  '%Array%': Array,
9773
9773
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
9774
- '%ArrayIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9774
+ '%ArrayIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$1,
9775
9775
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
9776
9776
  '%AsyncFunction%': needsEval,
9777
9777
  '%AsyncGenerator%': needsEval,
@@ -9802,10 +9802,10 @@ var INTRINSICS = {
9802
9802
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
9803
9803
  '%isFinite%': isFinite,
9804
9804
  '%isNaN%': isNaN,
9805
- '%IteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9805
+ '%IteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$1,
9806
9806
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
9807
9807
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
9808
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9808
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Map()[Symbol.iterator]()),
9809
9809
  '%Math%': Math,
9810
9810
  '%Number%': Number,
9811
9811
  '%Object%': $Object$2,
@@ -9819,11 +9819,11 @@ var INTRINSICS = {
9819
9819
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
9820
9820
  '%RegExp%': RegExp,
9821
9821
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
9822
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$2 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9822
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$3 || !getProto$2 ? undefined$1 : getProto$2(new Set()[Symbol.iterator]()),
9823
9823
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
9824
9824
  '%String%': String,
9825
- '%StringIteratorPrototype%': hasSymbols$2 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9826
- '%Symbol%': hasSymbols$2 ? Symbol : undefined$1,
9825
+ '%StringIteratorPrototype%': hasSymbols$3 && getProto$2 ? getProto$2(''[Symbol.iterator]()) : undefined$1,
9826
+ '%Symbol%': hasSymbols$3 ? Symbol : undefined$1,
9827
9827
  '%SyntaxError%': $SyntaxError$1,
9828
9828
  '%ThrowTypeError%': ThrowTypeError,
9829
9829
  '%TypedArray%': TypedArray,
@@ -10176,12 +10176,12 @@ var callBound$i = function callBoundIntrinsic(name, allowMissing) {
10176
10176
 
10177
10177
  // modified from https://github.com/es-shims/es6-shim
10178
10178
  var objectKeys$1 = objectKeys$2;
10179
- var hasSymbols$1 = requireShams$1()();
10179
+ var hasSymbols$2 = requireShams()();
10180
10180
  var callBound$h = callBound$i;
10181
10181
  var $Object$1 = esObjectAtoms;
10182
10182
  var $push = callBound$h('Array.prototype.push');
10183
10183
  var $propIsEnumerable = callBound$h('Object.prototype.propertyIsEnumerable');
10184
- var originalGetSymbols = hasSymbols$1 ? $Object$1.getOwnPropertySymbols : null;
10184
+ var originalGetSymbols = hasSymbols$2 ? $Object$1.getOwnPropertySymbols : null;
10185
10185
 
10186
10186
  // eslint-disable-next-line no-unused-vars
10187
10187
  var implementation$8 = function assign(target, source1) {
@@ -10195,7 +10195,7 @@ var implementation$8 = function assign(target, source1) {
10195
10195
 
10196
10196
  // step 3.a.ii:
10197
10197
  var keys = objectKeys$1(from);
10198
- var getSymbols = hasSymbols$1 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
10198
+ var getSymbols = hasSymbols$2 && ($Object$1.getOwnPropertySymbols || originalGetSymbols);
10199
10199
  if (getSymbols) {
10200
10200
  var syms = getSymbols(from);
10201
10201
  for (var j = 0; j < syms.length; ++j) {
@@ -10492,23 +10492,14 @@ var regexp_prototype_flags = flagsBound;
10492
10492
 
10493
10493
  var esGetIterator = {exports: {}};
10494
10494
 
10495
- var shams;
10496
- var hasRequiredShams;
10495
+ var hasSymbols$1 = requireShams();
10497
10496
 
10498
- function requireShams () {
10499
- if (hasRequiredShams) return shams;
10500
- hasRequiredShams = 1;
10501
-
10502
- var hasSymbols = requireShams$1();
10503
-
10504
- /** @type {import('.')} */
10505
- shams = function hasToStringTagShams() {
10506
- return hasSymbols() && !!Symbol.toStringTag;
10507
- };
10508
- return shams;
10509
- }
10497
+ /** @type {import('.')} */
10498
+ var shams = function hasToStringTagShams() {
10499
+ return hasSymbols$1() && !!Symbol.toStringTag;
10500
+ };
10510
10501
 
10511
- var hasToStringTag$7 = requireShams()();
10502
+ var hasToStringTag$7 = shams();
10512
10503
  var callBound$f = callBound$i;
10513
10504
 
10514
10505
  var $toString$7 = callBound$f('Object.prototype.toString');
@@ -11545,7 +11536,7 @@ var tryStringObject = function tryStringObject(value) {
11545
11536
  /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
11546
11537
  var $toString$6 = callBound$c('Object.prototype.toString');
11547
11538
  var strClass = '[object String]';
11548
- var hasToStringTag$6 = requireShams()();
11539
+ var hasToStringTag$6 = shams();
11549
11540
 
11550
11541
  /** @type {import('.')} */
11551
11542
  var isString$2 = function isString(value) {
@@ -11661,7 +11652,7 @@ var isSet$2 = exported$1 || function isSet(x) {
11661
11652
  var isArguments$1 = isArguments$2;
11662
11653
  var getStopIterationIterator = stopIterationIterator;
11663
11654
 
11664
- if (hasSymbols$3() || requireShams$1()()) {
11655
+ if (hasSymbols$4() || requireShams()()) {
11665
11656
  var $iterator = Symbol.iterator;
11666
11657
  // Symbol is available natively or shammed
11667
11658
  // natively:
@@ -11950,7 +11941,7 @@ var tryDateObject = function tryDateGetDayCall(value) {
11950
11941
  /** @type {(value: unknown) => string} */
11951
11942
  var toStr$2 = callBound$9('Object.prototype.toString');
11952
11943
  var dateClass = '[object Date]';
11953
- var hasToStringTag$5 = requireShams()();
11944
+ var hasToStringTag$5 = shams();
11954
11945
 
11955
11946
  /** @type {import('.')} */
11956
11947
  var isDateObject = function isDateObject(value) {
@@ -11961,7 +11952,7 @@ var isDateObject = function isDateObject(value) {
11961
11952
  };
11962
11953
 
11963
11954
  var callBound$8 = callBound$i;
11964
- var hasToStringTag$4 = requireShams()();
11955
+ var hasToStringTag$4 = shams();
11965
11956
  var hasOwn = hasown;
11966
11957
  var gOPD$1 = gopd$1;
11967
11958
 
@@ -12066,7 +12057,7 @@ var tryNumberObject = function tryNumberObject(value) {
12066
12057
  };
12067
12058
  var $toString$3 = callBound$6('Object.prototype.toString');
12068
12059
  var numClass = '[object Number]';
12069
- var hasToStringTag$3 = requireShams()();
12060
+ var hasToStringTag$3 = shams();
12070
12061
 
12071
12062
  /** @type {import('.')} */
12072
12063
  var isNumberObject = function isNumberObject(value) {
@@ -12093,7 +12084,7 @@ var tryBooleanObject = function booleanBrandCheck(value) {
12093
12084
  }
12094
12085
  };
12095
12086
  var boolClass = '[object Boolean]';
12096
- var hasToStringTag$2 = requireShams()();
12087
+ var hasToStringTag$2 = shams();
12097
12088
 
12098
12089
  /** @type {import('.')} */
12099
12090
  var isBooleanObject = function isBoolean(value) {
@@ -12135,7 +12126,7 @@ function requireSafeRegexTest () {
12135
12126
 
12136
12127
  var callBound$4 = callBound$i;
12137
12128
  var $toString$1 = callBound$4('Object.prototype.toString');
12138
- var hasSymbols = hasSymbols$3();
12129
+ var hasSymbols = hasSymbols$4();
12139
12130
  var safeRegexTest = requireSafeRegexTest();
12140
12131
 
12141
12132
  if (hasSymbols) {
@@ -12581,7 +12572,7 @@ var gOPD = gopd$1;
12581
12572
  var getProto = getProto$3;
12582
12573
 
12583
12574
  var $toString = callBound$2('Object.prototype.toString');
12584
- var hasToStringTag = requireShams()();
12575
+ var hasToStringTag = shams();
12585
12576
 
12586
12577
  var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
12587
12578
  var typedArrays = availableTypedArrays();
@@ -25452,6 +25443,7 @@ var WidgetErrorBoundary = /*#__PURE__*/function (_Component) {
25452
25443
  }, {
25453
25444
  key: "render",
25454
25445
  value: function render() {
25446
+ var _this2 = this;
25455
25447
  if (this.state.hasError) {
25456
25448
  var _this$state$error;
25457
25449
  var widgetName = this.props.widgetName;
@@ -25459,33 +25451,64 @@ var WidgetErrorBoundary = /*#__PURE__*/function (_Component) {
25459
25451
 
25460
25452
  // Check if it's a WidgetContext error
25461
25453
  var isContextError = errorMessage.includes("Widget ID not found in Context") || errorMessage.includes("WidgetContext");
25454
+
25455
+ // AI-built widgets live under @ai-built/* — they get an "Open
25456
+ // in AI Builder" recovery button that dispatches the existing
25457
+ // dash:edit-widget-with-ai event (dash-electron's Dash.js
25458
+ // listens for it and reopens the failing widget in remix mode).
25459
+ var isAiBuilt = typeof widgetName === "string" && /(^|[./])ai-built\b/i.test(widgetName);
25460
+ var openInBuilder = function openInBuilder() {
25461
+ try {
25462
+ window.dispatchEvent(new CustomEvent("dash:edit-widget-with-ai", {
25463
+ detail: {
25464
+ widgetComponentName: widgetName
25465
+ }
25466
+ }));
25467
+ } catch (err) {
25468
+ }
25469
+ };
25462
25470
  return /*#__PURE__*/jsxs("div", {
25463
- className: "flex flex-col h-full w-full bg-red-900 border-2 border-red-600 rounded p-4 text-red-100",
25471
+ className: "flex flex-col h-full w-full bg-amber-950 border border-amber-700 rounded p-4 text-amber-100",
25464
25472
  children: [/*#__PURE__*/jsx("div", {
25465
- className: "text-xl font-bold mb-2",
25466
- children: "\u26A0\uFE0F Widget Error"
25473
+ className: "text-base font-semibold mb-2 text-amber-200",
25474
+ children: "Widget couldn't render"
25467
25475
  }), /*#__PURE__*/jsxs("div", {
25468
- className: "text-sm mb-3",
25469
- children: [/*#__PURE__*/jsx("strong", {
25470
- children: "Widget:"
25471
- }), " ", widgetName]
25472
- }), /*#__PURE__*/jsxs("div", {
25473
- className: "text-sm mb-3",
25474
- children: [/*#__PURE__*/jsx("strong", {
25475
- children: "Error:"
25476
- }), " ", errorMessage]
25476
+ className: "text-xs mb-2 break-words",
25477
+ children: [/*#__PURE__*/jsx("span", {
25478
+ className: "text-amber-300",
25479
+ children: widgetName
25480
+ }), " threw", " ", /*#__PURE__*/jsx("span", {
25481
+ className: "font-mono",
25482
+ children: errorMessage
25483
+ })]
25477
25484
  }), isContextError && /*#__PURE__*/jsxs("div", {
25478
- className: "text-sm bg-red-800 border border-red-700 rounded p-3 mt-2",
25485
+ className: "text-xs bg-amber-900 border border-amber-700 rounded p-2 mt-2 mb-2",
25479
25486
  children: [/*#__PURE__*/jsx("strong", {
25480
25487
  children: "Fix:"
25481
25488
  }), " This widget uses ", /*#__PURE__*/jsx("code", {
25482
25489
  children: "WidgetContext"
25483
25490
  }), " ", "but is missing the ", /*#__PURE__*/jsx("code", {
25484
25491
  children: "<Widget>"
25485
- }), " wrapper.", /*#__PURE__*/jsx("br", {}), /*#__PURE__*/jsx("br", {}), "Add the wrapper in your widget component:", /*#__PURE__*/jsx("pre", {
25492
+ }), " wrapper.", /*#__PURE__*/jsx("br", {}), "Add the wrapper in your widget component:", /*#__PURE__*/jsx("pre", {
25486
25493
  className: "bg-gray-900 p-2 rounded mt-2 text-xs overflow-auto",
25487
25494
  children: "import { Widget } from \"@trops/dash-react\";\n\nexport const ".concat(widgetName, " = (props) => {\n return (\n <Widget {...props}>\n {/* Your widget content */}\n </Widget>\n );\n};")
25488
25495
  })]
25496
+ }), /*#__PURE__*/jsxs("div", {
25497
+ className: "flex items-center gap-2 mt-2",
25498
+ children: [/*#__PURE__*/jsx("button", {
25499
+ onClick: function onClick() {
25500
+ return _this2.setState({
25501
+ hasError: false,
25502
+ error: null
25503
+ });
25504
+ },
25505
+ className: "px-3 py-1 rounded text-xs bg-amber-700 hover:bg-amber-600 text-amber-100 transition-colors",
25506
+ children: "Retry"
25507
+ }), isAiBuilt && /*#__PURE__*/jsx("button", {
25508
+ onClick: openInBuilder,
25509
+ className: "px-3 py-1 rounded text-xs bg-indigo-600 hover:bg-indigo-500 text-white transition-colors",
25510
+ children: "Open in AI Builder"
25511
+ })]
25489
25512
  })]
25490
25513
  });
25491
25514
  }
@@ -45811,7 +45834,9 @@ var getIconForServer = function getIconForServer(server) {
45811
45834
  */
45812
45835
  var McpCatalogDetail = function McpCatalogDetail(_ref) {
45813
45836
  var onSave = _ref.onSave,
45814
- onCancel = _ref.onCancel;
45837
+ onCancel = _ref.onCancel,
45838
+ _ref$initialSelectedI = _ref.initialSelectedId,
45839
+ initialSelectedId = _ref$initialSelectedI === void 0 ? null : _ref$initialSelectedI;
45815
45840
  var appContext = useContext(AppContext);
45816
45841
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
45817
45842
  var _useState = useState([]),
@@ -45948,6 +45973,22 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
45948
45973
  // eslint-disable-next-line react-hooks/exhaustive-deps
45949
45974
  }, [dashApi]);
45950
45975
 
45976
+ // Pre-select a catalog entry when initialSelectedId is provided
45977
+ // (used by the cross-modal "Add new <type>" CTA from the Widget
45978
+ // Builder). Fires once the catalog finishes loading; if no entry
45979
+ // matches the id (e.g. type isn't in the catalog), silently no-ops
45980
+ // and the user lands on the catalog grid to pick manually.
45981
+ useEffect(function () {
45982
+ if (!initialSelectedId || selectedServer || catalog.length === 0) return;
45983
+ var match = catalog.find(function (s) {
45984
+ return s && s.id === initialSelectedId;
45985
+ });
45986
+ if (match) {
45987
+ setSelectedServer(match);
45988
+ }
45989
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45990
+ }, [catalog, initialSelectedId]);
45991
+
45951
45992
  // Filter catalog by search, then sort alphabetically by display name.
45952
45993
  // Built-in and known-external entries are interleaved alphabetically —
45953
45994
  // the per-card "external" badge keeps the source obvious without
@@ -47021,7 +47062,11 @@ var ProvidersSection = function ProvidersSection(_ref) {
47021
47062
  _ref$createRequested = _ref.createRequested,
47022
47063
  createRequested = _ref$createRequested === void 0 ? false : _ref$createRequested,
47023
47064
  _ref$onCreateAcknowle = _ref.onCreateAcknowledged,
47024
- onCreateAcknowledged = _ref$onCreateAcknowle === void 0 ? null : _ref$onCreateAcknowle;
47065
+ onCreateAcknowledged = _ref$onCreateAcknowle === void 0 ? null : _ref$onCreateAcknowle,
47066
+ _ref$initialProviderT = _ref.initialProviderType,
47067
+ initialProviderType = _ref$initialProviderT === void 0 ? null : _ref$initialProviderT,
47068
+ _ref$initialProviderC = _ref.initialProviderClass,
47069
+ initialProviderClass = _ref$initialProviderC === void 0 ? null : _ref$initialProviderC;
47025
47070
  var appContext = useContext(AppContext);
47026
47071
  var providers = (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || {};
47027
47072
  var refreshProviders = appContext === null || appContext === void 0 ? void 0 : appContext.refreshProviders;
@@ -47357,14 +47402,29 @@ var ProvidersSection = function ProvidersSection(_ref) {
47357
47402
  });
47358
47403
  }
47359
47404
 
47360
- // Respond to external create trigger from header
47405
+ // Respond to external create trigger from header (or from the
47406
+ // cross-modal "Add new <type>" event dispatched by the Widget
47407
+ // Builder, with optional initialProviderType/initialProviderClass
47408
+ // for type pre-fill / catalog pre-select).
47361
47409
  var prevCreateRequested = useRef(false);
47362
47410
  useEffect(function () {
47363
47411
  if (createRequested && !prevCreateRequested.current) {
47364
47412
  resetForm();
47365
47413
  setSelectedName(null);
47366
- setIsAddingMcp(false);
47367
- setIsCreating(true);
47414
+ if (initialProviderClass === "mcp") {
47415
+ // MCP class: open the catalog detail. Pre-select happens in
47416
+ // McpCatalogDetail via the initialSelectedId prop passed below.
47417
+ setIsCreating(false);
47418
+ setIsAddingMcp(true);
47419
+ } else {
47420
+ // Credential class (default): open the credential create form
47421
+ // and pre-fill the type field if provided.
47422
+ setIsAddingMcp(false);
47423
+ setIsCreating(true);
47424
+ if (initialProviderType) {
47425
+ setFormType(initialProviderType);
47426
+ }
47427
+ }
47368
47428
  }
47369
47429
  prevCreateRequested.current = createRequested;
47370
47430
  if (createRequested && onCreateAcknowledged) {
@@ -47500,7 +47560,8 @@ var ProvidersSection = function ProvidersSection(_ref) {
47500
47560
  onSave: handleMcpSave,
47501
47561
  onCancel: function onCancel() {
47502
47562
  return setIsAddingMcp(false);
47503
- }
47563
+ },
47564
+ initialSelectedId: initialProviderType
47504
47565
  });
47505
47566
  } else if (isCreating) {
47506
47567
  detailContent = /*#__PURE__*/jsx(ProviderDetail, {
@@ -53282,6 +53343,10 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
53282
53343
  initialProviderName = _ref$initialProviderN === void 0 ? null : _ref$initialProviderN,
53283
53344
  _ref$initialCreatePro = _ref.initialCreateProvider,
53284
53345
  initialCreateProvider = _ref$initialCreatePro === void 0 ? false : _ref$initialCreatePro,
53346
+ _ref$initialProviderT = _ref.initialProviderType,
53347
+ initialProviderType = _ref$initialProviderT === void 0 ? null : _ref$initialProviderT,
53348
+ _ref$initialProviderC = _ref.initialProviderClass,
53349
+ initialProviderClass = _ref$initialProviderC === void 0 ? null : _ref$initialProviderC,
53285
53350
  _ref$workspaces = _ref.workspaces,
53286
53351
  workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
53287
53352
  _ref$menuItems = _ref.menuItems,
@@ -53417,7 +53482,9 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
53417
53482
  return setCreateRequested(false);
53418
53483
  },
53419
53484
  initialProviderName: initialProviderName,
53420
- initialCreateRequested: initialCreateProvider
53485
+ initialCreateRequested: initialCreateProvider,
53486
+ initialProviderType: initialProviderType,
53487
+ initialProviderClass: initialProviderClass
53421
53488
  }), activeSection === "themes" && /*#__PURE__*/jsx(ThemesSection, {
53422
53489
  onOpenThemeEditor: onOpenThemeEditor,
53423
53490
  dashApi: dashApi,
@@ -58269,13 +58336,31 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
58269
58336
  _useState52 = _slicedToArray(_useState51, 2),
58270
58337
  appSettingsCreateProvider = _useState52[0],
58271
58338
  setAppSettingsCreateProvider = _useState52[1];
58339
+ // Optional pre-fills used by the cross-modal "Add new <type>"
58340
+ // flow dispatched from dash-electron's WidgetBuilderModal.
58341
+ // initialProviderType is the type id (e.g. "filesystem", "slack").
58342
+ // initialProviderClass routes the create flow: "mcp" opens the
58343
+ // catalog detail with that type pre-selected; otherwise opens
58344
+ // the credential create form with formType pre-filled.
58345
+ var _useState53 = useState(null),
58346
+ _useState54 = _slicedToArray(_useState53, 2),
58347
+ appSettingsInitialProviderType = _useState54[0],
58348
+ setAppSettingsInitialProviderType = _useState54[1];
58349
+ var _useState55 = useState(null),
58350
+ _useState56 = _slicedToArray(_useState55, 2),
58351
+ appSettingsInitialProviderClass = _useState56[0],
58352
+ setAppSettingsInitialProviderClass = _useState56[1];
58272
58353
  function openAppSettings() {
58273
58354
  var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
58274
58355
  var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
58275
58356
  var createProvider = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
58357
+ var providerType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
58358
+ var providerClass = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
58276
58359
  setAppSettingsInitialSection(section);
58277
58360
  setAppSettingsInitialProvider(providerName);
58278
58361
  setAppSettingsCreateProvider(createProvider);
58362
+ setAppSettingsInitialProviderType(providerType);
58363
+ setAppSettingsInitialProviderClass(providerClass);
58279
58364
  setIsAppSettingsOpen(true);
58280
58365
  }
58281
58366
  function handleProfileUpdated() {
@@ -58367,6 +58452,27 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
58367
58452
  };
58368
58453
  }, [changeCurrentTheme]);
58369
58454
 
58455
+ // ─── Listen for "open Settings to create a provider of type X" ──
58456
+ // Dispatched by dash-electron's Widget Builder PreviewProviderPicker
58457
+ // when the user clicks "Add new <type>" because no instances of the
58458
+ // chosen type exist yet. Detail: { type, providerClass }. The
58459
+ // Widget Builder's own listener (in dash-electron/Dash.js) handles
58460
+ // closing the builder modal — this listener only opens Settings.
58461
+ useEffect(function () {
58462
+ var handler = function handler(e) {
58463
+ var _ref4 = (e === null || e === void 0 ? void 0 : e.detail) || {},
58464
+ type = _ref4.type,
58465
+ providerClass = _ref4.providerClass;
58466
+ if (!type) return;
58467
+ openAppSettings("providers", null, true, type, providerClass || null);
58468
+ };
58469
+ window.addEventListener("dash:open-settings-create-provider", handler);
58470
+ return function () {
58471
+ return window.removeEventListener("dash:open-settings-create-provider", handler);
58472
+ };
58473
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58474
+ }, []);
58475
+
58370
58476
  // ─── Listen for external "open workspace" requests ──────────────
58371
58477
  // Fired by: Dash.js notification click, MCP state-changed for
58372
58478
  // create_dashboard, etc. Any code that wants to switch the active
@@ -58376,10 +58482,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
58376
58482
  // We record the requested ID and open it once it appears in
58377
58483
  // workspaceConfig — handles the case where the workspace was just
58378
58484
  // created and the config reload is still in flight.
58379
- var _useState53 = useState(null),
58380
- _useState54 = _slicedToArray(_useState53, 2),
58381
- pendingOpenWorkspaceId = _useState54[0],
58382
- setPendingOpenWorkspaceId = _useState54[1];
58485
+ var _useState57 = useState(null),
58486
+ _useState58 = _slicedToArray(_useState57, 2),
58487
+ pendingOpenWorkspaceId = _useState58[0],
58488
+ setPendingOpenWorkspaceId = _useState58[1];
58383
58489
  useEffect(function () {
58384
58490
  var handler = function handler(e) {
58385
58491
  var _e$detail2;
@@ -59001,10 +59107,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
59001
59107
  }
59002
59108
 
59003
59109
  // ─── Page State ──────────────────────────────────────────────────
59004
- var _useState55 = useState(null),
59005
- _useState56 = _slicedToArray(_useState55, 2),
59006
- activePageId = _useState56[0],
59007
- setActivePageId = _useState56[1];
59110
+ var _useState59 = useState(null),
59111
+ _useState60 = _slicedToArray(_useState59, 2),
59112
+ activePageId = _useState60[0],
59113
+ setActivePageId = _useState60[1];
59008
59114
 
59009
59115
  // Page history stack for goBack() — pushes the previous page id
59010
59116
  // whenever a navigation happens through navigateToPage().
@@ -59038,9 +59144,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
59038
59144
  // Listen for programmatic page switches via DashboardActionsApi
59039
59145
  useEffect(function () {
59040
59146
  function onSwitchPage(e) {
59041
- var _ref4 = e.detail || {},
59042
- pageId = _ref4.pageId,
59043
- pageName = _ref4.pageName;
59147
+ var _ref5 = e.detail || {},
59148
+ pageId = _ref5.pageId,
59149
+ pageName = _ref5.pageName;
59044
59150
  if (pageId) {
59045
59151
  navigateToPage(pageId);
59046
59152
  } else if (pageName) {
@@ -59895,11 +60001,15 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
59895
60001
  if (!open) {
59896
60002
  setAppSettingsInitialProvider(null);
59897
60003
  setAppSettingsCreateProvider(false);
60004
+ setAppSettingsInitialProviderType(null);
60005
+ setAppSettingsInitialProviderClass(null);
59898
60006
  }
59899
60007
  },
59900
60008
  initialSection: appSettingsInitialSection,
59901
60009
  initialProviderName: appSettingsInitialProvider,
59902
60010
  initialCreateProvider: appSettingsCreateProvider,
60011
+ initialProviderType: appSettingsInitialProviderType,
60012
+ initialProviderClass: appSettingsInitialProviderClass,
59903
60013
  workspaces: workspaceConfig,
59904
60014
  menuItems: menuItems,
59905
60015
  dashApi: dashApi,