@getspot/spot-widget 4.1.0 → 4.1.1
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/CHANGELOG.md +7 -0
- package/dist/index.es.js +17 -14
- package/dist/index.umd.js +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.1.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.1.0...@getspot/spot-widget@4.1.1) (2026-03-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **core:** prevent payment terms from displaying if they are empty in api response ([918df9d](https://gitlab.com/getspot/spot-widget/commit/918df9d6685a6c83ac16e17bf9b063b817b1f128))
|
|
7
|
+
|
|
1
8
|
# [4.1.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.0.4...@getspot/spot-widget@4.1.0) (2026-03-04)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.es.js
CHANGED
|
@@ -433,20 +433,23 @@ function Q(m, t, o) {
|
|
|
433
433
|
return e.type = "radio", e.name = "selection", e.value = b.NO, t === b.NO && (e.checked = !0), a("span", { text: o.noOptionText, parent: n }), s;
|
|
434
434
|
}
|
|
435
435
|
function M(m, t) {
|
|
436
|
-
var
|
|
437
|
-
const o = (
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
436
|
+
var s;
|
|
437
|
+
const o = (s = t.communication) == null ? void 0 : s.paymentTerms;
|
|
438
|
+
if (o) {
|
|
439
|
+
const i = a("div", {
|
|
440
|
+
className: "spot-payment-terms",
|
|
441
|
+
parent: m
|
|
442
|
+
});
|
|
443
|
+
return a("div", {
|
|
444
|
+
className: "spot-payment-terms__header",
|
|
445
|
+
text: "PAYMENT TERMS",
|
|
446
|
+
parent: i
|
|
447
|
+
}), a("div", {
|
|
448
|
+
className: "spot-payment-terms__body",
|
|
449
|
+
text: o || "",
|
|
450
|
+
parent: i
|
|
451
|
+
}), i;
|
|
452
|
+
}
|
|
450
453
|
}
|
|
451
454
|
function Z(m, t, o = "bottom-right") {
|
|
452
455
|
if (o === "top-right") {
|
package/dist/index.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" class="spot-bullets__checkmark">
|
|
3
3
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
4
4
|
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
</svg>`,a("span",{text:s,parent:i})})}function A(m,t=[]){if(!t||t.length===0)return;const o=a("div",{className:"spot-qualifying-reasons__container",parent:m}),s=[...t].sort((e,p)=>e.rank-p.rank),i=a("div",{className:"spot-qualifying-reasons__grid",parent:o}),r={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let n;try{const e=document.currentScript;if(e!=null&&e.src){const p=new URL(e.src);n=p.origin+p.pathname.replace(/\/[^/]*$/,"/")}else n=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");n+="assets/"}catch{n="./assets/"}s.forEach(e=>{var g,h,c;const p=a("div",{className:"spot-qualifying-reasons__item",parent:i}),u=a("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:p}),f=r[((g=e.benefitType)==null?void 0:g.name)||""]||r[e.name||""];if(f){const l=a("img",{parent:u});l.src=n+f,l.alt=((h=e.benefitType)==null?void 0:h.name)||e.name||"",l.className="spot-qualifying-reasons__icon"}a("span",{className:"spot-qualifying-reasons__label",text:((c=e.benefitType)==null?void 0:c.name)||e.name||"",parent:p})})}function R(m,t=[],o){if(t.length===0||!o||o<=1)return;const s=new Map;t.forEach(l=>{s.set(l,(s.get(l)||0)+1)});const r=Array.from(s.entries()).map(([l,d])=>({item:l,count:d,displayText:d>1?`${d} x ${l}`:l})).sort((l,d)=>{const b=l.item.charAt(0),w=d.item.charAt(0),k=/[a-zA-Z]/.test(b),q=/[a-zA-Z]/.test(w);return!k&&q?-1:k&&!q?1:l.item.localeCompare(d.item,void 0,{sensitivity:"base"})}),n=a("div",{className:"spot-covered-items__container",parent:m}),e=a("div",{className:"spot-covered-items__header",parent:n}),p=a("button",{className:"spot-covered-items__toggle",parent:e});a("span",{className:"spot-covered-items__title",text:`Items Covered in Your Cart (${t.length})`,parent:p});const u=a("div",{className:"spot-covered-items__right-section",parent:p});a("span",{className:"spot-covered-items__view-all",text:"View All",parent:u});const f=a("span",{className:"spot-covered-items__arrow",innerHTML:"▼",parent:u}),g=a("div",{className:"spot-covered-items__content",parent:n}),h=a("ul",{className:"spot-covered-items__list",parent:g});r.forEach(({displayText:l})=>{const d=a("li",{parent:h});a("span",{text:l,parent:d})});let c=!1;g.style.display="none",p.addEventListener("click",l=>{l.stopPropagation(),c=!c,g.style.display=c?"block":"none",f.innerHTML=c?"▲":"▼",p.setAttribute("aria-expanded",c.toString())}),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls","covered-items-list"),g.setAttribute("id","covered-items-list")}const V={USD:"$",CAD:"CAD $",AUD:"AUD $",NZD:"NZD $",MXN:"MXN $",EUR:"EUR €",GBP:"GBP £",AED:"AED ",MAD:"MAD ",SAR:"SAR "};function Q(m,t=[],o="USD"){const s=V[o]??`${o} `,i=a("div",{className:"spot-table__container",parent:m}),r=a("table",{className:"spot-refund__table spot-table--dynamic",parent:i}),n=a("thead",{parent:r}),e=a("tr",{parent:n});a("th",{text:"When you cancel",parent:e}),a("th",{text:"You will receive",parent:e});const p=a("tbody",{parent:r});t.forEach(({text:u,percent:f,amount:g})=>{const h=a("tr",{parent:p});a("td",{text:u,parent:h});const c=f==="Not eligible for refund"?"Not eligible for a refund":`${s}${g} refund`;a("td",{text:c,parent:h})})}function Z(m,t,o){const s=a("div",{className:"spot-selection__options",parent:m}),i=a("label",{className:`spot-selection__option ${t===y.YES?"selected":""}`,parent:s}),r=a("input",{parent:i});r.type="radio",r.name="selection",r.value=y.YES,t===y.YES&&(r.checked=!0),a("strong",{text:o.yesOptionText,parent:i}),a("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:i});const n=a("label",{className:`spot-selection__option ${t===y.NO?"selected":""}`,parent:s}),e=a("input",{parent:n});return e.type="radio",e.name="selection",e.value=y.NO,t===y.NO&&(e.checked=!0),a("span",{text:o.noOptionText,parent:n}),s}function I(m,t){var
|
|
5
|
+
</svg>`,a("span",{text:s,parent:i})})}function A(m,t=[]){if(!t||t.length===0)return;const o=a("div",{className:"spot-qualifying-reasons__container",parent:m}),s=[...t].sort((e,p)=>e.rank-p.rank),i=a("div",{className:"spot-qualifying-reasons__grid",parent:o}),r={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let n;try{const e=document.currentScript;if(e!=null&&e.src){const p=new URL(e.src);n=p.origin+p.pathname.replace(/\/[^/]*$/,"/")}else n=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");n+="assets/"}catch{n="./assets/"}s.forEach(e=>{var g,h,c;const p=a("div",{className:"spot-qualifying-reasons__item",parent:i}),u=a("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:p}),f=r[((g=e.benefitType)==null?void 0:g.name)||""]||r[e.name||""];if(f){const l=a("img",{parent:u});l.src=n+f,l.alt=((h=e.benefitType)==null?void 0:h.name)||e.name||"",l.className="spot-qualifying-reasons__icon"}a("span",{className:"spot-qualifying-reasons__label",text:((c=e.benefitType)==null?void 0:c.name)||e.name||"",parent:p})})}function R(m,t=[],o){if(t.length===0||!o||o<=1)return;const s=new Map;t.forEach(l=>{s.set(l,(s.get(l)||0)+1)});const r=Array.from(s.entries()).map(([l,d])=>({item:l,count:d,displayText:d>1?`${d} x ${l}`:l})).sort((l,d)=>{const b=l.item.charAt(0),w=d.item.charAt(0),k=/[a-zA-Z]/.test(b),q=/[a-zA-Z]/.test(w);return!k&&q?-1:k&&!q?1:l.item.localeCompare(d.item,void 0,{sensitivity:"base"})}),n=a("div",{className:"spot-covered-items__container",parent:m}),e=a("div",{className:"spot-covered-items__header",parent:n}),p=a("button",{className:"spot-covered-items__toggle",parent:e});a("span",{className:"spot-covered-items__title",text:`Items Covered in Your Cart (${t.length})`,parent:p});const u=a("div",{className:"spot-covered-items__right-section",parent:p});a("span",{className:"spot-covered-items__view-all",text:"View All",parent:u});const f=a("span",{className:"spot-covered-items__arrow",innerHTML:"▼",parent:u}),g=a("div",{className:"spot-covered-items__content",parent:n}),h=a("ul",{className:"spot-covered-items__list",parent:g});r.forEach(({displayText:l})=>{const d=a("li",{parent:h});a("span",{text:l,parent:d})});let c=!1;g.style.display="none",p.addEventListener("click",l=>{l.stopPropagation(),c=!c,g.style.display=c?"block":"none",f.innerHTML=c?"▲":"▼",p.setAttribute("aria-expanded",c.toString())}),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls","covered-items-list"),g.setAttribute("id","covered-items-list")}const V={USD:"$",CAD:"CAD $",AUD:"AUD $",NZD:"NZD $",MXN:"MXN $",EUR:"EUR €",GBP:"GBP £",AED:"AED ",MAD:"MAD ",SAR:"SAR "};function Q(m,t=[],o="USD"){const s=V[o]??`${o} `,i=a("div",{className:"spot-table__container",parent:m}),r=a("table",{className:"spot-refund__table spot-table--dynamic",parent:i}),n=a("thead",{parent:r}),e=a("tr",{parent:n});a("th",{text:"When you cancel",parent:e}),a("th",{text:"You will receive",parent:e});const p=a("tbody",{parent:r});t.forEach(({text:u,percent:f,amount:g})=>{const h=a("tr",{parent:p});a("td",{text:u,parent:h});const c=f==="Not eligible for refund"?"Not eligible for a refund":`${s}${g} refund`;a("td",{text:c,parent:h})})}function Z(m,t,o){const s=a("div",{className:"spot-selection__options",parent:m}),i=a("label",{className:`spot-selection__option ${t===y.YES?"selected":""}`,parent:s}),r=a("input",{parent:i});r.type="radio",r.name="selection",r.value=y.YES,t===y.YES&&(r.checked=!0),a("strong",{text:o.yesOptionText,parent:i}),a("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:i});const n=a("label",{className:`spot-selection__option ${t===y.NO?"selected":""}`,parent:s}),e=a("input",{parent:n});return e.type="radio",e.name="selection",e.value=y.NO,t===y.NO&&(e.checked=!0),a("span",{text:o.noOptionText,parent:n}),s}function I(m,t){var s;const o=(s=t.communication)==null?void 0:s.paymentTerms;if(o){const i=a("div",{className:"spot-payment-terms",parent:m});return a("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:i}),a("div",{className:"spot-payment-terms__body",text:o||"",parent:i}),i}}function U(m,t,o="bottom-right"){if(o==="top-right"){const e=a("div",{className:"spot-logo__top-right",parent:m});e.innerHTML=`
|
|
6
6
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
7
|
<rect width="145" height="28"/>
|
|
8
8
|
<rect x="-655" y="-270" width="819" height="325" rx="10"/>
|
package/dist/ui.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare function renderQualifyingReasons(container: HTMLElement, qualifyi
|
|
|
6
6
|
export declare function renderCoveredItems(container: HTMLElement, coveredItems?: string[], totalItemsInRequest?: number): void;
|
|
7
7
|
export declare function renderTable(container: HTMLElement, schedule?: PayoutScheduleItem[], currencyCode?: string): void;
|
|
8
8
|
export declare function renderOptions(container: HTMLElement, selection: SelectionEnum, communication: Communication): HTMLElement;
|
|
9
|
-
export declare function renderPaymentTerms(container: HTMLElement, quote: Quote): HTMLElement;
|
|
9
|
+
export declare function renderPaymentTerms(container: HTMLElement, quote: Quote): HTMLElement | void;
|
|
10
10
|
export declare function renderFooter(container: HTMLElement, quote: Quote, logoPosition?: "bottom-right" | "top-right"): HTMLElement;
|
|
11
11
|
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC1D,GAAG,EAAE,CAAC,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAE,cAAmB,GACxE,qBAAqB,CAAC,CAAC,CAAC,CAS1B;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjE,IAAI,CAWN;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,IAAI,CAcN;AAGD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,EACtB,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,IAAI,CA0EN;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,YAAY,GAAE,MAAM,EAAO,EAC3B,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAiHN;AAgBD,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,EACtB,QAAQ,GAAE,kBAAkB,EAAO,EACnC,YAAY,GAAE,MAAc,GAC3B,IAAI,CA2BN;AAGD,wBAAgB,aAAa,CAC3B,SAAS,EAA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