@faststore/api 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +333 -0
  2. package/README.md +115 -0
  3. package/dist/__generated__/schema.d.ts +281 -0
  4. package/dist/api.cjs.development.js +2226 -0
  5. package/dist/api.cjs.development.js.map +1 -0
  6. package/dist/api.cjs.production.min.js +2 -0
  7. package/dist/api.cjs.production.min.js.map +1 -0
  8. package/dist/api.esm.js +2217 -0
  9. package/dist/api.esm.js.map +1 -0
  10. package/dist/index.d.ts +136 -0
  11. package/dist/index.js +8 -0
  12. package/dist/platforms/vtex/clients/commerce/index.d.ts +29 -0
  13. package/dist/platforms/vtex/clients/commerce/types/Brand.d.ts +8 -0
  14. package/dist/platforms/vtex/clients/commerce/types/CategoryTree.d.ts +9 -0
  15. package/dist/platforms/vtex/clients/commerce/types/OrderForm.d.ts +347 -0
  16. package/dist/platforms/vtex/clients/commerce/types/Simulation.d.ts +154 -0
  17. package/dist/platforms/vtex/clients/fetch.d.ts +1 -0
  18. package/dist/platforms/vtex/clients/index.d.ts +32 -0
  19. package/dist/platforms/vtex/clients/search/index.d.ts +22 -0
  20. package/dist/platforms/vtex/clients/search/types/AttributeSearchResult.d.ts +56 -0
  21. package/dist/platforms/vtex/clients/search/types/ProductSearchResult.d.ts +199 -0
  22. package/dist/platforms/vtex/index.d.ts +144 -0
  23. package/dist/platforms/vtex/loaders/index.d.ts +7 -0
  24. package/dist/platforms/vtex/loaders/simulation.d.ts +5 -0
  25. package/dist/platforms/vtex/loaders/sku.d.ts +6 -0
  26. package/dist/platforms/vtex/resolvers/aggregateOffer.d.ts +7 -0
  27. package/dist/platforms/vtex/resolvers/aggregateRating.d.ts +2 -0
  28. package/dist/platforms/vtex/resolvers/collection.d.ts +8 -0
  29. package/dist/platforms/vtex/resolvers/facet.d.ts +5 -0
  30. package/dist/platforms/vtex/resolvers/facetValue.d.ts +5 -0
  31. package/dist/platforms/vtex/resolvers/mutation.d.ts +58 -0
  32. package/dist/platforms/vtex/resolvers/offer.d.ts +11 -0
  33. package/dist/platforms/vtex/resolvers/organization.d.ts +2 -0
  34. package/dist/platforms/vtex/resolvers/product.d.ts +5 -0
  35. package/dist/platforms/vtex/resolvers/productGroup.d.ts +3 -0
  36. package/dist/platforms/vtex/resolvers/query.d.ts +51 -0
  37. package/dist/platforms/vtex/resolvers/review.d.ts +2 -0
  38. package/dist/platforms/vtex/resolvers/searchResult.d.ts +5 -0
  39. package/dist/platforms/vtex/resolvers/seo.d.ts +7 -0
  40. package/dist/platforms/vtex/resolvers/validateCart.d.ts +71 -0
  41. package/dist/platforms/vtex/utils/enhanceSku.d.ts +5 -0
  42. package/dist/platforms/vtex/utils/facets.d.ts +12 -0
  43. package/dist/platforms/vtex/utils/slugify.d.ts +1 -0
  44. package/dist/platforms/vtex/utils/sort.d.ts +10 -0
  45. package/dist/typeDefs/index.d.ts +1 -0
  46. package/package.json +44 -0
  47. package/src/__generated__/schema.ts +324 -0
  48. package/src/index.ts +33 -0
  49. package/src/platforms/vtex/clients/commerce/index.ts +100 -0
  50. package/src/platforms/vtex/clients/commerce/types/Brand.ts +8 -0
  51. package/src/platforms/vtex/clients/commerce/types/CategoryTree.ts +9 -0
  52. package/src/platforms/vtex/clients/commerce/types/OrderForm.ts +371 -0
  53. package/src/platforms/vtex/clients/commerce/types/Simulation.ts +170 -0
  54. package/src/platforms/vtex/clients/fetch.ts +13 -0
  55. package/src/platforms/vtex/clients/index.ts +15 -0
  56. package/src/platforms/vtex/clients/search/index.ts +83 -0
  57. package/src/platforms/vtex/clients/search/types/AttributeSearchResult.ts +61 -0
  58. package/src/platforms/vtex/clients/search/types/ProductSearchResult.ts +223 -0
  59. package/src/platforms/vtex/index.ts +62 -0
  60. package/src/platforms/vtex/loaders/index.ts +16 -0
  61. package/src/platforms/vtex/loaders/simulation.ts +42 -0
  62. package/src/platforms/vtex/loaders/sku.ts +61 -0
  63. package/src/platforms/vtex/resolvers/aggregateOffer.ts +20 -0
  64. package/src/platforms/vtex/resolvers/aggregateRating.ts +7 -0
  65. package/src/platforms/vtex/resolvers/collection.ts +43 -0
  66. package/src/platforms/vtex/resolvers/facet.ts +11 -0
  67. package/src/platforms/vtex/resolvers/facetValue.ts +11 -0
  68. package/src/platforms/vtex/resolvers/mutation.ts +5 -0
  69. package/src/platforms/vtex/resolvers/offer.ts +26 -0
  70. package/src/platforms/vtex/resolvers/organization.ts +5 -0
  71. package/src/platforms/vtex/resolvers/product.ts +75 -0
  72. package/src/platforms/vtex/resolvers/productGroup.ts +9 -0
  73. package/src/platforms/vtex/resolvers/query.ts +115 -0
  74. package/src/platforms/vtex/resolvers/review.ts +11 -0
  75. package/src/platforms/vtex/resolvers/searchResult.ts +46 -0
  76. package/src/platforms/vtex/resolvers/seo.ts +10 -0
  77. package/src/platforms/vtex/resolvers/validateCart.ts +166 -0
  78. package/src/platforms/vtex/utils/enhanceSku.ts +8 -0
  79. package/src/platforms/vtex/utils/facets.ts +31 -0
  80. package/src/platforms/vtex/utils/slugify.ts +4 -0
  81. package/src/platforms/vtex/utils/sort.ts +10 -0
  82. package/src/typeDefs/aggregateOffer.graphql +10 -0
  83. package/src/typeDefs/aggregateRating.graphql +4 -0
  84. package/src/typeDefs/author.graphql +3 -0
  85. package/src/typeDefs/brand.graphql +3 -0
  86. package/src/typeDefs/breadcrumb.graphql +10 -0
  87. package/src/typeDefs/cart.graphql +13 -0
  88. package/src/typeDefs/collection.graphql +26 -0
  89. package/src/typeDefs/facet.graphql +14 -0
  90. package/src/typeDefs/image.graphql +9 -0
  91. package/src/typeDefs/index.ts +47 -0
  92. package/src/typeDefs/mutation.graphql +4 -0
  93. package/src/typeDefs/offer.graphql +21 -0
  94. package/src/typeDefs/order.graphql +9 -0
  95. package/src/typeDefs/organization.graphql +7 -0
  96. package/src/typeDefs/pageInfo.graphql +8 -0
  97. package/src/typeDefs/product.graphql +25 -0
  98. package/src/typeDefs/productGroup.graphql +5 -0
  99. package/src/typeDefs/query.graphql +64 -0
  100. package/src/typeDefs/review.graphql +9 -0
  101. package/src/typeDefs/seo.graphql +6 -0
  102. package/src/typeDefs/status.graphql +5 -0
  103. package/src/typings/schema.d.ts +7 -0
