@swan-io/shared-business 13.4.8 → 13.4.9

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": "13.4.8",
3
+ "version": "13.4.9",
4
4
  "engines": {
5
5
  "node": ">22.12.0"
6
6
  },
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "@swan-io/lake": "13.4.8"
28
+ "@swan-io/lake": "13.4.9"
29
29
  },
30
30
  "dependencies": {
31
31
  "@formatjs/intl": "^3.1.6",
@@ -50,6 +50,6 @@
50
50
  "@types/react-dom": "^19.1.7",
51
51
  "@types/react-native": "^0.72.8",
52
52
  "type-fest": "^4.41.0",
53
- "@swan-io/lake": "13.4.8"
53
+ "@swan-io/lake": "13.4.9"
54
54
  }
55
55
  }
@@ -50,5 +50,5 @@ type Props<Purpose extends string> = {
50
50
  };
51
51
  export declare const getSupportingDocumentPurposeLabel: (purpose: string) => string;
52
52
  export declare const getSupportingDocumentPurposeDescriptionLabel: (purpose: string) => string;
53
- export declare const SupportingDocumentCollection: <Purpose extends string>({ ref, documents, generateUpload, uploadFile, requiredDocumentPurposes, templateLanguage, status, onRemoveFile, showIds, readOnly, getPurposeMetadata, readonlyDocumentPurposes, purposeLabelOverrides, purposeDescriptionLabelOverrides, }: Props<Purpose>) => import("react/jsx-runtime").JSX.Element;
53
+ export declare const SupportingDocumentCollection: <Purpose extends string>({ ref, documents, generateUpload, uploadFile, requiredDocumentPurposes, templateLanguage, status, onChange, onRemoveFile, showIds, readOnly, getPurposeMetadata, readonlyDocumentPurposes, purposeLabelOverrides, purposeDescriptionLabelOverrides, }: Props<Purpose>) => import("react/jsx-runtime").JSX.Element;
54
54
  export {};
@@ -50,7 +50,7 @@ export const getSupportingDocumentPurposeDescriptionLabel = (purpose) => {
50
50
  const key = `supportingDocuments.purpose.${purpose}.description`;
51
51
  return isTranslationKey(key) ? t(key) : "";
52
52
  };
53
- export const SupportingDocumentCollection = ({ ref, documents, generateUpload, uploadFile, requiredDocumentPurposes, templateLanguage = locale.language, status, onRemoveFile, showIds = false, readOnly = false, getPurposeMetadata, readonlyDocumentPurposes = [], purposeLabelOverrides, purposeDescriptionLabelOverrides, }) => {
53
+ export const SupportingDocumentCollection = ({ ref, documents, generateUpload, uploadFile, requiredDocumentPurposes, templateLanguage = locale.language, status, onChange, onRemoveFile, showIds = false, readOnly = false, getPurposeMetadata, readonlyDocumentPurposes = [], purposeLabelOverrides, purposeDescriptionLabelOverrides, }) => {
54
54
  const [showPowerOfAttorneyModal, setShowPowerOfAttorneyModal] = useState(false);
55
55
  const [showSwornStatementModal, setShowSwornStatementModal] = useState(false);
56
56
  const [currentMetadata, setCurrentMetadata] = useState(undefined);
@@ -163,6 +163,14 @@ export const SupportingDocumentCollection = ({ ref, documents, generateUpload, u
163
163
  }), onRemoveFile: readOnly ? undefined : onRemoveFile, onChange: files => {
164
164
  if (isRequired) {
165
165
  filesByRequiredPurpose.current.set(purpose, files);
166
+ const documents = filesByRequiredPurpose.current
167
+ .entries()
168
+ .reduce((acc, [purpose, files]) => {
169
+ const purposeDocuments = files.map(file => ({ purpose, file }));
170
+ acc.push(...purposeDocuments);
171
+ return acc;
172
+ }, []);
173
+ onChange === null || onChange === void 0 ? void 0 : onChange(documents);
166
174
  }
167
175
  }, showIds: showIds })] })) }), _jsx(Space, { height: 24 })] }, purpose));
168
176
  }), showableDocumentPurposes.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(LakeText, { align: "center", children: t("supportingDocuments.noDocuments") }), _jsx(Space, { height: 24 })] })) : null, _jsxs(LakeModal, { visible: showPowerOfAttorneyModal, title: t("supportingDocuments.powerOfAttorneyModal.title"), icon: "document-regular", onPressClose: () => setShowPowerOfAttorneyModal(false), children: [_jsx(LakeText, { children: t("supportingDocuments.powerOfAttorneyModal.description") }), _jsx(Space, { height: 16 }), _jsx(LakeButtonGroup, { paddingBottom: 0, children: _jsx(LakeButton, { grow: true, color: "current", onPress: () => window.open(`/power-of-attorney-template/${match(templateLanguage)