@mochabug/adapt-web 1.0.0-rc60 → 1.0.0-rc62

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/esm/index.js CHANGED
@@ -118,6 +118,12 @@ const DEFAULT_STYLES = `
118
118
  --mb-adapt-cap-spinner-bg: #334155;
119
119
  --mb-adapt-cap-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
120
120
  --mb-adapt-cap-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
121
+
122
+ /* Status card dark mode */
123
+ --mb-adapt-status-card-bg: #1e293b;
124
+ --mb-adapt-status-card-border: #334155;
125
+ --mb-adapt-status-icon-bg: #351c1c;
126
+ --mb-adapt-status-text: #e2e8f0;
121
127
  }
122
128
 
123
129
  .mb-adapt__wrapper {
@@ -566,13 +572,50 @@ cap-widget::part(attribution) {
566
572
  width: 100%;
567
573
  height: 100%;
568
574
  min-height: 200px;
569
- color: #6b7280;
575
+ background: transparent;
576
+ }
577
+
578
+ .mb-adapt__status-card {
579
+ display: flex;
580
+ flex-direction: column;
581
+ align-items: center;
582
+ gap: 16px;
583
+ padding: 32px 40px;
584
+ max-width: 380px;
585
+ border-radius: 16px;
586
+ background: var(--mb-adapt-status-card-bg, #ffffff);
587
+ border: 1px solid var(--mb-adapt-status-card-border, #e5e7eb);
588
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
570
589
  font-family: system-ui, -apple-system, sans-serif;
571
- font-size: 16px;
572
- border-radius: var(--mb-adapt-border-radius);
573
- background: var(--mb-adapt-banner-bg);
574
- border: 1px solid var(--mb-adapt-banner-border);
590
+ text-align: center;
591
+ }
592
+
593
+ .mb-adapt__status-icon {
594
+ width: 48px;
595
+ height: 48px;
596
+ border-radius: 12px;
597
+ display: flex;
598
+ align-items: center;
599
+ justify-content: center;
600
+ background: var(--mb-adapt-status-icon-bg, #fef2f2);
601
+ }
602
+
603
+ .mb-adapt__status-icon svg {
604
+ width: 24px;
605
+ height: 24px;
606
+ }
607
+
608
+ .mb-adapt__status-icon--stopped {
609
+ background: var(--mb-adapt-status-icon-bg, #f3f4f6);
610
+ }
611
+
612
+ .mb-adapt__status-text {
613
+ color: var(--mb-adapt-status-text, #374151);
614
+ font-size: 15px;
615
+ line-height: 1.5;
616
+ margin: 0;
575
617
  }
618
+
576
619
  `;
