@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.cjs CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
44
44
  BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
45
45
  BuyerBlocklist: () => BuyerBlocklist,
46
+ BuyerConversations: () => BuyerConversations,
46
47
  CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
47
48
  CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
48
49
  CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
@@ -212,6 +213,7 @@ __export(index_exports, {
212
213
  fontWeightValue: () => fontWeightValue,
213
214
  inputPadValue: () => inputPadValue,
214
215
  isCheckboxChecked: () => isCheckboxChecked,
216
+ isConfirmedChild: () => isConfirmedChild,
215
217
  isDarkSurface: () => isDarkSurface,
216
218
  isDefaultBadgeSet: () => isDefaultBadgeSet,
217
219
  isHexColor: () => isHexColor,
@@ -5827,6 +5829,73 @@ var BuyerBlocklist = class {
5827
5829
  }
5828
5830
  };
5829
5831
 
5832
+ // src/resources/buyerConversations.ts
5833
+ var BuyerConversations = class {
5834
+ constructor(request) {
5835
+ this.request = request;
5836
+ }
5837
+ /**
5838
+ * One page of the inbox, the latest message first, filtered by shop,
5839
+ * status, assignee, mode or buyer. `GET /buyer-conversations`
5840
+ */
5841
+ async list(params) {
5842
+ return this.request("GET", "/buyer-conversations", {
5843
+ query: params
5844
+ });
5845
+ }
5846
+ /**
5847
+ * Starts the conversation with a buyer at one shop, or adds to the one that
5848
+ * exists, with a first message. `POST /buyer-conversations`
5849
+ */
5850
+ async start(params) {
5851
+ return this.request("POST", "/buyer-conversations", { body: params });
5852
+ }
5853
+ /**
5854
+ * One conversation and its newest messages, oldest first; `before` pages
5855
+ * back. `GET /buyer-conversations/{id}`
5856
+ */
5857
+ async retrieve(id, params) {
5858
+ return this.request("GET", `/buyer-conversations/${encodeURIComponent(id)}`, {
5859
+ query: params
5860
+ });
5861
+ }
5862
+ /**
5863
+ * A team member's answer. A closed conversation refuses it.
5864
+ * `POST /buyer-conversations/{id}/messages`
5865
+ */
5866
+ async reply(id, params) {
5867
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/messages`, {
5868
+ body: params
5869
+ });
5870
+ }
5871
+ /**
5872
+ * The team has read the conversation up to its last accepted message.
5873
+ * `POST /buyer-conversations/{id}/read`
5874
+ */
5875
+ async markRead(id) {
5876
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/read`);
5877
+ }
5878
+ /**
5879
+ * Hands the conversation to a team member, to the caller with `me`, or to
5880
+ * nobody with `null`. `POST /buyer-conversations/{id}/assign`
5881
+ */
5882
+ async assign(id, params) {
5883
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/assign`, {
5884
+ body: params
5885
+ });
5886
+ }
5887
+ /**
5888
+ * Closes or reopens the conversation. Closing moves no money and decides
5889
+ * no case; it stops new messages until reopened.
5890
+ * `POST /buyer-conversations/{id}/status`
5891
+ */
5892
+ async setStatus(id, params) {
5893
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/status`, {
5894
+ body: params
5895
+ });
5896
+ }
5897
+ };
5898
+
5830
5899
  // src/resources/checkoutRecovery.ts
5831
5900
  var CheckoutRecovery = class {
5832
5901
  constructor(request) {
@@ -7055,6 +7124,31 @@ var CheckoutMethods = class {
7055
7124
  body
7056
7125
  });
7057
7126
  }
