@salesforce/commerce-sdk-react 3.5.0-preview.1 → 4.0.0-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/README.md +21 -3
  3. package/auth/index.d.ts +127 -57
  4. package/auth/index.js +162 -107
  5. package/components/StorefrontPreview/utils.js +3 -2
  6. package/constant.d.ts +0 -16
  7. package/constant.js +1 -20
  8. package/hooks/ShopperBaskets/helpers.d.ts +32 -21
  9. package/hooks/ShopperBaskets/queryKeyHelpers.js +10 -10
  10. package/hooks/ShopperContexts/queryKeyHelpers.js +2 -2
  11. package/hooks/ShopperCustomers/queryKeyHelpers.js +22 -22
  12. package/hooks/ShopperExperience/queryKeyHelpers.js +4 -4
  13. package/hooks/ShopperGiftCertificates/queryKeyHelpers.js +2 -2
  14. package/hooks/ShopperLogin/queryKeyHelpers.js +6 -6
  15. package/hooks/ShopperOrders/queryKeyHelpers.js +6 -6
  16. package/hooks/ShopperProducts/queryKeyHelpers.js +8 -8
  17. package/hooks/ShopperPromotions/queryKeyHelpers.js +4 -4
  18. package/hooks/{ShopperSeo → ShopperSEO}/query.d.ts +1 -1
  19. package/hooks/{ShopperSeo → ShopperSEO}/query.js +3 -3
  20. package/hooks/{ShopperSeo → ShopperSEO}/queryKeyHelpers.d.ts +2 -2
  21. package/hooks/{ShopperSeo → ShopperSEO}/queryKeyHelpers.js +2 -2
  22. package/hooks/ShopperSearch/queryKeyHelpers.js +4 -4
  23. package/hooks/ShopperStores/queryKeyHelpers.js +4 -4
  24. package/hooks/helpers.d.ts +14 -1
  25. package/hooks/index.d.ts +1 -1
  26. package/hooks/index.js +4 -4
  27. package/hooks/types.d.ts +3 -3
  28. package/hooks/useDNT.d.ts +0 -4
  29. package/hooks/useDNT.js +0 -6
  30. package/hooks/useQuery.js +2 -0
  31. package/package.json +5 -5
  32. package/provider.d.ts +14 -2
  33. package/provider.js +19 -13
  34. package/utils.d.ts +1 -1
  35. /package/hooks/{ShopperSeo → ShopperSEO}/index.d.ts +0 -0
  36. /package/hooks/{ShopperSeo → ShopperSEO}/index.js +0 -0
@@ -19,32 +19,32 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getBasket = exports.getBasket = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/baskets/', params.basketId],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/baskets/', params === null || params === void 0 ? void 0 : params.basketId],
23
23
  queryKey: params => {
24
- return [...getBasket.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getBasket)];
24
+ return [...getBasket.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getBasket)];
25
25
  }
26
26
  };
27
27
  const getPaymentMethodsForBasket = exports.getPaymentMethodsForBasket = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/baskets/', params.basketId, '/payment-methods'],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/baskets/', params === null || params === void 0 ? void 0 : params.basketId, '/payment-methods'],
29
29
  queryKey: params => {
30
- return [...getPaymentMethodsForBasket.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getPaymentMethodsForBasket)];
30
+ return [...getPaymentMethodsForBasket.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getPaymentMethodsForBasket)];
31
31
  }
32
32
  };
33
33
  const getPriceBooksForBasket = exports.getPriceBooksForBasket = {
34
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/baskets/', params.basketId, '/price-books'],
34
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/baskets/', params === null || params === void 0 ? void 0 : params.basketId, '/price-books'],
35
35
  queryKey: params => {
36
- return [...getPriceBooksForBasket.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getPriceBooksForBasket)];
36
+ return [...getPriceBooksForBasket.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getPriceBooksForBasket)];
37
37
  }
38
38
  };
39
39
  const getShippingMethodsForShipment = exports.getShippingMethodsForShipment = {
40
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/baskets/', params.basketId, '/shipments/', params.shipmentId, '/shipping-methods'],
40
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/baskets/', params === null || params === void 0 ? void 0 : params.basketId, '/shipments/', params === null || params === void 0 ? void 0 : params.shipmentId, '/shipping-methods'],
41
41
  queryKey: params => {
42
- return [...getShippingMethodsForShipment.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getShippingMethodsForShipment)];
42
+ return [...getShippingMethodsForShipment.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getShippingMethodsForShipment)];
43
43
  }
