@salesforce/commerce-sdk-react 1.0.0-preview.1 → 1.0.0-preview.2

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 (40) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/auth/index.d.ts +4 -4
  3. package/auth/storage.d.ts +1 -1
  4. package/components/ShopperExperience/Component/index.d.ts +1 -1
  5. package/components/ShopperExperience/Page/index.d.ts +2 -2
  6. package/components/ShopperExperience/types.d.ts +5 -5
  7. package/hooks/ShopperBaskets/cache.d.ts +1 -1
  8. package/hooks/ShopperBaskets/mutation.d.ts +2 -2
  9. package/hooks/ShopperBaskets/query.d.ts +1 -1
  10. package/hooks/ShopperBaskets/queryKeyHelpers.d.ts +4 -4
  11. package/hooks/ShopperContexts/cache.d.ts +1 -1
  12. package/hooks/ShopperContexts/mutation.d.ts +2 -2
  13. package/hooks/ShopperContexts/query.d.ts +1 -1
  14. package/hooks/ShopperContexts/queryKeyHelpers.d.ts +4 -4
  15. package/hooks/ShopperCustomers/cache.d.ts +1 -1
  16. package/hooks/ShopperCustomers/mutation.d.ts +2 -2
  17. package/hooks/ShopperCustomers/query.d.ts +1 -1
  18. package/hooks/ShopperCustomers/queryKeyHelpers.d.ts +4 -4
  19. package/hooks/ShopperExperience/query.d.ts +1 -1
  20. package/hooks/ShopperExperience/queryKeyHelpers.d.ts +4 -4
  21. package/hooks/ShopperGiftCertificates/query.d.ts +1 -1
  22. package/hooks/ShopperGiftCertificates/queryKeyHelpers.d.ts +4 -4
  23. package/hooks/ShopperLogin/mutation.d.ts +2 -2
  24. package/hooks/ShopperLogin/query.d.ts +1 -1
  25. package/hooks/ShopperLogin/queryKeyHelpers.d.ts +4 -4
  26. package/hooks/ShopperOrders/cache.d.ts +1 -1
  27. package/hooks/ShopperOrders/mutation.d.ts +2 -2
  28. package/hooks/ShopperOrders/query.d.ts +1 -1
  29. package/hooks/ShopperOrders/queryKeyHelpers.d.ts +4 -4
  30. package/hooks/ShopperProducts/query.d.ts +1 -1
  31. package/hooks/ShopperProducts/queryKeyHelpers.d.ts +4 -4
  32. package/hooks/ShopperPromotions/query.d.ts +1 -1
  33. package/hooks/ShopperPromotions/queryKeyHelpers.d.ts +4 -4
  34. package/hooks/ShopperSearch/query.d.ts +1 -1
  35. package/hooks/ShopperSearch/queryKeyHelpers.d.ts +4 -4
  36. package/hooks/types.d.ts +27 -27
  37. package/hooks/useAuthHelper.d.ts +1 -1
  38. package/hooks/useCustomerType.d.ts +2 -2
  39. package/hooks/useLocalStorage.d.ts +1 -1
  40. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
+ ## v1.0.0-preview.2 (Jun 05, 2023)
1
2
  ## v1.0.0-preview.1 (Jun 02, 2023)
2
3
  ## v1.0.0-preview.0 (May 31, 2023)
3
4
  ## v1.0.0-dev (May 29, 2023)
package/auth/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { helpers, ShopperLoginTypes, ShopperCustomersTypes } from 'commerce-sdk-isomorphic';
2
2
  import { ApiClientConfigParams, Prettify, RemoveStringIndex } from '../hooks/types';
3
3
  import { CustomerType } from '../hooks/useCustomerType';
