@natch-the-storage/heathershaw-platform-types 1.18.13 → 1.18.15
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/build/validators.d.ts +20 -1
- package/build/validators.js +38 -0
- package/package.json +1 -1
package/build/validators.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const cDProductCategoryIdValues: readonly ["schedule_1", "schedul
|
|
|
3
3
|
export declare const logItemTypeValues: readonly ["CREATED", "CREATED_PAID", "UPDATED", "UPDATED_DRAFT", "MARKED_FOR_PICKUP", "CANCELLED", "PAYMENT_LINK_PHONE", "PAYMENT_LINK_EMAIL", "PAYMENT_LINK_BOTH", "PARTNER_ORDERED_INVOICE", "PARTNER_ORDERED_POS", "PAID", "MARKED_PAID", "PAYMENT_LINK_PAID"];
|
|
4
4
|
export declare const orderFulfillmentValues: readonly ["PICKUP", "POST", "COURIER", "DELIVER"];
|
|
5
5
|
export declare const orderStatusValues: readonly ["TO_REVIEW", "AWAITING_PICKUP", "POSTED", "IN_TRANSIT", "DELIVERED", "COLLECTED", "CANCELLED"];
|
|
6
|
-
export declare const orderTypeValues: readonly ["CG", "MC"];
|
|
6
|
+
export declare const orderTypeValues: readonly ["CG", "MC", "HS"];
|
|
7
7
|
export declare const patientRecordSubAccountRelationshipValues: readonly ["Child", "Spouse", "Parent", "Pet", "Other"];
|
|
8
8
|
export declare const paperScriptReminderStatusValues: readonly ["PENDING", "RECEIVED", "ESCALATED"];
|
|
9
9
|
export declare const quoteStatusValues: readonly ["PENDING", "RESOLVED", "DECLINED"];
|
|
@@ -83,13 +83,32 @@ export declare function getCurrentIsoTimestamp(): string;
|
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
85
|
export declare function formatDate(dateStr?: string | null, toDmy?: boolean): string;
|
|
86
|
+
/**
|
|
87
|
+
* Formats a date into a readable format
|
|
88
|
+
* @param date typically in ISO format - (yyyy-mm-ddThh:mm:sszz)
|
|
89
|
+
* @param time adds the time to the string
|
|
90
|
+
* @param toDmy format the date as dd/mm/yyyy instead
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatIsoTimestamp({ date, time, toDmy, }: {
|
|
94
|
+
date: string;
|
|
95
|
+
time?: boolean;
|
|
96
|
+
toDmy?: boolean;
|
|
97
|
+
}): string;
|
|
86
98
|
/**
|
|
87
99
|
* Gets the age in years based on todays date vs the date of birth
|
|
88
100
|
* @param dateOfBirth An isoDate (yyyy-mm-dd) string
|
|
89
101
|
* @returns The age in years
|
|
90
102
|
*/
|
|
91
103
|
export declare function getAge(dateOfBirth: string): number;
|
|
104
|
+
/**
|
|
105
|
+
* Formats an address object into a human readable format
|
|
106
|
+
*/
|
|
92
107
|
export declare function formatAddress(addr: Address): string;
|
|
108
|
+
/**
|
|
109
|
+
* Formats an address object into a human readable format
|
|
110
|
+
*/
|
|
111
|
+
export declare function formatOrderId(o: Pick<Order, 'id' | 'type'>): string;
|
|
93
112
|
export interface Address {
|
|
94
113
|
street: string;
|
|
95
114
|
suburb: string;
|
package/build/validators.js
CHANGED
|
@@ -46,6 +46,7 @@ export const orderStatusValues = [
|
|
|
46
46
|
export const orderTypeValues = [
|
|
47
47
|
'CG' /** compounding order */,
|
|
48
48
|
'MC' /** cannabis order */,
|
|
49
|
+
'HS' /** fallback */,
|
|
49
50
|
];
|
|
50
51
|
export const patientRecordSubAccountRelationshipValues = [
|
|
51
52
|
'Child',
|
|
@@ -243,6 +244,34 @@ export function formatDate(dateStr, toDmy) {
|
|
|
243
244
|
year: 'numeric',
|
|
244
245
|
});
|
|
245
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Formats a date into a readable format
|
|
249
|
+
* @param date typically in ISO format - (yyyy-mm-ddThh:mm:sszz)
|
|
250
|
+
* @param time adds the time to the string
|
|
251
|
+
* @param toDmy format the date as dd/mm/yyyy instead
|
|
252
|
+
* @returns
|
|
253
|
+
*/
|
|
254
|
+
export function formatIsoTimestamp({ date, time, toDmy, }) {
|
|
255
|
+
const d = new Date(date);
|
|
256
|
+
if (toDmy) {
|
|
257
|
+
return d.toLocaleDateString('en-AU', {
|
|
258
|
+
day: '2-digit',
|
|
259
|
+
month: '2-digit',
|
|
260
|
+
year: 'numeric',
|
|
261
|
+
hour: time ? '2-digit' : undefined,
|
|
262
|
+
minute: time ? '2-digit' : undefined,
|
|
263
|
+
timeZone: '+11',
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return d.toLocaleDateString('en-AU', {
|
|
267
|
+
day: '2-digit',
|
|
268
|
+
month: 'short',
|
|
269
|
+
year: 'numeric',
|
|
270
|
+
hour: time ? '2-digit' : undefined,
|
|
271
|
+
minute: time ? '2-digit' : undefined,
|
|
272
|
+
timeZone: '+11',
|
|
273
|
+
});
|
|
274
|
+
}
|
|
246
275
|
/**
|
|
247
276
|
* Gets the age in years based on todays date vs the date of birth
|
|
248
277
|
* @param dateOfBirth An isoDate (yyyy-mm-dd) string
|
|
@@ -258,9 +287,18 @@ export function getAge(dateOfBirth) {
|
|
|
258
287
|
age -= 1;
|
|
259
288
|
return age;
|
|
260
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Formats an address object into a human readable format
|
|
292
|
+
*/
|
|
261
293
|
export function formatAddress(addr) {
|
|
262
294
|
return `${addr.street}, ${addr.suburb} ${addr.state} ${addr.postcode}`;
|
|
263
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Formats an address object into a human readable format
|
|
298
|
+
*/
|
|
299
|
+
export function formatOrderId(o) {
|
|
300
|
+
return `#${o.id}-${o.type ?? 'HS'}`;
|
|
301
|
+
}
|
|
264
302
|
//#endregion ──────────────────────────────────────────────────────────────────────
|
|
265
303
|
//#region compound direct ────────────────────────────────────────────────────────────
|
|
266
304
|
export const CDProductCategoriesIdLabel = cDProductCategoryIdValues.map((v, i) => {
|