lesli 5.0.3 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/lesli_manifest.js +2 -1
- data/app/assets/javascripts/lesli/users/confirmations.js +32 -0
- data/app/assets/javascripts/lesli/users/passwords.js +3 -3
- data/app/assets/javascripts/lesli/users/registrations.js +2 -2
- data/app/assets/javascripts/lesli/users/sessions.js +2 -2
- data/app/assets/stylesheets/lesli/users/confirmations.scss +28 -6
- data/app/controllers/lesli/interfaces/application/authorization.rb +2 -2
- data/app/controllers/lesli/interfaces/application/logger.rb +14 -38
- data/app/controllers/lesli/roles_controller.rb +3 -1
- data/app/controllers/users/confirmations_controller.rb +63 -27
- data/app/controllers/users/passwords_controller.rb +70 -30
- data/app/controllers/users/sessions_controller.rb +2 -4
- data/app/lib/lesli/system.rb +13 -5
- data/app/mailers/lesli/application_lesli_mailer.rb +8 -19
- data/app/mailers/lesli/devise_mailer.rb +29 -3
- data/app/models/concerns/account_initializer.rb +91 -0
- data/app/models/concerns/{user_guard.rb → user_security.rb} +7 -8
- data/app/models/lesli/account.rb +8 -26
- data/app/models/lesli/application_lesli_record.rb +1 -0
- data/app/models/lesli/descriptor/privilege.rb +38 -0
- data/app/models/lesli/descriptor.rb +18 -1
- data/app/models/lesli/role/power.rb +70 -0
- data/app/models/lesli/role/privilege.rb +38 -0
- data/app/models/lesli/role.rb +20 -15
- data/app/models/lesli/user/{role.rb → power.rb} +1 -1
- data/app/{services/lesli/role_service.rb → models/lesli/user/setting.rb} +10 -9
- data/app/models/lesli/user.rb +11 -20
- data/app/operators/lesli/descriptor_privilege_operator.rb +75 -0
- data/app/operators/lesli/role_power_operator.rb +108 -0
- data/app/operators/lesli/user_registration_operator.rb +121 -0
- data/app/services/lesli/user_service.rb +2 -4
- data/app/services/lesli/{user/session_service.rb → user_session_service.rb} +11 -4
- data/app/views/devise/confirmations/new.html.erb +0 -14
- data/app/views/devise/confirmations/show.html.erb +63 -0
- data/app/views/devise/passwords/edit.html.erb +78 -24
- data/app/views/devise/passwords/new.html.erb +1 -2
- data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/lesli/emails/devise_mailer/reset_password_instructions.html.erb +23 -0
- data/app/views/lesli/partials/_application-lesli-header.html.erb +3 -1
- data/config/initializers/devise.rb +2 -0
- data/db/migrate/v1.0/0010000110_create_lesli_accounts.rb +2 -0
- data/db/{tables/0010001010_create_account_settings.rb → migrate/v1.0/0010001010_create_lesli_account_settings.rb} +5 -5
- data/db/{tables/0010003110_create_user_settings.rb → migrate/v1.0/0010003110_create_lesli_user_settings.rb} +4 -4
- data/db/migrate/v1.0/0010003210_create_lesli_user_sessions.rb +6 -2
- data/db/migrate/v1.0/{0010003410_create_lesli_user_roles.rb → 0010003410_create_lesli_user_powers.rb} +4 -4
- data/db/migrate/v1.0/0010005010_create_lesli_descriptors.rb +1 -1
- data/db/migrate/v1.0/{0010003910_create_lesli_user_agents.rb → 0010005510_create_lesli_role_powers.rb} +7 -9
- data/db/{tables/0010005710_create_role_privileges.rb → migrate/v1.0/0010005710_create_lesli_role_privileges.rb} +6 -6
- data/db/seed/development/users.rb +4 -4
- data/db/seed/tools.rb +4 -4
- data/lib/lesli/engine.rb +33 -10
- data/lib/lesli/version.rb +1 -1
- data/lib/sass/lesli/bulma/loader.scss +3 -0
- data/lib/sass/lesli/pages/devise-simple.scss +2 -1
- data/lib/tasks/lesli/controllers.rake +3 -6
- data/lib/tasks/lesli/db.rake +11 -1
- data/lib/tasks/lesli/role.rake +54 -0
- data/lib/vue/application.js +9 -2
- data/lib/vue/devise/passwords.js +3 -3
- data/lib/vue/layouts/application-header.vue +10 -3
- data/lib/webpack/core.js +2 -1
- data/readme.md +23 -7
- metadata +22 -18
- data/app/models/concerns/account_engines.rb +0 -249
- data/app/models/concerns/user_polyfill.rb +0 -134
- data/config/locales/translations.en.yml +0 -7
- data/config/locales/translations.es.yml +0 -7
- data/db/migrate/v1.0/0010001510_create_lesli_account_requests.rb +0 -45
- data/db/migrate/v1.0/0010003810_create_lesli_user_requests.rb +0 -44
- data/db/tables/0010005510_create_role_descriptors.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba9be6e311c5f85759e4fdad59138a230448fb448984464e5f11f9d814828ed2
|
4
|
+
data.tar.gz: 06b229e650d8da986061a8646b56ca039798118d8e7c4a8e68cdd23900de94fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36dc264e6fb5761e3be3c4c0c752ccc3071c808a8fe78220bc265611591a78a92e9cf5144dcf7f1b15e0869c77bd525c28c020ccbf338ded87de3e79c05e9eeb
|
7
|
+
data.tar.gz: 6abe940c11b64d7abbe6968192bff8f66a83addf9f5fb43560291ae8844c6e37cd04fbda8c64b344a77795775f02d71fb762fed4adc5a352f5d43f170e147e71
|
@@ -51,6 +51,7 @@ Building a better future, one line of code at a time.
|
|
51
51
|
//= link lesli/users/passwords.css
|
52
52
|
//= link lesli/users/registrations.js
|
53
53
|
//= link lesli/users/registrations.css
|
54
|
-
|
54
|
+
//= link lesli/users/confirmations.js
|
55
|
+
//= link lesli/users/confirmations.css
|
55
56
|
|
56
57
|
//= link lesli/i18n.js
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
6
|
+
* or disable the default devtool with "devtool: false".
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
8
|
+
*/
|
9
|
+
/******/ (() => { // webpackBootstrap
|
10
|
+
/******/ var __webpack_modules__ = ({
|
11
|
+
|
12
|
+
/***/ "./lib/vue/devise/confirmations.js":
|
13
|
+
/*!*****************************************!*\
|
14
|
+
!*** ./lib/vue/devise/confirmations.js ***!
|
15
|
+
\*****************************************/
|
16
|
+
/***/ (() => {
|
17
|
+
|
18
|
+
eval("/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Your Smart Business Assistant. \n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://lesli.tech\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// ·\n\n//# sourceURL=webpack://lesli/./lib/vue/devise/confirmations.js?");
|
19
|
+
|
20
|
+
/***/ })
|
21
|
+
|
22
|
+
/******/ });
|
23
|
+
/************************************************************************/
|
24
|
+
/******/
|
25
|
+
/******/ // startup
|
26
|
+
/******/ // Load entry module and return exports
|
27
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
28
|
+
/******/ var __webpack_exports__ = {};
|
29
|
+
/******/ __webpack_modules__["./lib/vue/devise/confirmations.js"]();
|
30
|
+
/******/
|
31
|
+
/******/ })()
|
32
|
+
;
|
@@ -82,7 +82,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
82
82
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
83
83
|
|
84
84
|
"use strict";
|
85
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var Lesli_public__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! Lesli/public */ \"./lib/vue/public.js\");\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Your Smart Business Assistant. \n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://lesli.tech\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · \n\n// · \n\n\n// · \n(0,Lesli_public__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({\n data() {\n return {\n loading: false,\n translations: {\n main: I18n.t(\"core.users/passwords\")\n },\n sign_in: {\n email: \"\",\n password: \"\"\n },\n password_edit: {\n new_password: \"
|
85
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var Lesli_public__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! Lesli/public */ \"./lib/vue/public.js\");\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Your Smart Business Assistant. \n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://lesli.tech\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · \n\n// · \n\n\n// · \n(0,Lesli_public__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({\n data() {\n return {\n loading: false,\n translations: {\n main: I18n.t(\"core.users/passwords\")\n },\n sign_in: {\n email: \"\",\n password: \"\"\n },\n password_edit: {\n new_password: \"Tardis2023$\",\n new_password_confirmation: \"Tardis2023$\"\n },\n notification: {\n message: \"\",\n show: false,\n type: \"danger\"\n }\n };\n },\n methods: {\n postPasswordNew(event) {\n this.notification.show = false;\n this.loading = true;\n event.preventDefault();\n let data = {\n user: {\n email: this.sign_in.email.toLowerCase(),\n password: this.sign_in.password\n }\n };\n this.http.post(\"/password\", data).then(response => {\n this.showNotification(this.translations.main.notification_reset_password_instructions_sent, \"success\");\n }).catch(error => {\n this.showNotification(error.message);\n }).finally(() => {\n this.loading = false;\n });\n },\n putPasswordEdit(event) {\n this.notification.show = false;\n this.loading = true;\n event.preventDefault();\n\n // check if passwords match\n if (this.password_edit.new_password != this.password_edit.new_password_confirmation) {\n this.showNotification(this.translations.main.error_passwords_do_not_match, \"danger\");\n return;\n }\n var token = null;\n try {\n token = Object.fromEntries(new URLSearchParams(window.location.search)).reset_password_token;\n } catch (error) {\n token = null;\n }\n this.http.put(\"/password\", {\n user: {\n password: this.password_edit.new_password,\n password_confirmation: this.password_edit.new_password_confirmation,\n reset_password_token: token\n }\n }).then(response => {\n this.showNotification(this.translations.main.notification_password_updated, \"success\");\n //setTimeout(() => { this.url.go(\"/login\") }, 2000)\n }).catch(error => {\n this.showNotification(error.message, \"danger\");\n }).finally(() => {\n this.loading = false;\n });\n },\n showNotification(message) {\n let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"danger\";\n this.notification.message = message;\n this.notification.type = type;\n this.notification.show = true;\n }\n }\n});\n\n//# sourceURL=webpack://lesli/./lib/vue/devise/passwords.js?");
|
86
86
|
|
87
87
|
/***/ }),
|
88
88
|
|
@@ -124,7 +124,7 @@ eval("/*\nLesli\n\nCopyright (c) 2021, Lesli Technologies, S. A.\n\nThis program
|
|
124
124
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
125
125
|
|
126
126
|
"use strict";
|
127
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this;\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
127
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this.toString();\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
128
128
|
|
129
129
|
/***/ }),
|
130
130
|
|
@@ -179,7 +179,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
179
179
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
180
180
|
|
181
181
|
"use strict";
|
182
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n profile2(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"administration/profile\", path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
182
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudShared engine\n vault(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"vault\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
183
183
|
|
184
184
|
/***/ }),
|
185
185
|
|
@@ -124,7 +124,7 @@ eval("/*\nLesli\n\nCopyright (c) 2021, Lesli Technologies, S. A.\n\nThis program
|
|
124
124
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
125
125
|
|
126
126
|
"use strict";
|
127
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this;\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
127
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this.toString();\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
128
128
|
|
129
129
|
/***/ }),
|
130
130
|
|
@@ -179,7 +179,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
179
179
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
180
180
|
|
181
181
|
"use strict";
|
182
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n profile2(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"administration/profile\", path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
182
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudShared engine\n vault(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"vault\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
183
183
|
|
184
184
|
/***/ }),
|
185
185
|
|
@@ -124,7 +124,7 @@ eval("/*\nLesli\n\nCopyright (c) 2021, Lesli Technologies, S. A.\n\nThis program
|
|
124
124
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
125
125
|
|
126
126
|
"use strict";
|
127
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this;\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
127
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliDate: () => (/* binding */ useLesliDate)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n/*\nIMPORTANT: \n This is a JavaScript implementation of app/lib/Date2 RoR lib.\n If any modification or update is needed it must be implemented in app/lib/Date2 first, then we can\n copy the new feature and implement in here.\n DO NOT add custom features, methods, params or any other modification that is not present in app/lib/Date2\n*/\n\n// · Import dayjs library and plugins\n\nvar utc = __webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\");\nvar timezone = __webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\");\n\n// · \ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(utc);\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(timezone);\n\n// · \nclass LesliDate {\n #settings = {};\n #datetime = {};\n #format = \"\";\n constructor() {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n /*\n # NOTE: Do not modify settings here,\n # if you need a different date format you should change it in the config file\n # Check the docs for more information: /development/docs/rails-lib-time\n # TODO: User should be able to select an appropiate datetime format in an easy way,\n # the Administration module must be present to the users a curated list of different\n # datetime format options with examples, also user should be able to manually modify\n # the format through an \"advanced view\"\n */\n this.#settings = {\n timeZone: \"America/Guatemala\",\n // get this from Lesli settings\n startWeekOn: \"config[:start_week_on]\",\n format: {\n date: \"%d.%m.%Y\",\n time: \"%H:%M\",\n // 24 hours datetime format (default)\n dateTime: \"%d.%m.%Y %H:%M\",\n // 24 hours datetime format (default)\n dateWords: \"%A, %B %d, %Y\",\n dateTimeWords: \"%A, %B %d, %Y, %H:%M\" // 24 hours datetime in words format (default)\n }\n };\n\n // default date format\n this.#format = this.#setFormat(\"date\");\n\n // get datetime object from user params\n this.#datetime = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(datetime).tz(this.#settings.timeZone);\n }\n date() {\n this.#setFormat(\"date\");\n return this.toString();\n }\n dateTime() {\n this.#setFormat(\"dateTime\");\n return this.toString();\n }\n dateWords() {\n this.#setFormat(\"dateWords\");\n return this;\n }\n\n // convert a datetime object to string representation using defined format\n toString() {\n return this.#datetime.format(this.#format);\n }\n\n //\n #setFormat(format) {\n this.#format = this.#settings.format[format]\n // Convert date Ruby to dayjs format\n .replaceAll(\"%Y\", \"YYYY\").replaceAll(\"%m\", \"MM\").replaceAll(\"%d\", \"DD\")\n // Convert time Ruby to dayjs format\n .replaceAll(\"%H\", \"HH\").replaceAll(\"%M\", \"mm\")\n // Convert words Ruby to dayjs format\n .replaceAll(\"%A\", \"dddd\") // Full day name\n .replaceAll(\"%B\", \"MMMM\"); // Full month name\n }\n}\n\nfunction useLesliDate() {\n return function () {\n let datetime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs__WEBPACK_IMPORTED_MODULE_0___default()().utc().format();\n let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"%Y-%m-%d %H:%M:%S\";\n return new LesliDate(datetime, format);\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/date/date.js?");
|
128
128
|
|
129
129
|
/***/ }),
|
130
130
|
|
@@ -179,7 +179,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
179
179
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
180
180
|
|
181
181
|
"use strict";
|
182
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n profile2(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"administration/profile\", path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
182
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useLesliUrl: () => (/* binding */ useLesliUrl)\n/* harmony export */ });\n/*\nLesli\n\nCopyright (c) 2023, Lesli Technologies, S. A.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nLesli · Ruby on Rails SaaS Development Framework.\n\nMade with ♥ by https://www.lesli.tech\nBuilding a better future, one line of code at a time.\n\n@contact hello@lesli.tech\n@website https://www.lesli.dev\n@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html\n\n// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~\n// · \n*/\n\n// · URL #builder for Lesli\nclass LesliUrl {\n #params = \"\";\n #base_url = \"\";\n #query = {};\n #path = \"\";\n #url = \"\";\n constructor(base_url, path, params) {\n this.#base_url = base_url;\n this.#params = params;\n this.#path = path;\n }\n\n // build a url for resources mounted at root level\n // this happens on builders engines like MW.\n root(path, params) {\n this.#path = \"\";\n\n // process path template if provided\n if (path) this.#path = this.#path.concat(this.#parsePath(path, params));\n return this;\n }\n\n // build a url for a specific engine\n engine(engine, path, params) {\n // manually add a slash due we are not using native JS url builders\n engine = engine.concat(\"/\");\n\n // return url for the root of the engine\n if (!path) return this.root(engine, params);\n\n // include the engine as part of the path\n return this.root(engine.concat(path), params);\n }\n\n // insert order params into query string\n order(column) {\n let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"asc\";\n this.#query[\"orderBy\"] = column;\n if (direction) {\n this.#query[\"order\"] = direction;\n }\n return this.#build();\n }\n\n // add standard query param to request paginated data to the server\n paginate(page) {\n let perPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 15;\n this.#query[\"page\"] = page;\n this.#query[\"perPage\"] = perPage;\n return this.#build();\n }\n\n // add standard query param to request search to the server\n search(text) {\n if (!!text) {\n this.#query[\"search\"] = text;\n }\n return this.#build();\n }\n group(text) {\n if (!!text) {\n this.#query[\"group\"] = text;\n }\n return this.#build();\n }\n\n // add standard query params to request filtered data from the server\n filter(filters) {\n let keys = Object.keys(filters);\n if (!this.#query.f) {\n this.#query[\"f\"] = {};\n }\n keys.forEach(key => {\n this.#query.f[key] = filters[key].join(',');\n });\n return this.#build();\n }\n\n // allow to add custom query params\n query(key, value) {\n this.#query[key] = value;\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string\n tokenUrl() {\n let urlParams = new URLSearchParams(window.location.search);\n this.#query[\"t\"] = urlParams.get(\"t\");\n return this.#build();\n }\n\n // automatically add auth token if exists in the url query string as param\n tokenShared() {\n // get the token from a \"signed\" url with format:\n // /shared/public/:token/help/tickets/new\n // for this kind of \"signed\" url token is always at position 4 of the string\n let url = window.location.pathname.split('/')[3];\n\n // attach the token as opaque token so the public api is able authenticate the request\n this.#query[\"t\"] = url;\n return this.#build();\n }\n\n // convert the url object to string automatically if object as string is needed\n toString() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.#build(extension);\n return this.#url.toString();\n }\n\n // alias for toString() method\n get s() {\n return this.toString();\n }\n\n // add json extension to the url \n json() {\n return this.toString(\".json\");\n }\n\n // add pdf extension to the url \n pdf() {\n return this.toString(\".pdf\");\n }\n\n // perform a redirect action after #build an url\n // be sure to call this method last always\n go() {\n this.#build();\n window.location.href = this.#url.toString();\n }\n\n // parse, join and create a well formated url object\n #build() {\n let extension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // root\n let url = \"/\";\n\n // if path exists for the url\n if (this.#path != \"\") {\n url = url.concat(this.#path);\n }\n\n // normally all the requests are sent to the internal Lesli api\n // so, the requests should include the json suffix\n if (extension) {\n url = url.concat(extension);\n }\n\n // concat query string if available\n url = url.concat(this.#parseQuery(this.#query));\n\n // #build a native URL object\n this.#url = url;\n\n // return this to enable methods chaining pattern\n return this;\n }\n\n // parse a string template into a string path\n // examples:\n // domain.com/user/:id, { id: 1 }\n // domain.com/user/:id, 1\n // result: domain.com/user/1\n // this is good to avoid string interpolation :)\n #parsePath(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // shortcut to get specific resource through id\n if (typeof params == 'string' || typeof params == 'number') {\n params = {\n id: params\n };\n }\n\n // remaining params are useful if we want to work with the params\n // that does not belongs to a any part of the path template\n const remainingParams = {\n ...params\n };\n\n // compile the string template to assign values to the variables\n const renderedPath = path.replace(/:[_A-Za-z][_A-Za-z0-9]*/g, p => {\n let key = p.slice(1);\n delete remainingParams[key];\n return encodeURIComponent(params[key]);\n });\n for (let param in remainingParams) {\n this.#query[param] = remainingParams[param];\n }\n return renderedPath;\n }\n\n // convert a key value object into a standard queryString. This custom implementation\n // supports deep object parsing and array parsing\n // example: { name: {first: \"luis\"}, age: 25 }\n // result: domain.com?name[first]=luis&age=25\n #parseQuery(query) {\n function recursion(query, path) {\n if (Array.isArray(query)) {\n query.forEach(function (element) {\n recursion(element, path + \"[]\");\n });\n return;\n }\n if (query !== null && typeof query === \"object\") {\n Object.keys(query).forEach(function (param) {\n recursion(query[param], path + \"[\" + param + \"]\");\n });\n return;\n }\n data.push(path + \"=\" + query);\n }\n var data = [];\n Object.keys(query).forEach(function (param) {\n recursion(query[param], param);\n });\n if (data.length > 0) {\n return \"?\".concat(data.join(\"&\"));\n }\n return \"\";\n }\n}\nfunction useLesliUrl() {\n const root = \"/\";\n return {\n // · Redirect to specific url\n go() {\n let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"/\";\n document.location.href = url;\n },\n // · Get well formated url\n to() {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (path) {\n return root.concat(path);\n }\n return root;\n },\n // · Build a url for core requests\n root(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for administration area\n lesli(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().root(path, params);\n },\n // · Build a url for core administration area\n admin(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"admin\", path, params);\n },\n // · Build a url for CloudAudit engine\n audit(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"audit\", path, params);\n },\n // · Build a url for CloudBabel engine\n babel(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"babel\", path, params);\n },\n // · Build a url for CloudBell engine\n bell(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"bell\", path, params);\n },\n // · Build a url for CloudHelp engine\n help(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"help\", path, params);\n },\n // · Build a url for CloudMailer engine\n mailer(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"mailer\", path, params);\n },\n // · Build a url for CloudTalk engine\n talk(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"talk\", path, params);\n },\n // · Build a url for CloudFocus engine\n focus(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"focus\", path, params);\n },\n // · Build a url for CloudTime engine\n time(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"time\", path, params);\n },\n // · Build a url for CloudDriver engine\n driver(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"driver\", path, params);\n },\n // · Build a url for CloudSocial engine\n social(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"social\", path, params);\n },\n // · Build a url for CloudWord engine\n word(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"word\", path, params);\n },\n // · Build a url for CloudTeam engine\n team(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"team\", path, params);\n },\n // · Build a url for CloudScraper engine\n scraper(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"scraper\", path, params);\n },\n // · Build a url for CloudShared engine\n shared(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"shared\", path, params);\n },\n // · Build a url for CloudShared engine\n vault(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"vault\", path, params);\n },\n // · Build a url for CloudAuthority engine\n authority(path) {\n let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new LesliUrl().engine(\"authority\", path, params);\n }\n };\n}\n\n//# sourceURL=webpack://lesli/../../enginesdev/lesli-vue/source/composables/url/url.js?");
|
183
183
|
|
184
184
|
/***/ }),
|
185
185
|
|
@@ -17,18 +17,40 @@ GNU General Public License for more details.
|
|
17
17
|
You should have received a copy of the GNU General Public License
|
18
18
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
19
|
|
20
|
-
Lesli ·
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
21
|
|
22
22
|
Made with ♥ by https://www.lesli.tech
|
23
23
|
Building a better future, one line of code at a time.
|
24
24
|
|
25
25
|
@contact hello@lesli.tech
|
26
|
-
@website https://lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
27
|
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
28
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
-
// ·
|
31
|
-
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
32
31
|
*/
|
33
32
|
|
34
|
-
@import "pages/
|
33
|
+
@import "lesli/pages/devise-simple";
|
34
|
+
|
35
|
+
|
36
|
+
// ·
|
37
|
+
div.confirmation-message {
|
38
|
+
//box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
39
|
+
padding: 4rem 0 5rem;
|
40
|
+
text-align: center;
|
41
|
+
max-width: 800px;
|
42
|
+
margin: 0 auto;
|
43
|
+
width: 90%;
|
44
|
+
|
45
|
+
svg {
|
46
|
+
max-width: 90px;
|
47
|
+
margin-bottom: 1rem;
|
48
|
+
fill: lesli-css-color(lime, 300);
|
49
|
+
}
|
50
|
+
|
51
|
+
p {
|
52
|
+
font-weight: 100;
|
53
|
+
font-size: 2rem;
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
@@ -69,10 +69,10 @@ module Lesli
|
|
69
69
|
# allowed core methods:
|
70
70
|
# [:index, :create, :update, :destroy, :new, :show, :edit, :options, :search, :resources]
|
71
71
|
def authorize_privileges
|
72
|
-
|
72
|
+
L2.info "authorize_privileges start"
|
73
73
|
# check if user has access to the requested controller
|
74
74
|
# this search is over all the privileges for all the roles of the user
|
75
|
-
granted = current_user.
|
75
|
+
granted = current_user.has_privileges_for?(params[:controller], params[:action])
|
76
76
|
|
77
77
|
# get the path to which the user is limited to
|
78
78
|
limited_path = current_user.has_role_limited_to_path?
|
@@ -64,15 +64,14 @@ module Lesli
|
|
64
64
|
|
65
65
|
def log_account_requests
|
66
66
|
return unless Lesli.config.security.dig(:enable_analytics)
|
67
|
+
return unless defined?(LesliAudit)
|
67
68
|
return unless current_user
|
68
|
-
return unless session[:user_session_id]
|
69
69
|
|
70
70
|
# Try to save a unique record for this request configuration
|
71
|
-
current_user.account.
|
71
|
+
current_user.account.audit.account_requests.upsert(
|
72
72
|
{
|
73
73
|
request_controller: controller_path,
|
74
74
|
request_action: action_name,
|
75
|
-
request_method: request.method,
|
76
75
|
request_count: 1
|
77
76
|
},
|
78
77
|
|
@@ -80,7 +79,7 @@ module Lesli
|
|
80
79
|
unique_by: %i[request_controller request_action created_at account_id],
|
81
80
|
|
82
81
|
# if request id is not unique, increase the counter for this configuration
|
83
|
-
on_duplicate: Arel.sql("request_count =
|
82
|
+
on_duplicate: Arel.sql("request_count = lesli_audit_account_requests.request_count + 1")
|
84
83
|
)
|
85
84
|
end
|
86
85
|
|
@@ -88,55 +87,32 @@ module Lesli
|
|
88
87
|
# this is disabled by default in the settings file
|
89
88
|
def log_user_requests
|
90
89
|
return unless Lesli.config.security.dig(:enable_analytics)
|
90
|
+
return unless defined?(LesliAudit)
|
91
91
|
return unless current_user
|
92
92
|
return unless session[:user_session_id]
|
93
|
-
|
93
|
+
|
94
94
|
# Try to save a unique record for this request configuration
|
95
|
-
current_user.
|
95
|
+
current_user.account.audit.user_requests.upsert(
|
96
96
|
{
|
97
|
-
|
98
|
-
|
97
|
+
request_controller: controller_path,
|
98
|
+
request_action: action_name,
|
99
|
+
session_id: session[:user_session_id],
|
100
|
+
user_id: current_user.id,
|
101
|
+
request_count: 1
|
99
102
|
},
|
100
|
-
|
103
|
+
|
101
104
|
# group of columns to consider a request as unique
|
102
|
-
unique_by: %i[created_at user_id session_id],
|
105
|
+
unique_by: %i[request_controller request_action created_at user_id session_id],
|
103
106
|
|
104
107
|
# if request id is not unique
|
105
108
|
# - increase the counter for this configuration
|
106
109
|
# - update the datetime of the last request
|
107
110
|
on_duplicate: Arel.sql(
|
108
|
-
'request_count =
|
109
|
-
'updated_at = current_timestamp'
|
111
|
+
'request_count = lesli_audit_user_requests.request_count + 1'
|
110
112
|
)
|
111
113
|
)
|
112
114
|
end
|
113
115
|
|
114
|
-
# Track user agents
|
115
|
-
# this is disabled by default in the settings file
|
116
|
-
def log_user_agent
|
117
|
-
return unless Lesli.config.security.dig(:enable_analytics)
|
118
|
-
return unless current_user
|
119
|
-
return unless session[:user_session_id]
|
120
|
-
|
121
|
-
user_agent = get_user_agent(false)
|
122
|
-
|
123
|
-
# Try to save a unique record for this agent configuration
|
124
|
-
current_user.agents.upsert(
|
125
|
-
{
|
126
|
-
os: user_agent[:os] || "unknown",
|
127
|
-
platform: user_agent[:platform] || "unknown",
|
128
|
-
browser: user_agent[:browser] || "unknown",
|
129
|
-
version: user_agent[:version] || "unknown",
|
130
|
-
count: 1
|
131
|
-
},
|
132
|
-
# group of columns to consider a agent as unique
|
133
|
-
unique_by: %i[platform os browser version user_id],
|
134
|
-
|
135
|
-
# if request id is not unique, increase the counter for this configuration
|
136
|
-
on_duplicate: Arel.sql("count = lesli_user_agents.count + 1")
|
137
|
-
)
|
138
|
-
end
|
139
|
-
|
140
116
|
# Track specific account activity
|
141
117
|
# this is disabled by default in the settings file
|
142
118
|
def log_account_activity(system_module, system_process, title = nil, payload = nil, description = nil)
|
@@ -36,7 +36,9 @@ module Lesli
|
|
36
36
|
|
37
37
|
def list
|
38
38
|
respond_to do |format|
|
39
|
-
format.json {
|
39
|
+
format.json {
|
40
|
+
respond_with_successful(Role.list(current_user, query, params))
|
41
|
+
}
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|