commerce-sdk-isomorphic 4.0.1-preview-shopper-test.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 (86) hide show
  1. package/README.md +3 -61
  2. package/lib/index.cjs.d.ts +1 -18
  3. package/lib/index.cjs.js +1 -1
  4. package/lib/index.esm.d.ts +1 -18
  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/shopperConsents.cjs.d.ts +0 -1142
  32. package/lib/shopperConsents.cjs.js +0 -1
  33. package/lib/shopperConsents.d.ts +0 -1142
  34. package/lib/shopperConsents.js +0 -1
  35. package/lib/shopperContext.cjs.d.ts +0 -1401
  36. package/lib/shopperContext.cjs.js +0 -1
  37. package/lib/shopperContext.d.ts +0 -1401
  38. package/lib/shopperContext.js +0 -1
  39. package/lib/shopperCustomers.cjs.d.ts +0 -12185
  40. package/lib/shopperCustomers.cjs.js +0 -1
  41. package/lib/shopperCustomers.d.ts +0 -12185
  42. package/lib/shopperCustomers.js +0 -1
  43. package/lib/shopperExperience.cjs.d.ts +0 -1169
  44. package/lib/shopperExperience.cjs.js +0 -1
  45. package/lib/shopperExperience.d.ts +0 -1169
  46. package/lib/shopperExperience.js +0 -1
  47. package/lib/shopperGiftCertificates.cjs.d.ts +0 -729
  48. package/lib/shopperGiftCertificates.cjs.js +0 -1
  49. package/lib/shopperGiftCertificates.d.ts +0 -729
  50. package/lib/shopperGiftCertificates.js +0 -1
  51. package/lib/shopperLogin.cjs.d.ts +0 -3842
  52. package/lib/shopperLogin.cjs.js +0 -1
  53. package/lib/shopperLogin.d.ts +0 -3842
  54. package/lib/shopperLogin.js +0 -1
  55. package/lib/shopperOrders.cjs.d.ts +0 -5393
  56. package/lib/shopperOrders.cjs.js +0 -1
  57. package/lib/shopperOrders.d.ts +0 -5393
  58. package/lib/shopperOrders.js +0 -1
  59. package/lib/shopperProducts.cjs.d.ts +0 -3479
  60. package/lib/shopperProducts.cjs.js +0 -1
  61. package/lib/shopperProducts.d.ts +0 -3479
  62. package/lib/shopperProducts.js +0 -1
  63. package/lib/shopperPromotions.cjs.d.ts +0 -1001
  64. package/lib/shopperPromotions.cjs.js +0 -1
  65. package/lib/shopperPromotions.d.ts +0 -1001
  66. package/lib/shopperPromotions.js +0 -1
  67. package/lib/shopperSearch.cjs.d.ts +0 -3352
  68. package/lib/shopperSearch.cjs.js +0 -1
  69. package/lib/shopperSearch.d.ts +0 -3352
  70. package/lib/shopperSearch.js +0 -1
  71. package/lib/shopperSeo.cjs.d.ts +0 -769
  72. package/lib/shopperSeo.cjs.js +0 -1
  73. package/lib/shopperSeo.d.ts +0 -769
  74. package/lib/shopperSeo.js +0 -1
  75. package/lib/shopperStores.cjs.d.ts +0 -1289
  76. package/lib/shopperStores.cjs.js +0 -1
  77. package/lib/shopperStores.d.ts +0 -1289
  78. package/lib/shopperStores.js +0 -1
  79. package/lib/templateUrl.cjs.d.ts +0 -76
  80. package/lib/templateUrl.cjs.js +0 -1
  81. package/lib/templateUrl.d.ts +0 -76
  82. package/lib/templateUrl.js +0 -1
  83. package/lib/version.cjs.d.ts +0 -3
  84. package/lib/version.cjs.js +0 -1
  85. package/lib/version.d.ts +0 -3
  86. 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.
@@ -54886,7 +54886,6 @@ declare namespace helpers {
54886
54886
  const isNode: boolean;
54887
54887
  const globalObject: typeof globalThis;
54888
54888
  const hasFetchAvailable: boolean;
54889
- // TODO: Remove this function in the next major version
54890
54889
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
54891
54890
  const fetch: FetchFunction;
54892
54891
  /**
@@ -57012,21 +57011,5 @@ declare namespace helpers {
57012
57011
  */
57013
57012
  const encodeSCAPISpecialCharacters: (str: string) => string;
57014
57013
  }
57015
- declare const pkg: {
57016
- ShopperBaskets: typeof ShopperBaskets;
57017
- ShopperBasketsV2: typeof ShopperBasketsV2;
57018
- ShopperConsents: typeof ShopperConsents;
57019
- ShopperContexts: typeof ShopperContexts;
57020
- ShopperCustomers: typeof ShopperCustomers;
57021
- ShopperExperience: typeof ShopperExperience;
57022
- ShopperGiftCertificates: typeof ShopperGiftCertificates;
57023
- ShopperLogin: typeof ShopperLogin;
57024
- ShopperOrders: typeof ShopperOrders;
57025
- ShopperProducts: typeof ShopperProducts;
57026
- ShopperPromotions: typeof ShopperPromotions;
57027
- ShopperSearch: typeof ShopperSearch;
57028
- ShopperSEO: typeof ShopperSEO;
57029
- ShopperStores: typeof ShopperStores;
57030
- };
57031
- export { pkg as default, ShopperBaskets, ShopperBasketsV2, ShopperConsents, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperLogin, ShopperOrders, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSEO, ShopperStores, ClientConfig, TemplateURL, helpers };
57014
+ export { ShopperBaskets, ShopperBasketsV2, ShopperConsents, ShopperContexts, ShopperCustomers, ShopperExperience, ShopperGiftCertificates, ShopperLogin, ShopperOrders, ShopperProducts, ShopperPromotions, ShopperSearch, ShopperSEO, ShopperStores, ClientConfig, TemplateURL, helpers };
57032
57015
  export type { ShopperBasketsTypes, ShopperBasketsV2Types, ShopperConsentsTypes, ShopperContextsTypes, ShopperCustomersTypes, ShopperExperienceTypes, ShopperGiftCertificatesTypes, ShopperLoginTypes, ShopperOrdersTypes, ShopperProductsTypes, ShopperPromotionsTypes, ShopperSearchTypes, ShopperSEOTypes, ShopperStoresTypes, ClientConfigInit, FetchFunction, FetchOptions };