44
44
  };
45
45
  const getTaxesFromBasket = exports.getTaxesFromBasket = {
46
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/baskets/', params.basketId, '/taxes'],
46
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/baskets/', params === null || params === void 0 ? void 0 : params.basketId, '/taxes'],
47
47
  queryKey: params => {
48
- return [...getTaxesFromBasket.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getTaxesFromBasket)];
48
+ return [...getTaxesFromBasket.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperBaskets.paramKeys.getTaxesFromBasket)];
49
49
  }
50
50
  };
@@ -19,8 +19,8 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getShopperContext = exports.getShopperContext = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/shopper-context/', params.usid],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/shopper-context/', params === null || params === void 0 ? void 0 : params.usid],
23
23
  queryKey: params => {
24
- return [...getShopperContext.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperContexts.paramKeys.getShopperContext)];
24
+ return [...getShopperContext.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperContexts.paramKeys.getShopperContext)];
25
25
  }
26
26
  };
@@ -26,68 +26,68 @@ var _utils = require("../utils");
26
26
  // }
27
27
 
28
28
  const getCustomer = exports.getCustomer = {
29
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId],
29
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId],
30
30
  queryKey: params => {
31
- return [...getCustomer.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomer)];
31
+ return [...getCustomer.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomer)];
32
32
  }
33
33
  };
34
34
  const getCustomerAddress = exports.getCustomerAddress = {
35
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/addresses/', params.addressName],
35
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/addresses/', params === null || params === void 0 ? void 0 : params.addressName],
36
36
  queryKey: params => {
37
- return [...getCustomerAddress.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerAddress)];
37
+ return [...getCustomerAddress.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerAddress)];
38
38
  }
39
39
  };
40
40
  const getCustomerBaskets = exports.getCustomerBaskets = {
41
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/baskets'],
41
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/baskets'],
42
42
  queryKey: params => {
43
- return [...getCustomerBaskets.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerBaskets)];
43
+ return [...getCustomerBaskets.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerBaskets)];
44
44
  }
45
45
  };
46
46
  const getCustomerOrders = exports.getCustomerOrders = {
47
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/orders'],
47
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/orders'],
48
48
  queryKey: params => {
49
- return [...getCustomerOrders.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerOrders)];
49
+ return [...getCustomerOrders.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerOrders)];
50
50
  }
51
51
  };
52
52
  const getCustomerPaymentInstrument = exports.getCustomerPaymentInstrument = {
53
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/payment-instruments/', params.paymentInstrumentId],
53
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/payment-instruments/', params === null || params === void 0 ? void 0 : params.paymentInstrumentId],
54
54
  queryKey: params => {
55
- return [...getCustomerPaymentInstrument.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerPaymentInstrument)];
55
+ return [...getCustomerPaymentInstrument.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerPaymentInstrument)];
56
56
  }
57
57
  };
58
58
  const getCustomerProductLists = exports.getCustomerProductLists = {
59
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/product-lists'],
59
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/product-lists'],
60
60
  queryKey: params => {
61
- return [...getCustomerProductLists.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductLists)];
61
+ return [...getCustomerProductLists.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductLists)];
62
62
  }
63
63
  };
64
64
  const getCustomerProductList = exports.getCustomerProductList = {
65
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/product-lists/', params.listId],
65
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/product-lists/', params === null || params === void 0 ? void 0 : params.listId],
66
66
  queryKey: params => {
67
- return [...getCustomerProductList.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductList)];
67
+ return [...getCustomerProductList.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductList)];
68
68
  }
69
69
  };
70
70
  const getCustomerProductListItem = exports.getCustomerProductListItem = {
71
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/customers/', params.customerId, '/product-lists/', params.listId, '/items/', params.itemId],
71
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/customers/', params === null || params === void 0 ? void 0 : params.customerId, '/product-lists/', params === null || params === void 0 ? void 0 : params.listId, '/items/', params === null || params === void 0 ? void 0 : params.itemId],
72
72
  queryKey: params => {
73
- return [...getCustomerProductListItem.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductListItem)];
73
+ return [...getCustomerProductListItem.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getCustomerProductListItem)];
74
74
  }
75
75
  };
