openstack-uicore-foundation 5.0.3 → 5.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/lib/components/attendance-tracker.js.map +1 -1
- package/lib/components/clock.js.map +1 -1
- package/lib/components/extra-questions.js.map +1 -1
- package/lib/components/forms/simple-form.js.map +1 -1
- package/lib/components/free-text-search.js.map +1 -1
- package/lib/components/google-map.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/inputs/access-levels-input.js.map +1 -1
- package/lib/components/inputs/attendee-input.js.map +1 -1
- package/lib/components/inputs/company-input-v2.js.map +1 -1
- package/lib/components/inputs/company-input.js.map +1 -1
- package/lib/components/inputs/country-dropdown.js.map +1 -1
- package/lib/components/inputs/country-input.js.map +1 -1
- package/lib/components/inputs/event-input.js.map +1 -1
- package/lib/components/inputs/group-input.js.map +1 -1
- package/lib/components/inputs/language-input.js.map +1 -1
- package/lib/components/inputs/member-input.js.map +1 -1
- package/lib/components/inputs/organization-input.js.map +1 -1
- package/lib/components/inputs/promocode-input.js.map +1 -1
- package/lib/components/inputs/registration-company-input.js.map +1 -1
- package/lib/components/inputs/speaker-input.js.map +1 -1
- package/lib/components/inputs/sponsor-input.js.map +1 -1
- package/lib/components/inputs/summit-input.js.map +1 -1
- package/lib/components/inputs/tag-input.js.map +1 -1
- package/lib/components/inputs/ticket-types-input.js.map +1 -1
- package/lib/components/inputs/upload-input-v2.js.map +1 -1
- package/lib/components/inputs/upload-input-v3.js.map +1 -1
- package/lib/components/mui/dropdown-checkbox.js +1 -1
- package/lib/components/mui/dropdown-checkbox.js.map +1 -1
- package/lib/components/mui/editable-table.js +1 -1
- package/lib/components/mui/editable-table.js.map +1 -1
- package/lib/components/mui/formik-inputs/additional-input-list.js +1 -1
- package/lib/components/mui/formik-inputs/additional-input-list.js.map +1 -1
- package/lib/components/mui/formik-inputs/additional-input.js +1 -1
- package/lib/components/mui/formik-inputs/additional-input.js.map +1 -1
- package/lib/components/mui/formik-inputs/company-input.js.map +1 -1
- package/lib/components/mui/formik-inputs/item-price-tiers.js.map +1 -1
- package/lib/components/mui/formik-inputs/sponsor-input.js.map +1 -1
- package/lib/components/mui/formik-inputs/sponsorship-input.js.map +1 -1
- package/lib/components/mui/formik-inputs/sponsorship-summit-select.js.map +1 -1
- package/lib/components/mui/formik-inputs/summit-addon-select.js.map +1 -1
- package/lib/components/mui/formik-inputs/upload.js.map +1 -1
- package/lib/components/mui/show-confirm-dialog.js +1 -1
- package/lib/components/mui/show-confirm-dialog.js.map +1 -1
- package/lib/components/mui/snackbar-notification.js +1 -1
- package/lib/components/mui/snackbar-notification.js.map +1 -1
- package/lib/components/mui/sortable-table.js +1 -1
- package/lib/components/mui/sortable-table.js.map +1 -1
- package/lib/components/mui/sponsor-addon-select.js.map +1 -1
- package/lib/components/mui/summit-addon-select.js.map +1 -1
- package/lib/components/mui/summits-dropdown.js.map +1 -1
- package/lib/components/mui/table.js +1 -1
- package/lib/components/mui/table.js.map +1 -1
- package/lib/components/schedule-builder-view.js.map +1 -1
- package/lib/components/sponsored-project-input.js.map +1 -1
- package/lib/components/summit-dropdown.js +1 -1
- package/lib/components/summit-dropdown.js.map +1 -1
- package/lib/components/table-editable.js.map +1 -1
- package/lib/i18n.js.map +1 -1
- package/lib/security/abstract-auth-callback-route-v2.js.map +1 -1
- package/lib/security/abstract-auth-callback-route.js.map +1 -1
- package/lib/security/actions.js.map +1 -1
- package/lib/security/methods.js.map +1 -1
- package/lib/security/reducers.js.map +1 -1
- package/lib/security/session-checker.js.map +1 -1
- package/lib/utils/actions.js.map +1 -1
- package/lib/utils/methods.js +1 -1
- package/lib/utils/methods.js.map +1 -1
- package/lib/utils/query-actions.js.map +1 -1
- package/lib/utils/questions-set.js.map +1 -1
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/questions-set.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBA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SAASC,KAAQ,OAjL1CrD,KAAK8C,UAAYA,EACjB9C,KAAK+F,gBAAkBhD,EACvB/C,KAAK+C,QAAU,GAEf,IAAK,IAAI/B,KAAKhB,KAAK+F,gBACf/F,KAAK+C,QAAQ/B,EAAEiF,aAAejF,EAClChB,KAAKiD,eAAiB,CAAC,EACvBjD,KAAKmD,aAAe,CAAC,EAErBnD,KAAKuD,MAAQ,CAAC,EACdvD,KAAK0G,iBACR,E","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/utils/questions-set.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n\nexport const isRateEnabled = (value) =>\n value !== null && value !== undefined && value !== \"\";\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const CheckBoxQuestionType = 'CheckBox';\nexport const ComboBoxQuestionType = 'ComboBox'\nexport const CheckBoxListQuestionType = 'CheckBoxList';\nexport const RadioButtonListQuestionType = 'RadioButtonList';\nexport const AllowedMultipleValueQuestionType = [ComboBoxQuestionType, CheckBoxListQuestionType, RadioButtonListQuestionType];\nexport const AnswerValuesOperator_And = 'And';\nexport const AnswerValuesOperator_Or = 'Or';\nexport const VisibilityCondition_Equal = 'Equal';\nexport const VisibilityCondition_NotEqual = 'NotEqual';\nexport const Visibility_Visible = 'Visible';\nexport const MainQuestionClassType = 'MainQuestion';\nimport {toSlug} from \"./methods\";\n\nexport default class QuestionsSet {\n\n constructor(questions, answers = []) {\n this.questions = questions;\n this.originalAnswers = answers\n this.answers = [];\n // map answers to associate array\n for (let a of this.originalAnswers)\n this.answers[a.question_id] = a;\n this.questionByName = {}\n this.questionById = {}\n // associative array ( rule id , rule);\n this.rules = {};\n this._parseQuestions();\n }\n\n _parseQuestion = (q) => {\n this.questionByName[toSlug(q.name)] = q;\n this.questionById[parseInt(q.id)] = q;\n if(q.hasOwnProperty('sub_question_rules'))\n for (let r of q.sub_question_rules) {\n this.rules[parseInt(r.id)] = r;\n this._parseQuestion(r.sub_question);\n }\n }\n\n _parseQuestions = () => {\n for (let q of this.questions) {\n this._parseQuestion(q);\n }\n }\n\n _allowsValues = (q) => {\n return AllowedMultipleValueQuestionType.includes(q.type);\n }\n\n _allowsValue = (q, answer) => {\n let value = answer.value.split(',').map(v => parseInt(v));\n for (let av of value) {\n if (!q.values.map(e => e.id).includes(av))\n return false;\n }\n return true;\n }\n\n _getAnswerFor = (q) => {\n let id = Number.isInteger(q) ? q : q.id;\n let a = this.answers[id] || null;\n return a ? a : null;\n }\n\n _hasValue = (answer) => {\n return answer.value !== '';\n }\n\n _answerContains = (answer, val) => {\n return answer.value.split(',').includes(val);\n }\n\n _isSubQuestionVisible = (rule) => {\n let initialCondition = rule.answer_values_operator === AnswerValuesOperator_And ? true : false;\n const parentQuestionAnswer = this._getAnswerFor(rule.parent_question_id);\n if (!parentQuestionAnswer) {\n initialCondition = rule.visibility_condition === VisibilityCondition_Equal ? false : true;\n } else {\n switch (rule.visibility_condition) {\n case VisibilityCondition_Equal: {\n for (let answerValue of rule.answer_values) {\n if (rule.answer_values_operator === AnswerValuesOperator_And)\n initialCondition = initialCondition && this._answerContains(parentQuestionAnswer, answerValue);\n else\n initialCondition = initialCondition || this._answerContains(parentQuestionAnswer, answerValue);\n }\n }\n break;\n case VisibilityCondition_NotEqual: {\n for (let answerValue of rule.answer_values) {\n if (rule.answer_values_operator === AnswerValuesOperator_And)\n initialCondition = initialCondition && !this._answerContains(parentQuestionAnswer, answerValue);\n else\n initialCondition = initialCondition || !this._answerContains(parentQuestionAnswer, answerValue);\n }\n }\n break;\n }\n }\n // final visibility check\n if (rule.visibility === Visibility_Visible) {\n return initialCondition;\n }\n // not visible\n return !initialCondition;\n }\n\n _isAnswered = (q) => {\n const answer = this._getAnswerFor(q);\n\n if (q.class === MainQuestionClassType) {\n if (!q.mandatory) return true;\n if (!answer) return false;\n if (!this._hasValue(answer)) return false;\n if (this._allowsValues(q) && !this._allowsValue(q, answer))\n return false;\n return true;\n }\n\n // check parent rules ...\n for (let ruleId of q.parent_rules) {\n if (!this._isSubQuestionVisible(this.rules[ruleId])) // if question is not visible skip it\n continue;\n if (!q.mandatory) return true;\n if (!answer) return false;\n if (!this._hasValue(answer)) return false;\n if (this._allowsValues(q) && !this._allowsValue(q, answer))\n return false;\n return true;\n }\n\n return true;\n }\n\n _checkQuestion = (q) => {\n let res = this._isAnswered(q);\n if(q.hasOwnProperty('sub_question_rules'))\n for (let rule of q.sub_question_rules) {\n // check recursive all the tree till leaves ...\n res = res && this._checkQuestion(rule.sub_question);\n }\n return res;\n }\n\n _formatQuestionAnswer = (question) => {\n let res = {};\n const slug = toSlug(question.name);\n let userAnswer = this.originalAnswers.find(a => a.question_id === question.id)?.value;\n if(!userAnswer && question?.values?.length > 0){\n // check default value\n const defaultVal = question.values.find(v => v.is_default);\n if(defaultVal) userAnswer = defaultVal.id.toString();\n }\n if(userAnswer) {\n if (question.type === CheckBoxQuestionType) userAnswer = userAnswer === 'false' ? false : !!userAnswer;\n if (question.type === RadioButtonListQuestionType || question.type === ComboBoxQuestionType) userAnswer = parseInt(userAnswer);\n if (question.type === CheckBoxListQuestionType) userAnswer = userAnswer.split(',').map(ansVal => parseInt(ansVal)) || [];\n }\n\n res[slug] = userAnswer || '';\n if(question.type === CheckBoxListQuestionType && res[slug] === '') res[slug] = []\n if(question.hasOwnProperty('sub_question_rules'))\n for (let rule of question.sub_question_rules) {\n // check recursive all the tree till leaves ...\n let res1 = this._formatQuestionAnswer(rule.sub_question);\n res = {...res, ...res1};\n }\n return res;\n }\n\n formatAnswers = () => {\n let res = {}\n this.questions.forEach(q => {\n let res1 = this._formatQuestionAnswer(q);\n res = {...res,...res1};\n });\n return res;\n }\n\n completed = () => {\n let res = true;\n for (let q of this.questions) {\n res = res && this._checkQuestion(q);\n }\n return res;\n }\n\n getQuestionByName = (name) => {\n const slug = toSlug(name)\n return this.questionByName[name] || this.questionByName[slug] || null;\n }\n\n getQuestionById = (id) => {\n return this.questionById[parseInt(id)] || null;\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","toSlug","text","toLowerCase","replace","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CheckBoxQuestionType","ComboBoxQuestionType","CheckBoxListQuestionType","RadioButtonListQuestionType","AllowedMultipleValueQuestionType","AnswerValuesOperator_And","AnswerValuesOperator_Or","VisibilityCondition_Equal","VisibilityCondition_NotEqual","Visibility_Visible","MainQuestionClassType","QuestionsSet","constructor","questions","answers","q","questionByName","name","questionById","parseInt","id","sub_question_rules","rules","_parseQuestion","sub_question","includes","type","answer","split","map","v","av","values","e","Number","isInteger","val","rule","initialCondition","answer_values_operator","parentQuestionAnswer","_getAnswerFor","parent_question_id","visibility_condition","answerValue","answer_values","_answerContains","visibility","class","mandatory","_hasValue","_allowsValues","_allowsValue","ruleId","parent_rules","_isSubQuestionVisible","res","_isAnswered","_checkQuestion","question","slug","userAnswer","originalAnswers","find","question_id","length","defaultVal","is_default","toString","ansVal","res1","_formatQuestionAnswer","forEach","_parseQuestions"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"utils/questions-set.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,+ECOF,MA0DMC,EAAUC,IACnBA,EAAOA,EAAKC,eACAC,QAAQ,iBAAiB,I,WC5EzCP,EAAOD,QAAUS,QAAQ,wC,WCAzBR,EAAOD,QAAUS,QAAQ,kB,WCAzBR,EAAOD,QAAUS,QAAQ,Q,GCCrBC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAab,QAGrB,IAAIC,EAASS,EAAyBE,GAAY,CAGjDZ,QAAS,CAAC,GAOX,OAHAe,EAAoBH,GAAUX,EAAQA,EAAOD,QAASW,GAG/CV,EAAOD,OACf,C,MCrBAW,EAAoBK,EAAKf,IACxB,IAAIgB,EAAShB,GAAUA,EAAOiB,WAC7B,IAAOjB,EAAiB,QACxB,IAAM,EAEP,OADAU,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,C,WCLdN,EAAoBQ,EAAI,CAACnB,EAASqB,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEvB,EAASsB,IAC5EE,OAAOC,eAAezB,EAASsB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,C,WCNDX,EAAoBY,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,E,WCClFlB,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C,8BA4KhBvC,IACjB,MAAM2C,GAAO5F,EAAAA,EAAAA,QAAOiD,GACpB,OAAOlD,KAAKiD,eAAeC,IAASlD,KAAKiD,eAAe4C,IAAU,IAAlE,IA9KiC,4BAiLlBxC,GACRrD,KAAKmD,aAAaC,SAASC,KAAQ,OAjL1CrD,KAAK8C,UAAYA,EACjB9C,KAAK+F,gBAAkBhD,EACvB/C,KAAK+C,QAAU,GAEf,IAAK,IAAI/B,KAAKhB,KAAK+F,gBACf/F,KAAK+C,QAAQ/B,EAAEiF,aAAejF,EAClChB,KAAKiD,eAAiB,CAAC,EACvBjD,KAAKmD,aAAe,CAAC,EAErBnD,KAAKuD,MAAQ,CAAC,EACdvD,KAAK0G,iBACR,E","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/utils/questions-set.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n\nexport const isRateEnabled = (value) =>\n value !== null && value !== undefined && value !== \"\";\n\n/**\n * Returns true if value is null, undefined, empty/whitespace string,\n * empty array, or empty object.\n */\nexport const empty = (value) => {\n if (value === null || value === undefined) return true;\n if (typeof value === \"string\") return value.trim().length === 0;\n if (Array.isArray(value)) return value.length === 0;\n if (typeof value === \"object\") return Object.keys(value).length === 0;\n return false;\n};\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const CheckBoxQuestionType = 'CheckBox';\nexport const ComboBoxQuestionType = 'ComboBox'\nexport const CheckBoxListQuestionType = 'CheckBoxList';\nexport const RadioButtonListQuestionType = 'RadioButtonList';\nexport const AllowedMultipleValueQuestionType = [ComboBoxQuestionType, CheckBoxListQuestionType, RadioButtonListQuestionType];\nexport const AnswerValuesOperator_And = 'And';\nexport const AnswerValuesOperator_Or = 'Or';\nexport const VisibilityCondition_Equal = 'Equal';\nexport const VisibilityCondition_NotEqual = 'NotEqual';\nexport const Visibility_Visible = 'Visible';\nexport const MainQuestionClassType = 'MainQuestion';\nimport {toSlug} from \"./methods\";\n\nexport default class QuestionsSet {\n\n constructor(questions, answers = []) {\n this.questions = questions;\n this.originalAnswers = answers\n this.answers = [];\n // map answers to associate array\n for (let a of this.originalAnswers)\n this.answers[a.question_id] = a;\n this.questionByName = {}\n this.questionById = {}\n // associative array ( rule id , rule);\n this.rules = {};\n this._parseQuestions();\n }\n\n _parseQuestion = (q) => {\n this.questionByName[toSlug(q.name)] = q;\n this.questionById[parseInt(q.id)] = q;\n if(q.hasOwnProperty('sub_question_rules'))\n for (let r of q.sub_question_rules) {\n this.rules[parseInt(r.id)] = r;\n this._parseQuestion(r.sub_question);\n }\n }\n\n _parseQuestions = () => {\n for (let q of this.questions) {\n this._parseQuestion(q);\n }\n }\n\n _allowsValues = (q) => {\n return AllowedMultipleValueQuestionType.includes(q.type);\n }\n\n _allowsValue = (q, answer) => {\n let value = answer.value.split(',').map(v => parseInt(v));\n for (let av of value) {\n if (!q.values.map(e => e.id).includes(av))\n return false;\n }\n return true;\n }\n\n _getAnswerFor = (q) => {\n let id = Number.isInteger(q) ? q : q.id;\n let a = this.answers[id] || null;\n return a ? a : null;\n }\n\n _hasValue = (answer) => {\n return answer.value !== '';\n }\n\n _answerContains = (answer, val) => {\n return answer.value.split(',').includes(val);\n }\n\n _isSubQuestionVisible = (rule) => {\n let initialCondition = rule.answer_values_operator === AnswerValuesOperator_And ? true : false;\n const parentQuestionAnswer = this._getAnswerFor(rule.parent_question_id);\n if (!parentQuestionAnswer) {\n initialCondition = rule.visibility_condition === VisibilityCondition_Equal ? false : true;\n } else {\n switch (rule.visibility_condition) {\n case VisibilityCondition_Equal: {\n for (let answerValue of rule.answer_values) {\n if (rule.answer_values_operator === AnswerValuesOperator_And)\n initialCondition = initialCondition && this._answerContains(parentQuestionAnswer, answerValue);\n else\n initialCondition = initialCondition || this._answerContains(parentQuestionAnswer, answerValue);\n }\n }\n break;\n case VisibilityCondition_NotEqual: {\n for (let answerValue of rule.answer_values) {\n if (rule.answer_values_operator === AnswerValuesOperator_And)\n initialCondition = initialCondition && !this._answerContains(parentQuestionAnswer, answerValue);\n else\n initialCondition = initialCondition || !this._answerContains(parentQuestionAnswer, answerValue);\n }\n }\n break;\n }\n }\n // final visibility check\n if (rule.visibility === Visibility_Visible) {\n return initialCondition;\n }\n // not visible\n return !initialCondition;\n }\n\n _isAnswered = (q) => {\n const answer = this._getAnswerFor(q);\n\n if (q.class === MainQuestionClassType) {\n if (!q.mandatory) return true;\n if (!answer) return false;\n if (!this._hasValue(answer)) return false;\n if (this._allowsValues(q) && !this._allowsValue(q, answer))\n return false;\n return true;\n }\n\n // check parent rules ...\n for (let ruleId of q.parent_rules) {\n if (!this._isSubQuestionVisible(this.rules[ruleId])) // if question is not visible skip it\n continue;\n if (!q.mandatory) return true;\n if (!answer) return false;\n if (!this._hasValue(answer)) return false;\n if (this._allowsValues(q) && !this._allowsValue(q, answer))\n return false;\n return true;\n }\n\n return true;\n }\n\n _checkQuestion = (q) => {\n let res = this._isAnswered(q);\n if(q.hasOwnProperty('sub_question_rules'))\n for (let rule of q.sub_question_rules) {\n // check recursive all the tree till leaves ...\n res = res && this._checkQuestion(rule.sub_question);\n }\n return res;\n }\n\n _formatQuestionAnswer = (question) => {\n let res = {};\n const slug = toSlug(question.name);\n let userAnswer = this.originalAnswers.find(a => a.question_id === question.id)?.value;\n if(!userAnswer && question?.values?.length > 0){\n // check default value\n const defaultVal = question.values.find(v => v.is_default);\n if(defaultVal) userAnswer = defaultVal.id.toString();\n }\n if(userAnswer) {\n if (question.type === CheckBoxQuestionType) userAnswer = userAnswer === 'false' ? false : !!userAnswer;\n if (question.type === RadioButtonListQuestionType || question.type === ComboBoxQuestionType) userAnswer = parseInt(userAnswer);\n if (question.type === CheckBoxListQuestionType) userAnswer = userAnswer.split(',').map(ansVal => parseInt(ansVal)) || [];\n }\n\n res[slug] = userAnswer || '';\n if(question.type === CheckBoxListQuestionType && res[slug] === '') res[slug] = []\n if(question.hasOwnProperty('sub_question_rules'))\n for (let rule of question.sub_question_rules) {\n // check recursive all the tree till leaves ...\n let res1 = this._formatQuestionAnswer(rule.sub_question);\n res = {...res, ...res1};\n }\n return res;\n }\n\n formatAnswers = () => {\n let res = {}\n this.questions.forEach(q => {\n let res1 = this._formatQuestionAnswer(q);\n res = {...res,...res1};\n });\n return res;\n }\n\n completed = () => {\n let res = true;\n for (let q of this.questions) {\n res = res && this._checkQuestion(q);\n }\n return res;\n }\n\n getQuestionByName = (name) => {\n const slug = toSlug(name)\n return this.questionByName[name] || this.questionByName[slug] || null;\n }\n\n getQuestionById = (id) => {\n return this.questionById[parseInt(id)] || null;\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","toSlug","text","toLowerCase","replace","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CheckBoxQuestionType","ComboBoxQuestionType","CheckBoxListQuestionType","RadioButtonListQuestionType","AllowedMultipleValueQuestionType","AnswerValuesOperator_And","AnswerValuesOperator_Or","VisibilityCondition_Equal","VisibilityCondition_NotEqual","Visibility_Visible","MainQuestionClassType","QuestionsSet","constructor","questions","answers","q","questionByName","name","questionById","parseInt","id","sub_question_rules","rules","_parseQuestion","sub_question","includes","type","answer","split","map","v","av","values","e","Number","isInteger","val","rule","initialCondition","answer_values_operator","parentQuestionAnswer","_getAnswerFor","parent_question_id","visibility_condition","answerValue","answer_values","_answerContains","visibility","class","mandatory","_hasValue","_allowsValues","_allowsValue","ruleId","parent_rules","_isSubQuestionVisible","res","_isAnswered","_checkQuestion","question","slug","userAnswer","originalAnswers","find","question_id","length","defaultVal","is_default","toString","ansVal","res1","_formatQuestionAnswer","forEach","_parseQuestions"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openstack-uicore-foundation",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "ui reactjs components for openstack marketing site",
|
|
5
5
|
"main": "lib/openstack-uicore-foundation.js",
|
|
6
6
|
"scripts": {
|
|
@@ -190,6 +190,5 @@
|
|
|
190
190
|
"console": {}
|
|
191
191
|
},
|
|
192
192
|
"testEnvironment": "jsdom"
|
|
193
|
-
}
|
|
194
|
-
"dependencies": {}
|
|
193
|
+
}
|
|
195
194
|
}
|