id
stringlengths
12
53
messages
listlengths
3
3
code_admin-list_45c1e3b5
[ { "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 admin-list/react/queries/searchListsRaw.gql from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery searchListsRaw(\n $page: Int!\n $pageSize: Int!\n $filter: ListsFiltersInput\n $sorting: ListsSortingInput\n) {\n searchListsRaw(\n page: $page\n pageSize: $pageSize\n filters: $filter\n sorting: $sorting\n ) {\n data {\n id\n listType\n name\n active\n public\n otherName\n ownerName\n ownerEmail\n image\n backgroundImage\n quantityPurchased\n valuePurchased\n eventDate\n createdIn\n }\n pagination {\n page\n pageSize\n total\n }\n totalizer {\n lists\n purchase\n }\n }\n}\n\n```" } ]
code_admin-list_dc2acffd
[ { "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 admin-list/react/provider/providerInterface.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useState } from 'react'\n\nimport { ContextInterface } from '../hooks/useInterface'\n\nconst ProviderInterface: FC = (props) => {\n const [searchEmailFilter, setSearchEmailFilter] = useState<string>()\n const [tableLists, setTableLists] = useState(false)\n const [infoUserList, setInfoUserList] = useState<TotalizerListsUsers>()\n\n return (\n <ContextInterface.Provider\n value={{\n searchEmailFilter,\n setSearchEmailFilter,\n tableLists,\n setTableLists,\n infoUserList,\n setInfoUserList,\n }}\n >\n {props.children}\n </ContextInterface.Provider>\n )\n}\n\nexport default ProviderInterface\n\n```" } ]
code_admin-list_7198d281
[ { "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 admin-list/react/provider/providerLists.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { useLazyQuery } from 'react-apollo'\nimport { useIntl } from 'react-intl'\nimport {\n Button,\n experimental_useDatePickerState,\n experimental_useFilterState,\n IconEye,\n Tag,\n Tooltip,\n useDataGridState,\n useDataViewState,\n useModalState,\n usePaginationState,\n useSearchState,\n} from '@vtex/admin-ui'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport searchListsRaw from '../queries/searchListsRaw.gql'\nimport { ContextLists } from '../hooks/useLists'\nimport {\n columns,\n messages,\n filterDate,\n filterStatus,\n} from '../utils/definedMessages'\nimport { ITEMS_PER_PAGE } from '../utils/constants'\nimport { useInterface } from '../hooks/useInterface'\nimport {\n dictionaryDate,\n dictionaryStatus,\n today,\n tomorrow,\n} from '../utils/dictionary'\n\nconst ProviderLists: FC = (props) => {\n const { culture } = useRuntime()\n const useFilterState = experimental_useFilterState\n const useDatePickerState = experimental_useDatePickerState\n const { formatMessage } = useIntl()\n const [valuesLists, setValuesLists] = useState<ValuesLists[]>()\n const [itemsLists, setItemsLists] = useState<ItemsLists[]>()\n const [totalPagination, setTotalPagination] = useState<number>(0)\n const [selectedDate, setSelectedDate] = useState<string | null>()\n const [selectedStatus, setSelectedStatus] = useState<string | null>()\n const [minimunDate, setMinimunDate] = useState(new Date())\n const [searchListRawQuery, { data: dataSearchListsRaw, loading }] =\n useLazyQuery(searchListsRaw, {\n fetchPolicy: 'cache-and-network',\n })\n\n const pagination = usePaginationState({\n pageSize: ITEMS_PER_PAGE,\n })\n\n const {\n getInputProps,\n value: search,\n debouncedValue,\n setValue,\n } = useSearchState({\n timeout: 500,\n })\n\n useEffect(() => {\n pagination.paginate({\n type: 'setTotal',\n total: totalPagination,\n })\n }, [totalPagination])\n\n const modalState = useModalState({ visible: false })\n\n const { searchEmailFilter, infoUserList, setInfoUserList, tableLists } =\n useInterface()\n\n const datePersonalizeInitial = useDatePickerState({\n minValue: {\n year: 2022,\n month: 0,\n day: 1,\n },\n maxValue: {\n year: tomorrow.getFullYear(),\n month: tomorrow.getMonth(),\n day: tomorrow.getDate(),\n },\n })\n\n const datePersonalizeFinal = useDatePickerState({\n minValue: {\n year: minimunDate.getFullYear(),\n month: minimunDate.getMonth(),\n day: minimunDate.getDate(),\n },\n maxValue: {\n year: tomorrow.getFullYear(),\n month: tomorrow.getMonth(),\n day: tomorrow.getDate(),\n },\n })\n\n useEffect(() => {\n setMinimunDate(new Date(datePersonalizeInitial.calendarState.dateValue))\n }, [datePersonalizeInitial.calendarState.dateValue])\n\n const dateOptions = [\n { id: '1', label: formatMessage(filterDate.today), value: 1 },\n { id: '2', label: formatMessage(filterDate.yesterday), value: 2 },\n { id: '3', label: formatMessage(filterDate.thisWeek), value: 3 },\n { id: '4', label: formatMessage(filterDate.lastWeek), value: 4 },\n { id: '5', label: formatMessage(filterDate.thisMonth), value: 5 },\n { id: '6', label: formatMessage(filterDate.lastMonth), value: 6 },\n { id: '7', label: formatMessage(filterDate.thisYear), value: 7 },\n { id: '8', label: formatMessage(filterDate.lastYear), value: 8 },\n { id: '9', label: formatMessage(filterDate.customizer), value: 9 },\n ]\n\n const dateState = useFilterState({\n items: dateOptions,\n onChange: ({ selected }) => setSelectedDate(selected),\n label: formatMessage(filterDate.date),\n })\n\n const statusOptions = [\n { id: '1', label: formatMessage(filterStatus.active), value: 1 },\n { id: '2', label: formatMessage(filterStatus.disabled), value: 2 },\n ]\n\n const statusState = useFilterState({\n items: statusOptions,\n onChange: ({ selected }) => setSelectedStatus(selected),\n label: formatMessage(filterStatus.status),\n })\n\n useEffect(() => {\n dateState.onClear()\n statusState.onClear()\n setValue('')\n }, [tableLists])\n\n useEffect(() => {\n if (selectedDate === '9') {\n modalState.setVisible(true)\n }\n }, [selectedDate])\n\n useEffect(() => {\n const filter = {\n name: debouncedValue ?? null,\n ownerEmail: searchEmailFilter ?? null,\n eventDateRange: selectedStatus ? dictionaryStatus[selectedStatus] : null,\n createdDateRange: selectedDate ? dictionaryDate[selectedDate] : null,\n }\n\n searchListRawQuery({\n variables: {\n filter,\n page: pagination.currentPage,\n pageSize: ITEMS_PER_PAGE,\n },\n })\n }, [\n debouncedValue,\n selectedDate,\n pagination.currentPage,\n selectedStatus,\n infoUserList?.ownerEmail,\n searchEmailFilter,\n ])\n\n function salveDatePersonalizate() {\n dictionaryDate[9] = {\n startDate: new Date(\n datePersonalizeInitial.calendarState.dateValue\n ).toISOString(),\n endDate: new Date(\n datePersonalizeFinal.calendarState.dateValue\n ).toISOString(),\n }\n modalState.setVisible(false)\n }\n\n const view = useDataViewState()\n\n const gridLists = useDataGridState({\n view,\n columns: [\n {\n id: 'list',\n width: '2%',\n resolver: {\n type: 'plain',\n render: ({ data }) => (\n <Tooltip\n label={formatMessage(columns.tooltipList)}\n placement=\"right\"\n >\n <Button\n icon={<IconEye />}\n variant=\"tertiary\"\n onClick={() =>\n window.open(`${window.location.origin}/lists/${data}/guest`)\n }\n />\n </Tooltip>\n ),\n },\n },\n {\n id: 'title',\n header: formatMessage(columns.title),\n sortable: true,\n width: '50%',\n resolver: {\n type: 'plain',\n render: ({ data }) => <b>{data}</b>,\n },\n compare: (a, b) => b.title.localeCompare(a.title),\n },\n {\n id: 'bought',\n header: formatMessage(columns.bought),\n resolver: {\n type: 'currency',\n locale: culture.locale,\n currency: culture.currency,\n },\n },\n {\n id: 'validate',\n header: formatMessage(columns.validate),\n resolver: {\n type: 'date',\n locale: culture.locale,\n options: {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n },\n },\n },\n {\n id: 'status',\n header: formatMessage(columns.status),\n resolver: {\n type: 'plain',\n render: ({ data }) =>\n data ? (\n <Tag label={formatMessage(messages.active)} palette=\"green\" />\n ) : (\n <Tag label={formatMessage(messages.disabled)} palette=\"red\" />\n ),\n },\n sortable: true,\n compare: (a, b) => (b.status === a.status ? 0 : a.status ? -1 : 1),\n },\n ],\n items: itemsLists,\n length: ITEMS_PER_PAGE,\n })\n\n useEffect(() => {\n const valuesSearchListsRaw: ValuesLists[] =\n dataSearchListsRaw?.searchListsRaw?.data\n\n setValuesLists(valuesSearchListsRaw)\n\n if (\n dataSearchListsRaw?.searchListsRaw?.pagination?.total !== undefined &&\n pagination.total !== dataSearchListsRaw?.searchListsRaw?.pagination?.total\n ) {\n setTotalPagination(dataSearchListsRaw?.searchListsRaw?.pagination?.total)\n }\n\n const totalizer = dataSearchListsRaw?.searchListsRaw?.totalizer\n\n setInfoUserList({ ...infoUserList, ...totalizer })\n }, [dataSearchListsRaw])\n\n useEffect(() => {\n const valueItems = valuesLists?.map((item) => {\n return {\n id: item.id ?? '',\n list: item.id ?? '',\n title: item.name ?? '',\n validate: item?.eventDate\n ? new Date(item.eventDate).valueOf()\n : new Date(2000, 1, 1).valueOf(),\n bought: item?.valuePurchased ? item.valuePurchased / 100 : 0,\n status: item?.eventDate ? new Date(item.eventDate) >= today : false,\n }\n })\n\n setItemsLists(valueItems)\n }, [valuesLists])\n\n useEffect(() => {\n if (loading && view.status !== 'loading') {\n view.setStatus({\n type: 'loading',\n })\n } else {\n view.setStatus({\n type: 'ready',\n })\n }\n }, [loading])\n\n return (\n <ContextLists.Provider\n value={{\n gridLists,\n view,\n dateState,\n statusState,\n search,\n getInputProps,\n debouncedValue,\n modalState,\n datePersonalizeInitial,\n datePersonalizeFinal,\n salveDatePersonalizate,\n pagination,\n }}\n >\n {props.children}\n </ContextLists.Provider>\n )\n}\n\nexport default ProviderLists\n\n```" } ]
code_admin-list_9004e9e3
[ { "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 admin-list/react/provider/providerUser.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC, SyntheticEvent } from 'react'\nimport React, { useEffect, useState, useMemo } from 'react'\nimport { useLazyQuery } from 'react-apollo'\nimport { useIntl } from 'react-intl'\nimport {\n Tag,\n useDataGridState,\n useDataViewState,\n IconArrowUpRight,\n useSearchState,\n Tooltip,\n Button,\n usePaginationState,\n} from '@vtex/admin-ui'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport searchGiftCards from '../queries/searchGiftCards.gql'\nimport searchUser from '../queries/searchUser.gql'\nimport searchListUser from '../queries/searchListUser.gql'\nimport { ContextUser } from '../hooks/useUser'\nimport { columns, messages } from '../utils/definedMessages'\nimport { ITEMS_PER_PAGE } from '../utils/constants'\nimport { useInterface } from '../hooks/useInterface'\n\ninterface Props {\n children?: React.ReactNode\n}\n\nconst ProviderUser: FC = (props: Props) => {\n const { culture } = useRuntime()\n const [valuesGiftCard, setValuesGiftCard] = useState<ValuesGiftCard[]>()\n const [valuesUser, setValuesUser] = useState<ValuesUser[]>()\n const [valuesListsUser, setValuesListsUser] = useState<ValuesListsUsers[]>()\n const [itemsListsUsers, setItemsListsUsers] = useState<ItemsListsUsers[]>()\n const [emailFilter, setEmailFilter] = useState<string[]>()\n const [totalPagination, setTotalPagination] = useState<number>(0)\n const [emailFilterGiftCard, setEmailFilterGiftCard] = useState<string>()\n const pagination = usePaginationState({\n pageSize: ITEMS_PER_PAGE,\n total: 0,\n })\n\n useEffect(() => {\n pagination.paginate({\n type: 'setTotal',\n total: totalPagination,\n })\n }, [totalPagination])\n\n const {\n getInputProps,\n value: search,\n debouncedValue,\n setValue,\n } = useSearchState({\n timeout: 500,\n })\n\n const [\n searchListUserQuery,\n { data: dataSearchListsUser, loading: loadingSearchListUser },\n ] = useLazyQuery(searchListUser, {\n fetchPolicy: 'cache-and-network',\n })\n\n const [\n searchGiftCardQuery,\n { data: dataSearchGiftCards, loading: loadingSearchGiftCard },\n ] = useLazyQuery(searchGiftCards, {\n fetchPolicy: 'cache-and-network',\n })\n\n const [\n searchUsersQuery,\n { data: dataSearchUser, loading: loadingSearchUser },\n ] = useLazyQuery(searchUser, {\n fetchPolicy: 'cache-and-network',\n })\n\n const view = useDataViewState()\n\n const { formatMessage } = useIntl()\n\n const { setTableLists, setSearchEmailFilter, setInfoUserList, tableLists } =\n useInterface()\n\n function openTableList(event: SyntheticEvent, email: any) {\n event.preventDefault()\n setTableLists(true)\n setSearchEmailFilter(email)\n const valueUser = valuesListsUser?.find(\n (element) => element.ownerEmail === email\n )\n\n const valueGift = valuesGiftCard?.find((element) => element.email === email)\n\n if (valueUser !== undefined) {\n setInfoUserList({\n ...valueUser,\n ...{ quantityAlreadyInGiftCard: valueGift?.quantityAlreadyInGiftCard },\n })\n }\n }\n\n const gridUsers = useDataGridState({\n view,\n columns: [\n {\n id: 'table',\n width: '2%',\n resolver: {\n type: 'plain',\n render: ({ data }) => (\n <Tooltip\n label={formatMessage(columns.tooltipUser)}\n placement=\"right\"\n >\n <Button\n icon={<IconArrowUpRight />}\n variant=\"tertiary\"\n onClick={(event: SyntheticEvent) => openTableList(event, data)}\n />\n </Tooltip>\n ),\n },\n },\n {\n id: 'owner',\n header: formatMessage(columns.owner),\n resolver: {\n type: 'plain',\n render: ({ data }: { data: any }) =>\n data ? (\n <>\n <b>{data.ownerName}</b>\n <p>{data.ownerEmail}</p>\n </>\n ) : undefined,\n },\n },\n {\n id: 'lists',\n header: formatMessage(columns.lists),\n },\n {\n id: 'bought',\n header: formatMessage(columns.bought),\n resolver: {\n type: 'currency',\n locale: culture.locale,\n currency: culture.currency,\n },\n },\n {\n id: 'converted',\n header: formatMessage(columns.converted),\n resolver: {\n type: 'currency',\n locale: culture.locale,\n currency: culture.currency,\n },\n },\n {\n id: 'status',\n header: formatMessage(columns.status),\n resolver: {\n type: 'plain',\n render: ({ data }) =>\n data ? (\n <Tag label={formatMessage(messages.active)} palette=\"green\" />\n ) : (\n <Tag label={formatMessage(messages.disabled)} palette=\"red\" />\n ),\n },\n },\n ],\n items: itemsListsUsers,\n length: ITEMS_PER_PAGE,\n })\n\n const loading = useMemo(() => {\n return loadingSearchGiftCard || loadingSearchUser || loadingSearchListUser\n }, [loadingSearchGiftCard, loadingSearchListUser, loadingSearchUser])\n\n useEffect(() => {\n if (loading && view.status !== 'loading') {\n view.setStatus({\n type: 'loading',\n })\n } else {\n view.setStatus({\n type: 'ready',\n })\n }\n }, [loading])\n\n useEffect(() => {\n const valuesSearchListsUser: ValuesListsUsers[] =\n dataSearchListsUser?.searchListUser\n\n setValuesListsUser(valuesSearchListsUser)\n }, [dataSearchListsUser])\n\n useEffect(() => {\n const valuesSearchGiftCards: ValuesGiftCard[] =\n dataSearchGiftCards?.searchGiftCards?.data\n\n setValuesGiftCard(valuesSearchGiftCards)\n }, [dataSearchGiftCards])\n\n useEffect(() => {\n setValuesUser(dataSearchUser?.allUsers?.data ?? undefined)\n\n if (\n dataSearchUser?.allUsers?.pagination?.total !== undefined &&\n pagination.total !== dataSearchUser?.allUsers?.pagination?.total\n ) {\n setTotalPagination(dataSearchUser?.allUsers?.pagination?.total)\n }\n }, [dataSearchUser])\n\n useEffect(() => {\n if (valuesUser !== undefined && valuesUser.length > 0) {\n const filter: string[] = []\n\n filter[0] = valuesUser[0].email\n let filterGift = valuesUser[0].email\n\n for (let index = 1; index < valuesUser.length; index++) {\n filterGift += ` OR email=${valuesUser[index].email}`\n filter[index] = valuesUser[index].email\n }\n\n setEmailFilter(filter)\n setEmailFilterGiftCard(filterGift)\n }\n }, [valuesUser])\n\n useEffect(() => {\n if (emailFilter) {\n searchListUserQuery({\n variables: {\n filter: emailFilter,\n },\n })\n\n searchGiftCardQuery({\n variables: {\n page: pagination.currentPage,\n pageSize: ITEMS_PER_PAGE,\n filter: { email: emailFilterGiftCard },\n sorting: { field: 'email', order: 'ASC' },\n },\n })\n }\n }, [emailFilter, emailFilterGiftCard])\n\n useEffect(() => {\n const valueItems = valuesListsUser?.map((item) => {\n const valueGift = valuesGiftCard?.find(\n (element) => element.email === item.ownerEmail\n )\n\n return {\n table: item.ownerEmail ?? '',\n id: item.id ?? '',\n owner: item?.ownerEmail\n ? { ownerEmail: item.ownerEmail, ownerName: item.ownerName }\n : '',\n lists: item.lists ?? 0,\n bought: item?.purchase ? item.purchase / 100 : 0,\n converted: valueGift ? valueGift.quantityAlreadyInGiftCard : 0,\n status: item.status ?? false,\n }\n })\n\n setItemsListsUsers(valueItems)\n }, [valuesListsUser, valuesGiftCard])\n\n useEffect(() => {\n const filter = debouncedValue ? { email: debouncedValue } : null\n\n setItemsListsUsers(undefined)\n searchUsersQuery({\n variables: {\n filter,\n page: pagination.currentPage,\n pageSize: ITEMS_PER_PAGE,\n },\n })\n }, [debouncedValue, pagination.currentPage])\n\n useEffect(() => {\n setValue('')\n }, [tableLists])\n\n return (\n <ContextUser.Provider\n value={{\n gridUsers,\n view,\n search,\n getInputProps,\n debouncedValue,\n pagination,\n }}\n >\n {props.children}\n </ContextUser.Provider>\n )\n}\n\nexport default ProviderUser\n\n```" } ]
code_admin-list_061ce44c
[ { "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 admin-list/react/utils/dictionary.ts from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const today = new Date(new Date().setHours(0, 0, 0, 0))\n\nexport const dictionaryStatus: { [key: string]: DictionaryType } = {\n '1': {\n startDate: today.toISOString(),\n endDate: '2099-01-01T00:00',\n },\n '2': {\n startDate: '2022-01-01T00:00',\n endDate: today.toISOString(),\n },\n}\n\nconst todayUTC = today.valueOf()\nconst oneDay = 86400000\n\nexport const yesterday = new Date(todayUTC - oneDay)\n\nexport const tomorrow = new Date(todayUTC + oneDay)\n\nfunction getMonday(d: Date) {\n d = new Date(d)\n const day = d.getDay()\n const diff = d.getDate() - day + (day === 0 ? -6 : 0)\n\n return new Date(new Date(d.setDate(diff)).setHours(0, 0, 0, 0))\n}\n\nconst thisWeek = getMonday(new Date())\n\nexport const dictionaryDate: { [key: string]: DictionaryType } = {\n '1': {\n startDate: today.toISOString(),\n endDate: new Date().toISOString(),\n },\n '2': {\n startDate: yesterday.toISOString(),\n endDate: today.toISOString(),\n },\n '3': {\n startDate: thisWeek.toISOString(),\n endDate: new Date().toISOString(),\n },\n '4': {\n startDate: new Date(thisWeek.valueOf() - oneDay * 7).toISOString(),\n endDate: thisWeek.toISOString(),\n },\n '5': {\n startDate: new Date(\n today.getFullYear(),\n today.getMonth(),\n 1,\n 0,\n 0,\n 0,\n 0\n ).toISOString(),\n endDate: new Date().toISOString(),\n },\n '6': {\n startDate: new Date(\n today.getFullYear(),\n today.getMonth() - 1,\n 1,\n 0,\n 0,\n 0,\n 0\n ).toISOString(),\n endDate: new Date(\n today.getFullYear(),\n today.getMonth(),\n 1,\n 0,\n 0,\n 0,\n 0\n ).toISOString(),\n },\n '7': {\n startDate: new Date(today.getFullYear(), 0, 1, 0, 0, 0, 0).toISOString(),\n endDate: new Date().toISOString(),\n },\n '8': {\n startDate: new Date(\n today.getFullYear() - 1,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0\n ).toISOString(),\n endDate: new Date(\n today.getFullYear() - 1,\n 11,\n 31,\n 0,\n 0,\n 0,\n 0\n ).toISOString(),\n },\n '9': {\n startDate: '',\n endDate: '',\n },\n}\n\n```" } ]
code_admin-list_f586e132
[ { "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 admin-list/react/utils/definedMessages.ts from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { defineMessages } from 'react-intl'\n\nexport const messages = defineMessages({\n titleUser: {\n id: 'admin/interface.title.user',\n },\n active: {\n id: 'admin/interface.active',\n },\n disabled: {\n id: 'admin/interface.disabled',\n },\n})\n\nexport const columns = defineMessages({\n title: {\n id: 'admin/interface.columns.title',\n },\n user: {\n id: 'admin/interface.columns.user',\n },\n validate: {\n id: 'admin/interface.columns.validate',\n },\n bought: {\n id: 'admin/interface.columns.bought',\n },\n converted: {\n id: 'admin/interface.columns.converted',\n },\n status: {\n id: 'admin/interface.columns.status',\n },\n owner: {\n id: 'admin/interface.columns.owner',\n },\n lists: {\n id: 'admin/interface.columns.lists',\n },\n tooltipUser: {\n id: 'admin/interface.columns.tooltip.user',\n },\n tooltipList: {\n id: 'admin/interface.columns.tooltip.list',\n },\n})\n\nexport const table = defineMessages({\n searchUser: {\n id: 'admin/interface.search.user',\n },\n searchList: {\n id: 'admin/interface.search.list',\n },\n paginationPreposition: {\n id: 'admin/interface.pagination.preposition',\n },\n paginationSubject: {\n id: 'admin/interface.pagination.subject',\n },\n paginationPrevious: {\n id: 'admin/interface.pagination.previous',\n },\n paginationNext: {\n id: 'admin/interface.pagination.next',\n },\n empty: {\n id: 'admin/interface.empty',\n },\n})\n\nexport const totalizer = defineMessages({\n listsCreated: {\n id: 'admin/interface.totalizer.lists.created',\n },\n bought: {\n id: 'admin/interface.totalizer.bought',\n },\n converted: {\n id: 'admin/interface.totalizer.converted',\n },\n info: {\n id: 'admin/interface.totalizer.info',\n },\n})\n\nexport const filterDate = defineMessages({\n date: {\n id: 'admin/interface.filter.date',\n },\n today: {\n id: 'admin/interface.filter.date.today',\n },\n yesterday: {\n id: 'admin/interface.filter.date.yesterday',\n },\n thisWeek: {\n id: 'admin/interface.filter.date.this.week',\n },\n lastWeek: {\n id: 'admin/interface.filter.date.last.week',\n },\n thisMonth: {\n id: 'admin/interface.filter.date.this.month',\n },\n lastMonth: {\n id: 'admin/interface.filter.date.last.month',\n },\n thisYear: {\n id: 'admin/interface.filter.date.this.year',\n },\n lastYear: {\n id: 'admin/interface.filter.date.last.year',\n },\n customizer: {\n id: 'admin/interface.filter.date.customizer',\n },\n})\n\nexport const filterStatus = defineMessages({\n status: {\n id: 'admin/interface.filter.status',\n },\n active: {\n id: 'admin/interface.filter.status.active',\n },\n disabled: {\n id: 'admin/interface.filter.status.disabled',\n },\n})\n\nexport const modal = defineMessages({\n dateInitial: {\n id: 'admin/interface.modal.date.initial',\n },\n dateFinal: {\n id: 'admin/interface.modal.date.final',\n },\n title: {\n id: 'admin/interface.modal.title',\n },\n ariaLabel: {\n id: 'admin/interface.modal.aria.label',\n },\n confirm: {\n id: 'admin/interface.modal.confirm',\n },\n})\n\n```" } ]
code_admin-list_0d97b160
[ { "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 admin-list/react/components/Title.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { tag } from '@vtex/admin-ui'\nimport type { FC } from 'react'\nimport React from 'react'\n\nimport { useInterface } from '../hooks/useInterface'\n\nconst TitleArea: FC = () => {\n const { infoUserList } = useInterface()\n\n return (\n <tag.div>\n <tag.p>\n <b>{infoUserList?.ownerName}</b>\n <br />\n {infoUserList?.ownerEmail}\n </tag.p>\n </tag.div>\n )\n}\n\nexport default TitleArea\n\n```" } ]
code_admin-list_c8781d26
[ { "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 admin-list/react/components/Totalizer.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport {\n Flex,\n Text,\n Set,\n Card,\n Divider,\n Tooltip,\n IconWarningCircle,\n} from '@vtex/admin-ui'\nimport React from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport { useInterface } from '../hooks/useInterface'\nimport { totalizer } from '../utils/definedMessages'\n\nconst TotalizerArea = () => {\n const intl = useIntl()\n\n const { infoUserList } = useInterface()\n\n const { culture } = useRuntime()\n\n return (\n <Card>\n <Flex justify=\"space-between\">\n <Flex grow={1}>\n <Set orientation=\"vertical\" spacing={3} fluid csx={{ paddingX: 4 }}>\n <Text variant=\"pageTitle\">\n {intl.formatMessage(totalizer.listsCreated)}\n </Text>\n <Text variant=\"pageTitle\" tone=\"positive\">\n <b>{infoUserList?.lists}</b>\n </Text>\n </Set>\n </Flex>\n <Flex grow={1}>\n <Divider orientation=\"vertical\" csx={{ marginX: 6, marginY: -25 }} />\n <Set orientation=\"vertical\" spacing={3} fluid csx={{ paddingX: 4 }}>\n <Flex>\n <Text variant=\"pageTitle\">\n {intl.formatMessage(totalizer.bought)}\n </Text>\n </Flex>\n <Text variant=\"pageTitle\" tone=\"positive\">\n <b>\n {infoUserList?.purchase\n ? intl.formatNumber(infoUserList?.purchase / 100, {\n style: 'currency',\n currency: culture.currency,\n })\n : 0}\n </b>\n </Text>\n </Set>\n </Flex>\n <Flex grow={1}>\n <Divider orientation=\"vertical\" csx={{ marginX: 6, marginY: -25 }} />\n <Set orientation=\"vertical\" spacing={3} fluid csx={{ paddingX: 4 }}>\n <Text variant=\"pageTitle\">\n {intl.formatMessage(totalizer.converted)}\n <Tooltip\n label={intl.formatMessage(totalizer.info)}\n placement=\"right\"\n >\n <IconWarningCircle size=\"small\" style={{ marginLeft: '2px' }} />\n </Tooltip>\n </Text>\n <Text variant=\"pageTitle\" tone=\"positive\">\n <b>\n {infoUserList?.quantityAlreadyInGiftCard\n ? intl.formatNumber(infoUserList?.quantityAlreadyInGiftCard, {\n style: 'currency',\n currency: culture.currency,\n })\n : 0}\n </b>\n </Text>\n </Set>\n </Flex>\n </Flex>\n </Card>\n )\n}\n\nexport default TotalizerArea\n\n```" } ]
code_admin-list_200c5ba5
[ { "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 admin-list/react/components/ChooseTable.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\n\nimport TableUserArea from './TableUser'\nimport { useInterface } from '../hooks/useInterface'\nimport TableListArea from './TableList'\n\nconst ChooseTableArea: FC = () => {\n const { tableLists } = useInterface()\n\n if (tableLists) return <TableListArea />\n\n return <TableUserArea />\n}\n\nexport default ChooseTableArea\n\n```" } ]
code_admin-list_66a18653
[ { "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 admin-list/react/components/TableUser.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport {\n DataGrid,\n DataView,\n DataViewControls,\n FlexSpacer,\n IconWarningCircle,\n PageHeader,\n PageTitle,\n Pagination,\n Search,\n tag,\n Tooltip,\n} from '@vtex/admin-ui'\nimport { FormattedMessage, useIntl } from 'react-intl'\n\nimport { messages, table } from '../utils/definedMessages'\nimport { useUser } from '../hooks/useUser'\n\nconst TableUserArea: FC = () => {\n const { gridUsers, view, getInputProps, pagination } = useUser()\n\n const { formatMessage } = useIntl()\n\n if (Object.keys(gridUsers).length < 1 && Object.keys(view).length < 1) {\n return null\n }\n\n return (\n <>\n <PageHeader>\n <PageTitle style={{ padding: '0 4rem' }}>\n <FormattedMessage {...messages.titleUser} />\n </PageTitle>\n </PageHeader>\n <tag.div\n csx={{\n padding: '0 4rem',\n }}\n >\n <DataView state={view}>\n <DataViewControls>\n <tag.div\n csx={{\n display: 'flex',\n alignItems: 'center',\n }}\n >\n <Search id=\"search\" {...getInputProps()} />\n <Tooltip\n label={formatMessage(table.searchUser)}\n placement=\"right\"\n >\n <IconWarningCircle size=\"small\" style={{ marginLeft: '2px' }} />\n </Tooltip>\n </tag.div>\n <FlexSpacer />\n <Pagination\n state={pagination}\n preposition={formatMessage(table.paginationPreposition)}\n subject={formatMessage(table.paginationSubject)}\n prevLabel={formatMessage(table.paginationPrevious)}\n nextLabel={formatMessage(table.paginationNext)}\n />\n </DataViewControls>\n <DataGrid state={gridUsers} />\n </DataView>\n </tag.div>\n </>\n )\n}\n\nexport default TableUserArea\n\n```" } ]
code_admin-list_3056f57b
[ { "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 admin-list/react/components/ModalDate.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport {\n Button,\n experimental_DatePickerCalendar,\n experimental_DatePickerField,\n experimental_I18nProvider,\n Modal,\n ModalContent,\n ModalFooter,\n ModalHeader,\n tag,\n} from '@vtex/admin-ui'\nimport type { FC } from 'react'\nimport React from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport { useLists } from '../hooks/useLists'\nimport { modal } from '../utils/definedMessages'\n\nconst ModalDateArea: FC = () => {\n const {\n modalState,\n datePersonalizeInitial,\n datePersonalizeFinal,\n salveDatePersonalizate,\n } = useLists()\n\n const { formatMessage } = useIntl()\n\n const DatePickerField = experimental_DatePickerField\n const DatePickerCalendar = experimental_DatePickerCalendar\n const I18nProvider = experimental_I18nProvider\n\n const { culture } = useRuntime()\n\n return (\n <Modal\n aria-label={formatMessage(modal.ariaLabel)}\n state={modalState}\n size=\"small\"\n >\n <ModalHeader title={formatMessage(modal.title)} />\n <ModalContent>\n <I18nProvider locale={culture.locale}>\n <tag.div\n csx={{\n paddingBottom: '15px',\n }}\n >\n <DatePickerField\n label={formatMessage(modal.dateInitial)}\n state={datePersonalizeInitial}\n />\n <DatePickerCalendar\n state={datePersonalizeInitial}\n csx={{ zIndex: 100000 }}\n />\n </tag.div>\n <DatePickerField\n label={formatMessage(modal.dateFinal)}\n state={datePersonalizeFinal}\n />\n <DatePickerCalendar\n state={datePersonalizeFinal}\n csx={{ zIndex: 100000 }}\n />\n </I18nProvider>\n </ModalContent>\n <ModalFooter>\n <Button\n onClick={(e: { preventDefault: () => void }) => {\n e.preventDefault()\n salveDatePersonalizate()\n }}\n >\n {formatMessage(modal.confirm)}\n </Button>\n </ModalFooter>\n </Modal>\n )\n}\n\nexport default ModalDateArea\n\n```" } ]
code_admin-list_edde2a23
[ { "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 admin-list/react/components/TableList.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport {\n DataGrid,\n DataView,\n DataViewControls,\n FlexSpacer,\n Pagination,\n Search,\n PageHeader,\n PageTitle,\n Toolbar,\n ToolbarItem,\n useToolbarState,\n experimental_Filter,\n tag,\n Tooltip,\n IconWarningCircle,\n} from '@vtex/admin-ui'\nimport { useIntl } from 'react-intl'\n\nimport { useLists } from '../hooks/useLists'\nimport { table } from '../utils/definedMessages'\nimport { useInterface } from '../hooks/useInterface'\nimport TitleArea from './Title'\nimport TotalizerArea from './Totalizer'\nimport ModalDateArea from './ModalDate'\n\nconst TableListArea: FC = () => {\n const { gridLists, view, dateState, statusState, getInputProps, pagination } =\n useLists()\n\n const Filter = experimental_Filter\n\n const { setTableLists } = useInterface()\n const toolbar = useToolbarState()\n\n const { formatMessage } = useIntl()\n\n if (Object.keys(gridLists).length < 1 && Object.keys(view).length < 1) {\n return null\n }\n\n return (\n <>\n <PageHeader onPopNavigation={() => setTableLists(false)}>\n <PageTitle style={{ padding: '0 4rem' }}>\n <TitleArea />\n </PageTitle>\n </PageHeader>\n <tag.div\n csx={{\n padding: '0 4rem',\n }}\n >\n <DataView state={view}>\n <DataViewControls>\n <tag.div\n csx={{\n display: 'flex',\n alignItems: 'center',\n marginTop: '-4px',\n }}\n >\n <Search id=\"search\" {...getInputProps()} />\n <Tooltip\n label={formatMessage(table.searchList)}\n placement=\"right\"\n >\n <IconWarningCircle size=\"small\" style={{ marginLeft: '2px' }} />\n </Tooltip>\n </tag.div>\n\n <Toolbar\n state={toolbar}\n aria-label=\"Toolbar Render Props\"\n style={{ marginTop: '-10px' }}\n >\n <ToolbarItem>{() => <Filter state={dateState} />}</ToolbarItem>\n <ToolbarItem>{() => <Filter state={statusState} />}</ToolbarItem>\n </Toolbar>\n\n <FlexSpacer />\n <Pagination\n state={pagination}\n preposition={formatMessage(table.paginationPreposition)}\n subject={formatMessage(table.paginationSubject)}\n prevLabel={formatMessage(table.paginationPrevious)}\n nextLabel={formatMessage(table.paginationNext)}\n />\n </DataViewControls>\n <TotalizerArea />\n <DataGrid state={gridLists} style={{ marginTop: '24px' }} />\n </DataView>\n </tag.div>\n\n <ModalDateArea />\n </>\n )\n}\n\nexport default TableListArea\n\n```" } ]
code_admin-list_2ccbb25a
[ { "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 admin-list/react/hooks/useUser.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type {\n UsePaginationReturn,\n DataGridState,\n DataViewState,\n GetInputPropsReturn,\n} from '@vtex/admin-ui'\nimport React, { useContext } from 'react'\n\ninterface ContextUser {\n gridUsers: DataGridState<ItemsListsUsers>\n view: DataViewState\n search: string\n getInputProps: () => GetInputPropsReturn\n debouncedValue: string\n pagination: UsePaginationReturn\n}\n\nexport const ContextUser = React.createContext<ContextUser>({\n gridUsers: {} as DataGridState<ItemsListsUsers>,\n view: {} as DataViewState,\n search: '',\n getInputProps: () => ({} as GetInputPropsReturn),\n debouncedValue: '',\n pagination: {} as UsePaginationReturn,\n})\n\nexport function useUser() {\n return useContext(ContextUser)\n}\n\n```" } ]
code_admin-list_9794bbb4
[ { "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 admin-list/react/hooks/useLists.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type {\n UsePaginationReturn,\n DataGridState,\n DataViewState,\n GetInputPropsReturn,\n ModalStateReturn,\n} from '@vtex/admin-ui'\nimport type { DatePickerStateReturn } from '@vtex/admin-ui/dist/declarations/src/date-picker'\nimport type { UseFilterStateReturn } from '@vtex/admin-ui/dist/declarations/src/filters'\nimport React, { useContext } from 'react'\n\ninterface ContextLists {\n gridLists: DataGridState<ItemsLists>\n view: DataViewState\n dateState: UseFilterStateReturn<{\n id: string\n label: string\n value: number\n }>\n statusState: UseFilterStateReturn<{\n id: string\n label: string\n value: number\n }>\n search: string\n getInputProps: () => GetInputPropsReturn\n debouncedValue: string\n modalState: ModalStateReturn\n datePersonalizeInitial: DatePickerStateReturn\n datePersonalizeFinal: DatePickerStateReturn\n salveDatePersonalizate: () => void\n pagination: UsePaginationReturn\n}\n\nexport const ContextLists = React.createContext<ContextLists>({\n gridLists: {} as DataGridState<ItemsLists>,\n view: {} as DataViewState,\n dateState: {} as UseFilterStateReturn<{\n id: string\n label: string\n value: number\n }>,\n statusState: {} as UseFilterStateReturn<{\n id: string\n label: string\n value: number\n }>,\n search: '',\n getInputProps: () => ({} as GetInputPropsReturn),\n debouncedValue: '',\n modalState: {} as ModalStateReturn,\n datePersonalizeInitial: {} as DatePickerStateReturn,\n datePersonalizeFinal: {} as DatePickerStateReturn,\n salveDatePersonalizate: () => {},\n pagination: {} as UsePaginationReturn,\n})\n\nexport function useLists() {\n return useContext(ContextLists)\n}\n\n```" } ]
code_admin-list_07432aa6
[ { "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 admin-list/react/hooks/useInterface.tsx from the admin-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useContext } from 'react'\n\ninterface ContextInterface {\n searchEmailFilter: string | undefined\n setSearchEmailFilter: (searchEmailFilter: string) => void\n tableLists: boolean\n setTableLists: (tableLists: boolean) => void\n infoUserList: TotalizerListsUsers | undefined\n setInfoUserList: (infoUserList: TotalizerListsUsers) => void\n}\n\nexport const ContextInterface = React.createContext<ContextInterface>({\n searchEmailFilter: '',\n setSearchEmailFilter: () => {},\n tableLists: false,\n setTableLists: () => {},\n infoUserList: undefined,\n setInfoUserList: () => {},\n})\n\nexport function useInterface() {\n return useContext(ContextInterface)\n}\n\n```" } ]
code_massive-collection-update_e4a8cd38
[ { "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 massive-collection-update/docs/README.md from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# ⚠️ Maintenance ⚠️\n*This application is not maintained by VTEX. This was developed as community gift by community members of VTEX. Feel free to use it at your own risk. This APP is a BETA, hence the 0.x version.*\n\n# ---\n\n# MASSIVE COLLECTION UPDATE\n\nThis application exposes an endpoint of massive collection updates. To add items or to remove items from subcollections. In order to get the subCollectionId from a Collection, you can refer to this endpoint.\n[link](https://developers.vtex.com/docs/api-reference/catalog-api#get-/api/catalog/pvt/collection/-collectionId-/subcollection)\n\n---\n\n```shell\nPOST https://{{workspace}}--{{accountName}}.myvtex.com/_v/massive/collection/add\n\nPOST https://{{workspace}}--{{accountName}}.myvtex.com/_v/massive/collection/remove\n\n```\n\n## Curl\n\n```shell\ncurl --location --request PUT 'https://{{workspace}}--{{accountName}}.myvtex.com/_v/massive/collection/add' \\\n--header 'VtexIdClientAutCookie: \"\" \\\n--header 'Content-Type: application/json' \\\n--data-raw '[\n {\n \"sku\": 1,\n \"subCollectionId\": 1\n }\n]'\n```\n\n## Specification\n\n### Headers\n\n- Required\n - Accept : application/json\n - Content-Type : application/json; charset=utf-8\n - VtexIdclientAutCookie : `eyJhbGciOi...`\n OR \n - X-VTEX-API-AppKey : `app key`\n - X-VTEX-API-AppToken : `app token`\n\n### Path params\n\n- Required\n - sku [int32]\n - subCollectionId [int32] || [string]\n\n> Read the API information for more information [link](https://developers.vtex.com/docs/api-reference/catalog-api#post-/api/catalog/pvt/subcollection/-subCollectionId-/stockkeepingunit)\n\n### Request body example\n\n```json\n[\n {\n \"sku\": 12,\n \"subCollectionId\": 47\n }\n]\n```\n\n### Success Response body example\n\n```json\n{\n \"successfulResponses\": {\n \"elements\": [\n {\n \"sku\": 12,\n \"success\": true,\n \"subCollectionId\": 47\n }\n ],\n \"quantity\": 1\n },\n \"failedResponses\": {\n \"elements\": [],\n \"quantity\": 0\n },\n \"total\": 1\n}\n```\n\n### Error Response body example\n\n```json\n{\n \"failedResponses\": {\n \"elements\": [\n [\n {\n \"sku\": 145,\n \"success\": \"false\",\n \"error\": 400,\n \"errorMessage\": \"The request is invalid: The 'subCollectionId' field is required.\"\n }\n ]\n ],\n \"quantity\": 1\n }\n}\n```\n\n---\n\n## Credentials\n\n### What Header to use?\n\nYou can use the following headers:\n\n- X-VTEX-API-AppKey\n- X-VTEX-API-AppToken\n\nOr\n\n- VtexIdClientAutCookie\n\n### Create appKey y appToken\n\nTo generate app keys in your account, you should follow the instructions seen in the [Application Keys](https://help.vtex.com/en/tutorial/application-keys--2iffYzlvvz4BDMr6WGUtet) article in our Help Center.\n\n### Create role\n\n[Create a role](https://help.vtex.com/en/tutorial/perfiles-de-acceso--7HKK5Uau2H6wxE1rH5oRbc) with the following resources and add your user to that role\n\n- Catalog / Catalog access / Catalog full access\n\n### Convert to JWT\n\nMake a call with the credentials created. The result, if the credentials are valid, will return a token that will be used as the value in the header 'VtexIdclientAutCookie' requested by the massive-stock-update component.\n\n```shell\n>>>>>>> 91953ff0fc5154ad45335f9f2a8dbc6141fadf81\ncurl --location --request POST 'https://vtexid.vtexcommercestable.com.br/api/vtexid/apptoken/login' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n \"appkey\": \"...\",\n \"apptoken\": \"...\"\n}'\n```\n\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n@Fbenitez97\n@Edyespinal\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n```" } ]
code_massive-collection-update_eacb0acc
[ { "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 massive-collection-update/node/service.json from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 60,\n \"minReplicas\": 10,\n \"maxReplicas\": 20,\n \"workers\": 2,\n \"routes\": {\n \"addItem\": {\n \"path\": \"/_v/massive/collection/add\",\n \"public\": true\n },\n \"removeItem\": {\n \"path\": \"/_v/massive/collection/remove\",\n \"public\": true\n }\n }\n}\n\n```" } ]
code_massive-collection-update_ec529ca5
[ { "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 massive-collection-update/node/utils.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { AuthenticationError, ForbiddenError, UserInputError } from '@vtex/api'\nimport type { AxiosError } from 'axios'\n\nexport const BUCKET_NAME = 'product-translation'\nexport const ALL_TRANSLATIONS_FILES = 'all-translations'\n\nexport const statusToError = (e: AxiosError) => {\n if (!e.response) {\n throw e\n }\n\n const {\n response: { status },\n } = e\n\n switch (status) {\n case 401: {\n throw new AuthenticationError(e)\n }\n\n case 403: {\n throw new ForbiddenError(e)\n }\n\n case 400: {\n throw new UserInputError(e)\n }\n\n default:\n throw new TypeError(e.message)\n }\n}\n\n```" } ]
code_massive-collection-update_158cf496
[ { "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 massive-collection-update/node/package.json from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"license\": \"MIT\",\n \"dependencies\": {\n \"co-body\": \"^6.0.0\",\n \"ramda\": \"^0.25.0\",\n \"graphql\": \"^14.5.8\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.46.0\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\",\n \"vtex.massive-collection-update\": \"https://colec--vtexspain.myvtex.com/_v/private/typings/linked/v1/vtex.massive-collection-update@0.0.1+build1703003843/public/_types/react\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"3.1.11\"\n}\n\n```" } ]
code_massive-collection-update_24d1571f
[ { "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 massive-collection-update/node/index.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { ClientsConfig, ServiceContext, RecorderState } from '@vtex/api'\nimport { LRUCache, method, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { addItemMiddleware } from './middlewares/addItemMiddleware'\nimport { removeItemMiddleware } from './middlewares/removeItemMiddleware'\nimport { auth } from './middlewares/validateMiddleware'\n\nconst TIMEOUT_MS = 600000\n\n// Create a LRU memory cache for the Status client.\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n // retries: 2,\n timeout: TIMEOUT_MS,\n },\n // This key will be merged with the default options and add this cache to our Status client.\n status: {\n memoryCache,\n },\n },\n}\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients, State>\n\n // The shape of our State object found in `ctx.state`. This is used as state bag to communicate between middlewares.\n interface State extends RecorderState {\n validatedBody: UpdateRequest[],\n userProfile?: UserProfile,\n // Added in the state via auth middleware when request has appkey and apptoken.\n appkey?: string\n }\n}\n\n\n// Export a service that defines route handlers and client options.\nexport default new Service({\n clients,\n routes: {\n // `status` is the route ID from service.json. It maps to an array of middlewares (or a single handler).\n addItem: method({\n POST: [ auth, addItemMiddleware],\n }),\n removeItem: method({\n POST: [auth, removeItemMiddleware],\n }),\n },\n})\n\n```" } ]
code_massive-collection-update_71a838e1
[ { "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 massive-collection-update/node/clients/collectionClient.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { JanusClient } from '@vtex/api'\nimport type { InstanceOptions, IOContext, IOResponse } from '@vtex/api'\n\n\nexport default class collectionClient extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, {\n ...options,\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n Accept: 'application/json',\n VtexIdClientAutCookie: context.authToken\n },\n })\n }\n\n\n\n // eslint-disable-next-line max-params\n public async addItem(\n subCollectionId?: number | string,\n body?: any\n ): Promise<IOResponse<string>> {\n\n const url = `http://${this.context.account}.vtexcommercestable.com.br/api/catalog/pvt/subcollection/${subCollectionId}/stockkeepingunit`\n\n return this.http.post(url, body)\n }\n\n public async removeItem(\n subCollectionId?: number | string,\n skuId?: number | string,\n ): Promise<IOResponse<string>> {\n const url = `http://${this.context.account}.vtexcommercestable.com.br/api/catalog/pvt/subcollection/${subCollectionId}/stockkeepingunit/${skuId}`\n\n return this.http.delete(url)\n }\n}\n\n```" } ]
code_massive-collection-update_250cc301
[ { "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 massive-collection-update/node/clients/vtexId.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { IOContext, InstanceOptions } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\ninterface VtexIdLoginResponse {\n authStatus: string\n token: string\n expires: number\n}\n\ninterface AuthenticatedUser {\n userId: string\n user: string\n userType: string\n}\n\nexport class VtexId extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, {\n ...options,\n headers: {\n ...options?.headers,\n 'x-vtex-user-agent': context.userAgent,\n },\n })\n }\n\n public login({\n appkey,\n apptoken,\n }: {\n appkey: string\n apptoken: string\n }): Promise<VtexIdLoginResponse> {\n return this.http.post(\n '/api/vtexid/apptoken/login',\n {\n appkey,\n apptoken,\n },\n {\n metric: 'vtexid-login',\n }\n )\n }\n\n public getAuthenticatedUser(\n authToken: string\n ): Promise<AuthenticatedUser | null> {\n return this.http.get('/api/vtexid/pub/authenticated/user/', {\n metric: 'vtexid-get-authenticated-user',\n params: {\n authToken,\n },\n })\n }\n}\n```" } ]
code_massive-collection-update_106c889b
[ { "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 massive-collection-update/node/clients/index.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients, Sphinx } from '@vtex/api'\n\nimport collectionClient from './collectionClient'\nimport { VtexId } from './vtexId'\n\nexport class Clients extends IOClients {\n public get collectionClient() {\n return this.getOrSet('collectionClient', collectionClient)\n }\n\n public get vtexId() {\n return this.getOrSet('vtexId', VtexId)\n }\n\n public get sphinx() {\n return this.getOrSet('sphinx', Sphinx)\n }\n}\n\n```" } ]
code_massive-collection-update_4a93ac7f
[ { "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 massive-collection-update/node/typings/authentication.d.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface AuthValidationResponse {\n authStatus: string\n token: string\n expires: number\n}\n\ninterface UserProfile {\n email: string\n userId: string\n firstName?: string\n lastName?: string\n role: 'admin' | 'store-user'\n}\n```" } ]
code_massive-collection-update_b06b499c
[ { "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 massive-collection-update/node/typings/collection.d.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface UpdateRequest {\n sku: number\n subCollectionId?: number | string\n }\n\n interface UpdateResponse {\n sku: number\n subCollectionId?: number | string\n success: string\n error?: number | string\n errorMessage?: string\n }\n\n```" } ]
code_massive-collection-update_06732662
[ { "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 massive-collection-update/node/middlewares/addItemMiddleware.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport async function addItemMiddleware(\n ctx: Context,\n next: () => Promise<any>\n ) {\n const {\n clients: { collectionClient },\n state: { validatedBody },\n } = ctx\n \n const responseList: UpdateResponse[] = []\n \n try {\n const expected = await operationRetry(\n await Promise.all(\n validatedBody.map(async (item) => {\n return addItem(item)\n })\n )\n )\n \n if (expected) {\n const successfulResponses: UpdateResponse[] = responseList.filter((e) => {\n return e.success !== 'false'\n })\n \n const failedResponses: UpdateResponse[] = responseList.filter((e) => {\n return e.success === 'false'\n })\n \n ctx.status = 200\n ctx.body = {\n successfulResponses: {\n elements: successfulResponses,\n quantity: successfulResponses.length,\n },\n failedResponses: {\n elements: failedResponses,\n quantity: failedResponses.length,\n },\n total: responseList.length,\n }\n \n await next()\n }\n } catch (error) {\n console.log(\"500 error pako\", error)\n ctx.status = 500\n ctx.body = error\n await next()\n }\n \n async function addItem(\n updateRequest: UpdateRequest\n ): Promise<UpdateResponse> {\n const {\n subCollectionId\n } = updateRequest\n\n try {\n //const vtexIdToken = ctx.get('VtexIdclientAutCookie') ?? ''\n //const appKey = ctx.get('X-VTEX-API-AppKey') ?? ''\n //const appToken = ctx.get('X-VTEX-API-AppToken') ?? ''\n \n const updateCollectionClientResponse = await collectionClient.addItem(\n subCollectionId,\n {\"SkuId\": updateRequest.sku}\n )\n \n const addItemMiddlewareResponse: UpdateResponse = {\n sku: updateRequest.sku,\n success: updateCollectionClientResponse.data,\n subCollectionId: updateRequest.subCollectionId\n }\n \n return addItemMiddlewareResponse\n } catch (error)\n \n { console.log(\"paco:\", error)\n const data = error.response ? error.response.data : ''\n const updateCollectionClientErrorResponse = {\n sku: updateRequest.sku,\n success: 'false',\n subCollectionId: updateRequest.subCollectionId,\n error: error.response ? error.response.status : 500,\n errorMessage: data.error ? data.error.message : data,\n }\n \n if (error.response && error.response.status === 429) {\n updateCollectionClientErrorResponse.errorMessage = error.response\n ? error.response.headers['ratelimit-reset']\n : '0'\n }\n \n return updateCollectionClientErrorResponse\n }\n }\n \n async function operationRetry(\n updateResponseList: UpdateResponse[]\n ): Promise<any> {\n addResponsesSuccessfulUpdates(updateResponseList)\n \n const response = await findStoppedRequests(updateResponseList)\n \n return response\n }\n \n async function findStoppedRequests(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n responseList: UpdateResponse[]\n ): Promise<any> {\n const retryList: UpdateRequest[] = []\n let value = '0'\n \n if (responseList.length >= 1) {\n for (const index in responseList) {\n const response = responseList[index]\n \n if (response.error && response.error === 429) {\n if (response.errorMessage && response.errorMessage > value) {\n value = response.errorMessage\n }\n \n if (value === '0') {\n value = '20'\n }\n \n retryList.push({\n sku: response.sku,\n subCollectionId: response.subCollectionId\n })\n }\n }\n }\n \n if (retryList.length >= 1) {\n let retryOperation: UpdateResponse[] = []\n \n const awaitTimeout = (delay: string) =>\n new Promise((resolve) => setTimeout(resolve, parseFloat(delay) * 1000))\n \n await awaitTimeout(value)\n \n retryOperation = await Promise.all(\n retryList.map(async (item) => {\n return addItem(item)\n })\n )\n \n return operationRetry(retryOperation)\n }\n \n return true\n }\n \n function addResponsesSuccessfulUpdates(\n updateResponseList: UpdateResponse[]\n ): void {\n for (const index in updateResponseList) {\n const updateResponse = updateResponseList[index]\n \n if (updateResponse.error !== 429) {\n responseList.push(updateResponse)\n }\n }\n }\n }\n```" } ]
code_massive-collection-update_25be71b1
[ { "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 massive-collection-update/node/middlewares/validateMiddleware.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { AuthenticationError, UserInputError } from '@vtex/api'\nimport { json } from 'co-body'\n\nexport async function auth(ctx: Context, next: () => Promise<void>) {\n const {\n header,\n clients: { vtexId, sphinx },\n state,\n } = ctx\n\n const appkey = header['x-vtex-api-appkey'] as string | undefined\n const apptoken = header['x-vtex-api-apptoken'] as string | undefined\n const authCookie = header.vtexidclientautcookie as string | undefined\n\n const requestList = await json(ctx.req)\n const errorList: any[] = []\n\n function requestValidator(request: UpdateRequest): void {\n const requestErrorList: UpdateResponse[] = []\n\n const {\n sku,\n subCollectionId\n } = request\n\n if (typeof sku !== 'number') {\n requestErrorList.push(errorResponseGenerator('sku'))\n }\n\n if (typeof subCollectionId !== 'string' && typeof subCollectionId !== 'number') {\n requestErrorList.push(errorResponseGenerator('subCollectionId'))\n }\n\n if (requestErrorList.length >= 1) {\n errorList.push(requestErrorList)\n }\n\n function errorResponseGenerator(field: string): UpdateResponse {\n return {\n sku,\n subCollectionId,\n success: 'false',\n error: 400,\n errorMessage: `The request is invalid: The '${field}' field is required.`,\n }\n }\n }\n\n try {\n for (const request of requestList) {\n requestValidator(request)\n }\n } catch (error) {\n throw new UserInputError(error)\n }\n\n if (errorList.length >= 1) {\n ctx.status = 400\n ctx.body = {\n failedResponses: {\n elements: errorList,\n quantity: errorList.length,\n },\n }\n\n return\n }\n\n ctx.state.validatedBody = requestList\n\n if (authCookie) {\n const authenticatedUser = await vtexId.getAuthenticatedUser(authCookie)\n\n // When the auth cookie is invalid, the API returns null\n if (authenticatedUser) {\n const isAdmin = await sphinx.isAdmin(authenticatedUser.user)\n\n const { user, userId } = authenticatedUser\n\n state.userProfile = {\n userId,\n email: user,\n role: isAdmin ? 'admin' : 'store-user',\n }\n\n if (isAdmin) {\n ctx.vtex.adminUserAuthToken = authCookie\n }\n }\n }\n\n if (appkey && apptoken) {\n // If appkey and apptoken are not valid, the method throws a 401 error\n const { token } = await vtexId.login({ appkey, apptoken })\n\n state.appkey = appkey\n ctx.vtex.adminUserAuthToken = token\n }\n\n const { userProfile, appkey: appKeyState } = state\n\n // Either userProfile or appKeyState must be on state to continue\n if (!userProfile && !appKeyState) {\n throw new AuthenticationError('Request failed with status code 401')\n }\n await next()\n}\n```" } ]
code_massive-collection-update_a85445fb
[ { "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 massive-collection-update/node/middlewares/removeItemMiddleware.ts from the massive-collection-update VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport async function removeItemMiddleware(\n ctx: Context,\n next: () => Promise<any>\n ) {\n const {\n clients: { collectionClient },\n state: { validatedBody },\n } = ctx\n \n const responseList: UpdateResponse[] = []\n \n try {\n const expected = await operationRetry(\n await Promise.all(\n validatedBody.map(async (item) => {\n return removeItem(item)\n })\n )\n )\n \n if (expected) {\n const successfulResponses: UpdateResponse[] = responseList.filter((e) => {\n return e.success !== 'false'\n })\n \n const failedResponses: UpdateResponse[] = responseList.filter((e) => {\n return e.success === 'false'\n })\n \n ctx.status = 200\n ctx.body = {\n successfulResponses: {\n elements: successfulResponses,\n quantity: successfulResponses.length,\n },\n failedResponses: {\n elements: failedResponses,\n quantity: failedResponses.length,\n },\n total: responseList.length,\n }\n \n await next()\n }\n } catch (error) {\n ctx.status = 500\n ctx.body = error\n await next()\n }\n \n async function removeItem(\n updateRequest: UpdateRequest\n ): Promise<UpdateResponse> {\n const {\n subCollectionId,\n sku\n } = updateRequest\n\n try {\n \n const updateCollectionClientResponse = await collectionClient.removeItem(\n subCollectionId,\n sku\n )\n \n const removeItemMiddlewareResponse: UpdateResponse = {\n sku: updateRequest.sku,\n success: updateCollectionClientResponse.data,\n subCollectionId: updateRequest.subCollectionId\n }\n \n return removeItemMiddlewareResponse\n } catch (error) {\n const data = error.response ? error.response.data : ''\n const updateCollectionClientErrorResponse = {\n sku: updateRequest.sku,\n success: 'false',\n subCollectionId: updateRequest.subCollectionId,\n error: error.response ? error.response.status : 500,\n errorMessage: data.error ? data.error.message : data,\n }\n \n if (error.response && error.response.status === 429) {\n updateCollectionClientErrorResponse.errorMessage = error.response\n ? error.response.headers['ratelimit-reset']\n : '0'\n }\n \n return updateCollectionClientErrorResponse\n }\n }\n \n async function operationRetry(\n updateResponseList: UpdateResponse[]\n ): Promise<any> {\n addResponsesSuccessfulUpdates(updateResponseList)\n \n const response = await findStoppedRequests(updateResponseList)\n \n return response\n }\n \n async function findStoppedRequests(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n responseList: UpdateResponse[]\n ): Promise<any> {\n const retryList: UpdateRequest[] = []\n let value = '0'\n \n if (responseList.length >= 1) {\n for (const index in responseList) {\n const response = responseList[index]\n \n if (response.error && response.error === 429) {\n if (response.errorMessage && response.errorMessage > value) {\n value = response.errorMessage\n }\n \n if (value === '0') {\n value = '20'\n }\n \n retryList.push({\n sku: response.sku,\n subCollectionId: response.subCollectionId\n })\n }\n }\n }\n \n if (retryList.length >= 1) {\n let retryOperation: UpdateResponse[] = []\n \n const awaitTimeout = (delay: string) =>\n new Promise((resolve) => setTimeout(resolve, parseFloat(delay) * 1000))\n \n await awaitTimeout(value)\n \n retryOperation = await Promise.all(\n retryList.map(async (item) => {\n return removeItem(item)\n })\n )\n \n return operationRetry(retryOperation)\n }\n \n return true\n }\n \n function addResponsesSuccessfulUpdates(\n updateResponseList: UpdateResponse[]\n ): void {\n for (const index in updateResponseList) {\n const updateResponse = updateResponseList[index]\n \n if (updateResponse.error !== 429) {\n responseList.push(updateResponse)\n }\n }\n }\n }\n```" } ]
code_sku-list_f0985686
[ { "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 sku-list/messages/th-TH.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"จำนวน\",\n \"store/specifications.title\": \"ข้อกำหนดคุณลักษณะ\",\n \"store/add-to-cart.success\": \"เพิ่มสินค้าลงในรถเข็นของคุณแล้ว\",\n \"store/add-to-cart.duplicate\": \"สินค้าอยู่ในรถเข็นของคุณแล้ว\",\n \"store/add-to-cart.failure\": \"มีบางอย่างผิดพลาดและเพิ่มสินค้าลงในรถเข็นของคุณไม่ได้!\",\n \"store/add-to-cart.see-cart\": \"ดูรถเข็น\",\n \"store/add-to-cart.add-to-cart\": \"เพิ่มลงในรถเข็น\",\n \"store/add-to-cart.select-sku-variations\": \"กรุณาเลือกตัวเลือกของแต่ละรุ่นสินค่า\",\n \"store/sku-list.inventory.title\": \"สินค้าคงคลัง\",\n \"store/sku-list.seller.name.title\": \"ผู้ขาย\",\n \"store/sku-list.sku.name.title\": \"ชื่อสินค้า\",\n \"store/sku-list.sku.price.title\": \"ราคา\",\n \"store/sku-list.sku.quantity-selector.title\": \"เลือกจำนวน\",\n \"store/sku-list.seller.price.title\": \"ราคาผู้ขาย\",\n \"admin/editor.sku-list.highlights.title\": \"ไฮไลต์ของสินค้า\",\n \"admin/editor.sku-list.highlights.description\": \"คอมโพเนนต์ไฮไลต์ของสินค้า\",\n \"admin/editor.sku-list.highlights.default\": \"เลือกไฮไลต์เริ่มต้น\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"ข้อกำหนดคุณลักษณะทั้งหมด\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"ข้อกำหนดคุณลักษณะฟิลด์\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"พิมพ์ข้อกำหนดคุณลักษณะด้านล่าง\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"แสดงไฮไลต์\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"แสดงป้ายข้อความ\",\n \"admin/editor.sku-list.inventory.title\": \"สินค้า SKU คงคลัง\",\n \"admin/editor.sku-list.inventory.description\": \"คอมโพเนนต์สินค้า SKU คงคลัง\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"แสดงป้ายข้อความ\",\n \"admin/editor.sku-list.item-quantity.title\": \"จำนวน SKU\",\n \"admin/editor.sku-list.item-quantity.description\": \"คอมโพเนนต์จำนวน SKU\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"ประเภทตัวเลือกจำนวน\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"การป้อนตัวเลข\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"การป้อนตัวเลข\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"แสดงป้ายข้อความ\",\n \"admin/test\": \"ทดสอบ\",\n \"store/test\": \"ทดสอบ\"\n}\n\n```" } ]
code_sku-list_02fe2c93
[ { "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 sku-list/messages/pt.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"Quantidade\",\n \"store/specifications.title\": \"Especificações\",\n \"store/add-to-cart.success\": \"Item adicionado ao seu carrinho\",\n \"store/add-to-cart.duplicate\": \"Item já no seu carrinho\",\n \"store/add-to-cart.failure\": \"Algo deu errado e o item não pôde ser adicionado ao seu carrinho!\",\n \"store/add-to-cart.see-cart\": \"Ver carrinho\",\n \"store/add-to-cart.add-to-cart\": \"Adicionar ao carrinho\",\n \"store/add-to-cart.select-sku-variations\": \"Por favor selecione uma opção de cada variação\",\n \"store/sku-list.inventory.title\": \"Inventário\",\n \"store/sku-list.seller.name.title\": \"Vendedor\",\n \"store/sku-list.sku.name.title\": \"Nome do item\",\n \"store/sku-list.sku.price.title\": \"Preço\",\n \"store/sku-list.sku.quantity-selector.title\": \"Selecione a quantidade\",\n \"store/sku-list.seller.price.title\": \"Preço do Vendedor\",\n \"admin/editor.sku-list.highlights.title\": \"Destaques do item\",\n \"admin/editor.sku-list.highlights.description\": \"Componente Destaques do Item\",\n \"admin/editor.sku-list.highlights.default\": \"Escolha o destaque padrão\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"Todas as especificações\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"Especificações personalizadas\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"Escreve as especificações abaixo\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"Mostrar destaques\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"Mostrar marcador\",\n \"admin/editor.sku-list.inventory.title\": \"Inventário de SKU\",\n \"admin/editor.sku-list.inventory.description\": \"Componente de inventário de SKU\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"Mostrar marcador\",\n \"admin/editor.sku-list.item-quantity.title\": \"Quantidade de SKU\",\n \"admin/editor.sku-list.item-quantity.description\": \"Componente de quantidade do SKU\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"Tipo de seletor de quantidade\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"Stepper numérico\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"Entrada de número\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"Mostrar marcador\",\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n\n```" } ]
code_sku-list_2aefceec
[ { "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 sku-list/messages/en.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"Quantity\",\n \"store/specifications.title\": \"Specifications\",\n \"store/add-to-cart.success\": \"Item added to your cart\",\n \"store/add-to-cart.duplicate\": \"Item already in your cart\",\n \"store/add-to-cart.failure\": \"Something went wrong and the item was not added to your cart!\",\n \"store/add-to-cart.see-cart\": \"View cart\",\n \"store/add-to-cart.add-to-cart\": \"Add to cart\",\n \"store/add-to-cart.select-sku-variations\": \"Please select an option of each variation\",\n \"store/sku-list.inventory.title\": \"Inventory\",\n \"store/sku-list.seller.name.title\": \"Seller\",\n \"store/sku-list.sku.name.title\": \"Item Name\",\n \"store/sku-list.sku.price.title\": \"Price\",\n \"store/sku-list.sku.quantity-selector.title\": \"Select Quantity\",\n \"store/sku-list.seller.price.title\": \"Seller Price\",\n \"admin/editor.sku-list.highlights.title\": \"Item Highlights\",\n \"admin/editor.sku-list.highlights.description\": \"Item Highlights Component\",\n \"admin/editor.sku-list.highlights.default\": \"Choose Default Highlight\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"All Specifications\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"Fields Specifications\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"Type specifications below\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"Show highlights\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"Show label\",\n \"admin/editor.sku-list.inventory.title\": \"SKU Inventory\",\n \"admin/editor.sku-list.inventory.description\": \"SKU inventory component\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"Show label\",\n \"admin/editor.sku-list.item-quantity.title\": \"SKU Quantity\",\n \"admin/editor.sku-list.item-quantity.description\": \"SKU quantity component\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"Quantity selector type\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"Numeric stepper\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"Number input\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"Show label\",\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n\n```" } ]
code_sku-list_527c3535
[ { "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 sku-list/messages/context.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"Quantity\",\n \"store/specifications.title\": \"Specifications\",\n \"store/add-to-cart.success\": \"Item added to your cart\",\n \"store/add-to-cart.duplicate\": \"Item already in your cart\",\n \"store/add-to-cart.failure\": \"Something went wrong and the item was not added to your cart!\",\n \"store/add-to-cart.see-cart\": \"View cart\",\n \"store/add-to-cart.add-to-cart\": \"Add to cart\",\n \"store/add-to-cart.select-sku-variations\": \"Please select an option of each variation\",\n \"store/sku-list.inventory.title\": \"Inventory\",\n \"store/sku-list.seller.name.title\": \"Seller\",\n \"store/sku-list.sku.name.title\": \"Item Name\",\n \"store/sku-list.sku.price.title\": \"Price\",\n \"store/sku-list.sku.quantity-selector.title\": \"Select Quantity\",\n \"store/sku-list.seller.price.title\": \"Seller Price\",\n \"admin/editor.sku-list.highlights.title\": \"Sku Highlights\",\n \"admin/editor.sku-list.highlights.description\": \"Sku Highlights Component\",\n \"admin/editor.sku-list.highlights.default\": \"Choose Default Highlight\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"All Specifications\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"Fields Specifications\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"Type specifications below\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"Show highlights\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"Show label\",\n \"admin/editor.sku-list.inventory.title\": \"SKU Inventory\",\n \"admin/editor.sku-list.inventory.description\": \"SKU inventory component\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"Show label\",\n \"admin/editor.sku-list.item-quantity.title\": \"SKU Quantity\",\n \"admin/editor.sku-list.item-quantity.description\": \"SKU quantity component\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"Quantity selector type\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"Numeric stepper\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"Number input\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"Show label\"\n}\n\n```" } ]
code_sku-list_bf3bd791
[ { "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 sku-list/messages/fr-FR.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"Quantité\",\n \"store/specifications.title\": \"Caractéristiques\",\n \"store/add-to-cart.success\": \"Article ajouté à votre panier\",\n \"store/add-to-cart.duplicate\": \"Article déjà dans votre panier\",\n \"store/add-to-cart.failure\": \"Un problème est survenu et l’article n’a pas été ajouté à votre panier !\",\n \"store/add-to-cart.see-cart\": \"Voir le panier\",\n \"store/add-to-cart.add-to-cart\": \"Ajouter au panier\",\n \"store/add-to-cart.select-sku-variations\": \"Veuillez sélectionner une option de chaque variante\",\n \"store/sku-list.inventory.title\": \"Stock\",\n \"store/sku-list.seller.name.title\": \"Vendeur\",\n \"store/sku-list.sku.name.title\": \"Nom de l’article\",\n \"store/sku-list.sku.price.title\": \"Prix\",\n \"store/sku-list.sku.quantity-selector.title\": \"Sélectionner la quantité\",\n \"store/sku-list.seller.price.title\": \"Prix du vendeur\",\n \"admin/editor.sku-list.highlights.title\": \"Points forts de l’article\",\n \"admin/editor.sku-list.highlights.description\": \"Composant des points forts de l’article\",\n \"admin/editor.sku-list.highlights.default\": \"Choisir le point fort par défaut\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"Toutes les caractéristiques\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"Caractéristiques des champs\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"Caractéristiques de type ci-dessous\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"Afficher les points forts\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"Afficher l’étiquette\",\n \"admin/editor.sku-list.inventory.title\": \"Stock de SKU\",\n \"admin/editor.sku-list.inventory.description\": \"Composant de stock de SKU\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"Afficher l’étiquette\",\n \"admin/editor.sku-list.item-quantity.title\": \"Quantité de SKU\",\n \"admin/editor.sku-list.item-quantity.description\": \"Composant quantité de SKU\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"Type de sélecteur de quantité\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"Pas à pas du numérique\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"Saisie du numéro\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"Afficher l’étiquette\",\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n\n```" } ]
code_sku-list_4640f69c
[ { "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 sku-list/messages/es.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"Cantidad\",\n \"store/specifications.title\": \"Especificaciones\",\n \"store/add-to-cart.success\": \"Ítem agregado a su carrito\",\n \"store/add-to-cart.duplicate\": \"Ítem ya en tu carrito\",\n \"store/add-to-cart.failure\": \"¡Algo salió mal y el artículo no se agregó a tu carrito!\",\n \"store/add-to-cart.see-cart\": \"Ver carrito\",\n \"store/add-to-cart.add-to-cart\": \"Agregar a su carrito\",\n \"store/add-to-cart.select-sku-variations\": \"Por favor seleccione una opción de cada variación\",\n \"store/sku-list.inventory.title\": \"Inventario\",\n \"store/sku-list.seller.name.title\": \"Vendedor\",\n \"store/sku-list.sku.name.title\": \"Nombre del árticulo\",\n \"store/sku-list.sku.price.title\": \"Precio\",\n \"store/sku-list.sku.quantity-selector.title\": \"Selecciona la cantidad\",\n \"store/sku-list.seller.price.title\": \"Precio del vendedor\",\n \"admin/editor.sku-list.highlights.title\": \"Puntos destacados del artículo\",\n \"admin/editor.sku-list.highlights.description\": \"Elemento de elementos destacados\",\n \"admin/editor.sku-list.highlights.default\": \"Elegir destaque predeterminado\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"Todas las especificaciones\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"Especificaciones personalizadas\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"Escriva las especificaciones abajo\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"Mostrar lo más destacados\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"Mostrar etiqueta\",\n \"admin/editor.sku-list.inventory.title\": \"Inventario de SKU\",\n \"admin/editor.sku-list.inventory.description\": \"Componente de inventario de SKU\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"Mostrar etiqueta\",\n \"admin/editor.sku-list.item-quantity.title\": \"Cantidad de SKU\",\n \"admin/editor.sku-list.item-quantity.description\": \"Componente de cantidad de SKU\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"Tipo de selector de cantidad\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"Paso a paso numérico\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"Entrada de número\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"Mostrar etiqueta\",\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n\n```" } ]
code_sku-list_916a1f39
[ { "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 sku-list/messages/ar.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/product-quantity.quantity\": \"الكمية\",\n \"store/specifications.title\": \"المواصفات\",\n \"store/add-to-cart.success\": \"تمت إضافة المنتج إلى السلة بنجاح\",\n \"store/add-to-cart.duplicate\": \"عنصر موجود مسبقًا في عربتك\",\n \"store/add-to-cart.failure\": \"حدث خطأ ولم تتم إضافة العنصر إلى عربة التسوق الخاصة بك!\",\n \"store/add-to-cart.see-cart\": \"عرض عربة التسوق\",\n \"store/add-to-cart.add-to-cart\": \"إضافة إلى العربة\",\n \"store/add-to-cart.select-sku-variations\": \"الرجاء تحديد خيار من كل متغير\",\n \"store/sku-list.inventory.title\": \"المخزون\",\n \"store/sku-list.seller.name.title\": \"البائع\",\n \"store/sku-list.sku.name.title\": \"إسم الصنف\",\n \"store/sku-list.sku.price.title\": \"السعر\",\n \"store/sku-list.sku.quantity-selector.title\": \"تحديد الكمية\",\n \"store/sku-list.seller.price.title\": \"سعر البائع\",\n \"admin/editor.sku-list.highlights.title\": \"نقاط العنصر الرئيسية\",\n \"admin/editor.sku-list.highlights.description\": \"النقاط البارزة للعنصر\",\n \"admin/editor.sku-list.highlights.default\": \"اختر الملامح الافتراضية\",\n \"admin/editor.sku-list.highlights.allSpecifications\": \"كل المواصفات\",\n \"admin/editor.sku-list.highlights.chooseDefaultSpecification\": \"مواصفات الحقول\",\n \"admin/editor.sku-list.highlights.typeSpecifications.title\": \"نوع المواصفات أدناه\",\n \"admin/editor.sku-list.highlights.showHighlight.title\": \"عرض المواصفات\",\n \"admin/editor.sku-list.highlights.showLabel.title\": \"عرض التسمية\",\n \"admin/editor.sku-list.inventory.title\": \"مخزون SKU\",\n \"admin/editor.sku-list.inventory.description\": \"مكون مخزون SKU\",\n \"admin/editor.sku-list.inventory.showLabel.title\": \"عرض التسمية\",\n \"admin/editor.sku-list.item-quantity.title\": \"كمية SKU\",\n \"admin/editor.sku-list.item-quantity.description\": \"مكون كمية SKU\",\n \"admin/editor.sku-list.item-quantity.inputType.title\": \"نوع محدد الكمية\",\n \"admin/editor.sku-list.item-quantity.inputType.stepper\": \"خطوة رقمية\",\n \"admin/editor.sku-list.item-quantity.inputType.number\": \"إدخال الرقم\",\n \"admin/editor.sku-list.item-quantity.showLabel.title\": \"عرض التسمية\",\n \"admin/test\": \"الاختبار\",\n \"store/test\": \"الاختبار\"\n}\n```" } ]
code_sku-list_cc50eabf
[ { "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 sku-list/docs/README.md from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/sku-list) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# SKU List \n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nThe SKU List app is an essential B2B feature responsible for rendering a SKU list in the product details page.\n\n![sku-list](https://user-images.githubusercontent.com/52087100/85888338-c762d100-b7bf-11ea-9ca0-c808ef9641ea.png)\n\n## Configuration\n\n1. Add the `vtex.sku-list` app to your theme's dependencies in the `manifest.json`, for example:\n\n```diff\n \"dependencies\": {\n+ \"vtex.sku-list\": \"1.x\"\n }\n```\n\nNow, you are able to use all blocks exported by the `sku-list` app. Check out the full list below:\n\n| Block name | Description |\n| -------------- | ----------------------------------------------- |\n| `sku-list` | Top level block in which you will declare as `children` the SKU List layout blocks according to devices (`sku-content.desktop` and the `sku-content.mobile` blocks). |\n| `sku-content.desktop` | Defines the SKU List layout for desktop devices. |\n| `sku-content.mobile` | Defines the SKU List layout for mobile devices. |\n| `sku-name` | Renders the SKU name. | \n| `sku-image` | Renders the SKU image. | \n| `sku-seller` | Renders the SKU sellers (if it has any). It uses the `seller-name`, `seller-inventory` and `seller-price` blocks as children in order to display seller data. | \n| `seller-name` | Renders the SKU seller name. | \n| `seller-inventory` | Renders the SKU inventory per seller. |\n| `seller-price` | Renders the SKU price per seller. | \n| `sku-price` | Renders the SKU price. | \n| `sku-inventory` | Renders the SKU inventory. | \n| `sku-quantity-selector` | Renders a quantity selector. | \n| `item-quantity` | Renders the SKU inventory. | \n| `sku-buy-button` | Renders a Buy Button to add a given SKU to the minicart. | \n| `item-buy-button` | Renders a Buy Button to add a given Product to the minicart. | \n| `sku-specifications` | Renders the SKU specifications. | \n| `sku-highlights` | Renders a highlight disclaimer for a specific SKU. | \n\n2. In the product template (`store.product`), use the following block structure in order to rebuild the Product Details Page now including the `sku-list` blocks:\n\n```diff\n{\n \"store.product\": {\n \"children\": [\n \"flex-layout.row#product-breadcrumb\",\n- \"flex-layout.row#product-main\",\n+ \"flex-layout.row#images-and-items\",\n+ \"flex-layout.row#buy-button\",\n \"flex-layout.row#description\",\n \"shelf.relatedProducts\",\n \"product-reviews\",\n \"product-questions-and-answers\"\n ]\n },\n+ \"flex-layout.row#images-and-items\": {\n+ \"children\": [\n+ \"product-images\",\n+ \"flex-layout.col#sku-list\"\n+ ],\n+ \"props\": {\n+ \"preventHorizontalStretch\": false\n+ }\n+ },\n+ \"flex-layout.col#sku-list\": {\n+ \"children\": [\n+ \"flex-layout.row#sku-list-header\",\n+ \"sku-list\"\n+ ],\n+ \"props\": {\n+ \"preventVerticalStretch\": true,\n+ \"width\": \"60%\",\n+ \"blockClass\": \"skuList\"\n+ }\n+ },\n+ \"flex-layout.row#sku-list-header\": {\n+ \"props\": {\n+ \"preventHorizontalStretch\": false,\n+ \"blockClass\": \"skuListHeader\"\n+ },\n+ \"children\": [\n+ \"rich-text#certificates\",\n+ \"rich-text#expiry-date\",\n+ \"rich-text#inventory\",\n+ \"rich-text#price\",\n+ \"rich-text#quantity-selector\"\n+ ]\n+ },\n+ \"rich-text#certificates\": {\n+ \"props\": {\n+ \"text\": \"**Has Certificates?**\",\n+ \"blockClass\": \"skuList\",\n+ \"width\": \"20%\"\n+ }\n+ },\n+ \"rich-text#expiry-date\": {\n+ \"props\": {\n+ \"text\": \"**Expires at**\",\n+ \"blockClass\": \"skuList\",\n+ \"width\": \"20%\"\n+ }\n+ },\n+ \"rich-text#inventory\": {\n+ \"props\": {\n+ \"text\": \"**Stock**\",\n+ \"blockClass\": \"skuList\",\n+ \"width\": \"20%\"\n+ }\n+ },\n+ \"rich-text#price\": {\n+ \"props\": {\n+ \"text\": \"**Price**\",\n+ \"blockClass\": \"skuList\",\n+ \"width\": \"20%\"\n+ }\n+ },\n+ \"rich-text#quantity-selector\": {\n+ \"props\": {\n+ \"text\": \"**Quantity**\",\n+ \"blockClass\": \"skuList\",\n+ \"width\": \"20%\"\n+ }\n+ },\n+ \"sku-list\": {\n+ \"blocks\": [\n+ \"sku-content.desktop\",\n+ \"sku-content.mobile\"\n+ ]\n+ },\n+ \"sku-content.desktop\": {\n+ \"children\": [\n+ \"flex-layout.row#item-main-desktop\"\n+ ]\n+ },\n+ \"flex-layout.row#item-main-desktop\": {\n+ \"props\": {\n+ \"preventHorizontalStretch\": false\n+ },\n+ \"children\": [\n+ \"flex-layout.col#sku-highlight-certificates\",\n+ \"flex-layout.col#sku-highlight-expiry-date\",\n+ \"flex-layout.col#sku-inventory\",\n+ \"flex-layout.col#sku-price\",\n+ \"flex-layout.col#sku-quantity-selector\"\n+ ]\n+ },\n+ \"flex-layout.col#sku-highlight-certificates\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-highlights#certificates\"\n+ ]\n+ },\n+ \"sku-highlights#certificates\": {\n+ \"props\": {\n+ \"conditional\": {\n+ \"highlight\": \"admin/editor.sku-list.highlights.chooseDefaultSpecification\",\n+ \"typeSpecifications\": \"Has Certificates\"\n+ },\n+ \"showLabel\": false\n+ }\n+ },\n+ \"flex-layout.col#sku-highlight-expiry-date\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-highlights#expiry-date\"\n+ ]\n+ },\n+ \"sku-highlights#expiry-date\": {\n+ \"props\": {\n+ \"conditional\": {\n+ \"highlight\": \"admin/editor.sku-list.highlights.chooseDefaultSpecification\",\n+ \"typeSpecifications\": \"Expiry Date\"\n+ },\n+ \"showLabel\": false\n+ }\n+ },\n+ \"flex-layout.col#sku-inventory\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-inventory#default\"\n+ ]\n+ },\n+ \"sku-inventory#default\": {\n+ \"props\": {\n+ \"showLabel\": false\n+ }\n+ },\n+ \"sku-seller#inventory\": {\n+ \"children\": [\n+ \"seller-inventory\"\n+ ]\n+ },\n+ \"flex-layout.col#sku-price\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-price\"\n+ ]\n+ },\n+ \"flex-layout.col#sku-quantity-selector\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-quantity-selector\"\n+ ]\n+ },\n+ \"sku-content.mobile\": {\n+ \"children\": [\n+ \"flex-layout.row#item-main-mobile\"\n+ ]\n+ },\n+ \"flex-layout.row#item-main-mobile\": {\n+ \"props\": {\n+ \"preventHorizontalStretch\": false\n+ },\n+ \"children\": [\n+ \"flex-layout.col#sku-highlight-certificates-mobile\",\n+ \"flex-layout.col#sku-highlight-expiry-date-mobile\",\n+ \"flex-layout.col#sku-inventory-mobile\",\n+ \"flex-layout.col#sku-price-mobile\",\n+ \"flex-layout.col#sku-quantity-selector-mobile\"\n+ ]\n+ },\n+ \"flex-layout.col#sku-highlight-certificates-mobile\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-highlights#certificates-mobile\"\n+ ]\n+ },\n+ \"sku-highlights#certificates-mobile\": {\n+ \"props\": {\n+ \"conditional\": {\n+ \"highlight\": \"admin/editor.sku-list.highlights.chooseDefaultSpecification\",\n+ \"typeSpecifications\": \"Has Certificates\"\n+ },\n+ \"showLabel\": true\n+ }\n+ },\n+ \"flex-layout.col#sku-highlight-expiry-date-mobile\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-highlights#expiry-date-mobile\"\n+ ]\n+ },\n+ \"sku-highlights#expiry-date-mobile\": {\n+ \"props\": {\n+ \"conditional\": {\n+ \"highlight\": \"admin/editor.sku-list.highlights.chooseDefaultSpecification\",\n+ \"typeSpecifications\": \"Expiry Date\"\n+ },\n+ \"showLabel\": true\n+ }\n+ },\n+ \"flex-layout.col#sku-inventory-mobile\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-inventory#default-mobile\"\n+ ]\n+ },\n+ \"sku-inventory#default-mobile\": {\n+ \"props\": {\n+ \"showLabel\": true\n+ }\n+ },\n+ \"sku-seller#inventory-mobile\": {\n+ \"children\": [\n+ \"seller-inventory#mobile\"\n+ ]\n+ },\n+ \"seller-inventory#mobile\": {\n+ \"props\": {\n+ \"showLabel\": true\n+ }\n+ },\n+ \"flex-layout.col#sku-price-mobile\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-price#mobile\"\n+ ]\n+ },\n+ \"sku-price#mobile\": {\n+ \"props\": {\n+ \"showLabel\": true\n+ }\n+ },\n+ \"flex-layout.col#sku-quantity-selector-mobile\": {\n+ \"props\": {\n+ \"width\": \"20%\"\n+ },\n+ \"children\": [\n+ \"sku-quantity-selector\"\n+ ]\n+ },\n+ \"sku-quantity-selector#mobile\": {\n+ \"props\": {\n+ \"showLabel\": true\n+ }\n+ },\n```\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).\n\n| CSS Handles | \n| ----------------------------------------- | \n| `availableQuantityContainer` |\n| `buttonDataContainer` |\n| `buttonItemsPrice` |\n| `buyButtonContainer` |\n| `buyButtonText` |\n| `buyButtonText` |\n| `colGroupLeadTime` |\n| `colGroupQuantityBreak` |\n| `colGroupUnitPrice` |\n| `highlightContent` |\n| `highlightTitle` |\n| `highlightValue` |\n| `inventory` |\n| `inventoryContainer` |\n| `itemHighlight` |\n| `priceContainer` |\n| `productPriceBreaksContainer` |\n| `productPriceBreaksContainer` |\n| `productPriceQuantityDataColumn` |\n| `productPriceTable` |\n| `productPriceTableFooterMultipleColumn` |\n| `productPriceTableFooterRow` |\n| `productPriceTableHeader` |\n| `productPriceTableHeaderRow` |\n| `productPriceTableHeaderRowData` |\n| `productPriceTableLeadTimeColumn` |\n| `productPriceTableMainHeader` |\n| `productPriceTablePriceColumn` |\n| `productPriceTableQuantities` |\n| `productPriceTableRow` |\n| `productPricingTableTitle` |\n| `quantitySelectorContainer` |\n| `quantitySelectorStepper` |\n| `quantitySelectorTitle` |\n| `selectedSkuContentWrapper` |\n| `sellerInventory` |\n| `sellerInventoryWrapper` |\n| `sellerName` |\n| `sellerPriceContainer` |\n| `skuContentWrapper` |\n| `skuImage` |\n| `skuName` |\n| `specificationItemProperty` |\n| `specificationItemSpecifications` |\n| `specificationsTable` |\n| `specificationsTableContainer` |\n| `specificationsTablePropertyHeading` |\n| `specificationsTableSpecificationHeading` |\n| `specificationsTabsContainer` |\n| `specificationsTitle` |\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<!-- 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\n<!-- DOCS-IGNORE:end -->\n\n```" } ]
code_sku-list_95d78a0b
[ { "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 sku-list/react/SkuContent.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuContent from './components/SkuContent'\n\nexport default SkuContent\n\n```" } ]
code_sku-list_69a1be1c
[ { "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 sku-list/react/styles.css from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.skuVideo {\n}\n\n.skuImage {\n}\n\n.carouselGaleryCursor {\n cursor: url('./components/SkuImages/Carousel/cursor.svg') 8 8, default;\n}\n\n.carouselGaleryThumbs :global(.swiper-slide) {\n height: auto;\n}\n\n.carouselGaleryThumbs\n:global(.swiper-slide):not(:global(.swiper-slide-thumb-active))\n.carouselThumbBorder {\n border-width: 0px;\n}\n\n.carouselIconCaretRight,\n.carouselIconCaretLeft {\n stroke: white;\n stroke-width: 0.5px;\n -webkit-filter: drop-shadow(0px 1px 1px #cacbcc);\n filter: drop-shadow(0px 1px 1px #cacbcc);\n}\n\n.carouselCursorDefault:hover {\n cursor: default;\n}\n\n.carouselImagePlaceholder {\n}\n\n/** Overrides figure css declaration from vtex-tachyons, which\n * for some reason adds margin to all figure elements */\n.figure {\n margin: 0;\n}\n\n.gradientBaseBottom {\n /** TODO: use the actual bg-base token instead of a hardcoded color */\n background: linear-gradient(transparent, white);\n}\n\n.gradientBaseTop {\n /** TODO: use the actual bg-base token instead of a hardcoded color */\n background: linear-gradient(white, transparent);\n}\n\n.gradientBaseRight {\n /** TODO: use the actual bg-base token instead of a hardcoded color */\n background: linear-gradient(90deg, transparent, white);\n}\n\n.gradientBaseLeft {\n /** TODO: use the actual bg-base token instead of a hardcoded color */\n background: linear-gradient(90deg, white, transparent);\n}\n\n```" } ]
code_sku-list_7e8695f7
[ { "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 sku-list/react/SellerName.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SellerName from './components/SellerName'\n\nexport default SellerName\n\n```" } ]
code_sku-list_7732ac57
[ { "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 sku-list/react/SkuInventory.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuInventory from './components/SkuInventory'\n\nexport default SkuInventory\n\n```" } ]
code_sku-list_4b38069e
[ { "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 sku-list/react/SkuList.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuList from './components/SkuList'\n\nexport default SkuList\n\n```" } ]
code_sku-list_e74ed2e3
[ { "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 sku-list/react/ItemQuantity.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport ItemQuantity from './components/ItemQuantity/ItemQuantity'\n\nexport default ItemQuantity\n\n```" } ]
code_sku-list_6a81e3f1
[ { "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 sku-list/react/SkuName.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuName from './components/SkuName'\n\nexport default SkuName\n\n```" } ]
code_sku-list_10592965
[ { "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 sku-list/react/BuyButton.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport BuyButton from './components/BuyButton/Wrapper'\n\nexport default BuyButton\n\n```" } ]
code_sku-list_365a2b34
[ { "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 sku-list/react/SkuSeller.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuSeller from './components/SkuSeller'\n\nexport default SkuSeller\n\n```" } ]
code_sku-list_8a421cde
[ { "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 sku-list/react/package.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"lint\": \"tsc --noEmit && eslint --quiet --fix --ext ts,tsx .\",\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.3\",\n \"classnames\": \"^2.2.6\",\n \"debounce\": \"^1.2.0\",\n \"graphql\": \"^14.5.8\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.8.6\",\n \"react-apollo\": \"^3.1.3\",\n \"react-content-loader\": \"^4.3.3\",\n \"react-dom\": \"^16.8.6\",\n \"react-html-parser\": \"^2.0.2\",\n \"react-id-swiper\": \"2.3.2\",\n \"react-intl\": \"^2.9.0\",\n \"react-resize-detector\": \"^4.2.1\",\n \"swiper\": \"github:vtex/swiper#4.5.1\"\n },\n \"devDependencies\": {\n \"@types/classnames\": \"^2.2.9\",\n \"@types/debounce\": \"^1.2.0\",\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^24.0.21\",\n \"@types/node\": \"^12.12.3\",\n \"@types/ramda\": \"^0.26.33\",\n \"@types/react\": \"^16.8.22\",\n \"@types/react-html-parser\": \"^2.0.1\",\n \"@types/react-intl\": \"^2.3.18\",\n \"@types/react-resize-detector\": \"^4.2.0\",\n \"@vtex/test-tools\": \"^0.3.2\",\n \"@vtex/tsconfig\": \"^0.2.0\",\n \"eslint\": \"5.x\",\n \"eslint-config-vtex-react\": \"^5.0.1\",\n \"prettier\": \"^1.18.2\",\n \"prop-types\": \"^15.7.2\",\n \"typescript\": \"3.8.3\"\n },\n \"version\": \"1.3.0\"\n}\n\n```" } ]
code_sku-list_0e0692a5
[ { "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 sku-list/react/typings.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ApolloError } from 'apollo-client'\nimport { ReactNodeArray } from 'react'\nimport { InjectedIntl } from 'react-intl'\n\nexport interface Product {\n productId: string\n description?: string\n productName: string\n productReference: string\n linkText: string\n brand: string\n brandId: number\n items: Item[]\n categories: string[]\n}\n\nexport interface Item {\n itemId: string\n name: string\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n sellers: Seller[]\n options?: BuyButtonItemOption[]\n variations: Variation[]\n}\n\nexport interface Variation {\n name: string\n values: string[]\n}\n\nexport interface LineItem {\n sellingPriceWithAssemblies: number\n price: number\n quantity: number\n}\n\nexport interface Image {\n imageUrls?: string[]\n imageUrl: string\n thresholds?: number[]\n thumbnailUrl?: string\n imageText: string\n imageLabel?: string\n imageTag?: string\n}\n\nexport interface Seller {\n sellerId: string | number\n sellerName: string\n commertialOffer: CommercialOffer\n}\n\nexport interface CommercialOffer {\n Price: number\n ListPrice: number\n PriceWithoutDiscount: number\n RewardValue: number\n AvailableQuantity: number\n Installments: Installment[]\n}\n\nexport interface Installment {\n Value: number\n InterestRate: number\n TotalValuePlusInterestRate: number\n NumberOfInstallments: number\n Name: string\n}\n\nexport interface PriceBreaks {\n priceBreaks: PriceBreak[]\n}\n\nexport interface PriceBreak {\n itemId: string\n maxQuantity: number\n minQuantity: number\n price: number\n leadTime: string\n totalScheduledTime: string\n}\n\nexport interface PriceBreakResult {\n loading: boolean\n error?: ApolloError\n data: PriceBreaks\n}\n\nexport interface MessageProps {\n showItemsPrice?: boolean\n skuItems: LineItem[]\n}\n\nexport interface BuyButtonItemOption {\n id: string\n quantity: number\n assemblyId: string\n seller?: string\n}\n\nexport interface InstalledApp {\n version: string\n}\n\nexport interface CheckoutVersion {\n installedApp: InstalledApp\n}\n\nexport type GroupId = string\n\nexport type InputValues = Record<string, string>\n\nexport interface AssemblyOptionItem {\n id: string\n quantity: number\n seller: string\n initialQuantity: number\n choiceType: GroupTypes\n name: string\n price: number\n children: Record<string, AssemblyOptionItem[]> | null\n}\n\nexport interface AssemblyOptions {\n items: Record<GroupId, AssemblyOptionItem[]>\n inputValues: Record<GroupId, InputValues>\n areGroupsValid: Record<GroupId, boolean>\n}\n\nexport type Option = ItemOption | InputValuesOption\n\nexport interface ItemOption {\n assemblyId: string\n id: string\n quantity: number\n seller: string\n options?: Option[]\n}\n\nexport type InputValue = Record<string, string | boolean>\n\nexport interface InputValuesOption {\n assemblyId: string\n inputValues: InputValue\n}\n\nexport interface AddedItem {\n id: string\n name: string\n quantity: number\n sellingPrice: number\n sellingPriceWithAssemblies: number\n assemblyOptions?: ParsedAssemblyOptionsMeta\n}\n\nexport type GroupTypes = 'SINGLE' | 'TOGGLE' | 'MULTIPLE'\n\nexport interface CartAddedOption {\n normalizedQuantity: number\n extraQuantity: number\n choiceType: GroupTypes\n item: AddedItem\n}\n\nexport interface CartRemovedOption {\n name: string\n initialQuantity: number\n removedQuantity: number\n}\n\nexport interface ParsedAssemblyOptionsMeta {\n added: CartAddedOption[]\n removed: CartRemovedOption[]\n parentPrice: number\n}\n\nexport interface ParsedAssemblyOptions {\n options: Option[]\n assemblyOptions: ParsedAssemblyOptionsMeta\n}\n\nexport interface BuyButtonItem {\n skuId: string\n quantity: number\n seller?: string | number\n name?: string\n price?: number\n variant?: string\n brand?: string\n options: BuyButtonItemOption[]\n}\n\nexport interface CartItem {\n index: number\n quantity: number\n detailUrl: string\n name: string\n brand: string\n category: string\n productRefId: string\n seller: string | number\n price: number\n listPrice: number\n variant: string\n skuId: string\n imageUrl: string\n options: Option[]\n assemblyOptions: ParsedAssemblyOptionsMeta\n sellingPriceWithAssemblies: number\n}\n\nexport interface MiniCartItem {\n quantity: number\n detailUrl: string\n name: string\n brand: string\n category: string\n productRefId: string\n seller: string | number\n sellingPrice: number\n listPrice: number\n skuName: string\n id: string\n imageUrl: string\n options: Option[]\n assemblyOptions: ParsedAssemblyOptionsMeta\n sellingPriceWithAssemblies: number\n}\n\nexport interface SkuSelector {\n isVisible: boolean\n areAllVariationsSelected: boolean\n}\n\nexport interface CustomApp {\n id?: string\n fields?: any\n}\n\nexport interface Address {\n addressName?: string\n addressType?: string\n city?: string\n complement?: string\n country?: string\n id?: string\n neighborhood?: string\n number?: string\n postalCode?: string\n receiverName?: string\n reference?: string\n state?: string\n street?: string\n userId?: string\n}\n\nexport interface AddItemResponse {\n data: {\n addItem: {\n items: {\n id: string\n seller: string | number\n }[]\n }\n }\n}\n\nexport interface OrderFormContext {\n message: {\n isSuccess?: boolean\n message?: string\n }\n loading: boolean\n refetch: () => Promise<void>\n addItem: ({ variables }: { variables: OrderFormArgs }) => AddItemResponse\n updateOrderForm: () => void\n updateOrderFormProfile: () => void\n updateAndRefetchOrderForm: () => void\n updateToastMessage: () => void\n updateOrderFormShipping: () => void\n orderForm: OrderFormArgs\n}\n\nexport interface TooltipArgs {\n showTooltipOnSkuNotSelected: boolean\n skuSelector: SkuSelector\n orderFormContext: OrderFormContext\n}\n\nexport interface BuyButtonWrapperProps {\n intl: InjectedIntl\n addToCart: (items: MiniCartItem[]) => AddToCartResponse\n showToast?: () => void\n onAddStart?: () => void\n onAddFinish?: () => void\n children: ReactNodeArray\n isOneClickBuy?: boolean\n shouldOpenMinicart?: boolean\n setMinicartOpen: () => void\n showItemsPrice?: boolean\n available?: boolean\n skuItems: CartItem[]\n large: boolean\n disabled?: boolean\n shouldAddToCart?: boolean\n customToastURL?: string\n showTooltipOnSkuNotSelected?: boolean\n checkoutVersion?: CheckoutVersion\n}\n\nexport interface AddToCartResponse {\n data: {\n addToCart: {\n id: string\n seller: string | number\n }[]\n }\n}\n\nexport interface BuyButtonProps {\n intl: InjectedIntl\n large: boolean\n // addToCart: (items: MiniCartItem[]) => AddToCartResponse\n addToCart: any\n skuItems: CartItem[]\n onAddStart?: () => void\n onAddFinish?: () => void\n // setMinicartOpen: (open: true) => void\n setMinicartOpen: any\n available?: boolean\n orderFormContext: OrderFormContext\n isOneClickBuy?: boolean\n children: ReactNodeArray\n disabled?: boolean\n shouldAddToCart?: boolean\n shouldOpenMinicart?: boolean\n showTooltipOnSkuNotSelected?: boolean\n checkoutUrl?: string\n customToastURL?: string\n showToast?: () => void\n}\n\nexport interface ToastMessageArgs {\n success: boolean\n isNewItem?: boolean\n}\n\nexport interface OrderFormArgs {\n orderFormId?: string\n value?: number\n items: {\n id: string\n seller: string | number\n options: Option[]\n quantity: number\n }[]\n customData: {\n customApps: CustomApp[]\n }\n shippingData: {\n address: Address\n availableAddresses: any[]\n }\n}\n\nexport enum InitialSelectionType {\n complete = 'complete',\n image = 'image',\n empty = 'empty',\n}\n\nexport enum DisplayMode {\n select = 'select',\n default = 'default',\n}\n\nexport type Variations = Record<string, string[]>\n\nexport type Maybe<T> = T | null | undefined\n\nexport interface BuyButtonContextState {\n clicked: boolean\n}\n\nexport interface ProductContextState {\n selectedItem: Maybe<Item>\n product: Maybe<Product>\n selectedQuantity: number\n skuSelector: {\n isVisible: boolean\n areAllVariationsSelected: boolean\n }\n buyButton: BuyButtonContextState\n assemblyOptions: {\n items: Record<string, AssemblyOptionItem[]>\n inputValues: Record<string, InputValues>\n areGroupsValid: Record<string, boolean>\n }\n}\n\nexport interface AssemblyOptionInput {\n id?: string\n quantity?: number\n assemblyId: string\n seller?: string\n inputValues?: Record<string, string | boolean>\n options?: AssemblyOptionInput[]\n}\n\nexport interface OrderFormItemInput {\n id?: number\n index?: number\n quantity?: number\n seller?: string\n uniqueId?: string\n options?: AssemblyOptionInput[]\n}\n\n```" } ]
code_sku-list_6c17d094
[ { "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 sku-list/react/SkuQuantitySelector.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuQuantitySelector from './components/SkuQuantitySelector'\n\nexport default SkuQuantitySelector\n\n```" } ]
code_sku-list_512880e2
[ { "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 sku-list/react/SkuImage.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuImage from './components/SkuImage'\n\nexport default SkuImage\n\n```" } ]
code_sku-list_2085a5f4
[ { "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 sku-list/react/SkuBuyButton.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuBuyButton from './components/SkuBuyButton'\n\nexport default SkuBuyButton\n\n```" } ]
code_sku-list_b0a60bb6
[ { "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 sku-list/react/SellerPrice.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SellerPrice from './components/SellerPrice'\n\nexport default SellerPrice\n\n```" } ]
code_sku-list_cccabe12
[ { "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 sku-list/react/SkuHighlights.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuHighlights from './components/SkuHighlights'\n\nexport default SkuHighlights\n\n```" } ]
code_sku-list_ddd2cb14
[ { "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 sku-list/react/SkuPrice.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuPrice from './components/SkuPrice'\n\nexport default SkuPrice\n\n```" } ]
code_sku-list_879c6ed2
[ { "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 sku-list/react/SellerInventory.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SellerInventory from './components/SellerInventory'\n\nexport default SellerInventory\n\n```" } ]
code_sku-list_34e26be2
[ { "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 sku-list/react/SkuSpecifications.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport SkuSpecifications from './components/SkuSpecifications'\n\nexport default SkuSpecifications\n\n```" } ]
code_sku-list_fea92fb6
[ { "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 sku-list/store/blocks.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"sku-list\": {\n \"blocks\": [\"sku-content.desktop\", \"sku-content.mobile\"]\n },\n \"sku-content.desktop\": {\n \"children\": [\n \"sku-name\",\n \"sku-image\",\n \"sku-seller\",\n \"sku-price\",\n \"sku-inventory\",\n \"sku-quantity-selector\",\n \"sku-buy-button\",\n \"sku-specifications\",\n \"sku-highlights\"\n ]\n },\n \"sku-content.mobile\": {\n \"children\": [\n \"sku-name\",\n \"sku-image\",\n \"sku-seller\",\n \"sku-price\",\n \"sku-inventory\",\n \"sku-quantity-selector\",\n \"sku-buy-button\",\n \"sku-specifications\",\n \"sku-highlights\"\n ]\n },\n \"sku-seller\": {\n \"children\": [\"seller-name\", \"seller-inventory\", \"seller-price\"]\n },\n \"sku-quantity-selector\": {\n \"blocks\": [\"item-quantity\"]\n },\n \"sku-buy-button\": {\n \"blocks\": [\"item-buy-button\"]\n }\n}\n\n```" } ]
code_sku-list_d569b7e7
[ { "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 sku-list/store/interfaces.json from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"sku-list\": {\n \"component\": \"SkuList\",\n \"allowed\": [\"sku-content.desktop\", \"sku-content.mobile\"]\n },\n \"sku-content\": {\n \"component\": \"SkuContent\",\n \"composition\": \"children\",\n \"allowed\": [\n \"flex-layout\",\n \"sku-name\",\n \"sku-seller\",\n \"sku-image\",\n \"sku-price\",\n \"sku-inventory\",\n \"sku-quantity-selector\",\n \"sku-buy-button\",\n \"sku-specifications\",\n \"sku-highlights\"\n ]\n },\n \"sku-content.desktop\": {\n \"device\": \"desktop\"\n },\n \"sku-content.mobile\": {\n \"device\": \"mobile\"\n },\n \"sku-name\": {\n \"component\": \"SkuName\"\n },\n \"sku-price\": {\n \"component\": \"SkuPrice\"\n },\n \"sku-inventory\": {\n \"component\": \"SkuInventory\"\n },\n \"sku-image\": {\n \"component\": \"SkuImage\"\n },\n \"sku-seller\": {\n \"component\": \"SkuSeller\",\n \"composition\": \"children\",\n \"allowed\": [\n \"flex-layout\",\n \"seller-name\",\n \"seller-inventory\",\n \"seller-price\"\n ]\n },\n \"seller-name\": {\n \"component\": \"SellerName\"\n },\n \"seller-inventory\": {\n \"component\": \"SellerInventory\"\n },\n \"seller-price\": {\n \"component\": \"SellerPrice\"\n },\n \"item-quantity\": {\n \"component\": \"ItemQuantity\"\n },\n \"sku-quantity-selector\": {\n \"component\": \"SkuQuantitySelector\",\n \"allowed\": [\"item-quantity\"]\n },\n \"item-buy-button\": {\n \"component\": \"BuyButton\"\n },\n \"sku-buy-button\": {\n \"component\": \"SkuBuyButton\",\n \"allowed\": [\"item-buy-button\"]\n },\n \"sku-specifications\": {\n \"component\": \"SkuSpecifications\"\n },\n \"sku-highlights\": {\n \"component\": \"SkuHighlights\"\n }\n}\n\n```" } ]
code_sku-list_1b203759
[ { "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 sku-list/react/mutations/setOpenMinicart.gql from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation setMinicartOpen($isOpen: Boolean!) {\n setMinicartOpen(isOpen: $isOpen) @client\n}\n\n```" } ]
code_sku-list_d4298c2e
[ { "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 sku-list/react/mutations/addToCart.gql from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation addToCart($items: [MinicartItem]) {\n addToCart(items: $items) @client\n}\n\n```" } ]
code_sku-list_a6c6582e
[ { "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 sku-list/react/typings/storefront.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent, ReactElement } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {\n getSchema?(props: P): object\n schema?: object\n }\n\n interface StorefrontComponent<P = {}, S = {}> extends Component<P, S> {\n getSchema?(props: P): object\n schema: object\n }\n}\n\n```" } ]
code_sku-list_7726a5d5
[ { "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 sku-list/react/typings/jsx.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport 'react'\n\ndeclare module 'react' {\n interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {\n loading?: 'lazy' | 'eager' | 'auto'\n }\n}\n\n```" } ]
code_sku-list_166c0b63
[ { "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 sku-list/react/typings/vtex.responsive-values.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.responsive-values' {\n const useResponsiveValues: (props: any) => any\n}\n\n```" } ]
code_sku-list_e73a7bf0
[ { "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 sku-list/react/typings/vtex.store-components.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.store-components/BuyButton'\ndeclare module 'vtex.store-components/SKUSelector'\ndeclare module 'vtex.store-components/ProductPrice'\ndeclare module 'vtex.store-components/GradientCollapse'\n\n```" } ]
code_sku-list_1c6b7f2c
[ { "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 sku-list/react/typings/vtex.product-context.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.product-context'\ndeclare module 'vtex.product-context/useProduct'\n\ndeclare module 'vtex.product-context/ProductDispatchContext' {\n type DispatchFunction = (payload: { type: string; args?: any }) => void\n export const useProductDispatch: () => DispatchFunction\n}\n\n```" } ]
code_sku-list_2ba3e2dd
[ { "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 sku-list/react/typings/vtex.checkout-resources.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.checkout-resources/Mutations'\n\n```" } ]
code_sku-list_eeacb940
[ { "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 sku-list/react/typings/vtex.product-quantity.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.product-quantity/ProductQuantity'\n\n```" } ]
code_sku-list_25d510ba
[ { "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 sku-list/react/typings/vtex.render-runtime.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* Typings for `render-runtime` */\ndeclare module 'vtex.render-runtime' {\n import { Component, ComponentType, ReactElement, ReactType } from 'react'\n\n export interface NavigationOptions {\n page: string\n params?: any\n }\n\n export interface RenderContextProps {\n runtime: {\n navigate: (options: NavigationOptions) => void\n }\n }\n\n interface ExtensionPointProps {\n id: string\n [key: string]: any\n }\n\n interface ChildBlock<BlockProps> {\n props: BlockProps\n }\n\n export const ExtensionPoint: ComponentType<ExtensionPointProps>\n export const useChildBlock: <BlockProps>({\n id,\n }: {\n id: string\n }) => ChildBlock<BlockProps> | null\n export const Helmet: ReactElement\n export const Link: ReactType\n export const NoSSR: ReactElement\n export const RenderContextConsumer: any\n export const TreePathContextConsumer: any\n export const useTreePath: any\n export const useRuntime: any\n export const canUseDOM: boolean\n export const withRuntimeContext: <TOriginalProps extends {}>(\n Component: ComponentType<TOriginalProps & RenderContextProps>\n ) => ComponentType<TOriginalProps>\n\n export const withSession: <TOriginalProps extends {}>(\n Component: ComponentType<TOriginalProps & RenderContextProps>\n ) => ComponentType<TOriginalProps>\n\n interface KeyValue {\n value: string\n }\n\n interface Session {\n id: string\n namespaces: {\n profile: {\n isAuthenticated: KeyValue\n }\n }\n }\n\n interface SessionUnauthorized {\n type: 'Unauthorized'\n message: string\n }\n\n export interface RenderSession {\n sessionPromise: Promise<SessionPromise>\n }\n\n export interface SessionPromise {\n response: Session | SessionUnauthorized\n }\n}\n\n```" } ]
code_sku-list_e55c8668
[ { "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 sku-list/react/typings/graphql.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```" } ]
code_sku-list_672f05c2
[ { "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 sku-list/react/queries/installedApp.gql from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery installedApp($slug: String!) {\n installedApp(slug: $slug) {\n version\n }\n}\n\n```" } ]
code_sku-list_e8fd2b6c
[ { "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 sku-list/react/utils/numberFormatter.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nconst hasNavigator = typeof navigator !== 'undefined'\n\nexport const formatNumber = (numberLiteral?: number) => {\n if (!numberLiteral || isNaN(numberLiteral)) {\n return ''\n }\n\n return hasNavigator && numberLiteral.toLocaleString(navigator.language)\n}\n\n```" } ]
code_sku-list_9290f895
[ { "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 sku-list/react/utils/aspectRatioUtil.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { changeImageUrlSize } from './generateUrl'\n\ntype AspectRatio = string | number\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?: AspectRatio | null) => {\n if (!input) {\n return null\n }\n if (typeof input === 'string') {\n if (input === 'auto') {\n return null\n }\n const separator = ':'\n const data = input.split(separator)\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' || 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 = (src: string, size: number, maxSize: number, aspectRatio?: AspectRatio) => {\n let width = size\n let height: number | string = 'auto'\n\n if (aspectRatio && aspectRatio !== 'auto') {\n height = size * (parseAspectRatio(aspectRatio) || 1)\n\n if (width > maxSize) {\n height = height / (width / maxSize)\n width = maxSize\n }\n\n if (height > maxSize) {\n width = 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_sku-list_ccba0eba
[ { "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 sku-list/react/utils/constants.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const MAX_VISIBLE_ITEMS_IN_TABLE = 2\nexport const MAX_ROWS_PRODUCT_PRICE_BREAKS_TABLE = 12\nexport const CURRENCY_SYMBOL = '$'\n\n```" } ]
code_sku-list_e895ee28
[ { "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 sku-list/react/utils/generateImageConfig.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { changeImageUrlSize } from './generateUrl'\nimport { Image } from '../typings'\n\nconst thumbnailSize = 160\n\nexport default function generateImageConfig(image: Image) {\n return {\n imageUrl: image.imageUrl,\n thumbnailUrl: changeImageUrlSize(image.imageUrl, thumbnailSize),\n imageText: image.imageText,\n imageLabel: image.imageLabel,\n }\n}\n\n```" } ]
code_sku-list_d0fb81fc
[ { "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 sku-list/react/utils/enums.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const THUMBS_POSITION_HORIZONTAL = {\n LEFT: 'left',\n RIGHT: 'right',\n}\n\nexport const THUMBS_ORIENTATION = {\n VERTICAL: 'vertical',\n HORIZONTAL: 'horizontal',\n}\n\nexport const DEFAULT_EXCLUDE_IMAGE_WITH = 'skuvariation'\n\n```" } ]
code_sku-list_de00bb36
[ { "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 sku-list/react/utils/generateUrl.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const DEFAULT_WIDTH = 'auto'\nexport const DEFAULT_HEIGHT = 'auto'\nexport const MAX_WIDTH = 3000\nexport const MAX_HEIGHT = 4000\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\nexport const cleanImageUrl = (imageUrl: string) => {\n const result = baseUrlRegex.exec(imageUrl)\n if (result && result.length > 0) {\n return result[0]\n }\n return null\n}\n\nconst replaceLegacyFileManagerUrl = (\n imageUrl: string,\n width: string,\n height: string\n) => {\n const legacyUrlPattern = '/arquivos/ids/'\n const isLegacyUrl = imageUrl.includes(legacyUrlPattern)\n if (!isLegacyUrl) {\n return imageUrl\n }\n return `${cleanImageUrl(imageUrl)}-${width}-${height}`\n}\n\nexport const 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.toString(),\n height.toString()\n )\n const queryStringSeparator = normalizedImageUrl.includes('?') ? '&' : '?'\n\n return `${normalizedImageUrl}${queryStringSeparator}width=${width}&height=${height}&aspect=true`\n}\n\n```" } ]
code_sku-list_9518a66d
[ { "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 sku-list/react/components/SkuInventory.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSku } from './SkuContext'\nimport { Item, Seller } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { pathOr } from 'ramda'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['inventoryContainer', 'inventory'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SkuInventory = ({ showLabel }: Props) => {\n const { sku }: { sku: Item } = useSku()\n const handles = useCssHandles(CSS_HANDLES)\n const inventory: number = sku.sellers\n .map((seller: Seller) =>\n pathOr(0, ['commertialOffer', 'AvailableQuantity'], seller)\n )\n .reduce(\n (accumulator: number, availableQuantity: number) =>\n accumulator + availableQuantity\n )\n\n return (\n <div\n className={`pt3 pb5 t-body c-muted-1 lh-copy ${handles.inventoryContainer}`}>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.inventory.title\" />:{' '}\n </span>\n )}\n <span className={`${handles.inventory}`}>{inventory}</span>\n </div>\n )\n}\n\nSkuInventory.defaultProps = {\n showLabel: true,\n}\n\nSkuInventory.schema = {\n title: 'admin/editor.sku-list.inventory.title',\n description: 'admin/editor.sku-list.inventory.description',\n type: 'object',\n properties: {\n showLabel: {\n type: 'boolean',\n title: 'admin/editor.sku-list.inventory.showLabel.title',\n default: true,\n isLayout: false,\n },\n },\n}\n\nexport default SkuInventory\n\n```" } ]
code_sku-list_58e6b7cf
[ { "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 sku-list/react/components/SkuContext.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useReducer } from 'react'\nimport { createContext, useContext } from 'react'\nimport { Item, Product } from '../typings'\n\nconst SkuContext = createContext<State | undefined>(undefined)\nconst SkuDispatchContext = createContext<Dispatch | undefined>(undefined)\n\ninterface State {\n product: Product\n sku: Item\n isHovering: boolean\n isLoading: boolean\n selectedQuantity: number\n buyButton: {\n clicked: boolean\n }\n}\n\ntype Dispatch = (action: Action) => void\n\ninterface SetHoverAction {\n type: 'SET_HOVER'\n args: {\n isHovering: boolean\n }\n}\n\ninterface SetLoadingAction {\n type: 'SET_LOADING'\n args: {\n isLoading: boolean\n }\n}\n\ninterface SetProductQuantity {\n type: 'SET_QUANTITY'\n args: {\n quantity: number\n }\n}\n\ninterface SetBuyButtonClicked {\n type: 'SET_BUY_BUTTON_CLICKED'\n args: { clicked: boolean }\n}\n\ntype Action =\n | SetHoverAction\n | SetLoadingAction\n | SetProductQuantity\n | SetBuyButtonClicked\n\nexport function reducer(state: State, action: Action) {\n switch (action.type) {\n case 'SET_HOVER': {\n return {\n ...state,\n isHovering: action.args.isHovering,\n }\n }\n case 'SET_LOADING': {\n return {\n ...state,\n isLoading: action.args.isLoading,\n }\n }\n case 'SET_QUANTITY': {\n return {\n ...state,\n selectedQuantity: action.args.quantity,\n }\n }\n case 'SET_BUY_BUTTON_CLICKED': {\n const args = action.args || {}\n return {\n ...state,\n buyButton: {\n ...state.buyButton,\n clicked: args.clicked,\n },\n }\n }\n default:\n return state\n }\n}\n\ninterface Props {\n sku: Item\n product: Product\n children: any\n}\n\nexport const SkuProvider = ({ sku, product, children }: Props) => {\n const initialState = {\n product,\n sku,\n isHovering: false,\n isLoading: false,\n selectedQuantity: 1,\n buyButton: {\n clicked: false,\n },\n }\n\n const [state, dispatch] = useReducer(reducer, initialState)\n\n return (\n <SkuContext.Provider value={state}>\n <SkuDispatchContext.Provider value={dispatch}>\n {children}\n </SkuDispatchContext.Provider>\n </SkuContext.Provider>\n )\n}\n\nexport function useSkuDispatch() {\n const context = useContext(SkuDispatchContext)\n\n if (context === undefined) {\n throw new Error('useSkuDispatch must be used within a SkuDispatchProvider')\n }\n\n return context\n}\n\nexport function useSku() {\n const context = useContext(SkuContext)\n\n if (context === undefined) {\n throw new Error('useSku must be used within a SkuProvider')\n }\n\n return context\n}\n\n```" } ]
code_sku-list_c06842ce
[ { "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 sku-list/react/components/SkuBuyButton.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { BuyButtonItem, Item } from '../typings'\nimport { useSku } from './SkuContext'\n\nimport { ExtensionPoint } from 'vtex.render-runtime'\nimport { path } from 'ramda'\n\ninterface Props {\n sku: Item\n selectedQuantity: number\n}\n\nconst SkuBuyButton = () => {\n const { sku, selectedQuantity }: Props = useSku()\n const buyButtonItem: BuyButtonItem = {\n skuId: sku.itemId,\n seller: path<string | number>(['sellers', 0, 'sellerId'], sku),\n options: sku.options || [],\n quantity: selectedQuantity,\n }\n\n return (\n <div>\n <ExtensionPoint\n id=\"item-buy-button\"\n selectedItem={sku}\n selectedQuantity={selectedQuantity}\n skuItems={[buyButtonItem]}\n isOneClickBuy={false}\n shouldAddToCart\n />\n </div>\n )\n}\n\nexport default SkuBuyButton\n\n```" } ]
code_sku-list_5be1c4f3
[ { "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 sku-list/react/components/SkuName.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSku } from './SkuContext'\nimport { Item } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['skuName'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SkuName = ({ showLabel }: Props) => {\n const { sku }: { sku: Item } = useSku()\n const handles = useCssHandles(CSS_HANDLES)\n return (\n <div>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.sku.name.title\" />:{' '}\n </span>\n )}\n <h4 className={`${handles.skuName} t-heading-4 c-muted-1`}>{sku.name}</h4>\n </div>\n )\n}\n\nexport default SkuName\n\n```" } ]
code_sku-list_ba8b9792
[ { "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 sku-list/react/components/SkuImage.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport { useSku } from './SkuContext'\nimport { path, map } from 'ramda'\n\nimport generateImageConfig from '../utils/generateImageConfig'\nimport { Item, Image } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\n\ninterface Props {\n images: Image[]\n}\n\nconst CSS_HANDLES = ['skuImage']\n\nconst SkuImagesWrapper = (props: Props) => {\n const { sku }: { sku: Item } = useSku()\n\n const images: Image[] = useMemo(\n () =>\n props.images != null\n ? props.images\n : map(generateImageConfig, path(['images'], sku) || []),\n [props.images, sku]\n )\n\n const handles = useCssHandles(CSS_HANDLES)\n return (\n <div className={handles.skuImage}>\n <img\n src={path([0, 'imageUrl'], images)}\n alt={path([0, 'imageText'], images)}\n />\n </div>\n )\n}\n\nexport default SkuImagesWrapper\n\n```" } ]
code_sku-list_4b1a129f
[ { "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 sku-list/react/components/Loader.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport ContentLoader from 'react-content-loader'\n\nconst Loader = () => (\n <ContentLoader\n height={170}\n width={180}\n style={{\n width: '100%'\n }}>\n <rect width=\"180\" height=\"180\" />\n </ContentLoader>\n)\n\nexport default Loader\n\n```" } ]
code_sku-list_6fd8524c
[ { "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 sku-list/react/components/SellerName.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSkuSeller } from './SkuSellerContext'\nimport { Seller } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['sellerName'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SellerName = ({ showLabel }: Props) => {\n const { seller }: { seller: Seller } = useSkuSeller()\n const handles = useCssHandles(CSS_HANDLES)\n return seller ? (\n <div>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.seller.name.title\" />:{' '}\n </span>\n )}\n <h5 className={`${handles.sellerName} t-heading-5 c-muted-1`}>\n {seller.sellerName}\n </h5>\n </div>\n ) : (\n <div />\n )\n}\n\nexport default SellerName\n\n```" } ]
code_sku-list_154e4ce2
[ { "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 sku-list/react/components/SkuSellerContext.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { ReactNode, useReducer } from 'react'\nimport { createContext, useContext } from 'react'\nimport { Seller, Item, Product } from '../typings'\n\nconst SkuSellerContext = createContext<State | undefined>(undefined)\nconst SkuSellerDispatchContext = createContext<Dispatch | undefined>(undefined)\n\ninterface State {\n seller: Seller\n item: Item\n product: Product\n isHovering: boolean\n isLoading: boolean\n selectedQuantity: number\n}\n\ntype Dispatch = (action: Action) => void\n\n// type SetProductAction = {\n// type: 'SET_PRODUCT',\n// args: {\n// product: any\n// }\n// }\n\n// type SetProductQueryAction = {\n// type: 'SET_PRODUCT_QUERY',\n// args: {\n// query: string\n// }\n// }\n\ninterface SetHoverAction {\n type: 'SET_HOVER'\n args: {\n isHovering: boolean\n }\n}\n\ninterface SetLoadingAction {\n type: 'SET_LOADING'\n args: {\n isLoading: boolean\n }\n}\n\ninterface SetProductQuantity {\n type: 'SET_QUANTITY'\n args: {\n quantity: number\n }\n}\n\ntype Action = SetHoverAction | SetLoadingAction | SetProductQuantity\n\nexport function reducer(state: State, action: Action) {\n switch (action.type) {\n // case 'SET_PRODUCT': {\n // const product = action.args.product\n // return {\n // ...state,\n // product: product,\n // //TODO: STOP USING PRODUCT.SKU https://app.clubhouse.io/vtex/story/18547/productsummarycontext-refactor\n // selectedItem: product.sku\n // }\n // }\n case 'SET_HOVER': {\n return {\n ...state,\n isHovering: action.args.isHovering,\n }\n }\n case 'SET_LOADING': {\n return {\n ...state,\n isLoading: action.args.isLoading,\n }\n }\n case 'SET_QUANTITY': {\n return {\n ...state,\n selectedQuantity: action.args.quantity,\n }\n }\n // case 'SET_PRODUCT_QUERY':\n // return {\n // ...state,\n // query: action.args.query,\n // }\n default:\n return state\n }\n}\n\ninterface Props {\n seller: Seller\n item: Item\n product: Product\n children?: ReactNode[]\n}\n\nexport const SkuSellerProvider = ({\n seller,\n item,\n product,\n children,\n}: Props) => {\n const initialState = {\n seller,\n item,\n product,\n isHovering: false,\n isLoading: false,\n selectedQuantity: 1,\n }\n\n const [state, dispatch] = useReducer(reducer, initialState)\n\n return (\n <SkuSellerContext.Provider value={state}>\n <SkuSellerDispatchContext.Provider value={dispatch}>\n {children}\n </SkuSellerDispatchContext.Provider>\n </SkuSellerContext.Provider>\n )\n}\n\nexport function useSkuSellerDispatch() {\n const context = useContext(SkuSellerDispatchContext)\n\n if (context === undefined) {\n throw new Error(\n 'useSkuSellerDispatch must be used within a SkuSellerDispatchProvider'\n )\n }\n\n return context\n}\n\nexport function useSkuSeller() {\n const context = useContext(SkuSellerContext)\n\n if (context === undefined) {\n throw new Error('useSkuSeller must be used within a SkuSellerProvider')\n }\n\n return context\n}\n\n```" } ]
code_sku-list_1d91c7ca
[ { "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 sku-list/react/components/SkuPrice.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSku } from './SkuContext'\nimport { Item } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { path } from 'ramda'\nimport { FormattedCurrency } from 'vtex.format-currency'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['priceContainer'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SkuPrice = ({ showLabel }: Props) => {\n const { sku }: { sku: Item } = useSku()\n const sellingPrice: number | undefined = path(\n ['sellers', 0, 'commertialOffer', 'Price'],\n sku\n )\n const handles = useCssHandles(CSS_HANDLES)\n\n return sellingPrice ? (\n <div\n className={`pt3 pb5 t-body c-muted-1 lh-copy ${handles.priceContainer}`}>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.sku.price.title\" />:{' '}\n </span>\n )}\n <span>\n <FormattedCurrency value={sellingPrice} />\n </span>\n </div>\n ) : (\n <div />\n )\n}\n\nexport default SkuPrice\n\n```" } ]
code_sku-list_c1cfc315
[ { "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 sku-list/react/components/SkuHighlights.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSku } from './SkuContext'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { Item, Variation } from '../typings'\nimport { toVariationArray, useVariations } from '../hooks/useVariations'\nimport { propOr } from 'ramda'\nimport HtmlParser from 'react-html-parser'\n\nconst CSS_HANDLES = [\n 'highlightContent',\n 'itemHighlight',\n 'highlightTitle',\n 'highlightValue',\n]\n\ninterface Props {\n conditional: {\n typeSpecifications: string\n highlight: string\n }\n skuSelected: Item\n visibleVariations?: string[]\n showLabel: boolean\n}\n\nconst SkuHighlights = (props: Props) => {\n\n const valuesFromContext = useSku()\n const { conditional, showLabel } = props\n const skuSelected =\n props.skuSelected != null\n ? props.skuSelected\n : valuesFromContext.sku\n const skuItems = [skuSelected]\n const shouldNotShow =\n skuItems.length === 0 ||\n !skuSelected?.variations ||\n skuSelected.variations.length === 0\n const variations = useVariations(skuItems, shouldNotShow, props.visibleVariations)\n\n const handles = useCssHandles(CSS_HANDLES)\n\n if (shouldNotShow || !skuSelected) {\n return null\n }\n\n const getHighlights = () => {\n const choose: string = propOr('', 'highlight', conditional)\n const allSpecifications: Variation[] = toVariationArray(variations)\n\n if (choose === 'admin/editor.sku-list.highlights.allSpecifications') {\n return allSpecifications\n }\n\n if (choose === 'admin/editor.sku-list.highlights.chooseDefaultSpecification') {\n const typeSpecifications: string = propOr('', 'typeSpecifications', conditional)\n const specificationNames: string[] = typeSpecifications.trim().split(',')\n\n return specificationNames.reduce((acc: Variation[], item: string) => {\n const highlight = allSpecifications.filter(\n x => x.name.toLowerCase() === item.trim().toLowerCase(),\n )\n return acc.concat(highlight)\n }, [])\n }\n return []\n }\n\n const highlights: Variation[] = getHighlights()\n\n return (\n <div className={`${handles.highlightContent} pt3 pb5`}>\n {highlights.length == 0 ? <div className={`${handles.itemHighlight} pv2`}>\n <span\n className={`${handles.highlightValue} t-body c-muted-1 lh-copy `}\n >\n {'N/A'}\n </span>\n </div> : highlights.map((item: Variation, i: number) => (\n <div\n className={`${handles.itemHighlight} pv2`}\n data-name={item.name}\n data-value={item.values[0]}\n key={i}\n >\n {showLabel && (<span\n className={`${handles.highlightTitle} t-body c-on-base fw7 pr3 `}\n >\n {HtmlParser(item.name)}\n {': '}\n </span>)}\n <span\n className={`${handles.highlightValue} t-body c-muted-1 lh-copy `}\n >\n {HtmlParser(item.values[0])}\n </span>\n </div>\n ))}\n </div>\n )\n}\n\nSkuHighlights.defaultProps = {\n showLabel: true,\n}\n\nSkuHighlights.schema = {\n title: 'admin/editor.sku-list.highlights.title',\n description: 'admin/editor.sku-list.highlights.description',\n type: 'object',\n definitions: {\n highlightGroupDefault: {\n title: 'highlightGroupDefault',\n type: 'object',\n properties: {\n highlight: {\n title: 'admin/editor.sku-list.highlights.default',\n type: 'string',\n enum: [\n 'admin/editor.sku-list.highlights.allSpecifications',\n 'admin/editor.sku-list.highlights.chooseDefaultSpecification',\n ],\n default: 'admin/editor.sku-list.highlights.allSpecifications',\n },\n },\n required: ['highlight'],\n dependencies: {\n highlight: {\n oneOf: [\n {\n properties: {\n highlight: {\n enum: [\n 'admin/editor.sku-list.highlights.allSpecifications',\n ],\n },\n },\n },\n {\n properties: {\n highlight: {\n enum: [\n 'admin/editor.sku-list.highlights.chooseDefaultSpecification',\n ],\n },\n typeSpecifications: {\n type: 'string',\n title:\n 'admin/editor.sku-list.highlights.typeSpecifications.title',\n },\n },\n required: [''],\n },\n ],\n },\n },\n },\n },\n properties: {\n showHighlight: {\n type: 'boolean',\n title: 'admin/editor.sku-list.highlights.showHighlight.title',\n default: false,\n isLayout: false,\n },\n showLabel: {\n type: 'boolean',\n title: 'admin/editor.sku-list.highlights.showLabel.title',\n default: true,\n isLayout: false,\n },\n conditional: {\n title: 'Conditional',\n $ref: '#/definitions/highlightGroupDefault',\n },\n },\n}\n\nexport default SkuHighlights\n\n```" } ]
code_sku-list_13304755
[ { "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 sku-list/react/components/SkuSeller.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { ReactNode } from 'react'\nimport { Item, Product, Seller } from '../typings'\nimport { SkuSellerProvider } from './SkuSellerContext'\n\ninterface Props {\n seller: Seller\n item: Item\n product: Product\n children?: ReactNode[]\n}\n\nconst SkuSeller = ({ seller, item, product, children }: Props) => {\n return (\n <SkuSellerProvider seller={seller} item={item} product={product}>\n {children}\n </SkuSellerProvider>\n )\n}\n\nexport default SkuSeller\n\n```" } ]
code_sku-list_16606499
[ { "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 sku-list/react/components/SkuList.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { path, pathOr } from 'ramda'\nimport React, { FunctionComponent, useContext } from 'react'\nimport { ProductContext } from 'vtex.product-context'\nimport { ExtensionPoint } from 'vtex.render-runtime'\nimport { useDevice } from 'vtex.device-detector'\nimport { Item, Product } from '../typings'\n\nenum Device {\n mobile = 'mobile',\n desktop = 'desktop',\n}\n\nconst SkuListComponent = React.memo(({ device }: { device: Device }) => {\n const valuesFromContext = useContext(ProductContext)\n const items: Item[] = pathOr([], ['product', 'items'], valuesFromContext)\n const product: Product | undefined = path(['product'], valuesFromContext)\n\n const renderContent = (item: Item) => {\n switch (device) {\n case Device.mobile:\n return (\n <ExtensionPoint\n id=\"sku-content.mobile\"\n item={item}\n product={product}\n key={`sku-content-${item.itemId}`}\n />\n )\n case Device.desktop:\n default:\n return (\n <ExtensionPoint\n id=\"sku-content.desktop\"\n item={item}\n product={product}\n key={`sku-content-${item.itemId}`}\n />\n )\n }\n }\n\n return (\n <div className=\"mw9 center pa3\">\n {items.map((item: Item) => renderContent(item))}\n </div>\n )\n})\n\nSkuListComponent.displayName = 'SkuListComponent'\n\nconst SkuList: FunctionComponent = () => {\n const { isMobile } = useDevice()\n\n return <SkuListComponent device={isMobile ? Device.mobile : Device.desktop} />\n}\n\nexport default SkuList\n\n```" } ]
code_sku-list_9c8c43e9
[ { "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 sku-list/react/components/SellerInventory.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSkuSeller } from './SkuSellerContext'\nimport { Seller } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { path } from 'ramda'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['sellerInventoryWrapper', 'sellerInventory'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SellerInventory = ({ showLabel }: Props) => {\n const { seller }: { seller: Seller } = useSkuSeller()\n const handles = useCssHandles(CSS_HANDLES)\n return seller ? (\n <div className={`${handles.sellerInventoryWrapper} lh-copy`}>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.inventory.title\" />:{' '}\n </span>\n )}\n <span className={`${handles.sellerInventory}`}>\n {path(['commertialOffer', 'AvailableQuantity'], seller)}\n </span>\n </div>\n ) : (\n <div />\n )\n}\n\nexport default SellerInventory\n\n```" } ]
code_sku-list_b98f973f
[ { "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 sku-list/react/components/SkuSpecifications.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, Fragment } from 'react'\nimport HtmlParser from 'react-html-parser'\nimport { FormattedMessage } from 'react-intl'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { InitialSelectionType, DisplayMode, Item, Variation } from '../typings'\nimport { useDevice } from 'vtex.device-detector'\nimport { useSku } from './SkuContext'\nimport GradientCollapse from 'vtex.store-components/GradientCollapse'\nimport { toVariationArray, useVariations } from '../hooks/useVariations'\n\nconst CSS_HANDLES = [\n 'specificationsTableContainer',\n 'specificationsTabsContainer',\n 'specificationsTitle',\n 'specificationsTable',\n 'specificationsTab',\n 'specificationsTablePropertyHeading',\n 'specificationsTableSpecificationHeading',\n 'specificationItemProperty',\n 'specificationItemSpecifications',\n]\n\ninterface Props {\n skuItems: Item[]\n skuSelected: Item\n onSKUSelected?: (skuId: string) => void\n maxItems?: number\n seeMoreLabel: string\n hideImpossibleCombinations?: boolean\n showValueNameForImageVariation?: boolean\n imageHeight?: number | object\n imageWidth?: number | object\n thumbnailImage?: string\n visibleVariations?: string[]\n showVariationsLabels?: boolean\n variationsSpacing?: number\n showVariationsErrorMessage?: boolean\n initialSelection?: InitialSelectionType\n displayMode?: DisplayMode\n collapsible: string\n}\n\nconst SKUSelectorWrapper: StorefrontFunctionComponent<Props> = props => {\n const valuesFromContext = useSku()\n\n const { isMobile } = useDevice()\n\n const skuSelected =\n props.skuSelected != null\n ? props.skuSelected\n : valuesFromContext.sku\n\n const skuItems = [skuSelected]\n\n const shouldNotShow =\n skuItems.length === 0 ||\n !skuSelected?.variations ||\n skuSelected.variations.length === 0\n\n const variations = useVariations(skuItems, shouldNotShow, props.visibleVariations)\n\n const handles = useCssHandles(CSS_HANDLES)\n\n const [collapsed, setCollapsed] = useState(true)\n\n if (shouldNotShow || !skuSelected) {\n return null\n }\n\n const specifications: Variation[] = toVariationArray(variations)\n\n const specificationsTable = (\n <table\n className={`${handles.specificationsTable} w-100 bg-base border-collapse`}\n >\n <thead>\n <tr>\n <th\n className={`${handles.specificationsTablePropertyHeading} w-50 b--muted-4 bb bt c-muted-2 t-body tl pa5`}\n >\n <FormattedMessage id=\"store/product-description.property\" />\n </th>\n <th\n className={`${handles.specificationsTableSpecificationHeading} w-50 b--muted-4 bb bt c-muted-2 t-body tl pa5`}\n >\n <FormattedMessage id=\"store/product-description.specification\" />\n </th>\n </tr>\n </thead>\n <tbody>\n {specifications.map((specification: Variation, i: number) => (\n <tr key={i}>\n <td\n className={`${handles.specificationItemProperty} w-50 b--muted-4 bb pa5`}\n >\n {HtmlParser(specification.name)}\n </td>\n <td\n className={`${handles.specificationItemSpecifications} w-50 b--muted-4 bb pa5`}\n >\n {HtmlParser(specification.values.join(', '))}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )\n\n const collapsible = props.collapsible || 'always'\n\n const shouldBeCollapsible = Boolean(\n collapsible === 'always' ||\n (collapsible === 'mobileOnly' && isMobile) ||\n (collapsible === 'desktopOnly' && !isMobile)\n )\n\n const specificationTitle = (\n <FormattedMessage id=\"store/specifications.title\">\n {(txt) => (\n <h2 className={`${handles.specificationsTitle} t-heading-5 mb5 mt0`}>\n {HtmlParser(txt as string)}\n </h2>\n )}\n </FormattedMessage>\n )\n\n const tableView = (\n <Fragment>\n {specifications.length > 0 && (\n <div\n className={`${handles.specificationsTableContainer} mt9 mt0-l pl8-l`}\n >\n {specificationTitle}\n {shouldBeCollapsible ? (\n <GradientCollapse\n collapseHeight={220}\n collapsed={collapsed}\n onCollapsedChange={(_: any, newValue: boolean) => setCollapsed(newValue)}\n >\n {specificationsTable}\n </GradientCollapse>\n ) : (\n specificationsTable\n )}\n </div>\n )}\n </Fragment>\n )\n\n return tableView\n}\n\nSKUSelectorWrapper.schema = {\n title: 'admin/editor.skuSelector.title',\n description: 'admin/editor.skuSelector.description',\n}\n\nexport default SKUSelectorWrapper\n\n```" } ]
code_sku-list_bc4349b4
[ { "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 sku-list/react/components/SkuQuantitySelector.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Item } from '../typings'\nimport { useSku } from './SkuContext'\n\nimport { ExtensionPoint } from 'vtex.render-runtime'\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SkuQuantitySelector = ({ showLabel = false }: Props) => {\n const {\n sku,\n selectedQuantity,\n }: { sku: Item; selectedQuantity: number } = useSku()\n\n return (\n <div>\n <ExtensionPoint\n id=\"item-quantity\"\n selectedItem={sku}\n showLabel={showLabel}\n selectedQuantity={selectedQuantity}\n />\n </div>\n )\n}\n\nexport default SkuQuantitySelector\n\n```" } ]
code_sku-list_6d3ef770
[ { "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 sku-list/react/components/SellerPrice.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useSkuSeller } from './SkuSellerContext'\nimport { Seller, Item } from '../typings'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { path } from 'ramda'\nimport { FormattedCurrency } from 'vtex.format-currency'\nimport { FormattedMessage } from 'react-intl'\n\nconst CSS_HANDLES = ['sellerPriceContainer'] as const\n\ninterface Props {\n showLabel: boolean\n}\n\nconst SellerPrice = ({ showLabel }: Props) => {\n const { seller }: { seller: Seller; item: Item } = useSkuSeller()\n const sellingPrice: number | undefined = path(\n ['commertialOffer', 'Price'],\n seller\n )\n const handles = useCssHandles(CSS_HANDLES)\n\n return seller ? (\n <div className={handles.sellerPriceContainer}>\n {showLabel && (\n <span className=\"t-body c-on-base fw7 pr3\">\n <FormattedMessage id=\"store/sku-list.seller.price.title\" />:{' '}\n </span>\n )}\n <span>\n <FormattedCurrency value={sellingPrice} />\n </span>\n </div>\n ) : (\n <div />\n )\n}\n\nexport default SellerPrice\n\n```" } ]
code_sku-list_621738a7
[ { "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 sku-list/react/components/SkuContent.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { ReactNode } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { ExtensionPoint } from 'vtex.render-runtime'\nimport { Item, Product, Seller } from '../typings'\nimport { SkuProvider } from './SkuContext'\nimport useProduct from 'vtex.product-context/useProduct'\nimport { useProductDispatch } from 'vtex.product-context/ProductDispatchContext'\nimport classNames from 'classnames'\n\nconst CSS_HANDLES = ['skuContentWrapper', 'selectedSkuContentWrapper'] as const\n\ninterface Props {\n product: Product\n item: Item\n children?: ReactNode[]\n}\n\nconst SkuContent = ({ item, product, children }: Props) => {\n const handles = useCssHandles(CSS_HANDLES)\n const { selectedItem }: { selectedItem: Item } = useProduct()\n const dispatch = useProductDispatch()\n const handleClick = () => {\n if (dispatch) {\n dispatch({ type: 'SET_SELECTED_ITEM', args: { item: item } })\n }\n }\n const containerClasses = classNames(\n 'ba mb3 pa5',\n handles.skuContentWrapper,\n {\n [`bw1 b--muted-1 ${handles.selectedSkuContentWrapper}`]:\n selectedItem.itemId != item.itemId,\n },\n {\n [`bw1 b--blue ${handles.selectedSkuContentWrapper}`]:\n selectedItem.itemId == item.itemId,\n }\n )\n return (\n <SkuProvider sku={item} product={product}>\n <div\n className={containerClasses}\n onClick={handleClick}\n role=\"button\"\n tabIndex={parseInt(item.itemId)}\n onKeyDown={handleClick}>\n {children}\n {item.sellers.map((seller: Seller) => (\n <ExtensionPoint\n id=\"sku-seller\"\n seller={seller}\n item={item}\n product={product}\n key={`seller-${seller.sellerId}`}\n />\n ))}\n </div>\n </SkuProvider>\n )\n}\n\nexport default SkuContent\n\n```" } ]
code_sku-list_97639e03
[ { "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 sku-list/react/__tests__/index.test.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\ndescribe('Orders List Scenarios', () => {\n it('should work', () => {\n expect(1).toBe(1)\n })\n})\n\n```" } ]
code_sku-list_9e3d18fb
[ { "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 sku-list/react/graphql/checkProfileAllowed.graphql from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery checkProfileAllowed {\n checkProfileAllowed @context(provider: \"vtex.store-graphql\") {\n allowed\n }\n}\n\n```" } ]
code_sku-list_350b5e85
[ { "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 sku-list/react/hooks/useVariations.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Item, Variation, Variations } from '../typings'\nimport { useMemo } from 'react'\n\nexport const useVariations = (\n skuItems: Item[],\n shouldNotShow: boolean,\n visibleVariations?: string[]\n) => {\n const result = useMemo(() => {\n if (\n shouldNotShow ||\n (visibleVariations && visibleVariations.length === 0)\n ) {\n return {}\n }\n const variations: Variations = {}\n const variationsSet: Record<string, Set<string>> = {}\n if (visibleVariations) {\n visibleVariations = visibleVariations.map(variation => variation.toLowerCase().trim())\n }\n\n for (const skuItem of skuItems) {\n for (const currentVariation of skuItem.variations) {\n const { name, values } = currentVariation\n if (!visibleVariations || visibleVariations.includes(name.toLowerCase().trim())) {\n\n const value = values[0]\n const currentSet = variationsSet[name] || new Set()\n currentSet.add(value)\n variationsSet[name] = currentSet\n }\n }\n }\n const variationsNames = Object.keys(variationsSet)\n // Transform set back to array\n for (const variationName of variationsNames) {\n const set = variationsSet[variationName]\n variations[variationName] = Array.from(set)\n }\n return variations\n }, [skuItems, shouldNotShow])\n return result\n}\n\nexport const toVariationArray = (variations: Variations) => {\n let result: Variation[] = []\n const variationNames = Object.keys(variations)\n for (const variationName of variationNames) {\n result = [\n ...result,\n { name: variationName, values: variations[variationName] },\n ]\n }\n return result\n}\n\n```" } ]
code_sku-list_5d3c3f0d
[ { "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 sku-list/react/modules/session.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { SessionPromise } from 'vtex.render-runtime'\n\nexport function getSession() {\n return window &&\n (window as any).__RENDER_8_SESSION__ &&\n (window as any).__RENDER_8_SESSION__.sessionPromise\n ? ((window as any).__RENDER_8_SESSION__.sessionPromise as Promise<\n SessionPromise\n >)\n : null\n}\n\n```" } ]
code_sku-list_3de6bea6
[ { "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 sku-list/react/typings/vtex.store-resources/OrderFormContext.d.ts from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.store-resources/OrderFormContext'\n\n```" } ]
code_sku-list_2d807cb9
[ { "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 sku-list/react/components/BuyButton/AddToCartButton.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { useMutation } from 'react-apollo'\nimport {\n FormattedMessage,\n injectIntl,\n InjectedIntlProps,\n defineMessages,\n} from 'react-intl'\nimport { Button, Tooltip } from 'vtex.styleguide'\nimport { OrderForm } from 'vtex.order-manager'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { usePixel } from 'vtex.pixel-manager/PixelContext'\nimport { addToCart as ADD_TO_CART } from 'vtex.checkout-resources/Mutations'\nimport { useProductDispatch } from 'vtex.product-context/ProductDispatchContext'\nimport { usePWA } from 'vtex.store-resources/PWAContext'\n\nimport { compareObjects } from './modules/compareObjects'\nimport { MapCatalogItemToCartReturn } from './modules/catalogItemToCart'\nimport { OrderFormArgs, OrderFormItemInput } from '../../typings'\n\ninterface Props {\n isOneClickBuy: boolean\n available: boolean\n disabled: boolean\n customToastUrl: string\n customOneClickBuyLink: string\n skuItems: MapCatalogItemToCartReturn[]\n showToast: Function\n allSkuVariationsSelected: boolean\n}\n\ninterface OrderFormContext {\n loading: boolean\n orderForm: OrderFormArgs | undefined\n setOrderForm: (orderForm: Partial<OrderFormArgs>) => void\n}\n\nconst CSS_HANDLES = ['buttonText', 'buttonDataContainer']\nconst CHECKOUT_URL = '/checkout/#/cart'\n\nconst messages = defineMessages({\n success: { id: 'store/add-to-cart.success', defaultMessage: '' },\n duplicate: { id: 'store/add-to-cart.duplicate', defaultMessage: '' },\n error: { id: 'store/add-to-cart.failure', defaultMessage: '' },\n seeCart: { id: 'store/add-to-cart.see-cart', defaultMessage: '' },\n})\n\nconst adjustItemsForMutationInput = (\n newItems: MapCatalogItemToCartReturn[]\n): OrderFormItemInput[] => {\n return newItems.map(item => ({\n id: Number.parseInt(item.skuId),\n index: item.index,\n seller: item.seller,\n quantity: item.quantity,\n options: item.options,\n }))\n}\n\nconst adjustSkuItemForPixelEvent = (skuItem: MapCatalogItemToCartReturn) => {\n // Changes this `/Apparel & Accessories/Clothing/Tops/`\n // to this `Apparel & Accessories/Clothing/Tops`\n const category = skuItem.category ? skuItem.category.slice(1, -1) : ''\n\n return {\n skuId: skuItem.skuId,\n variant: skuItem.variant,\n price: skuItem.price,\n name: skuItem.name,\n quantity: skuItem.quantity,\n productRefId: skuItem.productRefId,\n brand: skuItem.brand,\n category,\n }\n}\n\nconst AddToCartButton: FC<Props & InjectedIntlProps> = ({\n intl,\n isOneClickBuy,\n customOneClickBuyLink,\n available,\n disabled,\n skuItems,\n customToastUrl,\n showToast,\n allSkuVariationsSelected = true,\n}) => {\n const handles = useCssHandles(CSS_HANDLES)\n const {\n orderForm,\n setOrderForm,\n loading,\n }: OrderFormContext = OrderForm.useOrderForm()\n const dispatch = useProductDispatch()\n const { rootPath } = useRuntime()\n const { push } = usePixel()\n const { settings = {}, showInstallPrompt = undefined } = usePWA() || {}\n const { promptOnCustomEvent } = settings\n const translateMessage = (message: FormattedMessage.MessageDescriptor) =>\n intl.formatMessage(message)\n\n const resolveToastMessage = (success: boolean, isNewItem: boolean) => {\n if (!success) return translateMessage(messages.error)\n if (!isNewItem) return translateMessage(messages.duplicate)\n\n return translateMessage(messages.success)\n }\n\n const toastMessage = ({\n success,\n isNewItem,\n }: {\n success: boolean\n isNewItem: boolean\n }) => {\n const message = resolveToastMessage(success, isNewItem)\n\n const action = success\n ? {\n label: translateMessage(messages.seeCart),\n href: customToastUrl,\n }\n : undefined\n\n showToast({ message, action })\n }\n\n const [\n addToCart,\n { error: mutationError, loading: mutationLoading },\n ] = useMutation<\n { addToCart: OrderFormArgs },\n { items: OrderFormItemInput[] }\n >(ADD_TO_CART)\n\n const handleAddToCart = async (event: React.MouseEvent) => {\n event.stopPropagation()\n event.preventDefault()\n\n const adjustedSkuItems = adjustItemsForMutationInput(skuItems)\n\n const mutationResult = await addToCart({\n variables: { items: adjustedSkuItems },\n })\n\n if (mutationError) {\n console.error(mutationError)\n toastMessage({ success: false, isNewItem: false })\n return\n }\n\n if (\n mutationResult.data &&\n compareObjects(mutationResult.data.addToCart, orderForm)\n ) {\n toastMessage({ success: true, isNewItem: false })\n return\n }\n\n // Update OrderForm from the context\n mutationResult.data && setOrderForm(mutationResult.data.addToCart)\n\n // Send event to pixel-manager\n const pixelEventItems = skuItems.map(adjustSkuItemForPixelEvent)\n push({\n event: 'addToCart',\n items: pixelEventItems,\n })\n\n if (isOneClickBuy) {\n location.assign(rootPath + (customOneClickBuyLink || CHECKOUT_URL))\n }\n\n toastMessage({ success: true, isNewItem: true })\n\n /* PWA */\n if (promptOnCustomEvent === 'addToCart' && showInstallPrompt) {\n showInstallPrompt()\n }\n }\n\n const handleClick = (e: React.MouseEvent) => {\n if (dispatch) {\n dispatch({ type: 'SET_BUY_BUTTON_CLICKED', args: { clicked: true } })\n }\n\n if (allSkuVariationsSelected) {\n handleAddToCart(e)\n }\n }\n\n const availableButtonContent = (\n <div className={`${handles.buttonDataContainer} flex justify-center`}>\n <FormattedMessage id=\"store/add-to-cart.add-to-cart\">\n {message => <span className={handles.buttonText}>{message}</span>}\n </FormattedMessage>\n </div>\n )\n\n const unavailableButtonContent = (\n <FormattedMessage id=\"store/buyButton-label-unavailable\">\n {message => <span className={handles.buttonText}>{message}</span>}\n </FormattedMessage>\n )\n\n const tooltipLabel = (\n <FormattedMessage id=\"store/add-to-cart.select-sku-variations\">\n {message => <span className={handles.errorMessage}>{message}</span>}\n </FormattedMessage>\n )\n\n return allSkuVariationsSelected ? (\n <Button\n block\n disabled={disabled || !available || loading || mutationLoading}\n isLoading={mutationLoading}\n onClick={handleClick}>\n {available ? availableButtonContent : unavailableButtonContent}\n </Button>\n ) : (\n <Tooltip trigger=\"click\" label={tooltipLabel}>\n <Button\n block\n disabled={disabled || !available || loading || mutationLoading}\n isLoading={mutationLoading}\n onClick={handleClick}>\n {available ? availableButtonContent : unavailableButtonContent}\n </Button>\n </Tooltip>\n )\n}\n\nexport default injectIntl(AddToCartButton)\n\n```" } ]
code_sku-list_dbf960ef
[ { "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 sku-list/react/components/BuyButton/Wrapper.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport useProduct from 'vtex.product-context/useProduct'\nimport { withToast } from 'vtex.styleguide'\n\nimport AddToCartButton from './AddToCartButton'\nimport { mapCatalogItemToCart } from './modules/catalogItemToCart'\nimport { Item, Maybe, ProductContextState } from '../../typings'\n\ninterface Props {\n isOneClickBuy: boolean\n available: boolean\n disabled: boolean\n customToastUrl: string\n customOneClickBuyLink: string\n showToast: Function\n selectedItem: Maybe<Item>\n selectedQuantity: number\n}\n\nconst Wrapper: FC<Props> = ({\n isOneClickBuy,\n available,\n disabled,\n customToastUrl,\n showToast,\n customOneClickBuyLink,\n selectedItem,\n selectedQuantity,\n}) => {\n const productContext: Maybe<ProductContextState> = useProduct()\n\n if (!productContext) {\n throw new Error('useProduct must be used within a ProductContextProvider')\n }\n\n const isEmptyContext = Object.keys(productContext).length === 0\n\n const product = productContext && productContext.product\n // const selectedItem = productContext && productContext.selectedItem\n const assemblyOptions = productContext && productContext.assemblyOptions\n const selectedSeller =\n productContext &&\n productContext.selectedItem &&\n productContext.selectedItem.sellers[0]\n const quantity = selectedQuantity != null ? selectedQuantity : 1\n\n const skuItems = mapCatalogItemToCart({\n product,\n selectedItem,\n quantity,\n selectedSeller,\n assemblyOptions,\n })\n\n const isAvailable =\n isEmptyContext || available != null\n ? available\n : Boolean(\n selectedSeller &&\n selectedSeller.commertialOffer &&\n selectedSeller.commertialOffer.AvailableQuantity > 0\n )\n\n const groupsValidArray =\n (assemblyOptions &&\n assemblyOptions.areGroupsValid &&\n Object.values(assemblyOptions.areGroupsValid)) ||\n []\n\n const areAssemblyGroupsValid = groupsValidArray.every(Boolean)\n const isDisabled =\n isEmptyContext || disabled != null ? disabled : !areAssemblyGroupsValid\n\n const areAllSkuVariationsSelected =\n productContext && productContext.skuSelector.areAllVariationsSelected\n\n return (\n <AddToCartButton\n allSkuVariationsSelected={areAllSkuVariationsSelected}\n skuItems={skuItems}\n available={isAvailable}\n isOneClickBuy={isOneClickBuy}\n disabled={isDisabled}\n customToastUrl={customToastUrl}\n showToast={showToast}\n customOneClickBuyLink={customOneClickBuyLink}\n />\n )\n}\n\nexport default withToast(Wrapper)\n\n```" } ]
code_sku-list_8c29283a
[ { "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 sku-list/react/components/SellerPrice/SellerPriceLegacy.tsx from the sku-list VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { FormattedCurrency } from 'vtex.format-currency'\nimport { Installment } from '../../typings'\n\nconst CSS_HANDLES = ['priceContainer'] as const\n\ninterface Props {\n sellingPrice?: number\n listPrice?: number\n unitMultiplier?: number\n installments?: Installment[]\n}\n\nconst SellerPriceLegacy = ({ sellingPrice }: Props) => {\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <div className={handles.priceContainer}>\n <span>\n <FormattedCurrency value={sellingPrice} />\n </span>\n </div>\n )\n}\n\nexport default SellerPriceLegacy\n\n```" } ]