@jetshop/core 5.17.0-alpha.c701d997 → 5.17.0-alpha.d3f57df3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. package/ChannelHandler/ChannelHandler.js.map +1 -1
  2. package/ChannelHandler/PreserveRedirectRouteQuery.gql +4 -4
  3. package/ChannelHandler/redirectUtils.d.ts +1 -1
  4. package/ChannelHandler/redirectUtils.js +5 -3
  5. package/ChannelHandler/redirectUtils.js.map +1 -1
  6. package/ChannelHandler/redirectUtils.test.js +5 -5
  7. package/ChannelHandler/redirectUtilsGroupedChannels.test.js +5 -5
  8. package/analytics/webVitals.js +5 -5
  9. package/analytics/webVitals.js.map +1 -1
  10. package/boot/NetworkStatusNotifier.d.ts +2 -0
  11. package/boot/NetworkStatusNotifier.js +4 -0
  12. package/boot/NetworkStatusNotifier.js.map +1 -0
  13. package/boot/SharedTree.d.ts +1 -1
  14. package/boot/SharedTree.js +1 -1
  15. package/boot/SharedTree.js.map +1 -1
  16. package/boot/apollo.d.ts +1 -2
  17. package/boot/apollo.js +13 -8
  18. package/boot/apollo.js.map +1 -1
  19. package/boot/client/startClient.js +18 -5
  20. package/boot/client/startClient.js.map +1 -1
  21. package/boot/server/IntervalQuery.d.ts +1 -1
  22. package/boot/server/IntervalQuery.js +2 -2
  23. package/boot/server/IntervalQuery.js.map +1 -1
  24. package/boot/server/IntervalQuery.test.js +9 -13
  25. package/boot/server/PersistedApolloClient.test.js +8 -7
  26. package/boot/server/createApolloServer.d.ts +2 -1
  27. package/boot/server/createApolloServer.js +5 -5
  28. package/boot/server/createApolloServer.js.map +1 -1
  29. package/boot/server/createRenderer.js +4 -2
  30. package/boot/server/createRenderer.js.map +1 -1
  31. package/boot/server/entrypoint.js +7 -4
  32. package/boot/server/entrypoint.js.map +1 -1
  33. package/boot/server/persistedQueries/__tests__/getPersistedQueriesForRequest.test.js +1 -1
  34. package/boot/utils/queryLoggingMiddleware.d.ts +1 -1
  35. package/boot/utils/queryLoggingMiddleware.js +2 -2
  36. package/boot/utils/queryLoggingMiddleware.js.map +1 -1
  37. package/cart/AddToCartFormik.d.ts +2 -2
  38. package/cart/AddToCartFormik.js +2 -2
  39. package/cart/AddToCartFormik.js.map +1 -1
  40. package/cart/useAddToCart.d.ts +1 -1
  41. package/components/Auth/ForgotPasswordProvider.d.ts +4 -6
  42. package/components/Auth/ForgotPasswordProvider.js +18 -18
  43. package/components/Auth/ForgotPasswordProvider.js.map +1 -1
  44. package/components/Auth/ResetPasswordProvider.d.ts +5 -3
  45. package/components/Auth/ResetPasswordProvider.js +1 -1
  46. package/components/Auth/ResetPasswordProvider.js.map +1 -1
  47. package/components/Auth/SSN.js +4 -4
  48. package/components/Auth/SSN.js.map +1 -1
  49. package/components/Auth/SignupFormContainer.d.ts +2 -5
  50. package/components/Auth/SignupFormContainer.js.map +1 -1
  51. package/components/Auth/UpdatePasswordForm.js +6 -6
  52. package/components/Auth/UpdatePasswordForm.js.map +1 -1
  53. package/components/Auth/signup-context.d.ts +2 -2
  54. package/components/Auth/signup-context.js +2 -3
  55. package/components/Auth/signup-context.js.map +1 -1
  56. package/components/Auth/signupSubmit.js +4 -4
  57. package/components/Auth/signupSubmit.js.map +1 -1
  58. package/components/Auth/useAddressFields.js +3 -3
  59. package/components/Auth/useAddressFields.js.map +1 -1
  60. package/components/Auth/useAddressFields.test.js +10 -8
  61. package/components/Auth/useCustomer.d.ts +2 -2
  62. package/components/Auth/useCustomer.js +1 -1
  63. package/components/Auth/useCustomer.js.map +1 -1
  64. package/components/AuthContext/AuthProvider.js +2 -2
  65. package/components/AuthContext/AuthProvider.js.map +1 -1
  66. package/components/AuthContext/AuthProvider.test.js +1 -1
  67. package/components/AuthContext/LogOut.d.ts +2 -2
  68. package/components/ChannelContext/ChannelProvider.d.ts +1 -1
  69. package/components/ChannelContext/useCountrySettings.d.ts +1 -1
  70. package/components/ChannelContext/useCountrySettings.js +1 -1
  71. package/components/ChannelContext/useCountrySettings.js.map +1 -1
  72. package/components/DynamicRoute/ActiveFiltersQuery.gql +4 -4
  73. package/components/DynamicRoute/CategoryRoute.d.ts +3 -3
  74. package/components/DynamicRoute/CategoryRoute.js +6 -3
  75. package/components/DynamicRoute/CategoryRoute.js.map +1 -1
  76. package/components/DynamicRoute/ContentRoute.d.ts +1 -1
  77. package/components/DynamicRoute/GenericError.d.ts +18 -0
  78. package/components/DynamicRoute/GenericError.js +61 -0
  79. package/components/DynamicRoute/GenericError.js.map +1 -0
  80. package/components/DynamicRoute/PreviewRoute.d.ts +1 -1
  81. package/components/DynamicRoute/PreviewRoute.js +1 -1
  82. package/components/DynamicRoute/PreviewRoute.js.map +1 -1
  83. package/components/DynamicRoute/ProductByArticlenumber.d.ts +2 -2
  84. package/components/DynamicRoute/ProductByArticlenumber.js +2 -2
  85. package/components/DynamicRoute/ProductByArticlenumber.js.map +1 -1
  86. package/components/DynamicRoute/ProductRoute.d.ts +3 -3
  87. package/components/DynamicRoute/RouteResolver.d.ts +2 -2
  88. package/components/DynamicRoute/RouteResolver.js +2 -1
  89. package/components/DynamicRoute/RouteResolver.js.map +1 -1
  90. package/components/DynamicRoute/Status.d.ts +4 -3
  91. package/components/DynamicRoute/Status.js.map +1 -1
  92. package/components/DynamicRoute/index.d.ts +4 -4
  93. package/components/DynamicRoute/index.js +47 -42
  94. package/components/DynamicRoute/index.js.map +1 -1
  95. package/components/Filters/utils/replaceInSearch.d.ts +1 -1
  96. package/components/Filters/utils/replaceInSearch.js.map +1 -1
  97. package/components/Fonts/injectFont.js +2 -2
  98. package/components/Fonts/injectFont.js.map +1 -1
  99. package/components/Mutation/AddToCartFormik.d.ts +1 -1
  100. package/components/Mutation/AddToCartFormik.js +2 -2
  101. package/components/Mutation/AddToCartFormik.js.map +1 -1
  102. package/components/Mutation/DecrementQuantity.d.ts +2 -2
  103. package/components/Mutation/DecrementQuantity.js +1 -1
  104. package/components/Mutation/DecrementQuantity.js.map +1 -1
  105. package/components/Mutation/IncrementQuantity.d.ts +2 -2
  106. package/components/Mutation/IncrementQuantity.js +1 -1
  107. package/components/Mutation/IncrementQuantity.js.map +1 -1
  108. package/components/Mutation/RemoveFromCart.d.ts +2 -2
  109. package/components/Mutation/RemoveFromCart.js +1 -1
  110. package/components/Mutation/RemoveFromCart.js.map +1 -1
  111. package/components/Mutation/SetQuantity.d.ts +2 -2
  112. package/components/Mutation/SetQuantity.js +1 -1
  113. package/components/Mutation/SetQuantity.js.map +1 -1
  114. package/components/Mutation/SubscribeToNewsletter.d.ts +1 -1
  115. package/components/Mutation/SubscribeToNewsletter.js +1 -1
  116. package/components/Mutation/SubscribeToNewsletter.js.map +1 -1
  117. package/components/Mutation/SubscribeToStockNotifications.d.ts +1 -1
  118. package/components/Mutation/SubscribeToStockNotifications.js +6 -2
  119. package/components/Mutation/SubscribeToStockNotifications.js.map +1 -1
  120. package/components/Mutation/cartMutationUtils.d.ts +1 -2
  121. package/components/Mutation/cartMutationUtils.js.map +1 -1
  122. package/components/Mutation/useDecrementQuantity.d.ts +1 -1
  123. package/components/Mutation/useDecrementQuantity.js +1 -1
  124. package/components/Mutation/useDecrementQuantity.js.map +1 -1
  125. package/components/Mutation/useIncrementQuantity.d.ts +1 -1
  126. package/components/Mutation/useIncrementQuantity.js +1 -1
  127. package/components/Mutation/useIncrementQuantity.js.map +1 -1
  128. package/components/Mutation/useRemoveFromCart.d.ts +1 -1
  129. package/components/Mutation/useRemoveFromCart.js +1 -1
  130. package/components/Mutation/useRemoveFromCart.js.map +1 -1
  131. package/components/Mutation/useSetQuantity.d.ts +1 -1
  132. package/components/Mutation/useSetQuantity.js +1 -1
  133. package/components/Mutation/useSetQuantity.js.map +1 -1
  134. package/components/Notifications/Notifications.d.ts +3 -3
  135. package/components/Notifications/Notifications.js +2 -3
  136. package/components/Notifications/Notifications.js.map +1 -1
  137. package/components/ProductConfigurationProvider/ProductConfigurationProvider.js +6 -6
  138. package/components/ProductConfigurationProvider/ProductConfigurationProvider.js.map +1 -1
  139. package/components/Query/CartProvider.d.ts +1 -1
  140. package/components/Query/CartProvider.js +1 -1
  141. package/components/Query/CartProvider.js.map +1 -1
  142. package/components/SortOrder/SortOrderContainer.d.ts +1 -1
  143. package/components/StructuredData/StructuredBreadcrumbData.d.ts +2 -2
  144. package/data/cache.d.ts +1 -1
  145. package/data/cache.js +62 -12
  146. package/data/cache.js.map +1 -1
  147. package/global.d.ts +55 -1
  148. package/helpers/getErrorDetail.d.ts +1 -1
  149. package/helpers/getErrorDetail.js +2 -2
  150. package/helpers/getErrorDetail.js.map +1 -1
  151. package/hooks/Filters/useBooleanFilter.d.ts +1 -1
  152. package/hooks/Filters/useBooleanFilter.js +1 -2
  153. package/hooks/Filters/useBooleanFilter.js.map +1 -1
  154. package/hooks/Filters/useFilters.d.ts +1 -1
  155. package/hooks/Filters/useFilters.js +1 -2
  156. package/hooks/Filters/useFilters.js.map +1 -1
  157. package/hooks/Filters/useListFilter.d.ts +2 -2
  158. package/hooks/Filters/useListFilter.js +1 -2
  159. package/hooks/Filters/useListFilter.js.map +1 -1
  160. package/hooks/Filters/useMultiFilter.d.ts +3 -3
  161. package/hooks/Filters/useMultiFilter.js +1 -2
  162. package/hooks/Filters/useMultiFilter.js.map +1 -1
  163. package/hooks/Filters/useRangeFilter.d.ts +2 -2
  164. package/hooks/Filters/useRangeFilter.js +1 -2
  165. package/hooks/Filters/useRangeFilter.js.map +1 -1
  166. package/hooks/Filters/useSortOrder.d.ts +6 -1
  167. package/hooks/Filters/useSortOrder.js +4 -3
  168. package/hooks/Filters/useSortOrder.js.map +1 -1
  169. package/hooks/PackageProducts/usePackageProductItem.d.ts +1 -1
  170. package/hooks/PackageProducts/usePackageProductItem.js +1 -1
  171. package/hooks/PackageProducts/usePackageProductItem.js.map +1 -1
  172. package/hooks/PackageProducts/usePackageProducts.js +17 -17
  173. package/hooks/PackageProducts/usePackageProducts.js.map +1 -1
  174. package/hooks/PackageProducts/usePackageProducts.test.js +1 -1
  175. package/hooks/ProductList/ProductListContext.js +1 -1
  176. package/hooks/ProductList/ProductListContext.js.map +1 -1
  177. package/hooks/ProductList/action-creators.d.ts +1 -1
  178. package/hooks/ProductList/index.d.ts +1 -1
  179. package/hooks/ProductList/list-transforms.js +1 -1
  180. package/hooks/ProductList/list-transforms.js.map +1 -1
  181. package/hooks/ProductList/product-list-reducer.js +1 -1
  182. package/hooks/ProductList/product-list-reducer.js.map +1 -1
  183. package/hooks/ProductList/useProductList.js +1 -1
  184. package/hooks/ProductList/useProductList.js.map +1 -1
  185. package/hooks/ProductList/useProductListItems.js +1 -1
  186. package/hooks/ProductList/useProductListItems.js.map +1 -1
  187. package/hooks/Subscriptions/useNewsletterSubscription.js +3 -3
  188. package/hooks/Subscriptions/useNewsletterSubscription.js.map +1 -1
  189. package/hooks/Subscriptions/useStockNotifications.d.ts +1 -1
  190. package/hooks/Subscriptions/useStockNotifications.js +3 -3
  191. package/hooks/Subscriptions/useStockNotifications.js.map +1 -1
  192. package/hooks/Subscriptions/useStoreSubscriptions.d.ts +1 -1
  193. package/hooks/Subscriptions/useStoreSubscriptions.js +3 -6
  194. package/hooks/Subscriptions/useStoreSubscriptions.js.map +1 -1
  195. package/hooks/Subscriptions/useStoresubscriptions.test.js +5 -7
  196. package/hooks/useAddMultipleToCart.d.ts +1 -1
  197. package/hooks/useAddMultipleToCart.js +1 -1
  198. package/hooks/useAddMultipleToCart.js.map +1 -1
  199. package/hooks/useAddMultipleToCart.test.js +1 -1
  200. package/hooks/useCustomerOrders.test.js +7 -5
  201. package/hooks/useCustomerOrdersQuery.d.ts +2 -2
  202. package/hooks/useCustomerOrdersQuery.js +1 -1
  203. package/hooks/useCustomerOrdersQuery.js.map +1 -1
  204. package/hooks/useDeleteAccountMutation.js +3 -3
  205. package/hooks/useDeleteAccountMutation.js.map +1 -1
  206. package/hooks/useInfinitePagination.d.ts +1 -1
  207. package/hooks/useInfinitePagination.js +4 -1
  208. package/hooks/useInfinitePagination.js.map +1 -1
  209. package/hooks/useLoginMutation.d.ts +3 -3
  210. package/hooks/useLoginMutation.js +2 -2
  211. package/hooks/useLoginMutation.js.map +1 -1
  212. package/hooks/useLoginRedirect.js +2 -2
  213. package/hooks/useLoginRedirect.js.map +1 -1
  214. package/hooks/useOrderDetailQuery.d.ts +3 -3
  215. package/hooks/useOrderDetailQuery.js +1 -1
  216. package/hooks/useOrderDetailQuery.js.map +1 -1
  217. package/hooks/useRoutePreload.js +1 -1
  218. package/hooks/useRoutePreload.js.map +1 -1
  219. package/hooks/useStockStatus.d.ts +8 -0
  220. package/hooks/useStockStatus.js +26 -0
  221. package/hooks/useStockStatus.js.map +1 -0
  222. package/integrations/sluggishSchemaExtension.js +1 -1
  223. package/integrations/sluggishSchemaExtension.js.map +1 -1
  224. package/package.json +19 -36
  225. package/polyfills.js +0 -2
  226. package/polyfills.js.map +1 -1
  227. package/resolvers/filters/boolFilter.js +24 -27
  228. package/resolvers/filters/boolFilter.js.map +1 -1
  229. package/resolvers/filters/filterParams.js +8 -8
  230. package/resolvers/filters/filterParams.js.map +1 -1
  231. package/resolvers/filters/filters.js +5 -5
  232. package/resolvers/filters/filters.js.map +1 -1
  233. package/resolvers/filters/index.d.ts +0 -4
  234. package/resolvers/filters/listFilter.js +24 -29
  235. package/resolvers/filters/listFilter.js.map +1 -1
  236. package/resolvers/filters/listFilterItem.js +31 -36
  237. package/resolvers/filters/listFilterItem.js.map +1 -1
  238. package/resolvers/filters/multiListFilter.js +41 -42
  239. package/resolvers/filters/multiListFilter.js.map +1 -1
  240. package/resolvers/filters/multiListFilterList.js +1 -1
  241. package/resolvers/filters/multiListFilterList.js.map +1 -1
  242. package/resolvers/filters/rangeFilter.js +27 -43
  243. package/resolvers/filters/rangeFilter.js.map +1 -1
  244. package/test-utils/ProviderPyramid.js +1 -1
  245. package/types.d.ts +1820 -1955
  246. package/components/Fonts/GoogleFont.d.ts +0 -10
  247. package/components/Fonts/GoogleFont.js +0 -35
  248. package/components/Fonts/GoogleFont.js.map +0 -1
  249. package/components/Fonts/TypekitFont.d.ts +0 -16
  250. package/components/Fonts/TypekitFont.js +0 -25
  251. package/components/Fonts/TypekitFont.js.map +0 -1
  252. package/integrations/addwishSchemaExtension.d.ts +0 -35
  253. package/integrations/addwishSchemaExtension.js +0 -141
  254. package/integrations/addwishSchemaExtension.js.map +0 -1
  255. package/integrations/nostoSchemaExtension.d.ts +0 -5
  256. package/integrations/nostoSchemaExtension.js +0 -77
  257. package/integrations/nostoSchemaExtension.js.map +0 -1
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { primaryFont, secondaryFonts } from './injectFont';
3
- export type GoogleFontProps = {
4
- primaryFont?: primaryFont;
5
- secondaryFonts?: secondaryFonts;
6
- };
7
- export default class GoogleFont extends React.PureComponent<GoogleFontProps, {}> {
8
- componentDidMount: () => void;
9
- render(): null;
10
- }
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- import { injectFont } from './injectFont';
3
- export default class GoogleFont extends React.PureComponent {
4
- constructor() {
5
- super(...arguments);
6
- // Uses Google's CDN to request the desired font
7
- this.componentDidMount = () => {
8
- const { primaryFont = '', secondaryFonts = [] } = this.props;
9
- handleGoogleFonts([primaryFont, ...secondaryFonts]);
10
- injectFont(cleanFontName(primaryFont), secondaryFonts.map(font => cleanFontName(font)));
11
- };
12
- }
13
- render() {
14
- return null;
15
- }
16
- }
17
- function cleanFontName(family) {
18
- // Takes a font formatted as `Source+Sans+Pro:400,600&amp;subset=greek-ext`
19
- // and returns 'Source Sans Pro'
20
- return family
21
- .split('&')[0]
22
- .split(':')[0]
23
- .replace(/\+/gi, ' ');
24
- }
25
- function handleGoogleFonts(families) {
26
- // import external font stylesheet and store it in session storage to optimise
27
- // future loads
28
- // Check for document first as this should not run on the server
29
- document &&
30
- import('store-css').then(module => families.map(family => module.default.css(`https://fonts.googleapis.com/css?family=${family}`, {
31
- crossOrigin: 'anonymous',
32
- storage: 'session'
33
- })));
34
- }
35
- //# sourceMappingURL=GoogleFont.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoogleFont.js","sourceRoot":"","sources":["GoogleFont.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as React from 'react';
2
- import { primaryFont, secondaryFonts } from './injectFont';
3
- type TypekitFontProps = {
4
- primaryFont?: primaryFont;
5
- secondaryFonts?: secondaryFonts;
6
- /**
7
- * The embed code ID given by Adobe.
8
- * @see https://helpx.adobe.com/fonts/using/embed-codes.html
9
- */
10
- id: string;
11
- };
12
- export default class TypekitFont extends React.PureComponent<TypekitFontProps, {}> {
13
- componentDidMount: () => void;
14
- render(): null;
15
- }
16
- export {};
@@ -1,25 +0,0 @@
1
- import * as React from 'react';
2
- import { injectFont } from './injectFont';
3
- function handleTypekitFonts(id) {
4
- // Check for document first as this should not run on the server
5
- document &&
6
- import('store-css').then(module => module.default.css(`https://use.typekit.net/${id}.css`, {
7
- crossOrigin: 'anonymous',
8
- storage: 'session'
9
- }));
10
- }
11
- export default class TypekitFont extends React.PureComponent {
12
- constructor() {
13
- super(...arguments);
14
- // Uses Google's CDN to request the desired font
15
- this.componentDidMount = () => {
16
- const { primaryFont = '', secondaryFonts = [], id } = this.props;
17
- injectFont(primaryFont, secondaryFonts);
18
- handleTypekitFonts(id);
19
- };
20
- }
21
- render() {
22
- return null;
23
- }
24
- }
25
- //# sourceMappingURL=TypekitFont.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypekitFont.js","sourceRoot":"","sources":["TypekitFont.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAA+B,MAAM,cAAc,CAAC;AAYvE,SAAS,kBAAkB,CAAC,EAAU;IACpC,gEAAgE;IAChE,QAAQ;QACN,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAChC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,MAAM,EAAE;YACtD,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,SAAS;SACnB,CAAC,CACH,CAAC;AACN,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK,CAAC,aAG9C;IAHD;;QAIE,gDAAgD;QAChD,sBAAiB,GAAG,GAAG,EAAE;YACvB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,cAAc,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACjE,UAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YACxC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC;IAKJ,CAAC;IAHQ,MAAM;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,35 +0,0 @@
1
- import { SchemaExtension } from './../boot/server/createApolloServer';
2
- export interface AddwishGetRecommendationsResponseBoxItem {
3
- /**
4
- * Article number
5
- * @see https://www.addwish.com/api/v1/product-recommendation/getProductBoxes?ids=5aaf90dc65f8014ff3957e9e%2C5aaf90da65f8014ff3957e91&url=https%3A%2F%2Fwww.scstyling.com&format=json
6
- */
7
- productNumber: string;
8
- url: string;
9
- [key: string]: any;
10
- }
11
- export interface AddwishGetRecommendationsResponseBox {
12
- result?: AddwishGetRecommendationsResponseBoxItem[];
13
- errorCode?: string;
14
- countAfterSource?: string;
15
- }
16
- export interface AddwishGetRecommendationsResponse {
17
- result: {
18
- [key: string]: AddwishGetRecommendationsResponseBox;
19
- };
20
- }
21
- export declare function validateResponseBox({ response, id }: {
22
- response: AddwishGetRecommendationsResponse;
23
- id: string;
24
- }): void;
25
- export declare function fetchAddwishRecommendations({ ids, url }: {
26
- /**
27
- * List of recommendation box IDs. Separate multiple IDs with a comma.
28
- */
29
- ids: string[];
30
- /**
31
- * This url specifies the product you want to find relations for. Note that you can also specify specific urls for each recommendation box.
32
- */
33
- url?: string;
34
- }): Promise<AddwishGetRecommendationsResponse>;
35
- export declare const addwishSchemaExtension: SchemaExtension;
@@ -1,141 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { print } from 'graphql';
11
- import gql from 'graphql-tag';
12
- import fetch from 'node-fetch';
13
- import qs from 'qs';
14
- const typeDefs = gql `
15
- type GetAddwishProductsResponse {
16
- # Addwish Box ID
17
- id: String!
18
- products: [Product!]
19
- errorCode: String
20
- countAfterSource: String
21
- }
22
- extend type Query {
23
- getAddwishProducts(
24
- # Recommendation box ID
25
- id: String!
26
- # This url specifies the product you want to find relations for. Note that you can also specify specific urls for each recommendation box.
27
- url: String
28
- ): GetAddwishProductsResponse!
29
- }
30
- `;
31
- class UnexpectedResponseError extends Error {
32
- constructor(message, { id, response, box }) {
33
- super(message);
34
- console.warn(message, { id, response, box });
35
- }
36
- }
37
- export function validateResponseBox({ response, id }) {
38
- const box = response.result[id];
39
- if (!box) {
40
- throw new UnexpectedResponseError('Box not found in the rsponse.', {
41
- id,
42
- response,
43
- box
44
- });
45
- }
46
- if (box.errorCode) {
47
- throw new UnexpectedResponseError(`Box error: "${box.errorCode}"`, {
48
- id,
49
- response,
50
- box
51
- });
52
- }
53
- if (!Array.isArray(box.result)) {
54
- throw new UnexpectedResponseError("Result property wasn't an array", {
55
- id,
56
- response,
57
- box
58
- });
59
- }
60
- if (box.result.length > 0 &&
61
- typeof box.result[0].productNumber !== 'string') {
62
- throw new UnexpectedResponseError('"productNumber" needs to be a string', {
63
- id,
64
- response,
65
- box
66
- });
67
- }
68
- }
69
- const ADDWISH_GET_PRODUCTBOXES_URL = `https://www.addwish.com/api/v1/product-recommendation/getProductBoxes`;
70
- export function fetchAddwishRecommendations({ ids, url }) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- const addwishUrl = `${ADDWISH_GET_PRODUCTBOXES_URL}?${qs.stringify({
73
- format: 'json',
74
- url,
75
- ids: ids.join(',')
76
- })}`;
77
- return fetch(addwishUrl).then(res => res.json());
78
- });
79
- }
80
- export const addwishSchemaExtension = ({ remoteSchema }) => {
81
- const resolvers = {
82
- Query: {
83
- getAddwishProducts: {
84
- resolve(_source, { id, url }) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- // Don't fail the whole API response because Addwish is down etc
87
- try {
88
- // Could be refactored to use DataLoader
89
- const response = yield fetchAddwishRecommendations({
90
- ids: [id],
91
- url
92
- });
93
- validateResponseBox({ response, id });
94
- const box = response.result[id];
95
- return {
96
- id,
97
- box,
98
- errorCode: null,
99
- countAfterSource: box.countAfterSource
100
- };
101
- }
102
- catch (err) {
103
- return {
104
- id,
105
- errorCode: err.message || 'Something went wrong',
106
- box: null
107
- };
108
- }
109
- });
110
- }
111
- }
112
- },
113
- GetAddwishProductsResponse: {
114
- products: {
115
- resolve({ box }, _args, context, info) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- if (!box) {
118
- return null;
119
- }
120
- if (box.result.length <= 0) {
121
- return [];
122
- }
123
- const articleNumbers = box.result.map(item => item.productNumber);
124
- return info.mergeInfo.delegateToSchema({
125
- schema: remoteSchema,
126
- operation: 'query',
127
- fieldName: 'products',
128
- args: {
129
- articleNumbers
130
- },
131
- context,
132
- info
133
- });
134
- });
135
- }
136
- }
137
- }
138
- };
139
- return { schema: print(typeDefs), resolvers };
140
- };
141
- //# sourceMappingURL=addwishSchemaExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addwishSchemaExtension.js","sourceRoot":"","sources":["addwishSchemaExtension.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI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,KAAK,EACL,OAAO,EACP,IAAI;;wBAEJ,IAAI,CAAC,GAAG,EAAE;4BACR,OAAO,IAAI,CAAC;yBACb;wBAED,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;4BAC1B,OAAO,EAAE,CAAC;yBACX;wBAED,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;wBAElE,OAAO,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;4BACrC,MAAM,EAAE,YAAY;4BACpB,SAAS,EAAE,OAAO;4BAClB,SAAS,EAAE,UAAU;4BACrB,IAAI,EAAE;gCACJ,cAAc;6BACf;4BACD,OAAO;4BACP,IAAI;yBACL,CAAC,CAAC;oBACL,CAAC;iBAAA;aACF;SACF;KACF,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { SchemaExtension } from '../boot/server/createApolloServer';
2
- export declare const createNostoSchemaExtension: ({ nostoApiToken }: {
3
- nostoApiToken: string;
4
- }) => SchemaExtension;
5
- export declare const getNostoSchemaLinkTypeDefs: SchemaExtension;
@@ -1,77 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { setContext } from 'apollo-link-context';
11
- import fetch from 'node-fetch';
12
- import { introspectSchema, makeRemoteExecutableSchema, transformSchema, RenameTypes, RenameRootFields } from 'graphql-tools';
13
- import { HttpLink } from 'apollo-link-http';
14
- function getNostoSchema({ nostoApiToken }) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const http = new HttpLink({
17
- uri: `https://api.nosto.com/v1/graphql`,
18
- fetch: fetch
19
- });
20
- // on introspect, get headers from conf/env
21
- const introspectLink = setContext(() => ({
22
- headers: {
23
- Authorization: `Basic ${Buffer.from(`:${nostoApiToken}`).toString('base64')}`
24
- }
25
- })).concat(http);
26
- // We could do this build-time to speed up start
27
- const schema = yield introspectSchema(introspectLink);
28
- const executableSchema = makeRemoteExecutableSchema({
29
- schema,
30
- link: introspectLink
31
- });
32
- const transformedNostoSchema = transformSchema(executableSchema, [
33
- new RenameTypes((name) => `Nosto${name}`),
34
- new RenameRootFields((_operation, name) => `nosto${name.substring(0, 1).toUpperCase()}${name.substring(1)}`)
35
- ]);
36
- return transformedNostoSchema;
37
- });
38
- }
39
- export const createNostoSchemaExtension = ({ nostoApiToken }) => {
40
- const nostoSchemaExtension = ({ remoteSchema }) => __awaiter(void 0, void 0, void 0, function* () {
41
- const schema = yield getNostoSchema({ nostoApiToken });
42
- const resolvers = {
43
- NostoRecommendedProduct: {
44
- product: {
45
- fragment: `... on RecommendedProduct { productId }`,
46
- resolve(recommendedProduct, _args, context, info) {
47
- return info.mergeInfo.delegateToSchema({
48
- schema: remoteSchema,
49
- operation: 'query',
50
- fieldName: 'product',
51
- args: {
52
- id: parseInt(recommendedProduct.productId)
53
- },
54
- context,
55
- info
56
- });
57
- }
58
- }
59
- }
60
- };
61
- return {
62
- schema,
63
- resolvers
64
- };
65
- });
66
- return nostoSchemaExtension;
67
- };
68
- export const getNostoSchemaLinkTypeDefs = () => {
69
- return {
70
- schema: `
71
- extend type NostoRecommendedProduct {
72
- product: Product
73
- }
74
- `
75
- };
76
- };
77
- //# sourceMappingURL=nostoSchemaExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nostoS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