diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a8d4fe4f..0f1c3bdb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Bug Fixes + +- **controller/finder:** altering the beforeFind middleware to ensure redirection is blocked ([936e184](https://github.com/searchspring/snap/commit/936e184ba932fce75b379eeb6e197af0648aac68)) + +### Features + +- add autocomplete settings.redirects.singleResult config ([e620701](https://github.com/searchspring/snap/commit/e620701cb7d528ea4d3fe823bd0104e1bdd73a31)) +- icon component path element array, children support ([c8a6c44](https://github.com/searchspring/snap/commit/c8a6c4411636021f49da85c8eeb3e40528998f14)) +- move until utility function to toolbox ([d9d4eb3](https://github.com/searchspring/snap/commit/d9d4eb3d4994c30850e5829f1e609755112f5b06)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) ### Features diff --git a/docs/INTEGRATION_RECOMMENDATIONS.md b/docs/INTEGRATION_RECOMMENDATIONS.md index e13379cba..5c5697ccc 100644 --- a/docs/INTEGRATION_RECOMMENDATIONS.md +++ b/docs/INTEGRATION_RECOMMENDATIONS.md @@ -18,7 +18,8 @@ Context variables may be applied to individual recommendation profiles similar t | product | current product sku | product detail page | used to identify the current product being viewed | | cart | array (or function that returns an array) of current cart skus | all | optional method of setting cart contents | | options.siteId | global siteId overwrite | all | optional global siteId overwrite | -| options.categories | category path | all | optional category identifier to restrict recommendations | +| options.categories | array of category path strings | all | optional category identifiers used in category trending recommendation profiles | +| options.brands | array of brand strings | all | optional brand identifiers used in brand trending recommendation profiles | | options.branch | template branch overwrite | all | optional branch overwrite for recommendations template (advanced usage) | | options.filters | array of filters | all | optional recommendation filters | | options.batched | boolean (default: `true`)| all | only applies to recommendation context, optional disable profile from being batched in a single request, can also be set globally [via config](https://github.com/searchspring/snap/tree/main/packages/snap-controller/src/Recommendation) | diff --git a/lerna.json b/lerna.json index a2dd4b71b..99600a8f9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.47.0", + "version": "0.48.0", "packages": ["packages/*"], "useWorkspaces": true, "npmClient": "npm", diff --git a/package-lock.json b/package-lock.json index 5c2b9539c..9b88113c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40059,60 +40059,60 @@ }, "packages/snap-client": { "name": "@searchspring/snap-client", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "deepmerge": "4.3.1" } }, "packages/snap-controller": { "name": "@searchspring/snap-controller", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "css.escape": "1.5.1", "deepmerge": "4.3.1" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0" + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0" } }, "packages/snap-event-manager": { "name": "@searchspring/snap-event-manager", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT" }, "packages/snap-logger": { "name": "@searchspring/snap-logger", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0" + "@searchspring/snap-toolbox": "^0.48.0" } }, "packages/snap-preact": { "name": "@searchspring/snap-preact", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "deepmerge": "4.3.1", "intersection-observer": "0.12.0", "is-plain-object": "5.0.0" @@ -40123,11 +40123,11 @@ }, "packages/snap-preact-components": { "name": "@searchspring/snap-preact-components", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { "@emotion/react": "11.9.0", - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "classnames": "^2.3.2", "deepmerge": "4.3.1", "dequal": "2.0.3", @@ -40136,14 +40136,14 @@ "swiper": "6.8.4" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "@storybook/addon-actions": "6.4.22", "@storybook/addon-controls": "6.4.22", "@storybook/addon-docs": "6.4.22", @@ -40519,11 +40519,11 @@ }, "packages/snap-preact-demo": { "name": "@searchspring/snap-preact-demo", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-preact": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", + "@searchspring/snap-preact": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", "deepmerge": "4.3.1", "mobx-react": "7.5.0", "preact": "10.9.0" @@ -40796,42 +40796,42 @@ }, "packages/snap-profiler": { "name": "@searchspring/snap-profiler", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT" }, "packages/snap-shared": { "name": "@searchspring/snap-shared", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "devDependencies": { - "@searchspring/snap-client": "^0.47.0" + "@searchspring/snap-client": "^0.48.0" } }, "packages/snap-store-mobx": { "name": "@searchspring/snap-store-mobx", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "mobx": "^6.6.1" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0" + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0" } }, "packages/snap-toolbox": { "name": "@searchspring/snap-toolbox", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT" }, "packages/snap-tracker": { "name": "@searchspring/snap-tracker", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", "@types/uuid": "8.3.4", "deepmerge": "4.3.1", "uuid": "8.3.2" @@ -40839,7 +40839,7 @@ }, "packages/snap-url-manager": { "name": "@searchspring/snap-url-manager", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { "deepmerge": "4.3.1", @@ -45767,21 +45767,21 @@ "@searchspring/snap-client": { "version": "file:packages/snap-client", "requires": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "deepmerge": "4.3.1" } }, "@searchspring/snap-controller": { "version": "file:packages/snap-controller", "requires": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "css.escape": "1.5.1", "deepmerge": "4.3.1" } @@ -45792,22 +45792,22 @@ "@searchspring/snap-logger": { "version": "file:packages/snap-logger", "requires": { - "@searchspring/snap-toolbox": "^0.47.0" + "@searchspring/snap-toolbox": "^0.48.0" } }, "@searchspring/snap-preact": { "version": "file:packages/snap-preact", "requires": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "@types/react": "16.14.28", "deepmerge": "4.3.1", "intersection-observer": "0.12.0", @@ -45818,15 +45818,15 @@ "version": "file:packages/snap-preact-components", "requires": { "@emotion/react": "11.9.0", - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "@storybook/addon-actions": "6.4.22", "@storybook/addon-controls": "6.4.22", "@storybook/addon-docs": "6.4.22", @@ -46098,8 +46098,8 @@ "@babel/runtime": "^7.21.0", "@lhci/cli": "^0.11.0", "@searchspring/browserslist-config-snap": "^1.0.6", - "@searchspring/snap-preact": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", + "@searchspring/snap-preact": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", "babel-loader": "^9.1.2", "core-js": "^3.30.0", "css-loader": "^6.7.3", @@ -46279,15 +46279,15 @@ "@searchspring/snap-shared": { "version": "file:packages/snap-shared", "requires": { - "@searchspring/snap-client": "^0.47.0" + "@searchspring/snap-client": "^0.48.0" } }, "@searchspring/snap-store-mobx": { "version": "file:packages/snap-store-mobx", "requires": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "mobx": "^6.6.1" } }, @@ -46297,8 +46297,8 @@ "@searchspring/snap-tracker": { "version": "file:packages/snap-tracker", "requires": { - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", "@types/uuid": "8.3.4", "deepmerge": "4.3.1", "uuid": "8.3.2" diff --git a/packages/snap-client/CHANGELOG.md b/packages/snap-client/CHANGELOG.md index ed5ad6c1f..3cfd199ef 100644 --- a/packages/snap-client/CHANGELOG.md +++ b/packages/snap-client/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-client + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) ### Features diff --git a/packages/snap-client/package.json b/packages/snap-client/package.json index 8ba8db12f..68469e432 100644 --- a/packages/snap-client/package.json +++ b/packages/snap-client/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-client", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Client", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,7 +20,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "deepmerge": "4.3.1" }, "sideEffects": false, diff --git a/packages/snap-client/src/Client/apis/Recommend.test.ts b/packages/snap-client/src/Client/apis/Recommend.test.ts index 2b598feda..f9f4a08e9 100644 --- a/packages/snap-client/src/Client/apis/Recommend.test.ts +++ b/packages/snap-client/src/Client/apis/Recommend.test.ts @@ -233,6 +233,41 @@ describe('Recommend Api', () => { requestMock.mockReset(); }); + it('batchRecommendations handles multiple brands as expected', async () => { + const api = new RecommendAPI(new ApiConfiguration({})); + + const requestMock = jest + .spyOn(global.window, 'fetch') + .mockImplementation(() => Promise.resolve({ status: 200, json: () => Promise.resolve(mockData.recommend()) } as Response)); + + const GETRequestUrl = `https://8uyt2m.a.searchspring.io/boost/8uyt2m/recommend?tags=similar&tags=crossSell&limits=14&limits=10&brands=shirts&brands=pants&brands=pants2&siteId=8uyt2m&lastViewed=marnie-runner-2-7x10&lastViewed=ruby-runner-2-7x10&lastViewed=abbie-runner-2-7x10&lastViewed=riley-4x6&lastViewed=joely-5x8&lastViewed=helena-4x6&lastViewed=kwame-4x6&lastViewed=sadie-4x6&lastViewed=candice-runner-2-7x10&lastViewed=esmeray-4x6&lastViewed=camilla-230x160&lastViewed=candice-4x6&lastViewed=sahara-4x6&lastViewed=dayna-4x6&lastViewed=moema-4x6&product=marnie-runner-2-7x10`; + + //shirt category + // @ts-ignore + api.batchRecommendations({ + tags: ['similar'], + brands: ['shirts'], + limits: 14, + batched: true, + ...batchParams, + }); + //pants category + // @ts-ignore + api.batchRecommendations({ + tags: ['crossSell'], + brands: ['pants', 'pants2'], + limits: 10, + batched: true, + ...batchParams, + }); + + //add delay for paramBatch.timeout + await wait(250); + + expect(requestMock).toHaveBeenCalledWith(GETRequestUrl, GETParams); + requestMock.mockReset(); + }); + it('batchRecommendations handles order prop as expected', async () => { const api = new RecommendAPI(new ApiConfiguration({})); diff --git a/packages/snap-client/src/Client/apis/Recommend.ts b/packages/snap-client/src/Client/apis/Recommend.ts index 5b61ea1ba..9ca8063a0 100644 --- a/packages/snap-client/src/Client/apis/Recommend.ts +++ b/packages/snap-client/src/Client/apis/Recommend.ts @@ -74,7 +74,7 @@ export class RecommendAPI extends API { // now that the requests are in proper order, map through them // and build out the batches batch.entries.map((entry) => { - const { tags, categories, ...otherParams } = entry.request; + const { tags, categories, brands, ...otherParams } = entry.request; let limits = entry.request.limits; if (!limits) { @@ -96,6 +96,14 @@ export class RecommendAPI extends API { } } + if (brands) { + if (!batch.request.brands) { + batch.request.brands = Array.isArray(brands) ? brands : [brands]; + } else { + batch.request.brands = batch.request.brands.concat(brands); + } + } + batch.request.limits = (batch.request.limits as number[]).concat(limits); batch.request = { ...batch.request, ...otherParams }; }); diff --git a/packages/snap-client/src/types.ts b/packages/snap-client/src/types.ts index 8a8da3fae..d885c248a 100644 --- a/packages/snap-client/src/types.ts +++ b/packages/snap-client/src/types.ts @@ -101,6 +101,7 @@ export type RecommendRequestModel = { product?: string; shopper?: string; categories?: string[]; + brands?: string[]; cart?: string[]; lastViewed?: string[]; test?: boolean; @@ -165,6 +166,7 @@ export type RecommendCombinedRequestModel = { product?: string; shopper?: string; categories?: string[]; + brands?: string[]; cart?: string[]; lastViewed?: string[]; test?: boolean; diff --git a/packages/snap-controller/CHANGELOG.md b/packages/snap-controller/CHANGELOG.md index cd9183548..10f5601d5 100644 --- a/packages/snap-controller/CHANGELOG.md +++ b/packages/snap-controller/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Bug Fixes + +- **controller/finder:** altering the beforeFind middleware to ensure redirection is blocked ([936e184](https://github.com/searchspring/snap/commit/936e184ba932fce75b379eeb6e197af0648aac68)) + +### Features + +- add autocomplete settings.redirects.singleResult config ([e620701](https://github.com/searchspring/snap/commit/e620701cb7d528ea4d3fe823bd0104e1bdd73a31)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) ### Features diff --git a/packages/snap-controller/package.json b/packages/snap-controller/package.json index bf4512fd3..39e2cece7 100644 --- a/packages/snap-controller/package.json +++ b/packages/snap-controller/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-controller", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Controllers", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,18 +20,18 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "css.escape": "1.5.1", "deepmerge": "4.3.1" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0" + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0" }, "sideEffects": false, "files": [ diff --git a/packages/snap-controller/src/Finder/FinderController.ts b/packages/snap-controller/src/Finder/FinderController.ts index 7638ecc60..d663ff603 100644 --- a/packages/snap-controller/src/Finder/FinderController.ts +++ b/packages/snap-controller/src/Finder/FinderController.ts @@ -63,12 +63,6 @@ export class FinderController extends AbstractController { finder.controller.store.loading = false; }); - this.eventManager.on('beforeFind', async (finder: { controller: FinderController }, next: Next): Promise => { - await next(); - - window.location.href = this.urlManager.href; - }); - // attach config plugins and event middleware this.use(this.config); @@ -115,6 +109,9 @@ export class FinderController extends AbstractController { await this.eventManager.fire('beforeFind', { controller: this, }); + + // redirect to configured URL after middleware completes + window.location.href = this.urlManager.href; } catch (err: any) { if (err?.message == 'cancelled') { this.log.warn(`'beforeFind' middleware cancelled`); diff --git a/packages/snap-controller/src/Recommendation/RecommendationController.ts b/packages/snap-controller/src/Recommendation/RecommendationController.ts index 7d94394e8..b22e85f68 100644 --- a/packages/snap-controller/src/Recommendation/RecommendationController.ts +++ b/packages/snap-controller/src/Recommendation/RecommendationController.ts @@ -27,6 +27,7 @@ type RecommendCombinedRequestModel = { product?: string; shopper?: string; categories?: string[]; + brands?: string[]; cart?: string[]; lastViewed?: string[]; test?: boolean; diff --git a/packages/snap-event-manager/CHANGELOG.md b/packages/snap-event-manager/CHANGELOG.md index a083c2987..09820a3e4 100644 --- a/packages/snap-event-manager/CHANGELOG.md +++ b/packages/snap-event-manager/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-event-manager + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-event-manager diff --git a/packages/snap-event-manager/package.json b/packages/snap-event-manager/package.json index 86ffd207c..ce9033665 100644 --- a/packages/snap-event-manager/package.json +++ b/packages/snap-event-manager/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-event-manager", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Event Manager", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/packages/snap-logger/CHANGELOG.md b/packages/snap-logger/CHANGELOG.md index bc0a8e8bd..6951d23b7 100644 --- a/packages/snap-logger/CHANGELOG.md +++ b/packages/snap-logger/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-logger + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-logger diff --git a/packages/snap-logger/package.json b/packages/snap-logger/package.json index 7100a6191..6773b8d82 100644 --- a/packages/snap-logger/package.json +++ b/packages/snap-logger/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-logger", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Logger", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,7 +20,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0" + "@searchspring/snap-toolbox": "^0.48.0" }, "sideEffects": false, "files": [ diff --git a/packages/snap-preact-components/CHANGELOG.md b/packages/snap-preact-components/CHANGELOG.md index ebefc1c6d..07546ad23 100644 --- a/packages/snap-preact-components/CHANGELOG.md +++ b/packages/snap-preact-components/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Features + +- icon component path element array, children support ([c8a6c44](https://github.com/searchspring/snap/commit/c8a6c4411636021f49da85c8eeb3e40528998f14)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-preact-components diff --git a/packages/snap-preact-components/package.json b/packages/snap-preact-components/package.json index 3423a77a7..018a10adb 100644 --- a/packages/snap-preact-components/package.json +++ b/packages/snap-preact-components/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-preact-components", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Preact Component Library", "author": "Searchspring", "license": "MIT", @@ -26,7 +26,7 @@ }, "dependencies": { "@emotion/react": "11.9.0", - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "classnames": "^2.3.2", "deepmerge": "4.3.1", "dequal": "2.0.3", @@ -38,14 +38,14 @@ "preact": "10.9.0" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "@storybook/addon-actions": "6.4.22", "@storybook/addon-controls": "6.4.22", "@storybook/addon-docs": "6.4.22", diff --git a/packages/snap-preact-demo/CHANGELOG.md b/packages/snap-preact-demo/CHANGELOG.md index 69e066f99..ec66e5566 100644 --- a/packages/snap-preact-demo/CHANGELOG.md +++ b/packages/snap-preact-demo/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-preact-demo + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-preact-demo diff --git a/packages/snap-preact-demo/package.json b/packages/snap-preact-demo/package.json index 34adee8b1..7355a7492 100644 --- a/packages/snap-preact-demo/package.json +++ b/packages/snap-preact-demo/package.json @@ -1,7 +1,7 @@ { "name": "@searchspring/snap-preact-demo", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "demo store for development and testing", "author": "Searchspring", "license": "MIT", @@ -19,8 +19,8 @@ "lighthouse": "lhci --config ./tests/lighthouse/lighthouserc.js autorun" }, "dependencies": { - "@searchspring/snap-preact": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", + "@searchspring/snap-preact": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", "deepmerge": "4.3.1", "mobx-react": "7.5.0", "preact": "10.9.0" diff --git a/packages/snap-preact/CHANGELOG.md b/packages/snap-preact/CHANGELOG.md index b3c829345..451148e66 100644 --- a/packages/snap-preact/CHANGELOG.md +++ b/packages/snap-preact/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-preact + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-preact diff --git a/packages/snap-preact/package.json b/packages/snap-preact/package.json index b066f8293..363e914e1 100644 --- a/packages/snap-preact/package.json +++ b/packages/snap-preact/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-preact", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Preact", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,16 +20,16 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-controller": "^0.47.0", - "@searchspring/snap-event-manager": "^0.47.0", - "@searchspring/snap-logger": "^0.47.0", - "@searchspring/snap-preact-components": "^0.47.0", - "@searchspring/snap-profiler": "^0.47.0", - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", - "@searchspring/snap-tracker": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0", + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-controller": "^0.48.0", + "@searchspring/snap-event-manager": "^0.48.0", + "@searchspring/snap-logger": "^0.48.0", + "@searchspring/snap-preact-components": "^0.48.0", + "@searchspring/snap-profiler": "^0.48.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", + "@searchspring/snap-tracker": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0", "deepmerge": "4.3.1", "intersection-observer": "0.12.0", "is-plain-object": "5.0.0" diff --git a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.test.tsx b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.test.tsx index ab4902a47..3978173de 100644 --- a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.test.tsx +++ b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.test.tsx @@ -297,6 +297,7 @@ describe('RecommendationInstantiator', () => { value: { low: 0, high: 20 } } ] + brands: ['nike', 'h&m'], } `; @@ -330,6 +331,7 @@ describe('RecommendationInstantiator', () => { value: { low: 0, high: 20 }, }, ], + brands: ['nike', 'h&m'], limit: 5, siteId: 'abc123', }, @@ -353,6 +355,7 @@ describe('RecommendationInstantiator', () => { value: { low: 0, high: 20 }, }, ], + brands: ['nike', 'h&m'], limits: 5, product: 'sku1', shopper: 'snapdev', diff --git a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx index c3d2123fc..67dff88ac 100644 --- a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx +++ b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx @@ -145,7 +145,8 @@ export class RecommendationInstantiator { branch?: string; batched?: boolean; realtime?: boolean; - categories?: any; + categories?: string[]; + brands?: string[]; limit?: number; } } @@ -169,6 +170,9 @@ export class RecommendationInstantiator { if (options?.filters) { contextGlobals.filters = options.filters; } + if (options?.brands) { + contextGlobals.brands = options.brands; + } if (options?.limit && Number.isInteger(Number(options?.limit))) { contextGlobals.limits = Number(options?.limit); } diff --git a/packages/snap-profiler/CHANGELOG.md b/packages/snap-profiler/CHANGELOG.md index 94bd71168..ce49d89c1 100644 --- a/packages/snap-profiler/CHANGELOG.md +++ b/packages/snap-profiler/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-profiler + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-profiler diff --git a/packages/snap-profiler/package.json b/packages/snap-profiler/package.json index 6d3088d1c..bcffda366 100644 --- a/packages/snap-profiler/package.json +++ b/packages/snap-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-profiler", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Profiler", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/packages/snap-shared/CHANGELOG.md b/packages/snap-shared/CHANGELOG.md index 6c6e480b7..8888f7131 100644 --- a/packages/snap-shared/CHANGELOG.md +++ b/packages/snap-shared/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Features + +- add autocomplete settings.redirects.singleResult config ([e620701](https://github.com/searchspring/snap/commit/e620701cb7d528ea4d3fe823bd0104e1bdd73a31)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-shared diff --git a/packages/snap-shared/package.json b/packages/snap-shared/package.json index 895b38b83..3fc63cfad 100644 --- a/packages/snap-shared/package.json +++ b/packages/snap-shared/package.json @@ -1,7 +1,7 @@ { "name": "@searchspring/snap-shared", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "library of shared code utilized by snap packages", "author": "Searchspring", "license": "MIT", @@ -15,7 +15,7 @@ "test:watch": "jest --watch" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0" + "@searchspring/snap-client": "^0.48.0" }, "sideEffects": false, "files": [ diff --git a/packages/snap-store-mobx/CHANGELOG.md b/packages/snap-store-mobx/CHANGELOG.md index 97590b4d9..deaf6f5d7 100644 --- a/packages/snap-store-mobx/CHANGELOG.md +++ b/packages/snap-store-mobx/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Features + +- add autocomplete settings.redirects.singleResult config ([e620701](https://github.com/searchspring/snap/commit/e620701cb7d528ea4d3fe823bd0104e1bdd73a31)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) ### Features diff --git a/packages/snap-store-mobx/package.json b/packages/snap-store-mobx/package.json index 19f0fcacb..c28f0c641 100644 --- a/packages/snap-store-mobx/package.json +++ b/packages/snap-store-mobx/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-store-mobx", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap MobX Store", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,12 +20,12 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-toolbox": "^0.48.0", "mobx": "^6.6.1" }, "devDependencies": { - "@searchspring/snap-client": "^0.47.0", - "@searchspring/snap-url-manager": "^0.47.0" + "@searchspring/snap-client": "^0.48.0", + "@searchspring/snap-url-manager": "^0.48.0" }, "sideEffects": false, "files": [ diff --git a/packages/snap-toolbox/CHANGELOG.md b/packages/snap-toolbox/CHANGELOG.md index c7f3dcf3b..dbda9150c 100644 --- a/packages/snap-toolbox/CHANGELOG.md +++ b/packages/snap-toolbox/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +### Features + +- move until utility function to toolbox ([d9d4eb3](https://github.com/searchspring/snap/commit/d9d4eb3d4994c30850e5829f1e609755112f5b06)) + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-toolbox diff --git a/packages/snap-toolbox/package.json b/packages/snap-toolbox/package.json index 0847d32fd..b7428efb5 100644 --- a/packages/snap-toolbox/package.json +++ b/packages/snap-toolbox/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-toolbox", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Toolbox", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/packages/snap-tracker/CHANGELOG.md b/packages/snap-tracker/CHANGELOG.md index 26a0015de..80ecef4b2 100644 --- a/packages/snap-tracker/CHANGELOG.md +++ b/packages/snap-tracker/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-tracker + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-tracker diff --git a/packages/snap-tracker/package.json b/packages/snap-tracker/package.json index cf0d05cd6..8a471845c 100644 --- a/packages/snap-tracker/package.json +++ b/packages/snap-tracker/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-tracker", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap Tracker", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -20,8 +20,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@searchspring/snap-store-mobx": "^0.47.0", - "@searchspring/snap-toolbox": "^0.47.0", + "@searchspring/snap-store-mobx": "^0.48.0", + "@searchspring/snap-toolbox": "^0.48.0", "@types/uuid": "8.3.4", "deepmerge": "4.3.1", "uuid": "8.3.2" diff --git a/packages/snap-url-manager/CHANGELOG.md b/packages/snap-url-manager/CHANGELOG.md index c7436a06f..e8b5d4a67 100644 --- a/packages/snap-url-manager/CHANGELOG.md +++ b/packages/snap-url-manager/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.48.0](https://github.com/searchspring/snap/compare/v0.47.0...v0.48.0) (2023-10-11) + +**Note:** Version bump only for package @searchspring/snap-url-manager + # [0.47.0](https://github.com/searchspring/snap/compare/v0.46.0...v0.47.0) (2023-09-15) **Note:** Version bump only for package @searchspring/snap-url-manager diff --git a/packages/snap-url-manager/package.json b/packages/snap-url-manager/package.json index efc47b64b..e6f92ab06 100644 --- a/packages/snap-url-manager/package.json +++ b/packages/snap-url-manager/package.json @@ -1,6 +1,6 @@ { "name": "@searchspring/snap-url-manager", - "version": "0.47.0", + "version": "0.48.0", "description": "Snap URL Manager", "main": "dist/cjs/index.js", "module": "dist/esm/index.js",