@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
|
@@ -16,351 +16,157 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
16
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Mutations available for Shopper Baskets.
|
|
21
|
+
* @group ShopperBaskets
|
|
22
|
+
* @category Mutation
|
|
23
|
+
* @enum
|
|
24
|
+
*/
|
|
20
25
|
const ShopperBasketsMutations = {
|
|
21
26
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
API endpoints allowing further basket modification:
|
|
26
|
-
- customer information: PUT /baskets/\{basketId\}/customer
|
|
27
|
-
- billing address: PUT /baskets/\{basketId\}/billing-address
|
|
28
|
-
- shipments including shipping address and shipping method: POST /baskets/\{basketId\}/shipments
|
|
29
|
-
- product items: POST /baskets/\{basketId\}/items
|
|
30
|
-
- coupon items: POST /baskets/\{basketId\}/coupons
|
|
31
|
-
- gift certificate items: POST /baskets/\{basketId\}/gift-certificates
|
|
32
|
-
- basket taxation: PUT /baskets/\{basketId\}/taxes
|
|
33
|
-
- basket item taxation: PUT /baskets/\{basketId\}/items/\{itemId\}/taxes
|
|
34
|
-
- payment method and card type: POST /baskets/\{basketId\}/payment-instruments
|
|
35
|
-
- custom properties: PATCH /baskets/\{basketId\}
|
|
36
|
-
Related resource means with which resource you can specify the same data after the basket creation.
|
|
37
|
-
Identify the basket using the basketId property, which
|
|
38
|
-
should be integrated into the path of an update request (for example a POST to
|
|
39
|
-
/baskets/\{basketId\}/items).
|
|
40
|
-
A customer must provide a JSON Web Token (JWT), which specifies exactly one customer (it can be a guest or a registered
|
|
41
|
-
customer). In this case, the resource creates a basket for this customer.
|
|
42
|
-
The number of baskets which can be created per customer is limited. When a
|
|
43
|
-
basket is created, it is said to be open. It remains open until either an order is created from it
|
|
44
|
-
using a POST to resource /orders, or it is deleted using a DELETE to resource
|
|
45
|
-
/baskets/\{basketId\}. Each customer can have just one open basket.
|
|
46
|
-
Custom properties in the form c_\<CUSTOM_NAME\> are supported. A custom property must correspond to a custom
|
|
47
|
-
attribute (\<CUSTOM_NAME\>) defined for the basket system object, and its value must be valid for that custom
|
|
48
|
-
attribute.
|
|
49
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `createBasket` endpoint.
|
|
50
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=createBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
51
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#createbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
52
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
53
|
-
*/
|
|
27
|
+
* Creates a new basket.
|
|
28
|
+
The created basket is initialized with default values.
|
|
29
|
+
*/
|
|
54
30
|
CreateBasket: 'createBasket',
|
|
55
31
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `transferBasket` endpoint.
|
|
63
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=transferBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
64
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#transferbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
65
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
32
|
+
* Transfer the previous shopper's basket to the current shopper by updating the basket's owner. No other values change. You must obtain the shopper authorization token via SLAS and you must provide the ‘guest usid‘ in both the ‘/oauth2/login‘ and ‘/oauth2/token‘ calls while fetching the registered user JWT token.
|
|
33
|
+
A success response contains the transferred basket.
|
|
34
|
+
If the current shopper has an active basket, and the `overrideExisting` request parameter is `false`, then the transfer request returns a BasketTransferException (HTTP status 409). You can proceed with one of these options:
|
|
35
|
+
- Keep the current shopper's active basket.
|
|
36
|
+
- Merge the previous and current shoppers' baskets by calling the `baskets/merge` endpoint.
|
|
37
|
+
- Force the transfer by calling the `baskets/transfer` endpoint again, with the parameter `overrideExisting=true`. Forcing the transfer deletes the current shopper's active basket.
|
|
66
38
|
*/
|
|
67
39
|
TransferBasket: 'transferBasket',
|
|
68
40
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- custom attributes on the basket and on all copied records
|
|
72
|
-
- product items
|
|
73
|
-
- gift certificate items
|
|
74
|
-
- coupon items
|
|
75
|
-
- shipments
|
|
76
|
-
- ad-hoc price adjustments
|
|
77
|
-
To control the merging of products that exist in both baskets, use the `productItemMergeMode` parameter. By default, the higher of the two basket quantities is used for each product. Products in both baskets are considered to be the same when all of the following values match (if one product doesn't have a value, the other product is a match only if it also doesn't have that value):
|
|
78
|
-
- shipment
|
|
79
|
-
- productId
|
|
80
|
-
- option values
|
|
81
|
-
- wishlist reference
|
|
82
|
-
- inventory list id
|
|
83
|
-
- gift flag & message
|
|
84
|
-
- ad-hoc price adjustments
|
|
85
|
-
If any of the listed values don't match, then the item in the previous shopper's basket is copied to a new line item in the current shopper's basket. If the listed values all match, but the matching products have different values for any custom attribute, the merged line item keeps the custom attribute value from the current shopper's basket.
|
|
86
|
-
A success response contains the current shopper's active basket. The previous guest shopper's active basket is deleted.
|
|
87
|
-
If the current shopper doesn't have an active basket, and the createDestinationBasket request parameter is false, then the merge request returns a BasketMergeException (HTTP status 409). You can proceed with one of these options:
|
|
88
|
-
- Transfer the previous shopper's active basket to the current logged-in shopper by calling the `baskets/transfer` endpoint.
|
|
89
|
-
- Force the merge by calling the `baskets/merge` endpoint again, with the parameter `createDestinationBasket=true`. Forcing the merge creates a new basket for the current shopper and copies information from the previous shopper's basket into it. Because the merge doesn't copy all basket data, a forced merge is not the same as a transfer. For example, the new basket doesn't contain any Personally Identifiable Information (PII) from the previous basket.
|
|
90
|
-
### before merge
|
|
91
|
-
| Previous Shopper's Basket, SKU: Quantity, Custom Attributes | Current Shopper's Basket, SKU: Quantity, Custom Attributes |
|
|
92
|
-
|-------------------------------------------------------------|-------------------------------------------------------------|
|
|
93
|
-
| SKU_A: 5\<br\> SKU_B: 3\<br\> SKU_C: 4\<br\> c_customAttr_1: 'ABC' \<br\> c_customAttr_2: 'DEF' | SKU_A: 2\<br\> SKU_D: 6\<br\> SKU_E: 7\<br\> c_customAttr_1: 'UVW' \<br\> c_customAttr_3: 'XYZ' |
|
|
94
|
-
### after merge - (previous shopper's basket is deleted)
|
|
95
|
-
| productItemMergeMode | Current Shopper's Basket - SKU: Quantity, Custom Attributes |
|
|
96
|
-
|----------------------|--------------------------------------------------------------|
|
|
97
|
-
| sum_quantities | SKU_A: 7\<br\> SKU_B: 3\<br\> SKU_C: 4\<br\> SKU_D: 6\<br\> SKU_E: 7\<br\> c_customAttr_1: 'UVW' \<br\> c_customAttr_2: 'DEF' \<br\> c_customAttr_3: 'XYZ' |
|
|
98
|
-
| higher_quantity | SKU_A: 5\<br\> SKU_B: 3\<br\> SKU_C: 4\<br\> SKU_D: 6\<br\> SKU_E: 7\<br\> c_customAttr_1: 'UVW' \<br\> c_customAttr_2: 'DEF' \<br\> c_customAttr_3: 'XYZ' |
|
|
99
|
-
| saved_quantity | SKU_A: 2\<br\> SKU_B: 3\<br\> SKU_C: 4\<br\> SKU_D: 6\<br\> SKU_E: 7\<br\> c_customAttr_1: 'UVW' \<br\> c_customAttr_2: 'DEF' \<br\> c_customAttr_3: 'XYZ' |
|
|
100
|
-
| separate_item | SKU_A: 5\<br\> SKU_B: 3\<br\> SKU_C: 4\<br\> SKU_A: 2\<br\> SKU_D: 6\<br\> SKU_E: 7\<br\> c_customAttr_1: 'UVW' \<br\> c_customAttr_2: 'DEF' \<br\> c_customAttr_3: 'XYZ' |
|
|
101
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `mergeBasket` endpoint.
|
|
102
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=mergeBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
103
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#mergebasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
104
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
105
|
-
*/
|
|
41
|
+
* Merge data from the previous shopper's basket into the current shopper's active basket and delete the previous shopper's basket. This endpoint doesn't merge Personally Identifiable Information (PII). You must obtain the shopper authorization token via SLAS and you must provide the ‘guest usid‘ in both the ‘/oauth2/login‘ and ‘/oauth2/token‘ calls while fetching the registered user JWT token. After the merge, all basket amounts are recalculated and totaled, including lookups for prices, taxes, shipping, and promotions.
|
|
42
|
+
*/
|
|
106
43
|
MergeBasket: 'mergeBasket',
|
|
107
44
|
/**
|
|
108
45
|
* Removes a basket.
|
|
109
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `deleteBasket` endpoint.
|
|
110
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=deleteBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
111
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#deletebasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
112
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
113
46
|
*/
|
|
114
47
|
DeleteBasket: 'deleteBasket',
|
|
115
48
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
120
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updatebasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
121
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
122
|
-
*/
|
|
49
|
+
* Updates a basket. Only the currency of the basket, source code, the custom
|
|
50
|
+
properties of the basket, and the shipping items will be considered.
|
|
51
|
+
*/
|
|
123
52
|
UpdateBasket: 'updateBasket',
|
|
124
53
|
/**
|
|
125
54
|
* Sets the billing address of a basket.
|
|
126
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateBillingAddressForBasket` endpoint.
|
|
127
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateBillingAddressForBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
128
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updatebillingaddressforbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
129
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
130
55
|
*/
|
|
131
56
|
UpdateBillingAddressForBasket: 'updateBillingAddressForBasket',
|
|
132
57
|
/**
|
|
133
58
|
* Adds a coupon to an existing basket.
|
|
134
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addCouponToBasket` endpoint.
|
|
135
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addCouponToBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
136
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addcoupontobasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
137
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
138
59
|
*/
|
|
139
60
|
AddCouponToBasket: 'addCouponToBasket',
|
|
140
61
|
/**
|
|
141
62
|
* Removes a coupon from the basket.
|
|
142
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `removeCouponFromBasket` endpoint.
|
|
143
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=removeCouponFromBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
144
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#removecouponfrombasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
145
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
146
63
|
*/
|
|
147
64
|
RemoveCouponFromBasket: 'removeCouponFromBasket',
|
|
148
65
|
/**
|
|
149
66
|
* Sets customer information for an existing basket.
|
|
150
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateCustomerForBasket` endpoint.
|
|
151
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateCustomerForBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
152
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updatecustomerforbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
153
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
154
67
|
*/
|
|
155
68
|
UpdateCustomerForBasket: 'updateCustomerForBasket',
|
|
156
69
|
/**
|
|
157
70
|
* Adds a gift certificate item to an existing basket.
|
|
158
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addGiftCertificateItemToBasket` endpoint.
|
|
159
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addGiftCertificateItemToBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
160
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addgiftcertificateitemtobasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
161
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
162
71
|
*/
|
|
163
72
|
AddGiftCertificateItemToBasket: 'addGiftCertificateItemToBasket',
|
|
164
73
|
/**
|
|
165
74
|
* Deletes a gift certificate item from an existing basket.
|
|
166
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `removeGiftCertificateItemFromBasket` endpoint.
|
|
167
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=removeGiftCertificateItemFromBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
168
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#removegiftcertificateitemfrombasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
169
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
170
75
|
*/
|
|
171
76
|
RemoveGiftCertificateItemFromBasket: 'removeGiftCertificateItemFromBasket',
|
|
172
77
|
/**
|
|
173
78
|
* Updates a gift certificate item of an existing basket.
|
|
174
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateGiftCertificateItemInBasket` endpoint.
|
|
175
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateGiftCertificateItemInBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
176
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updategiftcertificateiteminbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
177
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
178
79
|
*/
|
|
179
80
|
UpdateGiftCertificateItemInBasket: 'updateGiftCertificateItemInBasket',
|
|
180
81
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Considered values from the request body, for each item are:
|
|
184
|
-
- productId: a valid product ID. This is the ID of the product to be added to the basket. If the
|
|
185
|
-
product is already in the basket, the API either increments the quantity of the existing product line item or
|
|
186
|
-
creates a new product line item, based on the site preference 'Add Product Behavior'. For option products and
|
|
187
|
-
product bundles containing variation masters, the API creates a new product line item regardless of the site
|
|
188
|
-
preference.
|
|
189
|
-
- shipmentId: a valid shipment ID (optional). This is the ID of the shipment in which the product item
|
|
190
|
-
is created.
|
|
191
|
-
- quantity: a number between 0.01 and 999. This is the quantity of the product to order.
|
|
192
|
-
- inventoryId: a valid inventory ID (optional). This is the ID of the inventory from which the item is
|
|
193
|
-
allocated.
|
|
194
|
-
- bonusDiscountLineItemId: a valid bonus discount line item ID (optional). This is the ID of the
|
|
195
|
-
bonus discount line item for which the added product is a selected bonus product.
|
|
196
|
-
- optionItems/optionValueId: a valid option value ID. This is an option value for an option item of
|
|
197
|
-
an option product. This is only possible if the product item is an option
|
|
198
|
-
product. To set option values, you must specify a collection of option items in the optionItems
|
|
199
|
-
property. These option items must contain optionId and optionValueId. Also,
|
|
200
|
-
the values you specify must be valid for the option product that this product item represents. Otherwise, the
|
|
201
|
-
server throws an InvalidProductOptionItemException or an
|
|
202
|
-
InvalidProductOptionValueItemException.
|
|
203
|
-
- custom properties in the form c_\<CUSTOM_NAME\>: the custom property must correspond to a custom
|
|
204
|
-
attribute (\<CUSTOM_NAME\>) defined for ProductLineItem. The value of this property must be valid for the
|
|
205
|
-
type of custom attribute defined for ProductLineItem.
|
|
206
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addItemToBasket` endpoint.
|
|
207
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addItemToBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
208
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#additemtobasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
209
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
210
|
-
*/
|
|
82
|
+
* Adds new items to a basket.
|
|
83
|
+
*/
|
|
211
84
|
AddItemToBasket: 'addItemToBasket',
|
|
212
85
|
/**
|
|
213
86
|
* Removes a product item from the basket.
|
|
214
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `removeItemFromBasket` endpoint.
|
|
215
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=removeItemFromBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
216
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#removeitemfrombasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
217
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
218
87
|
*/
|
|
219
88
|
RemoveItemFromBasket: 'removeItemFromBasket',
|
|
220
89
|
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
- productId: a valid product ID. The purpose of this
|
|
224
|
-
value is to exchange a variation of a variation product.
|
|
225
|
-
- shipmentId: a valid shipment ID. The purpose of
|
|
226
|
-
this value is to move a product item to another shipment.
|
|
227
|
-
- quantity: a number between 0 and 999. The purpose of
|
|
228
|
-
this value is to change quantity of the product item. If quantity is 0,
|
|
229
|
-
the product item is removed.
|
|
230
|
-
- optionItems/optionValueId: a valid option value
|
|
231
|
-
ID. The purpose of this value is to exchange an option value for an
|
|
232
|
-
option item of an option product.
|
|
233
|
-
This is only possible if the product item is an option product. To change
|
|
234
|
-
option values a collection of option items to be changed need to be
|
|
235
|
-
provided in property optionItems. Those
|
|
236
|
-
optionItems need to contain optionId
|
|
237
|
-
and optionValueId. The provided values must be valid
|
|
238
|
-
for the option product that this product item represents. Otherwise
|
|
239
|
-
InvalidProductOptionItemException or
|
|
240
|
-
InvalidProductOptionValueItemException will be thrown.
|
|
241
|
-
custom properties c_\<CUSTOM_NAME\>: a
|
|
242
|
-
value corresponding to the type defined for custom attribute
|
|
243
|
-
\<CUSTOM_NAME\> of ProductLineItem. The purpose of this value is to
|
|
244
|
-
add or change the value of a custom attribute defined for
|
|
245
|
-
ProductLineItem.
|
|
246
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateItemInBasket` endpoint.
|
|
247
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateItemInBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
248
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updateiteminbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
249
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
250
|
-
*/
|
|
90
|
+
* Updates an item in a basket.
|
|
91
|
+
*/
|
|
251
92
|
UpdateItemInBasket: 'updateItemInBasket',
|
|
252
93
|
/**
|
|
253
94
|
* This method allows you to apply external taxation data to an existing basket to be able to pass tax rates and optional values for a specific taxable line item. This endpoint can be called only if external taxation mode was used for basket creation. See POST /baskets for more information.
|
|
254
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addTaxesForBasketItem` endpoint.
|
|
255
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addTaxesForBasketItem| Salesforce Developer Center} for more information about the API endpoint.
|
|
256
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addtaxesforbasketitem | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
257
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
258
95
|
*/
|
|
259
96
|
AddTaxesForBasketItem: 'addTaxesForBasketItem',
|
|
260
97
|
/**
|
|
261
98
|
* Adds a payment instrument to a basket.
|
|
262
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addPaymentInstrumentToBasket` endpoint.
|
|
263
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addPaymentInstrumentToBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
264
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addpaymentinstrumenttobasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
265
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
266
99
|
*/
|
|
267
100
|
AddPaymentInstrumentToBasket: 'addPaymentInstrumentToBasket',
|
|
268
101
|
/**
|
|
269
102
|
* Removes a payment instrument of a basket.
|
|
270
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `removePaymentInstrumentFromBasket` endpoint.
|
|
271
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=removePaymentInstrumentFromBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
272
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#removepaymentinstrumentfrombasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
273
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
274
103
|
*/
|
|
275
104
|
RemovePaymentInstrumentFromBasket: 'removePaymentInstrumentFromBasket',
|
|
276
105
|
/**
|
|
277
106
|
* Updates payment instrument of an existing basket.
|
|
278
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updatePaymentInstrumentInBasket` endpoint.
|
|
279
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updatePaymentInstrumentInBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
280
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updatepaymentinstrumentinbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
281
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
282
107
|
*/
|
|
283
108
|
UpdatePaymentInstrumentInBasket: 'updatePaymentInstrumentInBasket',
|
|
284
109
|
/**
|
|
285
110
|
* This method allows you to put an array of priceBookIds to an existing basket, which will be used for basket calculation.
|
|
286
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addPriceBooksToBasket` endpoint.
|
|
287
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addPriceBooksToBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
288
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addpricebookstobasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
289
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
290
111
|
*/
|
|
291
112
|
AddPriceBooksToBasket: 'addPriceBooksToBasket',
|
|
292
113
|
/**
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=createShipmentForBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
305
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#createshipmentforbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
306
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
307
|
-
*/
|
|
114
|
+
* Creates a new shipment for a basket.
|
|
115
|
+
The created shipment is initialized with values provided in the body
|
|
116
|
+
document and can be updated with further data API calls. Considered from
|
|
117
|
+
the body are the following properties if specified:
|
|
118
|
+
- the ID
|
|
119
|
+
- the shipping address
|
|
120
|
+
- the shipping method
|
|
121
|
+
- gift boolean flag
|
|
122
|
+
- gift message
|
|
123
|
+
- custom properties
|
|
124
|
+
*/
|
|
308
125
|
CreateShipmentForBasket: 'createShipmentForBasket',
|
|
309
126
|
/**
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=removeShipmentFromBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
315
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#removeshipmentfrombasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
316
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
317
|
-
*/
|
|
127
|
+
* Removes a specified shipment and all associated product, gift certificate,
|
|
128
|
+
shipping, and price adjustment line items from a basket.
|
|
129
|
+
It is not allowed to remove the default shipment.
|
|
130
|
+
*/
|
|
318
131
|
RemoveShipmentFromBasket: 'removeShipmentFromBasket',
|
|
319
132
|
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateShipmentForBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
332
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updateshipmentforbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
333
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
334
|
-
*/
|
|
133
|
+
* Updates a shipment for a basket.
|
|
134
|
+
The shipment is initialized with values provided in the body
|
|
135
|
+
document and can be updated with further data API calls. Considered from
|
|
136
|
+
the body are the following properties if specified:
|
|
137
|
+
- the ID
|
|
138
|
+
- the shipping address
|
|
139
|
+
- the shipping method
|
|
140
|
+
- gift boolean flag
|
|
141
|
+
- gift message
|
|
142
|
+
- custom properties
|
|
143
|
+
*/
|
|
335
144
|
UpdateShipmentForBasket: 'updateShipmentForBasket',
|
|
336
145
|
/**
|
|
337
146
|
* Sets a shipping address of a specific shipment of a basket.
|
|
338
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateShippingAddressForShipment` endpoint.
|
|
339
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateShippingAddressForShipment| Salesforce Developer Center} for more information about the API endpoint.
|
|
340
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updateshippingaddressforshipment | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
341
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
342
147
|
*/
|
|
343
148
|
UpdateShippingAddressForShipment: 'updateShippingAddressForShipment',
|
|
344
149
|
/**
|
|
345
150
|
* Sets a shipping method to a specific shipment of a basket.
|
|
346
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `updateShippingMethodForShipment` endpoint.
|
|
347
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=updateShippingMethodForShipment| Salesforce Developer Center} for more information about the API endpoint.
|
|
348
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#updateshippingmethodforshipment | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
349
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
350
151
|
*/
|
|
351
152
|
UpdateShippingMethodForShipment: 'updateShippingMethodForShipment',
|
|
352
153
|
/**
|
|
353
154
|
* This method allows you to apply external taxation data to an existing basket to be able to pass tax rates and optional values for all taxable line items. This endpoint can be called only if external taxation mode was used for basket creation. See POST /baskets for more information.
|
|
354
|
-
* @returns A TanStack Query mutation hook for interacting with the Shopper Baskets `addTaxesForBasket` endpoint.
|
|
355
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-baskets?meta=addTaxesForBasket| Salesforce Developer Center} for more information about the API endpoint.
|
|
356
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shopperbaskets.shopperbaskets-1.html#addtaxesforbasket | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
357
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
358
155
|
*/
|
|
359
156
|
AddTaxesForBasket: 'addTaxesForBasket'
|
|
360
157
|
};
|
|
361
158
|
|
|
362
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Type for Shopper Baskets Mutation.
|
|
161
|
+
* @group ShopperBaskets
|
|
162
|
+
* @category Mutation
|
|
163
|
+
*/
|
|
363
164
|
exports.ShopperBasketsMutations = ShopperBasketsMutations;
|
|
165
|
+
/**
|
|
166
|
+
* Mutation hook for Shopper Baskets.
|
|
167
|
+
* @group ShopperBaskets
|
|
168
|
+
* @category Mutation
|
|
169
|
+
*/
|
|
364
170
|
function useShopperBasketsMutation(mutation) {
|
|
365
171
|
const getCacheUpdates = _cache.cacheUpdateMatrix[mutation];
|
|
366
172
|
|
|
@@ -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['shopperBaskets'];
|
|
4
4
|
/**
|
|
5
5
|
* Gets a basket.
|
|
6
|
+
* @group ShopperBaskets
|
|
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 Baskets `getBasket` endpoint.
|
|
@@ -13,6 +15,8 @@ declare type Client = ApiClients['shopperBaskets'];
|
|
|
13
15
|
export declare const useBasket: (apiOptions: NullableParameters<Argument<Client['getBasket']>>, queryOptions?: ApiQueryOptions<Client['getBasket']>) => UseQueryResult<DataType<Client['getBasket']>>;
|
|
14
16
|
/**
|
|
15
17
|
* Gets applicable payment methods for an existing basket considering the open payment amount only.
|
|
18
|
+
* @group ShopperBaskets
|
|
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 Baskets `getPaymentMethodsForBasket` endpoint.
|
|
@@ -23,6 +27,8 @@ export declare const useBasket: (apiOptions: NullableParameters<Argument<Client[
|
|
|
23
27
|
export declare const usePaymentMethodsForBasket: (apiOptions: NullableParameters<Argument<Client['getPaymentMethodsForBasket']>>, queryOptions?: ApiQueryOptions<Client['getPaymentMethodsForBasket']>) => UseQueryResult<DataType<Client['getPaymentMethodsForBasket']>>;
|
|
24
28
|
/**
|
|
25
29
|
* Gets applicable price books for an existing basket.
|
|
30
|
+
* @group ShopperBaskets
|
|
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 Baskets `getPriceBooksForBasket` endpoint.
|
|
@@ -33,6 +39,8 @@ export declare const usePaymentMethodsForBasket: (apiOptions: NullableParameters
|
|
|
33
39
|
export declare const usePriceBooksForBasket: (apiOptions: NullableParameters<Argument<Client['getPriceBooksForBasket']>>, queryOptions?: ApiQueryOptions<Client['getPriceBooksForBasket']>) => UseQueryResult<DataType<Client['getPriceBooksForBasket']>>;
|
|
34
40
|
/**
|
|
35
41
|
* Gets the applicable shipping methods for a certain shipment of a basket.
|
|
42
|
+
* @group ShopperBaskets
|
|
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 Baskets `getShippingMethodsForShipment` endpoint.
|
|
@@ -43,6 +51,8 @@ export declare const usePriceBooksForBasket: (apiOptions: NullableParameters<Arg
|
|
|
43
51
|
export declare const useShippingMethodsForShipment: (apiOptions: NullableParameters<Argument<Client['getShippingMethodsForShipment']>>, queryOptions?: ApiQueryOptions<Client['getShippingMethodsForShipment']>) => UseQueryResult<DataType<Client['getShippingMethodsForShipment']>>;
|
|
44
52
|
/**
|
|
45
53
|
* This method gives you the external taxation data set by the PUT taxes API. This endpoint can be called only if external taxation mode was used for basket creation. See POST /baskets for more information.
|
|
54
|
+
* @group ShopperBaskets
|
|
55
|
+
* @category Query
|
|
46
56
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
47
57
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
48
58
|
* @returns A TanStack Query query hook with data from the Shopper Baskets `getTaxesFromBasket` endpoint.
|
|
@@ -20,6 +20,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* Gets a basket.
|
|
23
|
+
* @group ShopperBaskets
|
|
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 Baskets `getBasket` endpoint.
|
|
@@ -58,6 +60,8 @@ const useBasket = (apiOptions, queryOptions = {}) => {
|
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Gets applicable payment methods for an existing basket considering the open payment amount only.
|
|
63
|
+
* @group ShopperBaskets
|
|
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 Baskets `getPaymentMethodsForBasket` endpoint.
|
|
@@ -97,6 +101,8 @@ const usePaymentMethodsForBasket = (apiOptions, queryOptions = {}) => {
|
|
|
97
101
|
};
|
|
98
102
|
/**
|
|
99
103
|
* Gets applicable price books for an existing basket.
|
|
104
|
+
* @group ShopperBaskets
|
|
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 Baskets `getPriceBooksForBasket` endpoint.
|
|
@@ -136,6 +142,8 @@ const usePriceBooksForBasket = (apiOptions, queryOptions = {}) => {
|
|
|
136
142
|
};
|
|
137
143
|
/**
|
|
138
144
|
* Gets the applicable shipping methods for a certain shipment of a basket.
|
|
145
|
+
* @group ShopperBaskets
|
|
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 Baskets `getShippingMethodsForShipment` endpoint.
|
|
@@ -175,6 +183,8 @@ const useShippingMethodsForShipment = (apiOptions, queryOptions = {}) => {
|
|
|
175
183
|
};
|
|
176
184
|
/**
|
|
177
185
|
* This method gives you the external taxation data set by the PUT taxes API. This endpoint can be called only if external taxation mode was used for basket creation. See POST /baskets for more information.
|
|
186
|
+
* @group ShopperBaskets
|
|
187
|
+
* @category Query
|
|
178
188
|
* @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
|
|
179
189
|
* @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
|
|
180
190
|
* @returns A TanStack Query query hook with data from the Shopper Baskets `getTaxesFromBasket` endpoint.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ShopperBaskets } from 'commerce-sdk-isomorphic';
|
|
2
2
|
import { Argument, ExcludeTail } from '../types';
|
|
3
|
-
|
|
3
|
+
type Client = ShopperBaskets<{
|
|
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
|
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
|
-
|
|
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
|
-
|
|
2
|
+
type Client = ApiClients['shopperContexts'];
|
|
3
3
|
export declare const cacheUpdateMatrix: CacheUpdateMatrix<Client>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
import { ApiClients, Argument, DataType } from '../types';
|
|
2
2
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
-
|
|
4
|
-
/**
|
|
3
|
+
type Client = ApiClients['shopperContexts'];
|
|
4
|
+
/**
|
|
5
|
+
* Mutation for Shopper Contexts.
|
|
6
|
+
* @group ShopperContexts
|
|
7
|
+
* @category Mutation
|
|
8
|
+
* @enum
|
|
9
|
+
*/
|
|
5
10
|
export declare const ShopperContextsMutations: {
|
|
6
11
|
/**
|
|
7
12
|
* Creates the shopper's context based on shopperJWT.
|
|
8
13
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Contexts `createShopperContext` endpoint.
|
|
9
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-contexts?meta=createShopperContext| Salesforce Developer Center} for more information about the API endpoint.
|
|
10
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shoppercontexts.shoppercontexts-1.html#createshoppercontext | `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 CreateShopperContext: "createShopperContext";
|
|
14
16
|
/**
|
|
15
17
|
* Gets the shopper's context based on the shopperJWT.
|
|
16
18
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Contexts `deleteShopperContext` endpoint.
|
|
17
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-contexts?meta=deleteShopperContext| Salesforce Developer Center} for more information about the API endpoint.
|
|
18
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shoppercontexts.shoppercontexts-1.html#deleteshoppercontext | `commerce-sdk-isomorphic` documentation} for more information on the parameters and returned data type.
|
|
19
|
-
* @see {@link https://tanstack.com/query/latest/docs/react/reference/useMutation | TanStack Query `useMutation` reference} for more information about the return value.
|
|
20
19
|
*/
|
|
21
20
|
readonly DeleteShopperContext: "deleteShopperContext";
|
|
22
21
|
/**
|
|
23
22
|
* Updates the shopper's context based on the Shopper JWT. If the shopper context exists, it's updated with the patch body. If a customer qualifier or an `effectiveDateTime` is already present in the existing shopper context, its value is replaced by the corresponding value from the patch body. If a customer qualifers' value is set to `null` it's deleted from existing shopper context. If `effectiveDateTime` value is set to set to an empty string (\"\"), it's deleted from existing shopper context. If `effectiveDateTime` value is set to `null` it's ignored. If an `effectiveDateTime` or customer qualifiiers' value is new, it's added to the existing Shopper context.
|
|
24
23
|
* @returns A TanStack Query mutation hook for interacting with the Shopper Contexts `updateShopperContext` endpoint.
|
|
25
|
-
* @see {@link https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-contexts?meta=updateShopperContext| Salesforce Developer Center} for more information about the API endpoint.
|
|
26
|
-
* @see {@link https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/classes/shoppercontexts.shoppercontexts-1.html#updateshoppercontext | `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
24
|
*/
|
|
29
25
|
readonly UpdateShopperContext: "updateShopperContext";
|
|
30
26
|
};
|
|
31
|
-
/**
|
|
32
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Mutation for Shopper Contexts.
|
|
29
|
+
* @group ShopperContexts
|
|
30
|
+
* @category Mutation
|
|
31
|
+
*/
|
|
32
|
+
export type ShopperContextsMutation = (typeof ShopperContextsMutations)[keyof typeof ShopperContextsMutations];
|
|
33
|
+
/**
|
|
34
|
+
* Mutation hook for Shopper Contexts.
|
|
35
|
+
* @group ShopperContexts
|
|
36
|
+
* @category Mutation
|
|
37
|
+
*/
|
|
33
38
|
export declare function useShopperContextsMutation<Mutation extends ShopperContextsMutation>(mutation: Mutation): UseMutationResult<DataType<Client[Mutation]>, unknown, Argument<Client[Mutation]>>;
|
|
34
39
|
export {};
|
|
35
40
|
//# sourceMappingURL=mutation.d.ts.map
|