Merged in development (pull request #34)

IO-755
This commit is contained in:
Patrick Fic
2021-03-09 21:18:56 +00:00
18 changed files with 6154 additions and 166 deletions

View File

@@ -11651,6 +11651,48 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>passwordresetvalidatesuccess</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>passwordresetvalidatesuccess_sub</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>passwordsdonotmatch</name>
<definition_loaded>false</definition_loaded>
@@ -11819,6 +11861,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>signin</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>sunday</name>
<definition_loaded>false</definition_loaded>
@@ -12186,6 +12249,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>noshop</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>notfoundsub</name>
<definition_loaded>false</definition_loaded>

View File

@@ -0,0 +1,12 @@
import React from "react";
import { Result } from "antd";
import { useTranslation } from "react-i18next";
export default function NoShop() {
const { t } = useTranslation();
return (
<div>
<Result status="403" title={t("general.messages.noshop")} />
</div>
);
}

View File

@@ -153,12 +153,14 @@ const { Content, Header } = Layout;
const stripePromise = new Promise((resolve, reject) => {
client.query({ query: QUERY_STRIPE_ID }).then((resp) => {
resolve(
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
stripeAccount:
resp.data.bodyshops[0].stripe_acct_id || "No Stripe Id Resolve",
})
);
if (resp.data.bodyshops[0])
resolve(
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
stripeAccount:
resp.data.bodyshops[0].stripe_acct_id || "No Stripe Id Resolve",
})
);
reject();
});
});

View File

@@ -7,12 +7,17 @@ import { setBodyshop } from "../../redux/user/user.actions";
import ManagePage from "./manage.page.component";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import { useTranslation } from "react-i18next";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import NoShop from "../../components/no-shop/no-shop.component";
const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop });
const mapDispatchToProps = (dispatch) => ({
setBodyshop: (bs) => dispatch(setBodyshop(bs)),
});
function ManagePageContainer({ match, setBodyshop }) {
function ManagePageContainer({ match, setBodyshop, bodyshop }) {
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
fetchPolicy: "network-only",
});
@@ -20,13 +25,19 @@ function ManagePageContainer({ match, setBodyshop }) {
const { t } = useTranslation();
useEffect(() => {
if (data) setBodyshop(data.bodyshops[0]);
if (data) setBodyshop(data.bodyshops[0] || { notfound: true });
}, [data, setBodyshop]);
if (loading)
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (bodyshop && bodyshop.notfound) return <NoShop />;
return <ManagePage match={match} />;
}
export default connect(null, mapDispatchToProps)(ManagePageContainer);
export default connect(
mapStateToProps,
mapDispatchToProps
)(ManagePageContainer);

View File

