ui.shipaid.com 0.3.148 → 0.3.149

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
@@ -3643,7 +3643,9 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3643
3643
  this._sellingPlanId = null;
3644
3644
  this._isUpdatingShipAid = false;
3645
3645
  this._lastCartEventAt = 0;
3646
- this._isReplacingCartSections = false;
3646
+ this._checkoutButtonStylesInjected = false;
3647
+ this._cachedCheckoutButton = null;
3648
+ this._cachedCheckoutButtonClasses = "";
3647
3649
  this._onShipAidCartEvent = (event) => {
3648
3650
  var _a2, _b2;
3649
3651
  if (((_b2 = (_a2 = event == null ? void 0 : event.detail) == null ? void 0 : _a2.data) == null ? void 0 : _b2.source) === "shipaid-widget") return;
@@ -3768,6 +3770,47 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
3768
3770
  _toggleBenefits() {
3769
3771
  this._isBenefitsOpen = !this._isBenefitsOpen;
3770
3772
  }
3773
+ /**
3774
+ * Get the contactless checkout selector from DB or sessionStorage
3775
+ * @private
3776
+ */
3777
+ _getContactlessCheckoutSelector() {
3778
+ var _a, _b, _c, _d;
3779
+ return ((_d = (_c = (_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) == null ? void 0 : _c.theme_checkout) == null ? void 0 : _d.checkoutButtonSelector) || null;
3780
+ }
3781
+ /**
3782
+ * Check if we should use contactless checkout template
3783
+ * @private
3784
+ */
3785
+ _shouldUseContactlessCheckout() {
3786
+ const dbSelector = this._getContactlessCheckoutSelector();
3787
+ const sessionSelector = sessionStorage.getItem("shipaidWidgetTheme");
3788
+ if (this.useShipAidCheckout || !dbSelector) {
3789
+ return false;
3790
+ }
3791
+ return !!sessionSelector;
3792
+ }
3793
+ /**
3794
+ * Check if widget should be shown based on config
3795
+ * @private
3796
+ */
3797
+ _shouldShowWidgetContent() {
3798
+ var _a;
3799
+ return !!(this._shouldShowWidget && this.planActive && ((_a = this._store) == null ? void 0 : _a.widgetShowCart));
3800
+ }
3801
+ /**
3802
+ * Determine which template to render
3803
+ * @private
3804
+ */
3805
+ _getTemplateToRender() {
3806
+ if (!this._hasFinishedSetup) {
3807
+ return this._shouldUseContactlessCheckout() ? this.contactlessCheckoutButtonTemplate() : this.promptTemplate();
3808
+ }
3809
+ if (this._shouldShowWidgetContent()) {
3810
+ return this._shouldUseContactlessCheckout() ? this.contactlessCheckoutButtonTemplate() : this.promptTemplate();
3811
+ }
3812
+ return A;
3813
+ }
3771
3814
  get nhost() {
3772
3815
  const subdomain = this.env === "prod" ? "gjiyysyzjwuculcymsvb" : this.env === "staging" ? "xfnjpunvafvudwuzwjlm" : "local";
3773
3816
  const region = "us-east-1";
@@ -4160,13 +4203,6 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4160
4203
  } catch {
4161
4204
  }
4162
4205
  }
4163
- try {
4164
- this._isReplacingCartSections = true;
4165
- await refreshShopifyCartUI();
4166
- } catch {
4167
- } finally {
4168
- this._isReplacingCartSections = false;
4169
- }
4170
4206
  }
4171
4207
  async addCartProtectionVariant() {
4172
4208
  var _a, _b;
@@ -4682,8 +4718,12 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4682
4718
  </div>
4683
4719
  `;
4684
4720
  }
4685
- checkoutButtonTemplate() {
4686
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
4721
+ /**
4722
+ * Inject global styles for checkoutButtonTemplate (only once)
4723
+ * @private
4724
+ */
4725
+ _injectCheckoutButtonGlobalStyles() {
4726
+ if (this._checkoutButtonStylesInjected) return;
4687
4727
  if (!document.getElementById("shipaid-styles")) {
4688
4728
  const style = document.createElement("style");
4689
4729
  style.id = "shipaid-styles";
@@ -4698,70 +4738,257 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4698
4738
  `;
4699
4739
  document.head.appendChild(style);
4700
4740
  }
