@appdirect/sfb-toolkit 4.0.25 → 5.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 (58) hide show
  1. package/bin/index.js +4 -4
  2. package/coverage/clover.xml +89 -80
  3. package/coverage/coverage-final.json +3 -3
  4. package/coverage/lcov-report/constants/customUserAttributesMock.js.html +1 -1
  5. package/coverage/lcov-report/constants/index.html +1 -1
  6. package/coverage/lcov-report/constants/pageUrls.js.html +1 -1
  7. package/coverage/lcov-report/constants/userMock.js.html +1 -1
  8. package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +1 -1
  9. package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
  10. package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +1 -1
  11. package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +1 -1
  12. package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
  13. package/coverage/lcov-report/controllers/index.html +15 -15
  14. package/coverage/lcov-report/controllers/index.js.html +15 -12
  15. package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +1 -1
  16. package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +1 -1
  17. package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
  18. package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +1 -1
  19. package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
  20. package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
  21. package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +125 -71
  22. package/coverage/lcov-report/front-end-utils/src/components/index.html +14 -14
  23. package/coverage/lcov-report/front-end-utils/src/components/search.js.html +1 -1
  24. package/coverage/lcov-report/front-end-utils/src/constants/index.html +5 -5
  25. package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +12 -6
  26. package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
  27. package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
  28. package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
  29. package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
  30. package/coverage/lcov-report/index.html +25 -25
  31. package/coverage/lcov-report/middlewares/config.js.html +1 -1
  32. package/coverage/lcov-report/middlewares/index.html +1 -1
  33. package/coverage/lcov-report/tools/index.html +1 -1
  34. package/coverage/lcov-report/tools/proxy-fetch.js.html +1 -1
  35. package/coverage/lcov.info +160 -144
  36. package/index.js +2 -0
  37. package/mockPages/admin/admin.html +4 -1
  38. package/mockPages/login/css/theme-index.css +353 -0
  39. package/mockPages/login/images/login.png +0 -0
  40. package/mockPages/login/login.html +43 -0
  41. package/npm-shrinkwrap.json +26 -15
  42. package/package.json +4 -3
  43. package/readme.md +13 -181
  44. package/src/api/cors.js +5 -2
  45. package/src/controllers/index.js +2 -1
  46. package/src/front-end-utils/dist/toolbar.bundle.js +1 -1
  47. package/src/front-end-utils/src/components/header-view.js +80 -62
  48. package/src/front-end-utils/src/constants/pageUrl.js +2 -1
  49. package/src/routes/cors.js +55 -31
  50. package/src/routes/index.js +45 -41
  51. package/src/routes/mockRoutes/marketplaceManager/bootstrapContext.js +109 -499
  52. package/src/routes/mockRoutes/user/bootstrapContext.js +26 -432
  53. package/src/tools/prompt-questions.js +16 -3
  54. package/src/tools/toolkit-components-add.js +1 -4
  55. package/src/tools/toolkit-import.js +1 -1
  56. package/src/tools/toolkit-status.js +3 -3
  57. package/src/tools/zip-theme.js +1 -0
  58. package/themes-config.json +7 -0
package/readme.md CHANGED
@@ -1,184 +1,14 @@
1
1
  # @appdirect/sfb-toolkit
2
2
  Storefront Toolkit CLI to power up building your custom theme for AppDirect's Marketplace.
3
3
 
