@open-tender/utils 0.4.55 → 0.4.56

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.
@@ -9,5 +9,5 @@ export declare const makeRevenueCenterMsg: (revenueCenter: RevenueCenter, servic
9
9
  message: any;
10
10
  color: string;
11
11
  };
12
- export declare const isRevenueCenterOpen: (revenueCenter: RevenueCenter, serviceType: ServiceType, statusMessages: Record<string, string>) => boolean;
13
- export declare const getRevenueCenterStatus: (revenueCenter: RevenueCenter, serviceType: ServiceType, statusMessages: Record<string, string>) => string;
12
+ export declare const isRevenueCenterOpen: (revenueCenter: RevenueCenter, serviceType: ServiceType) => boolean;
13
+ export declare const getRevenueCenterStatus: (revenueCenter: RevenueCenter, serviceType: ServiceType) => string;
@@ -124,13 +124,9 @@ const makeRevenueCenterMsg = (revenueCenter, serviceType, requestedAt, statusMes
124
124
  return { message, color };
125
125
  };
126
126
  exports.makeRevenueCenterMsg = makeRevenueCenterMsg;
127
- const isRevenueCenterOpen = (revenueCenter, serviceType, statusMessages) => {
127
+ const isRevenueCenterOpen = (revenueCenter, serviceType) => {
128
128
  const { status, first_times, order_times } = revenueCenter;
129
- const tempClosed = status === 'CLOSED_TEMPORARILY';
130
- if (tempClosed)
131
- return false;
132
- const statusMsg = statusMessages[revenueCenter.status];
133
- if (!statusMsg)
129
+ if (status !== 'OPEN')
134
130
  return false;
135
131
  const serviceOrderTimes = order_times ? order_times[serviceType] : null;
136
132
  const serviceFirstTimes = first_times ? first_times[serviceType] : null;
@@ -139,13 +135,12 @@ const isRevenueCenterOpen = (revenueCenter, serviceType, statusMessages) => {
139
135
  return !isHasFirstTimes && !isHasOrderTime;
140
136
  };
141
137
  exports.isRevenueCenterOpen = isRevenueCenterOpen;
142
- const getRevenueCenterStatus = (revenueCenter, serviceType, statusMessages) => {
143
- const { first_times } = revenueCenter;
144
- const isOpen = (0, exports.isRevenueCenterOpen)(revenueCenter, serviceType, statusMessages);
138
+ const getRevenueCenterStatus = (revenueCenter, serviceType) => {
139
+ const { first_times, status } = revenueCenter;
140
+ const isOpen = (0, exports.isRevenueCenterOpen)(revenueCenter, serviceType);
145
141
  if (isOpen)
146
142
  return 'Open Now';
147
- const statusMsg = statusMessages[revenueCenter.status];
148
- if (!statusMsg)
143
+ if (status !== 'OPEN')
149
144
  return 'Closed';
150
145
  const serviceFirstTimes = first_times ? first_times[serviceType] : null;
151
146
  if (!serviceFirstTimes)
@@ -9,5 +9,5 @@ export declare const makeRevenueCenterMsg: (revenueCenter: RevenueCenter, servic
9
9
  message: any;
10
10
  color: string;
11
11
  };
12
- export declare const isRevenueCenterOpen: (revenueCenter: RevenueCenter, serviceType: ServiceType, statusMessages: Record<string, string>) => boolean;
13
- export declare const getRevenueCenterStatus: (revenueCenter: RevenueCenter, serviceType: ServiceType, statusMessages: Record<string, string>) => string;
12
+ export declare const isRevenueCenterOpen: (revenueCenter: RevenueCenter, serviceType: ServiceType) => boolean;
13
+ export declare const getRevenueCenterStatus: (revenueCenter: RevenueCenter, serviceType: ServiceType) => string;
@@ -114,13 +114,9 @@ export const makeRevenueCenterMsg = (revenueCenter, serviceType, requestedAt, st
114
114
  }
115
115
  return { message, color };
116
116
  };
117
- export const isRevenueCenterOpen = (revenueCenter, serviceType, statusMessages) => {
117
+ export const isRevenueCenterOpen = (revenueCenter, serviceType) => {
118
118
  const { status, first_times, order_times } = revenueCenter;
119
- const tempClosed = status === 'CLOSED_TEMPORARILY';
120
- if (tempClosed)
121
- return false;
122
- const statusMsg = statusMessages[revenueCenter.status];
123
- if (!statusMsg)
119
+ if (status !== 'OPEN')
124
120
  return false;
125
121
  const serviceOrderTimes = order_times ? order_times[serviceType] : null;
126
122
  const serviceFirstTimes = first_times ? first_times[serviceType] : null;
@@ -128,13 +124,12 @@ export const isRevenueCenterOpen = (revenueCenter, serviceType, statusMessages)
128
124
  const isHasOrderTime = !!serviceOrderTimes && serviceOrderTimes.length > 0;
129
125
  return !isHasFirstTimes && !isHasOrderTime;
130
126
  };
131
- export const getRevenueCenterStatus = (revenueCenter, serviceType, statusMessages) => {
132
- const { first_times } = revenueCenter;
133
- const isOpen = isRevenueCenterOpen(revenueCenter, serviceType, statusMessages);
127
+ export const getRevenueCenterStatus = (revenueCenter, serviceType) => {
128
+ const { first_times, status } = revenueCenter;
129
+ const isOpen = isRevenueCenterOpen(revenueCenter, serviceType);
134
130
  if (isOpen)
135
131
  return 'Open Now';
136
- const statusMsg = statusMessages[revenueCenter.status];
137
- if (!statusMsg)
132
+ if (status !== 'OPEN')
138
133
  return 'Closed';
139
134
  const serviceFirstTimes = first_times ? first_times[serviceType] : null;
140
135
  if (!serviceFirstTimes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.55",
3
+ "version": "0.4.56",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",