diff --git a/api/.babelrc.json b/api/.babelrc.json index b7c04286..b727ed84 100644 --- a/api/.babelrc.json +++ b/api/.babelrc.json @@ -1,17 +1,25 @@ { - "presets": [ - [ - "@babel/preset-env", - { - "modules": false, - "targets": { - "node": "current" - } - } - ], - "@babel/preset-typescript" + "presets": [ + [ + "@babel/preset-env", + { + "modules": false, + "targets": { + "node": "current" + } + } ], - "plugins": [ - "add-import-extension" + "@babel/preset-typescript" + ], + "plugins": [ + "add-import-extension", + [ + "module-resolver", + { + "alias": { + ":movinin-types": "../packages/movinin-types" + } + } ] + ] } diff --git a/api/package-lock.json b/api/package-lock.json index 7c10eab6..d07aeeac 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -29,6 +29,7 @@ "@types/validator": "^13.11.9", "babel-jest": "^29.7.0", "babel-plugin-add-import-extension": "^1.6.0", + "babel-plugin-module-resolver": "^5.0.0", "bcrypt": "^5.1.1", "compression": "^1.7.4", "cookie-parser": "^1.4.6", @@ -43,7 +44,6 @@ "jest": "^29.7.0", "jsonwebtoken": "^9.0.2", "mongoose": "^8.3.1", - "movinin-types": "file:../packages/movinin-types", "multer": "^1.4.5-lts.1", "nocache": "^4.0.0", "nodemailer": "^6.9.13", @@ -67,6 +67,7 @@ }, "../packages/movinin-types": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "rimraf": "^5.0.1", @@ -4337,6 +4338,58 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/babel-plugin-module-resolver": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-5.0.0.tgz", + "integrity": "sha512-g0u+/ChLSJ5+PzYwLwP8Rp8Rcfowz58TJNCe+L/ui4rpzE/mg//JVX0EWBUYoxaextqnwuGHzfGp2hh0PPV25Q==", + "dependencies": { + "find-babel-config": "^2.0.0", + "glob": "^8.0.3", + "pkg-up": "^3.1.0", + "reselect": "^4.1.7", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.10", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.10.tgz", @@ -6455,6 +6508,18 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/find-babel-config": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-2.0.0.tgz", + "integrity": "sha512-dOKT7jvF3hGzlW60Gc3ONox/0rRZ/tz7WCil0bqA1In/3I8f1BctpXahRnEKDySZqci7u+dqq93sZST9fOJpFw==", + "dependencies": { + "json5": "^2.1.1", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -9203,10 +9268,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "node_modules/movinin-types": { - "resolved": "../packages/movinin-types", - "link": true - }, "node_modules/mpath": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", @@ -10366,6 +10427,73 @@ "node": ">=8" } }, + "node_modules/pkg-up": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-up/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-up/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -10851,6 +10979,11 @@ "node": ">=0.10.0" } }, + "node_modules/reselect": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz", + "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==" + }, "node_modules/resolve": { "version": "1.22.6", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz", diff --git a/api/package.json b/api/package.json index c247d1f7..094d4208 100644 --- a/api/package.json +++ b/api/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "dev": "nodemon", - "build": "rimraf dist && tsc && babel dist -d dist", + "build": "rimraf dist && tsc -b && babel dist -d dist", "start": "npm run build && node dist/src", "test": "rimraf coverage && cross-env NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage", "lint": "eslint --ext .ts .", @@ -46,6 +46,7 @@ "@types/validator": "^13.11.9", "babel-jest": "^29.7.0", "babel-plugin-add-import-extension": "^1.6.0", + "babel-plugin-module-resolver": "^5.0.0", "bcrypt": "^5.1.1", "compression": "^1.7.4", "cookie-parser": "^1.4.6", @@ -60,7 +61,6 @@ "jest": "^29.7.0", "jsonwebtoken": "^9.0.2", "mongoose": "^8.3.1", - "movinin-types": "file:../packages/movinin-types", "multer": "^1.4.5-lts.1", "nocache": "^4.0.0", "nodemailer": "^6.9.13", diff --git a/api/src/config/env.config.ts b/api/src/config/env.config.ts index 81d1ea62..52b10f40 100644 --- a/api/src/config/env.config.ts +++ b/api/src/config/env.config.ts @@ -1,7 +1,7 @@ import process from 'node:process' import { Document, Types } from 'mongoose' import { CookieOptions } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as helper from '../common/helper' /** diff --git a/api/src/controllers/agencyController.ts b/api/src/controllers/agencyController.ts index 115be8c8..1af273a5 100644 --- a/api/src/controllers/agencyController.ts +++ b/api/src/controllers/agencyController.ts @@ -2,7 +2,7 @@ import path from 'node:path' import fs from 'node:fs/promises' import escapeStringRegexp from 'escape-string-regexp' import { Request, Response } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import * as env from '../config/env.config' import User from '../models/User' diff --git a/api/src/controllers/bookingController.ts b/api/src/controllers/bookingController.ts index 6368b287..3b0da8e2 100644 --- a/api/src/controllers/bookingController.ts +++ b/api/src/controllers/bookingController.ts @@ -2,7 +2,7 @@ import mongoose from 'mongoose' import escapeStringRegexp from 'escape-string-regexp' import { Expo, ExpoPushMessage, ExpoPushTicket } from 'expo-server-sdk' import { Request, Response } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import Booking from '../models/Booking' import User from '../models/User' diff --git a/api/src/controllers/locationController.ts b/api/src/controllers/locationController.ts index cf2e52fe..7cf84065 100644 --- a/api/src/controllers/locationController.ts +++ b/api/src/controllers/locationController.ts @@ -1,7 +1,7 @@ import escapeStringRegexp from 'escape-string-regexp' import mongoose from 'mongoose' import { Request, Response } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as env from '../config/env.config' import i18n from '../lang/i18n' import Location from '../models/Location' diff --git a/api/src/controllers/propertyController.ts b/api/src/controllers/propertyController.ts index cdc15def..79bac0d1 100644 --- a/api/src/controllers/propertyController.ts +++ b/api/src/controllers/propertyController.ts @@ -4,7 +4,7 @@ import { v1 as uuid } from 'uuid' import escapeStringRegexp from 'escape-string-regexp' import mongoose from 'mongoose' import { Request, Response } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Booking from '../models/Booking' import Property from '../models/Property' import i18n from '../lang/i18n' diff --git a/api/src/controllers/userController.ts b/api/src/controllers/userController.ts index 978624bc..ea86b70c 100644 --- a/api/src/controllers/userController.ts +++ b/api/src/controllers/userController.ts @@ -6,7 +6,7 @@ import { v1 as uuid } from 'uuid' import escapeStringRegexp from 'escape-string-regexp' import mongoose from 'mongoose' import { CookieOptions, Request, Response } from 'express' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import * as env from '../config/env.config' import User from '../models/User' diff --git a/api/src/models/Booking.ts b/api/src/models/Booking.ts index 1a8865c4..e2e26409 100644 --- a/api/src/models/Booking.ts +++ b/api/src/models/Booking.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as env from '../config/env.config' const bookingSchema = new Schema( diff --git a/api/src/models/Property.ts b/api/src/models/Property.ts index 9320543e..a69b0ad9 100644 --- a/api/src/models/Property.ts +++ b/api/src/models/Property.ts @@ -1,5 +1,5 @@ import { Schema, model } from 'mongoose' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as env from '../config/env.config' const propertySchema = new Schema( diff --git a/api/src/models/User.ts b/api/src/models/User.ts index 482af50b..02104b10 100644 --- a/api/src/models/User.ts +++ b/api/src/models/User.ts @@ -1,6 +1,6 @@ import validator from 'validator' import { Schema, model } from 'mongoose' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as env from '../config/env.config' const userSchema = new Schema( diff --git a/api/tests/agency.test.ts b/api/tests/agency.test.ts index 1e4aaa5b..84d8341c 100644 --- a/api/tests/agency.test.ts +++ b/api/tests/agency.test.ts @@ -4,7 +4,7 @@ import url from 'url' import path from 'path' import fs from 'node:fs/promises' import { v1 as uuid } from 'uuid' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as databaseHelper from '../src/common/databaseHelper' import * as testHelper from './testHelper' import app from '../src/app' diff --git a/api/tests/booking.test.ts b/api/tests/booking.test.ts index 5cf1149a..c19a2c08 100644 --- a/api/tests/booking.test.ts +++ b/api/tests/booking.test.ts @@ -1,6 +1,6 @@ import 'dotenv/config' import request from 'supertest' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { v1 as uuid } from 'uuid' import app from '../src/app' import * as databaseHelper from '../src/common/databaseHelper' diff --git a/api/tests/location.test.ts b/api/tests/location.test.ts index 19f9322e..3621ee51 100644 --- a/api/tests/location.test.ts +++ b/api/tests/location.test.ts @@ -1,7 +1,7 @@ import 'dotenv/config' import request from 'supertest' import { v1 as uuid } from 'uuid' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import app from '../src/app' import * as databaseHelper from '../src/common/databaseHelper' import * as testHelper from './testHelper' diff --git a/api/tests/middleware.test.ts b/api/tests/middleware.test.ts index b69ee634..c85fba86 100644 --- a/api/tests/middleware.test.ts +++ b/api/tests/middleware.test.ts @@ -1,6 +1,6 @@ import 'dotenv/config' import request from 'supertest' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as databaseHelper from '../src/common/databaseHelper' import app from '../src/app' import * as env from '../src/config/env.config' diff --git a/api/tests/miscellaneous.test.ts b/api/tests/miscellaneous.test.ts index 170899b2..14495e64 100644 --- a/api/tests/miscellaneous.test.ts +++ b/api/tests/miscellaneous.test.ts @@ -1,5 +1,5 @@ import 'dotenv/config' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as env from '../src/config/env.config' import * as databaseHelper from '../src/common/databaseHelper' import * as mailHelper from '../src/common/mailHelper' diff --git a/api/tests/property.test.ts b/api/tests/property.test.ts index a3da6133..8fe8950f 100644 --- a/api/tests/property.test.ts +++ b/api/tests/property.test.ts @@ -1,6 +1,6 @@ import 'dotenv/config' import request from 'supertest' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import url from 'url' import path from 'path' import fs from 'node:fs/promises' diff --git a/api/tests/testHelper.ts b/api/tests/testHelper.ts index 4404826d..b7113e45 100644 --- a/api/tests/testHelper.ts +++ b/api/tests/testHelper.ts @@ -1,7 +1,7 @@ import request from 'supertest' import cookieParser from 'cookie-parser' import bcrypt from 'bcrypt' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { v1 as uuid } from 'uuid' import mongoose from 'mongoose' import app from '../src/app' diff --git a/api/tests/user.test.ts b/api/tests/user.test.ts index 8d38596e..cbc7c7da 100644 --- a/api/tests/user.test.ts +++ b/api/tests/user.test.ts @@ -4,7 +4,7 @@ import url from 'url' import path from 'path' import fs from 'node:fs/promises' import { v1 as uuid } from 'uuid' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import app from '../src/app' import * as databaseHelper from '../src/common/databaseHelper' import * as testHelper from './testHelper' diff --git a/api/tsconfig.json b/api/tsconfig.json index 349d7401..2ca6089c 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -26,10 +26,12 @@ /* Modules */ "module": "esnext", /* Specify what module code is generated. */ - "rootDir": "./", /* Specify the root folder within your source files. */ + "rootDir": "./", /* Specify the root folder within your source files. */ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + "paths": { + ":movinin-types": ["../packages/movinin-types"] + }, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ @@ -109,5 +111,8 @@ "exclude": [ "dist", "node_modules" - ] + ], + "references": [ + { "path": "../packages/movinin-types" } + ], } diff --git a/backend/craco.config.js b/backend/craco.config.js new file mode 100644 index 00000000..2d3acbf1 --- /dev/null +++ b/backend/craco.config.js @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable import/no-extraneous-dependencies */ +const path = require('path') +const { CracoAliasPlugin } = require('react-app-alias-ex') + +module.exports = { + plugins: [ + { + plugin: CracoAliasPlugin, + options: {} + } + ], + webpack: { + alias: { + ':bookcars-types': path.resolve(__dirname, '../packages/bookcars-types'), + ':bookcars-helper': path.resolve(__dirname, '../packages/bookcars-helper'), + ':disable-react-devtools': path.resolve(__dirname, '../packages/disable-react-devtools'), + }, + }, +} diff --git a/backend/package-lock.json b/backend/package-lock.json index b7059288..d3c0e64a 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -8,6 +8,7 @@ "name": "backend", "version": "2.6.0", "dependencies": { + "@craco/craco": "^7.1.0", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.15", @@ -23,13 +24,11 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "date-fns": "^2.25.0", - "disable-react-devtools": "file:../packages/disable-react-devtools", "draft-js": "^0.11.7", "draftjs-to-html": "^0.9.1", "html-to-draftjs": "^1.5.0", - "movinin-helper": "file:../packages/movinin-helper", - "movinin-types": "file:../packages/movinin-types", "react": "^18.2.0", + "react-app-alias-ex": "^2.1.0", "react-dom": "^18.2.0", "react-draft-wysiwyg": "^1.15.0", "react-localization": "^1.0.19", @@ -49,6 +48,7 @@ }, "../packages/disable-react-devtools": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "rimraf": "^5.0.1", @@ -57,6 +57,7 @@ }, "../packages/movinin-helper": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "movinin-types": "file:../movinin-types" @@ -68,6 +69,7 @@ }, "../packages/movinin-types": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "rimraf": "^5.0.1", @@ -2025,6 +2027,79 @@ "node": ">=0.1.90" } }, + "node_modules/@craco/craco": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@craco/craco/-/craco-7.1.0.tgz", + "integrity": "sha512-oRAcPIKYrfPXp9rSzlsDNeOaVtDiKhoyqSXUoqiK24jCkHr4T8m/a2f74yXIzCbIheoUWDOIfWZyRgFgT+cpqA==", + "dependencies": { + "autoprefixer": "^10.4.12", + "cosmiconfig": "^7.0.1", + "cosmiconfig-typescript-loader": "^1.0.0", + "cross-spawn": "^7.0.3", + "lodash": "^4.17.21", + "semver": "^7.3.7", + "webpack-merge": "^5.8.0" + }, + "bin": { + "craco": "dist/bin/craco.js" + }, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "react-scripts": "^5.0.0" + } + }, + "node_modules/@craco/craco/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@craco/craco/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@craco/craco/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@csstools/css-parser-algorithms": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.6.1.tgz", @@ -4710,6 +4785,26 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -7110,6 +7205,30 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-deep/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/clsx": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", @@ -7409,6 +7528,29 @@ "node": ">=10" } }, + "node_modules/cosmiconfig-typescript-loader": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.9.tgz", + "integrity": "sha512-tRuMRhxN4m1Y8hP9SNYfz7jRwt8lZdWxdjg/ohg5esKmsndJIn4yT96oJVcf5x0eA11taXl+sIp+ielu529k6g==", + "dependencies": { + "cosmiconfig": "^7", + "ts-node": "^10.7.0" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=7", + "typescript": ">=3" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, "node_modules/cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", @@ -8137,6 +8279,14 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -8156,10 +8306,6 @@ "node": ">=8" } }, - "node_modules/disable-react-devtools": { - "resolved": "../packages/disable-react-devtools", - "link": true - }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", @@ -9785,6 +9931,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, "node_modules/flat-cache": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", @@ -11704,6 +11858,14 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -14421,6 +14583,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, "node_modules/make-fetch-happen": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", @@ -14918,14 +15085,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/movinin-helper": { - "resolved": "../packages/movinin-helper", - "link": true - }, - "node_modules/movinin-types": { - "resolved": "../packages/movinin-types", - "link": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -17933,6 +18092,19 @@ "node": ">=0.10.0" } }, + "node_modules/react-app-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-app-alias/-/react-app-alias-2.2.2.tgz", + "integrity": "sha512-mkebUkGLEBA8A8jripu5h1e3cccGl8wWHCUmyJo43/KhaN91DO3qyCLWGWneogqkG4PWhp2JHtlCJ06YSdHVYQ==" + }, + "node_modules/react-app-alias-ex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-app-alias-ex/-/react-app-alias-ex-2.1.0.tgz", + "integrity": "sha512-MTr2yBSlU68ptmrukT8F6Fp6K6dp4Ui+uX/qV28oqGD+v+cLB+mOAnprvQOuG0zS6fW+X9Xk0QzaG6t30pQvHQ==", + "dependencies": { + "react-app-alias": "^2.0.0" + } + }, "node_modules/react-app-polyfill": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", @@ -19227,6 +19399,17 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -20916,6 +21099,61 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -21431,6 +21669,11 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, "node_modules/v8-to-istanbul": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", @@ -21878,6 +22121,19 @@ "node": ">=10.13.0" } }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", @@ -22096,6 +22352,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==" + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -22656,6 +22917,14 @@ "node": ">=10" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/backend/package.json b/backend/package.json index 74eacabb..74a80d94 100644 --- a/backend/package.json +++ b/backend/package.json @@ -3,6 +3,7 @@ "version": "2.6.0", "private": true, "dependencies": { + "@craco/craco": "^7.1.0", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.15", @@ -18,13 +19,11 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "date-fns": "^2.25.0", - "disable-react-devtools": "file:../packages/disable-react-devtools", "draft-js": "^0.11.7", "draftjs-to-html": "^0.9.1", "html-to-draftjs": "^1.5.0", - "movinin-helper": "file:../packages/movinin-helper", - "movinin-types": "file:../packages/movinin-types", "react": "^18.2.0", + "react-app-alias-ex": "^2.1.0", "react-dom": "^18.2.0", "react-draft-wysiwyg": "^1.15.0", "react-localization": "^1.0.19", @@ -35,10 +34,10 @@ "validator": "^13.11.0" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject", + "start": "tsc -b && craco start", + "build": "tsc -b && craco build", + "test": "tsc -b && craco test", + "eject": "craco eject", "lint": "eslint --ext .ts,.tsx .", "fix": "eslint --fix .", "stylelint": "stylelint \"**/*.css\"", diff --git a/backend/src/common/helper.ts b/backend/src/common/helper.ts index ca1e0b24..13dc4359 100644 --- a/backend/src/common/helper.ts +++ b/backend/src/common/helper.ts @@ -1,6 +1,6 @@ import { toast } from 'react-toastify' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as rtStrings } from '../lang/rental-term' import { strings } from '../lang/properties' diff --git a/backend/src/components/AgencyBadge.tsx b/backend/src/components/AgencyBadge.tsx index 7028e5c6..22ce9693 100644 --- a/backend/src/components/AgencyBadge.tsx +++ b/backend/src/components/AgencyBadge.tsx @@ -1,6 +1,6 @@ import React from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import '../assets/css/agency-badge.css' diff --git a/backend/src/components/AgencyFilter.tsx b/backend/src/components/AgencyFilter.tsx index 6f0cb193..bcb2023f 100644 --- a/backend/src/components/AgencyFilter.tsx +++ b/backend/src/components/AgencyFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import Accordion from './Accordion' diff --git a/backend/src/components/AgencyList.tsx b/backend/src/components/AgencyList.tsx index 86d0fd05..63d34ec3 100644 --- a/backend/src/components/AgencyList.tsx +++ b/backend/src/components/AgencyList.tsx @@ -16,8 +16,8 @@ import { Edit as EditIcon, Delete as DeleteIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import Const from '../config/const' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/components/AgencySelectList.tsx b/backend/src/components/AgencySelectList.tsx index 826fef0d..098c87e2 100644 --- a/backend/src/components/AgencySelectList.tsx +++ b/backend/src/components/AgencySelectList.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' import { TextFieldVariants } from '@mui/material' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as AgencyService from '../services/AgencyService' import * as helper from '../common/helper' diff --git a/backend/src/components/AvailabilityFilter.tsx b/backend/src/components/AvailabilityFilter.tsx index 5e3d1970..bb7f1fdb 100644 --- a/backend/src/components/AvailabilityFilter.tsx +++ b/backend/src/components/AvailabilityFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/properties' import Accordion from './Accordion' diff --git a/backend/src/components/Avatar.tsx b/backend/src/components/Avatar.tsx index e1654ed1..4ee8bc77 100644 --- a/backend/src/components/Avatar.tsx +++ b/backend/src/components/Avatar.tsx @@ -18,8 +18,8 @@ import { DirectionsCar as PropertyIcon, Check as VerifiedIcon, } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' diff --git a/backend/src/components/BookingFilter.tsx b/backend/src/components/BookingFilter.tsx index f93bce6a..a60157ed 100644 --- a/backend/src/components/BookingFilter.tsx +++ b/backend/src/components/BookingFilter.tsx @@ -9,8 +9,8 @@ import { Search as SearchIcon, Clear as ClearIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/booking-filter' import LocationSelectList from './LocationSelectList' diff --git a/backend/src/components/BookingList.tsx b/backend/src/components/BookingList.tsx index 3a22e2a7..8e27fdaf 100644 --- a/backend/src/components/BookingList.tsx +++ b/backend/src/components/BookingList.tsx @@ -26,8 +26,8 @@ import { } from '@mui/icons-material' import { format } from 'date-fns' import { fr as dfnsFR, enUS as dfnsENUS } from 'date-fns/locale' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings as csStrings } from '../lang/properties' diff --git a/backend/src/components/Header.tsx b/backend/src/components/Header.tsx index a741c91c..0098ba30 100644 --- a/backend/src/components/Header.tsx +++ b/backend/src/components/Header.tsx @@ -32,7 +32,7 @@ import { ExitToApp as SignoutIcon, } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import env from '../config/env.config' import { strings } from '../lang/header' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/components/ImageEditor.tsx b/backend/src/components/ImageEditor.tsx index 606c3b95..218c56e1 100644 --- a/backend/src/components/ImageEditor.tsx +++ b/backend/src/components/ImageEditor.tsx @@ -3,7 +3,7 @@ import { Delete as DeleteIcon, PhotoCamera as ImageIcon } from '@mui/icons-material' -import * as movininHelper from 'movinin-helper' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/image-editor' import ImageViewer from './ImageViewer' diff --git a/backend/src/components/LocationList.tsx b/backend/src/components/LocationList.tsx index 2b049186..15c70ad1 100644 --- a/backend/src/components/LocationList.tsx +++ b/backend/src/components/LocationList.tsx @@ -21,7 +21,7 @@ import { Delete as DeleteIcon, LocationOn as LocationIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import env from '../config/env.config' import Const from '../config/const' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/components/LocationSelectList.tsx b/backend/src/components/LocationSelectList.tsx index 12a731ad..30e8b7f5 100644 --- a/backend/src/components/LocationSelectList.tsx +++ b/backend/src/components/LocationSelectList.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' import { TextFieldVariants } from '@mui/material' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as LocationService from '../services/LocationService' import * as helper from '../common/helper' diff --git a/backend/src/components/Master.tsx b/backend/src/components/Master.tsx index 6528bf60..4c88d613 100644 --- a/backend/src/components/Master.tsx +++ b/backend/src/components/Master.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, CSSProperties, ReactNode } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings } from '../lang/master' import Header from './Header' import * as UserService from '../services/UserService' diff --git a/backend/src/components/MultipleSelect.tsx b/backend/src/components/MultipleSelect.tsx index 9fe04578..ae678f39 100644 --- a/backend/src/components/MultipleSelect.tsx +++ b/backend/src/components/MultipleSelect.tsx @@ -10,8 +10,8 @@ import { AutocompleteInputChangeReason } from '@mui/material' import { LocationOn as LocationIcon, AccountCircle } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import '../assets/css/multiple-select.css' diff --git a/backend/src/components/NotificationList.tsx b/backend/src/components/NotificationList.tsx index 1ca7ae96..83643dfd 100644 --- a/backend/src/components/NotificationList.tsx +++ b/backend/src/components/NotificationList.tsx @@ -23,8 +23,8 @@ import { import { format } from 'date-fns' import { fr, enUS } from 'date-fns/locale' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/notifications' import * as NotificationService from '../services/NotificationService' diff --git a/backend/src/components/PropertyInfo.tsx b/backend/src/components/PropertyInfo.tsx index 2be66f05..541c38e8 100644 --- a/backend/src/components/PropertyInfo.tsx +++ b/backend/src/components/PropertyInfo.tsx @@ -19,8 +19,8 @@ import { AttachMoney as RentalTermIcon, PhotoSizeSelectSmall as SizeIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as helper from '../common/helper' import { strings } from '../lang/properties' import { strings as cpStrings } from '../lang/create-property' diff --git a/backend/src/components/PropertyList.tsx b/backend/src/components/PropertyList.tsx index 3688917d..2701057f 100644 --- a/backend/src/components/PropertyList.tsx +++ b/backend/src/components/PropertyList.tsx @@ -17,8 +17,8 @@ import { Delete as DeleteIcon, Bookmarks as BookingsIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import Const from '../config/const' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/components/PropertySelectList.tsx b/backend/src/components/PropertySelectList.tsx index f22f2743..c6e58883 100644 --- a/backend/src/components/PropertySelectList.tsx +++ b/backend/src/components/PropertySelectList.tsx @@ -7,7 +7,7 @@ import { Button, TextFieldVariants } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings as bfStrings } from '../lang/booking-filter' diff --git a/backend/src/components/PropertyTypeFilter.tsx b/backend/src/components/PropertyTypeFilter.tsx index 17b787a1..682a25b9 100644 --- a/backend/src/components/PropertyTypeFilter.tsx +++ b/backend/src/components/PropertyTypeFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as cpStrings } from '../lang/create-property' import { strings } from '../lang/properties' diff --git a/backend/src/components/PropertyTypeList.tsx b/backend/src/components/PropertyTypeList.tsx index 080946dc..c42a5f72 100644 --- a/backend/src/components/PropertyTypeList.tsx +++ b/backend/src/components/PropertyTypeList.tsx @@ -5,7 +5,7 @@ import { MenuItem, SelectChangeEvent } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings } from '../lang/properties' interface PropertyTypeListProps { diff --git a/backend/src/components/RentalTermFilter.tsx b/backend/src/components/RentalTermFilter.tsx index a76c68ac..ae7e0e8f 100644 --- a/backend/src/components/RentalTermFilter.tsx +++ b/backend/src/components/RentalTermFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as cpStrings } from '../lang/create-property' import { strings } from '../lang/rental-term' diff --git a/backend/src/components/RentalTermList.tsx b/backend/src/components/RentalTermList.tsx index 9848b31c..955c922d 100644 --- a/backend/src/components/RentalTermList.tsx +++ b/backend/src/components/RentalTermList.tsx @@ -5,7 +5,7 @@ import { MenuItem, SelectChangeEvent } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings } from '../lang/rental-term' interface RentalTermListProps { diff --git a/backend/src/components/StatusFilter.tsx b/backend/src/components/StatusFilter.tsx index 92997205..13dde8bd 100644 --- a/backend/src/components/StatusFilter.tsx +++ b/backend/src/components/StatusFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' import Accordion from '../components/Accordion' diff --git a/backend/src/components/StatusList.tsx b/backend/src/components/StatusList.tsx index 774662d9..20ba0d2b 100644 --- a/backend/src/components/StatusList.tsx +++ b/backend/src/components/StatusList.tsx @@ -6,7 +6,7 @@ import { SelectChangeEvent, TextFieldVariants } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' diff --git a/backend/src/components/UserList.tsx b/backend/src/components/UserList.tsx index 301eeda8..cc2ab0e2 100644 --- a/backend/src/components/UserList.tsx +++ b/backend/src/components/UserList.tsx @@ -22,8 +22,8 @@ import { Delete as DeleteIcon, AccountCircle, Check as VerifiedIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/user-list' diff --git a/backend/src/components/UserSelectList.tsx b/backend/src/components/UserSelectList.tsx index 6342e52c..43f7f64f 100644 --- a/backend/src/components/UserSelectList.tsx +++ b/backend/src/components/UserSelectList.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' import { TextFieldVariants } from '@mui/material' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as UserService from '../services/UserService' import * as helper from '../common/helper' diff --git a/backend/src/components/UserTypeFilter.tsx b/backend/src/components/UserTypeFilter.tsx index e968949c..362ea60a 100644 --- a/backend/src/components/UserTypeFilter.tsx +++ b/backend/src/components/UserTypeFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' diff --git a/backend/src/config/env.config.ts b/backend/src/config/env.config.ts index 264dd6ca..a2e87ab3 100644 --- a/backend/src/config/env.config.ts +++ b/backend/src/config/env.config.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Const from './const' // diff --git a/backend/src/index.tsx b/backend/src/index.tsx index d4e73bcd..1c9d4410 100644 --- a/backend/src/index.tsx +++ b/backend/src/index.tsx @@ -7,7 +7,7 @@ import { ToastContainer } from 'react-toastify' import { frFR as corefrFR, enUS as coreenUS } from '@mui/material/locale' import { frFR, enUS } from '@mui/x-date-pickers/locales' import { frFR as dataGridfrFR, enUS as dataGridenUS } from '@mui/x-data-grid/locales' -import { disableDevTools } from 'disable-react-devtools' +import { disableDevTools } from ':disable-react-devtools' import * as helper from './common/helper' import * as UserService from './services/UserService' import { strings as commonStrings } from './lang/common' diff --git a/backend/src/pages/Activate.tsx b/backend/src/pages/Activate.tsx index cd98e79f..e19c1d61 100644 --- a/backend/src/pages/Activate.tsx +++ b/backend/src/pages/Activate.tsx @@ -9,7 +9,7 @@ import { Link } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/Agencies.tsx b/backend/src/pages/Agencies.tsx index 71bcb444..a91f9915 100644 --- a/backend/src/pages/Agencies.tsx +++ b/backend/src/pages/Agencies.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings } from '../lang/agencies' import Search from '../components/Search' diff --git a/backend/src/pages/Agency.tsx b/backend/src/pages/Agency.tsx index 3fe27c58..e6ff8104 100644 --- a/backend/src/pages/Agency.tsx +++ b/backend/src/pages/Agency.tsx @@ -11,8 +11,8 @@ import { } from '@mui/material' import { Edit as EditIcon, Delete as DeleteIcon } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings as clStrings } from '../lang/agency-list' diff --git a/backend/src/pages/Bookings.tsx b/backend/src/pages/Bookings.tsx index 4aab8608..981b756a 100644 --- a/backend/src/pages/Bookings.tsx +++ b/backend/src/pages/Bookings.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings } from '../lang/bookings' diff --git a/backend/src/pages/ChangePassword.tsx b/backend/src/pages/ChangePassword.tsx index c4a9509e..b6538cdf 100644 --- a/backend/src/pages/ChangePassword.tsx +++ b/backend/src/pages/ChangePassword.tsx @@ -7,7 +7,7 @@ import { FormHelperText, Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/change-password' diff --git a/backend/src/pages/CreateAgency.tsx b/backend/src/pages/CreateAgency.tsx index 7402d74f..733cc382 100644 --- a/backend/src/pages/CreateAgency.tsx +++ b/backend/src/pages/CreateAgency.tsx @@ -12,7 +12,7 @@ import { import { Info as InfoIcon } from '@mui/icons-material' import validator from 'validator' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/create-agency' diff --git a/backend/src/pages/CreateBooking.tsx b/backend/src/pages/CreateBooking.tsx index 375f51a3..ba3342df 100644 --- a/backend/src/pages/CreateBooking.tsx +++ b/backend/src/pages/CreateBooking.tsx @@ -10,7 +10,7 @@ import { Info as InfoIcon } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings as blStrings } from '../lang/booking-list' diff --git a/backend/src/pages/CreateLocation.tsx b/backend/src/pages/CreateLocation.tsx index ddc8a04c..99c9a1df 100644 --- a/backend/src/pages/CreateLocation.tsx +++ b/backend/src/pages/CreateLocation.tsx @@ -7,8 +7,8 @@ import { Button, Paper } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/create-location' diff --git a/backend/src/pages/CreateProperty.tsx b/backend/src/pages/CreateProperty.tsx index 5baa6dd8..8debad1c 100644 --- a/backend/src/pages/CreateProperty.tsx +++ b/backend/src/pages/CreateProperty.tsx @@ -15,8 +15,8 @@ import { Editor } from 'react-draft-wysiwyg' import { EditorState, convertToRaw, ContentState } from 'draft-js' import draftToHtml from 'draftjs-to-html' import htmlToDraft from 'html-to-draftjs' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/CreateUser.tsx b/backend/src/pages/CreateUser.tsx index 91bedabe..c998ff9e 100644 --- a/backend/src/pages/CreateUser.tsx +++ b/backend/src/pages/CreateUser.tsx @@ -16,8 +16,8 @@ import { Info as InfoIcon } from '@mui/icons-material' import validator from 'validator' import { intervalToDuration } from 'date-fns' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/ForgotPassword.tsx b/backend/src/pages/ForgotPassword.tsx index f5c0e680..19f2d9f9 100644 --- a/backend/src/pages/ForgotPassword.tsx +++ b/backend/src/pages/ForgotPassword.tsx @@ -9,7 +9,7 @@ import { Link } from '@mui/material' import validator from 'validator' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/Locations.tsx b/backend/src/pages/Locations.tsx index ad2d9d64..74b21de7 100644 --- a/backend/src/pages/Locations.tsx +++ b/backend/src/pages/Locations.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings } from '../lang/locations' import Search from '../components/Search' diff --git a/backend/src/pages/Notifications.tsx b/backend/src/pages/Notifications.tsx index c9d8df57..37c6818a 100644 --- a/backend/src/pages/Notifications.tsx +++ b/backend/src/pages/Notifications.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import NotificationList from '../components/NotificationList' diff --git a/backend/src/pages/Properties.tsx b/backend/src/pages/Properties.tsx index e590b987..024b58ab 100644 --- a/backend/src/pages/Properties.tsx +++ b/backend/src/pages/Properties.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as helper from '../common/helper' import { strings } from '../lang/properties' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/Property.tsx b/backend/src/pages/Property.tsx index 39de8345..d07e39d4 100644 --- a/backend/src/pages/Property.tsx +++ b/backend/src/pages/Property.tsx @@ -14,8 +14,8 @@ import { Delete as DeleteIcon, Bookmarks as BookingsIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Backdrop from '../components/SimpleBackdrop' import Master from '../components/Master' import env from '../config/env.config' diff --git a/backend/src/pages/PropertyBookings.tsx b/backend/src/pages/PropertyBookings.tsx index 54df2d86..0a80af04 100644 --- a/backend/src/pages/PropertyBookings.tsx +++ b/backend/src/pages/PropertyBookings.tsx @@ -14,8 +14,8 @@ import { Edit as EditIcon, Delete as DeleteIcon, } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/ResetPassword.tsx b/backend/src/pages/ResetPassword.tsx index 89172298..bbd52a3b 100644 --- a/backend/src/pages/ResetPassword.tsx +++ b/backend/src/pages/ResetPassword.tsx @@ -8,7 +8,7 @@ import { Paper } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/Settings.tsx b/backend/src/pages/Settings.tsx index bd3e8c49..2dcbd89b 100644 --- a/backend/src/pages/Settings.tsx +++ b/backend/src/pages/Settings.tsx @@ -10,8 +10,8 @@ import { Paper } from '@mui/material' import validator from 'validator' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/settings' diff --git a/backend/src/pages/SignIn.tsx b/backend/src/pages/SignIn.tsx index 0afa2b1a..276e6947 100644 --- a/backend/src/pages/SignIn.tsx +++ b/backend/src/pages/SignIn.tsx @@ -8,7 +8,7 @@ import { Link } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/sign-in' import * as UserService from '../services/UserService' diff --git a/backend/src/pages/SignUp.tsx b/backend/src/pages/SignUp.tsx index a5534bea..86d6d57f 100644 --- a/backend/src/pages/SignUp.tsx +++ b/backend/src/pages/SignUp.tsx @@ -9,7 +9,7 @@ import { } from '@mui/material' import validator from 'validator' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/sign-up' import * as UserService from '../services/UserService' diff --git a/backend/src/pages/UpdateAgency.tsx b/backend/src/pages/UpdateAgency.tsx index bcc83d0c..0afaea16 100644 --- a/backend/src/pages/UpdateAgency.tsx +++ b/backend/src/pages/UpdateAgency.tsx @@ -11,8 +11,8 @@ import { } from '@mui/material' import { Info as InfoIcon } from '@mui/icons-material' import validator from 'validator' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/UpdateBooking.tsx b/backend/src/pages/UpdateBooking.tsx index eacd4f63..7249264d 100644 --- a/backend/src/pages/UpdateBooking.tsx +++ b/backend/src/pages/UpdateBooking.tsx @@ -13,8 +13,8 @@ import { Info as InfoIcon, } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as blStrings } from '../lang/booking-list' import { strings as bfStrings } from '../lang/booking-filter' diff --git a/backend/src/pages/UpdateLocation.tsx b/backend/src/pages/UpdateLocation.tsx index 4c3a49de..4928e052 100644 --- a/backend/src/pages/UpdateLocation.tsx +++ b/backend/src/pages/UpdateLocation.tsx @@ -7,8 +7,8 @@ import { Button, Paper } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings as clStrings } from '../lang/create-location' diff --git a/backend/src/pages/UpdateProperty.tsx b/backend/src/pages/UpdateProperty.tsx index b8b410e6..77a51271 100644 --- a/backend/src/pages/UpdateProperty.tsx +++ b/backend/src/pages/UpdateProperty.tsx @@ -15,8 +15,8 @@ import { Editor } from 'react-draft-wysiwyg' import { EditorState, convertToRaw, ContentState } from 'draft-js' import draftToHtml from 'draftjs-to-html' import htmlToDraft from 'html-to-draftjs' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/UpdateUser.tsx b/backend/src/pages/UpdateUser.tsx index 0ae16912..263cd503 100644 --- a/backend/src/pages/UpdateUser.tsx +++ b/backend/src/pages/UpdateUser.tsx @@ -16,8 +16,8 @@ import { Info as InfoIcon } from '@mui/icons-material' import { intervalToDuration } from 'date-fns' import validator from 'validator' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' diff --git a/backend/src/pages/User.tsx b/backend/src/pages/User.tsx index eef94474..b961b7d0 100644 --- a/backend/src/pages/User.tsx +++ b/backend/src/pages/User.tsx @@ -14,8 +14,8 @@ import { Delete as DeleteIcon } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings as ulStrings } from '../lang/user-list' diff --git a/backend/src/pages/Users.tsx b/backend/src/pages/Users.tsx index 42518522..e16e55d2 100644 --- a/backend/src/pages/Users.tsx +++ b/backend/src/pages/Users.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import env from '../config/env.config' import { strings } from '../lang/users' diff --git a/backend/src/services/AgencyService.ts b/backend/src/services/AgencyService.ts index 91fcae3b..e02b85d6 100644 --- a/backend/src/services/AgencyService.ts +++ b/backend/src/services/AgencyService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' /** diff --git a/backend/src/services/BookingService.ts b/backend/src/services/BookingService.ts index ddbdc537..2e80f1d3 100644 --- a/backend/src/services/BookingService.ts +++ b/backend/src/services/BookingService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/backend/src/services/LocationService.ts b/backend/src/services/LocationService.ts index 11349bb4..17a6d0fc 100644 --- a/backend/src/services/LocationService.ts +++ b/backend/src/services/LocationService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/backend/src/services/NotificationService.ts b/backend/src/services/NotificationService.ts index 695aef5c..57b07940 100644 --- a/backend/src/services/NotificationService.ts +++ b/backend/src/services/NotificationService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import env from '../config/env.config' diff --git a/backend/src/services/PropertyService.ts b/backend/src/services/PropertyService.ts index e794e4ea..951a3399 100644 --- a/backend/src/services/PropertyService.ts +++ b/backend/src/services/PropertyService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/backend/src/services/UserService.ts b/backend/src/services/UserService.ts index e2e91847..830417e7 100644 --- a/backend/src/services/UserService.ts +++ b/backend/src/services/UserService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import env from '../config/env.config' diff --git a/backend/tsconfig.json b/backend/tsconfig.json index d04b620d..f0c2a669 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -19,11 +19,20 @@ "isolatedModules": false, "noEmit": true, "jsx": "react-jsx", - "typeRoots": [ - "./src/types" - ] + "rootDir": "./", + "baseUrl": "./", + "paths": { + ":movinin-types": ["../packages/movinin-types"], + ":movinin-helper": ["../packages/movinin-helper"], + ":disable-react-devtools": ["../packages/disable-react-devtools"] + } }, "include": [ "src" + ], + "references": [ + { "path": "../packages/movinin-types" }, + { "path": "../packages/movinin-helper" }, + { "path": "../packages/disable-react-devtools" } ] } diff --git a/frontend/craco.config.js b/frontend/craco.config.js new file mode 100644 index 00000000..2d3acbf1 --- /dev/null +++ b/frontend/craco.config.js @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable import/no-extraneous-dependencies */ +const path = require('path') +const { CracoAliasPlugin } = require('react-app-alias-ex') + +module.exports = { + plugins: [ + { + plugin: CracoAliasPlugin, + options: {} + } + ], + webpack: { + alias: { + ':bookcars-types': path.resolve(__dirname, '../packages/bookcars-types'), + ':bookcars-helper': path.resolve(__dirname, '../packages/bookcars-helper'), + ':disable-react-devtools': path.resolve(__dirname, '../packages/disable-react-devtools'), + }, + }, +} diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ff18d330..4101d45a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "frontend", "version": "2.6.0", "dependencies": { + "@craco/craco": "^7.1.0", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.15", @@ -21,10 +22,8 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "date-fns": "^2.25.0", - "disable-react-devtools": "file:../packages/disable-react-devtools", - "movinin-helper": "file:../packages/movinin-helper", - "movinin-types": "file:../packages/movinin-types", "react": "^18.2.0", + "react-app-alias-ex": "^2.1.0", "react-dom": "^18.2.0", "react-google-recaptcha": "^3.1.0", "react-localization": "^1.0.19", @@ -44,6 +43,7 @@ }, "../packages/disable-react-devtools": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "rimraf": "^5.0.1", @@ -52,6 +52,7 @@ }, "../packages/movinin-helper": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "movinin-types": "file:../movinin-types" @@ -63,6 +64,7 @@ }, "../packages/movinin-types": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "dependencies": { "rimraf": "^5.0.1", @@ -2020,6 +2022,79 @@ "node": ">=0.1.90" } }, + "node_modules/@craco/craco": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@craco/craco/-/craco-7.1.0.tgz", + "integrity": "sha512-oRAcPIKYrfPXp9rSzlsDNeOaVtDiKhoyqSXUoqiK24jCkHr4T8m/a2f74yXIzCbIheoUWDOIfWZyRgFgT+cpqA==", + "dependencies": { + "autoprefixer": "^10.4.12", + "cosmiconfig": "^7.0.1", + "cosmiconfig-typescript-loader": "^1.0.0", + "cross-spawn": "^7.0.3", + "lodash": "^4.17.21", + "semver": "^7.3.7", + "webpack-merge": "^5.8.0" + }, + "bin": { + "craco": "dist/bin/craco.js" + }, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "react-scripts": "^5.0.0" + } + }, + "node_modules/@craco/craco/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@craco/craco/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@craco/craco/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@csstools/css-parser-algorithms": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.6.1.tgz", @@ -4705,6 +4780,26 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -7066,6 +7161,30 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-deep/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/clsx": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", @@ -7365,6 +7484,29 @@ "node": ">=10" } }, + "node_modules/cosmiconfig-typescript-loader": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-1.0.9.tgz", + "integrity": "sha512-tRuMRhxN4m1Y8hP9SNYfz7jRwt8lZdWxdjg/ohg5esKmsndJIn4yT96oJVcf5x0eA11taXl+sIp+ielu529k6g==", + "dependencies": { + "cosmiconfig": "^7", + "ts-node": "^10.7.0" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@types/node": "*", + "cosmiconfig": ">=7", + "typescript": ">=3" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -8085,6 +8227,14 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", @@ -8104,10 +8254,6 @@ "node": ">=8" } }, - "node_modules/disable-react-devtools": { - "resolved": "../packages/disable-react-devtools", - "link": true - }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", @@ -9675,6 +9821,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, "node_modules/flat-cache": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", @@ -11574,6 +11728,14 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -14284,6 +14446,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, "node_modules/make-fetch-happen": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", @@ -14781,14 +14948,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/movinin-helper": { - "resolved": "../packages/movinin-helper", - "link": true - }, - "node_modules/movinin-types": { - "resolved": "../packages/movinin-types", - "link": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -17758,6 +17917,19 @@ "node": ">=0.10.0" } }, + "node_modules/react-app-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-app-alias/-/react-app-alias-2.2.2.tgz", + "integrity": "sha512-mkebUkGLEBA8A8jripu5h1e3cccGl8wWHCUmyJo43/KhaN91DO3qyCLWGWneogqkG4PWhp2JHtlCJ06YSdHVYQ==" + }, + "node_modules/react-app-alias-ex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-app-alias-ex/-/react-app-alias-ex-2.1.0.tgz", + "integrity": "sha512-MTr2yBSlU68ptmrukT8F6Fp6K6dp4Ui+uX/qV28oqGD+v+cLB+mOAnprvQOuG0zS6fW+X9Xk0QzaG6t30pQvHQ==", + "dependencies": { + "react-app-alias": "^2.0.0" + } + }, "node_modules/react-app-polyfill": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", @@ -19053,6 +19225,17 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -20742,6 +20925,61 @@ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -21230,6 +21468,11 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, "node_modules/v8-to-istanbul": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", @@ -21677,6 +21920,19 @@ "node": ">=10.13.0" } }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", @@ -21895,6 +22151,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==" + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -22455,6 +22716,14 @@ "node": ">=10" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 1822e6f2..a9f93de8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,6 +3,7 @@ "version": "2.6.0", "private": true, "dependencies": { + "@craco/craco": "^7.1.0", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/icons-material": "^5.15.15", @@ -16,10 +17,8 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "date-fns": "^2.25.0", - "disable-react-devtools": "file:../packages/disable-react-devtools", - "movinin-helper": "file:../packages/movinin-helper", - "movinin-types": "file:../packages/movinin-types", "react": "^18.2.0", + "react-app-alias-ex": "^2.1.0", "react-dom": "^18.2.0", "react-google-recaptcha": "^3.1.0", "react-localization": "^1.0.19", @@ -30,10 +29,10 @@ "validator": "^13.11.0" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject", + "start": "tsc -b && craco start", + "build": "tsc -b && craco build", + "test": "tsc -b && craco test", + "eject": "craco eject", "lint": "eslint --ext .ts,.tsx .", "fix": "eslint --fix .", "stylelint": "stylelint \"**/*.css\"", diff --git a/frontend/src/common/helper.ts b/frontend/src/common/helper.ts index db882f9a..93e6fc4d 100644 --- a/frontend/src/common/helper.ts +++ b/frontend/src/common/helper.ts @@ -1,6 +1,6 @@ import { toast } from 'react-toastify' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as rtStrings } from '../lang/rental-term' import { strings } from '../lang/properties' diff --git a/frontend/src/components/AgencyBadge.tsx b/frontend/src/components/AgencyBadge.tsx index ea463f48..3b277230 100644 --- a/frontend/src/components/AgencyBadge.tsx +++ b/frontend/src/components/AgencyBadge.tsx @@ -1,6 +1,6 @@ import React from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import '../assets/css/agency-badge.css' diff --git a/frontend/src/components/AgencyFilter.tsx b/frontend/src/components/AgencyFilter.tsx index 3c63a22b..2f1a1fe3 100644 --- a/frontend/src/components/AgencyFilter.tsx +++ b/frontend/src/components/AgencyFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import Accordion from './Accordion' diff --git a/frontend/src/components/AgencySelectList.tsx b/frontend/src/components/AgencySelectList.tsx index a025a2a6..0424f960 100644 --- a/frontend/src/components/AgencySelectList.tsx +++ b/frontend/src/components/AgencySelectList.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' import { TextFieldVariants } from '@mui/material' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as AgencyService from '../services/AgencyService' import * as helper from '../common/helper' diff --git a/frontend/src/components/Avatar.tsx b/frontend/src/components/Avatar.tsx index 0c0d3650..46fc2e49 100644 --- a/frontend/src/components/Avatar.tsx +++ b/frontend/src/components/Avatar.tsx @@ -13,8 +13,8 @@ import { PhotoCamera as PhotoCameraIcon, BrokenImageTwoTone as DeleteIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as helper from '../common/helper' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/components/BookingFilter.tsx b/frontend/src/components/BookingFilter.tsx index f93bce6a..a60157ed 100644 --- a/frontend/src/components/BookingFilter.tsx +++ b/frontend/src/components/BookingFilter.tsx @@ -9,8 +9,8 @@ import { Search as SearchIcon, Clear as ClearIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/booking-filter' import LocationSelectList from './LocationSelectList' diff --git a/frontend/src/components/BookingList.tsx b/frontend/src/components/BookingList.tsx index a22d359f..7c8e51f5 100644 --- a/frontend/src/components/BookingList.tsx +++ b/frontend/src/components/BookingList.tsx @@ -28,8 +28,8 @@ import { } from '@mui/icons-material' import { format } from 'date-fns' import { fr as dfnsFR, enUS as dfnsENUS } from 'date-fns/locale' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as BookingService from '../services/BookingService' import * as helper from '../common/helper' import { strings } from '../lang/booking-list' diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 266e0f6e..e71875b6 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -30,7 +30,7 @@ import { EventSeat as BookingsIcon, } from '@mui/icons-material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import env from '../config/env.config' import { strings } from '../lang/header' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/components/LocationSelectList.tsx b/frontend/src/components/LocationSelectList.tsx index 2ffe21c7..7ebbc5e2 100644 --- a/frontend/src/components/LocationSelectList.tsx +++ b/frontend/src/components/LocationSelectList.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' import { TextFieldVariants } from '@mui/material' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as LocationService from '../services/LocationService' import * as helper from '../common/helper' diff --git a/frontend/src/components/Master.tsx b/frontend/src/components/Master.tsx index 4697d18e..9c4b052b 100644 --- a/frontend/src/components/Master.tsx +++ b/frontend/src/components/Master.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, ReactNode } from 'react' import { Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings } from '../lang/master' import Header from '../components/Header' import * as UserService from '../services/UserService' diff --git a/frontend/src/components/MultipleSelect.tsx b/frontend/src/components/MultipleSelect.tsx index 1483d468..07277987 100644 --- a/frontend/src/components/MultipleSelect.tsx +++ b/frontend/src/components/MultipleSelect.tsx @@ -10,8 +10,8 @@ import { AutocompleteInputChangeReason } from '@mui/material' import { LocationOn as LocationIcon, AccountCircle } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import '../assets/css/multiple-select.css' diff --git a/frontend/src/components/NotificationList.tsx b/frontend/src/components/NotificationList.tsx index 4000d0a5..87e5f706 100644 --- a/frontend/src/components/NotificationList.tsx +++ b/frontend/src/components/NotificationList.tsx @@ -23,8 +23,8 @@ import { import { format } from 'date-fns' import { fr, enUS } from 'date-fns/locale' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/notifications' import * as NotificationService from '../services/NotificationService' diff --git a/frontend/src/components/PropertyFilter.tsx b/frontend/src/components/PropertyFilter.tsx index f2187a47..a362c612 100644 --- a/frontend/src/components/PropertyFilter.tsx +++ b/frontend/src/components/PropertyFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react' import { FormControl, Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import * as UserService from '../services/UserService' import LocationSelectList from './LocationSelectList' diff --git a/frontend/src/components/PropertyInfo.tsx b/frontend/src/components/PropertyInfo.tsx index e35cfc02..f32f198f 100644 --- a/frontend/src/components/PropertyInfo.tsx +++ b/frontend/src/components/PropertyInfo.tsx @@ -17,7 +17,7 @@ import { AttachMoney as RentalTermIcon, PhotoSizeSelectSmall as SizeIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as cpStrings } from '../lang/property' import { strings } from '../lang/properties' import * as helper from '../common/helper' diff --git a/frontend/src/components/PropertyList.tsx b/frontend/src/components/PropertyList.tsx index e712b057..d9466d3e 100644 --- a/frontend/src/components/PropertyList.tsx +++ b/frontend/src/components/PropertyList.tsx @@ -6,8 +6,8 @@ import { Typography, Button } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import Const from '../config/const' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/components/PropertySelectList.tsx b/frontend/src/components/PropertySelectList.tsx index d4a12963..568f9953 100644 --- a/frontend/src/components/PropertySelectList.tsx +++ b/frontend/src/components/PropertySelectList.tsx @@ -7,7 +7,7 @@ import { Button, TextFieldVariants } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings as bfStrings } from '../lang/booking-filter' diff --git a/frontend/src/components/PropertyTypeFilter.tsx b/frontend/src/components/PropertyTypeFilter.tsx index 5f796818..f4601744 100644 --- a/frontend/src/components/PropertyTypeFilter.tsx +++ b/frontend/src/components/PropertyTypeFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as cpStrings } from '../lang/property' import { strings } from '../lang/properties' diff --git a/frontend/src/components/RentalTermFilter.tsx b/frontend/src/components/RentalTermFilter.tsx index 018bd10d..852cc14f 100644 --- a/frontend/src/components/RentalTermFilter.tsx +++ b/frontend/src/components/RentalTermFilter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as propertyStrings } from '../lang/property' import { strings } from '../lang/rental-term' diff --git a/frontend/src/components/StatusFilter.tsx b/frontend/src/components/StatusFilter.tsx index e283fcee..b27057fc 100644 --- a/frontend/src/components/StatusFilter.tsx +++ b/frontend/src/components/StatusFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' import Accordion from '../components/Accordion' diff --git a/frontend/src/components/StatusList.tsx b/frontend/src/components/StatusList.tsx index 82f5d407..9395079a 100644 --- a/frontend/src/components/StatusList.tsx +++ b/frontend/src/components/StatusList.tsx @@ -6,7 +6,7 @@ import { SelectChangeEvent, TextFieldVariants } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import * as helper from '../common/helper' diff --git a/frontend/src/config/env.config.ts b/frontend/src/config/env.config.ts index 62a3f48f..a77ce1c7 100644 --- a/frontend/src/config/env.config.ts +++ b/frontend/src/config/env.config.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Const from './const' // diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 8f3473ba..f3d3d1f8 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -7,7 +7,7 @@ import CssBaseline from '@mui/material/CssBaseline' import { frFR as corefrFR, enUS as coreenUS } from '@mui/material/locale' import { frFR, enUS } from '@mui/x-date-pickers/locales' import { frFR as dataGridfrFR, enUS as dataGridenUS } from '@mui/x-data-grid/locales' -import { disableDevTools } from 'disable-react-devtools' +import { disableDevTools } from ':disable-react-devtools' import * as helper from './common/helper' import * as UserService from './services/UserService' import { strings as commonStrings } from './lang/common' diff --git a/frontend/src/pages/Activate.tsx b/frontend/src/pages/Activate.tsx index 884bd9ba..0e5b950f 100644 --- a/frontend/src/pages/Activate.tsx +++ b/frontend/src/pages/Activate.tsx @@ -9,7 +9,7 @@ import { Link } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/pages/Booking.tsx b/frontend/src/pages/Booking.tsx index f366d45f..60270c51 100644 --- a/frontend/src/pages/Booking.tsx +++ b/frontend/src/pages/Booking.tsx @@ -5,8 +5,8 @@ import { Switch, } from '@mui/material' import { Info as InfoIcon } from '@mui/icons-material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import { strings as commonStrings } from '../lang/common' import { strings as blStrings } from '../lang/booking-list' import { strings as bfStrings } from '../lang/booking-filter' diff --git a/frontend/src/pages/Bookings.tsx b/frontend/src/pages/Bookings.tsx index bd269e48..bdbbb4d5 100644 --- a/frontend/src/pages/Bookings.tsx +++ b/frontend/src/pages/Bookings.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import env from '../config/env.config' import * as helper from '../common/helper' diff --git a/frontend/src/pages/ChangePassword.tsx b/frontend/src/pages/ChangePassword.tsx index 629ec6bd..703a8804 100644 --- a/frontend/src/pages/ChangePassword.tsx +++ b/frontend/src/pages/ChangePassword.tsx @@ -7,7 +7,7 @@ import { FormHelperText, Button } from '@mui/material' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/change-password' diff --git a/frontend/src/pages/Checkout.tsx b/frontend/src/pages/Checkout.tsx index ea4ef07c..56c8952d 100644 --- a/frontend/src/pages/Checkout.tsx +++ b/frontend/src/pages/Checkout.tsx @@ -23,8 +23,8 @@ import { import validator from 'validator' import { format, intervalToDuration } from 'date-fns' import { fr, enUS } from 'date-fns/locale' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as BookingService from '../services/BookingService' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/pages/ForgotPassword.tsx b/frontend/src/pages/ForgotPassword.tsx index 15211fe3..fbfe9204 100644 --- a/frontend/src/pages/ForgotPassword.tsx +++ b/frontend/src/pages/ForgotPassword.tsx @@ -9,7 +9,7 @@ import { Link } from '@mui/material' import validator from 'validator' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index 98b66963..b434625e 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import { FormControl, Button } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/home' import * as UserService from '../services/UserService' diff --git a/frontend/src/pages/Notifications.tsx b/frontend/src/pages/Notifications.tsx index c9d8df57..37c6818a 100644 --- a/frontend/src/pages/Notifications.tsx +++ b/frontend/src/pages/Notifications.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import NotificationList from '../components/NotificationList' diff --git a/frontend/src/pages/Property.tsx b/frontend/src/pages/Property.tsx index 690791f3..95bd5191 100644 --- a/frontend/src/pages/Property.tsx +++ b/frontend/src/pages/Property.tsx @@ -4,8 +4,8 @@ import { Button, FormControl, } from '@mui/material' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Backdrop from '../components/SimpleBackdrop' import Master from '../components/Master' import env from '../config/env.config' diff --git a/frontend/src/pages/ResetPassword.tsx b/frontend/src/pages/ResetPassword.tsx index 5a9d5e39..876f035b 100644 --- a/frontend/src/pages/ResetPassword.tsx +++ b/frontend/src/pages/ResetPassword.tsx @@ -8,7 +8,7 @@ import { Paper } from '@mui/material' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import * as UserService from '../services/UserService' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/pages/Search.tsx b/frontend/src/pages/Search.tsx index 23963ac9..56f7bc2e 100644 --- a/frontend/src/pages/Search.tsx +++ b/frontend/src/pages/Search.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { useLocation } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import * as helper from '../common/helper' import * as LocationService from '../services/LocationService' diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index f4c8a730..9c31c06d 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -11,8 +11,8 @@ import { } from '@mui/material' import validator from 'validator' import { intervalToDuration } from 'date-fns' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import Master from '../components/Master' import { strings as commonStrings } from '../lang/common' diff --git a/frontend/src/pages/SignUp.tsx b/frontend/src/pages/SignUp.tsx index 8fcb0baf..60e55279 100644 --- a/frontend/src/pages/SignUp.tsx +++ b/frontend/src/pages/SignUp.tsx @@ -13,8 +13,8 @@ import { import validator from 'validator' import { intervalToDuration } from 'date-fns' import { useNavigate } from 'react-router-dom' -import * as movininTypes from 'movinin-types' -import * as movininHelper from 'movinin-helper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import env from '../config/env.config' import { strings as commonStrings } from '../lang/common' import { strings } from '../lang/sign-up' diff --git a/frontend/src/services/AgencyService.ts b/frontend/src/services/AgencyService.ts index 09c3149d..9d132ad3 100644 --- a/frontend/src/services/AgencyService.ts +++ b/frontend/src/services/AgencyService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' /** diff --git a/frontend/src/services/BookingService.ts b/frontend/src/services/BookingService.ts index a3c00ff7..7ddae5d1 100644 --- a/frontend/src/services/BookingService.ts +++ b/frontend/src/services/BookingService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/frontend/src/services/LocationService.ts b/frontend/src/services/LocationService.ts index a6cf8361..6f182169 100644 --- a/frontend/src/services/LocationService.ts +++ b/frontend/src/services/LocationService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/frontend/src/services/NotificationService.ts b/frontend/src/services/NotificationService.ts index d505f677..f2a6563e 100644 --- a/frontend/src/services/NotificationService.ts +++ b/frontend/src/services/NotificationService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import env from '../config/env.config' diff --git a/frontend/src/services/PropertyService.ts b/frontend/src/services/PropertyService.ts index 81d8d393..9ad04c9d 100644 --- a/frontend/src/services/PropertyService.ts +++ b/frontend/src/services/PropertyService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import * as UserService from './UserService' diff --git a/frontend/src/services/UserService.ts b/frontend/src/services/UserService.ts index 23afee4d..818a4010 100644 --- a/frontend/src/services/UserService.ts +++ b/frontend/src/services/UserService.ts @@ -1,4 +1,4 @@ -import * as movininTypes from 'movinin-types' +import * as movininTypes from ':movinin-types' import axiosInstance from './axiosInstance' import env from '../config/env.config' diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 37f4fff3..f0c2a669 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -18,9 +18,21 @@ "resolveJsonModule": true, "isolatedModules": false, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "rootDir": "./", + "baseUrl": "./", + "paths": { + ":movinin-types": ["../packages/movinin-types"], + ":movinin-helper": ["../packages/movinin-helper"], + ":disable-react-devtools": ["../packages/disable-react-devtools"] + } }, "include": [ "src" + ], + "references": [ + { "path": "../packages/movinin-types" }, + { "path": "../packages/movinin-helper" }, + { "path": "../packages/disable-react-devtools" } ] } diff --git a/mobile/app.json b/mobile/app.json index a6e3711e..02d3ad21 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -43,6 +43,9 @@ }, "updates": { "url": "https://exp.host/@aelassas/movinin" - } + }, + "experiments": { + "tsconfigPaths": true + } } } diff --git a/mobile/babel.config.js b/mobile/babel.config.js index a2e77a38..f0f26538 100644 --- a/mobile/babel.config.js +++ b/mobile/babel.config.js @@ -14,6 +14,16 @@ module.exports = function (api) { allowUndefined: false, }, ], + [ + "module-resolver", + { + "root": ['./'], + "alias": { + ":movinin-types": "../packages/movinin-types", + ":movinin-helper": "../packages/movinin-helper" + } + } + ], 'react-native-reanimated/plugin', ], } diff --git a/mobile/common/helper.ts b/mobile/common/helper.ts index f12837b3..64c5009b 100644 --- a/mobile/common/helper.ts +++ b/mobile/common/helper.ts @@ -8,8 +8,8 @@ import { RouteProp } from '@react-navigation/native' import mime from 'mime' import i18n from '../lang/i18n' import * as UserService from '../services/UserService' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as toastHelper from './toastHelper' /** diff --git a/mobile/components/AgencyFilter.tsx b/mobile/components/AgencyFilter.tsx index ea3e2cf0..f4f63c7c 100644 --- a/mobile/components/AgencyFilter.tsx +++ b/mobile/components/AgencyFilter.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { Image, StyleSheet, View } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as helper from '../common/helper' import * as env from '../config/env.config' diff --git a/mobile/components/Booking.tsx b/mobile/components/Booking.tsx index 24c474ca..bcc8cee4 100644 --- a/mobile/components/Booking.tsx +++ b/mobile/components/Booking.tsx @@ -7,8 +7,8 @@ import { } from 'react-native' import { MaterialIcons } from '@expo/vector-icons' import { Locale, format } from 'date-fns' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import BookingStatus from './BookingStatus' import Button from './Button' diff --git a/mobile/components/BookingFilter.tsx b/mobile/components/BookingFilter.tsx index aaae7349..54a14a6c 100644 --- a/mobile/components/BookingFilter.tsx +++ b/mobile/components/BookingFilter.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react' import { StyleSheet, View, TextInput as ReactTextInput } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import Accordion from './Accordion' diff --git a/mobile/components/BookingList.tsx b/mobile/components/BookingList.tsx index 09a0e6dc..f86b90de 100644 --- a/mobile/components/BookingList.tsx +++ b/mobile/components/BookingList.tsx @@ -13,7 +13,7 @@ import { Button as NativeButton } from 'react-native-paper' import { enUS, fr } from 'date-fns/locale' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import * as env from '../config/env.config' import i18n from '../lang/i18n' import * as helper from '../common/helper' diff --git a/mobile/components/BookingStatus.tsx b/mobile/components/BookingStatus.tsx index 02a346fe..b20f4f61 100644 --- a/mobile/components/BookingStatus.tsx +++ b/mobile/components/BookingStatus.tsx @@ -1,6 +1,6 @@ import React from 'react' import { StyleSheet, Text, View } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import * as helper from '../common/helper' diff --git a/mobile/components/DateTimePicker.tsx b/mobile/components/DateTimePicker.tsx index e80fe861..a3d7f357 100644 --- a/mobile/components/DateTimePicker.tsx +++ b/mobile/components/DateTimePicker.tsx @@ -9,7 +9,7 @@ import ReactDateTimePicker from '@react-native-community/datetimepicker' import { format } from 'date-fns' import { enUS, fr } from 'date-fns/locale' import { MaterialIcons } from '@expo/vector-icons' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininHelper from ':movinin-helper' import * as helper from '../common/helper' interface DateTimePickerProps { diff --git a/mobile/components/DrawerContent.tsx b/mobile/components/DrawerContent.tsx index 814d847d..037ad270 100644 --- a/mobile/components/DrawerContent.tsx +++ b/mobile/components/DrawerContent.tsx @@ -23,7 +23,7 @@ import i18n from '../lang/i18n' import * as env from '../config/env.config' import * as helper from '../common/helper' import * as UserService from '../services/UserService' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' interface DrawerContentProps { language: string diff --git a/mobile/components/Header.tsx b/mobile/components/Header.tsx index de16678d..755e4fab 100644 --- a/mobile/components/Header.tsx +++ b/mobile/components/Header.tsx @@ -4,7 +4,7 @@ import { MaterialIcons } from '@expo/vector-icons' import { useNavigation, DrawerActions } from '@react-navigation/native' import { Avatar, Badge } from 'react-native-paper' import type { NativeStackNavigationProp } from '@react-navigation/native-stack' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininHelper from ':movinin-helper' import * as UserService from '../services/UserService' import * as env from '../config/env.config' diff --git a/mobile/components/Master.tsx b/mobile/components/Master.tsx index 6f68d0f0..4c4d4a4e 100644 --- a/mobile/components/Master.tsx +++ b/mobile/components/Master.tsx @@ -8,7 +8,7 @@ import Button from '../components/Button' import i18n from '../lang/i18n' import * as helper from '../common/helper' import Header from '../components/Header' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' interface MasterProps { navigation: NativeStackNavigationProp diff --git a/mobile/components/NotificationList.tsx b/mobile/components/NotificationList.tsx index 9a5cf513..82bd87bc 100644 --- a/mobile/components/NotificationList.tsx +++ b/mobile/components/NotificationList.tsx @@ -4,8 +4,8 @@ import { MaterialIcons } from '@expo/vector-icons' import { Dialog, Portal, Button as NativeButton, Paragraph } from 'react-native-paper' import { Locale, format } from 'date-fns' import { NativeStackNavigationProp } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import i18n from '../lang/i18n' import * as UserService from '../services/UserService' diff --git a/mobile/components/Property.tsx b/mobile/components/Property.tsx index f016582b..f2aa2c0f 100644 --- a/mobile/components/Property.tsx +++ b/mobile/components/Property.tsx @@ -9,8 +9,8 @@ import { useWindowDimensions } from 'react-native' import HTML from 'react-native-render-html' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Button from './Button' import * as helper from '../common/helper' import * as env from '../config/env.config' diff --git a/mobile/components/PropertyList.tsx b/mobile/components/PropertyList.tsx index 2f3b87d5..ab3f54f5 100644 --- a/mobile/components/PropertyList.tsx +++ b/mobile/components/PropertyList.tsx @@ -7,7 +7,7 @@ import { ActivityIndicator } from 'react-native' import type { NativeStackNavigationProp } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import * as helper from '../common/helper' import * as env from '../config/env.config' diff --git a/mobile/components/PropertyTypeFilter.tsx b/mobile/components/PropertyTypeFilter.tsx index 31ca1bec..8eae5ea6 100644 --- a/mobile/components/PropertyTypeFilter.tsx +++ b/mobile/components/PropertyTypeFilter.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { StyleSheet, View } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import i18n from '../lang/i18n' import Accordion from './Accordion' diff --git a/mobile/components/RentalTermFilter.tsx b/mobile/components/RentalTermFilter.tsx index 66251589..f18b2400 100644 --- a/mobile/components/RentalTermFilter.tsx +++ b/mobile/components/RentalTermFilter.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { StyleSheet, View } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import i18n from '../lang/i18n' import Accordion from './Accordion' diff --git a/mobile/components/StatusFilter.tsx b/mobile/components/StatusFilter.tsx index efec4a60..976ecca8 100644 --- a/mobile/components/StatusFilter.tsx +++ b/mobile/components/StatusFilter.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { StyleSheet, View } from 'react-native' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import * as helper from '../common/helper' import i18n from '../lang/i18n' diff --git a/mobile/metro.config.js b/mobile/metro.config.js index 8f1fb7d4..abf74f47 100644 --- a/mobile/metro.config.js +++ b/mobile/metro.config.js @@ -1,7 +1,9 @@ // Learn more https://docs.expo.io/guides/cust omizing-metro const { getDefaultConfig } = require('expo/metro-config') +const path = require('path') const config = getDefaultConfig(__dirname) config.resolver.sourceExts.push('mjs') +config.watchFolders = [path.resolve(__dirname, '../packages')] module.exports = config diff --git a/mobile/miscellaneous/movininHelper.ts b/mobile/miscellaneous/movininHelper.ts deleted file mode 100644 index 922d6e1c..00000000 --- a/mobile/miscellaneous/movininHelper.ts +++ /dev/null @@ -1,140 +0,0 @@ -// Metro does not support symlinks - -import * as movininTypes from './movininTypes' - -export const formatNumber = (x?: number): string => { - if (typeof x === 'number') { - const parts: string[] = String(x % 1 !== 0 ? x.toFixed(2) : x).split('.') - parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ') - return parts.join('.') - } - return '' -} - -export const formatDatePart = (n: number): string => (n > 9 ? String(n) : `0${n}`) - -export const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1) - -export const isDate = (date?: Date): boolean => date instanceof Date && !Number.isNaN(date.valueOf()) - -export const joinURL = (part1?: string, part2?: string) => { - if (!part1 || !part2) { - const msg = '[joinURL] part undefined' - console.log(msg) - throw new Error(msg) - } - - if (part1.charAt(part1.length - 1) === '/') { - part1 = part1.substring(0, part1.length - 1) - } - if (part2.charAt(0) === '/') { - part2 = part2.substring(1) - } - return `${part1}/${part2}` -} - -export const isInteger = (val: string) => /^\d+$/.test(val) - -export const isYear = (val: string) => /^\d{2}$/.test(val) - -export const isCvv = (val: string) => /^\d{3,4}$/.test(val) - -export const arrayEqual = (a: any, b: any) => { - if (a === b) { - return true - } - if (a == null || b == null) { - return false - } - if (a.length !== b.length) { - return false - } - - // If you don't care about the order of the elements inside - // the array, you should sort both arrays here. - // Please note that calling sort on an array will modify that array. - // you might want to clone your array first. - - for (let i = 0; i < a.length; i += 1) { - if (a[i] !== b[i]) { - return false - } - } - return true -} - -export const clone = (obj: any) => (Array.isArray(obj) ? Array.from(obj) : ({ ...obj })) - -export const cloneArray = (arr: T[]): T[] | undefined | null => { - if (typeof arr === 'undefined') { - return undefined - } - if (arr == null) { - return null - } - return [...arr] -} - -export const filterEqual = (a?: movininTypes.Filter | null, b?: movininTypes.Filter | null) => { - if (a === b) { - return true - } - if (a == null || b == null) { - return false - } - - if (a.from !== b.from) { - return false - } - if (a.to !== b.to) { - return false - } - if (a.keyword !== b.keyword) { - return false - } - - return true -} - -export const flattenAgencies = (agencies: movininTypes.User[]): string[] => - agencies.map((agency) => agency._id ?? '') - -export const days = (from?: Date, to?: Date) => - (from && to && Math.ceil((to.getTime() - from.getTime()) / (1000 * 3600 * 24))) || 0 - -export const fr = (user?: movininTypes.User) => - (user && user.language === 'fr') || false - -export const extraToNumber = (extra: string) => (extra === '' ? -1 : Number(extra)) - -export const extraToString = (extra: number) => (extra === -1 ? '' : String(extra)) - -export const trimCarriageReturn = (str: string) => str.replace(/[\n\r]+/g, '') - -export const totalDays = (date1: Date, date2: Date) => - Math.ceil((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)) - -export const daysInMonth = (month: number, year: number) => - new Date(year, month, 0).getDate() - -export const daysInYear = (year: number) => - (((year % 4 === 0 && year % 100 > 0) || year % 400 === 0) ? 366 : 365) - -export const getAllPropertyTypes = () => - [ - movininTypes.PropertyType.Apartment, - movininTypes.PropertyType.Commercial, - movininTypes.PropertyType.Farm, - movininTypes.PropertyType.House, - movininTypes.PropertyType.Industrial, - movininTypes.PropertyType.Plot, - movininTypes.PropertyType.Townhouse - ] - -export const getAllRentalTerms = () => - [ - movininTypes.RentalTerm.Monthly, - movininTypes.RentalTerm.Weekly, - movininTypes.RentalTerm.Daily, - movininTypes.RentalTerm.Yearly, - ] diff --git a/mobile/miscellaneous/movininTypes.ts b/mobile/miscellaneous/movininTypes.ts deleted file mode 100644 index 8805f252..00000000 --- a/mobile/miscellaneous/movininTypes.ts +++ /dev/null @@ -1,387 +0,0 @@ -/* eslint-disable no-shadow */ - -// -// Metro does not support symlinks -// - -export enum UserType { - Admin = 'ADMIN', - Agency = 'AGENCY', - User = 'USER', -} - -export enum AppType { - Backend = 'BACKEND', - Frontend = 'FRONTEND', -} - -export enum PropertyType { - Apartment = 'APARTMENT', - Commercial = 'COMMERCIAL', - Farm = 'FARM', - House = 'HOUSE', - Industrial = 'INDUSTRIAL', - Plot = 'PLOT', - Townhouse = 'TOWNHOUSE', -} - -export enum BookingStatus { - Void = 'VOID', - Pending = 'PENDING', - Deposit = 'DEPOSIT', - Paid = 'PAID', - Reserved = 'RESERVED', - Cancelled = 'CANCELLED' -} - -export enum RecordType { - Admin = 'ADMIN', - Agency = 'AGENCY', - User = 'USER', - Property = 'PROPERTY', - Location = 'LOCATION' -} - -export enum Availablity { - Available = 'AVAILABLE', - Unavailable = 'UNAVAILABLE' -} - -export enum RentalTerm { - Monthly = 'MONTHLY', - Weekly = 'WEEKLY', - Daily = 'DAILY', - Yearly = 'YEARLY' -} - -export interface BackendSignUpPayload { - email: string - password: string - fullName: string - language: string - active?: boolean - verified?: boolean - blacklisted?: boolean - type?: string - avatar?: string -} - -export interface FrontendSignUpPayload extends BackendSignUpPayload { - birthDate: number | Date - phone: string -} - -export interface CreateUserPayload { - email?: string - phone: string - location: string - bio: string - fullName: string - type?: string - avatar?: string - birthDate?: number | Date - language?: string - agency?: string - password?: string - verified?: boolean - blacklisted?: boolean - payLater?: boolean -} - -export interface UpdateUserPayload extends CreateUserPayload { - _id: string - enableEmailNotifications?: boolean - payLater?: boolean -} - -export interface changePasswordPayload { - _id: string - password: string - newPassword: string - strict: boolean -} - -export interface UpdateAgencyPayload { - _id: string - fullName: string - phone: string - location: string - bio: string - payLater: boolean -} - -export interface UpdateStatusPayload { - ids: string[], - status: string -} - -export interface Renter { - _id?: string - email: string - phone: string - fullName: string - birthDate: string - language: string - verified: boolean - blacklisted: boolean -} - -export interface Booking { - _id?: string - agency: string | User - property: string | Property - renter?: string | User - from: Date - to: Date - status: BookingStatus - cancellation: boolean - price?: number - location: string | Location - cancelRequest?: boolean -} - -export interface CheckoutPayload { - renter?: User - booking: Booking - payLater?: boolean -} - -export interface Filter { - from?: Date - to?: Date - location?: string - keyword?: string -} - -export interface GetBookingsPayload { - agencies: string[] - statuses: string[] - user?: string - property?: string - filter?: Filter - language: string -} - -export interface LocationName { - language: string - name: string -} - -export interface ActivatePayload { - userId: string - token: string - password: string -} - -export interface ValidateEmailPayload { - email: string -} - -export interface SignInPayload { - email: string - password?: string - stayConnected?: boolean - mobile?: boolean -} - -export interface ResendLinkPayload { - email?: string -} - -export interface UpdateLanguage { - id: string - language: string -} - -export interface ValidateAgencyPayload { - fullName: string -} - -export interface ValidateLocationPayload { - language: string - name: string -} - -export interface GetBookingPropertiesPayload { - agency: string - location: string -} - -export interface User { - _id?: string - agency?: User | string - fullName: string - email?: string - phone?: string - password?: string - birthDate?: Date - verified?: boolean - verifiedAt?: Date - active?: boolean - language?: string - enableEmailNotifications?: boolean - avatar?: string - bio?: string - location?: string - type?: string - blacklisted?: boolean - payLater?: boolean - accessToken?: string - checked?: boolean -} - -export interface Option { - _id: string - name?: string - image?: string -} - -export interface LocationValue { - language: string - value?: string - name?: string -} - -export interface Location { - _id: string - name?: string - values?: LocationValue[] -} - -export interface Property { - _id: string - name: string - type: PropertyType - agency: User - description: string - available: boolean - image: string - images?: string[] - bedrooms: number - bathrooms: number - kitchens: number - parkingSpaces: number, - size?: number - petsAllowed: boolean - furnished: boolean - aircon: boolean - minimumAge: number - location: Location - address?: string - price: number - hidden: boolean - cancellation: number - rentalTerm: RentalTerm - [propKey: string]: any -} - -export interface CreatePropertyPayload { - name: string - agency: string - type: string - description: string - image: string - images?: string[] - available: boolean - bedrooms: number - bathrooms: number - kitchens: number - parkingSpaces: number - size?: number - petsAllowed: boolean - furnished: boolean - aircon: boolean - minimumAge: number - location?: string - address: string - price: number - hidden: boolean - cancellation: number - rentalTerm: string -} - -export interface UpdatePropertyPayload extends CreatePropertyPayload { - _id: string -} - -export interface Notification { - _id: string - user: string - message: string - booking?: string - isRead?: boolean - checked?: boolean - createdAt?: Date -} - -export interface NotificationCounter { - _id: string - user: string - count: number -} - -export interface ResultData { - pageInfo: { totalRecords: number } - resultData: T[] -} - -export type Result = [ResultData] | [] | undefined | null - -export interface Data { - rows: T[] - rowCount: number -} - -export interface ChangePasswordPayload { - _id: string - password: string - newPassword: string - strict: boolean -} - -export interface UpdateEmailNotificationsPayload { - _id: string - enableEmailNotifications: boolean -} - -export interface GetPropertiesPayload { - agencies: string[] - types?: PropertyType[] - rentalTerms?: RentalTerm[] - availability?: Availablity[] - location?: string - language?: string -} - -export interface UpdateLanguagePayload { - id: string - language: string -} - -export interface GetUsersBody { - user: string - types: UserType[] -} - -export interface PropertyOptions { - cancellation?: boolean -} - -// -// React types -// -export type DataEvent = (data?: Data) => void - -export interface StatusFilterItem { - label: string - value: BookingStatus - checked?: boolean -} - -export interface PropertyFilter { - location: Location - from: Date - to: Date -} - -export type PropertyFilterSubmitEvent = (filter: PropertyFilter) => void diff --git a/mobile/package-lock.json b/mobile/package-lock.json index ec2170c0..c38e85e7 100644 --- a/mobile/package-lock.json +++ b/mobile/package-lock.json @@ -21,6 +21,7 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "axios-retry": "^4.1.0", + "babel-plugin-module-resolver": "^5.0.0", "date-fns": "^3.6.0", "expo": "~50.0.15", "expo-asset": "~9.0.2", @@ -7477,6 +7478,74 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-module-resolver": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-5.0.0.tgz", + "integrity": "sha512-g0u+/ChLSJ5+PzYwLwP8Rp8Rcfowz58TJNCe+L/ui4rpzE/mg//JVX0EWBUYoxaextqnwuGHzfGp2hh0PPV25Q==", + "dependencies": { + "find-babel-config": "^2.0.0", + "glob": "^8.0.3", + "pkg-up": "^3.1.0", + "reselect": "^4.1.7", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/babel-plugin-module-resolver/node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", @@ -10710,6 +10779,18 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/find-babel-config": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-2.0.0.tgz", + "integrity": "sha512-dOKT7jvF3hGzlW60Gc3ONox/0rRZ/tz7WCil0bqA1In/3I8f1BctpXahRnEKDySZqci7u+dqq93sZST9fOJpFw==", + "dependencies": { + "json5": "^2.1.1", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/find-cache-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", @@ -16647,6 +16728,73 @@ "node": ">=4" } }, + "node_modules/pkg-up": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-up/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-up/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/plist": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", @@ -17846,6 +17994,11 @@ "path-parse": "^1.0.5" } }, + "node_modules/reselect": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz", + "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==" + }, "node_modules/resolve": { "version": "2.0.0-next.5", "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", diff --git a/mobile/package.json b/mobile/package.json index 0e1567aa..204e73f7 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -3,17 +3,17 @@ "version": "2.6.0", "main": "node_modules/expo/AppEntry.js", "scripts": { - "start": "expo start --port 8081", - "start:clean": "expo start -c --port 8081", - "android": "expo start --android", - "ios": "expo start --ios", - "build:android": "cross-env EAS_NO_VCS=1 eas build --profile production --platform android", - "build:android:local": "cross-env EAS_NO_VCS=1 eas build --profile production --platform android --local", - "build:android:preview": "cross-env EAS_NO_VCS=1 eas build --profile preview --platform android", - "build:ios": "cross-env EAS_NO_VCS=1 eas build --profile production --platform ios", - "build:ios:local": "cross-env EAS_NO_VCS=1 eas build --profile production --platform ios --local", - "build:ios:preview": "cross-env EAS_NO_VCS=1 eas build --profile preview --platform android", - "ts:check": "tsc", + "start": "tsc -b && expo start --port 8081", + "start:clean": "tsc -b && expo start -c --port 8081", + "android": "tsc -b && expo start --android", + "ios": "tsc -b && expo start --ios", + "build:android": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile production --platform android", + "build:android:local": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile production --platform android --local", + "build:android:preview": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile preview --platform android", + "build:ios": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile production --platform ios", + "build:ios:local": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile production --platform ios --local", + "build:ios:preview": "cross-env EAS_NO_VCS=1 tsc -b && eas build --profile preview --platform android", + "ts:check": "tsc -b", "lint": "eslint --ext .ts,.tsx .", "fix": "eslint --fix .", "ncu": "ncu -u -x eslint && npm i && expo install --fix && npm prune" @@ -32,6 +32,7 @@ "@types/validator": "^13.11.9", "axios": "^1.6.8", "axios-retry": "^4.1.0", + "babel-plugin-module-resolver": "^5.0.0", "date-fns": "^3.6.0", "expo": "~50.0.15", "expo-asset": "~9.0.2", diff --git a/mobile/screens/BookingScreen.tsx b/mobile/screens/BookingScreen.tsx index 1cbf685b..df50c02c 100644 --- a/mobile/screens/BookingScreen.tsx +++ b/mobile/screens/BookingScreen.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' import { StyleSheet } from 'react-native' import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import * as UserService from '../services/UserService' diff --git a/mobile/screens/BookingsScreen.tsx b/mobile/screens/BookingsScreen.tsx index 7e647459..c764ff85 100644 --- a/mobile/screens/BookingsScreen.tsx +++ b/mobile/screens/BookingsScreen.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' import { StyleSheet, View } from 'react-native' import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import i18n from '../lang/i18n' diff --git a/mobile/screens/ChangePasswordScreen.tsx b/mobile/screens/ChangePasswordScreen.tsx index 9c7ca7d7..eea24935 100644 --- a/mobile/screens/ChangePasswordScreen.tsx +++ b/mobile/screens/ChangePasswordScreen.tsx @@ -7,7 +7,7 @@ import { } from 'react-native' import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import Master from '../components/Master' import i18n from '../lang/i18n' diff --git a/mobile/screens/Checkout.tsx b/mobile/screens/Checkout.tsx index 1d500a74..41af9fcd 100644 --- a/mobile/screens/Checkout.tsx +++ b/mobile/screens/Checkout.tsx @@ -13,8 +13,8 @@ import { MaterialIcons } from '@expo/vector-icons' import validator from 'validator' import { format, intervalToDuration } from 'date-fns' import { enUS, fr } from 'date-fns/locale' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import i18n from '../lang/i18n' diff --git a/mobile/screens/NotificationsScreen.tsx b/mobile/screens/NotificationsScreen.tsx index 95bbbe27..5a269aeb 100644 --- a/mobile/screens/NotificationsScreen.tsx +++ b/mobile/screens/NotificationsScreen.tsx @@ -3,7 +3,7 @@ import { StyleSheet } from 'react-native' import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' import { enUS, fr } from 'date-fns/locale' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import * as UserService from '../services/UserService' diff --git a/mobile/screens/PropertiesScreen.tsx b/mobile/screens/PropertiesScreen.tsx index d4052abc..c6c19c65 100644 --- a/mobile/screens/PropertiesScreen.tsx +++ b/mobile/screens/PropertiesScreen.tsx @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react' import { StyleSheet, View } from 'react-native' import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import i18n from '../lang/i18n' diff --git a/mobile/screens/SettingsScreen.tsx b/mobile/screens/SettingsScreen.tsx index c441bb41..19de7edb 100644 --- a/mobile/screens/SettingsScreen.tsx +++ b/mobile/screens/SettingsScreen.tsx @@ -18,8 +18,8 @@ import { import * as ImagePicker from 'expo-image-picker' import validator from 'validator' import { intervalToDuration } from 'date-fns' -import * as movininTypes from '../miscellaneous/movininTypes' -import * as movininHelper from '../miscellaneous/movininHelper' +import * as movininTypes from ':movinin-types' +import * as movininHelper from ':movinin-helper' import Master from '../components/Master' import i18n from '../lang/i18n' diff --git a/mobile/screens/SignInScreen.tsx b/mobile/screens/SignInScreen.tsx index e11a0b8f..787f4cfc 100644 --- a/mobile/screens/SignInScreen.tsx +++ b/mobile/screens/SignInScreen.tsx @@ -8,7 +8,7 @@ import { import { useIsFocused } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' import validator from 'validator' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import TextInput from '../components/TextInput' import Button from '../components/Button' diff --git a/mobile/screens/SignUpScreen.tsx b/mobile/screens/SignUpScreen.tsx index 16acbf99..d1bf3471 100644 --- a/mobile/screens/SignUpScreen.tsx +++ b/mobile/screens/SignUpScreen.tsx @@ -8,7 +8,7 @@ import { useIsFocused } from '@react-navigation/native' import { intervalToDuration } from 'date-fns' import { NativeStackScreenProps } from '@react-navigation/native-stack' import validator from 'validator' -import * as movininTypes from '../miscellaneous/movininTypes' +import * as movininTypes from ':movinin-types' import i18n from '../lang/i18n' import TextInput from '../components/TextInput' @@ -293,7 +293,7 @@ const SignUpScreen = ({ navigation, route }: NativeStackScreenProps { /** * Sign up. * - * @param {movininTypes.FrontendSignUpPayload} data + * @param {movininTypes.SignUpPayload} data * @returns {Promise} */ -export const signup = (data: movininTypes.FrontendSignUpPayload): Promise => +export const signup = (data: movininTypes.SignUpPayload): Promise => axiosInstance .post( '/api/sign-up', diff --git a/mobile/tsconfig.json b/mobile/tsconfig.json index 724e1092..bb339fae 100644 --- a/mobile/tsconfig.json +++ b/mobile/tsconfig.json @@ -4,6 +4,16 @@ "strict": true, "typeRoots": [ "./types" - ] - } + ], + "rootDir": "./", + "baseUrl": "./", + "paths": { + ":movinin-types": ["../packages/movinin-types"], + ":movinin-helper": ["../packages/movinin-helper"] + } + }, + "references": [ + { "path": "../packages/movinin-types" }, + { "path": "../packages/movinin-helper" } + ] } diff --git a/packages/disable-react-devtools/index.d.ts b/packages/disable-react-devtools/index.d.ts deleted file mode 100644 index da77c128..00000000 --- a/packages/disable-react-devtools/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare global { - interface Window { - __REACT_DEVTOOLS_GLOBAL_HOOK__?: Record | (() => any)>; - } -} -/** - * Disable React Developer Tools. - * - * @export - */ -export declare const disableDevTools: () => void; diff --git a/packages/disable-react-devtools/index.js b/packages/disable-react-devtools/index.js deleted file mode 100644 index 780c2f07..00000000 --- a/packages/disable-react-devtools/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Disable React Developer Tools. - * - * @export - */ -export const disableDevTools = () => { - if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) - return; - Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__).forEach((k) => { - let replacement; - if (k === 'renderers') - replacement = new Map(); - window.__REACT_DEVTOOLS_GLOBAL_HOOK__[k] = - replacement || (() => undefined); - }); -}; diff --git a/packages/disable-react-devtools/tsconfig.json b/packages/disable-react-devtools/tsconfig.json index 154411cb..8eddd7db 100644 --- a/packages/disable-react-devtools/tsconfig.json +++ b/packages/disable-react-devtools/tsconfig.json @@ -4,7 +4,7 @@ /* Projects */ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ diff --git a/packages/movinin-helper/index.d.ts b/packages/movinin-helper/index.d.ts deleted file mode 100644 index addccac8..00000000 --- a/packages/movinin-helper/index.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -import * as movininTypes from 'movinin-types'; -/** - * Format a number. - * - * @export - * @param {?number} [x] - * @returns {string} - */ -export declare const formatNumber: (x?: number) => string; -/** - * Format a Date number to two digits. - * - * @export - * @param {number} n - * @returns {string} - */ -export declare const formatDatePart: (n: number) => string; -/** - * Capitalize a string. - * - * @export - * @param {string} str - * @returns {string} - */ -export declare const capitalize: (str: string) => string; -/** - * Check if a value is a Date. - * - * @export - * @param {?*} [value] - * @returns {boolean} - */ -export declare const isDate: (value?: any) => boolean; -/** - * Join two url parts. - * - * @param {?string} [part1] - * @param {?string} [part2] - * @returns {string} - */ -export declare const joinURL: (part1?: string, part2?: string) => string; -/** - * Check if a string is an integer. - * - * @param {string} val - * @returns {boolean} - */ -export declare const isInteger: (val: string) => boolean; -/** - * Check if a string is a year. - * - * @param {string} val - * @returns {boolean} - */ -export declare const isYear: (val: string) => boolean; -/** - * Check if a string is a CVV. - * - * @param {string} val - * @returns {boolean} - */ -export declare const isCvv: (val: string) => boolean; -/** - * Check if two arrays are equal. - * - * @param {*} a - * @param {*} b - * @returns {boolean} - */ -export declare const arrayEqual: (a: any, b: any) => boolean; -/** - * Clone an object or array. - * - * @param {*} obj - * @returns {*} - */ -export declare const clone: (obj: any) => any; -/** - * Clone an array. - * - * @export - * @template T - * @param {T[]} arr - * @returns {(T[] | undefined | null)} - */ -export declare const cloneArray: (arr: T[]) => T[] | null | undefined; -/** - * Check if two filters are equal. - * - * @param {?(movininTypes.Filter | null)} [a] - * @param {?(movininTypes.Filter | null)} [b] - * @returns {boolean} - */ -export declare const filterEqual: (a?: movininTypes.Filter | null, b?: movininTypes.Filter | null) => boolean; -/** - * Flatten Agency array. - * - * @param {movininTypes.User[]} companies - * @returns {string[]} - */ -export declare const flattenAgencies: (companies: movininTypes.User[]) => string[]; -/** - * Get number of days between two dates. - * - * @param {?Date} [from] - * @param {?Date} [to] - * @returns {number} - */ -export declare const days: (from?: Date, to?: Date) => number; -/** - * Check if User's language is French. - * - * @param {?movininTypes.User} [user] - * @returns {boolean} - */ -export declare const fr: (user?: movininTypes.User) => boolean; -/** - * Convert Extra string to number. - * - * @param {string} extra - * @returns {number} - */ -export declare const extraToNumber: (extra: string) => number; -/** - * Convert Extra number to string. - * - * @param {number} extra - * @returns {string} - */ -export declare const extraToString: (extra: number) => string; -/** - * Trim carriage return. - * - * @param {string} str - * @returns {string} - */ -export declare const trimCarriageReturn: (str: string) => string; -/** - * Get total days between two dates. - * - * @param {Date} date1 - * @param {Date} date2 - * @returns {number} - */ -export declare const totalDays: (date1: Date, date2: Date) => number; -/** - * Get number of days in a month. - * - * @param {number} month - * @param {number} year - * @returns {number} - */ -export declare const daysInMonth: (month: number, year: number) => number; -/** - * Get number of days in a year. - * - * @param {number} year - * @returns {(366 | 365)} - */ -export declare const daysInYear: (year: number) => 366 | 365; -/** - * Get all PropertyTypes. - * - * @returns {movininTypes.PropertyType[]} - */ -export declare const getAllPropertyTypes: () => movininTypes.PropertyType[]; -/** - * Get all RentalTerms. - * - * @returns {movininTypes.RentalTerm} - */ -export declare const getAllRentalTerms: () => movininTypes.RentalTerm[]; diff --git a/packages/movinin-helper/index.js b/packages/movinin-helper/index.js deleted file mode 100644 index b6ab7171..00000000 --- a/packages/movinin-helper/index.js +++ /dev/null @@ -1,264 +0,0 @@ -import * as movininTypes from 'movinin-types'; -/** - * Format a number. - * - * @export - * @param {?number} [x] - * @returns {string} - */ -export const formatNumber = (x) => { - if (typeof x === 'number') { - const parts = String(x % 1 !== 0 ? x.toFixed(2) : x).split('.'); - parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' '); - return parts.join('.'); - } - return ''; -}; -/** - * Format a Date number to two digits. - * - * @export - * @param {number} n - * @returns {string} - */ -export const formatDatePart = (n) => { - return n > 9 ? String(n) : '0' + n; -}; -/** - * Capitalize a string. - * - * @export - * @param {string} str - * @returns {string} - */ -export const capitalize = (str) => { - return str.charAt(0).toUpperCase() + str.slice(1); -}; -/** - * Check if a value is a Date. - * - * @export - * @param {?*} [value] - * @returns {boolean} - */ -export const isDate = (value) => { - return value instanceof Date && !Number.isNaN(value.valueOf()); -}; -/** - * Join two url parts. - * - * @param {?string} [part1] - * @param {?string} [part2] - * @returns {string} - */ -export const joinURL = (part1, part2) => { - if (!part1 || !part2) { - const msg = '[joinURL] part undefined'; - console.log(msg); - throw new Error(msg); - } - if (part1.charAt(part1.length - 1) === '/') { - part1 = part1.substring(0, part1.length - 1); - } - if (part2.charAt(0) === '/') { - part2 = part2.substring(1); - } - return part1 + '/' + part2; -}; -/** - * Check if a string is an integer. - * - * @param {string} val - * @returns {boolean} - */ -export const isInteger = (val) => { - return /^\d+$/.test(val); -}; -/** - * Check if a string is a year. - * - * @param {string} val - * @returns {boolean} - */ -export const isYear = (val) => { - return /^\d{2}$/.test(val); -}; -/** - * Check if a string is a CVV. - * - * @param {string} val - * @returns {boolean} - */ -export const isCvv = (val) => { - return /^\d{3,4}$/.test(val); -}; -/** - * Check if two arrays are equal. - * - * @param {*} a - * @param {*} b - * @returns {boolean} - */ -export const arrayEqual = (a, b) => { - if (a === b) { - return true; - } - if (a == null || b == null) { - return false; - } - if (a.length !== b.length) { - return false; - } - // If you don't care about the order of the elements inside - // the array, you should sort both arrays here. - // Please note that calling sort on an array will modify that array. - // you might want to clone your array first. - for (let i = 0; i < a.length; i += 1) { - if (a[i] !== b[i]) { - return false; - } - } - return true; -}; -/** - * Clone an object or array. - * - * @param {*} obj - * @returns {*} - */ -export const clone = (obj) => { - return Array.isArray(obj) ? Array.from(obj) : Object.assign({}, obj); -}; -/** - * Clone an array. - * - * @export - * @template T - * @param {T[]} arr - * @returns {(T[] | undefined | null)} - */ -export const cloneArray = (arr) => { - if (typeof arr === 'undefined') { - return undefined; - } - if (arr == null) { - return null; - } - return [...arr]; -}; -/** - * Check if two filters are equal. - * - * @param {?(movininTypes.Filter | null)} [a] - * @param {?(movininTypes.Filter | null)} [b] - * @returns {boolean} - */ -export const filterEqual = (a, b) => { - if (a === b) { - return true; - } - if (a == null || b == null) { - return false; - } - if (a.from !== b.from) { - return false; - } - if (a.to !== b.to) { - return false; - } - if (a.keyword !== b.keyword) { - return false; - } - return true; -}; -/** - * Flatten Agency array. - * - * @param {movininTypes.User[]} companies - * @returns {string[]} - */ -export const flattenAgencies = (companies) => companies.map((agency) => agency._id ?? ''); -/** - * Get number of days between two dates. - * - * @param {?Date} [from] - * @param {?Date} [to] - * @returns {number} - */ -export const days = (from, to) => (from && to && Math.ceil((to.getTime() - from.getTime()) / (1000 * 3600 * 24))) || 0; -/** - * Check if User's language is French. - * - * @param {?movininTypes.User} [user] - * @returns {boolean} - */ -export const fr = (user) => (user && user.language === 'fr') || false; -/** - * Convert Extra string to number. - * - * @param {string} extra - * @returns {number} - */ -export const extraToNumber = (extra) => (extra === '' ? -1 : Number(extra)); -/** - * Convert Extra number to string. - * - * @param {number} extra - * @returns {string} - */ -export const extraToString = (extra) => (extra === -1 ? '' : String(extra)); -/** - * Trim carriage return. - * - * @param {string} str - * @returns {string} - */ -export const trimCarriageReturn = (str) => str.replace(/[\n\r]+/g, ''); -/** - * Get total days between two dates. - * - * @param {Date} date1 - * @param {Date} date2 - * @returns {number} - */ -export const totalDays = (date1, date2) => Math.ceil((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)); -/** - * Get number of days in a month. - * - * @param {number} month - * @param {number} year - * @returns {number} - */ -export const daysInMonth = (month, year) => new Date(year, month, 0).getDate(); -/** - * Get number of days in a year. - * - * @param {number} year - * @returns {(366 | 365)} - */ -export const daysInYear = (year) => ((year % 4 === 0 && year % 100 > 0) || year % 400 == 0) ? 366 : 365; -/** - * Get all PropertyTypes. - * - * @returns {movininTypes.PropertyType[]} - */ -export const getAllPropertyTypes = () => [ - movininTypes.PropertyType.Apartment, - movininTypes.PropertyType.Commercial, - movininTypes.PropertyType.Farm, - movininTypes.PropertyType.House, - movininTypes.PropertyType.Industrial, - movininTypes.PropertyType.Plot, - movininTypes.PropertyType.Townhouse -]; -/** - * Get all RentalTerms. - * - * @returns {movininTypes.RentalTerm} - */ -export const getAllRentalTerms = () => [ - movininTypes.RentalTerm.Monthly, - movininTypes.RentalTerm.Weekly, - movininTypes.RentalTerm.Daily, - movininTypes.RentalTerm.Yearly, -]; diff --git a/packages/movinin-helper/tsconfig.json b/packages/movinin-helper/tsconfig.json index 4dbf37fc..58bbe4df 100644 --- a/packages/movinin-helper/tsconfig.json +++ b/packages/movinin-helper/tsconfig.json @@ -4,7 +4,7 @@ /* Projects */ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ diff --git a/packages/movinin-types/index.d.ts b/packages/movinin-types/index.d.ts deleted file mode 100644 index a1d2d2bf..00000000 --- a/packages/movinin-types/index.d.ts +++ /dev/null @@ -1,328 +0,0 @@ -export declare enum UserType { - Admin = "ADMIN", - Agency = "AGENCY", - User = "USER" -} -export declare enum AppType { - Backend = "BACKEND", - Frontend = "FRONTEND" -} -export declare enum PropertyType { - Apartment = "APARTMENT", - Commercial = "COMMERCIAL", - Farm = "FARM", - House = "HOUSE", - Industrial = "INDUSTRIAL", - Plot = "PLOT", - Townhouse = "TOWNHOUSE" -} -export declare enum BookingStatus { - Void = "VOID", - Pending = "PENDING", - Deposit = "DEPOSIT", - Paid = "PAID", - Reserved = "RESERVED", - Cancelled = "CANCELLED" -} -export declare enum RecordType { - Admin = "ADMIN", - Agency = "AGENCY", - User = "USER", - Property = "PROPERTY", - Location = "LOCATION" -} -export declare enum Availablity { - Available = "AVAILABLE", - Unavailable = "UNAVAILABLE" -} -export declare enum RentalTerm { - Monthly = "MONTHLY", - Weekly = "WEEKLY", - Daily = "DAILY", - Yearly = "YEARLY" -} -export interface SignUpPayload { - email: string; - password: string; - fullName: string; - language: string; - active?: boolean; - verified?: boolean; - blacklisted?: boolean; - type?: string; - avatar?: string; - birthDate?: number | Date; - phone?: string; -} -export interface CreateUserPayload { - email?: string; - phone: string; - location: string; - bio: string; - fullName: string; - type?: string; - avatar?: string; - birthDate?: number | Date; - language?: string; - agency?: string; - password?: string; - verified?: boolean; - blacklisted?: boolean; - payLater?: boolean; -} -export interface UpdateUserPayload extends CreateUserPayload { - _id: string; - enableEmailNotifications?: boolean; - payLater?: boolean; -} -export interface changePasswordPayload { - _id: string; - password: string; - newPassword: string; - strict: boolean; -} -export interface UpdateAgencyPayload { - _id: string; - fullName: string; - phone: string; - location: string; - bio: string; - payLater: boolean; -} -export interface UpdateStatusPayload { - ids: string[]; - status: string; -} -export interface Renter { - _id?: string; - email: string; - phone: string; - fullName: string; - birthDate: string; - language: string; - verified: boolean; - blacklisted: boolean; -} -export interface Booking { - _id?: string; - agency: string | User; - property: string | Property; - renter?: string | User; - from: Date; - to: Date; - status: BookingStatus; - cancellation: boolean; - price?: number; - location: string | Location; - cancelRequest?: boolean; -} -export interface CheckoutPayload { - renter?: User; - booking: Booking; - payLater?: boolean; -} -export interface Filter { - from?: Date; - to?: Date; - location?: string; - keyword?: string; -} -export interface GetBookingsPayload { - agencies: string[]; - statuses: string[]; - user?: string; - property?: string; - filter?: Filter; -} -export interface LocationName { - language: string; - name: string; -} -export interface ActivatePayload { - userId: string; - token: string; - password: string; -} -export interface ValidateEmailPayload { - email: string; -} -export interface SignInPayload { - email: string; - password?: string; - stayConnected?: boolean; - mobile?: boolean; -} -export interface ResendLinkPayload { - email?: string; -} -export interface UpdateLanguage { - id: string; - language: string; -} -export interface ValidateAgencyPayload { - fullName: string; -} -export interface ValidateLocationPayload { - language: string; - name: string; -} -export interface GetBookingPropertiesPayload { - agency: string; - location: string; -} -export interface User { - _id?: string; - agency?: User | string; - fullName: string; - email?: string; - phone?: string; - password?: string; - birthDate?: Date; - verified?: boolean; - verifiedAt?: Date; - active?: boolean; - language?: string; - enableEmailNotifications?: boolean; - avatar?: string; - bio?: string; - location?: string; - type?: string; - blacklisted?: boolean; - payLater?: boolean; - accessToken?: string; - checked?: boolean; -} -export interface Option { - _id: string; - name?: string; - image?: string; -} -export interface LocationValue { - language: string; - value?: string; - name?: string; -} -export interface Location { - _id: string; - name?: string; - values?: LocationValue[]; -} -export interface Property { - _id: string; - name: string; - type: PropertyType; - agency: User; - description: string; - available: boolean; - image: string; - images?: string[]; - bedrooms: number; - bathrooms: number; - kitchens: number; - parkingSpaces: number; - size?: number; - petsAllowed: boolean; - furnished: boolean; - aircon: boolean; - minimumAge: number; - location: Location; - address?: string; - price: number; - hidden: boolean; - cancellation: number; - rentalTerm: RentalTerm; - [propKey: string]: any; -} -export interface CreatePropertyPayload { - name: string; - agency: string; - type: string; - description: string; - image: string; - images?: string[]; - available: boolean; - bedrooms: number; - bathrooms: number; - kitchens: number; - parkingSpaces: number; - size?: number; - petsAllowed: boolean; - furnished: boolean; - aircon: boolean; - minimumAge: number; - location?: string; - address: string; - price: number; - hidden: boolean; - cancellation: number; - rentalTerm: string; -} -export interface UpdatePropertyPayload extends CreatePropertyPayload { - _id: string; -} -export interface Notification { - _id: string; - user: string; - message: string; - booking?: string; - isRead?: boolean; - checked?: boolean; - createdAt?: Date; -} -export interface NotificationCounter { - _id: string; - user: string; - count: number; -} -export interface ResultData { - pageInfo: { - totalRecords: number; - }; - resultData: T[]; -} -export type Result = [ResultData] | [] | undefined | null; -export interface Data { - rows: T[]; - rowCount: number; -} -export interface ChangePasswordPayload { - _id: string; - password: string; - newPassword: string; - strict: boolean; -} -export interface UpdateEmailNotificationsPayload { - _id: string; - enableEmailNotifications: boolean; -} -export interface GetPropertiesPayload { - agencies: string[]; - types?: PropertyType[]; - rentalTerms?: RentalTerm[]; - availability?: Availablity[]; - location?: string; - language?: string; -} -export interface UpdateLanguagePayload { - id: string; - language: string; -} -export interface GetUsersBody { - user: string; - types: UserType[]; -} -export interface PropertyOptions { - cancellation?: boolean; -} -export type DataEvent = (data?: Data) => void; -export interface StatusFilterItem { - label: string; - value: BookingStatus; - checked?: boolean; -} -export interface PropertyFilter { - location: Location; - from: Date; - to: Date; -} -export type PropertyFilterSubmitEvent = (filter: PropertyFilter) => void; diff --git a/packages/movinin-types/index.js b/packages/movinin-types/index.js deleted file mode 100644 index fb5ae473..00000000 --- a/packages/movinin-types/index.js +++ /dev/null @@ -1,50 +0,0 @@ -export var UserType; -(function (UserType) { - UserType["Admin"] = "ADMIN"; - UserType["Agency"] = "AGENCY"; - UserType["User"] = "USER"; -})(UserType || (UserType = {})); -export var AppType; -(function (AppType) { - AppType["Backend"] = "BACKEND"; - AppType["Frontend"] = "FRONTEND"; -})(AppType || (AppType = {})); -export var PropertyType; -(function (PropertyType) { - PropertyType["Apartment"] = "APARTMENT"; - PropertyType["Commercial"] = "COMMERCIAL"; - PropertyType["Farm"] = "FARM"; - PropertyType["House"] = "HOUSE"; - PropertyType["Industrial"] = "INDUSTRIAL"; - PropertyType["Plot"] = "PLOT"; - PropertyType["Townhouse"] = "TOWNHOUSE"; -})(PropertyType || (PropertyType = {})); -export var BookingStatus; -(function (BookingStatus) { - BookingStatus["Void"] = "VOID"; - BookingStatus["Pending"] = "PENDING"; - BookingStatus["Deposit"] = "DEPOSIT"; - BookingStatus["Paid"] = "PAID"; - BookingStatus["Reserved"] = "RESERVED"; - BookingStatus["Cancelled"] = "CANCELLED"; -})(BookingStatus || (BookingStatus = {})); -export var RecordType; -(function (RecordType) { - RecordType["Admin"] = "ADMIN"; - RecordType["Agency"] = "AGENCY"; - RecordType["User"] = "USER"; - RecordType["Property"] = "PROPERTY"; - RecordType["Location"] = "LOCATION"; -})(RecordType || (RecordType = {})); -export var Availablity; -(function (Availablity) { - Availablity["Available"] = "AVAILABLE"; - Availablity["Unavailable"] = "UNAVAILABLE"; -})(Availablity || (Availablity = {})); -export var RentalTerm; -(function (RentalTerm) { - RentalTerm["Monthly"] = "MONTHLY"; - RentalTerm["Weekly"] = "WEEKLY"; - RentalTerm["Daily"] = "DAILY"; - RentalTerm["Yearly"] = "YEARLY"; -})(RentalTerm || (RentalTerm = {})); diff --git a/packages/movinin-types/index.ts b/packages/movinin-types/index.ts index 84c38d42..cd8c3f3b 100644 --- a/packages/movinin-types/index.ts +++ b/packages/movinin-types/index.ts @@ -1,360 +1,361 @@ export enum UserType { - Admin = 'ADMIN', - Agency = 'AGENCY', - User = 'USER', + Admin = 'ADMIN', + Agency = 'AGENCY', + User = 'USER', } export enum AppType { - Backend = 'BACKEND', - Frontend = 'FRONTEND', + Backend = 'BACKEND', + Frontend = 'FRONTEND', } export enum PropertyType { - Apartment = 'APARTMENT', - Commercial = 'COMMERCIAL', - Farm = 'FARM', - House = 'HOUSE', - Industrial = 'INDUSTRIAL', - Plot = 'PLOT', - Townhouse = 'TOWNHOUSE', + Apartment = 'APARTMENT', + Commercial = 'COMMERCIAL', + Farm = 'FARM', + House = 'HOUSE', + Industrial = 'INDUSTRIAL', + Plot = 'PLOT', + Townhouse = 'TOWNHOUSE', } export enum BookingStatus { - Void = 'VOID', - Pending = 'PENDING', - Deposit = 'DEPOSIT', - Paid = 'PAID', - Reserved = 'RESERVED', - Cancelled = 'CANCELLED' + Void = 'VOID', + Pending = 'PENDING', + Deposit = 'DEPOSIT', + Paid = 'PAID', + Reserved = 'RESERVED', + Cancelled = 'CANCELLED' } export enum RecordType { - Admin = 'ADMIN', - Agency = 'AGENCY', - User = 'USER', - Property = 'PROPERTY', - Location = 'LOCATION' + Admin = 'ADMIN', + Agency = 'AGENCY', + User = 'USER', + Property = 'PROPERTY', + Location = 'LOCATION' } export enum Availablity { - Available = 'AVAILABLE', - Unavailable = 'UNAVAILABLE' + Available = 'AVAILABLE', + Unavailable = 'UNAVAILABLE' } export enum RentalTerm { - Monthly = 'MONTHLY', - Weekly = 'WEEKLY', - Daily = 'DAILY', - Yearly = 'YEARLY' + Monthly = 'MONTHLY', + Weekly = 'WEEKLY', + Daily = 'DAILY', + Yearly = 'YEARLY' } export interface SignUpPayload { - email: string - password: string - fullName: string - language: string - active?: boolean - verified?: boolean - blacklisted?: boolean - type?: string - avatar?: string - birthDate?: number | Date - phone?: string + email: string + password: string + fullName: string + language: string + active?: boolean + verified?: boolean + blacklisted?: boolean + type?: string + avatar?: string + birthDate?: number | Date + phone?: string } export interface CreateUserPayload { - email?: string - phone: string - location: string - bio: string - fullName: string - type?: string - avatar?: string - birthDate?: number | Date - language?: string - agency?: string - password?: string - verified?: boolean - blacklisted?: boolean - payLater?: boolean + email?: string + phone: string + location: string + bio: string + fullName: string + type?: string + avatar?: string + birthDate?: number | Date + language?: string + agency?: string + password?: string + verified?: boolean + blacklisted?: boolean + payLater?: boolean } export interface UpdateUserPayload extends CreateUserPayload { - _id: string - enableEmailNotifications?: boolean - payLater?: boolean + _id: string + enableEmailNotifications?: boolean + payLater?: boolean } export interface changePasswordPayload { - _id: string - password: string - newPassword: string - strict: boolean + _id: string + password: string + newPassword: string + strict: boolean } export interface UpdateAgencyPayload { - _id: string - fullName: string - phone: string - location: string - bio: string - payLater: boolean + _id: string + fullName: string + phone: string + location: string + bio: string + payLater: boolean } export interface UpdateStatusPayload { - ids: string[], - status: string + ids: string[] + status: string } export interface Renter { - _id?: string - email: string - phone: string - fullName: string - birthDate: string - language: string - verified: boolean - blacklisted: boolean + _id?: string + email: string + phone: string + fullName: string + birthDate: string + language: string + verified: boolean + blacklisted: boolean } export interface Booking { - _id?: string - agency: string | User - property: string | Property - renter?: string | User - from: Date - to: Date - status: BookingStatus - cancellation: boolean - price?: number - location: string | Location - cancelRequest?: boolean + _id?: string + agency: string | User + property: string | Property + renter?: string | User + from: Date + to: Date + status: BookingStatus + cancellation: boolean + price?: number + location: string | Location + cancelRequest?: boolean } export interface CheckoutPayload { - renter?: User - booking: Booking - payLater?: boolean + renter?: User + booking: Booking + payLater?: boolean } export interface Filter { - from?: Date - to?: Date - location?: string - keyword?: string + from?: Date + to?: Date + location?: string + keyword?: string } export interface GetBookingsPayload { - agencies: string[] - statuses: string[] - user?: string - property?: string - filter?: Filter + agencies: string[] + statuses: string[] + user?: string + property?: string + filter?: Filter + language?: string } export interface LocationName { - language: string - name: string + language: string + name: string } export interface ActivatePayload { - userId: string - token: string - password: string + userId: string + token: string + password: string } export interface ValidateEmailPayload { - email: string + email: string } export interface SignInPayload { - email: string - password?: string - stayConnected?: boolean - mobile?: boolean + email: string + password?: string + stayConnected?: boolean + mobile?: boolean } export interface ResendLinkPayload { - email?: string + email?: string } export interface UpdateLanguage { - id: string - language: string + id: string + language: string } export interface ValidateAgencyPayload { - fullName: string + fullName: string } export interface ValidateLocationPayload { - language: string - name: string + language: string + name: string } export interface GetBookingPropertiesPayload { - agency: string - location: string + agency: string + location: string } export interface User { - _id?: string - agency?: User | string - fullName: string - email?: string - phone?: string - password?: string - birthDate?: Date - verified?: boolean - verifiedAt?: Date - active?: boolean - language?: string - enableEmailNotifications?: boolean - avatar?: string - bio?: string - location?: string - type?: string - blacklisted?: boolean - payLater?: boolean - accessToken?: string - checked?: boolean + _id?: string + agency?: User | string + fullName: string + email?: string + phone?: string + password?: string + birthDate?: Date + verified?: boolean + verifiedAt?: Date + active?: boolean + language?: string + enableEmailNotifications?: boolean + avatar?: string + bio?: string + location?: string + type?: string + blacklisted?: boolean + payLater?: boolean + accessToken?: string + checked?: boolean } export interface Option { - _id: string - name?: string - image?: string + _id: string + name?: string + image?: string } export interface LocationValue { - language: string - value?: string - name?: string + language: string + value?: string + name?: string } export interface Location { - _id: string - name?: string - values?: LocationValue[] + _id: string + name?: string + values?: LocationValue[] } export interface Property { - _id: string - name: string - type: PropertyType - agency: User - description: string - available: boolean - image: string - images?: string[] - bedrooms: number - bathrooms: number - kitchens: number - parkingSpaces: number, - size?: number - petsAllowed: boolean - furnished: boolean - aircon: boolean - minimumAge: number - location: Location - address?: string - price: number - hidden: boolean - cancellation: number - rentalTerm: RentalTerm - [propKey: string]: any + _id: string + name: string + type: PropertyType + agency: User + description: string + available: boolean + image: string + images?: string[] + bedrooms: number + bathrooms: number + kitchens: number + parkingSpaces: number + size?: number + petsAllowed: boolean + furnished: boolean + aircon: boolean + minimumAge: number + location: Location + address?: string + price: number + hidden: boolean + cancellation: number + rentalTerm: RentalTerm + [propKey: string]: any } export interface CreatePropertyPayload { - name: string - agency: string - type: string - description: string - image: string - images?: string[] - available: boolean - bedrooms: number - bathrooms: number - kitchens: number - parkingSpaces: number - size?: number - petsAllowed: boolean - furnished: boolean - aircon: boolean - minimumAge: number - location?: string - address: string - price: number - hidden: boolean - cancellation: number - rentalTerm: string + name: string + agency: string + type: string + description: string + image: string + images?: string[] + available: boolean + bedrooms: number + bathrooms: number + kitchens: number + parkingSpaces: number + size?: number + petsAllowed: boolean + furnished: boolean + aircon: boolean + minimumAge: number + location?: string + address: string + price: number + hidden: boolean + cancellation: number + rentalTerm: string } export interface UpdatePropertyPayload extends CreatePropertyPayload { - _id: string + _id: string } export interface Notification { - _id: string - user: string - message: string - booking?: string - isRead?: boolean - checked?: boolean - createdAt?: Date + _id: string + user: string + message: string + booking?: string + isRead?: boolean + checked?: boolean + createdAt?: Date } export interface NotificationCounter { - _id: string - user: string - count: number + _id: string + user: string + count: number } export interface ResultData { - pageInfo: { totalRecords: number } - resultData: T[] + pageInfo: { totalRecords: number } + resultData: T[] } export type Result = [ResultData] | [] | undefined | null export interface Data { - rows: T[] - rowCount: number + rows: T[] + rowCount: number } export interface ChangePasswordPayload { - _id: string - password: string - newPassword: string - strict: boolean + _id: string + password: string + newPassword: string + strict: boolean } export interface UpdateEmailNotificationsPayload { - _id: string - enableEmailNotifications: boolean + _id: string + enableEmailNotifications: boolean } export interface GetPropertiesPayload { - agencies: string[] - types?: PropertyType[] - rentalTerms?: RentalTerm[] - availability?: Availablity[] - location?: string - language?: string + agencies: string[] + types?: PropertyType[] + rentalTerms?: RentalTerm[] + availability?: Availablity[] + location?: string + language?: string } export interface UpdateLanguagePayload { - id: string - language: string + id: string + language: string } export interface GetUsersBody { - user: string - types: UserType[] + user: string + types: UserType[] } export interface PropertyOptions { - cancellation?: boolean + cancellation?: boolean } @@ -364,15 +365,15 @@ export interface PropertyOptions { export type DataEvent = (data?: Data) => void export interface StatusFilterItem { - label: string - value: BookingStatus - checked?: boolean + label: string + value: BookingStatus + checked?: boolean } export interface PropertyFilter { - location: Location - from: Date - to: Date + location: Location + from: Date + to: Date } export type PropertyFilterSubmitEvent = (filter: PropertyFilter) => void diff --git a/packages/movinin-types/tsconfig.json b/packages/movinin-types/tsconfig.json index 273510e7..4d098fd0 100644 --- a/packages/movinin-types/tsconfig.json +++ b/packages/movinin-types/tsconfig.json @@ -4,7 +4,7 @@ /* Projects */ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */