@qonto/embed-sdk 0.60.0 → 0.62.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.
Files changed (177) hide show
  1. package/dist/common/operation-settings/operation-settings.d.ts.map +1 -1
  2. package/dist/index.umd.js +4 -4
  3. package/dist/mocks/handlers.d.ts +2 -2
  4. package/dist/mocks/handlers.d.ts.map +1 -1
  5. package/dist/organizations/client/organizations.client.d.ts +67 -0
  6. package/dist/organizations/client/organizations.client.d.ts.map +1 -0
  7. package/dist/organizations/client/organizations.client.test.d.ts +2 -0
  8. package/dist/organizations/client/organizations.client.test.d.ts.map +1 -0
  9. package/dist/organizations/index.d.ts +24 -4
  10. package/dist/organizations/index.d.ts.map +1 -1
  11. package/dist/organizations/index.server.d.ts +32 -0
  12. package/dist/organizations/index.server.d.ts.map +1 -0
  13. package/dist/organizations/server/organizations.server.d.ts +49 -0
  14. package/dist/organizations/server/organizations.server.d.ts.map +1 -0
  15. package/dist/organizations/server/organizations.server.test.d.ts +2 -0
  16. package/dist/organizations/server/organizations.server.test.d.ts.map +1 -0
  17. package/dist/organizations/shared/organizations.api.d.ts.map +1 -0
  18. package/dist/organizations/shared/organizations.serializer.d.ts.map +1 -0
  19. package/dist/organizations/shared/organizations.shared.test.d.ts +2 -0
  20. package/dist/organizations/shared/organizations.shared.test.d.ts.map +1 -0
  21. package/dist/organizations/shared/organizations.types.d.ts.map +1 -0
  22. package/dist/server/common/operation-settings/operation-settings.d.ts.map +1 -1
  23. package/dist/server/index.server.umd.js +1 -1
  24. package/dist/server/mocks/handlers.d.ts +2 -2
  25. package/dist/server/mocks/handlers.d.ts.map +1 -1
  26. package/dist/server/organizations/client/organizations.client.d.ts +67 -0
  27. package/dist/server/organizations/client/organizations.client.d.ts.map +1 -0
  28. package/dist/server/organizations/client/organizations.client.test.d.ts +2 -0
  29. package/dist/server/organizations/client/organizations.client.test.d.ts.map +1 -0
  30. package/dist/server/organizations/index.d.ts +24 -4
  31. package/dist/server/organizations/index.d.ts.map +1 -1
  32. package/dist/server/organizations/index.server.d.ts +32 -0
  33. package/dist/server/organizations/index.server.d.ts.map +1 -0
  34. package/dist/server/organizations/server/organizations.server.d.ts +49 -0
  35. package/dist/server/organizations/server/organizations.server.d.ts.map +1 -0
  36. package/dist/server/organizations/server/organizations.server.test.d.ts +2 -0
  37. package/dist/server/organizations/server/organizations.server.test.d.ts.map +1 -0
  38. package/dist/server/organizations/shared/organizations.api.d.ts.map +1 -0
  39. package/dist/server/organizations/shared/organizations.serializer.d.ts.map +1 -0
  40. package/dist/server/organizations/shared/organizations.shared.test.d.ts +2 -0
  41. package/dist/server/organizations/shared/organizations.shared.test.d.ts.map +1 -0
  42. package/dist/server/organizations/shared/organizations.types.d.ts.map +1 -0
  43. package/dist/server/src/common/operation-settings/operation-settings.js +1 -1
  44. package/dist/server/transactions/{transactions.d.ts → client/transactions.client.d.ts} +33 -17
  45. package/dist/server/transactions/client/transactions.client.d.ts.map +1 -0
  46. package/dist/server/transactions/client/transactions.client.test.d.ts +2 -0
  47. package/dist/server/transactions/client/transactions.client.test.d.ts.map +1 -0
  48. package/dist/server/transactions/index.d.ts +14 -16
  49. package/dist/server/transactions/index.d.ts.map +1 -1
  50. package/dist/server/transactions/index.server.d.ts +45 -0
  51. package/dist/server/transactions/index.server.d.ts.map +1 -0
  52. package/dist/server/transactions/server/transactions.server.d.ts +70 -0
  53. package/dist/server/transactions/server/transactions.server.d.ts.map +1 -0
  54. package/dist/server/transactions/server/transactions.server.test.d.ts +2 -0
  55. package/dist/server/transactions/server/transactions.server.test.d.ts.map +1 -0
  56. package/dist/server/transactions/shared/transactions.api.d.ts.map +1 -0
  57. package/dist/server/transactions/shared/transactions.serializer.d.ts.map +1 -0
  58. package/dist/server/transactions/shared/transactions.shared.test.d.ts +2 -0
  59. package/dist/server/transactions/shared/transactions.shared.test.d.ts.map +1 -0
  60. package/dist/server/transactions/shared/transactions.types.d.ts.map +1 -0
  61. package/dist/server/transactions/shared/transactions.validation.d.ts +3 -0
  62. package/dist/server/transactions/shared/transactions.validation.d.ts.map +1 -0
  63. package/dist/server/types/types.public-api.d.ts +2 -2
  64. package/dist/server/types/types.public-api.d.ts.map +1 -1
  65. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page-utils.d.ts +1 -1
  66. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page-utils.d.ts.map +1 -1
  67. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page.d.ts +1 -1
  68. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page.d.ts.map +1 -1
  69. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-summary-page.d.ts +1 -1
  70. package/dist/server/ui/ui-elements/sepa-transfer-creation/pages/transfer-summary-page.d.ts.map +1 -1
  71. package/dist/server/ui/ui-elements/sepa-transfer-creation/sepa-transfer-creation.events.d.ts +1 -1
  72. package/dist/server/ui/ui-elements/sepa-transfer-creation/sepa-transfer-creation.events.d.ts.map +1 -1
  73. package/dist/server/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts +1 -1
  74. package/dist/server/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts.map +1 -1
  75. package/dist/server/ui/ui-elements/transaction-list/transaction-list.d.ts.map +1 -1
  76. package/dist/src/common/operation-settings/operation-settings.js +1 -1
  77. package/dist/src/organizations/client/organizations.client.js +1 -0
  78. package/dist/src/organizations/index.js +1 -1
  79. package/dist/src/organizations/shared/organizations.api.js +1 -0
  80. package/dist/src/transactions/client/transactions.client.js +1 -0
  81. package/dist/src/transactions/index.js +1 -1
  82. package/dist/src/transactions/shared/transactions.api.js +1 -0
  83. package/dist/src/transactions/shared/transactions.validation.js +1 -0
  84. package/dist/src/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page.js +9 -9
  85. package/dist/src/ui/ui-elements/transaction-list/transaction-list.js +2 -2
  86. package/dist/transactions/{transactions.d.ts → client/transactions.client.d.ts} +33 -17
  87. package/dist/transactions/client/transactions.client.d.ts.map +1 -0
  88. package/dist/transactions/client/transactions.client.test.d.ts +2 -0
  89. package/dist/transactions/client/transactions.client.test.d.ts.map +1 -0
  90. package/dist/transactions/index.d.ts +14 -16
  91. package/dist/transactions/index.d.ts.map +1 -1
  92. package/dist/transactions/index.server.d.ts +45 -0
  93. package/dist/transactions/index.server.d.ts.map +1 -0
  94. package/dist/transactions/server/transactions.server.d.ts +70 -0
  95. package/dist/transactions/server/transactions.server.d.ts.map +1 -0
  96. package/dist/transactions/server/transactions.server.test.d.ts +2 -0
  97. package/dist/transactions/server/transactions.server.test.d.ts.map +1 -0
  98. package/dist/transactions/shared/transactions.api.d.ts.map +1 -0
  99. package/dist/transactions/shared/transactions.serializer.d.ts.map +1 -0
  100. package/dist/transactions/shared/transactions.shared.test.d.ts +2 -0
  101. package/dist/transactions/shared/transactions.shared.test.d.ts.map +1 -0
  102. package/dist/transactions/shared/transactions.types.d.ts.map +1 -0
  103. package/dist/transactions/shared/transactions.validation.d.ts +3 -0
  104. package/dist/transactions/shared/transactions.validation.d.ts.map +1 -0
  105. package/dist/types/types.public-api.d.ts +2 -2
  106. package/dist/types/types.public-api.d.ts.map +1 -1
  107. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page-utils.d.ts +1 -1
  108. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page-utils.d.ts.map +1 -1
  109. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page.d.ts +1 -1
  110. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-details-page.d.ts.map +1 -1
  111. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-summary-page.d.ts +1 -1
  112. package/dist/ui/ui-elements/sepa-transfer-creation/pages/transfer-summary-page.d.ts.map +1 -1
  113. package/dist/ui/ui-elements/sepa-transfer-creation/sepa-transfer-creation.events.d.ts +1 -1
  114. package/dist/ui/ui-elements/sepa-transfer-creation/sepa-transfer-creation.events.d.ts.map +1 -1
  115. package/dist/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts +1 -1
  116. package/dist/ui/ui-elements/transaction-list/create-transaction-list-element.d.ts.map +1 -1
  117. package/dist/ui/ui-elements/transaction-list/transaction-list.d.ts.map +1 -1
  118. package/package.json +9 -1
  119. package/dist/organizations/organizations.api.d.ts.map +0 -1
  120. package/dist/organizations/organizations.d.ts +0 -29
  121. package/dist/organizations/organizations.d.ts.map +0 -1
  122. package/dist/organizations/organizations.public-api.d.ts +0 -5
  123. package/dist/organizations/organizations.public-api.d.ts.map +0 -1
  124. package/dist/organizations/organizations.serializer.d.ts.map +0 -1
  125. package/dist/organizations/organizations.test.d.ts +0 -2
  126. package/dist/organizations/organizations.test.d.ts.map +0 -1
  127. package/dist/organizations/organizations.types.d.ts.map +0 -1
  128. package/dist/server/organizations/organizations.api.d.ts.map +0 -1
  129. package/dist/server/organizations/organizations.d.ts +0 -29
  130. package/dist/server/organizations/organizations.d.ts.map +0 -1
  131. package/dist/server/organizations/organizations.public-api.d.ts +0 -5
  132. package/dist/server/organizations/organizations.public-api.d.ts.map +0 -1
  133. package/dist/server/organizations/organizations.serializer.d.ts.map +0 -1
  134. package/dist/server/organizations/organizations.test.d.ts +0 -2
  135. package/dist/server/organizations/organizations.test.d.ts.map +0 -1
  136. package/dist/server/organizations/organizations.types.d.ts.map +0 -1
  137. package/dist/server/transactions/transactions.api.d.ts.map +0 -1
  138. package/dist/server/transactions/transactions.d.ts.map +0 -1
  139. package/dist/server/transactions/transactions.public-api.d.ts +0 -8
  140. package/dist/server/transactions/transactions.public-api.d.ts.map +0 -1
  141. package/dist/server/transactions/transactions.serializer.d.ts.map +0 -1
  142. package/dist/server/transactions/transactions.test.d.ts +0 -2
  143. package/dist/server/transactions/transactions.test.d.ts.map +0 -1
  144. package/dist/server/transactions/transactions.types.d.ts.map +0 -1
  145. package/dist/server/transactions/transactions.validation.d.ts +0 -3
  146. package/dist/server/transactions/transactions.validation.d.ts.map +0 -1
  147. package/dist/src/organizations/organizations.api.js +0 -1
  148. package/dist/src/organizations/organizations.js +0 -1
  149. package/dist/src/organizations/organizations.public-api.js +0 -1
  150. package/dist/src/transactions/transactions.api.js +0 -1
  151. package/dist/src/transactions/transactions.js +0 -1
  152. package/dist/src/transactions/transactions.public-api.js +0 -1
  153. package/dist/src/transactions/transactions.validation.js +0 -1
  154. package/dist/transactions/transactions.api.d.ts.map +0 -1
  155. package/dist/transactions/transactions.d.ts.map +0 -1
  156. package/dist/transactions/transactions.public-api.d.ts +0 -8
  157. package/dist/transactions/transactions.public-api.d.ts.map +0 -1
  158. package/dist/transactions/transactions.serializer.d.ts.map +0 -1
  159. package/dist/transactions/transactions.test.d.ts +0 -2
  160. package/dist/transactions/transactions.test.d.ts.map +0 -1
  161. package/dist/transactions/transactions.types.d.ts.map +0 -1
  162. package/dist/transactions/transactions.validation.d.ts +0 -3
  163. package/dist/transactions/transactions.validation.d.ts.map +0 -1
  164. /package/dist/organizations/{organizations.api.d.ts → shared/organizations.api.d.ts} +0 -0
  165. /package/dist/organizations/{organizations.serializer.d.ts → shared/organizations.serializer.d.ts} +0 -0
  166. /package/dist/organizations/{organizations.types.d.ts → shared/organizations.types.d.ts} +0 -0
  167. /package/dist/server/organizations/{organizations.api.d.ts → shared/organizations.api.d.ts} +0 -0
  168. /package/dist/server/organizations/{organizations.serializer.d.ts → shared/organizations.serializer.d.ts} +0 -0
  169. /package/dist/server/organizations/{organizations.types.d.ts → shared/organizations.types.d.ts} +0 -0
  170. /package/dist/server/transactions/{transactions.api.d.ts → shared/transactions.api.d.ts} +0 -0
  171. /package/dist/server/transactions/{transactions.serializer.d.ts → shared/transactions.serializer.d.ts} +0 -0
  172. /package/dist/server/transactions/{transactions.types.d.ts → shared/transactions.types.d.ts} +0 -0
  173. /package/dist/src/organizations/{organizations.serializer.js → shared/organizations.serializer.js} +0 -0
  174. /package/dist/src/transactions/{transactions.serializer.js → shared/transactions.serializer.js} +0 -0
  175. /package/dist/transactions/{transactions.api.d.ts → shared/transactions.api.d.ts} +0 -0
  176. /package/dist/transactions/{transactions.serializer.d.ts → shared/transactions.serializer.d.ts} +0 -0
  177. /package/dist/transactions/{transactions.types.d.ts → shared/transactions.types.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/shared/beneficiaries.types';
2
2
  import type { CardDataObject } from '@cards/cards.types';
3
- import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/organizations.types';
3
+ import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/shared/organizations.types';
4
4
  import type { BulkTransferDataObject, BulkTransferSettings, NewBulkTransfer, NewBulkTransferWithBeneficiary } from '@sepa-transfers/bulk-transfers/shared/bulk-transfers.types';
5
5
  import type { SepaTransferDataObject } from '@sepa-transfers/shared/sepa-transfers.types';
6
- import type { TransactionDataObject } from '@transactions/transactions.types';
6
+ import type { TransactionDataObject } from '@transactions/shared/transactions.types';
7
7
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
8
8
  export declare const mockedBankAccountsList: BankAccountDataObject[];
9
9
  export declare const mockedOrganization: OrganizationDataObject;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAI5C,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAI9E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BAk4BvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,2CAA2C,CAAC;AAInD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIrF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BA26BvB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { type ClientOperationSettings } from '@validation/operation-settings-validation';
2
+ import type { BankAccount, Organization } from '../shared/organizations.types';
3
+ /**
4
+ * Retrieves the organization information.
5
+ *
6
+ * **Client-side only** - Uses proxy-based authentication.
7
+ * For server-side operations, import from `'@qonto/embed-sdk/server/organizations'`.
8
+ *
9
+ * @param operationSettings - An object with operation-level settings such as
10
+ * `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
11
+ * @returns A promise that resolves to the organization the current user belongs to.
12
+ * @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
13
+ * `proxyRequestFunction` is provided.
14
+ * @throws `EmbedApiError` If the API request fails or returns an error.
15
+ *
16
+ * @example
17
+ * ```
18
+ * // Preferred: Using proxyEndpointDescriptor
19
+ * const organization = await getOrganization({
20
+ * operationSettings: { proxyEndpointDescriptor }
21
+ * });
22
+ *```
23
+ *
24
+ * @example
25
+ * ```
26
+ * // Alternative: Using proxyRequestFunction
27
+ * const organization = await getOrganization({
28
+ * operationSettings: { proxyRequestFunction }
29
+ * });
30
+ * ```
31
+ */
32
+ export declare const getOrganization: ({ operationSettings, }: {
33
+ operationSettings: ClientOperationSettings;
34
+ }) => Promise<Organization>;
35
+ /**
36
+ * Retrieves the bank accounts for the organization.
37
+ *
38
+ * **Client-side only** - Uses proxy-based authentication.
39
+ * For server-side operations, import from `'@qonto/embed-sdk/server/organizations'`.
40
+ *
41
+ * @param operationSettings - An object with operation-level settings such as
42
+ * `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
43
+ * @returns A promise that resolves to the bank accounts for the organization.
44
+ * @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
45
+ * `proxyRequestFunction` is provided.
46
+ * @throws `EmbedApiError` If the API request fails or returns an error.
47
+ *
48
+ * @example
49
+ * ```
50
+ * // Preferred: Using proxyEndpointDescriptor
51
+ * const bankAccounts = await getBankAccounts({
52
+ * operationSettings: { proxyEndpointDescriptor }
53
+ * });
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```
58
+ * // Alternative: Using proxyRequestFunction
59
+ * const bankAccounts = await getBankAccounts({
60
+ * operationSettings: { proxyRequestFunction }
61
+ * });
62
+ * ```
63
+ */
64
+ export declare const getBankAccounts: ({ operationSettings, }: {
65
+ operationSettings: ClientOperationSettings;
66
+ }) => Promise<BankAccount[]>;
67
+ //# sourceMappingURL=organizations.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.client.d.ts","sourceRoot":"","sources":["../../../src/organizations/client/organizations.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,2CAA2C,CAAC;AAUnD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEb,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,GAAU,wBAEnC;IACD,iBAAiB,EAAE,uBAAuB,CAAC;CAC5C,KAAG,OAAO,CAAC,YAAY,CAkBvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,GAAU,wBAEnC;IACD,iBAAiB,EAAE,uBAAuB,CAAC;CAC5C,KAAG,OAAO,CAAC,WAAW,EAAE,CAgBxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=organizations.client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.client.test.d.ts","sourceRoot":"","sources":["../../../src/organizations/client/organizations.client.test.ts"],"names":[],"mappings":""}
@@ -1,13 +1,33 @@
1
1
  /**
2
2
  * The organizations namespace contains all the functions related to organizations'
3
- * operations such as retrieving bank accounts. It can be accessed like this:
3
+ * operations such as retrieving bank accounts.
4
+ *
5
+ * **Client-side only** - Uses proxy-based authentication (proxyEndpointDescriptor or proxyRequestFunction).
6
+ * For server-side operations with accessToken, import from `'@qonto/embed-sdk/server/organizations'`.
7
+ *
8
+ * @example
4
9
  * ```ts
5
10
  * import { organizations } from '@qonto/embed-sdk/organizations';
6
- * await organizations.getBankAccounts({accessToken, stagingToken});
11
+ *
12
+ * // Preferred: Using proxyEndpointDescriptor
13
+ * const bankAccounts = await organizations.getBankAccounts({
14
+ * operationSettings: { proxyEndpointDescriptor }
15
+ * });
16
+ *
17
+ * // Alternative: Using proxyRequestFunction
18
+ * const bankAccounts = await organizations.getBankAccounts({
19
+ * operationSettings: { proxyRequestFunction }
20
+ * });
7
21
  * ```
8
22
  */
9
23
  export declare const organizations: {
10
- getOrganization: (operationSettings: import("../validation/operation-settings-validation").OperationSettings) => Promise<import("./organizations.types").Organization>;
11
- getBankAccounts: (operationSettings: import("../validation/operation-settings-validation").OperationSettings) => Promise<import("./organizations.types").BankAccount[]>;
24
+ getOrganization: ({ operationSettings, }: {
25
+ operationSettings: import("@validation/operation-settings-validation").ClientOperationSettings;
26
+ }) => Promise<import(".").Organization>;
27
+ getBankAccounts: ({ operationSettings, }: {
28
+ operationSettings: import("@validation/operation-settings-validation").ClientOperationSettings;
29
+ }) => Promise<import(".").BankAccount[]>;
12
30
  };
31
+ export type * from './shared/organizations.types';
32
+ export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
13
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa;;;;;;;CAGzB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The organizations namespace contains all the functions related to organizations'
3
+ * operations such as retrieving bank accounts.
4
+ *
5
+ * **Server-side only** - Uses accessToken-based authentication.
6
+ * For client-side operations with proxyEndpointDescriptor/proxyRequestFunction,
7
+ * import from `'@qonto/embed-sdk/organizations'`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { organizations } from '@qonto/embed-sdk/server/organizations';
12
+ *
13
+ * // Using explicit accessToken
14
+ * const bankAccounts = await organizations.getBankAccounts({
15
+ * operationSettings: { accessToken: 'your-token' }
16
+ * });
17
+ *
18
+ * // Using globally configured token
19
+ * const bankAccounts = await organizations.getBankAccounts();
20
+ * ```
21
+ */
22
+ export declare const organizations: {
23
+ getOrganization: ({ operationSettings, }?: {
24
+ operationSettings?: import("@validation/operation-settings-validation").ServerOperationSettings;
25
+ }) => Promise<import(".").Organization>;
26
+ getBankAccounts: ({ operationSettings, }?: {
27
+ operationSettings?: import("@validation/operation-settings-validation").ServerOperationSettings;
28
+ }) => Promise<import(".").BankAccount[]>;
29
+ };
30
+ export type * from './shared/organizations.types';
31
+ export type { ServerOperationSettings } from '@validation/operation-settings-validation';
32
+ //# sourceMappingURL=index.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/organizations/index.server.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa;;yBAQ8O,CAAC;;;yBAAoqC,CAAC;;CAL76C,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { ServerOperationSettings } from '@validation/operation-settings-validation';
2
+ import type { BankAccount, Organization } from '../shared/organizations.types';
3
+ /**
4
+ * Retrieves the organization information.
5
+ *
6
+ * **Server-side only** - Uses accessToken-based authentication.
7
+ * For client-side operations, import from `'@qonto/embed-sdk/organizations'`.
8
+ *
9
+ * @param params - An object containing:
10
+ * - `operationSettings`: (Optional) An object with operation-level settings such as
11
+ * `accessToken` and `stagingToken`.
12
+ * @returns A promise that resolves to the organization the current user belongs to.
13
+ * @throws `AuthenticationError` If the `accessToken` is invalid or missing.
14
+ * @throws `EmbedApiError` If the API request fails or returns an error.
15
+ *
16
+ * @example
17
+ * ```
18
+ * const organization = await getOrganization({
19
+ * operationSettings: { accessToken: 'your-token' }
20
+ * });
21
+ * ```
22
+ */
23
+ export declare const getOrganization: ({ operationSettings, }?: {
24
+ operationSettings?: ServerOperationSettings;
25
+ }) => Promise<Organization>;
26
+ /**
27
+ * Retrieves the bank accounts for the organization.
28
+ *
29
+ * **Server-side only** - Uses accessToken-based authentication.
30
+ * For client-side operations, import from `'@qonto/embed-sdk/organizations'`.
31
+ *
32
+ * @param params - An object containing:
33
+ * - `operationSettings`: (Optional) An object with operation-level settings such as
34
+ * `accessToken` and `stagingToken`.
35
+ * @returns A promise that resolves to the bank accounts for the organization.
36
+ * @throws `AuthenticationError` If the `accessToken` is invalid or missing.
37
+ * @throws `EmbedApiError` If the API request fails or returns an error.
38
+ *
39
+ * @example
40
+ * ```
41
+ * const bankAccounts = await getBankAccounts({
42
+ * operationSettings: { accessToken: 'your-token' }
43
+ * });
44
+ * ```
45
+ */
46
+ export declare const getBankAccounts: ({ operationSettings, }?: {
47
+ operationSettings?: ServerOperationSettings;
48
+ }) => Promise<BankAccount[]>;
49
+ //# sourceMappingURL=organizations.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.server.d.ts","sourceRoot":"","sources":["../../../src/organizations/server/organizations.server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAUzF,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAAU,yBAEnC;IACD,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CACxC,KAAG,OAAO,CAAC,YAAY,CAS5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAAU,yBAEnC;IACD,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CACxC,KAAG,OAAO,CAAC,WAAW,EAAE,CAS7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=organizations.server.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.server.test.d.ts","sourceRoot":"","sources":["../../../src/organizations/server/organizations.server.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.api.d.ts","sourceRoot":"","sources":["../../../src/organizations/shared/organizations.api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,sBAAsB,GAAI,gCAGpC;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,qBAYH,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,gCAGnC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC;IAAE,YAAY,EAAE,sBAAsB,CAAA;CAAE,CASnD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,gCAGpC;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,qBAYH,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,gCAGnC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC;IAAE,aAAa,EAAE,qBAAqB,EAAE,CAAA;CAAE,CASrD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.serializer.d.ts","sourceRoot":"","sources":["../../../src/organizations/shared/organizations.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,qBAAqB,GAChC,cAAc,sBAAsB,KACnC,YAgBF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,aAAa,qBAAqB,KACjC,WAgBF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=organizations.shared.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.shared.test.d.ts","sourceRoot":"","sources":["../../../src/organizations/shared/organizations.shared.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.types.d.ts","sourceRoot":"","sources":["../../../src/organizations/shared/organizations.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,qBAAqB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"operation-settings.d.ts","sourceRoot":"","sources":["../../../../src/common/operation-settings/operation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,2CAA2C,CAAC;AAEnD;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,oBAAoB,CAEd;IACd,OAAO,CAAC,uBAAuB,CAAsC;IAErE,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAkB9D;;;OAGG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAI5D;;;OAGG;IACI,gBAAgB,IAAI,SAAS;IAIpC;;;OAGG;IACI,YAAY,IAAI,OAAO;IAIvB,uBAAuB,wBAhEN,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;IAoE3C,0BAA0B,IAAI,uBAAuB,GAAG,SAAS;IAIxE;;OAEG;IACI,aAAa,IAAI,IAAI;IAOrB,WAAW,IAAI,iBAAiB;CAQxC;AAGD,eAAO,MAAM,wBAAwB,0BAAyC,CAAC"}
1
+ {"version":3,"file":"operation-settings.d.ts","sourceRoot":"","sources":["../../../../src/common/operation-settings/operation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,2CAA2C,CAAC;AAEnD;;GAEG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,oBAAoB,CAEd;IACd,OAAO,CAAC,uBAAuB,CAAsC;IAErE,OAAO;IAIP;;OAEG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAkB9D;;;OAGG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAI5D;;;OAGG;IACI,gBAAgB,IAAI,SAAS;IAIpC;;;OAGG;IACI,YAAY,IAAI,OAAO;IAIvB,uBAAuB,wBAhEN,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;IAoE3C,0BAA0B,IAAI,uBAAuB,GAAG,SAAS;IAIxE;;OAEG;IACI,aAAa,IAAI,IAAI;IAQrB,WAAW,IAAI,iBAAiB;CAQxC;AAGD,eAAO,MAAM,wBAAwB,0BAAyC,CAAC"}
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let t;const a=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function s(e,s,o){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(a)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(i)}function o(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function i(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}class c{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return c.instance||(c.instance=new c),c.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const u=c.getInstance();class d extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class f extends d{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function p(){if(!u.hasAccessToken())throw new f;return u.getAccessToken()}const g={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},m=3e4,h="REJECT",k={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},b="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",w="https://embed.dev.qonto.co",I={[g.PRODUCTION]:{EMBED_BASE_URL:b,EMBED_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[g.STAGING]:{EMBED_BASE_URL:y,EMBED_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[g.LOCAL]:{EMBED_BASE_URL:w,EMBED_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class S{constructor(){let e,n;this.environment=g.PRODUCTION,this.branch=l.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(g).includes(e)?e:g.PRODUCTION,this.branch=Object.values(l).includes(n)?n:l.SANDBOX}static getInstance(){return S.instance||(S.instance=new S),S.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===g.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=g.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===g.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const _=S.getInstance();function P(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}class E{constructor(){this.currentLocale="en"}static getInstance(){return E.instance||(E.instance=new E),E.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const A=E.getInstance();class v{constructor(){this.mfaPreference=T.PASSKEY,this.debugMode=!1}static getInstance(){return v.instance||(v.instance=new v),v.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=T.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const D=v.getInstance();class R extends d{constructor({message:e,data:n,code:t}){super(),this.code=500;const a=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${a}`,this.data=n||{},this.code=t||this.code}}function x({accessToken:e,stagingToken:n,idempotencyKey:t,mfaPreference:a,scaSessionToken:r}){const s=new Headers;s.append("Authorization",`Bearer ${e}`);const o=n||u.getStagingToken();o&&s.append("X-Qonto-Staging-Token",o),t&&s.append("X-Qonto-Idempotency-Key",t);const i=a||D.getMFAPreference();return i&&s.append("X-Qonto-2fa-Preference",i),r&&s.append("X-Qonto-SCA-Session-Token",r),s.append("Content-Type","application/json"),s.append("Accept-Language",A.getLocale()),s}async function U({path:e,options:n}){const t=`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(t,{...n,headers:x(n.headers),body:n.body?JSON.stringify(n.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new R({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new R({code:a.status,message:`${r.code}: ${r.detail}`,data:r});return r}function O(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return a=t,P()?Buffer.from(a).toString("base64"):btoa(a);var a}function $(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function q(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function M(e){return{name:e.name,iban:e.iban}}const N="/v2/sepa",L=`${N}/transfers`;async function C({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${L}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{transfers:r,meta:s}=await U(a);return{transfers:r,meta:s}}async function j({accessToken:e,stagingToken:n,sepaTransferId:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:t,accessToken:e,stagingToken:n}),{transfer:r}=await U(a);return r}async function B({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:L,options:{method:"POST",headers:{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s},body:{transfer:o,vop_proof_token:n}}}}({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}),{transfer:i}=await U(o);return i}async function F({sepaTransferId:e,accessToken:n,stagingToken:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}/cancel`,options:{method:"POST",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:e,accessToken:n,stagingToken:t});await U(a)}async function K({sepaPayee:e,accessToken:n,stagingToken:t}){const a=function({sepaPayee:e,accessToken:n,stagingToken:t}){return{path:`${N}/verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:n,stagingToken:t});return await U(a)}function Y(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function G(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const H="/v2/sepa/bulk_transfers";async function Q({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${H}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{bulk_transfers:r,meta:s}=await U(a);return{bulkTransfers:r,meta:s}}async function X({accessToken:e,stagingToken:n,bulkTransferId:t}){const a=function({bulkTransferId:e,accessToken:n,stagingToken:t}){return{path:`${H}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({bulkTransferId:t,accessToken:e,stagingToken:n}),{bulk_transfer:r}=await U(a);return r}async function z({sepaPayees:e,accessToken:n,stagingToken:t}){const a=function({sepaPayees:e,accessToken:n,stagingToken:t}){return{path:`${N}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{requests:e.map(M)}}}}({sepaPayees:e,accessToken:n,stagingToken:t});return await U(a)}class J extends d{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}function V(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new J(t.map((e=>`Missing required parameter: ${e}`)))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function Z(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function ee(e){if(!e)throw new J("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new J("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new J("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new J("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new J(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiary)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new J(`Invalid bulkTransfer at index ${n}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary name is required as part of the beneficiary details`);const t=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Z({amount:e.amount}),r=[...t,...a].flat();if(r.length>0)throw new J(r);if(e.amount>m&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new J(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const ne={getBulkTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await Q({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.bulkTransfers?.map(Y),c=i(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new J("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return Y(await X({accessToken:s,stagingToken:r,bulkTransferId:t}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s(),u=ee(e),d=new Map;for(const e of u.bulkTransfers){const n=e.beneficiary;if(n){const e=n.iban;e&&!d.has(e)&&d.set(e,{name:n.name,iban:e})}}const f=Array.from(d.values()),g=await z({sepaPayees:f,accessToken:i,stagingToken:a});if((yield g.requests.map(G))===h)return;const l=await async function({bulkTransfers:e,accessToken:n,stagingToken:t,scaSessionToken:a,bankAccountId:r,idempotencyKey:s}){const o={method:"POST",headers:{...x({accessToken:n,stagingToken:t,scaSessionToken:a,idempotencyKey:s})},body:JSON.stringify({bank_account_id:r,bulk_transfers:e.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))})},i=new URL(`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${H}`),c=await fetch(i,o),u=await c.json();if(!c.ok||u.errors)throw new R({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c});return{bulkTransfer:Y(l),meta:{idempotencyKey:c}}}};class te extends d{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function ae({proxyFunction:e,networkCallDescriptor:n,proxyEndpointDescriptor:t}){if(t){const e={...Object.fromEntries([...x(n.options?.headers)??{}])},a=O({...n,options:{...n.options,headers:e}}),r=await fetch(t.path,{method:t.method,headers:t.options.headers,body:a}),s=$(await r.text());if(!r.ok)throw new R({code:r.status,data:s,message:`Error from proxy endpoint: ${r.status} ${r.statusText}`});return s}if(e){const t=Object.fromEntries([...x(n.options?.headers)??{}]),a=O({...n,options:{...n.options,headers:t}});return $(await e(a))}throw new te("No proxy function or proxy endpoint descriptor provided for proxy call.")}const re={requiresUI:!1};function se(e,{requiresUI:n}=re){const t=e?.uiParentElementId||D.getUIParentElementId();if(n){if(!t)throw new J("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");if(!["string","function"].includes(typeof t))throw new J("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const a=e?.mfaPreference||D.getMFAPreference();if(a){const e=(r=Object.values(T),_.isProductionEnvironment()?r.filter((e=>e!==T.MOCK)):r);if(!e.includes(a))throw new J(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(_.isProductionEnvironment()&&a===T.MOCK)throw new J("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const s=e?.debugMode||D.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||D.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||D.getProxyEndpointDescriptor();if(i&&!i.path)throw new J("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:t,mfaPreference:a,debugMode:s,proxyRequestFunction:o,proxyEndpointDescriptor:i}}function oe({accessToken:e,stagingToken:n,action:t,callbackUrl:a}){const r={post_authn_action:t};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:n},body:{embed_auth_link:r}}}}function ie(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}async function ce({requestSettings:e,operationSettings:n}){!function(e){if(!e||"object"!=typeof e)throw new J("requestSettings must be an object");const n=e,{action:t,callbackUrl:a}=e;V(n,[{name:"action"}]);const r=W(n),s=Object.values(k);if(s.includes(t)||r.push(`action must be one of ${s.join(", ")}`),r.length>0)throw new J(r);if(void 0!==a&&""===a.trim())throw new J("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:t,proxyEndpointDescriptor:a,stagingToken:r}=se(n||{});if(t||a){const n=oe({stagingToken:r,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,proxyEndpointDescriptor:a,networkCallDescriptor:n})).body)}{const t=n?.accessToken||p();return ie(await async function(e){const n=oe({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:t}=await U(n);return{url:t.url,post_authn_action:t.post_authn_action,callback_url:t.callback_url,expired_at:t.expired_at,used_at:t.used_at}}({accessToken:t,stagingToken:r,action:e.action,callbackUrl:e.callbackUrl}))}}function ue(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function de({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`/v2/sepa/beneficiaries/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function fe({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,proxyEndpointDescriptor:r,accessToken:s,stagingToken:o}=se(n||{});if(a||r){const e=de({beneficiaryId:t});return ue((await ae({proxyFunction:a,proxyEndpointDescriptor:r,networkCallDescriptor:e})).body.beneficiary)}{const e=s||p(),n=await async function({accessToken:e,stagingToken:n,beneficiaryId:t}){const a=de({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:r}=await U(a);return r}({beneficiaryId:t,accessToken:e,stagingToken:o});return ue(n)}}function pe(e,n){const t=n?.locale||A.getLocale(),a=new URL(e);return t&&a.searchParams.append("lang",t),n?.mfaPreference&&a.searchParams.append("mfaPreference",n.mfaPreference),n?.idempotencyKey&&a.searchParams.append("idempotencyKey",n.idempotencyKey),a.toString()}const ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const le={getSepaTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await C({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.transfers.map(q),c=i(s.meta);return{transfers:o,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return q(await j({sepaTransferId:t,accessToken:s,stagingToken:r}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s();!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new J("Either beneficiaryId or beneficiary must be provided");const n=W({beneficiaryId:e.beneficiaryId});if(n.length>0)throw new J(n)}(e);const u=e?.beneficiary?e.beneficiary:await async function({sepaTransferSettings:e,operationSettings:n}){return e?.beneficiary?e.beneficiary:await fe({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:n})}({sepaTransferSettings:e,operationSettings:n}),d={name:u.name,iban:u.iban},f=await K({sepaPayee:d,accessToken:i,stagingToken:a}),g=yield(l=f,{matchResult:l.match_result,matchedName:l.matched_name});var l;let T;if("string"==typeof g){if(g===h)return}else{if(g.vopDecision===h)return;T=g.sepaTransferSettings}const k={...e,...T};!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");V(e,ge);const n=[...W({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Z({amount:e.amount})].flat();if(n.length>0)throw new J(n);if(e.amount>m&&(!e.attachmentIds||0===e.attachmentIds.length))throw new J("Attachments are required for transfers over €30,000")}(k);const b={...k,beneficiary:u};return{transfer:q(await B({transfer:b,vopProofToken:f.proof_token.token,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();await F({sepaTransferId:t,accessToken:s,stagingToken:r})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e||!e.callbackUrl)throw new J("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new J("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:a,stagingToken:r}=n||{},s=a||p(),o=await ce({requestSettings:{action:k.SEPA_TRANSFER_CREATE,callbackUrl:t},operationSettings:{stagingToken:r,accessToken:s}});return{...o,url:pe(o.url,n)}},bulkTransfers:ne};e.sepaTransfers=le}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let t;const a=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function s(e,s,o){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(a)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(i)}function o(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function i(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}class c{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return c.instance||(c.instance=new c),c.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const u=c.getInstance();class d extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class f extends d{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function p(){if(!u.hasAccessToken())throw new f;return u.getAccessToken()}const g={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},h=3e4,m="REJECT",k={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},b="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",w="https://embed.dev.qonto.co",I={[g.PRODUCTION]:{EMBED_BASE_URL:b,EMBED_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[g.STAGING]:{EMBED_BASE_URL:y,EMBED_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[g.LOCAL]:{EMBED_BASE_URL:w,EMBED_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class S{constructor(){let e,n;this.environment=g.PRODUCTION,this.branch=l.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(g).includes(e)?e:g.PRODUCTION,this.branch=Object.values(l).includes(n)?n:l.SANDBOX}static getInstance(){return S.instance||(S.instance=new S),S.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===g.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=g.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===g.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const _=S.getInstance();function P(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}class E{constructor(){this.currentLocale="en"}static getInstance(){return E.instance||(E.instance=new E),E.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const A=E.getInstance();class v{constructor(){this.mfaPreference=T.PASSKEY,this.debugMode=!1}static getInstance(){return v.instance||(v.instance=new v),v.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=T.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0,this.proxyEndpointDescriptor=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const D=v.getInstance();class R extends d{constructor({message:e,data:n,code:t}){super(),this.code=500;const a=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${a}`,this.data=n||{},this.code=t||this.code}}function x({accessToken:e,stagingToken:n,idempotencyKey:t,mfaPreference:a,scaSessionToken:r}){const s=new Headers;s.append("Authorization",`Bearer ${e}`);const o=n||u.getStagingToken();o&&s.append("X-Qonto-Staging-Token",o),t&&s.append("X-Qonto-Idempotency-Key",t);const i=a||D.getMFAPreference();return i&&s.append("X-Qonto-2fa-Preference",i),r&&s.append("X-Qonto-SCA-Session-Token",r),s.append("Content-Type","application/json"),s.append("Accept-Language",A.getLocale()),s}async function U({path:e,options:n}){const t=`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(t,{...n,headers:x(n.headers),body:n.body?JSON.stringify(n.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new R({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new R({code:a.status,message:`${r.code}: ${r.detail}`,data:r});return r}function O(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return a=t,P()?Buffer.from(a).toString("base64"):btoa(a);var a}function $(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function q(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function M(e){return{name:e.name,iban:e.iban}}const N="/v2/sepa",L=`${N}/transfers`;async function C({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${L}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{transfers:r,meta:s}=await U(a);return{transfers:r,meta:s}}async function j({accessToken:e,stagingToken:n,sepaTransferId:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:t,accessToken:e,stagingToken:n}),{transfer:r}=await U(a);return r}async function B({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:L,options:{method:"POST",headers:{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s},body:{transfer:o,vop_proof_token:n}}}}({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}),{transfer:i}=await U(o);return i}async function F({sepaTransferId:e,accessToken:n,stagingToken:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}/cancel`,options:{method:"POST",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:e,accessToken:n,stagingToken:t});await U(a)}async function K({sepaPayee:e,accessToken:n,stagingToken:t}){const a=function({sepaPayee:e,accessToken:n,stagingToken:t}){return{path:`${N}/verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:n,stagingToken:t});return await U(a)}function Y(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function G(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const H="/v2/sepa/bulk_transfers";async function Q({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${H}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{bulk_transfers:r,meta:s}=await U(a);return{bulkTransfers:r,meta:s}}async function X({accessToken:e,stagingToken:n,bulkTransferId:t}){const a=function({bulkTransferId:e,accessToken:n,stagingToken:t}){return{path:`${H}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({bulkTransferId:t,accessToken:e,stagingToken:n}),{bulk_transfer:r}=await U(a);return r}async function z({sepaPayees:e,accessToken:n,stagingToken:t}){const a=function({sepaPayees:e,accessToken:n,stagingToken:t}){return{path:`${N}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{requests:e.map(M)}}}}({sepaPayees:e,accessToken:n,stagingToken:t});return await U(a)}class J extends d{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}function V(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new J(t.map((e=>`Missing required parameter: ${e}`)))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function Z(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function ee(e){if(!e)throw new J("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new J("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new J("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new J("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new J(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiary)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new J(`Invalid bulkTransfer at index ${n}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary name is required as part of the beneficiary details`);const t=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Z({amount:e.amount}),r=[...t,...a].flat();if(r.length>0)throw new J(r);if(e.amount>h&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new J(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const ne={getBulkTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await Q({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.bulkTransfers?.map(Y),c=i(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new J("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return Y(await X({accessToken:s,stagingToken:r,bulkTransferId:t}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s(),u=ee(e),d=new Map;for(const e of u.bulkTransfers){const n=e.beneficiary;if(n){const e=n.iban;e&&!d.has(e)&&d.set(e,{name:n.name,iban:e})}}const f=Array.from(d.values()),g=await z({sepaPayees:f,accessToken:i,stagingToken:a});if((yield g.requests.map(G))===m)return;const l=await async function({bulkTransfers:e,accessToken:n,stagingToken:t,scaSessionToken:a,bankAccountId:r,idempotencyKey:s}){const o={method:"POST",headers:{...x({accessToken:n,stagingToken:t,scaSessionToken:a,idempotencyKey:s})},body:JSON.stringify({bank_account_id:r,bulk_transfers:e.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))})},i=new URL(`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${H}`),c=await fetch(i,o),u=await c.json();if(!c.ok||u.errors)throw new R({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c});return{bulkTransfer:Y(l),meta:{idempotencyKey:c}}}};class te extends d{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function ae({proxyFunction:e,networkCallDescriptor:n,proxyEndpointDescriptor:t}){if(t){const e={...Object.fromEntries([...x(n.options?.headers)??{}])},a=O({...n,options:{...n.options,headers:e}}),r=await fetch(t.path,{method:t.method,headers:t.options.headers,body:a}),s=$(await r.text());if(!r.ok)throw new R({code:r.status,data:s,message:`Error from proxy endpoint: ${r.status} ${r.statusText}`});return s}if(e){const t=Object.fromEntries([...x(n.options?.headers)??{}]),a=O({...n,options:{...n.options,headers:t}});return $(await e(a))}throw new te("No proxy function or proxy endpoint descriptor provided for proxy call.")}const re={requiresUI:!1};function se(e,{requiresUI:n}=re){const t=e?.uiParentElementId||D.getUIParentElementId();if(n){if(!t)throw new J("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");if(!["string","function"].includes(typeof t))throw new J("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const a=e?.mfaPreference||D.getMFAPreference();if(a){const e=(r=Object.values(T),_.isProductionEnvironment()?r.filter((e=>e!==T.MOCK)):r);if(!e.includes(a))throw new J(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(_.isProductionEnvironment()&&a===T.MOCK)throw new J("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const s=e?.debugMode||D.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||D.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||D.getProxyEndpointDescriptor();if(i&&!i.path)throw new J("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:t,mfaPreference:a,debugMode:s,proxyRequestFunction:o,proxyEndpointDescriptor:i}}function oe({accessToken:e,stagingToken:n,action:t,callbackUrl:a}){const r={post_authn_action:t};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:n},body:{embed_auth_link:r}}}}function ie(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}async function ce({requestSettings:e,operationSettings:n}){!function(e){if(!e||"object"!=typeof e)throw new J("requestSettings must be an object");const n=e,{action:t,callbackUrl:a}=e;V(n,[{name:"action"}]);const r=W(n),s=Object.values(k);if(s.includes(t)||r.push(`action must be one of ${s.join(", ")}`),r.length>0)throw new J(r);if(void 0!==a&&""===a.trim())throw new J("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:t,proxyEndpointDescriptor:a,stagingToken:r}=se(n||{});if(t||a){const n=oe({stagingToken:r,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,proxyEndpointDescriptor:a,networkCallDescriptor:n})).body)}{const t=n?.accessToken||p();return ie(await async function(e){const n=oe({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:t}=await U(n);return{url:t.url,post_authn_action:t.post_authn_action,callback_url:t.callback_url,expired_at:t.expired_at,used_at:t.used_at}}({accessToken:t,stagingToken:r,action:e.action,callbackUrl:e.callbackUrl}))}}function ue(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function de({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`/v2/sepa/beneficiaries/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function fe({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,proxyEndpointDescriptor:r,accessToken:s,stagingToken:o}=se(n||{});if(a||r){const e=de({beneficiaryId:t});return ue((await ae({proxyFunction:a,proxyEndpointDescriptor:r,networkCallDescriptor:e})).body.beneficiary)}{const e=s||p(),n=await async function({accessToken:e,stagingToken:n,beneficiaryId:t}){const a=de({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:r}=await U(a);return r}({beneficiaryId:t,accessToken:e,stagingToken:o});return ue(n)}}function pe(e,n){const t=n?.locale||A.getLocale(),a=new URL(e);return t&&a.searchParams.append("lang",t),n?.mfaPreference&&a.searchParams.append("mfaPreference",n.mfaPreference),n?.idempotencyKey&&a.searchParams.append("idempotencyKey",n.idempotencyKey),a.toString()}const ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const le={getSepaTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await C({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.transfers.map(q),c=i(s.meta);return{transfers:o,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return q(await j({sepaTransferId:t,accessToken:s,stagingToken:r}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s();!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new J("Either beneficiaryId or beneficiary must be provided");const n=W({beneficiaryId:e.beneficiaryId});if(n.length>0)throw new J(n)}(e);const u=e?.beneficiary?e.beneficiary:await async function({sepaTransferSettings:e,operationSettings:n}){return e?.beneficiary?e.beneficiary:await fe({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:n})}({sepaTransferSettings:e,operationSettings:n}),d={name:u.name,iban:u.iban},f=await K({sepaPayee:d,accessToken:i,stagingToken:a}),g=yield(l=f,{matchResult:l.match_result,matchedName:l.matched_name});var l;let T;if("string"==typeof g){if(g===m)return}else{if(g.vopDecision===m)return;T=g.sepaTransferSettings}const k={...e,...T};!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");V(e,ge);const n=[...W({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Z({amount:e.amount})].flat();if(n.length>0)throw new J(n);if(e.amount>h&&(!e.attachmentIds||0===e.attachmentIds.length))throw new J("Attachments are required for transfers over €30,000")}(k);const b={...k,beneficiary:u};return{transfer:q(await B({transfer:b,vopProofToken:f.proof_token.token,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();await F({sepaTransferId:t,accessToken:s,stagingToken:r})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e||!e.callbackUrl)throw new J("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new J("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:a,stagingToken:r}=n||{},s=a||p(),o=await ce({requestSettings:{action:k.SEPA_TRANSFER_CREATE,callbackUrl:t},operationSettings:{stagingToken:r,accessToken:s}});return{...o,url:pe(o.url,n)}},bulkTransfers:ne};e.sepaTransfers=le}));
@@ -1,9 +1,9 @@
1
1
  import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/shared/beneficiaries.types';
2
2
  import type { CardDataObject } from '@cards/cards.types';
3
- import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/organizations.types';
3
+ import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/shared/organizations.types';
4
4
  import type { BulkTransferDataObject, BulkTransferSettings, NewBulkTransfer, NewBulkTransferWithBeneficiary } from '@sepa-transfers/bulk-transfers/shared/bulk-transfers.types';
5
5
  import type { SepaTransferDataObject } from '@sepa-transfers/shared/sepa-transfers.types';
6
- import type { TransactionDataObject } from '@transactions/transactions.types';
6
+ import type { TransactionDataObject } from '@transactions/shared/transactions.types';
7
7
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
8
8
  export declare const mockedBankAccountsList: BankAccountDataObject[];
9
9
  export declare const mockedOrganization: OrganizationDataObject;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAI5C,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAI9E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BAk4BvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,2CAA2C,CAAC;AAInD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIrF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BA26BvB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { type ClientOperationSettings } from '@validation/operation-settings-validation';
2
+ import type { BankAccount, Organization } from '../shared/organizations.types';
3
+ /**
4
+ * Retrieves the organization information.
5
+ *
6
+ * **Client-side only** - Uses proxy-based authentication.
7
+ * For server-side operations, import from `'@qonto/embed-sdk/server/organizations'`.
8
+ *
9
+ * @param operationSettings - An object with operation-level settings such as
10
+ * `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
11
+ * @returns A promise that resolves to the organization the current user belongs to.
12
+ * @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
13
+ * `proxyRequestFunction` is provided.
14
+ * @throws `EmbedApiError` If the API request fails or returns an error.
15
+ *
16
+ * @example
17
+ * ```
18
+ * // Preferred: Using proxyEndpointDescriptor
19
+ * const organization = await getOrganization({
20
+ * operationSettings: { proxyEndpointDescriptor }
21
+ * });
22
+ *```
23
+ *
24
+ * @example
25
+ * ```
26
+ * // Alternative: Using proxyRequestFunction
27
+ * const organization = await getOrganization({
28
+ * operationSettings: { proxyRequestFunction }
29
+ * });
30
+ * ```
31
+ */
32
+ export declare const getOrganization: ({ operationSettings, }: {
33
+ operationSettings: ClientOperationSettings;
34
+ }) => Promise<Organization>;
35
+ /**
36
+ * Retrieves the bank accounts for the organization.
37
+ *
38
+ * **Client-side only** - Uses proxy-based authentication.
39
+ * For server-side operations, import from `'@qonto/embed-sdk/server/organizations'`.
40
+ *
41
+ * @param operationSettings - An object with operation-level settings such as
42
+ * `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
43
+ * @returns A promise that resolves to the bank accounts for the organization.
44
+ * @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
45
+ * `proxyRequestFunction` is provided.
46
+ * @throws `EmbedApiError` If the API request fails or returns an error.
47
+ *
48
+ * @example
49
+ * ```
50
+ * // Preferred: Using proxyEndpointDescriptor
51
+ * const bankAccounts = await getBankAccounts({
52
+ * operationSettings: { proxyEndpointDescriptor }
53
+ * });
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```
58
+ * // Alternative: Using proxyRequestFunction
59
+ * const bankAccounts = await getBankAccounts({
60
+ * operationSettings: { proxyRequestFunction }
61
+ * });
62
+ * ```
63
+ */
64
+ export declare const getBankAccounts: ({ operationSettings, }: {
65
+ operationSettings: ClientOperationSettings;
66
+ }) => Promise<BankAccount[]>;
67
+ //# sourceMappingURL=organizations.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.client.d.ts","sourceRoot":"","sources":["../../../../src/organizations/client/organizations.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,2CAA2C,CAAC;AAUnD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEb,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,GAAU,wBAEnC;IACD,iBAAiB,EAAE,uBAAuB,CAAC;CAC5C,KAAG,OAAO,CAAC,YAAY,CAkBvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,GAAU,wBAEnC;IACD,iBAAiB,EAAE,uBAAuB,CAAC;CAC5C,KAAG,OAAO,CAAC,WAAW,EAAE,CAgBxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=organizations.client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.client.test.d.ts","sourceRoot":"","sources":["../../../../src/organizations/client/organizations.client.test.ts"],"names":[],"mappings":""}
@@ -1,13 +1,33 @@
1
1
  /**
2
2
  * The organizations namespace contains all the functions related to organizations'
3
- * operations such as retrieving bank accounts. It can be accessed like this:
3
+ * operations such as retrieving bank accounts.
4
+ *
5
+ * **Client-side only** - Uses proxy-based authentication (proxyEndpointDescriptor or proxyRequestFunction).
6
+ * For server-side operations with accessToken, import from `'@qonto/embed-sdk/server/organizations'`.
7
+ *
8
+ * @example
4
9
  * ```ts
5
10
  * import { organizations } from '@qonto/embed-sdk/organizations';
6
- * await organizations.getBankAccounts({accessToken, stagingToken});
11
+ *
12
+ * // Preferred: Using proxyEndpointDescriptor
13
+ * const bankAccounts = await organizations.getBankAccounts({
14
+ * operationSettings: { proxyEndpointDescriptor }
15
+ * });
16
+ *
17
+ * // Alternative: Using proxyRequestFunction
18
+ * const bankAccounts = await organizations.getBankAccounts({
19
+ * operationSettings: { proxyRequestFunction }
20
+ * });
7
21
  * ```
8
22
  */
9
23
  export declare const organizations: {
10
- getOrganization: (operationSettings: import("../validation/operation-settings-validation").OperationSettings) => Promise<import("./organizations.types").Organization>;
11
- getBankAccounts: (operationSettings: import("../validation/operation-settings-validation").OperationSettings) => Promise<import("./organizations.types").BankAccount[]>;
24
+ getOrganization: ({ operationSettings, }: {
25
+ operationSettings: import("@validation/operation-settings-validation").ClientOperationSettings;
26
+ }) => Promise<import(".").Organization>;
27
+ getBankAccounts: ({ operationSettings, }: {
28
+ operationSettings: import("@validation/operation-settings-validation").ClientOperationSettings;
29
+ }) => Promise<import(".").BankAccount[]>;
12
30
  };
31
+ export type * from './shared/organizations.types';
32
+ export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
13
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organizations/index.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;CAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organizations/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa;;;;;;;CAGzB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The organizations namespace contains all the functions related to organizations'
3
+ * operations such as retrieving bank accounts.
4
+ *
5
+ * **Server-side only** - Uses accessToken-based authentication.
6
+ * For client-side operations with proxyEndpointDescriptor/proxyRequestFunction,
7
+ * import from `'@qonto/embed-sdk/organizations'`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { organizations } from '@qonto/embed-sdk/server/organizations';
12
+ *
13
+ * // Using explicit accessToken
14
+ * const bankAccounts = await organizations.getBankAccounts({
15
+ * operationSettings: { accessToken: 'your-token' }
16
+ * });
17
+ *
18
+ * // Using globally configured token
19
+ * const bankAccounts = await organizations.getBankAccounts();
20
+ * ```
21
+ */
22
+ export declare const organizations: {
23
+ getOrganization: ({ operationSettings, }?: {
24
+ operationSettings?: import("@validation/operation-settings-validation").ServerOperationSettings;
25
+ }) => Promise<import(".").Organization>;
26
+ getBankAccounts: ({ operationSettings, }?: {
27
+ operationSettings?: import("@validation/operation-settings-validation").ServerOperationSettings;
28
+ }) => Promise<import(".").BankAccount[]>;
29
+ };
30
+ export type * from './shared/organizations.types';
31
+ export type { ServerOperationSettings } from '@validation/operation-settings-validation';
32
+ //# sourceMappingURL=index.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../../src/organizations/index.server.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa;;yBAQ8O,CAAC;;;yBAAoqC,CAAC;;CAL76C,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}