4
- declare type TokenResponse = ShopperLoginTypes.TokenResponse;
5
- declare type Helpers = typeof helpers;
4
+ type TokenResponse = ShopperLoginTypes.TokenResponse;
5
+ type Helpers = typeof helpers;
6
6
  interface AuthConfig extends ApiClientConfigParams {
7
7
  redirectURI: string;
8
8
  proxy: string;
@@ -16,12 +16,12 @@ interface AuthConfig extends ApiClientConfigParams {
16
16
  * Plus, the getCustomer endpoint only works for registered user, it returns a 404 for a guest user,
17
17
  * and it's not easy to grab this info in user land, so we add it into the Auth object, and expose it via a hook
18
18
  */
19
- export declare type AuthData = Prettify<RemoveStringIndex<TokenResponse> & {
19
+ export type AuthData = Prettify<RemoveStringIndex<TokenResponse> & {
20
20
  customer_type: CustomerType;
21
21
  idp_access_token: string;
22
22
  }>;
23
23
  /** A shopper could be guest or registered, so we store the refresh tokens individually. */
24
- declare type AuthDataKeys = Exclude<keyof AuthData, 'refresh_token'> | 'refresh_token_guest' | 'refresh_token_registered' | 'refresh_token_guest_copy' | 'refresh_token_registered_copy';
24
+ type AuthDataKeys = Exclude<keyof AuthData, 'refresh_token'> | 'refresh_token_guest' | 'refresh_token_registered' | 'refresh_token_guest_copy' | 'refresh_token_registered_copy';
25
25
  /**
26
26
  * This class is used to handle shopper authentication.
27
27
  * It is responsible for initializing shopper session, manage access
package/auth/storage.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Cookies from 'js-cookie';
2
- export declare type StorageType = 'cookie' | 'local' | 'memory';
2
+ export type StorageType = 'cookie' | 'local' | 'memory';
3
3
  export interface BaseStorageOptions {
4
4
  keySuffix?: string;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { Component as ComponentType } from '../types';
2
- declare type ComponentProps = {
2
+ type ComponentProps = {
3
3
  component: ComponentType;
4
4
  };
5
5
  /**
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { Component as ComponentType, Page as PageType } from '../types';
3
- declare type ComponentMap = {
3
+ type ComponentMap = {
4
4
  [typeId: string]: React.ComponentType<ComponentType & unknown>;
5
5
  };
6
6
  interface PageProps extends React.ComponentProps<'div'> {
7
7
  page: PageType;
8
8
  components: ComponentMap;
9
9
  }
10
- declare type PageContextValue = {
10
+ type PageContextValue = {
11
11
  components: ComponentMap;
12
12
  };
13
13
  export declare const PageContext: React.Context<PageContextValue | undefined>;
@@ -1,8 +1,8 @@
1
1
  import { ApiClients, DataType } from '../../hooks/types';
2
- declare type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType[number];
3
- declare type Client = ApiClients['shopperExperience'];
4
- export declare type Page = DataType<Client['getPage']>;
5
- export declare type Region = ArrayElement<NonNullable<Page['regions']>>;
6
- export declare type Component = ArrayElement<NonNullable<Region['components']>>;
2
+ type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType[number];
3
+ type Client = ApiClients['shopperExperience'];
4
+ export type Page = DataType<Client['getPage']>;
5
+ export type Region = ArrayElement<NonNullable<Page['regions']>>;
6
+ export type Component = ArrayElement<NonNullable<Region['components']>>;
7
7
  export {};
8
8
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { ApiClients, CacheUpdateMatrix } from '../types';
2
- declare type Client = ApiClients['shopperBaskets'];
2
+ type Client = ApiClients['shopperBaskets'];
3
3
  export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
4
4
  export {};
5
5
  //# sourceMappingURL=cache.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ApiClients, Argument, DataType } from '../types';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- declare type Client = ApiClients['shopperBaskets'];
3
+ type Client = ApiClients['shopperBaskets'];
4
4
  /**
5
5
  * Mutations available for Shopper Baskets.
6
6
  * @group ShopperBaskets
@@ -151,7 +151,7 @@ export declare const ShopperBasketsMutations: {
151
151
  * @group ShopperBaskets
152
152
  * @category Mutation
153
153
  */
154
- export declare type ShopperBasketsMutation = (typeof ShopperBasketsMutations)[keyof typeof ShopperBasketsMutations];
154
+ export type ShopperBasketsMutation = (typeof ShopperBasketsMutations)[keyof typeof ShopperBasketsMutations];
155
155
  /**
156
156
  * Mutation hook for Shopper Baskets.
157
157
  * @group ShopperBaskets
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperBaskets'];
3
+ type Client = ApiClients['shopperBaskets'];
4
4
  /**
5
5
  * Gets a basket.
6
6
  * @group ShopperBaskets
@@ -1,10 +1,10 @@
1
1
  import type { ShopperBaskets } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperBaskets<{
3
+ type Client = ShopperBaskets<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getBasket: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -52,7 +52,7 @@ export declare type QueryKeys = {
52
52
  Params<'getTaxesFromBasket'>
53
53
  ];
54
54
  };
55
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
55
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
56
56
  /**
57
57
  * Reduces the given parameters (which may have additional, unknown properties) to an object
58
58
  * containing *only* the properties required for an endpoint.
@@ -1,5 +1,5 @@
1
1
  import { ApiClients, CacheUpdateMatrix } from '../types';
2
- declare type Client = ApiClients['shopperContexts'];
2
+ type Client = ApiClients['shopperContexts'];
3
3
  export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
4
4
  export {};
5
5
  //# sourceMappingURL=cache.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ApiClients, Argument, DataType } from '../types';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- declare type Client = ApiClients['shopperContexts'];
3
+ type Client = ApiClients['shopperContexts'];
4
4
  /**
5
5
  * Mutation for Shopper Contexts.
6
6
  * @group ShopperContexts
@@ -29,7 +29,7 @@ export declare const ShopperContextsMutations: {
29
29
  * @group ShopperContexts
30
30
  * @category Mutation
31
31
  */
32
- export declare type ShopperContextsMutation = (typeof ShopperContextsMutations)[keyof typeof ShopperContextsMutations];
32
+ export type ShopperContextsMutation = (typeof ShopperContextsMutations)[keyof typeof ShopperContextsMutations];
33
33
  /**
34
34
  * Mutation hook for Shopper Contexts.
35
35
  * @group ShopperContexts
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperContexts'];
3
+ type Client = ApiClients['shopperContexts'];
4
4
  /**
5
5
  * Gets the shopper's context based on the shopperJWT.
6
6
  * @group ShopperContexts
@@ -1,10 +1,10 @@
1
1
  import type { ShopperContexts } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperContexts<{
3
+ type Client = ShopperContexts<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getShopperContext: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -14,7 +14,7 @@ export declare type QueryKeys = {
14
14
  Params<'getShopperContext'>
15
15
  ];
16
16
  };
17
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
17
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
18
18
  /**
19
19
  * Reduces the given parameters (which may have additional, unknown properties) to an object
20
20
  * containing *only* the properties required for an endpoint.
@@ -1,5 +1,5 @@
1
1
  import { ApiClients, CacheUpdateMatrix } from '../types';
2
- declare type Client = ApiClients['shopperCustomers'];
2
+ type Client = ApiClients['shopperCustomers'];
3
3
  export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
4
4
  export {};
5
5
  //# sourceMappingURL=cache.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ApiClients, Argument, DataType } from '../types';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- declare type Client = ApiClients['shopperCustomers'];
3
+ type Client = ApiClients['shopperCustomers'];
4
4
  /**
5
5
  * Mutations available for Shopper Customers.
6
6
  * @group ShopperCustomers
@@ -92,7 +92,7 @@ export declare const ShopperCustomersMutations: {
92
92
  * @group ShopperCustomers
93
93
  * @category Mutation
94
94
  */
95
- export declare type ShopperCustomersMutation = (typeof ShopperCustomersMutations)[keyof typeof ShopperCustomersMutations];
95
+ export type ShopperCustomersMutation = (typeof ShopperCustomersMutations)[keyof typeof ShopperCustomersMutations];
96
96
  /**
97
97
  * Mutation hook for Shopper Customers.
98
98
  * @group ShopperCustomers
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperCustomers'];
3
+ type Client = ApiClients['shopperCustomers'];
4
4
  /**
5
5
  * Gets a customer's information.
6
6
  *
@@ -1,10 +1,10 @@
1
1
  import type { ShopperCustomers } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperCustomers<{
3
+ type Client = ShopperCustomers<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getExternalProfile: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -115,7 +115,7 @@ export declare type QueryKeys = {
115
115
  Params<'getProductListItem'>
116
116
  ];
117
117
  };
118
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
118
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
119
119
  /**
120
120
  * Reduces the given parameters (which may have additional, unknown properties) to an object
121
121
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperExperience'];
3
+ type Client = ApiClients['shopperExperience'];
4
4
  /**
5
5
  * Get Page Designer pages.
6
6
  *
@@ -1,10 +1,10 @@
1
1
  import type { ShopperExperience } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperExperience<{
3
+ type Client = ShopperExperience<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getPages: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -21,7 +21,7 @@ export declare type QueryKeys = {
21
21
  Params<'getPage'>
22
22
  ];
23
23
  };
24
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
24
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
25
25
  /**
26
26
  * Reduces the given parameters (which may have additional, unknown properties) to an object
27
27
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperGiftCertificates'];
3
+ type Client = ApiClients['shopperGiftCertificates'];
4
4
  /**
5
5
  * Action to retrieve an existing gift certificate.
6
6
  * @group ShopperGiftCertificates
@@ -1,10 +1,10 @@
1
1
  import type { ShopperGiftCertificates } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperGiftCertificates<{
3
+ type Client = ShopperGiftCertificates<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getGiftCertificate: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -13,7 +13,7 @@ export declare type QueryKeys = {
13
13
  Params<'getGiftCertificate'>
14
14
  ];
15
15
  };
16
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
16
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
17
17
  /**
18
18
  * Reduces the given parameters (which may have additional, unknown properties) to an object
19
19
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { ApiClients, Argument, DataType } from '../types';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- declare type Client = ApiClients['shopperLogin'];
3
+ type Client = ApiClients['shopperLogin'];
4
4
  /**
5
5
  * Mutations available for Shopper Login
6
6
  * @group ShopperLogin
@@ -80,7 +80,7 @@ The value of the `_sfdc_client_auth` header must be a Base64-encoded string. The
80
80
  * @group ShopperLogin
81
81
  * @category Mutation
82
82
  */
83
- export declare type ShopperLoginMutation = (typeof ShopperLoginMutations)[keyof typeof ShopperLoginMutations];
83
+ export type ShopperLoginMutation = (typeof ShopperLoginMutations)[keyof typeof ShopperLoginMutations];
84
84
  /**
85
85
  * Mutation hook for Shopper Login.
86
86
  * @group ShopperLogin
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperLogin'];
3
+ type Client = ApiClients['shopperLogin'];
4
4
  /**
5
5
  * Get credential quality statistics for a user.
6
6
  * @group ShopperLogin
@@ -1,10 +1,10 @@
1
1
  import type { ShopperLogin } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperLogin<{
3
+ type Client = ShopperLogin<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  retrieveCredQualityUserInfo: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -34,7 +34,7 @@ export declare type QueryKeys = {
34
34
  Params<'getJwksUri'>
35
35
  ];
36
36
  };
37
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
37
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
38
38
  /**
39
39
  * Reduces the given parameters (which may have additional, unknown properties) to an object
40
40
  * containing *only* the properties required for an endpoint.
@@ -1,5 +1,5 @@
1
1
  import { ApiClients, CacheUpdateMatrix } from '../types';
2
- declare type Client = ApiClients['shopperOrders'];
2
+ type Client = ApiClients['shopperOrders'];
3
3
  export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
4
4
  export {};
5
5
  //# sourceMappingURL=cache.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ApiClients, Argument, DataType } from '../types';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- declare type Client = ApiClients['shopperOrders'];
3
+ type Client = ApiClients['shopperOrders'];
4
4
  /**
5
5
  * Mutations available for Shopper Orders
6
6
  * @group ShopperOrders
@@ -39,7 +39,7 @@ The payment instrument is added with the provided details. The payment method mu
39
39
  * @group ShopperOrders
40
40
  * @category Mutation
41
41
  */
42
- export declare type ShopperOrdersMutation = (typeof ShopperOrdersMutations)[keyof typeof ShopperOrdersMutations];
42
+ export type ShopperOrdersMutation = (typeof ShopperOrdersMutations)[keyof typeof ShopperOrdersMutations];
43
43
  /**
44
44
  * Mutation hook for Shopper Orders.
45
45
  * @group ShopperOrders
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperOrders'];
3
+ type Client = ApiClients['shopperOrders'];
4
4
  /**
5
5
  * Gets information for an order.
6
6
  * @group ShopperOrders
@@ -1,10 +1,10 @@
1
1
  import type { ShopperOrders } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperOrders<{
3
+ type Client = ShopperOrders<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getOrder: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -32,7 +32,7 @@ export declare type QueryKeys = {
32
32
  Params<'getTaxesFromOrder'>
33
33
  ];
34
34
  };
35
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
35
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
36
36
  /**
37
37
  * Reduces the given parameters (which may have additional, unknown properties) to an object
38
38
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperProducts'];
3
+ type Client = ApiClients['shopperProducts'];
4
4
  /**
5
5
  * Allows access to multiple products by a single request. Only products that are online and assigned to a site catalog are returned. The maximum number of productIDs that can be requested are 24. Along with product details, the availability, product options, images, price, promotions, and variations for the valid products will be included, as appropriate.
6
6
  * @group ShopperProducts
@@ -1,10 +1,10 @@
1
1
  import type { ShopperProducts } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperProducts<{
3
+ type Client = ShopperProducts<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getProducts: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -36,7 +36,7 @@ export declare type QueryKeys = {
36
36
  Params<'getCategory'>
37
37
  ];
38
38
  };
39
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
39
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
40
40
  /**
41
41
  * Reduces the given parameters (which may have additional, unknown properties) to an object
42
42
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperPromotions'];
3
+ type Client = ApiClients['shopperPromotions'];
4
4
  /**
5
5
  * Returns an array of enabled promotions for a list of specified IDs. In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
6
6
  * @group ShopperPromotions
@@ -1,10 +1,10 @@
1
1
  import type { ShopperPromotions } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperPromotions<{
3
+ type Client = ShopperPromotions<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  getPromotions: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -21,7 +21,7 @@ export declare type QueryKeys = {
21
21
  Params<'getPromotionsForCampaign'>
22
22
  ];
23
23
  };
24
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
24
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
25
25
  /**
26
26
  * Reduces the given parameters (which may have additional, unknown properties) to an object
27
27
  * containing *only* the properties required for an endpoint.
@@ -1,6 +1,6 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
3
- declare type Client = ApiClients['shopperSearch'];
3
+ type Client = ApiClients['shopperSearch'];
4
4
  /**
5
5
  * Provides keyword and refinement search functionality for products.
6
6
  *
@@ -1,10 +1,10 @@
1
1
  import type { ShopperSearch } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- declare type Client = ShopperSearch<{
3
+ type Client = ShopperSearch<{
4
4
  shortCode: string;
5
5
  }>;
6
- declare type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
- export declare type QueryKeys = {
6
+ type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
7
+ export type QueryKeys = {
8
8
  productSearch: [
9
9
  '/commerce-sdk-react',
10
10
  '/organizations/',
@@ -20,7 +20,7 @@ export declare type QueryKeys = {
20
20
  Params<'getSearchSuggestions'>
21
21
  ];
22
22
  };
23
- declare type QueryKeyHelper<T extends keyof QueryKeys> = {
23
+ type QueryKeyHelper<T extends keyof QueryKeys> = {
24
24
  /**
25
25
  * Reduces the given parameters (which may have additional, unknown properties) to an object
26
26
  * containing *only* the properties required for an endpoint.
package/hooks/types.d.ts CHANGED
@@ -1,39 +1,39 @@
1
1
  import { InvalidateQueryFilters, QueryFilters, Updater, UseQueryOptions } from '@tanstack/react-query';
2
2
  import { ShopperBaskets, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperLogin, ShopperOrders, ShopperProducts, ShopperPromotions, ShopperSearch } from 'commerce-sdk-isomorphic';
3
3
  /** Makes a type easier to read. */
4
- export declare type Prettify<T extends object> = NonNullable<Pick<T, keyof T>>;
4
+ export type Prettify<T extends object> = NonNullable<Pick<T, keyof T>>;
5
5
  /**
6
6
  * Marks the given keys as required.
7
7
  * WARNING: Does not work if T has an index signature.
8
8
  */
9
- export declare type RequireKeys<T, K extends keyof T> = Prettify<T & Required<Pick<T, K>>>;
9
+ export type RequireKeys<T, K extends keyof T> = Prettify<T & Required<Pick<T, K>>>;
10
10
  /** Removes keys whose value is `never`. */
11
- declare type RemoveNeverValues<T> = {
11
+ type RemoveNeverValues<T> = {
12
12
  [K in keyof T as T[K] extends never ? never : K]: T[K];
13
13
  };
14
14
  /** Change string index type to `never`. */
15
- declare type StringIndexToNever<T> = {
15
+ type StringIndexToNever<T> = {
16
16
  [K in keyof T]: string extends K ? never : T[K];
17
17
  };
18
18
  /** Removes a string index type. */
19
- export declare type RemoveStringIndex<T> = RemoveNeverValues<StringIndexToNever<T>>;
19
+ export type RemoveStringIndex<T> = RemoveNeverValues<StringIndexToNever<T>>;
20
20
  /** Gets the last element of an array. */
21
- export declare type Tail<T extends readonly unknown[]> = T extends [...head: unknown[], tail: infer Tail] ? Tail : T;
21
+ export type Tail<T extends readonly unknown[]> = T extends [...head: unknown[], tail: infer Tail] ? Tail : T;
22
22
  /** Remove the last entry from a tuple type. */
23
- export declare type ExcludeTail<T extends readonly unknown[]> = T extends readonly [...infer Head, unknown] ? T extends unknown[] ? Head : Readonly<Head> : T;
23
+ export type ExcludeTail<T extends readonly unknown[]> = T extends readonly [...infer Head, unknown] ? T extends unknown[] ? Head : Readonly<Head> : T;
24
24
  /** Adds `null` as an allowed value to all properties. */
25
- declare type AllowNull<T> = {
25
+ type AllowNull<T> = {
26
26
  [K in keyof T]: T[K] | null;
27
27
  };
28
28
  /** Gets the keys of `T` which allow `null` as a possible value. */
29
- declare type NullKeys<T> = {
29
+ type NullKeys<T> = {
30
30
  [K in keyof T]-?: null extends T[K] ? K : never;
31
31
  }[keyof T];
32
32
  /** Removes `null` values and marks those properties as optional. */
33
- export declare type NullToOptional<T> = Omit<T, NullKeys<T>> & {
33
+ export type NullToOptional<T> = Omit<T, NullKeys<T>> & {
34
34
  [K in keyof T]?: NonNullable<T[K]>;
35
35
  };
36
- export declare type ApiClientConfigParams = {
36
+ export type ApiClientConfigParams = {
37
37
  clientId: string;
38
38
  organizationId: string;
39
39
  siteId: string;
@@ -56,11 +56,11 @@ export interface ApiClients {
56
56
  shopperPromotions: ShopperPromotions<ApiClientConfigParams>;
57
57
  shopperSearch: ShopperSearch<ApiClientConfigParams>;
58
58
  }
59
- export declare type ApiClient = ApiClients[keyof ApiClients];
59
+ export type ApiClient = ApiClients[keyof ApiClients];
60
60
  /**
61
61
  * Generic signature of the options objects used by commerce-sdk-isomorphic
62
62
  */
63
- export declare type ApiOptions<Parameters extends object = Record<string, unknown>, Body extends object | unknown[] | undefined = Record<string, unknown> | unknown[] | undefined, Headers extends Record<string, string> = Record<string, string>> = {
63
+ export type ApiOptions<Parameters extends object = Record<string, unknown>, Body extends object | unknown[] | undefined = Record<string, unknown> | unknown[] | undefined, Headers extends Record<string, string> = Record<string, string>> = {
64
64
  parameters?: Parameters;
65
65
  headers?: Headers;
66
66
  body?: Body;
@@ -68,35 +68,35 @@ export declare type ApiOptions<Parameters extends object = Record<string, unknow
68
68
  /**
69
69
  * Generic signature of API methods exported by commerce-sdk-isomorphic
70
70
  */
71
- export declare type ApiMethod<Options extends ApiOptions, Data> = {
71
+ export type ApiMethod<Options extends ApiOptions, Data> = {
72
72
  (options: Options): Promise<Data>;
73
73
  };
74
74
  /**
75
75
  * The first argument of a function.
76
76
  */
77
- export declare type Argument<T extends (arg: any) => unknown> = NonNullable<Parameters<T>[0]>;
77
+ export type Argument<T extends (arg: any) => unknown> = NonNullable<Parameters<T>[0]>;
78
78
  /**
79
79
  * The data type returned by a commerce-sdk-isomorphic method when the raw response
80
80
  * flag is not set.
81
81
  */
82
- export declare type DataType<T> = T extends ApiMethod<any, Response | infer R> ? R : never;
82
+ export type DataType<T> = T extends ApiMethod<any, Response | infer R> ? R : never;
83
83
  /**
84
84
  * Merged headers and parameters from client config and options, mimicking the behavior
85
85
  * of commerce-sdk-isomorphic.
86
86
  */
87
- export declare type MergedOptions<Client extends ApiClient, Options extends ApiOptions> = Required<ApiOptions<NonNullable<Client['clientConfig']['parameters'] & Options['parameters']>, unknown extends Options['body'] ? never : Options['body'], NonNullable<Client['clientConfig']['headers'] & Options['headers']>>>;
87
+ export type MergedOptions<Client extends ApiClient, Options extends ApiOptions> = Required<ApiOptions<NonNullable<Client['clientConfig']['parameters'] & Options['parameters']>, unknown extends Options['body'] ? never : Options['body'], NonNullable<Client['clientConfig']['headers'] & Options['headers']>>>;
88
88
  /** Query key interface used by API query hooks. */
89
- export declare type ApiQueryKey<Params extends Record<string, unknown> = Record<string, unknown>> = readonly [...path: (string | undefined)[], parameters: Params];
89
+ export type ApiQueryKey<Params extends Record<string, unknown> = Record<string, unknown>> = readonly [...path: (string | undefined)[], parameters: Params];
90
90
  /** Query options for endpoint hooks. */
91
- export declare type ApiQueryOptions<Method extends ApiMethod<any, unknown>> = Prettify<Omit<UseQueryOptions<DataType<Method>, unknown, DataType<Method>, ApiQueryKey>, 'queryFn' | 'queryKey'>>;
91
+ export type ApiQueryOptions<Method extends ApiMethod<any, unknown>> = Prettify<Omit<UseQueryOptions<DataType<Method>, unknown, DataType<Method>, ApiQueryKey>, 'queryFn' | 'queryKey'>>;
92
92
  /** Adds `null` as an allowed value to all parameters. */
93
- export declare type NullableParameters<T extends {
93
+ export type NullableParameters<T extends {
94
94
  parameters?: object;
95
95
  }> = {
96
96
  [K in keyof T]: K extends 'parameters' ? AllowNull<T[K]> : T[K];
97
97
  };
98
98
  /** Remove `null` and `undefined` values from all parameters. */
99
- export declare type OmitNullableParameters<T extends {
99
+ export type OmitNullableParameters<T extends {
100
100
  parameters: object;
101
101
  }> = Omit<T, 'parameters'> & {
102
102
  parameters: NullToOptional<T['parameters']>;
@@ -106,25 +106,25 @@ export declare type OmitNullableParameters<T extends {
106
106
  * @property queryKey - The query key to update
107
107
  * @property updater - Either the new data or a function that accepts old data and returns new data
108
108
  */
109
- export declare type CacheUpdateUpdate<T> = {
109
+ export type CacheUpdateUpdate<T> = {
110
110
  queryKey: ApiQueryKey;
111
111
  updater?: Updater<T | undefined, T | undefined>;
112
112
  };
113
113
  /** Query predicate for queries to invalidate */
114
- export declare type CacheUpdateInvalidate = InvalidateQueryFilters;
114
+ export type CacheUpdateInvalidate = InvalidateQueryFilters;
115
115
  /** Query predicate for queries to remove */
116
- export declare type CacheUpdateRemove = QueryFilters;
116
+ export type CacheUpdateRemove = QueryFilters;
117
117
  /** Collection of updates to make to the cache when a request completes. */
118
- export declare type CacheUpdate = {
118
+ export type CacheUpdate = {
119
119
  update?: CacheUpdateUpdate<unknown>[];
120
120
  invalidate?: CacheUpdateInvalidate[];
121
121
  remove?: CacheUpdateRemove[];
122
122
  clear?: boolean;
123
123
  };
124
124
  /** Generates a collection of cache updates to make for a given request. */
125
- export declare type CacheUpdateGetter<Options, Data> = (customerId: string | null, options: Options, response: Data) => CacheUpdate;
125
+ export type CacheUpdateGetter<Options, Data> = (customerId: string | null, options: Options, response: Data) => CacheUpdate;
126
126
  /** Collection of cache update getters for each method of an API client. */
127
- export declare type CacheUpdateMatrix<Client extends ApiClient> = {
127
+ export type CacheUpdateMatrix<Client extends ApiClient> = {
128
128
  [Method in keyof Client]?: Client[Method] extends ApiMethod<any, Response | infer Data> ? CacheUpdateGetter<MergedOptions<Client, Argument<Client[Method]>>, Data> : never;
129
129
  };
130
130
  export {};
@@ -16,7 +16,7 @@ export declare const AuthHelpers: {
16
16
  * @category Shopper Authentication
17
17
  *
18
18
  */
19
- export declare type AuthHelper = (typeof AuthHelpers)[keyof typeof AuthHelpers];
19
+ export type AuthHelper = (typeof AuthHelpers)[keyof typeof AuthHelpers];
20
20
  /**
21
21
  * A hook for Public Client OAuth helpers.
22
22
  *
@@ -1,5 +1,5 @@
1
- export declare type CustomerType = null | 'guest' | 'registered';
2
- declare type useCustomerType = {
1
+ export type CustomerType = null | 'guest' | 'registered';
2
+ type useCustomerType = {
3
3
  customerType: CustomerType;
4
4
  isGuest: boolean;
5
5
  isRegistered: boolean;
@@ -1,4 +1,4 @@
1
- declare type Value = string | null;
1
+ type Value = string | null;
2
2
  /**
3
3
  * @internal
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/commerce-sdk-react",
3
- "version": "1.0.0-preview.1",
3
+ "version": "1.0.0-preview.2",
4
4
  "description": "A library that provides react hooks for fetching data from Commerce Cloud",
5
5
  "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
6
6
  "bugs": {
@@ -47,20 +47,20 @@
47
47
  "typedoc-plugin-missing-exports": "^2.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@salesforce/pwa-kit-dev": "3.0.0-preview.1",
50
+ "@salesforce/pwa-kit-dev": "3.0.0-preview.2",
51
51
  "@tanstack/react-query": "^4.28.0",
52
52
  "@testing-library/jest-dom": "^5.16.5",
53
53
  "@testing-library/react": "^14.0.0",
54
54
  "@types/js-cookie": "^3.0.3",
55
- "@types/jsonwebtoken": "^8.5.9",
55
+ "@types/jsonwebtoken": "^9.0.0",
56
56
  "@types/jwt-decode": "^3.1.0",
57
57
  "@types/node": "^14.18.40",
58
58
  "@types/react": "^18.2.0",
59
59
  "@types/react-dom": "^18.2.1",
60
60
  "@types/react-helmet": "^6.1.6",
61
61
  "cross-env": "^5.2.1",
62
- "internal-lib-build": "3.0.0-preview.1",
63
- "jsonwebtoken": "^8.5.1",
62
+ "internal-lib-build": "3.0.0-preview.2",
63
+ "jsonwebtoken": "^9.0.0",
64
64
  "nock": "^13.3.0",
65
65
  "nodemon": "^2.0.22",
66
66
  "react": "^18.2.0",
@@ -68,13 +68,13 @@
68
68
  "react-helmet": "^6.1.0",
69
69
  "semver": "^7.3.8",
70
70
  "shelljs": "^0.8.5",
71
- "typedoc": "^0.23.28",
72
- "typescript": "4.8.3"
71
+ "typedoc": "^0.24.7",
72
+ "typescript": "^4.8.3"
73
73
  },
74
74
  "peerDependencies": {
75
- "@tanstack/react-query": "^4",
76
- "react": "^18",
77
- "react-helmet": "6"
75
+ "@tanstack/react-query": "^4.28.0",
76
+ "react": "^18.2.0",
77
+ "react-helmet": "^6.1.0"
78
78
  },
79
79
  "optionalDependencies": {
80
80
  "prop-types": "^15.8.1"
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "directory": "dist"
88
88
  },
89
- "gitHead": "457b0179e4cf536e55bf9b21758302ff68ef3ea4"
89
+ "gitHead": "a2476c090ce48fd09e9116437aedc6cc45ae60bd"
90
90
  }