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.
- package/README.md +3 -61
- package/lib/index.cjs.d.ts +1 -18
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.d.ts +1 -18
- package/lib/index.esm.js +1 -1
- package/package.json +27 -94
- package/lib/clientConfig.cjs.d.ts +0 -52
- package/lib/clientConfig.cjs.js +0 -1
- package/lib/clientConfig.d.ts +0 -52
- package/lib/clientConfig.js +0 -1
- package/lib/config.cjs.d.ts +0 -2
- package/lib/config.cjs.js +0 -1
- package/lib/config.d.ts +0 -2
- package/lib/config.js +0 -1
- package/lib/helpers.cjs.d.ts +0 -2225
- package/lib/helpers.cjs.js +0 -1
- package/lib/helpers.d.ts +0 -2225
- package/lib/helpers.js +0 -1
- package/lib/responseError.cjs.d.ts +0 -12
- package/lib/responseError.cjs.js +0 -1
- package/lib/responseError.d.ts +0 -12
- package/lib/responseError.js +0 -1
- package/lib/shopperBaskets.cjs.d.ts +0 -10259
- package/lib/shopperBaskets.cjs.js +0 -1
- package/lib/shopperBaskets.d.ts +0 -10259
- package/lib/shopperBaskets.js +0 -1
- package/lib/shopperBasketsv2.cjs.d.ts +0 -10453
- package/lib/shopperBasketsv2.cjs.js +0 -1
- package/lib/shopperBasketsv2.d.ts +0 -10453
- package/lib/shopperBasketsv2.js +0 -1
- package/lib/shopperConsents.cjs.d.ts +0 -1142
- package/lib/shopperConsents.cjs.js +0 -1
- package/lib/shopperConsents.d.ts +0 -1142
- package/lib/shopperConsents.js +0 -1
- package/lib/shopperContext.cjs.d.ts +0 -1401
- package/lib/shopperContext.cjs.js +0 -1
- package/lib/shopperContext.d.ts +0 -1401
- package/lib/shopperContext.js +0 -1
- package/lib/shopperCustomers.cjs.d.ts +0 -12185
- package/lib/shopperCustomers.cjs.js +0 -1
- package/lib/shopperCustomers.d.ts +0 -12185
- package/lib/shopperCustomers.js +0 -1
- package/lib/shopperExperience.cjs.d.ts +0 -1169
- package/lib/shopperExperience.cjs.js +0 -1
- package/lib/shopperExperience.d.ts +0 -1169
- package/lib/shopperExperience.js +0 -1
- package/lib/shopperGiftCertificates.cjs.d.ts +0 -729
- package/lib/shopperGiftCertificates.cjs.js +0 -1
- package/lib/shopperGiftCertificates.d.ts +0 -729
- package/lib/shopperGiftCertificates.js +0 -1
- package/lib/shopperLogin.cjs.d.ts +0 -3842
- package/lib/shopperLogin.cjs.js +0 -1
- package/lib/shopperLogin.d.ts +0 -3842
- package/lib/shopperLogin.js +0 -1
- package/lib/shopperOrders.cjs.d.ts +0 -5393
- package/lib/shopperOrders.cjs.js +0 -1
- package/lib/shopperOrders.d.ts +0 -5393
- package/lib/shopperOrders.js +0 -1
- package/lib/shopperProducts.cjs.d.ts +0 -3479
- package/lib/shopperProducts.cjs.js +0 -1
- package/lib/shopperProducts.d.ts +0 -3479
- package/lib/shopperProducts.js +0 -1
- package/lib/shopperPromotions.cjs.d.ts +0 -1001
- package/lib/shopperPromotions.cjs.js +0 -1
- package/lib/shopperPromotions.d.ts +0 -1001
- package/lib/shopperPromotions.js +0 -1
- package/lib/shopperSearch.cjs.d.ts +0 -3352
- package/lib/shopperSearch.cjs.js +0 -1
- package/lib/shopperSearch.d.ts +0 -3352
- package/lib/shopperSearch.js +0 -1
- package/lib/shopperSeo.cjs.d.ts +0 -769
- package/lib/shopperSeo.cjs.js +0 -1
- package/lib/shopperSeo.d.ts +0 -769
- package/lib/shopperSeo.js +0 -1
- package/lib/shopperStores.cjs.d.ts +0 -1289
- package/lib/shopperStores.cjs.js +0 -1
- package/lib/shopperStores.d.ts +0 -1289
- package/lib/shopperStores.js +0 -1
- package/lib/templateUrl.cjs.d.ts +0 -76
- package/lib/templateUrl.cjs.js +0 -1
- package/lib/templateUrl.d.ts +0 -76
- package/lib/templateUrl.js +0 -1
- package/lib/version.cjs.d.ts +0 -3
- package/lib/version.cjs.js +0 -1
- package/lib/version.d.ts +0 -3
- 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 `^
|
|
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
|
-
|
|
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
|
|
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.
|
package/lib/index.cjs.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 };
|