@qonto/embed-sdk 0.8.0 → 0.10.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 (62) hide show
  1. package/dist/beneficiaries/beneficiaries.api.d.ts.map +1 -1
  2. package/dist/beneficiaries/beneficiaries.d.ts +4 -1
  3. package/dist/beneficiaries/beneficiaries.d.ts.map +1 -1
  4. package/dist/beneficiaries/beneficiaries.types.d.ts +1 -1
  5. package/dist/beneficiaries/beneficiaries.types.d.ts.map +1 -1
  6. package/dist/cards/cards.api.d.ts.map +1 -1
  7. package/dist/common/api-pagination/api-pagination.d.ts +1 -1
  8. package/dist/common/api-pagination/api-pagination.d.ts.map +1 -1
  9. package/dist/common/constants.d.ts +16 -0
  10. package/dist/common/constants.d.ts.map +1 -1
  11. package/dist/common/network/network.types.d.ts +5 -0
  12. package/dist/common/network/network.types.d.ts.map +1 -0
  13. package/dist/index.d.ts +4 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.umd.js +1 -1
  16. package/dist/mocks/handlers.d.ts +2 -0
  17. package/dist/mocks/handlers.d.ts.map +1 -1
  18. package/dist/organizations/index.d.ts +20 -0
  19. package/dist/organizations/index.d.ts.map +1 -0
  20. package/dist/organizations/organizations.api.d.ts +6 -0
  21. package/dist/organizations/organizations.api.d.ts.map +1 -0
  22. package/dist/organizations/organizations.d.ts +6 -0
  23. package/dist/organizations/organizations.d.ts.map +1 -0
  24. package/dist/organizations/organizations.public-api.d.ts +8 -0
  25. package/dist/organizations/organizations.public-api.d.ts.map +1 -0
  26. package/dist/organizations/organizations.serializer.d.ts +3 -0
  27. package/dist/organizations/organizations.serializer.d.ts.map +1 -0
  28. package/dist/organizations/organizations.test.d.ts +2 -0
  29. package/dist/organizations/organizations.test.d.ts.map +1 -0
  30. package/dist/organizations/organizations.types.d.ts +38 -0
  31. package/dist/organizations/organizations.types.d.ts.map +1 -0
  32. package/dist/sepa-transfers/index.d.ts +18 -0
  33. package/dist/sepa-transfers/index.d.ts.map +1 -0
  34. package/dist/sepa-transfers/sepa-transfers.api.d.ts +21 -0
  35. package/dist/sepa-transfers/sepa-transfers.api.d.ts.map +1 -0
  36. package/dist/sepa-transfers/sepa-transfers.d.ts +41 -0
  37. package/dist/sepa-transfers/sepa-transfers.d.ts.map +1 -0
  38. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts +7 -0
  39. package/dist/sepa-transfers/sepa-transfers.public-api.d.ts.map +1 -0
  40. package/dist/sepa-transfers/sepa-transfers.serializer.d.ts +3 -0
  41. package/dist/sepa-transfers/sepa-transfers.serializer.d.ts.map +1 -0
  42. package/dist/sepa-transfers/sepa-transfers.test.d.ts +2 -0
  43. package/dist/sepa-transfers/sepa-transfers.test.d.ts.map +1 -0
  44. package/dist/sepa-transfers/sepa-transfers.types.d.ts +70 -0
  45. package/dist/sepa-transfers/sepa-transfers.types.d.ts.map +1 -0
  46. package/dist/sepa-transfers/sepa-transfers.validate.d.ts +2 -0
  47. package/dist/sepa-transfers/sepa-transfers.validate.d.ts.map +1 -0
  48. package/dist/src/beneficiaries/beneficiaries.js +1 -1
  49. package/dist/src/common/api-pagination/api-pagination.js +1 -1
  50. package/dist/src/common/constants.js +1 -1
  51. package/dist/src/index.js +1 -1
  52. package/dist/src/sepa-transfers/index.js +1 -0
  53. package/dist/src/sepa-transfers/sepa-transfers.api.js +1 -0
  54. package/dist/src/sepa-transfers/sepa-transfers.js +1 -0
  55. package/dist/src/sepa-transfers/sepa-transfers.public-api.js +1 -0
  56. package/dist/src/sepa-transfers/sepa-transfers.serializer.js +1 -0
  57. package/dist/src/sepa-transfers/sepa-transfers.validate.js +1 -0
  58. package/dist/types/index.d.ts +2 -2
  59. package/dist/types/index.d.ts.map +1 -1
  60. package/dist/types/types.public-api.d.ts +3 -1
  61. package/dist/types/types.public-api.d.ts.map +1 -1
  62. package/package.json +9 -1
@@ -1 +1 @@
1
- {"version":3,"file":"beneficiaries.api.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAIrD,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AASD,UAAU,2BAA2B;IACnC,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,wBAAsB,gBAAgB,CAAC,EACrC,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CA+B/D;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,YAAY,EACZ,aAAa,GACd,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqBvD;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,gBAyBtB"}
1
+ {"version":3,"file":"beneficiaries.api.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAKrD,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC5B,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,UAAU,2BAA2B;IACnC,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,wBAAsB,gBAAgB,CAAC,EACrC,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CA+B/D;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,YAAY,EACZ,aAAa,GACd,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqBvD;AAED,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,gBAyBtB"}
@@ -12,6 +12,7 @@ import type { PaginationSettings } from '@common/api-pagination/api-pagination.t
12
12
  * @throws \{AuthenticationError\} If the access token is invalid or missing.
13
13
  * Ensure initialize has been called before using this function if you are not
14
14
  * passing the access token.
15
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
15
16
  */