76
76
  const getPublicProductListsBySearchTerm = exports.getPublicProductListsBySearchTerm = {
77
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/product-lists'],
77
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/product-lists'],
78
78
  queryKey: params => {
79
- return [...getPublicProductListsBySearchTerm.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getPublicProductListsBySearchTerm)];
79
+ return [...getPublicProductListsBySearchTerm.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getPublicProductListsBySearchTerm)];
80
80
  }
81
81
  };
82
82
  const getPublicProductList = exports.getPublicProductList = {
83
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/product-lists/', params.listId],
83
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/product-lists/', params === null || params === void 0 ? void 0 : params.listId],
84
84
  queryKey: params => {
85
- return [...getPublicProductList.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getPublicProductList)];
85
+ return [...getPublicProductList.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getPublicProductList)];
86
86
  }
87
87
  };
88
88
  const getProductListItem = exports.getProductListItem = {
89
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/product-lists/', params.listId, '/items/', params.itemId],
89
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/product-lists/', params === null || params === void 0 ? void 0 : params.listId, '/items/', params === null || params === void 0 ? void 0 : params.itemId],
90
90
  queryKey: params => {
91
- return [...getProductListItem.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getProductListItem)];
91
+ return [...getProductListItem.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperCustomers.paramKeys.getProductListItem)];
92
92
  }
93
93
  };
@@ -19,14 +19,14 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getPages = exports.getPages = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/pages'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/pages'],
23
23
  queryKey: params => {
24
- return [...getPages.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperExperience.paramKeys.getPages)];
24
+ return [...getPages.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperExperience.paramKeys.getPages)];
25
25
  }
26
26
  };
27
27
  const getPage = exports.getPage = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/pages/', params.pageId],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/pages/', params === null || params === void 0 ? void 0 : params.pageId],
29
29
  queryKey: params => {
30
- return [...getPage.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperExperience.paramKeys.getPage)];
30
+ return [...getPage.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperExperience.paramKeys.getPage)];
31
31
  }
32
32
  };
@@ -19,8 +19,8 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getGiftCertificate = exports.getGiftCertificate = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/gift-certificate'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/gift-certificate'],
23
23
  queryKey: params => {
24
- return [...getGiftCertificate.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperGiftCertificates.paramKeys.getGiftCertificate)];
24
+ return [...getGiftCertificate.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperGiftCertificates.paramKeys.getGiftCertificate)];
25
25
  }
26
26
  };
@@ -19,20 +19,20 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getUserInfo = exports.getUserInfo = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/oauth2/userinfo'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/oauth2/userinfo'],
23
23
  queryKey: params => {
24
- return [...getUserInfo.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getUserInfo)];
24
+ return [...getUserInfo.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getUserInfo)];
25
25
  }
26
26
  };
27
27
  const getWellknownOpenidConfiguration = exports.getWellknownOpenidConfiguration = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/oauth2/.well-known/openid-configuration'],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/oauth2/.well-known/openid-configuration'],
29
29
  queryKey: params => {
30
- return [...getWellknownOpenidConfiguration.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getWellknownOpenidConfiguration)];
30
+ return [...getWellknownOpenidConfiguration.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getWellknownOpenidConfiguration)];
31
31
  }
32
32
  };
33
33
  const getJwksUri = exports.getJwksUri = {
34
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/oauth2/jwks'],
34
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/oauth2/jwks'],
35
35
  queryKey: params => {
36
- return [...getJwksUri.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getJwksUri)];
36
+ return [...getJwksUri.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperLogin.paramKeys.getJwksUri)];
37
37
  }
38
38
  };
@@ -19,20 +19,20 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getOrder = exports.getOrder = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/orders/', params.orderNo],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/orders/', params === null || params === void 0 ? void 0 : params.orderNo],
23
23
  queryKey: params => {
24
- return [...getOrder.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getOrder)];
24
+ return [...getOrder.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getOrder)];
25
25
  }
26
26
  };
27
27
  const getPaymentMethodsForOrder = exports.getPaymentMethodsForOrder = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/orders/', params.orderNo, '/payment-methods'],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/orders/', params === null || params === void 0 ? void 0 : params.orderNo, '/payment-methods'],
29
29
  queryKey: params => {
30
- return [...getPaymentMethodsForOrder.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getPaymentMethodsForOrder)];
30
+ return [...getPaymentMethodsForOrder.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getPaymentMethodsForOrder)];
31
31
  }
