id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_checkout-resources_b0d674ae
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/QueryOrderForm.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport orderForm from './queries/orderForm.graphql'\n\nexport default orderForm\n\n```"
}
] |
code_checkout-resources_f9027c43
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/MutationSelectDeliveryOption.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport selectDeliveryOption from './mutations/selectDeliveryOption.graphql'\n\nexport default selectDeliveryOption\n\n```"
}
] |
code_checkout-resources_bbb84c71
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/QueryCardSessionId.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport cardSessionId from './queries/cardSessionId.graphql'\n\nexport default cardSessionId\n\n```"
}
] |
code_checkout-resources_d0211397
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/QueryProfile.ts from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport profileQuery from './queries/profile.graphql'\n\nexport default profileQuery\n\n```"
}
] |
code_checkout-resources_f17fa6b0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/Mutations.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/** DEPRECATED, being kept just for retrocompatibility.\n * Create individual entry points for each mutation instead */\n\nimport addToCart from './mutations/addToCart.graphql'\nimport estimateShipping from './mutations/estimateShipping.graphql'\nimport insertCoupon from './mutations/insertCoupon.graphql'\nimport selectDeliveryOption from './mutations/selectDeliveryOption.graphql'\nimport updateItems from './mutations/updateItems.graphql'\nimport savePaymentToken from './mutations/savePaymentToken.graphql'\nimport saveCards from './mutations/saveCards.graphql'\nimport setManualPrice from './mutations/setManualPrice.graphql'\n\nexport default {\n addToCart,\n estimateShipping,\n insertCoupon,\n selectDeliveryOption,\n updateItems,\n savePaymentToken,\n saveCards,\n setManualPrice,\n}\n\n```"
}
] |
code_checkout-resources_1f17e5e0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/Utils.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useCheckoutURL } from './utils/useCheckoutURL'\n\nexport default {\n useCheckoutURL,\n}\n\n```"
}
] |
code_checkout-resources_eacdb677
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/MutationUpdateSelectedAddress.ts from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport updateSelectedAddress from './mutations/updateSelectedAddress.graphql'\n\nexport default updateSelectedAddress\n\n```"
}
] |
code_checkout-resources_f36eb219
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/MutationSetManualPrice.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport setManualPrice from './mutations/setManualPrice.graphql'\n\nexport default setManualPrice\n\n```"
}
] |
code_checkout-resources_96d84745
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/useGeolocationEnabled.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useQuery } from 'react-apollo'\n\nimport QueryGeolocationInstalled from './QueryGeolocationInstalled'\n\nexport default function useGeolocationEnabled() {\n const { data, loading } = useQuery(QueryGeolocationInstalled)\n\n return [(data?.installedApp?.source ?? 'none') !== 'none', loading]\n}\n\n```"
}
] |
code_checkout-resources_37f3caa5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/MutationInsertCoupon.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport insertCoupon from './mutations/insertCoupon.graphql'\n\nexport default insertCoupon\n\n```"
}
] |
code_checkout-resources_9b89e2e0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/MutationAddToCart.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport addToCart from './mutations/addToCart.graphql'\n\nexport default addToCart\n\n```"
}
] |
code_checkout-resources_5b1c9ae1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/fragments/address.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment Address on Address {\n addressId\n addressType\n city\n complement\n country\n neighborhood\n number\n postalCode\n receiverName\n reference\n state\n street\n isDisposable\n geoCoordinates\n}\n\n```"
}
] |
code_checkout-resources_5345decc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/fragments/orderForm.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import './address.graphql'\n#import './item.graphql'\n\nfragment OrderFormFragment on OrderForm {\n id\n items {\n ...ItemFragment\n }\n canEditData\n loggedIn\n userProfileId\n userType\n marketingData {\n coupon\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPart\n utmiPage\n }\n totalizers {\n id\n name\n value\n }\n shipping {\n countries\n availableAddresses {\n ...Address\n }\n selectedAddress {\n ...Address\n }\n deliveryOptions {\n id\n deliveryChannel\n price\n estimate\n isSelected\n }\n pickupOptions {\n id\n address {\n ...Address\n }\n deliveryChannel\n price\n estimate\n isSelected\n friendlyName\n additionalInfo\n storeDistance\n transitTime\n businessHours {\n dayNumber\n closed\n closingTime\n openingTime\n }\n }\n isValid\n }\n paymentData {\n paymentSystems {\n id\n name\n groupName\n validator {\n regex\n mask\n cardCodeRegex\n cardCodeMask\n weights\n useCvv\n useExpirationDate\n useCardHolderName\n useBillingAddress\n }\n stringId\n requiresDocument\n isCustom\n description\n requiresAuthentication\n dueDate\n }\n payments {\n paymentSystem\n bin\n accountId\n tokenId\n installments\n referenceValue\n value\n }\n installmentOptions {\n paymentSystem\n installments {\n count\n hasInterestRate\n interestRate\n value\n total\n }\n }\n availableAccounts {\n accountId\n paymentSystem\n paymentSystemName\n cardNumber\n bin\n }\n isValid\n }\n clientProfileData {\n email\n firstName\n lastName\n document\n documentType\n phone\n isValid\n isCorporate\n corporateName\n tradeName\n corporateDocument\n stateInscription\n }\n clientPreferencesData {\n locale\n optInNewsletter\n }\n messages {\n couponMessages {\n code\n }\n generalMessages {\n code\n text\n status\n }\n }\n value\n allowManualPrice\n customData {\n customApps {\n fields\n id\n major\n }\n }\n}\n\n```"
}
] |
code_checkout-resources_5266a3f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/fragments/item.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import './bundleItem.graphql'\n\nfragment ItemFragment on Item {\n additionalInfo {\n brandName\n }\n attachments {\n name\n content\n }\n attachmentOfferings {\n name\n required\n schema\n }\n bundleItems {\n ...BundleItemFragment\n }\n parentAssemblyBinding\n parentItemIndex\n sellingPriceWithAssemblies\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n }\n }\n }\n availability\n detailUrl\n id\n imageUrls {\n at1x\n at2x\n at3x\n }\n listPrice\n manualPrice\n measurementUnit\n modalType\n name\n offerings {\n id\n name\n price\n type\n attachmentOfferings {\n name\n required\n schema\n }\n }\n price\n priceTags {\n identifier\n isPercentual\n name\n rawValue\n value\n }\n productCategories\n productCategoryIds\n productRefId\n productId\n quantity\n seller\n sellingPrice\n skuName\n skuSpecifications {\n fieldName\n fieldValues\n }\n unitMultiplier\n uniqueId\n refId\n priceTags {\n identifier\n isPercentual\n rawValue\n value\n name\n ratesAndBenefitsIdentifier {\n description\n id\n featured\n name\n matchedParameters\n }\n }\n isGift\n priceDefinition {\n calculatedSellingPrice\n total\n sellingPrices {\n quantity\n value\n }\n }\n}\n\n```"
}
] |
code_checkout-resources_262f1725
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/fragments/bundleItem.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment BundleItemFragment on Item {\n additionalInfo {\n brandName\n }\n attachments {\n name\n content\n }\n attachmentOfferings {\n name\n required\n schema\n }\n availability\n detailUrl\n id\n imageUrls {\n at1x\n at2x\n at3x\n }\n listPrice\n measurementUnit\n name\n offerings {\n id\n name\n price\n type\n attachmentOfferings {\n name\n required\n schema\n }\n }\n price\n productCategories\n productCategoryIds\n productRefId\n productId\n quantity\n seller\n sellingPrice\n skuName\n skuSpecifications {\n fieldName\n fieldValues\n }\n unitMultiplier\n uniqueId\n refId\n}\n```"
}
] |
code_checkout-resources_8232727f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/updateOrderFormPayment.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation UpdateOrderFormPayment($paymentData: PaymentDataInput!) {\n updateOrderFormPayment(input: $paymentData) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_439873ab
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/setManualPrice.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation SetManualPrice($manualPriceInput: ManualPriceInput!) {\n setManualPrice(input: $manualPriceInput) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_0a7f6599
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/updateSelectedAddress.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation UpdateSelectedAddress($address: AddressInput!) {\n updateSelectedAddress(input: $address) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_942ad4e4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/savePaymentToken.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation SavePaymentToken($paymentTokens: [PaymentToken]) {\n savePaymentToken(paymentTokens: $paymentTokens) {\n status\n }\n}\n\n```"
}
] |
code_checkout-resources_d4dd7d89
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/updateClientPreferencesData.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation UpdateClientPreferencesData($clientPreferences: ClientPreferencesDataInput!) {\n updateClientPreferencesData(input: $clientPreferences) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_b368bc15
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/insertCoupon.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation insertCoupon($text: String) {\n insertCoupon(text: $text) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_89b727dc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/saveCards.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation SaveCards(\n $paymentData: [PaymentDataInput!]!\n $cardSessionId: String!\n) {\n saveCards(paymentData: $paymentData, cardSessionId: $cardSessionId) {\n tokenizedCards {\n token\n bin\n lastDigits\n paymentSystem\n }\n }\n}\n\n```"
}
] |
code_checkout-resources_ee6a2924
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/selectDeliveryOption.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation selectDeliveryOption($deliveryOptionId: String) {\n selectDeliveryOption(deliveryOptionId: $deliveryOptionId)\n @context(provider: \"vtex.checkout-graphql\") {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_b137af0b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/updateItems.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation updateItems(\n $orderItems: [ItemInput]\n $allowedOutdatedData: [String!]\n $splitItem: Boolean\n) {\n updateItems(\n orderItems: $orderItems\n allowedOutdatedData: $allowedOutdatedData\n splitItem: $splitItem\n ) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_fa98af19
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/estimateShipping.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation estimateShipping($addressInput: AddressInput) {\n estimateShipping(address: $addressInput)\n @context(provider: \"vtex.checkout-graphql\") {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_3072d45a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/updateOrderFormProfile.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation UpdateOrderFormProfile($profile: UserProfileInput!) {\n updateOrderFormProfile(input: $profile) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_4afdd2a3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/selectPickupOption.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation selectPickupOption($pickupOptionId: String) {\n selectPickupOption(pickupOptionId: $pickupOptionId)\n @context(provider: \"vtex.checkout-graphql\") {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_2b3a961f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/addToCart.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation addToCart(\n $items: [ItemInput]\n $marketingData: MarketingDataInput\n $salesChannel: String\n $allowedOutdatedData: [String!]\n) {\n addToCart(\n items: $items\n marketingData: $marketingData\n salesChannel: $salesChannel\n allowedOutdatedData: $allowedOutdatedData\n ) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_e356e07a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/mutations/clearOrderFormMessages.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation ClearOrderFormMessages($orderFormId: ID!) {\n clearOrderFormMessages(orderFormId: $orderFormId) {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_d4d0a134
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/typings/graphql.d.ts from the checkout-resources 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_checkout-resources_b4d3fdf2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/queries/profile.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery ProfileQuery($email: String!) {\n checkoutProfile(email: $email) {\n userProfileId\n profileProvider\n availableAccounts {\n accountId\n paymentSystem\n paymentSystemName\n cardNumber\n bin\n }\n userProfile {\n email\n firstName\n lastName\n document\n documentType\n phone\n corporateName\n tradeName\n corporateDocument\n stateInscription\n corporatePhone\n isCorporate\n profileCompleteOnLoading\n profileErrorOnLoading\n customerClass\n }\n availableAddresses {\n addressId\n addressType\n city\n complement\n country\n geoCoordinates\n neighborhood\n number\n }\n }\n}\n\n```"
}
] |
code_checkout-resources_fdd40b0a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/queries/geolocationInstalled.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery GeolocationInstalled {\n installedApp: installedAppPublic(slug: \"vtex.geolocation-graphql-interface\") {\n source\n }\n}\n\n```"
}
] |
code_checkout-resources_0c8b4363
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/queries/orderForm.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nquery orderForm($orderFormId: ID, $refreshOutdatedData: Boolean) {\n orderForm(orderFormId: $orderFormId, refreshOutdatedData: $refreshOutdatedData)\n @context(scope: \"private\") {\n ...OrderFormFragment\n }\n}\n\n```"
}
] |
code_checkout-resources_753010b2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/utils/useCheckoutURL.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useQuery } from 'react-apollo'\n\nimport installedApp from './graphql/installedApp.graphql'\n\nconst CHECKOUT_URL = {\n V0: '/checkout/#/cart',\n V1: '/cart',\n}\n\nexport const useCheckoutURL = () => {\n const { data } = useQuery(installedApp, {\n ssr: false,\n variables: {\n slug: 'vtex.checkout',\n },\n })\n\n const version = data?.installedApp?.version\n const major = version && parseInt(version.split('.')[0])\n\n return {\n url: major > 0 ? CHECKOUT_URL.V1 : CHECKOUT_URL.V0,\n major,\n }\n}\n\n```"
}
] |
code_checkout-resources_81abfee1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/utils/__tests__/useCheckoutURL.test.tsx from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { flushPromises, render } from '@vtex/test-tools/react'\nimport { MockedProvider } from '@apollo/react-testing'\n\nimport installedApp from '../graphql/installedApp.graphql'\nimport { useCheckoutURL } from '../useCheckoutURL'\n\ndescribe('useCheckoutURL', () => {\n it('should return the correct URL when checkout major is 0', async () => {\n jest.useFakeTimers()\n\n const Component: FC = () => {\n const { url } = useCheckoutURL()\n return <div>{url}</div>\n }\n\n const mockInstalledApp = {\n request: {\n query: installedApp,\n variables: {\n slug: 'vtex.checkout',\n },\n },\n result: {\n data: {\n installedApp: {\n version: '0.4.2',\n },\n },\n },\n }\n\n const { getByText } = render(<Component />, {\n graphql: { mocks: [mockInstalledApp] },\n MockedProvider,\n })\n\n await flushPromises()\n jest.runAllTimers()\n\n expect(getByText('/checkout/#/cart')).toBeTruthy()\n })\n\n it('should return the correct URL when checkout major is 1', async () => {\n jest.useFakeTimers()\n\n const Component = () => {\n const { url } = useCheckoutURL()\n return <div>{url}</div>\n }\n\n const mockInstalledApp = {\n request: {\n query: installedApp,\n variables: {\n slug: 'vtex.checkout',\n },\n },\n result: {\n data: {\n installedApp: {\n version: '1.4.2',\n },\n },\n },\n }\n\n const { getByText } = render(<Component />, {\n graphql: { mocks: [mockInstalledApp] },\n MockedProvider,\n })\n\n await flushPromises()\n jest.runAllTimers()\n\n expect(getByText('/cart')).toBeTruthy()\n })\n})\n\n```"
}
] |
code_checkout-resources_3e9c128c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of checkout-resources/react/utils/graphql/installedApp.graphql from the checkout-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery installedApp($slug: String!) {\n installedApp: installedAppPublic(slug: $slug) {\n version\n }\n}\n\n```"
}
] |
code_store-form_56bd61e7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/nl.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Dit veld is verplicht\",\n \"store/form.error.maxLength\": \"Dit veld heeft een maximale lengte van: {value}\",\n \"store/form.error.minLength\": \"Dit veld heeft een minimale lengte van: {value}\",\n \"store/form.error.maxValue\": \"De maximale waarde die door dit veld wordt geaccepteerd is {value}\",\n \"store/form.error.minValue\": \"De minimale waarde die door dit veld wordt geaccepteerd is {value}\",\n \"store/form.error.notFloat\": \"Moet een getal zijn\",\n \"store/form.error.notInteger\": \"Moet een geheel getal zijn\",\n \"store/form.error.pattern\": \"Deze tekst komt niet overeen met het verwachte patroon\",\n \"store/form.error.notInEnum\": \"Moet een van de volgende waarden hebben: {values}\",\n \"store/form.error.multipleOf\": \"Moet een veelvoud zijn van {value}\",\n \"store/form.error.undefinedError\": \"Ongeldige waarde.\",\n \"store/form.submit.buttonLabel\": \"Versturen\",\n \"store/form.submit.error.userInputError\": \"Er zijn enkele fouten gevonden in de verstrekte gegevens, bekijk de aangegeven velden en probeer het opnieuw!\",\n \"store/form.submit.error.serverError\": \"Interne serverfout! Probeer het later opnieuw!\",\n \"store/form.schema.loading\": \"Formulier laden...\",\n \"store/form.schema.error\": \"Fout bij laden formulier, probeer het later opnieuw!\",\n \"store/form.operating.agreement\": \"Exploitatieovereenkomst\",\n \"store/form.add-button\": \"Toevoegen\",\n \"store/form.add-document.title\": \"Document uploaden\",\n \"store/form.add-document.label\": \"Document URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Bestand overschrijdt de limiet van 4 MB. Kies een kleinere.\",\n \"store/form.document-uploader.error.generic\": \"Er is iets fout gegaan. Probeer het opnieuw.\",\n \"store/form.upload-button\": \"Document uploaden\",\n \"store/form.upload-document-label\": \"Kies een document om te uploaden\"\n}\n\n```"
}
] |
code_store-form_f6f0eb17
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/de.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Dies ist ein Pflichtfeld\",\n \"store/form.error.maxLength\": \"Dieses Feld hat eine maximale Länge von: {value}\",\n \"store/form.error.minLength\": \"Dieses Feld hat eine Mindestlänge von: {value}\",\n \"store/form.error.maxValue\": \"Der maximal zulässige Wert für dieses Feld ist {value}\",\n \"store/form.error.minValue\": \"Der Mindestwert für dieses Feld ist {value}\",\n \"store/form.error.notFloat\": \"Muss eine Zahl sein\",\n \"store/form.error.notInteger\": \"Muss eine ganze Zahl sein\",\n \"store/form.error.pattern\": \"Dieser Text entspricht nicht dem erwarteten Muster\",\n \"store/form.error.notInEnum\": \"Muss einer der folgenden Werte sein: {values}\",\n \"store/form.error.multipleOf\": \"Muss ein Vielfaches von {value} sein\",\n \"store/form.error.undefinedError\": \"Ungültiger Wert.\",\n \"store/form.submit.buttonLabel\": \"Absenden\",\n \"store/form.submit.error.userInputError\": \"Es wurden einige Fehler in den angegebenen Daten gefunden. Bitte überprüfen Sie die angegebenen Felder und versuchen Sie es erneut!\",\n \"store/form.submit.error.serverError\": \"Interner Serverfehler. Bitte versuchen Sie es später erneut!\",\n \"store/form.schema.loading\": \"Formular wird geladen...\",\n \"store/form.schema.error\": \"Fehler beim Laden. Versuche es später erneut!\",\n \"store/form.operating.agreement\": \"Betriebsvereinbarung\",\n \"store/form.add-button\": \"Zufügen\",\n \"store/form.add-document.title\": \"Dokument hochladen\",\n \"store/form.add-document.label\": \"Dokument-URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Dieses Photo liegt über der 4MB-Grenze. Wählen Sie ein kleineres.\",\n \"store/form.document-uploader.error.generic\": \"Etwas ist schiefgelaufen. Bitte versuche es erneut.\",\n \"store/form.upload-button\": \"Dokument hochladen\",\n \"store/form.upload-document-label\": \"Wählen Sie eine Datei zum Hochladen\"\n}\n\n```"
}
] |
code_store-form_dcc6e1a2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/ru.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Это обязательное поле\",\n \"store/form.error.maxLength\": \"Максимальная длина поля: {value}\",\n \"store/form.error.minLength\": \"Минимальная длина поля: {value}\",\n \"store/form.error.maxValue\": \"Максимальное значение поля: {value}\",\n \"store/form.error.minValue\": \"Минимальное значение поля: {value}\",\n \"store/form.error.notFloat\": \"Должно быть числом\",\n \"store/form.error.notInteger\": \"Должно быть целым числом\",\n \"store/form.error.pattern\": \"Текст не соответствует ожидаемому шаблону\",\n \"store/form.error.notInEnum\": \"Должно иметь одно из следующих значений: {values}\",\n \"store/form.error.multipleOf\": \"Должно быть кратно {value}\",\n \"store/form.error.undefinedError\": \"Недопустимое значение.\",\n \"store/form.submit.buttonLabel\": \"Отправить\",\n \"store/form.submit.error.userInputError\": \"Во введенных данных обнаружены ошибки. Проверьте указанные поля и повторите попытку!\",\n \"store/form.submit.error.serverError\": \"Внутренняя ошибка сервера! Повторите попытку позже!\",\n \"store/form.schema.loading\": \"Загрузка формы...\",\n \"store/form.schema.error\": \"Ошибка загрузки формы. Попробуйте позже!\",\n \"store/form.operating.agreement\": \"Операционное соглашение\",\n \"store/form.add-button\": \"Добавить\",\n \"store/form.add-document.title\": \"Загрузить документ\",\n \"store/form.add-document.label\": \"URL документа\",\n \"store/form.add-document.placeholder\": \"URL-адрес\",\n \"store/form.document-uploader.error.file-size\": \"Файл превышает 4 Мб. Выберите меньший размер.\",\n \"store/form.document-uploader.error.generic\": \"Произошла ошибка. Повторите попытку.\",\n \"store/form.upload-button\": \"Загрузить документ\",\n \"store/form.upload-document-label\": \"Выберите документ для загрузки\"\n}\n\n```"
}
] |
code_store-form_110c726a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/pl.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"To pole jest wymagane\",\n \"store/form.error.maxLength\": \"To pole ma maks. długość: {value}\",\n \"store/form.error.minLength\": \"To pole ma min. długość: {value}\",\n \"store/form.error.maxValue\": \"Maksymalna wartość akceptowana przez to pole wynosi {value}\",\n \"store/form.error.minValue\": \"Minimalna wartość akceptowana przez to pole wynosi {value}\",\n \"store/form.error.notFloat\": \"Musi być liczbą\",\n \"store/form.error.notInteger\": \"Musi być liczbą całkowitą\",\n \"store/form.error.pattern\": \"Ten tekst nie jest zgodny z oczekiwanym wzorem\",\n \"store/form.error.notInEnum\": \"Musi mieć jedną z następujących wartości: {values}\",\n \"store/form.error.multipleOf\": \"Musi być wielokrotnością {value}\",\n \"store/form.error.undefinedError\": \"Nieprawidłowa wartość.\",\n \"store/form.submit.buttonLabel\": \"Prześlij\",\n \"store/form.submit.error.userInputError\": \"Znaleziono błędy w podanych danych, przejrzyj wskazane pola i spróbuj ponownie!\",\n \"store/form.submit.error.serverError\": \"Wewnętrzny błąd serwera. Spróbuj ponownie później!\",\n \"store/form.schema.loading\": \"Ładowanie formularza...\",\n \"store/form.schema.error\": \"Błąd ładowania formularza, spróbuj ponownie później!\",\n \"store/form.operating.agreement\": \"Umowa operacyjna\",\n \"store/form.add-button\": \"Dodaj\",\n \"store/form.add-document.title\": \"Prześlij dokument\",\n \"store/form.add-document.label\": \"Adres URL dokumentu\",\n \"store/form.add-document.placeholder\": \"Adres URL\",\n \"store/form.document-uploader.error.file-size\": \"Plik przekracza limit rozmiaru 4 MB. Wybierz mniejszy.\",\n \"store/form.document-uploader.error.generic\": \"Coś poszło nie tak. Spróbuj ponownie.\",\n \"store/form.upload-button\": \"Prześlij dokument\",\n \"store/form.upload-document-label\": \"Wybierz dokument do przesłania\"\n}\n\n```"
}
] |
code_store-form_373c54c6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/uk.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Це поле обов’язкове\",\n \"store/form.error.maxLength\": \"Максимальна довжина поля: {value}\",\n \"store/form.error.minLength\": \"Мінімальна довжина поля: {value}\",\n \"store/form.error.maxValue\": \"Максимальне значення цього поля: {value}\",\n \"store/form.error.minValue\": \"Мінімальне значення цього поля: {value}\",\n \"store/form.error.notFloat\": \"Має бути числом\",\n \"store/form.error.notInteger\": \"Має бути ціле число\",\n \"store/form.error.pattern\": \"Цей текст не збігається з очікуваним шаблоном\",\n \"store/form.error.notInEnum\": \"Має мати одне з наступних значень: {values}\",\n \"store/form.error.multipleOf\": \"Має бути кратним {value}\",\n \"store/form.error.undefinedError\": \"Недійсне значення.\",\n \"store/form.submit.buttonLabel\": \"Відправити\",\n \"store/form.submit.error.userInputError\": \"У введених даних виявлені помилки. Перевірте зазначені поля та спробуйте ще раз!\",\n \"store/form.submit.error.serverError\": \"Внутрішня помилка сервера! Спробуйте пізніше!\",\n \"store/form.schema.loading\": \"Завантаження форми...\",\n \"store/form.schema.error\": \"Помилка завантаження форми, спробуйте пізніше!\",\n \"store/form.operating.agreement\": \"Операційна угода\",\n \"store/form.add-button\": \"Додати\",\n \"store/form.add-document.title\": \"Завантажити документ\",\n \"store/form.add-document.label\": \"URL-адреса документа\",\n \"store/form.add-document.placeholder\": \"URL-адреса\",\n \"store/form.document-uploader.error.file-size\": \"Файл перевищує 4 Мб. Виберіть менший розмір.\",\n \"store/form.document-uploader.error.generic\": \"Щось пішло не так. Спробуйте ще раз.\",\n \"store/form.upload-button\": \"Завантажити документ\",\n \"store/form.upload-document-label\": \"Виберіть документ для завантаження\"\n}\n\n```"
}
] |
code_store-form_3805c080
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/fi.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Tämä on pakollinen kenttä\",\n \"store/form.error.maxLength\": \"Tämän kentän enimmäispituus on: {value}\",\n \"store/form.error.minLength\": \"Tämän kentän vähimmäispituus on: {value}\",\n \"store/form.error.maxValue\": \"Tämän kentän suurin sallittu arvo on {value}\",\n \"store/form.error.minValue\": \"Tämän kentän pienin sallittu vähimmäisarvo on {value}\",\n \"store/form.error.notFloat\": \"On oltava numero\",\n \"store/form.error.notInteger\": \"On oltava kokonaisluku\",\n \"store/form.error.pattern\": \"Teksti ei vastaa odotettua kuviota\",\n \"store/form.error.notInEnum\": \"On oltava jokin seuraavista arvoista: {values}\",\n \"store/form.error.multipleOf\": \"On oltava arvon {value} kerrannainen\",\n \"store/form.error.undefinedError\": \"Virheellinen arvo.\",\n \"store/form.submit.buttonLabel\": \"Lähetä\",\n \"store/form.submit.error.userInputError\": \"Annetuissa tiedoissa oli virheitä. Tarkista merkityt kentät ja yritä uudelleen!\",\n \"store/form.submit.error.serverError\": \"Sisäinen palvelinvirhe! Yritä myöhemmin uudelleen!\",\n \"store/form.schema.loading\": \"Ladataan lomaketta...\",\n \"store/form.schema.error\": \"Virhe ladattaessa lomaketta. Yritä myöhemmin uudelleen!\",\n \"store/form.operating.agreement\": \"Toimintasopimus\",\n \"store/form.add-button\": \"Lisää\",\n \"store/form.add-document.title\": \"Lataa asiakirja\",\n \"store/form.add-document.label\": \"Asiakirjan URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Tiedosto ylittää 4 Mt:n kokorajan. Valitse pienempi tiedosto.\",\n \"store/form.document-uploader.error.generic\": \"Jokin meni pieleen. Yritä uudelleen.\",\n \"store/form.upload-button\": \"Lataa asiakirja\",\n \"store/form.upload-document-label\": \"Valitse ladattava asiakirja\"\n}\n\n```"
}
] |
code_store-form_6e95cf40
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/sk.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Toto pole je povinné\",\n \"store/form.error.maxLength\": \"Toto pole má maximálnu dĺžku: {value}\",\n \"store/form.error.minLength\": \"Toto pole má minimálnu dĺžku: {value}\",\n \"store/form.error.maxValue\": \"Maximálna hodnota akceptovaná týmto poľom je {value}\",\n \"store/form.error.minValue\": \"Minimálna hodnota akceptovaná týmto poľom je {value}\",\n \"store/form.error.notFloat\": \"Musí to byť číslo\",\n \"store/form.error.notInteger\": \"Musí to byť celé číslo\",\n \"store/form.error.pattern\": \"Tento text nezodpovedá očakávanému vzoru\",\n \"store/form.error.notInEnum\": \"Musí mať jednu z nasledujúcich hodnôt: {values}\",\n \"store/form.error.multipleOf\": \"Musí byť násobkom {value}\",\n \"store/form.error.undefinedError\": \"Neplatná hodnota.\",\n \"store/form.submit.buttonLabel\": \"Odoslať\",\n \"store/form.submit.error.userInputError\": \"V poskytnutých údajoch sa našli chyby, skontrolujte označené polia a skúste to znova.\",\n \"store/form.submit.error.serverError\": \"Interná chyba servera. Skúste to znova neskôr.\",\n \"store/form.schema.loading\": \"Načítava sa formulár...\",\n \"store/form.schema.error\": \"Pri načítaní formulára došlo k chybe. Skúste to znova neskôr.\",\n \"store/form.operating.agreement\": \"Prevádzková zmluva\",\n \"store/form.add-button\": \"Pridať\",\n \"store/form.add-document.title\": \"Nahrať dokument\",\n \"store/form.add-document.label\": \"Adresa URL dokumentu\",\n \"store/form.add-document.placeholder\": \"Adresa URL\",\n \"store/form.document-uploader.error.file-size\": \"Súbor prekračuje limit veľkosti 4 MB. Vyberte menší súbor.\",\n \"store/form.document-uploader.error.generic\": \"Niečo sa nepodarilo. Skúste to znova.\",\n \"store/form.upload-button\": \"Nahrať dokument\",\n \"store/form.upload-document-label\": \"Vyberte dokument, ktorý chcete nahrať\"\n}\n\n```"
}
] |
code_store-form_3dd21282
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/pt.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Este campo é necessário\",\n \"store/form.error.maxLength\": \"Este campo deve ter até {value} caracteres\",\n \"store/form.error.minLength\": \"Este campo deve ter no mínimo {value} caracteres\",\n \"store/form.error.maxValue\": \"O valor máximo aceito neste campo é {value}\",\n \"store/form.error.minValue\": \"O valor mínimo aceito neste campo é {value}\",\n \"store/form.error.notFloat\": \"Deve ser um número\",\n \"store/form.error.notInteger\": \"Deve ser um número inteiro\",\n \"store/form.error.pattern\": \"Este texto não corresponde com o padrão esperado\",\n \"store/form.error.notInEnum\": \"Deve ser algum dos seguintes valores: {values}\",\n \"store/form.error.multipleOf\": \"Este campo deve ser um mútiplo de {value}\",\n \"store/form.error.undefinedError\": \"Valor inválido.\",\n \"store/form.submit.buttonLabel\": \"Enviar\",\n \"store/form.submit.error.userInputError\": \"Foram encontrados alguns erros nos dados fornecidos, revise os campos indicados e tente novamente.\",\n \"store/form.submit.error.serverError\": \"Erro interno do servidor! Por favor, tente novamente mais tarde!\",\n \"store/form.schema.loading\": \"Carregando o formulário...\",\n \"store/form.schema.error\": \"Erro carregando o formulário, tente de novo mais tarde!\",\n \"store/form.operating.agreement\": \"Acordo Operacional\",\n \"store/form.add-button\": \"Adicionar\",\n \"store/form.add-document.title\": \"Inserir documento\",\n \"store/form.add-document.label\": \"URL do documento\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"O arquivo excede 4MB. Por favor, escolhe um menor.\",\n \"store/form.document-uploader.error.generic\": \"Erro ao carregar. Por favor, tente novamente.\",\n \"store/form.upload-button\": \"Upload\",\n \"store/form.upload-document-label\": \"Escolha um documento para upload\"\n}\n\n```"
}
] |
code_store-form_bae8bf2b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/en.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"This field is required\",\n \"store/form.error.maxLength\": \"The maximum character length of this field is {value}\",\n \"store/form.error.minLength\": \"The minimum character length of this field is {value}\",\n \"store/form.error.maxValue\": \"The maximum value accepted by this field is {value}\",\n \"store/form.error.minValue\": \"The minimum value accepted by this field is {value}\",\n \"store/form.error.notFloat\": \"Must be a number\",\n \"store/form.error.notInteger\": \"Must be an integer\",\n \"store/form.error.pattern\": \"This text does not match the expected pattern\",\n \"store/form.error.notInEnum\": \"Must be one of the following values: {values}\",\n \"store/form.error.multipleOf\": \"Must be a multiple of {value}\",\n \"store/form.error.undefinedError\": \"Invalid value.\",\n \"store/form.submit.buttonLabel\": \"Submit\",\n \"store/form.submit.error.userInputError\": \"There are some errors in the information provided. Please check the highlighted fields and try again.\",\n \"store/form.submit.error.serverError\": \"Internal server error. Please try again later.\",\n \"store/form.schema.loading\": \"Loading form...\",\n \"store/form.schema.error\": \"Error loading form. Please try again later.\",\n \"store/form.operating.agreement\": \"Operating agreement\",\n \"store/form.add-button\": \"Add\",\n \"store/form.add-document.title\": \"Upload Document\",\n \"store/form.add-document.label\": \"Document URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"File exceeds the size limit of 4 MB. Please choose a smaller one.\",\n \"store/form.document-uploader.error.generic\": \"Something went wrong. Please try again.\",\n \"store/form.upload-button\": \"Upload Document\",\n \"store/form.upload-document-label\": \"Choose a document to upload\"\n}\n\n```"
}
] |
code_store-form_9136dbfd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/it.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Questo campo è obbligatorio\",\n \"store/form.error.maxLength\": \"Questo campo deve avere una lunghezza massima di: {value}\",\n \"store/form.error.minLength\": \"Questo campo deve avere una lunghezza minima di: {value}\",\n \"store/form.error.maxValue\": \"Il valore massimo accettato da questo campo è {value}\",\n \"store/form.error.minValue\": \"Il valore minimo accettato da questo campo è {value}\",\n \"store/form.error.notFloat\": \"Deve essere un numero\",\n \"store/form.error.notInteger\": \"Deve essere un numero intero\",\n \"store/form.error.pattern\": \"Questo testo non corrisponde al modello previsto\",\n \"store/form.error.notInEnum\": \"Deve essere uno dei seguenti valori: {values}\",\n \"store/form.error.multipleOf\": \"Deve essere un multiplo di {value}\",\n \"store/form.error.undefinedError\": \"Valore non valido.\",\n \"store/form.submit.buttonLabel\": \"Invia\",\n \"store/form.submit.error.userInputError\": \"Sono stati riscontrati degli errori nei dati forniti, controlla di nuovo i campi indicati e riprova!\",\n \"store/form.submit.error.serverError\": \"Errore interno del server! Riprova tra poco!\",\n \"store/form.schema.loading\": \"Caricamento del modulo in corso...\",\n \"store/form.schema.error\": \"Errore nel caricamento del modulo, riprova tra poco!\",\n \"store/form.operating.agreement\": \"Accordo di gestione\",\n \"store/form.add-button\": \"Aggiungi\",\n \"store/form.add-document.title\": \"Carica documento\",\n \"store/form.add-document.label\": \"URL del documento\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Questo file supera la dimensione di 4 MB. Scegline uno di dimensioni minori.\",\n \"store/form.document-uploader.error.generic\": \"Si è verificato un errore. Riprova.\",\n \"store/form.upload-button\": \"Carica documento\",\n \"store/form.upload-document-label\": \"Scegli un documento da caricare\"\n}\n\n```"
}
] |
code_store-form_82fab90c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/fr.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Ce champ est obligatoire\",\n \"store/form.error.maxLength\": \"Ce champ a une longueur maximale de : {value}\",\n \"store/form.error.minLength\": \"Ce champ a une longueur minimale de : {value}\",\n \"store/form.error.maxValue\": \"La valeur maximale acceptée par ce champ est {value}\",\n \"store/form.error.minValue\": \"La valeur minimale acceptée par ce champ est {value}\",\n \"store/form.error.notFloat\": \"Doit être un nombre\",\n \"store/form.error.notInteger\": \"Doit être un nombre entier\",\n \"store/form.error.pattern\": \"Ce texte ne correspond pas au modèle attendu\",\n \"store/form.error.notInEnum\": \"Doit avoir l'une des valeurs suivantes : {values}\",\n \"store/form.error.multipleOf\": \"Doit être un multiple de {value}\",\n \"store/form.error.undefinedError\": \"Valeur invalide.\",\n \"store/form.submit.buttonLabel\": \"Envoyer\",\n \"store/form.submit.error.userInputError\": \"Des erreurs se sont glissées dans les données fournies, veuillez revoir les champs indiqués et réessayer !\",\n \"store/form.submit.error.serverError\": \"Erreur interne du serveur. Veuillez réessayer ultérieurement !\",\n \"store/form.schema.loading\": \"Chargement du formulaire...\",\n \"store/form.schema.error\": \"Erreur de chargement du formulaire, réessayez plus tard !\",\n \"store/form.operating.agreement\": \"Accord d'exploitation\",\n \"store/form.add-button\": \"Ajouter\",\n \"store/form.add-document.title\": \"Télécharger un document\",\n \"store/form.add-document.label\": \"URL du document\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Le fichier dépasse la limite de taille de 4MB. Veuillez en choisir un plus petit.\",\n \"store/form.document-uploader.error.generic\": \"Une erreur s’est produite. Veuillez réessayer.\",\n \"store/form.upload-button\": \"Télécharger un document\",\n \"store/form.upload-document-label\": \"Choisir un document à télécharger\"\n}\n\n```"
}
] |
code_store-form_b1830126
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/el.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Αυτό το πεδίο είναι υποχρεωτικό\",\n \"store/form.error.maxLength\": \"Αυτό το πεδίο έχει μέγιστο μήκος: {value}\",\n \"store/form.error.minLength\": \"Αυτό το πεδίο έχει ελάχιστο μήκος: {value}\",\n \"store/form.error.maxValue\": \"Η μέγιστη τιμή που δέχεται αυτό το πεδίο είναι {value}\",\n \"store/form.error.minValue\": \"Η ελάχιστη τιμή που δέχεται αυτό το πεδίο είναι {value}\",\n \"store/form.error.notFloat\": \"Πρέπει να είναι αριθμός\",\n \"store/form.error.notInteger\": \"Πρέπει να είναι ακέραιος αριθμός\",\n \"store/form.error.pattern\": \"Αυτό το κείμενο δεν ταιριάζει με το αναμενόμενο μοτίβο\",\n \"store/form.error.notInEnum\": \"Πρέπει να έχει μία από τις ακόλουθες τιμές: {values}\",\n \"store/form.error.multipleOf\": \"Πρέπει να είναι πολλαπλάσιο του {value}\",\n \"store/form.error.undefinedError\": \"Άκυρη τιμή.\",\n \"store/form.submit.buttonLabel\": \"Υποβολή\",\n \"store/form.submit.error.userInputError\": \"Βρέθηκαν κάποια σφάλματα στα παρεχόμενα δεδομένα, παρακαλούμε ελέγξτε τα υποδεικνυόμενα πεδία και δοκιμάστε ξανά!\",\n \"store/form.submit.error.serverError\": \"Σφάλμα εσωτερικού διακομιστή! Δοκιμάστε ξανά αργότερα!\",\n \"store/form.schema.loading\": \"Γίνεται φόρτωση εντύπου...\",\n \"store/form.schema.error\": \"Σφάλμα στη φόρτωση φόρμας, δοκιμάστε ξανά αργότερα!\",\n \"store/form.operating.agreement\": \"Συμφωνία λειτουργίας\",\n \"store/form.add-button\": \"Προσθήκη\",\n \"store/form.add-document.title\": \"Αποστολή εγγράφου\",\n \"store/form.add-document.label\": \"Αναγνωριστικό εγγράφου\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Το αρχείο υπερβαίνει το όριο μεγέθους των 4MB. Επιλέξτε ένα μικρότερο.\",\n \"store/form.document-uploader.error.generic\": \"Κάτι πήγε στραβά. Παρακαλώ προσπαθήστε ξανά.\",\n \"store/form.upload-button\": \"Αποστολή εγγράφου\",\n \"store/form.upload-document-label\": \"Επιλέξτε ένα έγγραφο για αποστολή\"\n}\n\n```"
}
] |
code_store-form_0eb57202
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/bg.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Това поле е задължително\",\n \"store/form.error.maxLength\": \"Това поле има максимална дължина: {value}\",\n \"store/form.error.minLength\": \"Това поле има минимална дължина: {value}\",\n \"store/form.error.maxValue\": \"Максималната стойност, приемана от това поле, е {value}\",\n \"store/form.error.minValue\": \"Минималната стойност, приемана от това поле, е {value}\",\n \"store/form.error.notFloat\": \"Трябва да бъде число\",\n \"store/form.error.notInteger\": \"Трябва да бъде цяло число\",\n \"store/form.error.pattern\": \"Този текст не съвпада с очаквания модел\",\n \"store/form.error.notInEnum\": \"Трябва да има една от следните стойности: {values}\",\n \"store/form.error.multipleOf\": \"Трябва да бъде кратно на {value}\",\n \"store/form.error.undefinedError\": \"Невалидна стойност.\",\n \"store/form.submit.buttonLabel\": \"Изпращане\",\n \"store/form.submit.error.userInputError\": \"Открити са грешки в предоставените данни, моля, прегледайте посочените полета и опитайте отново!\",\n \"store/form.submit.error.serverError\": \"Вътрешна сървърна грешка! Моля, опитайте отново по-късно!\",\n \"store/form.schema.loading\": \"Зареждане на формуляра...\",\n \"store/form.schema.error\": \"Грешка при зареждане на формуляра, опитайте отново по-късно!\",\n \"store/form.operating.agreement\": \"Оперативно споразумение\",\n \"store/form.add-button\": \"Добавяне\",\n \"store/form.add-document.title\": \"Качване на документ\",\n \"store/form.add-document.label\": \"URL адрес на документа\",\n \"store/form.add-document.placeholder\": \"URL адрес\",\n \"store/form.document-uploader.error.file-size\": \"Файлът надвишава ограничението на 4 MB. Моля, изберете по-малък файл.\",\n \"store/form.document-uploader.error.generic\": \"Нещо се обърка. Моля, опитайте отново.\",\n \"store/form.upload-button\": \"Качване на документ\",\n \"store/form.upload-document-label\": \"Изберете документ за качване\"\n}\n\n```"
}
] |
code_store-form_b0bb6ed3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/ro.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Acest câmp este obligatoriu\",\n \"store/form.error.maxLength\": \"Câmpul are o lungime maximă de: {value}\",\n \"store/form.error.minLength\": \"Câmpul are o lungime minimă de: {value}\",\n \"store/form.error.maxValue\": \"Valoarea maximă acceptată de acest câmp este {value}\",\n \"store/form.error.minValue\": \"Valoarea minimă acceptată de acest câmp este {value}\",\n \"store/form.error.notFloat\": \"Trebuie să fie un număr\",\n \"store/form.error.notInteger\": \"Trebuie să fie o integrală\",\n \"store/form.error.pattern\": \"Acest text nu se potrivește modelului așteptat\",\n \"store/form.error.notInEnum\": \"Trebuie să fie una dintre următoarele valori: {values}\",\n \"store/form.error.multipleOf\": \"Trebuie să fie multiplu de {value}\",\n \"store/form.error.undefinedError\": \"Valoare invalidă.\",\n \"store/form.submit.buttonLabel\": \"Trimite\",\n \"store/form.submit.error.userInputError\": \"S-au găsit erori în datele furnizate, te rugăm să revizuiești câmpurile indicate și să încerci din nou!\",\n \"store/form.submit.error.serverError\": \"Eroare internă de server! Te rugăm să încerci din nou!\",\n \"store/form.schema.loading\": \"Se încarcă formularul...\",\n \"store/form.schema.error\": \"Eroare în încărcarea formularului, încearcă din nou mai târziu!\",\n \"store/form.operating.agreement\": \"Acord de funcționare\",\n \"store/form.add-button\": \"Adaugă\",\n \"store/form.add-document.title\": \"Încarcă documentul\",\n \"store/form.add-document.label\": \"URL document\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Fișierul depășește limita de dimensiune de 4MB. Te rugăm să alegi unul mai mic.\",\n \"store/form.document-uploader.error.generic\": \"A apărut o eroare. Încearcă din nou.\",\n \"store/form.upload-button\": \"Încarcă documentul\",\n \"store/form.upload-document-label\": \"Alege un document pentru a-l încărca\"\n}\n\n```"
}
] |
code_store-form_52d77918
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/ca.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Aquest camp és obligatori\",\n \"store/form.error.maxLength\": \"La longitud màxima d'aquest camp és: {value}\",\n \"store/form.error.minLength\": \"La longitud mínima d'aquest camp és: {value}\",\n \"store/form.error.maxValue\": \"El valor màxim que accepta aquest camp és {value}\",\n \"store/form.error.minValue\": \"El valor mínim que accepta aquest camp és {value}\",\n \"store/form.error.notFloat\": \"Ha de ser un número\",\n \"store/form.error.notInteger\": \"Ha de ser un nombre enter\",\n \"store/form.error.pattern\": \"Aquest text no coincideix amb el patró previst\",\n \"store/form.error.notInEnum\": \"Ha de ser un dels valors següents: {values}\",\n \"store/form.error.multipleOf\": \"Ha de ser un múltiple de {value}\",\n \"store/form.error.undefinedError\": \"El valor no és vàlid.\",\n \"store/form.submit.buttonLabel\": \"Envia\",\n \"store/form.submit.error.userInputError\": \"S'han trobat alguns errors en les dades facilitades. Reviseu els camps indicats i torneu-ho a provar.\",\n \"store/form.submit.error.serverError\": \"Error al servidor intern. Torneu-ho a provar més endavant.\",\n \"store/form.schema.loading\": \"S'està carregant el formulari...\",\n \"store/form.schema.error\": \"S'ha produït un error en carregar el formulari. Torneu-ho a provar més endavant.\",\n \"store/form.operating.agreement\": \"Acord operatiu\",\n \"store/form.add-button\": \"Afegeix-ho\",\n \"store/form.add-document.title\": \"Puja el document\",\n \"store/form.add-document.label\": \"URL del document\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"La mida del fitxer supera el límit de 4 MB. Trieu-ne un de més petit.\",\n \"store/form.document-uploader.error.generic\": \"Alguna cosa ha anat malament. Torneu-ho a provar.\",\n \"store/form.upload-button\": \"Puja el document\",\n \"store/form.upload-document-label\": \"Trieu un document per pujar-lo\"\n}\n\n```"
}
] |
code_store-form_ec0dc07c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/context.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"This field is required\",\n \"store/form.error.maxLength\": \"This field has a max length of: {value}\",\n \"store/form.error.minLength\": \"This field has a min length of: {value}\",\n \"store/form.error.maxValue\": \"The maximum value accepted by this field is {value}\",\n \"store/form.error.minValue\": \"The minimum value accepted by this field is {value}\",\n \"store/form.error.notFloat\": \"Must be a number\",\n \"store/form.error.notInteger\": \"Must be an integer\",\n \"store/form.error.pattern\": \"This text does not match the expected pattern\",\n \"store/form.error.notInEnum\": \"Must one of the following values: {values}\",\n \"store/form.error.multipleOf\": \"Must be a multiple of {value}\",\n \"store/form.error.undefinedError\": \"Invalid value.\",\n \"store/form.submit.buttonLabel\": \"Submit\",\n \"store/form.submit.error.userInputError\": \"Found some errors in the data provided, please review the indicated fields try again!\",\n \"store/form.submit.error.serverError\": \"Internal Server Error! Please, try again later!\",\n \"store/form.schema.loading\": \"Loading form...\",\n \"store/form.schema.error\": \"Error loading form, try again later!\"\n}\n```"
}
] |
code_store-form_a0e4fb01
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/id.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Bidang ini wajib diisi\",\n \"store/form.error.maxLength\": \"Bidang ini memiliki panjang maksimum: {value}\",\n \"store/form.error.minLength\": \"Bidang ini memiliki panjang minimum: {value}\",\n \"store/form.error.maxValue\": \"Nilai maksimum yang diterima oleh bidang ini adalah {value}\",\n \"store/form.error.minValue\": \"Nilai minimum yang diterima oleh bidang ini adalah {value}\",\n \"store/form.error.notFloat\": \"Harus berupa angka\",\n \"store/form.error.notInteger\": \"Harus berupa bilangan bulat\",\n \"store/form.error.pattern\": \"Teks ini tidak cocok dengan pola yang diharapkan\",\n \"store/form.error.notInEnum\": \"Harus salah satu dari nilai berikut: {values}\",\n \"store/form.error.multipleOf\": \"Harus berupa kelipatan {value}\",\n \"store/form.error.undefinedError\": \"Nilai tidak valid.\",\n \"store/form.submit.buttonLabel\": \"Kirim\",\n \"store/form.submit.error.userInputError\": \"Menemukan beberapa error di data yang diberikan, silakan periksa kembali bidang yang ditunjukkan, coba lagi!\",\n \"store/form.submit.error.serverError\": \"Server Internal Error! Silakan coba lagi nanti!\",\n \"store/form.schema.loading\": \"Memuat formulir...\",\n \"store/form.schema.error\": \"Terjadi error saat memuat formulir, coba lagi nanti!\",\n \"store/form.operating.agreement\": \"Perjanjian Operasi\",\n \"store/form.add-button\": \"Tambahkan\",\n \"store/form.add-document.title\": \"Unggah dokumen\",\n \"store/form.add-document.label\": \"URL Dokumen\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"File melebihi batas ukuran 4 MB. Pilih ukuran file yang lebih kecil.\",\n \"store/form.document-uploader.error.generic\": \"Terjadi kesalahan. Silakan coba lagi.\",\n \"store/form.upload-button\": \"Unggah dokumen\",\n \"store/form.upload-document-label\": \"Pilih dokumen untuk diunggah\"\n}\n\n```"
}
] |
code_store-form_c99f01da
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/no.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Dette feltet er obligatorisk\",\n \"store/form.error.maxLength\": \"Dette feltet har maksimal lengde på: {value}\",\n \"store/form.error.minLength\": \"Dette feltet har en minimum lengde på: {value}\",\n \"store/form.error.maxValue\": \"Den maksimale verdien som godtas av dette feltet er {value}\",\n \"store/form.error.minValue\": \"Den minimale verdien som godtas av dette feltet er {value}\",\n \"store/form.error.notFloat\": \"Må være et tall\",\n \"store/form.error.notInteger\": \"Må være et heltall\",\n \"store/form.error.pattern\": \"Denne teksten samsvarer ikke med forventet mønster\",\n \"store/form.error.notInEnum\": \"Må én av følgende verdier: {values}\",\n \"store/form.error.multipleOf\": \"Må være multiplum av {value}\",\n \"store/form.error.undefinedError\": \"Ugyldig verdi.\",\n \"store/form.submit.buttonLabel\": \"Send inn\",\n \"store/form.submit.error.userInputError\": \"Fant noen feil i dataene som er oppgitt. Gå gjennom feltene som er angitt, prøv igjen!\",\n \"store/form.submit.error.serverError\": \"Intern serverfeil! Prøv igjen senere!\",\n \"store/form.schema.loading\": \"Laster inn skjema ...\",\n \"store/form.schema.error\": \"Feil ved innlasting av skjema, prøv igjen senere!\",\n \"store/form.operating.agreement\": \"Driftsavtale\",\n \"store/form.add-button\": \"Legg til\",\n \"store/form.add-document.title\": \"Last opp dokument\",\n \"store/form.add-document.label\": \"Dokument-URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Filen er større enn størrelsesgrensen på 4 MB. Velg en mindre.\",\n \"store/form.document-uploader.error.generic\": \"Noe gikk galt. Prøv igjen.\",\n \"store/form.upload-button\": \"Last opp dokument\",\n \"store/form.upload-document-label\": \"Velg et dokument å laste opp\"\n}\n\n```"
}
] |
code_store-form_dd02778c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/da.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Dette felt er påkrævet\",\n \"store/form.error.maxLength\": \"Dette felt har en maksimal længde på: {value}\",\n \"store/form.error.minLength\": \"Dette felt har en mindste længde på: {value}\",\n \"store/form.error.maxValue\": \"Den maksimale værdi, der accepteres af dette felt, er {value}\",\n \"store/form.error.minValue\": \"Den mindste værdi, der accepteres af dette felt, er {value}\",\n \"store/form.error.notFloat\": \"Skal være et tal\",\n \"store/form.error.notInteger\": \"Skal være et heltal\",\n \"store/form.error.pattern\": \"Denne tekst matcher ikke det forventede mønster\",\n \"store/form.error.notInEnum\": \"Skal en af følgende værdier: {values}\",\n \"store/form.error.multipleOf\": \"Skal være et flertal af {value}\",\n \"store/form.error.undefinedError\": \"Ugyldig værdi.\",\n \"store/form.submit.buttonLabel\": \"Indsend\",\n \"store/form.submit.error.userInputError\": \"Fandt nogle fejl i de leverede data. Gennemgå de angivne felter, prøv igen!\",\n \"store/form.submit.error.serverError\": \"Intern serverfejl! Prøv igen senere!\",\n \"store/form.schema.loading\": \"Indlæser formular...\",\n \"store/form.schema.error\": \"Fejl ved indlæsning af formular, prøv igen senere!\",\n \"store/form.operating.agreement\": \"Driftsaftale\",\n \"store/form.add-button\": \"Tilføj\",\n \"store/form.add-document.title\": \"Upload dokument\",\n \"store/form.add-document.label\": \"Dokument-URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Filen overskrider størrelsesgrænsen på 4 MB. Vælg en mindre fil.\",\n \"store/form.document-uploader.error.generic\": \"Noget gik galt. Prøv igen.\",\n \"store/form.upload-button\": \"Upload dokument\",\n \"store/form.upload-document-label\": \"Vælg et dokument til upload\"\n}\n\n```"
}
] |
code_store-form_f6455758
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/th.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"ต้องระบุฟิลด์นี้\",\n \"store/form.error.maxLength\": \"ฟิลด์นี้มีความยาวสูงสุด: {value}\",\n \"store/form.error.minLength\": \"ฟิลด์นี้มีความยาวต่ำสุด: {value}\",\n \"store/form.error.maxValue\": \"ค่าสูงสุดที่ฟิลด์นี่รับได้คือ {value}\",\n \"store/form.error.minValue\": \"ค่าต่ำสุดที่ฟิลด์นี่รับได้คือ {value}\",\n \"store/form.error.notFloat\": \"ต้องเป็นตัวเลข\",\n \"store/form.error.notInteger\": \"ต้องเป็นจำนวนเต็ม\",\n \"store/form.error.pattern\": \"ข้อความนี้ไม่ตรงกับรูปแบบที่คาดไว้\",\n \"store/form.error.notInEnum\": \"ต้องเป็นหนึ่งในค่าดังต่อไปนี้: {values}\",\n \"store/form.error.multipleOf\": \"ต้องเป็นผลคูณของ {value}\",\n \"store/form.error.undefinedError\": \"ค่าไม่ถูกต้อง\",\n \"store/form.submit.buttonLabel\": \"ส่ง\",\n \"store/form.submit.error.userInputError\": \"พบข้อผิดพลาดบางอย่างในข้อมูลที่ให้มา กรุณาตรวจสอบฟิลด์ที่ระบุ ลองอีกครั้ง!\",\n \"store/form.submit.error.serverError\": \"มีข้อผิดพลาดภายในเซิร์ฟเวอร์! กรุณาลองอีกครั้งในภายหลัง\",\n \"store/form.schema.loading\": \"กำลังโหลดแบบฟอร์ม...\",\n \"store/form.schema.error\": \"มีข้อผิดพลาดในการโหลดแบบฟอร์ม ลองอีกครั้งในภายหลัง!\",\n \"store/form.operating.agreement\": \"ข้อตกลงการดำเนินการ\",\n \"store/form.add-button\": \"เพิ่ม\",\n \"store/form.add-document.title\": \"อัปโหลดเอกสาร\",\n \"store/form.add-document.label\": \"URL เอกสาร\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"ขนาดไฟล์เกินขีดจำกัด 4MB โปรดเลือกไฟล์ที่เล็กกว่านี้\",\n \"store/form.document-uploader.error.generic\": \"มีบางอย่างผิดปกติ โปรดลองอีกครั้ง\",\n \"store/form.upload-button\": \"อัปโหลดเอกสาร\",\n \"store/form.upload-document-label\": \"เลือกเอกสารที่จะอัปโหลด\"\n}\n\n```"
}
] |
code_store-form_8f1edb09
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/sv.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Obligatoriskt fält\",\n \"store/form.error.maxLength\": \"Detta fält har en maxlängd av: {value}\",\n \"store/form.error.minLength\": \"Detta fält har en minimilängd av: {value}\",\n \"store/form.error.maxValue\": \"Det högsta värdet som accepteras av detta fält är {value}\",\n \"store/form.error.minValue\": \"Det lägsta värdet som accepteras av det här fältet är {value}\",\n \"store/form.error.notFloat\": \"Måste vara ett nummer\",\n \"store/form.error.notInteger\": \"Måste vara ett heltal\",\n \"store/form.error.pattern\": \"Denna text matchar inte det förväntade mönstret\",\n \"store/form.error.notInEnum\": \"Måste vara ett av följande värden: {values}\",\n \"store/form.error.multipleOf\": \"Måste vara en multipel av {value}\",\n \"store/form.error.undefinedError\": \"Ogiltigt värde.\",\n \"store/form.submit.buttonLabel\": \"Skicka in\",\n \"store/form.submit.error.userInputError\": \"Hittade några fel i de angivna uppgifterna, vänligen granska de angivna fälten försök igen!\",\n \"store/form.submit.error.serverError\": \"Internt serverfel! Vänligen försök igen senare!\",\n \"store/form.schema.loading\": \"Laddar formulär...\",\n \"store/form.schema.error\": \"Fel vid laddning av formulär, försök igen senare!\",\n \"store/form.operating.agreement\": \"Driftsavtal\",\n \"store/form.add-button\": \"Lägg till\",\n \"store/form.add-document.title\": \"Ladda upp dokument\",\n \"store/form.add-document.label\": \"Dokumentets URL\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"Filen överskrider maxstorleken på 4MB. Vänligen välj en mindre fil.\",\n \"store/form.document-uploader.error.generic\": \"Något gick fel. Vänligen försök igen.\",\n \"store/form.upload-button\": \"Ladda upp dokument\",\n \"store/form.upload-document-label\": \"Välj ett dokument att ladda upp\"\n}\n\n```"
}
] |
code_store-form_1f6d034a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/es.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"Este campo es requerido\",\n \"store/form.error.maxLength\": \"Este campo tiene una longitud máxima de: {value}\",\n \"store/form.error.minLength\": \"Este campo tiene una longitud mínima de: {value}\",\n \"store/form.error.maxValue\": \"El valor máximo aceptado por este campo es {value}\",\n \"store/form.error.minValue\": \"El valor mínimo aceptado por este campo es {value}\",\n \"store/form.error.notFloat\": \"Debe ser un número\",\n \"store/form.error.notInteger\": \"Debe ser un entero\",\n \"store/form.error.pattern\": \"Este texto no coincide con el patrón esperado\",\n \"store/form.error.notInEnum\": \"Debe ser uno de los siguientes valores: {values}\",\n \"store/form.error.multipleOf\": \"Debe ser un mútiplo de {value}\",\n \"store/form.error.undefinedError\": \"Valor no válido.\",\n \"store/form.submit.buttonLabel\": \"Enviar\",\n \"store/form.submit.error.userInputError\": \"Encontrado algunos errores en los datos, revise los campos indicados e intente nuevamente.\",\n \"store/form.submit.error.serverError\": \"¡Error interno de servidor! ¡Por favor, inténtelo de nuevo más tarde!\",\n \"store/form.schema.loading\": \"Cargando formulario...\",\n \"store/form.schema.error\": \"Error al cargar el formulario¡Inténtalo de nuevo más tarde!\",\n \"store/form.operating.agreement\": \"Acuerdo de operación\",\n \"store/form.add-button\": \"Agregar\",\n \"store/form.add-document.title\": \"Subir documento\",\n \"store/form.add-document.label\": \"URL del documento\",\n \"store/form.add-document.placeholder\": \"URL\",\n \"store/form.document-uploader.error.file-size\": \"El archivo supera el límite de tamaño de 4 MB. Elija uno más pequeño.\",\n \"store/form.document-uploader.error.generic\": \"Se produjo un error. Vuelva a intentarlo.\",\n \"store/form.upload-button\": \"Subir el documento\",\n \"store/form.upload-document-label\": \"Elija un documento para cargar\"\n}\n```"
}
] |
code_store-form_cbd6d906
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/messages/ar.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/form.error.required\": \"هذا الحقل مطلوب\",\n \"store/form.error.maxLength\": \"هذا الحقل له حد أقصى من الطول هو: {value}\",\n \"store/form.error.minLength\": \"هذا الحقل له حد أدنى من الطول هو: {value}\",\n \"store/form.error.maxValue\": \"القيمة القصوى المقبولة من هذا الحقل هي {value}\",\n \"store/form.error.minValue\": \"القيمة الدنيا المقبولة من هذا الحقل هي {value}\",\n \"store/form.error.notFloat\": \"يجب أن يكون رقماً\",\n \"store/form.error.notInteger\": \"يجب أن يكون عدد صحيح\",\n \"store/form.error.pattern\": \"هذا النص لا يتطابق مع النمط المتوقع\",\n \"store/form.error.notInEnum\": \"يجب أن تكون واحدة من القيم التالية: {values}\",\n \"store/form.error.multipleOf\": \"يجب أن يكون من مضاعفات {value}\",\n \"store/form.error.undefinedError\": \"قيمة غير صالحة.\",\n \"store/form.submit.buttonLabel\": \"إرسال\",\n \"store/form.submit.error.userInputError\": \"تم العثور على بعض الأخطاء في البيانات المقدمة، يرجى مراجعة الحقول المشار إليها حاول مرة أخرى!\",\n \"store/form.submit.error.serverError\": \"خطأ داخلي في الخادم! الرجاء المحاولة مرة أخرى لاحقاً!\",\n \"store/form.schema.loading\": \"تحميل الاستمارة...\",\n \"store/form.schema.error\": \"خطأ في تحميل الاستمارة، حاول مرة أخرى لاحقاً!\",\n \"store/form.operating.agreement\": \"اتفاقية التشغيل\",\n \"store/form.add-button\": \"إضافة\",\n \"store/form.add-document.title\": \"رفع مستند\",\n \"store/form.add-document.label\": \"رابط المستند\",\n \"store/form.add-document.placeholder\": \"الرابط\",\n \"store/form.document-uploader.error.file-size\": \"يتجاوز حجم الملف الحد الأقصى البالغ 4 ميغابايت. يُرجى اختيار واحد أصغر.\",\n \"store/form.document-uploader.error.generic\": \"حدث خطأ ما. يرجى المحاولة مرة أخرى.\",\n \"store/form.upload-button\": \"رفع مستند\",\n \"store/form.upload-document-label\": \"اختر مستندًا لرفعه\"\n}\n\n```"
}
] |
code_store-form_12015fb5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/docs/README.md from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/store-form) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n# Store Form\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nThe Store Form app provides blocks responsible for displaying a user form connected to [**Master Data**](https://help.vtex.com/tutorial/what-is-master-data--4otjBnR27u4WUIciQsmkAw?locale=en) through a [JSON schema](https://json-schema.org/understanding-json-schema/index.html).\n\n\n\n## Configuration\n\n> ⚠️ Before configuring the Store Form block in your theme, make sure you have already configured a **JSON schema in Master Data**. Otherwise, the customer form will not be saved appropriately. To learn more, please refer to [Creating forms for your store users](https://developers.vtex.com/docs/guides/vtex-io-documentation-creating-a-native-form-for-your-store-users).\n\n1. Add the `store-form` app to your theme dependencies in the `manifest.json`. For example:\n\n ```json\n \"dependencies\": {\n \"vtex.store-form\": \"0.x\"\n }\n ```\n\nNow, you can use all blocks exported by the `store-form` app. See the full list below:\n\n| Block name | Description |\n| - | - |\n| `form` |  Top-level block, in which you will specify which entity and schema from Master Data will be used for building the form. It provides context to its 8 children blocks (listed below). |\n| `form-input.checkbox` | Renders a checkbox field in the form. |\n| `form-input.dropdown` | Renders a dropdown field in the form. |\n| `form-input.radiogroup` | Renders a radio button field in the form. |\n| `form-input.textarea` | Renders a big text field in the form. |\n| `form-input.text` | Renders a small text field in the form with few available characters. |\n| `form-field-group` | Renders different form blocks (such as `form-input.radiogroup` and `form-input.text`) based on the schema's sub-property type. |\n| `form-input.upload` | Renders an `Upload` field in the form. |\n| `form-submit` | Renders a button to submit the user form content. |\n| `form-success` | Accepts an array of blocks rendered when the form is successfully submitted. Any children block is valid. |\n\n2. In any desired store template, such as the `store.product`, add the `form` block. In the example below, the form block is contained in a Flex Layout row:\n\n ```json\n {\n \"store.product\": {\n \"children\": [\n \"flex-layout.row#product-breadcrumb\",\n \"flex-layout.row#product-main\"\n \"flex-layout.row#form\",\n \"shelf.relatedProducts\",\n \"product-reviews\",\n \"product-questions-and-answers\"\n ]\n },\n ...\n }\n ```\n\n3. Then, declare the `form` block. Remember to specify which `entity` and `schema` from Master Data should be fetched to build the block.\n\n```JSON\n{\n \"flex-layout.row#form\": {\n \"children\": [\n \"flex-layout.col#form\"\n ]\n },\n \"flex-layout.col#form\": {\n \"children\": [\n \"form\"\n ]\n },\n \"form\": {\n \"props\": {\n \"entity\": \"clients\",\n \"schema\": \"person\"\n }\n }\n}\n```\n\n> ℹ️ If the `form` block does not have any children configured, **a default form will be rendered** automatically based on the JSON schema in Master Data. This reading and interpretation of JSON schemas is facilitated by the [Reacht Hook Form JSON Schema](https://github.com/vtex/react-hook-form-jsonschema) library, which supports the Store Form blocks logic behind the scenes.\n\n| Prop name | Type | Description| Default value |\n| - | - | - | - |\n| `entity` | `string` |  The [entity](https://help.vtex.com/tutorial/creating-data-entity--tutorials_1265) in Master Data where the document will be saved. | `undefined` |\n| `schema` | `string` |  The JSON schema name will be used. The schema name is set in the API request to create it in Master Data. | `undefined` |\n\n4. If desired, complete the `form` block by adding and configuring an array of children blocks. You can use the blocks listed in the first table stated above. For example:\n\n```json\n \"form\": {\n \"props\": {\n \"entity\": \"clients\",\n \"schema\": \"person\"\n },\n \"children\": [\n \"rich-text#formTitle\",\n \"form-input.text#firstName\",\n \"form-input.text#lastName\",\n \"form-field-group#address\",\n \"form-input.checkbox#agreement\",\n \"form-submit\"\n ],\n \"blocks\": [\"form-success\"]\n },\n \"form-success\": {\n \"children\": [\n \"rich-text#successSubmit\"\n ]\n },\n \"rich-text#successSubmit\": {\n \"props\": {\n \"text\": \"Succesfully submitted the data!\",\n \"textAlignment\": \"CENTER\",\n \"textPosition\": \"CENTER\"\n }\n },\n \"form-input.text#firstName\": {\n \"props\": {\n \"pointer\": \"#/properties/firstName\"\n }\n },\n \"form-input.text#lastName\": {\n \"props\": {\n \"pointer\": \"#/properties/lastName\"\n }\n },\n \"form-input.checkbox#agreement\": {\n \"props\": {\n \"pointer\": \"#/properties/agreement\",\n \"label\": \"Do you agree that this is the best form component in the whole wide world?\"\n }\n },\n \"form-field-group#address\": {\n \"props\": {\n \"pointer\": \"#/properties/address\"\n }\n },\n \"form-submit\": {\n \"props\": {\n \"label\": \"Submit\"\n }\n }\n```\n\n### `form-input.radiogroup`, `form-input.dropdown`, `form-input.textarea` and `form-input.checkbox` props\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `pointer` | `string` |  JSON schema pointer, i.e., the JSON schema path (for example: #/properties/firstName) in which the form block inputs should be validated against. | `undefined` |\n| `label` | `string` |  Field name when rendered. | Property title |\n\n### `form-input.textarea` props\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `placeholder` | `string` | Placeholder for the text area input. | `undefined` |\n\n### `form-input.text` props\n\n| Prop name | Type | Description | Default Value |\n| ----------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |\n| `pointer` | `string` |  JSON schema path (e.g., `#/properties/firstName`) for validating form block inputs. | `undefined` |\n| `inputType` | `enum` | Defines the type of the text field. Possible values are: `input` - renders a regular text field; `hidden` - renders a hidden text field used for pre-defining an editable value to be submitted to the form; `password` - renders a password text field. | `input` |\n| `value` (optional) | `string` | Displays a pre-defined text to be submitted when the `inputType` is set as `hidden`. | `undefined` |\n| `label` | `string` |  Label of the input field. | Property's title |\n| `placeholder` | `string` | Placeholder for the text input.\t | `undefined` |\n\n### `form-field-group` props\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `pointer` | `string` |  JSON schema pointer, i.e., the JSON schema path (for example: #/properties/address) in which the form block inputs should be validated against. Note that since you are configuring a `form-field-group` block, the path must not include a schema sub-property, only a schema property. | `undefined` |\n| `uiSchema` | `object` | Redefines how the `form-field-groups` block should render each sub-property declared in the JSON schema path defined in `pointer`. As previously mentioned, the `form-field-groups` already handle this functionality on their own. However, you have the option to override the sub-property types using a schema and redefine how each form block will be rendered. | `undefined` |\n\n### `form-input.upload` props\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `pointer` | `string` |  JSON schema pointer, i.e., the JSON schema path (for example: #/properties/address) in which the form block inputs should be validated against. Note that since you are configuring a `form-field-group` block, the path must not include a schema's sub-property, only a schema's property. | `undefined` |\n| `accept` | `string` |  By default, the upload input only supports image and PDF format files. If you want to customize it, you can use the format type you want by following this pattern: `*.TYPEFILE`. Learn more [about the `accept` field](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept). | |\n\n- **`uiSchema` object:**\n\n```js\nconst UISchema = {\n type: UIType,\n properties: {\n // Note that the definition is recursive\n childName: { UISchema },\n childName: { UISchema },\n // ...\n childName: { UISchema },\n },\n};\n```\n\nWhere `childName` should be replaced for the desired sub-property name and the `UIType` should be replaced for one of the following values:\n\n- `default`: Will consider the `form-field-group` own logic (e.g. using the [React Hook Form JSON Schema](https://github.com/vtex/react-hook-form-jsonschema) library) for block rendering;\n- `radio`: The sub-property will be rendered as a `form-input.radiogroup` block.\n- `select`: The sub-property will be rendered as a `form-input.dropdown` block.\n- `input`: The sub-property will be rendered as a `form-input.text` block with `inputType` set to `input`.\n- `hidden`: The sub-property will be rendered as a `form-input.text` block with `inputType` set to `hidden`.\n- `password`: The sub-property will be rendered as a `form-input.text` block with `inputType` set to `password`.\n- `textArea`: The sub-property will be rendered as a `form-input.textarea` block.\n- `checkbox`: The sub-property will be rendered as a `form-input.checkbox` block.\n- `upload`: The sub-property will be rendered as a `form-input.upload` block.\n\n## App Behavior\n\nThe JSON schema created in Master Data is responsible for informing the form blocks about the data they should receive. It specifies the type of input expected for each form field from users.\n\nWhen the user clicks the `Submit` button, the form blocks retrieve all input data and send it to the Schema validation. This process, which involves understanding the expected input and sending it to Master Data, is facilitated by the [`React Hook Form JSON schema`](https://github.com/vtex/react-hook-form-jsonschema) library working behind the scenes.\n\nIf any unexpected answer is detected, and the form blocks does not match the Schema, Master Data will be unable to create a user form, and an error message will be returned to the user.\n\n## Customization\n\nIn order to apply CSS customizations to this and other blocks, follow the instructions in [Using CSS handles for store customizations](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization).\n\n| CSS handles |\n| - |\n| `form` |\n| `formLoading` |\n| `formErrorLoading` |\n| `formSubmitContainer` |\n| `formSubmitButton` |\n| `formErrorServer` |\n| `formErrorUserInput` |\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/doruradu\"><img src=\"https://avatars1.githubusercontent.com/u/42587916?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>doruradu</b></sub></a><br /><a href=\"https://github.com/vtex-apps/store-form/commits?author=doruradu\" title=\"Code\">💻</a></td>\n <td align=\"center\"><a href=\"https://github.com/LEduard0\"><img src=\"https://avatars0.githubusercontent.com/u/50236503?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Luiz Eduardo</b></sub></a><br /><a href=\"https://github.com/vtex-apps/store-form/commits?author=LEduard0\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n```"
}
] |
code_store-form_a08f19ec
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputRadiogroup.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { RadioGroupInput } from './components/RadioGroup'\n\nexport default RadioGroupInput\n\n```"
}
] |
code_store-form_9b709061
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormSubmit.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useContext } from 'react'\nimport { defineMessages } from 'react-intl'\nimport { Button, Alert } from 'vtex.styleguide'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { IOMessage } from 'vtex.native-types'\n\nimport { SubmitContext } from './logic/formState'\n\nexport type FormSubmitProps = {\n label?: string\n}\n\nconst CSS_HANDLES = [\n 'formSubmitContainer',\n 'formSubmitButton',\n 'formErrorServer',\n 'formErrorUserInput',\n] as const\n\nconst messages = defineMessages({\n submitButton: {\n id: 'store/form.submit.buttonLabel',\n defaultMessage: '',\n },\n userInputError: {\n id: 'store/form.submit.error.userInputError',\n defaultMessage: '',\n },\n serverError: {\n id: 'store/form.submit.error.serverError',\n defaultMessage: '',\n },\n})\n\nexport default function FormSubmit({\n label = messages.submitButton.id,\n}: FormSubmitProps) {\n const { loading, userInputError, serverError } = useContext(SubmitContext)\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <div className={handles.formSubmitContainer}>\n <div className={handles.formSubmitButton}>\n <Button type=\"submit\" isLoading={loading}>\n <IOMessage id={label} />\n </Button>\n </div>\n <div className={handles.formErrorUserInput}>\n {userInputError && (\n <Alert type=\"error\">\n <IOMessage id={messages.userInputError.id} />\n </Alert>\n )}\n </div>\n <div className={handles.formErrorServer}>\n {serverError && (\n <Alert type=\"error\">\n <IOMessage id={messages.serverError.id} />\n </Alert>\n )}\n </div>\n </div>\n )\n}\n\n```"
}
] |
code_store-form_bf532099
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormFieldGroup.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport { ObjectMapper } from './components/Object'\nimport { FormFieldGroupProps } from './typings/InputProps'\n\nexport default function FormFieldGroup(props: FormFieldGroupProps) {\n return <ObjectMapper {...props} />\n}\n\n```"
}
] |
code_store-form_fae0ceac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputUpload.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport InputUpload from './components/Upload/Upload'\n\nexport default InputUpload\n\n```"
}
] |
code_store-form_864cd4e7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputText.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport { RawInput, HiddenInput, PasswordInput } from './components/Input'\nimport { FormRawInputProps, InputTypes } from './typings/InputProps'\n\nexport default function FormInput(props: FormRawInputProps) {\n const { inputType = InputTypes.input, pointer, ...rest } = props\n\n // eslint-disable-next-line default-case\n switch (inputType) {\n case InputTypes.input:\n return <RawInput pointer={pointer} {...rest} />\n case InputTypes.hidden:\n return <HiddenInput pointer={pointer} {...rest} />\n case InputTypes.password:\n return <PasswordInput pointer={pointer} {...rest} />\n }\n}\n\n```"
}
] |
code_store-form_d2ab6277
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/package.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"version\": \"0.10.2\",\n \"scripts\": {\n \"lint\": \"tsc --noEmit && eslint --quiet --fix --ext ts,tsx .\",\n \"test\": \"vtex-test-tools test\",\n \"test:watch\": \"vtex-test-tools test --watch\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"react\": \"^16.8.6\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.8.6\",\n \"react-hook-form-jsonschema\": \"0.2.0\",\n \"react-intl\": \"^4.5.3\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/graphql\": \"14.0.7\",\n \"@types/jest\": \"^25.1.1\",\n \"@types/node\": \"^13.5.3\",\n \"@types/react\": \"^16.9.19\",\n \"@vtex/styleguide\": \"^9.116.0\",\n \"@vtex/test-tools\": \"^3.1.0\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"mutationobserver-shim\": \"^0.3.5\",\n \"typescript\": \"3.9.7\"\n },\n \"jest\": {\n \"setupFilesAfterEnv\": [\n \"./setupTest.js\"\n ]\n }\n}\n\n```"
}
] |
code_store-form_3c44e735
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputTextArea.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { TextAreaInput } from './components/TextArea'\n\nexport default TextAreaInput\n\n```"
}
] |
code_store-form_2acfac10
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputCheckbox.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { CheckboxInput } from './components/Checkbox'\n\nexport default CheckboxInput\n\n```"
}
] |
code_store-form_440b007c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/FormInputDropdown.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { DropdownInput } from './components/Dropdown'\n\nexport default DropdownInput\n\n```"
}
] |
code_store-form_df64cc3f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/setupTest.js from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n/* eslint-disable no-undef */\nrequire('mutationobserver-shim')\n\nwindow.matchMedia =\n window.matchMedia ||\n function matchMedia() {\n return {\n matches: false,\n addListener() {},\n removeListener() {},\n }\n }\n\n```"
}
] |
code_store-form_cdc42042
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/Form.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { useQuery } from 'react-apollo'\nimport { useIntl, defineMessages } from 'react-intl'\nimport { Alert } from 'vtex.styleguide'\n\nimport { ObjectMapper } from './components/Object'\nimport FormSubmit from './FormSubmit'\nimport documentPublicSchema from './graphql/getSchema.graphql'\nimport { FormHandler } from './components/FormHandler'\nimport { FormProps } from './typings/FormProps'\n\nconst messages = defineMessages({\n loadingForm: {\n id: 'store/form.schema.loading',\n defaultMessage: '',\n },\n errorLoadingForm: {\n id: 'store/form.schema.error',\n defaultMessage: '',\n },\n})\n\nconst Form: FC<FormProps> = props => {\n const { entity, schema, children } = props\n const intl = useIntl()\n const { data, loading, error } = useQuery(documentPublicSchema, {\n variables: {\n dataEntity: entity,\n schema,\n },\n })\n\n if (loading) {\n return (\n <Alert type=\"warning\">{intl.formatMessage(messages.loadingForm)}</Alert>\n )\n }\n\n if (error) {\n return (\n <Alert type=\"error\">\n {intl.formatMessage(messages.errorLoadingForm)}\n </Alert>\n )\n }\n\n const schemaDocument = data.documentPublicSchema.schema\n\n if (!schemaDocument) {\n console.error('No MasterData Schema found')\n return null\n }\n\n if (!('properties' in schemaDocument)) {\n console.error(\n `The MasterData Schema fields should be inside \"properties\". Example: { \"schema\": { \"type\": \"object\", \"properties\": { \"foo\": { \"type\": \"string\" } }}}`\n )\n console.error('Received:', schemaDocument)\n return null\n }\n\n if (!('type' in schemaDocument)) {\n console.error(\n `The MasterData Schema is missing the required property \\`\"type\": \"object\"\\`. Example: { \"schema\": { \"type\": \"object\", \"properties\": { \"foo\": { \"type\": \"string\" } }}}`\n )\n console.error('Received:', schemaDocument)\n return null\n }\n\n if (!React.Children.count(children)) {\n return (\n <FormHandler schema={schemaDocument} formProps={props}>\n <ObjectMapper pointer=\"#\" />\n <FormSubmit label=\"Submit\" />\n </FormHandler>\n )\n }\n\n return (\n <FormHandler schema={schemaDocument} formProps={props}>\n {children}\n </FormHandler>\n )\n}\n\nexport default Form\n\n```"
}
] |
code_store-form_817d6f7d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/store/interfaces.json from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"form\": {\n \"component\": \"Form\",\n \"composition\": \"children\",\n \"allowed\": [\"form-success\"]\n },\n \"form-field-group\": {\n \"component\": \"FormFieldGroup\"\n },\n \"form-input\": {\n \"component\": \"nop\"\n },\n \"form-input.checkbox\": {\n \"component\": \"FormInputCheckbox\"\n },\n \"form-input.dropdown\": {\n \"component\": \"FormInputDropdown\"\n },\n \"form-input.text\": {\n \"component\": \"FormInputText\"\n },\n \"form-input.radiogroup\": {\n \"component\": \"FormInputRadiogroup\"\n },\n \"form-input.textarea\": {\n \"component\": \"FormInputTextArea\"\n },\n \"form-input.upload\": {\n \"component\": \"FormInputUpload\",\n \"render\": \"client\"\n },\n \"form-submit\": {\n \"component\": \"FormSubmit\"\n },\n \"form-success\": {\n \"composition\": \"children\"\n }\n}\n\n```"
}
] |
code_store-form_dd7426c1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/typings/FormProps.d.ts from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport type FormProps = {\n entity: string\n schema: string\n}\n\n```"
}
] |
code_store-form_c708b8f4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/typings/InputProps.ts from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { UISchemaType } from 'react-hook-form-jsonschema'\n\nexport interface BaseInputProps {\n pointer: string\n label?: string\n placeholder?: string\n}\n\nexport interface FormFieldGroupProps extends Omit<BaseInputProps, 'label'> {\n uiSchema?: UISchemaType\n}\n\nexport enum InputTypes {\n input = 'input',\n hidden = 'hidden',\n password = 'password',\n}\n\nexport interface FormRawInputProps extends BaseInputProps {\n inputType?: InputTypes\n value?: string\n}\n\n```"
}
] |
code_store-form_596808c4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/logic/parseDateTimeFields.ts from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface ParseDateTimeParams {\n data: Record<string, any>\n properties: Record<string, unknown>\n}\n\nexport const parseDateTimeFieldsData = ({\n data,\n properties,\n}: ParseDateTimeParams) => {\n const parsedData = { ...data }\n Object.entries(properties).forEach(([propertyKey, property]) => {\n if ((property as any)?.format === 'date-time' && parsedData[propertyKey]) {\n parsedData[propertyKey] = new Date(parsedData[propertyKey]).toISOString()\n }\n })\n\n return parsedData\n}\n\n```"
}
] |
code_store-form_e950e74c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/logic/formState.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useReducer } from 'react'\n\nconst initialState: SubmittingState = {\n loading: false,\n userInputError: null,\n serverError: null,\n success: null,\n}\n\nfunction reducer(\n state: SubmittingState,\n action: SubmittingAction\n): SubmittingState {\n switch (action.type) {\n case 'SET_LOADING': {\n return {\n loading: true,\n userInputError: null,\n serverError: null,\n success: null,\n }\n }\n case 'SET_SUCCESS': {\n return {\n loading: false,\n userInputError: false,\n serverError: null,\n success: true,\n }\n }\n case 'SET_USER_INPUT_ERROR': {\n return {\n ...state,\n loading: false,\n userInputError: true,\n success: false,\n }\n }\n case 'SET_SERVER_INTERNAL_ERROR': {\n return {\n ...state,\n loading: false,\n serverError: true,\n success: false,\n }\n }\n default:\n return state\n }\n}\n\nexport type SubmittingState = {\n loading: boolean\n userInputError: boolean | null\n serverError: boolean | null\n success: boolean | null\n}\n\nexport type SubmittingAction =\n | { type: 'SET_LOADING' }\n | { type: 'SET_SUCCESS' }\n | { type: 'SET_USER_INPUT_ERROR' }\n | { type: 'SET_SERVER_INTERNAL_ERROR' }\n\nexport const useSubmitReducer = () => {\n return useReducer(reducer, initialState)\n}\n\nexport const SubmitContext = React.createContext<SubmittingState>(initialState)\n\n```"
}
] |
code_store-form_edd73b67
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/logic/masterDataError.ts from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ApolloError } from 'apollo-client'\nimport { GraphQLError } from 'graphql'\nimport { ErrorTypes } from 'react-hook-form-jsonschema'\n\nconst concatFormPointer = (currPath: string, next: string) => {\n return `${currPath}/${next}`\n}\n\nexport type MasterDataErrorRecord = Record<string, ErrorTypes[]>\n\ninterface MasterDataError {\n Message: string\n LineNumber: number\n LinePosition: number\n Path: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Value: any | string[]\n SchemaId: string\n SchemaBaseUri: string | null\n ErrorType: string\n ChildErrors: []\n}\n\nconst concatErrors = (\n errors: MasterDataError[],\n error: { schema: string; errors: MasterDataError }\n) => {\n if (error.errors) {\n return errors.concat(error.errors)\n }\n return errors\n}\n\nconst filterMasterDataErrors = (\n acc: MasterDataError[],\n message: GraphQLError\n) => {\n if (message?.extensions?.exception?.response?.data?.errors) {\n return acc.concat(\n message.extensions.exception.response.data.errors.reduce(concatErrors, [])\n )\n }\n return acc\n}\n\nconst createOrPushError = (\n errorRecord: MasterDataErrorRecord,\n pointer: string,\n error: ErrorTypes\n) => {\n if (errorRecord[pointer]) {\n errorRecord[pointer].push(error)\n } else {\n errorRecord[pointer] = [error]\n }\n}\n\nconst evaluateMasterDataRequiredErrors = (\n data: { nodes: MasterDataErrorRecord; schemaId: string },\n nodeName: string\n) => {\n const pointer = concatFormPointer(\n concatFormPointer(data.schemaId, 'properties'),\n nodeName\n )\n createOrPushError(data.nodes, pointer, ErrorTypes.required)\n return { nodes: data.nodes, schemaId: data.schemaId }\n}\n\nconst evaluateMasterDataErrors = (\n acc: MasterDataErrorRecord,\n serverError: MasterDataError\n) => {\n // eslint-disable-next-line default-case\n switch (serverError.ErrorType) {\n case 'required':\n if (Array.isArray(serverError.Value)) {\n acc = serverError.Value.reduce(evaluateMasterDataRequiredErrors, {\n nodes: acc,\n schemaId: serverError.SchemaId,\n }).nodes\n }\n break\n case 'format':\n case 'type':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.pattern)\n break\n case 'maximum':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.maxValue)\n break\n case 'minimum':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.minValue)\n break\n case 'enum':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.notInEnum)\n break\n case 'minLength':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.minLength)\n break\n case 'maxLength':\n createOrPushError(acc, serverError.SchemaId, ErrorTypes.maxLength)\n break\n }\n return acc\n}\n\nexport const parseMasterDataError = (\n error: ApolloError | undefined\n): MasterDataErrorRecord => {\n if (!error) {\n return {}\n }\n\n return error.graphQLErrors\n .reduce(filterMasterDataErrors, [])\n .reduce(evaluateMasterDataErrors, {})\n}\n\n```"
}
] |
code_store-form_594acdf1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Dropdown.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC, useMemo } from 'react'\nimport { Dropdown as StyleguideDropdown } from 'vtex.styleguide'\nimport {\n Controller,\n UseSelectReturnType,\n useSelect,\n} from 'react-hook-form-jsonschema'\n\nimport { useFormattedError } from '../hooks/useErrorMessage'\nimport { BaseInputProps } from '../typings/InputProps'\n\nexport const DropdownInput: FC<BaseInputProps> = props => {\n const selectObject = useSelect(props.pointer)\n return <Dropdown selectObject={selectObject} label={props.label} />\n}\n\nexport const Dropdown: FC<{\n selectObject: UseSelectReturnType\n label?: string\n}> = props => {\n const { selectObject } = props\n const error = selectObject.getError()\n\n const subSchema = selectObject.getObject()\n const label = props.label ?? subSchema.title ?? selectObject.name\n\n const items = selectObject.getItems()\n const options = useMemo(() => {\n return items.map(value => {\n return { value, label: value }\n })\n }, [items])\n\n return (\n <>\n <Controller\n name={selectObject.pointer}\n control={selectObject.formContext.control}\n rules={selectObject.validator}\n as={\n <StyleguideDropdown\n name={label}\n multi={false}\n label={label}\n options={options}\n error={!!error}\n errorMessage={useFormattedError(error)}\n />\n }\n />\n </>\n )\n}\n\n```"
}
] |
code_store-form_c7a7bc17
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Object.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport {\n UseRawInputReturnType,\n InputReturnTypes,\n InputTypes,\n UseRadioReturnType,\n UseSelectReturnType,\n useObject,\n UseTextAreaReturnType,\n UseCheckboxReturnType,\n} from 'react-hook-form-jsonschema'\n\nimport { Input } from './Input'\nimport { TextArea } from './TextArea'\nimport { RadioGroup } from './RadioGroup'\nimport { Dropdown } from './Dropdown'\nimport { Checkbox } from './Checkbox'\nimport { FormFieldGroupProps } from '../typings/InputProps'\n\nconst SpecializedObject: FC<{ baseObject: InputReturnTypes }> = props => {\n switch (props.baseObject.type) {\n case InputTypes.input: {\n const inputObject = props.baseObject as UseRawInputReturnType\n return <Input inputObject={inputObject} />\n }\n case InputTypes.radio: {\n const radioObject = props.baseObject as UseRadioReturnType\n return <RadioGroup radioObject={radioObject} />\n }\n case InputTypes.select: {\n const selectObject = props.baseObject as UseSelectReturnType\n return <Dropdown selectObject={selectObject} />\n }\n case InputTypes.textArea: {\n const textAreaObject = props.baseObject as UseTextAreaReturnType\n return <TextArea textAreaObject={textAreaObject} />\n }\n case InputTypes.checkbox: {\n const checkboxObject = props.baseObject as UseCheckboxReturnType\n return <Checkbox checkboxObject={checkboxObject} />\n }\n default:\n return <></>\n }\n}\n\nexport const ObjectMapper: FC<FormFieldGroupProps> = props => {\n const { pointer, uiSchema } = props\n const methods = useObject({\n pointer,\n UISchema: uiSchema,\n })\n\n return (\n <>\n {methods.map(obj => (\n <div key={`${obj.type}${obj.pointer}`}>\n <SpecializedObject baseObject={obj} />\n </div>\n ))}\n </>\n )\n}\n\n```"
}
] |
code_store-form_d2f7bc9c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/FormHandler.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC, useMemo, useState, useCallback } from 'react'\nimport {\n FormContext,\n JSONSchemaType,\n JSONSubSchemaInfo,\n getDataFromPointer,\n OnSubmitParameters,\n} from 'react-hook-form-jsonschema'\nimport { useMutation } from 'react-apollo'\nimport { ExtensionPoint } from 'vtex.render-runtime'\nimport { GraphQLError } from 'graphql'\n\nimport createDocumentV2 from '../graphql/createDocument.graphql'\nimport { FormProps } from '../typings/FormProps'\nimport { parseMasterDataError } from '../logic/masterDataError'\nimport { useSubmitReducer, SubmitContext } from '../logic/formState'\nimport { parseDateTimeFieldsData } from '../logic/parseDateTimeFields'\n\nexport const FormHandler: FC<{\n schema: JSONSchemaType\n formProps: FormProps\n}> = props => {\n const [createDocumentMutation, { error }] = useMutation(createDocumentV2)\n\n const masterDataErrors = useMemo(() => parseMasterDataError(error), [error])\n const [lastErrorFieldValues, setLastErrorFieldValues] = useState<\n Record<string, string>\n >({})\n\n const [submitState, dispatchSubmitAction] = useSubmitReducer()\n\n const onSubmit = useCallback(\n async ({ data, methods, event }: OnSubmitParameters) => {\n if (event) {\n event.preventDefault()\n }\n dispatchSubmitAction({ type: 'SET_LOADING' })\n\n const parsedData = parseDateTimeFieldsData({\n data,\n properties: props.schema.properties,\n })\n\n await createDocumentMutation({\n variables: {\n dataEntity: props.formProps.entity,\n document: { document: parsedData },\n schema: props.formProps.schema,\n },\n })\n .then(() => {\n dispatchSubmitAction({ type: 'SET_SUCCESS' })\n })\n .catch(e => {\n setLastErrorFieldValues(parsedData)\n\n if (e.graphQLErrors) {\n for (const graphqlError of e.graphQLErrors as GraphQLError[]) {\n if (\n graphqlError.extensions?.exception?.name === 'UserInputError'\n ) {\n dispatchSubmitAction({ type: 'SET_USER_INPUT_ERROR' })\n } else {\n dispatchSubmitAction({\n type: 'SET_SERVER_INTERNAL_ERROR',\n })\n }\n }\n } else {\n dispatchSubmitAction({ type: 'SET_SERVER_INTERNAL_ERROR' })\n }\n\n methods.triggerValidation()\n })\n },\n [\n createDocumentMutation,\n dispatchSubmitAction,\n props.formProps.entity,\n props.formProps.schema,\n props.schema.properties,\n ]\n )\n\n if (submitState.success) {\n return <ExtensionPoint id=\"form-success\" />\n }\n\n return (\n <FormContext\n schema={props.schema}\n onSubmit={onSubmit}\n customValidators={{\n graphqlError: (value, context: JSONSubSchemaInfo) => {\n const lastValue = getDataFromPointer(\n context.pointer,\n lastErrorFieldValues\n )\n if (\n masterDataErrors[context.pointer] &&\n ((!lastValue && !value) || lastValue === value)\n ) {\n return masterDataErrors[context.pointer][0]\n }\n return true\n },\n }}\n >\n <SubmitContext.Provider value={submitState}>\n {props.children}\n </SubmitContext.Provider>\n </FormContext>\n )\n}\n\n```"
}
] |
code_store-form_fa4c4c11
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Checkbox.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { Checkbox as StyleguideCheckbox } from 'vtex.styleguide'\nimport { UseCheckboxReturnType, useCheckbox } from 'react-hook-form-jsonschema'\n\nimport { BaseInputProps } from '../typings/InputProps'\n\nexport const CheckboxInput: FC<BaseInputProps> = props => {\n const checkboxObject = useCheckbox(props.pointer)\n return <Checkbox checkboxObject={checkboxObject} label={props.label} />\n}\n\nexport const Checkbox: FC<{\n checkboxObject: UseCheckboxReturnType\n label?: string\n}> = props => {\n const { checkboxObject } = props\n const subSchema = checkboxObject.getObject()\n const label = props.label ?? subSchema.title ?? checkboxObject.name\n\n if (checkboxObject.isSingle) {\n const checked = checkboxObject.formContext.watch(checkboxObject.pointer)\n\n return (\n <>\n <StyleguideCheckbox\n {...checkboxObject.getItemInputProps(0)}\n label={label}\n required={checkboxObject.isRequired}\n checked={Boolean(checked)}\n value=\"true\"\n onChange={() => {\n const { pointer } = checkboxObject\n checkboxObject.formContext.setValue(pointer, !checked)\n }}\n />\n </>\n )\n }\n\n return (\n <>\n {checkboxObject.getItems().map((value, index) => {\n const checked = checkboxObject.formContext.watch(\n `${checkboxObject.pointer}[${index}]`\n )\n return (\n <StyleguideCheckbox\n {...checkboxObject.getItemInputProps(index)}\n key={`${value}${index}`}\n label={label}\n required={checkboxObject.isRequired}\n value={value}\n {...(checked ? { checked: true } : { checked: false })}\n onChange={() => {\n const { pointer } = checkboxObject\n\n checkboxObject.formContext.setValue(pointer, !checked)\n }}\n checked={Boolean(checked)}\n />\n )\n })}\n </>\n )\n}\n\n```"
}
] |
code_store-form_64bc12c5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/RadioGroup.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { RadioGroup as StyleguideRadioGroup } from 'vtex.styleguide'\nimport {\n UseRadioReturnType,\n Controller,\n useRadio,\n} from 'react-hook-form-jsonschema'\n\nimport { useFormattedError } from '../hooks/useErrorMessage'\nimport { BaseInputProps } from '../typings/InputProps'\n\nexport const RadioGroupInput: FC<BaseInputProps> = props => {\n const { pointer, label } = props\n const radioObject = useRadio(pointer)\n return <RadioGroup radioObject={radioObject} label={label} />\n}\n\nexport const RadioGroup: FC<{\n radioObject: UseRadioReturnType\n label?: string\n}> = props => {\n const { radioObject } = props\n const error = radioObject.getError()\n\n const subSchema = radioObject.getObject()\n const label = props.label ?? subSchema.title ?? radioObject.name\n\n return (\n <Controller\n name={radioObject.pointer}\n control={radioObject.formContext.control}\n rules={radioObject.validator}\n as={\n <StyleguideRadioGroup\n name={label}\n required={radioObject.isRequired}\n hideBorder\n label={label}\n options={radioObject.getItems().map(value => {\n return { value, label: value }\n })}\n error={!!error}\n errorMessage={useFormattedError(error)}\n />\n }\n />\n )\n}\n\n```"
}
] |
code_store-form_a291e7b1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/TextArea.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { Textarea as StyleguideTextarea } from 'vtex.styleguide'\nimport { UseTextAreaReturnType, useTextArea } from 'react-hook-form-jsonschema'\n\nimport { BaseInputProps } from '../typings/InputProps'\nimport { useFormattedError } from '../hooks/useErrorMessage'\n\nexport const TextAreaInput: FC<BaseInputProps> = props => {\n const textAreaObject = useTextArea(props.pointer)\n return (\n <TextArea\n textAreaObject={textAreaObject}\n label={props.label}\n placeholder={props.placeholder}\n />\n )\n}\n\nexport const TextArea: FC<{\n textAreaObject: UseTextAreaReturnType\n label?: string\n placeholder?: string\n}> = props => {\n const { textAreaObject, placeholder } = props\n const error = textAreaObject.getError()\n const subSchema = textAreaObject.getObject()\n const label = props.label ?? subSchema.title ?? textAreaObject.name\n\n return (\n <StyleguideTextarea\n {...textAreaObject.getTextAreaProps()}\n label={label}\n error={!!error}\n errorMessage={useFormattedError(error)}\n placeholder={placeholder}\n />\n )\n}\n\n```"
}
] |
code_store-form_42cdd694
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Input.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { Input as StyleguideInput } from 'vtex.styleguide'\nimport {\n UseRawInputReturnType,\n useInput,\n usePassword,\n useHidden,\n} from 'react-hook-form-jsonschema'\n\nimport { useFormattedError } from '../hooks/useErrorMessage'\nimport { FormRawInputProps } from '../typings/InputProps'\n\nexport const HiddenInput: FC<FormRawInputProps> = props => {\n const { pointer, value } = props\n const inputObject = useHidden(pointer)\n return <input {...inputObject.getInputProps()} value={value} />\n}\n\nexport const PasswordInput: FC<FormRawInputProps> = props => {\n const { pointer, label, placeholder } = props\n const inputObject = usePassword(pointer)\n return (\n <Input inputObject={inputObject} label={label} placeholder={placeholder} />\n )\n}\n\nexport const RawInput: FC<FormRawInputProps> = props => {\n const { pointer, label, placeholder } = props\n const inputObject = useInput(pointer)\n return (\n <Input inputObject={inputObject} label={label} placeholder={placeholder} />\n )\n}\n\nexport const Input: FC<{\n inputObject: UseRawInputReturnType\n label?: string\n placeholder?: string\n}> = props => {\n const { inputObject, placeholder } = props\n const error = inputObject.getError()\n\n const subSchema = inputObject.getObject()\n const label = props.label ?? subSchema.title ?? inputObject.name\n\n return (\n <StyleguideInput\n {...inputObject.getInputProps()}\n label={label}\n error={!!error}\n errorMessage={useFormattedError(error)}\n placeholder={placeholder}\n />\n )\n}\n\n```"
}
] |
code_store-form_6262a45a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/__tests__/Form.test.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport * as Apollo from 'react-apollo'\n\nimport Form from '../Form'\nimport FormInputCheckbox from '../FormInputCheckbox'\nimport FormText from '../FormInputText'\nimport FormFieldGroup from '../FormFieldGroup'\n\ndescribe('Form', () => {\n it('should render full schema', () => {\n const { getAllByText } = render(<Form entity=\"asdf\" schema=\"asdf\" />)\n\n expect(getAllByText('First Name')[0]).toBeDefined()\n expect(getAllByText('Last Name')[0]).toBeDefined()\n expect(getAllByText('Age')[0]).toBeDefined()\n expect(getAllByText('Your height in meters')[0]).toBeDefined()\n expect(getAllByText('Email address')[0]).toBeDefined()\n expect(getAllByText('Street Type')[0]).toBeDefined()\n expect(getAllByText('Address')[0]).toBeDefined()\n expect(getAllByText('Street Number')[0]).toBeDefined()\n expect(getAllByText('Do you agree with the terms?')[0]).toBeDefined()\n })\n\n it('should render partial schema', () => {\n const { getAllByText } = render(\n <Form entity=\"asdf\" schema=\"asdf\">\n <FormText pointer=\"#/properties/firstName\" />\n <FormText pointer=\"#/properties/lastName\" />\n <FormFieldGroup pointer=\"#/properties/address\" />\n <FormInputCheckbox pointer=\"#/properties/agreement\" />\n </Form>\n )\n\n expect(getAllByText('First Name')[0]).toBeDefined()\n expect(getAllByText('Last Name')[0]).toBeDefined()\n expect(getAllByText('Street Type')[0]).toBeDefined()\n expect(getAllByText('Address')[0]).toBeDefined()\n expect(getAllByText('Street Number')[0]).toBeDefined()\n expect(getAllByText('Do you agree with the terms?')[0]).toBeDefined()\n })\n\n it('should render an error if the properties is missing in the schema', () => {\n const schema = { firstName: { type: 'string' } }\n jest.spyOn(Apollo, 'useQuery').mockImplementation((query, options) => ({\n data: {\n documentPublicSchema: { schema },\n },\n query,\n options,\n }))\n\n const errorSpy = jest.spyOn(global.console, 'error')\n errorSpy.mockImplementation(() => {})\n\n render(\n <Form entity=\"foo\" schema=\"bar\">\n <FormText pointer=\"#/properties/firstName\" />\n </Form>\n )\n\n expect(errorSpy.mock.calls[0][0]).toBe(\n 'The MasterData Schema fields should be inside \"properties\". Example: { \"schema\": { \"type\": \"object\", \"properties\": { \"foo\": { \"type\": \"string\" } }}}'\n )\n expect(errorSpy.mock.calls[1][0]).toBe(`Received:`)\n expect(errorSpy.mock.calls[1][1]).toBe(schema)\n\n errorSpy.mockReset()\n })\n\n it('should render an error if the type property is missing in the schema', () => {\n const schema = { properties: { firstName: { type: 'string' } } }\n jest.spyOn(Apollo, 'useQuery').mockImplementation((query, options) => ({\n data: {\n documentPublicSchema: {\n schema,\n },\n },\n query,\n options,\n }))\n\n const errorSpy = jest.spyOn(global.console, 'error')\n\n render(\n <Form entity=\"foo\" schema=\"bar\">\n <FormText pointer=\"#/properties/firstName\" />\n </Form>\n )\n\n expect(errorSpy.mock.calls[0][0]).toBe(\n 'The MasterData Schema is missing the required property `\"type\": \"object\"`. Example: { \"schema\": { \"type\": \"object\", \"properties\": { \"foo\": { \"type\": \"string\" } }}}'\n )\n expect(errorSpy.mock.calls[1][0]).toBe(`Received:`)\n expect(errorSpy.mock.calls[1][1]).toBe(schema)\n\n errorSpy.mockReset()\n })\n\n it('should render OK if all required fields are present', () => {\n const schema = {\n type: 'object',\n properties: { firstName: { type: 'string' } },\n }\n jest.spyOn(Apollo, 'useQuery').mockImplementation((query, options) => ({\n data: {\n documentPublicSchema: {\n schema,\n },\n },\n query,\n options,\n }))\n\n const { getAllByText } = render(\n <Form entity=\"foo\" schema=\"bar\">\n <FormText pointer=\"#/properties/firstName\" />\n </Form>\n )\n\n expect(getAllByText('firstName')[0]).toBeDefined()\n })\n})\n\n```"
}
] |
code_store-form_14aa16ac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/graphql/createDocument.graphql from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation createDocument(\n $dataEntity: String!\n $document: DocumentInputV2\n $schema: String\n) {\n createDocumentV2(\n dataEntity: $dataEntity\n document: $document\n schema: $schema\n ) @context(provider: \"vtex.store-graphql\") {\n cacheId\n id\n href\n documentId\n }\n}\n\n```"
}
] |
code_store-form_773a2766
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/graphql/getSchema.graphql from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getPublicSchema($dataEntity: String!, $schema: String!) {\n documentPublicSchema(dataEntity: $dataEntity, schema: $schema)\n @context(provider: \"vtex.store-graphql\") {\n schema\n }\n}\n\n```"
}
] |
code_store-form_640b0e0b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/graphql/uploadFile.graphql from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation uploadFile($file: Upload!) {\n uploadFile(file: $file) {\n fileUrl\n }\n}\n\n```"
}
] |
code_store-form_1982e1e3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/hooks/useErrorMessage.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useIntl, defineMessages } from 'react-intl'\nimport { ErrorMessage, ErrorTypes } from 'react-hook-form-jsonschema'\n\nconst messages = defineMessages({\n required: {\n id: 'store/form.error.required',\n defaultMessage: '',\n },\n maxLength: {\n id: 'store/form.error.maxLength',\n defaultMessage: '',\n },\n minLength: {\n id: 'store/form.error.minLength',\n defaultMessage: '',\n },\n maxValue: {\n id: 'store/form.error.maxValue',\n defaultMessage: '',\n },\n minValue: {\n id: 'store/form.error.minValue',\n defaultMessage: '',\n },\n notFloat: {\n id: 'store/form.error.notFloat',\n defaultMessage: '',\n },\n notInteger: {\n id: 'store/form.error.notInteger',\n defaultMessage: '',\n },\n pattern: {\n id: 'store/form.error.pattern',\n defaultMessage: '',\n },\n notInEnum: {\n id: 'store/form.error.notInEnum',\n defaultMessage: '',\n },\n multipleOf: {\n id: 'store/form.error.multipleOf',\n defaultMessage: '',\n },\n genericError: {\n id: 'store/form.error.undefinedError',\n defaultMessage: '',\n },\n})\n\nexport const useFormattedError = (message: ErrorMessage): string => {\n const intl = useIntl()\n if (!message) {\n return ''\n }\n\n switch (message.message) {\n case ErrorTypes.required:\n return intl.formatMessage(messages.required)\n case ErrorTypes.maxLength:\n return intl.formatMessage(messages.maxLength, {\n value: message.expected?.toString(),\n })\n case ErrorTypes.minLength:\n return intl.formatMessage(messages.minLength, {\n value: message.expected?.toString(),\n })\n case ErrorTypes.maxValue:\n return intl.formatMessage(messages.maxValue, {\n value: message.expected?.toString(),\n })\n case ErrorTypes.minValue:\n return intl.formatMessage(messages.minValue, {\n value: message.expected?.toString(),\n })\n case ErrorTypes.notFloat:\n return intl.formatMessage(messages.notFloat)\n case ErrorTypes.notInteger:\n return intl.formatMessage(messages.notInteger)\n case ErrorTypes.notInEnum:\n return intl.formatMessage(messages.notInEnum)\n case ErrorTypes.pattern:\n return intl.formatMessage(messages.pattern)\n case ErrorTypes.multipleOf:\n return intl.formatMessage(messages.multipleOf, {\n value: message.expected?.toString(),\n })\n default:\n return intl.formatMessage(messages.genericError)\n }\n}\n\n```"
}
] |
code_store-form_c1ae5428
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Upload/StyleButton.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Tooltip } from 'vtex.styleguide'\n\ninterface Props {\n label: string | JSX.Element\n title?: string | JSX.Element\n active: boolean\n onToggle: (style: string | null) => void\n style: string | null\n className?: string\n}\n\nfunction StyleButton({\n active,\n onToggle,\n label,\n style,\n className = '',\n title = '',\n}: Props) {\n const handleToggle = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n e.preventDefault()\n onToggle(style)\n }\n\n return (\n <Tooltip label={title} position=\"bottom\">\n <div\n className={`vtex-styleguide-9-x-container vtex-dropdown__container br2 relative bw1 bg-base ba h-regular c-action-primary hover-b--muted-3 b--muted-4 t-body ${\n active ? 'bg-muted-5' : ''\n } ${className}`}\n onMouseDown={handleToggle}\n role=\"button\"\n tabIndex={0}\n >\n {label}\n </div>\n </Tooltip>\n )\n}\n\nexport default StyleButton\n\n```"
}
] |
code_store-form_de4333ac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-form/react/components/Upload/Upload.tsx from the store-form VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport * as React from 'react'\nimport { useMutation } from 'react-apollo'\nimport { useDropzone } from 'react-dropzone'\nimport { useIntl, defineMessages } from 'react-intl'\nimport { IOMessage } from 'vtex.native-types'\nimport {\n Button,\n IconClose,\n IconImage,\n Input,\n Spinner,\n IconCaretDown,\n} from 'vtex.styleguide'\n\nimport StyleButton from './StyleButton'\nimport UploadFileMutation from '../../graphql/uploadFile.graphql'\nimport { FormRawInputProps, InputTypes } from '../../typings/InputProps'\nimport { HiddenInput } from '../Input'\n\ninterface MutationData {\n uploadFile: { fileUrl: string }\n}\n\nconst MAX_SIZE = 4 * 1024 * 1024\n\nconst messages = defineMessages({\n titleLabel: {\n id: 'store/form.operating.agreement',\n defaultMessage: '',\n },\n add: {\n id: 'store/form.add-button',\n defaultMessage: '',\n },\n uploadLabel: {\n id: 'store/form.upload-document-label',\n defaultMessage: '',\n },\n uploadButton: {\n id: 'store/form.upload-button',\n defaultMessage: '',\n },\n})\n\nconst InputUpload = (props: FormRawInputProps & { accept?: string }) => {\n const intl = useIntl()\n const [uploadFile] = useMutation<MutationData>(UploadFileMutation)\n const ref = React.useRef<HTMLDivElement>(null)\n const [isLoading, setIsLoading] = React.useState(false)\n const [fileName, setFileName] = React.useState('')\n const [isOpen, setIsOpen] = React.useState(false)\n const [imageUrl, setImageUrl] = React.useState<string | undefined>()\n const [error, setError] = React.useState<string | null>()\n\n const { inputType = InputTypes.input, accept, pointer, ...rest } = props\n\n const onDropImage = async (files: File[]) => {\n setError(null)\n\n try {\n if (files?.[0]) {\n setIsLoading(true)\n\n const { data, errors } = await uploadFile({\n variables: { file: files[0] },\n })\n\n if (errors) {\n setError(\n intl.formatMessage({\n id: 'store/form.document-uploader.error.file-size',\n })\n )\n return\n }\n\n setIsLoading(false)\n setIsOpen(false)\n setFileName(files?.[0].name)\n setImageUrl(data?.uploadFile.fileUrl)\n\n return data\n }\n return setError(\n intl.formatMessage({\n id: 'store/form.document-uploader.error.file-size',\n })\n )\n } catch (err) {\n setError(\n intl.formatMessage({ id: 'store/form.document-uploader.error.generic' })\n )\n setIsLoading(false)\n }\n }\n\n const { getInputProps, getRootProps } = useDropzone({\n accept: accept ?? '.pdf, image/*',\n maxSize: MAX_SIZE,\n multiple: false,\n onDrop: onDropImage,\n })\n\n const handleAddImage = () => {\n setIsOpen(false)\n }\n\n return (\n <div className=\"vtex-styleguide-9-x-dropdown vtex-dropdown\" ref={ref}>\n <span className=\"db mb3 w-100 c-on-base t-small\">\n <IOMessage id={messages.titleLabel.id} />\n </span>\n <StyleButton\n title={intl.formatMessage({ id: 'store/form.add-document.title' })}\n active={isOpen}\n onToggle={() => setIsOpen(!isOpen)}\n style={null}\n label={\n <div className=\"flex flex-row justify-between items-center w-100 pa4\">\n <IconImage />\n <IconCaretDown size={8} />\n </div>\n }\n />\n\n {isOpen && (\n <div className=\"absolute pa5 bg-white b--solid b--muted-4 bw1 br2 w5 z-1\">\n {isLoading && (\n <div className=\"absolute flex justify-center items-center top-0 left-0 h-100 w-100 br2 z-1 bg-black-05\">\n <Spinner />\n </div>\n )}\n\n <div className={`flex flex-column ${isLoading && 'o-20'}`}>\n <div className=\"mb4\">\n <Input\n label={intl.formatMessage({\n id: 'store/form.add-document.label',\n })}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setImageUrl(e.target.value)\n }}\n placeholder={intl.formatMessage({\n id: 'store/form.add-document.placeholder',\n })}\n />\n </div>\n\n <Button onClick={handleAddImage} size=\"small\" disabled={!imageUrl}>\n <IOMessage id={messages.add.id} />\n </Button>\n\n <div className=\"flex flex-column\">\n <span className=\"db mb3 w-100 c-on-base t-small\">\n <IOMessage id={messages.uploadLabel.id} />\n </span>\n <div {...getRootProps()} className=\"flex flex-column\">\n <input {...getInputProps()} />\n <Button size=\"small\">\n <IOMessage id={messages.uploadButton.id} />\n </Button>\n </div>\n </div>\n\n {error && (\n <div className=\"flex flex-row c-danger t-small justify-center items-center mt5\">\n <IconClose />\n <span>{error}</span>\n </div>\n )}\n </div>\n </div>\n )}\n {fileName}\n\n {inputType && (\n <HiddenInput pointer={pointer} {...rest} value={imageUrl} />\n )}\n </div>\n )\n}\n\nexport default InputUpload\n\n```"
}
] |
code_open-graph_cb4f4688
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/docs/README.md from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Open Graph\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n> Implements Open Graph meta tags.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/MatheusR42\"><img src=\"https://avatars0.githubusercontent.com/u/16908590?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Matheus Araujo</b></sub></a><br /><a href=\"https://github.com/vtex-apps/open-graph/commits?author=MatheusR42\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n```"
}
] |
code_open-graph_946bfa79
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/package.json from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\",\n \"lint\": \"eslint --ext ts,tsx .\"\n },\n \"dependencies\": {\n \"react\": \"^16.8.3\",\n \"react-dom\": \"^16.8.3\",\n \"react-intl\": \"^2.7.2\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.4\",\n \"@types/classnames\": \"^2.2.7\",\n \"@types/graphql\": \"^14.2.0\",\n \"@types/jest\": \"^24.0.11\",\n \"@types/node\": \"^11.13.0\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/react\": \"^16.8.10\",\n \"@types/react-helmet\": \"^5.0.8\",\n \"@types/react-intl\": \"^2.3.17\",\n \"@vtex/test-tools\": \"^3.0.0\",\n \"apollo-client\": \"^2.5.1\",\n \"typescript\": \"3.9.7\"\n },\n \"version\": \"1.4.1\"\n}\n\n```"
}
] |
code_open-graph_b01de09e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/ProductOpenGraph.tsx from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useContext, Fragment } from 'react'\nimport {\n Helmet,\n useRuntime,\n RenderContext,\n canUseDOM,\n} from 'vtex.render-runtime'\nimport { ProductContext, SKU, Product } from 'vtex.product-context'\n\nimport useAppSettings from './hooks/useAppSettings'\n\n// eslint-disable-next-line no-var\ndeclare var global: {\n __hostname__: string\n __pathname__: string\n}\n\ninterface MetaTag {\n property: string\n content: string\n}\n\nfunction ProductOpenGraph() {\n const { disableOffers } = useAppSettings()\n const productContext = useContext(ProductContext) as ProductContext\n const runtime = useRuntime() as RenderContext\n const hasValue = productContext?.product\n\n if (!hasValue) {\n return null\n }\n\n const { product, selectedItem } = productContext\n const {\n culture: { currency },\n getSettings,\n } = runtime\n\n const hostname = canUseDOM ? window.location.hostname : global.__hostname__\n const pathname = canUseDOM ? window.location.pathname : global.__pathname__\n const url = `https://${hostname}${pathname}`\n\n const { titleTag = '', productName = '' } = product || {}\n\n let title = titleTag || productName\n\n try {\n const settings = getSettings('vtex.store')\n\n if (!settings.removeStoreNameTitle) {\n const { storeName, titleTag: storeTitleTag } = settings\n const suffix =\n (storeTitleTag || storeName) && ` - ${storeTitleTag || storeName}`\n\n if (suffix) {\n title += suffix\n }\n }\n } catch (e) {\n console.error('Failed to suffix store name in title.', e)\n }\n\n const metaTags = [\n { property: 'og:type', content: 'product' },\n { property: 'og:title', content: title },\n { property: 'og:url', content: url },\n { property: 'og:description', content: product.metaTagDescription },\n selectedItem\n ? { property: 'product:sku', content: selectedItem.itemId }\n : null,\n selectedItem\n ? { property: 'product:retailer_part_no', content: product.productId } // Used in the Synerise integration\n : null,\n { property: 'product:retailer_item_id', content: product.productReference },\n { property: 'product:condition', content: 'new' },\n { property: 'product:brand', content: product.brand },\n { property: 'product:price:currency', content: `${currency}` },\n ...productCategories(product),\n ...productImage(selectedItem),\n productPrice({ selectedItem, disableOffers }),\n productAvailability(selectedItem),\n ].filter(Boolean) as MetaTag[]\n\n return (\n <Fragment>\n <Helmet meta={metaTags} />\n </Fragment>\n )\n}\n\nfunction productImage(selectedItem?: SKU): Array<MetaTag | {}> {\n if (!selectedItem) {\n return []\n }\n\n const LIMIT_IMAGES = 3\n\n return selectedItem.images\n .slice(0, LIMIT_IMAGES)\n .reduce<MetaTag[]>(\n (acc, image) => [\n ...acc,\n { property: 'og:image', content: image.imageUrl },\n ],\n []\n )\n}\n\nfunction productAvailability(selectedItem?: SKU): MetaTag {\n const seller = selectedItem?.sellers.find(\n ({ commertialOffer }) => commertialOffer.AvailableQuantity > 0\n )\n\n const availability = seller ? 'instock' : 'oos'\n\n return { property: 'product:availability', content: `${availability}` }\n}\n\nfunction productPrice({\n selectedItem,\n disableOffers,\n}: {\n selectedItem?: SKU\n disableOffers: boolean\n}): MetaTag | null {\n const seller = selectedItem?.sellers.find(\n ({ commertialOffer }) => commertialOffer.AvailableQuantity > 0\n )\n\n if (!seller) {\n return null\n }\n\n if (disableOffers) {\n return null\n }\n\n return {\n property: 'product:price:amount',\n content: `${seller.commertialOffer.spotPrice}`,\n }\n}\n\nfunction productCategories(product?: Product) {\n if (!product?.categories?.length) {\n return []\n }\n\n return product.categories.map(category => ({\n property: 'product:category',\n content: category,\n }))\n}\n\nexport default ProductOpenGraph\n\n```"
}
] |
code_open-graph_70742e40
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/SearchOpenGraph.tsx from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\nimport { Helmet, canUseDOM } from 'vtex.render-runtime'\n\n// eslint-disable-next-line no-var\ndeclare var global: {\n __hostname__: string\n __pathname__: string\n}\n\ninterface MetaTag {\n property: string\n content: string\n}\n\ninterface Props {\n meta: {\n title: string\n description: string\n canonical?: string\n }\n}\n\nfunction SearchOpenGraph(props: Props) {\n const hostname = canUseDOM ? window.location.hostname : global.__hostname__\n const pathname = canUseDOM ? window.location.pathname : global.__pathname__\n const url = `https://${hostname}${pathname}`\n const { title, description, canonical } = props.meta\n\n // TODO: Add support for og:image property\n const metaTags: MetaTag[] = [\n { property: 'og:type', content: 'website' },\n { property: 'og:title', content: title },\n { property: 'og:url', content: canonical ?? url },\n { property: 'og:description', content: description ?? '' },\n ]\n\n return (\n <Fragment>\n <Helmet meta={metaTags} />\n </Fragment>\n )\n}\n\nexport default SearchOpenGraph\n\n```"
}
] |
code_open-graph_6c628266
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/HomeOpenGraph.tsx from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\nimport {\n Helmet,\n useRuntime,\n RenderContext,\n canUseDOM,\n} from 'vtex.render-runtime'\n\n// eslint-disable-next-line no-var\ndeclare var global: {\n __hostname__: string\n __pathname__: string\n}\n\ninterface MetaTag {\n property: string\n content: string\n}\n\nfunction HomeOpenGraph() {\n const runtime = useRuntime() as RenderContext\n\n const { getSettings } = runtime\n\n const hostname = canUseDOM ? window.location.hostname : global.__hostname__\n const pathname = canUseDOM ? window.location.pathname : global.__pathname__\n const url = `https://${hostname}${pathname}`\n let title = ''\n let description = ''\n\n try {\n const settings = getSettings('vtex.store')\n\n if (settings) {\n const { storeName, titleTag, metaTagDescription } = settings\n\n title = titleTag ?? storeName\n description = metaTagDescription\n }\n } catch (e) {\n console.error('Failed to load store settings.', e)\n }\n\n // TODO: Add og:image tag, which should be customizable via admin\n const metaTags: MetaTag[] = [\n { property: 'og:type', content: 'website' },\n { property: 'og:title', content: title },\n { property: 'og:url', content: url },\n { property: 'og:description', content: description },\n ]\n\n return (\n <Fragment>\n <Helmet meta={metaTags} />\n </Fragment>\n )\n}\n\nexport default HomeOpenGraph\n\n```"
}
] |
code_open-graph_9781288a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/typings/vtex.product-context.d.ts from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.product-context' {\n import { ContextType } from 'react'\n\n interface ProductContext {\n product: Product\n selectedItem: SKU\n }\n\n interface Product {\n productName: string\n productId: string\n description: string\n titleTag: string\n metaTagDescription: string\n linkText: string\n productReference: string\n categories: string[]\n categoryId: string\n categoriesIds: string[]\n categoryTree: {\n id: string\n name: string\n href: string\n }\n brand: string\n properties: Array<{\n name: string\n values: string\n }>\n specificationGroups: {\n name: string\n specifications: Array<{\n name: string\n values: string\n }>\n }\n items: SKU[]\n itemMetadata: {\n items: {\n id: string\n name: string\n imageUrl: string\n seller: string\n }\n }\n productClusters: Array<{\n id: string\n name: string\n }>\n clusterHighlights: Array<{\n id: string\n name: string\n }>\n }\n\n interface SKU {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n referenceId: Array<{\n Key\n Value\n }>\n measurementUnit: string\n unitMultiplier: string\n images: Array<{\n imageId: string\n imageLabel: string\n imageTag: string\n imageUrl: string\n imageText: string\n }>\n sellers: Array<{\n sellerId: string\n sellerName: string\n addToCartLink: string\n sellerDefault: string\n commertialOffer: {\n discountHighlights: {\n name: string\n }\n Price: string\n ListPrice: string\n spotPrice: string\n PriceWithoutDiscount: string\n RewardValue: string\n PriceValidUntil: string\n AvailableQuantity: number\n Tax: string\n CacheVersionUsedToCallCheckout: string\n Installments: Array<{\n Value: number\n InterestRate: number\n TotalValuePlusInterestRate: number\n NumberOfInstallments: number\n Name: string\n }>\n }\n }>\n variations: Array<{\n name: string\n values: string\n }>\n }\n\n export const ProductContext: Context<ProductContext>\n}\n\n```"
}
] |
code_open-graph_f5c035cd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/typings/vtex.render-runtime.d.ts from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.render-runtime' {\n export { Helmet } from 'react-helmet'\n\n export interface RenderContext {\n culture: {\n locale: string\n currency: string\n }\n getSettings: (app: string) => any\n }\n\n export const NoSSR: ReactElement\n export const canUseDOM: boolean\n\n export function useRuntime(): RenderContext\n}\n\n```"
}
] |
code_open-graph_be1da3bf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/queries/getSettings.graphql from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getSettings {\n publicSettingsForApp(app: \"vtex.open-graph\", version: \"1.x\")\n @context(provider: \"vtex.apps-graphql\") {\n message\n }\n}\n```"
}
] |
code_open-graph_a2331871
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of open-graph/react/__tests__/ProductOpenGraph.tsx from the open-graph VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport { ProductContext } from 'vtex.product-context'\n\nimport ProductOpenGraph from '../ProductOpenGraph'\n\nconst renderComponent = (productContext: object) => {\n const helpers = render(\n <ProductContext.Provider value={productContext}>\n <ProductOpenGraph />\n </ProductContext.Provider>\n )\n\n return helpers\n}\n\ntest('should have a brand', () => {\n const brand = 'Nike'\n const productContext = {\n product: {\n brand,\n },\n }\n\n const { getByTestId } = renderComponent(productContext)\n\n const tag = getByTestId('product:brand')\n\n expect(tag.innerHTML).toBe(brand)\n})\n\ntest('should show availability with instock when it has item available', () => {\n const productContext = {\n product: {},\n selectedItem: {\n images: [{ imageUrl: '' }],\n sellers: [\n {\n commertialOffer: {\n AvailableQuantity: 1,\n },\n },\n ],\n },\n }\n\n const { getByTestId } = renderComponent(productContext)\n\n const tag = getByTestId('product:availability')\n\n expect(tag.innerHTML).toBe('instock')\n})\n\ntest('should show availability with oos when no item is available', () => {\n const productContext = {\n product: {},\n selectedItem: {\n images: [{ imageUrl: '' }],\n sellers: [\n {\n commertialOffer: {\n AvailableQuantity: 0,\n },\n },\n ],\n },\n }\n\n const { getByTestId } = renderComponent(productContext)\n\n const tag = getByTestId('product:availability')\n\n expect(tag.innerHTML).toBe('oos')\n})\n\ntest('should render price', () => {\n const spotPrice = 10\n const productContext = {\n product: {},\n selectedItem: {\n images: [{ imageUrl: '' }],\n sellers: [\n {\n commertialOffer: {\n spotPrice,\n AvailableQuantity: 1,\n },\n },\n ],\n },\n }\n\n const { getByTestId } = renderComponent(productContext)\n\n const tag = getByTestId('product:price:amount')\n\n expect(tag.innerHTML).toBe(`${spotPrice}`)\n})\n\ntest('should render images', () => {\n const image1 = 'image_1'\n const image2 = 'image_2'\n const image3 = 'image_3'\n const image4 = 'image_4'\n\n const productContext = {\n product: {},\n selectedItem: {\n images: [\n { imageUrl: image1 },\n { imageUrl: image2 },\n { imageUrl: image3 },\n { imageUrl: image4 },\n ],\n sellers: [\n {\n commertialOffer: {\n AvailableQuantity: 1,\n },\n },\n ],\n },\n }\n\n const { getAllByTestId } = renderComponent(productContext)\n\n const tags = getAllByTestId('og:image')\n\n expect(tags).toHaveLength(3)\n expect(tags[0].innerHTML).toBe(image1)\n expect(tags[1].innerHTML).toBe(image2)\n expect(tags[2].innerHTML).toBe(image3)\n})\n\ntest('should have all expected tags', () => {\n const title = 'Title'\n const brand = 'Nike'\n const refId = 'ref-1'\n const skuId = 'sku-1'\n const imageUrl = 'image-url'\n const description = 'Nice shoes'\n const spotPrice = 10.5\n\n const productContext = {\n product: {\n titleTag: title,\n brand,\n productReference: refId,\n metaTagDescription: description,\n },\n selectedItem: {\n itemId: skuId,\n images: [{ imageUrl }],\n sellers: [\n {\n commertialOffer: {\n spotPrice,\n AvailableQuantity: 1,\n },\n },\n ],\n },\n }\n\n const { getByTestId } = renderComponent(productContext)\n\n const value = (type: string) => getByTestId(type).innerHTML\n\n expect(value('og:type')).toBe('product')\n expect(value('og:title')).toBe(`${title} - Store Components`)\n expect(value('og:url')).toBeDefined()\n expect(value('og:description')).toBe(description)\n expect(value('product:sku')).toBe(skuId)\n expect(value('product:condition')).toBe('new')\n expect(value('product:brand')).toBe(brand)\n expect(value('product:retailer_item_id')).toBe(refId)\n expect(value('product:price:currency')).toBe('USD')\n expect(value('og:image')).toBe(imageUrl)\n expect(value('product:availability')).toBe('instock')\n expect(value('product:price:amount')).toBe(`${spotPrice}`)\n})\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.