forked from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Live Search Widgets (EDS Delivery) (#18)
* Add PLP and search widget * Add autocomplete widget * Use EDS delivered widgets * Fix linting * Fix linting * Add urlKey to route function * Update widget version * Fix PLP widget config * Fix CLS * Fix CLS * Fix SaaS environment for LS autocomplete * search.js latest from elsie-base-design branch * add to cart * Optimize add to cart and enable list view * latest widgets update from elsie-base-design * Style fixes --------- Co-authored-by: Kathleen Tynan <[email protected]>
- Loading branch information
1 parent
5eca7a0
commit c79f666
Showing
12 changed files
with
1,147 additions
and
973 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
helix-importer-ui | ||
scripts/preact.js | ||
scripts/htm.js | ||
tools/picker | ||
tools/picker | ||
scripts/widgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { loadScript } from '../../scripts/aem.js'; | ||
import { getConfigValue } from '../../scripts/configs.js'; | ||
|
||
(async () => { | ||
const widgetProd = '/scripts/widgets/LiveSearchAutocomplete.js'; | ||
await loadScript(widgetProd); | ||
|
||
const storeDetails = { | ||
environmentId: await getConfigValue('commerce-environment-id'), | ||
environmentType: (await getConfigValue('commerce-environment-id')).includes('sandbox') ? 'testing' : '', | ||
apiKey: await getConfigValue('commerce-x-api-key'), | ||
websiteCode: await getConfigValue('commerce-website-code'), | ||
storeCode: await getConfigValue('commerce-store-code'), | ||
storeViewCode: await getConfigValue('commerce-store-view-code'), | ||
config: { | ||
pageSize: 8, | ||
perPageConfig: { | ||
pageSizeOptions: '12,24,36', | ||
defaultPageSizeOption: '24', | ||
}, | ||
minQueryLength: '2', | ||
currencySymbol: '$', | ||
currencyRate: '1', | ||
displayOutOfStock: true, | ||
allowAllProducts: false, | ||
}, | ||
context: { | ||
customerGroup: await getConfigValue('commerce-customer-group'), | ||
}, | ||
route: ({ sku }) => `/products/missing-url-key/${sku}`, // TODO: We need urlKey as parameter as well! | ||
searchRoute: { | ||
route: '/search', | ||
query: 'q', | ||
}, | ||
}; | ||
|
||
await new Promise((resolve) => { | ||
const interval = setInterval(() => { | ||
if (window.LiveSearchAutocomplete) { | ||
clearInterval(interval); | ||
resolve(); | ||
} | ||
}, 200); | ||
}); | ||
|
||
// eslint-disable-next-line no-new | ||
new window.LiveSearchAutocomplete(storeDetails); | ||
})(); |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.