@adyen/kyc-components 3.41.7 → 3.41.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.
@@ -32596,12 +32596,14 @@ const getRegularTaskStatus = ({
32596
32596
  if (importantProblems.length > 0) {
32597
32597
  return importantProblems[0].statusWithReason;
32598
32598
  }
32599
+ const pendingCapabilities = getPendingCapabilities(rootLegalEntity);
32600
+ if (!ignorePendingCapabilities && pendingCapabilities.length > 0)
32601
+ return {
32602
+ status: TaskStatus.PROCESSING,
32603
+ reason: "pendingCapabilities",
32604
+ details: { pendingCapabilities }
32605
+ };
32599
32606
  if (relevantEntityIds.includes(rootLegalEntity.id)) {
32600
- if (!ignorePendingCapabilities && hasPendingCapabilities(rootLegalEntity))
32601
- return {
32602
- status: TaskStatus.PROCESSING,
32603
- reason: "pendingCapabilities"
32604
- };
32605
32607
  if (hasAllCapabilitiesValid(rootLegalEntity))
32606
32608
  return {
32607
32609
  status: TaskStatus.FINISHED,
@@ -32625,9 +32627,7 @@ function findImportantProblems(type, capabilityProblems, entityIds) {
32625
32627
  (prev, curr) => curr.statusWithReason.status - prev.statusWithReason.status
32626
32628
  );
32627
32629
  }
32628
- const hasPendingCapabilities = (legalEntityResponse) => Object.values(legalEntityResponse.capabilities ?? {}).some(
32629
- (capability) => capability.verificationStatus === "pending"
32630
- );
32630
+ const getPendingCapabilities = (legalEntityResponse) => entriesOf(legalEntityResponse.capabilities ?? {}).filter(([, capability]) => (capability == null ? void 0 : capability.verificationStatus) === "pending").reduce((acc, [name]) => [...acc, name], []);
32631
32631
  const hasAllCapabilitiesResolved = (legalEntityResponse) => Object.values((legalEntityResponse == null ? void 0 : legalEntityResponse.capabilities) ?? {}).every(
32632
32632
  (capability) => capability.verificationStatus !== VerificationStatus.PENDING
32633
32633
  );
@@ -32733,11 +32733,13 @@ const calculateTaskStatus = ({
32733
32733
  });
32734
32734
  };
32735
32735
  const splitTaskIdentifier = (taskIdentifier) => {
32736
- if (taskIdentifier.includes("-")) {
32737
- const [taskType, id] = taskIdentifier.split("-");
32738
- return { taskType, id };
32736
+ const firstDashIndex = taskIdentifier.indexOf("-");
32737
+ if (firstDashIndex === -1) {
32738
+ return { taskType: taskIdentifier };
32739
32739
  }
32740
- return { taskType: taskIdentifier };
32740
+ const taskType = taskIdentifier.slice(0, firstDashIndex);
32741
+ const id = taskIdentifier.slice(firstDashIndex + 1);
32742
+ return { taskType, id };
32741
32743
  };
32742
32744
  const determineTaskIdentifiers = ({
32743
32745
  taskTypes: receivedTaskTypes,
@@ -32817,16 +32819,20 @@ const computed = dist.createComputed(
32817
32819
  trustMembers
32818
32820
  });
32819
32821
  const taskStatuses = tasks.reduce((acc, taskIdentifier) => {
32820
- acc[taskIdentifier] = calculateTaskStatus({
32821
- taskIdentifier,
32822
- // we know that neither `rootLegalEntity` nor `capabilityProblems` are undefined if there are tasks
32823
- accountHolder,
32824
- capabilityProblems,
32825
- rootLegalEntity,
32826
- legalRepresentative,
32827
- trustMembers,
32828
- transferInstruments
32829
- });
32822
+ try {
32823
+ acc[taskIdentifier] = calculateTaskStatus({
32824
+ taskIdentifier,
32825
+ // we know that neither `rootLegalEntity` nor `capabilityProblems` are undefined if there are tasks
32826
+ accountHolder,
32827
+ capabilityProblems,
32828
+ rootLegalEntity,
32829
+ legalRepresentative,
32830
+ trustMembers,
32831
+ transferInstruments
32832
+ });
32833
+ } catch (err) {
32834
+ logger$r.error(`Could not calculate task status for ${taskIdentifier}. `, err);
32835
+ }
32830
32836
  return acc;
32831
32837
  }, {});
32832
32838
  return {
@@ -43649,7 +43655,7 @@ const ConfigurationApiProvider = ({
43649
43655
  }) => {
43650
43656
  const authContext = useAuthContext();
43651
43657
  const { isEmbeddedDropin, loadingContext } = authContext;
43652
- const sdkVersion = "3.41.7";
43658
+ const sdkVersion = "3.41.9";
43653
43659
  useAnalytics({
43654
43660
  onUserEvent,
43655
43661
  legalEntityId: rootLegalEntityId,
@@ -44339,6 +44345,10 @@ const ExplainDetails = ({ status }) => {
44339
44345
  ] }, subError.code)) }) : /* @__PURE__ */ jsx(Fragment, {})
44340
44346
  ] });
44341
44347
  }
44348
+ case "pendingCapabilities": {
44349
+ const pendingCapabilities = details.pendingCapabilities;
44350
+ return /* @__PURE__ */ jsx("ul", { children: pendingCapabilities.map((capabilityName) => /* @__PURE__ */ jsx("li", { children: capabilityName }, capabilityName)) });
44351
+ }
44342
44352
  }
44343
44353
  };
44344
44354
  const tabs = "adyen-kyc-tabs";
@@ -44490,7 +44500,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
44490
44500
  const { i18n } = useI18nContext();
44491
44501
  const [tab, setTab] = useState("metadata");
44492
44502
  const metadata = {
44493
- sdkVersion: "3.41.7",
44503
+ sdkVersion: "3.41.9",
44494
44504
  locale: i18n.locale,
44495
44505
  rootLegalEntityId
44496
44506
  };
@@ -2,6 +2,7 @@ import type { ExistingLegalEntity, LegalEntity } from '../../core/models/api/leg
2
2
  import type { CapabilityProblems } from '../../core/models/errors/capability-problems';
3
3
  import type { TaskStatusWithReason } from './taskStatus';
4
4
  import { TaskTypes } from './taskTypes';
5
+ import type { CapabilityName } from '../../core/models/api/capability';
5
6
  export declare const getRegularTaskStatus: ({ taskType, capabilityProblems, rootLegalEntity, relevantEntityIds, ignorePendingCapabilities, }: {
6
7
  taskType: TaskTypes;
7
8
  capabilityProblems: CapabilityProblems;
@@ -9,7 +10,7 @@ export declare const getRegularTaskStatus: ({ taskType, capabilityProblems, root
9
10
  relevantEntityIds: string[];
10
11
  ignorePendingCapabilities?: boolean;
11
12
  }) => TaskStatusWithReason;
12
- export declare const hasPendingCapabilities: (legalEntityResponse: LegalEntity) => boolean;
13
+ export declare const getPendingCapabilities: (legalEntityResponse: LegalEntity) => CapabilityName[];
13
14
  export declare const hasAllCapabilitiesResolved: (legalEntityResponse: LegalEntity) => boolean;
14
15
  export declare const hasRejectedCapabilities: (legalEntityResponse: LegalEntity) => boolean;
15
16
  export declare const hasInvalidCapabilities: (legalEntityResponse: LegalEntity) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.41.7",
3
+ "version": "3.41.9",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",