@takeal/cusfront-sdk 0.1.0 → 0.3.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 (91) hide show
  1. package/CHANGELOG.md +104 -2
  2. package/README.md +393 -14
  3. package/dist/devices-C3JHi2Hi.d.cts +165 -0
  4. package/dist/devices-DP_hxwmW.d.ts +165 -0
  5. package/dist/{http-BkZZZI8K.d.cts → http-B-OQwMYn.d.cts} +13 -2
  6. package/dist/{http-BkZZZI8K.d.ts → http-B-OQwMYn.d.ts} +13 -2
  7. package/dist/index.cjs +425 -25
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +77 -8
  10. package/dist/index.d.ts +77 -8
  11. package/dist/index.js +422 -26
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/index.cjs +133 -6
  14. package/dist/react/index.cjs.map +1 -1
  15. package/dist/react/index.d.cts +65 -3
  16. package/dist/react/index.d.ts +65 -3
  17. package/dist/react/index.js +131 -8
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/resources/auth.cjs +73 -15
  20. package/dist/resources/auth.cjs.map +1 -1
  21. package/dist/resources/auth.d.cts +100 -9
  22. package/dist/resources/auth.d.ts +100 -9
  23. package/dist/resources/auth.js +73 -15
  24. package/dist/resources/auth.js.map +1 -1
  25. package/dist/resources/balance.cjs +4 -3
  26. package/dist/resources/balance.cjs.map +1 -1
  27. package/dist/resources/balance.d.cts +8 -9
  28. package/dist/resources/balance.d.ts +8 -9
  29. package/dist/resources/balance.js +4 -3
  30. package/dist/resources/balance.js.map +1 -1
  31. package/dist/resources/blog.d.cts +1 -1
  32. package/dist/resources/blog.d.ts +1 -1
  33. package/dist/resources/branding.cjs.map +1 -1
  34. package/dist/resources/branding.d.cts +8 -2
  35. package/dist/resources/branding.d.ts +8 -2
  36. package/dist/resources/branding.js.map +1 -1
  37. package/dist/resources/cards.cjs +33 -1
  38. package/dist/resources/cards.cjs.map +1 -1
  39. package/dist/resources/cards.d.cts +105 -4
  40. package/dist/resources/cards.d.ts +105 -4
  41. package/dist/resources/cards.js +33 -1
  42. package/dist/resources/cards.js.map +1 -1
  43. package/dist/resources/deposits.d.cts +1 -1
  44. package/dist/resources/deposits.d.ts +1 -1
  45. package/dist/resources/devices.cjs +92 -0
  46. package/dist/resources/devices.cjs.map +1 -0
  47. package/dist/resources/devices.d.cts +3 -0
  48. package/dist/resources/devices.d.ts +3 -0
  49. package/dist/resources/devices.js +89 -0
  50. package/dist/resources/devices.js.map +1 -0
  51. package/dist/resources/me.cjs +32 -0
  52. package/dist/resources/me.cjs.map +1 -0
  53. package/dist/resources/me.d.cts +40 -0
  54. package/dist/resources/me.d.ts +40 -0
  55. package/dist/resources/me.js +30 -0
  56. package/dist/resources/me.js.map +1 -0
  57. package/dist/resources/notifications.cjs +53 -0
  58. package/dist/resources/notifications.cjs.map +1 -0
  59. package/dist/resources/notifications.d.cts +109 -0
  60. package/dist/resources/notifications.d.ts +109 -0
  61. package/dist/resources/notifications.js +51 -0
  62. package/dist/resources/notifications.js.map +1 -0
  63. package/dist/resources/push.cjs +65 -0
  64. package/dist/resources/push.cjs.map +1 -0
  65. package/dist/resources/push.d.cts +76 -0
  66. package/dist/resources/push.d.ts +76 -0
  67. package/dist/resources/push.js +62 -0
  68. package/dist/resources/push.js.map +1 -0
  69. package/dist/resources/sessions.cjs +26 -0
  70. package/dist/resources/sessions.cjs.map +1 -0
  71. package/dist/resources/sessions.d.cts +43 -0
  72. package/dist/resources/sessions.d.ts +43 -0
  73. package/dist/resources/sessions.js +24 -0
  74. package/dist/resources/sessions.js.map +1 -0
  75. package/dist/resources/subscriptions.cjs.map +1 -1
  76. package/dist/resources/subscriptions.d.cts +8 -1
  77. package/dist/resources/subscriptions.d.ts +8 -1
  78. package/dist/resources/subscriptions.js.map +1 -1
  79. package/dist/resources/wallet.cjs +24 -0
  80. package/dist/resources/wallet.cjs.map +1 -0
  81. package/dist/resources/wallet.d.cts +39 -0
  82. package/dist/resources/wallet.d.ts +39 -0
  83. package/dist/resources/wallet.js +22 -0
  84. package/dist/resources/wallet.js.map +1 -0
  85. package/dist/telegram.cjs +466 -28
  86. package/dist/telegram.cjs.map +1 -1
  87. package/dist/telegram.d.cts +65 -7
  88. package/dist/telegram.d.ts +65 -7
  89. package/dist/telegram.js +465 -29
  90. package/dist/telegram.js.map +1 -1
  91. package/package.json +37 -3
@@ -1,12 +1,11 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Balance resource — `client.balance.*`.
5
5
  *
6
- * The user's wallet balance, tracked in the ledger. Mirrors
7
- * the Takeal API's `GET /me/balance?currency=<code>` route. Balance is per-currency:
8
- * the endpoint requires a `currency` query param and returns the amount held
9
- * in that currency.
6
+ * The user's wallet balance, tracked in the ledger. Mirrors the Takeal API's
7
+ * `GET /me/balance[?currency=<code>]` route. Balances are per-currency; with
8
+ * no `currency` the wallet's own currency is returned (see `client.wallet`).
10
9
  */
11
10
  /** Wallet balance for one currency. `amount` is a decimal string. */
