@salesforce/commerce-sdk-react 1.0.0-preview.0 → 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.
- package/CHANGELOG.md +2 -0
- package/README.md +4 -0
- package/auth/index.d.ts +19 -4
- package/auth/index.js +49 -1
- package/auth/storage.d.ts +1 -1
- package/components/ShopperExperience/Component/index.d.ts +1 -1
- package/components/ShopperExperience/Page/index.d.ts +2 -2
- package/components/ShopperExperience/types.d.ts +5 -5
- package/hooks/ShopperBaskets/cache.d.ts +1 -1
- package/hooks/ShopperBaskets/mutation.d.ts +63 -282
- package/hooks/ShopperBaskets/mutation.js +60 -254
- package/hooks/ShopperBaskets/query.d.ts +11 -1
- package/hooks/ShopperBaskets/query.js +10 -0
- package/hooks/ShopperBaskets/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperContexts/cache.d.ts +1 -1
- package/hooks/ShopperContexts/mutation.d.ts +18 -13
- package/hooks/ShopperContexts/mutation.js +16 -11
- package/hooks/ShopperContexts/query.d.ts +4 -2
- package/hooks/ShopperContexts/query.js +3 -1
- package/hooks/ShopperContexts/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperCustomers/cache.d.ts +1 -1
- package/hooks/ShopperCustomers/mutation.d.ts +22 -82
- package/hooks/ShopperCustomers/mutation.js +20 -81
- package/hooks/ShopperCustomers/query.d.ts +28 -3
- package/hooks/ShopperCustomers/query.js +28 -2
- package/hooks/ShopperCustomers/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperExperience/query.d.ts +13 -9
- package/hooks/ShopperExperience/query.js +12 -8
- package/hooks/ShopperExperience/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperGiftCertificates/query.d.ts +3 -1
- package/hooks/ShopperGiftCertificates/query.js +2 -0
- package/hooks/ShopperGiftCertificates/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperLogin/mutation.d.ts +21 -49
- package/hooks/ShopperLogin/mutation.js +19 -41
- package/hooks/ShopperLogin/query.d.ts +9 -1
- package/hooks/ShopperLogin/query.js +8 -0
- package/hooks/ShopperLogin/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperOrders/cache.d.ts +1 -1
- package/hooks/ShopperOrders/mutation.d.ts +21 -25
- package/hooks/ShopperOrders/mutation.js +19 -21
- package/hooks/ShopperOrders/query.d.ts +7 -1
- package/hooks/ShopperOrders/query.js +7 -1
- package/hooks/ShopperOrders/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperProducts/query.d.ts +9 -1
- package/hooks/ShopperProducts/query.js +8 -0
- package/hooks/ShopperProducts/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperPromotions/query.d.ts +5 -1
- package/hooks/ShopperPromotions/query.js +4 -0
- package/hooks/ShopperPromotions/queryKeyHelpers.d.ts +4 -4
- package/hooks/ShopperSearch/query.d.ts +12 -4
- package/hooks/ShopperSearch/query.js +11 -3
- package/hooks/ShopperSearch/queryKeyHelpers.d.ts +4 -4
- package/hooks/types.d.ts +30 -27
- package/hooks/useAccessToken.d.ts +6 -0
- package/hooks/useAccessToken.js +8 -0
- package/hooks/useAuthHelper.d.ts +15 -1
- package/hooks/useAuthHelper.js +19 -0
- package/hooks/useCommerceApi.d.ts +2 -0
- package/hooks/useCommerceApi.js +2 -0
- package/hooks/useCustomerId.d.ts +2 -0
- package/hooks/useCustomerId.js +2 -0
- package/hooks/useCustomerType.d.ts +5 -2
- package/hooks/useCustomerType.js +12 -1
- package/hooks/useEncUserId.d.ts +3 -0
- package/hooks/useEncUserId.js +3 -0
- package/hooks/useLocalStorage.d.ts +1 -1
- package/hooks/useUsid.d.ts +2 -0
- package/hooks/useUsid.js +2 -0
- package/package.json +15 -13
- package/provider.d.ts +27 -1
- package/provider.js +27 -1
- package/scripts/build-and-release-docs.js +1 -0
|
@@ -17,14 +17,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Mutations available for Shopper Login
|
|
22
|
+
* @group ShopperLogin
|
|
23
|
+
* @category Mutation
|
|
24
|
+
* @enum
|
|
25
|
+
*/
|
|
21
26
|
const ShopperLoginMutations = {
|
|
22
27
|
/**
|
|
23
28
|
* Allows the customer to authenticate when their identity provider is down.
|
|
24
29
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `authorizePasswordlessCustomer` endpoint.
|
|
25
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=authorizePasswordlessCustomer| Salesforce Developer Center} for more information about the API endpoint.
|
|
26
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#authorizepasswordlesscustomer | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
27
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
28
30
|
*/
|
|
29
31
|
AuthorizePasswordlessCustomer: 'authorizePasswordlessCustomer',
|
|
30
32
|
/**
|
|
@@ -32,33 +34,18 @@ const ShopperLoginMutations = {
|
|
|
32
34
|
Required header: Authorization header bearer token of the Shopper access token to logout.
|
|
33
35
|
Required parameters: `refresh token`, `channel_id`, and `client`.
|
|
34
36
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `logoutCustomer` endpoint.
|
|
35
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=logoutCustomer| Salesforce Developer Center} for more information about the API endpoint.
|
|
36
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#logoutcustomer | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
37
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
38
37
|
*/
|
|
39
38
|
LogoutCustomer: 'logoutCustomer',
|
|
40
39
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
For a public client using PKCE, an application will pass a PKCE `code_verifier`` that matches the `code_challenge`` that was used to `authorize` the customer along with the authorization code.
|
|
45
|
-
When refreshing the access token with a private client ID and client secret, the refresh token is _not_ regenerated. However, when refreshing the access token with a public client ID, the refresh token is _always_ regenerated. The old refresh token is voided with every refresh call, so the refresh token on the client needs to be replaced to always store the new refresh token.
|
|
46
|
-
See the Body section for required parameters, including `grant_type` and others, depending on the value of `grant_type`.
|
|
47
|
-
**Important**: We strongly recommended using the `channel_id` query parameter because **it will be required in the future**.
|
|
48
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getAccessToken` endpoint.
|
|
49
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getAccessToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
50
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#getaccesstoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
51
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
52
|
-
*/
|
|
40
|
+
* Get the shopper or guest JWT access token and a refresh token. This is the second step of the OAuth 2.1 authorization code flow.
|
|
41
|
+
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getAccessToken` endpoint.
|
|
42
|
+
*/
|
|
53
43
|
GetAccessToken: 'getAccessToken',
|
|
54
44
|
/**
|
|
55
45
|
* Get a shopper JWT access token for a registered customer using session bridge.
|
|
56
46
|
For public client id requests the grant_type must be set to `session_bridge`.
|
|
57
47
|
For private client_id and secret the grant_type must be set to `client_credentials` along with a basic authorization header.
|
|
58
48
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getSessionBridgeAccessToken` endpoint.
|
|
59
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getSessionBridgeAccessToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
60
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#getsessionbridgeaccesstoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
61
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
62
49
|
*/
|
|
63
50
|
GetSessionBridgeAccessToken: 'getSessionBridgeAccessToken',
|
|
64
51
|
/**
|
|
@@ -66,9 +53,6 @@ const ShopperLoginMutations = {
|
|
|
66
53
|
For external trusted-system requests, a basic authorization header that includes a SLAS client ID and SLAS client secret can be used in place of the bearer token.
|
|
67
54
|
For internal trusted-system requests, the bearer token must be a C2C JWT.
|
|
68
55
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getTrustedSystemAccessToken` endpoint.
|
|
69
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getTrustedSystemAccessToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
70
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#gettrustedsystemaccesstoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
71
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
72
56
|
*/
|
|
73
57
|
GetTrustedSystemAccessToken: 'getTrustedSystemAccessToken',
|
|
74
58
|
/**
|
|
@@ -76,47 +60,41 @@ const ShopperLoginMutations = {
|
|
|
76
60
|
If using a SLAS private client ID, you must also use an `_sfdc_client_auth` header.
|
|
77
61
|
The value of the `_sfdc_client_auth` header must be a Base64-encoded string. The string is composed of a SLAS private client ID and client secret, separated by a colon (`:`). For example, `privateClientId:privateClientsecret` becomes `cHJpdmF0ZUNsaWVudElkOnByaXZhdGVDbGllbnRzZWNyZXQ=` after Base64 encoding.
|
|
78
62
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getTrustedAgentAccessToken` endpoint.
|
|
79
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getTrustedAgentAccessToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
80
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#gettrustedagentaccesstoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
81
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
82
63
|
*/
|
|
83
64
|
GetTrustedAgentAccessToken: 'getTrustedAgentAccessToken',
|
|
84
65
|
/**
|
|
85
66
|
* Creates a new password
|
|
86
67
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `resetPassword` endpoint.
|
|
87
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=resetPassword| Salesforce Developer Center} for more information about the API endpoint.
|
|
88
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#resetpassword | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
89
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
90
68
|
*/
|
|
91
69
|
ResetPassword: 'resetPassword',
|
|
92
70
|
/**
|
|
93
71
|
* Issue a shopper token (JWT).
|
|
94
72
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `getPasswordLessAccessToken` endpoint.
|
|
95
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=getPasswordLessAccessToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
96
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#getpasswordlessaccesstoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
97
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
98
73
|
*/
|
|
99
74
|
GetPasswordLessAccessToken: 'getPasswordLessAccessToken',
|
|
100
75
|
/**
|
|
101
76
|
* Invalidate the refresh token. A basic auth header with Base64-encoded `clientId:secret` is required in the Authorization header, and the refresh token to be revoked is required in the body.
|
|
102
77
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `revokeToken` endpoint.
|
|
103
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=revokeToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
104
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#revoketoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
105
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
106
78
|
*/
|
|
107
79
|
RevokeToken: 'revokeToken',
|
|
108
80
|
/**
|
|
109
81
|
* Returns the token properties. A basic auth header with Base64-encoded `clientId:secret` is required in the Authorization header, as well as an access token or refresh token. Use `token_type_hint` to help identify the token.
|
|
110
82
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Login `introspectToken` endpoint.
|
|
111
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-login?meta=introspectToken| Salesforce Developer Center} for more information about the API endpoint.
|
|
112
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperlogin.shopperlogin-1.html#introspecttoken | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
113
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
114
83
|
*/
|
|
115
84
|
IntrospectToken: 'introspectToken'
|
|
116
85
|
};
|
|
117
86
|
|
|
118
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Mutation for Shopper Login.
|
|
89
|
+
* @group ShopperLogin
|
|
90
|
+
* @category Mutation
|
|
91
|
+
*/
|
|
119
92
|
exports.ShopperLoginMutations = ShopperLoginMutations;
|
|
93
|
+
/**
|
|
94
|
+
* Mutation hook for Shopper Login.
|
|
95
|
+
* @group ShopperLogin
|
|
96
|
+
* @category Mutation
|
|
97
|
+
*/
|
|
120
98
|
function useShopperLoginMutation(mutation) {
|
|
121
99
|
const getCacheUpdates = _cache.cacheUpdateMatrix[mutation];
|
|
122
100
|
// TODO: Remove this check when all mutations are implemented.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ApiClients['shopperLogin'];
|
|
4
4
|
/**
|
|
5
5
|
* Get credential quality statistics for a user.
|
|
6
|
+
* @group ShopperLogin
|
|
7
|
+
* @category Query
|
|
6
8
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
7
9
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
8
10
|
* @returns A TanStack Query query hook with data from the Shopper Login `retrieveCredQualityUserInfo` endpoint.
|
|
@@ -13,6 +15,8 @@ declare type Client = ApiClients['shopperLogin'];
|
|
|
13
15
|
export declare const useCredQualityUserInfo: (apiOptions: NullableParameters<Argument<Client['retrieveCredQualityUserInfo']>>, queryOptions?: ApiQueryOptions<Client['retrieveCredQualityUserInfo']>) => UseQueryResult<DataType<Client['retrieveCredQualityUserInfo']>>;
|
|
14
16
|
/**
|
|
15
17
|
* Returns a JSON listing of claims about the currently authenticated user.
|
|
18
|
+
* @group ShopperLogin
|
|
19
|
+
* @category Query
|
|
16
20
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
17
21
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
18
22
|
* @returns A TanStack Query query hook with data from the Shopper Login `getUserInfo` endpoint.
|
|
@@ -23,6 +27,8 @@ export declare const useCredQualityUserInfo: (apiOptions: NullableParameters<Arg
|
|
|
23
27
|
export declare const useUserInfo: (apiOptions: NullableParameters<Argument<Client['getUserInfo']>>, queryOptions?: ApiQueryOptions<Client['getUserInfo']>) => UseQueryResult<DataType<Client['getUserInfo']>>;
|
|
24
28
|
/**
|
|
25
29
|
* Returns a JSON listing of the OpenID/OAuth endpoints, supported scopes and claims, public keys used to sign the tokens, and other details.
|
|
30
|
+
* @group ShopperLogin
|
|
31
|
+
* @category Query
|
|
26
32
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
27
33
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
28
34
|
* @returns A TanStack Query query hook with data from the Shopper Login `getWellknownOpenidConfiguration` endpoint.
|
|
@@ -33,6 +39,8 @@ export declare const useUserInfo: (apiOptions: NullableParameters<Argument<Clien
|
|
|
33
39
|
export declare const useWellknownOpenidConfiguration: (apiOptions: NullableParameters<Argument<Client['getWellknownOpenidConfiguration']>>, queryOptions?: ApiQueryOptions<Client['getWellknownOpenidConfiguration']>) => UseQueryResult<DataType<Client['getWellknownOpenidConfiguration']>>;
|
|
34
40
|
/**
|
|
35
41
|
* Returns a JSON Web Key Set (JWKS) containing the current, past, and future public keys. The key set enables clients to validate the Shopper JSON Web Token (JWT) issued by SLAS.
|
|
42
|
+
* @group ShopperLogin
|
|
43
|
+
* @category Query
|
|
36
44
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
37
45
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
38
46
|
* @returns A TanStack Query query hook with data from the Shopper Login `getJwksUri` endpoint.
|
|
@@ -20,6 +20,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* Get credential quality statistics for a user.
|
|
23
|
+
* @group ShopperLogin
|
|
24
|
+
* @category Query
|
|
23
25
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
24
26
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
25
27
|
* @returns A TanStack Query query hook with data from the Shopper Login `retrieveCredQualityUserInfo` endpoint.
|
|
@@ -58,6 +60,8 @@ const useCredQualityUserInfo = (apiOptions, queryOptions = {}) => {
|
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Returns a JSON listing of claims about the currently authenticated user.
|
|
63
|
+
* @group ShopperLogin
|
|
64
|
+
* @category Query
|
|
61
65
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
62
66
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
63
67
|
* @returns A TanStack Query query hook with data from the Shopper Login `getUserInfo` endpoint.
|
|
@@ -97,6 +101,8 @@ const useUserInfo = (apiOptions, queryOptions = {}) => {
|
|
|
97
101
|
};
|
|
98
102
|
/**
|
|
99
103
|
* Returns a JSON listing of the OpenID/OAuth endpoints, supported scopes and claims, public keys used to sign the tokens, and other details.
|
|
104
|
+
* @group ShopperLogin
|
|
105
|
+
* @category Query
|
|
100
106
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
101
107
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
102
108
|
* @returns A TanStack Query query hook with data from the Shopper Login `getWellknownOpenidConfiguration` endpoint.
|
|
@@ -136,6 +142,8 @@ const useWellknownOpenidConfiguration = (apiOptions, queryOptions = {}) => {
|
|
|
136
142
|
};
|
|
137
143
|
/**
|
|
138
144
|
* Returns a JSON Web Key Set (JWKS) containing the current, past, and future public keys. The key set enables clients to validate the Shopper JSON Web Token (JWT) issued by SLAS.
|
|
145
|
+
* @group ShopperLogin
|
|
146
|
+
* @category Query
|
|
139
147
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
140
148
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
141
149
|
* @returns A TanStack Query query hook with data from the Shopper Login `getJwksUri` endpoint.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ShopperLogin } from 'commerce-sdk-isomorphic';
|
|
2
2
|
import { Argument, ExcludeTail } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ShopperLogin<{
|
|
4
4
|
shortCode: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
7
|
-
export
|
|
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
|
-
|
|
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
|
-
|
|
2
|
+
type Client = ApiClients['shopperOrders'];
|
|
3
3
|
export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ApiClients, Argument, DataType } from '../types';
|
|
2
2
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
|
|
4
|
-
/**
|
|
3
|
+
type Client = ApiClients['shopperOrders'];
|
|
4
|
+
/**
|
|
5
|
+
* Mutations available for Shopper Orders
|
|
6
|
+
* @group ShopperOrders
|
|
7
|
+
* @category Mutation
|
|
8
|
+
* @enum
|
|
9
|
+
*/
|
|
5
10
|
export declare const ShopperOrdersMutations: {
|
|
6
11
|
/**
|
|
7
12
|
* Submits an order based on a prepared basket. The only considered value from the request body is basketId.
|
|
8
13
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `createOrder` endpoint.
|
|
9
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=createOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
10
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#createorder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
11
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
12
14
|
*/
|
|
13
15
|
readonly CreateOrder: "createOrder";
|
|
14
16
|
/**
|
|
@@ -19,36 +21,30 @@ Details:
|
|
|
19
21
|
The payment instrument is added with the provided details. The payment method must be applicable for the order see GET
|
|
20
22
|
/baskets/\{basketId\}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.
|
|
21
23
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `createPaymentInstrumentForOrder` endpoint.
|
|
22
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=createPaymentInstrumentForOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
23
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#createpaymentinstrumentfororder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
24
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
25
24
|
*/
|
|
26
25
|
readonly CreatePaymentInstrumentForOrder: "createPaymentInstrumentForOrder";
|
|
27
26
|
/**
|
|
28
27
|
* Removes a payment instrument of an order.
|
|
29
28
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `removePaymentInstrumentFromOrder` endpoint.
|
|
30
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=removePaymentInstrumentFromOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
31
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#removepaymentinstrumentfromorder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
32
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
33
29
|
*/
|
|
34
30
|
readonly RemovePaymentInstrumentFromOrder: "removePaymentInstrumentFromOrder";
|
|
35
31
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
The payment instrument is updated with the provided details. The payment method must be applicable for the
|
|
41
|
-
order see GET /baskets/\{basketId\}/payment-methods, if the payment method is 'CREDIT_CARD' a
|
|
42
|
-
paymentCard must be specified in the request.
|
|
43
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `updatePaymentInstrumentForOrder` endpoint.
|
|
44
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=updatePaymentInstrumentForOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
45
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#updatepaymentinstrumentfororder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
46
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
47
|
-
*/
|
|
32
|
+
* Updates a payment instrument of an order.
|
|
33
|
+
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `updatePaymentInstrumentForOrder` endpoint.
|
|
34
|
+
*/
|
|
48
35
|
readonly UpdatePaymentInstrumentForOrder: "updatePaymentInstrumentForOrder";
|
|
49
36
|
};
|
|
50
|
-
/**
|
|
51
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Mutation for Shopper Orders.
|
|
39
|
+
* @group ShopperOrders
|
|
40
|
+
* @category Mutation
|
|
41
|
+
*/
|
|
42
|
+
export type ShopperOrdersMutation = (typeof ShopperOrdersMutations)[keyof typeof ShopperOrdersMutations];
|
|
43
|
+
/**
|
|
44
|
+
* Mutation hook for Shopper Orders.
|
|
45
|
+
* @group ShopperOrders
|
|
46
|
+
* @category Mutation
|
|
47
|
+
*/
|
|
52
48
|
export declare function useShopperOrdersMutation<Mutation extends ShopperOrdersMutation>(mutation: Mutation): UseMutationResult<DataType<Client[Mutation]>, unknown, Argument<Client[Mutation]>>;
|
|
53
49
|
export {};
|
|
54
50
|
//# sourceMappingURL=mutation.d.ts.map
|
|
@@ -17,14 +17,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Mutations available for Shopper Orders
|
|
22
|
+
* @group ShopperOrders
|
|
23
|
+
* @category Mutation
|
|
24
|
+
* @enum
|
|
25
|
+
*/
|
|
21
26
|
const ShopperOrdersMutations = {
|
|
22
27
|
/**
|
|
23
28
|
* Submits an order based on a prepared basket. The only considered value from the request body is basketId.
|
|
24
29
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `createOrder` endpoint.
|
|
25
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=createOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
26
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#createorder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
27
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
28
30
|
*/
|
|
29
31
|
CreateOrder: 'createOrder',
|
|
30
32
|
/**
|
|
@@ -33,35 +35,31 @@ const ShopperOrdersMutations = {
|
|
|
33
35
|
The payment instrument is added with the provided details. The payment method must be applicable for the order see GET
|
|
34
36
|
/baskets/\{basketId\}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.
|
|
35
37
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `createPaymentInstrumentForOrder` endpoint.
|
|
36
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=createPaymentInstrumentForOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
37
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#createpaymentinstrumentfororder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
38
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
39
38
|
*/
|
|
40
39
|
CreatePaymentInstrumentForOrder: 'createPaymentInstrumentForOrder',
|
|
41
40
|
/**
|
|
42
41
|
* Removes a payment instrument of an order.
|
|
43
42
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `removePaymentInstrumentFromOrder` endpoint.
|
|
44
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=removePaymentInstrumentFromOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
45
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#removepaymentinstrumentfromorder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
46
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
47
43
|
*/
|
|
48
44
|
RemovePaymentInstrumentFromOrder: 'removePaymentInstrumentFromOrder',
|
|
49
45
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
order see GET /baskets/\{basketId\}/payment-methods, if the payment method is 'CREDIT_CARD' a
|
|
54
|
-
paymentCard must be specified in the request.
|
|
55
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `updatePaymentInstrumentForOrder` endpoint.
|
|
56
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-orders?meta=updatePaymentInstrumentForOrder| Salesforce Developer Center} for more information about the API endpoint.
|
|
57
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperorders.shopperorders-1.html#updatepaymentinstrumentfororder | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
58
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
59
|
-
*/
|
|
46
|
+
* Updates a payment instrument of an order.
|
|
47
|
+
* @returns A TanStack Query mutation hook for interacting with the Shopper Orders `updatePaymentInstrumentForOrder` endpoint.
|
|
48
|
+
*/
|
|
60
49
|
UpdatePaymentInstrumentForOrder: 'updatePaymentInstrumentForOrder'
|
|
61
50
|
};
|
|
62
51
|
|
|
63
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Mutation for Shopper Orders.
|
|
54
|
+
* @group ShopperOrders
|
|
55
|
+
* @category Mutation
|
|
56
|
+
*/
|
|
64
57
|
exports.ShopperOrdersMutations = ShopperOrdersMutations;
|
|
58
|
+
/**
|
|
59
|
+
* Mutation hook for Shopper Orders.
|
|
60
|
+
* @group ShopperOrders
|
|
61
|
+
* @category Mutation
|
|
62
|
+
*/
|
|
65
63
|
function useShopperOrdersMutation(mutation) {
|
|
66
64
|
const getCacheUpdates = _cache.cacheUpdateMatrix[mutation];
|
|
67
65
|
// TODO: Remove this check when all mutations are implemented.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ApiClients['shopperOrders'];
|
|
4
4
|
/**
|
|
5
5
|
* Gets information for an order.
|
|
6
|
+
* @group ShopperOrders
|
|
7
|
+
* @category Query
|
|
6
8
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
7
9
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
8
10
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getOrder` endpoint.
|
|
@@ -13,6 +15,8 @@ declare type Client = ApiClients['shopperOrders'];
|
|
|
13
15
|
export declare const useOrder: (apiOptions: NullableParameters<Argument<Client['getOrder']>>, queryOptions?: ApiQueryOptions<Client['getOrder']>) => UseQueryResult<DataType<Client['getOrder']>>;
|
|
14
16
|
/**
|
|
15
17
|
* Gets the applicable payment methods for an existing order considering the open payment amount only.
|
|
18
|
+
* @group ShopperOrders
|
|
19
|
+
* @category Query
|
|
16
20
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
17
21
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
18
22
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getPaymentMethodsForOrder` endpoint.
|
|
@@ -25,6 +29,8 @@ export declare const usePaymentMethodsForOrder: (apiOptions: NullableParameters<
|
|
|
25
29
|
* This method gives you the external taxation data of the order transferred from the basket during
|
|
26
30
|
order creation. This endpoint can be called only if external taxation was used. See POST /baskets
|
|
27
31
|
for more information.
|
|
32
|
+
* @group ShopperOrders
|
|
33
|
+
* @category Query
|
|
28
34
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
29
35
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
30
36
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getTaxesFromOrder` endpoint.
|
|
@@ -20,6 +20,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* Gets information for an order.
|
|
23
|
+
* @group ShopperOrders
|
|
24
|
+
* @category Query
|
|
23
25
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
24
26
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
25
27
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getOrder` endpoint.
|
|
@@ -58,6 +60,8 @@ const useOrder = (apiOptions, queryOptions = {}) => {
|
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Gets the applicable payment methods for an existing order considering the open payment amount only.
|
|
63
|
+
* @group ShopperOrders
|
|
64
|
+
* @category Query
|
|
61
65
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
62
66
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
63
67
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getPaymentMethodsForOrder` endpoint.
|
|
@@ -98,7 +102,9 @@ const usePaymentMethodsForOrder = (apiOptions, queryOptions = {}) => {
|
|
|
98
102
|
/**
|
|
99
103
|
* This method gives you the external taxation data of the order transferred from the basket during
|
|
100
104
|
order creation. This endpoint can be called only if external taxation was used. See POST /baskets
|
|
101
|
-
for more information.
|
|
105
|
+
for more information.
|
|
106
|
+
* @group ShopperOrders
|
|
107
|
+
* @category Query
|
|
102
108
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
103
109
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
104
110
|
* @returns A TanStack Query query hook with data from the Shopper Orders `getTaxesFromOrder` endpoint.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ShopperOrders } from 'commerce-sdk-isomorphic';
|
|
2
2
|
import { Argument, ExcludeTail } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ShopperOrders<{
|
|
4
4
|
shortCode: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
7
|
-
export
|
|
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
|
-
|
|
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,8 +1,10 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
|
|
3
|
-
|
|
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
|
+
* @group ShopperProducts
|
|
7
|
+
* @category Query
|
|
6
8
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
7
9
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
8
10
|
* @returns A TanStack Query query hook with data from the Shopper Products `getProducts` endpoint.
|
|
@@ -13,6 +15,8 @@ declare type Client = ApiClients['shopperProducts'];
|
|
|
13
15
|
export declare const useProducts: (apiOptions: NullableParameters<Argument<Client['getProducts']>>, queryOptions?: ApiQueryOptions<Client['getProducts']>) => UseQueryResult<DataType<Client['getProducts']>>;
|
|
14
16
|
/**
|
|
15
17
|
* Allows access to product details for a single product ID. Only products that are online and assigned to a site catalog are returned. Along with product details, the availability, images, price, bundled_products, set_products, recommedations, product options, variations, and promotions for the products will be included, as appropriate.
|
|
18
|
+
* @group ShopperProducts
|
|
19
|
+
* @category Query
|
|
16
20
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
17
21
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
18
22
|
* @returns A TanStack Query query hook with data from the Shopper Products `getProduct` endpoint.
|
|
@@ -23,6 +27,8 @@ export declare const useProducts: (apiOptions: NullableParameters<Argument<Clien
|
|
|
23
27
|
export declare const useProduct: (apiOptions: NullableParameters<Argument<Client['getProduct']>>, queryOptions?: ApiQueryOptions<Client['getProduct']>) => UseQueryResult<DataType<Client['getProduct']>>;
|
|
24
28
|
/**
|
|
25
29
|
* When you use the URL template, the server returns multiple categories (a result object of category documents). You can use this template as a convenient way of obtaining multiple categories in a single request, instead of issuing separate requests for each category. You can specify up to 50 multiple IDs. You must enclose the list of IDs in parentheses. If a category identifier contains parenthesis or the separator sign, you must URL encode the character. The server only returns online categories.
|
|
30
|
+
* @group ShopperProducts
|
|
31
|
+
* @category Query
|
|
26
32
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
27
33
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
28
34
|
* @returns A TanStack Query query hook with data from the Shopper Products `getCategories` endpoint.
|
|
@@ -35,6 +41,8 @@ export declare const useCategories: (apiOptions: NullableParameters<Argument<Cli
|
|
|
35
41
|
* When you use the URL template below, the server returns a category identified by its ID; by default, the server
|
|
36
42
|
also returns the first level of subcategories, but you can specify another level by setting the levels
|
|
37
43
|
parameter. The server only returns online categories.
|
|
44
|
+
* @group ShopperProducts
|
|
45
|
+
* @category Query
|
|
38
46
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
39
47
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
40
48
|
* @returns A TanStack Query query hook with data from the Shopper Products `getCategory` endpoint.
|
|
@@ -20,6 +20,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* 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.
|
|
23
|
+
* @group ShopperProducts
|
|
24
|
+
* @category Query
|
|
23
25
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
24
26
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
25
27
|
* @returns A TanStack Query query hook with data from the Shopper Products `getProducts` endpoint.
|
|
@@ -58,6 +60,8 @@ const useProducts = (apiOptions, queryOptions = {}) => {
|
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Allows access to product details for a single product ID. Only products that are online and assigned to a site catalog are returned. Along with product details, the availability, images, price, bundled_products, set_products, recommedations, product options, variations, and promotions for the products will be included, as appropriate.
|
|
63
|
+
* @group ShopperProducts
|
|
64
|
+
* @category Query
|
|
61
65
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
62
66
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
63
67
|
* @returns A TanStack Query query hook with data from the Shopper Products `getProduct` endpoint.
|
|
@@ -97,6 +101,8 @@ const useProduct = (apiOptions, queryOptions = {}) => {
|
|
|
97
101
|
};
|
|
98
102
|
/**
|
|
99
103
|
* When you use the URL template, the server returns multiple categories (a result object of category documents). You can use this template as a convenient way of obtaining multiple categories in a single request, instead of issuing separate requests for each category. You can specify up to 50 multiple IDs. You must enclose the list of IDs in parentheses. If a category identifier contains parenthesis or the separator sign, you must URL encode the character. The server only returns online categories.
|
|
104
|
+
* @group ShopperProducts
|
|
105
|
+
* @category Query
|
|
100
106
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
101
107
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
102
108
|
* @returns A TanStack Query query hook with data from the Shopper Products `getCategories` endpoint.
|
|
@@ -138,6 +144,8 @@ const useCategories = (apiOptions, queryOptions = {}) => {
|
|
|
138
144
|
* When you use the URL template below, the server returns a category identified by its ID; by default, the server
|
|
139
145
|
also returns the first level of subcategories, but you can specify another level by setting the levels
|
|
140
146
|
parameter. The server only returns online categories.
|
|
147
|
+
* @group ShopperProducts
|
|
148
|
+
* @category Query
|
|
141
149
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
142
150
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
143
151
|
* @returns A TanStack Query query hook with data from the Shopper Products `getCategory` endpoint.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ShopperProducts } from 'commerce-sdk-isomorphic';
|
|
2
2
|
import { Argument, ExcludeTail } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ShopperProducts<{
|
|
4
4
|
shortCode: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
7
|
-
export
|
|
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
|
-
|
|
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,8 +1,10 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters } from '../types';
|
|
3
|
-
|
|
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
|
+
* @group ShopperPromotions
|
|
7
|
+
* @category Query
|
|
6
8
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
7
9
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
8
10
|
* @returns A TanStack Query query hook with data from the Shopper Promotions `getPromotions` endpoint.
|
|
@@ -17,6 +19,8 @@ criteria. In the request URL, you must provide a campaign_id parameter, and you
|
|
|
17
19
|
range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as
|
|
18
20
|
omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
|
|
19
21
|
promotions, since the server does not consider promotion qualifiers or schedules.
|
|
22
|
+
* @group ShopperPromotions
|
|
23
|
+
* @category Query
|
|
20
24
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
21
25
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
22
26
|
* @returns A TanStack Query query hook with data from the Shopper Promotions `getPromotionsForCampaign` endpoint.
|
|
@@ -20,6 +20,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* 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.
|
|
23
|
+
* @group ShopperPromotions
|
|
24
|
+
* @category Query
|
|
23
25
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
24
26
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
25
27
|
* @returns A TanStack Query query hook with data from the Shopper Promotions `getPromotions` endpoint.
|
|
@@ -62,6 +64,8 @@ criteria. In the request URL, you must provide a campaign_id parameter, and you
|
|
|
62
64
|
range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as
|
|
63
65
|
omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled
|
|
64
66
|
promotions, since the server does not consider promotion qualifiers or schedules.
|
|
67
|
+
* @group ShopperPromotions
|
|
68
|
+
* @category Query
|
|
65
69
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
66
70
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
67
71
|
* @returns A TanStack Query query hook with data from the Shopper Promotions `getPromotionsForCampaign` endpoint.
|