@curless/sinocare-demo 0.66.0 → 0.68.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
@@ -245,12 +245,24 @@ var productsView = (products) => ({
245
245
  count: products.length,
246
246
  products: [...products]
247
247
  });
248
+ var TERMINAL = /* @__PURE__ */ new Set(["captured", "settled", "reconciled", "refunded", "failed", "canceled"]);
248
249
  var ordersView = (orders) => ({
249
250
  view: "orders",
250
251
  orders: orders.map(
251
252
  (o) => ({
252
253
  orderId: o.id,
253
- status: o.refundRequest ? o.refundRequest.status === "approved" ? "refund approved" : "refund requested" : o.status,
254
+ status: o.refundRequest ? o.refundRequest.status === "approved" ? "refund approved" : "refund requested" : (
255
+ // ⚠️ A UnionPay order is the one case where a still-uncaptured order
256
+ // is not "nothing happened yet". The cardholder confirmed and a
257
+ // one-time credential exists; the charge belongs to the merchant's
258
+ // own acquirer, which is why the PI — and so `o.status` — never
259
+ // moves. Left as the bare pending status, the person sees an unpaid
260
+ // order and no reason, having just confirmed a payment.
261
+ //
262
+ // ⚠️ Not "paid", and never will be from here. The wording carries
263
+ // both halves, which is the same rule the tool descriptions follow.
264
+ o.metadata?.uaag?.credentialAt && !TERMINAL.has(o.status) ? "credential issued \xB7 merchant to charge" : o.status
265
+ ),
254
266
  refundPending: Boolean(o.refundRequest),
255
267
  product: o.lineItems?.map((li) => `${li.name} \xD7${li.quantity}`).join(", ") ?? "",
256
268
  total: formatMinor(Number(o.amount ?? 0), String(o.currency ?? "EUR")),
@@ -381,6 +393,14 @@ var startUaagCheckout = async (deps, args) => {
381
393
  awaitingPayment: true,
382
394
  message: "\u94F6\u8054\u6536\u94F6\u53F0\u5DF2\u5F00\u597D\u3002\u9875\u9762\u4E0A\u5199\u7684\u662F\u300C\u786E\u8BA4\u652F\u4ED8\u300D\u5E76\u663E\u793A\u91D1\u989D \u2014\u2014 \u4F60\u786E\u8BA4\u7684\u662F\u8FD9\u7B14\u8D2D\u4E70\u672C\u8EAB\uFF0C\u786E\u8BA4\u540E\u94F6\u8054\u628A\u4E00\u6B21\u6027\u652F\u4ED8\u51ED\u8BC1\u56DE\u8C03\u7ED9\u6211\u4EEC\u3002\u26A0\uFE0F \u5361\u4E0D\u4F1A\u5728\u90A3\u4E00\u523B\u88AB\u6263\u6B3E\uFF1A\u6263\u6B3E\u8981\u5546\u6237\u62FF\u8FD9\u5F20\u51ED\u8BC1\u8D70\u81EA\u5DF1\u7684\u94F6\u8054\u6536\u5355\uFF0C\u4E09\u8BFA\u6CA1\u6709\uFF0C\u6240\u4EE5\u6F14\u793A\u5230\u51ED\u8BC1\u4E3A\u6B62\u3002",
383
395
  checkoutUrl: upi.checkoutUrl ?? null,
396
+ // ⚠️ The card's own field names. `payUrl` is what it renders a "go pay"
397
+ // button from, and `uaagPaymentIntentId` is what it polls — deliberately
398
+ // NOT `sessionId`/`merchantId`, which would send it to the hosted poller
399
+ // that asks whether the ACP session was PAID. A UnionPay checkout never
400
+ // makes it paid, so that poller would spin for ten minutes and then time
401
+ // out on a flow that had, in its own terms, succeeded.
402
+ payUrl: upi.checkoutUrl ?? null,
403
+ uaagPaymentIntentId: session.sessionId,
384
404
  paymentIntentId: session.sessionId,
385
405
  merchantId: session.merchantId,
386
406
  card: { id: card.id, last4: card.panLastFour },
@@ -831,8 +851,8 @@ var SINOCARE_GROUPS = [
831
851
  rows: [
832
852
  {
833
853
  title: "\u94F6\u8054\u5361(UAAG)",
834
- sub: "\u7528\u4F60\u94B1\u5305\u91CC\u7ED1\u7684\u94F6\u8054\u5361 \xB7 \u94F6\u8054\u9875\u9762\u8BA4\u8BC1 \xB7 \u6F14\u793A\u6B62\u4E8E\u51ED\u8BC1\u7B7E\u53D1,\u4E0D\u6263\u6B3E",
835
- actions: [{ label: "\u5728\u804A\u5929\u91CC\u4ED8\u6B3E", tool: "start_sinocare_uaag_handoff", chat: true }]
854
+ sub: "\u7528\u4F60\u94B1\u5305\u91CC\u7ED1\u7684\u94F6\u8054\u5361 \xB7 \u5728\u94F6\u8054\u81EA\u5DF1\u7684\u9875\u9762\u4E0A\u786E\u8BA4",
855
+ actions: [{ label: "\u7528\u94F6\u8054\u4ED8\u6B3E", tool: "start_sinocare_uaag_handoff" }]
836
856
  }
837
857
  ]
838
858
  },
@@ -938,7 +958,7 @@ var pickView = (pick, r) => checkoutView({
938
958
  }
939
959
  });
940
960
  var CHECKOUT_URI_PREFIX = "ui://sinocare/";
941
- var CHECKOUT_URI = `${CHECKOUT_URI_PREFIX}card-v33.html`;
961
+ var CHECKOUT_URI = `${CHECKOUT_URI_PREFIX}card-v34.html`;
942
962
  var CHECKOUT_UI_META = uiMeta(CHECKOUT_URI);
943
963
  var WIDGET_META = widgetMeta();
944
964
  var SHARED_TOOLS = storefrontTools({