diff --git a/.eslintrc.json b/.eslintrc.json
index 0ee3260..215026e 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -31,7 +31,15 @@
"keyword-spacing": [
"error", {
"before": false, "after": false, "overrides": {
- "const": { "after": true }
+ "const": {
+ "after": true
+ },
+ "return": {
+ "after": true
+ },
+ "case": {
+ "after": true
+ }
}
}],
"space-before-function-paren": 0,
diff --git a/app.js b/app.js
index 5adfbd8..7e17670 100644
--- a/app.js
+++ b/app.js
@@ -39,34 +39,34 @@ if(baseConfig === false){
// Validate the payment gateway config
switch(config.paymentGateway){
- case'paypal':
+ case 'paypal':
if(ajv.validate(require('./config/paypalSchema'), require('./config/paypal.json')) === false){
console.log(colors.red(`PayPal config is incorrect: ${ajv.errorsText()}`));
process.exit(2);
}
break;
- case'stripe':
+ case 'stripe':
if(ajv.validate(require('./config/stripeSchema'), require('./config/stripe.json')) === false){
console.log(colors.red(`Stripe config is incorrect: ${ajv.errorsText()}`));
process.exit(2);
}
break;
- case'authorizenet':
+ case 'authorizenet':
if(ajv.validate(require('./config/authorizenetSchema'), require('./config/authorizenet.json')) === false){
console.log(colors.red(`Authorizenet config is incorrect: ${ajv.errorsText()}`));
process.exit(2);
}
break;
- case'adyen':
+ case 'adyen':
if(ajv.validate(require('./config/adyenSchema'), require('./config/adyen.json')) === false){
console.log(colors.red(`adyen config is incorrect: ${ajv.errorsText()}`));
process.exit(2);
}
break;
- case'instore':
+ case 'instore':
if(ajv.validate(require('./config/instoreSchema'), require('./config/instore.json')) === false){
console.log(colors.red(`instore config is incorrect: ${ajv.errorsText()}`));
process.exit(2);
@@ -128,37 +128,37 @@ handlebars = handlebars.create({
},
perRowClass: (numProducts) => {
if(parseInt(numProducts) === 1){
- return'col-6 col-md-12 product-item';
+ return 'col-6 col-md-12 product-item';
}
if(parseInt(numProducts) === 2){
- return'col-6 col-md-6 product-item';
+ return 'col-6 col-md-6 product-item';
}
if(parseInt(numProducts) === 3){
- return'col-6 col-md-4 product-item';
+ return 'col-6 col-md-4 product-item';
}
if(parseInt(numProducts) === 4){
- return'col-6 col-md-3 product-item';
+ return 'col-6 col-md-3 product-item';
}
- return'col-md-6 product-item';
+ return 'col-md-6 product-item';
},
menuMatch: (title, search) => {
if(!title || !search){
- return'';
+ return '';
}
if(title.toLowerCase().startsWith(search.toLowerCase())){
- return'class="navActive"';
+ return 'class="navActive"';
}
- return'';
+ return '';
},
getTheme: (view) => {
- return`themes/${config.theme}/${view}`;
+ return `themes/${config.theme}/${view}`;
},
formatAmount: (amt) => {
if(amt){
return numeral(amt).format('0.00');
}
- return'0.00';
+ return '0.00';
},
amountNoDecimal: (amt) => {
if(amt){
@@ -168,33 +168,33 @@ handlebars = handlebars.create({
},
getStatusColor: (status) => {
switch(status){
- case'Paid':
- return'success';
- case'Approved':
- return'success';
- case'Approved - Processing':
- return'success';
- case'Failed':
- return'danger';
- case'Completed':
- return'success';
- case'Shipped':
- return'success';
- case'Pending':
- return'warning';
+ case 'Paid':
+ return 'success';
+ case 'Approved':
+ return 'success';
+ case 'Approved - Processing':
+ return 'success';
+ case 'Failed':
+ return 'danger';
+ case 'Completed':
+ return 'success';
+ case 'Shipped':
+ return 'success';
+ case 'Pending':
+ return 'warning';
default:
- return'danger';
+ return 'danger';
}
},
checkProductOptions: (opts) => {
if(opts){
- return'true';
+ return 'true';
}
- return'false';
+ return 'false';
},
currencySymbol: (value) => {
if(typeof value === 'undefined' || value === ''){
- return'$';
+ return '$';
}
return value;
},
@@ -208,19 +208,19 @@ handlebars = handlebars.create({
if(obj){
return JSON.stringify(obj);
}
- return'';
+ return '';
},
checkedState: (state) => {
if(state === 'true' || state === true){
- return'checked';
+ return 'checked';
}
- return'';
+ return '';
},
selectState: (state, value) => {
if(state === value){
- return'selected';
+ return 'selected';
}
- return'';
+ return '';
},
isNull: (value, options) => {
if(typeof value === 'undefined' || value === ''){
@@ -242,24 +242,24 @@ handlebars = handlebars.create({
},
ifCond: (v1, operator, v2, options) => {
switch(operator){
- case'==':
- return(v1 === v2) ? options.fn(this) : options.inverse(this);
- case'!=':
- return(v1 !== v2) ? options.fn(this) : options.inverse(this);
- case'===':
- return(v1 === v2) ? options.fn(this) : options.inverse(this);
- case'<':
- return(v1 < v2) ? options.fn(this) : options.inverse(this);
- case'<=':
- return(v1 <= v2) ? options.fn(this) : options.inverse(this);
- case'>':
- return(v1 > v2) ? options.fn(this) : options.inverse(this);
- case'>=':
- return(v1 >= v2) ? options.fn(this) : options.inverse(this);
- case'&&':
- return(v1 && v2) ? options.fn(this) : options.inverse(this);
- case'||':
- return(v1 || v2) ? options.fn(this) : options.inverse(this);
+ case '==':
+ return (v1 === v2) ? options.fn(this) : options.inverse(this);
+ case '!=':
+ return (v1 !== v2) ? options.fn(this) : options.inverse(this);
+ case '===':
+ return (v1 === v2) ? options.fn(this) : options.inverse(this);
+ case '<':
+ return (v1 < v2) ? options.fn(this) : options.inverse(this);
+ case '<=':
+ return (v1 <= v2) ? options.fn(this) : options.inverse(this);
+ case '>':
+ return (v1 > v2) ? options.fn(this) : options.inverse(this);
+ case '>=':
+ return (v1 >= v2) ? options.fn(this) : options.inverse(this);
+ case '&&':
+ return (v1 && v2) ? options.fn(this) : options.inverse(this);
+ case '||':
+ return (v1 || v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
@@ -272,22 +272,22 @@ handlebars = handlebars.create({
},
paymentMessage: (status) => {
if(status === 'Paid'){
- return'
Your payment has been successfully processed
';
+ return 'Your payment has been successfully processed
';
}
if(status === 'Pending'){
const paymentConfig = common.getPaymentConfig();
if(config.paymentGateway === 'instore'){
- return`${paymentConfig.resultMessage}
`;
+ return `${paymentConfig.resultMessage}
`;
}
- return'The payment for this order is pending. We will be in contact shortly.
';
+ return 'The payment for this order is pending. We will be in contact shortly.
';
}
- return'Your payment has failed. Please try again or contact us.
';
+ return 'Your payment has failed. Please try again or contact us.
';
},
paymentOutcome: (status) => {
if(status === 'Paid' || status === 'Pending'){
- return'Please retain the details above as a reference of payment
';
+ return 'Please retain the details above as a reference of payment
';
}
- return'';
+ return '';
},
upperFirst: (value) => {
if(value){
@@ -301,7 +301,7 @@ handlebars = handlebars.create({
lvalue = parseFloat(lvalue);
rvalue = parseFloat(rvalue);
- return{
+ return {
'+': lvalue + rvalue,
'-': lvalue - rvalue,
'*': lvalue * rvalue,
@@ -311,9 +311,9 @@ handlebars = handlebars.create({
},
showCartButtons: (cart) => {
if(!cart){
- return'd-none';
+ return 'd-none';
}
- return'';
+ return '';
},
snip: (text) => {
if(text && text.length > 155){
@@ -321,6 +321,11 @@ handlebars = handlebars.create({
}
return text;
},
+ fixTags: (html) => {
+ html = html.replace(/>/g, '>');
+ html = html.replace(/</g, '<');
+ return html;
+ },
feather: (icon) => {
// eslint-disable-next-line keyword-spacing
return `