@molopos/shared 2.0.65 → 2.0.67

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.
@@ -0,0 +1,21 @@
1
+ export type Currency = {
2
+ name: string;
3
+ symbol: string;
4
+ code: CurrencyEnum;
5
+ };
6
+ /**
7
+ * Currency codes used in the system
8
+ */
9
+ export declare enum CurrencyEnum {
10
+ USD = "USD",
11
+ GBP = "GBP",
12
+ XAF = "XAF",
13
+ EUR = "EUR",
14
+ XOF = "XOF",
15
+ CHF = "CHF",
16
+ CAD = "CAD"
17
+ }
18
+ /**
19
+ * Currencies options
20
+ */
21
+ export declare const currencies: Currency[];
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.currencies = exports.CurrencyEnum = void 0;
4
+ /**
5
+ * Currency codes used in the system
6
+ */
7
+ var CurrencyEnum;
8
+ (function (CurrencyEnum) {
9
+ CurrencyEnum["USD"] = "USD";
10
+ CurrencyEnum["GBP"] = "GBP";
11
+ CurrencyEnum["XAF"] = "XAF";
12
+ CurrencyEnum["EUR"] = "EUR";
13
+ CurrencyEnum["XOF"] = "XOF";
14
+ CurrencyEnum["CHF"] = "CHF";
15
+ CurrencyEnum["CAD"] = "CAD";
16
+ })(CurrencyEnum || (exports.CurrencyEnum = CurrencyEnum = {}));
17
+ /**
18
+ * Currencies options
19
+ */
20
+ exports.currencies = [
21
+ { code: CurrencyEnum.USD, symbol: "$", name: "US Dollar" },
22
+ { code: CurrencyEnum.EUR, symbol: "€", name: "Euro" },
23
+ { code: CurrencyEnum.XAF, symbol: "FCFA", name: "CFA Franc BEAC" },
24
+ { code: CurrencyEnum.XOF, symbol: "CFA", name: "CFA Franc BCEAO" },
25
+ { code: CurrencyEnum.GBP, symbol: "£", name: "British Pound" },
26
+ { code: CurrencyEnum.CAD, symbol: "C$", name: "Canadian Dollar" },
27
+ { code: CurrencyEnum.CHF, symbol: "CHF", name: "Swiss Franc" },
28
+ ];
package/date/index.js CHANGED
@@ -167,11 +167,12 @@ const recurrenceDate = ({ date, recurrence, duration = 1, isRecurrence = false,
167
167
  if (!isRecurrence) {
168
168
  return null;
169
169
  }
170
+ const dateInit = date instanceof Date ? date : new Date(date);
170
171
  const dateNowUnix = (0, exports.dateTimeNowUtcUnixInteger)();
171
- const dateUnix = (0, exports.formateDateUnixInteger)(date);
172
+ const dateUnix = (0, exports.formateDateUnixInteger)(dateInit);
172
173
  const isFutureDate = dateUnix > dateNowUnix;
173
174
  const dateNowInit = isFutureDate
174
- ? luxon_1.DateTime.fromJSDate(date)
175
+ ? luxon_1.DateTime.fromJSDate(dateInit)
175
176
  : luxon_1.DateTime.fromJSDate((0, exports.dateTimeNowUtc)());
176
177
  switch (recurrence) {
177
178
  case enum_1.RecurrenceEnum.Daily:
@@ -183,7 +184,7 @@ const recurrenceDate = ({ date, recurrence, duration = 1, isRecurrence = false,
183
184
  return dateNowInit.plus({ months: duration }).toJSDate();
184
185
  }
185
186
  const now = luxon_1.DateTime.fromJSDate((0, exports.dateTimeNowUtc)());
186
- let nextOccurrence = now.set({ day: date.getDate() });
187
+ let nextOccurrence = now.set({ day: dateInit.getDate() });
187
188
  if (nextOccurrence.toUnixInteger() <= dateNowUnix) {
188
189
  nextOccurrence = nextOccurrence.plus({ months: duration });
189
190
  }
@@ -195,8 +196,8 @@ const recurrenceDate = ({ date, recurrence, duration = 1, isRecurrence = false,
195
196
  }
196
197
  const now = luxon_1.DateTime.fromJSDate((0, exports.dateTimeNowUtc)());
197
198
  let nextOccurrence = now.set({
198
- month: date.getMonth() + 1,
199
- day: date.getDate(),
199
+ month: dateInit.getMonth() + 1,
200
+ day: dateInit.getDate(),
200
201
  });
201
202
  if (nextOccurrence.toUnixInteger() <= dateNowUnix) {
202
203
  nextOccurrence = nextOccurrence.plus({ years: duration });
package/enum/index.d.ts CHANGED
@@ -187,18 +187,6 @@ export declare enum ExportExtEnum {
187
187
  Csv = "csv",
188
188
  Xlsx = "xlsx"
189
189
  }
190
- /**
191
- * Currency codes used in the system
192
- */
193
- export declare enum CurrencyEnum {
194
- USD = "USD",
195
- GBP = "GBP",
196
- XAF = "XAF",
197
- EUR = "EUR",
198
- XOF = "XOF",
199
- CHF = "CHF",
200
- CAD = "CAD"
201
- }
202
190
  /**
203
191
  * Quote signed view enum
204
192
  */
package/enum/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProviderEnum = exports.RecurrenceEnum = exports.UploadFolderEnum = exports.SectionStatusEnum = exports.StatusEnum = exports.QuoteStatusEnum = exports.PricingTypeEnum = exports.UserStatusEnum = exports.ApplicationSectionModuleEnum = exports.PagesProviderEnum = exports.PrivatePublicEnum = exports.StatusQuoteItemEnum = exports.ContributorRoleEnum = exports.QuoteSignedViewEnum = exports.CurrencyEnum = exports.ExportExtEnum = exports.SortOrderEnum = exports.BooleanStringEnum = exports.TransactionModelEnum = exports.TransactionDirectionEnum = exports.ActivityModelEnum = exports.QueryTypeEnum = exports.ProductTypeEnum = exports.PaymentMethodEnum = exports.DiscountTypeEnum = exports.CustomerTypeEnum = void 0;
3
+ exports.ProviderEnum = exports.RecurrenceEnum = exports.UploadFolderEnum = exports.SectionStatusEnum = exports.StatusEnum = exports.QuoteStatusEnum = exports.PricingTypeEnum = exports.UserStatusEnum = exports.ApplicationSectionModuleEnum = exports.PagesProviderEnum = exports.PrivatePublicEnum = exports.StatusQuoteItemEnum = exports.ContributorRoleEnum = exports.QuoteSignedViewEnum = exports.ExportExtEnum = exports.SortOrderEnum = exports.BooleanStringEnum = exports.TransactionModelEnum = exports.TransactionDirectionEnum = exports.ActivityModelEnum = exports.QueryTypeEnum = exports.ProductTypeEnum = exports.PaymentMethodEnum = exports.DiscountTypeEnum = exports.CustomerTypeEnum = void 0;
4
4
  /**
5
5
  * Customer type enum
6
6
  */
@@ -201,19 +201,6 @@ var ExportExtEnum;
201
201
  ExportExtEnum["Csv"] = "csv";
202
202
  ExportExtEnum["Xlsx"] = "xlsx";
203
203
  })(ExportExtEnum || (exports.ExportExtEnum = ExportExtEnum = {}));
204
- /**
205
- * Currency codes used in the system
206
- */
207
- var CurrencyEnum;
208
- (function (CurrencyEnum) {
209
- CurrencyEnum["USD"] = "USD";
210
- CurrencyEnum["GBP"] = "GBP";
211
- CurrencyEnum["XAF"] = "XAF";
212
- CurrencyEnum["EUR"] = "EUR";
213
- CurrencyEnum["XOF"] = "XOF";
214
- CurrencyEnum["CHF"] = "CHF";
215
- CurrencyEnum["CAD"] = "CAD";
216
- })(CurrencyEnum || (exports.CurrencyEnum = CurrencyEnum = {}));
217
204
  /**
218
205
  * Quote signed view enum
219
206
  */
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./data/countries";
2
+ export * from "./data/currencies";
2
3
  export * from "./date";
3
4
  export * from "./enum";
4
5
  export * from "./lib/utils";
package/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./data/countries"), exports);
18
+ __exportStar(require("./data/currencies"), exports);
18
19
  __exportStar(require("./date"), exports);
19
20
  __exportStar(require("./enum"), exports);
20
21
  __exportStar(require("./lib/utils"), exports);
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.65","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"class-transformer":"^0.5.1","date-fns":"^4.4.0","luxon":"^3.7.2"}}
1
+ {"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.67","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"class-transformer":"^0.5.1","date-fns":"^4.4.0","luxon":"^3.7.2"}}