@@ -0,0 +1,199 @@
1
+ export interface ProductSearchResult {
2
+ total: number;
3
+ products: Product[];
4
+ pagination: Pagination;
5
+ sampling: boolean;
6
+ options: Options;
7
+ translated: boolean;
8
+ locale: string;
9
+ query: string;
10
+ operator: string;
11
+ fuzzy: string;
12
+ correction: Correction;
13
+ }
14
+ export interface Correction {
15
+ misspelled: boolean;
16
+ }
17
+ export interface Options {
18
+ sorts: Sort[];
19
+ counts: Count[];
20
+ }
21
+ export interface Count {
22
+ count: number;
23
+ proxyURL: string;
24
+ }
25
+ export interface Sort {
26
+ field: string;
27
+ order: string;
28
+ active?: boolean;
29
+ proxyURL: string;
30
+ }
31
+ export interface Pagination {
32
+ count: number;
33
+ current: Current;
34
+ before: any[];
35
+ after: Current[];
36
+ perPage: number;
37
+ next: Current;
38
+ previous: First;
39
+ first: First;
40
+ last: Current;
41
+ }
42
+ export interface Current {
43
+ index: number;
44
+ proxyURL: string;
45
+ }
46
+ export interface First {
47
+ index: number;
48
+ }
49
+ export interface Product {
50
+ unitMultiplier: number;
51
+ year: number;
52
+ extraData: ExtraDatum[];
53
+ release: number;
54
+ discount: number;
55
+ reference: string;
56
+ split: Split;
57
+ collections: Collection[];
58
+ price: number;
59
+ customSort: number;
60
+ stickers: Sticker[];
61
+ id: string;
62
+ stock: number;
63
+ brand: string;
64
+ availableTradePolicies: string[];
65
+ categoryTrees: CategoryTree[];
66
+ images: Image[];
67
+ locationAttributes: any[];
68
+ tax: number;
69
+ productScore: number;
70
+ storeSplitAttribute: string;
71
+ brandID: string;
72
+ installment: Installment;
73
+ name: string;
74
+ boost: Boost;
75
+ skus: Sku[];
76
+ link: string;
77
+ wear: number;
78
+ description: string;
79
+ showIfNotAvailable: boolean;
80
+ clusterHighlights: ClusterHighlights;
81
+ categories: string[];
82
+ timestamp: number;
83
+ product: string;
84
+ oldPrice: number;
85
+ productSpecifications: any[];
86
+ url: string;
87
+ measurementUnit: string;
88
+ categoryIDS: string[];
89
+ textAttributes: TextAttribute[];
90
+ numberAttributes: NumberAttribute[];
91
+ headSku: string;
92
+ specificationGroups: string;
93
+ extraInfo: ExtraInfo;
94
+ oldPriceText: string;
95
+ priceText: string;
96
+ }
97
+ export interface Boost {
98
+ newness: number;
99
+ image: number;
100
+ revenue: number;
101
+ discount: number;
102
+ productScore: number;
103
+ click: number;
104
+ availableSpecsCount: number;
105
+ promotion: number;
106
+ order: number;
107
+ }
108
+ export interface CategoryTree {
109
+ categoryNames: string[];
110
+ categoryIDS: string[];
111
+ }
112
+ export interface ClusterHighlights {
113
+ the140: string;
114
+ }
115
+ export interface Collection {
116
+ id: string;
117
+ position: number;
118
+ }
119
+ export interface ExtraDatum {
120
+ value: string;
121
+ key: string;
122
+ }
123
+ export interface ExtraInfo {
124
+ sellerID: string;
125
+ }
126
+ export interface Image {
127
+ name: string;
128
+ value: string;
129
+ }
130
+ export interface Installment {
131
+ interest: boolean;
132
+ count: number;
133
+ paymentGroupName: string;
134
+ value: number;
135
+ paymentName: string;
136
+ valueText?: string;
137
+ }
138
+ export interface NumberAttribute {
139
+ labelKey: string;
140
+ value: number;
141
+ key: string;
142
+ }
143
+ export interface Sku {
144
+ images: Image[];
145
+ nameComplete: string;
146
+ complementName: string;
147
+ policies: Policy[];
148
+ videos: any[];
149
+ reference: string;
150
+ idWithSplit: string;
151
+ ean: string;
152
+ name: string;
153
+ attributes: ExtraDatum[];
154
+ id: string;
155
+ sellers: Seller[];
156
+ }
157
+ export interface Policy {
158
+ id: string;
159
+ sellers: Seller[];
160
+ }
161
+ export interface Seller {
162
+ default: boolean;
163
+ oldPrice?: number;
164
+ price?: number;
165
+ installment?: Installment;
166
+ name: string;
167
+ tax: number;
168
+ teasers: any[];
169
+ id: string;
170
+ }
171
+ export interface Split {
172
+ labelValue: string;
173
+ labelKey: string;
174
+ }
175
+ export interface Sticker {
176
+ image: string;
177
+ name: string;
178
+ location: string;
179
+ target: string;
180
+ }
181
+ export interface TextAttribute {
182
+ joinedValue: string;
183
+ isSku: boolean;
184
+ joinedKey: string;
185
+ joinedKeyTranslations: JoinedTranslations;
186
+ isFilter: boolean;
187
+ labelValue: string;
188
+ id: string[];
189
+ labelKey: string;
190
+ value: string;
191
+ key: string;
192
+ joinedValueTranslations: JoinedTranslations;
193
+ valueID?: string;
194
+ }
195
+ export interface JoinedTranslations {
196
+ spanish: string;
197
+ english: string;
198
+ italian: string;
199
+ }
@@ -0,0 +1,144 @@
1
+ import type { Loaders } from './loaders';
2
+ import type { Clients } from './clients';
3
+ export interface Options {
4
+ platform: 'vtex';
5
+ account: string;
6
+ environment: 'vtexcommercestable' | 'vtexcommercebeta';
7
+ channel: string;
8
+ }
9
+ export interface Context {
10
+ clients: Clients;
11
+ loaders: Loaders;
12
+ }
13
+ export declare type Resolver<R = unknown, A = unknown> = (root: R, args: A, ctx: Context, info: any) => any;
14
+ export declare const getContextFactory: (options: Options) => (ctx: any) => any;
15
+ export declare const getResolvers: (_: Options) => {
16
+ StoreCollection: Record<string, Resolver<import("./clients/commerce/types/Brand").Brand | (import("./clients/commerce/types/CategoryTree").CategoryTree & {
17
+ level: number;
18
+ }), unknown>>;
19
+ StoreAggregateOffer: Record<string, (root: import("./clients/commerce/types/Simulation").Simulation & {
20
+ product: import("./utils/enhanceSku").EnhancedSku;
21
+ }) => unknown>;
22
+ StoreProduct: Record<string, Resolver<import("./utils/enhanceSku").EnhancedSku, unknown>>;
23
+ StoreSeo: Record<string, Resolver<{
24
+ title?: string | undefined;
25
+ description?: string | undefined;
26
+ }, unknown>>;
27
+ StoreFacet: Record<string, Resolver<import("./clients/search/types/AttributeSearchResult").Attribute, unknown>>;
28
+ StoreFacetValue: Record<string, Resolver<import("./clients/search/types/AttributeSearchResult").Value, unknown>>;
29
+ StoreOffer: Record<string, Resolver<(import("./clients/commerce/types/Simulation").Item & {
30
+ product: import("./utils/enhanceSku").EnhancedSku;
31
+ }) | (import("./clients/commerce/types/OrderForm").OrderFormItem & {
32
+ product: Promise<import("./utils/enhanceSku").EnhancedSku>;
33
+ }), unknown>>;
34
+ StoreAggregateRating: Record<string, Resolver<unknown, unknown>>;
35
+ StoreReview: Record<string, Resolver<unknown, unknown>>;
36
+ StoreProductGroup: Record<string, Resolver<import("./clients/search/types/ProductSearchResult").Product, unknown>>;
37
+ StoreSearchResult: Record<string, Resolver<Pick<import("./clients/search").SearchArgs, "query" | "page" | "count" | "sort" | "selectedFacets" | "fuzzy">, unknown>>;
38
+ Query: {
39
+ product: (_: unknown, { locator }: import("../..").QueryProductArgs, ctx: Context) => Promise<import("./utils/enhanceSku").EnhancedSku>;
40
+ search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: import("../..").QuerySearchArgs) => Promise<{
41
+ page: number;
42
+ count: number;
43
+ query: string | null | undefined;
44
+ sort: import("./clients/search").Sort;
45
+ selectedFacets: {
46
+ key: string;
47
+ value: string;
48
+ }[];
49
+ }>;
50
+ allProducts: (_: unknown, { first, after: maybeAfter }: import("../..").QueryAllProductsArgs, ctx: Context) => Promise<{
51
+ pageInfo: {
52
+ hasNextPage: boolean;
53
+ hasPreviousPage: boolean;
54
+ startCursor: string;
55
+ endCursor: string;
56
+ totalCount: number;
57
+ };
58
+ edges: {
59
+ node: import("./utils/enhanceSku").EnhancedSku;
60
+ cursor: string;
61
+ }[];
62
+ }>;
63
+ allCollections: (_: unknown, __: import("../..").QueryAllCollectionsArgs, ctx: Context) => Promise<{
64
+ pageInfo: {
65
+ hasNextPage: boolean;
66
+ hasPreviousPage: boolean;
67
+ startCursor: string;
68
+ endCursor: string;
69
+ };
70
+ edges: {
71
+ node: {
72
+ type: string;
73
+ id: number;
74
+ name: string;
75
+ isActive: boolean;
76
+ title: string;
77
+ metaTagDescription: string;
78
+ imageURL: import("../..").Maybe<string>;
79
+ } | (import("./clients/commerce/types/CategoryTree").CategoryTree & {
80
+ level: number;
81
+ });
82
+ cursor: string;
83
+ }[];
84
+ }>;
85
+ };
86
+ Mutation: {
87
+ validateCart: (_: unknown, { cart: { order: { orderNumber, acceptedOffer }, }, }: {
88
+ cart: import("../..").IStoreCart;
89
+ }, ctx: Context) => Promise<{
90
+ order: {
91
+ orderNumber: string;
92
+ acceptedOffer: {
93
+ product: Promise<import("./utils/enhanceSku").EnhancedSku>;
94
+ id: string;
95
+ name: string;
96
+ detailUrl: string;
97
+ imageUrl: string;
98
+ skuName: string;
99
+ quantity: number;
100
+ uniqueId: string;
101
+ productId: string;
102
+ refId: string;
103
+ ean: string;
104
+ priceValidUntil: string;
105
+ price: number;
106
+ tax: number;
107
+ listPrice: number;
108
+ sellingPrice: number;
109
+ rewardValue: number;
110
+ isGift: boolean;
111
+ parentItemIndex: number | null;
112
+ parentAssemblyBinding: import("../..").Maybe<string>;
113
+ productCategoryIds: string;
114
+ priceTags: string[];
115
+ manualPrice: number;
116
+ measurementUnit: string;
117
+ additionalInfo: {
118
+ brandName: string;
119
+ brandId: string;
120
+ offeringInfo: any;
121
+ offeringType: any;
122
+ offeringTypeId: any;
123
+ };
124
+ productCategories: Record<string, string>;
125
+ productRefId: string;
126
+ seller: string;
127
+ sellerChain: string[];
128
+ availability: string;
129
+ unitMultiplier: number;
130
+ skuSpecifications: import("./clients/commerce/types/OrderForm").SKUSpecification[];
131
+ priceDefinition: {
132
+ calculatedSellingPrice: number;
133
+ sellingPrices: import("./clients/commerce/types/OrderForm").SellingPrice[];
134
+ total: number;
135
+ };
136
+ }[];
137
+ };
138
+ messages: {
139
+ text: any;
140
+ status: any;
141
+ }[];
142
+ } | null>;
143
+ };
144
+ };
@@ -0,0 +1,7 @@
1
+ import type { Options } from '..';
2
+ import type { Clients } from '../clients';
3
+ export declare type Loaders = ReturnType<typeof getLoaders>;
4
+ export declare const getLoaders: (options: Options, clients: Clients) => {
5
+ skuLoader: import("dataloader")<import("../utils/facets").SelectedFacet[], import("../utils/enhanceSku").EnhancedSku, import("../utils/facets").SelectedFacet[]>;
6
+ simulationLoader: import("dataloader")<import("../clients/commerce/types/Simulation").PayloadItem[], import("../clients/commerce/types/Simulation").Simulation, import("../clients/commerce/types/Simulation").PayloadItem[]>;
7
+ };
@@ -0,0 +1,5 @@
1
+ import DataLoader from 'dataloader';
2
+ import type { PayloadItem, Simulation } from '../clients/commerce/types/Simulation';
3
+ import type { Options } from '..';
4
+ import type { Clients } from '../clients';
5
+ export declare const getSimulationLoader: (_: Options, clients: Clients) => DataLoader<PayloadItem[], Simulation, PayloadItem[]>;
@@ -0,0 +1,6 @@
1
+ import DataLoader from 'dataloader';
2
+ import type { EnhancedSku } from '../utils/enhanceSku';
3
+ import type { Options } from '..';
4
+ import type { Clients } from '../clients';
5
+ import type { SelectedFacet } from '../utils/facets';
6
+ export declare const getSkuLoader: (_: Options, clients: Clients) => DataLoader<SelectedFacet[], EnhancedSku, SelectedFacet[]>;
@@ -0,0 +1,7 @@
1
+ import type { EnhancedSku } from '../utils/enhanceSku';
2
+ import type { Simulation } from '../clients/commerce/types/Simulation';
3
+ declare type Resolvers = (root: Simulation & {
4
+ product: EnhancedSku;
5
+ }) => unknown;
6
+ export declare const StoreAggregateOffer: Record<string, Resolvers>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Resolver } from '..';
2
+ export declare const StoreAggregateRating: Record<string, Resolver>;
@@ -0,0 +1,8 @@
1
+ import type { Resolver } from '..';
2
+ import type { Brand } from '../clients/commerce/types/Brand';
3
+ import type { CategoryTree } from '../clients/commerce/types/CategoryTree';
4
+ declare type Root = Brand | (CategoryTree & {
5
+ level: number;
6
+ });
7
+ export declare const StoreCollection: Record<string, Resolver<Root>>;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Resolver } from '..';
2
+ import type { Attribute } from '../clients/search/types/AttributeSearchResult';
3
+ declare type Root = Attribute;
4
+ export declare const StoreFacet: Record<string, Resolver<Root>>;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Resolver } from '..';
2
+ import type { Value } from '../clients/search/types/AttributeSearchResult';
3
+ declare type Root = Value;
4
+ export declare const StoreFacetValue: Record<string, Resolver<Root>>;
5
+ export {};
@@ -0,0 +1,58 @@
1
+ export declare const Mutation: {
2
+ validateCart: (_: unknown, { cart: { order: { orderNumber, acceptedOffer }, }, }: {
3
+ cart: import("../../..").IStoreCart;
4
+ }, ctx: import("..").Context) => Promise<{
5
+ order: {
6
+ orderNumber: string;
7
+ acceptedOffer: {
8
+ product: Promise<import("../utils/enhanceSku").EnhancedSku>;
9
+ id: string;
10
+ name: string;
11
+ detailUrl: string;
12
+ imageUrl: string;
13
+ skuName: string;
14
+ quantity: number;
15
+ uniqueId: string;
16
+ productId: string;
17
+ refId: string;
18
+ ean: string;
19
+ priceValidUntil: string;
20
+ price: number;
21
+ tax: number;
22
+ listPrice: number;
23
+ sellingPrice: number;
24
+ rewardValue: number;
25
+ isGift: boolean;
26
+ parentItemIndex: number | null;
27
+ parentAssemblyBinding: string | null;
28
+ productCategoryIds: string;
29
+ priceTags: string[];
30
+ manualPrice: number;
31
+ measurementUnit: string;
32
+ additionalInfo: {
33
+ brandName: string;
34
+ brandId: string;
35
+ offeringInfo: any;
36
+ offeringType: any;
37
+ offeringTypeId: any;
38
+ };
39
+ productCategories: Record<string, string>;
40
+ productRefId: string;
41
+ seller: string;
42
+ sellerChain: string[];
43
+ availability: string;
44
+ unitMultiplier: number;
45
+ skuSpecifications: import("../clients/commerce/types/OrderForm").SKUSpecification[];
46
+ priceDefinition: {
47
+ calculatedSellingPrice: number;
48
+ sellingPrices: import("../clients/commerce/types/OrderForm").SellingPrice[];
49
+ total: number;
50
+ };
51
+ }[];
52
+ };
53
+ messages: {
54
+ text: any;
55
+ status: any;
56
+ }[];
57
+ } | null>;
58
+ };
@@ -0,0 +1,11 @@
1
+ import type { EnhancedSku } from '../utils/enhanceSku';
2
+ import type { Resolver } from '..';
3
+ import type { Item } from '../clients/commerce/types/Simulation';
4
+ import type { OrderFormItem } from '../clients/commerce/types/OrderForm';
5
+ declare type Root = (Item & {
6
+ product: EnhancedSku;
7
+ }) | (OrderFormItem & {
8
+ product: Promise<EnhancedSku>;
9
+ });
10
+ export declare const StoreOffer: Record<string, Resolver<Root>>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Resolver } from '..';
2
+ export declare const StoreOrganization: Record<string, Resolver>;
@@ -0,0 +1,5 @@
1
+ import type { Resolver } from '..';
2
+ import type { EnhancedSku } from '../utils/enhanceSku';
3
+ declare type Root = EnhancedSku;
4
+ export declare const StoreProduct: Record<string, Resolver<Root>>;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Product } from '../clients/search/types/ProductSearchResult';
2
+ import type { Resolver } from '..';
3
+ export declare const StoreProductGroup: Record<string, Resolver<Product>>;
@@ -0,0 +1,51 @@
1
+ import type { QueryProductArgs, QueryAllCollectionsArgs, QueryAllProductsArgs, QuerySearchArgs } from '../../../__generated__/schema';
2
+ import type { CategoryTree } from '../clients/commerce/types/CategoryTree';
3
+ import type { Context } from '../index';
4
+ export declare const Query: {
5
+ product: (_: unknown, { locator }: QueryProductArgs, ctx: Context) => Promise<import("../utils/enhanceSku").EnhancedSku>;
6
+ search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: QuerySearchArgs) => Promise<{
7
+ page: number;
8
+ count: number;
9
+ query: string | null | undefined;
10
+ sort: import("../clients/search").Sort;
11
+ selectedFacets: {
12
+ key: string;
13
+ value: string;
14
+ }[];
15
+ }>;
16
+ allProducts: (_: unknown, { first, after: maybeAfter }: QueryAllProductsArgs, ctx: Context) => Promise<{
17
+ pageInfo: {
18
+ hasNextPage: boolean;
19
+ hasPreviousPage: boolean;
20
+ startCursor: string;
21
+ endCursor: string;
22
+ totalCount: number;
23
+ };
24
+ edges: {
25
+ node: import("../utils/enhanceSku").EnhancedSku;
26
+ cursor: string;
27
+ }[];
28
+ }>;
29
+ allCollections: (_: unknown, __: QueryAllCollectionsArgs, ctx: Context) => Promise<{
30
+ pageInfo: {
31
+ hasNextPage: boolean;
32
+ hasPreviousPage: boolean;
33
+ startCursor: string;
34
+ endCursor: string;
35
+ };
36
+ edges: {
37
+ node: {
38
+ type: string;
39
+ id: number;
40
+ name: string;
41
+ isActive: boolean;
42
+ title: string;
43
+ metaTagDescription: string;
44
+ imageURL: import("../../../__generated__/schema").Maybe<string>;
45
+ } | (CategoryTree & {
46
+ level: number;
47
+ });
48
+ cursor: string;
49
+ }[];
50
+ }>;
51
+ };
@@ -0,0 +1,2 @@
1
+ import type { Resolver } from '..';
2
+ export declare const StoreReview: Record<string, Resolver>;
@@ -0,0 +1,5 @@
1
+ import type { Resolver } from '..';
2
+ import type { SearchArgs } from '../clients/search';
3
+ declare type Root = Omit<SearchArgs, 'type'>;
4
+ export declare const StoreSearchResult: Record<string, Resolver<Root>>;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Resolver } from '..';
2
+ declare type Root = {
3
+ title?: string;
4
+ description?: string;
5
+ };
6
+ export declare const StoreSeo: Record<string, Resolver<Root>>;
7
+ export {};
@@ -0,0 +1,71 @@
1
+ import type { IStoreCart } from '../../../__generated__/schema';
2
+ import type { Context } from '..';
3
+ /**
4
+ * This resolver implements the optimistic cart behavior. The main idea in here
5
+ * is that we receive a cart from the UI (as query params) and we validate it with
6
+ * the commerce platform. If the cart is valid, we return null, if the cart is
7
+ * invalid according to the commerce platform, we return the new cart the UI should use
8
+ * instead
9
+ *
10
+ * The algoritm is something like:
11
+ * 1. Fetch orderForm from VTEX
12
+ * 2. Compute delta changes between the orderForm and the UI's cart
13
+ * 3. Update the orderForm in VTEX platform accordingly
14
+ * 4. If any chages were made, send to the UI the new cart. Null otherwise
15
+ */
16
+ export declare const validateCart: (_: unknown, { cart: { order: { orderNumber, acceptedOffer }, }, }: {
17
+ cart: IStoreCart;
18
+ }, ctx: Context) => Promise<{
19
+ order: {
20
+ orderNumber: string;
21
+ acceptedOffer: {
22
+ product: Promise<import("../utils/enhanceSku").EnhancedSku>;
23
+ id: string;
24
+ name: string;
25
+ detailUrl: string;
26
+ imageUrl: string;
27
+ skuName: string;
28
+ quantity: number;
29
+ uniqueId: string;
30
+ productId: string;
31
+ refId: string;
32
+ ean: string;
33
+ priceValidUntil: string;
34
+ price: number;
35
+ tax: number;
36
+ listPrice: number;
37
+ sellingPrice: number;
38
+ rewardValue: number;
39
+ isGift: boolean;
40
+ parentItemIndex: number | null;
41
+ parentAssemblyBinding: string | null;
42
+ productCategoryIds: string;
43
+ priceTags: string[];
44
+ manualPrice: number;
45
+ measurementUnit: string;
46
+ additionalInfo: {
47
+ brandName: string;
48
+ brandId: string;
49
+ offeringInfo: any;
50
+ offeringType: any;
51
+ offeringTypeId: any;
52
+ };
53
+ productCategories: Record<string, string>;
54
+ productRefId: string;
55
+ seller: string;
56
+ sellerChain: string[];
57
+ availability: string;
58
+ unitMultiplier: number;
59
+ skuSpecifications: import("../clients/commerce/types/OrderForm").SKUSpecification[];
60
+ priceDefinition: {
61
+ calculatedSellingPrice: number;
62
+ sellingPrices: import("../clients/commerce/types/OrderForm").SellingPrice[];
63
+ total: number;
64
+ };
65
+ }[];
66
+ };
67
+ messages: {
68
+ text: any;
69
+ status: any;
70
+ }[];
71
+ } | null>;
@@ -0,0 +1,5 @@
1
+ import type { Product, Sku } from '../clients/search/types/ProductSearchResult';
2
+ export declare type EnhancedSku = Sku & {
3
+ isVariantOf: Product;
4
+ };
5
+ export declare const enhanceSku: (sku: Sku, product: Product) => EnhancedSku;
@@ -0,0 +1,12 @@
1
+ export interface SelectedFacet {
2
+ key: string;
3
+ value: string;
4
+ }
5
+ /**
6
+ * Transform facets from the store to VTEX platform facets.
7
+ * For instance, the channel in Store becames trade-policy in VTEX's realm
8
+ * */
9
+ export declare const transformSelectedFacet: ({ key, value }: SelectedFacet) => {
10
+ key: string;
11
+ value: string;
12
+ };
@@ -0,0 +1 @@
1
+ export declare const slugify: (path: string) => string;
@@ -0,0 +1,10 @@
1
+ export declare const SORT_MAP: {
2
+ readonly price_desc: "price:desc";
3
+ readonly price_asc: "price:asc";
4
+ readonly orders_desc: "orders:desc";
5
+ readonly name_desc: "name:desc";
6
+ readonly name_asc: "name:asc";
7
+ readonly release_desc: "release:desc";
8
+ readonly discount_desc: "discount:desc";
9
+ readonly score_desc: "";
10
+ };
@@ -0,0 +1 @@
1
+ export declare const typeDefs: string;