32
32
  };
33
33
  const getTaxesFromOrder = exports.getTaxesFromOrder = {
34
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/orders/', params.orderNo, '/taxes'],
34
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/orders/', params === null || params === void 0 ? void 0 : params.orderNo, '/taxes'],
35
35
  queryKey: params => {
36
- return [...getTaxesFromOrder.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getTaxesFromOrder)];
36
+ return [...getTaxesFromOrder.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperOrders.paramKeys.getTaxesFromOrder)];
37
37
  }
38
38
  };
@@ -19,26 +19,26 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getProducts = exports.getProducts = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/products'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/products'],
23
23
  queryKey: params => {
24
- return [...getProducts.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getProducts)];
24
+ return [...getProducts.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getProducts)];
25
25
  }
26
26
  };
27
27
  const getProduct = exports.getProduct = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/products/', params.id],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/products/', params === null || params === void 0 ? void 0 : params.id],
29
29
  queryKey: params => {
30
- return [...getProduct.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getProduct)];
30
+ return [...getProduct.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getProduct)];
31
31
  }
32
32
  };
33
33
  const getCategories = exports.getCategories = {
34
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/categories'],
34
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/categories'],
35
35
  queryKey: params => {
36
- return [...getCategories.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getCategories)];
36
+ return [...getCategories.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getCategories)];
37
37
  }
38
38
  };
39
39
  const getCategory = exports.getCategory = {
40
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/categories/', params.id],
40
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/categories/', params === null || params === void 0 ? void 0 : params.id],
41
41
  queryKey: params => {
42
- return [...getCategory.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getCategory)];
42
+ return [...getCategory.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperProducts.paramKeys.getCategory)];
43
43
  }
44
44
  };
@@ -19,14 +19,14 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getPromotions = exports.getPromotions = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/promotions'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/promotions'],
23
23
  queryKey: params => {
24
- return [...getPromotions.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperPromotions.paramKeys.getPromotions)];
24
+ return [...getPromotions.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperPromotions.paramKeys.getPromotions)];
25
25
  }
26
26
  };
27
27
  const getPromotionsForCampaign = exports.getPromotionsForCampaign = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/promotions/campaigns/', params.campaignId],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/promotions/campaigns/', params === null || params === void 0 ? void 0 : params.campaignId],
29
29
  queryKey: params => {
30
- return [...getPromotionsForCampaign.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperPromotions.paramKeys.getPromotionsForCampaign)];
30
+ return [...getPromotionsForCampaign.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperPromotions.paramKeys.getPromotionsForCampaign)];
31
31
  }
32
32
  };
@@ -7,7 +7,7 @@ type Client = NonNullable<ApiClients[typeof CLIENT_KEY]>;
7
7
  *
8
8
  * The mapping information is based on URL rules and redirects set up in Business Manager.
