@open-tender/utils 0.4.72 → 0.4.73
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/cjs/utils/cart.d.ts
CHANGED
|
@@ -203,4 +203,4 @@ export declare const validateCart: (cart: Cart, categories: MenuCategories, sold
|
|
|
203
203
|
export declare const getDefaultTip: (config: CheckoutConfig) => string | null;
|
|
204
204
|
export declare const prepareOrder: (data: OrderData) => OrderCreate;
|
|
205
205
|
export declare const checkAmountRemaining: (total: Money, tenders: CheckoutTenders) => number;
|
|
206
|
-
export declare const makeDeviceType: (deviceType: string) => "DESKTOP" | "MOBILE" | "TABLET";
|
|
206
|
+
export declare const makeDeviceType: (deviceType: string, deviceId?: string) => "DESKTOP" | "MOBILE" | "TABLET";
|
package/dist/cjs/utils/cart.js
CHANGED
|
@@ -903,14 +903,18 @@ const checkAmountRemaining = (total, tenders) => {
|
|
|
903
903
|
return Object.is(remaining, -0) ? 0.0 : remaining;
|
|
904
904
|
};
|
|
905
905
|
exports.checkAmountRemaining = checkAmountRemaining;
|
|
906
|
-
const makeDeviceType = (deviceType) => {
|
|
907
|
-
|
|
906
|
+
const makeDeviceType = (deviceType, deviceId) => {
|
|
907
|
+
// when app is only built in phone mode (not Universal) react-native-device-info shows device type as "Handset"
|
|
908
|
+
// so override it to "Tablet" if the deviceId has "iPad" in the name
|
|
909
|
+
deviceType = (deviceType === 'Handset' && !!deviceId && /iPad/.test(deviceId)) ? 'Tablet' : deviceType;
|
|
910
|
+
switch (deviceType === null || deviceType === void 0 ? void 0 : deviceType.toLowerCase()) {
|
|
908
911
|
case 'tablet':
|
|
909
912
|
return 'TABLET';
|
|
910
913
|
case 'mobile':
|
|
914
|
+
case 'handset':
|
|
911
915
|
return 'MOBILE';
|
|
912
916
|
case 'browser':
|
|
913
|
-
|
|
917
|
+
case 'desktop':
|
|
914
918
|
default:
|
|
915
919
|
return 'DESKTOP';
|
|
916
920
|
}
|
package/dist/esm/utils/cart.d.ts
CHANGED
|
@@ -203,4 +203,4 @@ export declare const validateCart: (cart: Cart, categories: MenuCategories, sold
|
|
|
203
203
|
export declare const getDefaultTip: (config: CheckoutConfig) => string | null;
|
|
204
204
|
export declare const prepareOrder: (data: OrderData) => OrderCreate;
|
|
205
205
|
export declare const checkAmountRemaining: (total: Money, tenders: CheckoutTenders) => number;
|
|
206
|
-
export declare const makeDeviceType: (deviceType: string) => "DESKTOP" | "MOBILE" | "TABLET";
|
|
206
|
+
export declare const makeDeviceType: (deviceType: string, deviceId?: string) => "DESKTOP" | "MOBILE" | "TABLET";
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -863,14 +863,18 @@ export const checkAmountRemaining = (total, tenders) => {
|
|
|
863
863
|
remaining = Math.round((remaining + Number.EPSILON) * 100) / 100;
|
|
864
864
|
return Object.is(remaining, -0) ? 0.0 : remaining;
|
|
865
865
|
};
|
|
866
|
-
export const makeDeviceType = (deviceType) => {
|
|
867
|
-
|
|
866
|
+
export const makeDeviceType = (deviceType, deviceId) => {
|
|
867
|
+
// when app is only built in phone mode (not Universal) react-native-device-info shows device type as "Handset"
|
|
868
|
+
// so override it to "Tablet" if the deviceId has "iPad" in the name
|
|
869
|
+
deviceType = (deviceType === 'Handset' && !!deviceId && /iPad/.test(deviceId)) ? 'Tablet' : deviceType;
|
|
870
|
+
switch (deviceType === null || deviceType === void 0 ? void 0 : deviceType.toLowerCase()) {
|
|
868
871
|
case 'tablet':
|
|
869
872
|
return 'TABLET';
|
|
870
873
|
case 'mobile':
|
|
874
|
+
case 'handset':
|
|
871
875
|
return 'MOBILE';
|
|
872
876
|
case 'browser':
|
|
873
|
-
|
|
877
|
+
case 'desktop':
|
|
874
878
|
default:
|
|
875
879
|
return 'DESKTOP';
|
|
876
880
|
}
|
package/package.json
CHANGED