@delopay/sdk 0.481.0 → 0.483.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 (358) hide show
  1. package/dist/airwallexCard.cjs.map +1 -1
  2. package/dist/branding.cjs.map +1 -1
  3. package/dist/cardFormStyles.cjs.map +1 -1
  4. package/dist/checkoutSession.cjs +2 -2
  5. package/dist/checkoutSession.cjs.map +1 -1
  6. package/dist/checkoutSession.js +1 -1
  7. package/dist/chunk-244VZFFO.cjs.map +1 -1
  8. package/dist/chunk-2IJRBJXW.cjs.map +1 -1
  9. package/dist/{chunk-U72OIM7A.cjs → chunk-2OVTWQ3B.cjs} +7 -2
  10. package/dist/chunk-2OVTWQ3B.cjs.map +1 -0
  11. package/dist/{chunk-TSAQN7I5.js → chunk-2W55GSRP.js} +2 -2
  12. package/dist/chunk-2W55GSRP.js.map +1 -0
  13. package/dist/chunk-34PC72O7.cjs.map +1 -1
  14. package/dist/chunk-3GBWQWTP.cjs.map +1 -1
  15. package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
  16. package/dist/chunk-44QBWVRS.cjs.map +1 -1
  17. package/dist/chunk-4EKAWNYI.cjs.map +1 -1
  18. package/dist/chunk-4LN4BR2T.cjs.map +1 -1
  19. package/dist/chunk-4T4XHPYN.cjs.map +1 -1
  20. package/dist/chunk-5CITBN33.cjs.map +1 -1
  21. package/dist/chunk-5HCKC4HF.cjs.map +1 -1
  22. package/dist/{chunk-LZUHCGJ3.js → chunk-5LSXCHJU.js} +5 -2
  23. package/dist/chunk-5LSXCHJU.js.map +1 -0
  24. package/dist/chunk-5O2JSQYA.cjs.map +1 -1
  25. package/dist/chunk-5QS67SBO.cjs.map +1 -1
  26. package/dist/chunk-6BFZS4YP.cjs.map +1 -1
  27. package/dist/chunk-6EBY2KKL.cjs.map +1 -1
  28. package/dist/chunk-6LFOM6HV.cjs.map +1 -1
  29. package/dist/chunk-6LOWE2YI.cjs.map +1 -1
  30. package/dist/chunk-6LSG5Z4T.cjs.map +1 -1
  31. package/dist/chunk-6SU2MTN2.cjs.map +1 -1
  32. package/dist/{chunk-EHRQSUIK.js → chunk-6Y7YGECJ.js} +2 -2
  33. package/dist/chunk-6YCDLSIU.cjs.map +1 -1
  34. package/dist/chunk-75E5WNJG.cjs.map +1 -1
  35. package/dist/chunk-7JV6VVO7.cjs.map +1 -1
  36. package/dist/chunk-7NKJD5ST.cjs.map +1 -1
  37. package/dist/chunk-7QZCUXWB.cjs.map +1 -1
  38. package/dist/chunk-7VXF5D67.cjs.map +1 -1
  39. package/dist/chunk-ABWAYMN5.cjs.map +1 -1
  40. package/dist/chunk-ACZ2R47X.cjs.map +1 -1
  41. package/dist/chunk-AYUYJO3I.cjs.map +1 -1
  42. package/dist/chunk-BCA3TCGS.cjs.map +1 -1
  43. package/dist/{chunk-6MXPGE7O.cjs → chunk-BJ7Q4R6O.cjs} +11 -11
  44. package/dist/chunk-BJ7Q4R6O.cjs.map +1 -0
  45. package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
  46. package/dist/chunk-BRY3W7N3.cjs.map +1 -1
  47. package/dist/{chunk-FDHLDKNY.cjs → chunk-BT3UAUEV.cjs} +2 -2
  48. package/dist/chunk-BT3UAUEV.cjs.map +1 -0
  49. package/dist/chunk-CAMALM35.cjs.map +1 -1
  50. package/dist/chunk-CCN44NZJ.cjs.map +1 -1
  51. package/dist/{chunk-EK7RLJZB.js → chunk-CQ5WZMCN.js} +7 -2
  52. package/dist/chunk-CQ5WZMCN.js.map +1 -0
  53. package/dist/chunk-CR3JBTP3.cjs.map +1 -1
  54. package/dist/chunk-DJASVBOJ.cjs.map +1 -1
  55. package/dist/chunk-EEB2HDYL.cjs.map +1 -1
  56. package/dist/chunk-ENPSUWTS.cjs.map +1 -1
  57. package/dist/chunk-EQ6P6ZND.cjs.map +1 -1
  58. package/dist/chunk-EXPWQBI3.cjs.map +1 -1
  59. package/dist/{chunk-OPOSNWK4.cjs → chunk-EYHSXJMJ.cjs} +4 -2
  60. package/dist/chunk-EYHSXJMJ.cjs.map +1 -0
  61. package/dist/chunk-F3I5DOWV.cjs.map +1 -1
  62. package/dist/chunk-F46K5H3U.cjs.map +1 -1
  63. package/dist/chunk-F6S3WCCB.cjs.map +1 -1
  64. package/dist/chunk-FQRC4NJG.cjs.map +1 -1
  65. package/dist/chunk-FTWGI7UZ.cjs.map +1 -1
  66. package/dist/chunk-FYISDU2Y.cjs.map +1 -1
  67. package/dist/chunk-GG52SAHA.cjs.map +1 -1
  68. package/dist/chunk-GK5FWN4H.cjs.map +1 -1
  69. package/dist/chunk-GSQN5EOO.cjs.map +1 -1
  70. package/dist/chunk-GW7IHYXR.cjs.map +1 -1
  71. package/dist/chunk-GWSVQXEY.cjs.map +1 -1
  72. package/dist/chunk-HLHML5ES.cjs.map +1 -1
  73. package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
  74. package/dist/chunk-HLYGHP6F.cjs.map +1 -1
  75. package/dist/chunk-HSJABE7X.cjs.map +1 -1
  76. package/dist/{chunk-MCNDMK7F.cjs → chunk-HXKNTSTZ.cjs} +16 -1
  77. package/dist/chunk-HXKNTSTZ.cjs.map +1 -0
  78. package/dist/{chunk-ABDDRKOT.js → chunk-HYQXNRST.js} +3 -2
  79. package/dist/chunk-HYQXNRST.js.map +1 -0
  80. package/dist/chunk-I2W7AO4B.cjs.map +1 -1
  81. package/dist/chunk-I2XGNALG.cjs.map +1 -1
  82. package/dist/chunk-IGHAJNC6.cjs.map +1 -1
  83. package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
  84. package/dist/chunk-IR2LFKKA.cjs.map +1 -1
  85. package/dist/chunk-J4ZB7MU4.cjs.map +1 -1
  86. package/dist/{chunk-E2TF7JDB.cjs → chunk-J5RPSRBQ.cjs} +9 -8
  87. package/dist/chunk-J5RPSRBQ.cjs.map +1 -0
  88. package/dist/{chunk-2MSCXFWD.cjs → chunk-JETHANGQ.cjs} +3 -3
  89. package/dist/chunk-JETHANGQ.cjs.map +1 -0
  90. package/dist/chunk-JPPRDMTJ.cjs.map +1 -1
  91. package/dist/chunk-K5Q2H3VD.cjs.map +1 -1
  92. package/dist/{chunk-CPGGSHNB.js → chunk-K5WRCYXA.js} +4 -2
  93. package/dist/chunk-K5WRCYXA.js.map +1 -0
  94. package/dist/chunk-KD5Y2YWK.cjs.map +1 -1
  95. package/dist/chunk-KJDMNF2T.cjs.map +1 -1
  96. package/dist/chunk-KLONGJCL.cjs.map +1 -1
  97. package/dist/chunk-LJ2EG6JK.cjs.map +1 -1
  98. package/dist/chunk-LLYY4TCZ.cjs.map +1 -1
  99. package/dist/chunk-LYIBTVK6.cjs.map +1 -1
  100. package/dist/chunk-M3HWE7KT.cjs.map +1 -1
  101. package/dist/chunk-M3SJHFT4.cjs.map +1 -1
  102. package/dist/chunk-MLG6NXI6.cjs.map +1 -1
  103. package/dist/chunk-MYAXAWBQ.cjs.map +1 -1
  104. package/dist/chunk-NFB3S2E6.cjs.map +1 -1
  105. package/dist/chunk-NYL3BNHR.cjs.map +1 -1
  106. package/dist/chunk-O4AYHLQX.cjs.map +1 -1
  107. package/dist/chunk-OAEKP665.cjs.map +1 -1
  108. package/dist/chunk-ODPNVNYE.cjs.map +1 -1
  109. package/dist/chunk-OG2KJAYD.cjs.map +1 -1
  110. package/dist/chunk-OYZP6NF6.cjs.map +1 -1
  111. package/dist/chunk-P4UILJVU.cjs.map +1 -1
  112. package/dist/chunk-P7DYLUUI.cjs.map +1 -1
  113. package/dist/chunk-PKAE6AQT.cjs.map +1 -1
  114. package/dist/chunk-PYNHK6AP.cjs.map +1 -1
  115. package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
  116. package/dist/chunk-QKUWFMZP.cjs.map +1 -1
  117. package/dist/chunk-QRSA72B3.cjs.map +1 -1
  118. package/dist/chunk-QYNRNDIY.cjs.map +1 -1
  119. package/dist/{chunk-CYH4HZ4Y.cjs → chunk-R2AKKQ35.cjs} +107 -23
  120. package/dist/chunk-R2AKKQ35.cjs.map +1 -0
  121. package/dist/chunk-R4GA6BVP.cjs.map +1 -1
  122. package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
  123. package/dist/chunk-RHFUXHQN.cjs.map +1 -1
  124. package/dist/chunk-RI42IDRR.cjs.map +1 -1
  125. package/dist/{chunk-QGTVOC6O.js → chunk-S2P7TRD4.js} +16 -1
  126. package/dist/chunk-S2P7TRD4.js.map +1 -0
  127. package/dist/chunk-S77LQWYC.cjs.map +1 -1
  128. package/dist/chunk-S7SBNOGS.cjs.map +1 -1
  129. package/dist/chunk-TMAJE5P2.cjs.map +1 -1
  130. package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
  131. package/dist/chunk-U3JK7NBG.cjs.map +1 -1
  132. package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
  133. package/dist/chunk-UKLZAOLW.cjs.map +1 -1
  134. package/dist/chunk-V47G7P6L.cjs.map +1 -1
  135. package/dist/{chunk-CPT6VNW7.js → chunk-VGN3KBFY.js} +107 -23
  136. package/dist/chunk-VGN3KBFY.js.map +1 -0
  137. package/dist/chunk-VH5A6SMU.cjs.map +1 -1
  138. package/dist/chunk-VHMH4QMY.cjs.map +1 -1
  139. package/dist/chunk-VYC7WUM5.cjs.map +1 -1
  140. package/dist/chunk-VZ3BSIVU.cjs.map +1 -1
  141. package/dist/chunk-W457XUA6.cjs.map +1 -1
  142. package/dist/chunk-WHDI3TMP.cjs.map +1 -1
  143. package/dist/chunk-WITCPKNL.cjs.map +1 -1
  144. package/dist/chunk-WX6NP7UU.cjs.map +1 -1
  145. package/dist/chunk-XQLRIBVR.cjs.map +1 -1
  146. package/dist/chunk-Y7LSSRNJ.cjs.map +1 -1
  147. package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
  148. package/dist/{chunk-OWP7XBY2.cjs → chunk-YW4DVKNT.cjs} +5 -2
  149. package/dist/chunk-YW4DVKNT.cjs.map +1 -0
  150. package/dist/{chunk-NH2TUO7X.js → chunk-YZH24CEU.js} +6 -6
  151. package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
  152. package/dist/chunk-ZUULK36E.cjs.map +1 -1
  153. package/dist/client.cjs +2 -2
  154. package/dist/client.cjs.map +1 -1
  155. package/dist/client.js +1 -1
  156. package/dist/core.cjs.map +1 -1
  157. package/dist/currencies.cjs.map +1 -1
  158. package/dist/enigmaCardForm.cjs.map +1 -1
  159. package/dist/error.cjs.map +1 -1
  160. package/dist/eventStream.cjs.map +1 -1
  161. package/dist/exportDownload.cjs.map +1 -1
  162. package/dist/feeProgram.cjs.map +1 -1
  163. package/dist/index.cjs +8 -8
  164. package/dist/index.cjs.map +1 -1
  165. package/dist/index.d.cts +1 -1
  166. package/dist/index.d.ts +1 -1
  167. package/dist/index.js +7 -7
  168. package/dist/internal/resources/admin.cjs.map +1 -1
  169. package/dist/internal/resources/admin.d.cts +1 -1
  170. package/dist/internal/resources/admin.d.ts +1 -1
  171. package/dist/internal/resources/adminBranding.cjs.map +1 -1
  172. package/dist/internal/resources/adminBranding.d.cts +1 -1
  173. package/dist/internal/resources/adminBranding.d.ts +1 -1
  174. package/dist/internal/resources/adminCheckoutDomains.cjs.map +1 -1
  175. package/dist/internal/resources/adminCheckoutDomains.d.cts +1 -1
  176. package/dist/internal/resources/adminCheckoutDomains.d.ts +1 -1
  177. package/dist/internal/resources/adminFeePlans.cjs.map +1 -1
  178. package/dist/internal/resources/adminFeePlans.d.cts +1 -1
  179. package/dist/internal/resources/adminFeePlans.d.ts +1 -1
  180. package/dist/internal/resources/adminFileScans.cjs.map +1 -1
  181. package/dist/internal/resources/adminFileScans.d.cts +1 -1
  182. package/dist/internal/resources/adminFileScans.d.ts +1 -1
  183. package/dist/internal/resources/adminIndustries.cjs.map +1 -1
  184. package/dist/internal/resources/adminIndustries.d.cts +1 -1
  185. package/dist/internal/resources/adminIndustries.d.ts +1 -1
  186. package/dist/internal/resources/adminLive.cjs.map +1 -1
  187. package/dist/internal/resources/adminNotices.cjs.map +1 -1
  188. package/dist/internal/resources/adminNotices.d.cts +1 -1
  189. package/dist/internal/resources/adminNotices.d.ts +1 -1
  190. package/dist/internal/resources/adminPortal.cjs +2 -2
  191. package/dist/internal/resources/adminPortal.cjs.map +1 -1
  192. package/dist/internal/resources/adminPortal.d.cts +1 -1
  193. package/dist/internal/resources/adminPortal.d.ts +1 -1
  194. package/dist/internal/resources/adminPortal.js +1 -1
  195. package/dist/internal/resources/adminPricing.cjs +2 -2
  196. package/dist/internal/resources/adminPricing.cjs.map +1 -1
  197. package/dist/internal/resources/adminPricing.d.cts +19 -11
  198. package/dist/internal/resources/adminPricing.d.ts +19 -11
  199. package/dist/internal/resources/adminPricing.js +1 -1
  200. package/dist/internal/resources/adminSupport.cjs.map +1 -1
  201. package/dist/internal/resources/adminSupport.d.cts +1 -1
  202. package/dist/internal/resources/adminSupport.d.ts +1 -1
  203. package/dist/internal/resources/auditLogs.cjs.map +1 -1
  204. package/dist/internal/resources/auditLogs.d.cts +1 -1
  205. package/dist/internal/resources/auditLogs.d.ts +1 -1
  206. package/dist/internal/resources/cache.cjs.map +1 -1
  207. package/dist/internal/resources/cardIssuers.cjs.map +1 -1
  208. package/dist/internal/resources/cardIssuers.d.cts +1 -1
  209. package/dist/internal/resources/cardIssuers.d.ts +1 -1
  210. package/dist/internal/resources/configs.cjs.map +1 -1
  211. package/dist/internal/resources/connectorRestrictionRules.cjs.map +1 -1
  212. package/dist/internal/resources/connectorRestrictionRules.d.cts +1 -1
  213. package/dist/internal/resources/connectorRestrictionRules.d.ts +1 -1
  214. package/dist/internal/resources/connectorRestrictions.cjs.map +1 -1
  215. package/dist/internal/resources/connectorRestrictions.d.cts +1 -1
  216. package/dist/internal/resources/connectorRestrictions.d.ts +1 -1
  217. package/dist/internal/resources/diagnostic.cjs.map +1 -1
  218. package/dist/internal/resources/diagnostic.d.cts +1 -1
  219. package/dist/internal/resources/diagnostic.d.ts +1 -1
  220. package/dist/internal/resources/gsm.cjs.map +1 -1
  221. package/dist/internal/resources/gsm.d.cts +1 -1
  222. package/dist/internal/resources/gsm.d.ts +1 -1
  223. package/dist/internal/resources/nativeRenewals.cjs.map +1 -1
  224. package/dist/internal/resources/nativeRenewals.d.cts +1 -1
  225. package/dist/internal/resources/nativeRenewals.d.ts +1 -1
  226. package/dist/internal/resources/platformBilling.cjs.map +1 -1
  227. package/dist/internal/resources/platformBilling.d.cts +1 -1
  228. package/dist/internal/resources/platformBilling.d.ts +1 -1
  229. package/dist/internal/resources/platformFees.cjs.map +1 -1
  230. package/dist/internal/resources/platformMessageTemplates.cjs.map +1 -1
  231. package/dist/internal/resources/platformSettings.cjs.map +1 -1
  232. package/dist/internal/resources/platformSettings.d.cts +1 -1
  233. package/dist/internal/resources/platformSettings.d.ts +1 -1
  234. package/dist/internal.cjs +13 -13
  235. package/dist/internal.cjs.map +1 -1
  236. package/dist/internal.d.cts +2 -2
  237. package/dist/internal.d.ts +2 -2
  238. package/dist/internal.js +9 -9
  239. package/dist/listQuery.cjs.map +1 -1
  240. package/dist/panes.cjs.map +1 -1
  241. package/dist/paymentPresentation.cjs.map +1 -1
  242. package/dist/recordCounter.cjs.map +1 -1
  243. package/dist/resources/aiTools.cjs.map +1 -1
  244. package/dist/resources/analytics.cjs.map +1 -1
  245. package/dist/resources/analyticsDashboard.cjs.map +1 -1
  246. package/dist/resources/apiKeys.cjs.map +1 -1
  247. package/dist/resources/audit.cjs.map +1 -1
  248. package/dist/resources/authentication.cjs.map +1 -1
  249. package/dist/resources/availabilityOverrides.cjs.map +1 -1
  250. package/dist/resources/billing.cjs +2 -2
  251. package/dist/resources/billing.cjs.map +1 -1
  252. package/dist/resources/billing.d.cts +12 -1
  253. package/dist/resources/billing.d.ts +12 -1
  254. package/dist/resources/billing.js +1 -1
  255. package/dist/resources/buyerAccount.cjs.map +1 -1
  256. package/dist/resources/buyerBlocklist.cjs +2 -2
  257. package/dist/resources/buyerBlocklist.cjs.map +1 -1
  258. package/dist/resources/buyerBlocklist.js +1 -1
  259. package/dist/resources/buyerConversations.cjs.map +1 -1
  260. package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
  261. package/dist/resources/buyerPortal.cjs.map +1 -1
  262. package/dist/resources/cards.cjs.map +1 -1
  263. package/dist/resources/chargebackPrevention.cjs.map +1 -1
  264. package/dist/resources/checkoutDomains.cjs.map +1 -1
  265. package/dist/resources/checkoutMethods.cjs.map +1 -1
  266. package/dist/resources/checkoutRecovery.cjs.map +1 -1
  267. package/dist/resources/checkoutTemplates.cjs.map +1 -1
  268. package/dist/resources/connectors.cjs.map +1 -1
  269. package/dist/resources/contentEncryption.cjs.map +1 -1
  270. package/dist/resources/costRules.cjs.map +1 -1
  271. package/dist/resources/customers.cjs +2 -2
  272. package/dist/resources/customers.cjs.map +1 -1
  273. package/dist/resources/customers.js +1 -1
  274. package/dist/resources/deploymentBranding.cjs.map +1 -1
  275. package/dist/resources/disputes.cjs +2 -2
  276. package/dist/resources/disputes.cjs.map +1 -1
  277. package/dist/resources/disputes.js +1 -1
  278. package/dist/resources/ephemeralKeys.cjs.map +1 -1
  279. package/dist/resources/events.cjs.map +1 -1
  280. package/dist/resources/export.cjs.map +1 -1
  281. package/dist/resources/externalRecords.cjs.map +1 -1
  282. package/dist/resources/featureMatrix.cjs.map +1 -1
  283. package/dist/resources/fees.cjs.map +1 -1
  284. package/dist/resources/files.cjs.map +1 -1
  285. package/dist/resources/forex.cjs.map +1 -1
  286. package/dist/resources/identityVerifications.cjs.map +1 -1
  287. package/dist/resources/industries.cjs.map +1 -1
  288. package/dist/resources/invoiceSettings.cjs.map +1 -1
  289. package/dist/resources/invoices.cjs.map +1 -1
  290. package/dist/resources/live.cjs.map +1 -1
  291. package/dist/resources/mandates.cjs.map +1 -1
  292. package/dist/resources/merchantAccounts.cjs.map +1 -1
  293. package/dist/resources/messageTemplates.cjs.map +1 -1
  294. package/dist/resources/notices.cjs.map +1 -1
  295. package/dist/resources/operationLimits.cjs.map +1 -1
  296. package/dist/resources/paymentLinks.cjs.map +1 -1
  297. package/dist/resources/paymentMethods.cjs.map +1 -1
  298. package/dist/resources/payments.cjs.map +1 -1
  299. package/dist/resources/payoutDestinations.cjs.map +1 -1
  300. package/dist/resources/payouts.cjs.map +1 -1
  301. package/dist/resources/paypalDisputes.cjs.map +1 -1
  302. package/dist/resources/persons.cjs +2 -2
  303. package/dist/resources/persons.cjs.map +1 -1
  304. package/dist/resources/persons.js +1 -1
  305. package/dist/resources/poll.cjs.map +1 -1
  306. package/dist/resources/processorCosts.cjs.map +1 -1
  307. package/dist/resources/processorImports.cjs.map +1 -1
  308. package/dist/resources/products.cjs.map +1 -1
  309. package/dist/resources/profileAcquirers.cjs.map +1 -1
  310. package/dist/resources/profiles.cjs.map +1 -1
  311. package/dist/resources/projects.cjs.map +1 -1
  312. package/dist/resources/refunds.cjs.map +1 -1
  313. package/dist/resources/regions.cjs.map +1 -1
  314. package/dist/resources/relay.cjs.map +1 -1
  315. package/dist/resources/risk.cjs.map +1 -1
  316. package/dist/resources/routing.cjs.map +1 -1
  317. package/dist/resources/search.cjs.map +1 -1
  318. package/dist/resources/sellToRestrictions.cjs.map +1 -1
  319. package/dist/resources/settings.cjs.map +1 -1
  320. package/dist/resources/settlement.cjs.map +1 -1
  321. package/dist/resources/shareLinks.cjs.map +1 -1
  322. package/dist/resources/shopLabels.cjs.map +1 -1
  323. package/dist/resources/shopify.cjs.map +1 -1
  324. package/dist/resources/shops.cjs.map +1 -1
  325. package/dist/resources/stripeConnect.cjs.map +1 -1
  326. package/dist/resources/subscriptions.cjs.map +1 -1
  327. package/dist/resources/support.cjs.map +1 -1
  328. package/dist/resources/threeDsRules.cjs.map +1 -1
  329. package/dist/resources/users.cjs.map +1 -1
  330. package/dist/resources/vatRates.cjs.map +1 -1
  331. package/dist/resources/verification.cjs.map +1 -1
  332. package/dist/resources/webhooks.cjs.map +1 -1
  333. package/dist/resources/whopResolutionCases.cjs.map +1 -1
  334. package/dist/trustedOrigins.cjs.map +1 -1
  335. package/dist/{types-yDOfhGt3.d.cts → types-7WY9SUsl.d.ts} +116 -11
  336. package/dist/{types-fgHam_o6.d.ts → types-Cx6M3WF3.d.cts} +116 -11
  337. package/dist/types.cjs.map +1 -1
  338. package/dist/types.d.cts +103 -2
  339. package/dist/types.d.ts +103 -2
  340. package/package.json +1 -1
  341. package/dist/chunk-2MSCXFWD.cjs.map +0 -1
  342. package/dist/chunk-6MXPGE7O.cjs.map +0 -1
  343. package/dist/chunk-ABDDRKOT.js.map +0 -1
  344. package/dist/chunk-CPGGSHNB.js.map +0 -1
  345. package/dist/chunk-CPT6VNW7.js.map +0 -1
  346. package/dist/chunk-CYH4HZ4Y.cjs.map +0 -1
  347. package/dist/chunk-E2TF7JDB.cjs.map +0 -1
  348. package/dist/chunk-EK7RLJZB.js.map +0 -1
  349. package/dist/chunk-FDHLDKNY.cjs.map +0 -1
  350. package/dist/chunk-LZUHCGJ3.js.map +0 -1
  351. package/dist/chunk-MCNDMK7F.cjs.map +0 -1
  352. package/dist/chunk-OPOSNWK4.cjs.map +0 -1
  353. package/dist/chunk-OWP7XBY2.cjs.map +0 -1
  354. package/dist/chunk-QGTVOC6O.js.map +0 -1
  355. package/dist/chunk-TSAQN7I5.js.map +0 -1
  356. package/dist/chunk-U72OIM7A.cjs.map +0 -1
  357. /package/dist/{chunk-EHRQSUIK.js.map → chunk-6Y7YGECJ.js.map} +0 -0
  358. /package/dist/{chunk-NH2TUO7X.js.map → chunk-YZH24CEU.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-PYNHK6AP.cjs","../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACgDO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,eAAA,CAAgB,OAAA,EAA4D;AAChF,IAAA,OAAO,I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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACM,MAAA;AACzE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAekD,EAAA;AACpC,IAAA;AACV,MAAA;AACiE,MAAA;AACjE,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACO,MAAA;AAC1E,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBiD,EAAA;AAC8B,IAAA;AAC/E,EAAA;AACF;AD7JoF;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-PYNHK6AP.cjs","sourcesContent":[null,"import type {\n BuyerPortalSubscriptionCapabilities,\n NativeShopConfigRequest,\n NativeShopConfigResponse,\n NativeDunningConfigRequest,\n NativeDunningConfigResponse,\n AdoptSubscriptionRequest,\n AdoptSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateAndConfirmSubscriptionRequest,\n ConfirmSubscriptionRequest,\n UpdateSubscriptionRequest,\n PauseSubscriptionRequest,\n ResumeSubscriptionRequest,\n CancelSubscriptionRequest,\n SubscriptionResponse,\n ConfirmSubscriptionResponse,\n PauseSubscriptionResponse,\n ResumeSubscriptionResponse,\n CancelSubscriptionResponse,\n GetSubscriptionItemsResponse,\n GetSubscriptionItemsParams,\n SubscriptionEstimateResponse,\n SubscriptionEstimateParams,\n SubscriptionListParams,\n SubscriptionPaymentLookupRequest,\n SubscriptionPaymentLookupResponse,\n SubscriptionInvoiceListParams,\n SubscriptionInvoiceListResponse,\n SubscriptionBillingProcessorResponse,\n SubscriptionImportApplyRequest,\n SubscriptionImportApplyResponse,\n SubscriptionImportPreviewRequest,\n SubscriptionImportPreviewResponse,\n SubscriptionItemsPage,\n SubscriptionSyncRequest,\n SubscriptionSyncResponse,\n SubscriptionSyncResult,\n SubscriptionInvoiceRefundConfirmRequest,\n SubscriptionInvoiceRefundListResponse,\n SubscriptionInvoiceRefundRequest,\n SubscriptionInvoiceRefundResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Subscription endpoints are profile-scoped: the backend requires an\n * `X-Profile-Id` header to resolve the shop / billing processor (`IR_04`\n * otherwise). Pass it through the per-call `options.headers`, e.g.\n * `subscriptions.list(params, { headers: { 'X-Profile-Id': profileId } })`.\n */\nexport class Subscriptions {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */\n async getNativeConfig(options?: RequestExtras): Promise<NativeShopConfigResponse> {\n return this.request('GET', '/subscriptions/native/config', { ...options });\n }\n\n /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */\n async updateNativeConfig(\n params: NativeShopConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeShopConfigResponse> {\n return this.request('PUT', '/subscriptions/native/config', { body: params, ...options });\n }\n\n /** Read merchant-wide renewal recovery settings. */\n async getNativeDunning(options?: RequestExtras): Promise<NativeDunningConfigResponse> {\n return this.request('GET', '/subscriptions/native/dunning', { ...options });\n }\n\n async updateNativeDunning(\n params: NativeDunningConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeDunningConfigResponse> {\n return this.request('PUT', '/subscriptions/native/dunning', { body: params, ...options });\n }\n\n /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */\n async getCapabilities(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionCapabilities> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,\n { ...options },\n );\n }\n\n /**\n * Create and immediately confirm a subscription. `POST /subscriptions`\n *\n * For billing processors that require buyer approval (e.g. PayPal), the\n * response carries a `redirect_url` the customer must be sent to.\n */\n async createAndConfirm(\n params: CreateAndConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', '/subscriptions', { body: params, ...options });\n }\n\n /** Create a subscription without confirming it. `POST /subscriptions/create` */\n async create(\n params: CreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('POST', '/subscriptions/create', { body: params, ...options });\n }\n\n /**\n * Adopt an existing Creem subscription. `POST /subscriptions/adopt`\n *\n * Requires adoption to be enabled on the deployment and `X-Profile-Id` in\n * options.headers. Adoption charges nothing and emits no invoice or webhook.\n * Repeating the processor subscription ID returns the existing DeloPay ID.\n * Retry when handoff_confirmed is false. That flag confirms persistence,\n * not the merchant's external switch-over: stop processing Creem events in\n * your own integration when handing subsequent events to DeloPay.\n */\n async adopt(\n params: AdoptSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<AdoptSubscriptionResponse> {\n return this.request('POST', '/subscriptions/adopt', { body: params, ...options });\n }\n\n /** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */\n async retrieve(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}`, {\n ...options,\n });\n }\n\n /**\n * Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`\n *\n * Like {@link createAndConfirm}, the response may carry a `redirect_url` for\n * processors that require buyer approval.\n */\n async confirm(\n subscriptionId: string,\n params: ConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async update(\n subscriptionId: string,\n params: UpdateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('PUT', `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * List subscriptions for the profile, or one customer's with `customer_id`.\n * `GET /subscriptions/list`\n */\n async list(\n params?: SubscriptionListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse[]> {\n return this.request('GET', '/subscriptions/list', {\n query: csvQuery(params, ['profile_ids', 'industry']),\n ...options,\n });\n }\n\n /** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */\n async getEstimate(\n params: SubscriptionEstimateParams,\n options?: RequestExtras,\n ): Promise<SubscriptionEstimateResponse> {\n return this.request('GET', '/subscriptions/estimate', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */\n async getItems(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<GetSubscriptionItemsResponse[]> {\n return this.request('GET', '/subscriptions/items', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * {@link getItems}, with whether the list is only the first part of what the\n * processor holds. `GET /subscriptions/items`\n *\n * The backend states that in the `X-Delopay-Items-Truncated` response\n * header (Stripe Billing lists its first 100 products), which the plain\n * {@link getItems} cannot return. Without `limit` and `offset` every item\n * the billing account offers is listed, up to 500.\n */\n async getItemsPage(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<SubscriptionItemsPage> {\n let truncated = false;\n const items = await this.request<GetSubscriptionItemsResponse[]>(\n 'GET',\n '/subscriptions/items',\n {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n onDownloadProgress: (event) => {\n // The headers arrive with the first event; a retried request reports\n // them again, and the last attempt is the one the items come from.\n truncated = event.headers.get('x-delopay-items-truncated')?.toLowerCase() === 'true';\n options?.onDownloadProgress?.(event);\n },\n },\n );\n return { items, truncated };\n }\n\n /**\n * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n *\n * The body defaults to `{}` so the request still carries\n * `Content-Type: application/json` even when no params are passed — the\n * backend rejects the POST otherwise (\"Unsupported content type\").\n */\n async pause(\n subscriptionId: string,\n params?: PauseSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<PauseSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async resume(\n subscriptionId: string,\n params?: ResumeSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ResumeSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel`\n *\n * A subscription in a state it cannot be cancelled from is refused with\n * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async cancel(\n subscriptionId: string,\n params?: CancelSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<CancelSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Read 1 to 50 subscriptions back from their billing processor and mirror\n * what it reports. `POST /subscriptions/sync`\n *\n * Nothing is written at the processor. A status is mirrored only with the\n * time the processor stamped it with, and never over a newer event already\n * recorded; a plan only with its own stamp. One result per id, in request\n * order; one that fails does not stop the others.\n */\n async sync(\n params: SubscriptionSyncRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionSyncResponse> {\n return this.request('POST', '/subscriptions/sync', { body: params, ...options });\n }\n\n /**\n * Read one subscription back from its billing processor and mirror what it\n * reports, as {@link sync} does, with what the processor reported beside\n * what the mirror now holds. `POST /subscriptions/{subscriptionId}/sync`\n */\n async syncOne(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionSyncResult> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/sync`, {\n ...options,\n });\n }\n\n /**\n * List the subscriptions a billing account holds at its processor, and how\n * each relates to DeloPay's: already held, new (its buyer is a DeloPay\n * customer), needing a customer, ended, or not adoptable here.\n * `POST /subscriptions/import/preview`\n *\n * Reads only; nothing is written here or at the processor. Creem and\n * Stripe Billing can be listed; PayPal cannot, which `capabilities` states\n * (`reason_code: 'listing_unsupported'`).\n */\n async importPreview(\n params: SubscriptionImportPreviewRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportPreviewResponse> {\n return this.request('POST', '/subscriptions/import/preview', { body: params, ...options });\n }\n\n /**\n * Take 1 to 25 processor subscriptions over, each through {@link adopt}\n * with every one of its checks, one after another.\n * `POST /subscriptions/import/apply`\n *\n * One result per selection, in request order; one refused does not stop\n * the others.\n */\n async importApply(\n params: SubscriptionImportApplyRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportApplyResponse> {\n return this.request('POST', '/subscriptions/import/apply', { body: params, ...options });\n }\n\n /**\n * Resolve which of the given payments were raised by a subscription.\n * `POST /subscriptions/payments/lookup`\n *\n * The linkage exists in one direction only — an invoice points at the payment\n * it settled, and nothing is stamped on the payment — so this is the only way\n * to tell a subscription charge from a one-off one when you are holding a\n * page of payments. In particular, do not use `off_session` or the presence\n * of a mandate: an ordinary saved-card charge sets those identically.\n *\n * Ids that belong to no subscription are **absent** from `links` rather than\n * returned as an error, so match on presence:\n *\n * ```ts\n * const { links } = await subscriptions.lookupPayments(\n * { payment_ids: page.map((p) => p.payment_id) },\n * { headers: { 'X-Profile-Id': profileId } },\n * );\n * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));\n * ```\n *\n * Profile-scoped like every other subscription route, and that matters more\n * here than elsewhere: a `payment_id` is merchant-supplied and only unique\n * within a merchant, so the shop is part of the question, not an\n * optimisation. Pass the profile that owns **the payments** — for a list\n * spanning several shops, group the ids by shop and call once per group.\n *\n * At most 200 ids per call.\n */\n async lookupPayments(\n params: SubscriptionPaymentLookupRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionPaymentLookupResponse> {\n return this.request('POST', '/subscriptions/payments/lookup', { body: params, ...options });\n }\n\n /**\n * One subscription's billing history, newest cycle first.\n * `GET /subscriptions/{subscriptionId}/invoices`\n *\n * {@link retrieve} carries only the *latest* invoice, which is the current\n * cycle — a subscription that has renewed monthly for a year has one of those\n * and twelve of these. Use this wherever a merchant needs to see what a\n * subscription has actually billed, in particular on self-charging processors\n * (Creem, PayPal) where each renewal is charged by the processor and mirrored\n * here rather than raised as a DeloPay payment.\n *\n * Two things to render honestly, both decided rather than incidental:\n *\n * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net\n * them: the difference between the two is not a smaller charge.\n * - A `refunded_amount` of `null` is \"not reported\" and must not render as\n * `0`. Likewise a processor-hosted origination records a bootstrap invoice\n * at `0` before the buyer has paid anything, so a zero amount on such a\n * subscription is a placeholder rather than a free cycle.\n *\n * Profile-scoped like every other subscription route.\n */\n async listInvoices(\n subscriptionId: string,\n params?: SubscriptionInvoiceListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceListResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * Refund one paid subscription invoice at the billing processor that charged it.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refund`\n *\n * Needs the refund permission, as a payment refund does, and the merchant's\n * refund rules apply. Only invoices of processor-billed cycles are refunded\n * here; a cycle paid by a payment is refunded through `refunds.create`. The\n * processor refunds the whole amount left on the charge, so omit `amount` or\n * send exactly that remainder.\n *\n * The answer is usually `pending` or `succeeded`: the invoice's refunded total\n * moves, and `invoice_refunded` is sent, once the processor reports the refund.\n * The same `idempotency_key` again answers the first refund and sends nothing.\n * While one refund of an invoice awaits the processor, another is refused.\n */\n async refundInvoice(\n subscriptionId: string,\n invoiceId: string,\n params: SubscriptionInvoiceRefundRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refund`,\n { body: params, ...options, bodyIdempotencyKey: params.idempotency_key },\n );\n }\n\n /**\n * The refunds of one subscription invoice made through the API, oldest first.\n * `GET /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds`\n *\n * Needs subscription read. A refund whose processor reported a refund of the\n * invoice without a refund time of its own, while this one awaited it, reads\n * `awaiting_confirmation` with the processor's refunds it may be in\n * `confirmation_candidates`.\n */\n async listInvoiceRefunds(\n subscriptionId: string,\n invoiceId: string,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundListResponse> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds`,\n options,\n );\n }\n\n /**\n * Confirm that a refund the processor reported is this refund, once checked\n * at the processor.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds/{refundId}/confirm`\n *\n * Needs the refund permission. Only a refund in `awaiting_confirmation` is\n * confirmed, and only with one of its `confirmation_candidates`; it becomes\n * `succeeded` with the processor's refund id and amount. The invoice's\n * refunded total does not move and no webhook is sent. The same candidate\n * again answers the refund as it stands. A refund that does not await\n * confirmation, or a processor refund that is not one of its candidates, is\n * refused with a 400 (`IR_16`); a subscription, invoice or refund that is not\n * found answers 404. Only `connector_refund_id` is sent, so a candidate from\n * `confirmation_candidates` can be passed as it is.\n */\n async confirmInvoiceRefund(\n subscriptionId: string,\n invoiceId: string,\n refundId: string,\n params: SubscriptionInvoiceRefundConfirmRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds/${encodeURIComponent(refundId)}/confirm`,\n { ...options, body: { connector_refund_id: params.connector_refund_id } },\n );\n }\n\n /**\n * Which billing processor this shop's subscriptions run on.\n * `GET /subscriptions/billing_processor`\n *\n * The same mapping is derivable from the connector inventory\n * (`GET /account/{merchant_id}/connectors`), but that route is gated by a\n * connector-read permission granted independently of subscriptions — so a\n * role authorised to create subscriptions could be unable to learn which\n * processor it was creating them on. This answers under the same\n * authorization as the rest of the subscription API.\n *\n * Reach for it when the client must branch on the processor *before* calling\n * — origination differs by processor, and guessing is destructive. Resolve\n * the shop's `billing_processor_id` first: a shop that runs no subscriptions\n * has none assigned, and this route has no identity to report for it.\n */\n async getBillingProcessor(\n options?: RequestExtras,\n ): Promise<SubscriptionBillingProcessorResponse> {\n return this.request('GET', '/subscriptions/billing_processor', { ...options });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-PYNHK6AP.cjs","../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACgDO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,eAAA,CAAgB,OAAA,EAA4D;AAChF,IAAA,OA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACM,MAAA;AACzE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAekD,EAAA;AACpC,IAAA;AACV,MAAA;AACiE,MAAA;AACjE,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACO,MAAA;AAC1E,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBiD,EAAA;AAC8B,IAAA;AAC/E,EAAA;AACF;AD7JoF;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-PYNHK6AP.cjs","sourcesContent":[null,"import type {\n BuyerPortalSubscriptionCapabilities,\n NativeShopConfigRequest,\n NativeShopConfigResponse,\n NativeDunningConfigRequest,\n NativeDunningConfigResponse,\n AdoptSubscriptionRequest,\n AdoptSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateAndConfirmSubscriptionRequest,\n ConfirmSubscriptionRequest,\n UpdateSubscriptionRequest,\n PauseSubscriptionRequest,\n ResumeSubscriptionRequest,\n CancelSubscriptionRequest,\n SubscriptionResponse,\n ConfirmSubscriptionResponse,\n PauseSubscriptionResponse,\n ResumeSubscriptionResponse,\n CancelSubscriptionResponse,\n GetSubscriptionItemsResponse,\n GetSubscriptionItemsParams,\n SubscriptionEstimateResponse,\n SubscriptionEstimateParams,\n SubscriptionListParams,\n SubscriptionPaymentLookupRequest,\n SubscriptionPaymentLookupResponse,\n SubscriptionInvoiceListParams,\n SubscriptionInvoiceListResponse,\n SubscriptionBillingProcessorResponse,\n SubscriptionImportApplyRequest,\n SubscriptionImportApplyResponse,\n SubscriptionImportPreviewRequest,\n SubscriptionImportPreviewResponse,\n SubscriptionItemsPage,\n SubscriptionSyncRequest,\n SubscriptionSyncResponse,\n SubscriptionSyncResult,\n SubscriptionInvoiceRefundConfirmRequest,\n SubscriptionInvoiceRefundListResponse,\n SubscriptionInvoiceRefundRequest,\n SubscriptionInvoiceRefundResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Subscription endpoints are profile-scoped: the backend requires an\n * `X-Profile-Id` header to resolve the shop / billing processor (`IR_04`\n * otherwise). Pass it through the per-call `options.headers`, e.g.\n * `subscriptions.list(params, { headers: { 'X-Profile-Id': profileId } })`.\n */\nexport class Subscriptions {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */\n async getNativeConfig(options?: RequestExtras): Promise<NativeShopConfigResponse> {\n return this.request('GET', '/subscriptions/native/config', { ...options });\n }\n\n /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */\n async updateNativeConfig(\n params: NativeShopConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeShopConfigResponse> {\n return this.request('PUT', '/subscriptions/native/config', { body: params, ...options });\n }\n\n /** Read merchant-wide renewal recovery settings. */\n async getNativeDunning(options?: RequestExtras): Promise<NativeDunningConfigResponse> {\n return this.request('GET', '/subscriptions/native/dunning', { ...options });\n }\n\n async updateNativeDunning(\n params: NativeDunningConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeDunningConfigResponse> {\n return this.request('PUT', '/subscriptions/native/dunning', { body: params, ...options });\n }\n\n /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */\n async getCapabilities(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionCapabilities> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,\n { ...options },\n );\n }\n\n /**\n * Create and immediately confirm a subscription. `POST /subscriptions`\n *\n * For billing processors that require buyer approval (e.g. PayPal), the\n * response carries a `redirect_url` the customer must be sent to.\n */\n async createAndConfirm(\n params: CreateAndConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', '/subscriptions', { body: params, ...options });\n }\n\n /** Create a subscription without confirming it. `POST /subscriptions/create` */\n async create(\n params: CreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('POST', '/subscriptions/create', { body: params, ...options });\n }\n\n /**\n * Adopt an existing Creem subscription. `POST /subscriptions/adopt`\n *\n * Requires adoption to be enabled on the deployment and `X-Profile-Id` in\n * options.headers. Adoption charges nothing and emits no invoice or webhook.\n * Repeating the processor subscription ID returns the existing DeloPay ID.\n * Retry when handoff_confirmed is false. That flag confirms persistence,\n * not the merchant's external switch-over: stop processing Creem events in\n * your own integration when handing subsequent events to DeloPay.\n */\n async adopt(\n params: AdoptSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<AdoptSubscriptionResponse> {\n return this.request('POST', '/subscriptions/adopt', { body: params, ...options });\n }\n\n /** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */\n async retrieve(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}`, {\n ...options,\n });\n }\n\n /**\n * Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`\n *\n * Like {@link createAndConfirm}, the response may carry a `redirect_url` for\n * processors that require buyer approval.\n */\n async confirm(\n subscriptionId: string,\n params: ConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async update(\n subscriptionId: string,\n params: UpdateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('PUT', `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * List subscriptions for the profile, or one customer's with `customer_id`.\n * `GET /subscriptions/list`\n */\n async list(\n params?: SubscriptionListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse[]> {\n return this.request('GET', '/subscriptions/list', {\n query: csvQuery(params, ['profile_ids', 'industry']),\n ...options,\n });\n }\n\n /** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */\n async getEstimate(\n params: SubscriptionEstimateParams,\n options?: RequestExtras,\n ): Promise<SubscriptionEstimateResponse> {\n return this.request('GET', '/subscriptions/estimate', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */\n async getItems(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<GetSubscriptionItemsResponse[]> {\n return this.request('GET', '/subscriptions/items', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * {@link getItems}, with whether the list is only the first part of what the\n * processor holds. `GET /subscriptions/items`\n *\n * The backend states that in the `X-Delopay-Items-Truncated` response\n * header (Stripe Billing lists its first 100 products), which the plain\n * {@link getItems} cannot return. Without `limit` and `offset` every item\n * the billing account offers is listed, up to 500.\n */\n async getItemsPage(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<SubscriptionItemsPage> {\n let truncated = false;\n const items = await this.request<GetSubscriptionItemsResponse[]>(\n 'GET',\n '/subscriptions/items',\n {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n onDownloadProgress: (event) => {\n // The headers arrive with the first event; a retried request reports\n // them again, and the last attempt is the one the items come from.\n truncated = event.headers.get('x-delopay-items-truncated')?.toLowerCase() === 'true';\n options?.onDownloadProgress?.(event);\n },\n },\n );\n return { items, truncated };\n }\n\n /**\n * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n *\n * The body defaults to `{}` so the request still carries\n * `Content-Type: application/json` even when no params are passed — the\n * backend rejects the POST otherwise (\"Unsupported content type\").\n */\n async pause(\n subscriptionId: string,\n params?: PauseSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<PauseSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async resume(\n subscriptionId: string,\n params?: ResumeSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ResumeSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel`\n *\n * A subscription in a state it cannot be cancelled from is refused with\n * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async cancel(\n subscriptionId: string,\n params?: CancelSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<CancelSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Read 1 to 50 subscriptions back from their billing processor and mirror\n * what it reports. `POST /subscriptions/sync`\n *\n * Nothing is written at the processor. A status is mirrored only with the\n * time the processor stamped it with, and never over a newer event already\n * recorded; a plan only with its own stamp. One result per id, in request\n * order; one that fails does not stop the others.\n */\n async sync(\n params: SubscriptionSyncRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionSyncResponse> {\n return this.request('POST', '/subscriptions/sync', { body: params, ...options });\n }\n\n /**\n * Read one subscription back from its billing processor and mirror what it\n * reports, as {@link sync} does, with what the processor reported beside\n * what the mirror now holds. `POST /subscriptions/{subscriptionId}/sync`\n */\n async syncOne(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionSyncResult> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/sync`, {\n ...options,\n });\n }\n\n /**\n * List the subscriptions a billing account holds at its processor, and how\n * each relates to DeloPay's: already held, new (its buyer is a DeloPay\n * customer), needing a customer, ended, or not adoptable here.\n * `POST /subscriptions/import/preview`\n *\n * Reads only; nothing is written here or at the processor. Creem and\n * Stripe Billing can be listed; PayPal cannot, which `capabilities` states\n * (`reason_code: 'listing_unsupported'`).\n */\n async importPreview(\n params: SubscriptionImportPreviewRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportPreviewResponse> {\n return this.request('POST', '/subscriptions/import/preview', { body: params, ...options });\n }\n\n /**\n * Take 1 to 25 processor subscriptions over, each through {@link adopt}\n * with every one of its checks, one after another.\n * `POST /subscriptions/import/apply`\n *\n * One result per selection, in request order; one refused does not stop\n * the others.\n */\n async importApply(\n params: SubscriptionImportApplyRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportApplyResponse> {\n return this.request('POST', '/subscriptions/import/apply', { body: params, ...options });\n }\n\n /**\n * Resolve which of the given payments were raised by a subscription.\n * `POST /subscriptions/payments/lookup`\n *\n * The linkage exists in one direction only — an invoice points at the payment\n * it settled, and nothing is stamped on the payment — so this is the only way\n * to tell a subscription charge from a one-off one when you are holding a\n * page of payments. In particular, do not use `off_session` or the presence\n * of a mandate: an ordinary saved-card charge sets those identically.\n *\n * Ids that belong to no subscription are **absent** from `links` rather than\n * returned as an error, so match on presence:\n *\n * ```ts\n * const { links } = await subscriptions.lookupPayments(\n * { payment_ids: page.map((p) => p.payment_id) },\n * { headers: { 'X-Profile-Id': profileId } },\n * );\n * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));\n * ```\n *\n * Profile-scoped like every other subscription route, and that matters more\n * here than elsewhere: a `payment_id` is merchant-supplied and only unique\n * within a merchant, so the shop is part of the question, not an\n * optimisation. Pass the profile that owns **the payments** — for a list\n * spanning several shops, group the ids by shop and call once per group.\n *\n * At most 200 ids per call.\n */\n async lookupPayments(\n params: SubscriptionPaymentLookupRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionPaymentLookupResponse> {\n return this.request('POST', '/subscriptions/payments/lookup', { body: params, ...options });\n }\n\n /**\n * One subscription's billing history, newest cycle first.\n * `GET /subscriptions/{subscriptionId}/invoices`\n *\n * {@link retrieve} carries only the *latest* invoice, which is the current\n * cycle — a subscription that has renewed monthly for a year has one of those\n * and twelve of these. Use this wherever a merchant needs to see what a\n * subscription has actually billed, in particular on self-charging processors\n * (Creem, PayPal) where each renewal is charged by the processor and mirrored\n * here rather than raised as a DeloPay payment.\n *\n * Two things to render honestly, both decided rather than incidental:\n *\n * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net\n * them: the difference between the two is not a smaller charge.\n * - A `refunded_amount` of `null` is \"not reported\" and must not render as\n * `0`. Likewise a processor-hosted origination records a bootstrap invoice\n * at `0` before the buyer has paid anything, so a zero amount on such a\n * subscription is a placeholder rather than a free cycle.\n *\n * Profile-scoped like every other subscription route.\n */\n async listInvoices(\n subscriptionId: string,\n params?: SubscriptionInvoiceListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceListResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * Refund one paid subscription invoice at the billing processor that charged it.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refund`\n *\n * Needs the refund permission, as a payment refund does, and the merchant's\n * refund rules apply. Only invoices of processor-billed cycles are refunded\n * here; a cycle paid by a payment is refunded through `refunds.create`. The\n * processor refunds the whole amount left on the charge, so omit `amount` or\n * send exactly that remainder.\n *\n * The answer is usually `pending` or `succeeded`: the invoice's refunded total\n * moves, and `invoice_refunded` is sent, once the processor reports the refund.\n * The same `idempotency_key` again answers the first refund and sends nothing.\n * While one refund of an invoice awaits the processor, another is refused.\n */\n async refundInvoice(\n subscriptionId: string,\n invoiceId: string,\n params: SubscriptionInvoiceRefundRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refund`,\n { body: params, ...options, bodyIdempotencyKey: params.idempotency_key },\n );\n }\n\n /**\n * The refunds of one subscription invoice made through the API, oldest first.\n * `GET /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds`\n *\n * Needs subscription read. A refund whose processor reported a refund of the\n * invoice without a refund time of its own, while this one awaited it, reads\n * `awaiting_confirmation` with the processor's refunds it may be in\n * `confirmation_candidates`.\n */\n async listInvoiceRefunds(\n subscriptionId: string,\n invoiceId: string,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundListResponse> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds`,\n options,\n );\n }\n\n /**\n * Confirm that a refund the processor reported is this refund, once checked\n * at the processor.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds/{refundId}/confirm`\n *\n * Needs the refund permission. Only a refund in `awaiting_confirmation` is\n * confirmed, and only with one of its `confirmation_candidates`; it becomes\n * `succeeded` with the processor's refund id and amount. The invoice's\n * refunded total does not move and no webhook is sent. The same candidate\n * again answers the refund as it stands. A refund that does not await\n * confirmation, or a processor refund that is not one of its candidates, is\n * refused with a 400 (`IR_16`); a subscription, invoice or refund that is not\n * found answers 404. Only `connector_refund_id` is sent, so a candidate from\n * `confirmation_candidates` can be passed as it is.\n */\n async confirmInvoiceRefund(\n subscriptionId: string,\n invoiceId: string,\n refundId: string,\n params: SubscriptionInvoiceRefundConfirmRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds/${encodeURIComponent(refundId)}/confirm`,\n { ...options, body: { connector_refund_id: params.connector_refund_id } },\n );\n }\n\n /**\n * Which billing processor this shop's subscriptions run on.\n * `GET /subscriptions/billing_processor`\n *\n * The same mapping is derivable from the connector inventory\n * (`GET /account/{merchant_id}/connectors`), but that route is gated by a\n * connector-read permission granted independently of subscriptions — so a\n * role authorised to create subscriptions could be unable to learn which\n * processor it was creating them on. This answers under the same\n * authorization as the rest of the subscription API.\n *\n * Reach for it when the client must branch on the processor *before* calling\n * — origination differs by processor, and guessing is destructive. Resolve\n * the shop's `billing_processor_id` first: a shop that runs no subscriptions\n * has none assigned, and this route has no identity to report for it.\n */\n async getBillingProcessor(\n options?: RequestExtras,\n ): Promise<SubscriptionBillingProcessorResponse> {\n return this.request('GET', '/subscriptions/billing_processor', { ...options });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-Q7M7DO7M.cjs","../src/paymentPresentation.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACiBO,IAAM,8BAAA,EAAgC,CAAA;AAGtC,IAAM,0BAAA,EAA4B;AAAA,EACvC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,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ACM,IAAA;AACG,IAAA;AACH,IAAA;AACG,MAAA;AACrB,IAAA;AACI,IAAA;AACe,MAAA;AACf,QAAA;AACkB,QAAA;AACpB,MAAA;AACgB,MAAA;AACG,MAAA;AACL,IAAA;AACF,MAAA;AACM,QAAA;AACP,QAAA;AACX,MAAA;AACe,MAAA;AACK,MAAA;AAIR,MAAA;AACD,QAAA;AACX,MAAA;AAGY,MAAA;AACN,MAAA;AACR,IAAA;AACF,EAAA;AAAA;AAGc,EAAA;AACK,IAAA;AACnB,EAAA;AAEwE,EAAA;AACnD,IAAA;AACC,MAAA;AAClB,MAAA;AACF,IAAA;AACqB,IAAA;AACC,IAAA;AACJ,IAAA;AACI,MAAA;AACL,MAAA;AACG,MAAA;AACpB,IAAA;AACF,EAAA;AACF;AAO4C;AAEvB,EAAA;AAKrB;AAEuB;AACE,EAAA;AACC,EAAA;AAC1B;ADrJ0B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-Q7M7DO7M.cjs","sourcesContent":[null,"/**\n * Helpers for rendering a shop's payment buttons on the merchant's own site\n * from `GET /account/payment-methods/presentation`: DeloPay's\n * built-in glyphs, icon resolution with a fallback, grouping by tier, and a\n * cache for the merchant's server that honours the response's own policy.\n *\n * Nothing here decides which methods a payment can be confirmed with. The\n * payment is confirmed against the shop's current configuration, whatever a\n * cached or displayed list says.\n */\nimport { DelopayError } from './error';\nimport type {\n PaymentMethodPresentationEntry,\n PaymentMethodPresentationParams,\n PaymentMethodPresentationResponse,\n PresentationChild,\n PresentationIcon,\n} from './types';\nimport type { RequestExtras } from './client';\n\n/** The response contract these helpers read. */\nexport const PRESENTATION_CONTRACT_VERSION = 1;\n\n/** The built-in glyph keys a presentation names in `icon.key` and `fallback_icon`. */\nexport const BUILTIN_PAYMENT_ICON_KEYS = [\n 'wallet',\n 'card',\n 'bank',\n 'apple',\n 'google',\n 'bnpl',\n 'cash',\n 'paypal',\n 'klarna',\n 'crypto',\n] as const;\n\nexport type BuiltinPaymentIconKey = (typeof BUILTIN_PAYMENT_ICON_KEYS)[number];\n\nconst SVG_OPEN = '<svg xmlns=\"http://www.w3.org/2000/svg\"';\n\n/**\n * The glyphs DeloPay's hosted checkout draws, as standalone SVG documents.\n * Line glyphs and Apple's mark take `color`; the other brand marks keep their\n * brand colours.\n */\nfunction glyph(key: BuiltinPaymentIconKey, color: string): string {\n const line = (body: string) =>\n `${SVG_OPEN} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"${color}\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${body}</svg>`;\n switch (key) {\n case 'card':\n return line('<rect x=\"2\" y=\"5\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M2 10h20\"/>');\n case 'bank':\n return line(\n '<path d=\"M3 10h18\"/><path d=\"m12 3 9 5H3l9-5Z\"/><path d=\"M6 10v7M10 10v7M14 10v7M18 10v7\"/><path d=\"M3 20h18\"/>',\n );\n case 'bnpl':\n return line(\n '<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><path d=\"M6 12h4\"/><path d=\"M14 10v4\"/><path d=\"M18 10v4\"/>',\n );\n case 'cash':\n return line(\n '<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/><path d=\"M6 12h.01M18 12h.01\"/>',\n );\n case 'apple':\n return `${SVG_OPEN} viewBox=\"0 0 384 512\" fill=\"${color}\"><path d=\"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z\"/></svg>`;\n case 'google':\n return `${SVG_OPEN} viewBox=\"0 0 48 48\"><path fill=\"#4285F4\" d=\"M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z\"/><path fill=\"#34A853\" d=\"M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z\"/><path fill=\"#FBBC05\" d=\"M11.69 28.18C11.25 26.86 11 25.45 11 24s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24s.85 6.91 2.34 9.88l7.35-5.7z\"/><path fill=\"#EA4335\" d=\"M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z\"/></svg>`;\n case 'paypal':\n return `${SVG_OPEN} viewBox=\"0 0 32 32\"><path d=\"M9 4h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L10.4 23H6.7L9 4z\" fill=\"#003087\"/><path d=\"M13 8.5h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L14.4 27.5H10.7L13 8.5z\" fill=\"#009cde\"/></svg>`;\n case 'klarna':\n return `${SVG_OPEN} viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" rx=\"6\" fill=\"#FFA8CD\"/><path fill=\"#0B051D\" d=\"M8 6h2.7v12H8V6zm6.5 0h2.5c-.4 2.7-1.5 5-3 6.6 1.6 1.6 2.7 3.6 3.2 5.4h-2.7c-.5-1.6-1.4-3-2.7-4.2v4.2H10V12c2.1-1 3.8-3.2 4.5-6z\"/></svg>`;\n case 'crypto':\n return `${SVG_OPEN} viewBox=\"0 0 64 64\"><path fill=\"#F7931A\" d=\"m63.033,39.744c-4.274,17.143-21.637,27.576-38.782,23.301-17.138-4.274-27.571-21.638-23.295-38.78,4.272-17.145,21.635-27.579,38.775-23.305,17.144,4.274,27.576,21.64,23.302,38.784z\"/><path fill=\"#FFF\" d=\"m46.103,27.444c0.637-4.258-2.605-6.547-7.038-8.074l1.438-5.768-3.511-0.875-1.4,5.616c-0.923-0.23-1.871-0.447-2.813-0.662l1.41-5.653-3.509-0.875-1.439,5.766c-0.764-0.174-1.514-0.346-2.242-0.527l0.004-0.018-4.842-1.209-0.934,3.75s2.605,0.597,2.55,0.634c1.422,0.355,1.679,1.296,1.636,2.042l-1.638,6.571c0.098,0.025,0.225,0.061,0.365,0.117-0.117-0.029-0.242-0.061-0.371-0.092l-2.296,9.205c-0.174,0.432-0.615,1.08-1.609,0.834,0.035,0.051-2.552-0.637-2.552-0.637l-1.743,4.019,4.569,1.139c0.85,0.213,1.683,0.436,2.503,0.646l-1.453,5.834,3.507,0.875,1.439-5.772c0.958,0.26,1.888,0.5,2.798,0.726l-1.434,5.745,3.511,0.875,1.453-5.823c5.987,1.133,10.489,0.676,12.384-4.739,1.527-4.36-0.076-6.875-3.226-8.515,2.294-0.529,4.022-2.038,4.483-5.155zm-8.022,11.249c-1.085,4.36-8.426,2.003-10.806,1.412l1.928-7.729c2.38,0.594,10.012,1.77,8.878,6.317zm1.086-11.312c-0.99,3.966-7.1,1.951-9.082,1.457l1.748-7.01c1.982,0.494,8.365,1.416,7.334,5.553z\"/></svg>`;\n case 'wallet':\n return line(\n '<path d=\"M3 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2\"/><rect x=\"3\" y=\"7\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M16 13h3\"/>',\n );\n }\n}\n\nfunction isBuiltinKey(key: string): key is BuiltinPaymentIconKey {\n return (BUILTIN_PAYMENT_ICON_KEYS as readonly string[]).includes(key);\n}\n\n/**\n * The SVG document of a built-in glyph. An unknown key — one a newer API\n * added — draws the neutral `wallet` glyph rather than nothing.\n *\n * @param color - What line glyphs and Apple's mark are drawn in. Defaults to\n * a dark grey that reads on a light button.\n */\nexport function builtinPaymentIconSvg(key: string, color = '#1f2937'): string {\n return glyph(isBuiltinKey(key) ? key : 'wallet', color);\n}\n\n/** {@link builtinPaymentIconSvg} as a `data:` URI for an image element's `src`. */\nexport function builtinPaymentIconDataUri(key: string, color?: string): string {\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(builtinPaymentIconSvg(key, color))}`;\n}\n\n/**\n * The image `src` for an icon: an SVG icon's own `data_uri`, a built-in\n * glyph's document otherwise. Use it with an image element, which renders the\n * artwork without running anything in it.\n */\nexport function presentationIconDataUri(icon: PresentationIcon, color?: string): string {\n return icon.type === 'svg' ? icon.data_uri : builtinPaymentIconDataUri(icon.key, color);\n}\n\n/**\n * The image `src` to draw for an entry: its icon, else its fallback glyph.\n * `null` only for a heading, which has no artwork. Pair it with an `onerror`\n * that swaps to `builtinPaymentIconDataUri(entry.fallback_icon)` if you load\n * artwork from anywhere that can fail.\n */\nexport function presentationIconSrc(\n entry: PaymentMethodPresentationEntry,\n color?: string,\n): string | null {\n if (entry.icon) return presentationIconDataUri(entry.icon, color);\n if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);\n return null;\n}\n\n/**\n * Whether DeloPay confirmed a badge: from the provider's answer for the\n * account, or the account's own settings. A `merchant` badge is the shop's\n * own statement for a provider DeloPay cannot ask; draw it, if at all, so a\n * buyer can tell it apart.\n */\nexport function isConfirmedChild(child: Pick<PresentationChild, 'source'>): boolean {\n return child.source !== 'merchant';\n}\n\n/** Whether these helpers understand a response. A different `contract_version` is not read. */\nexport function isSupportedPresentation(\n response: Pick<PaymentMethodPresentationResponse, 'contract_version'>,\n): boolean {\n return response.contract_version === PRESENTATION_CONTRACT_VERSION;\n}\n\n/** A presentation's entries by tier, express rows kept apart, in checkout order. */\nexport interface PresentationTiers {\n express: PaymentMethodPresentationEntry[][];\n normal: PaymentMethodPresentationEntry[];\n alternative: PaymentMethodPresentationEntry[];\n}\n\n/** Group a presentation's entries the way the hosted checkout lays them out. */\nexport function presentationTiers(response: PaymentMethodPresentationResponse): PresentationTiers {\n const out: PresentationTiers = { express: [], normal: [], alternative: [] };\n for (const entry of response.entries) {\n if (entry.tier === 'express') {\n const row = entry.row ?? 0;\n while (out.express.length <= row) out.express.push([]);\n out.express[row]?.push(entry);\n } else {\n out[entry.tier].push(entry);\n }\n }\n out.express = out.express.filter((row) => row.length > 0);\n return out;\n}\n\n/** The entries a buyer can select, in order: everything but headings. */\nexport function selectableEntries(\n response: PaymentMethodPresentationResponse,\n): PaymentMethodPresentationEntry[] {\n return response.entries.filter((entry) => entry.action !== undefined);\n}\n\n/** What {@link PresentationCache.get} answers. */\nexport interface CachedPresentation {\n response: PaymentMethodPresentationResponse;\n /**\n * `true` when DeloPay could not be reached and this is the last answer,\n * still inside its `stale_if_error_seconds`. Display only.\n */\n stale: boolean;\n}\n\n/** How {@link PresentationCache} asks DeloPay. */\nexport type PresentationLoader = (\n params: PaymentMethodPresentationParams,\n options: RequestExtras,\n) => Promise<PaymentMethodPresentationResponse>;\n\nexport interface PresentationCacheOptions {\n /** Usually `(params, options) => delopay.paymentMethods.presentation(params, options)`. */\n load: PresentationLoader;\n /** Milliseconds since the epoch. Defaults to `Date.now`. */\n now?: () => number;\n /** At most this many contexts are kept; the least recently fetched goes first. Default 500. */\n maxEntries?: number;\n}\n\ninterface CacheSlot {\n response: PaymentMethodPresentationResponse;\n fetchedAt: number;\n}\n\n/**\n * A cache for the merchant's server in front of\n * `GET /account/payment-methods/presentation`, keyed by everything that\n * changes the answer: shop, environment, locale, country, currency and amount.\n *\n * - Reuses an answer for its `cache.max_age_seconds`, then revalidates with\n * `If-None-Match`; an unchanged revision costs no body.\n * - While DeloPay cannot be reached it keeps serving the last answer for\n * `cache.stale_if_error_seconds` more, marked `stale`, then rethrows.\n * - Never caches a payment's answer (`client_secret`): those are asked every\n * time, since a cart change needs a new answer.\n *\n * One instance per secret key: an answer is the authenticated merchant's and\n * must not be shared with another merchant's requests.\n */\nexport class PresentationCache {\n private readonly slots = new Map<string, CacheSlot>();\n private readonly load: PresentationLoader;\n private readonly now: () => number;\n private readonly maxEntries: number;\n\n constructor(options: PresentationCacheOptions) {\n this.load = options.load;\n this.now = options.now ?? Date.now;\n this.maxEntries = options.maxEntries ?? 500;\n }\n\n /** The key two requests share exactly when DeloPay would answer them alike. */\n static keyOf(params: PaymentMethodPresentationParams): string {\n return JSON.stringify([\n params.profile_id ?? null,\n params.environment ?? 'live',\n params.locale?.toLowerCase() ?? null,\n params.country?.toUpperCase() ?? null,\n params.currency ?? null,\n params.amount ?? null,\n params.contract_version ?? PRESENTATION_CONTRACT_VERSION,\n ]);\n }\n\n async get(params: PaymentMethodPresentationParams): Promise<CachedPresentation> {\n const request: PaymentMethodPresentationParams = {\n ...params,\n contract_version: params.contract_version ?? PRESENTATION_CONTRACT_VERSION,\n };\n if (request.client_secret) {\n return { response: await this.load(request, {}), stale: false };\n }\n const key = PresentationCache.keyOf(request);\n const slot = this.slots.get(key);\n const now = this.now();\n if (slot && now - slot.fetchedAt < slot.response.cache.max_age_seconds * 1000) {\n return { response: slot.response, stale: false };\n }\n try {\n const response = await this.load(\n request,\n slot ? { headers: { 'If-None-Match': `\"${slot.response.revision}\"` } } : {},\n );\n this.store(key, response, now);\n return { response, stale: false };\n } catch (error) {\n if (slot && error instanceof DelopayError && error.status === 304) {\n this.store(key, slot.response, now);\n return { response: slot.response, stale: false };\n }\n const policy = slot?.response.cache;\n const usableUntil = slot\n ? slot.fetchedAt +\n ((policy?.max_age_seconds ?? 0) + (policy?.stale_if_error_seconds ?? 0)) * 1000\n : 0;\n if (slot && isUnavailable(error) && now < usableUntil) {\n return { response: slot.response, stale: true };\n }\n // A definitive refusal (a shop that is gone, a revoked key) retires the\n // answer: a later outage must not bring it back as a stale copy.\n if (slot && isRefusal(error)) this.slots.delete(key);\n throw error;\n }\n }\n\n /** Forget every answer, e.g. after the merchant changes the checkout editor. */\n clear(): void {\n this.slots.clear();\n }\n\n private store(key: string, response: PaymentMethodPresentationResponse, now: number): void {\n if (response.cache.max_age_seconds <= 0) {\n this.slots.delete(key);\n return;\n }\n this.slots.delete(key);\n this.slots.set(key, { response, fetchedAt: now });\n while (this.slots.size > this.maxEntries) {\n const oldest = this.slots.keys().next().value;\n if (oldest === undefined) break;\n this.slots.delete(oldest);\n }\n }\n}\n\n/**\n * DeloPay could not answer: the network, a timeout, a rate limit or a server\n * error. A 4xx (a refused key, a shop that is not there) is an answer, and is\n * never papered over with an older one.\n */\nfunction isRefusal(error: unknown): boolean {\n return (\n error instanceof DelopayError &&\n error.status >= 400 &&\n error.status < 500 &&\n error.status !== 429\n );\n}\n\nfunction isUnavailable(error: unknown): boolean {\n if (!(error instanceof DelopayError)) return false;\n return error.status === 0 || error.status === 429 || error.status >= 500;\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-Q7M7DO7M.cjs","../src/paymentPresentation.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACiBO,IAAM,8BAAA,EAAgC,CAAA;AAGtC,IAAM,0BAAA,EAA4B;AAAA,EACvC,QAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,SAAA,EAAW,yCAAA;AAOjB,SAAS,KAAA,CAAM,GAAA,EAA4B,KAAA,EAAuB;AAChE,EAAA,MAAM,KAAA,EAAO,CAAC,IAA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AA;AACe,MAAA;AACK,MAAA;AAIR,MAAA;AACD,QAAA;AACX,MAAA;AAGY,MAAA;AACN,MAAA;AACR,IAAA;AACF,EAAA;AAAA;AAGc,EAAA;AACK,IAAA;AACnB,EAAA;AAEwE,EAAA;AACnD,IAAA;AACC,MAAA;AAClB,MAAA;AACF,IAAA;AACqB,IAAA;AACC,IAAA;AACJ,IAAA;AACI,MAAA;AACL,MAAA;AACG,MAAA;AACpB,IAAA;AACF,EAAA;AACF;AAO4C;AAEvB,EAAA;AAKrB;AAEuB;AACE,EAAA;AACC,EAAA;AAC1B;ADrJ0B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-Q7M7DO7M.cjs","sourcesContent":[null,"/**\n * Helpers for rendering a shop's payment buttons on the merchant's own site\n * from `GET /account/payment-methods/presentation`: DeloPay's\n * built-in glyphs, icon resolution with a fallback, grouping by tier, and a\n * cache for the merchant's server that honours the response's own policy.\n *\n * Nothing here decides which methods a payment can be confirmed with. The\n * payment is confirmed against the shop's current configuration, whatever a\n * cached or displayed list says.\n */\nimport { DelopayError } from './error';\nimport type {\n PaymentMethodPresentationEntry,\n PaymentMethodPresentationParams,\n PaymentMethodPresentationResponse,\n PresentationChild,\n PresentationIcon,\n} from './types';\nimport type { RequestExtras } from './client';\n\n/** The response contract these helpers read. */\nexport const PRESENTATION_CONTRACT_VERSION = 1;\n\n/** The built-in glyph keys a presentation names in `icon.key` and `fallback_icon`. */\nexport const BUILTIN_PAYMENT_ICON_KEYS = [\n 'wallet',\n 'card',\n 'bank',\n 'apple',\n 'google',\n 'bnpl',\n 'cash',\n 'paypal',\n 'klarna',\n 'crypto',\n] as const;\n\nexport type BuiltinPaymentIconKey = (typeof BUILTIN_PAYMENT_ICON_KEYS)[number];\n\nconst SVG_OPEN = '<svg xmlns=\"http://www.w3.org/2000/svg\"';\n\n/**\n * The glyphs DeloPay's hosted checkout draws, as standalone SVG documents.\n * Line glyphs and Apple's mark take `color`; the other brand marks keep their\n * brand colours.\n */\nfunction glyph(key: BuiltinPaymentIconKey, color: string): string {\n const line = (body: string) =>\n `${SVG_OPEN} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"${color}\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${body}</svg>`;\n switch (key) {\n case 'card':\n return line('<rect x=\"2\" y=\"5\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M2 10h20\"/>');\n case 'bank':\n return line(\n '<path d=\"M3 10h18\"/><path d=\"m12 3 9 5H3l9-5Z\"/><path d=\"M6 10v7M10 10v7M14 10v7M18 10v7\"/><path d=\"M3 20h18\"/>',\n );\n case 'bnpl':\n return line(\n '<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><path d=\"M6 12h4\"/><path d=\"M14 10v4\"/><path d=\"M18 10v4\"/>',\n );\n case 'cash':\n return line(\n '<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/><path d=\"M6 12h.01M18 12h.01\"/>',\n );\n case 'apple':\n return `${SVG_OPEN} viewBox=\"0 0 384 512\" fill=\"${color}\"><path d=\"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z\"/></svg>`;\n case 'google':\n return `${SVG_OPEN} viewBox=\"0 0 48 48\"><path fill=\"#4285F4\" d=\"M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z\"/><path fill=\"#34A853\" d=\"M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z\"/><path fill=\"#FBBC05\" d=\"M11.69 28.18C11.25 26.86 11 25.45 11 24s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24s.85 6.91 2.34 9.88l7.35-5.7z\"/><path fill=\"#EA4335\" d=\"M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z\"/></svg>`;\n case 'paypal':\n return `${SVG_OPEN} viewBox=\"0 0 32 32\"><path d=\"M9 4h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L10.4 23H6.7L9 4z\" fill=\"#003087\"/><path d=\"M13 8.5h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L14.4 27.5H10.7L13 8.5z\" fill=\"#009cde\"/></svg>`;\n case 'klarna':\n return `${SVG_OPEN} viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" rx=\"6\" fill=\"#FFA8CD\"/><path fill=\"#0B051D\" d=\"M8 6h2.7v12H8V6zm6.5 0h2.5c-.4 2.7-1.5 5-3 6.6 1.6 1.6 2.7 3.6 3.2 5.4h-2.7c-.5-1.6-1.4-3-2.7-4.2v4.2H10V12c2.1-1 3.8-3.2 4.5-6z\"/></svg>`;\n case 'crypto':\n return `${SVG_OPEN} viewBox=\"0 0 64 64\"><path fill=\"#F7931A\" d=\"m63.033,39.744c-4.274,17.143-21.637,27.576-38.782,23.301-17.138-4.274-27.571-21.638-23.295-38.78,4.272-17.145,21.635-27.579,38.775-23.305,17.144,4.274,27.576,21.64,23.302,38.784z\"/><path fill=\"#FFF\" d=\"m46.103,27.444c0.637-4.258-2.605-6.547-7.038-8.074l1.438-5.768-3.511-0.875-1.4,5.616c-0.923-0.23-1.871-0.447-2.813-0.662l1.41-5.653-3.509-0.875-1.439,5.766c-0.764-0.174-1.514-0.346-2.242-0.527l0.004-0.018-4.842-1.209-0.934,3.75s2.605,0.597,2.55,0.634c1.422,0.355,1.679,1.296,1.636,2.042l-1.638,6.571c0.098,0.025,0.225,0.061,0.365,0.117-0.117-0.029-0.242-0.061-0.371-0.092l-2.296,9.205c-0.174,0.432-0.615,1.08-1.609,0.834,0.035,0.051-2.552-0.637-2.552-0.637l-1.743,4.019,4.569,1.139c0.85,0.213,1.683,0.436,2.503,0.646l-1.453,5.834,3.507,0.875,1.439-5.772c0.958,0.26,1.888,0.5,2.798,0.726l-1.434,5.745,3.511,0.875,1.453-5.823c5.987,1.133,10.489,0.676,12.384-4.739,1.527-4.36-0.076-6.875-3.226-8.515,2.294-0.529,4.022-2.038,4.483-5.155zm-8.022,11.249c-1.085,4.36-8.426,2.003-10.806,1.412l1.928-7.729c2.38,0.594,10.012,1.77,8.878,6.317zm1.086-11.312c-0.99,3.966-7.1,1.951-9.082,1.457l1.748-7.01c1.982,0.494,8.365,1.416,7.334,5.553z\"/></svg>`;\n case 'wallet':\n return line(\n '<path d=\"M3 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2\"/><rect x=\"3\" y=\"7\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M16 13h3\"/>',\n );\n }\n}\n\nfunction isBuiltinKey(key: string): key is BuiltinPaymentIconKey {\n return (BUILTIN_PAYMENT_ICON_KEYS as readonly string[]).includes(key);\n}\n\n/**\n * The SVG document of a built-in glyph. An unknown key — one a newer API\n * added — draws the neutral `wallet` glyph rather than nothing.\n *\n * @param color - What line glyphs and Apple's mark are drawn in. Defaults to\n * a dark grey that reads on a light button.\n */\nexport function builtinPaymentIconSvg(key: string, color = '#1f2937'): string {\n return glyph(isBuiltinKey(key) ? key : 'wallet', color);\n}\n\n/** {@link builtinPaymentIconSvg} as a `data:` URI for an image element's `src`. */\nexport function builtinPaymentIconDataUri(key: string, color?: string): string {\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(builtinPaymentIconSvg(key, color))}`;\n}\n\n/**\n * The image `src` for an icon: an SVG icon's own `data_uri`, a built-in\n * glyph's document otherwise. Use it with an image element, which renders the\n * artwork without running anything in it.\n */\nexport function presentationIconDataUri(icon: PresentationIcon, color?: string): string {\n return icon.type === 'svg' ? icon.data_uri : builtinPaymentIconDataUri(icon.key, color);\n}\n\n/**\n * The image `src` to draw for an entry: its icon, else its fallback glyph.\n * `null` only for a heading, which has no artwork. Pair it with an `onerror`\n * that swaps to `builtinPaymentIconDataUri(entry.fallback_icon)` if you load\n * artwork from anywhere that can fail.\n */\nexport function presentationIconSrc(\n entry: PaymentMethodPresentationEntry,\n color?: string,\n): string | null {\n if (entry.icon) return presentationIconDataUri(entry.icon, color);\n if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);\n return null;\n}\n\n/**\n * Whether DeloPay confirmed a badge: from the provider's answer for the\n * account, or the account's own settings. A `merchant` badge is the shop's\n * own statement for a provider DeloPay cannot ask; draw it, if at all, so a\n * buyer can tell it apart.\n */\nexport function isConfirmedChild(child: Pick<PresentationChild, 'source'>): boolean {\n return child.source !== 'merchant';\n}\n\n/** Whether these helpers understand a response. A different `contract_version` is not read. */\nexport function isSupportedPresentation(\n response: Pick<PaymentMethodPresentationResponse, 'contract_version'>,\n): boolean {\n return response.contract_version === PRESENTATION_CONTRACT_VERSION;\n}\n\n/** A presentation's entries by tier, express rows kept apart, in checkout order. */\nexport interface PresentationTiers {\n express: PaymentMethodPresentationEntry[][];\n normal: PaymentMethodPresentationEntry[];\n alternative: PaymentMethodPresentationEntry[];\n}\n\n/** Group a presentation's entries the way the hosted checkout lays them out. */\nexport function presentationTiers(response: PaymentMethodPresentationResponse): PresentationTiers {\n const out: PresentationTiers = { express: [], normal: [], alternative: [] };\n for (const entry of response.entries) {\n if (entry.tier === 'express') {\n const row = entry.row ?? 0;\n while (out.express.length <= row) out.express.push([]);\n out.express[row]?.push(entry);\n } else {\n out[entry.tier].push(entry);\n }\n }\n out.express = out.express.filter((row) => row.length > 0);\n return out;\n}\n\n/** The entries a buyer can select, in order: everything but headings. */\nexport function selectableEntries(\n response: PaymentMethodPresentationResponse,\n): PaymentMethodPresentationEntry[] {\n return response.entries.filter((entry) => entry.action !== undefined);\n}\n\n/** What {@link PresentationCache.get} answers. */\nexport interface CachedPresentation {\n response: PaymentMethodPresentationResponse;\n /**\n * `true` when DeloPay could not be reached and this is the last answer,\n * still inside its `stale_if_error_seconds`. Display only.\n */\n stale: boolean;\n}\n\n/** How {@link PresentationCache} asks DeloPay. */\nexport type PresentationLoader = (\n params: PaymentMethodPresentationParams,\n options: RequestExtras,\n) => Promise<PaymentMethodPresentationResponse>;\n\nexport interface PresentationCacheOptions {\n /** Usually `(params, options) => delopay.paymentMethods.presentation(params, options)`. */\n load: PresentationLoader;\n /** Milliseconds since the epoch. Defaults to `Date.now`. */\n now?: () => number;\n /** At most this many contexts are kept; the least recently fetched goes first. Default 500. */\n maxEntries?: number;\n}\n\ninterface CacheSlot {\n response: PaymentMethodPresentationResponse;\n fetchedAt: number;\n}\n\n/**\n * A cache for the merchant's server in front of\n * `GET /account/payment-methods/presentation`, keyed by everything that\n * changes the answer: shop, environment, locale, country, currency and amount.\n *\n * - Reuses an answer for its `cache.max_age_seconds`, then revalidates with\n * `If-None-Match`; an unchanged revision costs no body.\n * - While DeloPay cannot be reached it keeps serving the last answer for\n * `cache.stale_if_error_seconds` more, marked `stale`, then rethrows.\n * - Never caches a payment's answer (`client_secret`): those are asked every\n * time, since a cart change needs a new answer.\n *\n * One instance per secret key: an answer is the authenticated merchant's and\n * must not be shared with another merchant's requests.\n */\nexport class PresentationCache {\n private readonly slots = new Map<string, CacheSlot>();\n private readonly load: PresentationLoader;\n private readonly now: () => number;\n private readonly maxEntries: number;\n\n constructor(options: PresentationCacheOptions) {\n this.load = options.load;\n this.now = options.now ?? Date.now;\n this.maxEntries = options.maxEntries ?? 500;\n }\n\n /** The key two requests share exactly when DeloPay would answer them alike. */\n static keyOf(params: PaymentMethodPresentationParams): string {\n return JSON.stringify([\n params.profile_id ?? null,\n params.environment ?? 'live',\n params.locale?.toLowerCase() ?? null,\n params.country?.toUpperCase() ?? null,\n params.currency ?? null,\n params.amount ?? null,\n params.contract_version ?? PRESENTATION_CONTRACT_VERSION,\n ]);\n }\n\n async get(params: PaymentMethodPresentationParams): Promise<CachedPresentation> {\n const request: PaymentMethodPresentationParams = {\n ...params,\n contract_version: params.contract_version ?? PRESENTATION_CONTRACT_VERSION,\n };\n if (request.client_secret) {\n return { response: await this.load(request, {}), stale: false };\n }\n const key = PresentationCache.keyOf(request);\n const slot = this.slots.get(key);\n const now = this.now();\n if (slot && now - slot.fetchedAt < slot.response.cache.max_age_seconds * 1000) {\n return { response: slot.response, stale: false };\n }\n try {\n const response = await this.load(\n request,\n slot ? { headers: { 'If-None-Match': `\"${slot.response.revision}\"` } } : {},\n );\n this.store(key, response, now);\n return { response, stale: false };\n } catch (error) {\n if (slot && error instanceof DelopayError && error.status === 304) {\n this.store(key, slot.response, now);\n return { response: slot.response, stale: false };\n }\n const policy = slot?.response.cache;\n const usableUntil = slot\n ? slot.fetchedAt +\n ((policy?.max_age_seconds ?? 0) + (policy?.stale_if_error_seconds ?? 0)) * 1000\n : 0;\n if (slot && isUnavailable(error) && now < usableUntil) {\n return { response: slot.response, stale: true };\n }\n // A definitive refusal (a shop that is gone, a revoked key) retires the\n // answer: a later outage must not bring it back as a stale copy.\n if (slot && isRefusal(error)) this.slots.delete(key);\n throw error;\n }\n }\n\n /** Forget every answer, e.g. after the merchant changes the checkout editor. */\n clear(): void {\n this.slots.clear();\n }\n\n private store(key: string, response: PaymentMethodPresentationResponse, now: number): void {\n if (response.cache.max_age_seconds <= 0) {\n this.slots.delete(key);\n return;\n }\n this.slots.delete(key);\n this.slots.set(key, { response, fetchedAt: now });\n while (this.slots.size > this.maxEntries) {\n const oldest = this.slots.keys().next().value;\n if (oldest === undefined) break;\n this.slots.delete(oldest);\n }\n }\n}\n\n/**\n * DeloPay could not answer: the network, a timeout, a rate limit or a server\n * error. A 4xx (a refused key, a shop that is not there) is an answer, and is\n * never papered over with an older one.\n */\nfunction isRefusal(error: unknown): boolean {\n return (\n error instanceof DelopayError &&\n error.status >= 400 &&\n error.status < 500 &&\n error.status !== 429\n );\n}\n\nfunction isUnavailable(error: unknown): boolean {\n if (!(error instanceof DelopayError)) return false;\n return error.status === 0 || error.status === 429 || error.status >= 500;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QKUWFMZP.cjs","../src/internal/resources/adminFeePlans.ts"],"names":[],"mappings":"AAAA;ACWA,IAAM,KAAA,EAAO,yBAAA;AACb,IAAM,aAAA,EAAe,CAAC,UAAA,EAAA,GACpB,CAAA,EAAA;AACoC;AASX;AACwB,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAGY,EAAA;AACjC,IAAA;AAC7B,EAAA;AAAA;AAGyE,EAAA;AACzC,IAAA;AAChC,EAAA;AAAA;AAGuC,EAAA;AACV,IAAA;AAC7B,EAAA;AAAA;AAKE,EAAA;AAG2B,IAAA;AAC7B,EAAA;AAAA;AAGuF,EAAA;AACtD,IAAA;AACD,IAAA;AACH,IAAA;AAC7B,EAAA;AAAA;AAAA;AAAA;AAAA;AAMkC,EAAA;AACR,IAAA;AACF,MAAA;AACtB,IAAA;AAEI,IAAA;AAE0B,IAAA;AAChC,EAAA;AAAA;AAKE,EAAA;AAG8B,IAAA;AACrB,MAAA;AACc,QAAA;AACD,QAAA;AACC,QAAA;AACrB,MAAA;AACD,IAAA;AACH,EAAA;AAAA;AAGwB,EAAA;AACE,IAAA;AACtB,MAAA;AAC2B,MAAA;AAC7B,IAAA;AACY,IAAA;AACd,EAAA;AAAA;AAG8E,EAAA;AAC7C,IAAA;AACjC,EAAA;AACF;ADnCoC;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QKUWFMZP.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type {\n FeePlanConnectorAccount,\n FeePlanOverview,\n FeePlanPreviewRequest,\n FeePlanPreviewResponse,\n FeePlanSaveRequest,\n FeePlanScope,\n FeePlanScopeView,\n} from '../types';\n\nconst BASE = '/admin-portal/fee-plans';\nconst merchantPath = (merchantId: string): string =>\n `${BASE}/merchants/${encodeURIComponent(merchantId)}`;\nconst shopPath = (merchantId: string, profileId: string): string =>\n `${merchantPath(merchantId)}/shops/${encodeURIComponent(profileId)}`;\n\n/**\n * Platform fee plans: the default plan every merchant pays, and exceptions for\n * one merchant or one shop. Every write names the scope's `revision` as read,\n * and one against an older revision is refused, so two editors never\n * overwrite each other.\n */\nexport class AdminFeePlans {\n constructor(private readonly request: RequestFn) {}\n\n /** The default plan and every exception, or one merchant's. `GET /admin-portal/fee-plans` */\n async overview(merchantId?: string): Promise<FeePlanOverview> {\n return this.request('GET', BASE, { query: { merchant_id: merchantId } });\n }\n\n /** A new version of the default plan. `PUT /admin-portal/fee-plans/default` */\n async saveDefault(params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n return this.request('PUT', `${BASE}/default`, { body: params });\n }\n\n /** A new version of a merchant exception. `PUT /admin-portal/fee-plans/merchants/{merchant_id}` */\n async saveMerchant(merchantId: string, params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n return this.request('PUT', merchantPath(merchantId), { body: params });\n }\n\n /** A new version of a shop exception. `PUT /admin-portal/fee-plans/merchants/{merchant_id}/shops/{profile_id}` */\n async saveShop(\n merchantId: string,\n profileId: string,\n params: FeePlanSaveRequest,\n ): Promise<FeePlanScopeView> {\n return this.request('PUT', shopPath(merchantId, profileId), { body: params });\n }\n\n /** Save the plan of any scope: the default, a merchant or a shop. */\n async save(scope: FeePlanScope, params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n if (!scope.merchant_id) return this.saveDefault(params);\n if (!scope.profile_id) return this.saveMerchant(scope.merchant_id, params);\n return this.saveShop(scope.merchant_id, scope.profile_id, params);\n }\n\n /**\n * Remove an exception with every scheduled version; the plan above it\n * applies. The default plan cannot be removed.\n */\n async remove(scope: FeePlanScope, expectedRevision: string): Promise<FeePlanScopeView> {\n if (!scope.merchant_id) {\n throw new TypeError('The default plan cannot be removed.');\n }\n const path = scope.profile_id\n ? shopPath(scope.merchant_id, scope.profile_id)\n : merchantPath(scope.merchant_id);\n return this.request('DELETE', path, { query: { expected_revision: expectedRevision } });\n }\n\n /** Cancel a version that has not started yet. `DELETE /admin-portal/fee-plans/versions/{version_id}` */\n async cancelVersion(\n versionId: string,\n scope: FeePlanScope,\n expectedRevision: string,\n ): Promise<FeePlanScopeView> {\n return this.request('DELETE', `${BASE}/versions/${encodeURIComponent(versionId)}`, {\n query: {\n merchant_id: scope.merchant_id,\n profile_id: scope.profile_id,\n expected_revision: expectedRevision,\n },\n });\n }\n\n /** A merchant's connector accounts, for an override that names one. `GET /admin-portal/fee-plans/merchants/{merchant_id}/connector-accounts` */\n async connectorAccounts(merchantId: string): Promise<FeePlanConnectorAccount[]> {\n const body = await this.request<{ accounts: FeePlanConnectorAccount[] }>(\n 'GET',\n `${merchantPath(merchantId)}/connector-accounts`,\n );\n return body.accounts;\n }\n\n /** What a sample payment would be charged under a plan, without saving it. `POST /admin-portal/fee-plans/preview` */\n async preview(params: FeePlanPreviewRequest): Promise<FeePlanPreviewResponse> {\n return this.request('POST', `${BASE}/preview`, { body: params });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QKUWFMZP.cjs","../src/internal/resources/adminFeePlans.ts"],"names":[],"mappings":"AAAA;ACWA,IAAM,KAAA,EAAO,yBAAA;AACb,IAAM,aAAA,EAAe,CAAC,UAAA,EAAA,GACpB,CAAA,EAAA;AACoC;AASX;AACwB,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAGY,EAAA;AACjC,IAAA;AAC7B,EAAA;AAAA;AAGyE,EAAA;AACzC,IAAA;AAChC,EAAA;AAAA;AAGuC,EAAA;AACV,IAAA;AAC7B,EAAA;AAAA;AAKE,EAAA;AAG2B,IAAA;AAC7B,EAAA;AAAA;AAGuF,EAAA;AACtD,IAAA;AACD,IAAA;AACH,IAAA;AAC7B,EAAA;AAAA;AAAA;AAAA;AAAA;AAMkC,EAAA;AACR,IAAA;AACF,MAAA;AACtB,IAAA;AAEI,IAAA;AAE0B,IAAA;AAChC,EAAA;AAAA;AAKE,EAAA;AAG8B,IAAA;AACrB,MAAA;AACc,QAAA;AACD,QAAA;AACC,QAAA;AACrB,MAAA;AACD,IAAA;AACH,EAAA;AAAA;AAGwB,EAAA;AACE,IAAA;AACtB,MAAA;AAC2B,MAAA;AAC7B,IAAA;AACY,IAAA;AACd,EAAA;AAAA;AAG8E,EAAA;AAC7C,IAAA;AACjC,EAAA;AACF;ADnCoC;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QKUWFMZP.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type {\n FeePlanConnectorAccount,\n FeePlanOverview,\n FeePlanPreviewRequest,\n FeePlanPreviewResponse,\n FeePlanSaveRequest,\n FeePlanScope,\n FeePlanScopeView,\n} from '../types';\n\nconst BASE = '/admin-portal/fee-plans';\nconst merchantPath = (merchantId: string): string =>\n `${BASE}/merchants/${encodeURIComponent(merchantId)}`;\nconst shopPath = (merchantId: string, profileId: string): string =>\n `${merchantPath(merchantId)}/shops/${encodeURIComponent(profileId)}`;\n\n/**\n * Platform fee plans: the default plan every merchant pays, and exceptions for\n * one merchant or one shop. Every write names the scope's `revision` as read,\n * and one against an older revision is refused, so two editors never\n * overwrite each other.\n */\nexport class AdminFeePlans {\n constructor(private readonly request: RequestFn) {}\n\n /** The default plan and every exception, or one merchant's. `GET /admin-portal/fee-plans` */\n async overview(merchantId?: string): Promise<FeePlanOverview> {\n return this.request('GET', BASE, { query: { merchant_id: merchantId } });\n }\n\n /** A new version of the default plan. `PUT /admin-portal/fee-plans/default` */\n async saveDefault(params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n return this.request('PUT', `${BASE}/default`, { body: params });\n }\n\n /** A new version of a merchant exception. `PUT /admin-portal/fee-plans/merchants/{merchant_id}` */\n async saveMerchant(merchantId: string, params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n return this.request('PUT', merchantPath(merchantId), { body: params });\n }\n\n /** A new version of a shop exception. `PUT /admin-portal/fee-plans/merchants/{merchant_id}/shops/{profile_id}` */\n async saveShop(\n merchantId: string,\n profileId: string,\n params: FeePlanSaveRequest,\n ): Promise<FeePlanScopeView> {\n return this.request('PUT', shopPath(merchantId, profileId), { body: params });\n }\n\n /** Save the plan of any scope: the default, a merchant or a shop. */\n async save(scope: FeePlanScope, params: FeePlanSaveRequest): Promise<FeePlanScopeView> {\n if (!scope.merchant_id) return this.saveDefault(params);\n if (!scope.profile_id) return this.saveMerchant(scope.merchant_id, params);\n return this.saveShop(scope.merchant_id, scope.profile_id, params);\n }\n\n /**\n * Remove an exception with every scheduled version; the plan above it\n * applies. The default plan cannot be removed.\n */\n async remove(scope: FeePlanScope, expectedRevision: string): Promise<FeePlanScopeView> {\n if (!scope.merchant_id) {\n throw new TypeError('The default plan cannot be removed.');\n }\n const path = scope.profile_id\n ? shopPath(scope.merchant_id, scope.profile_id)\n : merchantPath(scope.merchant_id);\n return this.request('DELETE', path, { query: { expected_revision: expectedRevision } });\n }\n\n /** Cancel a version that has not started yet. `DELETE /admin-portal/fee-plans/versions/{version_id}` */\n async cancelVersion(\n versionId: string,\n scope: FeePlanScope,\n expectedRevision: string,\n ): Promise<FeePlanScopeView> {\n return this.request('DELETE', `${BASE}/versions/${encodeURIComponent(versionId)}`, {\n query: {\n merchant_id: scope.merchant_id,\n profile_id: scope.profile_id,\n expected_revision: expectedRevision,\n },\n });\n }\n\n /** A merchant's connector accounts, for an override that names one. `GET /admin-portal/fee-plans/merchants/{merchant_id}/connector-accounts` */\n async connectorAccounts(merchantId: string): Promise<FeePlanConnectorAccount[]> {\n const body = await this.request<{ accounts: FeePlanConnectorAccount[] }>(\n 'GET',\n `${merchantPath(merchantId)}/connector-accounts`,\n );\n return body.accounts;\n }\n\n /** What a sample payment would be charged under a plan, without saving it. `POST /admin-portal/fee-plans/preview` */\n async preview(params: FeePlanPreviewRequest): Promise<FeePlanPreviewResponse> {\n return this.request('POST', `${BASE}/preview`, { body: params });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QRSA72B3.cjs","../src/resources/deploymentBranding.ts"],"names":[],"mappings":"AAAA;ACgBO,SAAS,iBAAA,CAAkB,KAAA,EAAsB,OAAA,EAAiC;AACvF,EAAA,MAAM,KAAA,EAAO,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,KAAK,CAAC,CAAA,CAAA;AACD,EAAA;AAC3D;AAQsB;AAIlB,EAAA;AAFiB,IAAA;AACA,IAAA;AAChB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY8D,EAAA;AACT,IAAA;AACxD,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASgE,EAAA;AACL,IAAA;AAC3D,EAAA;AACF;ADvB6D;AACA;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QRSA72B3.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type { BrandingAsset, PublicBranding } from '../types';\n\n/**\n * The path of one branding image or font file, relative to the API base URL:\n * `/branding/assets/{asset}`, with `?v={version}` when a version is given.\n *\n * The router serves the file in force from this path: the address the\n * operator saved, else the router's own environment value (only `logo` and\n * `email_font` have one). It answers 404 only when neither applies. A page\n * whose content security policy allows only same-origin images and fonts can\n * load it through its same-origin API prefix.\n *\n * So a `null` field from `branding.retrieve()` does not mean this path 404s:\n * `logo` and `email_font` may still serve the router's default.\n */\nexport function brandingAssetPath(asset: BrandingAsset, version?: string | null): string {\n const path = `/branding/assets/${encodeURIComponent(asset)}`;\n return version ? `${path}?v=${encodeURIComponent(version)}` : path;\n}\n\n/**\n * The deployment's branding (name, logos, favicon, default checkout colours)\n * as the platform operator saved it. Public: no credential is needed.\n *\n * The operator edits it through `adminBranding` on `DelopayInternal`.\n */\nexport class Branding {\n constructor(\n private readonly request: RequestFn,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * The saved branding. A `null` field means \"keep your own default\".\n *\n * Branding is cosmetic, so treat any failure as \"nothing saved\": routers\n * from before this route answer 404, and a page must never wait long for\n * it. Pass a `signal` (e.g. `AbortSignal.timeout(2500)`) to bound the call\n * including its retries; a `timeout` alone applies to each attempt.\n *\n * `GET /branding`\n */\n async retrieve(options?: RequestExtras): Promise<PublicBranding> {\n return this.request('GET', '/branding', { ...options });\n }\n\n /**\n * The address of one branding image or font file on this client's base\n * URL, for an `<img src>` or a `@font-face` `src`. See\n * {@link brandingAssetPath}.\n *\n * `GET /branding/assets/{asset}`\n */\n assetUrl(asset: BrandingAsset, version?: string | null): string {\n return `${this.baseUrl}${brandingAssetPath(asset, version)}`;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QRSA72B3.cjs","../src/resources/deploymentBranding.ts"],"names":[],"mappings":"AAAA;ACgBO,SAAS,iBAAA,CAAkB,KAAA,EAAsB,OAAA,EAAiC;AACvF,EAAA,MAAM,KAAA,EAAO,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,KAAK,CAAC,CAAA,CAAA;AACD,EAAA;AAC3D;AAQsB;AAIlB,EAAA;AAFiB,IAAA;AACA,IAAA;AAChB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY8D,EAAA;AACT,IAAA;AACxD,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASgE,EAAA;AACL,IAAA;AAC3D,EAAA;AACF;ADvB6D;AACA;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QRSA72B3.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type { BrandingAsset, PublicBranding } from '../types';\n\n/**\n * The path of one branding image or font file, relative to the API base URL:\n * `/branding/assets/{asset}`, with `?v={version}` when a version is given.\n *\n * The router serves the file in force from this path: the address the\n * operator saved, else the router's own environment value (only `logo` and\n * `email_font` have one). It answers 404 only when neither applies. A page\n * whose content security policy allows only same-origin images and fonts can\n * load it through its same-origin API prefix.\n *\n * So a `null` field from `branding.retrieve()` does not mean this path 404s:\n * `logo` and `email_font` may still serve the router's default.\n */\nexport function brandingAssetPath(asset: BrandingAsset, version?: string | null): string {\n const path = `/branding/assets/${encodeURIComponent(asset)}`;\n return version ? `${path}?v=${encodeURIComponent(version)}` : path;\n}\n\n/**\n * The deployment's branding (name, logos, favicon, default checkout colours)\n * as the platform operator saved it. Public: no credential is needed.\n *\n * The operator edits it through `adminBranding` on `DelopayInternal`.\n */\nexport class Branding {\n constructor(\n private readonly request: RequestFn,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * The saved branding. A `null` field means \"keep your own default\".\n *\n * Branding is cosmetic, so treat any failure as \"nothing saved\": routers\n * from before this route answer 404, and a page must never wait long for\n * it. Pass a `signal` (e.g. `AbortSignal.timeout(2500)`) to bound the call\n * including its retries; a `timeout` alone applies to each attempt.\n *\n * `GET /branding`\n */\n async retrieve(options?: RequestExtras): Promise<PublicBranding> {\n return this.request('GET', '/branding', { ...options });\n }\n\n /**\n * The address of one branding image or font file on this client's base\n * URL, for an `<img src>` or a `@font-face` `src`. See\n * {@link brandingAssetPath}.\n *\n * `GET /branding/assets/{asset}`\n */\n assetUrl(asset: BrandingAsset, version?: string | null): string {\n return `${this.baseUrl}${brandingAssetPath(asset, version)}`;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QYNRNDIY.cjs","../src/resources/invoiceSettings.ts"],"names":[],"mappings":"AAAA;ACkCO,IAAM,wBAAA,EAAN,MAA8B;AAAA,EACnC,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,QAAA,CAAS,OAAA,EAAmD;AAChE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,mBAAA,EAAqB,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAA,CAAO,QAAA,EAA2B,OAAA,EAAmD;AACzF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,mBAAA,EAAqB,EAAE,IAAA,EAAM,QAAA,EAAU,GAAG,QAAQ,CAAC,CAAA;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,eAAA,CAAgB,SAAA,EAAmB,OAAA,EAAmD;AAC1F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,2BAAA,EAA8B,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AACjF,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAU4B,EAAA;AAC4D,IAAA;AAC9E,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUqC,EAAA;AACvB,IAAA;AACV,MAAA;AAC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;AACF;AD9E2F;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-QYNRNDIY.cjs","sourcesContent":[null,"import type {\n EffectiveInvoiceSettings,\n InvoiceLogoRequest,\n InvoicePreviewRequest,\n InvoiceSettings,\n InvoiceTaxRuleEvaluateRequest,\n InvoiceTaxRuleEvaluation,\n InvoiceTaxRules,\n InvoiceTaxRulesRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/**\n * How the merchant's invoices look and are taxed: the merchant default, and\n * each shop's override of it.\n *\n * Every setting resolves shop → merchant default → built-in fallback, and\n * `retrieveEffective` shows the result for one shop with where each value came\n * from. The same two levels hold the tax rules: a shop either inherits the\n * merchant's list or has one of its own that replaces it.\n *\n * **The merchant-level methods need a merchant-level grant** (no shop role\n * holds one), so a shop user may style its own shop and give it tax rules of\n * its own but never change what every shop inherits. The `…ForShop` methods\n * need the `Invoice` area's grant on that shop.\n *\n * Exported as `InvoiceSettingsResource` so the class never shadows the\n * `InvoiceSettings` data type of the same package.\n *\n * An update **replaces every field but the logo**: read, change, and send the\n * whole object back. A field left out is cleared — on a shop that means\n * \"inherit\", on the merchant default \"use the built-in fallback\". The logo has\n * its own methods.\n */\nexport class InvoiceSettingsResource {\n constructor(private readonly request: RequestFn) {}\n\n // --- Settings -------------------------------------------------------------\n\n /**\n * The merchant default.\n * `GET /invoice-settings`\n */\n async retrieve(options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('GET', '/invoice-settings', { ...options });\n }\n\n /**\n * Replace the merchant default (every field but the logo).\n * `PUT /invoice-settings`\n */\n async update(settings: InvoiceSettings, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('PUT', '/invoice-settings', { body: settings, ...options });\n }\n\n /**\n * One shop's override. A `null` field inherits the merchant default.\n * `GET /invoice-settings/profiles/{profile_id}`\n */\n async retrieveForShop(profileId: string, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('GET', `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {\n ...options,\n });\n }\n\n /**\n * Replace one shop's override (every field but the logo).\n * `PUT /invoice-settings/profiles/{profile_id}`\n */\n async updateForShop(\n profileId: string,\n settings: InvoiceSettings,\n options?: RequestExtras,\n ): Promise<InvoiceSettings> {\n return this.request('PUT', `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {\n body: settings,\n ...options,\n });\n }\n\n /**\n * The settings a shop's next document is finalised with, and where each\n * value came from (`shop`, `merchant` or `default`).\n * `GET /invoice-settings/profiles/{profile_id}/effective`\n */\n async retrieveEffective(\n profileId: string,\n options?: RequestExtras,\n ): Promise<EffectiveInvoiceSettings> {\n return this.request(\n 'GET',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/effective`,\n { ...options },\n );\n }\n\n /**\n * A sample invoice PDF rendered from the effective settings with unsaved\n * values laid over them, so a form can show what saving would produce.\n * Writes nothing.\n * `POST /invoice-settings/preview`\n */\n async preview(params: InvoicePreviewRequest, options?: RequestExtras): Promise<Blob> {\n return this.request('POST', '/invoice-settings/preview', {\n body: params,\n responseType: 'blob',\n ...options,\n });\n }\n\n // --- Logo -----------------------------------------------------------------\n\n /**\n * The merchant default's logo image.\n * `GET /invoice-settings/logo`\n */\n async retrieveLogo(options?: RequestExtras): Promise<Blob> {\n return this.request('GET', '/invoice-settings/logo', { responseType: 'blob', ...options });\n }\n\n /**\n * Set the merchant default's logo: PNG or JPEG, at most 1 MB, as base64.\n * `PUT /invoice-settings/logo`\n */\n async updateLogo(params: InvoiceLogoRequest, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('PUT', '/invoice-settings/logo', { body: params, ...options });\n }\n\n /**\n * Remove the merchant default's logo.\n * `DELETE /invoice-settings/logo`\n */\n async deleteLogo(options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('DELETE', '/invoice-settings/logo', { ...options });\n }\n\n /**\n * One shop's own logo image.\n * `GET /invoice-settings/profiles/{profile_id}/logo`\n */\n async retrieveLogoForShop(profileId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * Set one shop's own logo: PNG or JPEG, at most 1 MB, as base64.\n * `PUT /invoice-settings/profiles/{profile_id}/logo`\n */\n async updateLogoForShop(\n profileId: string,\n params: InvoiceLogoRequest,\n options?: RequestExtras,\n ): Promise<InvoiceSettings> {\n return this.request('PUT', `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Remove one shop's own logo; the shop then inherits the merchant default's.\n * `DELETE /invoice-settings/profiles/{profile_id}/logo`\n */\n async deleteLogoForShop(profileId: string, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request(\n 'DELETE',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`,\n { ...options },\n );\n }\n\n // --- Tax rules ------------------------------------------------------------\n\n /**\n * The merchant's tax rules, which every shop without a list of its own uses.\n * `GET /invoice-settings/tax-rules`\n */\n async retrieveTaxRules(options?: RequestExtras): Promise<InvoiceTaxRules> {\n return this.request('GET', '/invoice-settings/tax-rules', { ...options });\n }\n\n /**\n * Replace the merchant's whole rule list; the order is the priority.\n * `PUT /invoice-settings/tax-rules`\n */\n async updateTaxRules(\n params: InvoiceTaxRulesRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request('PUT', '/invoice-settings/tax-rules', { body: params, ...options });\n }\n\n /**\n * The rules one shop uses: its own list, or the merchant's it inherits, as\n * `own_rules` says.\n * `GET /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async retrieveTaxRulesForShop(\n profileId: string,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'GET',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { ...options },\n );\n }\n\n /**\n * Give one shop a list of its own, replacing the merchant's for that shop —\n * even when empty, which leaves every line of the shop to the settings'\n * default rate.\n * `PUT /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async updateTaxRulesForShop(\n profileId: string,\n params: InvoiceTaxRulesRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'PUT',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { body: params, ...options },\n );\n }\n\n /**\n * Drop one shop's own list, so it inherits the merchant's again. Returns\n * the list the shop now uses.\n * `DELETE /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async deleteTaxRulesForShop(\n profileId: string,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'DELETE',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { ...options },\n );\n }\n\n /**\n * Which saved rule a buyer and a product tax category would meet, and what\n * the line would be taxed at. Writes nothing.\n * `POST /invoice-settings/tax-rules/evaluate`\n */\n async evaluateTaxRules(\n params: InvoiceTaxRuleEvaluateRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRuleEvaluation> {\n return this.request('POST', '/invoice-settings/tax-rules/evaluate', {\n body: params,\n ...options,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QYNRNDIY.cjs","../src/resources/invoiceSettings.ts"],"names":[],"mappings":"AAAA;ACkCO,IAAM,wBAAA,EAAN,MAA8B;AAAA,EACnC,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,QAAA,CAAS,OAAA,EAAmD;AAChE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,mBAAA,EAAqB,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAA,CAAO,QAAA,EAA2B,OAAA,EAAmD;AACzF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A,IAAA;AAC1E,EAAA;AAAA;AAAA;AAAA;AAAA;AAS4B,EAAA;AAC4D,IAAA;AACxF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU4B,EAAA;AACd,IAAA;AACV,MAAA;AAC2D,MAAA;AAC9C,MAAA;AACf,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY4B,EAAA;AACd,IAAA;AACV,MAAA;AAC2D,MAAA;AAChC,MAAA;AAC7B,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU4B,EAAA;AACd,IAAA;AACV,MAAA;AAC2D,MAAA;AAC9C,MAAA;AACf,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUqC,EAAA;AACiC,IAAA;AAC5D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AACF;AD9E2F;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-QYNRNDIY.cjs","sourcesContent":[null,"import type {\n EffectiveInvoiceSettings,\n InvoiceLogoRequest,\n InvoicePreviewRequest,\n InvoiceSettings,\n InvoiceTaxRuleEvaluateRequest,\n InvoiceTaxRuleEvaluation,\n InvoiceTaxRules,\n InvoiceTaxRulesRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/**\n * How the merchant's invoices look and are taxed: the merchant default, and\n * each shop's override of it.\n *\n * Every setting resolves shop → merchant default → built-in fallback, and\n * `retrieveEffective` shows the result for one shop with where each value came\n * from. The same two levels hold the tax rules: a shop either inherits the\n * merchant's list or has one of its own that replaces it.\n *\n * **The merchant-level methods need a merchant-level grant** (no shop role\n * holds one), so a shop user may style its own shop and give it tax rules of\n * its own but never change what every shop inherits. The `…ForShop` methods\n * need the `Invoice` area's grant on that shop.\n *\n * Exported as `InvoiceSettingsResource` so the class never shadows the\n * `InvoiceSettings` data type of the same package.\n *\n * An update **replaces every field but the logo**: read, change, and send the\n * whole object back. A field left out is cleared — on a shop that means\n * \"inherit\", on the merchant default \"use the built-in fallback\". The logo has\n * its own methods.\n */\nexport class InvoiceSettingsResource {\n constructor(private readonly request: RequestFn) {}\n\n // --- Settings -------------------------------------------------------------\n\n /**\n * The merchant default.\n * `GET /invoice-settings`\n */\n async retrieve(options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('GET', '/invoice-settings', { ...options });\n }\n\n /**\n * Replace the merchant default (every field but the logo).\n * `PUT /invoice-settings`\n */\n async update(settings: InvoiceSettings, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('PUT', '/invoice-settings', { body: settings, ...options });\n }\n\n /**\n * One shop's override. A `null` field inherits the merchant default.\n * `GET /invoice-settings/profiles/{profile_id}`\n */\n async retrieveForShop(profileId: string, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('GET', `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {\n ...options,\n });\n }\n\n /**\n * Replace one shop's override (every field but the logo).\n * `PUT /invoice-settings/profiles/{profile_id}`\n */\n async updateForShop(\n profileId: string,\n settings: InvoiceSettings,\n options?: RequestExtras,\n ): Promise<InvoiceSettings> {\n return this.request('PUT', `/invoice-settings/profiles/${encodeURIComponent(profileId)}`, {\n body: settings,\n ...options,\n });\n }\n\n /**\n * The settings a shop's next document is finalised with, and where each\n * value came from (`shop`, `merchant` or `default`).\n * `GET /invoice-settings/profiles/{profile_id}/effective`\n */\n async retrieveEffective(\n profileId: string,\n options?: RequestExtras,\n ): Promise<EffectiveInvoiceSettings> {\n return this.request(\n 'GET',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/effective`,\n { ...options },\n );\n }\n\n /**\n * A sample invoice PDF rendered from the effective settings with unsaved\n * values laid over them, so a form can show what saving would produce.\n * Writes nothing.\n * `POST /invoice-settings/preview`\n */\n async preview(params: InvoicePreviewRequest, options?: RequestExtras): Promise<Blob> {\n return this.request('POST', '/invoice-settings/preview', {\n body: params,\n responseType: 'blob',\n ...options,\n });\n }\n\n // --- Logo -----------------------------------------------------------------\n\n /**\n * The merchant default's logo image.\n * `GET /invoice-settings/logo`\n */\n async retrieveLogo(options?: RequestExtras): Promise<Blob> {\n return this.request('GET', '/invoice-settings/logo', { responseType: 'blob', ...options });\n }\n\n /**\n * Set the merchant default's logo: PNG or JPEG, at most 1 MB, as base64.\n * `PUT /invoice-settings/logo`\n */\n async updateLogo(params: InvoiceLogoRequest, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('PUT', '/invoice-settings/logo', { body: params, ...options });\n }\n\n /**\n * Remove the merchant default's logo.\n * `DELETE /invoice-settings/logo`\n */\n async deleteLogo(options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request('DELETE', '/invoice-settings/logo', { ...options });\n }\n\n /**\n * One shop's own logo image.\n * `GET /invoice-settings/profiles/{profile_id}/logo`\n */\n async retrieveLogoForShop(profileId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * Set one shop's own logo: PNG or JPEG, at most 1 MB, as base64.\n * `PUT /invoice-settings/profiles/{profile_id}/logo`\n */\n async updateLogoForShop(\n profileId: string,\n params: InvoiceLogoRequest,\n options?: RequestExtras,\n ): Promise<InvoiceSettings> {\n return this.request('PUT', `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Remove one shop's own logo; the shop then inherits the merchant default's.\n * `DELETE /invoice-settings/profiles/{profile_id}/logo`\n */\n async deleteLogoForShop(profileId: string, options?: RequestExtras): Promise<InvoiceSettings> {\n return this.request(\n 'DELETE',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/logo`,\n { ...options },\n );\n }\n\n // --- Tax rules ------------------------------------------------------------\n\n /**\n * The merchant's tax rules, which every shop without a list of its own uses.\n * `GET /invoice-settings/tax-rules`\n */\n async retrieveTaxRules(options?: RequestExtras): Promise<InvoiceTaxRules> {\n return this.request('GET', '/invoice-settings/tax-rules', { ...options });\n }\n\n /**\n * Replace the merchant's whole rule list; the order is the priority.\n * `PUT /invoice-settings/tax-rules`\n */\n async updateTaxRules(\n params: InvoiceTaxRulesRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request('PUT', '/invoice-settings/tax-rules', { body: params, ...options });\n }\n\n /**\n * The rules one shop uses: its own list, or the merchant's it inherits, as\n * `own_rules` says.\n * `GET /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async retrieveTaxRulesForShop(\n profileId: string,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'GET',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { ...options },\n );\n }\n\n /**\n * Give one shop a list of its own, replacing the merchant's for that shop —\n * even when empty, which leaves every line of the shop to the settings'\n * default rate.\n * `PUT /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async updateTaxRulesForShop(\n profileId: string,\n params: InvoiceTaxRulesRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'PUT',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { body: params, ...options },\n );\n }\n\n /**\n * Drop one shop's own list, so it inherits the merchant's again. Returns\n * the list the shop now uses.\n * `DELETE /invoice-settings/profiles/{profile_id}/tax-rules`\n */\n async deleteTaxRulesForShop(\n profileId: string,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRules> {\n return this.request(\n 'DELETE',\n `/invoice-settings/profiles/${encodeURIComponent(profileId)}/tax-rules`,\n { ...options },\n );\n }\n\n /**\n * Which saved rule a buyer and a product tax category would meet, and what\n * the line would be taxed at. Writes nothing.\n * `POST /invoice-settings/tax-rules/evaluate`\n */\n async evaluateTaxRules(\n params: InvoiceTaxRuleEvaluateRequest,\n options?: RequestExtras,\n ): Promise<InvoiceTaxRuleEvaluation> {\n return this.request('POST', '/invoice-settings/tax-rules/evaluate', {\n body: params,\n ...options,\n });\n }\n}\n"]}
@@ -5,6 +5,29 @@ var merchantBasePath = (merchantId) => `${BASE}/merchants/${encodeURIComponent(m
5
5
  var merchantFeePath = (merchantId, feeType) => `${merchantBasePath(merchantId)}/${encodeURIComponent(feeType)}`;
6
6
  var projectFeePath = (merchantId, projectId, feeType) => `${merchantBasePath(merchantId)}/projects/${encodeURIComponent(projectId)}/${encodeURIComponent(feeType)}`;
7
7
  var shopFeePath = (merchantId, profileId, feeType) => `${merchantBasePath(merchantId)}/shops/${encodeURIComponent(profileId)}/${encodeURIComponent(feeType)}`;
8
+ var UNICODE_EDGE_WHITESPACE = /^\p{White_Space}+|\p{White_Space}+$/gu;
9
+ function trimUnicodeWhitespace(value) {
10
+ return value.replace(UNICODE_EDGE_WHITESPACE, "");
11
+ }
12
+ function assertOptionalProviderSlug(provider) {
13
+ if (provider === void 0 || provider === null) {
14
+ return void 0;
15
+ }
16
+ const trimmed = trimUnicodeWhitespace(provider);
17
+ if (!trimmed) {
18
+ throw new TypeError(
19
+ "Provider slug cannot be empty or whitespace; omit provider (or pass null when saving) for a service-wide rule."
20
+ );
21
+ }
22
+ return trimmed;
23
+ }
24
+ function validateSaveRequest(params) {
25
+ if (params.provider === void 0 || params.provider === null) {
26
+ return params;
27
+ }
28
+ const provider = assertOptionalProviderSlug(params.provider);
29
+ return provider === params.provider ? params : { ...params, provider };
30
+ }
8
31
  function scopeCancelQuery(scope) {
9
32
  switch (scope.level) {
10
33
  case "brand_default":
@@ -38,7 +61,8 @@ var AdminPricing = class {
38
61
  return this.request("GET", BASE, {
39
62
  query: {
40
63
  merchant_id: _optionalChain([params, 'optionalAccess', _ => _.merchant_id]),
41
- fee_type: _optionalChain([params, 'optionalAccess', _2 => _2.fee_type])
64
+ fee_type: _optionalChain([params, 'optionalAccess', _2 => _2.fee_type]),
65
+ provider: _optionalChain([params, 'optionalAccess', _3 => _3.provider])
42
66
  }
43
67
  });
44
68
  }
@@ -49,42 +73,64 @@ var AdminPricing = class {
49
73
  merchant_id: params.merchant_id,
50
74
  project_id: params.project_id,
51
75
  profile_id: params.profile_id,
76
+ provider: params.provider,
52
77
  at: params.at
53
78
  }
54
79
  });
55
80
  }
56
- /** Save a brand default price. `PUT /admin-portal/pricing/brands/{brand}/{fee_type}` */
81
+ /** Save a brand default price (service-wide or for one provider). `PUT /admin-portal/pricing/brands/{brand}/{fee_type}` */
57
82
  async saveBrand(brand, feeType, params) {
58
- return this.request("PUT", brandPath(brand, feeType), { body: params });
83
+ return this.request("PUT", brandPath(brand, feeType), { body: validateSaveRequest(params) });
84
+ }
85
+ /** Remove a provider-specific brand default override. Service-wide brand defaults cannot be removed. `DELETE /admin-portal/pricing/brands/{brand}/{fee_type}` */
86
+ async removeBrand(brand, feeType, expectedRevision, provider) {
87
+ const trimmed = trimUnicodeWhitespace(provider);
88
+ if (!trimmed) {
89
+ throw new TypeError(
90
+ "Removing a brand pricing rule requires a provider slug; service-wide brand defaults cannot be removed."
91
+ );
92
+ }
93
+ return this.request("DELETE", brandPath(brand, feeType), {
94
+ query: { expected_revision: expectedRevision, provider: trimmed }
95
+ });
59
96
  }
60
97
  /** Save a merchant exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */
61
98
  async saveMerchant(merchantId, feeType, params) {
62
- return this.request("PUT", merchantFeePath(merchantId, feeType), { body: params });
99
+ return this.request("PUT", merchantFeePath(merchantId, feeType), {
100
+ body: validateSaveRequest(params)
101
+ });
63
102
  }
64
- /** Remove a merchant exception. `DELETE /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */
65
- async removeMerchant(merchantId, feeType, expectedRevision) {
103
+ /** Remove a merchant exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */
104
+ async removeMerchant(merchantId, feeType, expectedRevision, provider) {
105
+ const validatedProvider = assertOptionalProviderSlug(provider);
66
106
  return this.request("DELETE", merchantFeePath(merchantId, feeType), {
67
- query: { expected_revision: expectedRevision }
107
+ query: { expected_revision: expectedRevision, provider: validatedProvider }
68
108
  });
69
109
  }
70
110
  /** Save a project exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */
71
111
  async saveProject(merchantId, projectId, feeType, params) {
72
- return this.request("PUT", projectFeePath(merchantId, projectId, feeType), { body: params });
112
+ return this.request("PUT", projectFeePath(merchantId, projectId, feeType), {
113
+ body: validateSaveRequest(params)
114
+ });
73
115
  }
74
- /** Remove a project exception. `DELETE /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */
75
- async removeProject(merchantId, projectId, feeType, expectedRevision) {
116
+ /** Remove a project exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */
117
+ async removeProject(merchantId, projectId, feeType, expectedRevision, provider) {
118
+ const validatedProvider = assertOptionalProviderSlug(provider);
76
119
  return this.request("DELETE", projectFeePath(merchantId, projectId, feeType), {
77
- query: { expected_revision: expectedRevision }
120
+ query: { expected_revision: expectedRevision, provider: validatedProvider }
78
121
  });
79
122
  }
80
123
  /** Save a shop exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */
81
124
  async saveShop(merchantId, profileId, feeType, params) {
82
- return this.request("PUT", shopFeePath(merchantId, profileId, feeType), { body: params });
125
+ return this.request("PUT", shopFeePath(merchantId, profileId, feeType), {
126
+ body: validateSaveRequest(params)
127
+ });
83
128
  }
84
- /** Remove a shop exception. `DELETE /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */
85
- async removeShop(merchantId, profileId, feeType, expectedRevision) {
129
+ /** Remove a shop exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */
130
+ async removeShop(merchantId, profileId, feeType, expectedRevision, provider) {
131
+ const validatedProvider = assertOptionalProviderSlug(provider);
86
132
  return this.request("DELETE", shopFeePath(merchantId, profileId, feeType), {
87
- query: { expected_revision: expectedRevision }
133
+ query: { expected_revision: expectedRevision, provider: validatedProvider }
88
134
  });
89
135
  }
90
136
  /** Save a price at any scope in the hierarchy (brand default, merchant, project, or shop). */
@@ -112,34 +158,54 @@ var AdminPricing = class {
112
158
  return this.saveShop(scope.merchant_id, scope.profile_id, feeType, params);
113
159
  }
114
160
  }
115
- /** Remove an exception scope; brand defaults cannot be removed. */
116
- async remove(scope, feeType, expectedRevision) {
161
+ /** Remove an exception scope or a provider-specific brand override; service-wide brand defaults cannot be removed. */
162
+ async remove(scope, feeType, expectedRevision, provider) {
117
163
  switch (scope.level) {
118
164
  case "brand_default":
119
- throw new TypeError("A brand default price cannot be removed.");
165
+ if (!scope.brand) {
166
+ throw new TypeError("Brand default scope requires brand.");
167
+ }
168
+ if (!provider || !trimUnicodeWhitespace(provider)) {
169
+ throw new TypeError("A brand default price cannot be removed without a provider.");
170
+ }
171
+ return this.removeBrand(scope.brand, feeType, expectedRevision, provider);
120
172
  case "merchant":
121
173
  if (!scope.merchant_id) {
122
174
  throw new TypeError("Merchant scope requires merchant_id.");
123
175
  }
124
- return this.removeMerchant(scope.merchant_id, feeType, expectedRevision);
176
+ return this.removeMerchant(scope.merchant_id, feeType, expectedRevision, provider);
125
177
  case "project":
126
178
  if (!scope.merchant_id || !scope.project_id) {
127
179
  throw new TypeError("Project scope requires merchant_id and project_id.");
128
180
  }
129
- return this.removeProject(scope.merchant_id, scope.project_id, feeType, expectedRevision);
181
+ return this.removeProject(
182
+ scope.merchant_id,
183
+ scope.project_id,
184
+ feeType,
185
+ expectedRevision,
186
+ provider
187
+ );
130
188
  case "shop":
131
189
  if (!scope.merchant_id || !scope.profile_id) {
132
190
  throw new TypeError("Shop scope requires merchant_id and profile_id.");
133
191
  }
134
- return this.removeShop(scope.merchant_id, scope.profile_id, feeType, expectedRevision);
192
+ return this.removeShop(
193
+ scope.merchant_id,
194
+ scope.profile_id,
195
+ feeType,
196
+ expectedRevision,
197
+ provider
198
+ );
135
199
  }
136
200
  }
137
201
  /** Cancel a future scheduled version. `DELETE /admin-portal/pricing/versions/{version_id}` */
138
- async cancelVersion(versionId, feeType, scope, expectedRevision) {
202
+ async cancelVersion(versionId, feeType, scope, expectedRevision, provider) {
139
203
  const scopeQuery = scopeCancelQuery(scope);
204
+ const validatedProvider = assertOptionalProviderSlug(provider);
140
205
  return this.request("DELETE", `${BASE}/versions/${encodeURIComponent(versionId)}`, {
141
206
  query: {
142
207
  fee_type: feeType,
208
+ provider: validatedProvider,
143
209
  ...scopeQuery,
144
210
  expected_revision: expectedRevision
145
211
  }
@@ -155,9 +221,27 @@ var AdminPricing = class {
155
221
  body: { brand }
156
222
  });
157
223
  }
224
+ /** List recorded third-party service uses across merchants with separate provider cost and markup. `GET /admin-portal/pricing/service-usages` */
225
+ async listServiceUsages(params) {
226
+ return this.request("GET", `${BASE}/service-usages`, {
227
+ query: params
228
+ });
229
+ }
230
+ /** Dry-run calculate the provider cost, platform markup, and total charge for a third-party service use. `POST /admin-portal/pricing/service-usages/preview` */
231
+ async previewServiceUsage(params) {
232
+ return this.request("POST", `${BASE}/service-usages/preview`, {
233
+ body: params
234
+ });
235
+ }
236
+ /** Record and settle one third-party service use idempotently by `reference_id`. `POST /admin-portal/pricing/service-usages` */
237
+ async recordServiceUsage(params) {
238
+ return this.request("POST", `${BASE}/service-usages`, {
239
+ body: params
240
+ });
241
+ }
158
242
  };
159
243
 
160
244
 
161
245
 
162
246
  exports.AdminPricing = AdminPricing;
163
- //# sourceMappingURL=chunk-CYH4HZ4Y.cjs.map
247
+ //# sourceMappingURL=chunk-R2AKKQ35.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-R2AKKQ35.cjs","../src/internal/resources/adminPricing.ts"],"names":[],"mappings":"AAAA;ACoBA,IAAM,KAAA,EAAO,uBAAA;AACb,IAAM,UAAA,EAAY,CAAC,KAAA,EAAqB,OAAA,EAAA,GACtC,CAAA,EAAA;AACwB;AAEmB;AAED;A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AAA;AACP,IAAA;AACvB,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG8F,EAAA;AAC7D,IAAA;AACvB,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADnHqC;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-R2AKKQ35.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type {\n AdminServiceUsageListQuery,\n AdminServiceUsageListResponse,\n AdminServiceUsageRecord,\n EffectivePricingQuery,\n EffectivePricingResponse,\n MerchantPricingBrandResponse,\n PricingBrand,\n PricingFeeType,\n PricingOverview,\n PricingOverviewQuery,\n PricingSaveRequest,\n PricingScope,\n PricingScopeView,\n ServiceUsagePreviewRequest,\n ServiceUsagePreviewResponse,\n ServiceUsageRecordRequest,\n} from '../types';\n\nconst BASE = '/admin-portal/pricing';\nconst brandPath = (brand: PricingBrand, feeType: PricingFeeType): string =>\n `${BASE}/brands/${encodeURIComponent(brand)}/${encodeURIComponent(feeType)}`;\nconst merchantBasePath = (merchantId: string): string =>\n `${BASE}/merchants/${encodeURIComponent(merchantId)}`;\nconst merchantFeePath = (merchantId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/${encodeURIComponent(feeType)}`;\nconst projectFeePath = (merchantId: string, projectId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/projects/${encodeURIComponent(projectId)}/${encodeURIComponent(feeType)}`;\nconst shopFeePath = (merchantId: string, profileId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/shops/${encodeURIComponent(profileId)}/${encodeURIComponent(feeType)}`;\n\nconst UNICODE_EDGE_WHITESPACE = /^\\p{White_Space}+|\\p{White_Space}+$/gu;\n\nfunction trimUnicodeWhitespace(value: string): string {\n return value.replace(UNICODE_EDGE_WHITESPACE, '');\n}\n\nfunction assertOptionalProviderSlug(provider: string | null | undefined): string | undefined {\n if (provider === undefined || provider === null) {\n return undefined;\n }\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Provider slug cannot be empty or whitespace; omit provider (or pass null when saving) for a service-wide rule.',\n );\n }\n return trimmed;\n}\n\nfunction validateSaveRequest(params: PricingSaveRequest): PricingSaveRequest {\n if (params.provider === undefined || params.provider === null) {\n return params;\n }\n const provider = assertOptionalProviderSlug(params.provider);\n return provider === params.provider ? params : { ...params, provider };\n}\n\nfunction scopeCancelQuery(scope: PricingScope): Record<string, string> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return { brand: scope.brand };\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return { merchant_id: scope.merchant_id };\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return { merchant_id: scope.merchant_id, project_id: scope.project_id };\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return { merchant_id: scope.merchant_id, profile_id: scope.profile_id };\n }\n}\n\n/**\n * Unified platform pricing hierarchy across every fee type: brand default\n * (`delopay` / `spicepay`), merchant, project, and shop, plus the Effective\n * Price View showing where every price comes from.\n *\n * Every write carries the scope's optimistic `expected_revision` token; a write\n * against an older revision is refused with `412 Precondition Failed`.\n */\nexport class AdminPricing {\n constructor(private readonly request: RequestFn) {}\n\n /** Brand defaults, active/scheduled exceptions, and older setups. `GET /admin-portal/pricing` */\n async overview(params?: PricingOverviewQuery): Promise<PricingOverview> {\n return this.request('GET', BASE, {\n query: {\n merchant_id: params?.merchant_id,\n fee_type: params?.fee_type,\n provider: params?.provider,\n },\n });\n }\n\n /** Effective price view naming the exact source of every fee type. `GET /admin-portal/pricing/effective` */\n async effective(params: EffectivePricingQuery): Promise<EffectivePricingResponse> {\n return this.request('GET', `${BASE}/effective`, {\n query: {\n merchant_id: params.merchant_id,\n project_id: params.project_id,\n profile_id: params.profile_id,\n provider: params.provider,\n at: params.at,\n },\n });\n }\n\n /** Save a brand default price (service-wide or for one provider). `PUT /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async saveBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', brandPath(brand, feeType), { body: validateSaveRequest(params) });\n }\n\n /** Remove a provider-specific brand default override. Service-wide brand defaults cannot be removed. `DELETE /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async removeBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider: string,\n ): Promise<PricingScopeView> {\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Removing a brand pricing rule requires a provider slug; service-wide brand defaults cannot be removed.',\n );\n }\n return this.request('DELETE', brandPath(brand, feeType), {\n query: { expected_revision: expectedRevision, provider: trimmed },\n });\n }\n\n /** Save a merchant exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async saveMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', merchantFeePath(merchantId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a merchant exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async removeMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', merchantFeePath(merchantId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a project exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async saveProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', projectFeePath(merchantId, projectId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a project exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async removeProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', projectFeePath(merchantId, projectId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a shop exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async saveShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', shopFeePath(merchantId, profileId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a shop exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async removeShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', shopFeePath(merchantId, profileId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a price at any scope in the hierarchy (brand default, merchant, project, or shop). */\n async save(\n scope: PricingScope,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return this.saveBrand(scope.brand, feeType, params);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.saveMerchant(scope.merchant_id, feeType, params);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.saveProject(scope.merchant_id, scope.project_id, feeType, params);\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.saveShop(scope.merchant_id, scope.profile_id, feeType, params);\n }\n }\n\n /** Remove an exception scope or a provider-specific brand override; service-wide brand defaults cannot be removed. */\n async remove(\n scope: PricingScope,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n if (!provider || !trimUnicodeWhitespace(provider)) {\n throw new TypeError('A brand default price cannot be removed without a provider.');\n }\n return this.removeBrand(scope.brand, feeType, expectedRevision, provider);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.removeMerchant(scope.merchant_id, feeType, expectedRevision, provider);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.removeProject(\n scope.merchant_id,\n scope.project_id,\n feeType,\n expectedRevision,\n provider,\n );\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.removeShop(\n scope.merchant_id,\n scope.profile_id,\n feeType,\n expectedRevision,\n provider,\n );\n }\n }\n\n /** Cancel a future scheduled version. `DELETE /admin-portal/pricing/versions/{version_id}` */\n async cancelVersion(\n versionId: string,\n feeType: PricingFeeType,\n scope: PricingScope,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const scopeQuery = scopeCancelQuery(scope);\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', `${BASE}/versions/${encodeURIComponent(versionId)}`, {\n query: {\n fee_type: feeType,\n provider: validatedProvider,\n ...scopeQuery,\n expected_revision: expectedRevision,\n },\n });\n }\n\n /** Read a merchant's effective and explicit pricing brand. `GET /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async getMerchantBrand(merchantId: string): Promise<MerchantPricingBrandResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/brand`);\n }\n\n /** Assign a merchant's pricing brand (`'delopay'` / `'spicepay'`), or `null` to inherit the deployment brand. `PUT /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async setMerchantBrand(\n merchantId: string,\n brand: PricingBrand | null,\n ): Promise<MerchantPricingBrandResponse> {\n return this.request('PUT', `${merchantBasePath(merchantId)}/brand`, {\n body: { brand },\n });\n }\n\n /** List recorded third-party service uses across merchants with separate provider cost and markup. `GET /admin-portal/pricing/service-usages` */\n async listServiceUsages(\n params?: AdminServiceUsageListQuery,\n ): Promise<AdminServiceUsageListResponse> {\n return this.request('GET', `${BASE}/service-usages`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the provider cost, platform markup, and total charge for a third-party service use. `POST /admin-portal/pricing/service-usages/preview` */\n async previewServiceUsage(\n params: ServiceUsagePreviewRequest,\n ): Promise<ServiceUsagePreviewResponse> {\n return this.request('POST', `${BASE}/service-usages/preview`, {\n body: params,\n });\n }\n\n /** Record and settle one third-party service use idempotently by `reference_id`. `POST /admin-portal/pricing/service-usages` */\n async recordServiceUsage(params: ServiceUsageRecordRequest): Promise<AdminServiceUsageRecord> {\n return this.request('POST', `${BASE}/service-usages`, {\n body: params,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-R4GA6BVP.cjs","../src/internal/resources/auditLogs.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACUO,IAAM,UAAA,EAAN,MAAgB;AAAA,EACrB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,IAAA,CAAK,MAAA,EAA4D;AACrE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,qBAAA,EAAuB;AAAA,MAChD,KAAA,EAAO,wCAAA,MAAS,EAAQ,CAAC,QAAA,EAAU,aAAa,CAAC;AAAA,IACnD,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAM,QAAA,CAAS,KAAA,EAA0C;AACvD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,oBAAA,EAAuB,kBAAA,CAAmB,KAAK,CAAC,CAAA,CAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYqF,EAAA;AACvE,IAAA;AACV,MAAA;AACwD,MAAA;AAC1D,IAAA;AACF,EAAA;AA6B6D,EAAA;AACpD,IAAA;AACA,MAAA;AACL,MAAA;AACA,MAAA;AAAA;AAAA;AAAA;AAIqD,MAAA;AACrD,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADrCgF;AACA;AACA;AACA","file":"/tmp/sdkpub/delopay-typescript-sdk/dist/chunk-R4GA6BVP.cjs","sourcesContent":[null,"import type {\n AuditLogListParams,\n AuditLogListResponse,\n AuditLogResponse,\n ShopCheckoutStateListResponse,\n} from '../types';\nimport type { AdminAuditLogExportRecord } from '../types';\nimport type {\n BinaryExportOptions,\n ExportEnvelope,\n ExportOptions,\n JsonExportOptions,\n} from '../../types';\nimport type { RequestFn } from '../../client';\nimport { runExport } from '../../exportDownload';\nimport { csvQuery } from '../../listQuery';\n\nexport class AuditLogs {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * One page of the platform audit log, the newest entry first unless\n * `sort_by` says otherwise. Several `action` or `entity_type` values match\n * an entry with any of them.\n */\n async list(params?: AuditLogListParams): Promise<AuditLogListResponse> {\n return this.request('GET', '/admin-portal/audit', {\n query: csvQuery(params, ['action', 'entity_type']),\n });\n }\n\n async retrieve(logId: string): Promise<AuditLogResponse> {\n return this.request('GET', `/admin-portal/audit/${encodeURIComponent(logId)}`);\n }\n\n /**\n * What each shop of a merchant can take at its Live and its Test checkout\n * now. `GET /admin-portal/accounts/{merchant_id}/checkout-state`\n *\n * Every shop of the merchant is listed, with the number of accounts that\n * can take a payment at each checkout. For an account a checkout does not\n * use, `blocks` names who hid it or switched it off in the shop and why;\n * `idle_accounts` names the accounts that take no payments for a reason of\n * their own, such as missing credentials for that environment.\n */\n async shopCheckoutStates(merchantId: string): Promise<ShopCheckoutStateListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/checkout-state`,\n );\n }\n\n /**\n * The platform audit log as a file. `GET /admin-portal/audit/export`\n *\n * Takes the same filters as {@link AuditLogs.list}, and returns the whole\n * match set rather than a page — bounded at 25,000 rows (500 for `pdf`), and\n * refused past that with `DE_07` rather than truncated. `csv` and `json` are\n * streamed and held to their `X-Delopay-Record-Count`; see\n * {@link ExportTransferOptions} for progress, cancellation and the\n * `EXPORT_INCOMPLETE` check.\n *\n * Columns answer the question an audit asks rather than mirroring the\n * dashboard table: the actor, the real actor behind an impersonation, the\n * action, its target, when, and from where. `details` is deliberately absent —\n * an unbounded per-action blob is unreadable in a spreadsheet cell.\n */\n async export(\n params?: AuditLogListParams,\n options?: JsonExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord>>;\n async export(params: AuditLogListParams | undefined, options: BinaryExportOptions): Promise<Blob>;\n async export(\n params: AuditLogListParams | undefined,\n options: ExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord> | Blob>;\n async export(\n params?: AuditLogListParams,\n options?: ExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord> | Blob> {\n return runExport(\n this.request,\n 'GET',\n '/admin-portal/audit/export',\n // The format is negotiated by `Accept`, never a query field: the query\n // here is the list's own filter model, and adding a key to it would fork\n // the filter vocabulary the export exists to reuse.\n { query: csvQuery(params, ['action', 'entity_type']) },\n options,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-R4GA6BVP.cjs","../src/internal/resources/auditLogs.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACUO,IAAM,UAAA,EAAN,MAAgB;AAAA,EACrB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,IAAA,CAAK,MAAA,EAA4D;AACrE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,qBAAA,EAAuB;AAAA,MAChD,KAAA,EAAO,wCAAA,MAAS,EAAQ,CAAC,QAAA,EAAU,aAAa,CAAC;AAAA,IACnD,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAM,QAAA,CAAS,KAAA,EAA0C;AACvD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,oBAAA,EAAuB,kBAAA,CAAmB,KAAK,CAAC,CAAA,CAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYqF,EAAA;AACvE,IAAA;AACV,MAAA;AACwD,MAAA;AAC1D,IAAA;AACF,EAAA;AA6B6D,EAAA;AACpD,IAAA;AACA,MAAA;AACL,MAAA;AACA,MAAA;AAAA;AAAA;AAAA;AAIqD,MAAA;AACrD,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADrCgF;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-R4GA6BVP.cjs","sourcesContent":[null,"import type {\n AuditLogListParams,\n AuditLogListResponse,\n AuditLogResponse,\n ShopCheckoutStateListResponse,\n} from '../types';\nimport type { AdminAuditLogExportRecord } from '../types';\nimport type {\n BinaryExportOptions,\n ExportEnvelope,\n ExportOptions,\n JsonExportOptions,\n} from '../../types';\nimport type { RequestFn } from '../../client';\nimport { runExport } from '../../exportDownload';\nimport { csvQuery } from '../../listQuery';\n\nexport class AuditLogs {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * One page of the platform audit log, the newest entry first unless\n * `sort_by` says otherwise. Several `action` or `entity_type` values match\n * an entry with any of them.\n */\n async list(params?: AuditLogListParams): Promise<AuditLogListResponse> {\n return this.request('GET', '/admin-portal/audit', {\n query: csvQuery(params, ['action', 'entity_type']),\n });\n }\n\n async retrieve(logId: string): Promise<AuditLogResponse> {\n return this.request('GET', `/admin-portal/audit/${encodeURIComponent(logId)}`);\n }\n\n /**\n * What each shop of a merchant can take at its Live and its Test checkout\n * now. `GET /admin-portal/accounts/{merchant_id}/checkout-state`\n *\n * Every shop of the merchant is listed, with the number of accounts that\n * can take a payment at each checkout. For an account a checkout does not\n * use, `blocks` names who hid it or switched it off in the shop and why;\n * `idle_accounts` names the accounts that take no payments for a reason of\n * their own, such as missing credentials for that environment.\n */\n async shopCheckoutStates(merchantId: string): Promise<ShopCheckoutStateListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/checkout-state`,\n );\n }\n\n /**\n * The platform audit log as a file. `GET /admin-portal/audit/export`\n *\n * Takes the same filters as {@link AuditLogs.list}, and returns the whole\n * match set rather than a page — bounded at 25,000 rows (500 for `pdf`), and\n * refused past that with `DE_07` rather than truncated. `csv` and `json` are\n * streamed and held to their `X-Delopay-Record-Count`; see\n * {@link ExportTransferOptions} for progress, cancellation and the\n * `EXPORT_INCOMPLETE` check.\n *\n * Columns answer the question an audit asks rather than mirroring the\n * dashboard table: the actor, the real actor behind an impersonation, the\n * action, its target, when, and from where. `details` is deliberately absent —\n * an unbounded per-action blob is unreadable in a spreadsheet cell.\n */\n async export(\n params?: AuditLogListParams,\n options?: JsonExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord>>;\n async export(params: AuditLogListParams | undefined, options: BinaryExportOptions): Promise<Blob>;\n async export(\n params: AuditLogListParams | undefined,\n options: ExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord> | Blob>;\n async export(\n params?: AuditLogListParams,\n options?: ExportOptions,\n ): Promise<ExportEnvelope<AdminAuditLogExportRecord> | Blob> {\n return runExport(\n this.request,\n 'GET',\n '/admin-portal/audit/export',\n // The format is negotiated by `Accept`, never a query field: the query\n // here is the list's own filter model, and adding a key to it would fork\n // the filter vocabulary the export exists to reuse.\n { query: csvQuery(params, ['action', 'entity_type']) },\n options,\n );\n }\n}\n"]}