openstack-uicore-foundation 4.0.15 → 4.0.16

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "env": {
3
+ "test": {
4
+ "plugins": ["transform-es2015-modules-commonjs"]
5
+ }
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{"use strict";var e={};(()=>{e.d=(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})}})(),(()=>{e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var t={};function s(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){o(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function o(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}e.r(t),e.d(t,{AllowedMultipleValueQuestionType:()=>l,AnswerValuesOperator_And:()=>a,AnswerValuesOperator_Or:()=>c,CheckBoxListQuestionType:()=>n,ComboBoxQuestionType:()=>r,MainQuestionClassType:()=>b,RadioButtonListQuestionType:()=>u,VisibilityCondition_Equal:()=>f,VisibilityCondition_NotEqual:()=>p,Visibility_Visible:()=>h,default:()=>d});const r="ComboBox",n="CheckBoxList",u="RadioButtonList",l=[r,n,u],a="And",c="Or",f="Equal",p="NotEqual",h="Visible",b="MainQuestion";class d{constructor(e,t){o(this,"getRule",(e=>{let t=[];if(e.hasOwnProperty("sub_question_rules"))for(let s of e.sub_question_rules)t[s.id]=s,t=i(i({},t),this.getRule(s.sub_question));return t})),o(this,"getRules",(()=>{let e=[];for(let t of this.questions)e=i(i({},e),this.getRule(t));return e})),o(this,"allowsValues",(e=>l.includes(e.type))),o(this,"allowsValue",((e,t)=>{let s=t.value.split(",").map((e=>parseInt(e)));for(let t of s)if(!e.values.map((e=>e.id)).includes(t))return!1;return!0})),o(this,"getAnswerFor",(e=>{let t=Number.isInteger(e)?e:e.id,s=this.answers[t]||null;return s||null})),o(this,"hasValue",(e=>""!==e.value)),o(this,"answerContains",((e,t)=>e.value.split(",").includes(t))),o(this,"isSubQuestionVisible",(e=>{let t=e.answer_values_operator===a;const s=this.getAnswerFor(e.parent_question_id);if(s)switch(e.visibility_condition){case f:for(let i of e.answer_values)t=e.answer_values_operator===a?t&&this.answerContains(s,i):t||this.answerContains(s,i);break;case p:for(let i of e.answer_values)t=e.answer_values_operator===a?t&&!this.answerContains(s,i):t||!this.answerContains(s,i)}else t=e.visibility_condition!==f;return e.visibility===h?t:!t})),o(this,"isAnswered",(e=>{const t=this.getAnswerFor(e);if(e.class===b)return!e.mandatory||!!t&&(!!this.hasValue(t)&&!(this.allowsValues(e)&&!this.allowsValue(e,t)));for(let s of e.parent_rules)if(this.isSubQuestionVisible(this.rules[s]))return!e.mandatory||!!t&&(!!this.hasValue(t)&&!(this.allowsValues(e)&&!this.allowsValue(e,t)));return!0})),o(this,"checkQuestion",(e=>{let t=this.isAnswered(e);if(e.hasOwnProperty("sub_question_rules"))for(let s of e.sub_question_rules)t=t&&this.checkQuestion(s.sub_question);return t})),o(this,"completed",(()=>{let e=!0;for(let t of this.questions)e=e&&this.checkQuestion(t);return e})),this.questions=e,this.answers=[];for(let e of t)this.answers[e.question_id]=e;this.rules=this.getRules()}}return t})()}));
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "openstack-uicore-foundation",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
4
4
  "description": "ui reactjs components for openstack marketing site",
5
5
  "main": "lib/openstack-uicore-foundation.js",
6
6
  "scripts": {
7
7
  "build-dev": "./node_modules/.bin/webpack --config webpack.dev.js",
8
8
  "build": "./node_modules/.bin/webpack --config webpack.prod.js",
9
- "clean": "cd ./lib && rm -R *"
9
+ "clean": "cd ./lib && rm -R *",
10
+ "test": "jest"
10
11
  },
11
12
  "author": "smarcet@gmail.com",
12
13
  "license": "APACHE 2.0",
@@ -20,7 +21,9 @@
20
21
  "@babel/preset-react": "^7.7.4",
21
22
  "awesome-bootstrap-checkbox": "^1.0.1",
22
23
  "babel-cli": "^6.26.0",
24
+ "babel-jest": "^28.1.0",
23
25
  "babel-loader": "^8.2.4",
26
+ "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
24
27
  "browser-tabs-lock": "^1.2.15",
25
28
  "buffer": "^6.0.3",
26
29
  "crypto-js": "^4.1.1",
@@ -33,6 +36,7 @@
33
36
  "i18n-react": "^0.6.4",
34
37
  "idtoken-verifier": "^2.2.2",
35
38
  "immutability-helper": "^2.7.1",
39
+ "jest": "^28.1.0",
36
40
  "js-yaml": "^4.1.0",
37
41
  "js-yaml-loader": "^1.2.2",
38
42
  "less": "^4.1.2",
@@ -111,5 +115,30 @@
111
115
  "urijs": "^1.19.1",
112
116
  "validator": "^9.4.1",
113
117
  "video.js": "^7.8.2"
118
+ },
119
+ "jest": {
120
+ "collectCoverageFrom": [
121
+ "src/**/*.{js,jsx,mjs}"
122
+ ],
123
+ "testMatch": [
124
+ "<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
125
+ "<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
126
+ ],
127
+ "transform": {
128
+ "\\.[jt]sx?$": "babel-jest"
129
+ },
130
+ "moduleDirectories": [
131
+ "node_modules",
132
+ "src"
133
+ ],
134
+ "moduleFileExtensions": [
135
+ "web.js",
136
+ "js",
137
+ "json",
138
+ "web.jsx",
139
+ "jsx",
140
+ "node",
141
+ "mjs"
142
+ ]
114
143
  }
115
144
  }