16
17
  export declare function getBeneficiaries(getBeneficiariesParams?: {
17
18
  accessToken?: string;
@@ -20,13 +21,15 @@ export declare function getBeneficiaries(getBeneficiariesParams?: {
20
21
  }): Promise<GetBeneficiariesResponse>;
21
22
  /**
22
23
  * Fetches a single beneficiary of the current user by ID.
23
- * @param Object - An object with the beneficiaryId and the accessToken properties.
24
+ * @param Object - An object with the beneficiaryId and the optional accessToken
25
+ * and stagingToken properties.
24
26
  * @returns A promise that resolves to a beneficiary.
25
27
  * @throws \{AuthenticationError\} If the access token is invalid or missing.
26
28
  * Ensure initialize has been called before using this function if you are not
27
29
  * passing the access token.
28
30
  * @throws \{InvalidParametersError\} If the `beneficiaryId` parameter is not a
29
31
  * string or is missing.
32
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
30
33
  */
31
34
  export declare function getBeneficiary({ beneficiaryId, accessToken, stagingToken, }: {
32
35
  beneficiaryId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,sBAAsB,CAAC,EAAE;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAmBpC;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,EACnC,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE;IACD,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB"}
1
+ {"version":3,"file":"beneficiaries.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,sBAAsB,CAAC,EAAE;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAqBpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,EACnC,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,EACnC,WAAW,EACX,WAAW,EACX,YAAY,GACb,EAAE;IACD,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB"}
@@ -57,6 +57,6 @@ export interface GetBeneficiariesResponse {
57
57
  /**
58
58
  * Metadata about the pagination state of the response, such as the current page and total pages.
59
59
  */
60
- meta: PaginationState;
60
+ meta?: PaginationState;
61
61
  }
62
62
  //# sourceMappingURL=beneficiaries.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"beneficiaries.types.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;CACvB"}
1
+ {"version":3,"file":"beneficiaries.types.d.ts","sourceRoot":"","sources":["../../src/beneficiaries/beneficiaries.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"cards.api.d.ts","sourceRoot":"","sources":["../../src/cards/cards.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMzE,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD,wBAAsB,QAAQ,CAAC,EAC7B,YAAY,EACZ,WAAW,EACX,YAAY,GACb,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAoB5C;AAED,wBAAsB,OAAO,CAAC,EAC5B,MAAM,EACN,WAAW,EACX,YAAY,GACb,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBzC;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
1
+ {"version":3,"file":"cards.api.d.ts","sourceRoot":"","sources":["../../src/cards/cards.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOzE,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,QAAQ,CAAC,EAC7B,YAAY,EACZ,WAAW,EACX,YAAY,GACb,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAoB5C;AAED,wBAAsB,OAAO,CAAC,EAC5B,MAAM,EACN,WAAW,EACX,YAAY,GACb,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBzC;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
@@ -4,6 +4,6 @@ interface AddPaginationParamsToUrlArgs {
4
4
  paginationSettings?: PaginationSettings;
5
5
  }
6
6
  export declare function addPaginationParamsToUrl({ endpointUrl, paginationSettings, }: AddPaginationParamsToUrlArgs): URL;
7
- export declare function serializePaginationResponse(paginationResponse: PaginationResponseDataObject): PaginationState;
7
+ export declare function serializePaginationResponse(paginationResponse: PaginationResponseDataObject): PaginationState | undefined;
8
8
  export {};
9
9
  //# sourceMappingURL=api-pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-pagination.d.ts","sourceRoot":"","sources":["../../../src/common/api-pagination/api-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AAErD,UAAU,4BAA4B;IACpC,WAAW,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,GAAG,CAYpC;AAED,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,4BAA4B,GAC/C,eAAe,CASjB"}
1
+ {"version":3,"file":"api-pagination.d.ts","sourceRoot":"","sources":["../../../src/common/api-pagination/api-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EAChB,MAAM,6CAA6C,CAAC;AAErD,UAAU,4BAA4B;IACpC,WAAW,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,GAAG,CAYpC;AAED,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,4BAA4B,GAC/C,eAAe,GAAG,SAAS,CAY7B"}
@@ -73,4 +73,20 @@ export declare const BENEFICIARY_STATUSES: {
73
73
  VALIDATED: string;
74
74
  DECLINED: string;
75
75
  };
76
+ export declare const SEPA_TRANSFER_DECLINE_REASONS: {
77
+ BENEFICIARY_BIC_INVALID: string;
78
+ BENEFICIARY_IBAN_INVALID: string;
79
+ BENEFICIARY_STATUS: string;
80
+ BENEFICIARY_NETWORK_RULES_ERROR: string;
81
+ ORGANISATION_COMPLIANCE_REASONS: string;
82
+ DEBIT_ACCOUNT_INSUFFICIENT_FUNDS: string;
83
+ QONTO_PROCESSING_FAILED: string;
84
+ };
85
+ export declare const SEPA_TRANSFER_STATUSES: {
86
+ PENDING: string;
87
+ PROCESSING: string;
88
+ CANCELED: string;
89
+ DECLINED: string;
90
+ SETTLED: string;
91
+ };
76
92
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;CAQzC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;CAMlC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface ApiError {
2
+ code: string;
3
+ detail: string;
4
+ }
5
+ //# sourceMappingURL=network.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.types.d.ts","sourceRoot":"","sources":["../../../src/common/network/network.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { initialize, logout, constants } from '@common';
2
2
  import { cards } from '@cards';
3
3
  import { beneficiaries } from '@beneficiaries';
4
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary } from '@types';
5
- export { initialize, logout, cards, beneficiaries, constants };
6
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, };
4
+ import { sepaTransfers } from '@sepa-transfers';
5
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer } from '@types';
6
+ export { initialize, logout, cards, sepaTransfers, beneficiaries, constants };
7
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, };
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACZ,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AAC/D,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,GACZ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AAC9E,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,CAAC"}
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.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 n=t.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class s extends i{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")}`}}class o{constructor(){this.uiParentElementId=null,this.mfaPreference=null,this.debugMode=!1}static getInstance(){return o.instance||(o.instance=new o),o.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const c=o.getInstance();function d(e){const t=e?.uiParentElementId||c.getUIParentElementId();if(!t)throw new s("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.");const n=e?.mfaPreference||c.getMFAPreference();if(n&&!["passkey","paired-device","sms-otp"].includes(n))throw new s("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const i=e?.debugMode||c.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new s("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}function m(e){if(!e?.accessToken)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&d(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e}const l={READY:"qonto.ready"},u={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},p={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},h={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};var g=Object.freeze({__proto__:null,ACTIONS:u,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:h,ENVIRONMENTS:p,IFRAME_EVENTS:l});const f="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",y="https://embed.dev.qonto.co",T={[p.PRODUCTION]:{IFRAME_BASE_URL:f,IFRAME_URL:`${f}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[p.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[p.LOCAL]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{constructor(){this.environment=p.PRODUCTION,this.branch=h.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(p).includes(e)?e:p.PRODUCTION,this.branch=Object.values(h).includes(t)?t:h.SANDBOX}static getInstance(){return I.instance||(I.instance=new I),I.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=p.PRODUCTION,this.branch=h.MASTER}getEnvironmentUrls(){if(this.environment===p.PRODUCTION)return T.production;{const e=T[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=I.getInstance();const A={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:r,branch:s}=m(e);n.setAccessToken(t),i&&n.setStagingToken(i),a&&c.setSettings(a),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken()},constants:g},{initialize:b,logout:w,constants:L}=A;class v extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function R({accessToken:e,stagingToken:t,idempotencyKey:i}){const a=new Headers;a.append("Authorization",`Bearer ${e}`);const r=t||n.getStagingToken();return r&&a.append("X-Qonto-Staging-Token",r),i&&a.append("X-Qonto-Idempotency-Key",i),a.append("Content-Type","application/json"),a.append("Accept-Language","en"),a}async function D(e,t,n){const i={method:"GET",headers:R({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=await fetch(`${a}/v2/cards/${e.cardId}/data_view`,i),s=await r.json();if(s.errors)throw new v(s.errors.map((e=>`${e.code}: ${e.detail}`)));return function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal?"true":"false"),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking?"true":"false"),n.toString()}(s.iframe_url,e)}var P;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(P||(P={}));const k={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var O,S;function N(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function U(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function C(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function M(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(O||(O={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(S||(S={}));const $=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],B=[...$,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function j(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return N(e,$),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,p=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),h=U({membershipId:t,organizationId:n,bankAccountId:i}),g=C({hasDailyLimit:a,hasTransactionLimit:r}),f=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=F(m),y=q(l),T=[...p,...h,...g,...f,..._,...y];if(T.length>0)throw new s(T)}(e),e}(e):function(e){N(e,B),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:p,hasForeignPaymentOption:h,hasOnlinePaymentOption:g,shipToBusiness:f,hasAtmOption:_,hasAtmDailyLimit:y,atmDailyLimit:T,atmMonthlyLimit:I,address:E,cardDesign:A,typeOfPrint:b}=e,w=function(e){return Object.values(S).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),L=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(b),v=U({membershipId:t,organizationId:n,bankAccountId:i}),R=C({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:p,hasForeignPaymentOption:h,hasOnlinePaymentOption:g,hasAtmDailyLimit:y,shipToBusiness:f}),D=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:T,atmMonthlyLimit:I}),P=F(m),k=q(l),O=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),N=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E,f),$=[...w,...v,...R,...D,...P,...k,...L,...O,...N];if($.length>0)throw new s($)}(e)}(e)}function F(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function q(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class G extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class z{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new G(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new G(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===l.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){return this.iframe&&this.iframe.contentWindow?new Promise(((t,n)=>{const i=a=>{if(a.data?.actionId===e.actionId){if("error"===a.data.status)return this.removeMessageListener(e.actionId,i),n(new G(`An error occurred when performing the action ${e.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(e.actionId,i),t(a.data.payload)}};this.addMessageListener(e.actionId,i),this.iframe?.contentWindow?.postMessage(e,this.targetOrigin)})):Promise.reject(new G("Attempted to perform an Embed operation without having the authentication UI initialized."))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function x({accessToken:e,stagingToken:t,language:n,debugMode:i}){const a=i||!1,r=n||"en",s=E.getEnvironmentUrls().IFRAME_URL,o=t?`&staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function Y({parentElementId:e,iframeUrl:t}){return new z({parentElementId:e,iframeUrl:t}).initialize()}const H=[];for(let e=0;e<256;++e)H.push((e+256).toString(16).slice(1));let V;const X=new Uint8Array(16);var K={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Q(e,t,n){if(K.randomUUID&&!e)return K.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!V){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");V=crypto.getRandomValues.bind(crypto)}return V(X)}();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(H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]).toLowerCase()}(i)}function W(e){return"virtual"===e.cardLevel?function(e){const t=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function J(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function Z(e){const t=Object.values(k);return(e||[]).filter((e=>t.includes(e)))}const ee={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:R({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new v(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>J(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:R({accessToken:t,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new v(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return J(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);j(e.cardSettings);const s=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await Y({iframeUrl:s,parentElementId:i}),c=W(e.cardSettings),m=await o.postMessage(c);return o.destroy(),J(m)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=U({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),c=await Y({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:u.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),l=await c.postMessage(m);return c.destroy(),J(l)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const t=r(),{uiParentElementId:n}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=U({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const i=C(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await D(e.cardSettings,t),a=await Y({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},te=ee;function ne(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 ie(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const ae="/v2/sepa/beneficiaries";async function re({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:R({accessToken:t,stagingToken:n})},a=function({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+ae),paginationSettings:e}),r=await fetch(a,i),s=await r.json();if(s.errors)throw new v(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:s.beneficiaries,meta:s.meta}}const se=[{name:"name"},{name:"iban"}];const oe={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await re({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings});var i;return{beneficiaries:n.beneficiaries.map((e=>ne(e))),meta:{totalItems:(i=n.meta).total_count,totalPages:i.total_pages,currentPage:i.current_page,itemsPerPage:i.per_page,previousPage:i.prev_page||null,nextPage:i.next_page||null}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e);return ne(await async function({accessToken:e,stagingToken:t,beneficiaryId:n}){const i={method:"GET",headers:R({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ae}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new v(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiaryId:e,accessToken:i,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");N(e,se);const t=U({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t)}(e);return ne(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const i={method:"POST",headers:R({accessToken:t,stagingToken:n,idempotencyKey:Q()}),body:JSON.stringify({beneficiary:ie(e)})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${ae}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new v(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiary:e,accessToken:i,stagingToken:n}))}};e.beneficiaries=oe,e.cards=te,e.constants=L,e.initialize=b,e.logout=w}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbed={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.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 n=t.getInstance();class i extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class a extends i{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid access token.\nEnsure you have called the initialize function with a valid access token."}}function r(){if(!n.hasAccessToken())throw new a;return n.getAccessToken()}class s extends i{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")}`}}class o{constructor(){this.uiParentElementId=null,this.mfaPreference=null,this.debugMode=!1}static getInstance(){return o.instance||(o.instance=new o),o.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}clearSettings(){this.uiParentElementId=null,this.mfaPreference=null}}const c=o.getInstance();function d(e){const t=e?.uiParentElementId||c.getUIParentElementId();if(!t)throw new s("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.");const n=e?.mfaPreference||c.getMFAPreference();if(n&&!["passkey","paired-device","sms-otp"].includes(n))throw new s("operationSettings.mfaPreference must be one of passkey, paired-device or sms-otp.");const i=e?.debugMode||c.getDebugMode();if(void 0!==i&&"boolean"!=typeof i)throw new s("operationSettings.debugMode must be a boolean.");return{uiParentElementId:t,mfaPreference:n,debugMode:i}}function m(e){if(!e?.accessToken)throw new s("Access token is required when calling initialize()");return e?.operationSettings&&d(e.operationSettings),function(e){if(e.environment){if(!["production","staging","local"].includes(e.environment))throw new s('If provided, environment must be either "production" or "staging"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.environment.PRODUCTION" or "constants.environment.STAGING"');if(e.branch&&!["master","sandbox","qa"].includes(e.branch))throw new s('If provided, branch must be either "master", "sandbox" or "qa"\nYou can "import constants from @qonto/embed-sdk/common" and then use "constants.branch.MASTER" or "constants.environment.SANDBOX" and so on')}}(e),e}const l={READY:"qonto.ready"},u={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},p={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},g={MASTER:"master",SANDBOX:"sandbox",QA:"qa"};var h=Object.freeze({__proto__:null,ACTIONS:u,ACTIVITY_TAGS:{ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},BENEFICIARY_STATUSES:{PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},BRANCHES:g,ENVIRONMENTS:p,IFRAME_EVENTS:l,SEPA_TRANSFER_DECLINE_REASONS:{BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},SEPA_TRANSFER_STATUSES:{PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"}});const f="https://embed.qonto.com",_="https://embed-js{branch}.staging.qonto.co",y="https://embed.dev.qonto.co",T={[p.PRODUCTION]:{IFRAME_BASE_URL:f,IFRAME_URL:`${f}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[p.STAGING]:{IFRAME_BASE_URL:_,IFRAME_URL:`${_}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[p.LOCAL]:{IFRAME_BASE_URL:y,IFRAME_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class I{constructor(){this.environment=p.PRODUCTION,this.branch=g.SANDBOX;const e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH;this.environment=Object.values(p).includes(e)?e:p.PRODUCTION,this.branch=Object.values(g).includes(t)?t:g.SANDBOX}static getInstance(){return I.instance||(I.instance=new I),I.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=p.PRODUCTION,this.branch=g.MASTER}getEnvironmentUrls(){if(this.environment===p.PRODUCTION)return T.production;{const e=T[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const E=I.getInstance();const A={initialize:function(e){const{accessToken:t,stagingToken:i,operationSettings:a,environment:r,branch:s}=m(e);n.setAccessToken(t),i&&n.setStagingToken(i),a&&c.setSettings(a),r&&(E.setEnvironment(r),s&&E.setBranch(s))},logout:function(){n.clearAccessToken(),n.clearStagingToken()},constants:h},{initialize:w,logout:b,constants:R}=A;class L extends i{constructor(e){super();const t=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${t}`}}function D({accessToken:e,stagingToken:t,idempotencyKey:i}){const a=new Headers;a.append("Authorization",`Bearer ${e}`);const r=t||n.getStagingToken();return r&&a.append("X-Qonto-Staging-Token",r),i&&a.append("X-Qonto-Idempotency-Key",i),a.append("Content-Type","application/json"),a.append("Accept-Language","en"),a}async function k(e,t,n){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=await fetch(`${a}/v2/cards/${e.cardId}/data_view`,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return function(e,t){const n=new URL(e);return"boolean"==typeof t.allowPinReveal&&n.searchParams.set("canSeePin",t.allowPinReveal?"true":"false"),"boolean"==typeof t.allowBlocking&&n.searchParams.set("canBlock",t.allowBlocking?"true":"false"),n.toString()}(s.iframe_url,e)}var v;!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(v||(v={}));const S={TRANSPORT:"transport",RESTAURANT_AND_BAR:"restaurant_and_bar",FOOD_AND_GROCERY:"food_and_grocery",IT_AND_ELECTRONICS:"it_and_electronics",UTILITY:"utility",TAX:"tax",LEGAL_AND_ACCOUNTING:"legal_and_accounting",ATM:"atm",OFFICE_SUPPLY:"office_supply",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",FINANCE:"finance"};var P,N;function O(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new s(n.map((e=>`Missing required parameter: ${e}`)))}function U(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function C(e){return Object.entries(e).filter((([,e])=>void 0!==e&&!1!==e&&!0!==e)).map((([e])=>`${e} must be a boolean`))}function M(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}!function(e){e.VIRTUAL="virtual"}(P||(P={})),function(e){e.METAL="metal",e.PLUS="plus",e.STANDARD="standard"}(N||(N={}));const $=[{name:"organizationId"},{name:"membershipId"},{name:"bankAccountId"},{name:"monthlyLimit"},{name:"cardLevel"}],B=[...$,{name:"atmDailyLimit",requiredIfPresent:"hasAtmDailyLimit"},{name:"hasAtmDailyLimit",requiredIfPresent:"hasAtmOption"},{name:"atmMonthlyLimit",requiredIfPresent:"hasAtmOption"},{name:"shipToBusiness"},{name:"cardLevel"}];function F(e){if(!e)throw new s("cardSettings parameter is required for the called function");return"virtual"===e.cardLevel?function(e){return O(e,$),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u}=e,p=function(e){return"virtual"!==e?['cardLevel must be "virtual"']:[]}(u),g=U({membershipId:t,organizationId:n,bankAccountId:i}),h=C({hasDailyLimit:a,hasTransactionLimit:r}),f=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d}),_=G(m),y=j(l),T=[...p,...g,...h,...f,..._,...y];if(T.length>0)throw new s(T)}(e),e}(e):function(e){O(e,B),function(e){const{membershipId:t,organizationId:n,bankAccountId:i,hasDailyLimit:a,hasTransactionLimit:r,monthlyLimit:o,dailyLimit:c,transactionLimit:d,activeDays:m,categories:l,cardLevel:u,hasNfcOption:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,shipToBusiness:f,hasAtmOption:_,hasAtmDailyLimit:y,atmDailyLimit:T,atmMonthlyLimit:I,address:E,cardDesign:A,typeOfPrint:w}=e,b=function(e){return Object.values(N).includes(e)?[]:['cardLevel must be one of "standard", "plus", "metal"']}(u),R=function(e){const t=null!=e&&"string"!=typeof e,n=!["print","embossed",void 0,null].includes(e);return t||n?['typeOfPrint must be one of "print", "embossed" or null']:[]}(w),L=U({membershipId:t,organizationId:n,bankAccountId:i}),D=C({hasDailyLimit:a,hasTransactionLimit:r,hasAtmOption:_,hasNfcOption:p,hasForeignPaymentOption:g,hasOnlinePaymentOption:h,hasAtmDailyLimit:y,shipToBusiness:f}),k=M({monthlyLimit:o,dailyLimit:c,transactionLimit:d,atmDailyLimit:T,atmMonthlyLimit:I}),v=G(m),S=j(l),P=function(e){return["undefined","string"].includes(typeof e)?[]:["cardDesign must be a string"]}(A),O=function(e,t){if(t)return[];return!e||e.contactName&&e.firstLine&&e.zipCode&&e.city&&e.country?[]:["address must contain at least contactName, firstLine, zipCode, city and country properties"]}(E,f),$=[...b,...L,...D,...k,...v,...S,...R,...P,...O];if($.length>0)throw new s($)}(e)}(e)}function G(e){const t=!Array.isArray(e)||!e.every((e=>Number.isInteger(e)&&e>0&&e<8));return void 0!==e&&t?["activeDays must be an array of integers between 1 and 7"]:[]}function j(e){const t=!Array.isArray(e)||e.some((e=>"string"!=typeof e));return void 0!==e&&t?["categories must be an array of strings"]:[]}class Y extends i{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}class q{constructor(e){this.options=e,this.iframe=null,this.parentElement=null,this.messageListeners=new Map,this.defaultTimeout=3e4;const t=new URL(e.iframeUrl);this.targetOrigin=`${t.protocol}//${t.host}`}async initialize(){if(this.iframe)return this;if(this.parentElement=document.getElementById(this.options.parentElementId),!this.parentElement)throw new Y(`Could not install the authentication UI because the parent element with id ${this.options.parentElementId} was not found.\nPlease make sure to pass a valid parentElementId when calling the method.`);return new Promise(((e,t)=>{this.iframe=document.createElement("iframe"),this.iframe.src=this.options.iframeUrl,this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.style.border="none";const n=this.options.timeout||this.defaultTimeout,i=setTimeout((()=>{window.removeEventListener("message",a),t(new Y(`Could not install the authentication UI because the timeout of ${n}ms was reached.\nPlease make sure the application can reach the Internet.`))}),n),a=t=>{t.data.eventId===l.READY&&(clearTimeout(i),window.removeEventListener("message",a),e(this))};window.addEventListener("message",a),this.parentElement?.appendChild(this.iframe)}))}postMessage(e){return this.iframe&&this.iframe.contentWindow?new Promise(((t,n)=>{const i=a=>{if(a.data?.actionId===e.actionId){if("error"===a.data.status)return this.removeMessageListener(e.actionId,i),n(new Y(`An error occurred when performing the action ${e.actionId}.\n${JSON.stringify(a.data.payload)}`));this.removeMessageListener(e.actionId,i),t(a.data.payload)}};this.addMessageListener(e.actionId,i),this.iframe?.contentWindow?.postMessage(e,this.targetOrigin)})):Promise.reject(new Y("Attempted to perform an Embed operation without having the authentication UI initialized."))}addMessageListener(e,t){this.messageListeners.has(e)||this.messageListeners.set(e,[]);this.messageListeners.get(e).push(t),window.addEventListener("message",t)}removeMessageListener(e,t){const n=this.messageListeners.get(e);if(n){const e=n.indexOf(t);-1!==e&&(n.splice(e,1),window.removeEventListener("message",t))}}destroy(){this.messageListeners.forEach((e=>{e.forEach((e=>{window.removeEventListener("message",e)}))})),this.messageListeners.clear(),this.iframe&&this.parentElement&&(this.parentElement.removeChild(this.iframe),this.iframe=null)}}function x({accessToken:e,stagingToken:t,language:n,debugMode:i}){const a=i||!1,r=n||"en",s=E.getEnvironmentUrls().IFRAME_URL,o=t?`&staging_token=${encodeURIComponent(t)}`:"";return`${s}?debug=${a}&lang=${encodeURIComponent(r)}#access_token=${encodeURIComponent(e)}${o}`}function z({parentElementId:e,iframeUrl:t}){return new q({parentElementId:e,iframeUrl:t}).initialize()}const H=[];for(let e=0;e<256;++e)H.push((e+256).toString(16).slice(1));let V;const K=new Uint8Array(16);var X={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Q(e,t,n){if(X.randomUUID&&!e)return X.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!V){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");V=crypto.getRandomValues.bind(crypto)}return V(K)}();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(H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]).toLowerCase()}(i)}function W(e){return"virtual"===e.cardLevel?function(e){const t=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel}}}}}(e):function(e){const t=Z(e.categories);return{actionId:u.CARD_ORDER,actionData:{idempotencyKey:Q(),body:{card:{payment_monthly_limit:e.monthlyLimit,payment_daily_limit:e.dailyLimit,payment_daily_limit_option:e.hasDailyLimit,payment_transaction_limit:e.transactionLimit,payment_transaction_limit_option:e.hasTransactionLimit,active_days:e.activeDays||[],holder_id:e.membershipId,organization_id:e.organizationId,bank_account_id:e.bankAccountId,categories:t,card_level:e.cardLevel,card_design:e.cardDesign,..."plus"===e.cardLevel&&{type_of_print:e.typeOfPrint},ship_to_business_address:e.shipToBusiness,atm_option:e.hasAtmOption,nfc_option:e.hasNfcOption,foreign_option:e.hasForeignPaymentOption,online_option:e.hasOnlinePaymentOption,atm_daily_limit:e.atmDailyLimit,atm_monthly_limit:e.atmMonthlyLimit,...!e.shipToBusiness&&{address:{contact_name:e.address?.contactName,first_line:e.address?.firstLine,second_line:e.address?.secondLine,third_line:e.address?.thirdLine,zipcode:e.address?.zipCode,city:e.address?.city,country:e.address?.country}}}}}}}(e)}function J(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}function Z(e){const t=Object.values(S);return(e||[]).filter((e=>t.includes(e)))}const ee={getCards:async function({membershipId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("membershipId must be a string");const a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=E.getEnvironmentUrls().THIRD_PARTY_API_URL,r=e?`${a}/v2/cards?holder_ids[]=${e}`:`${a}/v2/cards`,s=await fetch(r,i),o=await s.json();if(o.errors)throw new L(o.errors.map((e=>`${e.code}: ${e.detail}`)));return o.cards}({membershipId:e,accessToken:i,stagingToken:n});return a.map((e=>J(e)))}catch(e){return Promise.reject(e)}},getCard:async function({cardId:e,accessToken:t,stagingToken:n}){try{const i=t||r();if(e&&"string"!=typeof e)throw new s("cardId must be a string");const a=await async function({cardId:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}/v2/cards?ids[]=${e}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.cards[0]}({cardId:e,accessToken:i,stagingToken:n});return J(a)}catch(e){return Promise.reject(e)}},orderCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);F(e.cardSettings);const s=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),o=await z({iframeUrl:s,parentElementId:i}),c=W(e.cardSettings),m=await o.postMessage(c);return o.destroy(),J(m)}catch(e){return Promise.reject(e)}},unlockCard:async function(e){try{const t=r(),{uiParentElementId:i,debugMode:a}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=U({cardId:e.cardId});if(t.length>0)throw new s(t)}(e.cardSettings);const o=x({accessToken:t,stagingToken:n.getStagingToken()||void 0,debugMode:a}),c=await z({iframeUrl:o,parentElementId:i}),m=function(e){return{actionId:u.CARD_UNLOCK,actionData:{cardId:e.cardSettings.cardId}}}(e),l=await c.postMessage(m);return c.destroy(),J(l)}catch(e){return Promise.reject(e)}},displayCard:async function(e){try{const t=r(),{uiParentElementId:n}=d(e.operationSettings);!function(e){if(!e)throw new s("cardSettings parameter is required for the called function");if(!e.cardId)throw new s("cardId is required for the called function");const t=U({cardId:e.cardId});if(t.length>0)throw new s(t);let n={};void 0!==e.allowPinReveal&&(n={allowPinReveal:e.allowPinReveal}),void 0!==e.allowBlocking&&(n={...n,allowBlocking:e.allowBlocking});const i=C(n);if(i.length>0)throw new s(i)}(e.cardSettings);const i=await k(e.cardSettings,t),a=await z({iframeUrl:i,parentElementId:n});return{destroyEmbedUI:()=>{a.destroy()}}}catch(e){return Promise.reject(e)}}},te=ee;function ne({endpointUrl:e,paginationSettings:t}){const n=new URL(e);return t?.page&&n.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&n.searchParams.set("per_page",t.itemsPerPage.toString()),n}function ie(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}}function ae(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 re(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const se="/v2/sepa/beneficiaries";const oe=[{name:"name"},{name:"iban"}];const ce={getBeneficiaries:async function(e){const t=e?.accessToken||r(),n=await async function({paginationSettings:e,accessToken:t,stagingToken:n}){const i={method:"GET",headers:D({accessToken:t,stagingToken:n})},a=ne({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+se),paginationSettings:e}),r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{beneficiaries:s.beneficiaries,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.beneficiaries.map((e=>ae(e))),a=ie(n.meta);return{beneficiaries:i,...a?{meta:a}:{}}},getBeneficiary:async function({beneficiaryId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("beneficiaryId must be a string")}(e);return ae(await async function({accessToken:e,stagingToken:t,beneficiaryId:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${se}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiaryId:e,accessToken:i,stagingToken:n}))},addBeneficiary:async function({beneficiary:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new s("beneficiary must be an object");O(e,oe);const t=U({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new s(t)}(e);return ae(await async function({beneficiary:e,accessToken:t,stagingToken:n}){const i={method:"POST",headers:D({accessToken:t,stagingToken:n,idempotencyKey:Q()}),body:JSON.stringify({beneficiary:re(e)})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${se}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.beneficiary}({beneficiary:e,accessToken:i,stagingToken:n}))}},de="/v2/sepa/transfers";function me(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}}const le={getSepaTransfers:async function(e={}){const t=e?.accessToken||r(),n=await async function({accessToken:e,stagingToken:t,paginationSettings:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=ne({endpointUrl:new URL(E.getEnvironmentUrls().THIRD_PARTY_API_URL+de),paginationSettings:n}),r=await fetch(a,i);if(!r.ok)throw new L("Failed to fetch SEPA transfers");const s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return{transfers:s.transfers,meta:s.meta}}({accessToken:t,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),i=n.transfers.map((e=>me(e))),a=ie(n.meta);return{transfers:i,...a?{meta:a}:{}}},getSepaTransfer:async function({sepaTransferId:e,accessToken:t,stagingToken:n}){const i=t||r();!function(e){if(!e)throw new s("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new s("sepaTransferId must be a string")}(e);return me(await async function({accessToken:e,stagingToken:t,sepaTransferId:n}){const i={method:"GET",headers:D({accessToken:e,stagingToken:t})},a=`${E.getEnvironmentUrls().THIRD_PARTY_API_URL}${de}/${n}`,r=await fetch(a,i),s=await r.json();if(s.errors)throw new L(s.errors.map((e=>`${e.code}: ${e.detail}`)));return s.external_transfer}({sepaTransferId:e,accessToken:i,stagingToken:n}))}};e.beneficiaries=ce,e.cards=te,e.constants=R,e.initialize=w,e.logout=b,e.sepaTransfers=le}));
@@ -1,4 +1,5 @@
1
1
  import type { BeneficiaryDataObject } from '@beneficiaries/beneficiaries.types';
2
+ import type { SepaTransferDataObject } from '@sepa-transfers/sepa-transfers.types';
2
3
  export declare const INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
3
4
  export declare const singleBeneficiary: BeneficiaryDataObject;
4
5
  export declare const newBeneficiaryDbFields: {
@@ -10,5 +11,6 @@ export declare const newBeneficiaryDbFields: {
10
11
  trusted: boolean;
11
12
  };
12
13
  export declare const mockedBeneficiariesList: BeneficiaryDataObject[];
14
+ export declare const mockTransfer: SepaTransferDataObject;
13
15
  export declare const mswHandlers: import("msw").HttpHandler[];
14
16
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,WAAW,6BAiLvB,CAAC"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAGnF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,sBAkB1B,CAAC;AAEF,eAAO,MAAM,WAAW,6BAkMvB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The organizations namespace contains all the functions related to organizations
3
+ * operations. It can be accessed like this:
4
+ * ```ts
5
+ * import { organizations } from '@qonto/embed-sdk/organizations';
6
+ * ```
7
+ *
8
+ * Then, the organizations object contains the functions to perform organizations
9
+ * operations:
10
+ * ```ts
11
+ * await organizations.getBankAccounts({accessToken, stagingToken});
12
+ * ```
13
+ */
14
+ export declare const organizations: {
15
+ getBankAccounts: (params: {
16
+ accessToken?: string;
17
+ stagingToken?: string;
18
+ }) => Promise<import("./organizations.types").BankAccount[]>;
19
+ };
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;mBAhBrB,CAAC;oBAAwB,CAAC;;CAgBkC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { OrganizationDataObject } from './organizations.types';
2
+ export declare const getOrganization: ({ accessToken, stagingToken, }: {
3
+ accessToken: string;
4
+ stagingToken?: string;
5
+ }) => Promise<OrganizationDataObject>;
6
+ //# sourceMappingURL=organizations.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.api.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAMpE,eAAO,MAAM,eAAe,GAAU,gCAGnC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC,sBAAsB,CAyBjC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { BankAccount } from './organizations.types';
2
+ export declare const getBankAccounts: (params: {
3
+ accessToken?: string;
4
+ stagingToken?: string;
5
+ }) => Promise<BankAccount[]>;
6
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,eAAe,EAAE,CAAC,MAAM,EAAE;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAK,OAAO,CAAC,WAAW,EAAE,CAa1B,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const organizations: {
2
+ getBankAccounts: (params: {
3
+ accessToken?: string;
4
+ stagingToken?: string;
5
+ }) => Promise<import("./organizations.types").BankAccount[]>;
6
+ };
7
+ export { organizations };
8
+ //# sourceMappingURL=organizations.public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.public-api.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.public-api.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,aAAa;;mBAKuJ,CAAC;oBAAwB,CAAC;;CAHnM,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BankAccount, BankAccountDataObject } from './organizations.types';
2
+ export declare const serializeBankAccount: (bankAccount: BankAccountDataObject) => BankAccount;
3
+ //# sourceMappingURL=organizations.serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.serializer.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,eAAO,MAAM,oBAAoB,GAC/B,aAAa,qBAAqB,KACjC,WAeF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=organizations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.test.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ export type BankAccountDataObject = {
2
+ slug: string;
3
+ iban: string;
4
+ bic: string;
5
+ currency: string;
6
+ balance: number;
7
+ balance_cents: number;
8
+ authorized_balance: number;
9
+ authorized_balance_cents: number;
10
+ name: string;
11
+ updated_at: Date;
12
+ status: (typeof ACCOUNT_STATUS)[keyof typeof ACCOUNT_STATUS];
13
+ main: boolean;
14
+ };
15
+ export type BankAccount = {
16
+ slug: string;
17
+ iban: string;
18
+ bic: string;
19
+ currency: string;
20
+ balance: number;
21
+ balanceCents: number;
22
+ authorizedBalance: number;
23
+ authorizedBalanceCents: number;
24
+ name: string;
25
+ updatedAt: Date;
26
+ status: (typeof ACCOUNT_STATUS)[keyof typeof ACCOUNT_STATUS];
27
+ main: boolean;
28
+ };
29
+ export declare const ACCOUNT_STATUS: {
30
+ readonly ACTIVE: "active";
31
+ readonly WAITING: "waiting_for_funds";
32
+ readonly CLOSED: "closed";
33
+ readonly PENDING: "pending";
34
+ };
35
+ export type OrganizationDataObject = {
36
+ bank_accounts: BankAccountDataObject[];
37
+ };
38
+ //# sourceMappingURL=organizations.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.types.d.ts","sourceRoot":"","sources":["../../src/organizations/organizations.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,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,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,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,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC7D,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,qBAAqB,EAAE,CAAC;CACxC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The sepaTransfers namespace contains all the functions related to SEPA transfer operations.
3
+ * It can be accessed like this:
4
+ * ```ts
5
+ * import { sepaTransfers } from '@qonto/embed-sdk/sepa-transfers';
6
+ * ```
7
+ *
8
+ * Then, the sepaTransfers object contains the functions to perform SEPA transfer operations:
9
+ * ```ts
10
+ * await sepaTransfers.getSepaTransfers();
11
+ * await sepaTransfers.getSepaTransfer({ sepaTransferId: '...' });
12
+ * ```
13
+ */
14
+ export declare const sepaTransfers: {
15
+ getSepaTransfers: typeof import("./sepa-transfers").getSepaTransfers;
16
+ getSepaTransfer: typeof import("./sepa-transfers").getSepaTransfer;
17
+ };
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;CAAuC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { PaginationResponseDataObject, PaginationSettings } from '@common/api-pagination/api-pagination.types';
2
+ import type { SepaTransferDataObject } from './sepa-transfers.types';
3
+ interface GetSepaTransfersParams {
4
+ accessToken: string;
5
+ stagingToken?: string;
6
+ paginationSettings?: PaginationSettings;
7
+ }
8
+ interface GetSepaTransferParams {
9
+ accessToken: string;
10
+ stagingToken?: string;
11
+ sepaTransferId: string;
12
+ }
13
+ interface GetSepaTransfersApiResponse {
14
+ transfers: SepaTransferDataObject[];
15
+ meta: PaginationResponseDataObject;
16
+ }
17
+ export declare const SEPA_TRANSFERS_ENDPOINT = "/v2/sepa/transfers";
18
+ export declare function getSepaTransfers({ accessToken, stagingToken, paginationSettings, }: GetSepaTransfersParams): Promise<GetSepaTransfersApiResponse>;
19
+ export declare function getSepaTransfer({ accessToken, stagingToken, sepaTransferId, }: GetSepaTransferParams): Promise<SepaTransferDataObject>;
20
+ export {};
21
+ //# sourceMappingURL=sepa-transfers.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMrE,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,2BAA2B;IACnC,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkC/D;AAED,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBzD"}
@@ -0,0 +1,41 @@
1
+ import type { PaginationSettings } from '@common/api-pagination/api-pagination.types';
2
+ import type { GetSepaTransfersResponse, SepaTransfer } from './sepa-transfers.types';
3
+ interface GetSepaTransfersParams {
4
+ accessToken?: string;
5
+ stagingToken?: string;
6
+ paginationSettings?: PaginationSettings;
7
+ }
8
+ /**
9
+ * Fetches the list of SEPA transfers for the current user.
10
+ * @param getSepaTransfersParams - An optional object with the accessToken
11
+ * property. If not passed, the function only works if initialize has been
12
+ * previously called. Also, this function allows managing pagination by passing
13
+ * the paginationSettings property, which accepts an object with the page and
14
+ * itemsPerPage properties.
15
+ * @returns A promise that resolves to an object containing an array of SEPA
16
+ * transfers and a `meta` object containing pagination state.
17
+ * @throws \{AuthenticationError\} If the access token is invalid or missing.
18
+ * Ensure initialize has been called before using this function if you are not
19
+ * passing the access token.
20
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
21
+ */
22
+ export declare function getSepaTransfers(getSepaTransfersParams?: GetSepaTransfersParams): Promise<GetSepaTransfersResponse>;
23
+ /**
24
+ * Fetches a single SEPA transfer of the current user by ID.
25
+ * @param Object - An object with the sepaTransferId and the optional accessToken
26
+ * and stagingToken properties.
27
+ * @returns A promise that resolves to a SEPA transfer.
28
+ * @throws \{AuthenticationError\} If the access token is invalid or missing.
29
+ * Ensure initialize has been called before using this function if you are not
30
+ * passing the access token.
31
+ * @throws \{InvalidParametersError\} If the `sepaTransferId` parameter is not a
32
+ * string or is missing.
33
+ * @throws \{EmbedApiError\} If the API request fails or returns an error.
34
+ */
35
+ export declare function getSepaTransfer({ sepaTransferId, accessToken, stagingToken, }: {
36
+ sepaTransferId: string;
37
+ accessToken?: string;
38
+ stagingToken?: string;
39
+ }): Promise<SepaTransfer>;
40
+ export {};
41
+ //# sourceMappingURL=sepa-transfers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAOtF,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAIhC,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,GAAE,sBAA2B,GAClD,OAAO,CAAC,wBAAwB,CAAC,CAqBnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,YAAY,CAAC,CASxB"}
@@ -0,0 +1,7 @@
1
+ import { getSepaTransfers, getSepaTransfer } from './sepa-transfers';
2
+ declare const sepaTransfers: {
3
+ getSepaTransfers: typeof getSepaTransfers;
4
+ getSepaTransfer: typeof getSepaTransfer;
5
+ };
6
+ export { sepaTransfers };
7
+ //# sourceMappingURL=sepa-transfers.public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.public-api.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,QAAA,MAAM,aAAa;;;CAGlB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SepaTransfer, SepaTransferDataObject } from './sepa-transfers.types';
2
+ export declare function serializeSepaTransfer(data: SepaTransferDataObject): SepaTransfer;
3
+ //# sourceMappingURL=sepa-transfers.serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.serializer.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,YAAY,CAoBd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sepa-transfers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.test.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import type { PaginationState } from '@common/api-pagination/api-pagination.types';
2
+ import { SEPA_TRANSFER_DECLINE_REASONS, SEPA_TRANSFER_STATUSES } from '@common/constants';
3
+ /**
4
+ * Represents the reasons why a SEPA transfer might be declined.
5
+ */
6
+ type SepaTransferDeclinedReason = (typeof SEPA_TRANSFER_DECLINE_REASONS)[keyof typeof SEPA_TRANSFER_DECLINE_REASONS];
7
+ /**
8
+ * Represents the possible statuses of a SEPA transfer.
9
+ */
10
+ type SepaTransferStatus = (typeof SEPA_TRANSFER_STATUSES)[keyof typeof SEPA_TRANSFER_STATUSES];
11
+ /**
12
+ * Represents a SEPA transfer in the system. This type includes all the fields
13
+ * necessary to describe a SEPA transfer and various timestamps related to the
14
+ * transfer's lifecycle.
15
+ */
16
+ export interface SepaTransfer {
17
+ id: string;
18
+ initiatorId: string;
19
+ bankAccountId: string;
20
+ amount: number;
21
+ amountCents: number;
22
+ amountCurrency: string;
23
+ status: SepaTransferStatus;
24
+ beneficiaryId: string;
25
+ reference: string;
26
+ note: string;
27
+ declinedReason: SepaTransferDeclinedReason;
28
+ scheduledDate: Date;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ processedAt: Date;
32
+ completedAt: Date;
33
+ transactionId: string;
34
+ }
35
+ export interface SepaTransferDataObject {
36
+ id: string;
37
+ initiator_id: string;
38
+ bank_account_id: string;
39
+ amount: string;
40
+ amount_cents: string;
41
+ amount_currency: string;
42
+ status: string;
43
+ beneficiary_id: string;
44
+ reference: string;
45
+ note: string;
46
+ declined_reason: string;
47
+ scheduled_date: string;
48
+ created_at: string;
49
+ updated_at: string;
50
+ processed_at: string;
51
+ completed_at: string;
52
+ transaction_id: string;
53
+ }
54
+ /**
55
+ * Represents the response structure for fetching a list of SEPA transfers.
56
+ */
57
+ export interface GetSepaTransfersResponse {
58
+ /**
59
+ * An array of SepaTransfer objects, each containing details about a specific
60
+ * transfer.
61
+ */
62
+ transfers: SepaTransfer[];
63
+ /**
64
+ * Metadata about the pagination state of the response, such as the current
65
+ * page and total pages.
66
+ */
67
+ meta?: PaginationState;
68
+ }
69
+ export {};
70
+ //# sourceMappingURL=sepa-transfers.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.types.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,KAAK,0BAA0B,GAC7B,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF;;GAEG;AACH,KAAK,kBAAkB,GACrB,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,0BAA0B,CAAC;IAC3C,aAAa,EAAE,IAAI,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export declare function validateGetSepaTransferParams(sepaTransferId: string): string;
2
+ //# sourceMappingURL=sepa-transfers.validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sepa-transfers.validate.d.ts","sourceRoot":"","sources":["../../src/sepa-transfers/sepa-transfers.validate.ts"],"names":[],"mappings":"AAEA,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAU5E"}
@@ -1 +1 @@
1
- import"../common/auth/auth.js";import{validatePresenceOfAuthToken as i}from"../common/auth/auth.validate.js";import{addBeneficiary as e,getBeneficiary as a,getBeneficiaries as n}from"./beneficiaries.api.js";import{serializeBeneficiary as t}from"./beneficiaries.serializer.js";import{validateAddBeneficiaryParams as s,validateGetBeneficiaryParams as o}from"./beneficiaries.validate.js";import{serializePaginationResponse as c}from"../common/api-pagination/api-pagination.js";async function r(e){const a=e?.accessToken||i(),s=await n({accessToken:a,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings});return{beneficiaries:s.beneficiaries.map((i=>t(i))),meta:c(s.meta)}}async function f({beneficiaryId:e,accessToken:n,stagingToken:s}){const c=n||i();o(e);const r=await a({beneficiaryId:e,accessToken:c,stagingToken:s});return t(r)}async function g({beneficiary:a,accessToken:n,stagingToken:o}){const c=n||i();s(a);const r=await e({beneficiary:a,accessToken:c,stagingToken:o});return t(r)}export{g as addBeneficiary,r as getBeneficiaries,f as getBeneficiary};
1
+ import"../common/auth/auth.js";import{validatePresenceOfAuthToken as i}from"../common/auth/auth.validate.js";import{addBeneficiary as e,getBeneficiary as a,getBeneficiaries as n}from"./beneficiaries.api.js";import{serializeBeneficiary as t}from"./beneficiaries.serializer.js";import{validateAddBeneficiaryParams as s,validateGetBeneficiaryParams as o}from"./beneficiaries.validate.js";import{serializePaginationResponse as c}from"../common/api-pagination/api-pagination.js";async function r(e){const a=e?.accessToken||i(),s=await n({accessToken:a,stagingToken:e?.stagingToken,paginationSettings:e?.paginationSettings}),o=s.beneficiaries.map((i=>t(i))),r=c(s.meta);return{beneficiaries:o,...r?{meta:r}:{}}}async function f({beneficiaryId:e,accessToken:n,stagingToken:s}){const c=n||i();o(e);const r=await a({beneficiaryId:e,accessToken:c,stagingToken:s});return t(r)}async function g({beneficiary:a,accessToken:n,stagingToken:o}){const c=n||i();s(a);const r=await e({beneficiary:a,accessToken:c,stagingToken:o});return t(r)}export{g as addBeneficiary,r as getBeneficiaries,f as getBeneficiary};
@@ -1 +1 @@
1
- function e({endpointUrl:e,paginationSettings:t}){const a=new URL(e);return t?.page&&a.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&a.searchParams.set("per_page",t.itemsPerPage.toString()),a}function t(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}}export{e as addPaginationParamsToUrl,t as serializePaginationResponse};
1
+ function e({endpointUrl:e,paginationSettings:t}){const a=new URL(e);return t?.page&&a.searchParams.set("page",t.page.toString()),t?.itemsPerPage&&a.searchParams.set("per_page",t.itemsPerPage.toString()),a}function t(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}}export{e as addPaginationParamsToUrl,t as serializePaginationResponse};
@@ -1 +1 @@
1
- const e={READY:"qonto.ready"},_={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},E={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},a={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},A={ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},n={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"};export{_ as ACTIONS,A as ACTIVITY_TAGS,n as BENEFICIARY_STATUSES,a as BRANCHES,E as ENVIRONMENTS,e as IFRAME_EVENTS};
1
+ const _={READY:"qonto.ready"},e={CARD_SEE:"card.see",CARD_SEE_DETAILS:"card.see-details",CARD_ORDER:"card.order",CARD_UNLOCK:"card.unlock",CARD_SHOW_PIN:"card.show.pin",CARD_SET_PIN:"card.set.pin",TRANSFERS_CREATE:"transfers.create"},E={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},n={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},N={ATM:"atm",FALLBACK:"fallback",FEES:"fees",FINANCE:"finance",FOOD_AND_GROCERY:"food_and_grocery",GAS_STATION:"gas_station",HARDWARE_AND_EQUIPMENT:"hardware_and_equipment",HOTEL_AND_LODGING:"hotel_and_lodging",INSURANCE:"insurance",IT_AND_ELECTRONICS:"it_and_electronics",LEGAL_AND_ACCOUNTING:"legal_and_accounting",LOGISTICS:"logistics",MANUFACTURING:"manufacturing",MARKETING:"marketing",OFFICE_RENTAL:"office_rental",OFFICE_SUPPLY:"office_supply",ONLINE_SERVICE:"online_service",OTHER_EXPENSE:"other_expense",OTHER_INCOME:"other_income",OTHER_SERVICE:"other_service",PENDING:"pending",REFUND:"refund",RESTAURANT_AND_BAR:"restaurant_and_bar",SALES:"sales",SALARY:"salary",SUBSCRIPTION:"subscription",TAX:"tax",TRANSPORT:"transport",TREASURY_AND_INTERCO:"treasury_and_interco",UTILITY:"utility",VOUCHER:"voucher"},a={PENDING:"pending",VALIDATED:"validated",DECLINED:"declined"},A={BENEFICIARY_BIC_INVALID:"beneficiary_bic_invalid",BENEFICIARY_IBAN_INVALID:"beneficiary_iban_invalid",BENEFICIARY_STATUS:"beneficiary_status",BENEFICIARY_NETWORK_RULES_ERROR:"beneficiary_network_rules_error",ORGANISATION_COMPLIANCE_REASONS:"organisation_compliance_reasons",DEBIT_ACCOUNT_INSUFFICIENT_FUNDS:"debit_account_insufficient_funds",QONTO_PROCESSING_FAILED:"qonto_processing_failed"},i={PENDING:"pending",PROCESSING:"processing",CANCELED:"canceled",DECLINED:"declined",SETTLED:"settled"};export{e as ACTIONS,N as ACTIVITY_TAGS,a as BENEFICIARY_STATUSES,n as BRANCHES,E as ENVIRONMENTS,_ as IFRAME_EVENTS,A as SEPA_TRANSFER_DECLINE_REASONS,i as SEPA_TRANSFER_STATUSES};
package/dist/src/index.js CHANGED
@@ -1 +1 @@
1
- export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";
1
+ export{constants,initialize,logout}from"./common/index.js";export{cards}from"./cards/index.js";export{beneficiaries}from"./beneficiaries/index.js";export{sepaTransfers}from"./sepa-transfers/index.js";
@@ -0,0 +1 @@
1
+ import{sepaTransfers as s}from"./sepa-transfers.public-api.js";const r=s;export{r as sepaTransfers};
@@ -0,0 +1 @@
1
+ import{buildRequestHeaders as n}from"../common/network/network.js";import{environmentManager as e}from"../common/environment/environment-manager.js";import{addPaginationParamsToUrl as r}from"../common/api-pagination/api-pagination.js";import{EmbedApiError as o}from"../errors/EmbedApiError.js";const t="/v2/sepa/transfers";async function a({accessToken:a,stagingToken:s,paginationSettings:i}){const m={method:"GET",headers:n({accessToken:a,stagingToken:s})},c=new URL(e.getEnvironmentUrls().THIRD_PARTY_API_URL+t),f=r({endpointUrl:c,paginationSettings:i}),g=await fetch(f,m);if(!g.ok)throw new o("Failed to fetch SEPA transfers");const p=await g.json();if(p.errors)throw new o(p.errors.map((n=>`${n.code}: ${n.detail}`)));return{transfers:p.transfers,meta:p.meta}}async function s({accessToken:r,stagingToken:a,sepaTransferId:s}){const i={method:"GET",headers:n({accessToken:r,stagingToken:a})},m=`${e.getEnvironmentUrls().THIRD_PARTY_API_URL}${t}/${s}`,c=await fetch(m,i),f=await c.json();if(f.errors)throw new o(f.errors.map((n=>`${n.code}: ${n.detail}`)));return f.external_transfer}export{t as SEPA_TRANSFERS_ENDPOINT,s as getSepaTransfer,a as getSepaTransfers};
@@ -0,0 +1 @@
1
+ import"../common/auth/auth.js";import{validatePresenceOfAuthToken as a}from"../common/auth/auth.validate.js";import{serializePaginationResponse as s}from"../common/api-pagination/api-pagination.js";import{getSepaTransfer as n,getSepaTransfers as t}from"./sepa-transfers.api.js";import{serializeSepaTransfer as e}from"./sepa-transfers.serializer.js";import{validateGetSepaTransferParams as r}from"./sepa-transfers.validate.js";async function o(n={}){const r=n?.accessToken||a(),o=await t({accessToken:r,stagingToken:n?.stagingToken,paginationSettings:n?.paginationSettings}),i=o.transfers.map((a=>e(a))),p=s(o.meta);return{transfers:i,...p?{meta:p}:{}}}async function i({sepaTransferId:s,accessToken:t,stagingToken:o}){const i=t||a();r(s);const p=await n({sepaTransferId:s,accessToken:i,stagingToken:o});return e(p)}export{i as getSepaTransfer,o as getSepaTransfers};
@@ -0,0 +1 @@
1
+ import{getSepaTransfer as e,getSepaTransfers as r}from"./sepa-transfers.js";const s={getSepaTransfers:r,getSepaTransfer:e};export{s as sepaTransfers};
@@ -0,0 +1 @@
1
+ function e(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}}export{e as serializeSepaTransfer};
@@ -0,0 +1 @@
1
+ import{InvalidParametersError as r}from"../errors/InvalidParametersError.js";function e(e){if(!e)throw new r("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new r("sepaTransferId must be a string");return e}export{e as validateGetSepaTransferParams};
@@ -1,3 +1,3 @@
1
- import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState } from './types.public-api';
2
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState, };
1
+ import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, SepaTransfer, GetSepaTransfersResponse, GetBeneficiariesResponse, PaginationState, BankAccount, ACCOUNT_STATUS } from './types.public-api';
2
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, BankAccount, ACCOUNT_STATUS, };
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,cAAc,EACf,MAAM,oBAAoB,CAAC;AAM5B,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,cAAc,GACf,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings } from '@cards/cards.types';
2
2
  import type { Beneficiary, GetBeneficiariesResponse } from '@beneficiaries/beneficiaries.types';
3
+ import type { SepaTransfer, GetSepaTransfersResponse } from '@sepa-transfers/sepa-transfers.types';
3
4
  import type { PaginationState } from '@common/api-pagination/api-pagination.types';
4
- export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, PaginationState, };
5
+ import type { BankAccount, ACCOUNT_STATUS } from '@organizations/organizations.types';
6
+ export type { Card, VirtualCardOrderSettings, PhysicalCardOrderSettings, CardOrderSettings, Beneficiary, GetBeneficiariesResponse, SepaTransfer, GetSepaTransfersResponse, PaginationState, BankAccount, ACCOUNT_STATUS, };
5
7
  //# sourceMappingURL=types.public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,eAAe,GAChB,CAAC"}
1
+ {"version":3,"file":"types.public-api.d.ts","sourceRoot":"","sources":["../../src/types/types.public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACf,MAAM,oCAAoC,CAAC;AAE5C,YAAY,EACV,IAAI,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,cAAc,GACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qonto/embed-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Library to embed Qonto features in your application",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,18 @@
17
17
  "types": "./dist/beneficiaries/index.d.ts",
18
18
  "import": "./dist/src/beneficiaries/index.js"
19
19
  },
20
+ "./sepa-transfers": {
21
+ "types": "./dist/sepa-transfers/index.d.ts",
22
+ "import": "./dist/src/sepa-transfers/index.js"
23
+ },
20
24
  "./common": {
21
25
  "types": "./dist/common/index.d.ts",
22
26
  "import": "./dist/src/common/index.js"
23
27
  },
28
+ "./organizations": {
29
+ "types": "./dist/organizations/index.d.ts",
30
+ "import": "./dist/src/organizations/index.js"
31
+ },
24
32
  "./types": {
25
33
  "types": "./dist/types/index.d.ts",
26
34
  "import": "./dist/src/types/index.js"