@appdirect/sfb-toolkit 3.0.1 → 3.0.5
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/coverage/clover.xml +157 -148
- package/coverage/coverage-final.json +6 -5
- package/coverage/lcov-report/constants/customUserAttributesMock.js.html +491 -0
- package/coverage/lcov-report/constants/index.html +20 -5
- package/coverage/lcov-report/constants/pageUrls.js.html +2 -2
- package/coverage/lcov-report/constants/userMock.js.html +29 -29
- package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +8 -8
- package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
- package/coverage/lcov-report/controllers/index.html +18 -18
- package/coverage/lcov-report/controllers/index.js.html +145 -76
- package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/search.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
- package/coverage/lcov-report/index.html +20 -20
- package/coverage/lcov-report/middlewares/config.js.html +9 -3
- package/coverage/lcov-report/middlewares/index.html +1 -1
- package/coverage/lcov.info +284 -258
- package/index.js +1 -3
- package/npm-shrinkwrap.json +24 -29
- package/package.json +3 -2
- package/readme.md +22 -2
- package/src/constants/customUserAttributesMock.js +137 -0
- package/src/constants/userMock.js +22 -23
- package/src/controllers/index.js +52 -29
- package/src/middlewares/config.js +3 -1
- package/src/tools/compiler-components-prod.js +30 -0
- package/src/tools/toolkit-common-vars.js +1 -1
- package/src/tools/toolkit-components.js +4 -0
- package/src/tools/toolkit-package.js +44 -37
- package/src/tools/zip-theme.js +15 -8
- package/webpack-components.config.js +28 -8
- package/webpack-components.config.prod.js +115 -0
- package/.node-version +0 -1
- package/src/tools/compiler-components.js +0 -25
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/sfb-toolkit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"integrity": "sha1-r5sX3a3DE3JXYDbIdgu668lvZPw="
|
|
11
11
|
},
|
|
12
12
|
"@appdirect/sfb-theme-plaza": {
|
|
13
|
-
"version": "0.0.
|
|
14
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/@appdirect/sfb-theme-plaza/-/sfb-theme-plaza-0.0.
|
|
15
|
-
"integrity": "sha1-
|
|
13
|
+
"version": "0.0.53",
|
|
14
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/@appdirect/sfb-theme-plaza/-/sfb-theme-plaza-0.0.53.tgz",
|
|
15
|
+
"integrity": "sha1-aVar0Fz/p+HMa3Q4L275iI0kKRk="
|
|
16
16
|
},
|
|
17
17
|
"@appdirect/storefront-utils": {
|
|
18
|
-
"version": "0.0.
|
|
19
|
-
"resolved": "https://registry.npmjs.org/@appdirect/storefront-utils/-/storefront-utils-0.0.
|
|
20
|
-
"integrity": "sha512-
|
|
18
|
+
"version": "0.0.114",
|
|
19
|
+
"resolved": "https://registry.npmjs.org/@appdirect/storefront-utils/-/storefront-utils-0.0.114.tgz",
|
|
20
|
+
"integrity": "sha512-srH8d6X5qjaLGACACFzE54XNcck4mLvh+y9eGAhThFtUW4YJ7EZbWhHGk+ovZvzZ8hd26PYswFUJghxH8sZaBQ==",
|
|
21
21
|
"requires": {
|
|
22
22
|
"cheerio": "^0.22.0",
|
|
23
23
|
"directory-tree": "^2.0.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"cheerio": {
|
|
39
39
|
"version": "0.22.0",
|
|
40
40
|
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
|
|
41
|
-
"integrity": "
|
|
41
|
+
"integrity": "sha512-8/MzidM6G/TgRelkzDG13y3Y9LxBjCb+8yOEZ9+wwq5gVF2w2pV0wmHvjfT0RvuxGyR7UEuK36r+yYMbT4uKgA==",
|
|
42
42
|
"requires": {
|
|
43
43
|
"css-select": "~1.2.0",
|
|
44
44
|
"dom-serializer": "~0.1.0",
|
|
@@ -348,11 +348,6 @@
|
|
|
348
348
|
"node-releases": "^1.1.71"
|
|
349
349
|
}
|
|
350
350
|
},
|
|
351
|
-
"caniuse-lite": {
|
|
352
|
-
"version": "1.0.30001228",
|
|
353
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz",
|
|
354
|
-
"integrity": "sha1-v9xZQs0zJvpR7gtC++9NqdSSp/o="
|
|
355
|
-
},
|
|
356
351
|
"colorette": {
|
|
357
352
|
"version": "1.2.2",
|
|
358
353
|
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/colorette/-/colorette-1.2.2.tgz",
|
|
@@ -2095,11 +2090,6 @@
|
|
|
2095
2090
|
"node-releases": "^1.1.71"
|
|
2096
2091
|
}
|
|
2097
2092
|
},
|
|
2098
|
-
"caniuse-lite": {
|
|
2099
|
-
"version": "1.0.30001228",
|
|
2100
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz",
|
|
2101
|
-
"integrity": "sha1-v9xZQs0zJvpR7gtC++9NqdSSp/o="
|
|
2102
|
-
},
|
|
2103
2093
|
"colorette": {
|
|
2104
2094
|
"version": "1.2.2",
|
|
2105
2095
|
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/colorette/-/colorette-1.2.2.tgz",
|
|
@@ -2729,9 +2719,9 @@
|
|
|
2729
2719
|
"integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs="
|
|
2730
2720
|
},
|
|
2731
2721
|
"caniuse-lite": {
|
|
2732
|
-
"version": "1.0.
|
|
2733
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/caniuse-lite/-/caniuse-lite-1.0.
|
|
2734
|
-
"integrity": "sha1-
|
|
2722
|
+
"version": "1.0.30001304",
|
|
2723
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz",
|
|
2724
|
+
"integrity": "sha1-OK9V7T/IIgyxPjXm5zCcjGWgVVk="
|
|
2735
2725
|
},
|
|
2736
2726
|
"capture-stack-trace": {
|
|
2737
2727
|
"version": "1.0.1",
|
|
@@ -5883,11 +5873,11 @@
|
|
|
5883
5873
|
"integrity": "sha1-MTtidN2nGPcU0AszMLuubjjpAgk="
|
|
5884
5874
|
},
|
|
5885
5875
|
"js-beautify": {
|
|
5886
|
-
"version": "1.14.
|
|
5887
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/js-beautify/-/js-beautify-1.14.
|
|
5888
|
-
"integrity": "sha1-
|
|
5876
|
+
"version": "1.14.3",
|
|
5877
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/js-beautify/-/js-beautify-1.14.3.tgz",
|
|
5878
|
+
"integrity": "sha1-PdEclJF43n873z9vdSd4077ZUVA=",
|
|
5889
5879
|
"requires": {
|
|
5890
|
-
"config-chain": "^1.1.
|
|
5880
|
+
"config-chain": "^1.1.13",
|
|
5891
5881
|
"editorconfig": "^0.15.3",
|
|
5892
5882
|
"glob": "^7.1.3",
|
|
5893
5883
|
"nopt": "^5.0.0"
|
|
@@ -7011,12 +7001,17 @@
|
|
|
7011
7001
|
"tar": "^4.4.13"
|
|
7012
7002
|
},
|
|
7013
7003
|
"dependencies": {
|
|
7004
|
+
"minimist": {
|
|
7005
|
+
"version": "1.2.6",
|
|
7006
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/minimist/-/minimist-1.2.6.tgz",
|
|
7007
|
+
"integrity": "sha1-hjelt1nqDW6YcCz7OpKDMjyTr0Q="
|
|
7008
|
+
},
|
|
7014
7009
|
"mkdirp": {
|
|
7015
|
-
"version": "0.5.
|
|
7016
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/mkdirp/-/mkdirp-0.5.
|
|
7017
|
-
"integrity": "sha1-
|
|
7010
|
+
"version": "0.5.6",
|
|
7011
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/mkdirp/-/mkdirp-0.5.6.tgz",
|
|
7012
|
+
"integrity": "sha1-fe8D0kMtyuS6HWEURcSDlgYiVfY=",
|
|
7018
7013
|
"requires": {
|
|
7019
|
-
"minimist": "^1.2.
|
|
7014
|
+
"minimist": "^1.2.6"
|
|
7020
7015
|
}
|
|
7021
7016
|
},
|
|
7022
7017
|
"nopt": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/sfb-toolkit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"^.+\\.js?$": "babel-jest"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
"license": "SEE LICENSE IN https://help.appdirect.com/sfb-eula.pdf",
|
|
24
25
|
"scripts": {
|
|
25
26
|
"test": "jest --coverage",
|
|
26
27
|
"buildToolbar": "webpack --config ./webpack.config.js --mode production",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@appdirect/sfb-theme-classic": "0.0.21",
|
|
49
|
-
"@appdirect/sfb-theme-plaza": "0.0.
|
|
50
|
+
"@appdirect/sfb-theme-plaza": "0.0.53",
|
|
50
51
|
"@babel/core": "^7.4.4",
|
|
51
52
|
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
|
52
53
|
"@babel/plugin-transform-runtime": "^7.14.3",
|
package/readme.md
CHANGED
|
@@ -7,8 +7,27 @@ It can be easily mixed with eg. HTML, CSS, JavaScript, jQuery, SASS.
|
|
|
7
7
|
|
|
8
8
|
### Requirements
|
|
9
9
|
* Node 10.x or 12.x
|
|
10
|
+
|
|
10
11
|
### Release Notes:
|
|
11
12
|
|
|
13
|
+
**3.0.5**
|
|
14
|
+
- Update `sfb-theme-components` library to version [0.0.272](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.272)
|
|
15
|
+
- 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))
|
|
16
|
+
|
|
17
|
+
**3.0.4**
|
|
18
|
+
- Update `sfb-theme-components` library to version [0.0.262](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.262)
|
|
19
|
+
- Update custom components section in the Storybook documentation
|
|
20
|
+
- 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))
|
|
21
|
+
|
|
22
|
+
**3.0.3**
|
|
23
|
+
- Bug fix: Fix `PRODUCTS_LIST` schema type not working on a custom page
|
|
24
|
+
- Update `sfb-toolkit package` command to minify `sfb-components.js` bundle
|
|
25
|
+
- Update `sfb-theme-components` library to version [0.0.245](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.245)
|
|
26
|
+
- Update custom components section in the Storybook documentation
|
|
27
|
+
- 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))
|
|
28
|
+
- Add product variants template
|
|
29
|
+
- Add `enableProductVariant` theme setting
|
|
30
|
+
|
|
12
31
|
**3.0.0**
|
|
13
32
|
- Add new storefront Header & Footer components
|
|
14
33
|
- Add new menu manager in the Visual Editor
|
|
@@ -81,14 +100,15 @@ It can be easily mixed with eg. HTML, CSS, JavaScript, jQuery, SASS.
|
|
|
81
100
|
**1.1.0**
|
|
82
101
|
- Toolkit is now ready and able to work on Node 12
|
|
83
102
|
|
|
84
|
-
**1.0.0**
|
|
103
|
+
**1.0.0**
|
|
104
|
+
- Initial release
|
|
85
105
|
|
|
86
106
|
### How to use
|
|
87
107
|
The idea behind Toolkit CLI is similar to how `git` CLI have been made.
|
|
88
108
|
Developer can have multiple themes in single environment.
|
|
89
109
|
|
|
90
110
|
|Command|Description|
|
|
91
|
-
|
|
111
|
+
|---|---|
|
|
92
112
|
|`sfb-toolkit setup`|Creates a new project/environment where Developer can store themes|
|
|
93
113
|
|`sfb-toolkit create [name]`|Creates a new theme|
|
|
94
114
|
|`sfb-toolkit checkout [name]`|Changes context to the theme [name]|
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
const customUserAttributesMock = {
|
|
2
|
+
key_user_1: {
|
|
3
|
+
id: 3638,
|
|
4
|
+
entityType: "USER",
|
|
5
|
+
type: "TEXT",
|
|
6
|
+
partner: "APPDIRECT",
|
|
7
|
+
attributeKey: "key_user_1",
|
|
8
|
+
enabled: true,
|
|
9
|
+
required: false,
|
|
10
|
+
system: false,
|
|
11
|
+
taggedPermissions: {},
|
|
12
|
+
label: { "en-US": "Demo user ID" },
|
|
13
|
+
hint: { "en-US": "" }
|
|
14
|
+
},
|
|
15
|
+
PatKey: {
|
|
16
|
+
id: 3471,
|
|
17
|
+
entityType: "USER",
|
|
18
|
+
type: "TEXT",
|
|
19
|
+
partner: "APPDIRECT",
|
|
20
|
+
attributeKey: "PatKey",
|
|
21
|
+
enabled: true,
|
|
22
|
+
required: false,
|
|
23
|
+
system: false,
|
|
24
|
+
taggedPermissions: {
|
|
25
|
+
USER_PROFILE: {
|
|
26
|
+
RESELLER: { permission: "READ", required: false },
|
|
27
|
+
CHANNEL_SUPPORT: { permission: "READ", required: false },
|
|
28
|
+
SALES_SUPPORT: { permission: "READ", required: false },
|
|
29
|
+
USER: { permission: "READ", required: false },
|
|
30
|
+
DEVELOPER: { permission: "READ", required: false }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
validation: {
|
|
34
|
+
validationType: "EXTERNAL",
|
|
35
|
+
uuid: "8c4901f6-25f0-4d26-ad97-a8a2242721b0",
|
|
36
|
+
errorMessageTranslations: { "en-US": "asdasd" },
|
|
37
|
+
consumerKey: "asda",
|
|
38
|
+
consumerSecret: "*****",
|
|
39
|
+
endpointTemplate: "http://example.com?{value}",
|
|
40
|
+
errorCodeMessages: {}
|
|
41
|
+
},
|
|
42
|
+
label: { "en-US": "Pat custom attribute" },
|
|
43
|
+
hint: { "en-US": "" }
|
|
44
|
+
},
|
|
45
|
+
"attrnew-francais": {
|
|
46
|
+
id: 7029,
|
|
47
|
+
entityType: "USER",
|
|
48
|
+
type: "MULTISELECT",
|
|
49
|
+
partner: "APPDIRECT",
|
|
50
|
+
attributeKey: "attrnew-francais",
|
|
51
|
+
enabled: true,
|
|
52
|
+
required: false,
|
|
53
|
+
system: false,
|
|
54
|
+
taggedPermissions: {},
|
|
55
|
+
label: {
|
|
56
|
+
fr: "attrnew-francais",
|
|
57
|
+
"en-US": "attrnew-fr"
|
|
58
|
+
},
|
|
59
|
+
hint: {
|
|
60
|
+
fr: "attrnew-francais"
|
|
61
|
+
},
|
|
62
|
+
valueOptions: [
|
|
63
|
+
{
|
|
64
|
+
uuid: "daa455fc-e2ec-404e-bcf7-0372379c06cf",
|
|
65
|
+
optionKey: "francais",
|
|
66
|
+
optionLabel: {
|
|
67
|
+
fr: "francais"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
user: {
|
|
73
|
+
id: 3481,
|
|
74
|
+
entityType: "USER",
|
|
75
|
+
type: "MULTISELECT",
|
|
76
|
+
partner: "APPDIRECT",
|
|
77
|
+
attributeKey: "user",
|
|
78
|
+
enabled: true,
|
|
79
|
+
required: false,
|
|
80
|
+
system: false,
|
|
81
|
+
taggedPermissions: {
|
|
82
|
+
USER_DETAILS: {
|
|
83
|
+
RESELLER: { permission: "WRITE", required: false },
|
|
84
|
+
CHANNEL_SUPPORT: { permission: "WRITE", required: false },
|
|
85
|
+
SALES_SUPPORT: { permission: "WRITE", required: false }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
label: { "en-US": "user_label" },
|
|
89
|
+
hint: { "en-US": "hint" },
|
|
90
|
+
valueOptions: [
|
|
91
|
+
{
|
|
92
|
+
uuid: "2c3908ec-6389-42c4-a1a2-32ed3e135df6",
|
|
93
|
+
optionKey: "o1",
|
|
94
|
+
optionLabel: { "en-US": "o1" }
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
uuid: "bad98a5f-17a5-4661-bb81-48bc397cfab1",
|
|
98
|
+
optionKey: "o2",
|
|
99
|
+
optionLabel: { "en-US": "o2" }
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
user_email: {
|
|
104
|
+
id: 6603,
|
|
105
|
+
entityType: "USER",
|
|
106
|
+
type: "TEXT",
|
|
107
|
+
partner: "APPDIRECT",
|
|
108
|
+
attributeKey: "user_email",
|
|
109
|
+
enabled: true,
|
|
110
|
+
required: false,
|
|
111
|
+
system: false,
|
|
112
|
+
taggedPermissions: {
|
|
113
|
+
USER_DETAILS: {
|
|
114
|
+
SALES_SUPPORT: {
|
|
115
|
+
permission: "WRITE",
|
|
116
|
+
required: false
|
|
117
|
+
},
|
|
118
|
+
RESELLER: {
|
|
119
|
+
permission: "WRITE",
|
|
120
|
+
required: false
|
|
121
|
+
},
|
|
122
|
+
CHANNEL_SUPPORT: {
|
|
123
|
+
permission: "WRITE",
|
|
124
|
+
required: false
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
label: {
|
|
129
|
+
"en-US": "user email"
|
|
130
|
+
},
|
|
131
|
+
hint: {
|
|
132
|
+
"en-US": ""
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = customUserAttributesMock
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
const customUserAttributes = require("./customUserAttributesMock")
|
|
2
|
+
|
|
1
3
|
const userMock = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
hasCustomerContract: false,
|
|
13
|
-
locale: "en_US",
|
|
14
|
-
attributes: {
|
|
4
|
+
name: "{Username} LastName",
|
|
5
|
+
isLoggedIn: true,
|
|
6
|
+
email: "Username.lastname@email.com",
|
|
7
|
+
family_name: "{Username}",
|
|
8
|
+
given_name: "LastName",
|
|
9
|
+
roles: ["CREATE_QUOTE", "USER"],
|
|
10
|
+
userUuid: "686e6521-4ed5-4164-a776-00b04c9d73ff",
|
|
11
|
+
hasCustomerContract: false,
|
|
12
|
+
locale: "en_US",
|
|
13
|
+
attributes: {
|
|
15
14
|
HAS_CUSTOMER_CONTRACT: "false"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
items: [
|
|
24
|
-
|
|
15
|
+
},
|
|
16
|
+
companyUuid: "3dc98547-47dd-47bb-9b01-4569be3412e6",
|
|
17
|
+
currency: "USD",
|
|
18
|
+
customUserAttributes,
|
|
19
|
+
customerContractEditionUuids: [],
|
|
20
|
+
ownedPartners: [],
|
|
21
|
+
segments: {
|
|
22
|
+
items: []
|
|
23
|
+
}
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
module.exports = userMock
|
|
26
|
+
module.exports = userMock
|
package/src/controllers/index.js
CHANGED
|
@@ -8,14 +8,13 @@ const { merge } = require("lodash")
|
|
|
8
8
|
|
|
9
9
|
const { callToActionsFilter } = require("./data-filters/call-to-actions-filter")
|
|
10
10
|
const { bootstrapDataFilter } = require("./data-filters//bootstrap-data-filter")
|
|
11
|
-
const { raw } = require("body-parser")
|
|
12
11
|
|
|
13
12
|
const { themeAssetsPath, toolkitAssetsPath } = require("../constants/pageUrls")
|
|
14
13
|
const buildHeaderAssets = require("./controllers-utils/assetsUtils")
|
|
15
14
|
|
|
16
15
|
const currentPath = process.cwd()
|
|
17
16
|
const API_PATHS = storefrontUtils.pageApi
|
|
18
|
-
const userMock = require("../constants/userMock")
|
|
17
|
+
const userMock = require("../constants/userMock")
|
|
19
18
|
|
|
20
19
|
const appendClearCartFunction = html => {
|
|
21
20
|
const clearCartJS = `<script>
|
|
@@ -76,6 +75,14 @@ class Pages {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
isCustomPage(page) {
|
|
79
|
+
return !!(page === "custom" && this.customPath && this.customPath.length)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getPage(page) {
|
|
83
|
+
return this.isCustomPage(page) ? this.customPath[0] : page
|
|
84
|
+
}
|
|
85
|
+
|
|
79
86
|
redirectToLocalePage() {
|
|
80
87
|
this.getData(this.config, this.page).then(response => {
|
|
81
88
|
const { data = {} } = response
|
|
@@ -115,8 +122,8 @@ class Pages {
|
|
|
115
122
|
getData(pageSettings) {
|
|
116
123
|
return new Promise(resolve => {
|
|
117
124
|
let { page, locale, currency } = this
|
|
118
|
-
if (page ===
|
|
119
|
-
page =
|
|
125
|
+
if (page === "admin") {
|
|
126
|
+
page = "home"
|
|
120
127
|
}
|
|
121
128
|
const apiURL = API_PATHS[page](
|
|
122
129
|
this.config.marketplacePath,
|
|
@@ -127,7 +134,8 @@ class Pages {
|
|
|
127
134
|
envData: storefrontUtils.getEnvMarketplaceData(
|
|
128
135
|
this.config.marketplacePath,
|
|
129
136
|
this.envData
|
|
130
|
-
)
|
|
137
|
+
),
|
|
138
|
+
currentPage: page
|
|
131
139
|
}),
|
|
132
140
|
storefrontUtils.getQueryData(
|
|
133
141
|
{
|
|
@@ -151,8 +159,8 @@ class Pages {
|
|
|
151
159
|
})
|
|
152
160
|
.then(response => {
|
|
153
161
|
const data = Pages.filterData(response.data)
|
|
154
|
-
if (this.mockRole ===
|
|
155
|
-
data.config.user = userMock
|
|
162
|
+
if (this.mockRole === "USER") {
|
|
163
|
+
data.config.user = userMock
|
|
156
164
|
}
|
|
157
165
|
this.defaultLocale = data.config.defaultLocale || "en-US"
|
|
158
166
|
resolve({
|
|
@@ -198,13 +206,13 @@ class Pages {
|
|
|
198
206
|
try {
|
|
199
207
|
return JSON.parse(
|
|
200
208
|
fs.readFileSync(
|
|
201
|
-
`${currentPath}/themes/${
|
|
202
|
-
this.config.theme
|
|
203
|
-
}/env-data.json`,
|
|
209
|
+
`${currentPath}/themes/${this.config.theme}/env-data.json`,
|
|
204
210
|
"utf8"
|
|
205
211
|
)
|
|
206
212
|
)
|
|
207
|
-
} catch (e) {
|
|
213
|
+
} catch (e) {
|
|
214
|
+
console.log("env data not loading")
|
|
215
|
+
}
|
|
208
216
|
return {}
|
|
209
217
|
}
|
|
210
218
|
|
|
@@ -228,15 +236,13 @@ class Pages {
|
|
|
228
236
|
try {
|
|
229
237
|
return JSON.parse(
|
|
230
238
|
fs.readFileSync(
|
|
231
|
-
`${currentPath}/themes/${
|
|
232
|
-
this.config.theme
|
|
233
|
-
}/settings.json`,
|
|
239
|
+
`${currentPath}/themes/${this.config.theme}/settings.json`,
|
|
234
240
|
"utf8"
|
|
235
241
|
)
|
|
236
242
|
)
|
|
237
|
-
} catch (e) {
|
|
243
|
+
} catch (e) {
|
|
238
244
|
// commented for 2.0.1 release.
|
|
239
|
-
// console.log("settings not loading")
|
|
245
|
+
// console.log("settings not loading")
|
|
240
246
|
}
|
|
241
247
|
return {}
|
|
242
248
|
}
|
|
@@ -312,22 +318,27 @@ class Pages {
|
|
|
312
318
|
}
|
|
313
319
|
|
|
314
320
|
getRawMockTemplates(mockedPages) {
|
|
315
|
-
const mockedPageObject = {}
|
|
316
|
-
const mockedPagesPath = `${__dirname}/../../mockPages
|
|
321
|
+
const mockedPageObject = {}
|
|
322
|
+
const mockedPagesPath = `${__dirname}/../../mockPages`
|
|
317
323
|
mockedPages.forEach(folder => {
|
|
318
324
|
try {
|
|
319
|
-
const htmlContent = fs.readFileSync(
|
|
320
|
-
|
|
325
|
+
const htmlContent = fs.readFileSync(
|
|
326
|
+
`${mockedPagesPath}/${folder}/${folder}.html`,
|
|
327
|
+
"utf8"
|
|
328
|
+
)
|
|
329
|
+
mockedPageObject[folder] = { [`${folder}.html`]: htmlContent }
|
|
321
330
|
} catch (error) {
|
|
322
|
-
console.error(
|
|
331
|
+
console.error(
|
|
332
|
+
`ERROR: could not find ${folder}.html in ${mockedPagesPath}/${folder}`
|
|
333
|
+
)
|
|
323
334
|
}
|
|
324
335
|
})
|
|
325
|
-
return mockedPageObject
|
|
336
|
+
return mockedPageObject
|
|
326
337
|
}
|
|
327
338
|
|
|
328
339
|
getFile(isMockedPage, rawTemplates) {
|
|
329
340
|
if (isMockedPage) {
|
|
330
|
-
return `${this.page}/${this.page}.html
|
|
341
|
+
return `${this.page}/${this.page}.html`
|
|
331
342
|
}
|
|
332
343
|
return storefrontUtils.findPage(rawTemplates, {}, this)
|
|
333
344
|
}
|
|
@@ -340,7 +351,7 @@ class Pages {
|
|
|
340
351
|
rawTemplates = { ...rawTemplates, ...rawMockTemplates }
|
|
341
352
|
const assetsMapperFunc = this.getAssetsMapperFunction()
|
|
342
353
|
const pageSettings = this.layoutEditorSettings.pages
|
|
343
|
-
? this.layoutEditorSettings.pages[this.page] || {}
|
|
354
|
+
? this.layoutEditorSettings.pages[this.getPage(this.page)] || {}
|
|
344
355
|
: {}
|
|
345
356
|
const defaultGlobalStyles = {
|
|
346
357
|
namespaces: {
|
|
@@ -363,12 +374,22 @@ class Pages {
|
|
|
363
374
|
rawTemplates.pages,
|
|
364
375
|
file.split("/")
|
|
365
376
|
)
|
|
366
|
-
|
|
367
|
-
// Now we have data for the product, we determine if we need to use a specific page for the product type.
|
|
377
|
+
const updateTemplateWithPageData = data => {
|
|
368
378
|
if (this.page === "profile") {
|
|
369
|
-
file = storefrontUtils.findPage(
|
|
379
|
+
file = storefrontUtils.findPage(
|
|
380
|
+
rawTemplates,
|
|
381
|
+
data,
|
|
382
|
+
this,
|
|
383
|
+
undefined,
|
|
384
|
+
this.themeSettings
|
|
385
|
+
)
|
|
370
386
|
template = `/pages/${file}`
|
|
371
387
|
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
this.getData(pageSettings).then(data => {
|
|
391
|
+
// Now we have data for the product, we determine if we need to use a specific page for the product type.
|
|
392
|
+
updateTemplateWithPageData(data)
|
|
372
393
|
storefrontUtils.TplEngine.compile(
|
|
373
394
|
rawTemplates,
|
|
374
395
|
template,
|
|
@@ -389,14 +410,16 @@ class Pages {
|
|
|
389
410
|
html,
|
|
390
411
|
this.themePath,
|
|
391
412
|
this.config.marketplacePath,
|
|
392
|
-
this.themeSettings
|
|
413
|
+
this.themeSettings[
|
|
414
|
+
storefrontUtils.themeSettingsKeys.USE_COMPONENT
|
|
415
|
+
],
|
|
393
416
|
this.layoutEditorSettings,
|
|
394
417
|
this.getLocalization()
|
|
395
418
|
)
|
|
396
419
|
.addToolbar()
|
|
397
420
|
.addLazyLoad()
|
|
398
421
|
.addPageReload401()
|
|
399
|
-
.addDevUniversalHeader(this.headerAssets)
|
|
422
|
+
.addDevUniversalHeader(this.headerAssets, html)
|
|
400
423
|
.addChangeCurrency()
|
|
401
424
|
.addCart({ userId: 117 })
|
|
402
425
|
.addGlobalStyling(globalStyles)
|
|
@@ -2,6 +2,7 @@ const path = require("path")
|
|
|
2
2
|
const currentPath = process.cwd() // used to get current dev folder
|
|
3
3
|
const config = require(`${currentPath}/config`)
|
|
4
4
|
const storefrontUtils = require("@appdirect/storefront-utils")
|
|
5
|
+
|
|
5
6
|
let envData = {}
|
|
6
7
|
try {
|
|
7
8
|
envData = require(`${currentPath}/themes/${config.theme}/env-data.json`)
|
|
@@ -28,7 +29,8 @@ module.exports = (req, res, next) => {
|
|
|
28
29
|
marketplacePath,
|
|
29
30
|
envData: storefrontUtils.getEnvMarketplaceData(marketplacePath, envData),
|
|
30
31
|
pageObjectsPath: PAGE_OBJECTS_OVERRIDE || config.pageObjectsPath,
|
|
31
|
-
projectPath: `${path.resolve(__dirname)}
|
|
32
|
+
projectPath: `${path.resolve(__dirname)}/../`,
|
|
33
|
+
serviceName: 'sfb-toolkit'
|
|
32
34
|
}
|
|
33
35
|
return next()
|
|
34
36
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const webpack = require("webpack")
|
|
2
|
+
const fs = require("fs")
|
|
3
|
+
const fsExtra = require("fs-extra")
|
|
4
|
+
const { TOOLKIT_PATH } = require("./toolkit-common-vars")
|
|
5
|
+
|
|
6
|
+
const getConfigComponentsProdWebpack = require(`${TOOLKIT_PATH}/webpack-components.config.prod`)
|
|
7
|
+
const currentPath = process.cwd() // used to get current dev folder
|
|
8
|
+
const config = require(`${currentPath}/config`)
|
|
9
|
+
const customComponentsAssets = `${currentPath}/themes/${
|
|
10
|
+
config.theme
|
|
11
|
+
}/assets/js/components`
|
|
12
|
+
|
|
13
|
+
if (fs.existsSync(customComponentsAssets)) {
|
|
14
|
+
// Remove unnecessary hot directory for the webpack hot module reload
|
|
15
|
+
fsExtra.remove(`${customComponentsAssets}/hot`, fsError => {
|
|
16
|
+
if (fsError) {
|
|
17
|
+
console.error(fsError)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const configComponentsWebpackAsset = getConfigComponentsProdWebpack(
|
|
21
|
+
currentPath,
|
|
22
|
+
config
|
|
23
|
+
)
|
|
24
|
+
webpack(configComponentsWebpackAsset, (err, stats) => {
|
|
25
|
+
if (err || stats.hasErrors()) {
|
|
26
|
+
console.log(stats.hasErrors())
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
}
|
|
@@ -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.
|
|
18
|
+
const THEME_COMPONENT_VERSION = "0.0.272";
|
|
19
19
|
|
|
20
20
|
let WORKSPACE_CONFIG;
|
|
21
21
|
try {
|
|
@@ -8,6 +8,8 @@ const addCustomCompToBase = (baseFilePath, data) => {
|
|
|
8
8
|
fs.writeFile(baseFilePath, data, (err) => {
|
|
9
9
|
if (err) return console.error(' ERROR: Unable to perform update to use custom components.'.red);
|
|
10
10
|
console.log('Successfully installed custom components!\nPlease start/restart the toolkit server to observe the changes.'.green);
|
|
11
|
+
console.log('\n\nFor custom components documentation please execute the following command:'.green)
|
|
12
|
+
console.log('sfb-toolkit storybook\n'.cyan)
|
|
11
13
|
});
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -60,6 +62,8 @@ const settingsSchemaData = `{ "useComponents": true }`;
|
|
|
60
62
|
|
|
61
63
|
} else {
|
|
62
64
|
console.log('Theme is already setup to use custom components.'.green)
|
|
65
|
+
console.log('\n\nFor custom components documentation please execute the following command:'.green)
|
|
66
|
+
console.log('sfb-toolkit storybook\n'.cyan)
|
|
63
67
|
}
|
|
64
68
|
})
|
|
65
69
|
})();
|