@descope/web-components-ui 1.0.418 → 1.0.420

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 (233) hide show
  1. package/dist/cjs/index.cjs.js +1439 -1355
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +0 -2
  4. package/dist/index.esm.js +1983 -1091
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/umd/1172.js +240 -0
  7. package/dist/umd/{8162.js → 1396.js} +3 -3
  8. package/dist/umd/1402.js +1 -0
  9. package/dist/umd/1484.js +148 -0
  10. package/dist/umd/{5026.js → 189.js} +5 -117
  11. package/dist/umd/{6637.js → 201.js} +5 -5
  12. package/dist/umd/{1053.js → 2159.js} +13 -13
  13. package/dist/umd/2540.js +1 -0
  14. package/dist/umd/2570.js +338 -0
  15. package/dist/umd/2666.js +148 -0
  16. package/dist/umd/3110.js +275 -0
  17. package/dist/umd/{9167.js → 3191.js} +66 -12
  18. package/dist/umd/3437.js +2 -0
  19. package/dist/umd/{6418.js → 3638.js} +2 -2
  20. package/dist/umd/{7212.js → 404.js} +8 -8
  21. package/dist/umd/4114.js +124 -0
  22. package/dist/umd/{7607.js → 4127.js} +9 -9
  23. package/dist/umd/4187.js +2 -0
  24. package/dist/umd/4218.js +129 -0
  25. package/dist/umd/4455.js +422 -0
  26. package/dist/umd/4480.js +1 -1
  27. package/dist/umd/{5086.js → 4554.js} +5 -5
  28. package/dist/umd/{4834.js → 4574.js} +5 -5
  29. package/dist/umd/4619.js +1 -1
  30. package/dist/umd/4902.js +170 -0
  31. package/dist/umd/{5273.js → 507.js} +5 -5
  32. package/dist/umd/5096.js +109 -0
  33. package/dist/umd/5318.js +1 -0
  34. package/dist/umd/5414.js +2 -0
  35. package/dist/umd/5414.js.LICENSE.txt +1 -0
  36. package/dist/umd/{8164.js → 5563.js} +5 -5
  37. package/dist/umd/{7824.js → 7097.js} +5 -117
  38. package/dist/umd/7150.js +2 -0
  39. package/dist/umd/7150.js.LICENSE.txt +485 -0
  40. package/dist/umd/731.js +832 -0
  41. package/dist/umd/742.js +2 -0
  42. package/dist/umd/{351.js → 7979.js} +10 -10
  43. package/dist/umd/8823.js +1 -0
  44. package/dist/umd/{6474.js → 9030.js} +12 -12
  45. package/dist/umd/9243.js +202 -0
  46. package/dist/umd/9243.js.LICENSE.txt +51 -0
  47. package/dist/umd/{5443.js → 9478.js} +5 -117
  48. package/dist/umd/DescopeDev.js +1 -2
  49. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
  50. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
  51. package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js +1 -1
  52. package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js +1 -1
  53. package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
  54. package/dist/umd/descope-alert-index-js.js +1 -1
  55. package/dist/umd/descope-apps-list-index-js.js +1 -1
  56. package/dist/umd/descope-avatar.js +1 -0
  57. package/dist/umd/descope-button-index-js.js +4 -116
  58. package/dist/umd/descope-code-snippet-index-js.js +1 -1
  59. package/dist/umd/descope-combo-box-index-js.js +5 -5
  60. package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
  61. package/dist/umd/descope-date-field-index-js.js +1 -1
  62. package/dist/umd/descope-divider-index-js.js +1 -1
  63. package/dist/umd/descope-email-field-index-js.js +4 -4
  64. package/dist/umd/descope-enriched-text-index-js.js +1 -1
  65. package/dist/umd/descope-grid-descope-grid-custom-column-index-js.js +4 -4
  66. package/dist/umd/descope-grid-descope-grid-item-details-column-index-js.js +19 -4
  67. package/dist/umd/descope-grid-descope-grid-item-details-column-index-js.js.LICENSE.txt +12 -0
  68. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
  69. package/dist/umd/descope-grid-descope-grid-text-column-index-js.js +4 -4
  70. package/dist/umd/descope-grid-index-js.js +1 -1
  71. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  72. package/dist/umd/descope-icon-index-js.js +1 -1
  73. package/dist/umd/descope-link-index-js.js +1 -1
  74. package/dist/umd/descope-modal-index-js.js +1 -1
  75. package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
  76. package/dist/umd/descope-new-password-index-js.js +1 -1
  77. package/dist/umd/descope-notification-descope-notification-card-index-js.js +1 -1
  78. package/dist/umd/descope-notification-index-js.js +1 -1
  79. package/dist/umd/descope-number-field-index-js.js +1 -1
  80. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  81. package/dist/umd/descope-passcode-index-js.js +1 -1
  82. package/dist/umd/descope-password-index-js.js +1 -1
  83. package/dist/umd/descope-radio-group-index-js.js +1 -1
  84. package/dist/umd/descope-scopes-list-index-js.js +1 -1
  85. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  86. package/dist/umd/descope-security-questions-verify-index-js.js +2 -2
  87. package/dist/umd/descope-text-area-index-js.js +1 -1
  88. package/dist/umd/descope-text-field-index-js.js +2 -2
  89. package/dist/umd/descope-text.js +1 -0
  90. package/dist/umd/descope-third-party-app-logo-index-js.js +1 -1
  91. package/dist/umd/descope-upload-file-index-js.js +1 -1
  92. package/dist/umd/descope-user-attribute-index-js.js +1 -1
  93. package/dist/umd/descope-user-auth-method-index-js.js +1 -1
  94. package/dist/umd/index.js +1 -1
  95. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  96. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  97. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  98. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  99. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
  100. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +7 -7
  101. package/node_modules/common/.eslintrc.json +18 -0
  102. package/node_modules/common/README.md +7 -0
  103. package/node_modules/common/package.json +34 -0
  104. package/node_modules/common/project.json +7 -0
  105. package/node_modules/common/src/baseClasses/baseClasses/createBaseClass.js +66 -0
  106. package/node_modules/common/src/baseClasses/baseClasses/createBaseInputClass.js +14 -0
  107. package/node_modules/common/src/baseClasses/baseClasses/createCssVarImageClass.js +55 -0
  108. package/node_modules/common/src/baseClasses/index.js +3 -0
  109. package/node_modules/common/src/componentsHelpers/index.js +95 -0
  110. package/node_modules/common/src/componentsMixins/helpers/mixinsHelpers.js +10 -0
  111. package/node_modules/common/src/componentsMixins/index.js +1 -0
  112. package/node_modules/common/src/componentsMixins/mixins/activableMixin.js +14 -0
  113. package/node_modules/common/src/componentsMixins/mixins/changeMixin.js +22 -0
  114. package/node_modules/common/src/componentsMixins/mixins/componentNameValidationMixin.js +23 -0
  115. package/node_modules/common/src/componentsMixins/mixins/componentsContextMixin.js +12 -0
  116. package/node_modules/common/src/componentsMixins/mixins/createDynamicDataMixin.js +100 -0
  117. package/node_modules/common/src/componentsMixins/mixins/createProxy.js +58 -0
  118. package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/helpers.js +106 -0
  119. package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/index.js +167 -0
  120. package/node_modules/common/src/componentsMixins/mixins/draggableMixin.js +62 -0
  121. package/node_modules/common/src/componentsMixins/mixins/externalInputHelpers.js +93 -0
  122. package/node_modules/common/src/componentsMixins/mixins/externalInputMixin.js +170 -0
  123. package/node_modules/common/src/componentsMixins/mixins/hoverableMixin.js +13 -0
  124. package/node_modules/common/src/componentsMixins/mixins/index.js +14 -0
  125. package/node_modules/common/src/componentsMixins/mixins/inputEventsDispatchingMixin.js +76 -0
  126. package/node_modules/common/src/componentsMixins/mixins/inputValidationMixin.js +210 -0
  127. package/node_modules/common/src/componentsMixins/mixins/lifecycleEventsMixin.js +23 -0
  128. package/node_modules/common/src/componentsMixins/mixins/normalizeBooleanAttributesMixin.js +57 -0
  129. package/node_modules/common/src/componentsMixins/mixins/portalMixin.js +112 -0
  130. package/node_modules/common/src/componentsMixins/mixins/proxyInputMixin.js +242 -0
  131. package/node_modules/common/src/constants.js +4 -0
  132. package/node_modules/common/src/icons/errorMessageIconBase64.js +1 -0
  133. package/node_modules/common/src/sbControls.js +302 -0
  134. package/node_modules/common/src/themeHelpers/colorsHelpers.js +94 -0
  135. package/node_modules/common/src/themeHelpers/index.js +176 -0
  136. package/node_modules/common/src/utils/index.js +68 -0
  137. package/node_modules/descope-avatar/e2e/descope-avatar.spec.ts +54 -0
  138. package/node_modules/descope-avatar/package.json +34 -0
  139. package/node_modules/descope-avatar/project.json +7 -0
  140. package/{src/components/descope-avatar → node_modules/descope-avatar/src/component}/AvatarClass.js +4 -4
  141. package/{src/theme/components/avatar.js → node_modules/descope-avatar/src/theme.js} +3 -3
  142. package/node_modules/descope-avatar/stories/avatar.jpeg +0 -0
  143. package/node_modules/descope-avatar/stories/descope-avatar.stories.js +32 -0
  144. package/node_modules/descope-text/e2e/descope-text.spec.ts +35 -0
  145. package/node_modules/descope-text/package.json +31 -0
  146. package/node_modules/descope-text/project.json +7 -0
  147. package/{src/components/descope-text → node_modules/descope-text/src/component}/TextClass.js +4 -4
  148. package/{src/theme/components/text.js → node_modules/descope-text/src/theme.js} +3 -3
  149. package/node_modules/descope-text/stories/descope-text.stories.js +55 -0
  150. package/package.json +52 -43
  151. package/src/components/descope-alert/AlertClass.js +1 -1
  152. package/src/components/descope-apps-list/AppsListClass.js +1 -1
  153. package/src/components/descope-apps-list/index.js +2 -2
  154. package/src/components/descope-divider/DividerClass.js +1 -1
  155. package/src/components/descope-divider/index.js +1 -1
  156. package/src/components/descope-link/LinkClass.js +1 -1
  157. package/src/components/descope-link/index.js +1 -1
  158. package/src/components/descope-security-questions-verify/SecurityQuestionsVerifyClass.js +1 -1
  159. package/src/components/descope-security-questions-verify/index.js +1 -1
  160. package/src/components/descope-user-attribute/UserAttributeClass.js +1 -1
  161. package/src/components/descope-user-attribute/index.js +1 -1
  162. package/src/components/descope-user-auth-method/UserAuthMethodClass.js +1 -1
  163. package/src/components/descope-user-auth-method/index.js +1 -1
  164. package/src/components/mapping-fields/descope-mappings-field/MappingsFieldClass.js +1 -1
  165. package/src/components/mapping-fields/descope-mappings-field/index.js +1 -1
  166. package/src/helpers/themeHelpers/index.js +1 -1
  167. package/src/index.cjs.js +2 -2
  168. package/src/index.d.ts +0 -2
  169. package/src/index.js +2 -2
  170. package/src/index.umd.js +3 -1
  171. package/src/mixins/createStyleMixin/index.js +1 -1
  172. package/src/theme/components/alert.js +1 -1
  173. package/src/theme/components/comboBox.js +2 -2
  174. package/src/theme/components/enrichedText.js +1 -1
  175. package/src/theme/components/index.js +2 -2
  176. package/dist/umd/1033.js +0 -2
  177. package/dist/umd/1414.js +0 -352
  178. package/dist/umd/1437.js +0 -422
  179. package/dist/umd/1672.js +0 -1
  180. package/dist/umd/2566.js +0 -2
  181. package/dist/umd/2838.js +0 -2
  182. package/dist/umd/2838.js.LICENSE.txt +0 -1
  183. package/dist/umd/286.js +0 -148
  184. package/dist/umd/2919.js +0 -832
  185. package/dist/umd/3222.js +0 -282
  186. package/dist/umd/3607.js +0 -2
  187. package/dist/umd/3711.js +0 -123
  188. package/dist/umd/5412.js +0 -109
  189. package/dist/umd/650.js +0 -1
  190. package/dist/umd/6726.js +0 -148
  191. package/dist/umd/7407.js +0 -450
  192. package/dist/umd/8980.js +0 -143
  193. package/dist/umd/8980.js.LICENSE.txt +0 -29
  194. package/dist/umd/9632.js +0 -275
  195. package/dist/umd/9878.js +0 -1
  196. package/dist/umd/9895.js +0 -17
  197. package/dist/umd/DescopeDev.js.LICENSE.txt +0 -1
  198. package/dist/umd/bcdfe87ae253c2cf789c9a737f8d8c22.woff +0 -0
  199. package/dist/umd/descope-avatar-index-js.js +0 -1
  200. package/dist/umd/descope-text-index-js.js +0 -1
  201. /package/dist/umd/{1414.js.LICENSE.txt → 1172.js.LICENSE.txt} +0 -0
  202. /package/dist/umd/{1437.js.LICENSE.txt → 1396.js.LICENSE.txt} +0 -0
  203. /package/dist/umd/{6726.js.LICENSE.txt → 1484.js.LICENSE.txt} +0 -0
  204. /package/dist/umd/{286.js.LICENSE.txt → 189.js.LICENSE.txt} +0 -0
  205. /package/dist/umd/{6637.js.LICENSE.txt → 201.js.LICENSE.txt} +0 -0
  206. /package/dist/umd/{1053.js.LICENSE.txt → 2159.js.LICENSE.txt} +0 -0
  207. /package/dist/umd/{351.js.LICENSE.txt → 2570.js.LICENSE.txt} +0 -0
  208. /package/dist/umd/{5026.js.LICENSE.txt → 2666.js.LICENSE.txt} +0 -0
  209. /package/dist/umd/{9632.js.LICENSE.txt → 3110.js.LICENSE.txt} +0 -0
  210. /package/dist/umd/{9167.js.LICENSE.txt → 3191.js.LICENSE.txt} +0 -0
  211. /package/dist/umd/{1033.js.LICENSE.txt → 3437.js.LICENSE.txt} +0 -0
  212. /package/dist/umd/{6418.js.LICENSE.txt → 3638.js.LICENSE.txt} +0 -0
  213. /package/dist/umd/{7212.js.LICENSE.txt → 404.js.LICENSE.txt} +0 -0
  214. /package/dist/umd/{3711.js.LICENSE.txt → 4114.js.LICENSE.txt} +0 -0
  215. /package/dist/umd/{7607.js.LICENSE.txt → 4127.js.LICENSE.txt} +0 -0
  216. /package/dist/umd/{3607.js.LICENSE.txt → 4187.js.LICENSE.txt} +0 -0
  217. /package/dist/umd/{3222.js.LICENSE.txt → 4218.js.LICENSE.txt} +0 -0
  218. /package/dist/umd/{5086.js.LICENSE.txt → 4455.js.LICENSE.txt} +0 -0
  219. /package/dist/umd/{5273.js.LICENSE.txt → 4554.js.LICENSE.txt} +0 -0
  220. /package/dist/umd/{4834.js.LICENSE.txt → 4574.js.LICENSE.txt} +0 -0
  221. /package/dist/umd/{9895.js.LICENSE.txt → 4902.js.LICENSE.txt} +0 -0
  222. /package/dist/umd/{5443.js.LICENSE.txt → 507.js.LICENSE.txt} +0 -0
  223. /package/dist/umd/{5412.js.LICENSE.txt → 5096.js.LICENSE.txt} +0 -0
  224. /package/dist/umd/{8164.js.LICENSE.txt → 5563.js.LICENSE.txt} +0 -0
  225. /package/dist/umd/{7407.js.LICENSE.txt → 7097.js.LICENSE.txt} +0 -0
  226. /package/dist/umd/{2919.js.LICENSE.txt → 731.js.LICENSE.txt} +0 -0
  227. /package/dist/umd/{2566.js.LICENSE.txt → 742.js.LICENSE.txt} +0 -0
  228. /package/dist/umd/{7824.js.LICENSE.txt → 7979.js.LICENSE.txt} +0 -0
  229. /package/dist/umd/{6474.js.LICENSE.txt → 9030.js.LICENSE.txt} +0 -0
  230. /package/dist/umd/{8162.js.LICENSE.txt → 9478.js.LICENSE.txt} +0 -0
  231. /package/{src/helpers → node_modules/common/src}/themeHelpers/componentsThemeManager.js +0 -0
  232. /package/{src/components/descope-avatar → node_modules/descope-avatar/src/component}/index.js +0 -0
  233. /package/{src/components/descope-text → node_modules/descope-text/src/component}/index.js +0 -0
