ui.shipaid.com 0.3.103 → 0.3.105

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
@@ -2406,6 +2406,9 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
2406
2406
  this.customerId = void 0;
2407
2407
  this.supportSubscriptions = false;
2408
2408
  this.dataSelector = "";
2409
+ this.buttonId = "";
2410
+ this.buttonTitle = "";
2411
+ this.buttonClasses = "";
2409
2412
  this.shadowRootSelector = "";
2410
2413
  this.useShipAidCheckout = false;
2411
2414
  this._apiEndpoint = "/apps/shipaid";
@@ -2434,7 +2437,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
2434
2437
  };
2435
2438
  this.getElementsBySelector = (selector) => {
2436
2439
  if (!selector) return [];
2437
- return document.querySelectorAll(`${selector}:not(#shipaid-checkout-button)`);
2440
+ return document.querySelectorAll(`${selector}:not(#${this.buttonId || "shipaid-checkout-button"})`);
2438
2441
  };
2439
2442
  this.addStylesIfNeeded = () => {
2440
2443
  var _a2, _b2, _c2, _d, _e;
@@ -3004,7 +3007,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3004
3007
  margin: var(--widget-margin, 0);
3005
3008
  padding: var(--widget-padding, 0);
3006
3009
  }
3007
- .shipaid-container a#shipaid-checkout-button {
3010
+ .shipaid-container a#${this.buttonId || "shipaid-checkout-button"} {
3008
3011
  width: 100%;
3009
3012
  margin: 0px;
3010
3013
  text-decoration: unset;
@@ -3113,7 +3116,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3113
3116
  return null;
3114
3117
  }
3115
3118
  checkoutButtonTemplate() {
3116
- var _a, _b, _c, _d, _e, _f, _g;
3119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
3117
3120
  if (!document.getElementById("shipaid-styles")) {
3118
3121
  const style = document.createElement("style");
3119
3122
  style.id = "shipaid-styles";
@@ -3136,7 +3139,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3136
3139
  if (this.shadowRootSelector) {
3137
3140
  const shadowHost = document.querySelector(this.shadowRootSelector);
3138
3141
  if (shadowHost && shadowHost.shadowRoot) {
3139
- originalCheckoutButton = shadowHost.shadowRoot.querySelector(`${this.dataSelector}:not(#shipaid-checkout-button)`);
3142
+ originalCheckoutButton = shadowHost.shadowRoot.querySelector(`${this.dataSelector}:not(#${this.buttonId || "shipaid-checkout-button"})`);
3140
3143
  } else {
3141
3144
  console.warn(`ShadowRoot not found in the element '${this.shadowRootSelector}'.`);
3142
3145
  return;
@@ -3169,7 +3172,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3169
3172
  width: 100%;
3170
3173
  }
3171
3174
 
3172
- .shipaid-container a#shipaid-checkout-button {
3175
+ .shipaid-container a#${this.buttonId || "shipaid-checkout-button"} {
3173
3176
  width: 100%;
3174
3177
  margin: 0px;
3175
3178
  text-decoration: unset;
@@ -3276,24 +3279,27 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3276
3279
  </div>
3277
3280
  </div>
3278
3281
  ${this._sellingPlanId ? x`
3279
- <button id="shipaid-checkout-button" class="${originalClasses}" @click=${async () => {
3282
+ <button id="${this.buttonId || "shipaid-checkout-button"}" variant="${(_d = this._protectionVariant) == null ? void 0 : _d.id}" class="${this.buttonClasses || originalClasses}" @click=${async () => {
3280
3283
  var _a2, _b2;
3281
3284
  sessionStorage.setItem("shipaid_variant", JSON.stringify((_a2 = this._protectionVariant) == null ? void 0 : _a2.id));
3282
3285
  await this.addCartProtectionVariant();
3283
3286
  window.location.href = `/checkout?attributes[_shipaid-internal]=1&updates[${(_b2 = this._protectionVariant) == null ? void 0 : _b2.id}]=1`;
3284
3287
  }}>
3285
- <slot name="checkout-button-text">CHECKOUT+</slot> ${cartTotal ? this._currencyFormat(cartTotal) : loading2}
3288
+ ${this.buttonTitle || x`<slot name="checkout-button-text">CHECKOUT+</slot> ${cartTotal ? this._currencyFormat(cartTotal) : loading2}`}
3286
3289
  </button>
3287
3290
  ` : x`
3288
- <a href="/checkout${((_d = this._protectionVariant) == null ? void 0 : _d.id) ? `?attributes[_shipaid-internal]=1&updates[${(_e = this._protectionVariant) == null ? void 0 : _e.id}]=1` : ""}" id="shipaid-checkout-button" class="${originalClasses}" @click=${() => {
3291
+ <a variant="${(_e = this._protectionVariant) == null ? void 0 : _e.id}" href="/checkout${((_f = this._protectionVariant) == null ? void 0 : _f.id) ? `?attributes[_shipaid-internal]=1&updates[${(_g = this._protectionVariant) == null ? void 0 : _g.id}]=1` : ""}" id="${this.buttonId || "shipaid-checkout-button"}" class="${this.buttonClasses || originalClasses}" @click=${() => {
3289
3292
  var _a2;
3290
3293
  sessionStorage.setItem("shipaid_variant", JSON.stringify((_a2 = this._protectionVariant) == null ? void 0 : _a2.id));
3291
3294
  }}>
3295
+ ${this.buttonTitle || x`
3292
3296
  <span class="shipaid-checkout-text">${translate("checkout-plus.checkout")}+</span>
3293
3297
  <span class="shipaid-checkout-amount">${cartTotal ? this._currencyFormat(cartTotal) : loading2}</span>
3298
+ `}
3299
+
3294
3300
  </a>
3295
3301
  `}
3296
- <a href="/checkout${((_f = this._protectionVariant) == null ? void 0 : _f.id) ? `?attributes[_shipaid-internal]=1&updates[${(_g = this._protectionVariant) == null ? void 0 : _g.id}]=0` : ""}" class="continue-link">
3302
+ <a href="/checkout${((_h = this._protectionVariant) == null ? void 0 : _h.id) ? `?attributes[_shipaid-internal]=1&updates[${(_i = this._protectionVariant) == null ? void 0 : _i.id}]=0` : ""}" class="continue-link">
3297
3303
  <slot name="link-continue">${translate("checkout-plus.continue")}</slot>
3298
3304
  </a>
3299
3305
  </div>
@@ -4051,6 +4057,15 @@ __decorateClass([
4051
4057
  __decorateClass([
4052
4058
  n$7({ type: String, attribute: "data-selector" })
4053
4059
  ], ShipAidWidget.prototype, "dataSelector");
4060
+ __decorateClass([
4061
+ n$7({ type: String, attribute: "button-id" })
4062
+ ], ShipAidWidget.prototype, "buttonId");
4063
+ __decorateClass([
4064
+ n$7({ type: String, attribute: "button-title" })
4065
+ ], ShipAidWidget.prototype, "buttonTitle");
4066
+ __decorateClass([
4067
+ n$7({ type: String, attribute: "button-classes" })
4068
+ ], ShipAidWidget.prototype, "buttonClasses");
4054
4069
  __decorateClass([
4055
4070
  n$7({ type: String, attribute: "shadow-root-selector" })
4056
4071
  ], ShipAidWidget.prototype, "shadowRootSelector");