@swan-io/shared-business 8.0.0 → 8.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -31,10 +31,10 @@
31
31
  "dependencies": {
32
32
  "@formatjs/intl": "^2.10.1",
33
33
  "@placekit/client-js": "^2.3.0",
34
- "@swan-io/boxed": "^2.1.1",
35
- "@swan-io/graphql-client": "^0.1.0",
36
- "@swan-io/request": "^1.0.2",
37
- "@swan-io/use-form": "^2.0.0",
34
+ "@swan-io/boxed": "^2.2.1",
35
+ "@swan-io/graphql-client": "^0.1.1",
36
+ "@swan-io/request": "^1.0.5",
37
+ "@swan-io/use-form": "^2.0.2",
38
38
  "dayjs": "^1.11.10",
39
39
  "iban": "^0.0.14",
40
40
  "react": "^18.2.0",
@@ -458,7 +458,7 @@ const MonthCalendar = ({ month, year, value, firstWeekDay, isSelectable, onChang
458
458
  }) }, weekIndex)))] }));
459
459
  };
460
460
  const DatePickerPopoverContent = ({ value, format, firstWeekDay, desktop, isSelectable, onChange, }) => {
461
- const [monthYear, setMonthYear] = useState(() => getYearMonth(value, format).getWithDefault(getTodayYearMonth()));
461
+ const [monthYear, setMonthYear] = useState(() => getYearMonth(value, format).getOr(getTodayYearMonth()));
462
462
  // Automatically change displayed year and month when user change the value with text input
463
463
  useEffect(() => {
464
464
  const yearMonth = getYearMonth(value, format);
@@ -494,7 +494,7 @@ export const DatePickerModal = ({ value, format, firstWeekDay, isSelectable, onC
494
494
  const handleConfirm = () => {
495
495
  submitForm({
496
496
  onSuccess: values => {
497
- const date = values.date.getWithDefault("");
497
+ const date = values.date.getOr("");
498
498
  if (isNotEmpty(date)) {
499
499
  onChange(date);
500
500
  }
@@ -519,8 +519,8 @@ const DateModal = ({ children, visible, maxWidth, withCloseButton, onPressClose,
519
519
  const DateRangePickerModalContent = ({ value, format, firstWeekDay, desktop, displayTwoCalendar, isSelectable, onChange, }) => {
520
520
  const isFirstMount = useFirstMountState();
521
521
  const [periods, setPeriods] = useState(() => {
522
- const startYearMonth = getYearMonth(value.start, format).getWithDefault(getTodayYearMonth());
523
- const endYearMonth = getYearMonth(value.end, format).getWithDefault(incrementYearMonth(startYearMonth));
522
+ const startYearMonth = getYearMonth(value.start, format).getOr(getTodayYearMonth());
523
+ const endYearMonth = getYearMonth(value.end, format).getOr(incrementYearMonth(startYearMonth));
524
524
  return {
525
525
  start: startYearMonth,
526
526
  end: isYearMonthEquals(startYearMonth, endYearMonth)
@@ -105,7 +105,7 @@ export const FileInput = ({ icon = "document-regular", accept, value, disabled =
105
105
  .with(P.nullish, () => Option.None())
106
106
  .with({ url: P.string }, ({ url, name }) => Option.Some({
107
107
  url,
108
- name: name !== null && name !== void 0 ? name : Result.fromExecution(() => new URL(url).pathname).getWithDefault("untitled"),
108
+ name: name !== null && name !== void 0 ? name : Result.fromExecution(() => new URL(url).pathname).getOr("untitled"),
109
109
  }))
110
110
  .with(P.instanceOf(File), file => Option.Some({
111
111
  name: file.name,