commerce-sdk-react 0.0.1-deprecated

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/.eslintrc.js ADDED
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright (c) 2021, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+
8
+ module.exports = {
9
+ extends: [require.resolve('@salesforce/pwa-kit-dev/configs/eslint')]
10
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ ## v1.0.0-dev (May 29, 2023)
2
+ ## v3.0.0-dev (May 12, 2023)
3
+
4
+ - Add missing cache invalidation for contexts/customers/login/order [#1073](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1073)
5
+
6
+ - Upgrade React 18, React DOM 18, @types/react@18, @types/react-dom@v18 Testing library 14 [#1166](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1166)
7
+
8
+ ## v2.7.1 (May 11, 2023)
9
+
10
+ - Re-generate lock files and fix hook lib tests [#1186](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1186)
11
+ - Add additional properties to ShopperLogin test types [#1185](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1185)
12
+ - Add missing cache invalidation for contexts/customers/login/order [#1073](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1073)
13
+ - Fix Shopper Baskets Test case [#1082](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1082)
14
+ - Implement remaining Shopper Baskets cache logic [#1070](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1070)
15
+ - Decode pre-fetched token and save auth data in storage [#1052](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1052)
16
+ - Allow query hook parameters to be null. [#1046](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1046)
17
+ - Implement updateCustomerPassword as no-op. [#1031](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1031)
18
+
19
+ ## v2.7.0 (Mar 03, 2023)
20
+
21
+ - Add Page/Region/Component components for shopper experience/page designer page rendering [#963](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/963)
22
+ - Namespace `Auth` storage keys with site identifier to allow multi-site support [#911](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/911)
23
+ - Add Shopper Experience `usePage` and `usePages` hooks[#958](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/958)
24
+
25
+ ## v2.6.0 (Jan 25, 2023)
26
+
27
+ ## v2.5.0 (Jan 05, 2023)
28
+
29
+ - Exclude test files in package file to avoid publishing them [#856](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/856)
30
+ - Pass in 'headers' and 'rawResponse' options to mutation hooks [#845](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/845)
31
+ - Commerce hooks: basket mutations [#834](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/834)
32
+ - Remove overriding of params in mutation hooks [#859](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/859)
33
+
34
+ ## v2.4.0 (Dec 01, 2022)
package/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, Salesforce.com, Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+ 3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # ⚠️ Warning! The package is moved to @salesforce/commerce-sdk-react
2
+
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ CommerceApiProvider: true
8
+ };
9
+ Object.defineProperty(exports, "CommerceApiProvider", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _provider.default;
13
+ }
14
+ });
15
+ var _provider = _interopRequireDefault(require("./provider"));
16
+ var _types = require("./hooks/types");
17
+ Object.keys(_types).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _types[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _types[key];
25
+ }
26
+ });
27
+ });
28
+ var _hooks = require("./hooks");
29
+ Object.keys(_hooks).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _hooks[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _hooks[key];
37
+ }
38
+ });
39
+ });
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "commerce-sdk-react",
3
+ "version": "0.0.1-deprecated",
4
+ "description": "A library that provides react hooks for fetching data from Commerce Cloud",
5
+ "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/SalesforceCommerceCloud/pwa-kit/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/SalesforceCommerceCloud/pwa-kit.git"
12
+ },
13
+ "license": "See license in LICENSE",
14
+ "author": "cc-pwa-kit@salesforce.com",
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "files": [
18
+ "CHANGELOG.md",
19
+ "LICENSE",
20
+ "+(auth|components|hooks|scripts)/**/!(*.test*).{ts,js}",
21
+ "*.{js,d.ts}",
22
+ "!*.test*.{js,d.ts}",
23
+ "!test*.*",
24
+ "!+(jest|babel).config.js",
25
+ "!setup-jest.js"
26
+ ],
27
+ "scripts": {
28
+ "build": "cross-env NODE_ENV=production internal-lib-build build && tsc --emitDeclarationOnly",
29
+ "build:docs": "typedoc",
30
+ "build:watch": "nodemon --watch 'src/**' --ext 'tsx,ts' --exec 'npm run build'",
31
+ "format": "internal-lib-build format \"**/*.{js,jsx,ts,tsx}\"",
32
+ "lint": "npm run lint:js && tsc --noEmit",
33
+ "lint:fix": "npm run lint:js -- --fix",
34
+ "lint:js": "pwa-kit-dev lint \"**/*.{js,jsx,ts,tsx}\"",
35
+ "prepare": "npm run build",
36
+ "test": "internal-lib-build test",
37
+ "test:inspect": "node --inspect-brk jest --runInBand",
38
+ "test:watch": "npm test -- --watch",
39
+ "typecheck": "tsc --noEmit",
40
+ "version": "node ./scripts/version.js"
41
+ },
42
+ "dependencies": {
43
+ "commerce-sdk-isomorphic": "^1.10.1",
44
+ "js-cookie": "^3.0.1",
45
+ "jwt-decode": "^3.1.2"
46
+ },
47
+ "devDependencies": {
48
+ "@tanstack/react-query": "^4.28.0",
49
+ "@testing-library/jest-dom": "^5.16.5",
50
+ "@testing-library/react": "^14.0.0",
51
+ "@types/js-cookie": "^3.0.3",
52
+ "@types/jsonwebtoken": "^8.5.9",
53
+ "@types/jwt-decode": "^3.1.0",
54
+ "@types/node": "^14.18.40",
55
+ "@types/react": "^18.2.0",
56
+ "@types/react-dom": "^18.2.1",
57
+ "@types/react-helmet": "^6.1.6",
58
+ "cross-env": "^5.2.1",
59
+ "internal-lib-build": "3.0.0-dev",
60
+ "jsonwebtoken": "^8.5.1",
61
+ "nock": "^13.3.0",
62
+ "nodemon": "^2.0.22",
63
+ "@salesforce/pwa-kit-dev": "3.0.0-dev",
64
+ "react": "^18.2.0",
65
+ "react-dom": "^18.2.0",
66
+ "react-helmet": "^6.1.0",
67
+ "semver": "^7.3.8",
68
+ "shelljs": "^0.8.5",
69
+ "typedoc": "^0.23.28",
70
+ "typescript": "4.8.3"
71
+ },
72
+ "peerDependencies": {
73
+ "@tanstack/react-query": "^4",
74
+ "react": "^18",
75
+ "react-helmet": "6"
76
+ },
77
+ "optionalDependencies": {
78
+ "prop-types": "^15.8.1"
79
+ },
80
+ "engines": {
81
+ "node": "^16.11.0 || ^18.0.0",
82
+ "npm": "^8.0.0 || ^9.0.0"
83
+ },
84
+ "publishConfig": {
85
+ "directory": "dist"
86
+ }
87
+ }
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright (c) 2023, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ /* eslint-disable @typescript-eslint/no-var-requires */
8
+ const packageJSON = require('../package.json')
9
+ const sh = require('shelljs')
10
+ const semver = require('semver')
11
+
12
+ // this script is expected to run on release branch.
13
+ const main = () => {
14
+ // get the version number from package json
15
+ const currentVersion = packageJSON.version
16
+ const isPrerelease = semver.prerelease(currentVersion.trim())
17
+ // if it is a pre-release version, do nothing
18
+ if (isPrerelease) {
19
+ return
20
+ }
21
+
22
+ let latestVersion
23
+ let isNewPackage
24
+ const {stdout, stderr} = sh.exec(`npm view ${packageJSON.name} version`, {silent: true})
25
+ if (stderr) {
26
+ isNewPackage = stderr.includes(`'${packageJSON.name}' is not in the npm registry`)
27
+ if (!isNewPackage) {
28
+ console.log('stderr', stderr)
29
+ process.exit(0)
30
+ }
31
+ } else {
32
+ latestVersion = stdout
33
+ }
34
+
35
+ const isLatest = isNewPackage || semver.gt(currentVersion, latestVersion)
36
+ if (isLatest) {
37
+ console.log(`Publish docs for version ${currentVersion} to gh-pages branch`)
38
+ // build the docs
39
+ sh.exec('npm run build:docs')
40
+
41
+ // release the docs
42
+ sh.exec(
43
+ 'npx gh-pages --dotfiles --message "[skip ci] Pushing docs to gh-pages" --dist docs'
44
+ )
45
+ }
46
+ }
47
+
48
+ main()
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * Copyright (c) 2023, Salesforce, Inc.
4
+ * All rights reserved.
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ /* eslint-disable @typescript-eslint/no-var-requires */
9
+ // Update Change Log heading
10
+ const pkg = require('../package.json')
11
+ const path = require('path')
12
+ const os = require('os')
13
+ const fs = require('fs')
14
+
15
+ const date = new Date().toString().split(' ').slice(1, 4)
16
+ const heading = `## v${pkg.version} (${date[0]} ${date[1]}, ${date[2]})\n`
17
+
18
+ const changelog = path.resolve(os.tmpdir(), 'CHANGELOG.md')
19
+
20
+ fs.writeFileSync(changelog, heading, 'utf8')
21
+ fs.appendFileSync(changelog, fs.readFileSync('CHANGELOG.md'), 'utf8')
22
+ fs.copyFileSync(changelog, 'CHANGELOG.md')