9
9
  * For more information about prerequisites and sample usage, see [URL Resolution](https://developer.salesforce.com/docs/commerce/commerce-api/guide/url-resolution.html). You can customize the behavior of this endpoint by using hooks.
10
- * @group ShopperSeo
10
+ * @group ShopperSEO
11
11
  * @category Query
12
12
  * @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
13
13
  * @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
@@ -31,7 +31,7 @@ const CLIENT_KEY = _constant.CLIENT_KEYS.SHOPPER_SEO;
31
31
  *
32
32
  * The mapping information is based on URL rules and redirects set up in Business Manager.
33
33
  * For more information about prerequisites and sample usage, see [URL Resolution](https://developer.salesforce.com/docs/commerce/commerce-api/guide/url-resolution.html). You can customize the behavior of this endpoint by using hooks.
34
- * @group ShopperSeo
34
+ * @group ShopperSEO
35
35
  * @category Query
36
36
  * @parameter apiOptions - Options to pass through to `commerce-sdk-isomorphic`, with `null` accepted for unset API parameters.
37
37
  * @parameter queryOptions - TanStack Query query options, with `enabled` by default set to check that all required API parameters have been set.
@@ -43,12 +43,12 @@ const CLIENT_KEY = _constant.CLIENT_KEYS.SHOPPER_SEO;
43
43
  const useUrlMapping = (apiOptions, queryOptions = {}) => {
44
44
  const client = (0, _useCommerceApi.default)(CLIENT_KEY);
45
45
  const methodName = 'getUrlMapping';
46
- const requiredParameters = _commerceSdkIsomorphic.ShopperSeo.paramKeys[`${methodName}Required`];
46
+ const requiredParameters = _commerceSdkIsomorphic.ShopperSEO.paramKeys[`${methodName}Required`];
47
47
 
48
48
  // Parameters can be set in `apiOptions` or `client.clientConfig`;
49
49
  // we must merge them in order to generate the correct query key.
50
50
  const netOptions = (0, _utils.omitNullableParameters)((0, _utils.mergeOptions)(client, apiOptions));
51
- const parameters = (0, _utils.pickValidParams)(netOptions.parameters, _commerceSdkIsomorphic.ShopperSeo.paramKeys[methodName]);
51
+ const parameters = (0, _utils.pickValidParams)(netOptions.parameters, _commerceSdkIsomorphic.ShopperSEO.paramKeys[methodName]);
52
52
  const queryKey = queryKeyHelpers[methodName].queryKey(netOptions.parameters);
53
53
  // We don't use `netOptions` here because we manipulate the options in `useQuery`.
54
54
  const method = /*#__PURE__*/function () {
@@ -1,6 +1,6 @@
1
- import { ShopperSeo } from 'commerce-sdk-isomorphic';
1
+ import { ShopperSEO } from 'commerce-sdk-isomorphic';
2
2
  import { Argument, ExcludeTail } from '../types';
3
- type Client = ShopperSeo<{
3
+ type Client = ShopperSEO<{
4
4
  shortCode: string;
5
5
  }>;
6
6
  type Params<T extends keyof QueryKeys> = Partial<Argument<Client[T]>['parameters']>;
@@ -19,8 +19,8 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const getUrlMapping = exports.getUrlMapping = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/url-mapping'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/url-mapping'],
23
23
  queryKey: params => {
24
- return [...getUrlMapping.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperSeo.paramKeys.getUrlMapping)];
24
+ return [...getUrlMapping.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperSEO.paramKeys.getUrlMapping)];
25
25
  }
26
26
  };
@@ -19,14 +19,14 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const productSearch = exports.productSearch = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/product-search'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/product-search'],
23
23
  queryKey: params => {
24
- return [...productSearch.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperSearch.paramKeys.productSearch)];
24
+ return [...productSearch.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperSearch.paramKeys.productSearch)];
25
25
  }
26
26
  };
27
27
  const getSearchSuggestions = exports.getSearchSuggestions = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/search-suggestions'],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/search-suggestions'],
29
29
  queryKey: params => {
30
- return [...getSearchSuggestions.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperSearch.paramKeys.getSearchSuggestions)];
30
+ return [...getSearchSuggestions.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperSearch.paramKeys.getSearchSuggestions)];
31
31
  }
32
32
  };
@@ -19,14 +19,14 @@ var _utils = require("../utils");
19
19
  // and making those generic would add too much complexity.
20
20
 
21
21
  const searchStores = exports.searchStores = {
22
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/store-search'],
22
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/store-search'],
23
23
  queryKey: params => {
24
- return [...searchStores.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperStores.paramKeys.searchStores)];
24
+ return [...searchStores.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperStores.paramKeys.searchStores)];
25
25
  }
26
26
  };
27
27
  const getStores = exports.getStores = {
28
- path: params => ['/commerce-sdk-react', '/organizations/', params.organizationId, '/stores'],
28
+ path: params => ['/commerce-sdk-react', '/organizations/', params === null || params === void 0 ? void 0 : params.organizationId, '/stores'],
29
29
  queryKey: params => {
30
- return [...getStores.path(params), (0, _utils.pickValidParams)(params, _commerceSdkIsomorphic.ShopperStores.paramKeys.getStores)];
30
+ return [...getStores.path(params), (0, _utils.pickValidParams)(params || {}, _commerceSdkIsomorphic.ShopperStores.paramKeys.getStores)];
31
31
  }
32
32
  };
@@ -9,7 +9,20 @@ import { OptionalCustomEndpointClientConfig, TMutationVariables } from './types'
9
9
  * @param error - the error
10
10
  * @returns a new guest access token
11
11
  */