4
- Theming a template leverages [Nunjucks Template System](https://mozilla.github.io/nunjucks/) to keep Server Side Rendering.
5
- It can be easily mixed with eg. HTML, CSS, JavaScript, jQuery, SASS.
6
-
7
4
  ### Requirements
8
5
  * Node 10.x or 12.x for versions 1.x.x to 3.0.6
9
- * Node 16.x or 18.x for versions 4.x.x
6
+ * Node 16.x or 18.x for versions 4.x.x or newer
10
7
 
11
8
  ### Release Notes:
12
9
 
13
- **4.0.25**
14
- - Removed `Classic` option when creating theme
15
- - Updated `sfb-theme-components` library to version [0.0.352](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.352)
16
- - `[DEPRECATED]` `sfb-toolkit storybook` command
17
- - `[BETA]` added `sfb-toolkit import` command
18
- - `[BETA]` added `sfb-toolkit components-add` command
19
- - `[BETA]` added `sfb-toolkit components-copy` command
20
- - `[BETA]` added `sfb-toolkit components-delete` command
21
-
22
- **4.0.20**
23
- - Updated internal packages
24
-
25
- **4.0.19**
26
- - Updated internal packages
27
-
28
- **4.0.18**
29
- - Updated documentation links
30
-
31
- **4.0.17**
32
- - Bug fix: fixed issue when executing `sfb-toolkit start` on Windows
33
- - Updated `sfb-theme-components` library to version [0.0.342](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.342)
34
-
35
- **4.0.14**
36
- - Bug fix: fixed error message showing when executing `sfb-toolkit setup`
37
-
38
- **4.0.13**
39
- - Added new command `sfb-toolkit components-info`
40
- - shows which custom components could override our internal UI library (`sfb-theme-components`)
41
- - Updated warning prompt for `sfb-toolkit install @appdirect/sfb-theme-components`
42
- - includes the current version of `sfb-theme-components` used
43
- - indicates which custom components should potentially be tested when updating the `sfb-theme-components` version
44
-
45
- **4.0.12**
46
- - Bug fix: fixed proxy issue
47
-
48
- **4.0.11**
49
- - Added warning prompt to `sfb-toolkit components` command
50
- - Added warning prompt to `sfb-toolkit install @appdirect/sfb-theme-components` command
51
- - Bug fix: fixed node_modules issue
52
-
53
- **4.0.10**
54
- - Add Node 18 support
55
- - Add prompts when enabling custom components and updating sfb-theme-component version
56
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.76 ([sfb-theme-mp2@0.0.75](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.76))
57
- - Add default translations for all supported languages
58
- - Update `sfb-theme-components` library to version [0.0.340](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.340)
59
- - Add Node 18 support
60
- - Update `storefront-utils` library to version [0.0.125](https://www.npmjs.com/package/@appdirect/storefront-utils/v/0.0.125)
61
-
62
- **4.0.8**
63
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.64 ([sfb-theme-mp2@0.0.75](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.75))
64
- - Update `@appdirect/sfb-theme-classic` to version 0.0.27 ([sfb-theme-classic@0.0.27](https://www.npmjs.com/package/@appdirect/sfb-theme-classic/v/0.0.27))
65
- - Update `sfb-theme-components` library to version [0.0.338](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.338)
66
-
67
- **4.0.4**
68
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.64 ([sfb-theme-mp2@0.0.64](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.64))
69
- - Update `sfb-theme-components` library to version [0.0.321](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.321)
70
-
71
- **4.0.2**
72
- - `sfb-components` bundles are split by storefront page to improve LCP performance.
73
- - Bug fix: Fix custom components with sfb-toolkit@4 on Windows.
74
- - Bug fix: Fix favicon not showing in the Plaza theme.
75
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.59 ([sfb-theme-mp2@0.0.59](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.59))
76
- - Update `sfb-theme-components` library to version [0.0.315](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.315)
77
-
78
- **4.0.1**
79
- - Toolkit is now able to work on Node 16.
80
- - Remove deprecated `node-sass` to compile SASS files in favour of `sass` aka Dart Sass.
81
- - Update `sfb-theme-components` library to version [0.0.293](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.293)
82
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.57 ([sfb-theme-mp2@0.0.57](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.57))
83
- - Update `@appdirect/sfb-theme-classic` to version 0.0.26 ([sfb-theme-classic@0.0.26](https://www.npmjs.com/package/@appdirect/sfb-theme-classic/v/0.0.26))
84
-
85
- **3.0.6**
86
- - Update `sfb-theme-components` library to version [0.0.282](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.282)
87
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.55 ([sfb-theme-mp2@0.0.55](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.55))
88
- - Update `@appdirect/sfb-theme-classic` to version 0.0.24 ([sfb-theme-classic@0.0.24](https://www.npmjs.com/package/@appdirect/sfb-theme-classic/v/0.0.24))
89
-
90
- **3.0.5**
91
- - Update `sfb-theme-components` library to version [0.0.272](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.272)
92
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.53 ([sfb-theme-mp2@0.0.53](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.53))
93
-
94
- **3.0.4**
95
- - Update `sfb-theme-components` library to version [0.0.262](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.262)
96
- - Update custom components section in the Storybook documentation
97
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.50 ([sfb-theme-mp2@0.0.47](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.50))
98
-
99
- **3.0.3**
100
- - Bug fix: Fix `PRODUCTS_LIST` schema type not working on a custom page
101
- - Update `sfb-toolkit package` command to minify `sfb-components.js` bundle
102
- - Update `sfb-theme-components` library to version [0.0.245](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.245)
103
- - Update custom components section in the Storybook documentation
104
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.47 ([sfb-theme-mp2@0.0.47](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.47))
105
- - Add product variants template
106
- - Add `enableProductVariant` theme setting
107
-
108
- **3.0.0**
109
- - Add new storefront Header & Footer components
110
- - Add new menu manager in the Visual Editor
111
- - Update `sfb-theme-components` library to version [0.0.237](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.237) and the Plaza theme to meet WCAG 2.1 level AA for accessibility
112
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.45 ([sfb-theme-mp2@0.0.45](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.45))
113
-
114
- **2.0.15**
115
- - Add new domain cross-selling page in Plaza theme. ([See Documentation](https://help.appdirect.com/products/Default.htm#StorefrontBuilder/sfb-configure-domain-x-sell.htm))
116
- - Read `crossSellingEnabled` setting from theme to optionally disable cross-selling
117
- - Update `@appdirect/sfb-theme-plaza` to version 0.0.44 ([sfb-theme-mp2@0.0.44](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.44))
118
-
119
- **2.0.14**
120
- - Fix npm security vulnerabilities when running `sfb-toolkit storybook` and `sfb-toolkit components` commands
121
-
122
- **2.0.13**
123
- - Customize CTA labels and `i18n` object in the theme ([See Documentation](https://help.appdirect.com/platform/Default.htm#StorefrontBuilder/sfb-override-labels.htm%3FTocPath%3DCustomize%2520the%2520storefront%7CWork%2520with%2520the%2520Storefront%2520Toolkit%7C_____10))
124
-
125
- **2.0.10**
126
- - Bug fix: `sfb-toolkit storybook` command throws an error
127
-
128
- **2.0.9**
129
- - Update storefront-utils library
130
-
131
- **2.0.8**
132
- - Improve the toolbar header view:
133
- - to preview the header as a regular user or a marketplace manager without a user token
134
- - to preview the header in the admin portal
135
- - The theme header-footer section can use assets (images, fonts) in the theme assets folder
136
-
137
- **2.0.7**
138
- - Bug fix: Default props should be passed properly to custom components
139
- - Bug fix: Custom components do not work in Classic theme
140
- - Bug fix: Removing a null file when `customComponents` folder is created
141
-
142
- **2.0.6**
143
- - Updating Classic and Plaza theme
144
-
145
- **2.0.5**
146
- - Add new toolkit commands: `storybook` and `components` to build new custom components in your Plaza theme
147
- - Update `setup` and `create` commands to choose between a `Classic` or a `Plaza` theme
148
-
149
- **2.0.4**
150
- - Update Classic theme, small fix in leads form
151
- - Update Plaza theme with product domains and bundles page
152
-
153
- **2.0.3**
154
- - Add pricing content to add to cart mock
155
- - Add Support for Storefront Builder Components rendering
156
- - Bug fix: Fix Microsoft subscription upgraded rendering
157
-
158
- **2.0.2**
159
- - Added Support for both SASS and SCSS styling file compilation
160
- - Bug fix: Hanging prompt on setup command on Windows
161
-
162
- **2.0.1**
163
- - Documentation links updated
164
- - Bug fix: Footer custom JS script parsing
165
-
166
- **2.0.0**
167
- - Classic Theme with new Checkout and Cart integration is now available ([See Documentation](https://help.appdirect.com/platform/Default.htm#StorefrontBuilder/sfb-checkout-intro.htm))
168
- - Added Product Configuration page
169
- - Added Cart Preview
170
- - Added window function to add to cart `AD_addToCart()`
171
- - Standalone Domains now supports new Checkout
172
- - Bug fix: Windows CRLF now supported
173
-
174
- **1.1.0**
175
- - Dynamic SASS compilation to work with Node 12
176
-
177
- **1.1.0**
178
- - Toolkit is now ready and able to work on Node 12
179
-
180
- **1.0.0**
181
- - Initial release
10
+ **5.0.1-5.0.2**
11
+ - Fixed `sfb-toolkit status` command to show correct paths.
182
12
 
183
13
  ### How to use
184
14
  The idea behind Toolkit CLI is similar to how `git` CLI has been made.
@@ -194,18 +24,20 @@ Developers can have multiple themes in a single environment.
194
24
  |`sfb-toolkit update`|Update current theme's configuration|
195
25
  |`sfb-toolkit start`|Starts local server with current theme on `https://localhost:3555/en-US/home`|
196
26
  |`sfb-toolkit package`|Creates a .zip file with current theme files|
197
- |`sfb-toolkit storybook`|Start storybook for the currently selected theme
198
- |`sfb-toolkit install [module]`|Installs npm module in the currently selected theme
199
- |`sfb-toolkit components`|Setup custom components
27
+ |`sfb-toolkit storybook`|[**Deprecated**] Start storybook for the currently selected theme|
28
+ |`sfb-toolkit install [module]`|Installs npm module in the currently selected theme|
29
+ |`sfb-toolkit components`|Setup custom components|
30
+ |`sfb-toolkit components-info`|Custom components information|
31
+ |`sfb-toolkit components-copy`|Copy UI library custom components|
32
+ |`sfb-toolkit components-delete`|Delete copied UI library components|
33
+ |`sfb-toolkit components-add`|Add a new custom components|
34
+ |`sfb-toolkit import [themePath] [marketplacePath] [themeName]`|Imports a theme|
200
35
  |`sfb-toolkit version`|Shows version of sfb-toolkit|
201
36
 
202
37
 
203
38
  ### Other Resources
204
- - [Official Documentation](https://help.appdirect.com/platform/Default.htm#StorefrontBuilder/sfb-install-dev-tool.htm)
39
+ - [Official Documentation](https://developer.appdirect.com/storefront/)
205
40
  - [Checkout Integration](https://help.appdirect.com/platform/Default.htm#StorefrontBuilder/sfb-checkout-intro.htm)
206
- - [Video Tutorials](https://help.appdirect.com/platform/Default.htm#StorefrontBuilder/sfb-toolkit-intro.htm)
207
- - [Nunjucks Template System Documentation](https://mozilla.github.io/nunjucks/)
208
- - [Contact Support](mailto:storefrontbuilder@appdirect.com)
209
41
 
210
42
 
211
- This Repository is owned and maintained by Storefront Builder Team @ AppDirect Inc.
43
+ This Repository is owned and maintained by UI Platform team @ AppDirect Inc.
package/src/api/cors.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const fetch = require("../tools/proxy-fetch");
2
2
 
3
3
  const cors = {
4
- async callApi(req, res, requestType = "get") {
4
+ async callApi(req, res, requestType = "get", overrides = {}) {
5
5
  const options = {
6
6
  method: requestType,
7
7
  redirect: "follow",
@@ -25,7 +25,10 @@ const cors = {
25
25
  options
26
26
  );
27
27
  const data = await response.json();
28
- res.send(data);
28
+ res.send({
29
+ ...data,
30
+ ...overrides,
31
+ });
29
32
  } catch (error) {
30
33
  console.log(error);
31
34
  res.sendStatus(500);
@@ -124,7 +124,7 @@ class Pages {
124
124
  getData(pageSettings) {
125
125
  return new Promise(resolve => {
126
126
  let { page, locale, currency } = this
127
- if (page === "admin") {
127
+ if (page === "admin" || page === "login") {
128
128
  page = "home"
129
129
  }
130
130
  const apiURL = API_PATHS[page](
@@ -333,6 +333,7 @@ class Pages {
333
333
  const mockedPageObject = {}
334
334
  const mockedPagesPath = `${__dirname}/../../mockPages`
335
335
  mockedPages.forEach(folder => {
336
+ console.log(folder)
336
337
  try {
337
338
  const htmlContent = fs.readFileSync(
338
339
  `${mockedPagesPath}/${folder}/${folder}.html`,