@betterview/integration-toolkit 0.1.0

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 (79) hide show
  1. package/.eslintignore +8 -0
  2. package/.eslintrc.js +273 -0
  3. package/.prettierignore +7 -0
  4. package/.prettierrc +19 -0
  5. package/CODEOWNERS +6 -0
  6. package/README.md +2 -0
  7. package/component-harness-server/index.html +11 -0
  8. package/component-harness-server/src/App.js +34 -0
  9. package/component-harness-server/src/fonts/biotif-black-webfont.woff +0 -0
  10. package/component-harness-server/src/fonts/biotif-black-webfont.woff2 +0 -0
  11. package/component-harness-server/src/fonts/biotif-blackitalic-webfont.woff +0 -0
  12. package/component-harness-server/src/fonts/biotif-blackitalic-webfont.woff2 +0 -0
  13. package/component-harness-server/src/fonts/biotif-bold-webfont.woff +0 -0
  14. package/component-harness-server/src/fonts/biotif-bold-webfont.woff2 +0 -0
  15. package/component-harness-server/src/fonts/biotif-bolditalic-webfont.woff +0 -0
  16. package/component-harness-server/src/fonts/biotif-bolditalic-webfont.woff2 +0 -0
  17. package/component-harness-server/src/fonts/biotif-book-webfont.woff +0 -0
  18. package/component-harness-server/src/fonts/biotif-book-webfont.woff2 +0 -0
  19. package/component-harness-server/src/fonts/biotif-bookitalic-webfont.woff +0 -0
  20. package/component-harness-server/src/fonts/biotif-bookitalic-webfont.woff2 +0 -0
  21. package/component-harness-server/src/fonts/biotif-extrabold-webfont.woff +0 -0
  22. package/component-harness-server/src/fonts/biotif-extrabold-webfont.woff2 +0 -0
  23. package/component-harness-server/src/fonts/biotif-extrabolditalic-webfont.woff +0 -0
  24. package/component-harness-server/src/fonts/biotif-extrabolditalic-webfont.woff2 +0 -0
  25. package/component-harness-server/src/fonts/biotif-light-webfont.woff +0 -0
  26. package/component-harness-server/src/fonts/biotif-light-webfont.woff2 +0 -0
  27. package/component-harness-server/src/fonts/biotif-lightitalic-webfont.woff +0 -0
  28. package/component-harness-server/src/fonts/biotif-lightitalic-webfont.woff2 +0 -0
  29. package/component-harness-server/src/fonts/biotif-medium-webfont.woff +0 -0
  30. package/component-harness-server/src/fonts/biotif-medium-webfont.woff2 +0 -0
  31. package/component-harness-server/src/fonts/biotif-mediumitalic-webfont.woff +0 -0
  32. package/component-harness-server/src/fonts/biotif-mediumitalic-webfont.woff2 +0 -0
  33. package/component-harness-server/src/fonts/biotif-regular-webfont.woff +0 -0
  34. package/component-harness-server/src/fonts/biotif-regular-webfont.woff2 +0 -0
  35. package/component-harness-server/src/fonts/biotif-regularitalic-webfont.woff +0 -0
  36. package/component-harness-server/src/fonts/biotif-regularitalic-webfont.woff2 +0 -0
  37. package/component-harness-server/src/fonts/biotif-semibold-webfont.woff +0 -0
  38. package/component-harness-server/src/fonts/biotif-semibold-webfont.woff2 +0 -0
  39. package/component-harness-server/src/fonts/biotif-semibolditalic-webfont.woff +0 -0
  40. package/component-harness-server/src/fonts/biotif-semibolditalic-webfont.woff2 +0 -0
  41. package/component-harness-server/src/fonts/pensumpro-black.otf +0 -0
  42. package/component-harness-server/src/fonts/pensumpro-blackitalic.otf +0 -0
  43. package/component-harness-server/src/fonts/pensumpro-bold.otf +0 -0
  44. package/component-harness-server/src/fonts/pensumpro-bolditalic.otf +0 -0
  45. package/component-harness-server/src/fonts/pensumpro-book.otf +0 -0
  46. package/component-harness-server/src/fonts/pensumpro-bookitalic.otf +0 -0
  47. package/component-harness-server/src/fonts/pensumpro-extrabold.otf +0 -0
  48. package/component-harness-server/src/fonts/pensumpro-extrabolditalic.otf +0 -0
  49. package/component-harness-server/src/fonts/pensumpro-extralight.otf +0 -0
  50. package/component-harness-server/src/fonts/pensumpro-extralightitalic.otf +0 -0
  51. package/component-harness-server/src/fonts/pensumpro-light.otf +0 -0
  52. package/component-harness-server/src/fonts/pensumpro-lightitalic.otf +0 -0
  53. package/component-harness-server/src/fonts/pensumpro-medium.otf +0 -0
  54. package/component-harness-server/src/fonts/pensumpro-mediumitalic.otf +0 -0
  55. package/component-harness-server/src/fonts/pensumpro-regular.otf +0 -0
  56. package/component-harness-server/src/fonts/pensumpro-regularitalic.otf +0 -0
  57. package/component-harness-server/src/fonts/pensumpro-thin.otf +0 -0
  58. package/component-harness-server/src/fonts/pensumpro-thinitalic.otf +0 -0
  59. package/component-harness-server/src/index.js +5 -0
  60. package/component-harness-server/src/styles/betterview.styl +34 -0
  61. package/component-harness-server/src/styles/fonts.styl +208 -0
  62. package/component-harness-server/src/styles/mixins.styl +23 -0
  63. package/component-harness-server/src/styles/reset.styl +28 -0
  64. package/component-harness-server/src/styles/vars.styl +77 -0
  65. package/component-harness-server/src/styles.styl +29 -0
  66. package/package.json +65 -0
  67. package/src/ComponentHarness/index.ts +93 -0
  68. package/src/Deployment/index.ts +72 -0
  69. package/src/Network/axios-error-handling.ts +76 -0
  70. package/src/Network/index.ts +14 -0
  71. package/src/TestHarness/index.ts +48 -0
  72. package/src/dummy.test.ts +1 -0
  73. package/src/types/IEnrichmentIntegration.ts +73 -0
  74. package/src/types/IPartnerDataSchema.ts +39 -0
  75. package/src/types/index.ts +2 -0
  76. package/src/utils/index.ts +5 -0
  77. package/tsconfig.build.json +14 -0
  78. package/tsconfig.eslint.json +20 -0
  79. package/tsconfig.json +20 -0