12
- export declare const handleInvalidToken: (error: any, auth: Auth, logger: Logger) => Promise<import("commerce-sdk-isomorphic").ShopperLoginTypes.TokenResponse>;
12
+ export declare const handleInvalidToken: (error: any, auth: Auth, logger: Logger) => Promise<{
13
+ access_token: string;
14
+ id_token: string;
15
+ refresh_token: string;
16
+ expires_in: number;
17
+ refresh_token_expires_in: number;
18
+ token_type: "Bearer";
19
+ usid: string;
20
+ customer_id: string;
21
+ enc_user_id: string;
22
+ idp_access_token: string;
23
+ } & {
24
+ [key: string]: any;
25
+ }>;
13
26
  /**
14
27
  * A helper function for preparing a call to the SCAPI custom API endpoint
15
28
  */
package/hooks/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export * from './ShopperProducts';
9
9
  export * from './ShopperPromotions';
10
10
  export * from './ShopperSearch';
11
11
  export * from './ShopperStores';
12
- export * from './ShopperSeo';
12
+ export * from './ShopperSEO';
13
13
  export * from './useAuthHelper';
14
14
  export { default as useAccessToken } from './useAccessToken';
15
15
  export { default as useCommerceApi } from './useCommerceApi';
package/hooks/index.js CHANGED
@@ -214,15 +214,15 @@ Object.keys(_ShopperStores).forEach(function (key) {
214
214
  }
215
215
  });
216
216
  });
217
- var _ShopperSeo = require("./ShopperSeo");
218
- Object.keys(_ShopperSeo).forEach(function (key) {
217
+ var _ShopperSEO = require("./ShopperSEO");
218
+ Object.keys(_ShopperSEO).forEach(function (key) {
219
219
  if (key === "default" || key === "__esModule") return;
220
220
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
221
- if (key in exports && exports[key] === _ShopperSeo[key]) return;
221
+ if (key in exports && exports[key] === _ShopperSEO[key]) return;
222
222
  Object.defineProperty(exports, key, {
223
223
  enumerable: true,
224
224
  get: function () {
225
- return _ShopperSeo[key];
225
+ return _ShopperSEO[key];
226
226
  }
227
227
  });
228
228
  });
package/hooks/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InvalidateQueryFilters, QueryFilters, Updater, UseQueryOptions } from '@tanstack/react-query';
2
- import { ShopperBaskets, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperLogin, ShopperOrders, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSeo, ShopperStores } from 'commerce-sdk-isomorphic';
2
+ import { ShopperBaskets, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperLogin, ShopperOrders, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSEO, ShopperStores } from 'commerce-sdk-isomorphic';
3
3
  import { helpers } from 'commerce-sdk-isomorphic';
4
4
  import { CommerceApiProviderProps } from '../provider';
5
5
  /** Makes a type easier to read. */
@@ -57,7 +57,7 @@ export interface ApiClients {
57
57
  shopperProducts?: ShopperProducts<ApiClientConfigParams>;
58
58
  shopperPromotions?: ShopperPromotions<ApiClientConfigParams>;
59
59
  shopperSearch?: ShopperSearch<ApiClientConfigParams>;
60
- shopperSeo?: ShopperSeo<ApiClientConfigParams>;
60
+ shopperSeo?: ShopperSEO<ApiClientConfigParams>;
61
61
  shopperStores?: ShopperStores<ApiClientConfigParams>;
62
62
  }
63
63
  export type ApiClient = NonNullable<ApiClients[keyof ApiClients]>;
@@ -90,7 +90,7 @@ export type DataType<T> = T extends ApiMethod<any, Response | infer R> ? R : nev
90
90
  */
91
91
  export type MergedOptions<Client extends ApiClient, Options extends ApiOptions> = Required<ApiOptions<NonNullable<Client['clientConfig']['parameters'] & Options['parameters']>, unknown extends Options['body'] ? never : Options['body'], NonNullable<Client['clientConfig']['headers'] & Options['headers']>>>;
92
92
  /** Query key interface used by API query hooks. */
93
- export type ApiQueryKey<Params extends Record<string, unknown> = Record<string, unknown>> = readonly [...path: (string | undefined)[], parameters: Params];
93
+ export type ApiQueryKey<Params extends Record<string, unknown> | undefined = Record<string, unknown> | undefined> = readonly [...path: (string | undefined)[], parameters: Params];
94
94
  /** Query options for endpoint hooks. */
95
95
  export type ApiQueryOptions<Method extends ApiMethod<any, unknown>> = Prettify<Omit<UseQueryOptions<DataType<Method>, unknown, DataType<Method>, ApiQueryKey>, 'queryFn' | 'queryKey'>>;
96
96
  /** Adds `null` as an allowed value to all parameters. */
package/hooks/useDNT.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  interface useDntReturn {
2
2
  selectedDnt: boolean | undefined;
3
- dntStatus: boolean | undefined;
4
3
  effectiveDnt: boolean | undefined;
5
- updateDNT: (preference: boolean | null) => Promise<void>;
6
4
  updateDnt: (preference: boolean | null) => Promise<void>;
7
5
  }
8
6
  /**
@@ -17,8 +15,6 @@ interface useDntReturn {
17
15
  * If defaultDnt is undefined as well, then SDK default is used.
18
16
  * @property {function} updateDnt - takes a DNT choice and creates the dw_dnt
19
17
  * cookie and reauthorizes with SLAS
20
- * @property {function} updateDNT - @deprecated Deprecated since version 3.1.0. Use updateDnt instead.
21
- * @property {boolean} dntStatus - @deprecated Deprecated since version 3.1.0. Use selectedDnt instead.
22
18
  *
23
19
  *
24
20
  */
package/hooks/useDNT.js CHANGED
@@ -25,8 +25,6 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
25
25
  * If defaultDnt is undefined as well, then SDK default is used.
26
26
  * @property {function} updateDnt - takes a DNT choice and creates the dw_dnt
27
27
  * cookie and reauthorizes with SLAS
28
- * @property {function} updateDNT - @deprecated Deprecated since version 3.1.0. Use updateDnt instead.
29
- * @property {boolean} dntStatus - @deprecated Deprecated since version 3.1.0. Use selectedDnt instead.
30
28
  *
31
29
  *
32
30
  */
@@ -44,13 +42,9 @@ const useDNT = () => {
44
42
  return _ref.apply(this, arguments);
45
43
  };
46
44
  }();