7127
+ /**
7128
+ * What DeloPay confirms beneath each item the shop can place: the card
7129
+ * networks the card form's accounts accept, and the methods or coins a
7130
+ * provider's page offers, per account, with source and freshness. A
7131
+ * provider that answers only per order reports `context_required` until
7132
+ * `currency` and `amount` are given. A layout item's `children` narrows
7133
+ * these lists and never adds to them.
7134
+ * `GET /checkout-methods/{profile_id}/children` (`/test/children` for Test)
7135
+ */
7136
+ async children(merchantId, profileId, params = {}) {
7137
+ const { environment, ...order } = params;
7138
+ const query = { merchant_id: merchantId, ...order };
7139
+ if (environment === "test") {
7140
+ return this.request(
7141
+ "GET",
7142
+ `/checkout-methods/${encodeURIComponent(profileId)}/test/children`,
7143
+ {
7144
+ query
7145
+ }
7146
+ );
7147
+ }
7148
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/children`, {
7149
+ query
7150
+ });
7151
+ }
7058
7152
  /**
7059
7153
  * Delete the stored layout; the shop is back on the derived one.
7060
7154
  * `DELETE /checkout-methods/{profile_id}`
@@ -7412,6 +7506,108 @@ var BuyerAccount = class {
7412
7506
  ...options
7413
7507
  });
7414
7508
  }
7509
+ /**
7510
+ * The shops the buyer has purchases at, once each and by name. Pass a
7511
+ * shop's `shop` to `listPurchases` to list only that shop's purchases.
7512
+ */
7513
+ async listShops(options) {
7514
+ return this.request("GET", "/buyer-account/shops", { ...options });
7515
+ }
7516
+ /**
7517
+ * The buyer's subscriptions across shops, newest first. A record the buyer
7518
+ * has not confirmed shows what a receipt carries, without its period or
7519
+ * cancellation.
7520
+ */
7521
+ async listSubscriptions(query, options) {
7522
+ return this.request("GET", "/buyer-account/subscriptions", {
7523
+ query,
7524
+ ...options
7525
+ });
7526
+ }
7527
+ /**
7528
+ * The issued invoices of the records the buyer has confirmed through a
7529
+ * shop's own link, newest first. `unconfirmed_records` says when records
7530
+ * were left out.
7531
+ */
7532
+ async listInvoices(query, options) {
7533
+ return this.request("GET", "/buyer-account/invoices", {
7534
+ query,
7535
+ ...options
7536
+ });
7537
+ }
7538
+ /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
7539
+ async listRefundRequests(query, options) {
7540
+ return this.request("GET", "/buyer-account/refund-requests", {
7541
+ query,
7542
+ ...options
7543
+ });
7544
+ }
7545
+ /**
7546
+ * The cases of the records the buyer has confirmed: the refund requests
7547
+ * they sent and the disputes about their purchases, newest first, with
7548
+ * where each stands, who acts next, the outcome and the recorded steps.
7549
+ */
7550
+ async listCases(query, options) {
7551
+ return this.request("GET", "/buyer-account/cases", {
7552
+ query,
7553
+ ...options
7554
+ });
7555
+ }
7556
+ /**
7557
+ * The conversations of the records the buyer has confirmed, the latest
7558
+ * message first. `unconfirmed_records` says when other records were left out.
7559
+ */
7560
+ async listConversations(query, options) {
7561
+ return this.request("GET", "/buyer-account/conversations", {
7562
+ query,
7563
+ ...options
7564
+ });
7565
+ }
7566
+ /**
7567
+ * The conversation of a confirmed record with one shop, and its newest
7568
+ * messages, oldest first; `before` pages back. `shop` is required here.
7569
+ */
7570
+ async listRecordMessages(record, query, options) {
7571
+ return this.request("GET", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7572
+ query,
7573
+ ...options
7574
+ });
7575
+ }
7576
+ /**
7577
+ * A message from a confirmed record to one of its shops. Sending again with
7578
+ * the same `client_message_id` returns the message the first send stored.
7579
+ */
7580
+ async sendRecordMessage(record, message, options) {
7581
+ return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7582
+ body: message,
7583
+ ...options
7584
+ });
7585
+ }
7586
+ /**
7587
+ * The buyer has read a record's conversation with one shop up to its last
7588
+ * accepted message. Answers with the buyer's conversations as they now stand.
7589
+ */
7590
+ async markRecordMessagesRead(record, query, options) {
7591
+ return this.request(
7592
+ "POST",
7593
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,
7594
+ {
7595
+ query,
7596
+ ...options
7597
+ }
7598
+ );
7599
+ }
7600
+ /**
7601
+ * What the buyer spent in a period: paid purchases summed per currency,
7602
+ * never converted, for the whole period, per day, week or month, per shop
7603
+ * and per kind of purchase.
7604
+ */
7605
+ async analytics(query, options) {
7606
+ return this.request("GET", "/buyer-account/analytics", {
7607
+ query,
7608
+ ...options
7609
+ });
7610
+ }
7415
7611
  /**
7416
7612
  * Confirm the record of a shop's customer portal link for the signed-in
7417
7613
  * buyer. The link's customer must carry the address the buyer signed in
@@ -7440,6 +7636,48 @@ var BuyerPortal = class {
7440
7636
  async getSession(options) {
7441
7637
  return this.request("GET", "/buyer-portal/session", { ...options });
7442
7638
  }
7639
+ /**
7640
+ * The buyer's cases at the shop: the refund requests they sent and the
7641
+ * disputes about their purchases, newest first, with where each stands, who
7642
+ * acts next, the outcome and the recorded steps.
7643
+ */
7644
+ async listCases(options) {
7645
+ return this.request("GET", "/buyer-portal/cases", { ...options });
7646
+ }
7647
+ /**
7648
+ * The buyer's conversations with the shop, the latest message first. A
7649
+ * portal link for the whole merchant lists one per shop and mode.
7650
+ */
7651
+ async listConversations(options) {
7652
+ return this.request("GET", "/buyer-portal/conversations", { ...options });
7653
+ }
7654
+ /**
7655
+ * The conversation with one shop and its newest messages, oldest first;
7656
+ * `before` pages back. A link issued for one shop may leave `shop` out.
7657
+ */
7658
+ async listMessages(query, options) {
7659
+ return this.request("GET", "/buyer-portal/messages", {
7660
+ query,
7661
+ ...options
7662
+ });
7663
+ }
7664
+ /**
7665
+ * A message to the shop. Sending again with the same `client_message_id`
7666
+ * returns the message the first send stored; a closed conversation refuses it.
7667
+ */
7668
+ async sendMessage(message, options) {
7669
+ return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
7670
+ }
7671
+ /**
7672
+ * The buyer has read the conversation with the shop up to its last accepted
7673
+ * message. Answers with the buyer's conversations as they now stand.
7674
+ */
7675
+ async markMessagesRead(query, options) {
7676
+ return this.request("POST", "/buyer-portal/messages/read", {
7677
+ query,
7678
+ ...options
7679
+ });
7680
+ }
7443
7681
  /** The buyer's contact and billing details, and what they may change. */
7444
7682
  async getProfile(options) {
7445
7683
  return this.request("GET", "/buyer-portal/profile", { ...options });
@@ -8567,6 +8805,7 @@ var Delopay = class {
8567
8805
  this.availabilityOverrides = new AvailabilityOverrides(request);
8568
8806
  this.sellToRestrictions = new SellToRestrictions(request);
8569
8807
  this.buyerBlocklist = new BuyerBlocklist(request);
8808
+ this.buyerConversations = new BuyerConversations(request);
8570
8809
  this.checkoutRecovery = new CheckoutRecovery(request);
8571
8810
  this.costRules = new CostRules(request);
8572
8811
  this.externalRecords = new ExternalRecords(request);
@@ -12853,6 +13092,9 @@ function presentationIconSrc(entry, color) {
12853
13092
  if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
12854
13093
  return null;
12855
13094
  }
13095
+ function isConfirmedChild(child) {
13096
+ return child.source !== "merchant";
13097
+ }
12856
13098
  function isSupportedPresentation(response) {
12857
13099
  return response.contract_version === PRESENTATION_CONTRACT_VERSION;
12858
13100
  }
@@ -13383,6 +13625,7 @@ var encodeNativePanes = encodePanes;
13383
13625
  BRANDING_EXPORT_VERSION,
13384
13626
  BUILTIN_PAYMENT_ICON_KEYS,
13385
13627
  BuyerBlocklist,
13628
+ BuyerConversations,
13386
13629
  CARD_FIELD_CHROMES,
13387
13630
  CARD_FIELD_FONT_SIZES,
13388
13631
  CARD_FIELD_WEIGHTS,
@@ -13552,6 +13795,7 @@ var encodeNativePanes = encodePanes;
13552
13795
  fontWeightValue,
13553
13796
  inputPadValue,
13554
13797
  isCheckboxChecked,
13798
+ isConfirmedChild,
13555
13799
  isDarkSurface,
13556
13800
  isDefaultBadgeSet,
13557
13801
  isHexColor,