Skip to content

Commit

Permalink
working version
Browse files Browse the repository at this point in the history
  • Loading branch information
summersab committed Sep 23, 2022
1 parent c5ff03e commit 5b1c3dc
Show file tree
Hide file tree
Showing 1,919 changed files with 167,983 additions and 45 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import * as tax from 'shared/helpers/taxes.js';
import './shared/order/taxes.js';
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "dutchie",
"type": "module",
"dependencies": {
}
}
25 changes: 25 additions & 0 deletions shared/constants/age-restrictions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {canadianProvincesMap} from '../../shared/core/constants/geography.js';

// country -> state
export const ageRestrictions = {
default: 21,
US: {
default: 21,
},
CA: {
default: 21,
[canadianProvincesMap.AB]: 18,
[canadianProvincesMap.BC]: 19,
[canadianProvincesMap.MB]: 19,
[canadianProvincesMap.NB]: 19,
[canadianProvincesMap.NL]: 19,
[canadianProvincesMap.NT]: 19,
[canadianProvincesMap.NS]: 19,
[canadianProvincesMap.NU]: 19,
[canadianProvincesMap.ON]: 19,
[canadianProvincesMap.PE]: 19,
[canadianProvincesMap.QC]: 21,
[canadianProvincesMap.SK]: 19,
[canadianProvincesMap.YT]: 19,
},
};
4 changes: 4 additions & 0 deletions shared/constants/aria.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const ARIA_ROLES = Object.freeze({
TAB_PANEL: 'tabpanel',
BUTTON: 'button',
});
2 changes: 1 addition & 1 deletion shared/constants/cannabinoids.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseNoidAbbreviation } from '../utils/misc-utils';
import { parseNoidAbbreviation } from '../utils/misc-utils.js';

export const CannabinoidAbbrev = {
TAC: 'TAC',
Expand Down
2 changes: 1 addition & 1 deletion shared/constants/content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { productEffects } from './products';
import { productEffects } from './products.js';

/**
* @type {Object.<string: string>}
Expand Down
11 changes: 11 additions & 0 deletions shared/constants/forms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const FIELD_NAMES = Object.freeze({
BIRTHDAY: 'birthday',
DATE: 'date',
EMAIL: 'email',
FIRST_NAME: 'firstName',
LAST_NAME: 'lastName',
PHONE: 'phone',
OLD_PASSWORD: 'oldPassword',
NEW_PASSWORD: 'newPassword',
CONFIRM_PASSWORD: 'confirmPassword',
});
24 changes: 12 additions & 12 deletions shared/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export * from './age-restrictions';
export * from './aria';
export * from './content';
export * from './dispensaries';
export * from './ernie';
export * from './forms';
export * from './orders';
export * from './products';
export * from './pusher';
export * from './specials';
export * from './taxes';
export * from './time';
export * from './age-restrictions.js';
export * from './aria.js';
export * from './content.js';
export * from './dispensaries.js';
//export * from './ernie.ts';
export * from './forms.js';
export * from './orders.js';
export * from './products.js';
export * from './pusher.js';
export * from './specials.js';
export * from './taxes.js';
export * from './time.js';

export const DELIVERY = 'Delivery';
export const PICKUP = 'Pickup';
Expand Down
214 changes: 214 additions & 0 deletions shared/constants/orders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
/* eslint-disable max-len */
import _ from 'lodash';

export const OrderFlows = {
pickup: ['open', 'confirmed', 'closed'],
delivery: ['open', 'confirmed', 'inTransit', 'closed'],
};

export const MARKETING_CAMPAIGN_PARAMS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];

export const CURBSIDE_PICKUP_SPECIAL_INSTRUCTIONS = 'This order is for Curbside Pickup.\n';
export const DRIVE_THRU_PICKUP_SPECIAL_INSTRUCTIONS = 'This is a drive thru order.\n';
export const DELIVERY_CUSTOMER_ERROR = 'cannot submit multiple orders from same customer to this dispensary on same day';
export const DELIVERY_ADDRESS_ERROR = 'cannot submit multiple orders from same address to this dispensary on same day';
export const PAUSED_ORDERS_CLOSED_ERROR = "We're closed at the moment due to extremely high demand. Stay tuned though, we'll reopen soon!";
export const DELIVERY_ERRORS = {
CUSTOMER: 'CUSTOMER',
ADDRESS: 'ADDRESS',
};

export const POSTAL_CODE_ERROR = 'We were unable to verify your card information. Please ensure the postal code entered matches what is on file at your bank for this card.';

export const OrderFilterOptions = [{
name: 'delivery-available',
key: 'deliveryAvailable',
label: 'Delivery Available',
}, {
name: 'free-delivery',
key: 'freeDelivery',
label: 'Free Delivery',
}, {
name: 'no-delivery-minimum',
key: 'noDeliveryMinimum',
label: 'No Delivery Minimum',
}, {
name: 'accepts-credit-cards',
key: 'acceptsCreditCards',
label: 'Accepts Credit Cards',
}, ];

export const PAYMENT_CASH = 'cash';
export const PAYMENT_DUTCHIEPAY = 'dutchiePay';
export const PAYMENT_CREDIT_CARD = 'creditCard';

