@delopay/sdk 0.255.0 → 0.263.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/index.js CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  BRANDING_EXPORT_VERSION,
23
23
  BUILTIN_PAYMENT_ICON_KEYS,
24
24
  BuyerBlocklist,
25
+ BuyerConversations,
25
26
  CARD_FIELD_CHROMES,
26
27
  CARD_FIELD_FONT_SIZES,
27
28
  CARD_FIELD_WEIGHTS,
@@ -191,6 +192,7 @@ import {
191
192
  fontWeightValue,
192
193
  inputPadValue,
193
194
  isCheckboxChecked,
195
+ isConfirmedChild,
194
196
  isDarkSurface,
195
197
  isDefaultBadgeSet,
196
198
  isHexColor,
@@ -248,7 +250,7 @@ import {
248
250
  visibleCustomFields,
249
251
  whopAccentSwatch,
250
252
  whopCardElement
251
- } from "./chunk-U3KDAIWB.js";
253
+ } from "./chunk-YZCDGNZL.js";
252
254
  export {
253
255
  AIRWALLEX_AUTOFILL_TREATMENTS,
254
256
  AIRWALLEX_CARD_LAYOUTS,
@@ -273,6 +275,7 @@ export {
273
275
  BRANDING_EXPORT_VERSION,
274
276
  BUILTIN_PAYMENT_ICON_KEYS,
275
277
  BuyerBlocklist,
278
+ BuyerConversations,
276
279
  CARD_FIELD_CHROMES,
277
280
  CARD_FIELD_FONT_SIZES,
278
281
  CARD_FIELD_WEIGHTS,
@@ -442,6 +445,7 @@ export {
442
445
  fontWeightValue,
443
446
  inputPadValue,
444
447
  isCheckboxChecked,
448
+ isConfirmedChild,
445
449
  isDarkSurface,
446
450
  isDefaultBadgeSet,
447
451
  isHexColor,
package/dist/internal.cjs CHANGED
@@ -46,6 +46,7 @@ __export(internal_exports, {
46
46
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
47
47
  BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
48
48
  BuyerBlocklist: () => BuyerBlocklist,
49
+ BuyerConversations: () => BuyerConversations,
49
50
  CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
50
51
  CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
51
52
  CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
@@ -228,6 +229,7 @@ __export(internal_exports, {
228
229
  fontWeightValue: () => fontWeightValue,
229
230
  inputPadValue: () => inputPadValue,
230
231
  isCheckboxChecked: () => isCheckboxChecked,
232
+ isConfirmedChild: () => isConfirmedChild,
231
233
  isDarkSurface: () => isDarkSurface,
232
234
  isDefaultBadgeSet: () => isDefaultBadgeSet,
233
235
  isHexColor: () => isHexColor,
@@ -5843,6 +5845,73 @@ var BuyerBlocklist = class {
5843
5845
  }
5844
5846
  };
5845
5847
 
5848
+ // src/resources/buyerConversations.ts
5849
+ var BuyerConversations = class {
5850
+ constructor(request) {
5851
+ this.request = request;
5852
+ }
5853
+ /**
5854
+ * One page of the inbox, the latest message first, filtered by shop,
5855
+ * status, assignee, mode or buyer. `GET /buyer-conversations`
5856
+ */
5857
+ async list(params) {
5858
+ return this.request("GET", "/buyer-conversations", {
5859
+ query: params
5860
+ });
5861
+ }
5862
+ /**
5863
+ * Starts the conversation with a buyer at one shop, or adds to the one that
5864
+ * exists, with a first message. `POST /buyer-conversations`
5865
+ */
5866
+ async start(params) {
5867
+ return this.request("POST", "/buyer-conversations", { body: params });
5868
+ }
5869
+ /**
5870
+ * One conversation and its newest messages, oldest first; `before` pages
5871
+ * back. `GET /buyer-conversations/{id}`
5872
+ */
5873
+ async retrieve(id, params) {
5874
+ return this.request("GET", `/buyer-conversations/${encodeURIComponent(id)}`, {
5875
+ query: params
5876
+ });
5877
+ }
5878
+ /**
5879
+ * A team member's answer. A closed conversation refuses it.
5880
+ * `POST /buyer-conversations/{id}/messages`
5881
+ */
5882
+ async reply(id, params) {
5883
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/messages`, {
5884
+ body: params
5885
+ });
5886
+ }
5887
+ /**
5888
+ * The team has read the conversation up to its last accepted message.
5889
+ * `POST /buyer-conversations/{id}/read`
5890
+ */
5891
+ async markRead(id) {
5892
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/read`);
5893
+ }
5894
+ /**
5895
+ * Hands the conversation to a team member, to the caller with `me`, or to
5896
+ * nobody with `null`. `POST /buyer-conversations/{id}/assign`
5897
+ */
5898
+ async assign(id, params) {
5899
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/assign`, {
5900
+ body: params
5901
+ });
5902
+ }
5903
+ /**
5904
+ * Closes or reopens the conversation. Closing moves no money and decides
5905
+ * no case; it stops new messages until reopened.
5906
+ * `POST /buyer-conversations/{id}/status`
5907
+ */
5908
+ async setStatus(id, params) {
5909
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/status`, {
5910
+ body: params
5911
+ });
5912
+ }
5913
+ };
5914
+
5846
5915
  // src/resources/checkoutRecovery.ts
5847
5916
  var CheckoutRecovery = class {
5848
5917
  constructor(request) {
@@ -7071,6 +7140,31 @@ var CheckoutMethods = class {
7071
7140
  body
7072
7141
  });
7073
7142
  }
7143
+ /**
7144
+ * What DeloPay confirms beneath each item the shop can place: the card
7145
+ * networks the card form's accounts accept, and the methods or coins a
7146
+ * provider's page offers, per account, with source and freshness. A
7147
+ * provider that answers only per order reports `context_required` until
7148
+ * `currency` and `amount` are given. A layout item's `children` narrows
7149
+ * these lists and never adds to them.
7150
+ * `GET /checkout-methods/{profile_id}/children` (`/test/children` for Test)
7151
+ */
7152
+ async children(merchantId, profileId, params = {}) {
7153
+ const { environment, ...order } = params;
7154
+ const query = { merchant_id: merchantId, ...order };
7155
+ if (environment === "test") {
7156
+ return this.request(
7157
+ "GET",
7158
+ `/checkout-methods/${encodeURIComponent(profileId)}/test/children`,
7159
+ {
7160
+ query
7161
+ }
7162
+ );
7163
+ }
7164
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/children`, {
7165
+ query
7166
+ });
7167
+ }
7074
7168
  /**
7075
7169
  * Delete the stored layout; the shop is back on the derived one.
7076
7170
  * `DELETE /checkout-methods/{profile_id}`
@@ -7428,6 +7522,108 @@ var BuyerAccount = class {
7428
7522
  ...options
7429
7523
  });
7430
7524
  }
7525
+ /**
7526
+ * The shops the buyer has purchases at, once each and by name. Pass a
7527
+ * shop's `shop` to `listPurchases` to list only that shop's purchases.
7528
+ */
7529
+ async listShops(options) {
7530
+ return this.request("GET", "/buyer-account/shops", { ...options });
7531
+ }
7532
+ /**
7533
+ * The buyer's subscriptions across shops, newest first. A record the buyer
7534
+ * has not confirmed shows what a receipt carries, without its period or
7535
+ * cancellation.
7536
+ */
7537
+ async listSubscriptions(query, options) {
7538
+ return this.request("GET", "/buyer-account/subscriptions", {
7539
+ query,
7540
+ ...options
7541
+ });
7542
+ }
7543
+ /**
7544
+ * The issued invoices of the records the buyer has confirmed through a
7545
+ * shop's own link, newest first. `unconfirmed_records` says when records
7546
+ * were left out.
7547
+ */
7548
+ async listInvoices(query, options) {
7549
+ return this.request("GET", "/buyer-account/invoices", {
7550
+ query,
7551
+ ...options
7552
+ });
7553
+ }
7554
+ /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
7555
+ async listRefundRequests(query, options) {
7556
+ return this.request("GET", "/buyer-account/refund-requests", {
7557
+ query,
7558
+ ...options
7559
+ });
7560
+ }
7561
+ /**
7562
+ * The cases of the records the buyer has confirmed: the refund requests
7563
+ * they sent and the disputes about their purchases, newest first, with
7564
+ * where each stands, who acts next, the outcome and the recorded steps.
7565
+ */
7566
+ async listCases(query, options) {
7567
+ return this.request("GET", "/buyer-account/cases", {
7568
+ query,
7569
+ ...options
7570
+ });
7571
+ }
7572
+ /**
7573
+ * The conversations of the records the buyer has confirmed, the latest
7574
+ * message first. `unconfirmed_records` says when other records were left out.
7575
+ */
7576
+ async listConversations(query, options) {
7577
+ return this.request("GET", "/buyer-account/conversations", {
7578
+ query,
7579
+ ...options
7580
+ });
7581
+ }
7582
+ /**
7583
+ * The conversation of a confirmed record with one shop, and its newest
7584
+ * messages, oldest first; `before` pages back. `shop` is required here.
7585
+ */
7586
+ async listRecordMessages(record, query, options) {
7587
+ return this.request("GET", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7588
+ query,
7589
+ ...options
7590
+ });
7591
+ }
7592
+ /**
7593
+ * A message from a confirmed record to one of its shops. Sending again with
7594
+ * the same `client_message_id` returns the message the first send stored.
7595
+ */
7596
+ async sendRecordMessage(record, message, options) {
7597
+ return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7598
+ body: message,
7599
+ ...options
7600
+ });
7601
+ }
7602
+ /**
7603
+ * The buyer has read a record's conversation with one shop up to its last
7604
+ * accepted message. Answers with the buyer's conversations as they now stand.
7605
+ */
7606
+ async markRecordMessagesRead(record, query, options) {
7607
+ return this.request(
7608
+ "POST",
7609
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,
7610
+ {
7611
+ query,
7612
+ ...options
7613
+ }
7614
+ );
7615
+ }
7616
+ /**
7617
+ * What the buyer spent in a period: paid purchases summed per currency,
7618
+ * never converted, for the whole period, per day, week or month, per shop
7619
+ * and per kind of purchase.
7620
+ */
7621
+ async analytics(query, options) {
7622
+ return this.request("GET", "/buyer-account/analytics", {
7623
+ query,
7624
+ ...options
7625
+ });
7626
+ }
7431
7627
  /**
7432
7628
  * Confirm the record of a shop's customer portal link for the signed-in
7433
7629
  * buyer. The link's customer must carry the address the buyer signed in
@@ -7456,6 +7652,48 @@ var BuyerPortal = class {
7456
7652
  async getSession(options) {
7457
7653
  return this.request("GET", "/buyer-portal/session", { ...options });
7458
7654
  }
7655
+ /**
7656
+ * The buyer's cases at the shop: the refund requests they sent and the
7657
+ * disputes about their purchases, newest first, with where each stands, who
7658
+ * acts next, the outcome and the recorded steps.
7659
+ */
7660
+ async listCases(options) {
7661
+ return this.request("GET", "/buyer-portal/cases", { ...options });
7662
+ }
7663
+ /**
7664
+ * The buyer's conversations with the shop, the latest message first. A
7665
+ * portal link for the whole merchant lists one per shop and mode.
7666
+ */
7667
+ async listConversations(options) {
7668
+ return this.request("GET", "/buyer-portal/conversations", { ...options });
7669
+ }
7670
+ /**
7671
+ * The conversation with one shop and its newest messages, oldest first;
7672
+ * `before` pages back. A link issued for one shop may leave `shop` out.
7673
+ */
7674
+ async listMessages(query, options) {
7675
+ return this.request("GET", "/buyer-portal/messages", {
7676
+ query,
7677
+ ...options
7678
+ });
7679
+ }
7680
+ /**
7681
+ * A message to the shop. Sending again with the same `client_message_id`
7682
+ * returns the message the first send stored; a closed conversation refuses it.
7683
+ */
7684
+ async sendMessage(message, options) {
7685
+ return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
7686
+ }
7687
+ /**
7688
+ * The buyer has read the conversation with the shop up to its last accepted
7689
+ * message. Answers with the buyer's conversations as they now stand.
7690
+ */
7691
+ async markMessagesRead(query, options) {
7692
+ return this.request("POST", "/buyer-portal/messages/read", {
7693
+ query,
7694
+ ...options
7695
+ });
7696
+ }
7459
7697
  /** The buyer's contact and billing details, and what they may change. */
7460
7698
  async getProfile(options) {
7461
7699
  return this.request("GET", "/buyer-portal/profile", { ...options });
@@ -8583,6 +8821,7 @@ var Delopay = class {
8583
8821
  this.availabilityOverrides = new AvailabilityOverrides(request);
8584
8822
  this.sellToRestrictions = new SellToRestrictions(request);
8585
8823
  this.buyerBlocklist = new BuyerBlocklist(request);
8824
+ this.buyerConversations = new BuyerConversations(request);
8586
8825
  this.checkoutRecovery = new CheckoutRecovery(request);
8587
8826
  this.costRules = new CostRules(request);
8588
8827
  this.externalRecords = new ExternalRecords(request);
@@ -12869,6 +13108,9 @@ function presentationIconSrc(entry, color) {
12869
13108
  if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
12870
13109
  return null;
12871
13110
  }
13111
+ function isConfirmedChild(child) {
13112
+ return child.source !== "merchant";
13113
+ }
12872
13114
  function isSupportedPresentation(response) {
12873
13115
  return response.contract_version === PRESENTATION_CONTRACT_VERSION;
12874
13116
  }
@@ -15031,6 +15273,7 @@ var DelopayInternal = class extends Delopay {
15031
15273
  BRANDING_EXPORT_VERSION,
15032
15274
  BUILTIN_PAYMENT_ICON_KEYS,
15033
15275
  BuyerBlocklist,
15276
+ BuyerConversations,
15034
15277
  CARD_FIELD_CHROMES,
15035
15278
  CARD_FIELD_FONT_SIZES,
15036
15279
  CARD_FIELD_WEIGHTS,
@@ -15213,6 +15456,7 @@ var DelopayInternal = class extends Delopay {
15213
15456
  fontWeightValue,
15214
15457
  inputPadValue,
15215
15458
  isCheckboxChecked,
15459
+ isConfirmedChild,
15216
15460
  isDarkSurface,
15217
15461
  isDefaultBadgeSet,
15218
15462
  isHexColor,