ui.shipaid.com 0.3.75 → 0.3.78

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
@@ -2946,19 +2946,26 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
2946
2946
  contactlessCheckoutButtonTemplate() {
2947
2947
  var _a, _b, _c, _d;
2948
2948
  const styles2 = ((_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.styles) || "";
2949
- if (!document.getElementById("shipaid-styles") && styles2) {
2950
- const style = document.createElement("style");
2951
- style.id = "shipaid-styles";
2952
- style.textContent = `
2949
+ if (!document.getElementById("shipaid-styles") && styles2.trim()) {
2950
+ const styleRules = styles2.split(";").map((rule) => rule.trim()).filter(Boolean);
2951
+ const shipaidCheckoutContainerStyles = styleRules.filter((rule) => rule.includes("shipaid-checkout-container")).join("; ");
2952
+ const shipaidCheckoutComponentStyles = styleRules.filter((rule) => !rule.includes("shipaid-checkout-container")).join("; ");
2953
+ console.log("Styles applied ===========>", { shipaidCheckoutContainerStyles, shipaidCheckoutComponentStyles });
2954
+ const styleElement = document.createElement("style");
2955
+ styleElement.id = "shipaid-styles";
2956
+ styleElement.textContent = `
2953
2957
  checkout-package-protection {
2954
- width: 100%;
2955
- justify-content: center;
2956
- display: flex;
2957
- ${styles2}
2958
+ ${shipaidCheckoutComponentStyles};
2958
2959
  }
2959
2960
 
2960
- `;
2961
- document.head.appendChild(style);
2961
+ .shipaid-checkout-container {
2962
+ width: 100%;
2963
+ display: flex;
2964
+ ${shipaidCheckoutContainerStyles};
2965
+ justify-content: var(--shipaid-checkout-container-x-position, center);
2966
+ }
2967
+ `.trim();
2968
+ document.head.appendChild(styleElement);
2962
2969
  }
2963
2970
  const originalCheckoutButtons = document.querySelectorAll(`${sessionStorage.getItem("shipaidWidgetTheme")}:not(#shipaid-checkout-button)`);
2964
2971
  if (!originalCheckoutButtons.length) return;
@@ -2971,9 +2978,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
2971
2978
  if (!container) {
2972
2979
  container = document.createElement("div");
2973
2980
  container.id = containerId;
2974
- container.style.width = "100%";
2975
- container.style.display = "flex";
2976
- container.style.justifyContent = "center";
2981
+ container.className = "shipaid-checkout-container";
2977
2982
  originalCheckoutButton.insertAdjacentElement("afterend", container);
2978
2983
  }
2979
2984
  const protectionPrice = Number((_a2 = this._protectionVariant) == null ? void 0 : _a2.price) || 0;
@@ -1179,7 +1179,7 @@ function qt(t,e,i){return t?e():null==i?void 0:i()}const jt=u`
1179
1179
  @close=${()=>{this.persistPopup&&localStorage.removeItem(`${Ce}`),this._popup=null}}
1180
1180
  @remove-protection=${()=>{this.removeProtection(),this.persistPopup&&localStorage.removeItem(`${Ce}`),this._popup=null}}
1181
1181
  ></shipaid-popup-confirmation>
1182
- `}contactlessCheckoutButtonTemplate(){var t,e,i,o;const r=(null==(o=null==(i=null==(e=null==(t=this._store)?void 0:t.widgetConfigurations)?void 0:e.widget)?void 0:i.theme_checkout)?void 0:o.styles)||"";if(!document.getElementById("shipaid-styles")&&r){const t=document.createElement("style");t.id="shipaid-styles",t.textContent=`\n checkout-package-protection {\n width: 100%;\n justify-content: center;\n display: flex;\n ${r}\n }\n\n `,document.head.appendChild(t)}const n=document.querySelectorAll(`${sessionStorage.getItem("shipaidWidgetTheme")}:not(#shipaid-checkout-button)`);if(n.length)return n.forEach(((t,e)=>{var i,o,r;const n=`shipaid-checkout-container-${e}`;t.style.display="none";const a=t.className;let s=document.getElementById(n);s||(s=document.createElement("div"),s.id=n,s.style.width="100%",s.style.display="flex",s.style.justifyContent="center",t.insertAdjacentElement("afterend",s));const p=Number(null==(i=this._protectionVariant)?void 0:i.price)||0,d=(Number(null==(o=this._cart)?void 0:o.total_price)||0)/100,l=this._hasProtectionInCart?d:p+d,c=H`
1182
+ `}contactlessCheckoutButtonTemplate(){var t,e,i,o;const r=(null==(o=null==(i=null==(e=null==(t=this._store)?void 0:t.widgetConfigurations)?void 0:e.widget)?void 0:i.theme_checkout)?void 0:o.styles)||"";if(!document.getElementById("shipaid-styles")&&r.trim()){const t=r.split(";").map((t=>t.trim())).filter(Boolean),e=t.filter((t=>t.includes("shipaid-checkout-container"))).join("; "),i=t.filter((t=>!t.includes("shipaid-checkout-container"))).join("; ");console.log("Styles applied ===========>",{shipaidCheckoutContainerStyles:e,shipaidCheckoutComponentStyles:i});const o=document.createElement("style");o.id="shipaid-styles",o.textContent=`\n checkout-package-protection {\n ${i};\n }\n\n .shipaid-checkout-container {\n width: 100%;\n display: flex;\n ${e};\n justify-content: var(--shipaid-checkout-container-x-position, center);\n }\n `.trim(),document.head.appendChild(o)}const n=document.querySelectorAll(`${sessionStorage.getItem("shipaidWidgetTheme")}:not(#shipaid-checkout-button)`);if(n.length)return n.forEach(((t,e)=>{var i,o,r;const n=`shipaid-checkout-container-${e}`;t.style.display="none";const a=t.className;let s=document.getElementById(n);s||(s=document.createElement("div"),s.id=n,s.className="shipaid-checkout-container",t.insertAdjacentElement("afterend",s));const p=Number(null==(i=this._protectionVariant)?void 0:i.price)||0,d=(Number(null==(o=this._cart)?void 0:o.total_price)||0)/100,l=this._hasProtectionInCart?d:p+d,c=H`
1183
1183
  <svg width="1.5rem" height="1.5rem" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="4" class="shipaid-loader">
1184
1184
  <circle cx="25" cy="25" r="20" stroke-opacity="0.5"/>
1185
1185
  <path d="M45 25a20 20 0 0 1-40 0" stroke="currentColor">
@@ -1179,7 +1179,7 @@ function qt(t,e,i){return t?e():null==i?void 0:i()}const jt=u`
1179
1179
  @close=${()=>{this.persistPopup&&localStorage.removeItem(`${Ce}`),this._popup=null}}
1180
1180
  @remove-protection=${()=>{this.removeProtection(),this.persistPopup&&localStorage.removeItem(`${Ce}`),this._popup=null}}
1181
1181
  ></shipaid-popup-confirmation>
1182
- `}contactlessCheckoutButtonTemplate(){var t,e,i,o;const r=(null==(o=null==(i=null==(e=null==(t=this._store)?void 0:t.widgetConfigurations)?void 0:e.widget)?void 0:i.theme_checkout)?void 0:o.styles)||"";if(!document.getElementById("shipaid-styles")&&r){const t=document.createElement("style");t.id="shipaid-styles",t.textContent=`\n checkout-package-protection {\n width: 100%;\n justify-content: center;\n display: flex;\n ${r}\n }\n\n `,document.head.appendChild(t)}const n=document.querySelectorAll(`${sessionStorage.getItem("shipaidWidgetTheme")}:not(#shipaid-checkout-button)`);if(n.length)return n.forEach(((t,e)=>{var i,o,r;const n=`shipaid-checkout-container-${e}`;t.style.display="none";const a=t.className;let s=document.getElementById(n);s||(s=document.createElement("div"),s.id=n,s.style.width="100%",s.style.display="flex",s.style.justifyContent="center",t.insertAdjacentElement("afterend",s));const p=Number(null==(i=this._protectionVariant)?void 0:i.price)||0,d=(Number(null==(o=this._cart)?void 0:o.total_price)||0)/100,l=this._hasProtectionInCart?d:p+d,c=H`
1182
+ `}contactlessCheckoutButtonTemplate(){var t,e,i,o;const r=(null==(o=null==(i=null==(e=null==(t=this._store)?void 0:t.widgetConfigurations)?void 0:e.widget)?void 0:i.theme_checkout)?void 0:o.styles)||"";if(!document.getElementById("shipaid-styles")&&r.trim()){const t=r.split(";").map((t=>t.trim())).filter(Boolean),e=t.filter((t=>t.includes("shipaid-checkout-container"))).join("; "),i=t.filter((t=>!t.includes("shipaid-checkout-container"))).join("; ");console.log("Styles applied ===========>",{shipaidCheckoutContainerStyles:e,shipaidCheckoutComponentStyles:i});const o=document.createElement("style");o.id="shipaid-styles",o.textContent=`\n checkout-package-protection {\n ${i};\n }\n\n .shipaid-checkout-container {\n width: 100%;\n display: flex;\n ${e};\n justify-content: var(--shipaid-checkout-container-x-position, center);\n }\n `.trim(),document.head.appendChild(o)}const n=document.querySelectorAll(`${sessionStorage.getItem("shipaidWidgetTheme")}:not(#shipaid-checkout-button)`);if(n.length)return n.forEach(((t,e)=>{var i,o,r;const n=`shipaid-checkout-container-${e}`;t.style.display="none";const a=t.className;let s=document.getElementById(n);s||(s=document.createElement("div"),s.id=n,s.className="shipaid-checkout-container",t.insertAdjacentElement("afterend",s));const p=Number(null==(i=this._protectionVariant)?void 0:i.price)||0,d=(Number(null==(o=this._cart)?void 0:o.total_price)||0)/100,l=this._hasProtectionInCart?d:p+d,c=H`
1183
1183
  <svg width="1.5rem" height="1.5rem" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="4" class="shipaid-loader">
1184
1184
  <circle cx="25" cy="25" r="20" stroke-opacity="0.5"/>
1185
1185
  <path d="M45 25a20 20 0 0 1-40 0" stroke="currentColor">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.3.75",
4
+ "version": "0.3.78",
5
5
  "type": "module",
6
6
  "main": "dist/widget.umd.js",
7
7
  "unpkg": "dist/widget.iife.js",