@@ -15,7 +15,6 @@ import {
sendPasswordResetSuccess,
setAuthlevel,
setInstanceConflict,
setInstanceId,
setLocalFingerprint,
signInFailure,
signInSuccess,
@@ -160,7 +159,7 @@ export function* onSignInSuccess() {
export function* signInSuccessSaga({ payload }) {
LogRocket.identify(payload.email);
if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
// if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
analytics.setUserId(payload.email);
analytics.setUserProperties(payload);
yield logImEXEvent("redux_sign_in_success");
@@ -177,7 +176,7 @@ export function* sendPasswordResetEmail({ payload }) {
yield auth.sendPasswordResetEmail(payload, {
url: "https://imex.online/passwordreset",
});
console.log("Good should send.");
yield put(sendPasswordResetSuccess());
} catch (error) {
yield put(sendPasswordResetFailure(error.message));

View File

@@ -753,6 +753,8 @@
"password": "Password",
"passwordresetsuccess": "A password reset link has been sent to you.",
"passwordresetsuccess_sub": "You should receive this email in the next few minutes. Please check your email including any junk or spam folders. ",
"passwordresetvalidatesuccess": "Password successfully reset. ",
"passwordresetvalidatesuccess_sub": "You may now sign in again using your new password. ",
"passwordsdonotmatch": "The passwords you have entered do not match.",
"print": "Print",
"required": "Required",
@@ -761,6 +763,7 @@
"selectdate": "Select date...",
"sendagain": "Send Again",
"sendby": "Send By",
"signin": "Sign In",
"sunday": "Sunday",
"text": "Text",
"thursday": "Thursday",
@@ -782,6 +785,7 @@
"newversionmessage": "Click refresh below to update to the latest available version of ImEX Online.",
"newversiontitle": "New version of ImEX Online Available",
"noacctfilepath": "There is no accounting file path set. You will not be able to export any items.",
"noshop": "You do not have access to any shops. Please reach out to your shop manager or technical support. ",
"notfoundsub": "Please make sure that you have access to the data or that the link is correct.",
"notfoundtitle": "We couldn't find what you're looking for...",
"partnernotrunning": "ImEX Online has detected that the partner is not running. Please ensure it is running to enable full functionality.",

View File

@@ -753,6 +753,8 @@
"password": "",
"passwordresetsuccess": "",
"passwordresetsuccess_sub": "",
"passwordresetvalidatesuccess": "",
"passwordresetvalidatesuccess_sub": "",
"passwordsdonotmatch": "",
"print": "",
"required": "",
@@ -761,6 +763,7 @@
"selectdate": "",
"sendagain": "",
"sendby": "",
"signin": "",
"sunday": "",
"text": "",
"thursday": "",
@@ -782,6 +785,7 @@
"newversionmessage": "",
"newversiontitle": "",
"noacctfilepath": "",
"noshop": "",
"notfoundsub": "",
"notfoundtitle": "",
"partnernotrunning": "",

View File

@@ -753,6 +753,8 @@
"password": "",
"passwordresetsuccess": "",
"passwordresetsuccess_sub": "",
"passwordresetvalidatesuccess": "",
"passwordresetvalidatesuccess_sub": "",
"passwordsdonotmatch": "",
"print": "",
"required": "",
@@ -761,6 +763,7 @@
"selectdate": "",
"sendagain": "",
"sendby": "",
"signin": "",
"sunday": "",
"text": "",
"thursday": "",
@@ -782,6 +785,7 @@
"newversionmessage": "",
"newversiontitle": "",
"noacctfilepath": "",
"noshop": "",
"notfoundsub": "",
"notfoundtitle": "",
"partnernotrunning": "",

View File

@@ -0,0 +1,122 @@
{
"root": true,
"parserOptions": {
// Required for certain syntax usages
"ecmaVersion": 2017
},
"plugins": ["promise"],
"extends": "eslint:recommended",
"rules": {
// Removed rule "disallow the use of console" from recommended eslint rules
"no-console": "off",
// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
"no-regex-spaces": "off",
// Removed rule ØØ"disallow the use of debugger" from recommended eslint rules
"no-debugger": "off",
// Removed rule "disallow unused variables" from recommended eslint rules
"no-unused-vars": "off",
// Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
"no-mixed-spaces-and-tabs": "off",
// Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
"no-undef": "off",
// Warn against template literal placeholder syntax in regular strings
"no-template-curly-in-string": 1,
// Warn if return statements do not either always or never specify values
"consistent-return": 1,
// Warn if no return statements in callbacks of array methods
"array-callback-return": 1,
// Require the use of === and !==
"eqeqeq": 2,
// Disallow the use of alert, confirm, and prompt
"no-alert": 2,
// Disallow the use of arguments.caller or arguments.callee
"no-caller": 2,
// Disallow null comparisons without type-checking operators
"no-eq-null": 2,
// Disallow the use of eval()
"no-eval": 2,
// Warn against extending native types
"no-extend-native": 1,
// Warn against unnecessary calls to .bind()
"no-extra-bind": 1,
// Warn against unnecessary labels
"no-extra-label": 1,
// Disallow leading or trailing decimal points in numeric literals
"no-floating-decimal": 2,
// Warn against shorthand type conversions
"no-implicit-coercion": 1,
// Warn against function declarations and expressions inside loop statements
"no-loop-func": 1,
// Disallow new operators with the Function object
"no-new-func": 2,
// Warn against new operators with the String, Number, and Boolean objects
"no-new-wrappers": 1,
// Disallow throwing literals as exceptions
"no-throw-literal": 2,
// Require using Error objects as Promise rejection reasons
"prefer-promise-reject-errors": 2,
// Enforce “for” loop update clause moving the counter in the right direction
"for-direction": 2,
// Enforce return statements in getters
"getter-return": 2,
// Disallow await inside of loops
"no-await-in-loop": 2,
// Disallow comparing against -0
"no-compare-neg-zero": 2,
// Warn against catch clause parameters from shadowing variables in the outer scope
"no-catch-shadow": 1,
// Disallow identifiers from shadowing restricted names
"no-shadow-restricted-names": 2,
// Enforce return statements in callbacks of array methods
"callback-return": 2,
// Require error handling in callbacks
"handle-callback-err": 2,
// Warn against string concatenation with __dirname and __filename
"no-path-concat": 1,
// Prefer using arrow functions for callbacks
"prefer-arrow-callback": 1,
// Return inside each then() to create readable and reusable Promise chains.
// Forces developers to return console logs and http calls in promises.
"promise/always-return": 2,
//Enforces the use of catch() on un-returned promises
"promise/catch-or-return": 2,
// Warn against nested then() or catch() statements
"promise/no-nesting": 1
}
}

View File

@@ -1,123 +0,0 @@
// {
// "parserOptions": {
// // Required for certain syntax usages
// "ecmaVersion": 2017
// },
// "plugins": [
// "promise"
// ],
// "extends": "eslint:recommended",
// "rules": {
// // Removed rule "disallow the use of console" from recommended eslint rules
// "no-console": "off",
// // Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
// "no-regex-spaces": "off",
// // Removed rule "disallow the use of debugger" from recommended eslint rules
// "no-debugger": "off",
// // Removed rule "disallow unused variables" from recommended eslint rules
// "no-unused-vars": "off",
// // Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
// "no-mixed-spaces-and-tabs": "off",
// // Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
// "no-undef": "off",
// // Warn against template literal placeholder syntax in regular strings
// "no-template-curly-in-string": 1,
// // Warn if return statements do not either always or never specify values
// "consistent-return": 1,
// // Warn if no return statements in callbacks of array methods
// "array-callback-return": 1,
// // Require the use of === and !==
// "eqeqeq": 2,
// // Disallow the use of alert, confirm, and prompt
// "no-alert": 2,
// // Disallow the use of arguments.caller or arguments.callee
// "no-caller": 2,
// // Disallow null comparisons without type-checking operators
// "no-eq-null": 2,
// // Disallow the use of eval()
// "no-eval": 2,
// // Warn against extending native types
// "no-extend-native": 1,
// // Warn against unnecessary calls to .bind()
// "no-extra-bind": 1,
// // Warn against unnecessary labels
// "no-extra-label": 1,
// // Disallow leading or trailing decimal points in numeric literals
// "no-floating-decimal": 2,
// // Warn against shorthand type conversions
// "no-implicit-coercion": 1,
// // Warn against function declarations and expressions inside loop statements
// "no-loop-func": 1,
// // Disallow new operators with the Function object
// "no-new-func": 2,
// // Warn against new operators with the String, Number, and Boolean objects
// "no-new-wrappers": 1,
// // Disallow throwing literals as exceptions
// "no-throw-literal": 2,
// // Require using Error objects as Promise rejection reasons
// "prefer-promise-reject-errors": 2,
// // Enforce “for” loop update clause moving the counter in the right direction
// "for-direction": 2,
// // Enforce return statements in getters
// "getter-return": 2,
// // Disallow await inside of loops
// "no-await-in-loop": 2,
// // Disallow comparing against -0
// "no-compare-neg-zero": 2,
// // Warn against catch clause parameters from shadowing variables in the outer scope
// "no-catch-shadow": 1,
// // Disallow identifiers from shadowing restricted names
// "no-shadow-restricted-names": 2,
// // Enforce return statements in callbacks of array methods
// "callback-return": 2,
// // Require error handling in callbacks
// "handle-callback-err": 2,
// // Warn against string concatenation with __dirname and __filename
// "no-path-concat": 1,
// // Prefer using arrow functions for callbacks
// "prefer-arrow-callback": 1,
// // Return inside each then() to create readable and reusable Promise chains.
// // Forces developers to return console logs and http calls in promises.
// "promise/always-return": 2,
// //Enforces the use of catch() on un-returned promises
// "promise/catch-or-return": 2,
// // Warn against nested then() or catch() statements
// "promise/no-nesting": 1
// }
// }

View File

@@ -7,23 +7,23 @@ exports.processSignUp = functions.auth.user().onCreate((user) => {
// Check if user meets role criteria:
// Your custom logic here: to decide what roles and other `x-hasura-*` should the user get
let customClaims;
if (user.email && user.email.indexOf("@thinkimex.com") !== -1) {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "admin",
"x-hasura-allowed-roles": ["user", "admin"],
"x-hasura-user-id": user.uid,
},
};
} else {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "user",
"x-hasura-allowed-roles": ["user"],
"x-hasura-user-id": user.uid,
},
};
}
// if (user.email && user.email.indexOf("@thinkimex.com") !== -1) {
// customClaims = {
// "https://hasura.io/jwt/claims": {
// "x-hasura-default-role": "admin",
// "x-hasura-allowed-roles": ["user", "admin"],
// "x-hasura-user-id": user.uid,
// },
// };
// } else {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "user",
"x-hasura-allowed-roles": ["user"],
"x-hasura-user-id": user.uid,
},
};
//}
//Removed for now - outbound connections are not free on firebase.
// fetch(GRAPHQL_ENDPOINT, {