47
- const updateDNT = updateDnt;
48
- const dntStatus = selectedDnt;
49
45
  return {
50
46
  selectedDnt,
51
47
  effectiveDnt,
52
- dntStatus,
53
- updateDNT,
54
48
  updateDnt
55
49
  };
56
50
  };
package/hooks/useQuery.js CHANGED
@@ -51,6 +51,8 @@ const useQuery = (apiOptions, queryOptions, hookConfig) => {
51
51
  return _ref.apply(this, arguments);
52
52
  };
53
53
  }();
54
+
55
+ // TODO: replace `as any`
54
56
  return (0, _reactQuery.useQuery)(hookConfig.queryKey, wrappedMethod, _objectSpread(_objectSpread(_objectSpread({
55
57
  enabled:
56
58
  // Individual hooks can provide `enabled` checks that are done in ADDITION to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/commerce-sdk-react",
3
- "version": "3.5.0-preview.1",
3
+ "version": "4.0.0-dev",
4
4
  "description": "A library that provides react hooks for fetching data from Commerce Cloud",
5
5
  "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
6
6
  "bugs": {
@@ -40,12 +40,12 @@
40
40
  "version": "node ./scripts/version.js"
41
41
  },
42
42
  "dependencies": {
43
- "commerce-sdk-isomorphic": "^3.4.0",
43
+ "commerce-sdk-isomorphic": "^4.0.0",
44
44
  "js-cookie": "^3.0.1",
45
45
  "jwt-decode": "^4.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@salesforce/pwa-kit-dev": "3.12.0-preview.1",
48
+ "@salesforce/pwa-kit-dev": "3.12.0-dev",
49
49
  "@tanstack/react-query": "^4.28.0",
50
50
  "@testing-library/jest-dom": "^5.16.5",
51
51
  "@testing-library/react": "^14.0.0",
@@ -60,7 +60,7 @@
60
60
  "@types/react-helmet": "~6.1.6",
61
61
  "@types/react-router-dom": "~5.3.3",
62
62
  "cross-env": "^5.2.1",
63
- "internal-lib-build": "3.12.0-preview.1",
63
+ "internal-lib-build": "3.12.0-dev",
64
64
  "jsonwebtoken": "^9.0.0",
65
65
  "nock": "^13.3.0",
66
66
  "nodemon": "^2.0.22",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "directory": "dist"
92
92
  },
93
- "gitHead": "0f66d26584f98d3322bffcb70e7feed08c81cc7a"
93
+ "gitHead": "60d9a47ad71824709be52bbe1110b092f7698244"
94
94
  }