Skip to content

Commit

Permalink
Merge pull request #482 from searchspring/develop
Browse files Browse the repository at this point in the history
v0.27.0 Release
  • Loading branch information
dkonieczek authored May 4, 2022
2 parents 2e6b920 + 0ef1c94 commit a9eda88
Show file tree
Hide file tree
Showing 48 changed files with 4,211 additions and 891 deletions.
547 changes: 271 additions & 276 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import deepmerge from 'deepmerge';

import { StorageStore, StorageType, ErrorType } from '@searchspring/snap-store-mobx';
import { url } from '@searchspring/snap-toolbox';
import { AbstractController } from '../Abstract/AbstractController';
import { getSearchParams } from '../utils/getParams';
import { ControllerTypes } from '../types';

import type { AutocompleteStore } from '@searchspring/snap-store-mobx';
import type {
Expand Down Expand Up @@ -45,7 +45,7 @@ type AutocompleteTrackMethods = {
};

export class AutocompleteController extends AbstractController {
public type = 'autocomplete';
public type = ControllerTypes.autocomplete;
public store: AutocompleteStore;
public config: AutocompleteControllerConfig;
public storage: StorageStore;
Expand Down Expand Up @@ -89,6 +89,7 @@ export class AutocompleteController extends AbstractController {

// cancel search if no input or query doesn't match current urlState
if (ac.response.autocomplete.query != ac.controller.urlManager.state.query) {
ac.controller.store.loading = false;
return false;
}
});
Expand Down
3 changes: 2 additions & 1 deletion packages/snap-controller/src/Finder/FinderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ErrorType } from '@searchspring/snap-store-mobx';

import { AbstractController } from '../Abstract/AbstractController';
import { getSearchParams } from '../utils/getParams';
import { ControllerTypes } from '../types';
import type { FinderStore } from '@searchspring/snap-store-mobx';
import type { FinderControllerConfig, BeforeSearchObj, AfterSearchObj, ControllerServices, NextEvent, ContextVariables } from '../types';

Expand All @@ -23,7 +24,7 @@ const defaultConfig: FinderControllerConfig = {
};