@@ -0,0 +1,485 @@
1
+ /*! vaadin-dev-mode:start
2
+ (function () {
3
+ 'use strict';
4
+
5
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
6
+ return typeof obj;
7
+ } : function (obj) {
8
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9
+ };
10
+
11
+ var classCallCheck = function (instance, Constructor) {
12
+ if (!(instance instanceof Constructor)) {
13
+ throw new TypeError("Cannot call a class as a function");
14
+ }
15
+ };
16
+
17
+ var createClass = function () {
18
+ function defineProperties(target, props) {
19
+ for (var i = 0; i < props.length; i++) {
20
+ var descriptor = props[i];
21
+ descriptor.enumerable = descriptor.enumerable || false;
22
+ descriptor.configurable = true;
23
+ if ("value" in descriptor) descriptor.writable = true;
24
+ Object.defineProperty(target, descriptor.key, descriptor);
25
+ }
26
+ }
27
+
28
+ return function (Constructor, protoProps, staticProps) {
29
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
30
+ if (staticProps) defineProperties(Constructor, staticProps);
31
+ return Constructor;
32
+ };
33
+ }();
34
+
35
+ var getPolymerVersion = function getPolymerVersion() {
36
+ return window.Polymer && window.Polymer.version;
37
+ };
38
+
39
+ var StatisticsGatherer = function () {
40
+ function StatisticsGatherer(logger) {
41
+ classCallCheck(this, StatisticsGatherer);
42
+
43
+ this.now = new Date().getTime();
44
+ this.logger = logger;
45
+ }
46
+
47
+ createClass(StatisticsGatherer, [{
48
+ key: 'frameworkVersionDetectors',
49
+ value: function frameworkVersionDetectors() {
50
+ return {
51
+ 'Flow': function Flow() {
52
+ if (window.Vaadin && window.Vaadin.Flow && window.Vaadin.Flow.clients) {
53
+ var flowVersions = Object.keys(window.Vaadin.Flow.clients).map(function (key) {
54
+ return window.Vaadin.Flow.clients[key];
55
+ }).filter(function (client) {
56
+ return client.getVersionInfo;
57
+ }).map(function (client) {
58
+ return client.getVersionInfo().flow;
59
+ });
60
+ if (flowVersions.length > 0) {
61
+ return flowVersions[0];
62
+ }
63
+ }
64
+ },
65
+ 'Vaadin Framework': function VaadinFramework() {
66
+ if (window.vaadin && window.vaadin.clients) {
67
+ var frameworkVersions = Object.values(window.vaadin.clients).filter(function (client) {
68
+ return client.getVersionInfo;
69
+ }).map(function (client) {
70
+ return client.getVersionInfo().vaadinVersion;
71
+ });
72
+ if (frameworkVersions.length > 0) {
73
+ return frameworkVersions[0];
74
+ }
75
+ }
76
+ },
77
+ 'AngularJs': function AngularJs() {
78
+ if (window.angular && window.angular.version && window.angular.version) {
79
+ return window.angular.version.full;
80
+ }
81
+ },
82
+ 'Angular': function Angular() {
83
+ if (window.ng) {
84
+ var tags = document.querySelectorAll("[ng-version]");
85
+ if (tags.length > 0) {
86
+ return tags[0].getAttribute("ng-version");
87
+ }
88
+ return "Unknown";
89
+ }
90
+ },
91
+ 'Backbone.js': function BackboneJs() {
92
+ if (window.Backbone) {
93
+ return window.Backbone.VERSION;
94
+ }
95
+ },
96
+ 'React': function React() {
97
+ var reactSelector = '[data-reactroot], [data-reactid]';
98
+ if (!!document.querySelector(reactSelector)) {
99
+ // React does not publish the version by default
100
+ return "unknown";
101
+ }
102
+ },
103
+ 'Ember': function Ember() {
104
+ if (window.Em && window.Em.VERSION) {
105
+ return window.Em.VERSION;
106
+ } else if (window.Ember && window.Ember.VERSION) {
107
+ return window.Ember.VERSION;
108
+ }
109
+ },
110
+ 'jQuery': function (_jQuery) {
111
+ function jQuery() {
112
+ return _jQuery.apply(this, arguments);
113
+ }
114
+
115
+ jQuery.toString = function () {
116
+ return _jQuery.toString();
117
+ };
118
+
119
+ return jQuery;
120
+ }(function () {
121
+ if (typeof jQuery === 'function' && jQuery.prototype.jquery !== undefined) {
122
+ return jQuery.prototype.jquery;
123
+ }
124
+ }),
125
+ 'Polymer': function Polymer() {
126
+ var version = getPolymerVersion();
127
+ if (version) {
128
+ return version;
129
+ }
130
+ },
131
+ 'LitElement': function LitElement() {
132
+ var version = window.litElementVersions && window.litElementVersions[0];
133
+ if (version) {
134
+ return version;
135
+ }
136
+ },
137
+ 'LitHtml': function LitHtml() {
138
+ var version = window.litHtmlVersions && window.litHtmlVersions[0];
139
+ if (version) {
140
+ return version;
141
+ }
142
+ },
143
+ 'Vue.js': function VueJs() {
144
+ if (window.Vue) {
145
+ return window.Vue.version;
146
+ }
147
+ }
148
+ };
149
+ }
150
+ }, {
151
+ key: 'getUsedVaadinElements',
152
+ value: function getUsedVaadinElements(elements) {
153
+ var version = getPolymerVersion();
154
+ var elementClasses = void 0;
155
+ // NOTE: In case you edit the code here, YOU MUST UPDATE any statistics reporting code in Flow.
156
+ // Check all locations calling the method getEntries() in
157
+ // https://github.com/vaadin/flow/blob/master/flow-server/src/main/java/com/vaadin/flow/internal/UsageStatistics.java#L106
158
+ // Currently it is only used by BootstrapHandler.
159
+ if (version && version.indexOf('2') === 0) {
160
+ // Polymer 2: components classes are stored in window.Vaadin
161
+ elementClasses = Object.keys(window.Vaadin).map(function (c) {
162
+ return window.Vaadin[c];
163
+ }).filter(function (c) {
164
+ return c.is;
165
+ });
166
+ } else {
167
+ // Polymer 3: components classes are stored in window.Vaadin.registrations
168
+ elementClasses = window.Vaadin.registrations || [];
169
+ }
170
+ elementClasses.forEach(function (klass) {
171
+ var version = klass.version ? klass.version : "0.0.0";
172
+ elements[klass.is] = { version: version };
173
+ });
174
+ }
175
+ }, {
176
+ key: 'getUsedVaadinThemes',
177
+ value: function getUsedVaadinThemes(themes) {
178
+ ['Lumo', 'Material'].forEach(function (themeName) {
179
+ var theme;
180
+ var version = getPolymerVersion();
181
+ if (version && version.indexOf('2') === 0) {
182
+ // Polymer 2: themes are stored in window.Vaadin
183
+ theme = window.Vaadin[themeName];
184
+ } else {
185
+ // Polymer 3: themes are stored in custom element registry
186
+ theme = customElements.get('vaadin-' + themeName.toLowerCase() + '-styles');
187
+ }
188
+ if (theme && theme.version) {
189
+ themes[themeName] = { version: theme.version };
190
+ }
191
+ });
192
+ }
193
+ }, {
194
+ key: 'getFrameworks',
195
+ value: function getFrameworks(frameworks) {
196
+ var detectors = this.frameworkVersionDetectors();
197
+ Object.keys(detectors).forEach(function (framework) {
198
+ var detector = detectors[framework];
199
+ try {
200
+ var version = detector();
201
+ if (version) {
202
+ frameworks[framework] = { version: version };
203
+ }
204
+ } catch (e) {}
205
+ });
206
+ }
207
+ }, {
208
+ key: 'gather',
209
+ value: function gather(storage) {
210
+ var storedStats = storage.read();
211
+ var gatheredStats = {};
212
+ var types = ["elements", "frameworks", "themes"];
213
+
214
+ types.forEach(function (type) {
215
+ gatheredStats[type] = {};
216
+ if (!storedStats[type]) {
217
+ storedStats[type] = {};
218
+ }
219
+ });
220
+
221
+ var previousStats = JSON.stringify(storedStats);
222
+
223
+ this.getUsedVaadinElements(gatheredStats.elements);
224
+ this.getFrameworks(gatheredStats.frameworks);
225
+ this.getUsedVaadinThemes(gatheredStats.themes);
226
+
227
+ var now = this.now;
228
+ types.forEach(function (type) {
229
+ var keys = Object.keys(gatheredStats[type]);
230
+ keys.forEach(function (key) {
231
+ if (!storedStats[type][key] || _typeof(storedStats[type][key]) != _typeof({})) {
232
+ storedStats[type][key] = { firstUsed: now };
233
+ }
234
+ // Discards any previously logged version number
235
+ storedStats[type][key].version = gatheredStats[type][key].version;
236
+ storedStats[type][key].lastUsed = now;
237
+ });
238
+ });
239
+
240
+ var newStats = JSON.stringify(storedStats);
241
+ storage.write(newStats);
242
+ if (newStats != previousStats && Object.keys(storedStats).length > 0) {
243
+ this.logger.debug("New stats: " + newStats);
244
+ }
245
+ }
246
+ }]);
247
+ return StatisticsGatherer;
248
+ }();
249
+
250
+ var StatisticsStorage = function () {
251
+ function StatisticsStorage(key) {
252
+ classCallCheck(this, StatisticsStorage);
253
+
254
+ this.key = key;
255
+ }
256
+
257
+ createClass(StatisticsStorage, [{
258
+ key: 'read',
259
+ value: function read() {
260
+ var localStorageStatsString = localStorage.getItem(this.key);
261
+ try {
262
+ return JSON.parse(localStorageStatsString ? localStorageStatsString : '{}');
263
+ } catch (e) {
264
+ return {};
265
+ }
266
+ }
267
+ }, {
268
+ key: 'write',
269
+ value: function write(data) {
270
+ localStorage.setItem(this.key, data);
271
+ }
272
+ }, {
273
+ key: 'clear',
274
+ value: function clear() {
275
+ localStorage.removeItem(this.key);
276
+ }
277
+ }, {
278
+ key: 'isEmpty',
279
+ value: function isEmpty() {
280
+ var storedStats = this.read();
281
+ var empty = true;
282
+ Object.keys(storedStats).forEach(function (key) {
283
+ if (Object.keys(storedStats[key]).length > 0) {
284
+ empty = false;
285
+ }
286
+ });
287
+
288
+ return empty;
289
+ }
290
+ }]);
291
+ return StatisticsStorage;
292
+ }();
293
+
294
+ var StatisticsSender = function () {
295
+ function StatisticsSender(url, logger) {
296
+ classCallCheck(this, StatisticsSender);
297
+
298
+ this.url = url;
299
+ this.logger = logger;
300
+ }
301
+
302
+ createClass(StatisticsSender, [{
303
+ key: 'send',
304
+ value: function send(data, errorHandler) {
305
+ var logger = this.logger;
306
+
307
+ if (navigator.onLine === false) {
308
+ logger.debug("Offline, can't send");
309
+ errorHandler();
310
+ return;
311
+ }
312
+ logger.debug("Sending data to " + this.url);
313
+
314
+ var req = new XMLHttpRequest();
315
+ req.withCredentials = true;
316
+ req.addEventListener("load", function () {
317
+ // Stats sent, nothing more to do
318
+ logger.debug("Response: " + req.responseText);
319
+ });
320
+ req.addEventListener("error", function () {
321
+ logger.debug("Send failed");
322
+ errorHandler();
323
+ });
324
+ req.addEventListener("abort", function () {
325
+ logger.debug("Send aborted");
326
+ errorHandler();
327
+ });
328
+ req.open("POST", this.url);
329
+ req.setRequestHeader("Content-Type", "application/json");
330
+ req.send(data);
331
+ }
332
+ }]);
333
+ return StatisticsSender;
334
+ }();
335
+
336
+ var StatisticsLogger = function () {
337
+ function StatisticsLogger(id) {
338
+ classCallCheck(this, StatisticsLogger);
339
+
340
+ this.id = id;
341
+ }
342
+
343
+ createClass(StatisticsLogger, [{
344
+ key: '_isDebug',
345
+ value: function _isDebug() {
346
+ return localStorage.getItem("vaadin." + this.id + ".debug");
347
+ }
348
+ }, {
349
+ key: 'debug',
350
+ value: function debug(msg) {
351
+ if (this._isDebug()) {
352
+ console.info(this.id + ": " + msg);
353
+ }
354
+ }
355
+ }]);
356
+ return StatisticsLogger;
357
+ }();
358
+
359
+ var UsageStatistics = function () {
360
+ function UsageStatistics() {
361
+ classCallCheck(this, UsageStatistics);
362
+
363
+ this.now = new Date();
364
+ this.timeNow = this.now.getTime();
365
+ this.gatherDelay = 10; // Delay between loading this file and gathering stats
366
+ this.initialDelay = 24 * 60 * 60;
367
+
368
+ this.logger = new StatisticsLogger("statistics");
369
+ this.storage = new StatisticsStorage("vaadin.statistics.basket");
370
+ this.gatherer = new StatisticsGatherer(this.logger);
371
+ this.sender = new StatisticsSender("https://tools.vaadin.com/usage-stats/submit", this.logger);
372
+ }
373
+
374
+ createClass(UsageStatistics, [{
375
+ key: 'maybeGatherAndSend',
376
+ value: function maybeGatherAndSend() {
377
+ var _this = this;
378
+
379
+ if (localStorage.getItem(UsageStatistics.optOutKey)) {
380
+ return;
381
+ }
382
+ this.gatherer.gather(this.storage);
383
+ setTimeout(function () {
384
+ _this.maybeSend();
385
+ }, this.gatherDelay * 1000);
386
+ }
387
+ }, {
388
+ key: 'lottery',
389
+ value: function lottery() {
390
+ return true;
391
+ }
392
+ }, {
393
+ key: 'currentMonth',
394
+ value: function currentMonth() {
395
+ return this.now.getYear() * 12 + this.now.getMonth();
396
+ }
397
+ }, {
398
+ key: 'maybeSend',
399
+ value: function maybeSend() {
400
+ var firstUse = Number(localStorage.getItem(UsageStatistics.firstUseKey));
401
+ var monthProcessed = Number(localStorage.getItem(UsageStatistics.monthProcessedKey));
402
+
403
+ if (!firstUse) {
404
+ // Use a grace period to avoid interfering with tests, incognito mode etc
405
+ firstUse = this.timeNow;
406
+ localStorage.setItem(UsageStatistics.firstUseKey, firstUse);
407
+ }
408
+
409
+ if (this.timeNow < firstUse + this.initialDelay * 1000) {
410
+ this.logger.debug("No statistics will be sent until the initial delay of " + this.initialDelay + "s has passed");
411
+ return;
412
+ }
413
+ if (this.currentMonth() <= monthProcessed) {
414
+ this.logger.debug("This month has already been processed");
415
+ return;
416
+ }
417
+ localStorage.setItem(UsageStatistics.monthProcessedKey, this.currentMonth());
418
+ // Use random sampling
419
+ if (this.lottery()) {
420
+ this.logger.debug("Congratulations, we have a winner!");
421
+ } else {
422
+ this.logger.debug("Sorry, no stats from you this time");
423
+ return;
424
+ }
425
+
426
+ this.send();
427
+ }
428
+ }, {
429
+ key: 'send',
430
+ value: function send() {
431
+ // Ensure we have the latest data
432
+ this.gatherer.gather(this.storage);
433
+
434
+ // Read, send and clean up
435
+ var data = this.storage.read();
436
+ data["firstUse"] = Number(localStorage.getItem(UsageStatistics.firstUseKey));
437
+ data["usageStatisticsVersion"] = UsageStatistics.version;
438
+ var info = 'This request contains usage statistics gathered from the application running in development mode. \n\nStatistics gathering is automatically disabled and excluded from production builds.\n\nFor details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.\n\n\n\n';
439
+ var self = this;
440
+ this.sender.send(info + JSON.stringify(data), function () {
441
+ // Revert the 'month processed' flag
442
+ localStorage.setItem(UsageStatistics.monthProcessedKey, self.currentMonth() - 1);
443
+ });
444
+ }
445
+ }], [{
446
+ key: 'version',
447
+ get: function get$1() {
448
+ return '2.1.2';
449
+ }
450
+ }, {
451
+ key: 'firstUseKey',
452
+ get: function get$1() {
453
+ return 'vaadin.statistics.firstuse';
454
+ }
455
+ }, {
456
+ key: 'monthProcessedKey',
457
+ get: function get$1() {
458
+ return 'vaadin.statistics.monthProcessed';
459
+ }
460
+ }, {
461
+ key: 'optOutKey',
462
+ get: function get$1() {
463
+ return 'vaadin.statistics.optout';
464
+ }
465
+ }]);
466
+ return UsageStatistics;
467
+ }();
468
+
469
+ try {
470
+ window.Vaadin = window.Vaadin || {};
471
+ window.Vaadin.usageStatsChecker = window.Vaadin.usageStatsChecker || new UsageStatistics();
472
+ window.Vaadin.usageStatsChecker.maybeGatherAndSend();
473
+ } catch (e) {
474
+ // Intentionally ignored as this is not a problem in the app being developed
475
+ }
476
+
477
+ }());
478
+
479
+ vaadin-dev-mode:end **/
480
+
481
+ /**
482
+ * @license
483
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
484
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
485
+ */