@@ -0,0 +1,208 @@
1
+ @font-face
2
+ font-family: 'Biotif'
3
+ src: url('../fonts/biotif-black-webfont.woff2') format('woff2'),
4
+ url('../fonts/biotif-black-webfont.woff') format('woff')
5
+ font-weight: 900
6
+ font-style: normal
7
+
8
+ @font-face
9
+ font-family: 'Biotif'
10
+ src: url('../fonts/biotif-blackitalic-webfont.woff2') format('woff2'),
11
+ url('../fonts/biotif-blackitalic-webfont.woff') format('woff')
12
+ font-weight: 900
13
+ font-style: italic
14
+
15
+ @font-face
16
+ font-family: 'Biotif'
17
+ src: url('../fonts/biotif-bold-webfont.woff2') format('woff2'),
18
+ url('../fonts/biotif-bold-webfont.woff') format('woff')
19
+ font-weight: 700
20
+ font-style: normal
21
+
22
+ @font-face
23
+ font-family: 'Biotif'
24
+ src: url('../fonts/biotif-bolditalic-webfont.woff2') format('woff2'),
25
+ url('../fonts/biotif-bolditalic-webfont.woff') format('woff')
26
+ font-weight: 700
27
+ font-style: italic
28
+
29
+ @font-face
30
+ font-family: 'Biotif'
31
+ src: url('../fonts/biotif-book-webfont.woff2') format('woff2'),
32
+ url('../fonts/biotif-book-webfont.woff') format('woff')
33
+ font-weight: 300
34
+ font-style: normal
35
+
36
+ @font-face
37
+ font-family: 'Biotif'
38
+ src: url('../fonts/biotif-bookitalic-webfont.woff2') format('woff2'),
39
+ url('../fonts/biotif-bookitalic-webfont.woff') format('woff')
40
+ font-weight: 300
41
+ font-style: italic
42
+
43
+ @font-face
44
+ font-family: 'Biotif'
45
+ src: url('../fonts/biotif-extrabold-webfont.woff2') format('woff2'),
46
+ url('../fonts/biotif-extrabold-webfont.woff') format('woff')
47
+ font-weight: 800
48
+ font-style: normal
49
+
50
+ @font-face
51
+ font-family: 'Biotif'
52
+ src: url('../fonts/biotif-extrabolditalic-webfont.woff2') format('woff2'),
53
+ url('../fonts/biotif-extrabolditalic-webfont.woff') format('woff')
54
+ font-weight: 800
55
+ font-style: italic
56
+
57
+ @font-face
58
+ font-family: 'Biotif'
59
+ src: url('../fonts/biotif-light-webfont.woff2') format('woff2'),
60
+ url('../fonts/biotif-light-webfont.woff') format('woff')
61
+ font-weight: 200
62
+ font-style: normal
63
+
64
+ @font-face
65
+ font-family: 'Biotif'
66
+ src: url('../fonts/biotif-lightitalic-webfont.woff2') format('woff2'),
67
+ url('../fonts/biotif-lightitalic-webfont.woff') format('woff')
68
+ font-weight: 200
69
+ font-style: italic
70
+
71
+ @font-face
72
+ font-family: 'Biotif'
73
+ src: url('../fonts/biotif-medium-webfont.woff2') format('woff2'),
74
+ url('../fonts/biotif-medium-webfont.woff') format('woff')
75
+ font-weight: 500
76
+ font-style: normal
77
+
78
+ @font-face
79
+ font-family: 'Biotif'
80
+ src: url('../fonts/biotif-mediumitalic-webfont.woff2') format('woff2'),
81
+ url('../fonts/biotif-mediumitalic-webfont.woff') format('woff')
82
+ font-weight: 500
83
+ font-style: italic
84
+
85
+ @font-face
86
+ font-family: 'Biotif'
87
+ src: url('../fonts/biotif-regular-webfont.woff2') format('woff2'),
88
+ url('../fonts/biotif-regular-webfont.woff') format('woff')
89
+ font-weight: 400
90
+ font-style: normal
91
+
92
+
93
+ @font-face
94
+ font-family: 'Biotif'
95
+ src: url('../fonts/biotif-regularitalic-webfont.woff2') format('woff2'),
96
+ url('../fonts/biotif-regularitalic-webfont.woff') format('woff')
97
+ font-weight: 400
98
+ font-style: italic
99
+
100
+ @font-face
101
+ font-family: 'Biotif'
102
+ src: url('../fonts/biotif-semibold-webfont.woff2') format('woff2'),
103
+ url('../fonts/biotif-semibold-webfont.woff') format('woff')
104
+ font-weight: 600
105
+ font-style: normal
106
+
107
+ @font-face
108
+ font-family: 'Biotif'
109
+ src: url('../fonts/biotif-semibolditalic-webfont.woff2') format('woff2'),
110
+ url('../fonts/biotif-semibolditalic-webfont.woff') format('woff')
111
+ font-weight: 600
112
+ font-style: italic
113
+
114
+ @font-face
115
+ font-family: 'Pensum Pro'
116
+ src: url('../fonts/pensumpro-black.otf') format('opentype')
117
+ font-weight: 900
118
+ font-style: normal
119
+
120
+ @font-face
121
+ font-family: 'Pensum Pro'
122
+ src: url('../fonts/pensumpro-blackitalic.otf') format('opentype')
123
+ font-weight: 900
124
+ font-style: italic
125
+
126
+ @font-face
127
+ font-family: 'Pensum Pro'
128
+ src: url('../fonts/pensumpro-bold.otf') format('opentype')
129
+ font-weight: 800
130
+ font-style: normal
131
+
132
+ @font-face
133
+ font-family: 'Pensum Pro'
134
+ src: url('../fonts/pensumpro-bolditalic.otf') format('opentype')
135
+ font-weight: 800
136
+ font-style: italic
137
+
138
+ @font-face
139
+ font-family: 'Pensum Pro'
140
+ src: url('../fonts/pensumpro-book.otf') format('opentype')
141
+ font-weight: 700
142
+ font-style: normal
143
+
144
+ @font-face
145
+ font-family: 'Pensum Pro'
146
+ src: url('../fonts/pensumpro-bookitalic.otf') format('opentype')
147
+ font-weight: 700
148
+ font-style: italic
149
+
150
+ @font-face
151
+ font-family: 'Pensum Pro'
152
+ src: url('../fonts/pensumpro-extralight.otf') format('opentype')
153
+ font-weight: 500
154
+ font-style: normal
155
+
156
+ @font-face
157
+ font-family: 'Pensum Pro'
158
+ src: url('../fonts/pensumpro-extralightitalic.otf') format('opentype')
159
+ font-weight: 500
160
+ font-style: italic
161
+
162
+ @font-face
163
+ font-family: 'Pensum Pro'
164
+ src: url('../fonts/pensumpro-light.otf') format('opentype')
165
+ font-weight: 400
166
+ font-style: normal
167
+
168
+ @font-face
169
+ font-family: 'Pensum Pro'
170
+ src: url('../fonts/pensumpro-lightitalic.otf') format('opentype')
171
+ font-weight: 400
172
+ font-style: italic
173
+
174
+ @font-face
175
+ font-family: 'Pensum Pro'
176
+ src: url('../fonts/pensumpro-medium.otf') format('opentype')
177
+ font-weight: 300
178
+ font-style: normal
179
+
180
+ @font-face
181
+ font-family: 'Pensum Pro'
182
+ src: url('../fonts/pensumpro-mediumitalic.otf') format('opentype')
183
+ font-weight: 300
184
+ font-style: italic
185
+
186
+ @font-face
187
+ font-family: 'Pensum Pro'
188
+ src: url('../fonts/pensumpro-regular.otf') format('opentype')
189
+ font-weight: 200
190
+ font-style: normal
191
+
192
+ @font-face
193
+ font-family: 'Pensum Pro'
194
+ src: url('../fonts/pensumpro-regularitalic.otf') format('opentype')
195
+ font-weight: 200
196
+ font-style: italic
197
+
198
+ @font-face
199
+ font-family: 'Pensum Pro'
200
+ src: url('../fonts/pensumpro-thin.otf') format('opentype')
201
+ font-weight: 100
202
+ font-style: normal
203
+
204
+ @font-face
205
+ font-family: 'Pensum Pro'
206
+ src: url('../fonts/pensumpro-thinitalic.otf') format('opentype')
207
+ font-weight: 100
208
+ font-style: italic
@@ -0,0 +1,23 @@
1
+ disableSelect()
2
+ -webkit-touch-callout: none
3
+ -webkit-user-select: none
4
+ -khtml-user-select: none
5
+ -moz-user-select: none
6
+ -ms-user-select: none
7
+ user-select: none
8
+
9
+ visibleScrollbar()
10
+ &::-webkit-scrollbar
11
+ -webkit-appearance: none
12
+ width: 7px
13
+
14
+ &::-webkit-scrollbar-thumb
15
+ border-radius: 4px
16
+ background-color: rgba(0, 0, 0, .5)
17
+ -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5)
18
+
19
+ fillAvailableSpace()
20
+ width: 100%
21
+ width: -moz-available /* WebKit-based browsers will ignore this. */
22
+ width: -webkit-fill-available /* Mozilla-based browsers will ignore this. */
23
+ width: fill-available
@@ -0,0 +1,28 @@
1
+ /* HTML5 display-role reset for older browsers */
2
+ article, aside, details, figcaption, figure,
3
+ footer, header, hgroup, menu, nav, section
4
+ display: block
5
+
6
+ body
7
+ line-height: 1
8
+
9
+ ol, ul
10
+ list-style: none
11
+
12
+ blockquote, q
13
+ quotes: none
14
+
15
+ blockquote:before, blockquote:after,
16
+ q:before, q:after
17
+ content: ''
18
+ content: none
19
+
20
+ table
21
+ border-collapse: collapse
22
+ border-spacing: 0
23
+
24
+ button:focus
25
+ outline: 0
26
+
27
+ ins, del
28
+ text-decoration: none
@@ -0,0 +1,77 @@
1
+ // colors
2
+ $betterviewBlue = rgba(0, 144, 218, 1) // #0090DA
3
+ $blueHoverState = rgba(0, 144, 218, 0.08)
4
+ $blueLightHoverState = rgba(0, 144, 218, 0.04)
5
+ $betterviewRed = rgb(255, 10, 57)
6
+ $betterviewGreen = rgb(0, 220, 79)
7
+ $betterviewOrange = rgb(255, 145, 0)
8
+ $betterviewYellow = rgb(255, 235, 59)
9
+ //this is the same as charcoal, but since we refer to it so much i think its worth calling it a betterview color.
10
+ $betterviewBlack = rgb(37,40,42)
11
+
12
+ $navy = #1c2851
13
+ $black = #23272b
14
+ $charcoal = rgb(37,40,42)
15
+ $blue = rgba(0, 144, 218, 1)
16
+ $borderColor = #eff0ed
17
+ $gray = #c6c8c5
18
+ $grayText = rgba(37, 40, 42, 0.6)
19
+ $grayUnderline = #B0B8BF
20
+ $green = rgb(0, 220, 79) // #00DC4F
21
+ $inputHighlightColor = #f8fbff
22
+ $inputSelectionColor = #fdfad8
23
+ $inputLabelColor = rgba(37, 40, 42, 1)
24
+ $inputPlaceholderColor = rgba(37, 40, 42, 0.3)
25
+ $inputGroupBorderColor = rgba(37, 40, 42, 0.2)
26
+ $lightBlue = #5bceff
27
+ $lightGray = #eeefee
28
+ $orange = #ff8200
29
+ $red = rgb(255, 10, 57) // #FF0A39
30
+ $redError = #e04e39
31
+ $searchColor = #fff
32
+ $secondaryBorderColor = #447d95
33
+ $sidebarBorderColor = #4A4A4A
34
+ $trueblack = #000
35
+ $white = #fff
36
+ $yellow = #fdd835
37
+
38
+ // colors based on others
39
+ $disabledText = rgba($black, .6)
40
+ $placeholderText = lighten($black, 40%)
41
+
42
+ // fonts
43
+ $primaryFont = Biotif, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
44
+ $primaryBoldFont = Biotif-Bold, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
45
+ $primaryBookFont = Biotif-Book, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
46
+ $secondaryFont = Biotif, 'Montserrat', sans-serif
47
+ $mediumFont = Biotif, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
48
+ $lightFont = Biotif, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
49
+
50
+ $subtextFont = Pensum, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
51
+ $subtextFontPro = Pensum Pro, -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif
52
+
53
+ // global light direction
54
+ $lightOffsetX = 0
55
+ $lightOffsetY = .2rem
56
+
57
+ // z-index
58
+ $layer0 = 0
59
+ $layer1 = 1000
60
+ $layer2 = 2000
61
+ $layer3 = 3000
62
+ $layer4 = 4000
63
+ $layer5 = 5000
64
+ $layer6 = 6000
65
+ $layer7 = 7000
66
+ $layer8 = 8000
67
+ $layer9 = 9000
68
+
69
+ //global heights
70
+ $primaryNavbarHeight = 6.4rem
71
+ $propertyProfileTopBarHeight = 11.4rem
72
+
73
+ $xs = 0px
74
+ $sm = 600px
75
+ $md = 960px
76
+ $lg = 1280px
77
+ $xl = 1920px
@@ -0,0 +1,29 @@
1
+
2
+ @import './styles/betterview.styl'
3
+
4
+ body
5
+ background-color: rgba(230, 230, 230, 1)
6
+
7
+ .root
8
+ margin-left: auto
9
+ margin-right: auto
10
+ width: 497px
11
+ background-color: white
12
+ margin-top: 40px
13
+ padding: 30px
14
+
15
+
16
+ .contentWrapper
17
+ margin-top: 20px
18
+
19
+ .componentContainer
20
+ margin-top: 20px
21
+ margin-left: auto
22
+ margin-right: auto
23
+ padding-bottom: 500px;
24
+
25
+ .showBorder
26
+ border: solid 1px rgba(125, 125, 125, 1)
27
+
28
+ .hideBorder
29
+ border: solid 1px rgba(125, 125, 125, 0)
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@betterview/integration-toolkit",
3
+ "version": "0.1.0",
4
+ "description": "Supports integration packages. This should be the only import from our integrations",
5
+ "scripts": {
6
+ "build": "rm -rf lib && npm run lint && tsc -p tsconfig.build.json",
7
+ "lint": "eslint . --ext .ts,.js",
8
+ "lint:fix": "npm run lint -- --fix",
9
+ "test": "jest --runInBand",
10
+ "test:debug": "node --inspect-brk node_modules/.bin/jest --forceExit --detectOpenHandles --verbose",
11
+ "test:debug:watch": "node --inspect-brk node_modules/.bin/jest --watch --forceExit --detectOpenHandles --verbose",
12
+ "test:coverage": "npm test -- --collectCoverage && open ./coverage/lcov-report/index.html",
13
+ "test:watch": "jest --watch --detectOpenHandles"
14
+ },
15
+ "author": "",
16
+ "license": "UNLICENSED",
17
+ "dependencies": {
18
+ "@material-ui/core": "^4.12.3",
19
+ "async": "^2.6.3",
20
+ "axios": "^0.21.1",
21
+ "classnames": "^2.3.1",
22
+ "css-loader": "^6.2.0",
23
+ "fs-extra": "^10.0.0",
24
+ "json-colorizer": "^2.2.2",
25
+ "react": "^17.0.2",
26
+ "react-dom": "^17.0.2",
27
+ "style-loader": "^3.2.1",
28
+ "stylus": "^0.54.8",
29
+ "stylus-loader": "^6.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "@babel/core": "^7.15.0",
33
+ "@babel/preset-env": "^7.15.0",
34
+ "@babel/preset-react": "^7.14.5",
35
+ "@types/jest": "26.0.24",
36
+ "@types/webpack": "^4.41.30",
37
+ "@types/webpack-dev-server": "^4.0.3",
38
+ "@typescript-eslint/eslint-plugin": "4.26.1",
39
+ "@typescript-eslint/eslint-plugin-tslint": "4.26.1",
40
+ "@typescript-eslint/parser": "4.26.1",
41
+ "babel-eslint": "^10.1.0",
42
+ "babel-loader": "^8.2.2",
43
+ "eslint": "^7.22.0",
44
+ "eslint-config-prettier": "6.10.1",
45
+ "eslint-plugin-import": "^2.22.1",
46
+ "eslint-plugin-jsdoc": "30.7.13",
47
+ "eslint-plugin-prefer-arrow": "1.2.3",
48
+ "eslint-plugin-prettier": "3.3.1",
49
+ "eslint-plugin-react": "7.22.0",
50
+ "eslint-plugin-sonarjs": "0.6.0",
51
+ "html-webpack-plugin": "^5.3.2",
52
+ "jest": "26.6.3",
53
+ "ts-jest": "26.5.5",
54
+ "ts-node": "8.8.2",
55
+ "tslint": "^6.1.3",
56
+ "tslint-config-prettier": "1.18.0",
57
+ "typescript": "4.3.2",
58
+ "webpack": "^5.51.1",
59
+ "webpack-cli": "^4.8.0",
60
+ "webpack-dev-server": "^4.0.0"
61
+ },
62
+ "engines": {
63
+ "node": "^10 || ^14"
64
+ }
65
+ }
@@ -0,0 +1,93 @@
1
+ import path from 'path';
2
+ import webpack, { Configuration as CompilerConfig } from 'webpack';
3
+ import WebpackDevServer, { Configuration as ServerConfig } from 'webpack-dev-server';
4
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
5
+
6
+ // we are attempting to get our bas /integration-toolkit directory here
7
+
8
+ const basePath = path.join(__dirname, '../../');
9
+ const enrichmentIntegrationBasePath = path.join(path.dirname(require.main!.filename), '../');
10
+ const rootPath = path.join(basePath, '/component-harness-server/');
11
+ const node_modules_path = path.join(basePath, '/node_modules/');
12
+
13
+ const serverConfig: ServerConfig = {
14
+ port: 3000,
15
+ open: true,
16
+ client: {
17
+ progress: true
18
+ },
19
+ host: '127.0.0.1'
20
+ };
21
+ const compilerConfig: CompilerConfig = {
22
+ entry: [path.join(rootPath, '/src/index.js')],
23
+ mode: 'development',
24
+ output: {
25
+ filename: 'bundle.js',
26
+ path: path.resolve(__dirname, 'dist')
27
+ },
28
+ resolve: {
29
+ alias: {
30
+ main: path.resolve(node_modules_path),
31
+ components: path.resolve(enrichmentIntegrationBasePath, 'enrichmentComponent')
32
+ }
33
+ },
34
+ module: {
35
+ rules: [
36
+ {
37
+ test: /\.?js$/,
38
+ exclude: /node_modules/,
39
+ include: [path.join(rootPath, '/src'), path.join(enrichmentIntegrationBasePath, 'enrichmentComponent')],
40
+ use: {
41
+ loader: path.join(node_modules_path, 'babel-loader'),
42
+ options: {
43
+ presets: [
44
+ path.join(node_modules_path, '@babel/preset-env'),
45
+ path.join(node_modules_path, '@babel/preset-react')
46
+ ]
47
+ }
48
+ }
49
+ },
50
+ {
51
+ test: /\.styl$/,
52
+ include: [path.join(rootPath, '/src'), path.join(enrichmentIntegrationBasePath, 'enrichmentComponent')],
53
+ exclude: /node_modules/,
54
+ parser: {
55
+ node: true
56
+ },
57
+ use: [
58
+ path.join(node_modules_path, 'style-loader'),
59
+ {
60
+ loader: path.join(node_modules_path, 'css-loader'),
61
+ options: {
62
+ importLoaders: 1,
63
+ modules: {
64
+ localIdentName: '[path]__[local]'
65
+ },
66
+ sourceMap: true
67
+ }
68
+ },
69
+ {
70
+ loader: path.join(node_modules_path, 'stylus-loader'),
71
+ options: {
72
+ stylusOptions: {
73
+ outputStyle: 'expanded',
74
+ include: [path.join(rootPath, '/src'), path.join(enrichmentIntegrationBasePath, 'enrichmentComponent')]
75
+ }
76
+ }
77
+ }
78
+ ]
79
+ }
80
+ ]
81
+ },
82
+ plugins: [
83
+ new HtmlWebpackPlugin({
84
+ template: path.join(rootPath, 'index.html')
85
+ })
86
+ ]
87
+ };
88
+
89
+ export default async function ComponentServer() {
90
+ const compiler = webpack(compilerConfig);
91
+ const s = new WebpackDevServer(serverConfig, compiler);
92
+ s.start();
93
+ }
@@ -0,0 +1,72 @@
1
+ import { IEnrichmentIntegration } from '../Types';
2
+
3
+ export type DatabaseScript = {
4
+ run: string;
5
+ rollback: string;
6
+ };
7
+
8
+ export type PartnerHubInstallScripts = {
9
+ install_partner: DatabaseScript;
10
+ install_flags: DatabaseScript;
11
+ };
12
+
13
+ export function generateDatabaseScripts(
14
+ integration: IEnrichmentIntegration,
15
+ billingProviderId: number
16
+ ): PartnerHubInstallScripts {
17
+ const { offering, partner } = integration.registration;
18
+ const intName = `${partner.toLowerCase()}_${offering.toLowerCase()}`;
19
+
20
+ const ph_create = `
21
+ create table if not exists ph.${intName} (
22
+ id bigint not null primary key default id_generator(1),
23
+ property_id int not null,
24
+ request_url text,
25
+ response jsonb,
26
+ added timestamptz not null default now()
27
+ );
28
+
29
+ insert into billing.provider (id, name) values (${billingProviderId}, '${partner}');
30
+ insert into ph.partner_offering (partner, offering, table_name, matrix_option, credentials_schema) values ('${partner}', '${offering}', '${intName}', 'include_${intName}', '{}');
31
+ ;
32
+ `;
33
+
34
+ const ph_rollback = `
35
+ drop table ph.${intName};
36
+ delete from billing.provider where id = ${billingProviderId};
37
+ `;
38
+
39
+ const flag_create = `
40
+ do $$
41
+ declare
42
+ sectionid bigint;
43
+ subsectionid bigint;
44
+ begin
45
+ insert into flags.options_section (display, position, color) values ('${partner}', 999, '#000000') returning id into sectionid;
46
+
47
+ insert into flags.options_subsection(options_section_id, display)
48
+ values (sectionid, '${partner} ${offering}')
49
+ returning id into subsectionid;
50
+
51
+ insert into flags.option(options_subsection_id, display, type, source, key, placeholder)
52
+ values (subsectionid, 'Match Value(s)', 'value', '${intName}', 'custom', 'Case-insesitive, comma separated');
53
+ end $$;
54
+ `;
55
+
56
+ const flag_rollback = `
57
+ delete from flags.option where source = '${intName}' and key = 'custom';
58
+ delete from flags.options_subsection where display = '${partner} ${offering}';
59
+ delete from flags.options_section where display = '${partner}' and position = 999;
60
+ `;
61
+
62
+ return {
63
+ install_partner: {
64
+ run: ph_create,
65
+ rollback: ph_rollback
66
+ },
67
+ install_flags: {
68
+ run: flag_create,
69
+ rollback: flag_rollback
70
+ }
71
+ };
72
+ }
@@ -0,0 +1,76 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+
3
+ export type FriendlyName =
4
+ | 'server error'
5
+ | 'no response'
6
+ | 'request init failure'
7
+ | 'auth error'
8
+ | 'endpoint not found';
9
+
10
+ export interface SimplifiedError {
11
+ /** the status code number (e.g. 500) */
12
+ statusCode?: number;
13
+ data?: any;
14
+ /** the status code name (e.g. ETIMEDOUT) */
15
+ code?: string;
16
+ responseHeaders?: Record<string, string>;
17
+ /**
18
+ * server error: the server responded with an error
19
+ * no repsonse: no response was received from the server
20
+ * request init failure: axios failed to create the request to send
21
+ */
22
+ friendly: FriendlyName;
23
+ }
24
+
25
+ /** simplifies an axios error, exposing the properties that are commonly used and friendly name to help decision trees */
26
+ export function simplifyError(err: AxiosError): SimplifiedError {
27
+ let friendly: FriendlyName = 'request init failure';
28
+ const statusCode = `${err.code ?? err.response?.status}`;
29
+ if (err.response) friendly = convertStatusCode(statusCode);
30
+ else if (err.request) friendly = 'no response';
31
+
32
+ return {
33
+ statusCode: err.response?.status,
34
+ data: err.response?.data,
35
+ code: statusCode,
36
+ responseHeaders: err.response?.headers,
37
+ friendly
38
+ };
39
+ }
40
+
41
+ export interface IWrapResult<T> {
42
+ data?: T;
43
+ headers?: Record<string, string>;
44
+ err?: SimplifiedError;
45
+ }
46
+
47
+ function convertStatusCode(code: string): FriendlyName {
48
+ switch (code) {
49
+ case '401':
50
+ return 'auth error';
51
+ case '500':
52
+ return 'server error';
53
+ case '404':
54
+ return 'endpoint not found';
55
+ default:
56
+ return 'no response';
57
+ }
58
+ }
59
+
60
+ /** wraps an axios api call, resulting in a successful promise containing either the requested data or a simplfied error */
61
+ export async function wrap<T>(axiosApiCall: Promise<AxiosResponse<T> | AxiosError<T>>): Promise<IWrapResult<T>> {
62
+ const result: IWrapResult<T> = {};
63
+ try {
64
+ let r = await axiosApiCall;
65
+ if ((r as AxiosError).isAxiosError !== undefined) {
66
+ throw r;
67
+ }
68
+ r = r as AxiosResponse<T>;
69
+ result.headers = r.headers;
70
+ result.data = r.data;
71
+ } catch (err) {
72
+ const simple = simplifyError(err as AxiosError<any>);
73
+ result.err = simple;
74
+ }
75
+ return result;
76
+ }
@@ -0,0 +1,14 @@
1
+ import { IWrapResult, wrap } from './axios-error-handling';
2
+ import axios, { AxiosRequestConfig } from 'axios';
3
+
4
+ export async function get(url: string, config: AxiosRequestConfig): Promise<IWrapResult<Record<string, any>>> {
5
+ return wrap(axios.get<Record<string, any>>(url, config));
6
+ }
7
+
8
+ export async function post(
9
+ url: string,
10
+ data: any,
11
+ config: AxiosRequestConfig
12
+ ): Promise<IWrapResult<Record<string, any>>> {
13
+ return wrap(axios.post<Record<string, any>>(url, data, config));
14
+ }