4741
+ this._checkoutButtonStylesInjected = true;
4742
+ }
4743
+ /**
4744
+ * Find and cache the original checkout button for checkoutButtonTemplate
4745
+ * @private
4746
+ */
4747
+ _findAndCacheCheckoutButton() {
4748
+ var _a;
4749
+ if (this._cachedCheckoutButton && document.contains(this._cachedCheckoutButton)) {
4750
+ return this._cachedCheckoutButton;
4751
+ }
4701
4752
  if (!this.dataSelector) {
4702
- console.error(
4703
- "[shipaid-widget] we couldn't find the 'data-selector' attribute."
4704
- );
4705
- return;
4753
+ logger.warn("[shipaid-widget] Missing 'data-selector' attribute for checkout button");
4754
+ return null;
4706
4755
  }
4707
- let originalCheckoutButton = null;
4756
+ let button = null;
4708
4757
  if (this.shadowRootSelector) {
4709
4758
  const shadowHost = document.querySelector(this.shadowRootSelector);
4710
- if (shadowHost && shadowHost.shadowRoot) {
4711
- originalCheckoutButton = shadowHost.shadowRoot.querySelector(
4759
+ if (shadowHost == null ? void 0 : shadowHost.shadowRoot) {
4760
+ button = shadowHost.shadowRoot.querySelector(
4712
4761
  `${this.dataSelector}:not(#${this.buttonId || "shipaid-checkout-button"})`
4713
4762
  );
4714
4763
  } else {
4715
- console.warn(
4716
- `ShadowRoot not found in the element '${this.shadowRootSelector}'.`
4717
- );
4718
- return;
4764
+ logger.warn(`ShadowRoot not found for selector '${this.shadowRootSelector}'`);
4765
+ return null;
4719
4766
  }
4720
4767
  } else {
4721
- originalCheckoutButton = (_a = this.getElementsBySelector(
4722
- this.dataSelector
4723
- )) == null ? void 0 : _a[0];
4768
+ button = (_a = this.getElementsBySelector(this.dataSelector)) == null ? void 0 : _a[0];
4724
4769
  }
4725
- if (!originalCheckoutButton) {
4726
- console.warn(`Button not found with selector '${this.dataSelector}'.`);
4727
- return;
4770
+ if (!button) {
4771
+ logger.warn(`Checkout button not found with selector '${this.dataSelector}'`);
4772
+ return null;
4728
4773
  }
4729
- originalCheckoutButton.setAttribute("shipaid-hidden", "");
4730
- const originalClasses = originalCheckoutButton.className;
4731
- const protectionPrice = Number((_b = this._protectionVariant) == null ? void 0 : _b.price) || 0;
4732
- const cartPrice = (Number((_c = this._cart) == null ? void 0 : _c.total_price) || 0) / 100;
4774
+ this._cachedCheckoutButton = button;
4775
+ this._cachedCheckoutButtonClasses = button.className;
4776
+ return button;
4777
+ }
4778
+ /**
4779
+ * Calculate cart totals for checkoutButtonTemplate
4780
+ * @private
4781
+ */
4782
+ _calculateCheckoutCartTotals() {
4783
+ var _a, _b;
4784
+ const protectionPrice = Number((_a = this._protectionVariant) == null ? void 0 : _a.price) || 0;
4785
+ const cartPrice = (Number((_b = this._cart) == null ? void 0 : _b.total_price) || 0) / 100;
4733
4786
  const cartTotal = !this._hasProtectionInCart ? protectionPrice + cartPrice : cartPrice;
4734
- const isGreenProtectionEnabled = Boolean(
4735
- (_e = (_d = this._store) == null ? void 0 : _d.greenProtection) == null ? void 0 : _e.enabled
4736
- );
4737
- const isFreeGiftEnabled = Boolean(
4738
- (_g = (_f = this._store) == null ? void 0 : _f.freeGifts) == null ? void 0 : _g.enabled
4739
- );
4787
+ return { protectionPrice, cartPrice, cartTotal };
4788
+ }
4789
+ /**
4790
+ * Get impact features for checkoutButtonTemplate
4791
+ * @private
4792
+ */
4793
+ _getCheckoutImpactFeatures() {
4794
+ var _a, _b, _c, _d;
4795
+ const isGreenProtectionEnabled = Boolean((_b = (_a = this._store) == null ? void 0 : _a.greenProtection) == null ? void 0 : _b.enabled);
4796
+ const isFreeGiftEnabled = Boolean((_d = (_c = this._store) == null ? void 0 : _c.freeGifts) == null ? void 0 : _d.enabled);
4740
4797
  const impactActive = isGreenProtectionEnabled || isFreeGiftEnabled;
4741
- const loading2 = x`
4742
- <svg
4743
- width="1.5rem"
4744
- height="1.5rem"
4745
- viewBox="0 0 50 50"
4746
- xmlns="http://www.w3.org/2000/svg"
4747
- fill="none"
4748
- stroke="currentColor"
4749
- stroke-width="4"
4750
- class="shipaid-loader"
4751
- >
4752
- <circle cx="25" cy="25" r="20" stroke-opacity="0.5" />
4753
- <path d="M45 25a20 20 0 0 1-40 0" stroke="currentColor">
4754
- <animateTransform
4755
- attributeName="transform"
4756
- type="rotate"
4757
- from="0 25 25"
4758
- to="360 25 25"
4759
- dur="1s"
4760
- repeatCount="indefinite"
4761
- />
4762
- </path>
4763
- </svg>
4798
+ return { isGreenProtectionEnabled, isFreeGiftEnabled, impactActive };
4799
+ }
4800
+ /**
4801
+ * Render Get Mechanism theme checkout button
4802
+ * Modern UI based on the mechanism theme design
4803
+ * @private
4804
+ */
4805
+ _renderGetMechanismCheckoutButton(originalClasses, protectionPrice, cartTotal, _isGreenProtectionEnabled, _isFreeGiftEnabled, loading2) {
4806
+ var _a, _b, _c, _d, _e, _f;
4807
+ return x`
4808
+ <style>
4809
+ :host {
4810
+ display: inline-block;
4811
+ font-family: Arial, sans-serif;
4812
+ width: 100%;
4813
+ }
4814
+
4815
+ .mechanism-container {
4816
+ width: 100%;
4817
+ display: flex;
4818
+ flex-direction: column;
4819
+ }
4820
+
4821
+ .mechanism-protection-card {
4822
+ display: flex;
4823
+ align-items: center;
4824
+ justify-content: space-between;
4825
+ padding: 12px 16px;
4826
+ background: #fff;
4827
+ }
4828
+
4829
+ .mechanism-left {
4830
+ display: flex;
4831
+ align-items: center;
4832
+ gap: 12px;
4833
+ }
4834
+
4835
+ .mechanism-icon {
4836
+ width: 40px;
4837
+ height: 40px;
4838
+ display: flex;
4839
+ align-items: center;
4840
+ justify-content: center;
4841
+ flex-shrink: 0;
4842
+ }
4843
+
4844
+ .mechanism-icon img {
4845
+ width: 100%;
4846
+ height: 100%;
4847
+ object-fit: contain;
4848
+ border-radius: 6px;
4849
+ }
4850
+
4851
+ .mechanism-info {
4852
+ display: flex;
4853
+ flex-direction: column;
4854
+ gap: 2px;
4855
+ }
4856
+
4857
+ .mechanism-title {
4858
+ display: flex;
4859
+ font-weight: 600;
4860
+ font-size: 14px;
4861
+ line-height: 1.2;
4862
+ margin: 0;
4863
+ }
4864
+
4865
+ .mechanism-subtitle {
4866
+ font-size: 12px;
4867
+ color: #6b7280;
4868
+ margin: 0;
4869
+ }
4870
+
4871
+ .mechanism-price {
4872
+ font-weight: 600;
4873
+ font-size: 14px;
4874
+ color: #000;
4875
+ }
4876
+
4877
+ .mechanism-info-icon {
4878
+ width: 16px;
4879
+ height: 16px;
4880
+ border-radius: 50%;
4881
+ border: 1.5px solid #9ca3af;
4882
+ display: flex;
4883
+ align-items: center;
4884
+ justify-content: center;
4885
+ font-size: 11px;
4886
+ color: #9ca3af;
4887
+ font-weight: 600;
4888
+ cursor: pointer;
4889
+ margin-left: 6px;
4890
+ }
4891
+
4892
+ .mechanism-checkout-button {
4893
+ width: 100%;
4894
+ padding: 14px;
4895
+ background: #000;
4896
+ color: #fff;
4897
+ border: none;
4898
+ border-radius: 6px;
4899
+ font-weight: 600;
4900
+ font-size: 15px;
4901
+ cursor: pointer;
4902
+ transition: opacity 0.2s;
4903
+ display: flex;
4904
+ align-items: center;
4905
+ justify-content: center;
4906
+ gap: 8px;
4907
+ }
4908
+
4909
+ .mechanism-checkout-button:hover {
4910
+ opacity: 0.9;
4911
+ }
4912
+
4913
+ .mechanism-continue-link {
4914
+ text-align: center;
4915
+ font-size: 13px;
4916
+ color: #6b7280;
4917
+ text-decoration: underline;
4918
+ cursor: pointer;
4919
+ padding: 8px;
4920
+ }
4921
+
4922
+ .mechanism-continue-link:hover {
4923
+ color: #000;
4924
+ }
4925
+ </style>
4926
+
4927
+ <div class="mechanism-container">
4928
+ <div class="mechanism-protection-card">
4929
+ <div class="mechanism-left">
4930
+ <div class="mechanism-icon">
4931
+ ${((_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.theme_logo) ? x`<img src="${this._store.widgetConfigurations.theme_logo}" alt="Logo" />` : x`<img src="${ShipAidBlueIcon}" alt="ShipAid" />`}
4932
+ </div>
4933
+ <div class="mechanism-info">
4934
+ <p class="mechanism-title">
4935
+ Checkout+
4936
+ <span class="mechanism-info-icon" @click=${this._openLearnMore}>i</span>
4937
+ </p>
4938
+ <p class="mechanism-subtitle">Free returns + package protection</p>
4939
+ </div>
4940
+ </div>
4941
+ <div class="mechanism-price">
4942
+ ${protectionPrice ? this._currencyFormat(protectionPrice) : loading2}
4943
+ </div>
4944
+ </div>
4945
+
4946
+ ${this._sellingPlanId ? x`
4947
+ <button
4948
+ class="mechanism-checkout-button ${originalClasses}"
4949
+ @click=${async () => {
4950
+ var _a2, _b2;
4951
+ sessionStorage.setItem(
4952
+ "shipaid_variant",
4953
+ JSON.stringify((_a2 = this._protectionVariant) == null ? void 0 : _a2.id)
4954
+ );
4955
+ await this.addCartProtectionVariant();
4956
+ window.location.href = `/checkout?attributes[_shipaid-internal]=1&updates[${(_b2 = this._protectionVariant) == null ? void 0 : _b2.id}]=1`;
4957
+ }}
4958
+ >
4959
+ Checkout+ | ${cartTotal ? this._currencyFormat(cartTotal) : loading2}
4960
+ </button>
4961
+ ` : x`
4962
+ <a
4963
+ href="/checkout${((_c = this._protectionVariant) == null ? void 0 : _c.id) ? `?attributes[_shipaid-internal]=1&updates[${(_d = this._protectionVariant) == null ? void 0 : _d.id}]=1` : ""}"
4964
+ class="mechanism-checkout-button ${originalClasses}"
4965
+ @click=${() => {
4966
+ var _a2;
4967
+ sessionStorage.setItem(
4968
+ "shipaid_variant",
4969
+ JSON.stringify((_a2 = this._protectionVariant) == null ? void 0 : _a2.id)
4970
+ );
4971
+ }}
4972
+ >
4973
+ Checkout+ | ${cartTotal ? this._currencyFormat(cartTotal) : loading2}
4974
+ </a>
4975
+ `}
4976
+
4977
+ <a
4978
+ href="/checkout${((_e = this._protectionVariant) == null ? void 0 : _e.id) ? `?attributes[_shipaid-internal]=1&updates[${(_f = this._protectionVariant) == null ? void 0 : _f.id}]=0` : ""}"
4979
+ class="mechanism-continue-link"
4980
+ >
4981
+ Checkout without free returns & package protection
4982
+ </a>
4983
+ </div>
4764
4984
  `;
4985
+ }
4986
+ /**
4987
+ * Render default/original checkout button UI
4988
+ * @private
4989
+ */
4990
+ _renderDefaultCheckoutButton(originalClasses, protectionPrice, cartTotal, isGreenProtectionEnabled, isFreeGiftEnabled, impactActive, loading2) {
4991
+ var _a, _b, _c, _d, _e, _f;
4765
4992
  return x`
4766
4993
  <style>
4767
4994
  :host {
@@ -4967,7 +5194,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4967
5194
  ${this._sellingPlanId ? x`
4968
5195
  <button
4969
5196
  id="${this.buttonId || "shipaid-checkout-button"}"
4970
- variant="${(_h = this._protectionVariant) == null ? void 0 : _h.id}"
5197
+ variant="${(_a = this._protectionVariant) == null ? void 0 : _a.id}"
4971
5198
  class="${this.buttonClasses || originalClasses}"
4972
5199
  @click=${async () => {
4973
5200
  var _a2, _b2;
@@ -4984,8 +5211,8 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
4984
5211
  </button>
4985
5212
  ` : x`
4986
5213
  <a
4987
- variant="${(_i = this._protectionVariant) == null ? void 0 : _i.id}"
4988
- href="/checkout${((_j = this._protectionVariant) == null ? void 0 : _j.id) ? `?attributes[_shipaid-internal]=1&updates[${(_k = this._protectionVariant) == null ? void 0 : _k.id}]=1` : ""}"
5214
+ variant="${(_b = this._protectionVariant) == null ? void 0 : _b.id}"
5215
+ href="/checkout${((_c = this._protectionVariant) == null ? void 0 : _c.id) ? `?attributes[_shipaid-internal]=1&updates[${(_d = this._protectionVariant) == null ? void 0 : _d.id}]=1` : ""}"
4989
5216
  id="${this.buttonId || "shipaid-checkout-button"}"
4990
5217
  class="${this.buttonClasses || originalClasses}"
4991
5218
  @click=${() => {
@@ -5007,7 +5234,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
5007
5234
  </a>
5008
5235
  `}
5009
5236
  <a
5010
- href="/checkout${((_l = this._protectionVariant) == null ? void 0 : _l.id) ? `?attributes[_shipaid-internal]=1&updates[${(_m = this._protectionVariant) == null ? void 0 : _m.id}]=0` : ""}"
5237
+ href="/checkout${((_e = this._protectionVariant) == null ? void 0 : _e.id) ? `?attributes[_shipaid-internal]=1&updates[${(_f = this._protectionVariant) == null ? void 0 : _f.id}]=0` : ""}"
5011
5238
  class="continue-link"
5012
5239
  >
5013
5240
  <slot name="link-continue"
@@ -5017,6 +5244,60 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
5017
5244
  </div>
5018
5245
  `;
5019
5246
  }
5247
+ checkoutButtonTemplate() {
5248
+ var _a, _b;
5249
+ this._injectCheckoutButtonGlobalStyles();
5250
+ const originalCheckoutButton = this._findAndCacheCheckoutButton();
5251
+ if (!originalCheckoutButton) return;
5252
+ originalCheckoutButton.setAttribute("shipaid-hidden", "");
5253
+ const originalClasses = this._cachedCheckoutButtonClasses || originalCheckoutButton.className;
5254
+ const { protectionPrice, cartTotal } = this._calculateCheckoutCartTotals();
5255
+ const { isGreenProtectionEnabled, isFreeGiftEnabled, impactActive } = this._getCheckoutImpactFeatures();
5256
+ const loading2 = x`
5257
+ <svg
5258
+ width="1.5rem"
5259
+ height="1.5rem"
5260
+ viewBox="0 0 50 50"
5261
+ xmlns="http://www.w3.org/2000/svg"
5262
+ fill="none"
5263
+ stroke="currentColor"
5264
+ stroke-width="4"
5265
+ class="shipaid-loader"
5266
+ >
5267
+ <circle cx="25" cy="25" r="20" stroke-opacity="0.5" />
5268
+ <path d="M45 25a20 20 0 0 1-40 0" stroke="currentColor">
5269
+ <animateTransform
5270
+ attributeName="transform"
5271
+ type="rotate"
5272
+ from="0 25 25"
5273
+ to="360 25 25"
5274
+ dur="1s"
5275
+ repeatCount="indefinite"
5276
+ />
5277
+ </path>
5278
+ </svg>
5279
+ `;
5280
+ const useGetMechanismTheme = ((_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.theme) === "get_mechanism";
5281
+ if (useGetMechanismTheme) {
5282
+ return this._renderGetMechanismCheckoutButton(
5283
+ originalClasses,
5284
+ protectionPrice,
5285
+ cartTotal,
5286
+ isGreenProtectionEnabled,
5287
+ isFreeGiftEnabled,
5288
+ loading2
5289
+ );
5290
+ }
5291
+ return this._renderDefaultCheckoutButton(
5292
+ originalClasses,
5293
+ protectionPrice,
5294
+ cartTotal,
5295
+ isGreenProtectionEnabled,
5296
+ isFreeGiftEnabled,
5297
+ impactActive,
5298
+ loading2
5299
+ );
5300
+ }
5020
5301
  renderPopups() {
5021
5302
  if (this.persistPopup) {
5022
5303
  this._popup = this.shouldPersistPopup();
@@ -5225,6 +5506,29 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
5225
5506
  } catch {
5226
5507
  }
5227
5508
  }
5509
+ updated(changedProperties) {
5510
+ super.updated(changedProperties);
5511
+ if (!this._hasFinishedSetup) return;
5512
+ const dbContactlessSelector = this._getContactlessCheckoutSelector();
5513
+ const sessionSelector = sessionStorage.getItem("shipaidWidgetTheme");
5514
+ if (!sessionSelector && dbContactlessSelector) {
5515
+ sessionStorage.setItem("shipaidWidgetTheme", dbContactlessSelector);
5516
+ }
5517
+ if (this.useShipAidCheckout || !dbContactlessSelector) {
5518
+ sessionStorage.removeItem("shipaidWidgetTheme");
5519
+ }
5520
+ if (!this.useShipAidCheckout) {
5521
+ document.querySelectorAll('[id*="shipaid-checkout-container"]').forEach((container) => container.remove());
5522
+ }
5523
+ if (!this._shouldShowWidgetContent()) {
5524
+ const selector = sessionStorage.getItem("shipaidWidgetTheme") || this.dataSelector;
5525
+ if (selector) {
5526
+ this.getElementsBySelector(selector).forEach((button) => {
5527
+ button.removeAttribute("shipaid-hidden");
5528
+ });
5529
+ }
5530
+ }
5531
+ }
5228
5532
  async updateProtection(force = false) {
5229
5533
  var _a, _b, _c;
5230
5534
  this._cartLastUpdated = /* @__PURE__ */ new Date();
@@ -5842,35 +6146,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
5842
6146
  }
5843
6147
  </style>
5844
6148
  <div class="shipaid">
5845
- ${n(
5846
- this._hasFinishedSetup,
5847
- () => {
5848
- var _a, _b, _c, _d, _e;
5849
- const dbContactlessCheckoutSelector = (_d = (_c = (_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) == null ? void 0 : _c.theme_checkout) == null ? void 0 : _d.checkoutButtonSelector;
5850
- const inSessionStorageCheckoutButtonSelector = sessionStorage.getItem("shipaidWidgetTheme");
5851
- if (!inSessionStorageCheckoutButtonSelector && dbContactlessCheckoutSelector) {
5852
- sessionStorage.setItem(
5853
- "shipaidWidgetTheme",
5854
- dbContactlessCheckoutSelector
5855
- );
5856
- }
5857
- if (this.useShipAidCheckout || !dbContactlessCheckoutSelector) {
5858
- sessionStorage.removeItem("shipaidWidgetTheme");
5859
- }
5860
- const configOk = this._shouldShowWidget && this.planActive && ((_e = this._store) == null ? void 0 : _e.widgetShowCart);
5861
- if (configOk) {
5862
- return inSessionStorageCheckoutButtonSelector ? this.contactlessCheckoutButtonTemplate() : this.promptTemplate();
5863
- }
5864
- if (!this.useShipAidCheckout) {
5865
- document.querySelectorAll('[id*="shipaid-checkout-container"]').forEach((container) => container.remove());
5866
- }
5867
- this.getElementsBySelector(
5868
- sessionStorage.getItem("shipaidWidgetTheme") || this.dataSelector
5869
- ).forEach((button) => button.removeAttribute("shipaid-hidden"));
5870
- return A;
5871
- },
5872
- () => sessionStorage.getItem("shipaidWidgetTheme") ? this.contactlessCheckoutButtonTemplate() : this.promptTemplate()
5873
- )}
6149
+ ${this._getTemplateToRender()}
5874
6150
  </div>
5875
6151
  `;
5876
6152
  }