id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_list-wallet_011629ce
|
[
{
"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 list-wallet/react/Components/validationsArea.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\n\nimport { useStore } from '../hooks/useStore'\n\nconst ValidationArea: FC = () => {\n const { validation } = useStore()\n\n return (\n <div>\n <p className=\"mt2\" style={{ color: 'red', fontSize: '12px' }}>\n {validation}\n </p>\n </div>\n )\n}\n\nexport default ValidationArea\n\n```"
}
] |
code_list-wallet_98193032
|
[
{
"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 list-wallet/react/Components/titlesArea.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { Divider, Spinner } from 'vtex.styleguide'\n\nimport { useStore } from '../hooks/useStore'\nimport '../styles.global.css'\nimport { titles } from '../utils/definedMessages'\nimport History from './history'\n\nconst TitlesArea: FC = () => {\n const { culture } = useRuntime()\n\n const intl = useIntl()\n\n const { valueGiftCard, credit, loadingGiftCard, loadingCredit } = useStore()\n\n return (\n <div className=\"mt5 mb6\">\n <div className=\"text-align-center\">\n <div className=\"mb5 t-heading-4\">\n {intl.formatMessage(titles.credit)}\n <b className=\"money\">\n {`${culture.customCurrencySymbol} `}\n {loadingCredit ? (\n <Spinner color=\"currentColor\" size={20} />\n ) : (\n credit.toLocaleString(culture.locale, {\n minimumFractionDigits: 2,\n })\n )}\n </b>\n <History />\n </div>\n <div className=\"mb5 t-heading-4\">\n {intl.formatMessage(titles.valueGiftCard)}\n <b className=\"money\">\n {`${culture.customCurrencySymbol} `}\n {loadingGiftCard ? (\n <Spinner color=\"currentColor\" size={20} />\n ) : (\n valueGiftCard.toLocaleString(culture.locale, {\n minimumFractionDigits: 2,\n })\n )}\n </b>\n </div>\n <div className=\"width-divider center\">\n <Divider />\n </div>\n <div className=\"mt5 t-heading-4\">\n {intl.formatMessage(titles.redemption)}\n </div>\n </div>\n </div>\n )\n}\n\nexport default TitlesArea\n\n```"
}
] |
code_list-wallet_b73323e7
|
[
{
"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 list-wallet/react/Components/toastArea.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useEffect } from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport success from '../assets/toast-success.svg'\nimport error from '../assets/toast-error.svg'\nimport { useStore } from '../hooks/useStore'\nimport '../styles.global.css'\nimport { ShowAlertOptions } from '../utils/showAlertOptions'\nimport { toast } from '../utils/definedMessages'\n\ninterface Props {\n duration?: number\n}\n\nconst ToastArea: FC<Props> = ({ duration = 3000 }) => {\n const intl = useIntl()\n\n const { culture } = useRuntime()\n\n const { showAlert, setShowAlert, rescue, code } = useStore()\n\n interface AlertInfo {\n className: string\n imageSrc: string\n message: React.ReactFragment\n }\n\n const dictionary: { [key: number]: AlertInfo } = {\n 1: {\n className: 'notification bg-color-sucess toast bottom-left',\n imageSrc: success,\n message: (\n <>\n <p className=\"notification-title\">\n {`${\n intl.formatMessage(toast.rescueValue) +\n (culture.customCurrencySymbol as string)\n } ${rescue.toLocaleString(culture.locale, {\n minimumFractionDigits: 2,\n })}`}\n </p>\n <p className=\"notification-message\">\n {intl.formatMessage(toast.rescueSucess)}\n </p>\n </>\n ),\n },\n 2: {\n className: 'notification bg-color-error toast bottom-left',\n imageSrc: error,\n message: (\n <p className=\"notification-middle\">\n {intl.formatMessage(toast.rescueError)}\n </p>\n ),\n },\n 3: {\n className: 'notification bg-color-sucess toast bottom-left',\n imageSrc: success,\n message: (\n <>\n <p className=\"notification-title\">\n {intl.formatMessage(toast.code) + code}\n </p>\n <p className=\"notification-message\">\n {intl.formatMessage(toast.copy)}\n </p>\n </>\n ),\n },\n 4: {\n className: 'notification bg-color-error toast bottom-left',\n imageSrc: error,\n message: (\n <p className=\"notification-middle\">\n {intl.formatMessage(toast.copyError)}\n </p>\n ),\n },\n 5: {\n className: 'notification bg-color-error toast bottom-left',\n imageSrc: error,\n message: (\n <p className=\"notification-middle\">\n {intl.formatMessage(toast.withoutCode)}\n </p>\n ),\n },\n }\n\n const alertInfo = dictionary[showAlert]\n\n function changeValueShowAlert() {\n if (showAlert !== ShowAlertOptions.notShow) {\n setShowAlert(ShowAlertOptions.notShow)\n }\n }\n\n useEffect(() => {\n const interval = setInterval(changeValueShowAlert, duration)\n\n return () => {\n clearInterval(interval)\n }\n }, [showAlert])\n\n if (showAlert !== ShowAlertOptions.notShow) {\n return (\n <div className={`notification-container bottom-left`}>\n <div className={alertInfo.className}>\n <div className=\"notification-image\">\n <img src={alertInfo.imageSrc} alt=\"\" />\n </div>\n <div>{alertInfo.message}</div>\n </div>\n </div>\n )\n }\n\n return null\n}\n\nexport default ToastArea\n\n```"
}
] |
code_list-wallet_6be67cd6
|
[
{
"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 list-wallet/react/Components/historyTable.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useState, useEffect } from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { Table, Tag, DatePicker, Dropdown } from 'vtex.styleguide'\n\nimport { useStore } from '../hooks/useStore'\nimport { historyMessages } from '../utils/definedMessages'\n\nconst TABLE_LENGTH = 5\nconst INITIAL_PAGE = 1\nconst ITEM_FROM = 1\nconst ITEM_TO = 5\n\nconst HistoryTable: FC = () => {\n const { culture } = useRuntime()\n\n const intl = useIntl()\n const { history, setFilterHistory, loadingGetRouteHistory } = useStore()\n\n const [tableOrder, setTableOrder] = useState({\n orderedItems: history,\n dataSort: {\n sortedBy: 'dateAndTime',\n sortOrder: 'DESC',\n },\n })\n\n const options = [\n { value: 'all', label: intl.formatMessage(historyMessages.filterAll) },\n {\n value: 'deposits',\n label: intl.formatMessage(historyMessages.filterStatusCredit),\n },\n {\n value: 'withdrawals',\n label: intl.formatMessage(historyMessages.filterStatusDebit),\n },\n ]\n\n const [tablePage, setTablePage] = useState({\n tableLength: TABLE_LENGTH,\n currentPage: INITIAL_PAGE,\n slicedData: tableOrder.orderedItems.slice(0, 5),\n currentItemFrom: ITEM_FROM,\n currentItemTo: ITEM_TO,\n itemsLength: tableOrder.orderedItems.length,\n filterStatements: [],\n })\n\n useEffect(() => {\n setTablePage({\n tableLength: TABLE_LENGTH,\n currentPage: INITIAL_PAGE,\n slicedData: tableOrder.orderedItems.slice(0, 5),\n currentItemFrom: ITEM_FROM,\n currentItemTo: ITEM_TO,\n itemsLength: tableOrder.orderedItems.length,\n filterStatements: tablePage.filterStatements,\n })\n }, [tableOrder])\n\n useEffect(() => {\n setTableOrder({\n orderedItems: history,\n dataSort: {\n sortedBy: 'dateAndTime',\n sortOrder: 'DESC',\n },\n })\n }, [history])\n\n const handleSort = ({\n sortOrder,\n sortedBy,\n }: {\n sortOrder: string\n sortedBy: string\n }) => {\n if (sortedBy === 'dateAndTime') {\n const orderedItems = tableOrder.orderedItems.reverse()\n\n setTableOrder({\n orderedItems,\n dataSort: {\n sortedBy,\n sortOrder,\n },\n })\n }\n }\n\n const goToPage = (\n currentPage: number,\n currentItemFrom: number,\n currentItemTo: number,\n slicedData: TableHistory[]\n ) => {\n setTablePage({\n tableLength: tablePage.tableLength,\n currentPage,\n slicedData,\n currentItemFrom,\n currentItemTo,\n itemsLength: tablePage.itemsLength,\n filterStatements: tablePage.filterStatements,\n })\n }\n\n const handleNextClick = () => {\n const newPage = tablePage.currentPage + 1\n const itemFrom = tablePage.currentItemTo + 1\n const itemTo = tablePage.tableLength * newPage\n const data = tableOrder.orderedItems.slice(itemFrom - 1, itemTo)\n\n goToPage(newPage, itemFrom, itemTo, data)\n }\n\n const handlePrevClick = () => {\n if (tablePage.currentPage === 0) return\n const newPage = tablePage.currentPage - 1\n const itemFrom = tablePage.currentItemFrom - tablePage.tableLength\n const itemTo = tablePage.currentItemFrom - 1\n const data = tableOrder.orderedItems.slice(itemFrom - 1, itemTo)\n\n goToPage(newPage, itemFrom, itemTo, data)\n }\n\n const DatePickerObject = ({\n value,\n onChange,\n }: {\n value: any\n onChange: any\n }) => {\n return (\n <div className=\"w-100\">\n <DatePicker\n value={value || new Date()}\n onChange={(date: any) => {\n onChange(date)\n }}\n locale={culture.locale}\n positionFixed\n />\n </div>\n )\n }\n\n const DatePickerRangeObject = ({\n value,\n onChange,\n }: {\n value: any\n onChange: any\n }) => {\n return (\n <div className=\"flex flex-column w-100\">\n <DatePicker\n value={value?.from || new Date(Date.now() - 86400000)}\n onChange={(date: any) => {\n const dateFrom = { from: date, to: value?.to }\n\n onChange(dateFrom)\n }}\n locale={culture.locale}\n maxDate={value?.to || new Date()}\n positionFixed\n />\n <br />\n <DatePicker\n value={value?.to || new Date()}\n onChange={(date: any) => {\n const dateTo = { from: value?.from, to: date }\n\n onChange(dateTo)\n }}\n locale={culture.locale}\n minDate={value?.from || new Date(Date.now() - 86400000)}\n maxDate={new Date()}\n positionFixed\n />\n <br />\n </div>\n )\n }\n\n const StatusSelectorObject = ({\n value,\n onChange,\n }: {\n value: any\n onChange: any\n }) => {\n return (\n <div>\n <Dropdown\n label={intl.formatMessage(historyMessages.filterStatus)}\n size=\"small\"\n options={options}\n value={value}\n onChange={(_: any, v: any) => {\n onChange(v)\n }}\n />\n </div>\n )\n }\n\n const handleFiltersChange = async (statements: any) => {\n if (statements.length === 0) {\n setFilterHistory(undefined)\n } else {\n let status\n let dateAndTime\n\n await statements.forEach((filters: any) => {\n if (filters.subject === 'status') {\n if (filters.object === 'deposits') {\n status = true\n } else if (filters.object === 'withdrawals') {\n status = false\n }\n }\n\n if (filters.subject === 'date' && filters.verb === '=') {\n const start = new Date(\n new Date(filters.object).setHours(0, 0, 0, 0)\n ).toISOString()\n\n const end = new Date(\n new Date(filters.object).setHours(23, 59, 59, 9)\n ).toISOString()\n\n dateAndTime = { startDate: start, endDate: end }\n } else if (filters.subject === 'date' && filters.verb === 'between') {\n const start = new Date(\n new Date(filters.object?.from ?? Date.now() - 86400000).setHours(\n 0,\n 0,\n 0,\n 0\n )\n ).toISOString()\n\n const end = new Date(\n new Date(filters.object?.to ?? Date.now()).setHours(23, 59, 59, 9)\n ).toISOString()\n\n dateAndTime = { startDate: start, endDate: end }\n }\n })\n\n setFilterHistory({ status, dateAndTime })\n }\n\n setTablePage({\n tableLength: TABLE_LENGTH,\n currentPage: INITIAL_PAGE,\n slicedData: tableOrder.orderedItems.slice(0, 5),\n currentItemFrom: ITEM_FROM,\n currentItemTo: ITEM_TO,\n itemsLength: tableOrder.orderedItems.length,\n filterStatements: statements,\n })\n }\n\n const defaultSchema = {\n properties: {\n dateAndTime: {\n title: intl.formatMessage(historyMessages.dateTitle),\n minWidth: 80,\n width: 180,\n sortable: true,\n },\n description: {\n title: intl.formatMessage(historyMessages.descriptionTitle),\n width: 300,\n minWidth: 280,\n },\n value: {\n title: intl.formatMessage(historyMessages.valueTitle),\n width: 100,\n },\n status: {\n title: intl.formatMessage(historyMessages.statusTitle),\n minWidth: 80,\n width: 170,\n cellRenderer: ({ cellData }: { cellData: boolean }) => {\n return (\n <Tag type={cellData ? 'success' : 'error'}>\n <span className=\"nowrap\">\n {cellData\n ? intl.formatMessage(historyMessages.creditStatus)\n : intl.formatMessage(historyMessages.debitStatus)}\n </span>\n </Tag>\n )\n },\n },\n },\n }\n\n return (\n <div className=\"mb5 mt5\">\n <Table\n fullWidth\n schema={defaultSchema}\n items={tablePage.slicedData}\n density=\"low\"\n loading={loadingGetRouteHistory}\n emptyStateLabel={intl.formatMessage(historyMessages.emptyHistoryTitle)}\n emptyStateChildren={\n <p>{intl.formatMessage(historyMessages.emptyHistoryMessage)}</p>\n }\n onSort={handleSort}\n sort={{\n sortedBy: tableOrder.dataSort.sortedBy,\n sortOrder: tableOrder.dataSort.sortOrder,\n }}\n pagination={{\n onNextClick: handleNextClick,\n onPrevClick: handlePrevClick,\n currentItemFrom: tablePage.currentItemFrom,\n currentItemTo: tablePage.currentItemTo,\n textOf: intl.formatMessage(historyMessages.paginationOf),\n totalItems: tablePage.itemsLength,\n }}\n filters={{\n alwaysVisibleFilters: ['date', 'status'],\n statements: tablePage.filterStatements,\n onChangeStatements: handleFiltersChange,\n clearAllFiltersButtonLabel: intl.formatMessage(\n historyMessages.filterClear\n ),\n collapseLeft: true,\n options: {\n date: {\n label: intl.formatMessage(historyMessages.filterDate),\n renderFilterLabel: (st: {\n object: { from: any; to: any } | any\n verb: string\n }) => {\n if (!st || !st.object) {\n return intl.formatMessage(historyMessages.filterAll)\n }\n\n return `${\n st.verb === 'between'\n ? `${intl.formatMessage(\n historyMessages.filterBetween\n )} ${new Date(\n st.object.from\n ).toLocaleDateString()} ${intl.formatMessage(\n historyMessages.filterAnd\n )} ${new Date(st.object.to).toLocaleDateString()}`\n : `${intl.formatMessage(\n historyMessages.filterIs\n )} ${new Date(st.object).toLocaleDateString()}`\n }`\n },\n verbs: [\n {\n label: intl.formatMessage(historyMessages.filterIs),\n value: '=',\n object: (props: any) => <DatePickerObject {...props} />,\n },\n {\n label: intl.formatMessage(historyMessages.filterBetween),\n value: 'between',\n object: (props: any) => <DatePickerRangeObject {...props} />,\n },\n ],\n },\n status: {\n label: intl.formatMessage(historyMessages.filterStatus),\n renderFilterLabel: (st: any) => {\n if (!st || !st.object) {\n return intl.formatMessage(historyMessages.filterAll)\n }\n\n const retorno = options.find(\n (filter) => filter.value === st.object\n )\n\n return retorno?.label\n },\n verbs: [\n {\n value: 'includes',\n object: (props: any) => <StatusSelectorObject {...props} />,\n },\n ],\n },\n },\n }}\n />\n </div>\n )\n}\n\nexport default HistoryTable\n\n```"
}
] |
code_list-wallet_45ba483f
|
[
{
"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 list-wallet/react/Components/history.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useState } from 'react'\nimport { useIntl } from 'react-intl'\nimport { Spinner, Button, Modal } from 'vtex.styleguide'\n\nimport { useStore } from '../hooks/useStore'\nimport HistoryTable from './historyTable'\nimport { historyMessages } from '../utils/definedMessages'\n\nconst History: FC = () => {\n const intl = useIntl()\n const [modalOpen, setModalOpen] = useState(false)\n const { loadingHistory, setFilterHistory } = useStore()\n\n const handleToggle = () => {\n setFilterHistory(undefined)\n setModalOpen(!modalOpen)\n }\n\n return (\n <span className=\"ml3 history\">\n {loadingHistory ? (\n <Spinner color=\"currentColor\" size={20} />\n ) : (\n <Button\n variation=\"tertiary\"\n size=\"small\"\n onClick={() => handleToggle()}\n >\n {intl.formatMessage(historyMessages.openHistory)}\n </Button>\n )}\n <Modal\n centered\n isOpen={modalOpen}\n onClose={handleToggle}\n title={intl.formatMessage(historyMessages.openHistory)}\n >\n <HistoryTable />\n </Modal>\n </span>\n )\n}\n\nexport default History\n\n```"
}
] |
code_list-wallet_a3f358de
|
[
{
"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 list-wallet/react/Components/collapsibleArea.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport { useIntl } from 'react-intl'\nimport { Collapsible } from 'vtex.styleguide'\n\nimport { useStore } from '../hooks/useStore'\nimport '../styles.global.css'\nimport { collapsible } from '../utils/definedMessages'\nimport InputButtonArea from './inputButtonArea'\nimport TitlesArea from './titlesArea'\nimport ToastArea from './toastArea'\n\nconst CollapsibleArea: FC = () => {\n const { setButton, button } = useStore()\n\n const intl = useIntl()\n\n return (\n <div className=\"w-80 center\">\n <div className=\"mb5 mt5\">\n <Collapsible\n header={\n <h1 className=\"t-heading-2\">\n {intl.formatMessage(collapsible.title)}\n </h1>\n }\n onClick={() => setButton(!button)}\n isOpen={button}\n align=\"right\"\n arrowAlign=\"center\"\n >\n <div style={{ position: 'relative' }}>\n <TitlesArea />\n <InputButtonArea />\n </div>\n </Collapsible>\n <ToastArea />\n </div>\n </div>\n )\n}\n\nexport default CollapsibleArea\n\n```"
}
] |
code_list-wallet_42a85748
|
[
{
"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 list-wallet/react/__tests__/toastArea.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { wait } from '@apollo/react-testing'\nimport { render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport ToastArea from '../Components/toastArea'\nimport { ContextStore } from '../hooks/useStore'\nimport { ShowAlertOptions } from '../utils/showAlertOptions'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\n\ndescribe('Toast Area', () => {\n it('should render success Alert if showAlert = 0', async () => {\n const showAlert = { showAlert: ShowAlertOptions.notShow }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container.firstChild).toBeNull()\n })\n\n it('should render success Alert if showAlert = 1', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertSave }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-sucess')\n })\n\n it('should render error Alert if showAlert = 2', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertError }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-error')\n })\n\n it('should render success Alert if showAlert = 3', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertCopySuccess }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-sucess')\n })\n\n it('should render error Alert if showAlert = 4', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertCopyError }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-error')\n })\n\n it('should render error Alert if showAlert = 5', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertWithoutCode }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-error')\n })\n\n it('should set ShowAlertOptions to notShow when finalize the timer', async () => {\n const showAlert = { showAlert: ShowAlertOptions.alertCopyError }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...showAlert }}>\n <ToastArea duration={1} />\n </ContextStore.Provider>\n )\n\n expect(container?.firstChild?.firstChild).toHaveClass('bg-color-error')\n\n await wait(1)\n\n expect(values.setShowAlert).toHaveBeenCalled()\n })\n})\n\n```"
}
] |
code_list-wallet_9ead02bd
|
[
{
"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 list-wallet/react/__tests__/inputButtonArea.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable jest/no-mocks-import */\nimport { fireEvent, render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport InputButtonArea from '../Components/inputButtonArea'\nimport { ContextStore } from '../hooks/useStore'\nimport { values } from '../__mocks__/values'\n\ndescribe('Input Button Area', () => {\n it('should render the first InputButtonArea', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const input = getByTestId('intl-currency-input')\n\n expect(input).toContainHTML('input')\n })\n it('should render the second InputButtonArea', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const input = getByTestId('input-test-id')\n\n expect(input).toContainHTML('input')\n })\n\n it('should call onBlur value', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const inputCurrency = getByTestId('intl-currency-input') as HTMLInputElement\n\n fireEvent.blur(inputCurrency as HTMLInputElement)\n\n expect(values.setAddValueGiftCard).toHaveBeenCalled()\n })\n\n it('should call onFocus', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const inputCurrency = getByTestId('intl-currency-input') as HTMLInputElement\n\n fireEvent.focus(inputCurrency as HTMLInputElement)\n\n expect(values.setValidation).toHaveBeenCalled()\n expect(values.setIsGiftCardFieldInvalid).toHaveBeenCalled()\n })\n\n it('should click on first button', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const buttonPointer = getByTestId('button-input-currency')\n\n fireEvent.click(buttonPointer as HTMLButtonElement)\n\n expect(values.updateGiftCardFunction).toHaveBeenCalled()\n })\n\n it('should click on second button', async () => {\n const { getByTestId } = render(\n <ContextStore.Provider value={values}>\n <InputButtonArea />\n </ContextStore.Provider>\n )\n\n const buttonPointer = getByTestId('button-input')\n\n fireEvent.click(buttonPointer)\n\n expect(values.copyCode).toHaveBeenCalled()\n })\n})\n\n```"
}
] |
code_list-wallet_6b037528
|
[
{
"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 list-wallet/react/__tests__/history.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { fireEvent, render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport { ContextStore } from '../hooks/useStore'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\nimport History from '../Components/history'\n\nwindow.matchMedia =\n window.matchMedia ||\n function () {\n return {\n matches: false,\n addListener() {},\n removeListener() {},\n }\n }\n\ndescribe('Hisotry Area', () => {\n it('should render the history area', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <History />\n </ContextStore.Provider>\n )\n\n expect(container).not.toBeNull()\n })\n\n it('should render the spinner when are loading', async () => {\n const loadingHistory = { loadingHistory: true }\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values, ...loadingHistory }}>\n <History />\n </ContextStore.Provider>\n )\n\n const spinner = container.querySelectorAll('svg')[0]\n\n expect(spinner).toHaveClass('vtex__icon-spinner')\n })\n\n it('should click on button and open the modal', async () => {\n const onClick = jest.fn()\n\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <History />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')[0]\n\n button.onclick = onClick()\n\n fireEvent.click(button)\n\n expect(onClick).toHaveBeenCalled()\n })\n})\n\n```"
}
] |
code_list-wallet_738b9e01
|
[
{
"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 list-wallet/react/__tests__/validationsArea.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport { ContextStore } from '../hooks/useStore'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\nimport ValidationArea from '../Components/validationsArea'\n\ndescribe('Validation Area', () => {\n it('should render the validation area', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <ValidationArea />\n </ContextStore.Provider>\n )\n\n expect(container).not.toBeNull()\n })\n\n it('should contain text validations', async () => {\n const { getByText } = render(\n <ContextStore.Provider value={{ ...values }}>\n <ValidationArea />\n </ContextStore.Provider>\n )\n\n const validation = getByText('text validations')\n\n expect(validation).not.toBeNull()\n })\n})\n\n```"
}
] |
code_list-wallet_2120f980
|
[
{
"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 list-wallet/react/__tests__/historyTable.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { act, fireEvent, render } from '@vtex/test-tools/react'\nimport React from 'react'\nimport { wait } from '@apollo/react-testing'\n\nimport HistoryTable from '../Components/historyTable'\nimport { ContextStore } from '../hooks/useStore'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: jest.fn().mockImplementation((query) => ({\n matches: false,\n media: query,\n onchange: null,\n addListener: jest.fn(), // Deprecated\n removeListener: jest.fn(), // Deprecated\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n dispatchEvent: jest.fn(),\n })),\n})\n\ndescribe('History Table Area', () => {\n it('should render the history table', async () => {\n const { container } = render(\n <ContextStore.Provider value={values}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n expect(container.firstChild).not.toBeNull()\n })\n\n it('should render and click on previous page button', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n fireEvent.click(button[4])\n fireEvent.click(button[3])\n expect(container.firstChild).not.toBeNull()\n })\n\n it('should render and click on next page button', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n fireEvent.click(button[4])\n expect(container.firstChild).not.toBeNull()\n })\n\n it('should render the status area and change the status filter to deposits', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n fireEvent.click(button[1])\n\n const buttonApply = container.querySelectorAll('button')[2]\n\n const select = container.querySelectorAll('select')[0] as HTMLSelectElement\n\n expect(select.value).toStrictEqual('')\n\n select.value = select.options[2].value // <-- select a new value\n\n fireEvent.change(select)\n\n fireEvent.click(buttonApply)\n\n expect(select.value).toStrictEqual('deposits')\n })\n\n it('should render the status area and change the status filter to withdrawals', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n fireEvent.click(button[1])\n\n const buttonApply = container.querySelectorAll('button')[2]\n\n const select = container.querySelectorAll('select')[0] as HTMLSelectElement\n\n expect(select.value).toStrictEqual('')\n\n select.value = select.options[3].value // <-- select a new value\n\n fireEvent.change(select)\n\n await act(async () => {\n await wait(0)\n fireEvent.click(buttonApply)\n })\n\n expect(select.value).toStrictEqual('withdrawals')\n })\n\n it('should render the date picker area and change the date filter', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n fireEvent.click(button[0])\n\n const input = container.querySelectorAll('input')\n\n await act(async () => {\n await wait(0)\n fireEvent.change(input[1], { target: { value: '29/06/2022' } })\n })\n\n const buttonApply = container.querySelectorAll('button')[1]\n\n fireEvent.click(buttonApply)\n\n expect(input[1]).toHaveValue('29/06/2022')\n })\n\n it('should render the date picker range area and change the date filter', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n await act(async () => {\n await wait(0)\n fireEvent.click(button[0])\n })\n\n const div = container?.querySelectorAll(\n 'div.css-1pcexqc-container.pointer.bw1.t-body'\n )[0] as any\n\n const reactHandlerKey = Object.keys(div).filter(function (item) {\n return item.indexOf('__reactEventHandlers') >= 0\n })\n\n div[reactHandlerKey[0]].children[1].props.selectProps.onMenuOpen()\n\n await wait(0)\n\n const openMenu = container.querySelectorAll('div.css-h54wua-menu')[0]\n\n const between = openMenu.querySelectorAll('div')[3]\n\n await act(async () => {\n await wait(0)\n between.click()\n })\n\n const input = container.querySelectorAll('input')\n\n await act(async () => {\n await wait(0)\n fireEvent.change(input[1], { target: { value: '29/06/2022' } })\n fireEvent.change(input[2], { target: { value: '29/07/2022' } })\n })\n\n const buttonApply = container.querySelectorAll('button')[1]\n\n await act(async () => {\n await wait(0)\n fireEvent.click(buttonApply)\n })\n\n expect(input[1]).toHaveValue('29/06/2022')\n expect(input[2]).toHaveValue('29/07/2022')\n })\n\n it('should render the date picker range area and remove the filter after', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <HistoryTable />\n </ContextStore.Provider>\n )\n\n const button = container.querySelectorAll('button')\n\n await act(async () => {\n await wait(0)\n fireEvent.click(button[0])\n })\n\n const div = container?.querySelectorAll(\n 'div.css-1pcexqc-container.pointer.bw1.t-body'\n )[0] as any\n\n const reactHandlerKey = Object.keys(div).filter(function (item) {\n return item.indexOf('__reactEventHandlers') >= 0\n })\n\n div[reactHandlerKey[0]].children[1].props.selectProps.onMenuOpen()\n\n await wait(0)\n\n const openMenu = container.querySelectorAll('div.css-h54wua-menu')[0]\n\n const between = openMenu.querySelectorAll('div')[3]\n\n await act(async () => {\n await wait(0)\n between.click()\n })\n\n const input = container.querySelectorAll('input')\n\n await act(async () => {\n await wait(0)\n fireEvent.change(input[1], { target: { value: '29/06/2022' } })\n fireEvent.change(input[2], { target: { value: '29/07/2022' } })\n })\n\n const buttonApply = container.querySelectorAll('button')[1]\n\n await act(async () => {\n await wait(0)\n fireEvent.click(buttonApply)\n })\n\n await act(async () => {\n await wait(0)\n fireEvent.change(input[1], { target: { value: '' } })\n fireEvent.change(input[2], { target: { value: '29/07/2022' } })\n })\n\n const buttonRemoveFilter = container.querySelectorAll(\n 'button.vtex-button.bw1.ba.fw5.v-mid.relative.pa0.lh-solid.br2.min-h-small.t-action--small.bg-transparent.b--transparent.c-action-primary.hover-b--transparent.hover-bg-action-secondary.hover-b--action-secondary.pointer'\n )[0] as HTMLButtonElement\n\n await act(async () => {\n await wait(0)\n buttonRemoveFilter.click()\n })\n\n const buttonRemoveFilterAfter = container.querySelectorAll(\n 'button.vtex-button.bw1.ba.fw5.v-mid.relative.pa0.lh-solid.br2.min-h-small.t-action--small.bg-transparent.b--transparent.c-action-primary.hover-b--transparent.hover-bg-action-secondary.hover-b--action-secondary.pointer'\n )[0] as HTMLButtonElement\n\n expect(buttonRemoveFilterAfter).toBeUndefined()\n })\n})\n\n```"
}
] |
code_list-wallet_b1d0a344
|
[
{
"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 list-wallet/react/__tests__/collasibleArea.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { fireEvent, render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport CollapsibleArea from '../Components/collapsibleArea'\nimport { ContextStore } from '../hooks/useStore'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\n\ndescribe('Collapsible Area', () => {\n it('should render InputArea if name is name', async () => {\n const { container } = render(\n <ContextStore.Provider value={values}>\n <CollapsibleArea />\n </ContextStore.Provider>\n )\n\n expect(container.firstChild).not.toBeNull()\n })\n\n it('should click', async () => {\n const onClick = jest.fn()\n\n const { container } = render(\n <ContextStore.Provider value={values}>\n <CollapsibleArea />\n </ContextStore.Provider>\n )\n\n const buttonPointer = container.getElementsByClassName('pointer')\n\n const button = buttonPointer[0] as HTMLButtonElement\n\n button.onclick = onClick()\n\n fireEvent.click(button)\n\n expect(onClick).toHaveBeenCalled()\n })\n})\n\n```"
}
] |
code_list-wallet_3872bd59
|
[
{
"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 list-wallet/react/__tests__/providerStore.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable jest/no-mocks-import */\n/* eslint-disable import/order */\nimport { act, fireEvent, render, waitFor } from '@vtex/test-tools/react'\nimport React from 'react'\nimport { MockedProvider, wait } from '@apollo/react-testing'\nimport * as reactapollo from 'react-apollo'\nimport {\n mocks,\n mocksUpdateReturnError,\n mocksUpdate,\n mocksErrorCode,\n mocksUpdateWithoutCode,\n} from '../__mocks__/mockUseQuery'\nimport ProviderStore from '../provider/providerStore'\nimport { ContextStore } from '../hooks/useStore'\nimport { ShowAlertOptions } from '../utils/showAlertOptions'\n\ndescribe('Provider', () => {\n it('should render provider', async () => {\n const { container } = render(\n <MockedProvider mocks={mocks} addTypename={false}>\n <ProviderStore />\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n })\n\n expect(container).not.toBeNull()\n })\n\n it('should test function handleCloseAlert', async () => {\n const TestComponent = () => {\n const { handleCloseAlert, showAlert } = React.useContext(ContextStore)\n\n return (\n <>\n <div data-testid=\"showAlert\">{showAlert}</div>\n <button onClick={handleCloseAlert} data-testid=\"buttonShowAlert\">\n SetShowAlert\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocks} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n getByTestId('buttonShowAlert').click()\n })\n\n const showAlertValue = getByTestId('showAlert').textContent\n\n expect(showAlertValue).toBe('0')\n })\n\n it('should test function validateIfAllFieldsIsComplete failed if I dont send a addValueGiftCard', async () => {\n const TestComponent = () => {\n const { validation, updateGiftCardFunction, isGiftCardFieldInvalid } =\n React.useContext(ContextStore)\n\n return (\n <>\n <div data-testid=\"validateText\">{validation}</div>\n <div data-testid=\"fieldInvalid\">\n {isGiftCardFieldInvalid.toString()}\n </div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocks} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n await wait(0)\n\n const validateText = getByTestId('validateText').textContent\n const invalidField = getByTestId('fieldInvalid').textContent\n\n expect(validateText).not.toBeNull()\n expect(invalidField).toBe('true')\n })\n\n it('should test function validateIfAllFieldsIsComplete failed if I send a addValueGiftCard <= 0', async () => {\n const TestComponent = () => {\n const {\n validation,\n updateGiftCardFunction,\n setAddValueGiftCard,\n isGiftCardFieldInvalid,\n } = React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('-2')}\n >\n add\n </button>\n <div data-testid=\"fieldInvalid\">\n {isGiftCardFieldInvalid.toString()}\n </div>\n <div data-testid=\"validateText\">{validation}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocks} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n const validateText = getByTestId('validateText').textContent\n const invalidField = getByTestId('fieldInvalid').textContent\n\n expect(validateText).not.toBeNull()\n expect(invalidField).toBe('true')\n })\n\n it('should test function validateIfAllFieldsIsComplete failed if I send a addValueGiftCard > credit', async () => {\n const TestComponent = () => {\n const {\n validation,\n updateGiftCardFunction,\n setAddValueGiftCard,\n isGiftCardFieldInvalid,\n } = React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('6')}\n >\n add\n </button>\n <div data-testid=\"fieldInvalid\">\n {isGiftCardFieldInvalid.toString()}\n </div>\n <div data-testid=\"validateText\">{validation}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocks} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n const validateText = getByTestId('validateText').textContent\n const invalidField = getByTestId('fieldInvalid').textContent\n\n expect(validateText).not.toBeNull()\n expect(invalidField).toBe('true')\n })\n\n it('should test function validateIfAllFieldsIsComplete sucess if I send a addValueGiftCard valid', async () => {\n jest.mock('react-apollo')\n jest\n .spyOn(reactapollo, 'useLazyQuery')\n .mockImplementation()\n .mockReturnValue([\n jest.fn(),\n {\n data: {\n getRouteHistory: [\n {\n value: 10,\n dateAndTime: '2022-09-08T00:00:00Z',\n },\n ],\n },\n refetch: jest.fn(),\n },\n ] as any)\n\n const TestComponents = () => {\n const {\n validation,\n updateGiftCardFunction,\n setAddValueGiftCard,\n isGiftCardFieldInvalid,\n } = React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('5')}\n >\n add\n </button>\n <div data-testid=\"fieldInvalid\">\n {isGiftCardFieldInvalid.toString()}\n </div>\n <div data-testid=\"validateText\">{validation}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdate} addTypename={false}>\n <ProviderStore>\n <TestComponents />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n const validationValue = getByTestId('validateText').textContent\n const invalidField = getByTestId('fieldInvalid').textContent\n\n await act(async () => {\n await wait(0)\n })\n\n expect(validationValue).toStrictEqual('')\n expect(invalidField).toBe('false')\n })\n\n it('should test function update if I send a addValueGiftCard valid and the return of mutation is a sucess', async () => {\n const TestComponent = () => {\n const {\n showAlert,\n updateGiftCardFunction,\n setAddValueGiftCard,\n rescue,\n addValueGiftCard,\n } = React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('5')}\n >\n add\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n <div data-testid=\"rescue\">{rescue}</div>\n <div data-testid=\"valueGiftCard\">{addValueGiftCard}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdate} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n const alertValue = getByTestId('alert')\n const rescueValue = getByTestId('rescue')\n const valueGiftCardValue = getByTestId('valueGiftCard')\n\n waitFor(() => {\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertSave.toString()\n )\n expect(rescueValue).toHaveTextContent('5')\n expect(valueGiftCardValue).toHaveTextContent('0')\n })\n })\n\n it('should test function update if I send a addValueGiftCard valid and the return of mutation is a failed', async () => {\n const TestComponent = () => {\n const { showAlert, updateGiftCardFunction, setAddValueGiftCard } =\n React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('5')}\n >\n add\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdateReturnError} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n })\n\n const alertValue = getByTestId('alert')\n\n waitFor(() => {\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertError.toString()\n )\n })\n })\n\n it('should test function copyCode return error if a send a invalid navigator', async () => {\n const TestComponent = () => {\n const { showAlert, copyCode } = React.useContext(ContextStore)\n\n return (\n <>\n <button data-testid=\"copy\" onClick={() => copyCode()}>\n copy\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdateReturnError} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('copy'))\n })\n\n const alertValue = getByTestId('alert')\n\n waitFor(() => {\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertCopyError.toString()\n )\n })\n })\n\n it('should test function copyCode return error if dont have a valid code', async () => {\n const TestComponent = () => {\n const { showAlert, copyCode } = React.useContext(ContextStore)\n\n return (\n <>\n <button data-testid=\"copy\" onClick={() => copyCode()}>\n copy\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksErrorCode} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n const alertValue = getByTestId('alert')\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('copy'))\n })\n\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertWithoutCode.toString()\n )\n })\n\n it('should test function copyCode return success if a send a valid navigator', async () => {\n Object.defineProperty(navigator, 'clipboard', {\n value: {\n writeText: () => {},\n },\n })\n\n const TestComponent = () => {\n const { showAlert, copyCode } = React.useContext(ContextStore)\n\n return (\n <>\n <button data-testid=\"copy\" onClick={() => copyCode()}>\n copy\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdateReturnError} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('copy'))\n })\n\n const alertValue = getByTestId('alert')\n\n waitFor(() => {\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertCopySuccess.toString()\n )\n })\n })\n\n it('should test function update if I send a addValueGiftCard valid but the code is invalid', async () => {\n const TestComponent = () => {\n const {\n showAlert,\n updateGiftCardFunction,\n setAddValueGiftCard,\n rescue,\n addValueGiftCard,\n } = React.useContext(ContextStore)\n\n return (\n <>\n <button\n data-testid=\"addValue\"\n onClick={() => setAddValueGiftCard('5')}\n >\n add\n </button>\n <div data-testid=\"alert\">{showAlert}</div>\n <div data-testid=\"rescue\">{rescue}</div>\n <div data-testid=\"valueGiftCard\">{addValueGiftCard}</div>\n <button data-testid=\"buttonUpdate\" onClick={updateGiftCardFunction}>\n update\n </button>\n </>\n )\n }\n\n const { getByTestId } = render(\n <MockedProvider mocks={mocksUpdateWithoutCode} addTypename={false}>\n <ProviderStore>\n <TestComponent />\n </ProviderStore>\n </MockedProvider>\n )\n\n await act(async () => {\n await wait(0)\n fireEvent.click(getByTestId('addValue'))\n fireEvent.click(getByTestId('buttonUpdate'))\n await wait(3000)\n })\n\n const alertValue = getByTestId('alert')\n const rescueValue = getByTestId('rescue')\n const valueGiftCardValue = getByTestId('valueGiftCard')\n\n waitFor(() => {\n expect(alertValue).toHaveTextContent(\n ShowAlertOptions.alertSave.toString()\n )\n expect(rescueValue).toHaveTextContent('5')\n expect(valueGiftCardValue).toHaveTextContent('0')\n })\n })\n})\n\n```"
}
] |
code_list-wallet_8beda499
|
[
{
"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 list-wallet/react/__tests__/titlesArea.spec.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { render } from '@vtex/test-tools/react'\nimport React from 'react'\n\nimport TitlesArea from '../Components/titlesArea'\nimport History from '../Components/history'\nimport { ContextStore } from '../hooks/useStore'\n// eslint-disable-next-line jest/no-mocks-import\nimport { values } from '../__mocks__/values'\n\ndescribe('Titles Area', () => {\n it('should render a titles area', async () => {\n const { container } = render(\n <ContextStore.Provider value={{ ...values }}>\n <TitlesArea />\n </ContextStore.Provider>\n )\n\n expect(container.firstChild).not.toBeNull()\n\n expect(container.firstChild).toHaveTextContent(values.credit.toString())\n })\n})\n\n```"
}
] |
code_list-wallet_7d0be423
|
[
{
"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 list-wallet/react/hooks/useStore.tsx from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useContext } from 'react'\nimport { History } from 'vtex.gift-card-list'\n\nimport { ShowAlertOptions } from '../utils/showAlertOptions'\n\ninterface ContextStoreType {\n button: boolean\n setButton: (button: boolean) => void\n valueGiftCard: number\n code: string\n addValueGiftCard: string | undefined\n setAddValueGiftCard: (addValueGiftCard: string) => void\n updateGiftCardFunction: () => void\n validation: string\n setValidation: (validation: string) => void\n showAlert: ShowAlertOptions\n setShowAlert: (showAlert: ShowAlertOptions) => void\n handleCloseAlert: () => void\n credit: number\n history: TableHistory[]\n copyCode: () => void\n loading: boolean\n loadingCode: boolean\n rescue: number\n isGiftCardFieldInvalid: boolean\n setIsGiftCardFieldInvalid: (isGiftCardFieldInvalid: boolean) => void\n loadingGiftCard: boolean\n loadingCredit: boolean\n loadingRedemptionCode: boolean\n loadingHistory: boolean\n loadingGetRouteHistory: boolean\n setFilterHistory: (filterHistory: FilterHistory | undefined) => void\n}\n\nexport const ContextStore = React.createContext<ContextStoreType>({\n button: false,\n setButton: () => {},\n valueGiftCard: 0,\n code: '',\n addValueGiftCard: '',\n setAddValueGiftCard: () => {},\n updateGiftCardFunction: () => {},\n validation: '',\n setValidation: () => {},\n showAlert: ShowAlertOptions.notShow,\n setShowAlert: () => {},\n handleCloseAlert: () => {},\n credit: 0,\n history: [],\n copyCode: () => {},\n loading: false,\n loadingCode: false,\n rescue: 0,\n isGiftCardFieldInvalid: false,\n setIsGiftCardFieldInvalid: () => {},\n loadingGiftCard: false,\n loadingCredit: false,\n loadingRedemptionCode: false,\n loadingHistory: false,\n loadingGetRouteHistory: false,\n setFilterHistory: () => {},\n})\n\nexport function useStore() {\n return useContext(ContextStore)\n}\n\n```"
}
] |
code_list-wallet_cc6d47e0
|
[
{
"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 list-wallet/react/typings/@vtex/styleguide.d.ts from the list-wallet VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '@vtex/styleguide/lib/Alert'\ndeclare module '@vtex/styleguide/lib/Collapsible'\ndeclare module '@vtex/styleguide/lib/InputButton'\ndeclare module '@vtex/styleguide/lib/icon/Info'\ndeclare module '@vtex/styleguide/lib/Tooltip'\ndeclare module '@vtex/styleguide/lib/Divider'\ndeclare module '@vtex/styleguide/lib/Button'\ndeclare module '@vtex/styleguide/lib/Input'\ndeclare module '@vtex/styleguide/lib/Modal'\ndeclare module '@vtex/styleguide/lib/Table'\ndeclare module '@vtex/styleguide/lib/DatePicker'\ndeclare module '@vtex/styleguide/lib/Dropdown'\ndeclare module '@vtex/styleguide/lib/Spinner'\ndeclare module '@vtex/styleguide/lib/Tag'\n\n```"
}
] |
code_product-summary_2d8e7977
|
[
{
"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 product-summary/messages/it-IT.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Da\",\n \"store/pricing.to\": \"A\",\n \"store/button-label\": \"Compra\",\n \"store/sponsored-badge.label\": \"Sponsorizzato\",\n \"admin/editor.productSummary.title\": \"Riepilogo del prodotto\",\n \"admin/editor.productSummary.description\": \"Il riepilogo del prodotto mostra le principali informazioni sul prodotto\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Dovrebbe reindirizzare l'utente al checkout dopo aver cliccato su \\\"Acquista\\\"\",\n \"admin/editor.productSummary.showBadge.title\": \"Mostra il badge di sconto\",\n \"admin/editor.productSummary.badgeText.title\": \"Testo badge\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Personalizza il testo del pulsante \\\"Acquista\\\"\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Nasconde completamente il pulsante \\\"Acquista\\\"\",\n \"admin/editor.productSummary.showCollections.title\": \"Mostra i badge delle collezioni\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Modalità di visualizzazione del pulsante \\\"Acquista\\\"\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Non mostrare mai\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Mostra sempre\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Mostra al passaggio del mouse (web)\",\n \"store/productSummary.quantity-error\": \"Non è stato possibile selezionare l'importo specificato\",\n \"store/productSummary.unit\": \"Pezzo\",\n \"store/productSummary.attachmentName\": \"{sign}{quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Senza {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Prezzo nel riepilogo del prodotto\",\n \"admin/editor.productSummaryPrice.description\": \"Componente che mostra il prezzo all'interno del riepilogo del prodotto\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Mostra prezzo di listino\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Mostra variazioni del prezzo di vendita\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Mostra variazioni del prezzo di listino\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Mostra rate\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Mostra sconto\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Mostra etichette\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etichetta per il prezzo di vendita\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etichetta per il prezzo di listino\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Mostra estremi\",\n \"admin/editor.productSummaryImage.title\": \"Immagine nel riepilogo del prodotto\",\n \"admin/editor.productSummaryImage.description\": \"Componente che mostra l'immagine del prodotto\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Etichetta dell'immagine secondaria\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Questa proprietà è obsoleta. Utilizza la proprietà relativa al tipo di selezione\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Criteri per la selezione dell'immagine secondaria\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Etichetta dell'immagine secondaria\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Criterio di ricerca dell'etichetta dell'immagine secondaria (exact: trova l'immagine che corrisponde esattamente al nome inserito nel campo \\\"Etichetta dell'immagine secondaria\\\" | contains: trova la prima immagine che contiene il testo inserito nel campo \\\"Etichetta dell'immagina secondaria\\\")\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Indice dell'immagine secondaria\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Suggerisci la priorità di caricamento\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"Priorità alta\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Priorità bassa\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Lascia che il browser decida la priorità\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Definire le priorità in base alla propria posizione\",\n \"admin/editor.productSummaryName.sponsoredBadge.title\": \"Testo del tag del prodotto sponsorizzato, se applicabile\",\n \"admin/editor.productSummaryBuyButton.title\": \"Pulsante \\\"Acquista\\\" nel riepilogo del prodotto\",\n \"admin/editor.productSummaryName.title\": \"Nome nel riepilogo del prodotto\",\n \"admin/editor.product-summary-specification-badges.title\": \"Badge per le specifiche nel riepilogo del prodotto\",\n \"admin/editor.productSummaryList.title\": \"Listino prodotti\",\n \"admin/editor.productSummaryList.description\": \"Un listino di prodotti di una collezione\",\n \"admin/editor.productSummaryList.category.title\": \"ID categoria\",\n \"admin/editor.productSummaryList.category.description\": \"Per le sottocategorie utilizza \\\"/\\\" (es.: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Collezione\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Ordinamento del listino\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Nascondi gli articoli non disponibili\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Numero massimo di articoli\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtri di specifica\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Voce del filtro di specifica\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID del filtro di specifica\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valore del filtro di specifica\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Saldi\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Prezzo decrescente\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Prezzo crescente\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nome, crescente\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nome decrescente\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Data di uscita\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Sconto\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Rilevanza\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtro SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Impostare il primo filtro disponibile potrebbe rendere la tua ricerca molto più veloce!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Nessuno\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Il primo disponibile\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Tutti disponibili\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Rate visualizzate\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Scegli il tipo di rate da mostrare (ad es.: importo massimo senza interessi o con interessi).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Importo massimo senza interessi\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Importo massimo\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nome del listino in \\\"Analisi\\\"\",\n \"admin/editor.productSummary.trackListName.title\": \"Serve a tracciare il nome del listino\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Testo del tag prodotto sponsorizzato, se applicabile\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Posizione del tag prodotto sponsorizzato, se applicabile\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Sopra il nome del prodotto\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"In cima al contenitore del prodotto\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Non mostrare\"\n}\n\n```"
}
] |
code_product-summary_bcfd3b65
|
[
{
"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 product-summary/messages/th-TH.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"ตั้งแต่\",\n \"store/pricing.to\": \"ถึง\",\n \"store/button-label\": \"ซื้อ\",\n \"store/sponsored-badge.label\": \"ได้รับการสนับสนุน\",\n \"admin/editor.productSummary.title\": \"ภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummary.description\": \"ภาพรวมผลิตภัณฑ์แสดงข้อมูลผลิตภัณฑ์หลัก\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"ควรเปลี่ยนเส้นทางไปยังหน้าชำระเงินหลังคลิกที่ซื้อ\",\n \"admin/editor.productSummary.showBadge.title\": \"แสดงป้ายส่วนลด\",\n \"admin/editor.productSummary.badgeText.title\": \"ข้อความของป้าย\",\n \"admin/editor.productSummary.buyButtonText.title\": \"ข้อความของปุ่มซื้อที่กำหนดเอง\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"ซ่อนปุ่มซื้อทั้งหมด\",\n \"admin/editor.productSummary.showCollections.title\": \"แสดงป้ายคอลเลกชัน\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"โหมดแสดงปุ่มซื้อ\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"ไม่แสดง\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"แสดงเสมอ\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"แสดงเมื่อนำเมาส์ไปชี้ (เว็บ)\",\n \"store/productSummary.quantity-error\": \"เป็นไปไม่ได้ที่จะเลือกจำนวนที่ระบุ\",\n \"store/productSummary.unit\": \"หน่วย\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"ไม่มี {name}\",\n \"admin/editor.productSummaryPrice.title\": \"ราคาตามภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummaryPrice.description\": \"คอมโพเนนต์ที่แสดงราคาผลิตภัณฑ์ภายในภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"แสดงราคาตามบัญชีราคา\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"แสดงช่วงราคาขาย\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"แสดงช่วงราคาตามบัญชีราคา\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"แสดงการผ่อนชำระ\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"แสดงค่าส่วนลด\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"แสดงป้ายชื่อ\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"ป้ายชื่อสำหรับราคาขาย\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"ป้ายชื่อสำหรับราคาตามบัญชีราคา\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"แสดงเส้นขอบ\",\n \"admin/editor.productSummaryImage.title\": \"รูปภาพสำหรับภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummaryImage.description\": \"คอมโพเนนต์ที่แสดงรูปภาพผลิตภัณฑ์\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"ป้ายข้อความภาพโฮเวอร์\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"คณสมบัตนี้เลิกใช้ ใช้คุณสมบัติเกณฑ์แทน\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"เกณฑ์สำหรับการเลือกภาพโฮเวอร์\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"ป้ายข้อความภาพโฮเวอร์\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"เกณฑ์การค้นหาป้ายข้อความภาพโฮเวอร์ (ทุกประการ: หารูปภาพที่มีค่าตรงกันทุกประการกับชื่อที่กรอกไว้ในฟิลด์ \\\"ป้ายข้อความภาพโฮเวอร์\\\" | มี: หารูปภาพแรกที่มีข้อความที่กรอกไว้ในฟิลด์ \\\"ป้ายข้อความภาพโฮเวอร์\\\")\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"ดัชนีภาพโฮเวอร์\",\n \"admin/editor.productSummaryBuyButton.title\": \"ปุ่มซื้อภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummaryName.title\": \"ชื่อภาพรวมผลิตภัณฑ์\",\n \"admin/editor.product-summary-specification-badges.title\": \"ป้ายข้อกำหนดคุณลักษณะภาพรวมผลิตภัณฑ์\",\n \"admin/editor.productSummaryList.title\": \"รายการผลิตภัณฑ์\",\n \"admin/editor.productSummaryList.description\": \"รายการผลิตภัณฑ์ที่มีคอลเลกชัน\",\n \"admin/editor.productSummaryList.category.title\": \"รหัสหมวดหมู่\",\n \"admin/editor.productSummaryList.category.description\": \"สำหรับหมวดหมู่ย่อย ใช้ \\\"/\\\" (เช่น 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"คอลเลกชัน\",\n \"admin/editor.productSummaryList.orderBy.title\": \"การจัดเรียงรายการ\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"ซ่อนสินค้าที่ไม่พร้อมจำหน่าย\",\n \"admin/editor.productSummaryList.maxItems.title\": \"จำนวนสินค้ามากที่สุดที่พร้อมจำหน่าย\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"ตัวกรองข้อกำหนดคุณลักษณะ\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"ไอเทมตัวกรองข้อกำหนดคุณลักษณะ\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"รหัสตัวกรองข้อกำหนดคุณลักษณะ\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"ค่าตัวกรองข้อกำหนดคุณลักษณะ\",\n \"admin/editor.productSummaryList.orderType.sales\": \"การขาย\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"ราคา จากมากไปหาน้อย\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"ราคา จากน้อยไปหามาก\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"ชื่อ จากน้อยไปหามาก\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"ชื่อ จากมากไปหาน้อย\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"วันที่วางจำหน่าย\",\n \"admin/editor.productSummaryList.orderType.discount\": \"ส่วนลด\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"ความเกี่ยวข้อง\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"ตัวกรอง SKUs\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"การตั้งค่าตัวกรองแรกที่มีอยู่อาจทำให้การสืบค้นของคุณเร็วขึ้นมาก\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"ไม่มี\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"แรกสุดที่มี\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"ทั้งหมดที่มี\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"การผ่อนชำระที่แสดง\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"เลือกว่าจะแสดงการผ่อนชำระประเภทใด (เช่น สูงสุดปราศจากดอกเบี้ยหรือมีดอกเบี้ย)\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"สูงสุดปราศจากดอกเบี้ย\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"สูงสุด\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"ชื่อรายการใน Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"ควรติดตามชื่อรายการ\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"ข้อความของแท็กผลิตภัณฑ์ที่ได้รับการสนับสนุนหากมี\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"ตำแหน่งของแท็กผลิตภัณฑ์ที่ได้รับการสนับสนุนหากมี\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"เหนือชื่อผลิตภัณฑ์\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"ด้านบนของภาชนะบรรจุผลิตภัณฑ์\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"อย่าแสดง\"\n}\n\n```"
}
] |
code_product-summary_649ccbbc
|
[
{
"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 product-summary/messages/ko-KR.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"에서\",\n \"store/pricing.to\": \"까지\",\n \"store/button-label\": \"구매\",\n \"store/sponsored-badge.label\": \"후원\",\n \"admin/editor.productSummary.title\": \"제품 요약\",\n \"admin/editor.productSummary.description\": \"주요 제품 정보를 보여주는 제품 요약\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"구매를 클릭한 후 체크아웃으로 리디렉션\",\n \"admin/editor.productSummary.showBadge.title\": \"할인 배지 표시\",\n \"admin/editor.productSummary.badgeText.title\": \"배지 텍스트\",\n \"admin/editor.productSummary.buyButtonText.title\": \"사용자 지정 구매 버튼의 텍스트\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"구매 버튼을 완전히 숨기기\",\n \"admin/editor.productSummary.showCollections.title\": \"컬렉션 배지 표시\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"구매 버튼 디스플레이 모드\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"표시 안함\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"항상 표시\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"가리키면 표시(웹)\",\n \"store/productSummary.quantity-error\": \"지정한 금액을 선택할 수 없습니다.\",\n \"store/productSummary.unit\": \"단위\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"{name} 없음\",\n \"admin/editor.productSummaryPrice.title\": \"제품 요약 가격\",\n \"admin/editor.productSummaryPrice.description\": \"제품 요약 내에 제품 가격을 표시하는 구성 요소\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"정가 표시\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"판매가 범위 표시\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"정가 범위 표시\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"분할 표시\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"할인가 표시\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"라벨 표시\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"판매 가격 라벨\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"정가 라벨\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"테두리 표시\",\n \"admin/editor.productSummaryImage.title\": \"제품 요약 이미지\",\n \"admin/editor.productSummaryImage.description\": \"제품 이미지를 표시하는 구성 요소\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"호버 이미지 라벨\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"이 속성은 사용되지 않습니다. 대신 기준 속성을 사용합니다\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"호버 이미지 선택 기준\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"호버 이미지 라벨\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"호버 이미지 라벨 검색 조건(정확: '호버 이미지 라벨' 필드에 입력된 이름과 정확히 일치하는 이미지를 찾습니다. | 포함: '호버 이미지 라벨' 필드에 입력된 텍스트를 포함하는 첫 번째 이미지를 찾습니다.)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"호버 이미지 인덱스\",\n \"admin/editor.productSummaryBuyButton.title\": \"제품 요약 구매 버튼\",\n \"admin/editor.productSummaryName.title\": \"제품 요약 이름\",\n \"admin/editor.product-summary-specification-badges.title\": \"제품 요약 사양 배지\",\n \"admin/editor.productSummaryList.title\": \"제품 목록\",\n \"admin/editor.productSummaryList.description\": \"컬렉션을 포함하는 제품 목록\",\n \"admin/editor.productSummaryList.category.title\": \"카테고리 ID\",\n \"admin/editor.productSummaryList.category.description\": \"하위 카테고리의 경우 \\\"/\\\" 사용 (예: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"컬렉션\",\n \"admin/editor.productSummaryList.orderBy.title\": \"목록 정렬\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"이용할 수 없는 품목 숨기기\",\n \"admin/editor.productSummaryList.maxItems.title\": \"최대 항목\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"사양 필터\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"사양 필터 항목\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"사양 필터 ID\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"사양 필터 값\",\n \"admin/editor.productSummaryList.orderType.sales\": \"판매량\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"가격, 내림차순\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"가격, 오름차순\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"이름, 오름차순\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"이름, 내림차순\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"출시일\",\n \"admin/editor.productSummaryList.orderType.discount\": \"할인\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"관련\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKU 필터\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"사용 가능한 첫 번째 필터를 설정하면 문의가 훨씬 빨라집니다!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"없음\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"첫 번째 사용 가능\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"모두 사용 가능\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"표시된 할부\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"표시될 할부 유형을 선택하세요 (예: 무이자 또는 무이자 최대).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"무이자 최대\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"최대\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"애널리틱스의 목록 이름\",\n \"admin/editor.productSummary.trackListName.title\": \"목록 이름을 추적해야 함\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"적용 가능한 경우 스폰서 제품 태그의 텍스트\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"적용 가능한 경우 스폰서 제품 태그의 위치\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"제품 이름 위\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"제품 컨테이너 위에\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"표시하지 마십시오\"\n}\n\n```"
}
] |
code_product-summary_99a63766
|
[
{
"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 product-summary/messages/nn-NO.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Fra\",\n \"store/pricing.to\": \"Til\",\n \"store/button-label\": \"Kjøp\",\n \"store/sponsored-badge.label\": \"Sponset\",\n \"admin/editor.productSummary.title\": \"Produktsammendrag\",\n \"admin/editor.productSummary.description\": \"Produktsammendraget viser hovedproduktinformasjonen\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Bør omdirigere til kassen etter klikk på kjøp\",\n \"admin/editor.productSummary.showBadge.title\": \"Vis rabattmerket\",\n \"admin/editor.productSummary.badgeText.title\": \"Merkets tekst\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Tekst på knappen for tilpasset kjøp\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Skjuler kjøpsknappen helt\",\n \"admin/editor.productSummary.showCollections.title\": \"Vis samlingsmerkene\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Visningsmodus for kjøpsknapp\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Vis aldri\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Vis alltid\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Vis på musepekeren (nett)\",\n \"store/productSummary.quantity-error\": \"Det var ikke mulig å velge angitt mengde\",\n \"store/productSummary.unit\": \"Enhet\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Nei {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Pris for produktsammendrag\",\n \"admin/editor.productSummaryPrice.description\": \"Komponent som viser produktpris inne i produktsammendraget\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Vis listepris\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Vis salgsprisområde\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Vis listeprisområde\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Vis avdrag\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Vis rabattverdi\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Vis etiketter\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etikett for salgspris\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etikett for listepris\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Vis kanter\",\n \"admin/editor.productSummaryImage.title\": \"Bilde av produktsammendrag\",\n \"admin/editor.productSummaryImage.description\": \"Komponenten som viser produktbildet\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Pek med musepekeren på bildeetikett\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Denne egenskapen er foreldet. Bruk kriterieegenskapen i stedet\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Kriterier for bildevalg for musepekeren\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Pek med musepekeren på bildeetikett\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Søkekriterier for pek med musepekeren på bildeetikett (nøyaktig: finner bildet som samsvarer nøyaktig med navnet fylt ut i feltet \\\"Pek med musepekeren på bildeetikett\\\" | inneholder: finner det første bildet som inneholder teksten fylt ut i \\\"Pek med musepekeren på bildeetikett\\\" -feltet)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Indeks for Pek med musepekeren på bildet\",\n \"admin/editor.productSummaryBuyButton.title\": \"Kjøpsknapp for produktsammendrag\",\n \"admin/editor.productSummaryName.title\": \"Navn på produktsammendrag\",\n \"admin/editor.product-summary-specification-badges.title\": \"Spesifikasjonsmerker for produktsammendrag\",\n \"admin/editor.productSummaryList.title\": \"Produktliste\",\n \"admin/editor.productSummaryList.description\": \"En produktliste med samling\",\n \"admin/editor.productSummaryList.category.title\": \"Kategori-ID\",\n \"admin/editor.productSummaryList.category.description\": \"Bruk \\\"/\\\" (for eksempel 1/2/3) for underkategorier\",\n \"admin/editor.productSummaryList.collection.title\": \"Samling\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Listesortering\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Skjul utilgjengelige varer\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Maks antall varer\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Spesifikasjonsfiltre\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Varespesifikasjonsfilter\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID-spesifikasjonsfilter\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Verdispesifikasjonsfilter\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Salg\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Pris, synkende\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Pris, stigende\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Navn, stigende\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Navn, synkende\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Utgivelsesdato\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Rabatt\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevans\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKU-filter\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Hvis du bruker det første tilgjengelige filteret, blir søket mye raskere!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Ingen\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Første tilgjengelige\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Alle tilgjengelige\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Viste avdrag\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Velg hvilken type avdrag som skal vises (f.eks: maksimum uten renter eller med renter).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maksimum uten renter\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maksimum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Listenavn i Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Bør navn på sporliste\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Tekst av den sponsede produktkoden, hvis aktuelt\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Plassering av den sponsede produkttaggen, hvis aktuelt\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Over produktets navn\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"På toppen av produktbeholderen\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Ikke vis\"\n}\n\n```"
}
] |
code_product-summary_4bfe187c
|
[
{
"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 product-summary/messages/ja-JP.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"開始\",\n \"store/pricing.to\": \"終了\",\n \"store/button-label\": \"購入する\",\n \"store/sponsored-badge.label\": \"スポンサー付き\",\n \"admin/editor.productSummary.title\": \"製品サマリ\",\n \"admin/editor.productSummary.description\": \"主な製品情報を表示する製品サマリ\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"購入をクリックした後でチェックアウトにリダイレクトしなければなりません\",\n \"admin/editor.productSummary.showBadge.title\": \"割引バッジを表示する\",\n \"admin/editor.productSummary.badgeText.title\": \"バッジのテキスト\",\n \"admin/editor.productSummary.buyButtonText.title\": \"カスタム購入ボタンのテキスト\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"購入ボタンを完全に非表示にする\",\n \"admin/editor.productSummary.showCollections.title\": \"コレクションバッジを表示する\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"購入ボタン表示モード\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"表示しない\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"常に表示する\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"マウスオーバーで表示する (Web)\",\n \"store/productSummary.quantity-error\": \"指定した金額は選択できませんでした\",\n \"store/productSummary.unit\": \"ユニット\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"{name} なし\",\n \"admin/editor.productSummaryPrice.title\": \"製品サマリ価格\",\n \"admin/editor.productSummaryPrice.description\": \"製品サマリ内で製品価格を表示するコンポーネント\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"希望小売価格を表示する\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"販売価格の範囲を表示する\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"希望小売価格の範囲を表示する\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"分割払いを表示する\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"割引額を表示する\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"ラベルを表示する\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"販売価格のラベル\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"希望小売価格のラベル\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"ボーダーを表示する\",\n \"admin/editor.productSummaryImage.title\": \"製品サマリ画像\",\n \"admin/editor.productSummaryImage.description\": \"製品画像を表示するコンポーネント\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"マウスオーバー画像ラベル\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"このプロパティは非推奨です。代わりに基準プロパティを使ってください\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"マウスオーバー画像選択の基準\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"マウスオーバー画像ラベル\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"マウスオーバー画像ラベル検索の基準 (すべて一致: 「マウスオーバー画像ラベル」フィールドの名前フィールドとすべて一致する画像を探します | 含む: 「マウスオーバー画像ラベル」フィールドのテキストフィールドを含む最初の画像を探します)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"マウスオーバー画像インデックス\",\n \"admin/editor.productSummaryBuyButton.title\": \"製品サマリ購入ボタン\",\n \"admin/editor.productSummaryName.title\": \"製品サマリ名\",\n \"admin/editor.product-summary-specification-badges.title\": \"製品サマリ指定バッジ\",\n \"admin/editor.productSummaryList.title\": \"製品リスト\",\n \"admin/editor.productSummaryList.description\": \"コレクションを特徴とした製品リスト\",\n \"admin/editor.productSummaryList.category.title\": \"カテゴリ ID\",\n \"admin/editor.productSummaryList.category.description\": \"サブカテゴリには「/」を使ってください (例 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"コレクション\",\n \"admin/editor.productSummaryList.orderBy.title\": \"リストの並べ替え\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"利用できない項目を非表示にする\",\n \"admin/editor.productSummaryList.maxItems.title\": \"最大項目数\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"仕様フィルタ\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"仕様フィルタ項目\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"仕様フィルタ ID\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"仕様フィルタ値\",\n \"admin/editor.productSummaryList.orderType.sales\": \"販売\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"価格、降順\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"価格、昇順\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"氏名、昇順\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"氏名、降順\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"リリース日\",\n \"admin/editor.productSummaryList.orderType.discount\": \"ディスカウント\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"関連性\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKU フィルタ\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"最初に利用できるフィルタを設定すると、クエリがずっと早くなることがあります!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"なし\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"最初に利用できる\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"すべて利用できる\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"表示された分割払い\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"どのタイプの分割払いが表示されるかを選びます (例: 利息込みあるいは利息抜きでの最大値)。\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"利息抜き最大値\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"最大値\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"アナリティクスのリスト名\",\n \"admin/editor.productSummary.trackListName.title\": \"リスト名を追跡する\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"該当する場合、スポンサー付き製品タグのテキスト\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"該当する場合、スポンサー付き製品タグの位置\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"製品の名前の上\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"製品容器の上\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"見せないでください\"\n}\n\n```"
}
] |
code_product-summary_0c35e614
|
[
{
"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 product-summary/messages/bg-BG.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"От\",\n \"store/pricing.to\": \"До\",\n \"store/button-label\": \"Купуване\",\n \"store/sponsored-badge.label\": \"Спонсориран\",\n \"admin/editor.productSummary.title\": \"Резюме на продукт\",\n \"admin/editor.productSummary.description\": \"Резюмето на продукта, което съдържа основните данни за него\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Трябва да пренасочи към финализиране след кликване на бутона за купуване\",\n \"admin/editor.productSummary.showBadge.title\": \"Показване на значката за отстъпка\",\n \"admin/editor.productSummary.badgeText.title\": \"Текст върху значката\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Текст върху бутона за купуване по избор\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Напълно скрива бутона за купуване\",\n \"admin/editor.productSummary.showCollections.title\": \"Показване на значките за колекцията\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Режим на показване на бутона за купуване\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Никога да не се показва\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Винаги да се показва\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Да се показва при преминаване на курсора на мишката върху него (уеб)\",\n \"store/productSummary.quantity-error\": \"Посочената сума не може да бъде избрана\",\n \"store/productSummary.unit\": \"Единица\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Няма {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Цена в резюме на продукта\",\n \"admin/editor.productSummaryPrice.description\": \"Компонент, който показва цената на продукта в резюмето на продукта\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Показване на цената в каталога\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Показване на диапазона на продажната цена\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Показване на диапазона на продажната цена\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Показване на вноските\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Показване на стойността на отстъпката\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Показване на етикети\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Етикет за продажна цена\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Етикет за каталожна цена\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Показване на граници\",\n \"admin/editor.productSummaryImage.title\": \"Изображение с резюме на продукта\",\n \"admin/editor.productSummaryImage.description\": \"Компонентът, който показва изображението на продукта\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Етикет при задържане на курсора върху изображението\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Това свойство е остаряло. Вместо това използвайте свойството за критерии\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Критерии за избор при задържане на курсора върху изображението\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Етикет при задържане на курсора върху изображение\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Критерии за търсене на етикет при задържане на курсора върху изображението (точно: намира изображението, което е точно съвпадение с името, посочено в полето „етикет при задържане на курсора върху изображение“ | съдържа: намира първото изображение, което съдържа текста, поставен в полето „етикет при задържане на курсора върху изображение“)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Индекс при задържане на курсора върху изображение\",\n \"admin/editor.productSummaryBuyButton.title\": \"Бутон за покупка с резюме на продукта\",\n \"admin/editor.productSummaryName.title\": \"Име на резюме на продукта\",\n \"admin/editor.product-summary-specification-badges.title\": \"Значки със спецификации на резюме на продукта\",\n \"admin/editor.productSummaryList.title\": \"Списък с продукти\",\n \"admin/editor.productSummaryList.description\": \"Продуктов списък, включващ колекция\",\n \"admin/editor.productSummaryList.category.title\": \"ИД на категория\",\n \"admin/editor.productSummaryList.category.description\": \"За подкатегории, използвайте „/“ (напр. 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Колекция\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Подредба на списък\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Скриване на недостъпните елементи\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Макс. артикули\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Филтри със спецификация\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Артикул на филтър за спецификация\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ИД на филтър за спецификация\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Стойност на филтър за спецификация\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Продажби\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Цена, низходяща\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Цена, възходяща\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Име, възходящо\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Име, низходящо\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Дата на излизане\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Отстъпка\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Приложимост\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Филтър по ИЕ-и\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Задаването на първия наличен филтър може да направи заявката ви много по-бърза!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Няма\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Първият наличен\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Всички налични\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Показани вноски\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Покажете какъв вид вноски да се показват (напр.: максимални без лихва или с лихва).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Максимални без лихва\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Максимални\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Наименование на списъка в Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Трябва да следи наименованието на списъка\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Текст на спонсорирания продуктов етикет, ако е приложимо\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Позиция на спонсорирания продуктов етикет, ако е приложимо\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Над името на продукта\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Отгоре на контейнера за продукти\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Не показвайте\"\n}\n\n```"
}
] |
code_product-summary_47365562
|
[
{
"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 product-summary/messages/id-ID.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Dari\",\n \"store/pricing.to\": \"Ke\",\n \"store/button-label\": \"Beli\",\n \"store/sponsored-badge.label\": \"Disponsori\",\n \"admin/editor.productSummary.title\": \"Ringkasan Produk\",\n \"admin/editor.productSummary.description\": \"Ringkasan produk menampilkan informasi produk utama\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Seharusnya dialihkan ke checkout setelah mengklik beli\",\n \"admin/editor.productSummary.showBadge.title\": \"Tampilkan badge diskon\",\n \"admin/editor.productSummary.badgeText.title\": \"Teks badge\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Teks tombol beli kustom\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Sembunyikan tombol beli sepenuhnya\",\n \"admin/editor.productSummary.showCollections.title\": \"Tampilkan badge koleksi\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Mode tampilan tombol beli\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Jangan pernah tampilkan\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Selalu tampilkan\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Tampilkan sesuai gerakan kursor (web)\",\n \"store/productSummary.quantity-error\": \"Tidak dapat memilih jumlah yang ditetapkan\",\n \"store/productSummary.unit\": \"Unit\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Tidak ada {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Harga Ringkasan Produk\",\n \"admin/editor.productSummaryPrice.description\": \"Komponen yang menampilkan harga produk di dalam ringkasan produk\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Tampilkan harga eceran\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Tampilkan rentang harga jual\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Tampilkan rentang harga eceran\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Tampilkan cicilan\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Tampilkan nilai diskon\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Tampilkan label\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Label untuk harga jual\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Label untuk harga eceran\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Tampilkan batas\",\n \"admin/editor.productSummaryImage.title\": \"Gambar Ringkasan Produk\",\n \"admin/editor.productSummaryImage.description\": \"Komponen yang menampilkan gambar produk\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Label Gambar Mengambang\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Properti ini tidak digunakan lagi. Gunakan properti kriteria saja\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Kriteria untuk pemilihan gambar mengambang\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Label Gambar Mengambang\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Kriteria pencarian label gambar mengambang (persis: temukan gambar yang sama persis dengan nama yang terisi di bidang 'Label Gambar Mengambang’| berisi: temukan gambar pertama yang berisi teks yang terisi di bidang 'Label Gambar Mengambang')\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Indeks Gambar Mengambang\",\n \"admin/editor.productSummaryBuyButton.title\": \"Tombol Beli Ringkasan Produk\",\n \"admin/editor.productSummaryName.title\": \"Nama Ringkasan Produk\",\n \"admin/editor.product-summary-specification-badges.title\": \"Badge Spesifikasi Ringkasan Produk\",\n \"admin/editor.productSummaryList.title\": \"Daftar Produk\",\n \"admin/editor.productSummaryList.description\": \"Daftar produk yang menampilkan koleksi\",\n \"admin/editor.productSummaryList.category.title\": \"Id Kategori\",\n \"admin/editor.productSummaryList.category.description\": \"Untuk sub-kategori, gunakan \\\"/\\\" (mis. 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Koleksi\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Penyortiran Daftar\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Sembunyikan item yang tidak tersedia\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Maks Item\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filter Spesifikasi\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Item Filter Spesifikasi\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID Filter Spesifikasi\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Nilai Filter Spesifikasi\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Penjualan\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Harga, rendah ke tinggi\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Harga, tinggi ke rendah\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nama, A ke Z\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nama, Z ke A\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Tanggal Rilis\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Diskon\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevansi\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filter SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Mengatur filter pertama yang tersedia mungkin mempercepat kueri Anda!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Tidak ada\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Tersedia pertama\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Semua yang tersedia\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Cicilan yang ditampilkan\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Pilih jenis cicilan apa yang akan ditampilkan (mis.: maksimum tanpa bunga atau dengan bunga).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maksimum tanpa bunga\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maksimum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nama daftar dalam Analitika\",\n \"admin/editor.productSummary.trackListName.title\": \"Harus melacak nama daftar\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Teks dari tag produk yang disponsori, jika berlaku\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Posisi tag produk yang disponsori, jika berlaku\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Di atas nama produk\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Di atas wadah produk\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Jangan tunjukkan\"\n}\n\n```"
}
] |
code_product-summary_22d55ca1
|
[
{
"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 product-summary/messages/pt.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"De\",\n \"store/pricing.to\": \"Para\",\n \"store/button-label\": \"Comprar\",\n \"store/sponsored-badge.label\": \"Patrocinado\",\n \"admin/editor.productSummary.title\": \"Resumo do produto\",\n \"admin/editor.productSummary.description\": \"O resumo do produto mostrando as principais informações do produto\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Redireciona para o checkout depois de clicar em comprar\",\n \"admin/editor.productSummary.showBadge.title\": \"Mostrar selo de desconto\",\n \"admin/editor.productSummary.badgeText.title\": \"Texto do selo\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Texto do botão de compra personalizado\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Esconde completamente o botão de compra\",\n \"admin/editor.productSummary.showCollections.title\": \"Mostrar selos de coleção\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Modo de visualização dos botões de compra\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Nunca mostrar\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Sempre mostrar\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Mostrar ao passar o mouse (web)\",\n \"store/productSummary.quantity-error\": \"Não foi possível selecionar a quantidade especificada\",\n \"store/productSummary.unit\": \"Unidade\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Sem {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Preço do resumo do produto\",\n \"admin/editor.productSummaryPrice.description\": \"Componente que mostra o preço do produto\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Mostrar preço de lista\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Mostrar faixa de preços de venda\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Mostrar faixa de preços de tabela\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Mostrar parcelas\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Mostrar desconto\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Mostrar etiquetas\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etiqueta para preço de venda\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etiqueta para preço de lista\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Mostrar bordas\",\n \"admin/editor.productSummaryImage.title\": \"Imagem do resumo do produto\",\n \"admin/editor.productSummaryImage.description\": \"O componente que mostra a imagem do produto\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Etiqueta da imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Esta propriedade foi descontinuada. Use a propriedade de tipo de seleção.\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Tipo de seleção para imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Etiqueta da imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Critério de busca da etiqueta da imagem secundária (exato: busca pelo nome exato definido em \\\"Etiqueta da imagem secundária\\\" | contém: busca a primeira imagem que contém o texto definido em \\\"Etiqueta da imagem secundária\\\")\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Número da imagem secundária\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Sugerir prioridade de carregamento\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"Prioridade máxima\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Baixa prioridade\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Deixe o navegador decidir a prioridade\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Priorizar segundo a sua posição\",\n \"admin/editor.productSummaryName.sponsoredBadge.title\": \"Texto do selo indicativo de produto patrocinado, se aplicável\",\n \"admin/editor.productSummaryBuyButton.title\": \"Botão de compra do resumo do produto\",\n \"admin/editor.productSummaryName.title\": \"Nome do resumo do produto\",\n \"admin/editor.product-summary-specification-badges.title\": \"Selos de especificação do resumo do produto\",\n \"admin/editor.productSummaryList.title\": \"Lista de produtos\",\n \"admin/editor.productSummaryList.description\": \"Uma lista de produtos de uma coleção\",\n \"admin/editor.productSummaryList.category.title\": \"ID da categoria\",\n \"admin/editor.productSummaryList.category.description\": \"Para subcategorias, use \\\"/\\\" (por exemplo: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Coleção\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Ordenação da lista\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Ocultar itens não disponíveis\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Quantidade máxima de itens\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtros de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Item do filtro de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID do filtro de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valor do filtro de especificação\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Vendas\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Preço, descrescente\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Preço, crescente\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nome, crescente\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nome, decrescente\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Data de lançamento\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Desconto\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevância\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtro de SKUs\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Configurando o filtro de primeiro disponível pode fazer sua query ser mais rápida!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Nenhum\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Primeiro disponível\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Todos disponíveis\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Parcelamento\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Escolha o tipo de parcelamento que será mostrado nos produtos (ex..: máximo sem juros ou com juros).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Máximo sem juros\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Máximo\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nome da lista no Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Rastreia o nome da lista\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Texto da etiqueta de produto patrocinado, se aplicável\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Posição da etiqueta de produto patrocinado\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Acima do nome do produto\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Acima do container do produto\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Não mostrar\"\n}\n\n```"
}
] |
code_product-summary_c5011954
|
[
{
"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 product-summary/messages/ar-SA.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"من\",\n \"store/pricing.to\": \"إلى\",\n \"store/button-label\": \"شراء\",\n \"store/sponsored-badge.label\": \"ได้รับการสนับสนุน\",\n \"admin/editor.productSummary.title\": \"ملخص المنتج\",\n \"admin/editor.productSummary.description\": \"ملخص المنتج الذي يظهر معلومات المنتج الرئيسي\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"يجب إعادة توجيه الدفع بعد النقر على الشراء\",\n \"admin/editor.productSummary.showBadge.title\": \"إظهار شارة الخصم\",\n \"admin/editor.productSummary.badgeText.title\": \"نص الشارة\",\n \"admin/editor.productSummary.buyButtonText.title\": \"نص زر الشراء المخصص\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"إخفاء زر الشراء بالكامل\",\n \"admin/editor.productSummary.showCollections.title\": \"إظهار شارات المجموعات\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"نمط عرض زر الشراء\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"لا تظهر أبداً\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"إظهار دائمًا\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"إظهار على (الويب)\",\n \"store/productSummary.quantity-error\": \"لم يكن من الممكن تحديد المبلغ المحدد\",\n \"store/productSummary.unit\": \"الوحدة\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"بدون {name}\",\n \"admin/editor.productSummaryPrice.title\": \"سعر ملخص المنتج\",\n \"admin/editor.productSummaryPrice.description\": \"المكون الذي يظهر سعر المنتج داخل ملخص المنتج\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"إظهار سعر القائمة\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"إظهار نطاق سعر البيع\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"إظهار نطاق سعر القائمة\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"إظهار الأقساط\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"إظهار قيمة الخصم\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"إظهار التسميات\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"تسمية لبيع السعر\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"تسمية لسعر القائمة\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"إظهار الحدود\",\n \"admin/editor.productSummaryImage.title\": \"صورة ملخص المنتج\",\n \"admin/editor.productSummaryImage.description\": \"العنصر الذي يظهر صورة المنتج\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"تسمية الصورة الفوقية\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"هذه المؤسسات مهملة. استخدم الخاصية المعيارية بدلا من ذلك\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"معايير لاختيار صورة فوق الشاشة\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"تسمية الصورة الفوقية\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"معايير البحث عن تسمية صورة فوقية (بالضبط: العثور على الصورة التي تطابق تماما الاسم المملوء في حقل 'تسمية صورة فوقية' | تضمن: العثور على الصورة الأولى التي تحتوي على النص المملوء في حقل 'تسمية صورة فوقية')\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"مؤشر الصورة الفوقية\",\n \"admin/editor.productSummaryBuyButton.title\": \"زر ملخص شراء المنتج\",\n \"admin/editor.productSummaryName.title\": \"اسم ملخص المنتج\",\n \"admin/editor.product-summary-specification-badges.title\": \"ملخص مواصفات شارات المنتج\",\n \"admin/editor.productSummaryList.title\": \"قائمة المنتجات\",\n \"admin/editor.productSummaryList.description\": \"قائمة المنتجات التي تحتوي على مجموعة\",\n \"admin/editor.productSummaryList.category.title\": \"معرّف الفئة\",\n \"admin/editor.productSummaryList.category.description\": \"بالنسبة للفئات الفرعية، استخدم \\\"/\\\" (مثال 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"المجموعة\",\n \"admin/editor.productSummaryList.orderBy.title\": \"ترتيب القائمة\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"إخفاء العناصر غير المتاحة\",\n \"admin/editor.productSummaryList.maxItems.title\": \"الحد الأقصى للعناصر\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"فلاتر المواصفات\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"عنصر مرشح المواصفات\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"معرف مرشح المواصفات\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"قيمة مرشح المواصفات\",\n \"admin/editor.productSummaryList.orderType.sales\": \"المبيعات\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"السعر، تنازليًا\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"السعر، تصاعديًا\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"الاسم، تصاعديًا\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"الاسم، تنازليًا\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"تاريخ الإصدار\",\n \"admin/editor.productSummaryList.orderType.discount\": \"الخصم\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"الأهمية\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"ترشيح الـ SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"إعداد أول مرشح متاح قد يجعل استفسارك أسرع بكثير!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"لا شيء\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"المتاح أولًا\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"كل العناصر المتاحة\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"الدفعات المعروضة\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"اختر نوع الدفعات التي سيتم عرضها (على سبيل المثال: الحد الأقصى بدون فائدة أو مع الاهتمام).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"الحد الأقصى بدون فوائد\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"الحد الأقصى\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"اسم القائمة في التحليلات\",\n \"admin/editor.productSummary.trackListName.title\": \"يجب أن يكون اسم مسار القائمة\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"نص علامة المنتج الدعاء ، إن أمكن\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"موقف علامة المنتج المدعومة ، إن أمكن\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"فوق اسم المنتج\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"فوق حاوية المنتج\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"لا تظهر\"\n}\n\n```"
}
] |
code_product-summary_1124a3f0
|
[
{
"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 product-summary/messages/en.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"From\",\n \"store/pricing.to\": \"To\",\n \"store/button-label\": \"Buy\",\n \"store/sponsored-badge.label\": \"Sponsored\",\n \"admin/editor.productSummary.title\": \"Product Summary\",\n \"admin/editor.productSummary.description\": \"Product summary showing the main product information\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Redirect to checkout after clicking buy\",\n \"admin/editor.productSummary.showBadge.title\": \"Show discount badge\",\n \"admin/editor.productSummary.badgeText.title\": \"Badge text\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Text for the custom purchase button\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Hides the buy button completely\",\n \"admin/editor.productSummary.showCollections.title\": \"Show the collection badges\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Buy button display mode\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Never Show\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Always Show\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Show on hover (web)\",\n \"store/productSummary.quantity-error\": \"Could not select the specified amount\",\n \"store/productSummary.unit\": \"Unit\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"No {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Product Summary Price\",\n \"admin/editor.productSummaryPrice.description\": \"Component that shows product price inside the product summary\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Show list price\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Show selling price range\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Show list-price range\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Show installments\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Show discount\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Show labels\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Selling price label\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"List price label\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Show borders\",\n \"admin/editor.productSummaryImage.title\": \"Product Summary Image\",\n \"admin/editor.productSummaryImage.description\": \"Component that displays the product image\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Hover image label\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"This property is deprecated. Please use the criteria property instead\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Criteria for hover image selection\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Hover image label\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Hover image label search criteria (exact: finds the image that is an exact match of the name in the 'Hover image label' field | contains: finds the first image that contains the text in the 'Hover image label' field).\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Hover Image Index\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Fetch priority hint\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"High priority\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Low priority\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Let the browser decide the priority.\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Prioritize based on its position\",\n \"admin/editor.productSummaryBuyButton.title\": \"Product Summary Buy Button\",\n \"admin/editor.productSummaryName.title\": \"Product Summary Name\",\n \"admin/editor.product-summary-specification-badges.title\": \"Product Summary Specification Badges\",\n \"admin/editor.productSummaryList.title\": \"Product List\",\n \"admin/editor.productSummaryList.description\": \"Product list from a collection\",\n \"admin/editor.productSummaryList.category.title\": \"Category ID\",\n \"admin/editor.productSummaryList.category.description\": \"For subcategories, use \\\"/\\\" (e.g.: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Collection\",\n \"admin/editor.productSummaryList.orderBy.title\": \"List Order\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Hide unavailable items\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Max Items\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Specification Filters\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Specification Filter Item\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"Specification Filter ID\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Specification Filter Value\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Sales\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Price, descending\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Price, ascending\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Name, ascending\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Name, descending\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Release date\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Discount\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevance\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKU Filter\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Setting the \\\"First available\\\" filter might make your query much faster!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"None\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"First available\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"All available\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Displayed installments\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Choose the installment type to be shown (e.g.: maximum without interest or with interest).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximum without interest\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"List name in Analytics\",\n \"admin/editor.productSummaryList.showSponsoredProducts.title\": \"Show contextual sponsored products\",\n \"admin/editor.productSummaryList.showSponsoredProducts.description\": \"Whether or not to show contextual sponsored products in this list.\",\n \"admin/editor.productSummaryList.sponsoredCount.title\": \"Maximum amount of sponsored products\",\n \"admin/editor.productSummaryList.sponsoredCount.description\": \"If there are sponsored products for this search, how many of them should be displayed before normal products\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.title\": \"Repeat sponsored and regular products\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.description\": \"Show the same product twice - once sponsored and another in its regular position. If false, only the sponsored product will be shown.\",\n \"admin/editor.productSummary.trackListName.title\": \"Track list name\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Text of the sponsored product tag, if applicable\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Position of the sponsored product tag, if applicable\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Above the product's name\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"On top of the product container\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Don't show\",\n \"store/product-summary.shelf.aria-label\": \"Product {productName}\",\n \"store/product-summary.name.aria-label\": \"Name for product {productName}\",\n \"store/product-summary.image.aria-label\": \"Image from product {productName}\"\n}\n\n```"
}
] |
code_product-summary_626b5220
|
[
{
"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 product-summary/messages/no-NO.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Fra\",\n \"store/pricing.to\": \"Til\",\n \"store/button-label\": \"Kjøp\",\n \"store/sponsored-badge.label\": \"Sponset\",\n \"admin/editor.productSummary.title\": \"Produktsammendrag\",\n \"admin/editor.productSummary.description\": \"Produktsammendraget viser hovedproduktinformasjonen\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Bør omdirigere til kassen etter klikk på kjøp\",\n \"admin/editor.productSummary.showBadge.title\": \"Vis rabattmerket\",\n \"admin/editor.productSummary.badgeText.title\": \"Merkets tekst\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Tekst på knappen for tilpasset kjøp\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Skjuler kjøpsknappen helt\",\n \"admin/editor.productSummary.showCollections.title\": \"Vis samlingsmerkene\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Visningsmodus for kjøpsknapp\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Vis aldri\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Vis alltid\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Vis på musepekeren (nett)\",\n \"store/productSummary.quantity-error\": \"Det var ikke mulig å velge angitt mengde\",\n \"store/productSummary.unit\": \"Enhet\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Nei {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Pris for produktsammendrag\",\n \"admin/editor.productSummaryPrice.description\": \"Komponent som viser produktpris inne i produktsammendraget\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Vis listepris\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Vis salgsprisområde\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Vis listeprisområde\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Vis avdrag\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Vis rabattverdi\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Vis etiketter\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etikett for salgspris\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etikett for listepris\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Vis kanter\",\n \"admin/editor.productSummaryImage.title\": \"Bilde av produktsammendrag\",\n \"admin/editor.productSummaryImage.description\": \"Komponenten som viser produktbildet\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Pek med musepekeren på bildeetikett\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Denne egenskapen er foreldet. Bruk kriterieegenskapen i stedet\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Kriterier for bildevalg for musepekeren\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Pek med musepekeren på bildeetikett\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Søkekriterier for pek med musepekeren på bildeetikett (nøyaktig: finner bildet som samsvarer nøyaktig med navnet fylt ut i feltet \\\"Pek med musepekeren på bildeetikett\\\" | inneholder: finner det første bildet som inneholder teksten fylt ut i \\\"Pek med musepekeren på bildeetikett\\\" -feltet)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Indeks for Pek med musepekeren på bildet\",\n \"admin/editor.productSummaryBuyButton.title\": \"Kjøpsknapp for produktsammendrag\",\n \"admin/editor.productSummaryName.title\": \"Navn på produktsammendrag\",\n \"admin/editor.product-summary-specification-badges.title\": \"Spesifikasjonsmerker for produktsammendrag\",\n \"admin/editor.productSummaryList.title\": \"Produktliste\",\n \"admin/editor.productSummaryList.description\": \"En produktliste med samling\",\n \"admin/editor.productSummaryList.category.title\": \"Kategori-ID\",\n \"admin/editor.productSummaryList.category.description\": \"Bruk \\\"/\\\" (for eksempel 1/2/3) for underkategorier\",\n \"admin/editor.productSummaryList.collection.title\": \"Samling\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Listesortering\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Skjul utilgjengelige varer\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Maks antall varer\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Spesifikasjonsfiltre\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Varespesifikasjonsfilter\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID-spesifikasjonsfilter\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Verdispesifikasjonsfilter\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Salg\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Pris, synkende\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Pris, stigende\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Navn, stigende\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Navn, synkende\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Utgivelsesdato\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Rabatt\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevans\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKU-filter\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Hvis du bruker det første tilgjengelige filteret, blir søket mye raskere!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Ingen\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Første tilgjengelige\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Alle tilgjengelige\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Viste avdrag\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Velg hvilken type avdrag som skal vises (f.eks: maksimum uten renter eller med renter).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maksimum uten renter\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maksimum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Listenavn i Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Bør navn på sporliste\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Tekst av den sponsede produktkoden, hvis aktuelt\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Plassering av den sponsede produkttaggen, hvis aktuelt\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Over produktets navn\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"På toppen av produktbeholderen\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Ikke vis\"\n}\n\n```"
}
] |
code_product-summary_c33285e5
|
[
{
"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 product-summary/messages/ro-RO.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"De la\",\n \"store/pricing.to\": \"Către\",\n \"store/button-label\": \"Cumpără\",\n \"store/sponsored-badge.label\": \"Sponsorizat\",\n \"admin/editor.productSummary.title\": \"Rezumat produs\",\n \"admin/editor.productSummary.description\": \"Rezumatul produsului care arată informațiile principale ale produsului\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Trebuie redirecționat către finalizarea comenzii după apăsarea butonului de cumpărare\",\n \"admin/editor.productSummary.showBadge.title\": \"Arată badge-ul de reducere\",\n \"admin/editor.productSummary.badgeText.title\": \"Textul badge-ului\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Textul butonului Cumpără personalizat\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Ascunde butonul Cumpără complet\",\n \"admin/editor.productSummary.showCollections.title\": \"Arată badge-urile colecțiilor\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Mod de afișare buton Cumpără\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Nu afișa niciodată\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Afișează mereu\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Afișează prin trecerea cu mouse-ul (web)\",\n \"store/productSummary.quantity-error\": \"Nu a fost posibilă selectarea cantității specificate\",\n \"store/productSummary.unit\": \"Unitate\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Fără {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Preț rezumat produs\",\n \"admin/editor.productSummaryPrice.description\": \"Componenta care arată prețul produsului în rezumatul produsului\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Arată prețul de listă\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Arată intervalul prețului de vânzare\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Arată intervalul prețului de listă\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Arată ratele\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Arată valoarea reducerii\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Arată etichetele\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etichetă pentru prețul de vânzare\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etichetă pentru prețul de listă\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Arată marginile\",\n \"admin/editor.productSummaryImage.title\": \"Imagine rezumat produs\",\n \"admin/editor.productSummaryImage.description\": \"Componenta care arată imaginea produsului\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Etichetă imagine secundară\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Această proprietate este învechită. Folosește proprietatea de criterii mai degrabă\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Criterii pentru selectarea imaginii secundare\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Eticheta imaginii secundare\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Criteriu de căutare al etichetei imaginii secundare (exact: găsește imaginea care se potrivește perfect cu denumirea completată în câmpul „Etichetă imagine secundară” | contains: găsește prima imagine care conține textul complet în câmpul „Etichetă imagine secundară”)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Indexul imaginii secundare\",\n \"admin/editor.productSummaryBuyButton.title\": \"Rezumat produs Buton cumpărare\",\n \"admin/editor.productSummaryName.title\": \"Denumire rezumat produs\",\n \"admin/editor.product-summary-specification-badges.title\": \"Rezumat produs Badge-uri specificații\",\n \"admin/editor.productSummaryList.title\": \"Listă de produse\",\n \"admin/editor.productSummaryList.description\": \"O listă de produse cu o colecție\",\n \"admin/editor.productSummaryList.category.title\": \"ID Categorie\",\n \"admin/editor.productSummaryList.category.description\": \"Pentru sub-categorii, folosește „/” (de exemplu, 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Colecție\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Sortare listă\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Ascunde articolele indisponibile\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Cantitatea maximă de articole\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtre specificație\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Elementul filtrului de specificație\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID-ul filtrului de specificație\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valoarea filtrului de specificație\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Vânzări\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Preț, descrescător\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Preț, crescător\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Denumire, crescătoare\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Denumire, descrescătoare\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Data publicării\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Discount\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevanță\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtru SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Alegerea primului filtru disponibil poate genera o căutare mult mai rapidă!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Niciunul\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Primul disponibil\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Toate disponibile\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Rate afișate\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Alege ce tip de rate vrei să fie afișate (ex: maxime fără dobândă sau cu dobândă).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximum fără dobândă\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Numele listei în Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Trebuie monitorizată denumirea listei\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Textul etichetei de produs sponsorizat, dacă este cazul\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Poziția etichetei de produs sponsorizate, dacă este cazul\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Deasupra numelui produsului\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Deasupra containerului de produs\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Nu arăta\"\n}\n\n```"
}
] |
code_product-summary_83405881
|
[
{
"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 product-summary/messages/context.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"store/pricing.from\",\n \"store/pricing.to\": \"store/pricing.to\",\n \"store/button-label\": \"store/button-label\",\n \"admin/editor.productSummary.title\": \"admin/editor.productSummary.title\",\n \"admin/editor.productSummary.description\": \"admin/editor.productSummary.description\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"admin/editor.productSummary.isOneClickBuy.title\",\n \"admin/editor.productSummary.showBadge.title\": \"admin/editor.productSummary.showBadge.title\",\n \"admin/editor.productSummary.badgeText.title\": \"admin/editor.productSummary.badgeText.title\",\n \"admin/editor.productSummary.buyButtonText.title\": \"admin/editor.productSummary.buyButtonText.title\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"admin/editor.productSummary.hideBuyButton.title\",\n \"admin/editor.productSummary.showCollections.title\": \"admin/editor.productSummary.showCollections.title\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"admin/editor.productSummary.displayBuyButton.title\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"admin/editor.productSummary.displayBuyButton.option.none\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"admin/editor.productSummary.displayBuyButton.option.always\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"admin/editor.productSummary.displayBuyButton.option.hover\",\n \"store/productSummary.quantity-error\": \"store/productSummary.quantity-error\",\n \"store/productSummary.unit\": \"store/productSummary.unit\",\n \"store/productSummary.attachmentName\": \"store/productSummary.attachmentName\",\n \"store/productSummary.missingOptionName\": \"String displayed when the assembly option was removed by user\",\n \"admin/editor.productSummaryPrice.title\": \"Title of ProductSummaryPrice component\",\n \"admin/editor.productSummaryPrice.description\": \"Description of ProductSummaryPrice component\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Title of showListPrice prop\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Title of showSellingPriceRange prop\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Title of showListPriceRange prop\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Title of showInstallments prop\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Title of showDiscountValue prop\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Title of showLabels prop\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Title of labelSellingPrice prop\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Title of labelListPrice prop\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Title of showBorders prop\",\n \"admin/editor.productSummaryImage.title\": \"admin/editor.productSummaryImage.title\",\n \"admin/editor.productSummaryImage.description\": \"admin/editor.productSummaryImage.description\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"admin/editor.productSummaryImage.hoverImageLabel.title\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"admin/editor.productSummaryImage.hoverImageLabel.description\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"admin/editor.productSummaryImage.hoverImage.criteria.title\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"admin/editor.productSummaryImage.hoverImage.criteria.index\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"admin/editor.productSummaryImage.hoverImage.criteria.label\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Fetch priority hint\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"High priority\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Low priority\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Let the browser decide the priority\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Prioritize based on its position\",\n \"admin/editor.productSummaryName.sponsoredBadge.title\": \"admin/editor.productSummaryName.sponsoredBadge.title\",\n \"admin/editor.productSummaryBuyButton.title\": \"admin/editor.productSummaryBuyButton.title\",\n \"admin/editor.productSummaryName.title\": \"admin/editor.productSummaryName.title\",\n \"admin/editor.product-summary-specification-badges.title\": \"admin/editor.product-summary-specification-badges.title\",\n \"admin/editor.productSummaryList.title\": \"Product List\",\n \"admin/editor.productSummaryList.description\": \"A product list featuring a collection\",\n \"admin/editor.productSummaryList.category.title\": \"Category Id\",\n \"admin/editor.productSummaryList.category.description\": \"For sub-categories, use \\\"/\\\" (e.g. 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Collection\",\n \"admin/editor.productSummaryList.orderBy.title\": \"List Ordenation\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Hide unavailable items\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Max Items\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Specification Filters\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Specification Filter Item\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"Specification Filter ID\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Specification Filter Value\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Sales\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Price, descending\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Price, ascending\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Name, ascending\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Name, descending\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Release Date\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Discount\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevance\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Title of skus filter property\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Description of skus filter property\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Value none of skus filter enum\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Value first available of skus filter enum\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Value all available of skus filter enum\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Title of installment criteria property\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Description of installment criteria property\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximum without interest enum name\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum with interest enum name\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"List name in Analytics\",\n \"admin/editor.productSummaryList.showSponsoredProducts.title\": \"Show contextual sponsored products\",\n \"admin/editor.productSummaryList.showSponsoredProducts.description\": \"Whether or not to show contextual sponsored products in this list.\",\n \"admin/editor.productSummaryList.sponsoredCount.title\": \"Maximum amount of sponsored products\",\n \"admin/editor.productSummaryList.sponsoredCount.description\": \"If there are sponsored products for this search, how many of them should be displayed before normal products\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.title\": \"Repeat sponsored and regular products\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.description\": \"Show the same product twice - once sponsored and another in its regular position. If false, only the sponsored product will be shown.\",\n \"admin/editor.productSummary.trackListName.title\": \"Should track list name\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"admin/editor.productSummary.sponsoredBadge.title\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"admin/editor.productSummary.sponsoredBadge.position\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"admin/editor.productSummary.sponsoredBadge.position.titleTop\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"admin/editor.productSummary.sponsoredBadge.position.none\",\n \"store/product-summary.shelf.aria-label\": \"Product {productName}\",\n \"store/product-summary.name.aria-label\": \"Name for product {productName}\",\n \"store/product-summary.image.aria-label\": \"Image from product {productName}\"\n}\n\n```"
}
] |
code_product-summary_d421d7e3
|
[
{
"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 product-summary/messages/pt-BR.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"De\",\n \"store/pricing.to\": \"Para\",\n \"store/button-label\": \"Comprar\",\n \"store/sponsored-badge.label\": \"Patrocinado\",\n \"admin/editor.productSummary.title\": \"Resumo do produto\",\n \"admin/editor.productSummary.description\": \"O resumo do produto mostrando as principais informações do produto\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Redireciona para o checkout depois de clicar em comprar\",\n \"admin/editor.productSummary.showBadge.title\": \"Mostrar selo de desconto\",\n \"admin/editor.productSummary.badgeText.title\": \"Texto do selo\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Texto do botão de compra personalizado\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Esconde completamente o botão de compra\",\n \"admin/editor.productSummary.showCollections.title\": \"Mostrar selos de coleção\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Modo de visualização dos botões de compra\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Nunca mostrar\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Sempre mostrar\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Mostrar ao passar o mouse (web)\",\n \"store/productSummary.quantity-error\": \"Não foi possível selecionar a quantidade especificada\",\n \"store/productSummary.unit\": \"Unidade\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Sem {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Preço do resumo do produto\",\n \"admin/editor.productSummaryPrice.description\": \"Componente que mostra o preço do produto\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Mostrar preço de lista\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Mostrar faixa de preços de venda\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Mostrar faixa de preços de tabela\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Mostrar parcelas\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Mostrar desconto\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Mostrar etiquetas\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etiqueta para preço de venda\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etiqueta para preço de lista\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Mostrar bordas\",\n \"admin/editor.productSummaryImage.title\": \"Imagem do resumo do produto\",\n \"admin/editor.productSummaryImage.description\": \"O componente que mostra a imagem do produto\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Etiqueta da imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Esta propriedade foi descontinuada. Use a propriedade de tipo de seleção.\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Tipo de seleção para imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Etiqueta da imagem secundária\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Critério de busca da etiqueta da imagem secundária (exato: busca pelo nome exato definido em \\\"Etiqueta da imagem secundária\\\" | contém: busca a primeira imagem que contém o texto definido em \\\"Etiqueta da imagem secundária\\\")\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Número da imagem secundária\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Sugerir prioridade de carregamento\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"Prioridade máxima\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Baixa prioridade\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Deixe o navegador decidir a prioridade\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Priorizar segundo a sua posição\",\n \"admin/editor.productSummaryName.sponsoredBadge.title\": \"Texto da tag indicativa de produto patrocinado, se aplicável\",\n \"admin/editor.productSummaryBuyButton.title\": \"Botão de compra do resumo do produto\",\n \"admin/editor.productSummaryName.title\": \"Nome do resumo do produto\",\n \"admin/editor.product-summary-specification-badges.title\": \"Selos de especificação do resumo do produto\",\n \"admin/editor.productSummaryList.title\": \"Lista de produtos\",\n \"admin/editor.productSummaryList.description\": \"Uma lista de produtos de uma coleção\",\n \"admin/editor.productSummaryList.category.title\": \"ID da categoria\",\n \"admin/editor.productSummaryList.category.description\": \"Para subcategorias, use \\\"/\\\" (por exemplo: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Coleção\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Ordenação da lista\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Ocultar itens não disponíveis\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Quantidade máxima de itens\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtros de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Item do filtro de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID do filtro de especificação\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valor do filtro de especificação\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Vendas\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Preço, descrescente\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Preço, crescente\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nome, crescente\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nome, decrescente\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Data de lançamento\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Desconto\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevância\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtro de SKUs\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Configurando o filtro de primeiro disponível pode fazer sua query ser mais rápida!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Nenhum\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Primeiro disponível\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Todos disponíveis\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Parcelamento\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Escolha o tipo de parcelamento que será mostrado nos produtos (ex..: máximo sem juros ou com juros).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Máximo sem juros\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Máximo\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nome da lista no Analytics\",\n \"admin/editor.productSummaryList.showSponsoredProducts.title\": \"Mostrar produtos patrocinados contextuais\",\n \"admin/editor.productSummaryList.showSponsoredProducts.description\": \"Se deve-se mostrar produtos patrocinados contextuais nesta lista.\",\n \"admin/editor.productSummaryList.sponsoredCount.title\": \"Quantidade máxima de produtos patrocinados\",\n \"admin/editor.productSummaryList.sponsoredCount.description\": \"Caso haja produtos patrocinados para esta busca, quantos deles devem ser exibidos antes dos produtos normais\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.title\": \"Repetir produtos patrocinados e regulares\",\n \"admin/editor.productSummaryList.repeatSponsoredProducts.description\": \"Mostrar o mesmo produto duas vezes - uma vez patrocinado e outro em sua posição regular. Se falso, apenas o produto patrocinado será exibido.\",\n \"admin/editor.productSummary.trackListName.title\": \"Rastreia o nome da lista\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Texto da tag de produto patrocinado, se aplicável\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Posição da tag de produto patrocinado\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Acima do nome do produto\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Acima do container do produto\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Não mostrar\",\n \"store/product-summary.shelf.aria-label\": \"Produto {productName}\",\n \"store/product-summary.name.aria-label\": \"Nome do produto {productName}\",\n \"store/product-summary.image.aria-label\": \"Imagem do produto {productName}\"\n}\n\n```"
}
] |
code_product-summary_1ebc5f56
|
[
{
"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 product-summary/messages/de-DE.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Von\",\n \"store/pricing.to\": \"Bis\",\n \"store/button-label\": \"Kaufen\",\n \"store/sponsored-badge.label\": \"Gesponsert\",\n \"admin/editor.productSummary.title\": \"Produktzusammenfassung\",\n \"admin/editor.productSummary.description\": \"Die Produktübersicht zeigt die wichtigsten Produktinformationen\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Soll nach einem Klick auf Kauf zur Kasse weitergeleitet werden\",\n \"admin/editor.productSummary.showBadge.title\": \"Rabatt-Abzeichen anzeigen\",\n \"admin/editor.productSummary.badgeText.title\": \"Abzeichentext\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Benutzerdefinierter Kauf-Button Text\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Versteckt den Kauf-Button komplett\",\n \"admin/editor.productSummary.showCollections.title\": \"Die Abzeichen der Kollektionen anzeigen\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Button Anzeigemodus kaufen\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Nie anzeigen\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Immer anzeigen\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"In Mausverschiebung anzeigen (Web)\",\n \"store/productSummary.quantity-error\": \"Es war nicht möglich, den angegebenen Betrag auszuwählen\",\n \"store/productSummary.unit\": \"Einheit\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Kein {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Produktzusammenfassung Preis\",\n \"admin/editor.productSummaryPrice.description\": \"Komponente, die den Produktpreis in der Produktübersicht anzeigt\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Listenpreis anzeigen\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Verkaufspreisspanne anzeigen\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Preislistespanne anzeigen\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Raten anzeigen\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Rabattwert anzeigen\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Beschreibung anzeigen\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Beschriftung für Verkaufspreis\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Beschriftung für Listenpreis\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Rahmen anzeigen\",\n \"admin/editor.productSummaryImage.title\": \"Produktübersicht\",\n \"admin/editor.productSummaryImage.description\": \"Die Komponente, die die Produktübersicht zeigt\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Mausverschiebung Bildbeschriftung\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Diese Eigenschaft ist veraltet. Verwenden Sie stattdessen die Kriterien Eigenschaft\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Kriterien für die Bildauswahl bei Mausverschiebung\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Mausverschiebung Bildbeschriftung\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Mausverschiebung Bildbeschriftung Bezeichnungssuche (genau: findet das Bild, das genau mit dem Namen übereinstimmt, der im Feld 'Hover Image Label' eingetragen ist | enthält: findet das erste Bild, das den Text enthält, der im Feld 'Hover Image Label' ausgefüllt ist)\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Mausverschiebung Index\",\n \"admin/editor.productSummaryBuyButton.title\": \"Produktübersicht Kauf-Taste\",\n \"admin/editor.productSummaryName.title\": \"Produktübersicht Name\",\n \"admin/editor.product-summary-specification-badges.title\": \"Produktübersicht Spezifikations-Abzeichen\",\n \"admin/editor.productSummaryList.title\": \"Produktliste\",\n \"admin/editor.productSummaryList.description\": \"Eine Produktliste mit einer Kollektion\",\n \"admin/editor.productSummaryList.category.title\": \"Kategorie-ID\",\n \"admin/editor.productSummaryList.category.description\": \"Für Unterkategorien verwenden Sie \\\"/\\\" (z.B. 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Kollektion\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Listensortierung\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Nicht verfügbare Artikel ausblenden\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Max. Artikel\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Spezifikationsfilter\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Spezifikationsfilter Artikel\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"Spezifikationsfilter ID\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Spezifikationsfilter Wert\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Verkäufe\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Preis, absteigend\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Preis, aufsteigend\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Name, aufsteigend\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Name, absteigend\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Erscheinungsdatum\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Rabatt\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevanz\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKUs Filter\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Das Setzen des ersten verfügbaren Filters kann Ihre Anfrage viel schneller machen!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Keine\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Zuerst verfügbar\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Alle verfügbar\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Angezeigte Raten\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Wählen Sie, welche Art von Raten angezeigt werden soll (z.B.: Maximum ohne Zins oder mit Zins).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximum ohne Zinsen\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Listenname in der Analytik\",\n \"admin/editor.productSummary.trackListName.title\": \"Sollte Listenname anzeigen\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Text des gesponserten Produkts, falls zutreffend\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Position des gesponserten Produkts, falls zutreffend\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Über dem Namen des Produkts\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Über den Produktbehälter\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Zeigen Sie nicht\"\n}\n\n```"
}
] |
code_product-summary_6fb6164e
|
[
{
"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 product-summary/messages/fr-FR.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"De\",\n \"store/pricing.to\": \"À\",\n \"store/button-label\": \"Acheter\",\n \"store/sponsored-badge.label\": \"Sponsorisé\",\n \"admin/editor.productSummary.title\": \"Synthèse de produit\",\n \"admin/editor.productSummary.description\": \"La synthèse du produit affichant les principales informations sur le produit\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Doit être redirigé vers la caisse après avoir cliqué sur Acheter\",\n \"admin/editor.productSummary.showBadge.title\": \"Afficher le badge de remise\",\n \"admin/editor.productSummary.badgeText.title\": \"Texte du badge\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Personnaliser le texte du bouton d’achat\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Masquer complètement le bouton d’achat\",\n \"admin/editor.productSummary.showCollections.title\": \"Afficher les badges des collections\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Mode d’affichage du bouton d’achat\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Ne jamais afficher\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Toujours afficher\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Afficher par pointage (web)\",\n \"store/productSummary.quantity-error\": \"Impossible de sélectionner le montant indiqué\",\n \"store/productSummary.unit\": \"Unité\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"No {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Prix de la synthèse du produit\",\n \"admin/editor.productSummaryPrice.description\": \"Composant qui indique le prix du produit dans la synthèse du produit\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Afficher la liste de prix\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Afficher la gamme de prix de vente\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Afficher la gamme de la liste de prix\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Afficher les versements\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Afficher la valeur de la remise\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Afficher les étiquettes\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Étiquette pour le prix de vente\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Étiquette pour le prix de liste\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Afficher les bordures\",\n \"admin/editor.productSummaryImage.title\": \"Image de la synthèse du produit\",\n \"admin/editor.productSummaryImage.description\": \"Le composant qui montre l’image du produit\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Pointer l’étiquette de l’image\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Cette propriété est dépréciée. Utilisez plutôt les critères de propriété\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Critères de sélection des images pointées\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Pointer l’étiquette de l’image\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Critères de recherche pour pointer l’étiquette de l’image (exact : trouve l’image correspondant exactement au nom rempli dans le champ 'Pointer l’étiquette de l’image' | contenus : trouve la première image qui contient le texte rempli dans le champ 'Pointer l’étiquette de l’image')\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Pointer l’index de l’image\",\n \"admin/editor.productSummaryBuyButton.title\": \"Bouton d’achat de la synthèse du produit\",\n \"admin/editor.productSummaryName.title\": \"Nom de la synthèse du produit\",\n \"admin/editor.product-summary-specification-badges.title\": \"Spécification des badges de la synthèse du produit\",\n \"admin/editor.productSummaryList.title\": \"Liste de produits\",\n \"admin/editor.productSummaryList.description\": \"Une liste de produits comportant une collection\",\n \"admin/editor.productSummaryList.category.title\": \"ID de la catégorie\",\n \"admin/editor.productSummaryList.category.description\": \"Pour les sous-catégories, utilisez \\\"/\\\" (par exemple 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Collection\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Tri de la liste\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Masquer les articles non disponibles\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Maximum d’articles\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtres de spécification\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Filtre de spécification de l’article\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID du filtre de spécification\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valeur du filtre de spécification\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Ventes\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Prix, décroissant\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Prix, croissant\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nom, en ordre croissant\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nom, en ordre décroissant\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Date de sortie\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Réduction\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Pertinence\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtre des SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Le réglage du premier filtre disponible pourrait rendre votre requête beaucoup plus rapide !\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Aucun\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Premier disponible\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Tous disponibles\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Versements affichés\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Choisissez le type de versements à afficher (par ex : maximum sans frais ou avec les frais).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximum sans intérêt\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nom de la liste dans Analyses\",\n \"admin/editor.productSummary.trackListName.title\": \"Suivre la liste des noms\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Texte de la balise de produit sponsorisée, le cas échéant\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Position de l'étiquette de produit sponsorisée, le cas échéant\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Au-dessus du nom du produit\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"En plus du conteneur de produit\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Ne montre pas\"\n}\n\n```"
}
] |
code_product-summary_1f59f86a
|
[
{
"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 product-summary/messages/nl-NL.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"Van\",\n \"store/pricing.to\": \"Naar\",\n \"store/button-label\": \"Koop\",\n \"store/sponsored-badge.label\": \"Gesponsord\",\n \"admin/editor.productSummary.title\": \"Productoverzicht\",\n \"admin/editor.productSummary.description\": \"Het productoverzicht met de belangrijkste productinformatie\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Moet doorverwijzen naar kassa na klikken op kopen\",\n \"admin/editor.productSummary.showBadge.title\": \"Toon de kortingsbadge\",\n \"admin/editor.productSummary.badgeText.title\": \"Tekst van de badge\",\n \"admin/editor.productSummary.buyButtonText.title\": \"De tekst van de aangepaste koopknop\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Verbergt de koopknop volledig\",\n \"admin/editor.productSummary.showCollections.title\": \"Laat de badges van de collectie zien\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Weergavemodus koopknop\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Toon nooit\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Altijd tonen\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Weergeven bij aanwijzen (web)\",\n \"store/productSummary.quantity-error\": \"Het was niet mogelijk om het opgegeven bedrag te selecteren\",\n \"store/productSummary.unit\": \"Eenheid\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Geen {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Productoverzicht prijs\",\n \"admin/editor.productSummaryPrice.description\": \"Component die de prijs van het product toont in het productoverzicht\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Toon lijstprijs\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Toon verkoopprijsbereik\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Toon lijstprijsbereik\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Toon termijnen\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Toon kortingswaarde\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Toon labels\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Label voor verkoopprijs\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Label voor lijstprijs\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Randen weergeven\",\n \"admin/editor.productSummaryImage.title\": \"Productoverzicht afbeelding\",\n \"admin/editor.productSummaryImage.description\": \"De component die de productafbeelding toont\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Aanwijzen afbeeldingslabel\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Deze eigenschap is verouderd. Gebruik in plaats daarvan de criteria-eigenschap\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Criteria voor de aanwijzing van afbeeldingselectie\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Aanwijzen afbeeldingslabel\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Zoekcriteria voor afbeeldingslabel zweven (exact: vindt de afbeelding die exact overeenkomt met de naam die is ingevuld in het veld 'Afbeeldingslabel zweven' | bevat: vindt de eerste afbeelding die de tekst bevat die is ingevuld in het veld 'Afbeeldingslabel zweven')\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Aanwijzen afbeeldingsindex\",\n \"admin/editor.productSummaryBuyButton.title\": \"Productoverzicht koopknop\",\n \"admin/editor.productSummaryName.title\": \"Productoverzicht naam\",\n \"admin/editor.product-summary-specification-badges.title\": \"Productoverzicht specificatiebadges\",\n \"admin/editor.productSummaryList.title\": \"Productlijst\",\n \"admin/editor.productSummaryList.description\": \"Een productlijst met een collectie\",\n \"admin/editor.productSummaryList.category.title\": \"Categorie-id\",\n \"admin/editor.productSummaryList.category.description\": \"Gebruik voor subcategorieën \\\"/\\\" (bijv. 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Collectie\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Lijst sorteren\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Verberg niet-beschikbare items\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Max. items\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Specificatiefilters\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Specificatiefilteritem\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"Specificatiefilter-id\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Specificatiefilterwaarde\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Verkoop\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Prijs, aflopend\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Prijs, oplopend\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Naam, oplopend\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Naam, aflopend\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Release datum\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Korting\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevantie\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"SKUs-filter\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"Het instellen van het eerste beschikbare filter kan uw query veel sneller maken!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Geen\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"Eerst beschikbaar\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Alle beschikbare\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Weergegeven termijnen\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Kies welk type termijnen getoond moet worden (bijv.: maximaal zonder rente of met rente).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Maximaal zonder rente\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Maximum\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Lijstnaam in Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Moet lijstnaam volgen\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Tekst van de gesponsorde producttag, indien van toepassing\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Positie van de gesponsorde producttag, indien van toepassing\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Boven de naam van het product\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Bovenop de productcontainer\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"Niet laten zien\"\n}\n\n```"
}
] |
code_product-summary_df5da171
|
[
{
"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 product-summary/messages/es.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/pricing.from\": \"De\",\n \"store/pricing.to\": \"Para\",\n \"store/button-label\": \"Comprar\",\n \"store/sponsored-badge.label\": \"Patrocinado\",\n \"admin/editor.productSummary.title\": \"Resumen del producto\",\n \"admin/editor.productSummary.description\": \"El resumen del producto que muestra la información principal del producto\",\n \"admin/editor.productSummary.isOneClickBuy.title\": \"Redirigir al checkout después de hacer clic en comprar\",\n \"admin/editor.productSummary.showBadge.title\": \"Mostrar la insignia de descuento\",\n \"admin/editor.productSummary.badgeText.title\": \"Texto de la insignia\",\n \"admin/editor.productSummary.buyButtonText.title\": \"Texto del botón de compra personalizado\",\n \"admin/editor.productSummary.hideBuyButton.title\": \"Oculta el botón de comprar por completo\",\n \"admin/editor.productSummary.showCollections.title\": \"Mostrar las insignias de las colecciones\",\n \"admin/editor.productSummary.displayBuyButton.title\": \"Modo de visualización del botón de compra\",\n \"admin/editor.productSummary.displayBuyButton.option.none\": \"Nunca mostrar\",\n \"admin/editor.productSummary.displayBuyButton.option.always\": \"Mostrar siempre\",\n \"admin/editor.productSummary.displayBuyButton.option.hover\": \"Mostrar al pasar el mouse (web)\",\n \"store/productSummary.quantity-error\": \"No se pudo seleccionar la cantidad especificada\",\n \"store/productSummary.unit\": \"Unidad\",\n \"store/productSummary.attachmentName\": \"{sign} {quantity}x {name}\",\n \"store/productSummary.missingOptionName\": \"Sin {name}\",\n \"admin/editor.productSummaryPrice.title\": \"Precio del resumen del producto\",\n \"admin/editor.productSummaryPrice.description\": \"Componente que muestra el precio del producto dentro del resumen del producto\",\n \"admin/editor.productSummaryPrice.showListPrice.title\": \"Mostrar el precio de lista\",\n \"admin/editor.productSummaryPrice.showSellingPriceRange.title\": \"Mostrar el rango del precio de venta\",\n \"admin/editor.productSummaryPrice.showListPriceRange.title\": \"Mostrar el rango del precio de lista\",\n \"admin/editor.productSummaryPrice.showInstallments.title\": \"Mostrar cuotas\",\n \"admin/editor.productSummaryPrice.showDiscountValue.title\": \"Mostrar valor de descuento\",\n \"admin/editor.productSummaryPrice.showLabels.title\": \"Mostrar etiquetas\",\n \"admin/editor.productSummaryPrice.labelSellingPrice.title\": \"Etiqueta para el precio de venta\",\n \"admin/editor.productSummaryPrice.labelListPrice.title\": \"Etiqueta para el precio de lista\",\n \"admin/editor.productSummaryPrice.showBorders.title\": \"Mostrar bordes\",\n \"admin/editor.productSummaryImage.title\": \"Imagen del resumen del producto\",\n \"admin/editor.productSummaryImage.description\": \"El componente que muestra la imagen del producto\",\n \"admin/editor.productSummaryImage.hoverImageLabel.title\": \"Etiqueta de la imagen activable\",\n \"admin/editor.productSummaryImage.hoverImageLabel.description\": \"Esta propiedad está en desuso. Por favor, utiliza la propiedad de criterios.\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.title\": \"Criterio para selección de imágenes activables\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.label\": \"Etiqueta de la imagen activable\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria\": \"Criterios de búsqueda de la etiqueta de la imagen activable (exact: busca la imagen que sea un resultado exacto para el nombre ingresado en el campo 'Etiqueta de la imagen activable' | contains: busca la primera imagen que contenga el texto ingresado en el campo 'Etiqueta de la imagen activable')\",\n \"admin/editor.productSummaryImage.hoverImage.criteria.index\": \"Índice de la imagen activable\",\n \"admin/editor.productSummaryImage.fetchpriority.title\": \"Sugiera la prioridad de la solicitud\",\n \"admin/editor.productSummaryImage.fetchpriority.high\": \"Alta prioridad\",\n \"admin/editor.productSummaryImage.fetchpriority.low\": \"Baja prioridad\",\n \"admin/editor.productSummaryImage.fetchpriority.auto\": \"Deja que el navegador decida la prioridad\",\n \"admin/editor.productSummaryImage.fetchpriority.byPosition\": \"Priorizar según su posición\",\n \"admin/editor.productSummaryBuyButton.title\": \"Botón de compra del resumen del producto\",\n \"admin/editor.productSummaryName.title\": \"Nombre del resumen del producto\",\n \"admin/editor.product-summary-specification-badges.title\": \"Insignias de especificación del resumen del producto\",\n \"admin/editor.productSummaryList.title\": \"Lista de productos\",\n \"admin/editor.productSummaryList.description\": \"Una lista de productos que tiene una colección\",\n \"admin/editor.productSummaryList.category.title\": \"ID de categoría\",\n \"admin/editor.productSummaryList.category.description\": \"Para las subcategorías, utiliza \\\"/\\\" (por ej.: 1/2/3)\",\n \"admin/editor.productSummaryList.collection.title\": \"Colección\",\n \"admin/editor.productSummaryList.orderBy.title\": \"Orden de la lista\",\n \"admin/editor.productSummaryList.hideUnavailableItems\": \"Ocultar los ítems no disponibles\",\n \"admin/editor.productSummaryList.maxItems.title\": \"Máximo de ítems\",\n \"admin/editor.productSummaryList.specificationFilters.title\": \"Filtros de especificación\",\n \"admin/editor.productSummaryList.specificationFilters.item.title\": \"Ítem del filtro de especificación\",\n \"admin/editor.productSummaryList.specificationFilters.item.id.title\": \"ID del filtro de especificación\",\n \"admin/editor.productSummaryList.specificationFilters.item.value.title\": \"Valor del filtro de especificación\",\n \"admin/editor.productSummaryList.orderType.sales\": \"Ventas\",\n \"admin/editor.productSummaryList.orderType.priceDesc\": \"Precio, descendente\",\n \"admin/editor.productSummaryList.orderType.priceAsc\": \"Precio, ascendente\",\n \"admin/editor.productSummaryList.orderType.nameAsc\": \"Nombre, ascendente\",\n \"admin/editor.productSummaryList.orderType.nameDesc\": \"Nombre, descendente\",\n \"admin/editor.productSummaryList.orderType.releaseDate\": \"Fecha de lanzamiento\",\n \"admin/editor.productSummaryList.orderType.discount\": \"Descuento\",\n \"admin/editor.productSummaryList.orderType.relevance\": \"Relevancia\",\n \"admin/editor.productSummaryList.skusFilter.title\": \"Filtro de SKU\",\n \"admin/editor.productSummaryList.skusFilter.description\": \"¡Establecer el primer filtro disponible puede agilizar tu consulta!\",\n \"admin/editor.productSummaryList.skusFilter.none\": \"Ninguno\",\n \"admin/editor.productSummaryList.skusFilter.first-available\": \"El primero disponible\",\n \"admin/editor.productSummaryList.skusFilter.all-available\": \"Todos los disponibles\",\n \"admin/editor.productSummaryList.installmentCriteria.title\": \"Cuotas mostradas\",\n \"admin/editor.productSummaryList.installmentCriteria.description\": \"Selecciona los tipos de cuotas que se mostrarán (por ej.: máximo sin interés o con interés).\",\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\": \"Máximo sin interés\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\": \"Máximo\",\n \"admin/editor.productSummaryList.analyticsListName.title\": \"Nombre de la lista en Analytics\",\n \"admin/editor.productSummary.trackListName.title\": \"Rastrear el nombre de la lista\",\n \"admin/editor.productSummary.sponsoredBadge.title\": \"Texto de la insignia de producto patrocinado, si corresponde\",\n \"admin/editor.productSummary.sponsoredBadge.position\": \"Posición de la insignia de producto patrocinado, si corresponde\",\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\": \"Sobre el nombre del producto\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\": \"Sobre el container del producto\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\": \"No mostrar\"\n}\n\n```"
}
] |
code_product-summary_351e85fd
|
[
{
"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 product-summary/docs/README.md from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/product-summary) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Product Summary\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nProduct Summary is an app for summarizing product information (such as name, price, and image) in other store blocks, such as the [Shelf](https://developers.vtex.com/docs/guides/vtex-shelf/) and the [Minicart](https://developers.vtex.com/docs/guides/vtex-minicart/).\n\n\n\n## Configurating the product summary\n\n1. Import the `vtex.product-summary` app to your theme's dependencies in the `manifest.json`:\n\n```json\n \"dependencies\": {\n \"vtex.product-summary\": \"2.x\"\n }\n```\n\nNow, you can use all blocks exported by the `product-summary` app. See the full list below:\n\n| Block name | Description |\n| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [`list-context.product-list`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummarylist) |  Renders the list of products in the Product Summary component. It fetches product information and provides it to the `product-summary.shelf` block. Then, this block provides its child blocks with the product information. |\n| `product-summary.shelf` |  Logical block that provides the needed structure for the Product Summary component through its child blocks (listed below). |\n| [`product-summary-attachment-list`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummaryattachmentlist) | Renders a list for product [attachments](https://help.vtex.com/tutorial/adding-an-attachment--7zHMUpuoQE4cAskqEUWScU). |\n| [`product-summary-brand`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummarybrand) | Renders the product brand. |\n| [`product-summary-buy-button`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummarybuybutton) | Renders the Buy button. This block must only be configured if your store uses the [Minicart v1](https://github.com/vtex-apps/minicart/blob/383d7bbd3295f06d1b5854a0add561a872e1515c/docs/README.md). If your store uses the [Minicart v2](https://developers.vtex.com/docs/guides/vtex-minicart), please configure the [**Add to Cart button**](https://developers.vtex.com/docs/guides/vtex-add-to-cart-button) instead. |\n| [`product-summary-description`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummarydescription) | Renders the product description. |\n| [`product-summary-image`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummaryimage) | Renders the product image. |\n| [`product-summary-name`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummaryname) | Renders the product name. |\n| [`product-summary-sku-name`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummaryskuname) | Renders the selected SKU name. |\n| `product-summary-price` |  Renders the product price. This block has been deprecated in favor of the [Product Price](https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/vtex-product-summary-3.png) app. Although support for this block is still available, we strongly recommend using the Product Price app. |\n| [`product-summary-sku-selector`](https://developers.vtex.com/docs/guides/vtex-product-summary-productsummaryskuselector) | Renders the SKU Selector block. |\n| [`product-specification-badges`](https://developers.vtex.com/vtex-developer-docs/docs/vtex-product-summary-productsummaryspecificationbadges) | Renders badges based on product specifications. |\n\n2. Add the `list-context.product-list` block to a store template of your choice, and declare the `product-summary.shelf` in its block list. For example:\n\n```json\n{\n \"list-context.product-list\": {\n \"blocks\": [\"product-summary.shelf\"]\n },\n```\n\n> ℹ️ Although the block name 'product-summary.shelf' alludes to the Shelf component, it is not necessary to use this block in order to create a shelf component. The Product Summary Shelf displays a summary of the product information in other components, such as the [Minicart](https://developers.vtex.com/docs/guides/vtex-minicart) and the [Search Results](https://developers.vtex.com/docs/guides/vtex-search-result) pages.\n\n3. Add the blocks from the list above as children of the `product-summary.shelf`, considering the product information you want to display in the product list. Take the following example in which the product name, description, image, price, SKU selector, and Buy button are all displayed in the Product Summary:\n\n```json\n{\n \"list-context.product-list\": {\n \"blocks\": [\"product-summary.shelf\"]\n },\n\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-name\",\n \"product-summary-description\",\n \"product-summary-image\",\n \"product-summary-price\",\n \"product-summary-sku-selector\",\n \"product-summary-buy-button\"\n ]\n }\n}\n```\n\n## Customization\n\nTo apply CSS customizations to this and other blocks, follow the instructions given in the recipe on [Using CSS handles for store customization](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization).\n\n| CSS handles |\n| -------------------------- |\n| `aspectRatio` |\n| `buyButton` |\n| `buyButtonContainer` |\n| `clearLink` |\n| `column` |\n| `container` |\n| `containerNormal` |\n| `containerSmall` |\n| `containerInline` |\n| `description` |\n| `element` |\n| `image` |\n| `imageContainer` |\n| `imagePlaceholder` |\n| `information` |\n| `isHidden` |\n| `nameContainer` |\n| `priceContainer` |\n| `quantityStepperContainer` |\n| `spacer` |\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/gustavopvasconcellos\"><img src=\"https://avatars1.githubusercontent.com/u/49173685?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>gustavopvasconcellos</b></sub></a><br /><a href=\"https://github.com/vtex-apps/product-summary/commits?author=gustavopvasconcellos\" title=\"Code\">💻</a></td>\n <td align=\"center\"><a href=\"http://imdanielpiva.me\"><img src=\"https://avatars0.githubusercontent.com/u/26178791?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Daniel Piva</b></sub></a><br /><a href=\"https://github.com/vtex-apps/product-summary/commits?author=imdanielpiva\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_product-summary_65d6d15e
|
[
{
"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 product-summary/react/ProductSummarySKUName.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\n\nconst { useProductSummary } = ProductSummaryContext\n\nconst CSS_HANDLES = ['skuNameContainer'] as const\n\ninterface Props {\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\nconst ProductSummarySKUName = ({ classes }: Props) => {\n const { product } = useProductSummary()\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n const skuName: string = product?.sku?.name ?? ''\n const { productName } = product\n\n if (!skuName || skuName === productName) {\n return null\n }\n\n return <div className={handles.skuNameContainer}>{skuName}</div>\n}\n\nexport default ProductSummarySKUName\n\n```"
}
] |
code_product-summary_31e8adcf
|
[
{
"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 product-summary/react/ProductSummaryAttachmentList.js from the product-summary 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_product-summary_c3059710
|
[
{
"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 product-summary/react/ProductSummarySKUSelector.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { SKUSelector } from 'vtex.store-components'\nimport { useCssHandles, useCustomClasses } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\nimport type { ResponsiveValuesTypes } from 'vtex.responsive-values'\nimport type { ProductTypes } from 'vtex.product-context'\n\nimport { getDefaultSeller } from './modules/seller'\n\nconst { useProductSummary, useProductSummaryDispatch } = ProductSummaryContext\n\nconst CSS_HANDLES = [\n 'SKUSelectorContainer',\n 'frameAround',\n 'seeMoreButton',\n 'skuSelectorContainer',\n 'skuSelectorInternalBox',\n 'skuSelectorItemImageValue',\n 'skuSelectorItemImage',\n 'skuSelectorItemTextValue',\n 'skuSelectorItem',\n 'skuSelectorNameContainer',\n 'skuSelectorNameSeparator',\n 'skuSelectorName',\n 'skuSelectorOptionsList',\n 'skuSelectorSelectorImageValue',\n 'skuSelectorSubcontainer',\n 'skuSelectorTextContainer',\n 'valueWrapper',\n] as const\n\ninterface Props {\n skuItems: ProductTypes.Item[]\n skuSelected: ProductTypes.Item | null\n onSKUSelected?: (skuId: string) => void\n maxItems?: number\n visibility?: string\n seeMoreLabel: string\n hideImpossibleCombinations?: boolean\n showValueNameForImageVariation?: boolean\n showValueForVariation?: 'none' | 'image' | 'all'\n imageHeight?: ResponsiveValuesTypes.ResponsiveValue<number>\n imageWidth?: ResponsiveValuesTypes.ResponsiveValue<number>\n thumbnailImage?: string\n visibleVariations?: string[]\n showVariationsLabels?: boolean\n variationsSpacing?: number\n showVariationsErrorMessage?: boolean\n initialSelection?: 'complete' | 'image' | 'empty'\n displayMode?: ResponsiveValuesTypes.ResponsiveValue<\n 'select' | 'default' | 'slider'\n >\n sliderDisplayThreshold?: number\n sliderArrowSize?: number\n sliderItemsPerPage?: ResponsiveValuesTypes.ResponsiveValue<number>\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\nfunction ProductSummarySKUSelector(props: Props) {\n const { handles } = useCssHandles(CSS_HANDLES, { classes: props.classes })\n const dispatch = useProductSummaryDispatch()\n const { product } = useProductSummary()\n\n const skuSelectorClasses = useCustomClasses(\n () => ({\n frameAround: [\n {\n name: `${handles.frameAround} vtex-store-components-3-x-frameAround`,\n applyModifiers: true,\n },\n ],\n seeMoreButton: [\n {\n name: `${handles.seeMoreButton} vtex-store-components-3-x-seeMoreButton`,\n applyModifiers: true,\n },\n ],\n skuSelectorContainer: [\n {\n name: `${handles.skuSelectorContainer} vtex-store-components-3-x-skuSelectorContainer`,\n applyModifiers: true,\n },\n ],\n skuSelectorInternalBox: [\n {\n name: `${handles.skuSelectorInternalBox} vtex-store-components-3-x-skuSelectorInternalBox`,\n applyModifiers: true,\n },\n ],\n skuSelectorItemImageValue: [\n {\n name: `${handles.skuSelectorItemImageValue} vtex-store-components-3-x-skuSelectorItemImageValue`,\n applyModifiers: true,\n },\n ],\n skuSelectorItemImage: [\n {\n name: `${handles.skuSelectorItemImage} vtex-store-components-3-x-skuSelectorItemImage`,\n applyModifiers: true,\n },\n ],\n skuSelectorItemTextValue: [\n {\n name: `${handles.skuSelectorItemTextValue} vtex-store-components-3-x-skuSelectorItemTextValue`,\n applyModifiers: true,\n },\n ],\n skuSelectorItem: [\n {\n name: `${handles.skuSelectorItem} vtex-store-components-3-x-skuSelectorItem`,\n applyModifiers: true,\n },\n ],\n skuSelectorNameContainer: [\n {\n name: `${handles.skuSelectorNameContainer} vtex-store-components-3-x-skuSelectorNameContainer`,\n applyModifiers: true,\n },\n ],\n skuSelectorNameSeparator: [\n {\n name: `${handles.skuSelectorNameSeparator} vtex-store-components-3-x-skuSelectorNameSeparator`,\n applyModifiers: true,\n },\n ],\n skuSelectorName: [\n {\n name: `${handles.skuSelectorName} vtex-store-components-3-x-skuSelectorName`,\n applyModifiers: true,\n },\n ],\n skuSelectorOptionsList: [\n {\n name: `${handles.skuSelectorOptionsList} vtex-store-components-3-x-skuSelectorOptionsList`,\n applyModifiers: true,\n },\n ],\n skuSelectorSelectorImageValue: [\n {\n name: `${handles.skuSelectorSelectorImageValue} vtex-store-components-3-x-skuSelectorSelectorImageValue`,\n applyModifiers: true,\n },\n ],\n skuSelectorSubcontainer: [\n {\n name: `${handles.skuSelectorSubcontainer} vtex-store-components-3-x-skuSelectorSubcontainer`,\n applyModifiers: true,\n },\n ],\n skuSelectorTextContainer: [\n {\n name: `${handles.skuSelectorTextContainer} vtex-store-components-3-x-skuSelectorTextContainer`,\n applyModifiers: true,\n },\n ],\n valueWrapper: [\n {\n name: `${handles.valueWrapper} vtex-store-components-3-x-valueWrapper`,\n applyModifiers: true,\n },\n ],\n }),\n [handles]\n )\n\n const stopBubblingUp: React.MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault()\n e.stopPropagation()\n }\n\n const handleSKUSelected = (skuId: string | null) => {\n if (skuId == null) {\n dispatch({\n type: 'SET_PRODUCT_QUERY',\n args: { query: '' },\n })\n\n return\n }\n\n const selectedItem =\n product.items &&\n (product.items.find(\n (item) => item.itemId === skuId\n ) as ProductSummaryTypes.SKU)\n\n const sku = {\n ...selectedItem,\n image: selectedItem.images[0],\n seller: getDefaultSeller(\n selectedItem.sellers\n ) as ProductSummaryTypes.Seller,\n }\n\n const newProduct = {\n ...product,\n selectedItem,\n sku,\n }\n\n dispatch({\n type: 'SET_PRODUCT',\n args: { product: newProduct },\n })\n\n dispatch({\n type: 'SET_PRODUCT_QUERY',\n args: { query: `skuId=${skuId}` },\n })\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <div onClick={stopBubblingUp} className={handles.SKUSelectorContainer}>\n <SKUSelector\n onSKUSelected={handleSKUSelected}\n {...props}\n classes={skuSelectorClasses}\n />\n </div>\n )\n}\n\nexport default ProductSummarySKUSelector\n\n```"
}
] |
code_product-summary_8f3b71cf
|
[
{
"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 product-summary/react/ProductSummaryImage.test.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render, fireEvent } from '@vtex/test-tools/react'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\n\nimport ProductImage from './ProductSummaryImage'\n\ntest('should show placeholder on error', () => {\n const productName = 'Ball'\n const mock = {\n product: {\n productName,\n sku: { image: { imageUrl: 'foo' } },\n },\n }\n\n const { getByAltText, getByTestId } = render(\n // @ts-expect-error We are not providing the full context\n <ProductSummaryContext.ProductSummaryProvider value={mock}>\n <ProductImage />\n </ProductSummaryContext.ProductSummaryProvider>\n )\n\n const image = getByAltText(productName)\n\n fireEvent.error(image)\n expect(getByTestId('image-placeholder')).toBeDefined()\n})\n\n```"
}
] |
code_product-summary_7ef06de5
|
[
{
"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 product-summary/react/Spacer.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nconst CSS_HANDLES = ['spacer'] as const\n\nfunction Spacer() {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n return <div className={`${handles.spacer} flex flex-grow-1`} />\n}\n\nexport default Spacer\n\n```"
}
] |
code_product-summary_f7e011d0
|
[
{
"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 product-summary/react/ProductSummaryName.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { ProductName } from 'vtex.store-components'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport { SponsoredBadgePosition } from 'vtex.product-summary-context/react/ProductSummaryTypes'\nimport { useIntl } from 'react-intl'\n\nimport shouldShowSponsoredBadge from './utils/shouldShowSponsoredBadge'\n\nconst { useProductSummary } = ProductSummaryContext\n\nconst CSS_HANDLES = [\n 'nameContainer',\n 'nameWrapper',\n 'brandName',\n 'skuName',\n 'productReference',\n 'productNameLoader',\n] as const\n\nconst defaultShowFields = {\n showProductReference: false,\n showBrandName: false,\n showSku: false,\n}\n\ninterface Props {\n /**\n * Defines the visibility on certain properties.\n * @default { showProductReference: false, showBrandName: false, showSku: false }\n */\n showFieldsProps?: {\n showProductReference: boolean\n showBrandName: boolean\n showSku: boolean\n }\n /**\n * HTML tag used. It can be: `div`, `h1`, `h2`, `h3`.\n * @default \"h3\"\n */\n tag?: 'div' | 'h1' | 'h2' | 'h3'\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\nfunction ProductSummaryName({\n showFieldsProps = defaultShowFields,\n tag = 'h3',\n classes,\n}: Props) {\n const { product, sponsoredBadge } = useProductSummary()\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n const productName = product?.productName\n // TODO: change ProductSummaryContext to have `selectedSku` field instead of `sku`\n const skuName = product?.sku?.name\n const brandName = product?.brand\n\n const showSponsoredBadge = shouldShowSponsoredBadge(\n product,\n sponsoredBadge?.position as SponsoredBadgePosition,\n 'titleTop'\n )\n\n const containerClasses = `${handles.nameContainer} flex items-start justify-center pv6`\n const wrapperClasses = `${handles.nameWrapper} overflow-hidden c-on-base f5`\n const brandNameClasses = `${handles.brandName} t-body`\n const skuNameClasses = `${handles.skuName} t-small`\n const loaderClasses = `${handles.productNameLoader} pt5 overflow-hidden`\n const intl = useIntl()\n\n return (\n <div\n className={containerClasses}\n aria-label={intl.formatMessage(\n { id: 'store/product-summary.name.aria-label' },\n { productName: product.productName }\n )}\n >\n <ProductName\n className={wrapperClasses}\n brandNameClass={brandNameClasses}\n skuNameClass={skuNameClasses}\n loaderClass={loaderClasses}\n showSponsoredBadge={showSponsoredBadge}\n sponsoredBadgeLabel={sponsoredBadge?.label}\n productReferenceClass={handles.productReference}\n name={productName}\n skuName={skuName}\n brandName={brandName}\n tag={tag}\n {...showFieldsProps}\n />\n </div>\n )\n}\n\nProductSummaryName.schema = {\n title: 'admin/editor.productSummaryName.title',\n type: 'object',\n properties: {\n showFieldsProps: ProductName.schema,\n },\n}\n\nexport default ProductSummaryName\n\n```"
}
] |
code_product-summary_e72f3f99
|
[
{
"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 product-summary/react/productSummary.css from the product-summary 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\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.hoverEffect:hover .mainImageHovered {\n opacity: 0;\n}\n\n.hoverImage {\n}\n\n.priceSpinner {\n border: 2px solid rgba(0, 0, 0, 0.1);\n border-left-color: #4d4d4d;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n animation: spin 0.5s linear infinite;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.sponsoredBadgeContainer {\n}\n\n.sponsoredBadgeText {\n}\n\n```"
}
] |
code_product-summary_3db7b229
|
[
{
"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 product-summary/react/ProductSummaryCustom.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport classNames from 'classnames'\nimport type { PropsWithChildren } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { useOnView } from 'vtex.on-view'\nimport type { ProductTypes } from 'vtex.product-context'\nimport { ProductContextProvider } from 'vtex.product-context'\nimport { ProductListContext } from 'vtex.product-list-context'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport { SponsoredBadgePosition } from 'vtex.product-summary-context/react/ProductSummaryTypes'\nimport { Link, useRuntime } from 'vtex.render-runtime'\nimport { useIntl } from 'react-intl'\n\nimport LocalProductSummaryContext from './ProductSummaryContext'\nimport ProductPriceSimulationWrapper from './components/ProductPriceSimulationWrapper'\nimport { SponsoredBadge } from './components/SponsoredBadge'\nimport { mapCatalogProductToProductSummary } from './utils/normalize'\nimport shouldShowSponsoredBadge from './utils/shouldShowSponsoredBadge'\n\nconst {\n ProductSummaryProvider,\n useProductSummaryDispatch,\n useProductSummary,\n} = ProductSummaryContext\n\nconst PRODUCT_SUMMARY_MAX_WIDTH = 300\nconst CSS_HANDLES = [\n 'container',\n 'containerNormal',\n 'element',\n 'clearLink',\n] as const\n\nfunction ProductSummaryCustom({\n product,\n actionOnClick,\n children,\n href,\n priceBehavior = 'default',\n position,\n classes,\n}: PropsWithChildren<Props>) {\n const {\n isLoading,\n isHovering,\n selectedItem,\n listName,\n query,\n inView,\n sponsoredBadge,\n } = useProductSummary()\n\n const dispatch = useProductSummaryDispatch()\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n const { getSettings } = useRuntime()\n\n const settings = getSettings('vtex.store')\n const useSemanticHtml = settings?.advancedSettings?.a11ySemanticHtmlMigration\n\n const productListDispatch = ProductListContext.useProductListDispatch()\n\n const productListState = ProductListContext.useProductListState()\n const autocompleteSummary =\n productListState?.listName === 'autocomplete-result-list'\n\n const inViewRef = useRef<HTMLDivElement | null>(null)\n const onView = useCallback(() => {\n productListDispatch?.({\n type: 'SEND_IMPRESSION',\n args: { product, position },\n })\n\n dispatch({\n type: 'SET_IN_VIEW',\n args: { inView: true },\n })\n }, [dispatch, productListDispatch, product, position])\n\n useOnView({\n ref: inViewRef,\n once: true,\n onView,\n })\n\n useEffect(() => {\n if (product) {\n dispatch({\n type: 'SET_PRODUCT',\n args: { product },\n })\n }\n }, [product, dispatch])\n\n useEffect(() => {\n if (position) {\n dispatch({\n // @ts-expect-error - Depends on vtex.product-summary-context update on PR: https://github.com/vtex-apps/product-summary-context/pull/25\n type: 'SET_POSITION',\n // @ts-expect-error - Depends on vtex.product-summary-context update on PR: https://github.com/vtex-apps/product-summary-context/pull/25\n args: { position },\n })\n }\n }, [position, dispatch])\n\n const handleMouseLeave = useCallback(() => {\n dispatch({\n type: 'SET_HOVER',\n args: { isHovering: false },\n })\n }, [dispatch])\n\n const handleMouseEnter = useCallback(() => {\n dispatch({\n type: 'SET_HOVER',\n args: { isHovering: true },\n })\n }, [dispatch])\n\n const handleItemsStateUpdate = useCallback(\n (loading) => {\n dispatch({\n type: 'SET_LOADING',\n args: { isLoading: loading },\n })\n },\n [dispatch]\n )\n\n const oldContextProps = useMemo(\n () => ({\n product,\n isLoading,\n isHovering,\n handleItemsStateUpdate,\n }),\n [product, isLoading, isHovering, handleItemsStateUpdate]\n )\n\n const containerClasses = classNames(\n handles.container,\n handles.containerNormal,\n 'br3 h-100 w-100 flex flex-column justify-between center tc',\n !useSemanticHtml && 'overflow-hidden'\n )\n\n const summaryClasses = classNames(\n handles.element,\n 'pointer pt3 pb4 flex flex-column h-100'\n )\n\n const linkClasses = classNames(\n handles.clearLink,\n 'h-100 flex flex-column',\n useSemanticHtml && 'focus-visible:outline-2 focus-visible:outline-blue-500'\n )\n\n const skuId = selectedItem?.itemId ?? product?.sku?.itemId\n\n const linkProps = href\n ? {\n to: href,\n onClick: autocompleteSummary ? actionOnClick : undefined,\n onClickCapture: autocompleteSummary ? undefined : actionOnClick,\n 'aria-label': `View product details for ${\n product?.productName || 'product'\n }`,\n }\n : {\n page: 'store.product',\n params: {\n slug: product?.linkText,\n id: product?.productId,\n __listName: listName,\n },\n query,\n onClick: autocompleteSummary ? actionOnClick : undefined,\n onClickCapture: autocompleteSummary ? undefined : actionOnClick,\n 'aria-label': `View product details for ${\n product?.productName || 'product'\n }`,\n }\n\n const eventParameters =\n (product.advertisement as any)?.eventParameters ??\n product.advertisement?.adId\n\n const showSponsoredBadge = shouldShowSponsoredBadge(\n product,\n sponsoredBadge?.position as SponsoredBadgePosition,\n 'containerTopLeft'\n )\n\n const intl = useIntl()\n\n return (\n <LocalProductSummaryContext.Provider value={oldContextProps}>\n <ProductContextProvider\n product={(product as unknown) as ProductTypes.Product}\n query={{ skuId }}\n >\n <ProductPriceSimulationWrapper\n product={product}\n inView={inView}\n priceBehavior={priceBehavior}\n >\n <section\n aria-label={intl.formatMessage(\n { id: 'store/product-summary.shelf.aria-label' },\n { productName: product.productName }\n )}\n className={containerClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n style={{ maxWidth: PRODUCT_SUMMARY_MAX_WIDTH }}\n ref={inViewRef}\n data-van-aid={eventParameters}\n >\n <Link className={linkClasses} {...linkProps}>\n <article className={summaryClasses}>\n {showSponsoredBadge ? (\n <SponsoredBadge label={sponsoredBadge?.label} />\n ) : null}\n {children}\n </article>\n </Link>\n </section>\n </ProductPriceSimulationWrapper>\n </ProductContextProvider>\n </LocalProductSummaryContext.Provider>\n )\n}\n\ninterface Props {\n product: ProductSummaryTypes.Product\n /** Function that is executed when a product is clicked */\n actionOnClick?: () => void\n href?: string\n /**\n * Whether the client will request the simulation API for all sellers (\"async\"), only for the 1P seller (\"asyncOnly1P\") or if will not request the API (\"default\")\n * @default \"default\"\n */\n priceBehavior?: 'async' | 'asyncOnly1P' | 'default'\n /**\n * Name of the list the Product Summary is in. Should be set by a Shelf or the Search Result gallery.\n */\n listName?: string\n /**\n * Whether the listName should be sent to product pages via querystring\n * @default true\n */\n trackListName?: boolean\n /**\n * The position of the Product Summary in a list of Product Summaries. Used by the\n * ProductImpressions event.\n */\n position?: number\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n /**\n * The predefined position of the sponsored badge, if applicable.\n */\n sponsoredBadgePosition?: SponsoredBadgePosition\n /**\n * The label of the sponsored badge, if applicable.\n */\n sponsoredBadgeLabel?: string\n /**\n * Where this ProductSummary is being shown. Used for analytics. E.g. \"search\" or \"shelf\".\n */\n placement?: string\n}\n\nfunction ProductSummaryWrapper({\n product,\n actionOnClick,\n href,\n priceBehavior = 'default',\n trackListName = true,\n listName,\n position,\n sponsoredBadgePosition,\n sponsoredBadgeLabel,\n placement,\n classes,\n children,\n}: PropsWithChildren<Props>) {\n const sponsoredBadge = {\n position: sponsoredBadgePosition,\n label: sponsoredBadgeLabel,\n }\n\n return (\n <ProductSummaryProvider\n product={product}\n listName={trackListName ? listName : undefined}\n sponsoredBadge={sponsoredBadge}\n isPriceLoading={\n priceBehavior === 'async' || priceBehavior === 'asyncOnly1P'\n }\n >\n <ProductSummaryCustom\n product={product}\n href={href}\n actionOnClick={actionOnClick}\n priceBehavior={priceBehavior}\n position={position}\n placement={placement}\n classes={classes}\n >\n {children}\n </ProductSummaryCustom>\n </ProductSummaryProvider>\n )\n}\n\nProductSummaryWrapper.schema = {\n title: 'admin/editor.productSummary.title',\n description: 'admin/editor.productSummary.description',\n}\n\n// This function is public available to be used only by vtex.shelf and vtex.search-result.\n// We do not garantee this API will not change and might happen breaking change anytime.\nProductSummaryWrapper.mapCatalogProductToProductSummary = mapCatalogProductToProductSummary\n\nexport default ProductSummaryWrapper\n\n```"
}
] |
code_product-summary_045b213a
|
[
{
"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 product-summary/react/ProductSummaryLegacy.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ProductSummaryLegacy from './legacy'\n\nexport default ProductSummaryLegacy\n\n```"
}
] |
code_product-summary_cb1e45b6
|
[
{
"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 product-summary/react/ProductSummaryList.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { ComponentType, PropsWithChildren } from 'react'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { useQuery } from 'react-apollo'\nimport { usePixel } from 'vtex.pixel-manager'\nimport { QueryProducts } from 'vtex.store-resources'\nimport { ProductList as ProductListStructuredData } from 'vtex.structured-data'\n// eslint-disable-next-line no-restricted-imports\nimport { equals } from 'ramda'\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport ProductSummaryListWithoutQuery, {\n PRODUCT_LIST_PLACEMENT,\n} from './ProductSummaryListWithoutQuery'\nimport useSession from './hooks/useSession'\nimport { PreferenceType } from './utils/normalize'\n\nconst DEFAULT_SHOW_SPONSORED_PRODUCTS = false\nconst DEFAULT_SPONSORED_COUNT = 2\nconst DEFAULT_REPEAT_SPONSORED_PRODUCTS = false\n\nconst ORDER_BY_OPTIONS = {\n RELEVANCE: {\n name: 'admin/editor.productSummaryList.orderType.relevance',\n value: '',\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}\n\nfunction getCookie(cname: string) {\n if (!canUseDOM) {\n return ''\n }\n\n const name = `${cname}=`\n const decodedCookie = decodeURIComponent(document.cookie)\n const ca = decodedCookie.split(';')\n\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i]\n\n while (c.charAt(0) === ' ') {\n c = c.substring(1)\n }\n\n if (c.indexOf(name) === 0) {\n return c.substring(name.length, c.length)\n }\n }\n\n return ''\n}\n\nconst parseFilters = ({ id, value }: { id: string; value: string }) =>\n `specificationFilter_${id}:${value}`\n\nfunction getOrdinationProp(attribute: 'name' | 'value') {\n return Object.keys(ORDER_BY_OPTIONS).map(\n (key) => ORDER_BY_OPTIONS[key as keyof typeof ORDER_BY_OPTIONS][attribute]\n )\n}\n\nexport interface ProductClickParams {\n position: number\n}\n\ninterface SpecificationFilter {\n id: string\n value: string\n}\n\ninterface Props {\n /** Category ID of the listed items. For sub-categories, use \"/\" (e.g. \"1/2/3\") */\n category?: string\n /** Specification Filters of the listed items. */\n specificationFilters?: SpecificationFilter[]\n /** Filter by collection. */\n collection?: string\n /**\n * Ordination type of the items. Possible values: `''`, `OrderByTopSaleDESC`, `OrderByReleaseDateDESC`, `OrderByBestDiscountDESC`, `OrderByPriceDESC`, `OrderByPriceASC`, `OrderByNameASC`, `OrderByNameDESC`\n * @default \"\"\n */\n orderBy?:\n | ''\n | 'OrderByTopSaleDESC'\n | 'OrderByPriceDESC'\n | 'OrderByPriceASC'\n | 'OrderByNameASC'\n | 'OrderByNameDESC'\n | 'OrderByReleaseDateDESC'\n | 'OrderByBestDiscountDESC'\n /** Hides items that are unavailable. */\n hideUnavailableItems?: boolean\n /**\n * Maximum items to be fetched.\n * @default 10\n */\n maxItems?: number\n /**\n * Control SKUs returned for each product in the query. The less SKUs needed to be returned, the more performant your shelf query will be.\n * @default \"ALL_AVAILABLE\"\n */\n skusFilter?: 'ALL_AVAILABLE' | 'ALL' | 'FIRST_AVAILABLE'\n /**\n * Control what price to be shown when price has different installments options.\n * @default \"MAX_WITHOUT_INTEREST\"\n */\n installmentCriteria?: 'MAX_WITHOUT_INTEREST' | 'MAX_WITH_INTEREST'\n /**\n * Name of the list property on Google Analytics events.\n */\n listName?: string\n /**\n * Logic to enable which SKU will be the selected item\n * */\n preferredSKU?: PreferenceType\n /** Slot of a product summary. */\n ProductSummary: ComponentType<{ product: any; actionOnClick: any }>\n /** Callback on product click. */\n actionOnProductClick?: (product: any) => void\n /** Whether or not to show sponsored products in this list. */\n showSponsoredProducts: boolean\n /** Maximum number of sponsored products to put on top of the regular products. */\n sponsoredCount: number\n /** If true, sponsored and regular products will be repeated on the list. */\n repeatSponsoredProducts: boolean\n}\n\nfunction ProductSummaryList(props: PropsWithChildren<Props>) {\n const {\n category = '',\n collection,\n hideUnavailableItems = false,\n orderBy = ORDER_BY_OPTIONS.RELEVANCE.value,\n specificationFilters = [],\n maxItems = 10,\n skusFilter,\n installmentCriteria,\n children,\n listName: rawListName,\n ProductSummary,\n actionOnProductClick,\n preferredSKU,\n showSponsoredProducts = DEFAULT_SHOW_SPONSORED_PRODUCTS,\n sponsoredCount = DEFAULT_SPONSORED_COUNT,\n repeatSponsoredProducts = DEFAULT_REPEAT_SPONSORED_PRODUCTS,\n } = props\n\n const [shippingOptions, setShippingOptions] = useState([])\n\n const { getShippingOptionFromSession } = useSession()\n\n useEffect(() => {\n async function getShippingFromSession() {\n const result = await getShippingOptionFromSession()\n\n if (result) {\n setShippingOptions((currentShippingOptions) =>\n equals(currentShippingOptions, result)\n ? currentShippingOptions\n : result\n )\n }\n }\n\n getShippingFromSession()\n }, [getShippingOptionFromSession])\n\n const { push } = usePixel()\n const { data, loading, error } = useQuery(QueryProducts, {\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 shippingOptions,\n hideUnavailableItems,\n skusFilter,\n installmentCriteria,\n variant: getCookie('sp-variant'),\n advertisementOptions: {\n showSponsored: showSponsoredProducts,\n sponsoredCount,\n repeatSponsoredProducts,\n advertisementPlacement: PRODUCT_LIST_PLACEMENT,\n },\n },\n })\n\n const { products } = data ?? {}\n // Not using ?? operator because listName can be ''\n // eslint-disable-next-line no-unneeded-ternary\n const listName = rawListName ? rawListName : 'List of products'\n\n const productClick = useCallback(\n (product: any, productClickParams?: ProductClickParams) => {\n actionOnProductClick?.(product)\n\n const { position } = productClickParams ?? {}\n\n push({\n event: 'productClick',\n list: listName,\n product,\n position,\n })\n },\n [push, actionOnProductClick, listName]\n )\n\n if (loading || error) {\n return null\n }\n\n return (\n <ProductSummaryListWithoutQuery\n products={products}\n listName={listName}\n ProductSummary={ProductSummary}\n actionOnProductClick={productClick}\n preferredSKU={preferredSKU}\n >\n <ProductListStructuredData products={products} />\n {children}\n </ProductSummaryListWithoutQuery>\n )\n}\n\nProductSummaryList.schema = {\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: 'string',\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.RELEVANCE.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 skusFilter: {\n title: 'admin/editor.productSummaryList.skusFilter.title',\n description: 'admin/editor.productSummaryList.skusFilter.description',\n type: 'string',\n default: 'ALL_AVAILABLE',\n enum: ['ALL_AVAILABLE', 'ALL', 'FIRST_AVAILABLE'],\n enumNames: [\n 'admin/editor.productSummaryList.skusFilter.all-available',\n 'admin/editor.productSummaryList.skusFilter.none',\n 'admin/editor.productSummaryList.skusFilter.first-available',\n ],\n },\n installmentCriteria: {\n title: 'admin/editor.productSummaryList.installmentCriteria.title',\n description:\n 'admin/editor.productSummaryList.installmentCriteria.description',\n type: 'string',\n default: 'MAX_WITHOUT_INTEREST',\n enum: ['MAX_WITHOUT_INTEREST', 'MAX_WITH_INTEREST'],\n enumNames: [\n 'admin/editor.productSummaryList.installmentCriteria.max-without-interest',\n 'admin/editor.productSummaryList.installmentCriteria.max-with-interest',\n ],\n },\n listName: {\n title: 'admin/editor.productSummaryList.analyticsListName.title',\n type: 'string',\n },\n showSponsoredProducts: {\n title: 'admin/editor.productSummaryList.showSponsoredProducts.title',\n description:\n 'admin/editor.productSummaryList.showSponsoredProducts.description',\n type: 'boolean',\n default: DEFAULT_SHOW_SPONSORED_PRODUCTS,\n },\n sponsoredCount: {\n title: 'admin/editor.productSummaryList.sponsoredCount.title',\n description: 'admin/editor.productSummaryList.sponsoredCount.description',\n type: 'number',\n default: DEFAULT_SPONSORED_COUNT,\n },\n repeatSponsoredProducts: {\n title: 'admin/editor.productSummaryList.repeatSponsoredProducts.title',\n description:\n 'admin/editor.productSummaryList.repeatSponsoredProducts.description',\n type: 'boolean',\n default: DEFAULT_REPEAT_SPONSORED_PRODUCTS,\n },\n },\n}\n\nexport default ProductSummaryList\n\n```"
}
] |
code_product-summary_6e2e6c99
|
[
{
"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 product-summary/react/ProductSummaryListWithoutQuery.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { ComponentType, PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\nimport { ListContextProvider, useListContext } from 'vtex.list-context'\nimport { ProductListContext } from 'vtex.product-list-context'\nimport { ExtensionPoint, useTreePath } from 'vtex.render-runtime'\n\nimport ProductListEventCaller from './components/ProductListEventCaller'\nimport type { ProductClickParams } from './ProductSummaryList'\nimport {\n mapCatalogProductToProductSummary,\n PreferenceType,\n} from './utils/normalize'\n\nconst { ProductListProvider } = ProductListContext\n\nexport const PRODUCT_LIST_PLACEMENT = 'home_shelf'\n\ntype Props = PropsWithChildren<{\n /** Array of products. */\n products?: any[]\n /** Slot of product summary. */\n ProductSummary: ComponentType<{\n product: any\n actionOnClick: (\n product: any,\n productClickParams?: ProductClickParams\n ) => void\n listName?: string\n position?: number\n placement?: string\n }>\n /** Name of the list property on Google Analytics events. */\n listName?: string\n /** Callback on product click. */\n actionOnProductClick?: (\n product: any,\n productClickParams?: ProductClickParams\n ) => void\n /** Logic to enable which SKU will be the selected item */\n preferredSKU?: PreferenceType\n}>\n\nfunction List({\n children,\n products,\n ProductSummary,\n listName,\n actionOnProductClick,\n preferredSKU,\n}: Props) {\n const { list } = useListContext()\n const { treePath } = useTreePath()\n\n const newListContextValue = useMemo(() => {\n const componentList = products?.map((product, index) => {\n const normalizedProduct = mapCatalogProductToProductSummary(\n product,\n preferredSKU\n )\n\n const position = list.length + index + 1\n\n const handleOnClick = () => {\n if (typeof actionOnProductClick === 'function') {\n actionOnProductClick(normalizedProduct, {\n position,\n })\n }\n }\n\n if (typeof ProductSummary === 'function') {\n return (\n <ProductSummary\n key={normalizedProduct.cacheId}\n product={normalizedProduct}\n listName={listName}\n actionOnClick={handleOnClick}\n position={position}\n placement={PRODUCT_LIST_PLACEMENT}\n />\n )\n }\n\n return (\n <ExtensionPoint\n id=\"product-summary\"\n key={product.cacheId}\n treePath={treePath}\n product={normalizedProduct}\n listName={listName}\n actionOnClick={handleOnClick}\n position={position}\n placement={PRODUCT_LIST_PLACEMENT}\n />\n )\n })\n\n return list.concat(componentList ?? [])\n }, [\n products,\n list,\n preferredSKU,\n ProductSummary,\n treePath,\n listName,\n actionOnProductClick,\n ])\n\n return (\n <ListContextProvider list={newListContextValue}>\n {children}\n </ListContextProvider>\n )\n}\n\nfunction ProductSummaryListWithoutQuery({\n children,\n products,\n listName,\n ProductSummary,\n actionOnProductClick,\n preferredSKU,\n}: Props) {\n return (\n <ProductListProvider listName={listName ?? ''}>\n <List\n preferredSKU={preferredSKU}\n products={products}\n listName={listName}\n ProductSummary={ProductSummary}\n actionOnProductClick={actionOnProductClick}\n >\n {children}\n </List>\n <ProductListEventCaller />\n </ProductListProvider>\n )\n}\n\nexport default ProductSummaryListWithoutQuery\n\n```"
}
] |
code_product-summary_f1bb1464
|
[
{
"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 product-summary/react/ProductSummarySpecificationBadges.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport { BaseSpecificationBadges } from 'vtex.product-specification-badges'\n\n/**\n * @deprecated Use [vtex.product-specifications](https://github.com/vtex-apps/product-specifications) instead.\n */\nfunction ProductSummarySpecificationBadges({\n specificationGroupName,\n visibleWhen,\n specificationsOptions,\n specificationName,\n displayValue,\n orientation,\n}: any) {\n const { product } = ProductSummaryContext.useProductSummary()\n\n return (\n <BaseSpecificationBadges\n product={product}\n visibleWhen={visibleWhen}\n specificationsOptions={specificationsOptions}\n specificationName={specificationName}\n displayValue={displayValue}\n orientation={orientation}\n specificationGroupName={specificationGroupName}\n />\n )\n}\n\nProductSummarySpecificationBadges.schema = {\n ...BaseSpecificationBadges.schema,\n title: 'admin/editor.product-summary-specification-badges.title',\n}\n\nexport default ProductSummarySpecificationBadges\n\n```"
}
] |
code_product-summary_028e8f2f
|
[
{
"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 product-summary/react/ProductSummaryAddToListButton.js from the product-summary 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_product-summary_72e07b42
|
[
{
"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 product-summary/react/package.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.product-summary\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\",\n \"lint\": \"tsc --noEmit && eslint --quiet --fix --ext ts,tsx .\"\n },\n \"dependencies\": {\n \"classnames\": \"^2.2.6\",\n \"debounce\": \"^1.2.0\",\n \"graphql\": \"^14.1.1\",\n \"prop-types\": \"^15.7.2\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.8.6\",\n \"react-apollo\": \"^3.1.5\",\n \"react-content-loader\": \"^3.1.2\",\n \"react-intersection-observer\": \"^8.25.2\",\n \"react-intl\": \"^3.12.1\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.4\",\n \"@types/classnames\": \"^2.2.11\",\n \"@types/ramda\": \"^0.27.11\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"apollo-cache-inmemory\": \"^1.5.1\",\n \"apollo-client\": \"^2.5.1\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles\",\n \"vtex.device-detector\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.device-detector@0.2.6/public/@types/vtex.device-detector\",\n \"vtex.list-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.list-context@0.2.0/public/@types/vtex.list-context\",\n \"vtex.native-types\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.native-types@0.10.0/public/@types/vtex.native-types\",\n \"vtex.on-view\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.on-view@1.0.0/public/@types/vtex.on-view\",\n \"vtex.pixel-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-manager@1.9.0/public/@types/vtex.pixel-manager\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.product-list-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-list-context@0.4.1/public/@types/vtex.product-list-context\",\n \"vtex.product-specification-badges\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-specification-badges@0.3.0/public/@types/vtex.product-specification-badges\",\n \"vtex.product-summary\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary@2.82.0/public/@types/vtex.product-summary\",\n \"vtex.product-summary-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary-context@0.11.0/public/@types/vtex.product-summary-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime\",\n \"vtex.responsive-values\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.responsive-values@0.4.2/public/@types/vtex.responsive-values\",\n \"vtex.search-page-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-page-context@0.2.0/public/@types/vtex.search-page-context\",\n \"vtex.store-components\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.170.0/public/@types/vtex.store-components\",\n \"vtex.store-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.90.0/public/@types/vtex.store-resources\",\n \"vtex.structured-data\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.structured-data@0.11.0/public/@types/vtex.structured-data\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.4/public/@types/vtex.styleguide\"\n },\n \"vtexScriptsOverride\": {\n \"srcPath\": \".\"\n },\n \"version\": \"2.91.0\"\n}\n\n```"
}
] |
code_product-summary_07c617da
|
[
{
"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 product-summary/react/ProductSummaryContext.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\n\ninterface ProductSummaryContext {\n product: ProductSummaryTypes.Product\n isLoading: boolean\n isHovering: boolean\n handleItemsStateUpdate: (loading: boolean) => void\n}\n\nconst ProductSummaryContext = React.createContext<\n ProductSummaryContext | undefined\n>(undefined)\n\nconst OriginalConsumer = ProductSummaryContext.Consumer\n\n// @ts-expect-error we are mutating the Consumer\nProductSummaryContext.Consumer = function WrappedConsumer(props: any) {\n console.error(\n \"If you are seeing this, a component it's using ProductSummaryContext from vtex.product-summary, which is deprecated. Please see the issue https://github.com/vtex-apps/store-issues#28 on how to migrate to the new component.\"\n )\n\n return <OriginalConsumer {...props} />\n}\n\nexport default ProductSummaryContext\n\n```"
}
] |
code_product-summary_cd46084a
|
[
{
"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 product-summary/react/ProductSummaryPrice.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport classNames from 'classnames'\n// eslint-disable-next-line no-restricted-imports\nimport { pluck, path, flatten } from 'ramda'\nimport { ProductPrice } from 'vtex.store-components'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\n\nimport styles from './productSummary.css'\n\nconst { useProductSummary } = ProductSummaryContext\n\nconst CSS_HANDLES = [\n 'priceContainer',\n 'productPriceClass',\n 'listPriceContainer',\n 'listPriceLabel',\n 'listPrice',\n 'sellingPriceContainer',\n 'sellingPriceLabel',\n 'sellingPrice',\n 'savingsContainer',\n 'savings',\n 'interestRate',\n 'installmentContainer',\n 'listPriceRange',\n 'sellingPriceRange',\n 'priceLoading',\n] as const\n\nfunction getPrices(\n product: ProductSummaryTypes.Product,\n attribute: 'sellingPrice' | 'listPrice'\n) {\n if (!product || (!product.items && !product.priceRange)) {\n return []\n }\n\n if (product.priceRange) {\n const values = product.priceRange[attribute]\n\n return values ? [values.lowPrice, values.highPrice] : []\n }\n\n // No priceRange resolver provided, use sku information\n const sellers = flatten(pluck('sellers', product.items))\n const offerAttribute = attribute === 'sellingPrice' ? 'Price' : 'ListPrice'\n const prices = sellers.map(path(['commertialOffer', offerAttribute]))\n const availableProductsPrices = prices.filter((price) => price !== 0)\n\n return availableProductsPrices\n}\n\ninterface Props {\n /**\n * Set the product selling price range visibility\n * @default false\n */\n showSellingPriceRange?: boolean\n /**\n * Set the product list price's visibility\n * @default true\n */\n showListPrice?: boolean\n /**\n * Set the product list price range visibility\n * @default false\n */\n showListPriceRange?: boolean\n /**\n * Set pricing labels' visibility\n * @default true\n */\n showLabels?: boolean\n /**\n * Set installments' visibility\n * @default true\n */\n showInstallments?: boolean\n /**\n * Set savings' visibility\n * @default false\n */\n showDiscountValue?: boolean\n /**\n * Text of selling Price's label\n * @default \"\"\n */\n labelSellingPrice?: string\n /**\n * Text of list Price's label\n * @default \"\"\n */\n labelListPrice?: string\n /**\n * Whether should show borders\n * @default false\n */\n showBorders?: boolean\n classes: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\n/**\n * @deprecated Please use [vtex.product-price](https://github.com/vtex-apps/product-price) instead.\n */\nfunction ProductSummaryPrice({\n showListPrice = true,\n showSellingPriceRange = false,\n showLabels = true,\n showInstallments = true,\n showDiscountValue = false,\n labelSellingPrice = '',\n labelListPrice = '',\n showBorders = false,\n showListPriceRange = false,\n classes,\n}: Props) {\n const { product, isLoading, isPriceLoading } = useProductSummary()\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n\n // TODO: change ProductSummaryContext to have `selectedSku` field instead of `sku`\n const commertialOffer = product?.sku?.seller?.commertialOffer\n\n if (isLoading || isPriceLoading) {\n return (\n <div\n className={`${handles.priceLoading} flex items-end justify-end w-100 h1 pr6`}\n >\n <div className={styles.priceSpinner} />\n </div>\n )\n }\n\n const priceClasses = {\n containerClass: classNames('flex flex-column justify-end items-center', {\n [`${handles.priceContainer} pv5`]: !showBorders,\n }),\n sellingPriceClass: `${handles.sellingPrice} dib ph2 t-body t-heading-5-ns`,\n }\n\n const sellingPriceList = showSellingPriceRange\n ? getPrices(product, 'sellingPrice')\n : []\n\n const listPriceList = showListPriceRange\n ? getPrices(product, 'listPrice')\n : []\n\n const sellingPrice = commertialOffer.Price\n\n return (\n <div className={priceClasses.containerClass}>\n {sellingPrice !== 0 && (\n <ProductPrice\n className={`${handles.productPriceClass} flex flex-column justify-start`}\n listPriceContainerClass={`${handles.listPriceContainer} pv1 normal c-muted-2`}\n listPriceLabelClass={`${handles.listPriceLabel} dib strike t-small t-mini`}\n listPriceClass={`${handles.listPrice} dib ph2 strike t-small-ns t-mini`}\n sellingPriceContainerClass={`${handles.sellingPriceContainer} pt1 pb3 c-on-base`}\n sellingPriceLabelClass={`${handles.sellingPriceLabel} dib`}\n sellingPriceClass={priceClasses.sellingPriceClass}\n savingsContainerClass={`${handles.savingsContainer} t-small-ns c-muted-2`}\n savingsClass={`${handles.savings} dib`}\n interestRateClass={`${handles.interestRate} dib pl2`}\n installmentContainerClass={`${handles.installmentContainer} t-small-ns c-muted-2`}\n listPrice={commertialOffer.ListPrice}\n sellingPriceList={sellingPriceList}\n listPriceRangeClass={`${handles.listPriceRange} dib ph2 t-small-ns strike`}\n sellingPriceRangeClass={`${handles.sellingPriceRange} dib ph2 t-small-ns`}\n sellingPrice={commertialOffer.Price}\n installments={commertialOffer.Installments}\n showListPrice={showListPrice}\n showSellingPriceRange={showSellingPriceRange}\n showLabels={showLabels}\n showInstallments={showInstallments}\n labelSellingPrice={labelSellingPrice}\n labelListPrice={labelListPrice}\n listPriceList={listPriceList}\n showListPriceRange={showListPriceRange}\n showSavings={showDiscountValue}\n />\n )}\n </div>\n )\n}\n\nProductSummaryPrice.schema = {\n title: 'admin/editor.productSummaryPrice.title',\n description: 'admin/editor.productSummaryPrice.description',\n type: 'object',\n properties: {\n showListPrice: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showListPrice.title',\n default: true,\n isLayout: true,\n },\n showSellingPriceRange: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showSellingPriceRange.title',\n default: false,\n isLayout: true,\n },\n showListPriceRange: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showListPriceRange.title',\n default: false,\n isLayout: true,\n },\n showInstallments: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showInstallments.title',\n default: true,\n isLayout: true,\n },\n showDiscountValue: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showDiscountValue.title',\n default: false,\n },\n showLabels: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showLabels.title',\n default: true,\n isLayout: true,\n },\n showBorders: {\n type: 'boolean',\n title: 'admin/editor.productSummaryPrice.showBorders.title',\n default: false,\n isLayout: true,\n },\n },\n}\n\nexport default ProductSummaryPrice\n\n```"
}
] |
code_product-summary_178a1c36
|
[
{
"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 product-summary/react/ProductSummaryDescription.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { SanitizedHTML } from 'vtex.store-components'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\n\nconst { useProductSummary } = ProductSummaryContext\n\nconst MAX_SIZE_DESCRIPTION = 120\nconst CSS_HANDLES = ['description'] as const\n\ninterface Props {\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n descriptionMaxSize?: number\n}\n\nfunction ProductSummaryDescription({ classes, descriptionMaxSize }: Props) {\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n\n const {\n product: { description },\n } = useProductSummary()\n\n if (!description) {\n return null\n }\n\n const descriptionClasses = `${handles.description} c-muted-2 t-small`\n\n const maxSize = descriptionMaxSize ?? MAX_SIZE_DESCRIPTION\n const descriptionTruncated =\n description.length > maxSize\n ? `${description.substring(0, maxSize)}...`\n : description\n\n return (\n <span className={descriptionClasses}>\n <SanitizedHTML content={descriptionTruncated} />\n </span>\n )\n}\n\nexport default ProductSummaryDescription\n\n```"
}
] |
code_product-summary_03af83bc
|
[
{
"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 product-summary/react/ProductSummaryBrand.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { ProductBrand } from 'vtex.store-components'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\n\nconst { useProductSummary } = ProductSummaryContext\n\ninterface Props {\n /** Whether it should be displayed as a logo or as a text */\n displayMode?: 'logo' | 'text'\n /** Whether it should display the name of the brand if there is no logo */\n fallbackToText?: boolean\n /** List of brands that should be hidden, if any */\n excludeBrands?: Array<string | number>\n /** Height of the logo */\n height?: number\n /** If the logo should have a link */\n logoWithLink?: boolean\n}\n\n/**\n * @deprecated Please use ProductBrand from vtex.store-components instead.\n */\nconst ProductSummaryBrand = ({\n displayMode,\n fallbackToText,\n height,\n excludeBrands,\n logoWithLink = false,\n}: Props) => {\n const { product } = useProductSummary()\n\n return (\n <ProductBrand\n displayMode={displayMode}\n fallbackToText={fallbackToText}\n height={height}\n excludeBrands={excludeBrands}\n logoWithLink={logoWithLink}\n brandName={product.brand}\n brandId={product.brandId}\n />\n )\n}\n\nexport default ProductSummaryBrand\n\n```"
}
] |
code_product-summary_3499d31c
|
[
{
"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 product-summary/react/ProductSummaryImage.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { CollectionBadges, DiscountBadge } from 'vtex.store-components'\nimport classNames from 'classnames'\nimport { useDevice } from 'vtex.device-detector'\nimport { useResponsiveValues } from 'vtex.responsive-values'\nimport type { ResponsiveValuesTypes } from 'vtex.responsive-values'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\nimport { useProduct } from 'vtex.product-context'\nimport {\n ProductSummaryContext,\n ProductSummaryTypes,\n} from 'vtex.product-summary-context'\nimport { useIntl } from 'react-intl'\n\nimport ImagePlaceholder from './components/ImagePlaceholder'\nimport productSummary from './productSummary.css'\nimport { changeImageUrlSize } from './utils/normalize'\nimport { imageUrl } from './utils/aspectRatioUtil'\n\nconst { useProductSummary } = ProductSummaryContext\n\nconst CSS_HANDLES = [\n 'image',\n 'imageWrapper',\n 'imageContainer',\n 'product',\n 'imagePlaceholder',\n 'mainImageHovered',\n] as const\n\nconst MAX_SIZE = 500\nconst DEFAULT_SIZE = 300\n\ntype ImageLabelMatchCriteria = 'exact' | 'contains'\n\ntype MainImageLabel = {\n label?: string\n labelMatchCriteria?: ImageLabelMatchCriteria\n}\n\ntype HoverImageCriteria = 'label' | 'index'\n\ntype HoverImage = {\n label?: string\n index?: number\n criteria?: HoverImageCriteria\n labelMatchCriteria?: ImageLabelMatchCriteria\n}\n\ntype GetImageSrcParams = {\n src: string\n width: number\n height: number\n dpi: number\n aspectRatio?: string | number\n}\n\nfunction getImageSrc({\n src,\n width,\n height,\n dpi,\n aspectRatio,\n}: GetImageSrcParams) {\n if (width || height) {\n return changeImageUrlSize(src, width * dpi, height * dpi)\n }\n\n if (aspectRatio) {\n return imageUrl(src, DEFAULT_SIZE, MAX_SIZE, aspectRatio)\n }\n\n return src\n}\n\ntype GetHoverImageParams = {\n images: ProductSummaryTypes.SKU['images']\n hoverImage?: HoverImage\n hoverImageLabel?: string\n}\n\nfunction findImageByIndex(\n images: ProductSummaryTypes.SKU['images'],\n index: HoverImage['index']\n) {\n if (index === null || index === undefined || Number.isNaN(index)) {\n return null\n }\n\n return images[index]\n}\n\nfunction getHoverImage({\n images,\n hoverImage,\n hoverImageLabel,\n}: GetHoverImageParams) {\n const {\n criteria = 'label',\n label = hoverImageLabel,\n labelMatchCriteria = 'exact',\n index,\n } = hoverImage ?? {}\n\n if (criteria === 'label') {\n return findImageByLabel(images, label, labelMatchCriteria)\n }\n\n if (criteria === 'index') {\n return findImageByIndex(images, index)\n }\n\n return null\n}\n\ntype GetStyleParams = {\n width: number\n height: number\n aspectRatio?: string | number\n maxHeight?: string\n}\n\nfunction getStyle({ width, height, aspectRatio, maxHeight }: GetStyleParams) {\n if (width || height) {\n return {\n width: '100%',\n height,\n objectFit: 'contain',\n maxHeight: 'unset',\n maxWidth: width,\n } as React.CSSProperties\n }\n\n if (aspectRatio || maxHeight) {\n return {\n width: '100%',\n height: '100%',\n objectFit: 'contain',\n maxHeight: maxHeight ?? 'unset',\n } as React.CSSProperties\n }\n\n return undefined\n}\n\ntype CollectionWrapperProps = {\n showCollections: boolean\n productClusters: Array<{ name: string }>\n}\n\nfunction CollectionWrapper({\n showCollections,\n productClusters,\n children,\n}: PropsWithChildren<CollectionWrapperProps>) {\n if (!showCollections || !productClusters || productClusters.length === 0) {\n return <>{children}</>\n }\n\n const collections = productClusters.map((cl) => cl.name)\n\n return (\n <CollectionBadges collectionBadgesText={collections}>\n {children}\n </CollectionBadges>\n )\n}\n\ntype BadgeWrapperProps = {\n showBadge: boolean\n commertialOffer: { ListPrice: number; Price: number }\n badgeText?: string\n}\n\nfunction BadgeWrapper({\n showBadge,\n commertialOffer,\n badgeText,\n children,\n}: PropsWithChildren<BadgeWrapperProps>) {\n if (!showBadge) {\n return <>{children}</>\n }\n\n return (\n <DiscountBadge\n listPrice={commertialOffer.ListPrice}\n sellingPrice={commertialOffer.Price}\n label={badgeText}\n >\n {children}\n </DiscountBadge>\n )\n}\n\nfunction findImageByLabel(\n images: ProductSummaryTypes.SKU['images'],\n selectedLabel: string | undefined,\n labelMatchCriteria?: ImageLabelMatchCriteria\n) {\n if (!selectedLabel) {\n return null\n }\n\n if (labelMatchCriteria === 'contains') {\n return images.find(({ imageLabel }) => imageLabel?.includes(selectedLabel))\n }\n\n return images.find(({ imageLabel }) => imageLabel === selectedLabel)\n}\n\ninterface ImageProps {\n src: string\n width: number\n height: number\n onError: () => void\n alt: string\n className: string\n aspectRatio?: string | number\n maxHeight?: string\n fetchpriority?: 'high' | 'low' | 'auto'\n}\n\nfunction Image({\n src,\n width,\n height,\n onError,\n alt,\n className,\n aspectRatio,\n maxHeight,\n fetchpriority = 'auto',\n}: ImageProps) {\n const { isMobile } = useDevice()\n\n /** TODO: Previously it was as follows :\n * \n const dpi = window.devicePixelRatio || (isMobile ? 2 : 1)\n *\n * it seems good, because it takes the actual user's screen density\n * into account, but causes images to be re-downloaded if the initial\n * device-based guess was wrong. Has to be looked into */\n const dpi = isMobile ? 2 : 1\n\n return (\n <img\n src={getImageSrc({ src, width, height, dpi, aspectRatio })}\n style={getStyle({ width, height, aspectRatio, maxHeight })}\n loading={fetchpriority === 'low' ? 'lazy' : 'eager'}\n alt={alt}\n className={className}\n onError={onError}\n // @ts-expect-error This property exists in HTML\n fetchpriority={fetchpriority}\n />\n )\n}\n\ninterface Props {\n /**\n * Set the discount badge's visibility\n * @default true\n */\n showBadge?: boolean\n /** Text shown on badge */\n badgeText?: string\n /**\n * Display mode of the summary\n * @default \"normal\"\n */\n displayMode?: 'normal' | 'inline'\n /**\n * @default \"\"\n */\n mainImageLabel?: string | MainImageLabel\n /**\n * @default \"\"\n * @deprecated\n * Use hoverImage instead\n */\n hoverImageLabel?: string\n hoverImage?: HoverImage\n /**\n * Defines if the collection badges are shown\n * @default false\n */\n showCollections?: boolean\n placeholder?: string\n width?: ResponsiveValuesTypes.ResponsiveValue<number | string>\n height?: ResponsiveValuesTypes.ResponsiveValue<number | string>\n aspectRatio?: ResponsiveValuesTypes.ResponsiveValue<string | number>\n maxHeight?: ResponsiveValuesTypes.ResponsiveValue<string>\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n fetchpriority?: 'high' | 'low' | 'auto' | 'byPosition'\n}\n\nfunction ProductImage({\n showBadge = true,\n badgeText,\n displayMode = 'normal',\n mainImageLabel = '',\n hoverImageLabel = '',\n hoverImage,\n showCollections = false,\n placeholder,\n width: widthProp,\n height: heightProp,\n aspectRatio: aspectRatioProp,\n maxHeight: maxHeightProp,\n classes,\n fetchpriority = 'byPosition',\n}: Props) {\n // @ts-expect-error - Depends on vtex.product-summary-context update on PR: https://github.com/vtex-apps/product-summary-context/pull/25\n const {\n product,\n position,\n }: {\n product: ProductSummaryTypes.Product\n position: number | undefined\n } = useProductSummary()\n\n const { handles, withModifiers } = useCssHandles(CSS_HANDLES, { classes })\n\n const intl = useIntl()\n\n const [error, setError] = useState(false)\n const onError = () => setError(true)\n\n const { isMobile } = useDevice()\n const productContext = useProduct() ?? {}\n const { skuSelector: { selectedImageVariationSKU } = {} } = productContext\n\n const { productClusters, productName: name } = product ?? {}\n const sku = product?.sku\n\n const {\n widthProp: responsiveWidth,\n heightProp: responsiveHeight,\n aspectRatioProp: aspectRatio,\n maxHeightProp: maxHeight,\n } = useResponsiveValues({\n widthProp,\n heightProp,\n aspectRatioProp,\n maxHeightProp,\n })\n\n const imageClassName = classNames(\n // legacy class\n productSummary.imageContainer,\n handles.imageWrapper,\n {\n 'db w-100 center': displayMode !== 'inline',\n }\n )\n\n const [width, height] = [\n // fallsback to the other remaining value, if not defined\n // @ts-expect-error There's no problem passing type number to parseFloat\n parseFloat(responsiveWidth ?? responsiveHeight ?? 0),\n // @ts-expect-error There's no problem passing type number to parseFloat\n parseFloat(responsiveHeight ?? responsiveWidth ?? 0),\n ]\n\n const legacyContainerClasses = classNames(\n productSummary.imageStackContainer,\n !isMobile && productSummary.hoverEffect\n )\n\n const containerClassname = classNames(\n 'dib relative',\n handles.imageContainer,\n legacyContainerClasses\n )\n\n let skuImageUrl = sku?.image?.imageUrl ?? ''\n\n const shouldDisplayPlaceholder = !skuImageUrl || error\n\n if (!placeholder && shouldDisplayPlaceholder) {\n return (\n <div className={imageClassName}>\n <div className={containerClassname}>\n <ImagePlaceholder cssHandle={handles.imagePlaceholder} />\n </div>\n </div>\n )\n }\n\n const images = sku?.images ?? []\n const selectedHoverImage = getHoverImage({\n images,\n hoverImage,\n hoverImageLabel,\n })\n\n if (selectedImageVariationSKU == null && mainImageLabel) {\n const mainImage =\n typeof mainImageLabel === 'string'\n ? findImageByLabel(images, mainImageLabel)\n : findImageByLabel(\n images,\n mainImageLabel.label,\n mainImageLabel.labelMatchCriteria\n )\n\n if (mainImage) {\n skuImageUrl = mainImage.imageUrl\n }\n }\n\n const legacyImageClasses = classNames({\n [productSummary.imageNormal]: displayMode !== 'inline',\n [productSummary.imageInline]: displayMode === 'inline',\n })\n\n // TODO: change ProductSummaryContext to have `selectedSku` field instead of `sku`\n const commertialOffer = product.sku?.seller?.commertialOffer ?? {}\n\n const imageClassname = classNames(legacyImageClasses, handles.image, {\n [handles.mainImageHovered]: Boolean(selectedHoverImage),\n })\n\n const hoverImageClassname = classNames(\n 'w-100 h-100 dn absolute top-0 left-0 z-999',\n withModifiers('image', 'hover'),\n legacyImageClasses,\n !isMobile && productSummary.hoverImage\n )\n\n /**\n * Determines the priority ('high' or 'low') based on the isMobile flag and the position value.\n * @param isMobileDevice - A boolean indicating the device type (true for mobile, false for non-mobile).\n * @param positionNumber - The Product Summary's position on a list context or search result, used to determine priority.\n * @returns A string representing the priority: 'high' for high priority, 'low' for low priority.\n */\n\n const getFetchPriority = (\n isMobileDevice: boolean,\n positionNumber: number | undefined\n ): 'high' | 'low' => {\n if (positionNumber) {\n return isMobileDevice\n ? positionNumber === 1\n ? 'high'\n : 'low'\n : positionNumber < 3\n ? 'high'\n : 'low'\n }\n\n return 'low'\n }\n\n return (\n <div\n className={imageClassName}\n aria-label={intl.formatMessage(\n { id: 'store/product-summary.image.aria-label' },\n { productName: product.productName }\n )}\n >\n <CollectionWrapper\n showCollections={showCollections}\n productClusters={productClusters}\n >\n <BadgeWrapper\n showBadge={showBadge}\n commertialOffer={commertialOffer}\n badgeText={badgeText}\n >\n <div className={containerClassname}>\n <Image\n src={\n shouldDisplayPlaceholder ? (placeholder as string) : skuImageUrl\n }\n width={width}\n height={height}\n aspectRatio={aspectRatio}\n maxHeight={maxHeight}\n alt={name}\n className={imageClassname}\n onError={onError}\n fetchpriority={\n fetchpriority === 'byPosition'\n ? getFetchPriority(isMobile, position)\n : fetchpriority\n }\n />\n {selectedHoverImage && !isMobile && (\n <Image\n src={selectedHoverImage.imageUrl}\n width={width}\n height={height}\n aspectRatio={aspectRatio}\n maxHeight={maxHeight}\n alt={name}\n className={hoverImageClassname}\n onError={onError}\n fetchpriority={\n fetchpriority === 'byPosition'\n ? getFetchPriority(isMobile, position)\n : fetchpriority\n }\n />\n )}\n </div>\n </BadgeWrapper>\n </CollectionWrapper>\n </div>\n )\n}\n\nProductImage.schema = {\n title: 'admin/editor.productSummaryImage.title',\n description: 'admin/editor.productSummaryImage.description',\n type: 'object',\n properties: {\n showBadge: {\n type: 'boolean',\n title: 'admin/editor.productSummary.showBadge.title',\n default: true,\n isLayout: true,\n },\n showCollections: {\n type: 'boolean',\n title: 'admin/editor.productSummary.showCollections.title',\n default: false,\n isLayout: true,\n },\n displayMode: {\n title: 'admin/editor.productSummary.displayMode.title',\n type: 'string',\n enum: ['normal', 'inline'],\n default: 'normal',\n isLayout: true,\n },\n hoverImageLabel: {\n title: 'admin/editor.productSummaryImage.hoverImageLabel.title',\n description:\n 'admin/editor.productSummaryImage.hoverImageLabel.description',\n type: 'string',\n default: '',\n isLayout: false,\n },\n hoverImage: {\n type: 'object',\n properties: {\n criteria: {\n title: 'admin/editor.productSummaryImage.hoverImage.criteria.title',\n enum: ['index', 'label'],\n },\n },\n dependencies: {\n criteria: {\n oneOf: [\n {\n properties: {\n criteria: {\n enum: ['index'],\n },\n index: {\n title:\n 'admin/editor.productSummaryImage.hoverImage.criteria.index',\n type: 'number',\n },\n },\n },\n {\n properties: {\n criteria: {\n enum: ['label'],\n },\n label: {\n title:\n 'admin/editor.productSummaryImage.hoverImage.criteria.label',\n type: 'string',\n },\n labelMatchCriteria: {\n title:\n 'admin/editor.productSummaryImage.hoverImage.criteria.matchCriteria',\n widget: {\n 'ui:widget': 'radio',\n },\n type: 'string',\n enum: ['exact', 'contains'],\n default: 'exact',\n },\n },\n },\n ],\n },\n },\n },\n fetchpriority: {\n title: 'admin/editor.productSummaryImage.fetchpriority.title',\n enum: ['high', 'low', 'auto', 'byPosition'],\n enumNames: [\n 'admin/editor.productSummaryImage.fetchpriority.high',\n 'admin/editor.productSummaryImage.fetchpriority.low',\n 'admin/editor.productSummaryImage.fetchpriority.auto',\n 'admin/editor.productSummaryImage.fetchpriority.byPosition',\n ],\n widget: {\n 'ui:widget': 'radio',\n },\n default: 'byPosition',\n },\n },\n}\n\nexport default ProductImage\n\n```"
}
] |
code_product-summary_721cc666
|
[
{
"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 product-summary/react/ProductSummaryBuyButton.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { BuyButton } from 'vtex.store-components'\nimport { useRuntime } from 'vtex.render-runtime'\n// eslint-disable-next-line no-restricted-imports\nimport { equals } from 'ramda'\nimport classnames from 'classnames'\nimport { IOMessage } from 'vtex.native-types'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport displayButtonTypes, {\n getDisplayButtonNames,\n getDisplayButtonValues,\n} from './utils/displayButtonTypes'\nimport productSummary from './productSummary.css'\n\nconst ALWAYS_ADD_TO_CART = 'alwaysAddToCart'\nconst DEFAULT_BUTTON_BEHAVIOR = 'default'\n\nconst CSS_HANDLES = ['buyButton', 'buyButtonContainer'] as const\n\ninterface Props {\n /** What the buy button should do when you click it, if you pass default it will add to cart only if there is only one SKU of that product */\n buyButtonBehavior?: 'default' | 'alwaysGoToProduct' | 'alwaysAddToCart'\n /** Should redirect to checkout after clicking on buy */\n isOneClickBuy?: boolean\n /** Custom buy button text */\n buyButtonText?: string\n /**\n * Defines the display mode of buy button\n * @default \"displayButtonAlways\"\n */\n displayBuyButton?:\n | 'displayButtonAlways'\n | 'displayButtonHover'\n | 'displayButtonNone'\n /** A custom URL for the `VIEW CART` button inside the toast created by BuyButton */\n customToastURL?: string\n isHovering?: boolean\n}\n\n/**\n * @deprecated This component is deprecated. Please migrate to vtex.add-to-cart-button and minicart.v2.\n */\nfunction ProductSummaryBuyButton({\n displayBuyButton = 'displayButtonAlways',\n isOneClickBuy = false,\n buyButtonText,\n customToastURL,\n buyButtonBehavior = DEFAULT_BUTTON_BEHAVIOR,\n isHovering,\n}: Props) {\n const {\n hints: { mobile },\n } = useRuntime()\n\n const { product, selectedItem, selectedQuantity } =\n ProductSummaryContext.useProductSummary() ?? {}\n\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const hoverBuyButton =\n equals(displayBuyButton, displayButtonTypes.DISPLAY_ALWAYS.value) ||\n !equals(displayBuyButton, displayButtonTypes.DISPLAY_ON_HOVER.value) ||\n (isHovering && !mobile)\n\n const showBuyButton =\n !equals(displayBuyButton, displayButtonTypes.DISPLAY_NONE.value) &&\n !(\n equals(displayBuyButton, displayButtonTypes.DISPLAY_ON_HOVER.value) &&\n mobile\n )\n\n const buyButtonClasses = classnames(handles.buyButton, 'center mw-100', {\n [productSummary.isHidden]: !hoverBuyButton,\n })\n\n const containerClass = classnames(handles.buyButtonContainer, 'pv3 w-100 db')\n\n const selectedSeller = selectedItem?.seller\n const isAvailable =\n selectedSeller?.commertialOffer &&\n selectedSeller.commertialOffer.AvailableQuantity > 0\n\n const skuItems = BuyButton.mapCatalogItemToCart({\n product,\n selectedItem,\n selectedSeller,\n selectedQuantity,\n })\n\n const { items = [] } = product\n const shouldAddToCart =\n isAvailable &&\n (buyButtonBehavior === ALWAYS_ADD_TO_CART ||\n (buyButtonBehavior === DEFAULT_BUTTON_BEHAVIOR && items.length === 1))\n\n return (\n showBuyButton && (\n <div\n className={containerClass}\n data-testid=\"product-summary__buy-button-container\"\n >\n <div className={buyButtonClasses}>\n <BuyButton\n skuItems={skuItems}\n available={isAvailable}\n isOneClickBuy={isOneClickBuy}\n customToastURL={customToastURL}\n shouldAddToCart={shouldAddToCart}\n >\n <IOMessage id={buyButtonText} />\n </BuyButton>\n </div>\n </div>\n )\n )\n}\n\nProductSummaryBuyButton.schema = {\n title: 'admin/editor.productSummaryBuyButton.title',\n type: 'object',\n properties: {\n isOneClickBuy: {\n type: 'boolean',\n title: 'admin/editor.productSummary.isOneClickBuy.title',\n default: false,\n isLayout: true,\n },\n displayBuyButton: {\n title: 'admin/editor.productSummary.displayBuyButton.title',\n type: 'string',\n enum: getDisplayButtonValues(),\n enumNames: getDisplayButtonNames(),\n default: displayButtonTypes.DISPLAY_ALWAYS.value,\n isLayout: true,\n },\n },\n}\n\nexport default ProductSummaryBuyButton\n\n```"
}
] |
code_product-summary_9188953b
|
[
{
"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 product-summary/react/Column.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nconst CSS_HANDLES = ['column'] as const\n\nfunction Column({ children }: PropsWithChildren<{}>) {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n return <div className={`${handles.column} flex items-center`}>{children}</div>\n}\n\nexport default Column\n\n```"
}
] |
code_product-summary_75262441
|
[
{
"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 product-summary/store/contentSchemas.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"ProductSummary\": {\n \"properties\": {\n \"badgeText\": {\n \"title\": \"admin/editor.productSummary.badgeText.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\"\n },\n \"buyButtonText\": {\n \"title\": \"admin/editor.productSummary.buyButtonText.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"store/button-label\"\n },\n \"labelSellingPrice\": {\n \"title\": \"admin/editor.productSummaryPrice.labelSellingPrice.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"store/pricing.to\"\n },\n \"labelListPrice\": {\n \"title\": \"admin/editor.productSummaryPrice.labelListPrice.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"store/pricing.from\"\n },\n \"sponsoredBadgeLabel\": {\n \"title\": \"admin/editor.productSummary.sponsoredBadge.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"store/sponsored-badge.label\"\n },\n \"sponsoredBadgePosition\": {\n \"title\": \"admin/editor.productSummary.sponsoredBadge.position\",\n \"type\": \"string\",\n \"enum\": [\"titleTop\", \"containerTopLeft\", \"none\"],\n \"default\": \"containerTopLeft\",\n \"enumNames\": [\n \"admin/editor.productSummary.sponsoredBadge.position.titleTop\",\n \"admin/editor.productSummary.sponsoredBadge.position.containerTopLeft\",\n \"admin/editor.productSummary.sponsoredBadge.position.none\"\n ]\n },\n \"trackListName\": {\n \"title\": \"admin/editor.productSummary.trackListName.title\",\n \"type\": \"boolean\",\n \"default\": true\n }\n }\n },\n \"ProductSummaryList\": {\n \"title\": \"admin/editor.productSummary.buyButtonText.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"store/button-label\"\n }\n }\n}\n\n```"
}
] |
code_product-summary_ef79f218
|
[
{
"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 product-summary/store/blocks.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-image\",\n \"product-summary-name\",\n \"product-summary-attachment-list\",\n \"product-summary-space\",\n \"product-summary-column#1\"\n ]\n },\n \"product-summary-column#1\": {\n \"children\": [\"product-summary-price\", \"product-summary-buy-button\"]\n },\n \"product-summary.unstable--flex\": {\n \"children\": [\n \"product-summary-image\",\n \"product-summary-name\",\n \"product-summary-attachment-list\",\n \"product-summary-space\",\n \"unstable--product-summary-column#1\"\n ]\n },\n \"unstable--product-summary-column#1\": {\n \"children\": [\"product-summary-price\", \"product-summary-buy-button\"]\n }\n}\n\n```"
}
] |
code_product-summary_3f5dfc48
|
[
{
"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 product-summary/store/interfaces.json from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-summary\": {\n \"component\": \"ProductSummaryLegacy\",\n \"content\": {\n \"$ref\": \"app:vtex.product-summary#/definitions/ProductSummary\"\n },\n \"allowed\": [\"addon-summary-btn\"]\n },\n \"product-summary.shelf\": {\n \"component\": \"ProductSummaryCustom\",\n \"composition\": \"children\"\n },\n \"product-summary-column\": {\n \"component\": \"Column\",\n \"composition\": \"children\"\n },\n \"product-summary.unstable--flex\": {\n \"component\": \"ProductSummaryCustom\",\n \"composition\": \"children\"\n },\n \"unstable--product-summary-column\": {\n \"component\": \"Column\",\n \"composition\": \"children\"\n },\n \"product-summary-space\": {\n \"component\": \"Spacer\"\n },\n \"product-summary-attachment-list\": {\n \"component\": \"ProductSummaryAttachmentList\"\n },\n \"product-summary-buy-button\": {\n \"component\": \"ProductSummaryBuyButton\",\n \"content\": {\n \"properties\": {\n \"buyButtonText\": {\n \"$ref\": \"app:vtex.product-summary#/definitions/ProductSummary/properties/buyButtonText\"\n }\n }\n }\n },\n \"product-summary-description\": {\n \"component\": \"ProductSummaryDescription\"\n },\n \"product-summary-image\": {\n \"component\": \"ProductSummaryImage\",\n \"content\": {\n \"properties\": {\n \"badgeText\": {\n \"$ref\": \"app:vtex.product-summary#/definitions/ProductSummary/properties/badgeText\"\n }\n }\n }\n },\n \"product-summary-name\": {\n \"component\": \"ProductSummaryName\"\n },\n \"product-summary-sku-name\": {\n \"component\": \"ProductSummarySKUName\"\n },\n \"product-summary-brand\": {\n \"component\": \"ProductSummaryBrand\"\n },\n \"product-summary-price\": {\n \"component\": \"ProductSummaryPrice\",\n \"content\": {\n \"properties\": {\n \"labelSellingPrice\": {\n \"$ref\": \"app:vtex.product-summary#/definitions/ProductSummary/properties/labelSellingPrice\"\n },\n \"labelListPrice\": {\n \"$ref\": \"app:vtex.product-summary#/definitions/ProductSummary/properties/labelListPrice\"\n }\n }\n }\n },\n \"product-summary-sku-selector\": {\n \"component\": \"ProductSummarySKUSelector\"\n },\n \"product-summary-specification-badges\": {\n \"component\": \"ProductSummarySpecificationBadges\"\n },\n \"product-summary-add-to-list-button\": {\n \"component\": \"ProductSummaryAddToListButton\",\n \"allowed\": [\"addon-summary-btn\"]\n },\n \"addon-summary-btn\": {\n \"component\": \"*\"\n },\n \"list-context.product-list\": {\n \"allowed\": [\"product-summary\"],\n \"composition\": \"children\",\n \"component\": \"ProductSummaryList\",\n \"preview\": {\n \"type\": \"grid\",\n \"height\": 550\n }\n },\n \"list-context.product-list-static\": {\n \"allowed\": [\"product-summary\"],\n \"composition\": \"children\",\n \"component\": \"ProductSummaryListWithoutQuery\"\n }\n}\n\n```"
}
] |
code_product-summary_5f36b9c4
|
[
{
"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 product-summary/react/typings/vtex.store-components.d.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport {}\n\ndeclare module 'vtex.store-components' {\n export const SKUSelector\n export const DiscountBadge\n export const ProductPrice\n export const BuyButton\n}\n\n```"
}
] |
code_product-summary_1c08fc36
|
[
{
"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 product-summary/react/typings/vtex.render-runtime.d.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport {}\n\ndeclare module 'vtex.render-runtime' {\n export function useTreePath(): {\n treePath: string\n }\n}\n\n```"
}
] |
code_product-summary_45e0b754
|
[
{
"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 product-summary/react/typings/graphql.d.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n const graphql: any\n export default graphql\n}\n\n```"
}
] |
code_product-summary_c90858e5
|
[
{
"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 product-summary/react/typings/vtex.store-resources.d.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport {}\n\ndeclare module 'vtex.store-resources' {\n import type { DocumentNode } from 'graphql'\n\n export const QueryItemsWithSimulation: DocumentNode\n}\n\n```"
}
] |
code_product-summary_e95ac85e
|
[
{
"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 product-summary/react/legacy/index.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n/* eslint-disable react/prop-types */\n/* eslint-disable react/jsx-handler-names */\nimport PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport { ProductName, ProductPrice } from 'vtex.store-components'\nimport { ProductListContext } from 'vtex.product-list-context'\nimport { useInView } from 'react-intersection-observer'\n\nimport ProductSummaryNormal from './components/ProductSummaryNormal'\nimport ProductSummarySmall from './components/ProductSummarySmall'\nimport ProductSummaryInline from './components/ProductSummaryInline'\nimport ProductSummaryInlinePrice from './components/ProductSummaryInlinePrice'\nimport displayButtonTypes, {\n getDisplayButtonNames,\n getDisplayButtonValues,\n} from '../utils/displayButtonTypes'\nimport { productShape } from '../utils/propTypes'\n\nconst DISPLAY_MODE_MAP = {\n normal: ProductSummaryNormal,\n small: ProductSummarySmall,\n inline: ProductSummaryInline,\n inlinePrice: ProductSummaryInlinePrice,\n}\n\n/**\n * Product Summary component. Summarizes the product information.\n */\nclass ProductSummary extends Component {\n static propTypes = {\n /** Product that owns the informations */\n product: productShape,\n /** Shows the product list price */\n showListPrice: PropTypes.bool,\n /** Should redirect to checkout after clicking on buy */\n isOneClickBuy: PropTypes.bool,\n /** Set pricing labels' visibility */\n showLabels: PropTypes.bool,\n /** Set installments' visibility */\n showInstallments: PropTypes.bool,\n /** Set the borders product's visibility */\n showBorders: PropTypes.bool,\n /** Set the discount badge's visibility */\n showBadge: PropTypes.bool,\n /** Set the product description visibility */\n showDescription: PropTypes.bool,\n /** Set the quantity selector visibility */\n showQuantitySelector: PropTypes.bool,\n /** Text of selling Price's label */\n labelSellingPrice: PropTypes.string,\n /** Text of list Price's label */\n labelListPrice: PropTypes.string,\n /** Text shown on badge */\n badgeText: PropTypes.string,\n /** Custom buy button text */\n buyButtonText: PropTypes.string,\n /** Defines the display mode of buy button */\n displayBuyButton: PropTypes.oneOf(getDisplayButtonValues()),\n /** Hides the buy button completely . If active, the button will not be shown in any condition */\n hideBuyButton: PropTypes.bool,\n /** Defines if the collection badges are shown */\n showCollections: PropTypes.bool,\n /** Name schema props */\n nameSchema: PropTypes.object,\n /** Display mode of the summary used in the search result */\n displayMode: PropTypes.oneOf(['normal', 'small', 'inline', 'inlinePrice']),\n /** Function that is executed when a product is clicked */\n actionOnClick: PropTypes.func,\n /** Set the price align to left */\n priceAlignLeft: PropTypes.bool,\n muted: PropTypes.bool,\n index: PropTypes.number,\n position: PropTypes.number,\n listName: PropTypes.string,\n }\n\n static defaultProps = {\n showListPrice: true,\n showInstallments: true,\n showLabels: true,\n showBadge: true,\n showQuantitySelector: true,\n showCollections: false,\n showDescription: false,\n displayBuyButton: displayButtonTypes.DISPLAY_ALWAYS.value,\n isOneClickBuy: false,\n nameSchema: {\n showProductReference: false,\n showBrandName: false,\n showSku: false,\n },\n displayMode: 'normal',\n showBorders: false,\n muted: false,\n }\n\n state = {\n isHovering: false,\n isUpdatingItems: false,\n }\n\n handleMouseLeave = () => {\n this.setState({ isHovering: false })\n }\n\n handleMouseEnter = () => {\n this.setState({ isHovering: true })\n }\n\n handleItemsStateUpdate = (isLoading) =>\n this.setState({ isUpdatingItems: isLoading })\n\n componentDidMount = () => {\n this.sendImpressionEvent()\n }\n\n componentDidUpdate = (prevProps) => {\n if (\n prevProps.productListDispatch !== this.props.productListDispatch ||\n prevProps.inView !== this.props.inView ||\n prevProps.product !== this.props.product\n ) {\n this.sendImpressionEvent()\n }\n }\n\n sendImpressionEvent = () => {\n const { inView, productListDispatch } = this.props\n\n if (inView && productListDispatch) {\n productListDispatch({\n type: 'SEND_IMPRESSION',\n args: { product: this.props.product, position: this.props.position },\n })\n }\n }\n\n render() {\n const {\n product,\n actionOnClick,\n displayMode,\n displayBuyButton,\n isOneClickBuy,\n buyButtonText,\n showBorders,\n showDescription,\n showBadge,\n badgeText,\n showCollections,\n showListPrice,\n showLabels,\n showInstallments,\n labelSellingPrice,\n labelListPrice,\n nameSchema: showFieldsProps,\n showQuantitySelector,\n priceAlignLeft,\n muted,\n index,\n listName,\n inViewRef,\n } = this.props\n\n const imageProps = {\n product,\n showBadge,\n badgeText,\n showCollections,\n displayMode,\n }\n\n const nameProps = { product, showFieldsProps }\n\n const priceProps = {\n product,\n showListPrice,\n showLabels,\n showInstallments,\n labelSellingPrice,\n labelListPrice,\n isLoading: this.state.isUpdatingItems,\n }\n\n const buyButtonProps = {\n product,\n displayBuyButton,\n isOneClickBuy,\n buyButtonText,\n isHovering: this.state.isHovering,\n }\n\n const ProductSummaryComponent =\n DISPLAY_MODE_MAP[displayMode] || ProductSummaryNormal\n\n return (\n <ProductSummaryComponent\n product={product}\n showBorders={showBorders}\n showDescription={showDescription}\n handleMouseEnter={this.handleMouseEnter}\n handleMouseLeave={this.handleMouseLeave}\n handleItemsStateUpdate={this.handleItemsStateUpdate}\n actionOnClick={actionOnClick}\n imageProps={imageProps}\n nameProps={nameProps}\n priceProps={priceProps}\n buyButtonProps={buyButtonProps}\n showQuantitySelector={showQuantitySelector}\n priceAlignLeft={priceAlignLeft}\n muted={muted}\n index={index}\n listName={listName}\n inViewRef={inViewRef}\n />\n )\n }\n}\n\nconst ProductSummaryWrapper = (props) => {\n const { useProductListDispatch } = ProductListContext\n const productListDispatch = useProductListDispatch()\n const [inViewRef, inView] = useInView({\n // Triggers the event when the element is 75% visible\n threshold: 0.75,\n triggerOnce: true,\n })\n\n return (\n <ProductSummary\n {...props}\n productListDispatch={productListDispatch}\n inView={inView}\n inViewRef={inViewRef}\n />\n )\n}\n\nconst defaultSchema = {\n title: 'admin/editor.productSummary.title',\n description: 'admin/editor.productSummary.description',\n type: 'object',\n properties: {\n isOneClickBuy: {\n type: 'boolean',\n title: 'admin/editor.productSummary.isOneClickBuy.title',\n default: false,\n isLayout: true,\n },\n showBadge: {\n type: 'boolean',\n title: 'admin/editor.productSummary.showBadge.title',\n default: true,\n isLayout: true,\n },\n displayBuyButton: {\n title: 'admin/editor.productSummary.displayBuyButton.title',\n type: 'string',\n enum: getDisplayButtonValues(),\n enumNames: getDisplayButtonNames(),\n default: displayButtonTypes.DISPLAY_ALWAYS.value,\n isLayout: true,\n },\n showCollections: {\n type: 'boolean',\n title: 'admin/editor.productSummary.showCollections.title',\n default: false,\n isLayout: true,\n },\n\n ...ProductPrice.schema.properties,\n },\n}\n\nProductSummaryWrapper.getSchema = () => {\n const nameSchema = ProductName.schema\n\n return {\n ...defaultSchema,\n properties: {\n ...defaultSchema.properties,\n nameSchema,\n },\n }\n}\n\nexport default ProductSummaryWrapper\n\n```"
}
] |
code_product-summary_6eed733e
|
[
{
"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 product-summary/react/utils/clone.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport default function clone(aObject: object) {\n if (!aObject) {\n return aObject\n }\n\n let v\n const bObject = Array.isArray(aObject) ? [] : {}\n\n for (const k in aObject) {\n // @ts-expect-error this function was copy-pasted from a JS snippet\n v = aObject[k]\n // @ts-expect-error this function was copy-pasted from a JS snippet\n bObject[k] = typeof v === 'object' ? clone(v) : v\n }\n\n return bObject\n}\n\n```"
}
] |
code_product-summary_2d05e23f
|
[
{
"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 product-summary/react/utils/shouldShowSponsoredBadge.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n Product,\n SponsoredBadgePosition,\n} from 'vtex.product-summary-context/react/ProductSummaryTypes'\n\ninterface NewAdvertisement {\n eventParameters?: string\n}\n\nconst shouldShowSponsoredBadge = (\n product: Product,\n position: SponsoredBadgePosition,\n eligiblePosition: SponsoredBadgePosition\n) => {\n const isSponsored =\n !!product?.advertisement?.adId ||\n !!(product.advertisement as NewAdvertisement)?.eventParameters\n const showSponsoredBadge = isSponsored && position === eligiblePosition\n\n return showSponsoredBadge\n}\n\nexport default shouldShowSponsoredBadge\n\n```"
}
] |
code_product-summary_4d58154b
|
[
{
"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 product-summary/react/utils/attachmentHelper.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// eslint-disable-next-line no-restricted-imports\nimport { pathOr } from 'ramda'\n\nexport const CHOICE_TYPES = {\n SINGLE: 'SINGLE',\n MULTIPLE: 'MULTIPLE',\n TOGGLE: 'TOGGLE',\n}\n\nexport const getProductPrice = (product: any) =>\n pathOr(0, ['sku', 'seller', 'commertialOffer', 'Price'], product)\n\n```"
}
] |
code_product-summary_d9d6f07c
|
[
{
"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 product-summary/react/utils/aspectRatioUtil.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { changeImageUrlSize } from './normalize'\n\n/** Parses ratio values into a multiplier to set the image height.\n * For example, turns \"3:4\" into 1.333, so the image height will be\n * 1.333 times its width.\n */\nconst parseAspectRatio = (input: string | number) => {\n if (!input) {\n return null\n }\n\n if (typeof input === 'string') {\n if (input === 'auto') {\n return null\n }\n\n const separator = ':'\n const data = input.split(separator)\n\n if (data.length !== 2) {\n return null\n }\n\n const [width, height] = data\n const ratio = parseFloat(height) / parseFloat(width)\n\n if (typeof ratio !== 'number' || Number.isNaN(ratio)) {\n return null\n }\n\n return ratio\n }\n\n if (typeof input === 'number') {\n return input\n }\n\n return null\n}\n\nexport const imageUrl = (\n src: string,\n size: number,\n maxSize: number,\n aspectRatio: string | number\n) => {\n let width = size\n let height: string | number = 'auto'\n\n if (aspectRatio && aspectRatio !== 'auto') {\n height = size * (parseAspectRatio(aspectRatio) ?? 1)\n\n if (width > maxSize) {\n height /= width / maxSize\n width = maxSize\n }\n\n if (height > maxSize) {\n width /= height / maxSize\n height = maxSize\n }\n\n width = Math.round(width)\n height = Math.round(height)\n } else {\n width = Math.min(maxSize, width)\n }\n\n return changeImageUrlSize(src, width, height)\n}\n\n```"
}
] |
code_product-summary_3d30b587
|
[
{
"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 product-summary/react/utils/normalize.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { ProductTypes } from 'vtex.product-context'\n\nimport { getDefaultSeller } from '../modules/seller'\n\nexport const DEFAULT_WIDTH = 'auto'\nexport const DEFAULT_HEIGHT = 'auto'\nexport const MAX_WIDTH = 3000\nexport const MAX_HEIGHT = 4000\n\nexport type PreferenceType =\n | 'FIRST_AVAILABLE'\n | 'LAST_AVAILABLE'\n | 'PRICE_ASC'\n | 'PRICE_DESC'\n\ntype PriceConditionRule = 'lowest' | 'highest'\n\n/**\n * Having the url below as base for the LEGACY file manager,\n * https://storecomponents.vteximg.com.br/arquivos/ids/155472/Frame-3.jpg?v=636793763985400000\n * the following regex will match https://storecomponents.vteximg.com.br/arquivos/ids/155472\n *\n * Also matches urls with defined sizes like:\n * https://storecomponents.vteximg.com.br/arquivos/ids/155473-160-auto\n * @type {RegExp}\n *\n * On the new vtex.file-manager isn't necessary replace the URL, just add the param on the querystring, like:\n * \"?width=WIDTH&height=HEIGHT&aspect=true\"\n *\n */\nconst baseUrlRegex = new RegExp(/.+ids\\/(\\d+)/)\n\nconst httpRegex = new RegExp(/http:\\/\\//)\n\nfunction getParamFromUrl(url: string, name: string) {\n return (url?.split(`${name}=`)[1] ?? '')?.split('&')[0]\n}\n\nfunction toHttps(url: string) {\n return url.replace(httpRegex, 'https://')\n}\n\nexport function cleanImageUrl(imageUrl: string) {\n const cleanUrlResult = baseUrlRegex.exec(imageUrl)\n const vParam = getParamFromUrl(imageUrl, 'v')\n\n if (cleanUrlResult && cleanUrlResult.length > 0) {\n return {\n cleanUrl: cleanUrlResult[0],\n vParam,\n }\n }\n\n return { cleanUrl: imageUrl }\n}\n\nfunction replaceLegacyFileManagerUrl(\n imageUrl: string,\n width: string | number,\n height: string | number\n) {\n const legacyUrlPattern = '/arquivos/ids/'\n const isLegacyUrl = imageUrl.includes(legacyUrlPattern)\n\n if (!isLegacyUrl) return imageUrl\n\n const { vParam, cleanUrl } = cleanImageUrl(imageUrl)\n\n return vParam\n ? `${cleanUrl}-${width}-${height}?v=${vParam}`\n : `${cleanUrl}-${width}-${height}`\n}\n\nexport function changeImageUrlSize(\n imageUrl: string,\n width: string | number = DEFAULT_WIDTH,\n height: string | number = DEFAULT_HEIGHT\n) {\n if (!imageUrl) return\n typeof width === 'number' && (width = Math.min(width, MAX_WIDTH))\n typeof height === 'number' && (height = Math.min(height, MAX_HEIGHT))\n\n const normalizedImageUrl = replaceLegacyFileManagerUrl(\n imageUrl,\n width,\n height\n )\n\n const queryStringSeparator = normalizedImageUrl.includes('?') ? '&' : '?'\n\n return `${normalizedImageUrl}${queryStringSeparator}width=${width}&height=${height}&aspect=true`\n}\n\nfunction getPriceFromSeller(seller: ProductTypes.Seller) {\n return seller.commertialOffer.Price\n}\n\nfunction isAvailable({\n commertialOffer: { AvailableQuantity },\n}: ProductTypes.Seller) {\n return AvailableQuantity != null && AvailableQuantity > 0\n}\n\n/**\n * @description\n * Find the lowest/highest `Price` between sellers\n * @param item an SKU\n * @param condition the condition enum used for comparison functions\n * */\nfunction getBestPrice(item: ProductTypes.Item, condition: PriceConditionRule) {\n // If there's only 1 seller, avoid filtering\n const { sellers } = item\n\n if (sellers.length === 1) {\n return sellers[0].commertialOffer.Price\n }\n\n const availableSellers = sellers.filter(isAvailable)\n const allPrices = availableSellers.map(getPriceFromSeller)\n\n let itemPrice\n\n if (condition === 'highest') {\n itemPrice = allPrices.reduce((max, price) => (price > max ? price : max))\n } else {\n itemPrice = allPrices.reduce((min, price) => (price < min ? price : min))\n }\n\n return itemPrice\n}\n\n/**\n * @description\n * Retrieves the SKU with the best price considering a provided condition\n * @param items an array of SKUs\n * @param condition the condition [highest|lowest]\n * */\nfunction findSKUByPrice(\n items: ProductTypes.Item[],\n condition: PriceConditionRule\n) {\n // If none or only 1 sku is available, avoid reducing\n const availableItems = items.filter(findAnyAvailable)\n\n if (availableItems.length === 0) return items[0]\n if (availableItems.length === 1) return availableItems[0]\n\n const bestPrices = availableItems.map((item) => getBestPrice(item, condition))\n let itemToReturn\n\n if (condition === 'highest') {\n itemToReturn = bestPrices.reduce(\n (maxIndex, currentPrice, currentIndex) =>\n currentPrice > bestPrices[maxIndex] ? currentIndex : maxIndex,\n 0\n )\n } else {\n itemToReturn = bestPrices.reduce(\n (minIndex, currentPrice, currentIndex) =>\n currentPrice < bestPrices[minIndex] ? currentIndex : minIndex,\n 0\n )\n }\n\n return availableItems[itemToReturn]\n}\n\n/**\n * @summary\n * Used to return the first available SKU\n * */\nfunction getAvailableProduct({ sellers }: ProductTypes.Item) {\n return sellers.find(isAvailable)\n}\n\n/**\n * @summary\n * Used to probe if at least 1 seller has stock\n * */\nfunction findAnyAvailable({ sellers }: ProductTypes.Item) {\n return sellers.some(isAvailable)\n}\n\n/**\n * @description\n * Attempts to retrieve the specific SKU using a custom Product (field)\n * in the Catalog. The specification has the value of the SKU ID\n * that will be looking for. If not found for any reason, we default\n * to finding the preferred SKU\n * @param items an array of SKUs\n * @param defaultSKUspec the ID used to find the SKU\n * @param preferenceFallback the logic for finding an SKU if the ID fails\n * @see {@link https://vtex.io/docs/recipes/all} recipe on how to implement this\n * */\nfunction findDefaultSKU(\n items: ProductTypes.Item[],\n defaultSKUspec: string[],\n preferenceFallback: PreferenceType\n) {\n const specificSKU = items.find(\n ({ itemId }) => String(itemId) === String(defaultSKUspec)\n )\n\n if (specificSKU) {\n return specificSKU\n }\n\n return findPreferredSKU(items, preferenceFallback)\n}\n\n/**\n * @description\n * If there's more than one `Item`, and if there's no defaultSKU, this will\n * retrieve a suitable one depending on the logic provided\n * @param items an array of SKUs\n * @param preferredSKU the logic for finding an SKU\n * */\nfunction findPreferredSKU(\n items: ProductTypes.Item[],\n preferredSKU: PreferenceType\n) {\n switch (preferredSKU) {\n default:\n case 'FIRST_AVAILABLE':\n return items.find(getAvailableProduct) ?? items[0]\n\n case 'LAST_AVAILABLE':\n return (\n [...items].reverse().find(getAvailableProduct) ??\n items[items.length - 1]\n )\n\n case 'PRICE_ASC':\n return findSKUByPrice(items, 'lowest')\n\n case 'PRICE_DESC':\n return findSKUByPrice(items, 'highest')\n }\n}\n\nconst defaultImage = { imageUrl: '', imageLabel: '' }\nconst defaultReference = { Value: '' }\nconst defaultSeller = { commertialOffer: { Price: 0, ListPrice: 0 } }\n\nconst resizeImage = (url: string, imageSize: string | number) =>\n changeImageUrlSize(toHttps(url), imageSize)\n\n/**\n * @description\n * This method is responsible for constructing the product type for the product-context.\n * The property `product.sku` is built by these specifications\n * */\nexport function mapCatalogProductToProductSummary(\n product: ProductTypes.Product,\n preferredSKU: PreferenceType = 'FIRST_AVAILABLE',\n imageSize: string | number = 500\n) {\n if (!product) return null\n const normalizedProduct: any = { ...product }\n const items = normalizedProduct.items || []\n const specifications = normalizedProduct.properties || []\n const defaultSKUspec =\n specifications.find(\n (spec: { name: string }) => spec.name === 'DefaultSKUSelected'\n ) ?? null\n\n // The SKU will be responsible of setting the `selectedItem` in the product context.\n let sku\n\n if (items.length === 1) {\n sku = items[0]\n } else if (defaultSKUspec) {\n sku = findDefaultSKU(items, defaultSKUspec.values, preferredSKU)\n } else {\n sku = findPreferredSKU(items, preferredSKU)\n }\n\n if (sku) {\n const seller = getDefaultSeller(sku?.sellers) ?? defaultSeller\n\n const [referenceId = defaultReference] = sku?.referenceId ?? []\n const catalogImages = sku?.images ?? []\n const normalizedImages = catalogImages.map(\n (image: { imageUrl: string }) => ({\n ...image,\n imageUrl: resizeImage(image.imageUrl, imageSize),\n })\n )\n\n const [image = defaultImage] = normalizedImages\n\n normalizedProduct.sku = {\n ...sku,\n seller,\n referenceId,\n image,\n images: normalizedImages,\n }\n }\n\n return normalizedProduct\n}\n\n```"
}
] |
code_product-summary_b073e3eb
|
[
{
"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 product-summary/react/utils/propTypes.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types'\n\nimport { CHOICE_TYPES } from './attachmentHelper'\n\nexport const addedOptionShape = PropTypes.shape({\n item: PropTypes.shape({\n name: PropTypes.string.isRequired,\n sellingPrice: PropTypes.number.isRequired,\n quantity: PropTypes.number.isRequired,\n }),\n normalizedQuantity: PropTypes.number,\n extraQuantity: PropTypes.number,\n choiceType: PropTypes.oneOf([\n CHOICE_TYPES.SINGLE,\n CHOICE_TYPES.MULTIPLE,\n CHOICE_TYPES.TOGGLE,\n ]).isRequired,\n})\n\nexport const removedOptionShape = PropTypes.shape({\n removedQuantity: PropTypes.number.isRequired,\n initialQuantity: PropTypes.number.isRequired,\n name: PropTypes.string.isRequired,\n})\n\nexport const productShape = PropTypes.shape({\n /** Product's id */\n productId: PropTypes.string.isRequired,\n /** Product's link text */\n linkText: PropTypes.string.isRequired,\n /** Product's name */\n productName: PropTypes.string.isRequired,\n /** Product's brand */\n brand: PropTypes.string,\n /** Product's brand id */\n brandId: PropTypes.number,\n /** Product's SKU */\n sku: PropTypes.shape({\n /** SKU name */\n name: PropTypes.string.isRequired,\n /** SKU id */\n itemId: PropTypes.string.isRequired,\n /** SKU Image to be shown */\n image: PropTypes.shape({\n /** Image URL */\n imageUrl: PropTypes.string.isRequired,\n /** Image tag as string */\n imageTag: PropTypes.string,\n }).isRequired,\n /** SKU seller */\n seller: PropTypes.shape({\n /** Seller id */\n sellerId: PropTypes.string,\n /** Seller comertial offer */\n commertialOffer: PropTypes.shape({\n /** SKU installments */\n Installments: PropTypes.arrayOf(\n PropTypes.shape({\n /** Installment value */\n Value: PropTypes.number.isRequired,\n /** Interest rate (zero if interest-free) */\n InterestRate: PropTypes.number.isRequired,\n /** Calculated total value */\n TotalValuePlusInterestRate: PropTypes.number,\n /** Number of installments */\n NumberOfInstallments: PropTypes.number.isRequired,\n /** Installments offer name */\n Name: PropTypes.string,\n })\n ),\n /** Selling Price */\n Price: PropTypes.number.isRequired,\n /** List Price */\n ListPrice: PropTypes.number.isRequired,\n }).isRequired,\n }).isRequired,\n }).isRequired,\n /** Product's collections */\n productClusters: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n })\n ),\n /** Contains relevant assembly options information */\n assemblyOptions: PropTypes.shape({\n added: PropTypes.arrayOf(addedOptionShape),\n removed: PropTypes.arrayOf(removedOptionShape),\n parentPrice: PropTypes.number,\n }),\n /** Quantity of item in Minicart */\n quantity: PropTypes.number,\n})\n\n```"
}
] |
code_product-summary_08b8b031
|
[
{
"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 product-summary/react/utils/compose.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport default function compose(...funcs: Function[]) {\n const functions = funcs.reverse()\n\n return (...args: any[]) => {\n const [firstFunction, ...restFunctions] = functions\n let result = firstFunction(...args)\n\n restFunctions.forEach((fnc) => {\n result = fnc.call(null, result)\n })\n\n return result\n }\n}\n\n```"
}
] |
code_product-summary_2963440e
|
[
{
"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 product-summary/react/utils/displayButtonTypes.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// eslint-disable-next-line no-restricted-imports\nimport { values, map } from 'ramda'\n\nconst displayButtonTypes = {\n DISPLAY_ALWAYS: {\n name: 'admin/editor.productSummary.displayBuyButton.option.always',\n value: 'displayButtonAlways',\n },\n DISPLAY_ON_HOVER: {\n name: 'admin/editor.productSummary.displayBuyButton.option.hover',\n value: 'displayButtonHover',\n },\n DISPLAY_NONE: {\n name: 'admin/editor.productSummary.displayBuyButton.option.none',\n value: 'displayButtonNone',\n },\n}\n\nexport function getDisplayButtonNames() {\n return map((opt) => opt.name, values(displayButtonTypes))\n}\n\nexport function getDisplayButtonValues() {\n return map((opt) => opt.value, values(displayButtonTypes))\n}\n\nexport default displayButtonTypes\n\n```"
}
] |
code_product-summary_02c6efe5
|
[
{
"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 product-summary/react/components/ProductListEventCaller.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useProductImpression } from 'vtex.product-list-context'\n\nfunction ProductListEventCaller() {\n useProductImpression()\n\n return null\n}\n\nexport default ProductListEventCaller\n\n```"
}
] |
code_product-summary_b82b8944
|
[
{
"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 product-summary/react/components/ImagePlaceholder.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nfunction ImagePlaceholder({ cssHandle }: { cssHandle: string }) {\n return (\n <div className=\"relative\">\n <div className={`${cssHandle} absolute w-100 h-100 contain bg-center`} />\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 512 512\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n data-testid=\"image-placeholder\"\n >\n <rect width=\"512\" height=\"512\" fill=\"#F2F2F2\" />\n <rect\n x=\"183.857\"\n y=\"180.2\"\n width=\"144.286\"\n height=\"150.474\"\n stroke=\"#CACBCC\"\n strokeWidth=\"2\"\n />\n <path d=\"M183.78 303.688H328.214\" stroke=\"#CACBCC\" strokeWidth=\"2\" />\n <path\n d=\"M205.082 279.563L223.599 240.507L242.116 260.035L269.892 220.979L306.926 279.563H205.082Z\"\n stroke=\"#CACBCC\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M252.225 213.939C252.225 219.822 247.66 224.52 242.114 224.52C236.569 224.52 232.004 219.822 232.004 213.939C232.004 208.057 236.569 203.359 242.114 203.359C247.66 203.359 252.225 208.057 252.225 213.939Z\"\n stroke=\"#CACBCC\"\n strokeWidth=\"2\"\n />\n </svg>\n </div>\n )\n}\n\nexport default ImagePlaceholder\n\n```"
}
] |
code_product-summary_7e9a2170
|
[
{
"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 product-summary/react/components/SponsoredBadge.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport classNames from 'classnames'\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { IOMessage } from 'vtex.native-types'\n\nconst CSS_HANDLES = ['sponsoredBadgeContainer', 'sponsoredBadgeText'] as const\n\ntype Props = {\n /**\n * The message ID or string for the sponsored label.\n */\n label?: string\n}\n\nexport const SponsoredBadge = ({\n label = 'store/sponsoredBadge.title',\n}: Props) => {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const containerClasses = classNames(\n handles.sponsoredBadgeContainer,\n 'absolute z-1'\n )\n\n const textClasses = classNames(\n handles.sponsoredBadgeText,\n 'c-muted-1 t-mini-s'\n )\n\n return (\n <div className={containerClasses}>\n <span className={textClasses}>\n <IOMessage id={label} />\n </span>\n </div>\n )\n}\n\n```"
}
] |
code_product-summary_9076573f
|
[
{
"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 product-summary/react/components/ProductPriceSimulationWrapper.tsx from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\n\nimport useSimulation from '../hooks/useSimulation'\nimport useSetProduct from '../hooks/useSetProduct'\n\ninterface Props {\n product: ProductSummaryTypes.Product\n inView: boolean\n priceBehavior: 'async' | 'asyncOnly1P' | 'default'\n}\n\nfunction ProductPriceSimulationWrapper({\n product,\n inView,\n children,\n priceBehavior,\n}: PropsWithChildren<Props>) {\n const productSummaryDispatch = ProductSummaryContext.useProductSummaryDispatch()\n const setProduct = useSetProduct()\n\n useSimulation({\n product,\n inView,\n priceBehavior,\n onError: () => {\n productSummaryDispatch({\n type: 'SET_PRICE_LOADING',\n args: { isPriceLoading: false },\n })\n },\n onComplete: (simulatedProduct) => {\n setProduct(simulatedProduct)\n\n productSummaryDispatch({\n type: 'SET_PRICE_LOADING',\n args: { isPriceLoading: false },\n })\n },\n })\n\n return <>{children}</>\n}\n\nexport default ProductPriceSimulationWrapper\n\n```"
}
] |
code_product-summary_f60c67c4
|
[
{
"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 product-summary/react/__tests__/ProductSummary.test.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport ProductSummary from '../ProductSummaryCustom'\n\ndescribe('<ProductSummary /> component', () => {\n it(`should parse a catalog product and get an available SKU with the highest price`, () => {\n const inheritedProps = {\n preferredSKU: 'PRICE_ASC',\n }\n\n const mockProduct = {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n items: [\n {\n itemId: '1',\n name: 'item 1',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 0,\n Price: 100,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n {\n itemId: '2',\n name: 'item 2',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 3,\n Price: 50,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n {\n itemId: '3',\n name: 'item 3',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 1,\n Price: 500,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n ],\n productClusters: [\n {\n name: 'name',\n },\n ],\n properties: [],\n }\n\n const result = ProductSummary.mapCatalogProductToProductSummary(\n mockProduct,\n inheritedProps.preferredSKU\n )\n\n expect(result).toBeDefined()\n expect(result.sku.seller.sellerId).toBe('1')\n expect(result.sku.image).toBeDefined()\n expect(result.sku.itemId).toBe('2')\n })\n\n it(`should parse a catalog product and get a specific SKU by it's properties`, () => {\n const inheritedProps = {\n preferredSKU: 'LAST_AVAILABLE',\n }\n\n const mockProduct = {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n items: [\n {\n itemId: '1',\n name: 'item 1',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 0,\n Price: 100,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n {\n itemId: '2',\n name: 'item 2',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 3,\n Price: 50,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n {\n itemId: '3',\n name: 'item 3',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 1,\n Price: 500,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n {\n imageUrl: 'image2',\n imageLabel: null,\n },\n ],\n },\n ],\n productClusters: [\n {\n name: 'name',\n },\n ],\n properties: [{ name: 'DefaultSKUSelected', values: ['2'] }],\n }\n\n const result = ProductSummary.mapCatalogProductToProductSummary(\n mockProduct,\n inheritedProps.preferredSKU\n )\n\n expect(result).toBeDefined()\n expect(result.sku.itemId).toBe('2')\n })\n\n it('ProductSummary should have a schema', () => {\n expect(ProductSummary.schema).toBeDefined()\n })\n})\n\n```"
}
] |
code_product-summary_e132e66e
|
[
{
"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 product-summary/react/__tests__/ProductSummaryImage.test.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport ProductImage from '../ProductSummaryImage'\nimport ProductSummary from '../ProductSummaryCustom'\n\ndescribe('<ProductImage /> component', () => {\n const inheritedProps = {\n preferredSKU: 'FIRST_AVAILABLE',\n }\n\n it('should render one img element', () => {\n const rawProduct = {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n items: [\n {\n itemId: '1',\n name: 'item 1',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 0,\n Price: 10,\n ListPrice: 7,\n },\n },\n ],\n images: [\n {\n imageUrl: 'image1',\n imageLabel: null,\n },\n ],\n },\n ],\n productClusters: [\n {\n name: 'name',\n },\n ],\n quantity: 1,\n }\n\n const product = ProductSummary.mapCatalogProductToProductSummary(\n rawProduct,\n inheritedProps.preferredSKU\n )\n\n const { container } = render(\n <ProductSummary product={product}>\n <ProductImage />\n </ProductSummary>\n )\n\n const imgElements = container.getElementsByTagName('img')\n\n expect(imgElements).toHaveLength(1)\n expect(imgElements[0].getAttribute('src')).toBeTruthy()\n expect(imgElements[0].getAttribute('src')).toContain('image1')\n })\n\n it('should render svg placeholder and no img element', () => {\n const rawProduct = {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n items: [\n {\n itemId: '1',\n name: 'item 1',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 0,\n Price: 10,\n ListPrice: 7,\n },\n },\n ],\n images: [],\n },\n ],\n productClusters: [\n {\n name: 'name',\n },\n ],\n quantity: 1,\n }\n\n const product = ProductSummary.mapCatalogProductToProductSummary(\n rawProduct,\n inheritedProps.preferredSKU\n )\n\n const { container } = render(\n <ProductSummary product={product}>\n <ProductImage />\n </ProductSummary>\n )\n\n const imgElements = container.getElementsByTagName('img')\n\n expect(imgElements).toHaveLength(0)\n const svgElements = container.getElementsByTagName('svg')\n\n expect(svgElements).toHaveLength(1)\n })\n\n it('should render custom placeholder img', () => {\n const rawProduct = {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n items: [\n {\n itemId: '1',\n name: 'item 1',\n sellers: [\n {\n sellerId: '1',\n commertialOffer: {\n AvailableQuantity: 0,\n Price: 10,\n ListPrice: 7,\n },\n },\n ],\n images: [],\n },\n ],\n productClusters: [\n {\n name: 'name',\n },\n ],\n quantity: 1,\n }\n\n const placeholder = 'placeholder-image-url'\n\n const product = ProductSummary.mapCatalogProductToProductSummary(\n rawProduct,\n inheritedProps.preferredSKU\n )\n\n const { container } = render(\n <ProductSummary product={product}>\n <ProductImage placeholder={placeholder} />\n </ProductSummary>\n )\n\n const imgElements = container.getElementsByTagName('img')\n\n expect(imgElements).toHaveLength(1)\n expect(imgElements[0].src.includes(placeholder)).toBeTruthy()\n })\n})\n\n```"
}
] |
code_product-summary_021f277b
|
[
{
"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 product-summary/react/__tests__/ProductSummaryLegacy.test.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport fs from 'fs'\n\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport ProductSummary from '../legacy/index'\n\ndescribe('<ProductSummary /> component', () => {\n // TODO: Remove this later when we have a better way to resolve contentSchemas.json at test-tools\n const rawData = fs.readFileSync('../store/contentSchemas.json')\n const contentSchema = JSON.parse(rawData)\n const buyButtonText =\n contentSchema.definitions.ProductSummary.properties.buyButtonText.default\n\n const props = {\n runtime: { hints: {} },\n buyButtonText,\n product: {\n productId: '123456789',\n linkText: 'linkText',\n productName: 'productName',\n sku: {\n name: 'name',\n itemId: 'itemId',\n image: {\n imageUrl: '',\n },\n seller: {\n sellerId: 'sellerId',\n commertialOffer: {\n Installments: [\n {\n Value: 1,\n InterestRate: 1,\n NumberOfInstallments: 1,\n },\n ],\n Price: 1,\n ListPrice: 1,\n },\n },\n },\n productClusters: [\n {\n name: 'name',\n },\n ],\n quantity: 1,\n },\n }\n\n function renderComponent(customProps) {\n return render(<ProductSummary {...props} {...customProps} />)\n }\n\n it('should match the snapshot for normal mode', () => {\n const { asFragment } = renderComponent({ displayMode: 'normal' })\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should match the snapshot for small mode', () => {\n const { asFragment } = renderComponent({ displayMode: 'small' })\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should match the snapshot for inline normal mode', () => {\n const { asFragment } = renderComponent({ displayMode: 'inline' })\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should match the snapshot for inline price mode', () => {\n const { asFragment } = renderComponent({ displayMode: 'inlinePrice' })\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render buy button in inline, small and normal mode', () => {\n const { getByText, rerender, container } = renderComponent({\n displayMode: 'normal',\n })\n\n expect(getByText('Buy')).toBeTruthy()\n\n rerender(<ProductSummary {...props} displayMode=\"small\" />)\n expect(getByText('Buy')).toBeTruthy()\n\n rerender(<ProductSummary {...props} displayMode=\"inline\" />)\n expect(getByText('Buy')).toBeTruthy()\n\n rerender(<ProductSummary {...props} displayMode=\"inlinePrice\" />)\n expect(container.querySelector('.buyButtonContainer')).toBeFalsy()\n })\n\n it('should render quantity stepper only in inline price mode', () => {\n const { container, rerender } = renderComponent({ displayMode: 'normal' })\n\n expect(container.querySelector('.quantityStepperContainer')).toBeFalsy()\n\n rerender(<ProductSummary {...props} displayMode=\"inlinePrice\" />)\n expect(container.querySelector('.quantityStepperContainer')).toBeTruthy()\n\n rerender(<ProductSummary {...props} displayMode=\"small\" />)\n expect(container.querySelector('.quantityStepperContainer')).toBeFalsy()\n\n rerender(<ProductSummary {...props} displayMode=\"inline\" />)\n expect(container.querySelector('.quantityStepperContainer')).toBeFalsy()\n })\n\n it(`should not break Shelf getSchema`, () => {\n expect(ProductSummary.getSchema).toEqual(expect.any(Function))\n })\n\n describe('Site editor editable', () => {\n it('should export getSchema and return object with title', () => {\n const schema = ProductSummary.schema || ProductSummary.getSchema({})\n\n expect(schema).toEqual(\n expect.objectContaining({ title: expect.any(String) })\n )\n })\n })\n})\n\n```"
}
] |
code_product-summary_f6667b87
|
[
{
"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 product-summary/react/hooks/useSimulation.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\nimport { useQuery } from 'react-apollo'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\nimport { QueryItemsWithSimulation } from 'vtex.store-resources'\n\nimport clone from '../utils/clone'\n\nconst mergeSellers = (\n sellerA: ProductSummaryTypes.Seller,\n sellerB: ProductSummaryTypes.Seller,\n sellerDefault?: string\n) => {\n sellerA.commertialOffer = {\n ...sellerA.commertialOffer,\n ...sellerB.commertialOffer,\n }\n\n // Deal with withoutPriceFulfillment cases\n if (sellerA.commertialOffer.Price === 0) {\n sellerA.commertialOffer.AvailableQuantity = 0\n }\n\n if (!sellerDefault) {\n return sellerA\n }\n\n return {\n ...sellerA,\n sellerDefault: sellerA.sellerId === sellerDefault,\n }\n}\n\nconst getDefaultSeller = (sellers: ProductSummaryTypes.Seller[]) => {\n const sellersWithStock = sellers.filter(\n (seller) => seller.commertialOffer.AvailableQuantity !== 0\n )\n\n return sellersWithStock\n ?.sort((a, b) => a.commertialOffer.Price - b.commertialOffer.Price)\n .map((seller) => seller.sellerId)[0]\n}\n\ntype Params = {\n product: ProductSummaryTypes.Product\n inView: boolean\n onComplete: (product: ProductSummaryTypes.Product) => void\n onError: () => void\n priceBehavior: 'async' | 'asyncOnly1P' | 'default'\n}\n\nfunction useSimulation({\n product,\n inView,\n onComplete,\n onError,\n priceBehavior,\n}: Params) {\n const items = product.items || []\n\n const simulationItemsInput = useMemo(() => {\n if (priceBehavior === 'async') {\n return items.map((item) => ({\n itemId: item.itemId,\n sellers: item.sellers.map((seller) => ({ sellerId: seller.sellerId })),\n }))\n }\n\n return items.map((item) => ({\n itemId: item.itemId,\n sellers: [{ sellerId: '1' }],\n }))\n }, [items, priceBehavior])\n\n useQuery(QueryItemsWithSimulation, {\n variables: {\n items: simulationItemsInput,\n },\n skip: priceBehavior === 'default' || !inView,\n ssr: false,\n onError,\n onCompleted: (response) => {\n if (!response) {\n return\n }\n\n const simulationItems = response.itemsWithSimulation\n\n const mergedProduct = clone(product) as ProductSummaryTypes.Product\n\n mergedProduct.items.forEach((item, itemIndex) => {\n const simulationItem = simulationItems[itemIndex]\n\n if (priceBehavior === 'async') {\n const sellerDefault = getDefaultSeller(simulationItem.sellers)\n\n item.sellers = item.sellers.map((seller, simulationIndex) => {\n const sellerSimulation = simulationItem.sellers[simulationIndex]\n\n return mergeSellers(seller, sellerSimulation, sellerDefault)\n })\n } else {\n const seller1PIndex = item.sellers.findIndex(\n (seller) => seller.sellerId === '1'\n )\n\n const sellers = Array.from(item.sellers)\n\n sellers[seller1PIndex] = simulationItem.sellers[0]\n const sellerDefault = getDefaultSeller(sellers)\n\n item.sellers = item.sellers.map((seller) => {\n if (seller.sellerId !== '1') {\n return !sellerDefault\n ? seller\n : {\n ...seller,\n sellerDefault: seller.sellerId === sellerDefault,\n }\n }\n\n return mergeSellers(\n seller,\n simulationItem.sellers[0],\n sellerDefault\n )\n })\n }\n })\n\n mergedProduct.sku = mergedProduct.items.find(\n (item) => item.itemId === mergedProduct.sku.itemId\n ) as ProductSummaryTypes.SingleSKU\n\n if (mergedProduct.sku.sellers.length > 0) {\n mergedProduct.sku.seller = (mergedProduct.sku.sellers.find(\n (seller) => seller.sellerDefault\n ) ?? mergedProduct.sku.sellers[0]) as ProductSummaryTypes.Seller\n } else {\n mergedProduct.sku.seller = {\n // @ts-expect-error We are not providing the full type\n commertialOffer: { Price: 0, ListPrice: 0 },\n }\n }\n\n mergedProduct.sku.image = product.sku.image\n\n onComplete(mergedProduct)\n },\n })\n}\n\nexport default useSimulation\n\n```"
}
] |
code_product-summary_7b117acb
|
[
{
"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 product-summary/react/hooks/useSetProduct.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useProduct, useProductDispatch } from 'vtex.product-context'\nimport type { ProductTypes } from 'vtex.product-context'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport type { ProductSummaryTypes } from 'vtex.product-summary-context'\n\nconst { useProductSummaryDispatch } = ProductSummaryContext\n\nfunction useSetProduct() {\n const { selectedItem: currentSelectedItem } = useProduct() ?? {}\n const productSummaryDispatch = useProductSummaryDispatch()\n const productDispatch = useProductDispatch()\n\n return (product: ProductSummaryTypes.Product) => {\n const newSelectedItem =\n currentSelectedItem &&\n product.items.find((item) => item.itemId === currentSelectedItem.itemId)\n\n productSummaryDispatch({\n type: 'SET_PRODUCT',\n args: { product },\n })\n\n productDispatch?.({\n type: 'SET_PRODUCT',\n args: { product: (product as unknown) as ProductTypes.Product },\n })\n\n productDispatch?.({\n type: 'SET_SELECTED_ITEM',\n args: { item: (newSelectedItem as unknown) as ProductTypes.Item },\n })\n }\n}\n\nexport default useSetProduct\n\n```"
}
] |
code_product-summary_096f1bd2
|
[
{
"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 product-summary/react/hooks/useSession.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useCallback } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\n\nconst useSession = () => {\n const { rootPath } = useRuntime()\n\n const getShippingOptionFromSession = useCallback(async () => {\n const headers = new Headers()\n\n headers.append('Content-Type', 'application/json')\n\n const requestOptions: RequestInit = {\n method: 'GET',\n headers,\n redirect: 'follow',\n }\n\n const session = await fetch(\n `${rootPath ?? ''}/api/sessions?items=public.shippingOption`,\n requestOptions\n )\n\n const data = await session.json()\n\n if (!data?.namespaces?.public?.shippingOption?.value) {\n return null\n }\n\n return JSON.parse(data.namespaces.public.shippingOption.value)?.map(\n (option: { key: string; value: string }) => option.value\n )\n }, [rootPath])\n\n return { getShippingOptionFromSession }\n}\n\nexport default useSession\n\n```"
}
] |
code_product-summary_9b6d7f4d
|
[
{
"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 product-summary/react/modules/seller.ts from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface SellerDefault {\n sellerDefault: boolean\n}\n\nexport function getDefaultSeller<T extends SellerDefault>(\n sellers?: T[]\n): T | undefined {\n if (!sellers || sellers.length === 0) {\n return\n }\n\n const defaultSeller = sellers.find((seller) => seller.sellerDefault)\n\n if (!defaultSeller) {\n return sellers[0]\n }\n\n return defaultSeller\n}\n\n```"
}
] |
code_product-summary_58e83e1a
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryNormal.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Component } from 'react'\n// eslint-disable-next-line no-restricted-imports\nimport { path } from 'ramda'\nimport classNames from 'classnames'\nimport { ExtensionPoint, Link } from 'vtex.render-runtime'\n\nimport AttachmentList from './AttachmentList'\nimport ProductImage from './ProductImage'\nimport ProductSummaryBuyButton from './ProductSummaryBuyButton'\nimport ProductSummaryPrice from './ProductSummaryPrice'\nimport ProductSummaryName from './ProductSummaryName'\nimport ProductSummaryDescription from './ProductSummaryDescription'\nimport productSummary from '../../productSummary.css'\n\nclass ProductSummaryNormal extends Component {\n render() {\n const {\n product,\n showBorders,\n showDescription,\n handleMouseEnter,\n handleMouseLeave,\n actionOnClick,\n imageProps,\n nameProps,\n priceProps,\n buyButtonProps,\n inViewRef,\n listName,\n } = this.props\n\n const containerClasses = classNames(\n productSummary.container,\n productSummary.containerNormal,\n 'overflow-hidden br3 h-100 w-100 flex flex-column justify-between center tc'\n )\n\n const summaryClasses = classNames(\n `${productSummary.element} pointer pt3 pb4 flex flex-column h-100`,\n {\n 'bb b--muted-4 mh2 mt2': showBorders,\n }\n )\n\n const nameClasses = {\n containerClass: `flex items-start ${productSummary.nameContainer} justify-center pv6`,\n brandNameClass: 't-body',\n }\n\n const priceClasses = {\n containerClass: classNames(\n 'flex flex-column justify-end items-center relative',\n {\n [`${productSummary.priceContainer} pv5`]: !showBorders,\n }\n ),\n sellingPriceClass: 'dib ph2 t-body t-heading-5-ns',\n }\n\n const buyButtonClasses = {\n containerClass: `${productSummary.buyButtonContainer} pv3 w-100 db`,\n }\n\n const descriptionClasses = `${productSummary.description} c-muted-2 t-small`\n\n return (\n <section\n className={containerClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={inViewRef}\n >\n <div className={`${productSummary.addToListBtn} absolute z-1 mt3`}>\n <ExtensionPoint\n id=\"addon-summary-btn\"\n product={{\n skuId: path(['sku', 'itemId'], product),\n productId: path(['productId'], product),\n quantity: 1,\n }}\n />\n </div>\n <Link\n className={`${productSummary.clearLink} h-100 flex flex-column`}\n page=\"store.product\"\n params={{\n slug: product && product.linkText,\n id: product && product.productId,\n __listName: listName,\n }}\n onClick={actionOnClick}\n >\n <article className={summaryClasses}>\n <div className={`${productSummary.imageContainer} db w-100 center`}>\n <ProductImage {...imageProps} />\n </div>\n <div\n className={`${productSummary.information} h-100 flex flex-column justify-between`}\n >\n <ProductSummaryName {...nameProps} {...nameClasses} />\n <AttachmentList product={product} />\n {showDescription && (\n <ProductSummaryDescription\n description={product.description}\n descriptionClasses={descriptionClasses}\n />\n )}\n <div>\n <ProductSummaryPrice {...priceProps} {...priceClasses} />\n </div>\n </div>\n </article>\n <ProductSummaryBuyButton {...buyButtonProps} {...buyButtonClasses} />\n </Link>\n </section>\n )\n }\n}\n\nexport default ProductSummaryNormal\n\n```"
}
] |
code_product-summary_4f8f4970
|
[
{
"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 product-summary/react/legacy/components/ProductSummarySmall.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Component } from 'react'\n// eslint-disable-next-line no-restricted-imports\nimport { path } from 'ramda'\nimport classNames from 'classnames'\nimport { Link } from 'vtex.render-runtime'\n\nimport AttachmentList from './AttachmentList'\nimport ProductImage from './ProductImage'\nimport ProductSummaryBuyButton from './ProductSummaryBuyButton'\nimport ProductSummaryPrice from './ProductSummaryPrice'\nimport ProductSummaryName from './ProductSummaryName'\nimport styles from '../../productSummary.css'\n\nclass ProductSummarySmall extends Component {\n render() {\n const {\n product,\n showBorders,\n handleMouseEnter,\n handleMouseLeave,\n actionOnClick,\n imageProps,\n nameProps,\n priceProps,\n buyButtonProps,\n inViewRef,\n listName,\n } = this.props\n\n const containerClasses = classNames(\n styles.container,\n styles.containerSmall,\n 'overflow-hidden br3 h-100 flex flex-column justify-between center tc'\n )\n\n const summaryClasses = classNames(\n styles.element,\n 'pointer pt3 pb4 flex flex-column',\n {\n 'bb b--muted-4 mh2 mt2': showBorders,\n }\n )\n\n const nameClasses = {\n containerClass: `flex items-start ${styles.nameContainer} justify-center pv5 t-mini pb2`,\n brandNameClass: 't-body t-mini',\n }\n\n const priceClasses = {\n containerClass: classNames('flex flex-column justify-end items-center', {\n [`${styles.priceContainer} pv5`]: !showBorders,\n }),\n sellingPriceClass: 'dib ph2 t-body t-heading-5-ns',\n }\n\n const buyButtonClasses = {\n containerClass: `${styles.buyButtonContainer} pv3 w-100 dn`,\n }\n\n return (\n <section\n className={containerClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={inViewRef}\n >\n <Link\n className={`${styles.clearLink} flex flex-column`}\n page=\"store.product\"\n params={{ slug: path(['linkText'], product), __listName: listName }}\n onClick={actionOnClick}\n >\n <article className={summaryClasses}>\n <div className={`${styles.imageContainer} db w-100 center`}>\n <ProductImage {...imageProps} />\n </div>\n <div className={styles.information}>\n <ProductSummaryName {...nameProps} {...nameClasses} />\n <AttachmentList product={product} />\n <div>\n <ProductSummaryPrice {...priceProps} {...priceClasses} />\n </div>\n </div>\n </article>\n <ProductSummaryBuyButton {...buyButtonProps} {...buyButtonClasses} />\n </Link>\n </section>\n )\n }\n}\n\nexport default ProductSummarySmall\n\n```"
}
] |
code_product-summary_17613653
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryInlinePrice.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport classNames from 'classnames'\nimport { Link } from 'vtex.render-runtime'\n\nimport AttachmentList from './AttachmentList'\nimport ProductImage from './ProductImage'\nimport ProductQuantityStepper from './ProductQuantityStepper'\nimport ProductSummaryPrice from './ProductSummaryPrice'\nimport ProductSummaryName from './ProductSummaryName'\nimport styles from '../../productSummary.css'\n\nconst ProductSummaryInlinePrice = ({\n product,\n showBorders,\n handleMouseEnter,\n handleMouseLeave,\n handleItemsStateUpdate,\n actionOnClick,\n imageProps,\n nameProps,\n priceProps,\n showQuantitySelector,\n priceAlignLeft,\n muted,\n index,\n inViewRef,\n listName,\n}) => {\n const containerClasses = classNames(\n styles.container,\n styles.containerInline,\n 'br3 h-100 w-100'\n )\n\n const summaryClasses = classNames(\n `${styles.element} pointer ph2 pt3 pb4 flex flex-column h-100`,\n {\n 'bb b--muted-4 mh2 mh3-ns mt2': showBorders,\n }\n )\n\n const nameClasses = {\n containerClass: classNames(\n 'flex items-start justify-left tl w-90 t-mini pb2',\n { 'c-muted-1': muted }\n ),\n brandNameClass: classNames('t-body', {\n 'c-muted-1': muted,\n 'c-on-base': !muted,\n }),\n skuNameClass: classNames('t-small', {\n 'c-muted-2': muted,\n }),\n }\n\n const priceClasses = {\n containerClass: classNames('flex flex-column nr1 h1', {\n 'items-start': priceAlignLeft,\n 'items-end': !priceAlignLeft,\n [`${styles.priceContainer} pv5`]: !showBorders,\n }),\n sellingPriceClass: classNames('dib ph2 t-body t-heading-5-ns', {\n 'c-muted-1': muted,\n }),\n }\n\n return (\n <section\n className={containerClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={inViewRef}\n >\n <article className={summaryClasses}>\n <Link\n className={`${styles.clearLink} flex h-100`}\n page=\"store.product\"\n params={{\n slug: product && product.linkText,\n id: product && product.productId,\n __listName: listName,\n }}\n onClick={actionOnClick}\n >\n <div className={`${styles.imageContainer} db h-100`}>\n <ProductImage {...imageProps} />\n </div>\n <div className={`${styles.information} w-70 pb2 ph3`}>\n <ProductSummaryName {...nameProps} {...nameClasses} />\n <AttachmentList product={product} />\n <div className=\"mv3 nr2\">\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n onClick={(e) => {\n e.preventDefault()\n // Stop propagation so it doesn't trigger the Link component above\n e.stopPropagation()\n }}\n className={`flex justify-end nr4 mb2 ${styles.quantityStepperContainer}`}\n >\n {showQuantitySelector && (\n <ProductQuantityStepper\n product={product}\n onUpdateItemsState={handleItemsStateUpdate}\n index={index}\n />\n )}\n </div>\n <ProductSummaryPrice {...priceProps} {...priceClasses} />\n </div>\n </div>\n </Link>\n </article>\n </section>\n )\n}\n\nexport default ProductSummaryInlinePrice\n\n```"
}
] |
code_product-summary_5629f2bc
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryName.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n/* eslint-disable react/prop-types */\nimport React from 'react'\nimport PropTypes from 'prop-types'\n// eslint-disable-next-line no-restricted-imports\nimport { path } from 'ramda'\nimport { ProductName } from 'vtex.store-components'\n\nimport { productShape } from '../../utils/propTypes'\n\nconst ProductSummaryName = ({\n product,\n showFieldsProps,\n containerClass,\n brandNameClass,\n skuNameClass,\n}) => {\n const productName = path(['productName'], product)\n const skuName = path(['sku', 'name'], product)\n const brandName = path(['brand'], product)\n\n return (\n <div className={containerClass}>\n <ProductName\n className=\"overflow-hidden c-on-base\"\n brandNameClass={brandNameClass}\n skuNameClass={skuNameClass}\n loaderClass=\"pt5 overflow-hidden\"\n name={productName}\n skuName={skuName}\n brandName={brandName}\n {...showFieldsProps}\n />\n </div>\n )\n}\n\nProductSummaryName.propTypes = {\n /** Product that owns the informations */\n product: productShape,\n /** Name schema props */\n showFieldsProps: PropTypes.object,\n /** Styles used in the container div */\n containerClass: PropTypes.string,\n /** Styles used in the brand name */\n brandNameClass: PropTypes.string,\n}\n\nexport default ProductSummaryName\n\n```"
}
] |
code_product-summary_0923dbb2
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryPrice.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport PropTypes from 'prop-types'\n// eslint-disable-next-line no-restricted-imports\nimport { path, prop } from 'ramda'\nimport { Spinner } from 'vtex.styleguide'\nimport { ProductPrice } from 'vtex.store-components'\n\nimport { productShape } from '../../utils/propTypes'\n\nconst ProductSummaryPrice = ({\n product,\n showListPrice,\n showLabels,\n showInstallments,\n labelSellingPrice,\n labelListPrice,\n isLoading,\n containerClass,\n sellingPriceClass,\n}) => {\n const commertialOffer = path(['sku', 'seller', 'commertialOffer'], product)\n\n if (isLoading) {\n return (\n <div className=\"flex items-end justify-end w-100 h1 pr6\">\n <Spinner size={20} />\n </div>\n )\n }\n\n const sellingPrice = prop('Price', commertialOffer)\n\n return (\n <div className={containerClass}>\n {sellingPrice !== 0 && (\n <ProductPrice\n className=\"flex flex-column justify-start\"\n listPriceContainerClass=\"pv1 normal c-muted-2\"\n listPriceLabelClass=\"dib strike t-small t-mini\"\n listPriceClass=\"dib ph2 strike t-small-ns t-mini\"\n sellingPriceContainerClass=\"pt1 pb3 c-on-base\"\n sellingPriceLabelClass=\"dib\"\n sellingPriceClass={sellingPriceClass}\n savingsContainerClass=\"t-small-ns c-muted-2\"\n savingsClass=\"dib\"\n interestRateClass=\"dib pl2\"\n installmentContainerClass=\"t-small-ns c-muted-2\"\n listPrice={prop('ListPrice', commertialOffer)}\n sellingPrice={prop('Price', commertialOffer)}\n installments={prop('Installments', commertialOffer)}\n showListPrice={showListPrice}\n showLabels={showLabels}\n showInstallments={showInstallments}\n labelSellingPrice={labelSellingPrice}\n labelListPrice={labelListPrice}\n />\n )}\n </div>\n )\n}\n\nProductSummaryPrice.propTypes = {\n /** Product that owns the informations */\n product: productShape,\n /** Set the product list price's visibility */\n showListPrice: PropTypes.bool,\n /** Set pricing labels' visibility */\n showLabels: PropTypes.bool,\n /** Set installments' visibility */\n showInstallments: PropTypes.bool,\n /** Text of selling Price's label */\n labelSellingPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n /** Text of selling Price's label */\n labelListPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n /** Defines if the loading spinner is shown */\n isLoading: PropTypes.bool,\n /** Styles used in the container div */\n containerClass: PropTypes.string,\n /** Styles used in the selling price */\n sellingPriceClass: PropTypes.string,\n}\n\nexport default ProductSummaryPrice\n\n```"
}
] |
code_product-summary_1c4fec5d
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryDescription.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Fragment } from 'react'\nimport PropTypes from 'prop-types'\n\nconst MAX_SIZE_DESCRIPTION = 120\n\nconst ProductSummaryDescription = ({ descriptionClasses, description }) => {\n if (!description) return <Fragment />\n\n const descriptionTruncated =\n description.length > MAX_SIZE_DESCRIPTION\n ? `${description.substring(0, MAX_SIZE_DESCRIPTION)}...`\n : description\n\n return <span className={descriptionClasses}>{descriptionTruncated}</span>\n}\n\nProductSummaryDescription.propTypes = {\n /** Styles used in the description */\n\n descriptionClasses: PropTypes.string.isRequired,\n /** Description of the product */\n\n description: PropTypes.string,\n}\n\nexport default ProductSummaryDescription\n\n```"
}
] |
code_product-summary_23105ef2
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryBuyButton.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport BuyButton from 'vtex.store-components/BuyButton'\n// eslint-disable-next-line no-restricted-imports\nimport { equals, path } from 'ramda'\nimport classNames from 'classnames'\nimport { IOMessage } from 'vtex.native-types'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport displayButtonTypes from '../../utils/displayButtonTypes'\nimport productSummary from '../../productSummary.css'\n\nconst ProductSummaryBuyButton = ({\n product,\n displayBuyButton,\n isOneClickBuy,\n buyButtonText,\n isHovering,\n containerClass,\n}) => {\n const {\n hints: { mobile },\n } = useRuntime()\n\n const hoverBuyButton =\n equals(displayBuyButton, displayButtonTypes.DISPLAY_ALWAYS.value) ||\n !equals(displayBuyButton, displayButtonTypes.DISPLAY_ON_HOVER.value) ||\n (isHovering && !mobile)\n\n const showBuyButton =\n !equals(displayBuyButton, displayButtonTypes.DISPLAY_NONE.value) &&\n !(\n equals(displayBuyButton, displayButtonTypes.DISPLAY_ON_HOVER.value) &&\n mobile\n )\n\n const buyButtonClasses = classNames(\n `${productSummary.buyButton} center mw-100`,\n {\n [productSummary.isHidden]: !hoverBuyButton,\n }\n )\n\n // TODO: change ProductSummaryContext to have `selectedSku` field instead of `sku`\n const selectedItem = product.sku\n const selectedSeller = path(['seller'], selectedItem)\n const isAvailable =\n selectedSeller &&\n selectedSeller.commertialOffer &&\n selectedSeller.commertialOffer.AvailableQuantity > 0\n\n const skuItems = BuyButton.mapCatalogItemToCart({\n product,\n selectedItem,\n selectedSeller,\n selectedQuantity: 1,\n })\n\n return (\n showBuyButton && (\n <div className={containerClass}>\n <div className={buyButtonClasses}>\n <BuyButton\n available={isAvailable}\n skuItems={skuItems}\n isOneClickBuy={isOneClickBuy}\n >\n <IOMessage id={buyButtonText} />\n </BuyButton>\n </div>\n </div>\n )\n )\n}\n\nexport default ProductSummaryBuyButton\n\n```"
}
] |
code_product-summary_f36136a1
|
[
{
"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 product-summary/react/legacy/components/ProductQuantityStepper.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Component } from 'react'\n// eslint-disable-next-line no-restricted-imports\nimport { path } from 'ramda'\nimport PropTypes from 'prop-types'\nimport { NumericStepper, withToast } from 'vtex.styleguide'\nimport { Pixel } from 'vtex.pixel-manager/PixelContext'\nimport { debounce } from 'debounce'\nimport { injectIntl, intlShape } from 'react-intl'\nimport { graphql } from 'react-apollo'\nimport { parse } from 'graphql'\n\nimport compose from '../../utils/compose'\nimport { productShape } from '../../utils/propTypes'\n\nconst UPDATE_ITEMS_MUTATION = parse(`\n mutation updateItems($items: [MinicartItem]) {\n updateItems(items: $items) @client\n }\n`)\n\nconst UPDATE_LOCAL_ITEMS_MUTATION = parse(`\n mutation updateLocalItems($items: [MinicartItem]) {\n updateLocalItems(items: $items) @client\n }\n`)\n\nclass ProductQuantityStepper extends Component {\n static propTypes = {\n product: productShape.isRequired,\n onUpdateItemsState: PropTypes.func.isRequired,\n showToast: PropTypes.func,\n intl: intlShape,\n minicartItems: PropTypes.array,\n updateItems: PropTypes.func.isRequired,\n updateLocalItems: PropTypes.func.isRequired,\n push: PropTypes.func.isRequired,\n index: PropTypes.number,\n }\n\n state = {\n quantity: this.props.product.quantity,\n canIncrease: true,\n }\n\n pushPixelCartEvents = ({ isAdditionOfProd, product }) => {\n const updatedProduct = {\n skuId: path(['sku', 'itemId'], product),\n variant: path(['sku', 'name'], product),\n price: path(['assemblyOptions', 'parentPrice'], product),\n name: path(['productName'], product),\n quantity: path(['quantity'], product),\n productRefId: product.productRefId,\n brand: product.brand,\n category: product.category,\n }\n\n if (isAdditionOfProd) {\n this.props.push({\n event: 'addToCart',\n items: [updatedProduct],\n })\n } else {\n // removal of product\n this.props.push({\n event: 'removeFromCart',\n items: [updatedProduct],\n })\n }\n }\n\n componentDidUpdate = (prevProps) => {\n const {\n product: { quantity: prevQuantity },\n } = prevProps\n\n const {\n product: { quantity },\n showToast,\n intl,\n } = this.props\n\n // eslint-disable-next-line vtex/prefer-early-return\n if (prevQuantity !== quantity) {\n this.pushPixelCartEvents({\n isAdditionOfProd: prevQuantity < quantity,\n product: this.props.product,\n })\n // eslint-disable-next-line react/no-access-state-in-setstate\n const canIncrease = quantity === this.state.quantity\n\n this.setState({ quantity, canIncrease })\n if (!canIncrease) {\n showToast({\n message: intl.formatMessage({\n id: 'store/productSummary.quantity-error',\n }),\n })\n }\n }\n }\n\n handleOnChange = (e) => {\n e.stopPropagation()\n e.preventDefault()\n this.props.onUpdateItemsState(true)\n this.setState({ quantity: e.value }, () =>\n this.debouncedUpdate(this.state.quantity)\n )\n }\n\n updateItemQuantity = async (quantity) => {\n const { product, updateItems, updateLocalItems, index } = this.props\n\n this.setState({ canIncrease: true })\n const {\n sku: { itemId: id, seller = {} },\n cartIndex,\n } = product\n\n try {\n if (cartIndex != null) {\n await updateItems([\n {\n id,\n quantity,\n seller: seller.sellerId,\n index: cartIndex,\n },\n ])\n } else {\n await updateLocalItems([\n {\n id,\n quantity,\n seller: seller.sellerId,\n index,\n },\n ])\n }\n } catch (err) {\n // gone wrong, rollback to old quantity value\n console.error(err)\n }\n\n this.props.onUpdateItemsState(false)\n }\n\n debouncedUpdate = debounce(this.updateItemQuantity, 1000)\n\n render() {\n return (\n <NumericStepper\n lean\n size=\"small\"\n value={this.state.quantity}\n minValue={1}\n maxValue={this.state.canIncrease ? undefined : this.state.quantity}\n onChange={this.handleOnChange}\n />\n )\n }\n}\n\nconst withUpdateItemsMutation = graphql(UPDATE_ITEMS_MUTATION, {\n props: ({ mutate }) => ({\n updateItems: (items) => mutate({ variables: { items } }),\n }),\n})\n\nconst withUpdateLocalItemsMutation = graphql(UPDATE_LOCAL_ITEMS_MUTATION, {\n props: ({ mutate }) => ({\n updateLocalItems: (items) => mutate({ variables: { items } }),\n }),\n})\n\nexport default compose(\n Pixel,\n injectIntl,\n withToast,\n withUpdateItemsMutation,\n withUpdateLocalItemsMutation\n)(ProductQuantityStepper)\n\n```"
}
] |
code_product-summary_96379f77
|
[
{
"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 product-summary/react/legacy/components/ProductSummaryInline.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Component } from 'react'\nimport classNames from 'classnames'\nimport { Link } from 'vtex.render-runtime'\n\nimport AttachmentList from './AttachmentList'\nimport ProductImage from './ProductImage'\nimport ProductSummaryBuyButton from './ProductSummaryBuyButton'\nimport ProductSummaryPrice from './ProductSummaryPrice'\nimport ProductSummaryName from './ProductSummaryName'\nimport productSummary from '../../productSummary.css'\n\nclass ProductSummaryInline extends Component {\n render() {\n const {\n product,\n showBorders,\n handleMouseEnter,\n handleMouseLeave,\n actionOnClick,\n imageProps,\n nameProps,\n priceProps,\n buyButtonProps,\n inViewRef,\n listName,\n } = this.props\n\n const containerClasses = classNames(\n productSummary.container,\n productSummary.containerInlinePrice,\n 'overflow-hidden br3 h-100 w-100'\n )\n\n const summaryClasses = classNames(\n `${productSummary.element} ${productSummary.clearLink} pointer pt3 pb4 flex flex-column`,\n {\n 'bb b--muted-4 mh2 mh3-ns mt2': showBorders,\n }\n )\n\n const nameClasses = {\n containerClass: 'flex items-start justify-left tl w-90 t-mini pb2',\n brandNameClass: 't-body c-on-base',\n }\n\n const priceClasses = {\n containerClass: classNames('flex flex-column nr1', {\n [`${productSummary.priceContainer}`]: !showBorders,\n }),\n sellingPriceClass: 'dib ph2 t-body t-heading-5-ns',\n }\n\n const buyButtonClasses = {\n containerClass: `${productSummary.buyButtonContainer} pt3 w-100`,\n }\n\n return (\n <section\n className={containerClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={inViewRef}\n >\n <Link\n className={summaryClasses}\n page=\"store.product\"\n params={{\n slug: product && product.linkText,\n id: product && product.productId,\n __listName: listName,\n }}\n onClick={actionOnClick}\n >\n <article className=\"flex\">\n <div className={`${productSummary.imageContainer} db w-70`}>\n <ProductImage {...imageProps} />\n </div>\n <div\n className={`${productSummary.information} w-80 pb2 pl3 flex flex-wrap flex-column justify-between`}\n >\n <div className=\"flex flex-column\">\n <ProductSummaryName {...nameProps} {...nameClasses} />\n <AttachmentList product={product} />\n <div className=\"nr2\">\n <ProductSummaryPrice {...priceProps} {...priceClasses} />\n </div>\n </div>\n <div className=\"flex flex-column-reverse\">\n <ProductSummaryBuyButton\n {...buyButtonProps}\n {...buyButtonClasses}\n />\n </div>\n </div>\n </article>\n </Link>\n </section>\n )\n }\n}\n\nexport default ProductSummaryInline\n\n```"
}
] |
code_product-summary_9719f224
|
[
{
"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 product-summary/react/legacy/components/AttachmentList.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n// eslint-disable-next-line no-restricted-imports\nimport { pathOr, reject } from 'ramda'\n\nimport { productShape } from '../../utils/propTypes'\nimport RemovedAttachmentsList from '../../components/ProductSummaryAttachmentList/RemovedAttachmentsList'\nimport AddedAttachmentsList from '../../components/ProductSummaryAttachmentList/AddedAttachmentsList'\nimport styles from '../../productSummary.css'\n\nconst itemShouldHide = ({ item, extraQuantity }) =>\n extraQuantity === 0 && item.sellingPriceWithAssemblies === 0\n\nconst AttachmentList = ({ product }) => {\n const addedOptions = pathOr([], ['assemblyOptions', 'added'], product)\n const removedOptions = pathOr([], ['assemblyOptions', 'removed'], product)\n\n const filteredOption = reject(itemShouldHide, addedOptions)\n\n if (filteredOption.length === 0 && removedOptions.length === 0) {\n return null\n }\n\n return (\n <div className={`${styles.attachmentListContainer} pv2`}>\n <AddedAttachmentsList addedOptions={filteredOption} />\n <RemovedAttachmentsList removedOptions={removedOptions} />\n </div>\n )\n}\n\nAttachmentList.propTypes = {\n product: productShape,\n}\n\nexport default AttachmentList\n\n```"
}
] |
code_product-summary_34dc66a4
|
[
{
"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 product-summary/react/legacy/components/ProductImage.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\n// eslint-disable-next-line no-restricted-imports\nimport { compose, pathOr, path } from 'ramda'\nimport { CollectionBadges, DiscountBadge } from 'vtex.store-components'\n\nimport ImagePlaceholder from '../../components/ImagePlaceholder'\nimport { productShape } from '../../utils/propTypes'\nimport productSummary from '../../productSummary.css'\n\nconst maybeBadge = ({ listPrice, price, label }) => (shouldShow) => (\n component\n) => {\n if (shouldShow) {\n return (\n <DiscountBadge listPrice={listPrice} sellingPrice={price} label={label}>\n {component}\n </DiscountBadge>\n )\n }\n\n return component\n}\n\nconst maybeCollection = ({ productClusters }) => (shouldShow) => (\n component\n) => {\n if (shouldShow && productClusters && productClusters.length > 0) {\n const collections = productClusters.map((cl) => cl.name)\n\n return (\n <CollectionBadges collectionBadgesText={collections}>\n {component}\n </CollectionBadges>\n )\n }\n\n return component\n}\n\nconst ProductImage = ({\n product,\n showBadge,\n badgeText,\n showCollections,\n displayMode,\n}) => {\n const [error, setError] = useState(false)\n\n if (!path(['sku', 'image', 'imageUrl'], product) || error) {\n return <ImagePlaceholder cssHandle={productSummary.imagePlaceholder} />\n }\n\n const {\n productClusters,\n productName: name,\n sku: {\n image: { imageUrl },\n },\n } = product\n\n const imageClassName = classNames({\n [productSummary.imageNormal]: displayMode !== 'inline',\n [productSummary.imageInline]: displayMode === 'inline',\n })\n\n const commertialOffer = pathOr(\n {},\n ['sku', 'seller', 'commertialOffer'],\n product\n )\n\n const withBadge = maybeBadge({\n listPrice: commertialOffer.ListPrice,\n price: commertialOffer.Price,\n label: badgeText,\n })\n\n const withCollection = maybeCollection({ productClusters })\n const img = (\n <img\n className={imageClassName}\n src={imageUrl}\n alt={name}\n onError={() => setError(true)}\n />\n )\n\n return compose(withBadge(showBadge), withCollection(showCollections))(img)\n}\n\nProductImage.propTypes = {\n /** Product that owns the informations */\n product: productShape,\n /** Set the discount badge's visibility */\n showBadge: PropTypes.bool,\n /** Text shown on badge */\n badgeText: PropTypes.string,\n /** Defines if the collection badges are shown */\n showCollections: PropTypes.bool,\n /** Display mode of the summary */\n displayMode: PropTypes.string,\n}\n\nexport default ProductImage\n\n```"
}
] |
code_product-summary_163fbd6b
|
[
{
"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 product-summary/react/components/ProductSummaryAddToListButton/ProductSummaryAddToListButton.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { useMemo } from 'react'\nimport { ExtensionPoint } from 'vtex.render-runtime'\n// eslint-disable-next-line no-restricted-imports\nimport { path } from 'ramda'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\nimport { useCssHandles } from 'vtex.css-handles'\n\n// TODO: change ProductSummaryContext to have `selectedSku` field instead of `sku`\nconst getSkuId = path(['sku', 'itemId'])\nconst getProductId = path(['productId'])\nconst CSS_HANDLES = ['addToListBtn']\n\n// This avoids triggering the link to the product page\nconst captureClick = (e) => {\n e.preventDefault()\n e.stopPropagation()\n}\n\nfunction ProductSummaryAddToListButton() {\n const handles = useCssHandles(CSS_HANDLES)\n const productContext = ProductSummaryContext.useProductSummary()\n\n const skuId = getSkuId(productContext.product)\n const productId = getProductId(productContext.product)\n\n const productProp = useMemo(\n () => ({\n skuId,\n productId,\n quantity: 1,\n }),\n [skuId, productId]\n )\n\n return (\n <div\n role=\"button\"\n tabIndex=\"-1\"\n onKeyDown={() => {}}\n className={`${handles.addToListBtn} absolute z-1`}\n onClick={captureClick}\n >\n <ExtensionPoint id=\"addon-summary-btn\" product={productProp} />\n </div>\n )\n}\n\nexport default ProductSummaryAddToListButton\n\n```"
}
] |
code_product-summary_da33c642
|
[
{
"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 product-summary/react/components/ProductSummaryAttachmentList/AttachmentChildren.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport AddedAttachmentsList from './AddedAttachmentsList'\nimport RemovedAttachmentsList from './RemovedAttachmentsList'\n\nconst CSS_HANDLES = ['attachmentChildrenContainer']\n\nconst AttachmentChildren = ({ addedOptions, removedOptions }) => {\n const handles = useCssHandles(CSS_HANDLES)\n\n if (addedOptions.length === 0 && removedOptions.length === 0) {\n return null\n }\n\n return (\n <div className={`${handles.attachmentChildrenContainer} ml3`}>\n <AddedAttachmentsList addedOptions={addedOptions} showItemPrice={false} />\n <RemovedAttachmentsList removedOptions={removedOptions} />\n </div>\n )\n}\n\nexport default AttachmentChildren\n\n```"
}
] |
code_product-summary_43c38d5d
|
[
{
"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 product-summary/react/components/ProductSummaryAttachmentList/AttachmentItem.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { memo } from 'react'\nimport { string, number, object, bool } from 'prop-types'\nimport { ProductPrice } from 'vtex.store-components'\n// eslint-disable-next-line no-restricted-imports\nimport { reject } from 'ramda'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport AttachmentChildren from './AttachmentChildren'\n\nconst CSS_HANDLES = [\n 'attachmentItemContainer',\n 'attachmentItem',\n 'attachmentItemProductText',\n]\n\nconst itemShouldHide = ({ item, extraQuantity }) =>\n extraQuantity === 0 && item.sellingPriceWithAssemblies === 0\n\nconst AttachmentItem = ({\n productText,\n price,\n assemblyOptions,\n showItemPrice,\n}) => {\n const { handles } = useCssHandles(CSS_HANDLES)\n const childrenAdded = (assemblyOptions && assemblyOptions.added) || []\n const childrenRemoved = (assemblyOptions && assemblyOptions.removed) || []\n const filteredChildrenAdded = reject(itemShouldHide, childrenAdded)\n const parentColor =\n filteredChildrenAdded.length > 0 || childrenRemoved.length > 0\n ? 'c-on-base'\n : 'c-muted-2'\n\n return (\n <div className={`${handles.attachmentItemContainer} flex flex-column pv1`}>\n <div\n className={`${handles.attachmentItem} flex items-center justify-between`}\n >\n <span\n className={`${handles.attachmentItemProductText} t-small ${parentColor} tl pr3`}\n >\n {productText}\n </span>\n {price != null && showItemPrice && price > 0 && (\n <ProductPrice\n sellingPrice={price}\n sellingPriceContainerClass=\"c-on-base\"\n sellingPriceLabelClass=\"dib\"\n sellingPriceClass=\"dib t-small c-muted-2\"\n showListPrice={false}\n showLabels={false}\n showInstallments={false}\n />\n )}\n </div>\n <AttachmentChildren\n addedOptions={filteredChildrenAdded}\n removedOptions={childrenRemoved}\n />\n </div>\n )\n}\n\nAttachmentItem.propTypes = {\n productText: string.isRequired,\n price: number,\n assemblyOptions: object,\n showItemPrice: bool,\n}\n\nexport default memo(AttachmentItem)\n\n```"
}
] |
code_product-summary_0c21e163
|
[
{
"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 product-summary/react/components/ProductSummaryAttachmentList/RemovedAttachmentsList.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Fragment } from 'react'\nimport { intlShape, injectIntl } from 'react-intl'\nimport { arrayOf } from 'prop-types'\n\nimport AttachmentItem from './AttachmentItem'\nimport { removedOptionShape } from '../../utils/propTypes'\n\nconst wasCompletelyRemoved = ({ removedQuantity, initialQuantity }) =>\n removedQuantity === 1 && removedQuantity === initialQuantity\n\nconst formatAttachmentName = (missingOption, intl) => {\n const { name, removedQuantity } = missingOption\n\n if (wasCompletelyRemoved(missingOption)) {\n return intl.formatMessage(\n { id: 'store/productSummary.missingOptionName' },\n { name }\n )\n }\n\n const extraParams = {\n sign: '-',\n name,\n quantity: removedQuantity,\n }\n\n return intl.formatMessage(\n { id: 'store/productSummary.attachmentName' },\n extraParams\n )\n}\n\nconst RemovedAttachmentsList = ({ removedOptions, intl }) => {\n if (removedOptions.length === 0) {\n return null\n }\n\n return (\n <Fragment>\n {removedOptions.map((removedOption) => {\n const productText = formatAttachmentName(removedOption, intl)\n\n return <AttachmentItem productText={productText} key={productText} />\n })}\n </Fragment>\n )\n}\n\nRemovedAttachmentsList.propTypes = {\n removedOptions: arrayOf(removedOptionShape).isRequired,\n intl: intlShape,\n}\n\nexport default injectIntl(RemovedAttachmentsList)\n\n```"
}
] |
code_product-summary_1aa87bd1
|
[
{
"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 product-summary/react/components/ProductSummaryAttachmentList/AttachmentList.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n// eslint-disable-next-line no-restricted-imports\nimport { reject } from 'ramda'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { ProductSummaryContext } from 'vtex.product-summary-context'\n\nimport RemovedAttachmentsList from './RemovedAttachmentsList'\nimport AddedAttachmentsList from './AddedAttachmentsList'\n\nconst CSS_HANDLES = ['attachmentListContainer']\n\nconst itemShouldHide = ({ item, extraQuantity }) =>\n extraQuantity === 0 && item.sellingPriceWithAssemblies === 0\n\nconst AttachmentList = () => {\n const { product } = ProductSummaryContext.useProductSummary()\n const { handles } = useCssHandles(CSS_HANDLES)\n const addedOptions = product?.assemblyOptions?.added ?? []\n const removedOptions = product?.assemblyOptions?.removed ?? []\n\n const filteredOption = reject(itemShouldHide, addedOptions)\n\n if (filteredOption.length === 0 && removedOptions.length === 0) {\n return null\n }\n\n return (\n <div className={`${handles.attachmentListContainer} pv2`}>\n <AddedAttachmentsList addedOptions={filteredOption} />\n <RemovedAttachmentsList removedOptions={removedOptions} />\n </div>\n )\n}\n\nexport default AttachmentList\n\n```"
}
] |
code_product-summary_99ad1059
|
[
{
"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 product-summary/react/components/ProductSummaryAttachmentList/AddedAttachmentsList.js from the product-summary VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, { Fragment } from 'react'\nimport { arrayOf, bool } from 'prop-types'\nimport { FormattedMessage } from 'react-intl'\n\nimport AttachmentItem from './AttachmentItem'\nimport { CHOICE_TYPES } from '../../utils/attachmentHelper'\nimport { addedOptionShape } from '../../utils/propTypes'\n\nconst formatAttachmentName = (option) => (\n <FormattedMessage\n id=\"store/productSummary.attachmentName\"\n values={{\n sign: '+',\n name: option.item.name,\n quantity: option.normalizedQuantity,\n }}\n />\n)\n\nconst AddedAttachmentsList = ({ addedOptions, showItemPrice }) => {\n if (addedOptions.length === 0) {\n return null\n }\n\n return (\n <Fragment>\n {addedOptions.map((option) => {\n const isMultiple = option.choiceType === CHOICE_TYPES.MULTIPLE\n const productText = isMultiple\n ? formatAttachmentName(option)\n : option.item.name\n\n return (\n <AttachmentItem\n productText={productText}\n price={\n option.item.sellingPriceWithAssemblies * option.normalizedQuantity\n }\n key={`${option.item.name}-${option.choiceType}`}\n assemblyOptions={option.item.assemblyOptions}\n showItemPrice={showItemPrice}\n />\n )\n })}\n </Fragment>\n )\n}\n\nAddedAttachmentsList.defaultProps = {\n showItemPrice: true,\n}\n\nAddedAttachmentsList.propTypes = {\n addedOptions: arrayOf(addedOptionShape).isRequired,\n showItemPrice: bool,\n}\n\nexport default AddedAttachmentsList\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.