@star-insure/sdk 0.3.5 → 0.3.8
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/dist/lib/dates.d.ts +1 -1
- package/dist/sdk.cjs.development.js +7 -2
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +7 -2
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/models/sms-messages/SmsContentOption.d.ts +7 -0
- package/dist/types/models/sms-messages/SmsMessage.d.ts +4 -4
- package/dist/types/models/sms-messages/SmsMessageReply.d.ts +2 -2
- package/dist/types/models/sms-messages/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/dates.ts +3 -2
- package/src/types/models/sms-messages/SmsContentOption.ts +7 -0
- package/src/types/models/sms-messages/SmsMessage.ts +4 -4
- package/src/types/models/sms-messages/SmsMessageReply.ts +2 -2
- package/src/types/models/sms-messages/index.ts +1 -0
package/dist/lib/dates.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare function formatDateNice(date: string): string;
|
|
|
5
5
|
/**
|
|
6
6
|
* Formats a date like "01/01/2022 9:50AM"
|
|
7
7
|
*/
|
|
8
|
-
export declare function formatDateForTable(date: string): string;
|
|
8
|
+
export declare function formatDateForTable(date: string, includeTime?: boolean): string;
|
|
@@ -15,8 +15,13 @@ function formatDateNice(date) {
|
|
|
15
15
|
* Formats a date like "01/01/2022 9:50AM"
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
function formatDateForTable(date) {
|
|
19
|
-
|
|
18
|
+
function formatDateForTable(date, includeTime) {
|
|
19
|
+
if (includeTime === void 0) {
|
|
20
|
+
includeTime = true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';
|
|
24
|
+
return dateFns.format(new Date(date), formatString);
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.cjs.development.js","sources":["../src/lib/dates.ts","../src/lib/money.ts","../src/lib/vehicles.ts"],"sourcesContent":["import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string) {\n
|
|
1
|
+
{"version":3,"file":"sdk.cjs.development.js","sources":["../src/lib/dates.ts","../src/lib/money.ts","../src/lib/vehicles.ts"],"sourcesContent":["import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string, includeTime: boolean = true) {\n const formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';\n return format(new Date(date), formatString);\n}\n","/**\n * Safely rounds a number\n */\nexport function round(value: number): number {\n return Number(Math.round(parseFloat(value + 'e' + 2)) + 'e-' + 2)\n}\n\n/**\n * Gets the GST value from a number\n */\nexport function getGst(value: number): number {\n return round(value * 3 / 23);\n}\n\n/**\n * Adds GST to a number\n */\nexport function addGst(value: number): number {\n return round(value * 1.15);\n}\n\n/**\n * Subtracts GST from a number\n */\nexport function subtractGst(value: number): number {\n return round(value - getGst(value));\n}\n\n/**\n * Calculates the various GST values on a figure\n */\nexport function gstCalc(input: number|string): {\n gst: number,\n amountInclusive: number,\n amountExclusive: number\n} {\n let value = input;\n\n if (typeof value === 'string') {\n value = parseFloat(value.replace(/[^0-9.]/g, ''));\n }\n\n value = round(value);\n\n return {\n gst: getGst(value),\n amountInclusive: addGst(value),\n amountExclusive: subtractGst(value)\n }\n}\n\n/**\n * Formats a value nicely\n */\n export function formatMoney(value: string|number, decimals: number = 2): string {\n let toFormat = value;\n if (typeof value === 'string') {\n toFormat = value.replace(/[^\\d.-]/g, '')\n }\n\n return Number(toFormat).toLocaleString('en', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n}\n\n/**\n * Turns a formatted value in to a float\n */\nexport function formatNumber(value: string): number {\n return parseFloat(value.replace(/[^0-9.]/g, ''));\n}\n","import { VehicleType } from \"../types\";\n\nexport function sanitiseVehicleType(inputType: string): VehicleType {\n let type: VehicleType;\n\n switch (inputType) {\n case 'TRAILER_CARAVAN':\n case 'TRAILER_NOT_DESIGNED_FOR_HIGHWAY_USE':\n case 'MOBILE_MACHINE':\n case 'GOODS_VAN_TRUCK_UTILITY':\n case 'BUS':\n case 'MOTOR_CARAVAN': {\n type = 'motorhome';\n break;\n }\n case 'MOTORCYCLE':\n case 'ATV':\n case 'MOPED':\n case 'TRACTOR':\n case 'AGRICULTURAL_MACHINE':\n case 'HIGH_SPEED_AGRICULTURAL_VEHICLE': {\n type = 'motorcycle';\n break;\n }\n case 'PASSENGER_CAR_VAN':\n case 'SPECIAL_PURPOSE_VEHICLE':\n case 'UNKNOWN':\n default:\n type = 'car';\n }\n\n return type;\n}\n"],"names":["formatDateNice","date","format","Date","formatDateForTable","includeTime","formatString","round","value","Number","Math","parseFloat","getGst","addGst","subtractGst","gstCalc","input","replace","gst","amountInclusive","amountExclusive","formatMoney","decimals","toFormat","toLocaleString","minimumFractionDigits","maximumFractionDigits","formatNumber","sanitiseVehicleType","inputType","type"],"mappings":";;;;;;AAEA;;;;SAGgBA,eAAeC;EAC3B,OAAOC,cAAM,CAAC,IAAIC,IAAJ,CAASF,IAAT,CAAD,EAAiB,aAAjB,CAAb;AACH;AAED;;;;SAGgBG,mBAAmBH,MAAcI;MAAAA;IAAAA,cAAuB;;;EACpE,IAAMC,YAAY,GAAGD,WAAW,GAAG,kBAAH,GAAwB,YAAxD;EACA,OAAOH,cAAM,CAAC,IAAIC,IAAJ,CAASF,IA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BAAqB,EAAEJ;GAFpB,CAAP;AAIH;AAED;;;;AAGA,SAAgBK,aAAanB;EACzB,OAAOG,UAAU,CAACH,KAAK,CAACS,OAAN,CAAc,UAAd,EAA0B,EAA1B,CAAD,CAAjB;AACH;;SCrEeW,oBAAoBC;EAChC,IAAIC,IAAJ;;EAEA,QAAQD,SAAR;IACI,KAAK,iBAAL;IACA,KAAK,sCAAL;IACA,KAAK,gBAAL;IACA,KAAK,yBAAL;IACA,KAAK,KAAL;IACA,KAAK,eAAL;MAAsB;QAClBC,IAAI,GAAG,WAAP;QACA;;;IAEJ,KAAK,YAAL;IACA,KAAK,KAAL;IACA,KAAK,OAAL;IACA,KAAK,SAAL;IACA,KAAK,sBAAL;IACA,KAAK,iCAAL;MAAwC;QACpCA,IAAI,GAAG,YAAP;QACA;;;IAEJ,KAAK,mBAAL;IACA,KAAK,yBAAL;IACA,KAAK,SAAL;IACA;MACIA,IAAI,GAAG,KAAP;;;EAGR,OAAOA,IAAP;AACH;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("date-fns");function t(e){return Number(Math.round(parseFloat(e+"e2"))+"e-2")}function r(e){return t(3*e/23)}function a(e){return t(1.15*e)}function o(e){return t(e-r(e))}exports.addGst=a,exports.formatDateForTable=function(t){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("date-fns");function t(e){return Number(Math.round(parseFloat(e+"e2"))+"e-2")}function r(e){return t(3*e/23)}function a(e){return t(1.15*e)}function o(e){return t(e-r(e))}exports.addGst=a,exports.formatDateForTable=function(t,r){void 0===r&&(r=!0);var a=r?"dd/MM/yyyy h:mma":"dd/MM/yyyy";return e.format(new Date(t),a)},exports.formatDateNice=function(t){return e.format(new Date(t),"MMM d, yyyy")},exports.formatMoney=function(e,t){void 0===t&&(t=2);var r=e;return"string"==typeof e&&(r=e.replace(/[^\d.-]/g,"")),Number(r).toLocaleString("en",{minimumFractionDigits:t,maximumFractionDigits:t})},exports.formatNumber=function(e){return parseFloat(e.replace(/[^0-9.]/g,""))},exports.getGst=r,exports.gstCalc=function(e){var n=e;return"string"==typeof n&&(n=parseFloat(n.replace(/[^0-9.]/g,""))),{gst:r(n=t(n)),amountInclusive:a(n),amountExclusive:o(n)}},exports.round=t,exports.sanitiseVehicleType=function(e){var t;switch(e){case"TRAILER_CARAVAN":case"TRAILER_NOT_DESIGNED_FOR_HIGHWAY_USE":case"MOBILE_MACHINE":case"GOODS_VAN_TRUCK_UTILITY":case"BUS":case"MOTOR_CARAVAN":t="motorhome";break;case"MOTORCYCLE":case"ATV":case"MOPED":case"TRACTOR":case"AGRICULTURAL_MACHINE":case"HIGH_SPEED_AGRICULTURAL_VEHICLE":t="motorcycle";break;case"PASSENGER_CAR_VAN":case"SPECIAL_PURPOSE_VEHICLE":case"UNKNOWN":default:t="car"}return t},exports.subtractGst=o;
|
|
2
2
|
//# sourceMappingURL=sdk.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.cjs.production.min.js","sources":["../src/lib/money.ts","../src/lib/dates.ts","../src/lib/vehicles.ts"],"sourcesContent":["/**\n * Safely rounds a number\n */\nexport function round(value: number): number {\n return Number(Math.round(parseFloat(value + 'e' + 2)) + 'e-' + 2)\n}\n\n/**\n * Gets the GST value from a number\n */\nexport function getGst(value: number): number {\n return round(value * 3 / 23);\n}\n\n/**\n * Adds GST to a number\n */\nexport function addGst(value: number): number {\n return round(value * 1.15);\n}\n\n/**\n * Subtracts GST from a number\n */\nexport function subtractGst(value: number): number {\n return round(value - getGst(value));\n}\n\n/**\n * Calculates the various GST values on a figure\n */\nexport function gstCalc(input: number|string): {\n gst: number,\n amountInclusive: number,\n amountExclusive: number\n} {\n let value = input;\n\n if (typeof value === 'string') {\n value = parseFloat(value.replace(/[^0-9.]/g, ''));\n }\n\n value = round(value);\n\n return {\n gst: getGst(value),\n amountInclusive: addGst(value),\n amountExclusive: subtractGst(value)\n }\n}\n\n/**\n * Formats a value nicely\n */\n export function formatMoney(value: string|number, decimals: number = 2): string {\n let toFormat = value;\n if (typeof value === 'string') {\n toFormat = value.replace(/[^\\d.-]/g, '')\n }\n\n return Number(toFormat).toLocaleString('en', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n}\n\n/**\n * Turns a formatted value in to a float\n */\nexport function formatNumber(value: string): number {\n return parseFloat(value.replace(/[^0-9.]/g, ''));\n}\n","import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string) {\n
|
|
1
|
+
{"version":3,"file":"sdk.cjs.production.min.js","sources":["../src/lib/money.ts","../src/lib/dates.ts","../src/lib/vehicles.ts"],"sourcesContent":["/**\n * Safely rounds a number\n */\nexport function round(value: number): number {\n return Number(Math.round(parseFloat(value + 'e' + 2)) + 'e-' + 2)\n}\n\n/**\n * Gets the GST value from a number\n */\nexport function getGst(value: number): number {\n return round(value * 3 / 23);\n}\n\n/**\n * Adds GST to a number\n */\nexport function addGst(value: number): number {\n return round(value * 1.15);\n}\n\n/**\n * Subtracts GST from a number\n */\nexport function subtractGst(value: number): number {\n return round(value - getGst(value));\n}\n\n/**\n * Calculates the various GST values on a figure\n */\nexport function gstCalc(input: number|string): {\n gst: number,\n amountInclusive: number,\n amountExclusive: number\n} {\n let value = input;\n\n if (typeof value === 'string') {\n value = parseFloat(value.replace(/[^0-9.]/g, ''));\n }\n\n value = round(value);\n\n return {\n gst: getGst(value),\n amountInclusive: addGst(value),\n amountExclusive: subtractGst(value)\n }\n}\n\n/**\n * Formats a value nicely\n */\n export function formatMoney(value: string|number, decimals: number = 2): string {\n let toFormat = value;\n if (typeof value === 'string') {\n toFormat = value.replace(/[^\\d.-]/g, '')\n }\n\n return Number(toFormat).toLocaleString('en', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n}\n\n/**\n * Turns a formatted value in to a float\n */\nexport function formatNumber(value: string): number {\n return parseFloat(value.replace(/[^0-9.]/g, ''));\n}\n","import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string, includeTime: boolean = true) {\n const formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';\n return format(new Date(date), formatString);\n}\n","import { VehicleType } from \"../types\";\n\nexport function sanitiseVehicleType(inputType: string): VehicleType {\n let type: VehicleType;\n\n switch (inputType) {\n case 'TRAILER_CARAVAN':\n case 'TRAILER_NOT_DESIGNED_FOR_HIGHWAY_USE':\n case 'MOBILE_MACHINE':\n case 'GOODS_VAN_TRUCK_UTILITY':\n case 'BUS':\n case 'MOTOR_CARAVAN': {\n type = 'motorhome';\n break;\n }\n case 'MOTORCYCLE':\n case 'ATV':\n case 'MOPED':\n case 'TRACTOR':\n case 'AGRICULTURAL_MACHINE':\n case 'HIGH_SPEED_AGRICULTURAL_VEHICLE': {\n type = 'motorcycle';\n break;\n }\n case 'PASSENGER_CAR_VAN':\n case 'SPECIAL_PURPOSE_VEHICLE':\n case 'UNKNOWN':\n default:\n type = 'car';\n }\n\n return type;\n}\n"],"names":["round","value","Number","Math","parseFloat","getGst","addGst","subtractGst","date","includeTime","formatString","format","Date","decimals","toFormat","replace","toLocaleString","minimumFractionDigits","maximumFractionDigits","input","gst","amountInclusive","amountExclusive","inputType","type"],"mappings":"uGAGgBA,EAAMC,GAClB,OAAOC,OAAOC,KAAKH,MAAMI,WAAWH,EAAAA,OAAtBE,gBAMFE,EAAOJ,GACnB,OAAOD,EAAc,EAARC,EAAY,aAMbK,EAAOL,GACnB,OAAOD,EAAc,KAARC,YAMDM,EAAYN,GACxB,OAAOD,EAAMC,EAAQI,EAAOJ,yDCbGO,EAAcC,YAAAA,IAAAA,GAAuB,GACpE,IAAMC,EAAeD,EAAc,mBAAqB,aACxD,OAAOE,SAAO,IAAIC,KAAKJ,GAAOE,oCATHF,GAC3B,OAAOG,SAAO,IAAIC,KAAKJ,GAAO,6CDgDLP,EAAsBY,YAAAA,IAAAA,EAAmB,GAClE,IAAIC,EAAWb,EAKf,MAJqB,iBAAVA,IACPa,EAAWb,EAAMc,QAAQ,WAAY,KAGlCb,OAAOY,GAAUE,eAAe,KAAM,CACzCC,sBAAuBJ,EACvBK,sBAAuBL,mCAOFZ,GACzB,OAAOG,WAAWH,EAAMc,QAAQ,WAAY,gDAvCxBI,GAKpB,IAAIlB,EAAQkB,EAQZ,MANqB,iBAAVlB,IACPA,EAAQG,WAAWH,EAAMc,QAAQ,WAAY,MAK1C,CACHK,IAAKf,EAHTJ,EAAQD,EAAMC,IAIVoB,gBAAiBf,EAAOL,GACxBqB,gBAAiBf,EAAYN,0DE7CDsB,GAChC,IAAIC,EAEJ,OAAQD,GACJ,IAAK,kBACL,IAAK,uCACL,IAAK,iBACL,IAAK,0BACL,IAAK,MACL,IAAK,gBACDC,EAAO,YACP,MAEJ,IAAK,aACL,IAAK,MACL,IAAK,QACL,IAAK,UACL,IAAK,uBACL,IAAK,kCACDA,EAAO,aACP,MAEJ,IAAK,oBACL,IAAK,0BACL,IAAK,UACL,QACIA,EAAO,MAGf,OAAOA"}
|
package/dist/sdk.esm.js
CHANGED
|
@@ -11,8 +11,13 @@ function formatDateNice(date) {
|
|
|
11
11
|
* Formats a date like "01/01/2022 9:50AM"
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
function formatDateForTable(date) {
|
|
15
|
-
|
|
14
|
+
function formatDateForTable(date, includeTime) {
|
|
15
|
+
if (includeTime === void 0) {
|
|
16
|
+
includeTime = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';
|
|
20
|
+
return format(new Date(date), formatString);
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
/**
|
package/dist/sdk.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.esm.js","sources":["../src/lib/dates.ts","../src/lib/money.ts","../src/lib/vehicles.ts"],"sourcesContent":["import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string) {\n
|
|
1
|
+
{"version":3,"file":"sdk.esm.js","sources":["../src/lib/dates.ts","../src/lib/money.ts","../src/lib/vehicles.ts"],"sourcesContent":["import { format } from \"date-fns\";\n\n/**\n * Formats a date like \"Jan 1, 2022\"\n */\nexport function formatDateNice(date: string) {\n return format(new Date(date), \"MMM d, yyyy\");\n}\n\n/**\n * Formats a date like \"01/01/2022 9:50AM\"\n */\nexport function formatDateForTable(date: string, includeTime: boolean = true) {\n const formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';\n return format(new Date(date), formatString);\n}\n","/**\n * Safely rounds a number\n */\nexport function round(value: number): number {\n return Number(Math.round(parseFloat(value + 'e' + 2)) + 'e-' + 2)\n}\n\n/**\n * Gets the GST value from a number\n */\nexport function getGst(value: number): number {\n return round(value * 3 / 23);\n}\n\n/**\n * Adds GST to a number\n */\nexport function addGst(value: number): number {\n return round(value * 1.15);\n}\n\n/**\n * Subtracts GST from a number\n */\nexport function subtractGst(value: number): number {\n return round(value - getGst(value));\n}\n\n/**\n * Calculates the various GST values on a figure\n */\nexport function gstCalc(input: number|string): {\n gst: number,\n amountInclusive: number,\n amountExclusive: number\n} {\n let value = input;\n\n if (typeof value === 'string') {\n value = parseFloat(value.replace(/[^0-9.]/g, ''));\n }\n\n value = round(value);\n\n return {\n gst: getGst(value),\n amountInclusive: addGst(value),\n amountExclusive: subtractGst(value)\n }\n}\n\n/**\n * Formats a value nicely\n */\n export function formatMoney(value: string|number, decimals: number = 2): string {\n let toFormat = value;\n if (typeof value === 'string') {\n toFormat = value.replace(/[^\\d.-]/g, '')\n }\n\n return Number(toFormat).toLocaleString('en', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n}\n\n/**\n * Turns a formatted value in to a float\n */\nexport function formatNumber(value: string): number {\n return parseFloat(value.replace(/[^0-9.]/g, ''));\n}\n","import { VehicleType } from \"../types\";\n\nexport function sanitiseVehicleType(inputType: string): VehicleType {\n let type: VehicleType;\n\n switch (inputType) {\n case 'TRAILER_CARAVAN':\n case 'TRAILER_NOT_DESIGNED_FOR_HIGHWAY_USE':\n case 'MOBILE_MACHINE':\n case 'GOODS_VAN_TRUCK_UTILITY':\n case 'BUS':\n case 'MOTOR_CARAVAN': {\n type = 'motorhome';\n break;\n }\n case 'MOTORCYCLE':\n case 'ATV':\n case 'MOPED':\n case 'TRACTOR':\n case 'AGRICULTURAL_MACHINE':\n case 'HIGH_SPEED_AGRICULTURAL_VEHICLE': {\n type = 'motorcycle';\n break;\n }\n case 'PASSENGER_CAR_VAN':\n case 'SPECIAL_PURPOSE_VEHICLE':\n case 'UNKNOWN':\n default:\n type = 'car';\n }\n\n return type;\n}\n"],"names":["formatDateNice","date","format","Date","formatDateForTable","includeTime","formatString","round","value","Number","Math","parseFloat","getGst","addGst","subtractGst","gstCalc","input","replace","gst","amountInclusive","amountExclusive","formatMoney","decimals","toFormat","toLocaleString","minimumFractionDigits","maximumFractionDigits","formatNumber","sanitiseVehicleType","inputType","type"],"mappings":";;AAEA;;;;SAGgBA,eAAeC;EAC3B,OAAOC,MAAM,CAAC,IAAIC,IAAJ,CAASF,IAAT,CAAD,EAAiB,aAAjB,CAAb;AACH;AAED;;;;SAGgBG,mBAAmBH,MAAcI;MAAAA;IAAAA,cAAuB;;;EACpE,IAAMC,YAAY,GAAG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,CAAN,CAAiBC,cAAjB,CAAgC,IAAhC,EAAsC;IACzCC,qBAAqB,EAAEH,QADkB;IAEzCI,qBAAqB,EAAEJ;GAFpB,CAAP;AAIH;AAED;;;;AAGA,SAAgBK,aAAanB;EACzB,OAAOG,UAAU,CAACH,KAAK,CAACS,OAAN,CAAc,UAAd,EAA0B,EAA1B,CAAD,CAAjB;AACH;;SCrEeW,oBAAoBC;EAChC,IAAIC,IAAJ;;EAEA,QAAQD,SAAR;IACI,KAAK,iBAAL;IACA,KAAK,sCAAL;IACA,KAAK,gBAAL;IACA,KAAK,yBAAL;IACA,KAAK,KAAL;IACA,KAAK,eAAL;MAAsB;QAClBC,IAAI,GAAG,WAAP;QACA;;;IAEJ,KAAK,YAAL;IACA,KAAK,KAAL;IACA,KAAK,OAAL;IACA,KAAK,SAAL;IACA,KAAK,sBAAL;IACA,KAAK,iCAAL;MAAwC;QACpCA,IAAI,GAAG,YAAP;QACA;;;IAEJ,KAAK,mBAAL;IACA,KAAK,yBAAL;IACA,KAAK,SAAL;IACA;MACIA,IAAI,GAAG,KAAP;;;EAGR,OAAOA,IAAP;AACH;;;;"}
|
|
@@ -3,15 +3,15 @@ import { QuoteRequest } from "../quotes";
|
|
|
3
3
|
import { SmsMessageReply } from "./SmsMessageReply";
|
|
4
4
|
export interface SmsMessage {
|
|
5
5
|
id: number;
|
|
6
|
-
created_at:
|
|
7
|
-
updated_at:
|
|
6
|
+
created_at: string;
|
|
7
|
+
updated_at: string;
|
|
8
8
|
content: string;
|
|
9
9
|
recipients: string;
|
|
10
10
|
reference: string | null;
|
|
11
11
|
reply_to: string | null;
|
|
12
12
|
user_id: number | null;
|
|
13
13
|
quote_request_id: string | null;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
replies?: SmsMessageReply[];
|
|
15
|
+
quote_request?: QuoteRequest;
|
|
16
16
|
user?: User;
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@star-insure/sdk",
|
|
3
3
|
"description": "The SDK for Star Insure client apps with shared helper functions and TypeScript definitions.",
|
|
4
4
|
"author": "alexclark_nz",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.8",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/src/lib/dates.ts
CHANGED
|
@@ -10,6 +10,7 @@ export function formatDateNice(date: string) {
|
|
|
10
10
|
/**
|
|
11
11
|
* Formats a date like "01/01/2022 9:50AM"
|
|
12
12
|
*/
|
|
13
|
-
export function formatDateForTable(date: string) {
|
|
14
|
-
|
|
13
|
+
export function formatDateForTable(date: string, includeTime: boolean = true) {
|
|
14
|
+
const formatString = includeTime ? 'dd/MM/yyyy h:mma' : 'dd/MM/yyyy';
|
|
15
|
+
return format(new Date(date), formatString);
|
|
15
16
|
}
|
|
@@ -4,15 +4,15 @@ import { SmsMessageReply } from "./SmsMessageReply";
|
|
|
4
4
|
|
|
5
5
|
export interface SmsMessage {
|
|
6
6
|
id: number;
|
|
7
|
-
created_at:
|
|
8
|
-
updated_at:
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
9
|
content: string;
|
|
10
10
|
recipients: string;
|
|
11
11
|
reference: string | null;
|
|
12
12
|
reply_to: string | null;
|
|
13
13
|
user_id: number | null;
|
|
14
14
|
quote_request_id: string | null;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
replies?: SmsMessageReply[];
|
|
16
|
+
quote_request?: QuoteRequest;
|
|
17
17
|
user?: User;
|
|
18
18
|
}
|