PageSourceSearch

https://www.cfainstitute.org/modules/custom/ep_search_api_coveo/js…/atomic-commerce-product-listBQkQnNU-.js

js cfainstitute.org collected 2026-09-24 07:45:47 UTC 19,926 bytes, 281 lines download raw bytes

1import { c as e, i as t, o as n } from "./bueno.esmDzhC9rWj.js";
2import { l as r, o as i } from "./commerce.indexBu0Q3kxk.js";
3import { a, i as o, n as s, o as c, p as l, r as u, u as d } from "./decoratorsDgvFPsqQ.js";
4import { t as f } from "./keyedBPCVJzoF.js";
5import { n as p } from "./refCq4ZCYz5.js";
6import { t as m } from "./whenDHlaxSuD.js";
7import { t as h } from "./bind-stateHBIU0rdL.js";
8import { t as g } from "./binding-guardBYpyFCsg.js";
9import { t as _ } from "./bindingsC1qzP6-H.js";
10import { t as v } from "./with-tailwind-stylesCLrXF-GP.js";
11import { t as y } from "./error-guardDZkUaSL0.js";
12import { d as b } from "./utilsCdZ5ESYt.js";
13import { n as x } from "./accessibility-utilsBIK7wPoy.js";
14import { t as S } from "./mapBA9JtKXU.js";
15import { t as C } from "./storeCURF8TVf.js";
16import { t as w } from "./children-update-complete-mixinBfBpoPA0.js";
17import { i as T, n as E, r as D, t as O } from "./placeholders.tw.cssB80O2fUW.js";
18import { n as k, r as A } from "./atomic-producth55BOYFZ.js";
19import { n as j } from "./base-template-controllerDBaGR5sS.js";
20import { t as M } from "./product-template-providerBMg0MsbJ.js";
21//#region node_modules/@coveo/atomic/dist/atomic/components/components/common/item-list/styles/grid-display.tw.css.js
22var N = l`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties;:host{[part~=outline][part~=result-list-grid-clickable-container]{border:1px solid transparent;border-radius:1rem;padding:1rem;position:relative;transition:all .12s ease-out;&:hover{border-color:var(--atomic-neutral);border-style:var(--tw-border-style);border-width:1px;box-shadow:0 10px 25px var(--atomic-neutral);cursor:pointer}}[part=result-list-grid-clickable]:focus-visible{border-color:var(--atomic-primary);border-radius:2px;border-style:var(--tw-border-style);border-width:2px;color:var(--atomic-primary);cursor:pointer;display:inline-block;position:absolute;text-align:center;text-decoration:underline}[part=result-list-grid-clickable]:not(:focus){clip:rect(1px,1px,1px,1px);overflow:hidden;padding:0;position:absolute}.list-wrapper{word-break:break-word}.list-root.display-grid{display:grid;justify-content:space-evenly;.result-component{box-sizing:border-box;height:100%}}.list-root.display-grid{@media (width >= 1024px){grid-template-columns:repeat(auto-fit,minmax(17rem,1fr));&.density-comfortable{grid-row-gap:4rem;grid-column-gap:1.5rem}&.density-compact,&.density-normal{grid-row-gap:3rem;grid-column-gap:1.5rem}&.image-large{grid-template-columns:repeat(auto-fill,minmax(19rem,1fr))}&.image-small{@media not all and (width >= 1024px){grid-template-columns:repeat(3,1fr)}@media (width >= 1024px){grid-template-columns:repeat(3,1fr)}@media (min-width:1280px){grid-template-columns:repeat(4,1fr)}}}}.list-root.display-grid{@media not all and (width >= 1024px){&.image-large{@media not all and (min-width:768px){grid-template-columns:minmax(auto,35rem);&.density-comfortable{[part~=outline]{&:before{margin:2rem 0}}}&.density-normal{[part~=outline]{&:before{margin:1.5rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.75rem 0}}}}&.density-compact{[part~=outline]{&:before{margin:1rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.5rem 0}}}}[part~=outline]{&:before{background-color:var(--atomic-neutral);content:" ";display:block;height:1px}&:first-of-type:before{display:none}}atomic-result-placeholder{&:before{background-color:transparent}}}@media (min-width:768px){grid-column-gap:.5rem;grid-row-gap:.5rem;grid-template-columns:1fr 1fr;[part~=outline]{border-color:var(--atomic-neutral);border-radius:1rem;border-style:var(--tw-border-style);border-width:1px;padding:1rem}atomic-result-placeholder{border-color:transparent}}}&.image-icon,&.image-none,&.image-small{grid-column-gap:.5rem;grid-row-gap:.5rem;[part~=outline]{border-color:var(--atomic-neutral);border-radius:1rem;border-style:var(--tw-border-style);border-width:1px;padding:1rem}atomic-result-placeholder{border-color:transparent}@media not all and (min-width:640px){grid-template-columns:minmax(0,1fr)}@media (min-width:768px){grid-template-columns:minmax(0,1fr) minmax(0,1fr)}@media (width >= 1024px){grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}}}}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid}}}`, P = l`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties;[part~=divider]{margin-bottom:1rem;&:not(:last-child){border-bottom-color:var(--atomic-neutral);padding-bottom:1rem}}.list-root.display-list{display:flex;flex-direction:column;.result-component,atomic-result-placeholder{width:auto}@media (width >= 1024px){&.density-comfortable{[part~=outline]{&:before{margin:2rem 0}}}&.density-normal{[part~=outline]{&:before{margin:1.5rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.75rem 0}}}}&.density-compact{[part~=outline]{&:before{margin:1rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.5rem 0}}}}[part~=outline]{&:before{background-color:var(--atomic-neutral);content:" ";display:block;height:1px}&:first-of-type:before{display:none}}atomic-result-placeholder{&:before{background-color:transparent}}}@media not all and (width >= 1024px){&.image-large{display:grid;grid-template-columns:minmax(auto,35rem);justify-content:space-evenly;&.density-comfortable{[part~=outline]{&:before{margin:2rem 0}}}&.density-normal{[part~=outline]{&:before{margin:1.5rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.75rem 0}}}}&.density-compact{[part~=outline]{&:before{margin:1rem 0}}@media not all and (width >= 1024px){[part~=outline]{&:before{margin:1.5rem 0}}}}[part~=outline]{&:before{background-color:var(--atomic-neutral);content:" ";display:block;height:1px}&:first-of-type:before{display:none}}atomic-result-placeholder{&:before{background-color:transparent}}}&.image-icon,&.image-none,&.image-small{grid-row-gap:1rem;[part~=outline]{border-color:var(--atomic-neutral);border-radius:1rem;border-style:var(--tw-border-style);border-width:1px;padding:1rem}atomic-result-placeholder{border-color:transparent}}}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid}}}`, F = l`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */@layer properties;.list-wrapper.display-table{display:grid;overflow-x:auto}.list-root.display-table{border-collapse:separate;border-spacing:0;min-width:100%;td,th{border-color:var(--atomic-neutral);border-style:var(--tw-border-style);border-width:1px;font-family:var(--atomic-font-family);font-size:var(--atomic-text-sm);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));line-height:1rem;white-space:nowrap;&:not(:first-child){border-left:none}&:first-child{min-width:19rem}}th{background-color:var(--atomic-neutral-light);border-bottom:none;color:#000;font-weight:700;padding:1rem var(--padding);text-align:left;&:first-child{border-top-left-radius:var(--atomic-border-radius-xl)}&:last-child{border-top-right-radius:var(--atomic-border-radius-xl)}}td{border-top:none;color:var(--atomic-neutral-dark);padding:var(--padding);vertical-align:top}&.density-comfortable{--padding:2rem}&.density-normal{--padding:1.5rem}&.density-compact{--padding:1rem}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-border-style:solid}}}`, I = ({ props: e }) => {
23	let { host: t, listClasses: n, logger: r } = e, i = z(e);
24	return i.length || r.error("atomic-table-element elements missing in the template to display columns.", t), (e) => d`<table class="list-root ${n}" part="result-table">
25      <thead part="result-table-heading">
26        <tr part="result-table-heading-row">
27          ${S(i, (e) => d`<th part="result-table-heading-cell">
28              <atomic-text
29                .value=${e.getAttribute("label")}
30              ></atomic-text>
31            </th>`)}
32        </tr>
33      </thead>
34      <tbody part="result-table-body">
35        ${e}
36      </tbody>
37    </table>`;
38}, L = ({ props: e }) => {
39	let { key: t, rowIndex: n, setRef: r } = e;
40	return (e) => d`${f(t, d`<tr
41        .part="result-table-row${n % 2 == 1 ? " result-table-row-even" : " result-table-row-odd"}"
42        ${p((e) => r(e))}
43      >
44        ${e}
45      </tr>`)}`;
46}, R = ({ props: e }) => {
47	let { renderItem: t, firstItem: n, itemRenderingFunction: r } = e, i = z(e), a = i;
48	if (r && n) {
49		let e = document.createElement("div");
50		e.innerHTML = r(n, document.createElement("div")), a = Array.from(e.querySelectorAll(j));
51	}
52	return d`${S(a, (n, r) => d`${f(`${i[r]?.getAttribute("label") || n.getAttribute("label")}${e.key}`, d`<td part="result-table-cell">${t(n)}</td>`)}`)}`;
53}, z = (e) => e.itemRenderingFunction ? B(e) : V(e), B = (e) => {
54	let { firstItem: t, itemRenderingFunction: n } = e, r = document.createElement("div");
55	return r.innerHTML = n(t, document.createElement("div")), Array.from(r.querySelectorAll(j));
56}, V = (e) => Array.from(e.templateContentForFirstItem.querySelectorAll(j)), H = function(e, t, n, r) {
57	var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
58	if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
59	else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
60	return i > 3 && a && Object.defineProperty(t, n, a), a;
61}, U = class extends w(a) {
62	constructor() {
63		super(...arguments), this.loadingFlag = b("firstProductLoaded-"), this.isAppLoaded = !1, this.isEveryProductReady = !1, this.resultTemplateRegistered = !1, this.templateHasError = !1, this.density = "normal", this.display = "grid", this.imageSize = "small", this.numberOfPlaceholders = 24;
64	}
65	async setRenderFunction(e) {
66		this.itemRenderingFunction = e;
67	}
68	initialize() {
69		this.validateProps(), this.initSearchOrListing(), this.initSummary(), this.initProductTemplateProvider(), this.initProductListCommon(), this.createSelectChildProductListener(), C(this.bindings.store, (e) => {
70			this.isAppLoaded = e;
71		});
72	}
73	disconnectedCallback() {
74		super.disconnectedCallback(), this.unsubscribeSummary?.(), this.removeEventListener("atomic/selectChildProduct", this.selectChildProductCallback);
75	}
76	async updated(e) {
77		super.updated(e), e.has("searchOrListingState") && !e.get("searchOrListingState")?.isLoading && this.searchOrListingState.isLoading && (this.isEveryProductReady = !1), await this.updateProductsReadyState();
78	}
79	async updateProductsReadyState() {
80		this.isAppLoaded && !this.isEveryProductReady && this.summaryState?.firstRequestExecuted && this.searchOrListingState?.products?.length > 0 && (await this.getUpdateComplete(), this.isEveryProductReady = !0);
81	}
82	render() {
83		return d`${m(this.shouldRender, () => d`${m(this.templateHasError, () => d`<slot></slot>`, () => {
84			let e = this.computeListDisplayClasses(), t = `${e} ${!this.isEveryProductReady && "hidden"}`;
85			return d`
86              ${m(this.isAppLoaded, () => D({ props: {
87				listClasses: t,
88				display: this.display
89			} })(d`${m(this.display === "grid", () => this.renderGrid(), () => d`${m(this.display === "list", () => this.renderList(), () => this.renderTable())}`)}`))}
90              ${m(!this.isEveryProductReady, () => D({ props: {
91				listClasses: e,
92				display: this.display
93			} })(T({ props: {
94				density: this.density,
95				display: this.display,
96				imageSize: this.imageSize,
97				numberOfPlaceholders: this.numberOfPlaceholders
98			} })))}
99            `;
100		})}`, () => c)}`;
101	}
102	validateProps() {
103		new n({
104			density: new e({ constrainTo: [
105				"normal",
106				"comfortable",
107				"compact"
108			] }),
109			display: new e({ constrainTo: [
110				"grid",
111				"list",
112				"table"
113			] }),
114			imageSize: new e({ constrainTo: [
115				"small",
116				"large",
117				"icon",
118				"none"
119			] }),
120			numberOfPlaceholders: new t({ min: 0 })
121		}).validate({
122			density: this.density,
123			display: this.display,
124			imageSize: this.imageSize,
125			numberOfPlaceholders: this.numberOfPlaceholders
126		});
127	}
128	initSearchOrListing() {
129		this.bindings.interfaceElement.type === "product-listing" ? this.searchOrListing = r(this.bindings.engine) : this.searchOrListing = i(this.bindings.engine);
130	}
131	initSummary() {
132		this.summary = this.searchOrListing.summary(), this.unsubscribeSummary = this.summary.subscribe(() => {
133			this.summaryState = this.summary.state, this.summaryState.firstRequestExecuted && this.bindings.store.unsetLoadingFlag(this.loadingFlag);
134		});
135	}
136	initProductTemplateProvider() {
137		this.productTemplateProvider = new M({
138			includeDefaultTemplate: !0,
139			templateElements: Array.from(this.querySelectorAll("atomic-product-template")),
140			getResultTemplateRegistered: () => this.resultTemplateRegistered,
141			getTemplateHasError: () => this.templateHasError,
142			setResultTemplateRegistered: (e) => {
143				this.resultTemplateRegistered = e;
144			},
145			setTemplateHasError: (e) => {
146				this.templateHasError = e;
147			}
148		});
149	}
150	initProductListCommon() {
151		this.productListCommon = new A({
152			engineSubscribe: this.bindings.engine.subscribe,
153			getCurrentNumberOfItems: () => this.searchOrListingState.products.length,
154			getIsLoading: () => this.searchOrListingState.isLoading,
155			host: this,
156			loadingFlag: this.loadingFlag,
157			nextNewItemTarget: this.focusTarget,
158			store: this.bindings.store
159		});
160	}
161	createSelectChildProductListener() {
162		this.addEventListener("atomic/selectChildProduct", this.selectChildProductCallback);
163	}
164	selectChildProductCallback(e) {
165		e.stopPropagation();
166		let t = e.detail.child;
167		this.searchOrListing.promoteChildToParent(t);
168	}
169	computeListDisplayClasses() {
170		let e = !(this.isAppLoaded && this.isEveryProductReady);
171		return k(this.display, this.density, this.imageSize, this.searchOrListingState?.isLoading, e);
172	}
173	renderGrid() {
174		return d`${S(this.searchOrListingState.products, (e, t) => E({ props: {
175			item: {
176				...e,
177				title: e.ec_name ?? ""
178			},
179			selectorForItem: "atomic-product",
180			setRef: (e) => {
181				e instanceof HTMLElement && this.productListCommon.setNewResultRef(e, t);
182			}
183		} })(d`${f(this.productListCommon.getResultId(e.permanentid, this.searchOrListingState.responseId, this.density, this.imageSize), d`<atomic-product
184            .content=${this.productTemplateProvider.getTemplateContent(e)}
185            .density=${this.density}
186            .display=${this.display}
187            .imageSize=${this.imageSize}
188            .interactiveProduct=${this.searchOrListing.interactiveProduct({ options: { product: e } })}
189            .linkContent=${this.productTemplateProvider.getLinkTemplateContent(e)}
190            .loadingFlag=${this.loadingFlag}
191            .product=${e}
192            .renderingFunction=${this.itemRenderingFunction}
193            .store=${this.bindings.store}
194          ></atomic-product>`)}`))}`;
195	}
196	renderList() {
197		return d`${S(this.searchOrListingState.products, (e, t) => d`${f(this.productListCommon.getResultId(e.permanentid, this.searchOrListingState.responseId, this.density, this.imageSize), d`<atomic-product
198          part="outline"
199          ${p((e) => e instanceof HTMLElement && this.productListCommon.setNewResultRef(e, t))}
200          .content=${this.productTemplateProvider.getTemplateContent(e)}
201          .density=${this.density}
202          .display=${this.display}
203          .imageSize=${this.imageSize}
204          .interactiveProduct=${this.searchOrListing.interactiveProduct({ options: { product: e } })}
205          .linkContent=${this.productTemplateProvider.getLinkTemplateContent(e)}
206          .loadingFlag=${this.loadingFlag}
207          .product=${e}
208          .renderingFunction=${this.itemRenderingFunction}
209          .store=${this.bindings.store}
210        ></atomic-product>`)}`)}`;
211	}
212	renderTable() {
213		return d`${m(this.summaryState.hasProducts, () => {
214			let e = this.searchOrListingState.products[0], t = this.computeListDisplayClasse
214s(), n = this.productTemplateProvider.getTemplateContent(e);
215			return I({ props: {
216				firstItem: e,
217				host: this,
218				itemRenderingFunction: this.itemRenderingFunction,
219				listClasses: t,
220				logger: this.bindings.engine.logger,
221				templateContentForFirstItem: n
222			} })(d`${S(this.searchOrListingState.products, (t, r) => {
223				let i = this.productListCommon.getResultId(t.permanentid, this.searchOrListingState.responseId, this.density, this.imageSize);
224				return L({ props: {
225					key: i,
226					rowIndex: r,
227					setRef: (e) => e instanceof HTMLElement && this.productListCommon.setNewResultRef(e, r)
228				} })(d`${R({ props: {
229					firstItem: e,
230					key: i,
231					itemRenderingFunction: this.itemRenderingFunction,
232					templateContentForFirstItem: n,
233					renderItem: (e) => d`${f(i, d`<atomic-product
234                        .content=${e}
235                        .density=${this.density}
236                        .display=${this.display}
237                        .imageSize=${this.imageSize}
238                        .interactiveProduct=${this.searchOrListing.interactiveProduct({ options: { product: t } })}
239                        .linkContent=${this.productTemplateProvider.getLinkTemplateContent(t)}
240                        .loadingFlag=${this.loadingFlag}
241                        .product=${t}
242                        .store=${this.bindings.store}
243                      ></atomic-product>`)}`
244				} })}`);
245			})}`);
246		}, () => c)}`;
247	}
248	get focusTarget() {
249		return this.nextNewResultTarget ||= new x(this, this.bindings), this.nextNewResultTarget;
250	}
251	get shouldRender() {
252		return !this.summaryState.hasError && this.resultTemplateRegistered && (!this.summaryState.firstRequestExecuted || this.summaryState.hasProducts);
253	}
254};
255U.styles = [
256	O,
257	F,
258	P,
259	N,
260	l`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */:host{.result-link{color:var(--atomic-on-background);&:focus-visible,&:hover{color:var(--atomic-primary);text-decoration:underline}&:focus{outline:none}&:visited{color:var(--atomic-visited)}}.result-grid{grid-template-columns:repeat(5,minmax(0,1fr));justify-items:center;& a{justify-content:center}}.result-list{display:flex;flex-direction:column;& .result-item{display:flex;flex-wrap:wrap;max-width:600px;width:100%;& .result-details{align-content:center}}}}@media (width >= 1024px){:host .result-grid{display:grid}}@media not all and (width >= 1024px){:host .result-grid{display:flex;flex-direction:column}}`
261], H([s()], U.prototype, "bindings", void 0), H([s()], U.prototype, "error", void 0), H([s()], U.prototype, "isAppLoaded", void 0), H([s()], U.prototype, "isEveryProductReady", void 0), H([s()], U.prototype, "resultTemplateRegistered", void 0), H([s()], U.prototype, "templateHasError", void 0), H([h("searchOrListing"), s()], U.prototype, "searchOrListingState", void 0), H([h("summary"), s()], U.prototype, "summaryState", void 0), H([u({
262	reflect: !0,
263	type: String
264})], U.prototype, "density", void 0), H([u({
265	reflect: !0,
266	type: String
267})], U.prototype, "display", void 0), H([u({
268	reflect: !0,
269	attribute: "image-size",
270	type: String
271})], U.prototype, "imageSize", void 0), H([u({
272	reflect: !0,
273	attribute: "number-of-placeholders",
274	type: Number
275})], U.prototype, "numberOfPlaceholders", void 0), H([g(), y()], U.prototype, "render", null), U = H([
276	o("atomic-commerce-product-list"),
277	_(),
278	v
279], U);
280//#endregion
281export { U as AtomicCommerceProductList };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.