// Order of these keys is important for
// firstValidPaymentOption to work correctly.
// We want to start with in store, then cash
export const paymentMethodsToDisplayNames = {
payInStore: 'In Store',
inStore: 'In Store',

[PAYMENT_CASH]: 'Cash',
check: 'Check',

[PAYMENT_CREDIT_CARD]: 'Credit Card',
creditCardAtDoor: 'Credit Card',
payOnlineHypur: 'Hypur',
payOnlineMerrco: 'Credit Card',
payOnlineMoneris: 'Credit Card',
payOnlineChase: 'Credit Card',
creditCardByPhone: 'Pay by Phone',
inStoreCreditCard: 'Credit Card',
credit: 'Credit Card',

debitCard: 'Debit Card',
debitOnly: 'Debit Card',
debit: 'Debit Card',

dutchiePay: 'dutchiePay',

linx: 'Linx',
alt36: 'Alt Thirty Six',
canPay: 'CanPay',
paytender: 'Paytender',
aeropay: 'Aeropay',
};

export const orderTypesToDisplayNames = {
pickup: 'Pickup',
curbsidePickup: 'Curbside Pickup',
driveThruPickup: 'Drive Thru Pickup',
delivery: 'Delivery',
kiosk: 'Kiosk',
};

export const orderTypesToDisplayNamesV2 = {
inStorePickup: 'In-Store Pickup',
curbsidePickup: 'Curbside Pickup',
driveThruPickup: 'Drive-Thru Pickup',
delivery: 'Delivery',
kiosk: 'Kiosk',
};

export const orderTypesToShortNamesV2 = {
inStorePickup: 'In-Store',
curbsidePickup: 'Curbside',
driveThruPickup: 'Drive-Thru',
delivery: 'Delivery',
};

export const paysafeCardTypes = {
VI: 'Visa',
MC: 'Mastercard',
// mastercard credit
MD: 'Mastercard',
// mastercard debit
AM: 'Amex',
DI: 'Discover',
};

export const paymentMethodsToDisplayNamesAdmin = {
...paymentMethodsToDisplayNames,
payOnlineMerrco: 'Credit Card (Merrco)',
payOnlineMoneris: 'Credit Card (Moneris)',
payOnlineChase: 'Credit Card (Chase)',
};

export const validOrderTypes = Object.keys(orderTypesToDisplayNames);

export const firstValidPaymentOption = (dispensary={})=>{
if (!dispensary.cashless) {
return 'cash';
}
if (dispensary.payOnlineMerrco) {
return 'creditCard';
}
const foundMethod = _.find(_.keys(paymentMethodsToDisplayNames), (key)=>dispensary[key]) || _.keys(paymentMethodsToDisplayNames)[0];

return foundMethod;
}
;

export const defaultDurationEstimates = {
delivery: {
lowInMinutes: 35,
highInMinutes: 45,
},
pickup: {
lowInMinutes: 15,
highInMinutes: 25,
},
curbsidePickup: {
lowInMinutes: 15,
highInMinutes: 25,
},
};

export const defaultActionEstimates = {
pickup: {
readyInMinutes: 20,
rangeInMinutes: 5,
},
delivery: {
readyInMinutes: 25,
rangeInMinutes: 10,
deliveryTimeInMinutes: 20,
},
};

// valid id's enum - graphql/order/type.js
export const archiveReasons = ({phone='', orderId=''}={})=>[{
id: 'NOPICKUP',
reason: 'Customer never picked up the order',
customerMessage: `Your order #${orderId} was cancelled because it wasn’t picked up. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'SOLDOUT',
reason: 'Items on the order were sold out',
customerMessage: `Your order #${orderId} contained a sold out item and therefore the order has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'CANCELLED',
reason: 'Customer asked to cancel the order',
customerMessage: `Your order #${orderId} has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'NOPAYMENT',
reason: 'Customer didn’t have proper payment',
customerMessage: `Your order #${orderId} has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'NOIDENTIFICATION',
reason: 'Customer didn’t have proper identification',
customerMessage: `Your order #${orderId} has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'BADINFO',
reason: 'Customer entered their information incorrectly',
customerMessage: `Your order #${orderId} has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, {
id: 'COMPLIANCEVIOLATION',
reason: 'The order violated compliance',
customerMessage: `Your order #${orderId} has been cancelled due to compliance concerns. If you have any questions or believe this was a mistake, please contact ${phone}.`,
}, {
id: 'OTHER',
reason: 'Other',
customerMessage: `Your order #${orderId} has been cancelled. Please contact ${phone} if you have any questions or believe this was a mistake.`,
}, ];

export const orderTypeToIndex = {
pickup: 0,
delivery: 1,
};

export const ORDER_TYPE_DELIVERY = 'delivery';
export const ORDER_TYPE_PICKUP = 'pickup';

export const indexToOrderType = [ORDER_TYPE_PICKUP, ORDER_TYPE_DELIVERY];

export const RewardsConnectionStatuses = {
ready: 'ready',
processing: 'processing',
failed: 'failed',
succeeded: 'succeeded',
};

export const RewardsBrands = {
alpineiq: 'alpineiq',
};
Loading

0 comments on commit 5b1c3dc

Please sign in to comment.