577
620
  /**
578
621
  * Browser client for rendering Adapt automation sessions in iframes.
@@ -1575,7 +1618,7 @@ export class AdaptWebClient {
1575
1618
  this.mainIframe.classList.remove("mb-adapt__iframe--visible");
1576
1619
  this.mainIframe.classList.add("mb-adapt__iframe--hidden");
1577
1620
  }
1578
- this.showStatusMessage(this.options.text?.stopped ?? "This session has been stopped");
1621
+ this.showStatusMessage(this.options.text?.stopped ?? "This session has been stopped", "stopped");
1579
1622
  return;
1580
1623
  }
1581
1624
  // Fork stopped — remove from queue
@@ -2116,15 +2159,39 @@ export class AdaptWebClient {
2116
2159
  });
2117
2160
  return iframe;
2118
2161
  }
2119
- showStatusMessage(text) {
2162
+ showStatusMessage(text, kind = "error") {
2120
2163
  if (!this.mainFrameElement && !this.mainContainer)
2121
2164
  return;
2122
2165
  // Remove existing message if any
2123
2166
  this.removeStatusMessage();
2167
+ // Hide the main iframe so it doesn't cover the status message
2168
+ if (this.mainIframe) {
2169
+ this.mainIframe.classList.remove("mb-adapt__iframe--visible");
2170
+ this.mainIframe.classList.add("mb-adapt__iframe--hidden");
2171
+ }
2172
+ // Build card structure
2124
2173
  this.statusMessageElement = document.createElement("div");
2125
2174
  this.statusMessageElement.className =
2126
2175
  this.options.classNames?.statusMessage ?? "mb-adapt__status-message";
2127
- this.statusMessageElement.textContent = text;
2176
+ const card = document.createElement("div");
2177
+ card.className = "mb-adapt__status-card";
2178
+ // Icon
2179
+ const iconWrap = document.createElement("div");
2180
+ iconWrap.className =
2181
+ kind === "stopped"
2182
+ ? "mb-adapt__status-icon mb-adapt__status-icon--stopped"
2183
+ : "mb-adapt__status-icon";
2184
+ iconWrap.innerHTML =
2185
+ kind === "stopped"
2186
+ ? `<svg viewBox="0 0 24 24" fill="none" stroke="#6b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>`
2187
+ : `<svg viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`;
2188
+ card.appendChild(iconWrap);
2189
+ // Text
2190
+ const msg = document.createElement("p");
2191
+ msg.className = "mb-adapt__status-text";
2192
+ msg.textContent = text;
2193
+ card.appendChild(msg);
2194
+ this.statusMessageElement.appendChild(card);
2128
2195
  const parent = this.mainFrameElement || this.mainContainer;
2129
2196
  // Ensure the parent frame is visible so the status message can be seen
2130
2197
  parent.classList.remove("mb-adapt__frame--hidden");
@@ -2134,6 +2201,10 @@ export class AdaptWebClient {
2134
2201
  if (this.statusMessageElement) {
2135
2202
  this.statusMessageElement.remove();
2136
2203
  this.statusMessageElement = null;
2204
+ // Restore the iframe (it will become visible when a URL arrives via showIframe)
2205
+ if (this.mainIframe) {
2206
+ this.mainIframe.classList.remove("mb-adapt__iframe--hidden");
2207
+ }
2137
2208
  }
2138
2209
  }
2139
2210
  getErrorMessage(error) {
@@ -7549,7 +7549,7 @@ var MbAdapt = (() => {
7549
7549
  // src/index.ts
7550
7550
  if (typeof window !== "undefined" && true && !window.CAP_CUSTOM_WASM_URL) {
7551
7551
  window.CAP_CUSTOM_WASM_URL = new URL(
7552
- "https://cdn.mochabug.com/adapt/web/1.0.0-rc60/cap_wasm.js",
7552
+ "https://cdn.mochabug.com/adapt/web/1.0.0-rc62/cap_wasm.js",
7553
7553
  window.location.href
7554
7554
  ).href;
7555
7555
  }
@@ -7642,6 +7642,12 @@ var MbAdapt = (() => {
7642
7642
  --mb-adapt-cap-spinner-bg: #334155;
7643
7643
  --mb-adapt-cap-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
7644
7644
  --mb-adapt-cap-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
7645
+
7646
+ /* Status card dark mode */
7647
+ --mb-adapt-status-card-bg: #1e293b;
7648
+ --mb-adapt-status-card-border: #334155;
7649
+ --mb-adapt-status-icon-bg: #351c1c;
7650
+ --mb-adapt-status-text: #e2e8f0;
7645
7651
  }
7646
7652
 
