id
stringlengths
12
53
messages
listlengths
3
3
code_store-on-localhost_49ed250a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Drawer/Portal.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { FunctionComponent } from 'react'\nimport ReactDOM from 'react-dom'\nimport { useSSR } from '../../../../vtex.render-runtime'\n\nconst Portal: FunctionComponent = ({ children }) => {\n const body = window && window.document && window.document.body\n const isSSR = useSSR()\n\n if (!body || isSSR) {\n return null\n }\n\n return ReactDOM.createPortal(children, body)\n}\n\nexport default Portal\n\n```" } ]
code_store-on-localhost_6fed611e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Drawer/Swipable.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { animate } from './modules/animation'\nimport PropTypes from 'prop-types'\nimport parseMeasure from './modules/parseMeasure'\nimport getPointerPosition from './modules/getPointerPosition'\n\nconst CENTER = 'center'\nconst LEFT = 'left'\nconst RIGHT = 'right'\n\nexport default class Swipable extends React.Component {\n constructor(props) {\n super(props)\n\n this.dragContainer = React.createRef()\n\n this.stopAnimation = () => {}\n this.isPointerDown = false\n this.isDragging = false\n\n /* Used for the click event handler, which is\n * fired after mouseup is fired.\n * See comment on handleClick function */\n this.wasDragging = false\n\n this.offset = this.getOffsetFromPosition()\n this.offsetAnimation = { value: this.offset }\n this.momentum = null\n this.momentumTimeout = null\n this.dragStartPos = {\n x: 0,\n y: 0,\n }\n this.previousDragPositions = []\n this.willTrigger = false\n }\n\n componentDidMount() {\n if (!window || !window.document) {\n return\n }\n\n window.document.addEventListener('mousedown', this.handleDragStart)\n window.document.addEventListener('touchstart', this.handleDragStart)\n window.document.addEventListener('mousemove', this.handleDragMove)\n window.document.addEventListener('touchmove', this.handleDragMove)\n window.document.addEventListener('mouseup', this.handleDragEnd)\n window.document.addEventListener('touchend', this.handleDragEnd)\n window.document.addEventListener('click', this.handleClick, {\n capture: true,\n })\n }\n\n componentWillUnmount() {\n if (!window || !window.document) {\n return\n }\n\n window.document.removeEventListener('mousedown', this.handleDragStart)\n window.document.removeEventListener('touchstart', this.handleDragStart)\n window.document.removeEventListener('mousemove', this.handleDragMove)\n window.document.removeEventListener('touchmove', this.handleDragMove)\n window.document.removeEventListener('mouseup', this.handleDragEnd)\n window.document.removeEventListener('touchend', this.handleDragEnd)\n window.document.removeEventListener('click', this.handleClick, {\n capture: true,\n })\n }\n\n /* Prevents click events from firing in the event of\n * firing swipe events. */\n handleClick = event => {\n if (this.wasDragging || this.isPointerDown) {\n event.preventDefault()\n event.stopPropagation()\n }\n this.wasDragging = false\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.enabled && !this.props.enabled && this.isPointerDown) {\n this.isPointerDown = false\n }\n\n if (prevProps.position !== this.props.position) {\n this.updatePosition()\n }\n }\n\n updatePosition = () => {\n this.offsetAnimation.value = this.offset\n animate({\n object: this.offsetAnimation,\n prop: 'value',\n target: this.getOffsetFromPosition(),\n ...(this.momentum\n ? { speed: this.momentum, acceleration: 1.25 }\n : { duration: 0.25 }),\n onUpdate: value => {\n this.setOffset(value)\n },\n })\n\n this.momentum = null\n if (this.momentumTimeout) {\n clearTimeout(this.momentumTimeout)\n this.momentumTimeout = null\n }\n }\n\n getOffsetFromPosition = () => {\n switch (this.props.position) {\n case 'center':\n return 0\n case 'right':\n return this.props.positionRight\n case 'left':\n return this.props.positionLeft\n }\n }\n\n handleDragStart = event => {\n if (this.isPointerDown || !this.props.enabled) {\n return\n }\n\n if (\n !this.props.allowOutsideDrag &&\n !this.dragContainer.current.contains(event.target)\n ) {\n return\n }\n\n const pos = getPointerPosition(event)\n if (pos === null) return\n\n this.isPointerDown = true\n this.isScrolling = false\n this.isDragging = false\n this.stopAnimation()\n this.dragStartPos = {\n ...pos,\n }\n this.previousDragPositions = [pos]\n this.willTrigger = false\n this.dispatchTriggerChange(this.willTrigger)\n }\n\n /** Lets the parent know that a swipe event will be triggered if the cursor\n * is released. Useful for displaying UI feedback */\n dispatchTriggerChange = willTrigger => {\n const { onTriggerChange } = this.props\n if (onTriggerChange) {\n onTriggerChange(willTrigger)\n }\n }\n\n handleDragMove = event => {\n const {\n onDragStart,\n onLockScroll,\n onSwipeLeft,\n onSwipeRight,\n enabled,\n rubberBanding,\n } = this.props\n if (this.isPointerDown && !this.isScrolling) {\n const pos = getPointerPosition(event)\n\n if (pos === null) return\n\n const lastPos = this.previousDragPositions[\n this.previousDragPositions.length - 1\n ]\n\n if (lastPos && pos.source !== lastPos.source) {\n return\n }\n\n /* Values to determine if the dragging means either a swipe or a scroll */\n const threshold = {\n x: 15,\n y: 10,\n }\n\n const distance = {\n x: pos.x - this.dragStartPos.x,\n y: pos.y - this.dragStartPos.y,\n }\n\n if (!this.isDragging) {\n if (Math.abs(distance.x) >= threshold.x) {\n this.isDragging = true\n onDragStart()\n onLockScroll()\n } else if (Math.abs(distance.y) >= threshold.y) {\n this.isScrolling = true\n }\n } else {\n this.offset = distance.x\n\n /** Either applies rubberbanding or stops dragging at the limits */\n const limitDragging = offset => {\n const rubberBandingMultiplier = 0.3\n return rubberBanding ? offset * rubberBandingMultiplier : 0\n }\n\n if (!enabled || (!onSwipeLeft && this.offset < 0)) {\n this.offset = limitDragging(this.offset)\n } else if (!enabled || (!onSwipeRight && this.offset > 0)) {\n this.offset = limitDragging(this.offset)\n }\n\n this.setOffset(this.offset)\n this.previousDragPositions.push(pos)\n\n const willTrigger = this.checkTrigger()\n\n if (this.willTrigger !== willTrigger) {\n this.dispatchTriggerChange(willTrigger)\n }\n\n this.willTrigger = willTrigger\n }\n }\n }\n\n setOffset = offset => {\n this.offset = offset\n if (this.dragContainer && this.dragContainer.current) {\n this.props.onSetPosition({\n element: this.props.element || this.dragContainer.current,\n offset,\n })\n this.props.onUpdateOffset(offset)\n }\n }\n\n setMomentum = (momentum, target) => {\n const [, targetUnit] = parseMeasure(target)\n\n if (targetUnit === '%') {\n const bounds = this.dragContainer.current.getBoundingClientRect()\n const width = bounds.width\n this.offset = `${(this.offset / width) * 100}%`\n momentum = (momentum / width) * 100\n }\n this.momentum = momentum\n\n /* Lets momentum live only for a brief time. If position changes in this meantime,\n * then momentum is applied. Otherwise it's ignored and a regular transition is done */\n if (this.momentumTimeout) {\n clearTimeout(this.momentumTimeout)\n }\n this.momentumTimeout = setTimeout(() => {\n this.momentum = null\n this.momentumTimeout = null\n }, 100)\n }\n\n /** Checks if the mouse/touch movement at the time of release triggers a\n * swipe, and if so, to which direction */\n checkTrigger = () => {\n if (!this.props.enabled) {\n return null\n }\n\n /* Checks the last $samples cursor positions to determine the\n * average speed and direction of movement */\n const samples = 6\n const fps = 60\n const releaseSpeed =\n this.previousDragPositions\n .slice(-samples)\n .map((cur, i, arr) => {\n const last = arr[i - 1]\n if (last == null) {\n return null\n }\n return cur.x - last.x\n })\n .filter(cur => cur != null)\n .reduce((sum, cur) => sum + cur / samples, 0) * fps\n\n const { onSwipeLeft, onSwipeRight } = this.props\n\n const triggers = {\n left:\n onSwipeLeft && releaseSpeed < 0 && this.offset < -this.props.threshold,\n right:\n onSwipeRight && releaseSpeed > 0 && this.offset > this.props.threshold,\n }\n\n if (triggers.left) {\n return {\n type: LEFT,\n speed: releaseSpeed,\n }\n }\n if (triggers.right) {\n return {\n type: RIGHT,\n speed: releaseSpeed,\n }\n }\n return null\n }\n\n handleDragEnd = event => {\n if (this.isPointerDown && this.isDragging) {\n event.preventDefault()\n event.stopPropagation()\n const trigger = this.checkTrigger()\n if (trigger) {\n switch (trigger.type) {\n case LEFT:\n if (this.props.preserveMomentum) {\n this.setMomentum(trigger.speed, this.props.positionLeft)\n }\n this.props.onSwipeLeft()\n break\n case RIGHT:\n if (this.props.preserveMomentum) {\n this.setMomentum(trigger.speed, this.props.positionRight)\n }\n this.props.onSwipeRight()\n break\n }\n } else {\n this.offsetAnimation.value = this.offset\n animate({\n object: this.offsetAnimation,\n prop: 'value',\n target: 0,\n duration: 0.2,\n onUpdate: value => {\n this.setOffset(value)\n },\n })\n }\n this.props.onDragEnd()\n this.props.onUnlockScroll()\n }\n this.isScrolling = false\n this.wasDragging = this.isPointerDown && this.isDragging\n this.isPointerDown = false\n }\n\n render() {\n return (\n <div\n aria-hidden\n ref={this.dragContainer}\n style={{\n ...this.props.style,\n transform: `translate3d(${this.getOffsetFromPosition()}, 0, 0)`,\n }}\n className={this.props.className}\n >\n {this.props.children}\n </div>\n )\n }\n}\n\nSwipable.propTypes = {\n children: PropTypes.node,\n onSwipeLeft: PropTypes.func,\n onSwipeRight: PropTypes.func,\n onTriggerChange: PropTypes.func,\n onLockScroll: PropTypes.func,\n onUnlockScroll: PropTypes.func,\n onDragStart: PropTypes.func,\n onDragEnd: PropTypes.func,\n onSetPosition: PropTypes.func,\n onUpdateOffset: PropTypes.func,\n threshold: PropTypes.number,\n enabled: PropTypes.bool,\n rubberBanding: PropTypes.bool,\n element: PropTypes.element,\n position: PropTypes.oneOf([CENTER, LEFT, RIGHT]),\n className: PropTypes.string,\n style: PropTypes.object,\n positionRight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n positionLeft: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n preserveMomentum: PropTypes.bool,\n allowOutsideDrag: PropTypes.bool,\n}\n\nSwipable.defaultProps = {\n onSwipeLeft: null,\n leftTargetPosition: null,\n onSwipeRight: null,\n rightTargetPosition: null,\n onTriggerChange: null,\n position: CENTER,\n onLockScroll: () => {},\n onUnlockScroll: () => {},\n onDragStart: () => {},\n onDragEnd: () => {},\n onSetPosition: ({ element, offset }) => {\n const unit = typeof offset === 'number' ? 'px' : ''\n element.style.transform = `translate3d(${offset}${unit},0,0)`\n },\n onUpdateOffset: () => {},\n element: null,\n threshold: 0,\n enabled: true,\n rubberBanding: false,\n style: {},\n positionRight: '100%',\n positionLeft: '-100%',\n preserveMomentum: true,\n allowOutsideDrag: false,\n}\n\n```" } ]
code_store-on-localhost_53f1cb11
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Drawer/Overlay.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { RefForwardingComponent } from 'react'\n\ninterface Props {\n visible: boolean\n onClick(event: React.MouseEvent | React.TouchEvent): void\n}\n\nconst Overlay: RefForwardingComponent<HTMLDivElement, Props> = (\n { visible, onClick }: Props,\n ref\n) => {\n return (\n <div\n ref={ref}\n aria-hidden\n onClick={onClick}\n style={{\n opacity: visible ? 0.5 : 0,\n pointerEvents: visible ? 'auto' : 'none',\n transition: 'opacity 300ms',\n }}\n className=\"bg-base--inverted z-999 fixed top-0 bottom-0 left-0 right-0\"\n />\n )\n}\n\nexport default React.forwardRef(Overlay)\n\n```" } ]
code_store-on-localhost_47f6a0f1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/SocialNetworks.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport IOMessage from '../NativeTypes/IOMessage'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nimport SocialNetwork from './components/SocialNetwork'\n\ninterface SocialNetworkData {\n url: string\n name: string\n}\n\ninterface Props {\n title?: string\n socialNetworks: SocialNetworkData[]\n showInColor: boolean\n}\n\nconst CSS_HANDLES = [\n 'socialNetworksTitle',\n 'socialNetworksContainer',\n 'socialNetworkWrapper',\n]\n\nconst SocialNetworks: StorefrontFunctionComponent<Props> = ({\n title,\n showInColor,\n socialNetworks = [],\n}) => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <div className={handles.socialNetworkWrapper}>\n {title && (\n <div className={`${handles.socialNetworksTitle} mb4`}>\n <IOMessage id={title} />\n </div>\n )}\n <div className={`${handles.socialNetworksContainer} nh2 flex`}>\n {socialNetworks.map(socialNetworkData => (\n <SocialNetwork\n key={socialNetworkData.name + socialNetworkData.url}\n showInColor={showInColor}\n url={socialNetworkData.url}\n name={socialNetworkData.name}\n />\n ))}\n </div>\n </div>\n )\n}\n\nSocialNetworks.schema = {\n title: 'admin/editor.footer.socialNetworks.title',\n description: 'admin/editor.footer.socialNetworks.description',\n type: 'object',\n properties: {\n showInColor: {\n default: false,\n isLayout: true,\n title: 'admin/editor.footer.showSocialNetworksInColor.title',\n type: 'boolean',\n },\n },\n}\n\nexport default SocialNetworks\n\n```" } ]
code_store-on-localhost_b0f33820
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/Spacer.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nconst CSS_HANDLES = ['footerSpacer'] as const\n\nconst Spacer: FunctionComponent = () => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return <div className={`${handles.footerSpacer} flex flex-grow-1`} />\n}\n\nexport default Spacer\n\n```" } ]
code_store-on-localhost_d6da9c38
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/AcceptedPaymentMethods.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nimport PaymentMethodIcon, {\n PaymentMethod,\n} from './components/PaymentMethodIcon'\n\ninterface Props {\n paymentMethods: PaymentMethod[]\n showInColor: boolean\n}\n\nconst CSS_HANDLES = ['acceptedPaymentMethodContainer'] as const\n\nconst AcceptedPaymentMethods: StorefrontFunctionComponent<Props> = ({\n paymentMethods = [],\n showInColor = false,\n}) => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <div className={`${handles.acceptedPaymentMethodContainer} nh2 flex`}>\n {paymentMethods.map(paymentMethod => (\n <PaymentMethodIcon\n key={paymentMethod}\n paymentMethod={paymentMethod}\n showInColor={showInColor}\n />\n ))}\n </div>\n )\n}\n\nAcceptedPaymentMethods.schema = {\n title: 'admin/editor.footer.acceptedPaymentMethods.title',\n description: 'admin/editor.footer.acceptedPaymentMethods.description',\n type: 'object',\n properties: {\n showInColor: {\n default: false,\n isLayout: true,\n title: 'admin/editor.footer.showPaymentMethodsInColor.title',\n type: 'boolean',\n },\n },\n}\n\nexport default AcceptedPaymentMethods\n\n```" } ]
code_store-on-localhost_158ff4bc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/PoweredBy.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport { withRuntimeContext } from 'vtex.render-runtime'\n\nimport withImage from './components/withImage'\nimport { PLATFORM_GOCOMMERCE } from './modules/platformCode'\n\nconst CSS_HANDLES = ['poweredBy', 'poweredByImage', 'poweredByLink']\n\n/**\n * \"Powered By VTEX/GoCommerce\" image component, used in Footer\n */\nconst PoweredBy: StorefrontFunctionComponent<PoweredByProps> = ({\n imageSrc,\n runtime,\n}) => {\n const handles = useCssHandles(CSS_HANDLES)\n if (!imageSrc) {\n return null\n }\n\n if (runtime.platform === PLATFORM_GOCOMMERCE) {\n return (\n <a\n href=\"https://www.gocommerce.com/?utm_source=store_footer\"\n className={handles.poweredByLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <div className={`${handles.poweredBy} flex items-center w4`}>\n <img\n className={`${handles.poweredByImage} w-100`}\n src={imageSrc}\n alt=\"GoCommerce\"\n />\n </div>\n </a>\n )\n }\n\n return (\n <div className={`${handles.poweredBy} flex items-center h3 w3`}>\n <img\n className={`${handles.poweredByImage} w-100`}\n src={imageSrc}\n alt=\"VTEX\"\n />\n </div>\n )\n}\n\ninterface PoweredByProps extends PoweredBySchema {\n runtime: {\n platform: string\n }\n logoUrl: string\n imageSrc: string\n}\n\ninterface PoweredBySchema {\n showInColor: boolean\n}\n\nPoweredBy.displayName = 'PoweredBy'\n\nconst getImagePathFromProps = ({ runtime, showInColor }: PoweredByProps) =>\n `${runtime.platform}${showInColor ? '' : '-bw'}.svg`\n\nexport default withRuntimeContext(withImage(getImagePathFromProps)(PoweredBy))\n\n```" } ]
code_store-on-localhost_278aa87c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/FooterLayout.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nconst CSS_HANDLES = ['footerLayout', 'footerLayoutSpacer'] as const\n\nconst FooterLayout: React.FC = props => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <>\n <div className={`${handles.footerLayoutSpacer} flex flex-grow-1`} />\n <div className={handles.footerLayout}>{props.children}</div>\n </>\n )\n}\n\nexport default FooterLayout\n\n```" } ]
code_store-on-localhost_4a238443
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/Row.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport classNames from 'classnames'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport Container from '../StoreComponents/Container'\n\ninterface RowProps {\n fullWidth?: boolean\n inverted?: boolean\n blockClass?: string\n}\n\nconst CSS_HANDLES = ['rowContainer', 'row', 'rowContentContainer'] as const\n\nconst Row: StorefrontFunctionComponent<RowProps> = ({\n children,\n fullWidth,\n inverted,\n blockClass,\n}) => {\n const handles = useCssHandles(CSS_HANDLES,{blockClass})\n\n const content = (\n <div className={`${handles.rowContainer} w-100 flex items-center`}>\n {children}\n </div>\n )\n\n return (\n <div\n className={classNames(\n handles.row,\n 'w-100',\n inverted ? 'bg-base--inverted c-on-base--inverted' : 'bg-base c-on-base'\n )}\n >\n {fullWidth ? (\n content\n ) : (\n <Container className={`${handles.rowContentContainer} w-100 flex`}>\n {content}\n </Container>\n )}\n </div>\n )\n}\n\nRow.schema = {\n title: 'admin/editor.row.title',\n type: 'object',\n properties: {\n blockClass: {\n title: 'admin/editor.blockClass.title',\n description: 'admin/editor.blockClass.description',\n type: 'string',\n isLayout: true,\n },\n inverted: {\n title: 'admin/editor.inverted.title',\n description: 'admin/editor.inverted.description',\n type: 'boolean',\n default: true,\n isLayout: true,\n },\n fullWidth: {\n title: 'admin/editor.fullWidth.title',\n description: 'admin/editor.fullWidth.description',\n type: 'boolean',\n default: false,\n isLayout: true,\n },\n },\n}\n\nexport default Row\n\n```" } ]
code_store-on-localhost_1a107300
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Footer/Footer.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport useDevice from '../DeviceDetector/useDevice'\nimport Row from './Row'\nimport Spacer from './Spacer'\nimport SocialNetworks from './SocialNetworks'\nimport Menu from '../Menu/Menu'\nimport MenuItem from '../Menu/MenuItem'\nimport AcceptedPaymentMethods from './AcceptedPaymentMethods'\nimport RichText from '../RichText'\nimport SubmenuAccordion from '../Menu/SubmenuAccordion'\n\nconst Desktop = () => {\n return (\n <div>\n <Row blockClass=\"menu-row\" paddingTop={6} paddingBottom={3}>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-news\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"#\", noFollow: true, tagTitle:\"News\", text:\"News\"}}/>\n <MenuItem id=\"menu-item-black-friday\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"#\", noFollow: true, tagTitle:\"BlackFriday\", text:\"Black Friday\"}}/>\n <MenuItem id=\"menu-item-sale\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"#\", noFollow: true, tagTitle:\"Sale\", text:\"Sale\"}}/>\n <MenuItem id=\"menu-item-personalization\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"#\", noFollow: true, tagTitle:\"Personalization\", text:\"Personalization\"}}/>\n </Menu>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-category-clothing\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/d\", noFollow: true, tagTitle:\"Clothing\", text:\"Clothing\"}}/>\n <MenuItem id=\"menu-item-shorts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/shorts\", noFollow: true, tagTitle:\"Shorts\", text:\"Shorts\"}}/>\n <MenuItem id=\"menu-item-tank-tops\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/tank-tops\", noFollow: true, tagTitle:\"Tank Tops\", text:\"Tank Tops\"}}/>\n <MenuItem id=\"menu-item-shirts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/shirts\", noFollow: true, tagTitle:\"Shirts\", text:\"Shirts\"}}/>\n <MenuItem id=\"menu-item-sweat-shirts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/sweatshirt\", noFollow: true, tagTitle:\"Sweatshirt\", text:\"Sweatshirt\"}}/>\n <MenuItem id=\"menu-item-cropped\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/cropped\", noFollow: true, tagTitle:\"Cropped\", text:\"Cropped\"}}/>\n </Menu>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-smartphones\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/smartphones\", noFollow: true, tagTitle:\"Smartphones\", text:\"Smartphones\"}}/>\n <MenuItem id=\"menu-item-videogames\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/videogames\", noFollow: true, tagTitle:\"Videogames\", text:\"Videogames\"}}/>\n <MenuItem id=\"menu-item-tvs\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/tvs\", noFollow: true, tagTitle:\"TVs\", text:\"TVs\"}}/>\n </Menu>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-bags\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/bags/d\", noFollow: true, tagTitle:\"Bags\", text:\"Bags\"}}/>\n <MenuItem id=\"menu-item-backpacks\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/bags/backpacks\", noFollow: true, tagTitle:\"Backpacks\", text:\"Backpacks\"}}/>\n <MenuItem id=\"menu-item-necessaire\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/bags/necessaire\", noFollow: true, tagTitle:\"Necessaire\", text:\"Necessaire\"}}/>\n </Menu>\n <Spacer />\n <SocialNetworks socialNetworks={[\n {\n \"name\": \"Facebook\",\n \"url\": \"https://www.facebook.com/vtexonline/\"\n },\n {\n \"name\": \"Instagram\",\n \"url\": \"https://www.instagram.com/vtextruecloud/\"\n },\n {\n \"name\": \"Twitter\",\n \"url\": \"https://twitter.com/vtexonline\"\n },\n {\n \"name\": \"Youtube\",\n \"url\": \"https://www.youtube.com/user/VTEXTV\"\n }\n ]}/>\n </Row>\n <Row blockClass=\"payment-methods\">\n <AcceptedPaymentMethods paymentMethods={[\"MasterCard\", \"Visa\", \"Diners Club\"]} />\n </Row>\n <Row blockClass=\"credits\">\n <RichText text=\"All stock and product photos are from photos.icons8.com\" blockClass=\"footer\"/>\n </Row>\n </div>\n )\n}\n\nconst Mobile = () => {\n return (\n <div>\n <Row paddingTop={4} paddingBottom={4}>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-category-clothing\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/d\", noFollow: true, tagTitle:\"Clothing\", text:\"Clothing\"}}>\n <SubmenuAccordion>\n <Menu orientation=\"vertical\">\n <MenuItem id=\"menu-item-category-clothing\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/d\", noFollow: true, tagTitle:\"Clothing\", text:\"Clothing\"}}/>\n <MenuItem id=\"menu-item-shorts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/shorts\", noFollow: true, tagTitle:\"Shorts\", text:\"Shorts\"}}/>\n <MenuItem id=\"menu-item-tank-tops\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/tank-tops\", noFollow: true, tagTitle:\"Tank Tops\", text:\"Tank Tops\"}}/>\n <MenuItem id=\"menu-item-shirts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/shirts\", noFollow: true, tagTitle:\"Shirts\", text:\"Shirts\"}}/>\n <MenuItem id=\"menu-item-sweat-shirts\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/sweatshirt\", noFollow: true, tagTitle:\"Sweatshirt\", text:\"Sweatshirt\"}}/>\n <MenuItem id=\"menu-item-cropped\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/clothing/cropped\", noFollow: true, tagTitle:\"Cropped\", text:\"Cropped\"}}/>\n </Menu>\n </SubmenuAccordion>\n </MenuItem>\n <MenuItem itemProps={{ \"tagTitle\": \"Decoration\", \"text\": \"Decoration\" }}>\n <SubmenuAccordion>\n <MenuItem id=\"menu-item-smartphones\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/smartphones\", noFollow: true, tagTitle:\"Smartphones\", text:\"Smartphones\"}}/>\n <MenuItem id=\"menu-item-videogames\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/videogames\", noFollow: true, tagTitle:\"Videogames\", text:\"Videogames\"}}/>\n <MenuItem id=\"menu-item-tvs\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/tvs\", noFollow: true, tagTitle:\"TVs\", text:\"TVs\"}}/>\n </SubmenuAccordion>\n </MenuItem>\n <MenuItem itemProps={{ \"tagTitle\": \"Sale\", \"text\": \"Sale\" }}>\n <SubmenuAccordion>\n <MenuItem id=\"menu-item-smartphones\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/smartphones\", noFollow: true, tagTitle:\"Smartphones\", text:\"Smartphones\"}}/>\n <MenuItem id=\"menu-item-videogames\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/videogames\", noFollow: true, tagTitle:\"Videogames\", text:\"Videogames\"}}/>\n <MenuItem id=\"menu-item-tvs\" type=\"custom\" iconId={null} highlight={false} itemProps={{ type: \"internal\", href: \"/decoration/tvs\", noFollow: true, tagTitle:\"TVs\", text:\"TVs\"}}/>\n </SubmenuAccordion>\n </MenuItem>\n </Menu>\n </Row>\n <Row>\n\n </Row>\n </div>\n )\n}\n\nconst Footer = () => {\n const { isMobile } = useDevice()\n return isMobile ? <Mobile /> : <Desktop />\n}\n\nFooter.schema = {\n title: 'admin/editor.footer.title',\n description: 'admin/editor.footer.description',\n type: 'object',\n properties: {\n showPaymentFormsInColor: {\n type: 'boolean',\n title: 'admin/editor.footer.showPaymentMethodsInColor.title',\n default: false,\n isLayout: true,\n },\n showSocialNetworksInColor: {\n type: 'boolean',\n title: 'admin/editor.footer.showSocialNetworksInColor.title',\n default: false,\n isLayout: true,\n },\n showVtexLogoInColor: {\n type: 'boolean',\n title: 'admin/editor.footer.showVtexLogoInColor.title',\n default: false,\n isLayout: true,\n },\n },\n}\n\nexport default Footer\n\n```" } ]
code_store-on-localhost_64b770ff
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductListContext/ProductListContext.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { createContext, useContext, useReducer, FC } from 'react'\n\nexport interface Product {\n productId: string\n [key: string]: any\n}\nexport interface State {\n nextImpressions: Product[]\n sentIds: Set<string>\n}\n\ntype ReducerActions =\n | { type: 'SEND_IMPRESSION'; args: { product: Product } }\n | { type: 'RESET_NEXT_IMPRESSIONS' }\n\nexport type Dispatch = (action: ReducerActions) => void\n\nconst DEFAULT_STATE: State = {\n nextImpressions: [],\n sentIds: new Set<string>(),\n}\n\nconst ProductListStateContext = createContext<State>(DEFAULT_STATE)\nconst ProductListDispatchContext = createContext<Dispatch>(action => {\n console.error('error in dispatch ', action)\n})\n\nfunction productListReducer(state: State, action: ReducerActions): State {\n switch (action.type) {\n case 'SEND_IMPRESSION': {\n const { product } = action.args\n let nextImpressions = state.nextImpressions\n if (!state.sentIds.has(product.productId)) {\n state.sentIds.add(product.productId)\n nextImpressions = state.nextImpressions.concat(product)\n }\n return {\n ...state,\n nextImpressions,\n }\n }\n case 'RESET_NEXT_IMPRESSIONS': {\n return { ...state, nextImpressions: [] }\n }\n default: {\n throw new Error(`Unhandled action type on product-list-context`)\n }\n }\n}\n\nconst initialState: State = {\n nextImpressions: [],\n sentIds: new Set(),\n}\n\nconst ProductListProvider: FC = ({ children }) => {\n const [state, dispatch] = useReducer(productListReducer, initialState)\n return (\n <ProductListStateContext.Provider value={state}>\n <ProductListDispatchContext.Provider value={dispatch}>\n {children}\n </ProductListDispatchContext.Provider>\n </ProductListStateContext.Provider>\n )\n}\n\nconst useProductListState = () => useContext(ProductListStateContext)\n\nconst useProductListDispatch = () => useContext(ProductListDispatchContext)\n\nexport default {\n ProductListProvider,\n useProductListState,\n useProductListDispatch,\n}\n\n```" } ]
code_store-on-localhost_939a5665
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductListContext/useProductImpression.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { useEffect, useCallback } from 'react'\nimport debounce from 'debounce'\nimport PixelContext from '../PixelContext/PixelContext'\n\nimport productImpressionHooks, { Product, Dispatch } from './ProductListContext'\nimport { parseToProductImpression } from './utils/parser'\n\nconst { useProductListDispatch, useProductListState } = productImpressionHooks\n\nconst sendImpressionEvents = (\n products: Product[],\n push: any,\n dispatch: Dispatch\n) => {\n if (!products || products.length <= 0) {\n return\n }\n const parsedProducts = products.filter(Boolean).map(parseToProductImpression)\n const impressions = parsedProducts.map((product: Product, index: number) => ({\n product,\n position: index + 1,\n }))\n push({\n event: 'productImpression',\n list: 'Shelf',\n impressions,\n })\n dispatch({ type: 'RESET_NEXT_IMPRESSIONS' })\n}\n\nconst useProductImpression = () => {\n const { nextImpressions } = useProductListState()\n const { push } = PixelContext.usePixel()\n const dispatch = useProductListDispatch()\n\n const debouncedSendImpressionEvents = useCallback(\n debounce(sendImpressionEvents, 1000, false),\n []\n )\n\n useEffect(() => {\n debouncedSendImpressionEvents(nextImpressions, push, dispatch)\n }, [nextImpressions, debouncedSendImpressionEvents, dispatch, push])\n}\n\nexport default useProductImpression\n\n```" } ]
code_store-on-localhost_e21fa480
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/CheckoutResources/Queries.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { loader } from 'graphql.macro'\n\nconst orderForm = loader('./queries/orderForm.graphql')\n\nexport default {\n orderForm,\n}\n\n```" } ]
code_store-on-localhost_0031b32a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/CheckoutResources/Mutations.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { loader } from 'graphql.macro'\n\nconst addToCart = loader('./mutations/addToCart.graphql')\nconst estimateShipping = loader('./mutations/estimateShipping.graphql')\nconst insertCoupon = loader('./mutations/insertCoupon.graphql')\nconst selectDeliveryOption = loader('./mutations/selectDeliveryOption.graphql')\nconst updateItems = loader('./mutations/updateItems.graphql')\n\nexport default {\n addToCart,\n estimateShipping,\n insertCoupon,\n selectDeliveryOption,\n updateItems,\n}\n\n```" } ]
code_store-on-localhost_f40b9545
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/CheckoutResources/Utils.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { useCheckoutURL } from './utils/useCheckoutURL'\n\nexport default {\n useCheckoutURL,\n}\n\n```" } ]
code_store-on-localhost_bfe32b97
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/LocaleSwitcher/LocaleSwitcher.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\n/* eslint-disable react-hooks/exhaustive-deps */\nimport { loader } from 'graphql.macro'\nimport { path } from 'ramda'\nimport React, { useEffect, useMemo, useState } from 'react'\nimport { useQuery } from 'react-apollo'\n\nimport { useRuntime } from '../../../../vtex.render-runtime'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport IconGlobe from '../StoreIcons/IconGlobe'\n\nconst Locales = loader('./queries/locales.gql')\n\nconst CSS_HANDLES = ['container', 'button', 'buttonText', 'list', 'listElement']\n\nfunction getLabel(localeId) {\n return localeId.split('-')[0]\n}\n\nfunction getSupportedLanguages(data) {\n if (data.loading || data.error) {\n return []\n }\n\n const supportedLanguages = path(['currentBinding', 'supportedLocales'], data) || path(['languages', 'supported'], data) || []\n \n return supportedLanguages.reduce((acc, lang) => {\n if (!lang.includes('-')) {\n return acc\n }\n\n return acc.concat({\n text: getLabel(lang),\n localeId: lang\n })\n }, [])\n}\n\nconst getLocale = (supportedLangs, locale) => {\n const localeObj = supportedLangs.find(\n ({ localeId }) => getLabel(localeId) === getLabel(locale)\n )\n return localeObj || (supportedLangs && supportedLangs[0])\n}\n\nconst LocaleSwitcher = () => {\n const data = useQuery(Locales)\n const supportedLangs = useMemo(() => getSupportedLanguages(data), [data])\n const { culture, emitter } = useRuntime()\n const [openLocaleSelector, setOpenLocaleSelector] = useState(false)\n const [selectedLocale, setSelectedLocale] = useState(() => getLocale(supportedLangs, culture && culture.locale))\n const handles = useCssHandles(CSS_HANDLES)\n\n useEffect(() => {\n const newSelectedLocale = getLocale(supportedLangs, culture.locale)\n\n if (newSelectedLocale !== selectedLocale) {\n setSelectedLocale(selectedLocale)\n }\n }, [supportedLangs, culture.locale])\n\n const handleLocaleClick = id => {\n emitter.emit('localesChanged', id)\n setOpenLocaleSelector(false)\n setSelectedLocale(getLocale(supportedLangs, id))\n }\n\n const handleMouseDown = e => {\n e.preventDefault()\n }\n\n if (supportedLangs.length === 0 || !selectedLocale) {\n return null\n }\n\n const containerClasses = `${handles.container} w3 flex items-center justify-end ml2 mr3 relative`\n const buttonClasses = `${handles.button} link pa0 bg-transparent bn flex items-center pointer mr3 c-on-base`\n const buttonTextClasses = `${handles.buttonText} pl2 t-action--small order-1`\n const listClasses = `${handles.list} absolute z-5 list top-1 w3 ph0 mh0 mv4 bg-base`\n const listElementClasses = `${handles.listElement} t-action--small pointer f5 pa3 hover-bg-muted-5 tc`\n\n return (\n <div className={containerClasses}>\n <button\n className={buttonClasses}\n onBlur={() => setOpenLocaleSelector(false)}\n onClick={() => setOpenLocaleSelector(!openLocaleSelector)}\n >\n <IconGlobe />\n <span className={buttonTextClasses}>{selectedLocale.text}</span>\n </button>\n <ul\n hidden={!openLocaleSelector}\n className={listClasses}\n >\n {supportedLangs\n .filter(({ localeId }) => localeId !== selectedLocale.localeId)\n .map(({ localeId, text }) => (\n <li\n key={localeId}\n onMouseDown={handleMouseDown}\n className={listElementClasses}\n onClick={() => handleLocaleClick(localeId)}\n >\n {text}\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport default LocaleSwitcher\n\n```" } ]
code_store-on-localhost_2d535baf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryAttachmentList.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport AttachmentList from './components/ProductSummaryAttachmentList/AttachmentList'\n\nexport default AttachmentList\n\n```" } ]
code_store-on-localhost_d39b394c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummarySpecificationBadges.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummarySpecificationBadges from './components/ProductSummarySpecificationBadges/index'\n\nexport default ProductSummarySpecificationBadges\n\n```" } ]
code_store-on-localhost_603dd733
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/Spacer.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nconst CSS_HANDLES = ['spacer']\n\nconst Spacer = () => {\n const handles = useCssHandles(CSS_HANDLES)\n return <div className={`${handles.spacer} flex flex-grow-1`}/>\n}\n\nexport default Spacer\n\n```" } ]
code_store-on-localhost_d7331248
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/productSummary.css from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.containerInline .imageContainer {\n max-width: 30%;\n}\n\n.containerInline .imageContainer > img {\n max-height: 100%;\n}\n\n.container {\n}\n.containerSmall {\n}\n.containerInline {\n}\n.containerInlinePrice {\n}\n.information {\n}\n.element {\n}\n.image {\n}\n.buyButtonContainer {\n}\n.buyButton {\n}\n.description {\n}\n.quantityStepperContainer {\n}\n.imageInline {\n max-height: 7rem;\n}\n\n.isHidden {\n visibility: hidden;\n}\n\n.containerNormal {\n}\n\n.nameContainer {\n}\n\n.clearLink {\n text-decoration: inherit;\n color: inherit;\n}\n\n.aspectRatio {\n padding-top: 100%;\n background: center / contain no-repeat;\n}\n\n.priceContainer {\n}\n\n.SKUSelectorContainer {}\n\n.attachmentListContainer {\n}\n\n.attachmentItemContainer {\n}\n\n.imageNormal {\n max-height: 17.56rem;\n}\n\n.addToListBtn {\n}\n\n.imagePlaceholder {\n}\n\n.attachmentChildrenContainer {\n}\n\n.imageStackContainer {\n}\n\n.hoverEffect {\n}\n\n.hoverEffect:hover .hoverImage {\n display: inline;\n}\n\n.hoverImage {\n}\n\n```" } ]
code_store-on-localhost_87858eea
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummarySKUSelector.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummarySKUSelector from './components/ProductSummarySKUSelector'\n\nexport default ProductSummarySKUSelector\n\n```" } ]
code_store-on-localhost_259f6044
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryName.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryName from './components/ProductSummaryName/ProductSummaryName'\n\nexport default ProductSummaryName\n\n```" } ]
code_store-on-localhost_8a233a20
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryCustom.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummary from './components/ProductSummary'\n\nexport default ProductSummary\n\n```" } ]
code_store-on-localhost_3098bbd8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryImage.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductImage from './components/ProductSummaryImage/ProductImage'\n\nexport default ProductImage\n\n```" } ]
code_store-on-localhost_301833be
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryBrand.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryBrand from './components/ProductSummaryBrand/ProductSummaryBrand'\n\nexport default ProductSummaryBrand\n```" } ]
code_store-on-localhost_5740e564
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryPrice.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryPrice from './components/ProductSummaryPrice/ProductSummaryPrice'\n\nexport default ProductSummaryPrice\n\n```" } ]
code_store-on-localhost_b70d0cd0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryLegacy.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryLegacy from './legacy'\n\nexport default ProductSummaryLegacy\n\n```" } ]
code_store-on-localhost_acaa95d5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryDescription.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryDescription from './components/ProductSummaryDescription/ProductSummaryDescription'\n\nexport default ProductSummaryDescription\n\n```" } ]
code_store-on-localhost_47753b4a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryContext.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryContext from './components/ProductSummaryContext'\n\nexport default ProductSummaryContext\n\n```" } ]
code_store-on-localhost_f2af1f34
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/useProductSummaryListState.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport { useProductSummaryListState } from './ProductSummaryList'\n\nexport default useProductSummaryListState\n\n```" } ]
code_store-on-localhost_2d301da2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryBuyButton.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryBuyButton from './components/ProductSummaryBuyButton/ProductSummaryBuyButton'\n\nexport default ProductSummaryBuyButton\n\n```" } ]
code_store-on-localhost_499b61f0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryAddToListButton.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryAddToListButton from './components/ProductSummaryAddToListButton/ProductSummaryAddToListButton'\n\nexport default ProductSummaryAddToListButton\n\n```" } ]
code_store-on-localhost_dcf46335
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/ProductSummaryList.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { useQuery } from 'react-apollo'\nimport ProductListContext from '../ProductListContext/ProductListContext'\nimport { ExtensionPoint, useTreePath } from '../../../../vtex.render-runtime'\nimport ListContextProvider from '../ListContext/ListContextProvider'\nimport useListContext from '../ListContext/useListContext'\n\nimport { mapCatalogProductToProductSummary } from './utils/normalize'\nimport ProductListEventCaller from './components/ProductListEventCaller'\nimport { loader } from 'graphql.macro'\n\nconst productSearchV2 = loader('../StoreResources/queries/productSearchV2.gql')\n\nconst ORDER_BY_OPTIONS = {\n RELEVANCE: {\n name: 'admin/editor.productSummaryList.orderType.relevance',\n value: 'OrderByScoreDESC',\n },\n TOP_SALE_DESC: {\n name: 'admin/editor.productSummaryList.orderType.sales',\n value: 'OrderByTopSaleDESC',\n },\n PRICE_DESC: {\n name: 'admin/editor.productSummaryList.orderType.priceDesc',\n value: 'OrderByPriceDESC',\n },\n PRICE_ASC: {\n name: 'admin/editor.productSummaryList.orderType.priceAsc',\n value: 'OrderByPriceASC',\n },\n NAME_ASC: {\n name: 'admin/editor.productSummaryList.orderType.nameAsc',\n value: 'OrderByNameASC',\n },\n NAME_DESC: {\n name: 'admin/editor.productSummaryList.orderType.nameDesc',\n value: 'OrderByNameDESC',\n },\n RELEASE_DATE_DESC: {\n name: 'admin/editor.productSummaryList.orderType.releaseDate',\n value: 'OrderByReleaseDateDESC',\n },\n BEST_DISCOUNT_DESC: {\n name: 'admin/editor.productSummaryList.orderType.discount',\n value: 'OrderByBestDiscountDESC',\n },\n}\nconst parseFilters = ({ id, value }) => `specificationFilter_${id}:${value}`\n\nfunction getOrdinationProp(attribute) {\n return Object.keys(ORDER_BY_OPTIONS).map(\n key => ORDER_BY_OPTIONS[key][attribute]\n )\n}\n\nconst ProductSummaryList = ({\n children,\n category = '',\n collection,\n hideUnavailableItems = false,\n orderBy = ORDER_BY_OPTIONS.TOP_SALE_DESC.value,\n specificationFilters = [],\n maxItems = 10,\n withFacets = false,\n}) => {\n const { data } = useQuery(productSearchV2, {\n ssr: true,\n name: 'productList',\n variables: {\n category,\n ...(collection != null\n ? {\n collection,\n }\n : {}),\n specificationFilters: specificationFilters.map(parseFilters),\n orderBy,\n from: 0,\n to: maxItems - 1,\n hideUnavailableItems,\n withFacets,\n },\n })\n\n const { list } = useListContext()\n const { treePath } = useTreePath()\n\n const componentList =\n data.productSearch &&\n data.productSearch.products.map(product => {\n const normalizedProduct = mapCatalogProductToProductSummary(product)\n\n return (\n <ExtensionPoint\n id=\"product-summary\"\n key={product.id}\n treePath={treePath}\n product={normalizedProduct}\n />\n )\n })\n\n const newListContextValue = list.concat(componentList)\n\n return (\n <ListContextProvider list={newListContextValue}>\n {children}\n </ListContextProvider>\n )\n}\n\nconst EnhancedProductList = ({ children }) => {\n const { ProductListProvider } = ProductListContext\n\n return (\n <ProductListProvider>\n <ProductSummaryList>{children}</ProductSummaryList>\n <ProductListEventCaller />\n </ProductListProvider>\n )\n}\n\nEnhancedProductList.getSchema = () => ({\n title: 'admin/editor.productSummaryList.title',\n description: 'admin/editor.productSummaryList.description',\n type: 'object',\n properties: {\n category: {\n title: 'admin/editor.productSummaryList.category.title',\n description: 'admin/editor.productSummaryList.category.description',\n type: 'string',\n isLayout: false,\n },\n specificationFilters: {\n title: 'admin/editor.productSummaryList.specificationFilters.title',\n type: 'array',\n items: {\n title:\n 'admin/editor.productSummaryList.specificationFilters.item.title',\n type: 'object',\n properties: {\n id: {\n type: 'string',\n title:\n 'admin/editor.productSummaryList.specificationFilters.item.id.title',\n },\n value: {\n type: 'string',\n title:\n 'admin/editor.productSummaryList.specificationFilters.item.value.title',\n },\n },\n },\n },\n collection: {\n title: 'admin/editor.productSummaryList.collection.title',\n type: 'number',\n isLayout: false,\n },\n orderBy: {\n title: 'admin/editor.productSummaryList.orderBy.title',\n type: 'string',\n enum: getOrdinationProp('value'),\n enumNames: getOrdinationProp('name'),\n default: ORDER_BY_OPTIONS.TOP_SALE_DESC.value,\n isLayout: false,\n },\n hideUnavailableItems: {\n title: 'admin/editor.productSummaryList.hideUnavailableItems',\n type: 'boolean',\n default: false,\n isLayout: false,\n },\n maxItems: {\n title: 'admin/editor.productSummaryList.maxItems.title',\n type: 'number',\n isLayout: false,\n default: 10,\n },\n },\n})\n\nexport default EnhancedProductList\n\n```" } ]
code_store-on-localhost_33c98a33
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/ProductSummary/Column.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nconst CSS_HANDLES = ['column']\n\nconst Column = ({ children }) => {\n const handles = useCssHandles(CSS_HANDLES)\n return <div className={`${handles.column} flex items-center`}>{children}</div>\n}\n\nexport default Column\n\n```" } ]
code_store-on-localhost_86e2c7f1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/ProductList.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport OrderFormOrder from '../OrderManager/OrderForm'\nconst { useOrderForm } = OrderFormOrder\nimport OrderItems from '../OrderItems/OrderItems'\nconst { useOrderItems } = OrderItems\nimport { ExtensionPoint } from '../../../../vtex.render-runtime'\nimport { usePixel } from '../PixelContext/PixelContext'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nimport { mapCartItemToPixel } from './modules/pixelHelper'\n\ninterface Props {\n renderAsChildren: boolean\n}\n\nconst CSS_HANDLES = ['minicartProductListContainer'] as const\n\nconst ProductList: FC<Props> = ({ renderAsChildren }) => {\n const {\n orderForm: { items },\n } = useOrderForm()\n const { updateQuantity, removeItem } = useOrderItems()\n const { push } = usePixel()\n const handles = useCssHandles(CSS_HANDLES)\n\n const handleQuantityChange = (\n uniqueId: string,\n quantity: number,\n item: OrderFormItem\n ) => {\n const adjustedItem = {\n ...mapCartItemToPixel(item),\n quantity,\n }\n\n push({\n event: 'addToCart',\n items: [adjustedItem],\n })\n updateQuantity({ uniqueId, quantity })\n }\n const handleRemove = (uniqueId: string, item: OrderFormItem) => {\n const adjustedItem = mapCartItemToPixel(item)\n push({\n event: 'removeFromCart',\n items: [adjustedItem],\n })\n removeItem({ uniqueId })\n }\n\n return (\n <div\n /* \n This prevents an interaction with the quantity selector\n inside of a product in the ProductList to bubble up a\n mouseleave event to the Popup component, which would result\n in the minicart being closed (when openOnHover = true). \n */\n onMouseLeave={e => e.stopPropagation()}\n className={`${handles.minicartProductListContainer} ${\n renderAsChildren ? 'w-100 h-100' : ''\n } overflow-y-auto ph4 ph6-l`}\n >\n <ExtensionPoint\n id=\"product-list\"\n items={items}\n onQuantityChange={handleQuantityChange}\n onRemove={handleRemove}\n />\n </div>\n )\n}\n\nexport default ProductList\n\n```" } ]
code_store-on-localhost_8404fc72
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/MinicartContext.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { createContext, useReducer, useContext, FC } from 'react'\nimport useDevice from '../DeviceDetector/useDevice'\n\ninterface OpenMinicartAction {\n type: 'OPEN_MINICART'\n}\ninterface CloseMinicartAction {\n type: 'CLOSE_MINICART'\n}\ninterface SetOpenBehaviorAction {\n type: 'SET_OPEN_BEHAVIOR'\n value: 'click' | 'hover'\n}\n\ninterface State {\n variation: MinicartVariationType\n open: boolean\n hasBeenOpened: boolean\n /** Controls the minicart opening behavior */\n openBehavior: 'click' | 'hover'\n /** Value provided by the user to openOnHover prop */\n openOnHoverProp: boolean\n}\n\ninterface Props {\n openOnHover: boolean\n variation: MinicartVariationType\n}\n\ntype Action = OpenMinicartAction | CloseMinicartAction | SetOpenBehaviorAction\ntype Dispatch = (action: Action) => void\n\nconst MinicartStateContext = createContext<State | undefined>(undefined)\nconst MinicartDispatchContext = createContext<Dispatch | undefined>(undefined)\n\nfunction minicartContextReducer(state: State, action: Action): State {\n switch (action.type) {\n case 'OPEN_MINICART':\n return {\n ...state,\n open: true,\n hasBeenOpened: true,\n }\n case 'CLOSE_MINICART':\n return {\n ...state,\n open: false,\n }\n case 'SET_OPEN_BEHAVIOR':\n return {\n ...state,\n openBehavior: action.value,\n }\n default:\n return state\n }\n}\n\nconst MinicartContextProvider: FC<Props> = ({\n variation = 'drawer',\n openOnHover: openOnHoverProp = false,\n children,\n}) => {\n const { isMobile } = useDevice()\n\n // This prevents a popup minicart from being used on a mobile device\n const resolvedVariation =\n isMobile || (window && window.innerWidth <= 480) ? 'drawer' : variation\n\n const [state, dispatch] = useReducer(minicartContextReducer, {\n variation: resolvedVariation,\n open: false,\n hasBeenOpened: false,\n openOnHoverProp,\n openBehavior:\n resolvedVariation === 'popup' && openOnHoverProp ? 'hover' : 'click',\n })\n\n return (\n <MinicartStateContext.Provider value={state}>\n <MinicartDispatchContext.Provider value={dispatch}>\n {children}\n </MinicartDispatchContext.Provider>\n </MinicartStateContext.Provider>\n )\n}\n\nfunction useMinicartState() {\n const context = useContext(MinicartStateContext)\n if (context === undefined) {\n throw new Error(\n 'useMinicartState must be used within a MinicartContextProvider'\n )\n }\n return context\n}\n\nfunction useMinicartDispatch() {\n const context = useContext(MinicartDispatchContext)\n\n if (context === undefined) {\n throw new Error(\n 'useMinicartDispatch must be used within a MinicartContextProvider'\n )\n }\n return context\n}\n\nexport { MinicartContextProvider, useMinicartDispatch, useMinicartState }\n\n```" } ]
code_store-on-localhost_c1f56f0f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/styles.css from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.drawerStyles {\n height: 100%;\n}\n\n.popupStyles {\n max-height: 600px;\n}\n\n.minicartEmptyStateContainerDefault {\n width: 340px;\n}\n\n.minicartQuantityBadgeDefault {\n top: -0.7rem;\n right: -0.8rem;\n}\n\n.popupBoxPosition {\n right: -40px;\n width: 364px;\n top: 100%;\n}\n\n.popupArrowUp {\n right: 7px;\n}\n```" } ]
code_store-on-localhost_d0adc426
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/Minicart.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport CheckoutUtils from '../CheckoutResources/Utils'\nconst { useCheckoutURL } = CheckoutUtils\nimport OrderFormOrder from '../OrderManager/OrderForm'\nconst { useOrderForm } = OrderFormOrder\n\nimport MinicartIconButton from './components/MinicartIconButton'\nimport DrawerMode from './components/DrawerMode'\nimport { MinicartContextProvider, useMinicartState } from './MinicartContext'\nimport PopupMode from './components/Popup'\nimport useCartIdPixel from './modules/useCartIdPixel'\n\nconst CSS_HANDLES = ['minicartWrapperContainer', 'minicartContainer'] as const\n\nconst Minicart: FC<MinicartProps> = ({\n maxDrawerWidth = 400,\n drawerSlideDirection = 'rightToLeft',\n linkVariationUrl,\n children,\n}) => {\n const handles = useCssHandles(CSS_HANDLES)\n const { variation } = useMinicartState()\n const { url: checkoutUrl } = useCheckoutURL()\n\n if (variation === 'link') {\n return (\n <aside\n className={`${handles.minicartWrapperContainer} relative fr flex items-center`}\n >\n <div className={`${handles.minicartContainer} flex flex-column`}>\n <a href={linkVariationUrl || checkoutUrl}>{MinicartIconButton}</a>\n </div>\n </aside>\n )\n }\n\n return (\n <aside\n className={`${handles.minicartWrapperContainer} relative fr flex items-center`}\n >\n <div className={`${handles.minicartContainer} flex flex-column`}>\n {variation === 'drawer' ? (\n <DrawerMode\n maxDrawerWidth={maxDrawerWidth}\n drawerSlideDirection={drawerSlideDirection}\n >\n {children}\n </DrawerMode>\n ) : (\n <PopupMode>{children}</PopupMode>\n )}\n </div>\n </aside>\n )\n}\n\nconst CartIdPixel = () => {\n const { orderForm, loading }: OrderFormContext = useOrderForm()\n\n const orderFormId = !loading && orderForm ? orderForm.id : undefined\n useCartIdPixel(orderFormId)\n\n return null\n}\n\nconst EnhancedMinicart = (props: MinicartProps) => (\n <MinicartContextProvider\n variation={props.variation}\n openOnHover={props.openOnHover}\n >\n <CartIdPixel />\n <Minicart {...props} />\n </MinicartContextProvider>\n)\n\nexport default EnhancedMinicart\n\n```" } ]
code_store-on-localhost_8c76be44
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/index.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport classNames from 'classnames'\nimport { compose, map, partition, path, pathOr, pick, isNil, prop } from 'ramda'\nimport React, {\n useState,\n useEffect,\n useCallback,\n useRef,\n useContext,\n useMemo,\n} from 'react'\nimport { graphql, withApollo } from 'react-apollo'\nimport { injectIntl } from 'react-intl'\nimport ButtonWithIcon from '../Styleguide/ButtonWithIcon'\nimport ToastContext from '../Styleguide/ToastContext'\nimport { useRuntime } from '../../../../vtex.render-runtime'\nimport IconCart from '../StoreIcons/IconCart'\n\n\nimport { usePixel } from '../PixelContext/PixelContext'\nimport ProductPrice from '../StoreComponents/ProductPrice'\nimport CheckoutUtils from '../CheckoutResources/Utils'\n\nimport MiniCartContent from './legacy/components/MiniCartContent'\nimport Sidebar from './legacy/components/Sidebar'\nimport Popup from './legacy/components/Popup'\nimport { shouldShowItem } from './legacy/utils/itemsHelper'\nimport {\n mapBuyButtonItemToPixel,\n mapCartItemToPixel,\n} from './modules/pixelHelper'\nimport { loader } from 'graphql.macro'\n\nimport createLocalState, { ITEMS_STATUS } from './legacy/localState'\n\nimport styles from './legacy/minicart.css'\nimport useMarketingSessionParams from './legacy/hooks/useMarketingSessionParams'\nimport useCardIdPixel from './modules/useCartIdPixel'\n\nconst orderFormQuery = loader('../StoreResources/queries/orderForm.gql')\nconst addToCart = loader('../StoreResources/mutations/addToCart.gql')\nconst updateItems = loader('../StoreResources/mutations/updateItems.gql')\nconst fullMinicartQuery = loader('./legacy/localState/graphql/fullMinicartQuery.gql')\nconst updateItemsMutation = loader('./legacy/localState/graphql/updateItemsMutation.gql')\nconst updateOrderFormMutation = loader('./legacy/localState/graphql/updateOrderFormMutation.gql')\nconst updateLocalItemStatusMutation = loader('./legacy/localState/graphql/updateLocalItemStatusMutation.gql')\nconst setMinicartOpenMutation = loader('./legacy/localState/graphql/setMinicartOpenMutation.gql')\n\nconst { useCheckoutURL } = CheckoutUtils\nconst DEFAULT_LABEL_CLASSES = ''\nconst DEFAULT_ICON_CLASSES = 'gray'\n\nconst useOffline = () => {\n const [isOffline, setOffline] = useState(() =>\n typeof navigator !== 'undefined'\n ? !pathOr(true, ['onLine'], navigator)\n : false\n )\n\n useEffect(() => {\n const updateStatus = () => {\n if (navigator) {\n const offline = !pathOr(true, ['onLine'], navigator)\n setOffline(offline)\n }\n }\n\n window.addEventListener('online', updateStatus)\n window.addEventListener('offline', updateStatus)\n\n return () => {\n window.removeEventListener('online', updateStatus)\n window.removeEventListener('offline', updateStatus)\n }\n }, [])\n\n return isOffline\n}\n\nconst useLinkState = client => {\n useEffect(() => {\n const { resolvers, initialState } = createLocalState(client)\n client.addResolvers(resolvers)\n // Add the initial state to if there is not there\n try {\n client.readQuery({ query: fullMinicartQuery })\n } catch (err) {\n client.writeData({ data: initialState })\n }\n\n const minicartData = JSON.parse(localStorage.getItem('minicart'))\n\n if (minicartData) {\n client.writeData({\n data: {\n minicart: {\n __typename: 'Minicart',\n items: JSON.stringify(minicartData),\n },\n },\n })\n }\n }, [client])\n}\n\nconst useUpdateOrderFormOnState = (data, minicartState, updateOrderForm) => {\n // This ref guarantees that the first remote order form after mount will be saved on state, regardless of minicart state\n const hasSavedRemoteOrderFormRef = useRef(false)\n useEffect(\n () => {\n const updateLocalOrderForm = async () => {\n const orderFormData = JSON.parse(localStorage.getItem('orderForm'))\n\n const remoteOrderForm = data.orderForm\n\n if (remoteOrderForm || !orderFormData) {\n const forceRemoteOrderform =\n !hasSavedRemoteOrderFormRef.current && remoteOrderForm\n if (\n forceRemoteOrderform ||\n (!path(['orderForm'], minicartState) && remoteOrderForm)\n ) {\n hasSavedRemoteOrderFormRef.current = true\n await updateOrderForm(remoteOrderForm)\n }\n } else if (!path(['orderForm'], minicartState)) {\n await updateOrderForm(orderFormData)\n }\n }\n\n updateLocalOrderForm()\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data, minicartState]\n )\n}\n\nconst partitionItemsAddUpdate = clientItems => {\n return partition(compose(isNil, prop('cartIndex')), clientItems)\n}\n\n/**\n * Minicart component\n */\nconst MiniCart = ({\n labelClasses = DEFAULT_LABEL_CLASSES,\n iconClasses = DEFAULT_ICON_CLASSES,\n openOnHover = false,\n client,\n setMinicartOpen,\n labelMiniCartEmpty,\n linkButtonFinishShopping,\n labelButtonFinishShopping,\n iconSize,\n iconLabel,\n showTotalItemsQty,\n showPrice,\n showDiscount,\n data,\n linkState,\n type,\n hideContent,\n showShippingCost,\n updateOrderForm,\n intl,\n updateItemsMutation,\n addToCartMutation,\n updateLocalItemStatus,\n iconsProps,\n productSummaryProps,\n}) => {\n useLinkState(client)\n\n const [isUpdatingOrderForm, setUpdatingOrderForm] = useState(false)\n const isOffline = useOffline()\n\n const {\n hints: { mobile },\n navigate,\n } = useRuntime()\n const { showToast } = useContext(ToastContext)\n\n const minicartState = linkState.minicart || {}\n\n const localOrderForm = useMemo(() => {\n try {\n return JSON.parse(minicartState.orderForm)\n } catch (e) {\n return undefined\n }\n }, [minicartState.orderForm])\n\n const orderForm = pathOr(localOrderForm, ['orderForm'], data)\n const orderFormId =\n orderForm && orderForm.orderFormId ? orderForm.orderFormId : undefined\n\n useCardIdPixel(orderFormId)\n\n const minicartItems = useMemo(() => {\n try {\n return JSON.parse(minicartState.items)\n } catch (e) {\n return []\n }\n }, [minicartState.items])\n\n const modifiedItems = useMemo(\n () =>\n minicartItems.filter(\n ({ localStatus }) => localStatus === ITEMS_STATUS.MODIFIED\n ),\n [minicartItems]\n )\n\n useUpdateOrderFormOnState(data, minicartState, updateOrderForm)\n\n // synchronize values with local storage\n useEffect(() => {\n if (orderForm) {\n localStorage.setItem('minicart', JSON.stringify(minicartItems))\n localStorage.setItem('orderForm', JSON.stringify(orderForm))\n }\n }, [minicartItems, orderForm])\n\n const { utmParams, utmiParams } = useMarketingSessionParams()\n\n const addItems = useCallback(\n items => {\n if (!items.length || !orderFormId) {\n return null\n }\n\n return addToCartMutation({\n variables: {\n orderFormId,\n items,\n ...(utmParams ? {utmParams} : {}),\n ...(utmiParams ? {utmiParams} : {}),\n },\n })\n },\n [orderFormId, addToCartMutation, utmParams, utmiParams]\n )\n\n const mutateUpdateItems = useCallback(\n items => {\n if (!items.length || !orderFormId) {\n return null\n }\n\n return updateItemsMutation({\n variables: { orderFormId, items },\n })\n },\n [orderFormId, updateItemsMutation]\n )\n\n const { push } = usePixel()\n\n const orderFormRef = useRef(orderForm)\n\n const { url: checkoutUrl } = useCheckoutURL()\n\n useEffect(() => {\n orderFormRef.current = orderForm\n }, [orderForm])\n\n useEffect(\n () => {\n if (!isOffline) {\n updateLocalItemStatus()\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isOffline]\n )\n\n useEffect(\n () => {\n let isCurrent = true\n\n const syncItemsWithServer = async () => {\n if (!modifiedItems.length) {\n return\n }\n\n const prevOrderForm = orderFormRef.current\n\n try {\n setUpdatingOrderForm(true)\n\n const [itemsToAdd, itemsToUpdate] = partitionItemsAddUpdate(\n modifiedItems\n )\n const pickProps = map(\n pick(['id', 'index', 'quantity', 'seller', 'options'])\n )\n\n // server mutation\n const updateItemsResponse = await mutateUpdateItems(\n pickProps(itemsToUpdate)\n )\n\n // server mutation\n const addItemsResponse = await addItems(pickProps(itemsToAdd))\n\n if (itemsToAdd.length > 0) {\n push({\n event: 'addToCart',\n items: itemsToAdd.map(mapBuyButtonItemToPixel),\n })\n }\n\n if (!isCurrent) {\n return\n }\n\n const newOrderForm = pathOr(\n path(['data', 'updateItems'], updateItemsResponse),\n ['data', 'addItem'],\n addItemsResponse\n )\n\n push({\n event: 'cartChanged',\n items: newOrderForm && newOrderForm.items\n ? newOrderForm.items.map(mapCartItemToPixel)\n : []\n })\n\n setUpdatingOrderForm(false)\n await updateOrderForm(newOrderForm, true)\n } catch (err) {\n // TODO: Toast error message into Alert\n console.error(err)\n\n if (!isCurrent) {\n return\n }\n\n // Rollback items and orderForm\n setUpdatingOrderForm(false)\n await updateOrderForm(prevOrderForm, true)\n\n showToast({\n message: intl.formatMessage({\n id: 'store/minicart.checkout-failure',\n }),\n })\n }\n }\n\n if (isOffline) {\n setUpdatingOrderForm(updating => (updating ? false : updating))\n return\n }\n\n syncItemsWithServer()\n\n return () => {\n isCurrent = false\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n intl,\n isOffline,\n showToast,\n addItems,\n mutateUpdateItems,\n modifiedItems,\n push,\n ]\n )\n\n const handleClickButton = event => {\n if (!hideContent) {\n setMinicartOpen(!minicartState.isOpen)\n }\n event.persist()\n }\n\n const handleUpdateContentVisibility = () => {\n setMinicartOpen(false)\n }\n\n const handleClickProduct = detailUrl => {\n setMinicartOpen(false)\n navigate({\n to: detailUrl,\n })\n }\n\n const getFilteredItems = () => {\n return minicartItems.filter(shouldShowItem)\n }\n\n const itemsToShow = getFilteredItems()\n const totalItemsSum = arr =>\n arr.reduce((sum, product) => sum + product.quantity, 0)\n const quantity = showTotalItemsQty\n ? totalItemsSum(itemsToShow)\n : itemsToShow.length\n\n const isSizeLarge =\n (type && type === 'sidebar') ||\n mobile ||\n (window && window.innerWidth <= 480)\n\n const isOpen = pathOr(false, ['isOpen'], minicartState)\n\n const miniCartContent = (\n <MiniCartContent\n isSizeLarge={isSizeLarge}\n itemsToShow={itemsToShow}\n orderForm={{\n ...orderForm,\n items: minicartItems,\n }}\n loading={data.loading}\n showDiscount={showDiscount}\n labelMiniCartEmpty={labelMiniCartEmpty}\n linkButton={linkButtonFinishShopping || checkoutUrl}\n labelButton={labelButtonFinishShopping}\n onClickProduct={handleClickProduct}\n onClickAction={handleUpdateContentVisibility}\n showShippingCost={showShippingCost}\n updatingOrderForm={isUpdatingOrderForm}\n iconsProps={iconsProps}\n productSummaryProps={productSummaryProps}\n />\n )\n\n const priceClasses = classNames(\n `${styles.label} dn-m db-l t-action--small ${labelClasses}`,\n {\n pl6: quantity > 0,\n pl4: quantity <= 0,\n }\n )\n\n const isPriceVisible = showPrice && orderForm && orderForm.value > 0\n const iconLabelClasses = classNames(\n `${styles.label} dn-m db-l ${\n isPriceVisible ? 't-mini' : 't-action--small'\n } ${labelClasses}`,\n {\n pl6: quantity > 0,\n pl4: quantity <= 0,\n }\n )\n\n // This feature should only work for the popup minicart\n const shouldOpenOnHover = openOnHover && !isSizeLarge\n\n return (\n <aside className={`${styles.container} relative fr flex items-center`}>\n <div\n onMouseEnter={\n shouldOpenOnHover ? () => setMinicartOpen(true) : undefined\n }\n className=\"flex flex-column\"\n >\n <ButtonWithIcon\n icon={\n <span className={`relative ${iconClasses}`}>\n <IconCart size={iconSize} {...iconsProps} />\n {quantity > 0 && (\n <span\n data-testid=\"item-qty\"\n className={`${styles.badge} c-on-emphasis absolute t-mini bg-emphasis br4 w1 h1 pa1 flex justify-center items-center lh-solid`}\n >\n {quantity}\n </span>\n )}\n </span>\n }\n variation=\"tertiary\"\n onClick={handleClickButton}\n >\n {(iconLabel || isPriceVisible) && (\n <span className=\"flex items-center\">\n <span className=\"flex flex-column items-start\">\n {iconLabel && (\n <span className={iconLabelClasses}>{iconLabel}</span>\n )}\n {isPriceVisible && (\n <span data-testid=\"total-price\" className={priceClasses}>\n <div>\n <ProductPrice\n showLabels={false}\n showListPrice={false}\n sellingPrice={orderForm.value}\n />\n </div>\n </span>\n )}\n </span>\n </span>\n )}\n </ButtonWithIcon>\n {!hideContent &&\n (isSizeLarge ? (\n <Sidebar\n quantity={quantity}\n iconSize={iconSize}\n onOutsideClick={handleUpdateContentVisibility}\n isOpen={isOpen}\n iconsProps={iconsProps}\n >\n {miniCartContent}\n </Sidebar>\n ) : (\n isOpen && (\n <Popup onOutsideClick={handleUpdateContentVisibility}>\n {miniCartContent}\n </Popup>\n )\n ))}\n </div>\n </aside>\n )\n}\n\nconst withLinkStateUpdateItemsMutation = graphql(updateItemsMutation, {\n name: 'updateLinkStateItems',\n props: ({ updateLinkStateItems }) => ({\n updateLinkStateItems: items =>\n updateLinkStateItems({ variables: { items } }),\n }),\n})\n\nconst withLinkStateUpdateOrderFormMutation = graphql(updateOrderFormMutation, {\n name: 'updateOrderForm',\n props: ({ updateOrderForm }) => ({\n updateOrderForm: (orderForm, forceUpdateItems = false) =>\n updateOrderForm({ variables: { orderForm, forceUpdateItems } }),\n }),\n})\n\nconst withLinkStateUpdateLocalItemStatusMutation = graphql(\n updateLocalItemStatusMutation,\n {\n name: 'updateLocalItemStatus',\n }\n)\n\nconst withLinkStateSetIsOpenMutation = graphql(setMinicartOpenMutation, {\n name: 'setMinicartOpen',\n props: ({ setMinicartOpen }) => ({\n setMinicartOpen: isOpen => setMinicartOpen({ variables: { isOpen } }),\n }),\n})\n\nconst EnhancedMinicart = compose(\n graphql(orderFormQuery, { options: { ssr: false } }),\n graphql(fullMinicartQuery, { name: 'linkState', ssr: false }),\n graphql(addToCart, { name: 'addToCartMutation' }),\n graphql(updateItems, { name: 'updateItemsMutation' }),\n withApollo,\n withLinkStateUpdateItemsMutation,\n withLinkStateUpdateOrderFormMutation,\n withLinkStateUpdateLocalItemStatusMutation,\n withLinkStateSetIsOpenMutation,\n injectIntl\n)(MiniCart)\n\nEnhancedMinicart.schema = {\n title: 'admin/editor.minicart.title',\n description: 'admin/editor.minicart.description',\n type: 'object',\n properties: {\n type: {\n title: 'admin/editor.minicart.type.title',\n type: 'string',\n default: 'popup',\n enum: ['popup', 'sidebar'],\n enumNames: [\n 'admin/editor.minicart.type.popup',\n 'admin/editor.minicart.type.sidebar',\n ],\n widget: {\n 'ui:widget': 'radio',\n 'ui:options': {\n inline: true,\n },\n },\n isLayout: true,\n },\n iconLabel: {\n title: 'admin/editor.minicart.iconLabel.title',\n type: 'string',\n isLayout: false,\n },\n showDiscount: {\n title: 'admin/editor.minicart.showDiscount.title',\n type: 'boolean',\n isLayout: true,\n },\n labelMiniCartEmpty: {\n title: 'admin/editor.minicart.labelMiniCartEmpty.title',\n type: 'string',\n isLayout: false,\n },\n linkButtonFinishShopping: {\n title: 'admin/editor.minicart.linkButtonFinishShopping.title',\n type: 'string',\n isLayout: false,\n },\n labelButtonFinishShopping: {\n title: 'admin/editor.minicart.labelButtonFinishShopping.title',\n type: 'string',\n isLayout: false,\n },\n },\n}\n\nexport default EnhancedMinicart\n\n```" } ]
code_store-on-localhost_ce5838b5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/BaseContent.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, {\n FC,\n useEffect,\n Children,\n ReactElement,\n Fragment,\n memo,\n} from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { ExtensionPoint, useChildBlock } from '../../../../vtex.render-runtime'\nimport OrderFormOrder from '../OrderManager/OrderForm'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nimport { useMinicartState } from './MinicartContext'\nimport styles from './styles.css'\nimport { mapCartItemToPixel } from './modules/pixelHelper'\nimport useDebouncedPush from './modules/debouncedPixelHook'\nimport CheckoutButton from './CheckoutButton'\nimport EmptyState from './EmptyState'\nimport Row from '../FlexLayout/Row'\nimport Col from '../FlexLayout/Col'\nimport RichText from '../RichText'\n\ninterface Props {\n sideBarMode: boolean\n finishShoppingButtonLink: string\n}\n\nconst { useOrderForm } = OrderFormOrder\n\nconst CSS_HANDLES = [\n 'minicartContentContainer',\n 'minicartProductListContainer',\n'minicartTitle',\n 'minicartFooter',\n] as const\n\n// eslint-disable-next-line react/display-name\nconst MinicartHeader: FC<{ minicartTitleHandle: string }> = memo(\n ({ minicartTitleHandle }) => (\n <h3\n className={`${minicartTitleHandle} t-heading-3 mv2 ph4 ph6-l c-on-base`}\n >\n <FormattedMessage id=\"store/minicart.title\" />\n </h3>\n )\n)\n\nconst Content: FC<Props> = ({ finishShoppingButtonLink, children }) => {\n const { orderForm, loading }: OrderFormContext = useOrderForm()\n const push = useDebouncedPush()\n const handles = useCssHandles(CSS_HANDLES)\n const { variation } = useMinicartState()\n\n useEffect(() => {\n if (loading) {\n return\n }\n\n push({\n event: 'cartChanged',\n items: orderForm.items.map(mapCartItemToPixel),\n })\n }, [push, loading, orderForm.items])\n\n const minicartContentClasses = `${handles.minicartContentContainer} ${\n variation === 'drawer' ? styles.drawerStyles : styles.popupStyles\n } flex flex-column justify-between`\n\n const minicartFooterClasses = `${handles.minicartFooter} ${\n variation === 'drawer' ? '' : 'pv3'\n } sticky`\n\n const isCartEmpty = !loading && orderForm.items.length === 0\n const hasProductListBlock = useChildBlock({ id: 'minicart-product-list' })\n const hasMinicartSummaryBlock = useChildBlock({ id: 'minicart-summary' })\n\n if (isCartEmpty) {\n return (\n <Fragment>\n <MinicartHeader minicartTitleHandle={handles.minicartTitle} />\n {/* <ExtensionPoint id=\"minicart-empty-state\" /> */}\n <EmptyState>\n <Row>\n <Col>\n <RichText text=\"Your cart is empty!\" />\n </Col>\n </Row>\n </EmptyState>\n </Fragment>\n )\n }\n\n if (hasProductListBlock && hasMinicartSummaryBlock) {\n return (\n <div className={minicartContentClasses}>\n <div\n className={`w-100 h-100 overflow-y-auto ${handles.minicartProductListContainer}`}\n >\n <MinicartHeader minicartTitleHandle={handles.minicartTitle} />\n <ExtensionPoint id=\"minicart-product-list\" />\n </div>\n <div className={minicartFooterClasses}>\n <ExtensionPoint id=\"minicart-summary\" />\n <CheckoutButton finishShoppingButtonLink={finishShoppingButtonLink} />\n </div>\n </div>\n )\n }\n\n return (\n <div className={minicartContentClasses}>\n <MinicartHeader minicartTitleHandle={handles.minicartTitle} />\n {Children.map(children, child =>\n React.cloneElement(child as ReactElement, { renderAsChildren: true })\n )}\n </div>\n )\n}\n\nexport default Content\n\n```" } ]
code_store-on-localhost_785db4ce
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/EmptyState.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport useCssHandles from '../CssHandles/useCssHandles'\n\nconst CSS_HANDLES = ['minicartEmptyStateContainer'] as const\n\nconst EmptyState: FC = ({ children }) => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return <div className={handles.minicartEmptyStateContainer}>{children}</div>\n}\n\nexport default EmptyState\n\n```" } ]
code_store-on-localhost_cd5da792
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/CheckoutButton.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport Button from '../Styleguide/Button'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport CheckoutUtils from '../CheckoutResources/Utils'\nconst { useCheckoutURL } = CheckoutUtils\n\nimport useCheckout from './modules/checkoutHook'\n\ninterface Props {\n finishShoppingButtonLink: string\n}\n\nconst CSS_HANDLES = ['minicartCheckoutButton'] as const\n\nconst CheckoutButton: FC<Props> = ({ finishShoppingButtonLink }) => {\n const { url: checkoutUrl } = useCheckoutURL()\n const handles = useCssHandles(CSS_HANDLES)\n const goToCheckout = useCheckout()\n\n return (\n <div className={`${handles.minicartCheckoutButton} mv3 ph4 ph6-l`}>\n <Button\n id=\"proceed-to-checkout\"\n onClick={() => goToCheckout(finishShoppingButtonLink || checkoutUrl)}\n variation=\"primary\"\n block\n >\n <FormattedMessage id=\"store/minicart.go-to-checkout\" />\n </Button>\n </div>\n )\n}\n\nexport default CheckoutButton\n\n```" } ]
code_store-on-localhost_a199731a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Minicart/Summary.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { ExtensionPoint } from '../../../../vtex.render-runtime'\nimport OrderForm from '../OrderManager/OrderForm'\nconst { useOrderForm } = OrderForm\n\nconst Summary: FC = () => {\n const {\n orderForm: { totalizers, value },\n } = useOrderForm()\n\n return (\n <div className=\"ph4 ph6-l pt5\">\n <ExtensionPoint\n id=\"checkout-summary\"\n totalizers={totalizers}\n total={value}\n />\n </div>\n )\n}\n\nexport default Summary\n\n```" } ]
code_store-on-localhost_c405ddd4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconMinus.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconMinus = (props: IconProps) => {\n return <Icon id=\"nav-minus\" handle=\"minusIcon\" {...props} />\n}\n\nexport default IconMinus\n\n```" } ]
code_store-on-localhost_fb2784d5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconHeart.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconHeart = (props: IconProps) => {\n return <Icon id=\"mpa-heart\" handle=\"heartIcon\" {...props} />\n}\n\nexport default IconHeart\n\n```" } ]
code_store-on-localhost_464bbd6f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconPlus.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconPlus = (props: IconProps) => {\n return <Icon id=\"nav-plus\" handle=\"plusIcon\" {...props} />\n}\n\nexport default IconPlus\n\n```" } ]
code_store-on-localhost_3c5af462
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconSingleGrid.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconSingleGrid = (props: IconProps) => {\n return <Icon id=\"mpa-single-item\" handle=\"singleGridIcon\" {...props} />\n}\n\nexport default IconSingleGrid\n\n```" } ]
code_store-on-localhost_b064671a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconCaret.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport classnames from 'classnames'\nimport Icon from './components/Icon'\nimport { getOrientation } from './utils/helpers'\n\nconst IconCaret = ({ orientation, thin = false, ...props }: CaretProps) => {\n const orientationModifier = getOrientation(orientation)\n const id: string = classnames({\n [`nav-thin-caret${orientationModifier}`]: thin,\n [`nav-caret${orientationModifier}`]: !thin,\n })\n return <Icon id={id} handle=\"caretIcon\" {...props} />\n}\n\nexport default IconCaret as any\n\n```" } ]
code_store-on-localhost_68579722
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconLocationMarker.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconLocationMarker = (props: IconProps) => {\n return (\n <Icon id=\"hpa-location-marker\" handle=\"locationMarkerIcon\" {...props} />\n )\n}\n\nexport default IconLocationMarker\n\n```" } ]
code_store-on-localhost_d70560e5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconInlineGrid.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconInlineGrid = (props: IconProps) => {\n return <Icon id=\"mpa-list-items\" handle=\"inlineGridIcon\" {...props} />\n}\n\nexport default IconInlineGrid\n\n```" } ]
code_store-on-localhost_b4e0bc33
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconCart.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconCart = (props: IconProps) => {\n return <Icon id=\"hpa-cart\" handle=\"cartIcon\" {...props} />\n}\n\nexport default IconCart as any\n\n```" } ]
code_store-on-localhost_79c55d8a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconEyeSight.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\nimport { getType, getState } from './utils/helpers'\n\nconst IconEyeSight = ({ type, state, ...props }: EnhancedIconProps) => {\n const typeModifier = getType(type, 'filled, outline')\n const stateModifier = getState(state)\n return (\n <Icon\n id={`mpa-eyesight${typeModifier}${stateModifier}`}\n handle=\"eyeSightIcon\"\n {...props}\n />\n )\n}\n\nexport default IconEyeSight\n\n```" } ]
code_store-on-localhost_214deb28
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconGlobe.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconGlobe = (props: IconProps) => {\n return <Icon id=\"mpa-globe\" handle=\"globeIcon\" {...props} />\n}\n\nexport default IconGlobe\n\n```" } ]
code_store-on-localhost_4349be7e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconBookmark.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\nimport { getType } from './utils/helpers'\n\nconst IconBoomark = ({ type = 'outline', ...props }: EnhancedIconProps) => {\n const typeModifier = getType(type, 'filled, outline')\n return <Icon id={`mpa-bookmark${typeModifier}`} {...props} />\n}\n\nexport default IconBoomark\n\n```" } ]
code_store-on-localhost_b8926ba7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconEquals.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconEquals = (props: IconProps) => {\n return <Icon id=\"sti-equals\" handle=\"equalsIcon\" {...props} />\n}\n\nexport default IconEquals\n\n```" } ]
code_store-on-localhost_443e07b3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/Icon.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport Icon from './components/Icon'\n\nexport default Icon\n\n```" } ]
code_store-on-localhost_c23f99c4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconSearch.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconSearch = (props: IconProps) => {\n return <Icon id=\"hpa-search\" handle=\"searchIcon\" {...props} />\n}\n\nexport default IconSearch\n\n```" } ]
code_store-on-localhost_9f6ee38f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconHome.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconHome = (props: IconProps) => {\n return <Icon id=\"nav-home\" handle=\"homeIcon\" {...props} />\n}\n\nexport default IconHome\n\n```" } ]
code_store-on-localhost_0df107f8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconClose.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\nimport { getType } from './utils/helpers'\n\nconst IconClose = ({ type = 'filled', ...props }: EnhancedIconProps) => {\n const typeModifier = getType(type)\n return <Icon handle=\"closeIcon\" id={`sti-close${typeModifier}`} {...props} />\n}\n\nexport default IconClose as any\n\n```" } ]
code_store-on-localhost_ff7d108a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconGrid.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconGrid = (props: IconProps) => {\n return <Icon id=\"mpa-gallery\" handle=\"gridIcon\" {...props} />\n}\n\nexport default IconGrid\n\n```" } ]
code_store-on-localhost_97b17f54
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconCheck.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { getType } from './utils/helpers'\n\nimport Icon from './components/Icon'\n\nconst IconCheck = ({ type, ...props }: EnhancedIconProps) => {\n const typeModifier = getType(type)\n return <Icon handle=\"checkIcon\" id={`sti-check${typeModifier}`} {...props} />\n}\n\nexport default IconCheck\n\n```" } ]
code_store-on-localhost_bcd90c09
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconDelete.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconDelete = (props: IconProps) => {\n return <Icon id=\"hpa-delete\" handle=\"deleteIcon\" {...props} />\n}\n\nexport default IconDelete\n\n```" } ]
code_store-on-localhost_00e7e7da
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconSwap.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconSwap = (props: IconProps) => {\n return <Icon id=\"mpa-swap\" handle=\"swapIcon\" {...props} />\n}\n\nexport default IconSwap\n\n```" } ]
code_store-on-localhost_45c256a1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconArrowBack.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconArrowBack = (props: IconProps) => {\n return <Icon id=\"hpa-arrow-back\" handle=\"arrowBackIcon\" {...props} />\n}\n\nexport default IconArrowBack\n\n```" } ]
code_store-on-localhost_115d3f13
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconMenu.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconMenu = (props: IconProps) => {\n return <Icon id=\"hpa-hamburguer-menu\" handle=\"menuIcon\" {...props} />\n}\n\nexport default IconMenu as any\n\n```" } ]
code_store-on-localhost_18ab4e76
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconRemove.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconRemove = (props: IconProps) => {\n return <Icon id=\"mpa-remove\" handle=\"removeIcon\" {...props} />\n}\n\nexport default IconRemove\n\n```" } ]
code_store-on-localhost_52f2a477
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconFilter.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconFilter = (props: IconProps) => {\n return <Icon id=\"mpa-filter-settings\" handle=\"filterIcon\" {...props} />\n}\n\nexport default IconFilter\n\n```" } ]
code_store-on-localhost_48e62250
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/package.json from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.store-icons\",\n \"version\": \"0.16.0\",\n \"description\": \"React components that encapsules store icons\",\n \"scripts\": {\n \"pretest\": \"yarn\",\n \"test\": \"vtex-test-tools test\",\n \"test:watch\": \"vtex-test-tools test --watch\",\n \"lint\": \"tsc --noEmit --pretty && tslint -c tslint.json './**/*.ts'\"\n },\n \"files\": [\n \"react\"\n ],\n \"dependencies\": {\n \"classnames\": \"^2.2.6\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.9.0\",\n \"react-dom\": \"^16.9.0\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.3.4\",\n \"@babel/preset-env\": \"^7.3.4\",\n \"@types/classnames\": \"^2.2.7\",\n \"@types/jest\": \"^24.0.9\",\n \"@types/node\": \"^11.10.0\",\n \"@types/ramda\": \"^0.25.51\",\n \"@types/react\": \"^16.8.6\",\n \"@vtex/test-tools\": \"^1.1.0\",\n \"babel-preset-react-app\": \"^7.0.2\",\n \"tslint\": \"^5.11.0\",\n \"tslint-config-vtex\": \"^2.0.0\",\n \"tslint-eslint-rules\": \"^5.4.0\",\n \"typescript\": \"3.7.3\"\n },\n \"resolutions\": {\n \"babel-core\": \"^7.0.0-bridge.0\"\n }\n}\n\n```" } ]
code_store-on-localhost_bce6e0ed
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconAssistantSales.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconAssistantSales = (props: IconProps) => {\n return <Icon id=\"hpa-telemarketing\" handle=\"assistantSalesIcon\" {...props} />\n}\n\nexport default IconAssistantSales\n\n```" } ]
code_store-on-localhost_f6c622c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconSocial.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\nimport { getShape } from './utils/helpers'\n\ninterface Props extends EnhancedIconProps {\n readonly network: string\n readonly background: string\n}\n\nconst IconSocial = ({ network, size, background, shape, ...props }: Props) => {\n const { wrapperProps, reducedIconSize } = getShape(size!, background, shape)\n\n return (\n <span {...wrapperProps}>\n <Icon\n id={`bnd-${network}`}\n handle=\"socialIcon\"\n size={reducedIconSize}\n {...props}\n />\n </span>\n )\n}\n\nIconSocial.defautProps = {\n size: 16,\n viewBox: '0 0 16 16',\n}\n\nexport default IconSocial\n\n```" } ]
code_store-on-localhost_c4a9a426
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconStar.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconStar = (props: IconProps) => {\n return <Icon id=\"inf-star\" handle=\"starIcon\" {...props} />\n}\n\nexport default IconStar\n\n```" } ]
code_store-on-localhost_9a4c9aaa
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconProfile.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconProfile = (props: IconProps) => {\n return <Icon id=\"hpa-profile\" handle=\"profileIcon\" {...props} />\n}\n\nexport default IconProfile\n\n```" } ]
code_store-on-localhost_e0f8f6a0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/StoreIcons/IconLocationInput.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Icon from './components/Icon'\n\nconst IconLocationInput = (props: IconProps) => {\n return <Icon id=\"mpa-location-input\" handle=\"locationInputIcon\" {...props} />\n}\n\nexport default IconLocationInput\n\n```" } ]
code_store-on-localhost_3c5b6ab7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Slider/resolveSlidesNumber.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport resolveSlidesNumber from './utils/resolveSlidesNumber'\n\nexport default resolveSlidesNumber\n\n```" } ]
code_store-on-localhost_790585c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Slider/Dots.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Dots from './components/Dots'\n\nexport default Dots\n\n\n```" } ]
code_store-on-localhost_7a01fb4b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Slider/Slide.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Slide from './components/Slide'\n\nexport default Slide\n\n```" } ]
code_store-on-localhost_78288962
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Slider/SliderContainer.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport SliderContainer from './components/SliderContainer'\n\nexport default SliderContainer\n\n```" } ]
code_store-on-localhost_55b4da54
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Slider/Slider.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Slider from './components/Slider'\n\nexport default Slider\n\n```" } ]
code_store-on-localhost_f20c8d37
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Carousel/Banner.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Link } from '../../../../vtex.render-runtime'\nimport useDevice from '../DeviceDetector/useDevice'\nimport classnames from 'classnames'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport styles from './styles.css'\n\nconst CSS_HANDLES = ['imgRegular', 'img', 'bannerLink'] as const\n\nexport interface Props {\n /** The image of the banner */\n image: string\n /** Link for the mobile image of the banner */\n mobileImage: string\n /** The description of the image */\n description: string\n /** Max height size of the banner */\n height: number\n /** The url where the image is pointing to, in case of external route */\n url: string\n /** The page where the image is pointing to */\n page: string\n /** Params of the url */\n params: string\n /** Indicates if the route is external or not */\n externalRoute: boolean\n /** The url where the image is pointing to, in case of internal route (optional) */\n customInternalURL: string\n /** Runtime injected deps */\n runtime: any,\n /** Link for the tablet image of the banner */\n tabletImage: string\n}\n\nfunction getParams(params: string) {\n const json: { [s: string]: string } = {}\n if (params) {\n const array = params.split(',')\n array.forEach(item => {\n const pair = item.split('=')\n json[pair[0]] = pair[1]\n })\n return json\n }\n return null\n}\n\nconst Banner = (props: Props) => {\n const {\n url,\n page,\n image,\n params,\n mobileImage,\n tabletImage,\n height = 420,\n externalRoute,\n description = '',\n customInternalURL,\n } = props\n\n const { isMobile, device } = useDevice()\n const handles = useCssHandles(CSS_HANDLES)\n\n const content = (\n <div className={classnames(styles.containerImg, 'w-100')}>\n <div\n className={classnames(\n handles.imgRegular,\n 'flex items-center justify-center'\n )}\n style={{ maxHeight: height }}\n >\n <img\n className={classnames(handles.img, 'w-100 h-100')}\n src={device === \"tablet\" ? tabletImage || image : isMobile && mobileImage ? mobileImage : image}\n alt={description}\n />\n </div>\n </div>\n )\n\n if (!externalRoute) {\n return page || customInternalURL ? (\n <Link\n className={classnames(handles.bannerLink, 'w-100')}\n page={customInternalURL ? undefined : page}\n params={getParams(params)}\n to={customInternalURL || undefined}\n >\n {content}\n </Link>\n ) : (\n content\n )\n }\n\n return (\n <a\n className={classnames(handles.bannerLink, 'w-100')}\n href={url}\n target=\"_blank\"\n >\n {content}\n </a>\n )\n}\n\nexport default Banner\n\n```" } ]
code_store-on-localhost_ca74c8ab
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Carousel/styles.css from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.container {\n min-height: 0.625rem;\n min-width: 0.625rem;\n}\n\n.containerImg {\n max-height: inherit;\n}\n\n.dot {\n height: 10px;\n width: 10px;\n}\n\n.arrowsContainer {\n box-sizing: content-box;\n}\n\n```" } ]
code_store-on-localhost_ee61f4c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Carousel/tests-setup.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\n/* eslint-disable */\nwindow.matchMedia =\n window.matchMedia ||\n function() {\n return {\n matches: false,\n addListener: function() {},\n removeListener: function() {},\n }\n }\n\n```" } ]
code_store-on-localhost_b7a4add2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Carousel/Carousel.tsx from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport classnames from 'classnames'\nimport React, { useState } from 'react'\nimport Dots from '../Slider/Dots'\nimport Slide from '../Slider/Slide'\nimport Slider from '../Slider/Slider'\nimport SliderContainer from '../Slider/SliderContainer'\n\nimport Container from '../StoreComponents/Container'\n\nimport IconCaret from '../StoreIcons/IconCaret'\n\nimport Banner, { Props as BannerProps } from './Banner'\nimport useCssHandles from '../CssHandles/useCssHandles'\nimport styles from './styles.css'\n\nconst GLOBAL_PAGES = (global as any).__RUNTIME__ && [\n 'Internal URL',\n ...Object.keys((global as any).__RUNTIME__.pages),\n]\n\ninterface Props {\n /** Should change images automatically */\n autoplay?: boolean\n /** How long it should wait to change the banner in secs */\n autoplaySpeed: number | string | null\n /** Banners that will be displayed by the Carousel */\n banners: BannerProps[]\n /** Max height size of the banners */\n height?: number\n /** Set visibility of arrows */\n showArrows?: boolean\n /** Set visibility of dots */\n showDots?: boolean\n}\n\ninterface ArrowProps {\n orientation: string\n onClick: (event: React.MouseEvent<HTMLElement>) => void\n}\n\ninterface ArrowContainerProps {\n children: React.ReactNode\n}\n\nconst PER_PAGE = 1\nconst CSS_HANDLES = [\n 'arrow',\n 'arrowLeft',\n 'arrowRight',\n 'arrowsContainerWrapper',\n 'sliderRoot',\n 'sliderFrame',\n 'slide',\n 'activeDot',\n 'notActiveDot',\n 'containerDots',\n] as const\n\nconst Carousel = (props: Props) => {\n const {\n height = 420,\n autoplay = true,\n showDots = true,\n showArrows = true,\n autoplaySpeed = 5,\n banners: bannersProp\n } = props\n const [currentSlide, setCurrentSlide] = useState(0)\n const handles = useCssHandles(CSS_HANDLES)\n\n if (!bannersProp.length) {\n return null\n }\n\n const ArrowRender = ({ orientation, onClick }: ArrowProps) => {\n const containerClasses = classnames(handles.arrow, 'pointer z-1 flex', {\n [handles.arrowLeft]: orientation === 'left',\n [handles.arrowRight]: orientation === 'right',\n })\n return (\n <div className={containerClasses} onClick={onClick}>\n <IconCaret orientation={orientation} thin size={20} />\n </div>\n )\n }\n\n const ArrowContainerRender = ({ children }: ArrowContainerProps) => {\n const wrapperClasses = classnames(\n handles.arrowsContainerWrapper,\n 'w-100 h-100 absolute left-0 top-0 flex justify-center'\n )\n const containerClasses = classnames(\n styles.arrowsContainer,\n 'w-100 h-100 mw9 flex-ns justify-between items-center dn-s'\n )\n\n return (\n <div className={wrapperClasses}>\n <Container className={containerClasses}>{children}</Container>\n </div>\n )\n }\n\n const banners: BannerProps[] = bannersProp.filter(\n banner => banner && (banner.mobileImage || banner.image)\n )\n\n const handleNextSlide = () => {\n const nextSlide = ((currentSlide + 1 - PER_PAGE) % banners.length) + PER_PAGE\n setCurrentSlide(nextSlide)\n }\n\n const autoplayInterval = autoplaySpeed\n ? typeof autoplaySpeed === 'string'\n ? parseFloat(autoplaySpeed)\n : autoplaySpeed\n : 0\n\n return (\n <SliderContainer\n autoplay={autoplay && autoplayInterval > 0}\n autoplayInterval={autoplayInterval * 1000}\n pauseOnHover\n onNextSlide={handleNextSlide}\n className={styles.container}\n >\n <Slider\n loop\n classes={{\n root: handles.sliderRoot,\n sliderFrame: handles.sliderFrame,\n }}\n perPage={PER_PAGE}\n arrowRender={showArrows && ArrowRender}\n currentSlide={currentSlide}\n onChangeSlide={setCurrentSlide}\n arrowsContainerComponent={showArrows && ArrowContainerRender}\n duration={500}\n >\n {banners.map((banner, i) => (\n <Slide\n className={handles.slide}\n key={i}\n style={{ maxHeight: height }}\n sliderTransitionDuration={500}\n >\n <Banner height={height} {...banner} />\n </Slide>\n ))}\n </Slider>\n {showDots && (\n <Dots\n loop\n perPage={PER_PAGE}\n currentSlide={currentSlide}\n totalSlides={banners.length}\n onChangeSlide={setCurrentSlide}\n classes={{\n activeDot: classnames(handles.activeDot, 'bg-emphasis'),\n dot: classnames(styles.dot, 'mh2 mv0 pointer br-100'),\n notActiveDot: classnames(handles.notActiveDot, 'bg-muted-3'),\n root: classnames(handles.containerDots, 'bottom-0 pb4'),\n }}\n />\n )}\n </SliderContainer>\n )\n}\n\nCarousel.getSchema = () => {\n const internalRouteSchema = {\n customInternalURL: {\n description:\n 'admin/editor.carousel.bannerLink.custominternalurl.description',\n isLayout: false,\n title: 'admin/editor.carousel.bannerLink.custominternalurl.title',\n type: 'string',\n },\n page: {\n enum: GLOBAL_PAGES,\n isLayout: false,\n title: 'admin/editor.carousel.bannerLink.page.title',\n type: 'string',\n },\n params: {\n description: 'admin/editor.carousel.bannerLink.params.description',\n isLayout: false,\n title: 'admin/editor.carousel.bannerLink.params.title',\n type: 'string',\n },\n }\n\n const externalRouteSchema = {\n url: {\n isLayout: false,\n title: 'admin/editor.carousel.bannerLink.url.title',\n type: 'string',\n },\n }\n\n return {\n description: 'admin/editor.carousel.description',\n dependencies: {\n autoplay: {\n oneOf: [\n {\n properties: {\n autoplay: {\n enum: [true],\n },\n autoplaySpeed: {\n enum: ['2', '3', '4', '5', '6', '7', '8'],\n isLayout: false,\n title: 'admin/editor.carousel.autoplaySpeed.title',\n type: 'string',\n },\n },\n },\n ],\n },\n },\n properties: {\n banners: {\n items: {\n properties: {\n image: {\n default: '',\n title: 'admin/editor.carousel.banner.image.title',\n type: 'string',\n widget: {\n 'ui:widget': 'image-uploader',\n },\n },\n mobileImage: {\n default: '',\n title: 'admin/editor.carousel.banner.mobileImage.title',\n type: 'string',\n widget: {\n 'ui:widget': 'image-uploader',\n },\n },\n tabletImage: {\n default: '',\n title: 'admin/editor.carousel.banner.tabletImage.title',\n type: 'string',\n widget: {\n 'ui:widget': 'image-uploader',\n },\n },\n description: {\n default: '',\n title: 'admin/editor.carousel.banner.description.title',\n type: 'string',\n },\n externalRoute: {\n default: false,\n isLayout: false,\n title: 'admin/editor.carousel.banner.externalRoute.title',\n type: 'boolean',\n },\n },\n dependencies: {\n externalRoute: {\n oneOf: [\n {\n properties: {\n externalRoute: {\n enum: [false],\n },\n ...internalRouteSchema,\n },\n },\n {\n properties: {\n externalRoute: {\n enum: [true],\n },\n ...externalRouteSchema,\n },\n },\n ],\n },\n },\n title: 'admin/editor.carousel.banner.title',\n type: 'object',\n },\n minItems: 1,\n title: 'admin/editor.carousel.banners.title',\n type: 'array',\n },\n height: {\n default: 420,\n enum: [420, 440],\n isLayout: true,\n title: 'admin/editor.carousel.height.title',\n type: 'number',\n },\n showArrows: {\n default: true,\n isLayout: true,\n title: 'admin/editor.carousel.showArrows.title',\n type: 'boolean',\n },\n showDots: {\n default: true,\n isLayout: true,\n title: 'admin/editor.carousel.showDots.title',\n type: 'boolean',\n },\n autoplay: {\n default: true,\n isLayout: false,\n title: 'admin/editor.carousel.autoplay.title',\n type: 'boolean',\n },\n },\n title: 'admin/editor.carousel.title',\n type: 'object',\n }\n}\n\nexport default Carousel\n\n```" } ]
code_store-on-localhost_85c72c7e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/AuthState.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React, { useState, useCallback, useEffect, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useRuntime } from '../../../../vtex.render-runtime'\n\nimport Context from './context'\nimport { Services, Validations, UserAccounts, Constants, NOOP } from './utils'\nimport UnexpectedError from './errors/UnexpectedError'\nimport CurrentPassword from './state-components/CurrentPassword'\nimport Email from './state-components/Email'\nimport IdentityProviders from './state-components/IdentityProviders'\nimport Login from './state-components/Login'\nimport Password from './state-components/Password'\nimport PhoneNumber from './state-components/PhoneNumber'\nimport Recaptcha from './state-components/Recaptcha'\nimport Token from './state-components/Token'\nimport UserAccountsComponent from './state-components/UserAccounts'\nimport UserInfo from './state-components/UserInfo'\nimport useStateWithCallback from './utils/useStateWithCallback'\n\nimport useAuthStateInitializer from './service-hooks/useAuthStateInitializer'\n\nconst { SessionDuration: SESSION_DURATION } = Constants\nlet sessionTimeout = null\n\nconst AuthState = ({\n scope: initialScope,\n returnUrl: initialReturnUrl,\n email: initialEmail,\n parentAppId,\n uiNameAndVersion,\n children,\n skip,\n}) => {\n const scope = useMemo(() => initialScope, [initialScope])\n const returnUrl = useMemo(() => initialReturnUrl, [initialReturnUrl])\n const [email, setEmail] = useStateWithCallback(\n Validations.validateEmail(initialEmail) ? initialEmail : null\n )\n const [password, setPassword] = useState(null)\n const [recaptcha, setRecaptcha] = useStateWithCallback(null)\n const [currentPassword, setCurrentPassword] = useState(null)\n const [confirmPass, setConfirmPass] = useState(null)\n const [passwordsMatch, setPasswordsMatch] = useState(false)\n const [token, setToken] = useState(null)\n const [rememberMe] = useState(false)\n const [phoneNumber, setPhoneNumber] = useStateWithCallback(null)\n const [userAccounts, setUserAccounts] = useState([])\n const [meta, setMeta] = useStateWithCallback({ loading: false })\n const [isSessionExpired, setIsSessionExpired] = useState(false)\n const {\n account,\n culture: { locale },\n } = useRuntime()\n\n const handleConfirmPassChange = useCallback(\n pass => {\n setConfirmPass(pass)\n setPasswordsMatch(pass === password)\n },\n [setConfirmPass, setPasswordsMatch, password]\n )\n\n const handleTokenChange = useCallback(\n token => {\n if (token === '' || Validations.hasOnlyNumbers(token)) {\n setToken(token.substring(0, 6))\n }\n },\n [setToken]\n )\n\n const handleUserAccountsChange = useCallback(\n userAccounts => {\n UserAccounts.set(userAccounts)\n setUserAccounts(userAccounts)\n },\n [setUserAccounts]\n )\n\n const toggleGlobalLoading = useCallback(\n () => setMeta(meta => ({ ...meta, loading: !meta.loading })),\n [setMeta]\n )\n\n const setGlobalLoading = useCallback(\n (loading, callback = null) => {\n setMeta(meta => ({ ...meta, loading }), callback)\n },\n [setMeta]\n )\n\n const setMfaPhone = useCallback(\n (phoneNumber, callback = null) => {\n setPhoneNumber(phoneNumber, callback)\n setMeta(meta => ({ ...meta, loading: false }))\n },\n [setPhoneNumber, setMeta]\n )\n\n useEffect(() => {\n setUserAccounts(UserAccounts.get())\n }, [setUserAccounts])\n\n const scopeUpper = useMemo(() => scope.toUpperCase(), [scope])\n\n const {\n loading,\n error,\n value: { identityProviders, userInfo, fingerprint },\n } = useAuthStateInitializer({\n skip,\n scope: scopeUpper,\n parentAppId: parentAppId || uiNameAndVersion,\n })\n\n return (\n <Context.Provider\n value={{\n loading,\n error,\n parentAppId: parentAppId || uiNameAndVersion,\n state: {\n scope,\n returnUrl,\n email,\n password,\n recaptcha,\n currentPassword,\n confirmPass,\n passwordsMatch,\n token,\n rememberMe,\n phoneNumber,\n userAccounts,\n meta,\n isSessionExpired,\n identityProviders,\n userInfo,\n fingerprint,\n account,\n locale,\n },\n handlers: {\n handleEmailChange: setEmail,\n handlePasswordChange: setPassword,\n handleCurrentPasswordChange: setCurrentPassword,\n handleRecaptchaChange: setRecaptcha,\n handleConfirmPassChange,\n handleTokenChange,\n handlePhoneNumberChange: setPhoneNumber,\n handleRememberMeChange: undefined,\n handleUserAccountsChange,\n toggleGlobalLoading,\n setGlobalLoading,\n setMfaPhone,\n withSession: callback => {\n clearTimeout(sessionTimeout)\n sessionTimeout = setTimeout(() => {\n setIsSessionExpired(true)\n }, SESSION_DURATION)\n return Services.withSession({\n accountName: account,\n returnUrl,\n scope: scopeUpper,\n user: email,\n fingerprint,\n parentAppId: parentAppId || uiNameAndVersion,\n })(callback)\n },\n },\n }}\n >\n {typeof children === 'function'\n ? children({\n loading,\n error:\n !identityProviders && !loading ? new UnexpectedError() : error,\n isSessionExpired,\n identityProviders,\n userInfo,\n })\n : children}\n </Context.Provider>\n )\n}\n\nAuthState.CurrentPassword = CurrentPassword\nAuthState.Email = Email\nAuthState.IdentityProviders = IdentityProviders\nAuthState.Login = Login\nAuthState.Password = Password\nAuthState.PhoneNumber = PhoneNumber\nAuthState.Recaptcha = Recaptcha\nAuthState.Token = Token\nAuthState.UserAccounts = UserAccountsComponent\nAuthState.UserInfo = UserInfo\n\nAuthState.defaultProps = {\n scope: 'STORE',\n onFailure: NOOP,\n}\n\nAuthState.propTypes = {\n children: PropTypes.oneOfType([\n PropTypes.func.isRequired,\n PropTypes.node.isRequired,\n ]).isRequired,\n returnUrl: PropTypes.string,\n email: PropTypes.string,\n scope: PropTypes.oneOf(['ADMIN', 'STORE']),\n skip: PropTypes.bool,\n onUserAuthenticated: PropTypes.func,\n uiNameAndVersion: PropTypes.string,\n parentAppId: PropTypes.string,\n}\n\nexport default AuthState\n\n```" } ]
code_store-on-localhost_b5f4d0c4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/stateHooks.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport * as stateHooks from './state-hooks'\nexport default { ...stateHooks }\n\n```" } ]
code_store-on-localhost_38a694e1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/AuthStateLazy.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n\nconst AuthStateLazy = React.lazy(() => import('./AuthState'))\n\nAuthStateLazy.CurrentPassword = React.lazy(() =>\n import('./state-components/CurrentPassword')\n)\nAuthStateLazy.Email = React.lazy(() => import('./state-components/Email'))\nAuthStateLazy.IdentityProviders = React.lazy(() =>\n import('./state-components/IdentityProviders')\n)\nAuthStateLazy.Login = React.lazy(() => import('./state-components/Login'))\nAuthStateLazy.Password = React.lazy(() => import('./state-components/Password'))\nAuthStateLazy.PhoneNumber = React.lazy(() =>\n import('./state-components/PhoneNumber')\n)\nAuthStateLazy.Recaptcha = React.lazy(() =>\n import('./state-components/Recaptcha')\n)\nAuthStateLazy.Token = React.lazy(() => import('./state-components/Token'))\nAuthStateLazy.UserAccounts = React.lazy(() =>\n import('./state-components/UserAccounts')\n)\nAuthStateLazy.UserInfo = React.lazy(() => import('./state-components/UserInfo'))\n\nexport default AuthStateLazy\n\n```" } ]
code_store-on-localhost_cff87906
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/AuthProvider.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport AuthState from './AuthState'\n\nexport default AuthState\n\n```" } ]
code_store-on-localhost_2c78ea3e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/AuthServiceLazy.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n\nexport default {\n GetIdentityProviders: React.lazy(() =>\n import('./service-components/GetIdentityProviders')\n ),\n GetLoginPreference: React.lazy(() =>\n import('./service-components/GetLoginPreference')\n ),\n LoginWithAccessKey: React.lazy(() =>\n import('./service-components/LoginWithAccessKey')\n ),\n LoginWithPassword: React.lazy(() =>\n import('./service-components/LoginWithPassword')\n ),\n Logout: React.lazy(() => import('./service-components/Logout')),\n OAuthPopup: React.lazy(() => import('./service-components/OAuthPopup')),\n OAuthRedirect: React.lazy(() => import('./service-components/OAuthRedirect')),\n RedirectAfterLogin: React.lazy(() =>\n import('./service-components/RedirectAfterLogin')\n ),\n RedirectLogout: React.lazy(() =>\n import('./service-components/RedirectLogout')\n ),\n RegisterMfaAuthenticator: React.lazy(() =>\n import('./service-components/RegisterMfaAuthenticator')\n ),\n RegisterMfaPhone: React.lazy(() =>\n import('./service-components/RegisterMfaPhone')\n ),\n ResendMfaToken: React.lazy(() =>\n import('./service-components/ResendMfaToken')\n ),\n SendAccessKey: React.lazy(() => import('./service-components/SendAccessKey')),\n SetPassword: React.lazy(() => import('./service-components/SetPassword')),\n SetPasswordAfterLogin: React.lazy(() =>\n import('./service-components/SetPasswordAfterLogin')\n ),\n StartLoginSession: React.lazy(() =>\n import('./service-components/StartLoginSession')\n ),\n ValidateMfa: React.lazy(() => import('./service-components/ValidateMfa')),\n}\n\n```" } ]
code_store-on-localhost_e2d78166
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/serviceHooks.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport * as serviceHooks from './service-hooks'\nexport default { ...serviceHooks }\n\n```" } ]
code_store-on-localhost_64b91796
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/context.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n\nconst Context = React.createContext({ state: {}, handlers: {}, parentAppId: undefined })\nexport default Context\n\n```" } ]
code_store-on-localhost_cd907fbd
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/validations.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport { Validations } from './utils'\n\nexport default { ...Validations }\n\n```" } ]
code_store-on-localhost_9bf8ce97
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/VtexId/AuthService.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport * as ServiceComponents from './service-components'\nexport default { ...ServiceComponents }\n\n```" } ]
code_store-on-localhost_6f4b11db
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/MultiSelect.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport MultiSelect from './components/MultiSelect/index'\nimport deprecated from './modules/deprecated'\n\nexport default deprecated({\n useNewComponent: {\n old: 'MultiSelect',\n new: 'Select',\n },\n})(MultiSelect)\n\n```" } ]
code_store-on-localhost_b03d28f9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/IconEdit.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Edit from './components/icon/Edit/index'\n\nexport default Edit\n\n```" } ]
code_store-on-localhost_3086a9a6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/IconCopy.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Copy from './components/icon/Copy/index'\n\nexport default Copy\n\n```" } ]
code_store-on-localhost_940e043f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/IconExternalLink.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ExternalLink from './components/icon/ExternalLink/index'\n\nexport default ExternalLink\n\n```" } ]
code_store-on-localhost_1fb31e28
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/ButtonGroup.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ButtonGroup from './components/ButtonGroup/index'\n\nexport default ButtonGroup\n\n```" } ]
code_store-on-localhost_11c86e34
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/CheckboxGroup.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport CheckboxGroup from './components/CheckboxGroup/index'\n\nexport default CheckboxGroup\n\n```" } ]
code_store-on-localhost_2f4e462d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/Layout.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Layout from './components/Layout/index'\n\nexport default Layout\n\n```" } ]
code_store-on-localhost_c27e580f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/Totalizer.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport Totalizer from './components/Totalizer/index'\n\nexport default Totalizer\n\n```" } ]
code_store-on-localhost_2da79155
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of store-on-localhost/src/monobloco/components/new/Styleguide/IconTableFilter.js from the store-on-localhost VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport TableFilter from './components/icon/TableFilter/index'\n\nexport default TableFilter\n\n```" } ]