commerce-sdk-isomorphic 4.0.1-preview-shopper-configurations.0 → 4.0.1

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 (90) hide show
  1. package/README.md +3 -61
  2. package/lib/index.cjs.d.ts +6 -748
  3. package/lib/index.cjs.js +1 -1
  4. package/lib/index.esm.d.ts +6 -748
  5. package/lib/index.esm.js +1 -1
  6. package/package.json +27 -94
  7. package/lib/clientConfig.cjs.d.ts +0 -52
  8. package/lib/clientConfig.cjs.js +0 -1
  9. package/lib/clientConfig.d.ts +0 -52
  10. package/lib/clientConfig.js +0 -1
  11. package/lib/config.cjs.d.ts +0 -2
  12. package/lib/config.cjs.js +0 -1
  13. package/lib/config.d.ts +0 -2
  14. package/lib/config.js +0 -1
  15. package/lib/helpers.cjs.d.ts +0 -2225
  16. package/lib/helpers.cjs.js +0 -1
  17. package/lib/helpers.d.ts +0 -2225
  18. package/lib/helpers.js +0 -1
  19. package/lib/responseError.cjs.d.ts +0 -12
  20. package/lib/responseError.cjs.js +0 -1
  21. package/lib/responseError.d.ts +0 -12
  22. package/lib/responseError.js +0 -1
  23. package/lib/shopperBaskets.cjs.d.ts +0 -10259
  24. package/lib/shopperBaskets.cjs.js +0 -1
  25. package/lib/shopperBaskets.d.ts +0 -10259
  26. package/lib/shopperBaskets.js +0 -1
  27. package/lib/shopperBasketsv2.cjs.d.ts +0 -10453
  28. package/lib/shopperBasketsv2.cjs.js +0 -1
  29. package/lib/shopperBasketsv2.d.ts +0 -10453
  30. package/lib/shopperBasketsv2.js +0 -1
  31. package/lib/shopperConfigurations.cjs.d.ts +0 -601
  32. package/lib/shopperConfigurations.cjs.js +0 -1
  33. package/lib/shopperConfigurations.d.ts +0 -601
  34. package/lib/shopperConfigurations.js +0 -1
  35. package/lib/shopperConsents.cjs.d.ts +0 -1142
  36. package/lib/shopperConsents.cjs.js +0 -1
  37. package/lib/shopperConsents.d.ts +0 -1142
  38. package/lib/shopperConsents.js +0 -1
  39. package/lib/shopperContext.cjs.d.ts +0 -1401
  40. package/lib/shopperContext.cjs.js +0 -1
  41. package/lib/shopperContext.d.ts +0 -1401
  42. package/lib/shopperContext.js +0 -1
  43. package/lib/shopperCustomers.cjs.d.ts +0 -12425
  44. package/lib/shopperCustomers.cjs.js +0 -1
  45. package/lib/shopperCustomers.d.ts +0 -12425
  46. package/lib/shopperCustomers.js +0 -1
  47. package/lib/shopperExperience.cjs.d.ts +0 -1169
  48. package/lib/shopperExperience.cjs.js +0 -1
  49. package/lib/shopperExperience.d.ts +0 -1169
  50. package/lib/shopperExperience.js +0 -1
  51. package/lib/shopperGiftCertificates.cjs.d.ts +0 -729
  52. package/lib/shopperGiftCertificates.cjs.js +0 -1
  53. package/lib/shopperGiftCertificates.d.ts +0 -729
  54. package/lib/shopperGiftCertificates.js +0 -1
  55. package/lib/shopperLogin.cjs.d.ts +0 -3842
  56. package/lib/shopperLogin.cjs.js +0 -1
  57. package/lib/shopperLogin.d.ts +0 -3842
  58. package/lib/shopperLogin.js +0 -1
  59. package/lib/shopperOrders.cjs.d.ts +0 -5393
  60. package/lib/shopperOrders.cjs.js +0 -1
  61. package/lib/shopperOrders.d.ts +0 -5393
  62. package/lib/shopperOrders.js +0 -1
  63. package/lib/shopperProducts.cjs.d.ts +0 -3479
  64. package/lib/shopperProducts.cjs.js +0 -1
  65. package/lib/shopperProducts.d.ts +0 -3479
  66. package/lib/shopperProducts.js +0 -1
  67. package/lib/shopperPromotions.cjs.d.ts +0 -1001
  68. package/lib/shopperPromotions.cjs.js +0 -1
  69. package/lib/shopperPromotions.d.ts +0 -1001
  70. package/lib/shopperPromotions.js +0 -1
  71. package/lib/shopperSearch.cjs.d.ts +0 -3352
  72. package/lib/shopperSearch.cjs.js +0 -1
  73. package/lib/shopperSearch.d.ts +0 -3352
  74. package/lib/shopperSearch.js +0 -1
  75. package/lib/shopperSeo.cjs.d.ts +0 -769
  76. package/lib/shopperSeo.cjs.js +0 -1
  77. package/lib/shopperSeo.d.ts +0 -769
  78. package/lib/shopperSeo.js +0 -1
  79. package/lib/shopperStores.cjs.d.ts +0 -1289
  80. package/lib/shopperStores.cjs.js +0 -1
  81. package/lib/shopperStores.d.ts +0 -1289
  82. package/lib/shopperStores.js +0 -1
  83. package/lib/templateUrl.cjs.d.ts +0 -76
  84. package/lib/templateUrl.cjs.js +0 -1
  85. package/lib/templateUrl.d.ts +0 -76
  86. package/lib/templateUrl.js +0 -1
  87. package/lib/version.cjs.d.ts +0 -3
  88. package/lib/version.cjs.js +0 -1
  89. package/lib/version.d.ts +0 -3
  90. package/lib/version.js +0 -1