12
11
  interface Balance {
@@ -17,11 +16,11 @@ declare class BalanceResource {
17
16
  private readonly http;
18
17
  constructor(http: HttpClient);
19
18
  /**
20
- * Fetch the user's wallet balance for `currency` (ISO 4217, e.g. `"USD"`).
21
- * Required — the ledger holds a separate balance per currency, so there is
22
- * no "total" without one.
19
+ * Fetch the user's wallet balance. Omit `currency` for the wallet's own
20
+ * currency; pass an ISO 4217 code (e.g. `"USD"`) to read another one —
21
+ * the ledger holds a separate balance per currency.
23
22
  */
24
- get(currency: string): Promise<Balance>;
23
+ get(currency?: string): Promise<Balance>;
25
24
  }
26
25
 
27
26
  export { type Balance, BalanceResource };
@@ -4,11 +4,12 @@ var BalanceResource = class {
4
4
  this.http = http;
5
5
  }
6
6
  /**
7
- * Fetch the user's wallet balance for `currency` (ISO 4217, e.g. `"USD"`).
8
- * Required — the ledger holds a separate balance per currency, so there is
9
- * no "total" without one.
7
+ * Fetch the user's wallet balance. Omit `currency` for the wallet's own
8
+ * currency; pass an ISO 4217 code (e.g. `"USD"`) to read another one —
9
+ * the ledger holds a separate balance per currency.
10
10
  */
11
11
  async get(currency) {
12
+ if (!currency) return this.http.get("/me/balance");
12
13
  const q = new URLSearchParams({ currency }).toString();
13
14
  return this.http.get(`/me/balance?${q}`);
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/balance.ts"],"names":[],"mappings":";AAiBO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhD,MAAM,IAAI,QAAA,EAAoC;AAC5C,IAAA,MAAM,IAAI,IAAI,eAAA,CAAgB,EAAE,QAAA,EAAU,EAAE,QAAA,EAAS;AACrD,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAa,CAAA,YAAA,EAAe,CAAC,CAAA,CAAE,CAAA;AAAA,EAClD;AACF","file":"balance.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Balance resource — `client.balance.*`.\n *\n * The user's wallet balance, tracked in the ledger. Mirrors\n * the Takeal API's `GET /me/balance?currency=<code>` route. Balance is per-currency:\n * the endpoint requires a `currency` query param and returns the amount held\n * in that currency.\n */\n\n/** Wallet balance for one currency. `amount` is a decimal string. */\nexport interface Balance {\n amount: string;\n currency: string;\n}\n\nexport class BalanceResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Fetch the user's wallet balance for `currency` (ISO 4217, e.g. `\"USD\"`).\n * Required — the ledger holds a separate balance per currency, so there is\n * no \"total\" without one.\n */\n async get(currency: string): Promise<Balance> {\n const q = new URLSearchParams({ currency }).toString();\n return this.http.get<Balance>(`/me/balance?${q}`);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/balance.ts"],"names":[],"mappings":";AAgBO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhD,MAAM,IAAI,QAAA,EAAqC;AAC7C,IAAA,IAAI,CAAC,QAAA,EAAU,OAAO,IAAA,CAAK,IAAA,CAAK,IAAa,aAAa,CAAA;AAC1D,IAAA,MAAM,IAAI,IAAI,eAAA,CAAgB,EAAE,QAAA,EAAU,EAAE,QAAA,EAAS;AACrD,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAa,CAAA,YAAA,EAAe,CAAC,CAAA,CAAE,CAAA;AAAA,EAClD;AACF","file":"balance.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Balance resource — `client.balance.*`.\n *\n * The user's wallet balance, tracked in the ledger. Mirrors the Takeal API's\n * `GET /me/balance[?currency=<code>]` route. Balances are per-currency; with\n * no `currency` the wallet's own currency is returned (see `client.wallet`).\n */\n\n/** Wallet balance for one currency. `amount` is a decimal string. */\nexport interface Balance {\n amount: string;\n currency: string;\n}\n\nexport class BalanceResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Fetch the user's wallet balance. Omit `currency` for the wallet's own\n * currency; pass an ISO 4217 code (e.g. `\"USD\"`) to read another one —\n * the ledger holds a separate balance per currency.\n */\n async get(currency?: string): Promise<Balance> {\n if (!currency) return this.http.get<Balance>(\"/me/balance\");\n const q = new URLSearchParams({ currency }).toString();\n return this.http.get<Balance>(`/me/balance?${q}`);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Blog resource — `client.blog.*`.
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Blog resource — `client.blog.*`.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/branding.ts"],"names":[],"mappings":";;;AA2BO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAsB;AAChE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAc,WAAA,EAAa,EAAE,UAAU,IAAA,EAAM,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACrF;AACF","file":"branding.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Branding resource — `client.branding.*`.\n *\n * Runtime white-label config published by the deployment at `GET /branding`\n * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform\n * name, logo, favicon and the label used for the end-user's balance — without\n * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values\n * win whenever both are present.\n */\n\n/** Public brand config of the deployment. All strings; empty = use the client default. */\nexport interface Branding {\n /** Platform display name (e.g. the white-label brand). */\n platform_name: string;\n /** Name of the merchant-facing portal. */\n merchant_portal_name: string;\n /** Logo image — absolute URL or `data:` URI. Empty → client default. */\n logo_url: string;\n /** Favicon — absolute URL or `data:` URI. Empty → client default. */\n favicon_url: string;\n /** User-facing name of the balance, e.g. `\"Wallet\"` or `\"Acme Wallet\"`.\n * Display-only: the `balance` API shape never changes with it. */\n wallet_label: string;\n}\n\nexport class BrandingResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Fetch the deployment's public brand config. Safe to call before login. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Branding> {\n return this.http.get<Branding>(\"/branding\", { skipAuth: true, signal: opts.signal });\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/branding.ts"],"names":[],"mappings":";;;AAiCO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAsB;AAChE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAc,WAAA,EAAa,EAAE,UAAU,IAAA,EAAM,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACrF;AACF","file":"branding.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Branding resource — `client.branding.*`.\n *\n * Runtime white-label config published by the deployment at `GET /branding`\n * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform\n * name, logo, favicon, brand colours and the label used for the end-user's balance — without\n * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values\n * win whenever both are present.\n */\n\n/** Public brand config of the deployment. All strings; empty = use the client default. */\nexport interface Branding {\n /** Platform display name (e.g. the white-label brand). */\n platform_name: string;\n /** Name of the merchant-facing portal. */\n merchant_portal_name: string;\n /** Logo image — absolute URL or `data:` URI. Empty → client default. */\n logo_url: string;\n /** Favicon — absolute URL or `data:` URI. Empty → client default. */\n favicon_url: string;\n /** User-facing name of the balance, e.g. `\"Wallet\"` or `\"Acme Wallet\"`.\n * Display-only: the `balance` API shape never changes with it. */\n wallet_label: string;\n /** Primary brand colour as `#rrggbb`. Empty → client default palette. */\n primary_color: string;\n /** Secondary brand colour as `#rrggbb`. Empty → client default palette. */\n secondary_color: string;\n /** Accent colour as `#rrggbb`. Empty → client default palette. */\n accent_color: string;\n}\n\nexport class BrandingResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Fetch the deployment's public brand config. Safe to call before login. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Branding> {\n return this.http.get<Branding>(\"/branding\", { skipAuth: true, signal: opts.signal });\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Branding resource — `client.branding.*`.
5
5
  *
6
6
  * Runtime white-label config published by the deployment at `GET /branding`
7
7
  * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform
8
- * name, logo, favicon and the label used for the end-user's balance — without
8
+ * name, logo, favicon, brand colours and the label used for the end-user's balance — without
9
9
  * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values
10
10
  * win whenever both are present.
11
11
  */
@@ -22,6 +22,12 @@ interface Branding {
22
22
  /** User-facing name of the balance, e.g. `"Wallet"` or `"Acme Wallet"`.
23
23
  * Display-only: the `balance` API shape never changes with it. */
24
24
  wallet_label: string;
25
+ /** Primary brand colour as `#rrggbb`. Empty → client default palette. */
26
+ primary_color: string;
27
+ /** Secondary brand colour as `#rrggbb`. Empty → client default palette. */
28
+ secondary_color: string;
29
+ /** Accent colour as `#rrggbb`. Empty → client default palette. */
30
+ accent_color: string;
25
31
  }
26
32
  declare class BrandingResource {
27
33
  private readonly http;
@@ -1,11 +1,11 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Branding resource — `client.branding.*`.
5
5
  *
6
6
  * Runtime white-label config published by the deployment at `GET /branding`
7
7
  * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform
8
- * name, logo, favicon and the label used for the end-user's balance — without
8
+ * name, logo, favicon, brand colours and the label used for the end-user's balance — without
9
9
  * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values
10
10
  * win whenever both are present.
11
11
  */
@@ -22,6 +22,12 @@ interface Branding {
22
22
  /** User-facing name of the balance, e.g. `"Wallet"` or `"Acme Wallet"`.
23
23
  * Display-only: the `balance` API shape never changes with it. */
24
24
  wallet_label: string;
25
+ /** Primary brand colour as `#rrggbb`. Empty → client default palette. */
26
+ primary_color: string;
27
+ /** Secondary brand colour as `#rrggbb`. Empty → client default palette. */
28
+ secondary_color: string;
29
+ /** Accent colour as `#rrggbb`. Empty → client default palette. */
30
+ accent_color: string;
25
31
  }
26
32
  declare class BrandingResource {
27
33
  private readonly http;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/branding.ts"],"names":[],"mappings":";AA2BO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAsB;AAChE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAc,WAAA,EAAa,EAAE,UAAU,IAAA,EAAM,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACrF;AACF","file":"branding.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Branding resource — `client.branding.*`.\n *\n * Runtime white-label config published by the deployment at `GET /branding`\n * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform\n * name, logo, favicon and the label used for the end-user's balance — without\n * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values\n * win whenever both are present.\n */\n\n/** Public brand config of the deployment. All strings; empty = use the client default. */\nexport interface Branding {\n /** Platform display name (e.g. the white-label brand). */\n platform_name: string;\n /** Name of the merchant-facing portal. */\n merchant_portal_name: string;\n /** Logo image — absolute URL or `data:` URI. Empty → client default. */\n logo_url: string;\n /** Favicon — absolute URL or `data:` URI. Empty → client default. */\n favicon_url: string;\n /** User-facing name of the balance, e.g. `\"Wallet\"` or `\"Acme Wallet\"`.\n * Display-only: the `balance` API shape never changes with it. */\n wallet_label: string;\n}\n\nexport class BrandingResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Fetch the deployment's public brand config. Safe to call before login. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Branding> {\n return this.http.get<Branding>(\"/branding\", { skipAuth: true, signal: opts.signal });\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/branding.ts"],"names":[],"mappings":";AAiCO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,GAAA,CAAI,IAAA,GAAiC,EAAC,EAAsB;AAChE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAc,WAAA,EAAa,EAAE,UAAU,IAAA,EAAM,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAQ,CAAA;AAAA,EACrF;AACF","file":"branding.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Branding resource — `client.branding.*`.\n *\n * Runtime white-label config published by the deployment at `GET /branding`\n * (public, no auth). Lets a Cusfront re-theme itself on the fly — platform\n * name, logo, favicon, brand colours and the label used for the end-user's balance — without\n * a rebuild. Pairs with the build-time `BrandConfig`: the server-side values\n * win whenever both are present.\n */\n\n/** Public brand config of the deployment. All strings; empty = use the client default. */\nexport interface Branding {\n /** Platform display name (e.g. the white-label brand). */\n platform_name: string;\n /** Name of the merchant-facing portal. */\n merchant_portal_name: string;\n /** Logo image — absolute URL or `data:` URI. Empty → client default. */\n logo_url: string;\n /** Favicon — absolute URL or `data:` URI. Empty → client default. */\n favicon_url: string;\n /** User-facing name of the balance, e.g. `\"Wallet\"` or `\"Acme Wallet\"`.\n * Display-only: the `balance` API shape never changes with it. */\n wallet_label: string;\n /** Primary brand colour as `#rrggbb`. Empty → client default palette. */\n primary_color: string;\n /** Secondary brand colour as `#rrggbb`. Empty → client default palette. */\n secondary_color: string;\n /** Accent colour as `#rrggbb`. Empty → client default palette. */\n accent_color: string;\n}\n\nexport class BrandingResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Fetch the deployment's public brand config. Safe to call before login. */\n async get(opts: { signal?: AbortSignal } = {}): Promise<Branding> {\n return this.http.get<Branding>(\"/branding\", { skipAuth: true, signal: opts.signal });\n }\n}\n"]}
@@ -12,12 +12,44 @@ var CardsResource = class {
12
12
  * `failure_reason` on the result.
13
13
  */
14
14
  async create(input) {
15
- const { idempotencyKey, ...body } = input;
15
+ const { idempotencyKey, productId, name, designId, ...rest } = input;
16
+ const body = { ...rest };
17
+ if (productId !== void 0) body["product_id"] = productId;
18
+ if (name !== void 0) body["name"] = name;
19
+ if (designId !== void 0) body["design_id"] = designId;
16
20
  return this.http.post("/me/cards", {
17
21
  body,
18
22
  idempotencyKey
19
23
  });
20
24
  }
25
+ /**
26
+ * The cards the caller can order, in the order the deployment offers them
27
+ * (the default product first). Each item carries its name, description,
28
+ * artwork, the issuance price after the caller's subscription discount,
29
+ * and the currency. Pass an item's `id` as `productId` to {@link create}.
30
+ */
31
+ async listProducts() {
32
+ return this.http.get("/me/card-products");
33
+ }
34
+ /** One product from the catalog. 404 when unknown, disabled or hidden. */
35
+ async getProduct(id) {
36
+ return this.http.get(
37
+ `/me/card-products/${encodeURIComponent(id)}`
38
+ );
39
+ }
40
+ /**
41
+ * Rename the caller's own card or change its design. Resolves to the
42
+ * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
43
+ * `design_not_allowed` on a bad value.
44
+ */
45
+ async update(id, input) {
46
+ const body = {};
47
+ if (input.name !== void 0) body["name"] = input.name;
48
+ if (input.designId !== void 0) body["design_id"] = input.designId;
49
+ return this.http.patch(`/me/cards/${encodeURIComponent(id)}`, {
50
+ body
51
+ });
52
+ }
21
53
  /** Fetch one card by id. */
22
54
  async get(id) {
23
55
  return this.http.get(`/me/cards/${encodeURIComponent(id)}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/cards.ts"],"names":[],"mappings":";;;AAkIO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhD,MAAM,OAA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f,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,OAAA,CAAA;AAAA,MACnC,EAAE,MAAM,EAAE,QAAA,EAAU,MAAM,QAAA,EAAU,SAAA,EAAW,KAAA,CAAM,QAAA,EAAS;AAAE,KAClE;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,SAAS,EAAA,EAA2B;AACxC,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,SAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAC;AAAE,KACb;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAA,CAAU,EAAA,EAAY,MAAA,EAAgC;AAC1D,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,UAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO;AAAE,KACrB;AAAA,EACF;AACF","file":"cards.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\nimport type { CustomerInfo } from \"../types/customer.js\";\n\n/**\n * Cards resource — `client.cards.*`.\n *\n * The end-user \"money OUT\" surface: a user issues themselves a card backed by\n * their wallet balance via an issuer connector. Mirrors the Takeal API's\n * `/me/cards` routes:\n *\n * POST /me/cards → create\n * GET /me/cards → list (most recent first)\n * GET /me/cards/{id} → get\n * GET /me/cards/{id}/balance → balance (prepaid remaining)\n * POST /me/cards/{id}/freeze → freeze\n * POST /me/cards/{id}/unfreeze → unfreeze\n * POST /me/cards/{id}/terminate → terminate (one-way)\n *\n * The lifecycle actions are ownership-gated server-side: a caller can only\n * freeze / unfreeze / terminate a card that belongs to them (else 404).\n *\n * ## What is intentionally NOT here\n *\n * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its\n * own re-auth + rate-limit + audit contract and is intentionally\n * NOT part of this resource (tracked separately).\n *\n * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from\n * the Takeal API until their issuer flows land.\n */\n\n/** Card product. Only `prepaid` is fully implemented today. */\nexport type CardType = \"credit\" | \"prepaid\" | \"gift\";\n\n/**\n * Card lifecycle state.\n *\n * `pending_payment` is a transient state: the row exists but the\n * per-card issuance-fee debit has not yet succeeded; such cards have no\n * provider reference and no user-visible side effects.\n */\nexport type CardStatus =\n | \"pending_payment\"\n | \"active\"\n | \"frozen\"\n | \"terminated\"\n | \"redeemed\"\n | \"failed\";\n\n/**\n * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the\n * SDK never receives the full PAN or CVV here — only `last4` + expiry. The\n * gift-card `redemption_code` is returned exactly once (on create) and\n * scrubbed from subsequent list/get responses.\n */\nexport interface Card {\n id: string;\n user_id: string;\n card_type: CardType;\n /** Slug of the issuer that minted this card, as configured by the deployment. */\n connector_slug: string;\n /** The connector's own reference, populated once it responds. */\n provider_reference: string | null;\n status: CardStatus;\n /** Last four digits of the PAN — safe to display. */\n last4: string | null;\n expiry_month: number | null;\n expiry_year: number | null;\n /** Gift cards only, present once on create then scrubbed. */\n redemption_code?: string;\n /** Decimal as a string. */\n initial_amount: string | null;\n currency: string;\n failure_reason: string | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface CreateCardInput {\n /** `prepaid` (the only fully-wired type today), `credit`, or `gift`. */\n type: CardType;\n /** Decimal as a string. The prepaid load amount drained from wallet balance. */\n initial_amount?: string;\n /** ISO 4217 code, e.g. `\"USD\"`. */\n currency: string;\n /**\n * Optional. Slug of a specific issuer to mint with. Omit to let\n * the Takeal API pick the first active issuer. Unknown slug → 400; empty issuer\n * list → 503.\n */\n issuer_slug?: string;\n metadata?: Record<string, string>;\n /** Structured billing details — real issuers require these for 3DS / KYC. */\n customer?: CustomerInfo;\n /**\n * Required by the Takeal API on this write endpoint. Same key + body replays the\n * original card; same key + different body returns 409.\n */\n idempotencyKey: string;\n}\n\n/** Remaining balance of a prepaid card. */\nexport interface CardBalance {\n amount: string;\n currency: string;\n}\n\n/** Re-auth gate for {@link CardsResource.reveal}. */\nexport interface RevealCardInput {\n /** The user's account password — mandatory re-auth. */\n password: string;\n /** TOTP code; required only when the user has TOTP enrolled. */\n totpCode?: string;\n}\n\n/**\n * Full card data from a successful reveal. **Security**: never persist this —\n * keep it in volatile memory only, clear it within `expires_in_seconds`, and\n * never write it to localStorage / logs (the API marks the response no-store).\n */\nexport interface RevealedCard {\n pan: string;\n cvv: string;\n expiry_month: number;\n expiry_year: number;\n holder_name: string;\n /** Display window before the client should auto-clear the data. */\n expires_in_seconds: number;\n}\n\nexport class CardsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Issue a card backed by the user's wallet balance. Resolves to the new\n * `Card`. On a ledger failure after provider creation, the Takeal API rolls the row\n * to `failed` (never an orphaned active card); inspect `status` /\n * `failure_reason` on the result.\n */\n async create(input: CreateCardInput): Promise<Card> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Card>(\"/me/cards\", {\n body,\n idempotencyKey,\n });\n }\n\n /** Fetch one card by id. */\n async get(id: string): Promise<Card> {\n return this.http.get<Card>(`/me/cards/${encodeURIComponent(id)}`);\n }\n\n /** List the caller's cards, most recent first. */\n async list(): Promise<Card[]> {\n return this.http.get<Card[]>(\"/me/cards\");\n }\n\n /**\n * Remaining balance of a prepaid card. `currency` is required by the Takeal API and\n * forwarded as a query param.\n */\n async balance(id: string, currency: string): Promise<CardBalance> {\n const q = new URLSearchParams({ currency }).toString();\n return this.http.get<CardBalance>(\n `/me/cards/${encodeURIComponent(id)}/balance?${q}`,\n );\n }\n\n /**\n * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional\n * `reason` is recorded on the audit trail. Resolves to the updated card.\n * 404 if the card isn't the caller's; 501 if the issuer can't freeze.\n */\n async freeze(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/freeze`,\n { body: { reason } },\n );\n }\n\n /**\n * Reveal the FULL PAN + CVV for the caller's own card. Re-auth gated\n * (password, + TOTP when the user has it enrolled) and rate-limited\n * server-side. The Takeal API never persists this data and marks the\n * response no-store; the SDK returns it verbatim and holds nothing.\n *\n * **Consumer security duties** (the SDK can't enforce these for you):\n * keep the result in volatile memory only, never write it to\n * localStorage / logs, and clear it within `expires_in_seconds`.\n *\n * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector\n * has no sensitive-data endpoint · 503 provider error.\n */\n async reveal(id: string, input: RevealCardInput): Promise<RevealedCard> {\n return this.http.post<RevealedCard>(\n `/me/cards/${encodeURIComponent(id)}/reveal`,\n { body: { password: input.password, totp_code: input.totpCode } },\n );\n }\n\n /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */\n async unfreeze(id: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/unfreeze`,\n { body: {} },\n );\n }\n\n /**\n * Terminate the caller's own card. **One-way** — a terminated card cannot be\n * reactivated. The optional `reason` is audited. Idempotent on an\n * already-terminated card.\n */\n async terminate(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/terminate`,\n { body: { reason } },\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/cards.ts"],"names":[],"mappings":";;;AAyNO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhD,MAAM,OAAO,KAAA,EAAuC;AAClD,IAAA,MAAM,EAAE,cAAA,EAAgB,SAAA,EAAW,MAAM,QAAA,EAAU,GAAG,MAAK,GAAI,KAAA;AAC/D,IAAA,MAAM,IAAA,GAAgC,EAAE,GAAG,IAAA,EAAK;AAChD,IAAA,IAAI,SAAA,KAAc,MAAA,EAAW,IAAA,CAAK,YAAY,CAAA,GAAI,SA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A,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAA,CAAU,EAAA,EAAY,MAAA,EAAgC;AAC1D,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,UAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO;AAAE,KACrB;AAAA,EACF;AACF","file":"cards.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\nimport type { CustomerInfo } from \"../types/customer.js\";\n\n/**\n * Cards resource — `client.cards.*`.\n *\n * The end-user \"money OUT\" surface: a user issues themselves a card backed by\n * their wallet balance via an issuer connector. Mirrors the Takeal API's\n * `/me/cards` routes:\n *\n * GET /me/card-products → listProducts (the catalog)\n * GET /me/card-products/{id} → getProduct\n * POST /me/cards → create\n * GET /me/cards → list (most recent first)\n * GET /me/cards/{id} → get\n * PATCH /me/cards/{id} → update (name, design)\n * GET /me/cards/{id}/balance → balance (prepaid remaining)\n * POST /me/cards/{id}/freeze → freeze\n * POST /me/cards/{id}/unfreeze → unfreeze\n * POST /me/cards/{id}/terminate → terminate (one-way)\n *\n * The lifecycle actions are ownership-gated server-side: a caller can only\n * freeze / unfreeze / terminate a card that belongs to them (else 404).\n *\n * ## What is intentionally NOT here\n *\n * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its\n * own re-auth + rate-limit + audit contract and is intentionally\n * NOT part of this resource (tracked separately).\n *\n * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from\n * the Takeal API until their issuer flows land.\n */\n\n/** Card product. Only `prepaid` is fully implemented today. */\nexport type CardType = \"credit\" | \"prepaid\" | \"gift\";\n\n/**\n * Card lifecycle state.\n *\n * `pending_payment` is a transient state: the row exists but the\n * per-card issuance-fee debit has not yet succeeded; such cards have no\n * provider reference and no user-visible side effects.\n */\nexport type CardStatus =\n | \"pending_payment\"\n | \"active\"\n | \"frozen\"\n | \"terminated\"\n | \"redeemed\"\n | \"failed\";\n\n/**\n * A card design: the artwork a card is shown with. `image_url` is either an\n * absolute URL or a path relative to the API origin (the deployment's default\n * design is `/card-designs/default.svg`) — pass it through\n * `client.assetUrl()` before rendering. `id` is `null` for the deployment\n * default, which is rendered from the branding settings.\n */\nexport interface CardDesignRef {\n id: string | null;\n name?: string;\n image_url: string;\n}\n\n/**\n * What issuing a card costs the caller. `amount` is the price after the\n * user's subscription discount; `base_amount` is the list price and\n * `discount_bps` the discount in basis points (1000 = 10 %). `label` is the\n * operator's wording for the fee line (\"Card issuance\").\n */\nexport interface CardProductPrice {\n amount: string;\n currency: string;\n label: string;\n base_amount: string;\n discount_bps: number;\n}\n\n/**\n * A card the user can order, as listed by `GET /me/card-products`. The id is\n * opaque — it names a product, never a provider. `designs` is the set the\n * user may pick from (may be empty when only the default applies); `design`\n * is what the card gets when no choice is made. `price` is `null` for a\n * free card. `features` is an operator-defined object (scheme, wallet\n * support, load limits, …) with no fixed keys.\n */\nexport interface CardProduct {\n id: string;\n name: string;\n description: string | null;\n card_type: CardType;\n currency: string | null;\n features: Record<string, unknown>;\n design: CardDesignRef;\n designs: CardDesignRef[];\n price: CardProductPrice | null;\n /** True for the product the deployment issues when none is chosen. */\n is_default: boolean;\n}\n\n/**\n * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the\n * SDK never receives the full PAN or CVV here — only `last4` + expiry. The\n * gift-card `redemption_code` is returned exactly once (on create) and\n * scrubbed from subsequent list/get responses.\n */\nexport interface Card {\n id: string;\n user_id: string;\n card_type: CardType;\n /** Slug of the issuer that minted this card, as configured by the deployment. */\n connector_slug: string;\n /** The connector's own reference, populated once it responds. */\n provider_reference: string | null;\n status: CardStatus;\n /** Last four digits of the PAN — safe to display. */\n last4: string | null;\n expiry_month: number | null;\n expiry_year: number | null;\n /** Gift cards only, present once on create then scrubbed. */\n redemption_code?: string;\n /** Decimal as a string. */\n initial_amount: string | null;\n currency: string;\n failure_reason: string | null;\n /** The name the user gave the card, or `null`. */\n name: string | null;\n /** The artwork the card is shown with. Always present. */\n design: CardDesignRef;\n /** The product the card was issued from; `null` for cards issued without one. */\n product: { id: string; name: string } | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface CreateCardInput {\n /**\n * A product id from {@link CardsResource.listProducts}. Sent as\n * `product_id`. When given, `type` and `issuer_slug` may be omitted; when\n * both are given they must agree with the product (400 `product_mismatch`).\n * Unknown, disabled or hidden product → 400 `unknown_product`.\n */\n productId?: string;\n /** A name for the card, 1–40 characters. Sent as `name`. */\n name?: string;\n /**\n * One of the product's `designs`. Sent as `design_id`. `null` or omitted\n * picks the product's default design; a design outside the product's set →\n * 400 `design_not_allowed`.\n */\n designId?: string | null;\n /**\n * `prepaid` (the only fully-wired type today), `credit`, or `gift`.\n * Optional when `productId` is given, required otherwise.\n */\n type?: CardType;\n /** Decimal as a string. The prepaid load amount drained from wallet balance. */\n initial_amount?: string;\n /** ISO 4217 code, e.g. `\"USD\"`. */\n currency: string;\n /**\n * Optional. Slug of a specific issuer to mint with. Omit to let\n * the Takeal API pick the first active issuer. Unknown slug → 400; empty issuer\n * list → 503.\n */\n issuer_slug?: string;\n metadata?: Record<string, string>;\n /** Structured billing details — real issuers require these for 3DS / KYC. */\n customer?: CustomerInfo;\n /**\n * Required by the Takeal API on this write endpoint. Same key + body replays the\n * original card; same key + different body returns 409.\n */\n idempotencyKey: string;\n}\n\n/** Remaining balance of a prepaid card. */\nexport interface CardBalance {\n amount: string;\n currency: string;\n}\n\n/** Fields a user can change on their own card. Omitted fields are left as they are. */\nexport interface UpdateCardInput {\n /** New name, 1–40 characters. Sent as `name`. */\n name?: string;\n /**\n * New design (one of the product's `designs`), or `null` for the product's\n * default. Sent as `design_id`.\n */\n designId?: string | null;\n}\n\n/** Re-auth gate for {@link CardsResource.reveal}. */\nexport interface RevealCardInput {\n /** The user's account password — mandatory re-auth. */\n password: string;\n /** TOTP code; required only when the user has TOTP enrolled. */\n totpCode?: string;\n}\n\n/**\n * Full card data from a successful reveal. **Security**: never persist this —\n * keep it in volatile memory only, clear it within `expires_in_seconds`, and\n * never write it to localStorage / logs (the API marks the response no-store).\n */\nexport interface RevealedCard {\n pan: string;\n cvv: string;\n expiry_month: number;\n expiry_year: number;\n holder_name: string;\n /** Display window before the client should auto-clear the data. */\n expires_in_seconds: number;\n}\n\nexport class CardsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Issue a card backed by the user's wallet balance. Resolves to the new\n * `Card`. On a ledger failure after provider creation, the Takeal API rolls the row\n * to `failed` (never an orphaned active card); inspect `status` /\n * `failure_reason` on the result.\n */\n async create(input: CreateCardInput): Promise<Card> {\n const { idempotencyKey, productId, name, designId, ...rest } = input;\n const body: Record<string, unknown> = { ...rest };\n if (productId !== undefined) body[\"product_id\"] = productId;\n if (name !== undefined) body[\"name\"] = name;\n if (designId !== undefined) body[\"design_id\"] = designId;\n return this.http.post<Card>(\"/me/cards\", {\n body,\n idempotencyKey,\n });\n }\n\n /**\n * The cards the caller can order, in the order the deployment offers them\n * (the default product first). Each item carries its name, description,\n * artwork, the issuance price after the caller's subscription discount,\n * and the currency. Pass an item's `id` as `productId` to {@link create}.\n */\n async listProducts(): Promise<CardProduct[]> {\n return this.http.get<CardProduct[]>(\"/me/card-products\");\n }\n\n /** One product from the catalog. 404 when unknown, disabled or hidden. */\n async getProduct(id: string): Promise<CardProduct> {\n return this.http.get<CardProduct>(\n `/me/card-products/${encodeURIComponent(id)}`,\n );\n }\n\n /**\n * Rename the caller's own card or change its design. Resolves to the\n * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /\n * `design_not_allowed` on a bad value.\n */\n async update(id: string, input: UpdateCardInput): Promise<Card> {\n const body: Record<string, unknown> = {};\n if (input.name !== undefined) body[\"name\"] = input.name;\n if (input.designId !== undefined) body[\"design_id\"] = input.designId;\n return this.http.patch<Card>(`/me/cards/${encodeURIComponent(id)}`, {\n body,\n });\n }\n\n /** Fetch one card by id. */\n async get(id: string): Promise<Card> {\n return this.http.get<Card>(`/me/cards/${encodeURIComponent(id)}`);\n }\n\n /** List the caller's cards, most recent first. */\n async list(): Promise<Card[]> {\n return this.http.get<Card[]>(\"/me/cards\");\n }\n\n /**\n * Remaining balance of a prepaid card. `currency` is required by the Takeal API and\n * forwarded as a query param.\n */\n async balance(id: string, currency: string): Promise<CardBalance> {\n const q = new URLSearchParams({ currency }).toString();\n return this.http.get<CardBalance>(\n `/me/cards/${encodeURIComponent(id)}/balance?${q}`,\n );\n }\n\n /**\n * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional\n * `reason` is recorded on the audit trail. Resolves to the updated card.\n * 404 if the card isn't the caller's; 501 if the issuer can't freeze.\n */\n async freeze(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/freeze`,\n { body: { reason } },\n );\n }\n\n /**\n * Reveal the FULL PAN + CVV for the caller's own card. Re-auth gated\n * (password, + TOTP when the user has it enrolled) and rate-limited\n * server-side. The Takeal API never persists this data and marks the\n * response no-store; the SDK returns it verbatim and holds nothing.\n *\n * **Consumer security duties** (the SDK can't enforce these for you):\n * keep the result in volatile memory only, never write it to\n * localStorage / logs, and clear it within `expires_in_seconds`.\n *\n * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector\n * has no sensitive-data endpoint · 503 provider error.\n */\n async reveal(id: string, input: RevealCardInput): Promise<RevealedCard> {\n return this.http.post<RevealedCard>(\n `/me/cards/${encodeURIComponent(id)}/reveal`,\n { body: { password: input.password, totp_code: input.totpCode } },\n );\n }\n\n /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */\n async unfreeze(id: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/unfreeze`,\n { body: {} },\n );\n }\n\n /**\n * Terminate the caller's own card. **One-way** — a terminated card cannot be\n * reactivated. The optional `reason` is audited. Idempotent on an\n * already-terminated card.\n */\n async terminate(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/terminate`,\n { body: { reason } },\n );\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
  import { C as CustomerInfo } from '../customer-CoxPwe5o.cjs';
3
3
 
4
4
  /**
@@ -8,9 +8,12 @@ import { C as CustomerInfo } from '../customer-CoxPwe5o.cjs';
8
8
  * their wallet balance via an issuer connector. Mirrors the Takeal API's
9
9
  * `/me/cards` routes:
10
10
  *
11
+ * GET /me/card-products → listProducts (the catalog)
12
+ * GET /me/card-products/{id} → getProduct
11
13
  * POST /me/cards → create
12
14
  * GET /me/cards → list (most recent first)
13
15
  * GET /me/cards/{id} → get
16
+ * PATCH /me/cards/{id} → update (name, design)
14
17
  * GET /me/cards/{id}/balance → balance (prepaid remaining)
15
18
  * POST /me/cards/{id}/freeze → freeze
16
19
  * POST /me/cards/{id}/unfreeze → unfreeze
@@ -38,6 +41,52 @@ type CardType = "credit" | "prepaid" | "gift";
38
41
  * provider reference and no user-visible side effects.
39
42
  */
40
43
  type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
44
+ /**
45
+ * A card design: the artwork a card is shown with. `image_url` is either an
46
+ * absolute URL or a path relative to the API origin (the deployment's default
47
+ * design is `/card-designs/default.svg`) — pass it through
48
+ * `client.assetUrl()` before rendering. `id` is `null` for the deployment
49
+ * default, which is rendered from the branding settings.
50
+ */
51
+ interface CardDesignRef {
52
+ id: string | null;
53
+ name?: string;
54
+ image_url: string;
55
+ }
56
+ /**
57
+ * What issuing a card costs the caller. `amount` is the price after the
58
+ * user's subscription discount; `base_amount` is the list price and
59
+ * `discount_bps` the discount in basis points (1000 = 10 %). `label` is the
60
+ * operator's wording for the fee line ("Card issuance").
61
+ */
62
+ interface CardProductPrice {
63
+ amount: string;
64
+ currency: string;
65
+ label: string;
66
+ base_amount: string;
67
+ discount_bps: number;
68
+ }
69
+ /**
70
+ * A card the user can order, as listed by `GET /me/card-products`. The id is
71
+ * opaque — it names a product, never a provider. `designs` is the set the
72
+ * user may pick from (may be empty when only the default applies); `design`
73
+ * is what the card gets when no choice is made. `price` is `null` for a
74
+ * free card. `features` is an operator-defined object (scheme, wallet
75
+ * support, load limits, …) with no fixed keys.
76
+ */
77
+ interface CardProduct {
78
+ id: string;
79
+ name: string;
80
+ description: string | null;
81
+ card_type: CardType;
82
+ currency: string | null;
83
+ features: Record<string, unknown>;
84
+ design: CardDesignRef;
85
+ designs: CardDesignRef[];
86
+ price: CardProductPrice | null;
87
+ /** True for the product the deployment issues when none is chosen. */
88
+ is_default: boolean;
89
+ }
41
90
  /**
42
91
  * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
43
92
  * SDK never receives the full PAN or CVV here — only `last4` + expiry. The
@@ -63,12 +112,39 @@ interface Card {
63
112
  initial_amount: string | null;
64
113
  currency: string;
65
114
  failure_reason: string | null;
115
+ /** The name the user gave the card, or `null`. */
116
+ name: string | null;
117
+ /** The artwork the card is shown with. Always present. */
118
+ design: CardDesignRef;
119
+ /** The product the card was issued from; `null` for cards issued without one. */
120
+ product: {
121
+ id: string;
122
+ name: string;
123
+ } | null;
66
124
  created_at: string;
67
125
  updated_at: string;
68
126
  }
69
127
  interface CreateCardInput {
70
- /** `prepaid` (the only fully-wired type today), `credit`, or `gift`. */
71
- type: CardType;
128
+ /**
129
+ * A product id from {@link CardsResource.listProducts}. Sent as
130
+ * `product_id`. When given, `type` and `issuer_slug` may be omitted; when
131
+ * both are given they must agree with the product (400 `product_mismatch`).
132
+ * Unknown, disabled or hidden product → 400 `unknown_product`.
133
+ */
134
+ productId?: string;
135
+ /** A name for the card, 1–40 characters. Sent as `name`. */
136
+ name?: string;
137
+ /**
138
+ * One of the product's `designs`. Sent as `design_id`. `null` or omitted
139
+ * picks the product's default design; a design outside the product's set →
140
+ * 400 `design_not_allowed`.
141
+ */
142
+ designId?: string | null;
143
+ /**
144
+ * `prepaid` (the only fully-wired type today), `credit`, or `gift`.
145
+ * Optional when `productId` is given, required otherwise.
146
+ */
147
+ type?: CardType;
72
148
  /** Decimal as a string. The prepaid load amount drained from wallet balance. */
73
149
  initial_amount?: string;
74
150
  /** ISO 4217 code, e.g. `"USD"`. */
@@ -93,6 +169,16 @@ interface CardBalance {
93
169
  amount: string;
94
170
  currency: string;
95
171
  }
172
+ /** Fields a user can change on their own card. Omitted fields are left as they are. */
173
+ interface UpdateCardInput {
174
+ /** New name, 1–40 characters. Sent as `name`. */
175
+ name?: string;
176
+ /**
177
+ * New design (one of the product's `designs`), or `null` for the product's
178
+ * default. Sent as `design_id`.
179
+ */
180
+ designId?: string | null;
181
+ }
96
182
  /** Re-auth gate for {@link CardsResource.reveal}. */
97
183
  interface RevealCardInput {
98
184
  /** The user's account password — mandatory re-auth. */
@@ -124,6 +210,21 @@ declare class CardsResource {
124
210
  * `failure_reason` on the result.
125
211
  */
126
212
  create(input: CreateCardInput): Promise<Card>;
213
+ /**
214
+ * The cards the caller can order, in the order the deployment offers them
215
+ * (the default product first). Each item carries its name, description,
216
+ * artwork, the issuance price after the caller's subscription discount,
217
+ * and the currency. Pass an item's `id` as `productId` to {@link create}.
218
+ */
219
+ listProducts(): Promise<CardProduct[]>;
220
+ /** One product from the catalog. 404 when unknown, disabled or hidden. */
221
+ getProduct(id: string): Promise<CardProduct>;
222
+ /**
223
+ * Rename the caller's own card or change its design. Resolves to the
224
+ * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
225
+ * `design_not_allowed` on a bad value.
226
+ */
227
+ update(id: string, input: UpdateCardInput): Promise<Card>;
127
228
  /** Fetch one card by id. */
128
229
  get(id: string): Promise<Card>;
129
230
  /** List the caller's cards, most recent first. */
@@ -163,4 +264,4 @@ declare class CardsResource {
163
264
  terminate(id: string, reason?: string): Promise<Card>;
164
265
  }
165
266
 
166
- export { type Card, type CardBalance, type CardStatus, type CardType, CardsResource, type CreateCardInput, type RevealCardInput, type RevealedCard };
267
+ export { type Card, type CardBalance, type CardDesignRef, type CardProduct, type CardProductPrice, type CardStatus, type CardType, CardsResource, type CreateCardInput, type RevealCardInput, type RevealedCard, type UpdateCardInput };
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkZZZI8K.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
  import { C as CustomerInfo } from '../customer-CoxPwe5o.js';
3
3
 
4
4
  /**
@@ -8,9 +8,12 @@ import { C as CustomerInfo } from '../customer-CoxPwe5o.js';
8
8
  * their wallet balance via an issuer connector. Mirrors the Takeal API's
9
9
  * `/me/cards` routes:
10
10
  *
11
+ * GET /me/card-products → listProducts (the catalog)
12
+ * GET /me/card-products/{id} → getProduct
11
13
  * POST /me/cards → create
12
14
  * GET /me/cards → list (most recent first)
13
15
  * GET /me/cards/{id} → get
16
+ * PATCH /me/cards/{id} → update (name, design)
14
17
  * GET /me/cards/{id}/balance → balance (prepaid remaining)
15
18
  * POST /me/cards/{id}/freeze → freeze
16
19
  * POST /me/cards/{id}/unfreeze → unfreeze
@@ -38,6 +41,52 @@ type CardType = "credit" | "prepaid" | "gift";
38
41
  * provider reference and no user-visible side effects.
39
42
  */
40
43
  type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
44
+ /**
45
+ * A card design: the artwork a card is shown with. `image_url` is either an
46
+ * absolute URL or a path relative to the API origin (the deployment's default
47
+ * design is `/card-designs/default.svg`) — pass it through
48
+ * `client.assetUrl()` before rendering. `id` is `null` for the deployment
49
+ * default, which is rendered from the branding settings.
50
+ */
51
+ interface CardDesignRef {
52
+ id: string | null;
53
+ name?: string;
54
+ image_url: string;
55
+ }
56
+ /**
57
+ * What issuing a card costs the caller. `amount` is the price after the
58
+ * user's subscription discount; `base_amount` is the list price and
59
+ * `discount_bps` the discount in basis points (1000 = 10 %). `label` is the
60
+ * operator's wording for the fee line ("Card issuance").
61
+ */
62
+ interface CardProductPrice {
63
+ amount: string;
64
+ currency: string;
65
+ label: string;
66
+ base_amount: string;
67
+ discount_bps: number;
68
+ }
69
+ /**
70
+ * A card the user can order, as listed by `GET /me/card-products`. The id is
71
+ * opaque — it names a product, never a provider. `designs` is the set the
72
+ * user may pick from (may be empty when only the default applies); `design`
73
+ * is what the card gets when no choice is made. `price` is `null` for a
74
+ * free card. `features` is an operator-defined object (scheme, wallet
75
+ * support, load limits, …) with no fixed keys.
76
+ */
77
+ interface CardProduct {
78
+ id: string;
79
+ name: string;
80
+ description: string | null;
81
+ card_type: CardType;
82
+ currency: string | null;
83
+ features: Record<string, unknown>;
84
+ design: CardDesignRef;
85
+ designs: CardDesignRef[];
86
+ price: CardProductPrice | null;
87
+ /** True for the product the deployment issues when none is chosen. */
88
+ is_default: boolean;
89
+ }
41
90
  /**
42
91
  * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
43
92
  * SDK never receives the full PAN or CVV here — only `last4` + expiry. The
@@ -63,12 +112,39 @@ interface Card {
63
112
  initial_amount: string | null;
64
113
  currency: string;
65
114
  failure_reason: string | null;
115
+ /** The name the user gave the card, or `null`. */
116
+ name: string | null;
117
+ /** The artwork the card is shown with. Always present. */
118
+ design: CardDesignRef;
119
+ /** The product the card was issued from; `null` for cards issued without one. */
120
+ product: {
121
+ id: string;
122
+ name: string;
123
+ } | null;
66
124
  created_at: string;
67
125
  updated_at: string;
68
126
  }
69
127
  interface CreateCardInput {
70
- /** `prepaid` (the only fully-wired type today), `credit`, or `gift`. */
71
- type: CardType;
128
+ /**
129
+ * A product id from {@link CardsResource.listProducts}. Sent as
130
+ * `product_id`. When given, `type` and `issuer_slug` may be omitted; when
131
+ * both are given they must agree with the product (400 `product_mismatch`).
132
+ * Unknown, disabled or hidden product → 400 `unknown_product`.
133
+ */
134
+ productId?: string;
135
+ /** A name for the card, 1–40 characters. Sent as `name`. */
136
+ name?: string;
137
+ /**
138
+ * One of the product's `designs`. Sent as `design_id`. `null` or omitted
139
+ * picks the product's default design; a design outside the product's set →
140
+ * 400 `design_not_allowed`.
141
+ */
142
+ designId?: string | null;
143
+ /**
144
+ * `prepaid` (the only fully-wired type today), `credit`, or `gift`.
145
+ * Optional when `productId` is given, required otherwise.
146
+ */
147
+ type?: CardType;
72
148
  /** Decimal as a string. The prepaid load amount drained from wallet balance. */
73
149
  initial_amount?: string;
74
150
  /** ISO 4217 code, e.g. `"USD"`. */
@@ -93,6 +169,16 @@ interface CardBalance {
93
169
  amount: string;
94
170
  currency: string;
95
171
  }
172
+ /** Fields a user can change on their own card. Omitted fields are left as they are. */
173
+ interface UpdateCardInput {
174
+ /** New name, 1–40 characters. Sent as `name`. */
175
+ name?: string;
176
+ /**
177
+ * New design (one of the product's `designs`), or `null` for the product's
178
+ * default. Sent as `design_id`.
179
+ */
180
+ designId?: string | null;
181
+ }
96
182
  /** Re-auth gate for {@link CardsResource.reveal}. */
97
183
  interface RevealCardInput {
98
184
  /** The user's account password — mandatory re-auth. */
@@ -124,6 +210,21 @@ declare class CardsResource {
124
210
  * `failure_reason` on the result.
125
211
  */
126
212
  create(input: CreateCardInput): Promise<Card>;
213
+ /**
214
+ * The cards the caller can order, in the order the deployment offers them
215
+ * (the default product first). Each item carries its name, description,
216
+ * artwork, the issuance price after the caller's subscription discount,
217
+ * and the currency. Pass an item's `id` as `productId` to {@link create}.
218
+ */
219
+ listProducts(): Promise<CardProduct[]>;
220
+ /** One product from the catalog. 404 when unknown, disabled or hidden. */
221
+ getProduct(id: string): Promise<CardProduct>;
222
+ /**
223
+ * Rename the caller's own card or change its design. Resolves to the
224
+ * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
225
+ * `design_not_allowed` on a bad value.
226
+ */
227
+ update(id: string, input: UpdateCardInput): Promise<Card>;
127
228
  /** Fetch one card by id. */
128
229
  get(id: string): Promise<Card>;
129
230
  /** List the caller's cards, most recent first. */
@@ -163,4 +264,4 @@ declare class CardsResource {
163
264
  terminate(id: string, reason?: string): Promise<Card>;
164
265
  }
165
266
 
166
- export { type Card, type CardBalance, type CardStatus, type CardType, CardsResource, type CreateCardInput, type RevealCardInput, type RevealedCard };
267
+ export { type Card, type CardBalance, type CardDesignRef, type CardProduct, type CardProductPrice, type CardStatus, type CardType, CardsResource, type CreateCardInput, type RevealCardInput, type RevealedCard, type UpdateCardInput };
@@ -10,12 +10,44 @@ var CardsResource = class {
10
10
  * `failure_reason` on the result.
11
11
  */
12
12
  async create(input) {
13
- const { idempotencyKey, ...body } = input;
13
+ const { idempotencyKey, productId, name, designId, ...rest } = input;
14
+ const body = { ...rest };
15
+ if (productId !== void 0) body["product_id"] = productId;
16
+ if (name !== void 0) body["name"] = name;
17
+ if (designId !== void 0) body["design_id"] = designId;
14
18
  return this.http.post("/me/cards", {
15
19
  body,
16
20
  idempotencyKey
17
21
  });
18
22
  }
23
+ /**
24
+ * The cards the caller can order, in the order the deployment offers them
25
+ * (the default product first). Each item carries its name, description,
26
+ * artwork, the issuance price after the caller's subscription discount,
27
+ * and the currency. Pass an item's `id` as `productId` to {@link create}.
28
+ */
29
+ async listProducts() {
30
+ return this.http.get("/me/card-products");
31
+ }
32
+ /** One product from the catalog. 404 when unknown, disabled or hidden. */
33
+ async getProduct(id) {
34
+ return this.http.get(
35
+ `/me/card-products/${encodeURIComponent(id)}`
36
+ );
37
+ }
38
+ /**
39
+ * Rename the caller's own card or change its design. Resolves to the
40
+ * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
41
+ * `design_not_allowed` on a bad value.
42
+ */
43
+ async update(id, input) {
44
+ const body = {};
45
+ if (input.name !== void 0) body["name"] = input.name;
46
+ if (input.designId !== void 0) body["design_id"] = input.designId;
47
+ return this.http.patch(`/me/cards/${encodeURIComponent(id)}`, {
48
+ body
49
+ });
50
+ }
19
51
  /** Fetch one card by id. */
20
52
  async get(id) {
21
53
  return this.http.get(`/me/cards/${encodeURIComponent(id)}`);