Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundleRecommendations component #965

Merged
merged 40 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5547094
feat(preact-components-bundlerecommendations): new component for upco…
chrisFrazier77 Dec 19, 2023
b4f27b2
test(preact-components-testing): updating tests to pass with swiper u…
chrisFrazier77 Dec 20, 2023
53431af
chore(preact-demo-recs): reverting demo back to expected recommendati…
chrisFrazier77 Dec 20, 2023
5fc146d
test(recommendation.cy): reliability hardening to cypress recommendat…
chrisFrazier77 Dec 20, 2023
be36989
refactor(preact-components-bundledrecommendation): some tweaks and bu…
chrisFrazier77 Jan 3, 2024
71fa958
refactor(preact-components-carousel): some typing clean up
chrisFrazier77 Jan 3, 2024
ac7f9be
refactor(preact-components-bundlerecommendation): typing changes
chrisFrazier77 Jan 3, 2024
ede9163
refactor(recommendationcontroller): change bundle track event types
chrisFrazier77 Jan 3, 2024
917c20c
test(preact-components-cypress-testing): adding cypress component tes…
chrisFrazier77 Jan 9, 2024
1d49d2d
test(preact-components-bundlerecs): temporary remove bundle rec beaco…
chrisFrazier77 Jan 9, 2024
3e00e5f
Merge pull request #976 from searchspring/swiperUpgrade-Testing
chrisFrazier77 Jan 9, 2024
15208ed
feat(product-variants): adding initial product variants code to the r…
chrisFrazier77 Jan 23, 2024
af653cc
refactor(searchresultstore): variants are broken
chrisFrazier77 Jan 23, 2024
42d3c8e
refactor(store-mobx/searchresultstore): changes to get a demo working
korgon Jan 25, 2024
80caa17
refactor(preact-components-bundledrecommendation): clean up and some …
chrisFrazier77 Feb 1, 2024
5bde153
Merge pull request #988 from searchspring/bundled-variants
chrisFrazier77 Feb 1, 2024
eeec473
build(cypress-component-testing): build fixed, component cypress test…
chrisFrazier77 Feb 2, 2024
8a1f12f
chore(merge-develop): merge in develop
chrisFrazier77 Feb 2, 2024
dccb266
refactor(fix-demo): fix preact-demo for tests to pass
chrisFrazier77 Feb 2, 2024
bcb5baa
test(bundlerecommendations): test hardenening
chrisFrazier77 Feb 5, 2024
dc12622
refactor(bundlerecommendations): cartstore, bundleRecommendation clea…
chrisFrazier77 Feb 21, 2024
06aeca1
chore(merge-develop): merge in develop
chrisFrazier77 Feb 21, 2024
88bae80
test(preact-components-bundlerecommendation): adding some additional …
chrisFrazier77 Feb 23, 2024
881ad04
fix(bundledrecommendation): bugfixes around seedincarousel
chrisFrazier77 Feb 27, 2024
6a7a761
feat(preact-components/carousel): updating to swiper v11
korgon Feb 27, 2024
7bd6371
refactor(preact-components-carousel): adding a few things for backwar…
chrisFrazier77 Feb 27, 2024
f16f8c3
Merge pull request #1005 from searchspring/bundleRecComponent-v11
chrisFrazier77 Feb 27, 2024
80139d0
test(preact-components-bundlerec): adding e2e tests for bundlerecs
chrisFrazier77 Feb 28, 2024
ed6629d
group review changes
korgon Mar 4, 2024
355b5c0
fix(preact-components-carousel): monkey patching navigation.onprev an…
chrisFrazier77 Mar 4, 2024
abdc4eb
fix(preact-components-carousel): custom swiper navigation support, bc…
chrisFrazier77 Mar 4, 2024
2c04a47
test: fixing jest tests after dependency changes
korgon Mar 4, 2024
cfc8e61
build: fixes to mobx packages to prevent mismatched versions
korgon Mar 4, 2024
2091afb
build: removing nx dependency
korgon Mar 5, 2024
278de24
build: bringing `nx` devDependency back for build fix
korgon Mar 5, 2024
21833b3
refactor(preact-components/recommendation): rename component -> Recom…
korgon Mar 5, 2024
98e475f
refactor(preact-components-recommendationbundle): change default valu…
chrisFrazier77 Mar 5, 2024
25a61b0
test(preact-components-recommendationbundle): fixing tests, and few s…
chrisFrazier77 Mar 5, 2024
b45deba
refactor(preact-components-recommendationbundle): adding back vertica…
chrisFrazier77 Mar 5, 2024
fb544e5
docs: addressing some documentation around recommendations
korgon Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
**/tests/**
**/mocks/**
**/__tests__/**
**/__mocks__/**
**/__mocks__/**
**/jest.config.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
yarn-error.log
lerna-debug.log
.DS_Store
.nx
dist
coverage
metrics/data
Expand Down
52 changes: 48 additions & 4 deletions docs/PREACT_RECOMMENDATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
```

## Default Template
The Searchspring Management Console contains a `Default` template availble for all profiles that does not require the use of the Snapfu CLI to create a custom template. To use the `Default` template, the following instantiator config should be added to your `snap-preact` config.
The Searchspring Management Console contains a `Default` template availble for standard profiles (non-bundle) that does not require the use of the Snapfu CLI to create a custom template. To use the `Default` template, the following instantiator config should be added to your `snap-preact` config.

```js
instantiators: {
Expand Down Expand Up @@ -82,6 +82,51 @@ export const Recs = observer((props) => {
});
```

## Default Bundle Template
The Searchspring Management Console also contains a `Bundle` template availble for bundle profiles, this template does not require the use of the Snapfu CLI to create a custom template. To use the `Bundle` template, another component mapping will need to be added to your `snap-preact` instantiator config.

```js
instantiators: {
recommendation: {
components: {
Default: async () => {
return (await import('./components/Recommendations/Recs')).Recs;
},
Bundle: async () => {
return (await import('./components/Recommendations/Bundled')).Bundled;
},
},
config: {
branch: BRANCHNAME || 'production',
},
},
},
```

Note that the component is not required to be named `Bundle`, however `instantiators.recommendation.component` must contain the `Bundle` key as seen in the example above.

The example Bundled component below uses the `RecommendationBundle` component imported from the snap component library. See [Components Preact > RecommendationBundle](https://searchspring.github.io/snap/#/components-preact?params=%3Fpath%3D%2Fstory%2Forganisms-recommendationbundle--default) for more details.

```jsx
import { h } from 'preact';
import { observer } from 'mobx-react';

import { RecommendationBundle } from '@searchspring/snap-preact-components';

export const Bundled = observer((props) => {
const controller = props.controller;
const store = controller?.store;

if (!controller.store.loaded && !controller.store.loading) {
controller.search();
}

const parameters = store?.profile?.display?.templateParameters;

return store.results.length > 0 && <RecommendationBundle controller={controller} onAddToCart={(items)=> console.log("need to add these to the platform cart", items)} title={parameters?.title} />;
});
```

## Custom Template
Let's look at how to setup a custom recommendation template using the Snapfu CLI. See [Getting Started > Setup](https://searchspring.github.io/snap/#/start-setup) for installing Snapfu.

Expand All @@ -91,7 +136,7 @@ There are three steps required for adding recommendations:
- Updating our Snap config (see instantiator config above)

### Creating a new recommendation template
To generate a new template, run the following at the root of the project. This command will prompt you to provide various inputs such as the template name, an optional description, and the path to the component.
To generate a new template, run the following at the root of the project. This command will prompt you to provide various inputs such as the template type, template name, an optional description, and the path to the component.

```bash
snapfu recs init
Expand Down Expand Up @@ -146,5 +191,4 @@ snapfu recs sync
#### Syncing to multiple accounts
To sync the template(s) to multiple accounts, multiple siteIds must be defined in the project's package.json file

See [Getting Started > Github Setup](https://searchspring.github.io/snap/#/start-github)

See [Getting Started > Github Setup](https://searchspring.github.io/snap/#/start-github)
7 changes: 7 additions & 0 deletions docs/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ var documents = [
url: './packages/snap-store-mobx/src/Storage/README.md',
searchable: true,
},
{
label: 'Cart',
route: '/package-storeMobx-cart',
type: 'markdown',
url: './packages/snap-store-mobx/src/Cart/README.md',
searchable: true,
},
{
label: 'Typedocs',
type: 'external',
Expand Down
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"version": "0.51.2",
"packages": ["packages/*"],
"useWorkspaces": true,
"npmClient": "npm",
"command": {
"publish": {
Expand Down
Loading
Loading