@appdirect/sfb-toolkit 3.0.6 → 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 (61) hide show
  1. package/.babelrc +8 -13
  2. package/Dockerfile +2 -2
  3. package/bin/index.js +0 -14
  4. package/coverage/clover.xml +2 -2
  5. package/coverage/coverage-final.json +8 -8
  6. package/coverage/lcov-report/block-navigation.js +8 -0
  7. package/coverage/lcov-report/constants/customUserAttributesMock.js.html +8 -3
  8. package/coverage/lcov-report/constants/index.html +8 -3
  9. package/coverage/lcov-report/constants/pageUrls.js.html +8 -3
  10. package/coverage/lcov-report/constants/userMock.js.html +8 -3
  11. package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +8 -3
  12. package/coverage/lcov-report/controllers/controllers-utils/index.html +8 -3
  13. package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +9 -4
  14. package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +8 -3
  15. package/coverage/lcov-report/controllers/data-filters/index.html +12 -7
  16. package/coverage/lcov-report/controllers/index.html +8 -3
  17. package/coverage/lcov-report/controllers/index.js.html +11 -6
  18. package/coverage/lcov-report/favicon.png +0 -0
  19. package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +12 -7
  20. package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +9 -4
  21. package/coverage/lcov-report/front-end-utils/src/components/base/index.html +13 -8
  22. package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +9 -4
  23. package/coverage/lcov-report/front-end-utils/src/components/container.js.html +11 -6
  24. package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +10 -5
  25. package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +10 -5
  26. package/coverage/lcov-report/front-end-utils/src/components/index.html +17 -12
  27. package/coverage/lcov-report/front-end-utils/src/components/search.js.html +11 -6
  28. package/coverage/lcov-report/front-end-utils/src/constants/index.html +8 -3
  29. package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +8 -3
  30. package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +8 -3
  31. package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +8 -3
  32. package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +8 -3
  33. package/coverage/lcov-report/front-end-utils/src/utils/index.html +8 -3
  34. package/coverage/lcov-report/index.html +18 -13
  35. package/coverage/lcov-report/middlewares/config.js.html +8 -3
  36. package/coverage/lcov-report/middlewares/index.html +8 -3
  37. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  38. package/coverage/lcov-report/sorter.js +26 -0
  39. package/index.js +14 -8
  40. package/npm-shrinkwrap.json +34935 -7401
  41. package/package.json +99 -80
  42. package/readme.md +13 -6
  43. package/src/controllers/index.js +1 -1
  44. package/src/front-end-utils/dist/toolbar.bundle.js +2 -49
  45. package/src/front-end-utils/dist/toolbar.bundle.js.LICENSE.txt +52 -0
  46. package/src/front-end-utils/src/components/base/ResultItem.js +2 -2
  47. package/src/front-end-utils/src/components/base/SearchBar.js +1 -1
  48. package/src/front-end-utils/src/components/container.js +1 -1
  49. package/src/front-end-utils/src/components/data-view.js +1 -1
  50. package/src/front-end-utils/src/components/header-view.js +1 -1
  51. package/src/front-end-utils/src/components/search.js +1 -1
  52. package/src/tools/compiler-components-prod.js +1 -1
  53. package/src/tools/gulp-tasks.js +2 -2
  54. package/src/tools/toolkit-common-fun.js +1 -1
  55. package/src/tools/toolkit-common-vars.js +1 -1
  56. package/src/tools/toolkit-package.js +1 -2
  57. package/src/tools/toolkit-storybook.js +5 -5
  58. package/{webpack-components.config.js → webpack-components.config.cjs} +1 -3
  59. package/{webpack-components.config.prod.js → webpack-components.config.prod.cjs} +1 -3
  60. package/{webpack.config.js → webpack.config.cjs} +8 -5
  61. package/src/tools/toolkit-tests.js +0 -99
@@ -0,0 +1,52 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*! js-cookie v3.0.1 | MIT */
8
+
9
+ /**
10
+ * Prism: Lightweight, robust, elegant syntax highlighting
11
+ *
12
+ * @license MIT <https://opensource.org/licenses/MIT>
13
+ * @author Lea Verou <https://lea.verou.me>
14
+ * @namespace
15
+ * @public
16
+ */
17
+
18
+ /** @license React v0.19.1
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+
27
+ /** @license React v16.13.1
28
+ * react-is.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */
35
+
36
+ /** @license React v16.14.0
37
+ * react-dom.production.min.js
38
+ *
39
+ * Copyright (c) Facebook, Inc. and its affiliates.
40
+ *
41
+ * This source code is licensed under the MIT license found in the
42
+ * LICENSE file in the root directory of this source tree.
43
+ */
44
+
45
+ /** @license React v16.14.0
46
+ * react.production.min.js
47
+ *
48
+ * Copyright (c) Facebook, Inc. and its affiliates.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ */
@@ -1,9 +1,9 @@
1
1
  import React from "react"
