ui.shipaid.com 0.3.133 → 0.3.135

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/widget.es.js CHANGED
@@ -4094,13 +4094,14 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4094
4094
  }
4095
4095
  /** Templates */
4096
4096
  learnMorePopupTemplate() {
4097
- var _a;
4097
+ var _a, _b;
4098
4098
  const carousel = document.querySelector("shipaid-learn-more-carousel");
4099
+ const isGreenEnabled = Boolean((_b = (_a = this._store) == null ? void 0 : _a.greenProtection) == null ? void 0 : _b.enabled);
4099
4100
  if (carousel) return;
4100
4101
  return x`
4101
4102
  <shipaid-learn-more-carousel
4102
4103
  carousel-state=${this._popup === "learn-more" ? "open" : "close"}
4103
- carousel-type=${((_a = this._store) == null ? void 0 : _a.greenProtection.enabled) || this.previewGreenShipAid ? "green-protection" : "standard-protection"}
4104
+ green-protection=${isGreenEnabled}
4104
4105
  >
4105
4106
  </shipaid-learn-more-carousel>
4106
4107
  `;
@@ -5853,6 +5854,27 @@ class ShipAidCheckoutPlus extends s$1 {
5853
5854
  } catch {
5854
5855
  }
5855
5856
  }
5857
+ // Find a flex/grid ancestor and tag it so embed app CSS can make our widget span a full row
5858
+ _prepareParentContainer(btn) {
5859
+ if (!btn) return;
5860
+ try {
5861
+ let el = btn.parentElement;
5862
+ let depth = 0;
5863
+ while (el && depth < 3) {
5864
+ const cs = window.getComputedStyle(el);
5865
+ const display = (cs.display || "").toLowerCase();
5866
+ const isFlex = display === "flex" || display === "inline-flex";
5867
+ const isGrid = display === "grid" || display === "inline-grid";
5868
+ if (isFlex && cs.flexDirection !== "column" || isGrid) {
5869
+ el.setAttribute("shipaid-parent-container", "");
5870
+ return;
5871
+ }
5872
+ el = el.parentElement;
5873
+ depth++;
5874
+ }
5875
+ } catch {
5876
+ }
5877
+ }
5856
5878
  // Copy visual styles from the original checkout button so our primary button matches
5857
5879
  _applyButtonStylesFrom(btn, customStyles = {}) {
5858
5880
  if (!btn) return;
@@ -5966,8 +5988,9 @@ class ShipAidCheckoutPlus extends s$1 {
5966
5988
  this._applyButtonStylesFrom(target, customStyles || {});
5967
5989
  target.setAttribute("data-shipaid-replaced", "true");
5968
5990
  if (!target.hasAttribute("shipaid-hidden")) target.setAttribute("shipaid-hidden", "");
5991
+ this._prepareParentContainer(target);
5969
5992
  if (this.previousElementSibling !== target && this.nextElementSibling !== target) {
5970
- target.insertAdjacentElement("afterend", this);
5993
+ target.insertAdjacentElement("beforebegin", this);
5971
5994
  }
5972
5995
  return;
5973
5996
  }
@@ -5977,8 +6000,9 @@ class ShipAidCheckoutPlus extends s$1 {
5977
6000
  this._applyButtonStylesFrom(first, customStyles || {});
5978
6001
  first.setAttribute("data-shipaid-replaced", "true");
5979
6002
  if (!first.hasAttribute("shipaid-hidden")) first.setAttribute("shipaid-hidden", "");
6003
+ this._prepareParentContainer(first);
5980
6004
  if (this.previousElementSibling !== first && this.nextElementSibling !== first) {
5981
- first.insertAdjacentElement("afterend", this);
6005
+ first.insertAdjacentElement("beforebegin", this);
5982
6006
  }
5983
6007
  }
5984
6008
  for (const btn of rest) {
@@ -5998,7 +6022,8 @@ class ShipAidCheckoutPlus extends s$1 {
5998
6022
  clone.setAttribute("lang", this.lang);
5999
6023
  } catch {
6000
6024
  }
6001
- btn.insertAdjacentElement("afterend", clone);
6025
+ this._prepareParentContainer(btn);
6026
+ btn.insertAdjacentElement("beforebegin", clone);
6002
6027
  }
6003
6028
  } catch {
6004
6029
  }
@@ -6036,6 +6061,7 @@ class ShipAidCheckoutPlus extends s$1 {
6036
6061
  if (!this._originalCheckoutButton && firstEl) {
6037
6062
  this._applyButtonStylesFrom(firstEl, customStyles || {});
6038
6063
  }
6064
+ if (firstEl) this._prepareParentContainer(firstEl);
6039
6065
  const anyMatch = nodeList.length > 0;
6040
6066
  if (!hasOriginal || anyMatch) {
6041
6067
  this._mountNearCheckoutButton();
@@ -6478,7 +6504,7 @@ class ShipAidCheckoutPlus extends s$1 {
6478
6504
  border-style: var(--cp-primary-border-style, none);
6479
6505
  border-color: var(--cp-primary-border-color, transparent);
6480
6506
  border-width: var(--cp-primary-border-width, 0);
6481
- border-radius:20px;
6507
+ border-radius: var(--cp-radius);;
6482
6508
  padding:14px 12px;
6483
6509
  font-size: var(--cp-primary-size);
6484
6510
  font-weight:800;
@@ -6496,7 +6522,7 @@ class ShipAidCheckoutPlus extends s$1 {
6496
6522
  background:#fff;
6497
6523
  color:var(--cp-text);
6498
6524
  border:1px solid var(--cp-border);
6499
- border-radius:20px;
6525
+ border-radius: var(--cp-radius);;
6500
6526
  padding:12px 12px;
6501
6527
  font-size: var(--cp-secondary-size);
6502
6528
  font-weight:600;
@@ -7355,7 +7381,7 @@ const _ShipAidAddToCartPlus = class _ShipAidAddToCartPlus extends s$1 {
7355
7381
  if (document.getElementById(styleId)) return;
7356
7382
  const style = document.createElement("style");
7357
7383
  style.id = styleId;
7358
- style.textContent = `.${ATC_ORIGINAL_BTN_CLASS} { background: #fff !important; color: #111 !important; border: 1px solid #111 !important; border-radius: 9999px !important; text-transform: none !important; }
7384
+ style.textContent = `.${ATC_ORIGINAL_BTN_CLASS} { background: #fff !important; color: #111 !important; border: 1px solid #111 !important; border-radius: 12px !important; text-transform: none !important; }
7359
7385
  .${ATC_ORIGINAL_BTN_CLASS}:hover, .${ATC_ORIGINAL_BTN_CLASS}:focus { background: #f7f7f7 !important; color: #111 !important; border-color: #111 !important; }
7360
7386
  .${ATC_ORIGINAL_BTN_CLASS}[disabled] { opacity: 0.6 !important; cursor: not-allowed !important; }
7361
7387
  .${ATC_ORIGINAL_BTN_CLASS}:after { position: unset !important; opacity: 0 !important; }
@@ -7574,7 +7600,7 @@ _ShipAidAddToCartPlus.styles = i2`
7574
7600
  }
7575
7601
  .cp-primary {
7576
7602
  width: 100%;
7577
- border-radius: 20px;
7603
+ border-radius: 12px;
7578
7604
  padding: 14px 12px;
7579
7605
  font-size: 13px;
7580
7606
  font-weight: 700;