@becollective/utils 1.10.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.semaphore/utils.yml +1 -1
- package/index.ts +7 -0
- package/lib/FeatureFlag.d.ts +12 -0
- package/lib/FeatureFlag.js +51 -0
- package/lib/constants/allowedHtmlTags.d.ts +7 -0
- package/lib/constants/allowedHtmlTags.js +8 -0
- package/lib/constants/avatarColours.d.ts +35 -0
- package/lib/constants/avatarColours.js +36 -0
- package/lib/constants/countries.d.ts +253 -0
- package/lib/constants/countries.js +254 -0
- package/lib/constants/currencies.d.ts +29 -0
- package/lib/constants/currencies.js +36 -0
- package/lib/constants/customFields.d.ts +11 -0
- package/lib/constants/customFields.js +12 -0
- package/lib/constants/distancesUnits.d.ts +11 -0
- package/lib/constants/distancesUnits.js +13 -0
- package/lib/constants/groups.d.ts +13 -0
- package/lib/constants/groups.js +85 -0
- package/lib/constants/insuranceStatuses.d.ts +15 -0
- package/lib/constants/insuranceStatuses.js +7 -0
- package/lib/constants/insuranceTypes.d.ts +35 -0
- package/lib/constants/insuranceTypes.js +36 -0
- package/lib/constants/languages.d.ts +2 -0
- package/lib/constants/languages.js +194 -0
- package/lib/constants/locales.d.ts +119 -0
- package/lib/constants/locales.js +191 -0
- package/lib/constants/notifications.d.ts +47 -0
- package/lib/constants/notifications.js +31 -0
- package/lib/constants/opportunities.d.ts +72 -0
- package/lib/constants/opportunities.js +82 -0
- package/lib/constants/qualificationTypes.d.ts +4 -0
- package/lib/constants/qualificationTypes.js +18 -0
- package/lib/constants/rules.d.ts +13 -0
- package/lib/constants/rules.js +21 -0
- package/lib/constants/subscriptions.d.ts +9 -0
- package/lib/constants/subscriptions.js +10 -0
- package/lib/constants/surveys.d.ts +16 -0
- package/lib/constants/surveys.js +17 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +76 -0
- package/lib/date-time.d.ts +28 -0
- package/lib/date-time.js +79 -0
- package/lib/forms.d.ts +1 -0
- package/lib/forms.js +728 -0
- package/lib/locality.d.ts +5 -0
- package/lib/locality.js +15 -0
- package/lib/money.d.ts +7 -0
- package/lib/money.js +32 -0
- package/lib/opportunity.d.ts +1 -0
- package/lib/opportunity.js +11 -0
- package/lib/opportunityUser.d.ts +8 -0
- package/lib/opportunityUser.js +29 -0
- package/lib/password.d.ts +8 -0
- package/lib/password.js +43 -0
- package/lib/rrule/date.d.ts +4 -0
- package/lib/rrule/date.js +30 -0
- package/lib/rrule/index.d.ts +2 -0
- package/lib/rrule/index.js +18 -0
- package/lib/rrule/parsing.d.ts +6 -0
- package/lib/rrule/parsing.js +130 -0
- package/lib/rrule/parsing.test.d.ts +1 -0
- package/lib/rrule/parsing.test.js +11 -0
- package/lib/rrule.d.ts +49 -0
- package/lib/rrule.js +303 -0
- package/lib/src/FeatureFlag.d.ts +12 -0
- package/lib/src/FeatureFlag.js +51 -0
- package/lib/src/date-time.d.ts +28 -0
- package/lib/src/date-time.js +79 -0
- package/lib/src/forms.d.ts +1 -0
- package/lib/src/forms.js +728 -0
- package/lib/src/locality.d.ts +5 -0
- package/lib/src/locality.js +15 -0
- package/lib/src/money.d.ts +7 -0
- package/lib/src/money.js +32 -0
- package/lib/src/opportunity.d.ts +1 -0
- package/lib/src/opportunity.js +11 -0
- package/lib/src/opportunityUser.d.ts +8 -0
- package/lib/src/opportunityUser.js +29 -0
- package/lib/src/password.d.ts +8 -0
- package/lib/src/password.js +43 -0
- package/package.json +15 -29
- package/src/FeatureFlag.ts +26 -10
- package/src/constants/allowedHtmlTags.ts +6 -0
- package/src/constants/avatarColours.ts +34 -0
- package/src/constants/countries.ts +252 -0
- package/src/constants/currencies.ts +33 -0
- package/src/constants/customFields.ts +10 -0
- package/src/constants/distancesUnits.ts +11 -0
- package/src/constants/groups.ts +83 -0
- package/src/constants/insuranceStatuses.ts +5 -0
- package/src/constants/insuranceTypes.ts +34 -0
- package/src/constants/languages.ts +192 -0
- package/src/constants/locales.ts +189 -0
- package/src/constants/notifications.ts +30 -0
- package/src/constants/opportunities.ts +84 -0
- package/src/constants/qualificationTypes.ts +17 -0
- package/src/constants/rules.ts +22 -0
- package/src/constants/subscriptions.ts +8 -0
- package/src/constants/surveys.ts +15 -0
- package/src/constants.ts +40 -0
- package/src/{date-time.js → date-time.ts} +18 -11
- package/src/forms.ts +807 -0
- package/src/{opportunityUser.js → opportunityUser.ts} +5 -1
- package/src/{password.js → password.ts} +2 -0
- package/src/rrule/date.ts +25 -0
- package/src/rrule/index.ts +2 -0
- package/src/rrule/parsing.ts +136 -0
- package/src/rrule.ts +367 -0
- package/tests/{date-time.test.js → date-time.test.ts} +48 -46
- package/tests/featureFlag.test.ts +36 -39
- package/tests/forms.test-data.json +43 -0
- package/tests/forms.test-schema.json +144 -0
- package/tests/forms.test-uischema.json +117 -0
- package/tests/forms.test.ts +674 -0
- package/tests/{money.test.js → money.test.ts} +2 -3
- package/tests/{password.test.js → password.test.ts} +7 -6
- package/tests/rrule/parsing.test.ts +12 -0
- package/tests/rrule.test.ts +625 -0
- package/tsconfig.json +15 -12
- package/bundle.js +0 -270
- package/index.js +0 -25
- package/rollup.config.js +0 -25
- /package/src/{locality.js → locality.ts} +0 -0
- /package/src/{money.js → money.ts} +0 -0
- /package/src/{opportunity.js → opportunity.ts} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHomeLocalityFromLocationList = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Array} locationList
|
|
7
|
+
*/
|
|
8
|
+
const getHomeLocalityFromLocationList = (locationList) => {
|
|
9
|
+
const homeLocation = Array.isArray(locationList) && locationList.find((location) => location.name === 'Home');
|
|
10
|
+
if (homeLocation && homeLocation.locality && homeLocation.locality.long) {
|
|
11
|
+
return homeLocation.locality.long;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
exports.getHomeLocalityFromLocationList = getHomeLocalityFromLocationList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getCurrencyFromCurrencyCode: (currencyCode: any) => any;
|
|
2
|
+
export declare const makeMoneyString: ({ amount: inputAmount, currencyCode, rounded, showCurrencyCode }: {
|
|
3
|
+
amount: any;
|
|
4
|
+
currencyCode: any;
|
|
5
|
+
rounded?: boolean | undefined;
|
|
6
|
+
showCurrencyCode?: boolean | undefined;
|
|
7
|
+
}) => string;
|
package/lib/src/money.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeMoneyString = exports.getCurrencyFromCurrencyCode = void 0;
|
|
4
|
+
const { currencies } = require('@becollective/constants');
|
|
5
|
+
// We should probably throw and error on bad input instead of falling back to a default.
|
|
6
|
+
// We're making an assumption that whoever is calling this function can safely work
|
|
7
|
+
// with AUD. But this assumption removes a lot of error handling elsewhere.
|
|
8
|
+
const getCurrencyFromCurrencyCode = (currencyCode) => {
|
|
9
|
+
if (typeof currencyCode !== 'string' || !currencies[currencyCode]) {
|
|
10
|
+
console.error(new Error(`Invalid currencyCode: ${currencyCode}. Falling back to 'AUD'.`));
|
|
11
|
+
return currencies.AUD;
|
|
12
|
+
}
|
|
13
|
+
return currencies[currencyCode];
|
|
14
|
+
};
|
|
15
|
+
exports.getCurrencyFromCurrencyCode = getCurrencyFromCurrencyCode;
|
|
16
|
+
const makeMoneyString = ({ amount: inputAmount, currencyCode, rounded = false, showCurrencyCode = false }) => {
|
|
17
|
+
let amount = Number(inputAmount);
|
|
18
|
+
if (isNaN(amount)) {
|
|
19
|
+
console.error(new Error(`Invalid amount: ${inputAmount}. Falling back to 0.`));
|
|
20
|
+
amount = 0;
|
|
21
|
+
}
|
|
22
|
+
const currency = (0, exports.getCurrencyFromCurrencyCode)(currencyCode);
|
|
23
|
+
const { minorUnit, symbol } = currency;
|
|
24
|
+
const decimalPlaces = rounded ? 0 : minorUnit;
|
|
25
|
+
const localeAmount = amount.toLocaleString(undefined, {
|
|
26
|
+
minimumFractionDigits: decimalPlaces,
|
|
27
|
+
maximumFractionDigits: decimalPlaces,
|
|
28
|
+
});
|
|
29
|
+
const currencyCodeString = showCurrencyCode ? ` ${currency.code}` : '';
|
|
30
|
+
return `${symbol}${localeAmount}${currencyCodeString}`;
|
|
31
|
+
};
|
|
32
|
+
exports.makeMoneyString = makeMoneyString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readableOpportunityType: (type: any) => string | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readableOpportunityType = void 0;
|
|
4
|
+
const { opportunities } = require('@becollective/constants');
|
|
5
|
+
const { typesMapV2: opportunityTypes } = opportunities;
|
|
6
|
+
const TYPE_MAP = {
|
|
7
|
+
[opportunityTypes.shift]: 'Shifts',
|
|
8
|
+
[opportunityTypes.flexible]: 'Flexible',
|
|
9
|
+
};
|
|
10
|
+
const readableOpportunityType = (type) => TYPE_MAP[type] || null;
|
|
11
|
+
exports.readableOpportunityType = readableOpportunityType;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimeInfo = void 0;
|
|
4
|
+
const pick = (obj, keysToPick = []) => {
|
|
5
|
+
return Object.fromEntries(Object.entries(obj).filter(([key]) => keysToPick.includes(key)));
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {*} opportunityUser
|
|
10
|
+
* @param {*} opportunity
|
|
11
|
+
*/
|
|
12
|
+
const getTimeInfo = (opportunityUser, opportunity = null) => {
|
|
13
|
+
const opp = opportunity || opportunityUser.opportunity;
|
|
14
|
+
const isEoi = (opportunityUser && opportunityUser.eoi) || (opp && opp.eoi);
|
|
15
|
+
const record = isEoi ? opportunityUser : opp;
|
|
16
|
+
const fields = pick(record, [
|
|
17
|
+
'startDate',
|
|
18
|
+
'endDate',
|
|
19
|
+
'type',
|
|
20
|
+
'dates',
|
|
21
|
+
'recurrenceRule',
|
|
22
|
+
'timezone',
|
|
23
|
+
'location',
|
|
24
|
+
'locationOther',
|
|
25
|
+
'locationVirtual',
|
|
26
|
+
]);
|
|
27
|
+
return fields;
|
|
28
|
+
};
|
|
29
|
+
exports.getTimeInfo = getTimeInfo;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.password = void 0;
|
|
4
|
+
exports.password = {
|
|
5
|
+
hasUppercase: (input) => {
|
|
6
|
+
return !!input.match(/[A-Z]/);
|
|
7
|
+
},
|
|
8
|
+
hasLowerCase: (input) => {
|
|
9
|
+
return !!input.match(/[a-z]/);
|
|
10
|
+
},
|
|
11
|
+
hasNumeral: (input) => {
|
|
12
|
+
return !!input.match(/[0-9]/);
|
|
13
|
+
},
|
|
14
|
+
validate: (input) => {
|
|
15
|
+
if (typeof input !== 'string') {
|
|
16
|
+
throw new Error('not-string');
|
|
17
|
+
}
|
|
18
|
+
else if (input.length < 12) {
|
|
19
|
+
throw new Error('invalid-length');
|
|
20
|
+
}
|
|
21
|
+
let rules = 0;
|
|
22
|
+
if (exports.password.hasUppercase(input))
|
|
23
|
+
rules++;
|
|
24
|
+
if (exports.password.hasLowerCase(input))
|
|
25
|
+
rules++;
|
|
26
|
+
if (exports.password.hasNumeral(input))
|
|
27
|
+
rules++;
|
|
28
|
+
if (rules < 3) {
|
|
29
|
+
throw new Error('invalid-minimum-rules');
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
isValid: (input) => {
|
|
34
|
+
try {
|
|
35
|
+
exports.password.validate(input);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.default = exports.password;
|
package/package.json
CHANGED
|
@@ -1,46 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@becollective/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Common utilities",
|
|
5
5
|
"main": "bundle.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "npm run build && NODE_ENV=localtest jest --config jestconfig.json --detectOpenHandles --verbose --forceExit",
|
|
8
|
-
"build": "
|
|
8
|
+
"build": "tsc",
|
|
9
9
|
"prepare": "npm run build"
|
|
10
10
|
},
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"@types/pino": "^5.8.12",
|
|
23
|
-
"jest": "^24.9.0",
|
|
24
|
-
"prettier": "^1.18.2",
|
|
25
|
-
"rollup": "^2.47.0",
|
|
26
|
-
"rollup-plugin-babel": "^4.0.3",
|
|
27
|
-
"rollup-plugin-node-resolve": "^3.4.0",
|
|
28
|
-
"ts-jest": "^24.3.0",
|
|
29
|
-
"tslint": "^5.20.0",
|
|
14
|
+
"@types/jest": "^30.0.0",
|
|
15
|
+
"@types/mongodb": "^4.0.7",
|
|
16
|
+
"@types/node": "^25.6.0",
|
|
17
|
+
"@types/pino": "^7.0.5",
|
|
18
|
+
"jest": "^30.3.0",
|
|
19
|
+
"prettier": "^3.8.3",
|
|
20
|
+
"ts-jest": "^29.4.9",
|
|
21
|
+
"tslint": "^6.1.3",
|
|
30
22
|
"tslint-config-prettier": "^1.18.0",
|
|
31
|
-
"typescript": "^
|
|
23
|
+
"typescript": "^6.0.3"
|
|
32
24
|
},
|
|
33
25
|
"dependencies": {
|
|
34
26
|
"@becollective/constants": "^3.11.0",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"axios": "^0.21.1",
|
|
42
|
-
"lodash": "^4.17.15",
|
|
43
|
-
"moment": "^2.24.0",
|
|
44
|
-
"moment-timezone": "^0.5.26"
|
|
27
|
+
"ajv": "^8.20.0",
|
|
28
|
+
"libphonenumber-js": "^1.13.5",
|
|
29
|
+
"luxon": "^3.7.2",
|
|
30
|
+
"rrule": "^2.8.1"
|
|
45
31
|
}
|
|
46
32
|
}
|
package/src/FeatureFlag.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type Cache = {
|
|
2
|
+
store: Map<string, string>;
|
|
3
|
+
memoize: Function;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const cache: Cache = {
|
|
7
|
+
store: new Map(),
|
|
8
|
+
memoize: async (feature, options) => {
|
|
9
|
+
const stringified = JSON.stringify({ feature, options });
|
|
10
|
+
const response = cache.store.get(stringified);
|
|
11
|
+
if(response) {
|
|
12
|
+
return JSON.parse(response);
|
|
13
|
+
}
|
|
14
|
+
const fetchResponse = await fetchFeatureActive(feature, options);
|
|
15
|
+
cache.store.set(stringified, JSON.stringify(fetchResponse));
|
|
16
|
+
return fetchResponse;
|
|
17
|
+
},
|
|
18
|
+
}
|
|
3
19
|
|
|
4
20
|
const fetchFeatureActive = async (feature: string, options: { env: string; region?: string }): Promise<boolean> => {
|
|
5
21
|
const getFlagByFeatureUrl = `https://lb-central.becollective.com/api/v2/feature-flags/${feature}`;
|
|
6
22
|
let isFeatureActive = false;
|
|
7
|
-
const featureFlags = await
|
|
8
|
-
const
|
|
23
|
+
const featureFlags = await fetch(getFlagByFeatureUrl, { method: 'get' });
|
|
24
|
+
const json: any = await featureFlags.json();
|
|
25
|
+
const environments = json.Environments;
|
|
9
26
|
if (environments) {
|
|
10
27
|
isFeatureActive = environments.includes(options.env);
|
|
11
28
|
}
|
|
12
29
|
return isFeatureActive;
|
|
13
30
|
};
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class FeatureFlag {
|
|
32
|
+
export class FeatureFlag {
|
|
18
33
|
ttl: number;
|
|
19
34
|
expiry: number;
|
|
20
35
|
constructor(ttl?) {
|
|
@@ -25,13 +40,14 @@ class FeatureFlag {
|
|
|
25
40
|
// Lazy expiration upon function call
|
|
26
41
|
const now = Date.now();
|
|
27
42
|
if (now >= this.expiry) {
|
|
28
|
-
|
|
43
|
+
cache.store.clear();
|
|
29
44
|
this.expiry = now + this.ttl;
|
|
30
45
|
}
|
|
31
|
-
|
|
46
|
+
|
|
47
|
+
return cache.memoize(feature, options);
|
|
32
48
|
}
|
|
33
49
|
clearCache() {
|
|
34
|
-
|
|
50
|
+
cache.store.clear();
|
|
35
51
|
}
|
|
36
52
|
setCacheTtl(ttl: number) {
|
|
37
53
|
this.ttl = ttl;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
watusi: {
|
|
3
|
+
backgroundColour: '#f5d0b9',
|
|
4
|
+
textColour: '#845235',
|
|
5
|
+
},
|
|
6
|
+
hawkesBlue: {
|
|
7
|
+
backgroundColour: '#f6dae4',
|
|
8
|
+
textColour: '#8b4960',
|
|
9
|
+
},
|
|
10
|
+
botticelli: {
|
|
11
|
+
backgroundColour: '#cedde9',
|
|
12
|
+
textColour: '#46637d',
|
|
13
|
+
},
|
|
14
|
+
surfCrest: {
|
|
15
|
+
backgroundColour: '#c8d8c2',
|
|
16
|
+
textColour: '#49623f',
|
|
17
|
+
},
|
|
18
|
+
quarterSpanishWhite: {
|
|
19
|
+
backgroundColour: '#e9e0d2',
|
|
20
|
+
textColour: '#7a6114',
|
|
21
|
+
},
|
|
22
|
+
buttermilk: {
|
|
23
|
+
backgroundColour: '#f1e0ab',
|
|
24
|
+
textColour: '#635429',
|
|
25
|
+
},
|
|
26
|
+
fog: {
|
|
27
|
+
backgroundColour: '#e0d8ee',
|
|
28
|
+
textColour: '#625082',
|
|
29
|
+
},
|
|
30
|
+
mabel: {
|
|
31
|
+
backgroundColour: '#c1e6e5',
|
|
32
|
+
textColour: '#426968',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
BD: 'Bangladesh',
|
|
3
|
+
BE: 'Belgium',
|
|
4
|
+
BF: 'Burkina Faso',
|
|
5
|
+
BG: 'Bulgaria',
|
|
6
|
+
BA: 'Bosnia and Herzegovina',
|
|
7
|
+
BB: 'Barbados',
|
|
8
|
+
WF: 'Wallis and Futuna',
|
|
9
|
+
BL: 'Saint Barthelemy',
|
|
10
|
+
BM: 'Bermuda',
|
|
11
|
+
BN: 'Brunei',
|
|
12
|
+
BO: 'Bolivia',
|
|
13
|
+
BH: 'Bahrain',
|
|
14
|
+
BI: 'Burundi',
|
|
15
|
+
BJ: 'Benin',
|
|
16
|
+
BT: 'Bhutan',
|
|
17
|
+
JM: 'Jamaica',
|
|
18
|
+
BV: 'Bouvet Island',
|
|
19
|
+
BW: 'Botswana',
|
|
20
|
+
WS: 'Samoa',
|
|
21
|
+
BQ: 'Bonaire, Saint Eustatius and Saba ',
|
|
22
|
+
BR: 'Brazil',
|
|
23
|
+
BS: 'Bahamas',
|
|
24
|
+
JE: 'Jersey',
|
|
25
|
+
BY: 'Belarus',
|
|
26
|
+
BZ: 'Belize',
|
|
27
|
+
RU: 'Russia',
|
|
28
|
+
RW: 'Rwanda',
|
|
29
|
+
RS: 'Serbia',
|
|
30
|
+
TL: 'East Timor',
|
|
31
|
+
RE: 'Reunion',
|
|
32
|
+
TM: 'Turkmenistan',
|
|
33
|
+
TJ: 'Tajikistan',
|
|
34
|
+
RO: 'Romania',
|
|
35
|
+
TK: 'Tokelau',
|
|
36
|
+
GW: 'Guinea-Bissau',
|
|
37
|
+
GU: 'Guam',
|
|
38
|
+
GT: 'Guatemala',
|
|
39
|
+
GS: 'South Georgia and the South Sandwich Islands',
|
|
40
|
+
GR: 'Greece',
|
|
41
|
+
GQ: 'Equatorial Guinea',
|
|
42
|
+
GP: 'Guadeloupe',
|
|
43
|
+
JP: 'Japan',
|
|
44
|
+
GY: 'Guyana',
|
|
45
|
+
GG: 'Guernsey',
|
|
46
|
+
GF: 'French Guiana',
|
|
47
|
+
GE: 'Georgia',
|
|
48
|
+
GD: 'Grenada',
|
|
49
|
+
GB: 'United Kingdom',
|
|
50
|
+
GA: 'Gabon',
|
|
51
|
+
SV: 'El Salvador',
|
|
52
|
+
GN: 'Guinea',
|
|
53
|
+
GM: 'Gambia',
|
|
54
|
+
GL: 'Greenland',
|
|
55
|
+
GI: 'Gibraltar',
|
|
56
|
+
GH: 'Ghana',
|
|
57
|
+
OM: 'Oman',
|
|
58
|
+
TN: 'Tunisia',
|
|
59
|
+
JO: 'Jordan',
|
|
60
|
+
HR: 'Croatia',
|
|
61
|
+
HT: 'Haiti',
|
|
62
|
+
HU: 'Hungary',
|
|
63
|
+
HK: 'Hong Kong',
|
|
64
|
+
HN: 'Honduras',
|
|
65
|
+
HM: 'Heard Island and McDonald Islands',
|
|
66
|
+
VE: 'Venezuela',
|
|
67
|
+
PR: 'Puerto Rico',
|
|
68
|
+
PS: 'Palestinian Territory',
|
|
69
|
+
PW: 'Palau',
|
|
70
|
+
PT: 'Portugal',
|
|
71
|
+
SJ: 'Svalbard and Jan Mayen',
|
|
72
|
+
PY: 'Paraguay',
|
|
73
|
+
IQ: 'Iraq',
|
|
74
|
+
PA: 'Panama',
|
|
75
|
+
PF: 'French Polynesia',
|
|
76
|
+
PG: 'Papua New Guinea',
|
|
77
|
+
PE: 'Peru',
|
|
78
|
+
PK: 'Pakistan',
|
|
79
|
+
PH: 'Philippines',
|
|
80
|
+
PN: 'Pitcairn',
|
|
81
|
+
PL: 'Poland',
|
|
82
|
+
PM: 'Saint Pierre and Miquelon',
|
|
83
|
+
ZM: 'Zambia',
|
|
84
|
+
EH: 'Western Sahara',
|
|
85
|
+
EE: 'Estonia',
|
|
86
|
+
EG: 'Egypt',
|
|
87
|
+
ZA: 'South Africa',
|
|
88
|
+
EC: 'Ecuador',
|
|
89
|
+
IT: 'Italy',
|
|
90
|
+
VN: 'Vietnam',
|
|
91
|
+
SB: 'Solomon Islands',
|
|
92
|
+
ET: 'Ethiopia',
|
|
93
|
+
SO: 'Somalia',
|
|
94
|
+
ZW: 'Zimbabwe',
|
|
95
|
+
SA: 'Saudi Arabia',
|
|
96
|
+
ES: 'Spain',
|
|
97
|
+
ER: 'Eritrea',
|
|
98
|
+
ME: 'Montenegro',
|
|
99
|
+
MD: 'Moldova',
|
|
100
|
+
MG: 'Madagascar',
|
|
101
|
+
MF: 'Saint Martin',
|
|
102
|
+
MA: 'Morocco',
|
|
103
|
+
MC: 'Monaco',
|
|
104
|
+
UZ: 'Uzbekistan',
|
|
105
|
+
MM: 'Myanmar',
|
|
106
|
+
ML: 'Mali',
|
|
107
|
+
MO: 'Macao',
|
|
108
|
+
MN: 'Mongolia',
|
|
109
|
+
MH: 'Marshall Islands',
|
|
110
|
+
MK: 'Macedonia',
|
|
111
|
+
MU: 'Mauritius',
|
|
112
|
+
MT: 'Malta',
|
|
113
|
+
MW: 'Malawi',
|
|
114
|
+
MV: 'Maldives',
|
|
115
|
+
MQ: 'Martinique',
|
|
116
|
+
MP: 'Northern Mariana Islands',
|
|
117
|
+
MS: 'Montserrat',
|
|
118
|
+
MR: 'Mauritania',
|
|
119
|
+
IM: 'Isle of Man',
|
|
120
|
+
UG: 'Uganda',
|
|
121
|
+
TZ: 'Tanzania',
|
|
122
|
+
MY: 'Malaysia',
|
|
123
|
+
MX: 'Mexico',
|
|
124
|
+
IL: 'Israel',
|
|
125
|
+
FR: 'France',
|
|
126
|
+
IO: 'British Indian Ocean Territory',
|
|
127
|
+
SH: 'Saint Helena',
|
|
128
|
+
FI: 'Finland',
|
|
129
|
+
FJ: 'Fiji',
|
|
130
|
+
FK: 'Falkland Islands',
|
|
131
|
+
FM: 'Micronesia',
|
|
132
|
+
FO: 'Faroe Islands',
|
|
133
|
+
NI: 'Nicaragua',
|
|
134
|
+
NL: 'Netherlands',
|
|
135
|
+
NO: 'Norway',
|
|
136
|
+
NA: 'Namibia',
|
|
137
|
+
VU: 'Vanuatu',
|
|
138
|
+
NC: 'New Caledonia',
|
|
139
|
+
NE: 'Niger',
|
|
140
|
+
NF: 'Norfolk Island',
|
|
141
|
+
NG: 'Nigeria',
|
|
142
|
+
NZ: 'New Zealand',
|
|
143
|
+
NP: 'Nepal',
|
|
144
|
+
NR: 'Nauru',
|
|
145
|
+
NU: 'Niue',
|
|
146
|
+
CK: 'Cook Islands',
|
|
147
|
+
XK: 'Kosovo',
|
|
148
|
+
CI: 'Ivory Coast',
|
|
149
|
+
CH: 'Switzerland',
|
|
150
|
+
CO: 'Colombia',
|
|
151
|
+
CN: 'China',
|
|
152
|
+
CM: 'Cameroon',
|
|
153
|
+
CL: 'Chile',
|
|
154
|
+
CC: 'Cocos Islands',
|
|
155
|
+
CA: 'Canada',
|
|
156
|
+
CG: 'Republic of the Congo',
|
|
157
|
+
CF: 'Central African Republic',
|
|
158
|
+
CD: 'Democratic Republic of the Congo',
|
|
159
|
+
CZ: 'Czech Republic',
|
|
160
|
+
CY: 'Cyprus',
|
|
161
|
+
CX: 'Christmas Island',
|
|
162
|
+
CR: 'Costa Rica',
|
|
163
|
+
CW: 'Curacao',
|
|
164
|
+
CV: 'Cape Verde',
|
|
165
|
+
CU: 'Cuba',
|
|
166
|
+
SZ: 'Swaziland',
|
|
167
|
+
SY: 'Syria',
|
|
168
|
+
SX: 'Sint Maarten',
|
|
169
|
+
KG: 'Kyrgyzstan',
|
|
170
|
+
KE: 'Kenya',
|
|
171
|
+
SS: 'South Sudan',
|
|
172
|
+
SR: 'Suriname',
|
|
173
|
+
KI: 'Kiribati',
|
|
174
|
+
KH: 'Cambodia',
|
|
175
|
+
KN: 'Saint Kitts and Nevis',
|
|
176
|
+
KM: 'Comoros',
|
|
177
|
+
ST: 'Sao Tome and Principe',
|
|
178
|
+
SK: 'Slovakia',
|
|
179
|
+
KR: 'South Korea',
|
|
180
|
+
SI: 'Slovenia',
|
|
181
|
+
KP: 'North Korea',
|
|
182
|
+
KW: 'Kuwait',
|
|
183
|
+
SN: 'Senegal',
|
|
184
|
+
SM: 'San Marino',
|
|
185
|
+
SL: 'Sierra Leone',
|
|
186
|
+
SC: 'Seychelles',
|
|
187
|
+
KZ: 'Kazakhstan',
|
|
188
|
+
KY: 'Cayman Islands',
|
|
189
|
+
SG: 'Singapore',
|
|
190
|
+
SE: 'Sweden',
|
|
191
|
+
SD: 'Sudan',
|
|
192
|
+
DO: 'Dominican Republic',
|
|
193
|
+
DM: 'Dominica',
|
|
194
|
+
DJ: 'Djibouti',
|
|
195
|
+
DK: 'Denmark',
|
|
196
|
+
VG: 'British Virgin Islands',
|
|
197
|
+
DE: 'Germany',
|
|
198
|
+
YE: 'Yemen',
|
|
199
|
+
DZ: 'Algeria',
|
|
200
|
+
US: 'United States',
|
|
201
|
+
UY: 'Uruguay',
|
|
202
|
+
YT: 'Mayotte',
|
|
203
|
+
UM: 'United States Minor Outlying Islands',
|
|
204
|
+
LB: 'Lebanon',
|
|
205
|
+
LC: 'Saint Lucia',
|
|
206
|
+
LA: 'Laos',
|
|
207
|
+
TV: 'Tuvalu',
|
|
208
|
+
TW: 'Taiwan',
|
|
209
|
+
TT: 'Trinidad and Tobago',
|
|
210
|
+
TR: 'Turkey',
|
|
211
|
+
LK: 'Sri Lanka',
|
|
212
|
+
LI: 'Liechtenstein',
|
|
213
|
+
LV: 'Latvia',
|
|
214
|
+
TO: 'Tonga',
|
|
215
|
+
LT: 'Lithuania',
|
|
216
|
+
LU: 'Luxembourg',
|
|
217
|
+
LR: 'Liberia',
|
|
218
|
+
LS: 'Lesotho',
|
|
219
|
+
TH: 'Thailand',
|
|
220
|
+
TF: 'French Southern Territories',
|
|
221
|
+
TG: 'Togo',
|
|
222
|
+
TD: 'Chad',
|
|
223
|
+
TC: 'Turks and Caicos Islands',
|
|
224
|
+
LY: 'Libya',
|
|
225
|
+
VA: 'Vatican',
|
|
226
|
+
VC: 'Saint Vincent and the Grenadines',
|
|
227
|
+
AE: 'United Arab Emirates',
|
|
228
|
+
AD: 'Andorra',
|
|
229
|
+
AG: 'Antigua and Barbuda',
|
|
230
|
+
AF: 'Afghanistan',
|
|
231
|
+
AI: 'Anguilla',
|
|
232
|
+
VI: 'U.S. Virgin Islands',
|
|
233
|
+
IS: 'Iceland',
|
|
234
|
+
IR: 'Iran',
|
|
235
|
+
AM: 'Armenia',
|
|
236
|
+
AL: 'Albania',
|
|
237
|
+
AO: 'Angola',
|
|
238
|
+
AQ: 'Antarctica',
|
|
239
|
+
AS: 'American Samoa',
|
|
240
|
+
AR: 'Argentina',
|
|
241
|
+
AU: 'Australia',
|
|
242
|
+
AT: 'Austria',
|
|
243
|
+
AW: 'Aruba',
|
|
244
|
+
IN: 'India',
|
|
245
|
+
AX: 'Aland Islands',
|
|
246
|
+
AZ: 'Azerbaijan',
|
|
247
|
+
IE: 'Ireland',
|
|
248
|
+
ID: 'Indonesia',
|
|
249
|
+
UA: 'Ukraine',
|
|
250
|
+
QA: 'Qatar',
|
|
251
|
+
MZ: 'Mozambique',
|
|
252
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import getSymbol from 'currency-symbol-map';
|
|
2
|
+
|
|
3
|
+
// ISO reference: https://www.currency-iso.org/en/home/tables/table-a1.html. This is what Intl.NumberFormat() uses.
|
|
4
|
+
|
|
5
|
+
// These are the currently supported currencies on our platform
|
|
6
|
+
export default {
|
|
7
|
+
AUD: {
|
|
8
|
+
code: 'AUD',
|
|
9
|
+
name: 'Australian Dollar',
|
|
10
|
+
minorUnit: 2, // The number of digits after the decimal separator.
|
|
11
|
+
symbol: getSymbol('AUD'),
|
|
12
|
+
prefix: 'A', // To identify which currency when use the same symbol
|
|
13
|
+
},
|
|
14
|
+
NZD: {
|
|
15
|
+
code: 'NZD',
|
|
16
|
+
name: 'New Zealand Dollar',
|
|
17
|
+
minorUnit: 2,
|
|
18
|
+
symbol: getSymbol('NZD'),
|
|
19
|
+
prefix: 'NZ',
|
|
20
|
+
},
|
|
21
|
+
GBP: {
|
|
22
|
+
code: 'GBP',
|
|
23
|
+
name: 'Pound Sterling',
|
|
24
|
+
minorUnit: 2,
|
|
25
|
+
symbol: getSymbol('GBP'),
|
|
26
|
+
},
|
|
27
|
+
EUR: {
|
|
28
|
+
code: 'EUR',
|
|
29
|
+
name: 'Euro',
|
|
30
|
+
minorUnit: 2,
|
|
31
|
+
symbol: getSymbol('EUR'),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
maxMongoStringLength: 4096, // https://github.com/mongodb/mongo/blob/master/src/mongo/shell/linenoise.cpp#L145
|
|
3
|
+
maxFileSizeBytes: 16000000, // 16 MB https://docs.mongodb.com/manual/reference/limits/
|
|
4
|
+
emailReferenceHeadingString: 'Email (ref.)',
|
|
5
|
+
uploadBatchSize: 25,
|
|
6
|
+
fNameReferenceHeadingString: 'First name (ref.)',
|
|
7
|
+
lNameReferenceHeadingString: 'Last name (ref.)',
|
|
8
|
+
maxNumberOfRows: 501, // 500 rows + headings row
|
|
9
|
+
templateFileName: 'Custom_Fields_Template.csv', // should end in .csv
|
|
10
|
+
};
|