2
2
  import PropTypes from "prop-types"
3
3
  import styled from "styled-components"
4
- import SyntaxHighlighter from "react-syntax-highlighter/prism"
4
+ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"
5
5
  import ReactJson from "react-json-view"
6
- import { atomDark } from "react-syntax-highlighter/styles/prism"
6
+ import { atomDark } from "react-syntax-highlighter/dist/cjs/styles/prism"
7
7
 
8
8
  import { SEARCH_TYPES } from "../../constants/searchType"
9
9
 
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import PropTypes from "prop-types"
3
3
  import styled from "styled-components"
4
- import FontAwesomeIcon from "@fortawesome/react-fontawesome"
4
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
5
5
  import { faSearch, faAngleDown } from "@fortawesome/free-solid-svg-icons"
6
6
 
7
7
  const SelectContainer = styled.div`
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import styled from "styled-components"
3
- import FontAwesomeIcon from "@fortawesome/react-fontawesome"
3
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
4
4
  import {
5
5
  faAngleDoubleLeft,
6
6
  faAngleDoubleRight,
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import PropTypes from "prop-types"
3
3
  import styled from "styled-components"
4
- import FontAwesomeIcon from "@fortawesome/react-fontawesome"
4
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
5
5
  import ReactJson from "react-json-view"
6
6
  import { faDatabase } from "@fortawesome/free-solid-svg-icons"
7
7
 
@@ -2,7 +2,7 @@ import React from "react"
2
2
  import Cookies from "js-cookie"
3
3
  import PropTypes from "prop-types"
4
4
  import styled from "styled-components"
5
- import FontAwesomeIcon from "@fortawesome/react-fontawesome"
5
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
6
6
  import { NO_ROLE, MARKETPLACE_MANAGER, USER } from '../constants/roleType'
7
7
  import { HOME_PAGE_URL, MOCK_ADMIN_PAGE_URL } from '../constants/pageUrl'
8
8
 
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import PropTypes from "prop-types"
3
3
  import styled from "styled-components"
4
- import FontAwesomeIcon from "@fortawesome/react-fontawesome"
4
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
5
5
  import { faSearch, faTimes } from "@fortawesome/free-solid-svg-icons"
6
6
 
7
7
  import debounce from "../utils/debounce"
@@ -3,7 +3,7 @@ const fs = require("fs")
3
3
  const fsExtra = require("fs-extra")
4
4
  const { TOOLKIT_PATH } = require("./toolkit-common-vars")
5
5
 
6
- const getConfigComponentsProdWebpack = require(`${TOOLKIT_PATH}/webpack-components.config.prod`)
6
+ const getConfigComponentsProdWebpack = require(`${TOOLKIT_PATH}/webpack-components.config.prod.cjs`)
7
7
  const currentPath = process.cwd() // used to get current dev folder
8
8
  const config = require(`${currentPath}/config`)
9
9
  const customComponentsAssets = `${currentPath}/themes/${
@@ -1,5 +1,5 @@
1
- const { src, dest, series, watch } = require('gulp');
2
- const sass = require("gulp-sass")
1
+ const { src, dest, series, watch } = require("gulp");
2
+ const sass = require("gulp-sass")(require("sass"))
3
3
  const concat = require("gulp-concat")
4
4
  const sourcemaps = require("gulp-sourcemaps")
5
5
 
@@ -111,7 +111,7 @@ const installSfbThemeComponents = () => {
111
111
 
112
112
  // check if sfb-theme-components is installed otherwise install it
113
113
  spawnSync('npm',
114
- [`ls ${THEME_COMPONENT_MODULE} 2>&1 | (findstr ${THEME_COMPONENT_MODULE} || grep ${THEME_COMPONENT_MODULE}) > ${THEME_LOGS_FILE_PATH} 2>&1 || npm i -S ${THEME_COMPONENT_MODULE}@${THEME_COMPONENT_VERSION} --production`], {
114
+ [`ls ${THEME_COMPONENT_MODULE} 2>&1 | (findstr ${THEME_COMPONENT_MODULE} || grep ${THEME_COMPONENT_MODULE}) > ${THEME_LOGS_FILE_PATH} 2>&1 || npm i -S ${THEME_COMPONENT_MODULE}@${THEME_COMPONENT_VERSION} --production --legacy-peer-deps`], {
115
115
  cwd: ACTIVE_THEME_PATH,
116
116
  stdio: "inherit",
117
117
  shell: true
@@ -15,7 +15,7 @@ const THEME_TEMPLATES_CONFIG_PATH = `${TOOLKIT_PATH}/themes-config.json`;
15
15
  const THEME_TEMPLATES = JSON.parse(fs.readFileSync(THEME_TEMPLATES_CONFIG_PATH));
16
16
  const PAGE_OBJECTS_SUFFIX = "/api/internal/storefront/v1";
17
17
  const THEME_COMPONENT_MODULE = "@appdirect/sfb-theme-components";
18
- const THEME_COMPONENT_VERSION = "0.0.282";
18
+ const THEME_COMPONENT_VERSION = "0.0.293";
19
19
 
20
20
  let WORKSPACE_CONFIG;
21
21
  try {
@@ -29,10 +29,9 @@ const hasTranslationErrors = async () => {
29
29
  const translationsPath = `${currentPath}/themes/${config.theme}/translations`
30
30
  try {
31
31
  const translationsFiles = await fsProm.readdir(translationsPath)
32
-
33
32
  translationsFiles.forEach(langFile => {
34
33
  try {
35
- yaml.safeLoad(fs.readFileSync(`${translationsPath}/${langFile}`))
34
+ yaml.load(fs.readFileSync(`${translationsPath}/${langFile}`))
36
35
  } catch (err) {
37
36
  yamlErrorFlag = true
38
37
  if (err.name === "YAMLException") {
@@ -5,9 +5,9 @@ const { ACTIVE_THEME_PATH, THEME_LOGS_FILE_PATH } = require("./toolkit-common-va
5
5
 
6
6
  shouldBeProjectFolder(true);
7
7
  const storybookDependencies = [
8
- "@babel/core@7.14.0",
8
+ "@babel/core@7.19.0",
9
9
  "@babel/plugin-proposal-class-properties@7.13.0",
10
- "@babel/preset-env@7.14.1",
10
+ "@babel/preset-env@7.19.0",
11
11
  "@storybook/addon-actions@6.3.1",
12
12
  "@storybook/addon-essentials@6.2.9",
13
13
  "@storybook/addon-knobs@6.2.9",
@@ -15,14 +15,14 @@ const storybookDependencies = [
15
15
  "@storybook/addon-a11y@6.3.1",
16
16
  "@storybook/addon-docs@6.3.1",
17
17
  "@storybook/react@6.3.1",
18
- "babel-loader@8.2.2",
18
+ "babel-loader@8.2.5",
19
19
  "core-js@3.12.1",
20
20
  "preset-react@1.0.0",
21
21
  "react@16.14.0",
22
22
  "react-content-loader@5.1.4",
23
23
  "react-dom@16.14.0",
24
24
  "sass@1.32.12",
25
- "sass-loader@10.2.0"
25
+ "sass-loader@10.3.1"
26
26
  ].join(' ');
27
27
 
28
28
  const storybookModule = "@storybook/react";
@@ -39,7 +39,7 @@ const storybookModule = "@storybook/react";
39
39
 
40
40
  // check if storybook module is installed otherwise install storybook dependencies
41
41
  spawnSync('npm',
42
- [`ls ${storybookModule} 2>&1 | (findstr ${storybookModule} || grep ${storybookModule}) > ${THEME_LOGS_FILE_PATH} 2>&1 || npm i -S ${storybookDependencies} --production`], {
42
+ [`ls ${storybookModule} 2>&1 | (findstr ${storybookModule} || grep ${storybookModule}) > ${THEME_LOGS_FILE_PATH} 2>&1 || npm i -S ${storybookDependencies} --legacy-peer-deps --production`], {
43
43
  cwd: ACTIVE_THEME_PATH,
44
44
  stdio: "inherit",
45
45
  shell: true
@@ -58,9 +58,7 @@ module.exports = (currentPath, config, isAsset) => {
58
58
  ),
59
59
  path.resolve(
60
60
  currentPath,
61
- `themes/${
62
- config.theme
63
- }/node_modules/@appdirect/sfb-theme-components`
61
+ `themes/${config.theme}/node_modules/@appdirect/sfb-theme-components`
64
62
  )
65
63
  ]
66
64
  }
@@ -48,9 +48,7 @@ module.exports = (currentPath, config) => {
48
48
  ),
49
49
  path.resolve(
50
50
  currentPath,
51
- `themes/${
52
- config.theme
53
- }/node_modules/@appdirect/sfb-theme-components`
51
+ `themes/${config.theme}/node_modules/@appdirect/sfb-theme-components`
54
52
  )
55
53
  ]
56
54
  }
@@ -1,18 +1,21 @@
1
- "use strict"
2
-
3
1
  module.exports = {
4
- entry: ["./src/front-end-utils/toolbar.js"],
2
+ entry: "./src/front-end-utils/toolbar.js",
5
3
  module: {
6
4
  rules: [
7
5
  {
8
6
  test: /\.(js|jsx)$/,
9
7
  exclude: /node_modules/,
10
- use: ["babel-loader"]
8
+ use: {
9
+ loader: "babel-loader",
10
+ },
11
+ resolve: {
12
+ fullySpecified: false,
13
+ }
11
14
  }
12
15
  ]
13
16
  },
14
17
  resolve: {
15
- extensions: ["*", ".js", ".jsx"]
18
+ extensions: [".js", ".jsx"]
16
19
  },
17
20
  output: {
18
21
  path: `${__dirname}/src/front-end-utils/dist`,
@@ -1,99 +0,0 @@
1
- const {
2
- spawn
3
- } = require("child_process")
4
- const fs = require('fs');
5
- const colors = require("colors")
6
- const NODEMON_PATH = "node_modules/nodemon/bin/nodemon.js"
7
- const {
8
- TOOLKIT_PATH,
9
- ACTIVE_THEME,
10
- ACTIVE_THEME_PATH
11
- } = require("./toolkit-common-vars")
12
-
13
- const TESTS_CONFIG_PATH = `${ACTIVE_THEME_PATH}/__tests__/config/index.js`;
14
- const testsConfig = require(TESTS_CONFIG_PATH);
15
-
16
-
17
- function installDepedency(depedency) {
18
- return new Promise((resolve, reject) => {
19
- const child = spawn('npm', ['install', depedency], {
20
- cwd: `${__dirname}/..`,
21
- stdio: "inherit",
22
- shell: true
23
- });
24
-
25
- child.on('error', reject);
26
- child.on('exit', code => {
27
- if (code == 0) {
28
- return resolve();
29
- }
30
- const err = new Error(`child exited with code ${code}`)
31
- err.code = code;
32
- return reject(err)
33
- });
34
- });
35
- }
36
-
37
- async function checkAndInstall(depedency) {
38
- try {
39
- fs.accessSync(`${TOOLKIT_PATH}/node_modules/${depedency}`, fs.F_OK);
40
- } catch (e) {
41
- console.log(`\n Could not find module ${depedency}. Trying to install...\n`.yellow);
42
- await installDepedency(depedency);
43
- }
44
- }
45
-
46
- async function runTests() {
47
- // pre-conditions
48
- console.log(" \n Checking pre-conditions...");
49
- for (let depedency of testsConfig.requiredModules) {
50
- await checkAndInstall(depedency);
51
- }
52
- console.log("\n Pre-conditions met.\n".green);
53
- startTests();
54
- }
55
-
56
- function startTests() {
57
-
58
- console.log(" ---");
59
- console.log(
60
- ` Running browser testing for theme ${ACTIVE_THEME}`
61
- );
62
- console.log(" ---");
63
-
64
- const testsProcess = spawn(
65
- `node ${TOOLKIT_PATH}/node_modules/.bin/jest --config='${TOOLKIT_PATH}/config/jest-config.js'`, {
66
- stdio: "inherit",
67
- shell: true
68
- }
69
- )
70
- testsProcess.on("error", () => {
71
- webserverProcess.kill()
72
- })
73
- testsProcess.on("close", () => {
74
- webserverProcess.kill()
75
- })
76
-
77
- webserverProcess.on("error", () => {
78
- testsProcess.kill();
79
- })
80
- webserverProcess.on("close", () => {
81
- testsProcess.kill();
82
- })
83
- webserverProcess.on("exit", () => {
84
- testsProcess.kill();
85
- })
86
- }
87
-
88
- const webserverProcess = spawn(
89
- `node ${TOOLKIT_PATH}/${NODEMON_PATH} ${TOOLKIT_PATH}/index.js`, {
90
- shell: true
91
- }
92
- )
93
-
94
- webserverProcess.stdout.on("data", data => {
95
- const message = data.toString()
96
- if (/running/.test(message)) {
97
- runTests()
98
- }
99
- })