7647
7653
  .mb-adapt__wrapper {
@@ -8090,13 +8096,50 @@ cap-widget::part(attribution) {
8090
8096
  width: 100%;
8091
8097
  height: 100%;
8092
8098
  min-height: 200px;
8093
- color: #6b7280;
8099
+ background: transparent;
8100
+ }
8101
+
8102
+ .mb-adapt__status-card {
8103
+ display: flex;
8104
+ flex-direction: column;
8105
+ align-items: center;
8106
+ gap: 16px;
8107
+ padding: 32px 40px;
8108
+ max-width: 380px;
8109
+ border-radius: 16px;
8110
+ background: var(--mb-adapt-status-card-bg, #ffffff);
8111
+ border: 1px solid var(--mb-adapt-status-card-border, #e5e7eb);
8112
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
8094
8113
  font-family: system-ui, -apple-system, sans-serif;
8095
- font-size: 16px;
8096
- border-radius: var(--mb-adapt-border-radius);
8097
- background: var(--mb-adapt-banner-bg);
8098
- border: 1px solid var(--mb-adapt-banner-border);
8114
+ text-align: center;
8115
+ }
8116
+
8117
+ .mb-adapt__status-icon {
8118
+ width: 48px;
8119
+ height: 48px;
8120
+ border-radius: 12px;
8121
+ display: flex;
8122
+ align-items: center;
8123
+ justify-content: center;
8124
+ background: var(--mb-adapt-status-icon-bg, #fef2f2);
8125
+ }
8126
+
8127
+ .mb-adapt__status-icon svg {
8128
+ width: 24px;
8129
+ height: 24px;
8130
+ }
8131
+
8132
+ .mb-adapt__status-icon--stopped {
8133
+ background: var(--mb-adapt-status-icon-bg, #f3f4f6);
8134
+ }
8135
+
8136
+ .mb-adapt__status-text {
8137
+ color: var(--mb-adapt-status-text, #374151);
8138
+ font-size: 15px;
8139
+ line-height: 1.5;
8140
+ margin: 0;
8099
8141
  }
8142
+
8100
8143
  `;
8101
8144
  var AdaptWebClient = class _AdaptWebClient {
8102
8145
  constructor(options) {
@@ -8917,7 +8960,8 @@ cap-widget::part(attribution) {
8917
8960
  this.mainIframe.classList.add("mb-adapt__iframe--hidden");
8918
8961
  }
8919
8962
  this.showStatusMessage(
8920
- this.options.text?.stopped ?? "This session has been stopped"
8963
+ this.options.text?.stopped ?? "This session has been stopped",
8964
+ "stopped"
8921
8965
  );
8922
8966
  return;
8923
8967
  }
@@ -9369,12 +9413,26 @@ cap-widget::part(attribution) {
9369
9413
  });
9370
9414
  return iframe;
9371
9415
  }
9372
- showStatusMessage(text) {
9416
+ showStatusMessage(text, kind = "error") {
9373
9417
  if (!this.mainFrameElement && !this.mainContainer) return;
9374
9418
  this.removeStatusMessage();
9419
+ if (this.mainIframe) {
9420
+ this.mainIframe.classList.remove("mb-adapt__iframe--visible");
9421
+ this.mainIframe.classList.add("mb-adapt__iframe--hidden");
9422
+ }
9375
9423
  this.statusMessageElement = document.createElement("div");
9376
9424
  this.statusMessageElement.className = this.options.classNames?.statusMessage ?? "mb-adapt__status-message";
9377
- this.statusMessageElement.textContent = text;
9425
+ const card = document.createElement("div");
9426
+ card.className = "mb-adapt__status-card";
9427
+ const iconWrap = document.createElement("div");
9428
+ iconWrap.className = kind === "stopped" ? "mb-adapt__status-icon mb-adapt__status-icon--stopped" : "mb-adapt__status-icon";
9429
+ iconWrap.innerHTML = kind === "stopped" ? `<svg viewBox="0 0 24 24" fill="none" stroke="#6b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>` : `<svg viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`;
9430
+ card.appendChild(iconWrap);
9431
+ const msg = document.createElement("p");
9432
+ msg.className = "mb-adapt__status-text";
9433
+ msg.textContent = text;
9434
+ card.appendChild(msg);
9435
+ this.statusMessageElement.appendChild(card);
9378
9436
  const parent = this.mainFrameElement || this.mainContainer;
9379
9437
  parent.classList.remove("mb-adapt__frame--hidden");
9380
9438
  parent.appendChild(this.statusMessageElement);
@@ -9383,6 +9441,9 @@ cap-widget::part(attribution) {
9383
9441
  if (this.statusMessageElement) {
9384
9442
  this.statusMessageElement.remove();
9385
9443
  this.statusMessageElement = null;
9444
+ if (this.mainIframe) {
9445
+ this.mainIframe.classList.remove("mb-adapt__iframe--hidden");
9446
+ }
9386
9447
  }
9387
9448
  }
9388
9449
  getErrorMessage(error) {