@veevarts/design-system 2.0.0 → 2.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.
@@ -1,3 +1,3 @@
1
1
  import { JSX } from 'react';
2
2
  import { InstallmentScheduleProps } from './types';
3
- export declare function InstallmentSchedule({ mode: controlledMode, donationAmount, currency, locale, installments, automaticSettings, defaultTab, showTitle, showCard, showSavePayment, showTabs, inputs, startDate, labels: customLabels, classNames, isSaving, isModeSwitchDisabled, onModeChange, onAutomaticSettingsChange, onInstallmentsChange, onSave, }: InstallmentScheduleProps): JSX.Element;
3
+ export declare function InstallmentSchedule({ mode: controlledMode, donationAmount, currency, locale, installments, automaticSettings, defaultTab, showTitle, showCard, showSavePayment, showTabs, inputs, startDate, firstInstallmentDateOverride, labels: customLabels, classNames, isSaving, isModeSwitchDisabled, onModeChange, onAutomaticSettingsChange, onInstallmentsChange, onSave, }: InstallmentScheduleProps): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export { InstallmentSchedule } from './InstallmentSchedule';
2
2
  export { InstallmentScheduleSkeleton } from './InstallmentScheduleSkeleton';
3
3
  export { InstallmentTable } from './InstallmentTable';
4
- export { generateAutomaticInstallments } from './utils';
4
+ export { applyFirstInstallmentDateOverride, generateAutomaticInstallments } from './utils';
5
5
  export type { AutomaticScheduleSettings, InstallmentFrequency, InstallmentScheduleInput, InstallmentTableLabels, InstallmentTableProps, InstallmentScheduleClassNames, InstallmentScheduleLabels, InstallmentScheduleMode, InstallmentScheduleProps, InstallmentStatus, ScheduledInstallment, } from './types';
@@ -71,6 +71,22 @@ export type InstallmentScheduleProps = {
71
71
  showTabs?: boolean;
72
72
  inputs?: InstallmentScheduleInput[];
73
73
  startDate?: string;
74
+ /**
75
+ * Automatic mode only. Dates installment #1 on this day instead of the day
76
+ * the generated cadence would put it on. Installments #2..N keep the
77
+ * generated cadence untouched.
78
+ *
79
+ * For flows where the first charge happens when the plan is COMMITTED
80
+ * while the schedule anchors on a later term start: a plan created today
81
+ * with a term starting next month charges #1 today, then follows the term.
82
+ * Without this the first charge silently moves to the term start, and the
83
+ * schedule on screen stops matching the one that gets persisted.
84
+ *
85
+ * Ignored in manual mode, where the host already owns every date, and
86
+ * ignored when `firstInstallmentDate` is one of `inputs` — there the user
87
+ * picks that date themselves and the schedule must agree with the field.
88
+ */
89
+ firstInstallmentDateOverride?: string;
74
90
  labels?: InstallmentScheduleLabels;
75
91
  classNames?: InstallmentScheduleClassNames;
76
92
  isSaving?: boolean;
@@ -1,3 +1,15 @@
1
1
  import { AutomaticScheduleSettings, ScheduledInstallment } from './types';
2
2
  export declare function generateAutomaticInstallments(donationAmount: number, settings: AutomaticScheduleSettings): ScheduledInstallment[];
3
3
  export declare function getInvalidDateRowIds(installments: ScheduledInstallment[]): Set<string>;
4
+ /**
5
+ * Re-dates installment #1 without touching the rest of the schedule.
6
+ *
7
+ * The generator produces one uniform cadence from a single anchor, which
8
+ * cannot express "charge #1 today, then follow the term start". This applies
9
+ * that shape on top: only the first date moves, and only when an override is
10
+ * given and it actually differs.
11
+ *
12
+ * Amounts are never touched — the first-installment rounding remainder stays
13
+ * where the generator put it.
14
+ */
15
+ export declare function applyFirstInstallmentDateOverride(installments: ScheduledInstallment[], firstInstallmentDateOverride?: string): ScheduledInstallment[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veevarts/design-system",
3
3
  "private": false,
4
- "version": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",