@delopay/sdk 0.497.0 → 0.501.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.
- package/dist/airwallexCard.cjs.map +1 -1
- package/dist/branding.cjs.map +1 -1
- package/dist/cardFormStyles.cjs.map +1 -1
- package/dist/checkoutSession.cjs +2 -2
- package/dist/checkoutSession.cjs.map +1 -1
- package/dist/checkoutSession.js +1 -1
- package/dist/chunk-244VZFFO.cjs.map +1 -1
- package/dist/chunk-2IJRBJXW.cjs.map +1 -1
- package/dist/{chunk-I5KOMBQ3.js → chunk-2OJJ3KGP.js} +25 -1
- package/dist/chunk-2OJJ3KGP.js.map +1 -0
- package/dist/chunk-34PC72O7.cjs.map +1 -1
- package/dist/chunk-3GBWQWTP.cjs.map +1 -1
- package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
- package/dist/chunk-44QBWVRS.cjs.map +1 -1
- package/dist/chunk-4EKAWNYI.cjs.map +1 -1
- package/dist/chunk-4LN4BR2T.cjs.map +1 -1
- package/dist/chunk-4T4XHPYN.cjs.map +1 -1
- package/dist/{chunk-2NVGA4G5.cjs → chunk-575SNLIT.cjs} +35 -1
- package/dist/chunk-575SNLIT.cjs.map +1 -0
- package/dist/chunk-5CITBN33.cjs.map +1 -1
- package/dist/chunk-5HCKC4HF.cjs.map +1 -1
- package/dist/chunk-5O2JSQYA.cjs.map +1 -1
- package/dist/chunk-5QS67SBO.cjs.map +1 -1
- package/dist/chunk-6EBY2KKL.cjs.map +1 -1
- package/dist/chunk-6LFOM6HV.cjs.map +1 -1
- package/dist/chunk-6LOWE2YI.cjs.map +1 -1
- package/dist/chunk-6LSG5Z4T.cjs.map +1 -1
- package/dist/chunk-6SU2MTN2.cjs.map +1 -1
- package/dist/chunk-6YCDLSIU.cjs.map +1 -1
- package/dist/chunk-75E5WNJG.cjs.map +1 -1
- package/dist/chunk-7JV6VVO7.cjs.map +1 -1
- package/dist/chunk-7NKJD5ST.cjs.map +1 -1
- package/dist/chunk-7QZCUXWB.cjs.map +1 -1
- package/dist/chunk-7VXF5D67.cjs.map +1 -1
- package/dist/chunk-ABWAYMN5.cjs.map +1 -1
- package/dist/chunk-ACZ2R47X.cjs.map +1 -1
- package/dist/chunk-AYUYJO3I.cjs.map +1 -1
- package/dist/chunk-BCA3TCGS.cjs.map +1 -1
- package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
- package/dist/chunk-BRY3W7N3.cjs.map +1 -1
- package/dist/chunk-BT3UAUEV.cjs.map +1 -1
- package/dist/chunk-CCN44NZJ.cjs.map +1 -1
- package/dist/chunk-CR3JBTP3.cjs.map +1 -1
- package/dist/chunk-DJASVBOJ.cjs.map +1 -1
- package/dist/chunk-EEB2HDYL.cjs.map +1 -1
- package/dist/chunk-ENPSUWTS.cjs.map +1 -1
- package/dist/chunk-EQ6P6ZND.cjs.map +1 -1
- package/dist/chunk-EXPWQBI3.cjs.map +1 -1
- package/dist/chunk-EYHSXJMJ.cjs.map +1 -1
- package/dist/chunk-F3I5DOWV.cjs.map +1 -1
- package/dist/chunk-F46K5H3U.cjs.map +1 -1
- package/dist/chunk-F6QJB4XP.cjs.map +1 -1
- package/dist/chunk-F6S3WCCB.cjs.map +1 -1
- package/dist/chunk-FQRC4NJG.cjs.map +1 -1
- package/dist/chunk-FTWGI7UZ.cjs.map +1 -1
- package/dist/chunk-FYISDU2Y.cjs.map +1 -1
- package/dist/chunk-GG52SAHA.cjs.map +1 -1
- package/dist/chunk-GK5FWN4H.cjs.map +1 -1
- package/dist/chunk-GSQN5EOO.cjs.map +1 -1
- package/dist/chunk-GW7IHYXR.cjs.map +1 -1
- package/dist/chunk-GWSVQXEY.cjs.map +1 -1
- package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
- package/dist/chunk-HLYGHP6F.cjs.map +1 -1
- package/dist/chunk-HSJABE7X.cjs.map +1 -1
- package/dist/chunk-I2W7AO4B.cjs.map +1 -1
- package/dist/chunk-I2XGNALG.cjs.map +1 -1
- package/dist/{chunk-K3XXGAOR.cjs → chunk-IDY2LP4Q.cjs} +3 -3
- package/dist/chunk-IDY2LP4Q.cjs.map +1 -0
- package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
- package/dist/{chunk-7H2VFIPS.js → chunk-IPN7D5PP.js} +4 -4
- package/dist/chunk-IR2LFKKA.cjs.map +1 -1
- package/dist/{chunk-ZMJT2YPZ.cjs → chunk-IUXCU3DW.cjs} +7 -7
- package/dist/chunk-IUXCU3DW.cjs.map +1 -0
- package/dist/chunk-J4ZB7MU4.cjs.map +1 -1
- package/dist/chunk-J5RPSRBQ.cjs.map +1 -1
- package/dist/chunk-JPPRDMTJ.cjs.map +1 -1
- package/dist/chunk-K5Q2H3VD.cjs.map +1 -1
- package/dist/chunk-KD5Y2YWK.cjs.map +1 -1
- package/dist/chunk-KJDMNF2T.cjs.map +1 -1
- package/dist/chunk-KLONGJCL.cjs.map +1 -1
- package/dist/chunk-LJ2EG6JK.cjs.map +1 -1
- package/dist/chunk-LLYY4TCZ.cjs.map +1 -1
- package/dist/chunk-LYIBTVK6.cjs.map +1 -1
- package/dist/chunk-M3HWE7KT.cjs.map +1 -1
- package/dist/chunk-M3SJHFT4.cjs.map +1 -1
- package/dist/chunk-MLG6NXI6.cjs.map +1 -1
- package/dist/chunk-MYAXAWBQ.cjs.map +1 -1
- package/dist/chunk-NFB3S2E6.cjs.map +1 -1
- package/dist/chunk-NULOAF7W.cjs.map +1 -1
- package/dist/chunk-NX36HDXE.cjs.map +1 -1
- package/dist/chunk-NYL3BNHR.cjs.map +1 -1
- package/dist/chunk-O4AYHLQX.cjs.map +1 -1
- package/dist/{chunk-YFRAI34Y.cjs → chunk-O53VOQK7.cjs} +67 -1
- package/dist/chunk-O53VOQK7.cjs.map +1 -0
- package/dist/chunk-OAEKP665.cjs.map +1 -1
- package/dist/chunk-ODPNVNYE.cjs.map +1 -1
- package/dist/chunk-OG2KJAYD.cjs.map +1 -1
- package/dist/chunk-OYZP6NF6.cjs.map +1 -1
- package/dist/chunk-P4UILJVU.cjs.map +1 -1
- package/dist/chunk-P7DYLUUI.cjs.map +1 -1
- package/dist/chunk-PKAE6AQT.cjs.map +1 -1
- package/dist/{chunk-F6LZ2YNM.js → chunk-Q5S7YKB3.js} +35 -1
- package/dist/chunk-Q5S7YKB3.js.map +1 -0
- package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
- package/dist/chunk-QKUWFMZP.cjs.map +1 -1
- package/dist/chunk-QRSA72B3.cjs.map +1 -1
- package/dist/chunk-QYNRNDIY.cjs.map +1 -1
- package/dist/chunk-R4GA6BVP.cjs.map +1 -1
- package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
- package/dist/chunk-RHFUXHQN.cjs.map +1 -1
- package/dist/{chunk-CAMALM35.cjs → chunk-RHT27R27.cjs} +25 -1
- package/dist/chunk-RHT27R27.cjs.map +1 -0
- package/dist/chunk-RI42IDRR.cjs.map +1 -1
- package/dist/chunk-S77LQWYC.cjs.map +1 -1
- package/dist/chunk-S7SBNOGS.cjs.map +1 -1
- package/dist/{chunk-CQQW5JU7.js → chunk-SAXTZZQL.js} +2 -2
- package/dist/{chunk-OEREK6NU.js → chunk-TDCB2FQI.js} +67 -1
- package/dist/chunk-TDCB2FQI.js.map +1 -0
- package/dist/chunk-TMAJE5P2.cjs.map +1 -1
- package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
- package/dist/chunk-U3JK7NBG.cjs.map +1 -1
- package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
- package/dist/chunk-UKLZAOLW.cjs.map +1 -1
- package/dist/chunk-UTCXNBID.cjs.map +1 -1
- package/dist/chunk-V47G7P6L.cjs.map +1 -1
- package/dist/chunk-VH5A6SMU.cjs.map +1 -1
- package/dist/chunk-VHMH4QMY.cjs.map +1 -1
- package/dist/chunk-VYC7WUM5.cjs.map +1 -1
- package/dist/chunk-W457XUA6.cjs.map +1 -1
- package/dist/{chunk-DDXERBGG.js → chunk-W7KJTMAF.js} +12 -1
- package/dist/chunk-W7KJTMAF.js.map +1 -0
- package/dist/chunk-WHDI3TMP.cjs.map +1 -1
- package/dist/chunk-WITCPKNL.cjs.map +1 -1
- package/dist/chunk-WX6NP7UU.cjs.map +1 -1
- package/dist/chunk-XQLRIBVR.cjs.map +1 -1
- package/dist/chunk-Y7LSSRNJ.cjs.map +1 -1
- package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
- package/dist/chunk-YW4DVKNT.cjs.map +1 -1
- package/dist/{chunk-PYNHK6AP.cjs → chunk-Z7AVB6VI.cjs} +12 -1
- package/dist/chunk-Z7AVB6VI.cjs.map +1 -0
- package/dist/chunk-ZGMIHHGL.cjs.map +1 -1
- package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
- package/dist/chunk-ZUULK36E.cjs.map +1 -1
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/currencies.cjs.map +1 -1
- package/dist/enigmaCardForm.cjs.map +1 -1
- package/dist/error.cjs.map +1 -1
- package/dist/eventStream.cjs.map +1 -1
- package/dist/exportDownload.cjs.map +1 -1
- package/dist/feeProgram.cjs.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/internal/resources/admin.cjs.map +1 -1
- package/dist/internal/resources/admin.d.cts +1 -1
- package/dist/internal/resources/admin.d.ts +1 -1
- package/dist/internal/resources/adminBranding.cjs.map +1 -1
- package/dist/internal/resources/adminBranding.d.cts +1 -1
- package/dist/internal/resources/adminBranding.d.ts +1 -1
- package/dist/internal/resources/adminCheckoutDomains.cjs.map +1 -1
- package/dist/internal/resources/adminCheckoutDomains.d.cts +1 -1
- package/dist/internal/resources/adminCheckoutDomains.d.ts +1 -1
- package/dist/internal/resources/adminFeePlans.cjs.map +1 -1
- package/dist/internal/resources/adminFeePlans.d.cts +1 -1
- package/dist/internal/resources/adminFeePlans.d.ts +1 -1
- package/dist/internal/resources/adminFileScans.cjs.map +1 -1
- package/dist/internal/resources/adminFileScans.d.cts +1 -1
- package/dist/internal/resources/adminFileScans.d.ts +1 -1
- package/dist/internal/resources/adminIndustries.cjs.map +1 -1
- package/dist/internal/resources/adminIndustries.d.cts +1 -1
- package/dist/internal/resources/adminIndustries.d.ts +1 -1
- package/dist/internal/resources/adminLive.cjs.map +1 -1
- package/dist/internal/resources/adminNotices.cjs.map +1 -1
- package/dist/internal/resources/adminNotices.d.cts +1 -1
- package/dist/internal/resources/adminNotices.d.ts +1 -1
- package/dist/internal/resources/adminPortal.cjs.map +1 -1
- package/dist/internal/resources/adminPortal.d.cts +1 -1
- package/dist/internal/resources/adminPortal.d.ts +1 -1
- package/dist/internal/resources/adminPricing.cjs +2 -2
- package/dist/internal/resources/adminPricing.cjs.map +1 -1
- package/dist/internal/resources/adminPricing.d.cts +19 -1
- package/dist/internal/resources/adminPricing.d.ts +19 -1
- package/dist/internal/resources/adminPricing.js +1 -1
- package/dist/internal/resources/adminSupport.cjs.map +1 -1
- package/dist/internal/resources/adminSupport.d.cts +1 -1
- package/dist/internal/resources/adminSupport.d.ts +1 -1
- package/dist/internal/resources/auditLogs.cjs.map +1 -1
- package/dist/internal/resources/auditLogs.d.cts +1 -1
- package/dist/internal/resources/auditLogs.d.ts +1 -1
- package/dist/internal/resources/cache.cjs.map +1 -1
- package/dist/internal/resources/cardIssuers.cjs.map +1 -1
- package/dist/internal/resources/cardIssuers.d.cts +1 -1
- package/dist/internal/resources/cardIssuers.d.ts +1 -1
- package/dist/internal/resources/configs.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictionRules.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictionRules.d.cts +1 -1
- package/dist/internal/resources/connectorRestrictionRules.d.ts +1 -1
- package/dist/internal/resources/connectorRestrictions.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictions.d.cts +1 -1
- package/dist/internal/resources/connectorRestrictions.d.ts +1 -1
- package/dist/internal/resources/diagnostic.cjs.map +1 -1
- package/dist/internal/resources/diagnostic.d.cts +1 -1
- package/dist/internal/resources/diagnostic.d.ts +1 -1
- package/dist/internal/resources/gsm.cjs.map +1 -1
- package/dist/internal/resources/gsm.d.cts +1 -1
- package/dist/internal/resources/gsm.d.ts +1 -1
- package/dist/internal/resources/nativeRenewals.cjs.map +1 -1
- package/dist/internal/resources/nativeRenewals.d.cts +1 -1
- package/dist/internal/resources/nativeRenewals.d.ts +1 -1
- package/dist/internal/resources/platformBilling.cjs.map +1 -1
- package/dist/internal/resources/platformBilling.d.cts +1 -1
- package/dist/internal/resources/platformBilling.d.ts +1 -1
- package/dist/internal/resources/platformFees.cjs.map +1 -1
- package/dist/internal/resources/platformMessageTemplates.cjs.map +1 -1
- package/dist/internal/resources/platformSettings.cjs.map +1 -1
- package/dist/internal/resources/platformSettings.d.cts +1 -1
- package/dist/internal/resources/platformSettings.d.ts +1 -1
- package/dist/internal.cjs +9 -9
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +6 -6
- package/dist/listQuery.cjs.map +1 -1
- package/dist/panes.cjs.map +1 -1
- package/dist/paymentPresentation.cjs.map +1 -1
- package/dist/recordCounter.cjs.map +1 -1
- package/dist/resources/aiTools.cjs.map +1 -1
- package/dist/resources/analytics.cjs.map +1 -1
- package/dist/resources/analyticsDashboard.cjs.map +1 -1
- package/dist/resources/apiKeys.cjs.map +1 -1
- package/dist/resources/audit.cjs.map +1 -1
- package/dist/resources/authentication.cjs.map +1 -1
- package/dist/resources/availabilityOverrides.cjs.map +1 -1
- package/dist/resources/billing.cjs.map +1 -1
- package/dist/resources/buyerAccount.cjs.map +1 -1
- package/dist/resources/buyerBlocklist.cjs.map +1 -1
- package/dist/resources/buyerConversations.cjs.map +1 -1
- package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
- package/dist/resources/buyerPortal.cjs +2 -2
- package/dist/resources/buyerPortal.cjs.map +1 -1
- package/dist/resources/buyerPortal.d.cts +7 -1
- package/dist/resources/buyerPortal.d.ts +7 -1
- package/dist/resources/buyerPortal.js +1 -1
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/chargebackPrevention.cjs.map +1 -1
- package/dist/resources/checkoutDomains.cjs.map +1 -1
- package/dist/resources/checkoutMethods.cjs.map +1 -1
- package/dist/resources/checkoutRecovery.cjs.map +1 -1
- package/dist/resources/checkoutTemplates.cjs.map +1 -1
- package/dist/resources/connectors.cjs.map +1 -1
- package/dist/resources/contentEncryption.cjs.map +1 -1
- package/dist/resources/costRules.cjs.map +1 -1
- package/dist/resources/customers.cjs.map +1 -1
- package/dist/resources/deploymentBranding.cjs.map +1 -1
- package/dist/resources/disputes.cjs.map +1 -1
- package/dist/resources/ephemeralKeys.cjs.map +1 -1
- package/dist/resources/events.cjs.map +1 -1
- package/dist/resources/export.cjs.map +1 -1
- package/dist/resources/externalRecords.cjs.map +1 -1
- package/dist/resources/featureMatrix.cjs.map +1 -1
- package/dist/resources/fees.cjs.map +1 -1
- package/dist/resources/files.cjs.map +1 -1
- package/dist/resources/forex.cjs.map +1 -1
- package/dist/resources/identityVerifications.cjs.map +1 -1
- package/dist/resources/industries.cjs.map +1 -1
- package/dist/resources/invoiceSettings.cjs.map +1 -1
- package/dist/resources/invoices.cjs.map +1 -1
- package/dist/resources/live.cjs.map +1 -1
- package/dist/resources/mandates.cjs.map +1 -1
- package/dist/resources/merchantAccounts.cjs.map +1 -1
- package/dist/resources/messageTemplates.cjs.map +1 -1
- package/dist/resources/notices.cjs.map +1 -1
- package/dist/resources/operationLimits.cjs.map +1 -1
- package/dist/resources/paymentLinks.cjs.map +1 -1
- package/dist/resources/paymentMethods.cjs.map +1 -1
- package/dist/resources/payments.cjs.map +1 -1
- package/dist/resources/payoutDestinations.cjs.map +1 -1
- package/dist/resources/payouts.cjs.map +1 -1
- package/dist/resources/paypalDisputes.cjs.map +1 -1
- package/dist/resources/persons.cjs.map +1 -1
- package/dist/resources/poll.cjs.map +1 -1
- package/dist/resources/processorCosts.cjs.map +1 -1
- package/dist/resources/processorImports.cjs.map +1 -1
- package/dist/resources/products.cjs.map +1 -1
- package/dist/resources/profileAcquirers.cjs.map +1 -1
- package/dist/resources/profiles.cjs.map +1 -1
- package/dist/resources/projects.cjs.map +1 -1
- package/dist/resources/refunds.cjs.map +1 -1
- package/dist/resources/regions.cjs.map +1 -1
- package/dist/resources/relay.cjs.map +1 -1
- package/dist/resources/risk.cjs.map +1 -1
- package/dist/resources/routing.cjs.map +1 -1
- package/dist/resources/search.cjs.map +1 -1
- package/dist/resources/sellToRestrictions.cjs.map +1 -1
- package/dist/resources/settings.cjs.map +1 -1
- package/dist/resources/settlement.cjs.map +1 -1
- package/dist/resources/shareLinks.cjs.map +1 -1
- package/dist/resources/shopLabels.cjs.map +1 -1
- package/dist/resources/shopify.cjs +2 -2
- package/dist/resources/shopify.cjs.map +1 -1
- package/dist/resources/shopify.d.cts +41 -4
- package/dist/resources/shopify.d.ts +41 -4
- package/dist/resources/shopify.js +1 -1
- package/dist/resources/shops.cjs.map +1 -1
- package/dist/resources/stripeConnect.cjs.map +1 -1
- package/dist/resources/subscriptions.cjs +2 -2
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/subscriptions.d.cts +6 -1
- package/dist/resources/subscriptions.d.ts +6 -1
- package/dist/resources/subscriptions.js +1 -1
- package/dist/resources/support.cjs.map +1 -1
- package/dist/resources/threeDsRules.cjs.map +1 -1
- package/dist/resources/users.cjs.map +1 -1
- package/dist/resources/vatRates.cjs.map +1 -1
- package/dist/resources/verification.cjs.map +1 -1
- package/dist/resources/webhooks.cjs.map +1 -1
- package/dist/resources/whopResolutionCases.cjs.map +1 -1
- package/dist/trustedOrigins.cjs.map +1 -1
- package/dist/{types-D_Y2A9ny.d.cts → types-FHqOLCyI.d.cts} +181 -1
- package/dist/{types-BxgOWS55.d.ts → types-SEJjet2B.d.ts} +181 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +282 -6
- package/dist/types.d.ts +282 -6
- package/package.json +1 -1
- package/dist/chunk-2NVGA4G5.cjs.map +0 -1
- package/dist/chunk-CAMALM35.cjs.map +0 -1
- package/dist/chunk-DDXERBGG.js.map +0 -1
- package/dist/chunk-F6LZ2YNM.js.map +0 -1
- package/dist/chunk-I5KOMBQ3.js.map +0 -1
- package/dist/chunk-K3XXGAOR.cjs.map +0 -1
- package/dist/chunk-OEREK6NU.js.map +0 -1
- package/dist/chunk-PYNHK6AP.cjs.map +0 -1
- package/dist/chunk-YFRAI34Y.cjs.map +0 -1
- package/dist/chunk-ZMJT2YPZ.cjs.map +0 -1
- /package/dist/{chunk-7H2VFIPS.js.map → chunk-IPN7D5PP.js.map} +0 -0
- /package/dist/{chunk-CQQW5JU7.js.map → chunk-SAXTZZQL.js.map} +0 -0
|
@@ -290,9 +290,43 @@ var AdminPricing = class {
|
|
|
290
290
|
query: params
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Read the platform margin report comparing provider cost, amount charged,
|
|
295
|
+
* and resulting margin across merchants, shops, fee types, and providers.
|
|
296
|
+
* `GET /admin-portal/pricing/margin-report`
|
|
297
|
+
*/
|
|
298
|
+
async marginReport(params) {
|
|
299
|
+
return this.request("GET", `${BASE}/margin-report`, {
|
|
300
|
+
query: params
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Export the filtered platform margin report as a CSV or Excel (`.xlsx`)
|
|
305
|
+
* spreadsheet matching the on-screen figures.
|
|
306
|
+
* `GET /admin-portal/pricing/margin-report/export`
|
|
307
|
+
*/
|
|
308
|
+
async exportMarginReport(params, format) {
|
|
309
|
+
return this.request("GET", `${BASE}/margin-report/export`, {
|
|
310
|
+
query: {
|
|
311
|
+
...params,
|
|
312
|
+
format
|
|
313
|
+
},
|
|
314
|
+
responseType: "blob"
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Replay real historical volume for a merchant, project, or shop under a
|
|
319
|
+
* proposed price change and return before/after charges and margins without
|
|
320
|
+
* mutating any stored price. `POST /admin-portal/pricing/simulate`
|
|
321
|
+
*/
|
|
322
|
+
async simulate(params) {
|
|
323
|
+
return this.request("POST", `${BASE}/simulate`, {
|
|
324
|
+
body: params
|
|
325
|
+
});
|
|
326
|
+
}
|
|
293
327
|
};
|
|
294
328
|
|
|
295
329
|
export {
|
|
296
330
|
AdminPricing
|
|
297
331
|
};
|
|
298
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-Q5S7YKB3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/resources/adminPricing.ts"],"sourcesContent":["import type { RequestFn } from '../../client';\nimport type { MerchantPricingViewResponse, PricingFeeType } from '../../types';\nimport type {\n AdminEventFeeListQuery,\n AdminEventFeeListResponse,\n AdminEventFeeRecord,\n AdminServiceUsageListQuery,\n AdminServiceUsageListResponse,\n AdminServiceUsageRecord,\n EffectivePricingQuery,\n EffectivePricingResponse,\n EventFeePreviewRequest,\n EventFeePreviewResponse,\n EventFeeRecordRequest,\n MarginReportExportFormat,\n MarginReportQuery,\n MarginReportResponse,\n MerchantPricingBrandResponse,\n PricingBrand,\n PricingOverview,\n PricingOverviewQuery,\n PricingSaveRequest,\n PricingScope,\n PricingScopeView,\n PricingSimulationRequest,\n PricingSimulationResponse,\n RecurringFeeChargeListQuery,\n RecurringFeeChargeListResponse,\n RecurringFeeRunRequest,\n RecurringFeeRunResponse,\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 /** Read the exact Pricing page view a merchant sees (read-only staff mirror). `GET /admin-portal/pricing/merchants/{merchant_id}/view` */\n async getMerchantView(merchantId: string): Promise<MerchantPricingViewResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/view`);\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 /** List recorded platform event fees across merchants. `GET /admin-portal/pricing/event-fees` */\n async listEventFees(params?: AdminEventFeeListQuery): Promise<AdminEventFeeListResponse> {\n return this.request('GET', `${BASE}/event-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the platform event fee and effective FX rate for a hypothetical event. `POST /admin-portal/pricing/event-fees/preview` */\n async previewEventFee(params: EventFeePreviewRequest): Promise<EventFeePreviewResponse> {\n return this.request('POST', `${BASE}/event-fees/preview`, {\n body: params,\n });\n }\n\n /**\n * Record and settle one operator-recorded platform event fee. `POST /admin-portal/pricing/event-fees`\n *\n * Deduplicated by `(merchant_id, fee_type, reference_id)` (trimmed `reference_id`, without a\n * `test_mode` dimension). Retrying with a different `fee_type` bypasses deduplication and can\n * create a separate debit depending on `charge_status`; callers must use distinct `reference_id`\n * values for test and live records so a completed test write is never replayed as a live charge.\n */\n async recordEventFee(params: EventFeeRecordRequest): Promise<AdminEventFeeRecord> {\n return this.request('POST', `${BASE}/event-fees`, {\n body: params,\n });\n }\n\n /**\n * Preview (`dry_run: true`) or execute (`dry_run: false`) monthly recurring,\n * setup, and monthly-minimum fee charging. Only an explicit `dry_run: false`\n * posts live charges; omitted arguments or an omitted `dry_run` field default\n * to preview mode (`dry_run: true`).\n * `POST /admin-portal/pricing/recurring-fees/run`\n */\n async runRecurringFees(params: RecurringFeeRunRequest): Promise<RecurringFeeRunResponse> {\n const dry_run = params?.dry_run === false ? false : true;\n return this.request('POST', `${BASE}/recurring-fees/run`, {\n body: {\n ...params,\n dry_run,\n },\n });\n }\n\n /** List recorded monthly recurring, setup, and monthly-minimum fee charges. `GET /admin-portal/pricing/recurring-fees` */\n async listRecurringFees(\n params?: RecurringFeeChargeListQuery,\n ): Promise<RecurringFeeChargeListResponse> {\n return this.request('GET', `${BASE}/recurring-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Read the platform margin report comparing provider cost, amount charged,\n * and resulting margin across merchants, shops, fee types, and providers.\n * `GET /admin-portal/pricing/margin-report`\n */\n async marginReport(params?: MarginReportQuery): Promise<MarginReportResponse> {\n return this.request('GET', `${BASE}/margin-report`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Export the filtered platform margin report as a CSV or Excel (`.xlsx`)\n * spreadsheet matching the on-screen figures.\n * `GET /admin-portal/pricing/margin-report/export`\n */\n async exportMarginReport(\n params: MarginReportQuery | undefined,\n format: MarginReportExportFormat,\n ): Promise<Blob> {\n return this.request('GET', `${BASE}/margin-report/export`, {\n query: {\n ...(params as Record<string, string | number | boolean | undefined>),\n format,\n },\n responseType: 'blob',\n });\n }\n\n /**\n * Replay real historical volume for a merchant, project, or shop under a\n * proposed price change and return before/after charges and margins without\n * mutating any stored price. `POST /admin-portal/pricing/simulate`\n */\n async simulate(params: PricingSimulationRequest): Promise<PricingSimulationResponse> {\n return this.request('POST', `${BASE}/simulate`, {\n body: params,\n });\n }\n}\n"],"mappings":";AAmCA,IAAM,OAAO;AACb,IAAM,YAAY,CAAC,OAAqB,YACtC,GAAG,IAAI,WAAW,mBAAmB,KAAK,CAAC,IAAI,mBAAmB,OAAO,CAAC;AAC5E,IAAM,mBAAmB,CAAC,eACxB,GAAG,IAAI,cAAc,mBAAmB,UAAU,CAAC;AACrD,IAAM,kBAAkB,CAAC,YAAoB,YAC3C,GAAG,iBAAiB,UAAU,CAAC,IAAI,mBAAmB,OAA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AAG,IAAI,kBAAkB;AAAA,MAClD,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,mBACJ,QACA,QACe;AACf,WAAO,KAAK,QAAQ,OAAO,GAAG,IAAI,yBAAyB;AAAA,MACzD,OAAO;AAAA,QACL,GAAI;AAAA,QACJ;AAAA,MACF;AAAA,MACA,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAS,QAAsE;AACnF,WAAO,KAAK,QAAQ,QAAQ,GAAG,IAAI,aAAa;AAAA,MAC9C,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/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,IAAA,EAAA,GACZ,CAAA,EAAA;AACW,EAAA;AACN,IAAA;AACS,MAAA;AACT,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,I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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/sdk-pub-04970/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":["/tmp/w3-sdk-publish-0501/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,IAAA,EAAA,GACZ,CAAA,EAAA;AACW,EAAA;AACN,IAAA;AACS,MAAA;AACT,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACG,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,IAAA;AACe,MAAA;AACf,IAAA;AACI,MAAA;AACL,QAAA;AACF,MAAA;AACJ,EAAA;AACF;AAEsB;AACZ,EAAA;AACV;AASgB;AACD,EAAA;AACf;AAGgB;AACP,EAAA;AACT;AAOgB;AACO,E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tmp/w3-sdk-publish-0501/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/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/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/w3-sdk-publish-0501/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/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/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/w3-sdk-publish-0501/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/sdk-pub-04970/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;AAC2D,MAAA;AAC9C,MAAA;AACf,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQqF,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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":["/tmp/w3-sdk-publish-0501/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,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;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":"/tmp/w3-sdk-publish-0501/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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/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/w3-sdk-publish-0501/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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-R5VYSZ3Q.cjs","../src/resources/events.ts"],"names":[],"mappings":"AAAA;ACSO,IAAM,OAAA,EAAN,MAAa;AAAA,EAClB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA,EAElD,MAAM,IAAA,CAAK,UAAA,EAAoB,MAAA,EAAsD;AACnF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,CAAA,QAAA,EAAW,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AACvE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUgG,EAAA;AAClF,IAAA;AACV,MAAA;AACgE,MAAA;AAClE,IAAA;AACF,EAAA;AAEuF,EAAA;AACzE,IAAA;AACV,MAAA;AACgE,MAAA;AAClE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcuC,EAAA;AACgC,IAAA;AACvE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW0E,EAAA;AACJ,IAAA;AACtE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS6F,EAAA;AAC5B,IAAA;AACjE,EAAA;AACF;ADf0E;AACA;AACA;AACA","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-R5VYSZ3Q.cjs","sourcesContent":[null,"import type {\n EventListParams,\n EventListResponse,\n EventDetailResponse,\n EventManualTriggerRequest,\n EventManualTriggerResponse,\n} from '../types';\nimport type { RequestFn } from '../client';\n\nexport class Events {\n constructor(private readonly request: RequestFn) {}\n\n async list(merchantId: string, params?: EventListParams): Promise<EventListResponse> {\n return this.request('POST', `/events/${encodeURIComponent(merchantId)}`, { body: params });\n }\n\n /**\n * Every delivery attempt of one event, initial attempt first.\n * `GET /events/{merchant_id}/{event_id}/attempts`\n *\n * Each entry describes one attempt: `attempt_delivered` is that attempt's own\n * result, while `is_delivery_successful` and `delivery_terminal_reason` are\n * the event's and read the same on every entry.\n */\n async listDeliveryAttempts(merchantId: string, eventId: string): Promise<EventDetailResponse[]> {\n return this.request(\n 'GET',\n `/events/${encodeURIComponent(merchantId)}/${encodeURIComponent(eventId)}/attempts`,\n );\n }\n\n async retryDelivery(merchantId: string, eventId: string): Promise<EventDetailResponse> {\n return this.request(\n 'POST',\n `/events/${encodeURIComponent(merchantId)}/${encodeURIComponent(eventId)}/retry`,\n );\n }\n\n /**\n * Fire an outgoing webhook event by hand for one object.\n * `POST /events/{merchant_id}/trigger`\n *\n * Not a replay — see {@link EventManualTriggerRequest}. Needs the\n * `WebhookEventTrigger` permission, which is separate from the one that\n * authorizes {@link retryDelivery}, and is JWT-only: a forged payload must\n * be attributable to a person.\n */\n async trigger(\n merchantId: string,\n body: EventManualTriggerRequest,\n ): Promise<EventManualTriggerResponse> {\n return this.request('POST', `/events/${encodeURIComponent(merchantId)}/trigger`, { body });\n }\n\n // --- Profile-scoped listing (Task 4.12) ---\n\n /**\n * List events (profile-scoped). `POST /events/profile/list`\n *\n * Takes the same constraints as {@link list} — it is the same endpoint\n * narrowed to the caller's own shop, so `profile_id` is redundant and\n * ignored there.\n */\n async listByProfile(params?: EventListParams): Promise<EventListResponse> {\n return this.request('POST', '/events/profile/list', { body: params });\n }\n\n /**\n * Fire an outgoing webhook event by hand (profile-scoped).\n * `POST /events/profile/trigger`\n *\n * The shop-user twin of {@link trigger}; the shop is taken from the auth\n * context, so `profile_id` on the body is ignored.\n */\n async triggerByProfile(body: EventManualTriggerRequest): Promise<EventManualTriggerResponse> {\n return this.request('POST', '/events/profile/trigger', { body });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-RHFUXHQN.cjs","../src/resources/aiTools.ts"],"names":[],"mappings":"AAAA;ACQA,IAAM,iBAAA,EAAmB,CAAC,cAAA,EAAwB,QAAA,EAAA,GAChD,CAAA,2BAAA,EAA8B,kBAAA,CAAmB,cAAc,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA;AAgBzD;AAC8B,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUV,EAAA;AACmB,IAAA;AACH,MAAA;AACrD,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASiF,EAAA;AACR,IAAA;AACzE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOiF,EAAA;AACR,IAAA;AACzE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO4D,EAAA;AACL,IAAA;AACvD,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQuD,EAAA;AACkC,IAAA;AACzF,EAAA;AACF;AD3BkI;AACA;AACA;AACA","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-RHFUXHQN.cjs","sourcesContent":[null,"import type {\n McpConfirmationEntry,\n McpConfirmationListParams,\n McpConfirmationListResponse,\n McpConnectionListResponse,\n} from '../types';\nimport type { RequestFn } from '../client';\n\nconst confirmationPath = (confirmationId: string, decision: 'approve' | 'decline'): string =>\n `/account/mcp/confirmations/${encodeURIComponent(confirmationId)}/${decision}`;\n\n/**\n * AI tools that work in the merchant account through the MCP server: the\n * confirmations they ask for, and the tools connected by signing in.\n *\n * A sensitive change an AI tool makes, such as a refund, a deletion or an\n * access change, waits for a person's confirmation. When the tool cannot ask\n * in the agent, the confirmation waits here for a decision.\n *\n * Every method needs a signed-in dashboard user and acts on the merchant of\n * that sign-in. A user sees the confirmations of their own sign-ins and their\n * own connected tools; a user whose role may manage API keys sees every one of\n * the merchant's. A sign-in's confirmation is decided only by the user who\n * signed in, an API key's by a user whose role may manage API keys.\n */\nexport class AiTools {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The confirmations this user may see, newest first: by default those\n * waiting for a decision and not expired, or every one with\n * `{ status: 'all' }`.\n * `GET /account/mcp/confirmations`\n */\n async listConfirmations(\n params: McpConfirmationListParams = {},\n ): Promise<McpConfirmationListResponse> {\n return this.request('GET', '/account/mcp/confirmations', {\n query: params.status ? { status: params.status } : {},\n });\n }\n\n /**\n * Approve a pending confirmation. The AI tool can then make the confirmed\n * change once, for the same request, before the confirmation expires.\n * Refused with 400 when it is no longer pending, 403 when this user may not\n * decide it, and 404 for an unknown confirmation.\n * `POST /account/mcp/confirmations/{confirmationId}/approve`\n */\n async approveConfirmation(confirmationId: string): Promise<McpConfirmationEntry> {\n return this.request('POST', confirmationPath(confirmationId, 'approve'));\n }\n\n /**\n * Decline a pending confirmation; the change is not made. Refused like\n * {@link AiTools.approveConfirmation}.\n * `POST /account/mcp/confirmations/{confirmationId}/decline`\n */\n async declineConfirmation(confirmationId: string): Promise<McpConfirmationEntry> {\n return this.request('POST', confirmationPath(confirmationId, 'decline'));\n }\n\n /**\n * The AI tools connected to the merchant by signing in, newest first: this\n * user's own, or every user's for a role that may manage API keys.\n * `GET /account/mcp/connections`\n */\n async listConnections(): Promise<McpConnectionListResponse> {\n return this.request('GET', '/account/mcp/connections');\n }\n\n /**\n * Remove a connected AI tool by revoking its sign-in; its next request is\n * refused. Refused with 403 when it is neither this user's tool nor the role\n * may manage API keys, and 404 for an unknown one.\n * `DELETE /account/mcp/connections/{grantId}`\n */\n async removeConnection(grantId: string): Promise<void> {\n return this.request('DELETE', `/account/mcp/connections/${encodeURIComponent(grantId)}`);\n }\n}\n"]}
|
|
@@ -269,9 +269,33 @@ var BuyerPortal = class {
|
|
|
269
269
|
{ query: { profile_id: params.profile_id }, ...options }
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
+
/** Start (or resume an open) payment method replacement for a native subscription. */
|
|
273
|
+
async replaceSubscriptionPaymentMethod(subscriptionId, params, options) {
|
|
274
|
+
return this.request(
|
|
275
|
+
"POST",
|
|
276
|
+
`/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace`,
|
|
277
|
+
{ body: params, ...options }
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
/** Read the latest payment method replacement state for a native subscription. */
|
|
281
|
+
async getSubscriptionPaymentMethodReplacement(subscriptionId, options) {
|
|
282
|
+
return this.request(
|
|
283
|
+
"GET",
|
|
284
|
+
`/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace`,
|
|
285
|
+
{ ...options }
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
/** Abandon a pending payment method replacement; the existing method remains in place. */
|
|
289
|
+
async abandonSubscriptionPaymentMethodReplacement(subscriptionId, options) {
|
|
290
|
+
return this.request(
|
|
291
|
+
"POST",
|
|
292
|
+
`/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace/abandon`,
|
|
293
|
+
{ ...options }
|
|
294
|
+
);
|
|
295
|
+
}
|
|
272
296
|
};
|
|
273
297
|
|
|
274
298
|
|
|
275
299
|
|
|
276
300
|
exports.BuyerPortal = BuyerPortal;
|
|
277
|
-
//# sourceMapp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AACtC,MAAA;AAC7B,IAAA;AACF,EAAA;AAMgC,EAAA;AAClB,IAAA;AACV,MAAA;AACiE,MAAA;AACQ,MAAA;AAC3E,IAAA;AACF,EAAA;AAMoC,EAAA;AACtB,IAAA;AACV,MAAA;AACiE,MAAA;AACtC,MAAA;AAC7B,IAAA;AACF,EAAA;AAMgC,EAAA;AAClB,IAAA;AACV,MAAA;AACyE,MAAA;AACA,MAAA;AAC3E,IAAA;AACF,EAAA;AAAA;AAMqC,EAAA;AACsC,IAAA;AACjE,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAMqC,EAAA;AACvB,IAAA;AACV,MAAA;AAC+E,MAAA;AACxB,MAAA;AACzD,IAAA;AACF,EAAA;AAM4C,EAAA;AAC9B,IAAA;AACV,MAAA;AAC+E,MAAA;AACxB,MAAA;AACzD,IAAA;AACF,EAAA;AAAA;AAOmD,EAAA;AACrC,IAAA;AACV,MAAA;AACiE,MAAA;AACtC,MAAA;AAC7B,IAAA;AACF,EAAA;AAAA;AAMmD,EAAA;AACrC,IAAA;AACV,MAAA;AACiE,MAAA;AACpD,MAAA;AACf,IAAA;AACF,EAAA;AAAA;AAMmD,EAAA;AACrC,IAAA;AACV,MAAA;AACiE,MAAA;AACpD,MAAA;AACf,IAAA;AACF,EAAA;AACF;AD1KqG;AACA;AACA;AACA","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-RHT27R27.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type {\n BuyerCaseList,\n BuyerConversationAttachment,\n BuyerPortalAttachmentQuery,\n BuyerPortalContactEmailCommand,\n BuyerPortalContactEmailOutcome,\n BuyerPortalConversationList,\n BuyerPortalConversationQuery,\n BuyerPortalMessage,\n BuyerPortalMessageCreate,\n BuyerPortalMessagePage,\n BuyerInvoiceListQuery,\n BuyerPortalInvoice,\n BuyerPortalInvoicePage,\n BuyerPortalPageQuery,\n BuyerPortalProfile,\n BuyerPortalProfileUpdate,\n BuyerPortalPurchasePage,\n BuyerPortalRefundRequest,\n BuyerPortalRefundRequestCreate,\n BuyerPortalSession,\n BuyerPortalSubscriptionPage,\n BuyerPortalSubscription,\n BuyerPortalSubscriptionActionRequest,\n BuyerPortalPlanPage,\n BuyerPortalPlanChangeRequest,\n NativeCreateSubscriptionRequest,\n NativeEnrollmentResponse,\n NativeEnrollmentStatusQuery,\n NativeEnrollmentAbandonResponse,\n NativePaymentMethodReplacementRequest,\n NativePaymentMethodReplacementResponse,\n BuyerEvidence,\n BuyerEvidenceEntry,\n BuyerEvidenceExtensionRequest,\n BuyerEvidenceFile,\n BuyerEvidenceSubmit,\n} from '../types';\n\n/**\n * Buyer access using a customer portal grant, sent in the api-key header.\n * Use a separate client constructed with the portal token, not a merchant secret\n * key or dashboard JWT. The grant determines buyer identity and permitted shops.\n */\nexport class BuyerPortal {\n constructor(private readonly request: RequestFn) {}\n\n async getSession(options?: RequestExtras): Promise<BuyerPortalSession> {\n return this.request('GET', '/buyer-portal/session', { ...options });\n }\n\n /**\n * The buyer's cases at the shop: the refund requests they sent and the\n * disputes about their purchases, newest first, with where each stands, who\n * acts next, the outcome and the recorded steps.\n */\n async listCases(options?: RequestExtras): Promise<BuyerCaseList> {\n return this.request('GET', '/buyer-portal/cases', { ...options });\n }\n\n /**\n * A case's evidence: what may be handed in and by when, the files saved\n * and handed in, and what the reviewer said. Opened on the first read\n * while the case still waits.\n */\n async caseEvidence(caseId: string, options?: RequestExtras): Promise<BuyerEvidence> {\n return this.request('GET', `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {\n ...options,\n });\n }\n\n /**\n * Upload a file for a case. It is saved, not handed in, until a\n * submission takes it. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored, also after the cut-off.\n */\n async uploadEvidenceFile(\n caseId: string,\n file: Blob,\n clientUploadId: string,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerEvidenceFile> {\n const { fileName, ...extras } = options ?? {};\n const form = new FormData();\n form.append('client_upload_id', clientUploadId);\n if (fileName === undefined) form.append('file', file);\n else form.append('file', file, fileName);\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,\n { body: form, ...extras },\n );\n }\n\n /** Download a file of the case's evidence. */\n async downloadEvidenceFile(\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /** Remove a saved file. A file a submission took stays. */\n async removeEvidenceFile(caseId: string, fileId: string, options?: RequestExtras): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n ...options,\n },\n );\n }\n\n /**\n * Hand in an explanation, saved files or both, while the buyer's window\n * is open. Sending again with the same `client_submission_id` returns the\n * submission the first send stored.\n */\n async submitEvidence(\n caseId: string,\n params: BuyerEvidenceSubmit,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,\n { body: params, ...options },\n );\n }\n\n /** Ask for more time, once until the cut-off is next set. */\n async requestEvidenceExtension(\n caseId: string,\n params: BuyerEvidenceExtensionRequest,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,\n { body: params, ...options },\n );\n }\n\n /**\n * The buyer's conversations with the shop, the latest message first. A\n * portal link for the whole merchant lists one per shop and mode.\n */\n async listConversations(options?: RequestExtras): Promise<BuyerPortalConversationList> {\n return this.request('GET', '/buyer-portal/conversations', { ...options });\n }\n\n /**\n * The conversation with one shop and its newest messages, oldest first;\n * `before` pages back. A link issued for one shop may leave `shop` out.\n */\n async listMessages(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessagePage> {\n return this.request('GET', '/buyer-portal/messages', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * A message to the shop. A message to a closed conversation reopens it.\n * Sending again with the same `client_message_id` returns the message the\n * first send stored.\n */\n async sendMessage(\n message: BuyerPortalMessageCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessage> {\n return this.request('POST', '/buyer-portal/messages', { body: message, ...options });\n }\n\n /**\n * The buyer has read the conversation with the shop up to its last accepted\n * message. Answers with the buyer's conversations as they now stand.\n */\n async markMessagesRead(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request('POST', '/buyer-portal/messages/read', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * Upload a file for the buyer's next message to one shop, under the shop's\n * attachment rules (`attachment_rules` on the message page). It belongs to\n * the buyer until a message names it in `attachments`; one no message took\n * within a day is cleared. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored.\n */\n async uploadMessageFile(\n file: Blob,\n clientUploadId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerConversationAttachment> {\n const { fileName, ...extras } = options ?? {};\n const form = new FormData();\n form.append('client_upload_id', clientUploadId);\n if (fileName === undefined) form.append('file', file);\n else form.append('file', file, fileName);\n return this.request('POST', '/buyer-portal/messages/files', {\n body: form,\n query: query as Record<string, string | boolean | null | undefined>,\n ...extras,\n });\n }\n\n /** Download a file a message of the buyer's conversation with one shop carries. */\n async downloadMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request('GET', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n responseType: 'blob',\n ...options,\n });\n }\n\n /** Remove a file the buyer uploaded that no message took. */\n async removeMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request('DELETE', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n ...options,\n });\n }\n\n /** The buyer's contact and billing details, and what they may change. */\n async getProfile(options?: RequestExtras): Promise<BuyerPortalProfile> {\n return this.request('GET', '/buyer-portal/profile', { ...options });\n }\n\n /**\n * Change the buyer's contact and billing details. Fields left out stay as\n * they are; the merchant decides whether buyers may change them at all.\n */\n async updateProfile(\n params: BuyerPortalProfileUpdate,\n options?: RequestExtras,\n ): Promise<BuyerPortalProfile> {\n return this.request('POST', '/buyer-portal/profile', { body: params, ...options });\n }\n\n /**\n * Change the buyer's email address, as the profile's `email_policy` allows:\n * `request` names the new address, and under a `confirm_new` policy\n * `confirm` completes it with the proof sent there. A refusal comes back as\n * an outcome with `status: 'refused'`; a 403 means the policy does not let\n * the buyer change the address at all, and a 429 that the request limit was\n * reached.\n * `POST /buyer-portal/profile/contact-email`\n */\n async changeContactEmail(\n command: BuyerPortalContactEmailCommand,\n options?: RequestExtras,\n ): Promise<BuyerPortalContactEmailOutcome> {\n return this.request('POST', '/buyer-portal/profile/contact-email', {\n body: command,\n ...options,\n });\n }\n\n /**\n * Ask the shop for a refund of one of the buyer's purchases, named by its\n * `id` from `listPurchases()`. Nothing is refunded until the shop approves\n * the request with a refund.\n */\n async createRefundRequest(\n purchaseId: string,\n params: BuyerPortalRefundRequestCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalRefundRequest> {\n return this.request(\n 'POST',\n `/buyer-portal/purchases/${encodeURIComponent(purchaseId)}/refund-requests`,\n { body: params, ...options },\n );\n }\n\n async listInvoices(\n params?: BuyerInvoiceListQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalInvoicePage> {\n return this.request('GET', '/buyer-portal/invoices', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async retrieveInvoice(invoiceId: string, options?: RequestExtras): Promise<BuyerPortalInvoice> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {\n ...options,\n });\n }\n\n /** Download the owned, published invoice as PDF bytes. */\n async downloadInvoicePdf(invoiceId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n async listPurchases(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPurchasePage> {\n return this.request('GET', '/buyer-portal/purchases', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async listSubscriptions(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionPage> {\n return this.request('GET', '/buyer-portal/subscriptions', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n /** Apply an action allowed by the subscription capabilities and portal grant. */\n async actOnSubscription(\n subscriptionId: string,\n params: BuyerPortalSubscriptionActionRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,\n { body: params, ...options },\n );\n }\n\n async listSubscriptionPlans(\n subscriptionId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n async changeSubscriptionPlan(\n subscriptionId: string,\n params: BuyerPortalPlanChangeRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,\n { body: params, ...options },\n );\n }\n\n async listNativePlans(\n profileId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n /** Retry with the same subscription ID and accepted terms after a lost response. */\n async enrollNative(\n params: NativeCreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request('POST', '/buyer-portal/subscriptions/native/enroll', {\n body: params,\n ...options,\n });\n }\n\n async getNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n\n async abandonNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentAbandonResponse> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n\n /** Start (or resume an open) payment method replacement for a native subscription. */\n async replaceSubscriptionPaymentMethod(\n subscriptionId: string,\n params: NativePaymentMethodReplacementRequest,\n options?: RequestExtras,\n ): Promise<NativePaymentMethodReplacementResponse> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace`,\n { body: params, ...options },\n );\n }\n\n /** Read the latest payment method replacement state for a native subscription. */\n async getSubscriptionPaymentMethodReplacement(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<NativePaymentMethodReplacementResponse> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace`,\n { ...options },\n );\n }\n\n /** Abandon a pending payment method replacement; the existing method remains in place. */\n async abandonSubscriptionPaymentMethodReplacement(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<NativePaymentMethodReplacementResponse> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/payment-method/replace/abandon`,\n { ...options },\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-RI42IDRR.cjs","../src/resources/profileAcquirers.ts"],"names":[],"mappings":"AAAA;ACOO,IAAM,iBAAA,EAAN,MAAuB;AAAA,EAC5B,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA,EAElD,MAAM,MAAA,CAAO,MAAA,EAAwE;AACnF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,mBAAA,EAAqB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACnE;AAAA,EAEA,MAAM,MAAA,CACJ,SAAA,EACA,iBAAA,EACA,MAAA,EACkC;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,MAAA;AAAA,MACA,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA,EAAI,kBAAA,CAAmB,iBAAiB,CAAC,CAAA,CAAA;AAC3F,MAAA;AACQ,QAAA;AACR,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADTkG;AACA;AACA;AACA","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-RI42IDRR.cjs","sourcesContent":[null,"import type {\n ProfileAcquirerCreateRequest,\n ProfileAcquirerResponse,\n ProfileAcquirerUpdateRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\nexport class ProfileAcquirers {\n constructor(private readonly request: RequestFn) {}\n\n async create(params: ProfileAcquirerCreateRequest): Promise<ProfileAcquirerResponse> {\n return this.request('POST', '/profile-acquirer', { body: params });\n }\n\n async update(\n profileId: string,\n profileAcquirerId: string,\n params: ProfileAcquirerUpdateRequest,\n ): Promise<ProfileAcquirerResponse> {\n return this.request(\n 'POST',\n `/profile-acquirer/${encodeURIComponent(profileId)}/${encodeURIComponent(profileAcquirerId)}`,\n {\n body: params,\n },\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-S77LQWYC.cjs","../src/internal/resources/platformSettings.ts"],"names":[],"mappings":"AAAA;ACoBO,IAAM,iBAAA,EAAN,MAAuB;AAAA,EAC5B,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,6BAAA,CAAA,EAAwE;AAC5E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,gDAAgD,CAAA;AAAA,EAC7E;AAAA;AAAA,EAGA,MAAM,0BAAA,CACJ,SAAA,EACA,gBAAA,EAC2B;AAC3B,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO;AAAA,MACjB,OAAA,EAAS;AAAA,QACP;AAAA,UACE,GAAA,EAAK,iCAAA;AAAA,UACL,KAAA,EAAO,SAAA;AAAA,UACP,iBAAA,EAAmB;AAAA,QACrB;AAAA,MACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QAAA,CAAA,EAAsC;AAC1C,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAwB,CAAA;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAA,CAAO,MAAA,EAA0D;AACrE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,wBAAA,EAA0B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAC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AA,EAAM,OAAO,CAAC,CAAA;AAAA,EAChF;AACF,CAAA;AAEA,SAAS,QAAA,CAAS,UAAA,EAAoB,SAAA,EAA2B;AAC/D,EAAA,OAAO,CAAA,uBAAA,EAA0B,kBAAA,CAAmB,UAAU,CAAC,CAAA,OAAA,EAAU,kBAAA,CAAmB,SAAS,CAAC,CAAA,SAAA,CAAA;AACxG;AAGA,SAAS,YAAA,CAAa,KAAA,EAAsD;AAC1E,EAAA,OAAO,KAAA,CAAM,WAAA,EAAa,EAAE,UAAA,EAAY,KAAA,CAAM,WAAW,EAAA,EAAI,CAAC,CAAA;AAChE;AD1CA;AACA;AACE;AACF,4CAAC","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-S77LQWYC.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type { SettingOverridesResponse } from '../types';\nimport type {\n ApplePayVerificationCatalogue,\n ApplePayVerificationSelection,\n MerchantSettingsQuery,\n SettingsResponse,\n UpdateSettingsRequest,\n} from '../../types';\n\n/**\n * Settings as the platform operator sees them: the platform's own, and the\n * operator's values at any merchant, project or shop.\n *\n * Each setting names the admin permission group needed to change it. Every\n * change is recorded in the audit log with the previous and the new value\n * (`entity_type: 'setting'`); `auditLogs.list({ entity_type: 'setting',\n * entity_id })` is one setting's history. A merchant's own values are listed\n * (`authority: 'merchant'`) but can only be changed by the merchant.\n */\nexport class PlatformSettings {\n constructor(private readonly request: RequestFn) {}\n\n /** Provider-issued presets for this backend environment. */\n async applePayVerificationCatalogue(): Promise<ApplePayVerificationCatalogue> {\n return this.request('GET', '/payment-link/apple-pay-verification/catalogue');\n }\n\n /** Atomic, audited update. A stale revision leaves the current file unchanged. */\n async updateApplePayVerification(\n selection: ApplePayVerificationSelection,\n expectedRevision: number,\n ): Promise<SettingsResponse> {\n return this.update({\n changes: [\n {\n key: 'checkout.apple_pay_verification',\n value: selection,\n expected_revision: expectedRevision,\n },\n ],\n });\n }\n\n /** `GET /admin-portal/settings` */\n async retrieve(): Promise<SettingsResponse> {\n return this.request('GET', '/admin-portal/settings');\n }\n\n /**\n * Change platform settings. All changes are applied or none is.\n *\n * `PATCH /admin-portal/settings`\n */\n async update(params: UpdateSettingsRequest): Promise<SettingsResponse> {\n return this.request('PATCH', '/admin-portal/settings', { body: params });\n }\n\n /** `GET /admin-portal/accounts/{merchantId}/settings` */\n async retrieveMerchant(\n merchantId: string,\n query: MerchantSettingsQuery = {},\n ): Promise<SettingsResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settings`,\n {\n query: projectQuery(query),\n },\n );\n }\n\n /** `PATCH /admin-portal/accounts/{merchantId}/settings` */\n async updateMerchant(\n merchantId: string,\n params: UpdateSettingsRequest,\n query: MerchantSettingsQuery = {},\n ): Promise<SettingsResponse> {\n return this.request(\n 'PATCH',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settings`,\n { body: params, query: projectQuery(query) },\n );\n }\n\n /**\n * `GET /admin-portal/accounts/{merchantId}/settings/overrides`\n *\n * Which of the merchant's projects and shops carry an operator setting of\n * their own, in one call instead of one settings read per project and shop.\n * A store named in `not_read` could not be read: treat its settings as\n * unknown, not as unset.\n */\n async listMerchantOverrides(merchantId: string): Promise<SettingOverridesResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settings/overrides`,\n );\n }\n\n /** `GET /admin-portal/accounts/{merchantId}/shops/{profileId}/settings` */\n async retrieveShop(merchantId: string, profileId: string): Promise<SettingsResponse> {\n return this.request('GET', shopPath(merchantId, profileId));\n }\n\n /** `PATCH /admin-portal/accounts/{merchantId}/shops/{profileId}/settings` */\n async updateShop(\n merchantId: string,\n profileId: string,\n params: UpdateSettingsRequest,\n ): Promise<SettingsResponse> {\n return this.request('PATCH', shopPath(merchantId, profileId), { body: params });\n }\n}\n\nfunction shopPath(merchantId: string, profileId: string): string {\n return `/admin-portal/accounts/${encodeURIComponent(merchantId)}/shops/${encodeURIComponent(profileId)}/settings`;\n}\n\n/** The query string of a merchant-scope call; a null project is omitted. */\nfunction projectQuery(query: MerchantSettingsQuery): Record<string, string> {\n return query.project_id ? { project_id: query.project_id } : {};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-S7SBNOGS.cjs","../src/resources/operationLimits.ts"],"names":[],"mappings":"AAAA;ACsCO,IAAM,gBAAA,EAAN,MAAsB;AAAA,EAC3B,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,SAAA,CACJ,MAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,yBAAA,EAA2B;AAAA,MACpD,KAAA,EAAO,EAAE,SAAA,kBAAW,MAAA,2BAAQ,YAAU,CAAA;AAAA,MACtC,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,UAAA,CACJ,MAAA,EACA,OAAA,EAC6B;AAC7B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,yBAAA,EAA2B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACpF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,UAAA,CACJ,MAAA,EACA,OAAA,EAC2C;AAC3C,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,QAAA,EAAU,CAAA,wBAAA,EAA2B,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AACrF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQiF,EAAA;AACf,IAAA;AAClE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBgC,EAAA;AACwB,IAAA;AACgB,MAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa0C,EAAA;AACgB,IAAA;AACA,MAAA;AACnD,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUmC,EAAA;AACmD,IAAA;AACtF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmByC,EAAA;AACmB,IAAA;AACjD,MAAA;AACc,QAAA;AACH,QAAA;AACD,QAAA;AACjB,MAAA;AACG,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsB6B,EAAA;AACsD,IAAA;AACzE,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW6B,EAAA;AACsD,IAAA;AACzE,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AACF;ADzEwF;AACA;AACA;AACA","file":"/tmp/w3-sdk-publish-0501/delopay-typescript-sdk/dist/chunk-S7SBNOGS.cjs","sourcesContent":[null,"import type {\n DecidePendingOperationRequest,\n OperationLimitHistoryParams,\n OperationLimitHistoryResponse,\n OperationLimitRule,\n OperationLimitRuleDeleteResponse,\n OperationLimitRuleListParams,\n OperationLimitSettings,\n OperationLimitUsage,\n OperationLimitUsageParams,\n PendingOperation,\n PendingOperationListParams,\n PendingOperationListResponse,\n UpdateOperationLimitSettingsRequest,\n UpsertOperationLimitRuleRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/**\n * Per-operation spending limits: rules scoped to the merchant, a role, a\n * user or an API key, on the entire account or one shop, the merchant-level\n * enforcement settings, the version history and the approvals inbox.\n * Enforcement resolves the most specific rule: api_key > user > role >\n * merchant, a shop rule before the account rule at each level, and a\n * switched-off rule at any applicable level wins.\n *\n * A rule set to `require_approval` does not refuse an over-limit operation —\n * it parks it. The original call fails with HTTP 409 `DE_06` carrying\n * `PendingApprovalErrorDetails`, and the operation runs only once a second\n * person approves the request through this inbox.\n *\n * **Refunds only.** Approval needs an executor that can run the operation\n * after the decision, and only refunds have one; every other operation takes\n * `block` alone, which the request type enforces. So every request in this\n * inbox is a refund, and `DE_06` never comes back from any other call — an\n * over-limit settlement adjustment, payout or subscription change fails with\n * `DE_01`.\n */\nexport class OperationLimits {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * List the merchant's limit rules, optionally for one operation.\n *\n * `GET /operation-limits/rules`\n */\n async listRules(\n params?: OperationLimitRuleListParams,\n options?: RequestExtras,\n ): Promise<OperationLimitRule[]> {\n return this.request('GET', '/operation-limits/rules', {\n query: { operation: params?.operation },\n ...options,\n });\n }\n\n /**\n * Create or replace the limit rule for one target. Full-replace upsert:\n * absent limit fields clear that dimension.\n *\n * `PUT /operation-limits/rules`\n */\n async upsertRule(\n params: UpsertOperationLimitRuleRequest,\n options?: RequestExtras,\n ): Promise<OperationLimitRule> {\n return this.request('PUT', '/operation-limits/rules', { body: params, ...options });\n }\n\n /**\n * Delete a limit rule.\n *\n * `DELETE /operation-limits/rules/{ruleId}`\n */\n async deleteRule(\n ruleId: string,\n options?: RequestExtras,\n ): Promise<OperationLimitRuleDeleteResponse> {\n return this.request('DELETE', `/operation-limits/rules/${encodeURIComponent(ruleId)}`, options);\n }\n\n /**\n * The merchant-level enforcement settings. An untouched merchant gets the\n * defaults: rolling window, admins not exempt.\n *\n * `GET /operation-limits/settings`\n */\n async retrieveSettings(options?: RequestExtras): Promise<OperationLimitSettings> {\n return this.request('GET', '/operation-limits/settings', options);\n }\n\n /**\n * The caller's own usage against the limit on one operation: the rule that\n * applies to them, what they have used in the current window and what\n * remains.\n *\n * Refund usage needs merchant-wide refund read and is refused to a role\n * restricted to some connectors: the totals span every shop and connector,\n * as the budget does. Settlement usage needs merchant settlement read.\n *\n * `GET /operation-limits/usage`\n */\n async retrieveUsage(\n params: OperationLimitUsageParams,\n options?: RequestExtras,\n ): Promise<OperationLimitUsage> {\n return this.request('GET', '/operation-limits/usage', {\n query: { operation: params.operation, profile_id: params.profile_id },\n ...options,\n });\n }\n\n /**\n * The version history of the merchant's limit settings, newest first: every\n * rule created, changed (switched off or on included) or deleted, and every\n * settings change, with who made it (and who really did, under act-as) and\n * the values before and after.\n *\n * `GET /operation-limits/history`\n */\n async listHistory(\n params?: OperationLimitHistoryParams,\n options?: RequestExtras,\n ): Promise<OperationLimitHistoryResponse> {\n return this.request('GET', '/operation-limits/history', {\n query: { limit: params?.limit, before: params?.before },\n ...options,\n });\n }\n\n /**\n * Update the enforcement settings. Only provided fields change.\n *\n * `PUT /operation-limits/settings`\n */\n async updateSettings(\n params: UpdateOperationLimitSettingsRequest,\n options?: RequestExtras,\n ): Promise<OperationLimitSettings> {\n return this.request('PUT', '/operation-limits/settings', { body: params, ...options });\n }\n\n /**\n * The approvals inbox: over-limit operations waiting on a second person.\n *\n * Both filters default rather than widen. With no `status` the list holds\n * **pending requests only** — approved, rejected and expired ones are\n * reachable only by asking for that status, so a history view must pass one\n * per status. With no `operation` it lists **refunds only**; the list is one\n * operation at a time. `limit` defaults to 100 and is clamped to 1–500.\n *\n * Requests past their `expires_at` are expired before the list is read, so\n * nothing here is shown as actionable when it is not.\n *\n * `GET /operation-limits/approvals`\n */\n async listApprovals(\n params?: PendingOperationListParams,\n options?: RequestExtras,\n ): Promise<PendingOperationListResponse> {\n return this.request('GET', '/operation-limits/approvals', {\n query: {\n operation: params?.operation,\n status: params?.status,\n limit: params?.limit,\n },\n ...options,\n });\n }\n\n /**\n * Approve a parked operation and execute it.\n *\n * Refused for the user who requested it, and for an approver whose own\n * limit would not have covered the operation — the permission is necessary\n * and not sufficient. The requester stays refused while signed in as\n * another team member: that is a `DE_12` error (`approval_decision_refused`)\n * whose `data.reason` is `requester_acting_as_another_member`, and\n * {@link reject} refuses the same way.\n *\n * Approval and execution are two facts. A request that was approved but\n * whose operation then failed comes back `approved` with `execution_error`\n * set and no `result_entity_id`; that is a real outcome, not a partial read.\n *\n * `POST /operation-limits/approvals/{id}/approve`\n */\n async approve(\n id: string,\n params: DecidePendingOperationRequest = {},\n options?: RequestExtras,\n ): Promise<PendingOperation> {\n return this.request('POST', `/operation-limits/approvals/${encodeURIComponent(id)}/approve`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Reject a parked operation. Nothing is executed and the request is closed.\n *\n * `POST /operation-limits/approvals/{id}/reject`\n */\n async reject(\n id: string,\n params: DecidePendingOperationRequest = {},\n options?: RequestExtras,\n ): Promise<PendingOperation> {\n return this.request('POST', `/operation-limits/approvals/${encodeURIComponent(id)}/reject`, {\n body: params,\n ...options,\n });\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Delopay
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IPN7D5PP.js";
|
|
4
4
|
import {
|
|
5
5
|
DelopayError
|
|
6
6
|
} from "./chunk-37BJUQ32.js";
|
|
@@ -1040,4 +1040,4 @@ var CheckoutSession = class {
|
|
|
1040
1040
|
export {
|
|
1041
1041
|
CheckoutSession
|
|
1042
1042
|
};
|
|
1043
|
-
//# sourceMappingURL=chunk-
|
|
1043
|
+
//# sourceMappingURL=chunk-SAXTZZQL.js.map
|