package/README.md CHANGED
@@ -51,31 +51,19 @@ In the next major version release, the SDK will encode special characters (UTF-8
51
51
 
52
52
  ### Requirements
53
53
 
54
- - Node `^20.x` or `^22.x`
54
+ - Node `^12.x`, `^14.x`, `^16.x`, `^18.x`
55
55
  - The SDK requires B2C Commerce API (SCAPI) to be configured. For more info see [Getting started with SCAPI](https://developer.salesforce.com/docs/commerce/commerce-api/guide/get-started.html).
56
56
 
57
57
  ### Installation
58
58
 
59
59
  ```bash
60
- # This package uses yarn, if you don't have yarn:
61
- # npm install -g yarn
62
- yarn install commerce-sdk-isomorphic
60
+ npm install commerce-sdk-isomorphic
63
61
  ```
64
62
 
65
63
  ### Usage
66
64
 
67
65
  ```javascript
68
- import ocapi from 'commerce-sdk-isomorphic';
69
- const { helpers, ShopperLogin, ShopperSearch } = ocapi;
70
-
71
- // Named imports also work
72
- // import {helpers, ShopperLogin, ShopperSearch} from 'commerce-sdk-isomorphic';
73
-
74
- // Alternatively, you can use subpath imports to import a single API at a time instead of the entire SDK
75
- // Useful for when you want a slimmer bundle size and only need a single API
76
- // import * as helpers from 'commerce-sdk-isomorphic/helpers'
77
- // import { ShopperProducts } from 'commerce-sdk-isomorphic/shopperProducts';
78
- // import { ShopperSearch } from 'commerce-sdk-isomorphic/shopperSearch';
66
+ import {helpers, ShopperLogin, ShopperSearch} from 'commerce-sdk-isomorphic';
79
67
 
80
68
  const config = {
81
69
  // SCAPI does not support CORS, so client side requests must use a reverse proxy.
@@ -103,52 +91,6 @@ const searchResult = await shopperSearch.productSearch({
103
91
  });
104
92
  ```
105
93
 
106
- #### Import Strategies
107
-
108
- The SDK supports multiple import patterns to accommodate different use cases:
109
-
110
- **Default Import (Full SDK)**
111
- ```javascript
112
- import ocapi from 'commerce-sdk-isomorphic';
113
- const { helpers, ShopperLogin, ShopperSearch } = ocapi;
114
- ```
115
-
116
- **Named Imports (Full SDK)**
117
- ```javascript
118
- import { helpers, ShopperLogin, ShopperSearch } from 'commerce-sdk-isomorphic';
119
- ```
120
-
121
- **Subpath Imports (Individual APIs and Common dependencies)**
122
-
123
- *ESM (ES Modules):*
124
- ```javascript
125
- import { ShopperLogin } from 'commerce-sdk-isomorphic/shopperLogin';
126
- import * as helpers from 'commerce-sdk-isomorphic/helpers';
127
- ```
128
-
129
- *CommonJS:*
130
- ```javascript
131
- const { ShopperLogin } = require('commerce-sdk-isomorphic/shopperLogin');
132
- const helpers = require('commerce-sdk-isomorphic/helpers');
133
- ```
134
-
135
- #### Choosing the Right Import Strategy
136
-
137
- **Use Default/Named Imports when:**
138
- - You need multiple APIs from the SDK
139
- - You want the smallest overall bundle size for comprehensive usage
140
- - The entire SDK is optimized and maximally compressed as a single bundle
141
-
142
- **Note:** Default and named imports load the entire SDK, including all APIs, helpers, and dependencies.
143
-
144
- **Use Subpath Imports when:**
145
- - You only need specific APIs
146
- - You want to minimize initial bundle size
147
- - You're implementing dynamic loading for better page performance
148
- - You need granular control over which APIs are loaded
149
-
150
- **Note:** While subpath imports reduce initial bundle size, using them for all APIs will result in a larger total bundle size due to duplicated dependencies required for standalone operation.
151
-
152
94
  #### Fetch Options
153
95
 
154
96
  You can configure how the SDK makes requests using the `fetchOptions` parameter. It is passed to [node-fetch](https://github.com/node-fetch/node-fetch/1#api) on the server and [whatwg-fetch](https://github.github.io/fetch/) on browser.