5565
firebase/functions/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"lint": "eslint -c ./.eslintrc.json .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
@@ -10,11 +10,11 @@
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
"node": "12"
},
"dependencies": {
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0"
"firebase-admin": "^9.5.0",
"firebase-functions": "^3.13.2"
},
"devDependencies": {
"eslint": "^5.12.0",

View File

@@ -0,0 +1,73 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
columns:
- accountingconfig
- address1
- address2
- appt_alt_transport
- appt_colors
- appt_length
- bill_tax_rates
- city
- country
- created_at
- default_adjustment_rate
- deliverchecklist
- email
- enforce_class
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_classes
- md_hour_split
- md_ins_cos
- md_labor_rates
- md_messaging_presets
- md_notes_presets
- md_order_statuses
- md_parts_locations
- md_payment_types
- md_rbac
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- phone
- prodtargethrs
- production_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- target_touchtime
- updated_at
- use_fippa
- workingdays
- zip_post
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,74 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
columns:
- accountingconfig
- address1
- address2
- appt_alt_transport
- appt_colors
- appt_length
- bill_tax_rates
- city
- country
- created_at
- default_adjustment_rate
- deliverchecklist
- email
- enforce_class
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_classes
- md_hour_split
- md_ins_cos
- md_labor_rates
- md_messaging_presets
- md_notes_presets
- md_order_statuses
- md_parts_locations
- md_payment_types
- md_rbac
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- phone
- prodtargethrs
- production_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- target_touchtime
- updated_at
- use_fippa
- workingdays
- zip_post
filter:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,80 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- accountingconfig
- address1
- address2
- appt_alt_transport
- appt_colors
- appt_length
- bill_tax_rates
- city
- country
- created_at
- default_adjustment_rate
- deliverchecklist
- email
- enforce_class
- federal_tax_id
- id
- imexshopid
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_classes
- md_hour_split
- md_ins_cos
- md_labor_rates
- md_messaging_presets
- md_notes_presets
- md_order_statuses
- md_parts_locations
- md_payment_types
- md_rbac
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- messagingservicesid
- phone
- prodtargethrs
- production_config
- region_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- stripe_acct_id
- target_touchtime
- template_header
- textid
- updated_at
- use_fippa
- workingdays
- zip_post
computed_fields: []
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -0,0 +1,78 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- accountingconfig
- address1
- address2
- appt_alt_transport
- appt_colors
- appt_length
- bill_tax_rates
- city
- country
- created_at
- default_adjustment_rate
- deliverchecklist
- email
- enforce_class
- federal_tax_id
- id
- imexshopid
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- logo_img_path
- md_categories
- md_classes
- md_hour_split
- md_ins_cos
- md_labor_rates
- md_messaging_presets
- md_notes_presets
- md_order_statuses
- md_parts_locations
- md_payment_types
- md_rbac
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- messagingservicesid
- phone
- prodtargethrs
- production_config
- region_config
- schedule_end_time
- schedule_start_time
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- stripe_acct_id
- target_touchtime
- template_header
- textid
- updated_at
- use_fippa
- workingdays
- zip_post
computed_fields: []
filter:
associations:
user:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -786,11 +786,9 @@ tables:
- zip_post
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
user:
authid:
_eq: X-Hasura-User-Id
update_permissions:
- role: user
permission:
@@ -848,11 +846,12 @@ tables:
- zip_post
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
check: null
- table:
schema: public