export class FinderController extends AbstractController {
public type = 'finder';
public type = ControllerTypes.finder;
public store: FinderStore;
config: FinderControllerConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import deepmerge from 'deepmerge';
import { BeaconType, BeaconCategory } from '@searchspring/snap-tracker';
import { LogMode } from '@searchspring/snap-logger';
import { AbstractController } from '../Abstract/AbstractController';
import { ControllerTypes } from '../types';
import { ErrorType } from '@searchspring/snap-store-mobx';

import type { BeaconEvent } from '@searchspring/snap-tracker';
Expand All @@ -29,7 +30,7 @@ const defaultConfig: RecommendationControllerConfig = {
};

export class RecommendationController extends AbstractController {
public type = 'recommendation';
public type = ControllerTypes.recommendation;
public store: RecommendationStore;
config: RecommendationControllerConfig;
events = {
Expand Down Expand Up @@ -242,8 +243,8 @@ export class RecommendationController extends AbstractController {
const params = {
tag: this.config.tag,
batched: this.config.batched,
...this.config.globals,
branch: this.config.branch || 'production',
...this.config.globals,
};
const shopperId = this.tracker.context.shopperId;
const cart = this.tracker.cookies.cart.get();
Expand Down
3 changes: 2 additions & 1 deletion packages/snap-controller/src/Search/SearchController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import deepmerge from 'deepmerge';
import { AbstractController } from '../Abstract/AbstractController';
import { StorageStore, StorageType, ErrorType } from '@searchspring/snap-store-mobx';
import { getSearchParams } from '../utils/getParams';
import { ControllerTypes } from '../types';

import type { BeaconEvent } from '@searchspring/snap-tracker';
import type { SearchStore } from '@searchspring/snap-store-mobx';
Expand Down Expand Up @@ -42,7 +43,7 @@ type SearchTrackMethods = {
};

export class SearchController extends AbstractController {
public type = 'search';
public type = ControllerTypes.search;
public store: SearchStore;
config: SearchControllerConfig;
storage: StorageStore;
Expand Down
7 changes: 7 additions & 0 deletions packages/snap-controller/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export type AfterStoreObj = {
response: any;
};

export enum ControllerTypes {
search = 'search',
autocomplete = 'autocomplete',
finder = 'finder',
recommendation = 'recommendation',
}

export type ControllerServices = {
client: Client;
store: AbstractStore;
Expand Down
9 changes: 8 additions & 1 deletion packages/snap-preact-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@
},
"dependencies": {
"@emotion/react": "^11.7.1",
"@searchspring/snap-preact": "^0.26.1",
"@searchspring/snap-client": "^0.26.1",
"@searchspring/snap-controller": "^0.26.1",
"@searchspring/snap-event-manager": "^0.26.1",
"@searchspring/snap-logger": "^0.26.1",
"@searchspring/snap-profiler": "^0.26.1",
"@searchspring/snap-store-mobx": "^0.26.1",
"@searchspring/snap-toolbox": "^0.26.1",
"@searchspring/snap-tracker": "^0.26.1",
"@searchspring/snap-url-manager": "^0.26.1",
"classnames": "^2.3.1",
"deepmerge": "^4.2.2",
"mobx-react-lite": "^3.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const CSS = {
fill: color || theme.colors?.primary,
width: width || size,
height: height || size,
position: 'relative',
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import classnames from 'classnames';
import { observer } from 'mobx-react-lite';
import deepmerge from 'deepmerge';
import SwiperCore, { Pagination, Navigation } from 'swiper/core';
import 'swiper/swiper.min.css';

import { Icon, IconProps } from '../../Atoms/Icon/Icon';
import { Swiper, SwiperSlide } from 'swiper/react';
Expand Down Expand Up @@ -75,9 +74,35 @@ const CSS = {
'.swiper-container': {
display: 'flex',
flexDirection: 'column',
marginLeft: 'auto',
marginRight: 'auto',
position: 'relative',
overflow: 'hidden',
listStyle: 'none',
padding: 0,
zIndex: 1,
},
'.swiper-container-vertical': {
'.swiper-wrapper': {
flexDirection: 'column',
},
},
'.swiper-wrapper': {
order: 0,
position: 'relative',
width: '100%',
height: '100%',
zIndex: 1,
display: 'flex',
transitionProperty: 'transform',
boxSizing: 'content-box',
},
'.swiper-slide': {
flexShrink: 0,
width: '100%',
height: '100%',
position: 'relative',
transitionProperty: 'transform',
},
'.swiper-pagination': {
display: 'flex',
Expand All @@ -101,6 +126,15 @@ const CSS = {
background: theme?.colors?.primary || '#000',
},
},
'.swiper-container-pointer-events': {
touchAction: 'pan-y',
'&.swiper-container-vertical': {
touchAction: 'pan-x',
},
},
'.swiper-slide-invisible-blank': {
visibility: 'hidden',
},
}),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { h, Fragment } from 'preact';

import { ArgsTable, PRIMARY_STORY } from '@storybook/addon-docs/blocks';

import { BranchOverride } from './BranchOverride';
import { componentArgs } from '../../../utilities';
import Readme from '../BranchOverride/readme.md';

export default {
title: `Organisms/BranchOverride`,
component: BranchOverride,
parameters: {
docs: {
page: () => (
<div>
<Readme />
<ArgsTable story={PRIMARY_STORY} />
</div>
),
},
},
decorators: [
(Story) => (
<div
style={{
maxWidth: '900px',
position: 'relative',
}}
>
<Story />
</div>
),
],
argTypes: {
name: {
description: 'bundle branch name',
type: { required: true },
table: {
type: {
summary: 'string',
},
},
control: { type: 'text' },
},
details: {
description: 'Object containing details for branch override',
type: { required: false },
table: {
type: {
summary: '{ url: string; lastModified: string }',
},
},
control: { type: 'object' },
},
error: {
description: 'Object containing error message and description',
type: { required: false },
table: {
type: {
summary: '{ message: string; description: string }',
},
},
control: { type: 'object' },
},
onRemoveClick: {
description: 'optional function to run on remove button click',
table: {
type: {
summary: '(e: Event, name: string) => void',
},
},
action: 'onRemoveClick',
},
darkMode: {
description: 'force dark darkMode',
type: { required: false },
table: {
type: {
summary: 'boolean',
},
},
control: { type: 'boolean' },
},
...componentArgs,
},
};

const Template = (args) => <BranchOverride {...args} />;

export const Auto = Template.bind({});
Auto.args = {
name: 'next',
details: {
url: 'https://snapui.searchspring.io/y56s6x/next/bundle.js',
lastModified: '1 Feb 2022 1:02:03 GMT',
},
};

export const Dark = Template.bind({});
Dark.args = {
name: 'next',
details: {
url: 'https://snapui.searchspring.io/y56s6x/next/bundle.js',
lastModified: '1 Feb 2022 1:02:03 GMT',
},
darkMode: true,
};

export const Error = Template.bind({});
Error.args = {
name: 'testing',
error: {
message: 'Branch not found!',
description: 'Incorrect branch name or branch no longer exists.',
},
};

export const Light = Template.bind({});
Light.args = {
name: 'next',
details: {
url: 'https://snapui.searchspring.io/y56s6x/next/bundle.js',
lastModified: '1 Feb 2022 1:02:03 GMT',
},
darkMode: false,
};
Loading

0 comments on commit a9eda88

Please sign in to comment.