@burdenoff/microfe-healthybowl 2026.919.1 → 2026.919.2

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.
@@ -1,59 +1,17 @@
1
1
  import { loadRazorpayCheckout as e } from "./useOrderPayments.js";
2
- import { useCallback as t, useMemo as n } from "react";
3
- import { gql as r } from "@apollo/client";
4
- import { useMutation as i } from "@apollo/client/react";
2
+ import { useCallback as t } from "react";
5
3
  //#region src/healthybowl/hooks/useConsultationPayments.ts
6
- var a = r`
7
- mutation CheckoutHealthyBowlConsultation($consultationId: ID!, $context: ContextInput!) {
8
- checkoutHealthyBowlConsultation(consultationId: $consultationId, context: $context) {
9
- consultationId
10
- billingOrderId
11
- provider
12
- providerOrderId
13
- razorpayKeyId
14
- clientSecret
15
- subtotal
16
- taxAmount
17
- total
18
- currency
19
- }
20
- }
21
- `, o = r`
22
- mutation SyncHealthyBowlConsultationPayment($consultationId: ID!, $context: ContextInput!) {
23
- syncHealthyBowlConsultationPayment(consultationId: $consultationId, context: $context) {
24
- id
25
- status
26
- paymentStatus
27
- paymentProvider
28
- paymentReference
29
- paidAmount
30
- paidAt
31
- }
32
- }
33
- `;
34
- function s() {
35
- let r = n(() => ({}), []), [s] = i(a), [c] = i(o);
4
+ function n() {
5
+ let n = t((e) => {
6
+ throw Error(`${e} is unavailable: BOFF-6030's consultation-payment backend is not deployed. Land that slice and restore the operations before calling this.`);
7
+ }, []);
36
8
  return {
37
- checkoutConsultation: t(async (e) => {
38
- let t = (await s({ variables: {
39
- consultationId: e,
40
- context: r
41
- } })).data?.checkoutHealthyBowlConsultation;
42
- if (!t) throw Error("Checkout did not return a payment session");
43
- return t;
44
- }, [s, r]),
45
- syncConsultationPayment: t(async (e) => {
46
- let t = (await c({ variables: {
47
- consultationId: e,
48
- context: r
49
- } })).data?.syncHealthyBowlConsultationPayment;
50
- if (!t) throw Error("Payment sync did not return the consultation");
51
- return t;
52
- }, [r, c]),
9
+ checkoutConsultation: t(async (e) => n("checkoutConsultation"), [n]),
10
+ syncConsultationPayment: t(async (e) => n("syncConsultationPayment"), [n]),
53
11
  loadRazorpay: e
54
12
  };
55
13
  }
56
14
  //#endregion
57
- export { s as useConsultationPayments };
15
+ export { n as useConsultationPayments };
58
16
 
59
17
  //# sourceMappingURL=useConsultationPayments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useConsultationPayments.js","names":[],"sources":["../../../src/healthybowl/hooks/useConsultationPayments.ts"],"sourcesContent":["/**\n * Real expert-consultation payments (BOFF-6030, slice B).\n *\n * The client starts checkout and asks HealthyBowl to settle afterwards. HealthyBowl re-reads the\n * authoritative Payment from global-billing, so this MFE never decides that money arrived or handles\n * card data. The documents stay inline because the committed workspace SDL snapshot predates these\n * operations; adding them under `src/operations/wspace` would make codegen validate them too early.\n */\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport { useCallback, useMemo } from 'react';\nimport type { Consultation } from '../types';\nimport { loadRazorpayCheckout } from './useOrderPayments';\n\n/** Everything the client needs to open the payment provider's checkout for one consultation. */\nexport interface ConsultationCheckout {\n consultationId: string;\n billingOrderId: string;\n /** RAZORPAY / STRIPE — selected by platform billing. */\n provider: string;\n /** Razorpay `order_xxx`; absent when billing routes to another provider. */\n providerOrderId?: string | null;\n /** Publishable Razorpay key returned at runtime by billing, never hard-coded. */\n razorpayKeyId?: string | null;\n /** Stripe client secret; this MFE does not implement the Stripe checkout path yet. */\n clientSecret?: string | null;\n subtotal: number;\n taxAmount: number;\n total: number;\n currency: string;\n}\n\n/** Payment details mirrored by HealthyBowl only after it settles against platform billing. */\nexport type ConsultationPayment = Pick<\n Consultation,\n 'id' | 'status' | 'paymentStatus' | 'paymentProvider' | 'paymentReference' | 'paidAmount' | 'paidAt'\n>;\n\nconst CHECKOUT_CONSULTATION = gql`\n mutation CheckoutHealthyBowlConsultation($consultationId: ID!, $context: ContextInput!) {\n checkoutHealthyBowlConsultation(consultationId: $consultationId, context: $context) {\n consultationId\n billingOrderId\n provider\n providerOrderId\n razorpayKeyId\n clientSecret\n subtotal\n taxAmount\n total\n currency\n }\n }\n`;\n\nconst SYNC_CONSULTATION_PAYMENT = gql`\n mutation SyncHealthyBowlConsultationPayment($consultationId: ID!, $context: ContextInput!) {\n syncHealthyBowlConsultationPayment(consultationId: $consultationId, context: $context) {\n id\n status\n paymentStatus\n paymentProvider\n paymentReference\n paidAmount\n paidAt\n }\n }\n`;\n\ninterface CheckoutConsultationData {\n checkoutHealthyBowlConsultation: ConsultationCheckout;\n}\n\ninterface SyncConsultationPaymentData {\n syncHealthyBowlConsultationPayment: ConsultationPayment;\n}\n\ninterface ConsultationCheckoutVariables {\n consultationId: string;\n context: Record<string, never>;\n}\n\ninterface SyncConsultationPaymentVariables {\n consultationId: string;\n context: Record<string, never>;\n}\n\n/**\n * Starts idempotent platform-billing checkout sessions and settles their authoritative result.\n * `loadRazorpay` deliberately delegates to the shared lazy script loader, so marketplace and\n * consultation checkout inject at most one provider script per page.\n */\nexport function useConsultationPayments() {\n // Wspace identity is gateway-authoritative; this required GraphQL input intentionally carries no\n // client-held workspace id.\n const context = useMemo<Record<string, never>>(() => ({}), []);\n const [checkoutMutation] = useMutation<CheckoutConsultationData, ConsultationCheckoutVariables>(\n CHECKOUT_CONSULTATION\n );\n const [syncMutation] = useMutation<SyncConsultationPaymentData, SyncConsultationPaymentVariables>(\n SYNC_CONSULTATION_PAYMENT\n );\n\n const checkoutConsultation = useCallback(\n async (consultationId: string): Promise<ConsultationCheckout> => {\n const result = await checkoutMutation({ variables: { consultationId, context } });\n const checkout = result.data?.checkoutHealthyBowlConsultation;\n if (!checkout) throw new Error('Checkout did not return a payment session');\n return checkout;\n },\n [checkoutMutation, context]\n );\n\n const syncConsultationPayment = useCallback(\n async (consultationId: string): Promise<ConsultationPayment> => {\n const result = await syncMutation({ variables: { consultationId, context } });\n const consultation = result.data?.syncHealthyBowlConsultationPayment;\n if (!consultation) throw new Error('Payment sync did not return the consultation');\n return consultation;\n },\n [context, syncMutation]\n );\n\n const loadRazorpay = loadRazorpayCheckout;\n\n return { checkoutConsultation, syncConsultationPayment, loadRazorpay };\n}\n"],"mappings":";;;;;AAsCA,IAAM,IAAwB,CAAG;;;;;;;;;;;;;;;GAiB3B,IAA4B,CAAG;;;;;;;;;;;;;AAqCrC,SAAgB,IAA0B;CAGxC,IAAM,IAAU,SAAsC,CAAC,IAAI,CAAC,CAAC,GACvD,CAAC,KAAoB,EACzB,CACF,GACM,CAAC,KAAgB,EACrB,CACF;CAwBA,OAAO;EAAE,sBAtBoB,EAC3B,OAAO,MAA0D;GAE/D,IAAM,KAAW,MADI,EAAiB,EAAE,WAAW;IAAE;IAAgB;GAAQ,EAAE,CAAC,GACxD,MAAM;GAC9B,IAAI,CAAC,GAAU,MAAU,MAAM,2CAA2C;GAC1E,OAAO;EACT,GACA,CAAC,GAAkB,CAAO,CAenB;EAAsB,yBAZC,EAC9B,OAAO,MAAyD;GAE9D,IAAM,KAAe,MADA,EAAa,EAAE,WAAW;IAAE;IAAgB;GAAQ,EAAE,CAAC,GAChD,MAAM;GAClC,IAAI,CAAC,GAAc,MAAU,MAAM,8CAA8C;GACjF,OAAO;EACT,GACA,CAAC,GAAS,CAAY,CAKO;EAAyB,cAAA;CAAa;AACvE"}
1
+ {"version":3,"file":"useConsultationPayments.js","names":[],"sources":["../../../src/healthybowl/hooks/useConsultationPayments.ts"],"sourcesContent":["/**\n * Expert-consultation payments (BOFF-6030, slice B) — ★ DISABLED, BACKEND NOT SHIPPED.\n *\n * The design is unchanged and correct: the client starts checkout and asks HealthyBowl to settle\n * afterwards, HealthyBowl re-reads the authoritative Payment from global-billing, and this MFE never\n * decides that money arrived or touches card data.\n *\n * ★★ WHAT IS WRONG IS THAT THE BACKEND HALF NEVER MERGED. `checkoutHealthyBowlConsultation` and\n * `syncHealthyBowlConsultationPayment` do not exist on the composed supergraph, on any subgraph, or\n * on `wspace-healthybowl-svc` main; PRs #248 and #249 are closed unmerged. This UI nonetheless\n * landed on this repo's main on 2026-09-02 (#328), so main has been unshippable ever since — proven\n * on 2026-09-18 when the BOFF-7341 repin took six prod pages down for 38 minutes and was rolled back.\n *\n * ★★★ AND THE ORIGINAL HEADER EXPLAINED HOW IT GOT PAST THE GUARD. It read: \"The documents stay\n * inline because the committed workspace SDL snapshot predates these operations; adding them under\n * `src/operations/wspace` would make codegen validate them too early.\" That is a description of\n * routing around the one check that would have caught this. Codegen was not validating too early —\n * it was validating correctly, against a schema that genuinely lacked the fields. Keeping the\n * documents where codegen could not see them is why a query against a nonexistent backend reached\n * main and then production.\n *\n * The two mutation DOCUMENTS are therefore deleted rather than left inline: an invalid operation in\n * the bundle is a loaded gun, and `scripts/schema-preflight.md` should be able to report zero\n * blockers before a publish. The hook keeps its shape so its caller still compiles, and both entry\n * points now reject with an explicit reason instead of sending an operation the gateway will refuse.\n *\n * TO RESTORE: land BOFF-6030's backend slice (migration, deploy, Hive production publish, wait out\n * the supergraph CDN lag), then revert the commit that added this comment and put the operations\n * under `src/operations/wspace` so CODEGEN VALIDATES THEM. Re-run the pre-flight before publishing.\n */\nimport { useCallback } from 'react';\nimport type { Consultation } from '../types';\nimport { loadRazorpayCheckout } from './useOrderPayments';\n\n/** Everything the client needs to open the payment provider's checkout for one consultation. */\nexport interface ConsultationCheckout {\n consultationId: string;\n billingOrderId: string;\n /** RAZORPAY / STRIPE — selected by platform billing. */\n provider: string;\n /** Razorpay `order_xxx`; absent when billing routes to another provider. */\n providerOrderId?: string | null;\n /** Publishable Razorpay key returned at runtime by billing, never hard-coded. */\n razorpayKeyId?: string | null;\n /** Stripe client secret; this MFE does not implement the Stripe checkout path yet. */\n clientSecret?: string | null;\n subtotal: number;\n taxAmount: number;\n total: number;\n currency: string;\n}\n\n/** Payment details mirrored by HealthyBowl only after it settles against platform billing. */\nexport type ConsultationPayment = Pick<\n Consultation,\n 'id' | 'status' | 'paymentStatus' | 'paymentProvider' | 'paymentReference' | 'paidAmount' | 'paidAt'\n>;\n\n/**\n * Keeps the call shape its caller expects while the backend is absent.\n *\n * `loadRazorpay` still delegates to the shared lazy script loader (so marketplace and consultation\n * checkout would inject at most one provider script per page) — it is harmless and left intact,\n * because the loader is what a restored checkout needs and it touches no missing schema.\n */\nexport function useConsultationPayments() {\n const unavailable = useCallback((operation: string): never => {\n // Explicit and loud. The UI does not offer these paths while the fields are unselected (the\n // Pay-now button is gated on `paymentStatus === 'PENDING'`, which is now always undefined), so\n // reaching here means a new caller was added without the backend — exactly the mistake that\n // produced the 2026-09-18 rollback. Better a clear throw at the call site than a\n // GRAPHQL_VALIDATION_FAILED toast in front of a farmer.\n throw new Error(\n `${operation} is unavailable: BOFF-6030's consultation-payment backend is not deployed. ` +\n 'Land that slice and restore the operations before calling this.'\n );\n }, []);\n\n const checkoutConsultation = useCallback(\n async (_consultationId: string): Promise<ConsultationCheckout> => unavailable('checkoutConsultation'),\n [unavailable]\n );\n\n const syncConsultationPayment = useCallback(\n async (_consultationId: string): Promise<ConsultationPayment> => unavailable('syncConsultationPayment'),\n [unavailable]\n );\n\n const loadRazorpay = loadRazorpayCheckout;\n\n return { checkoutConsultation, syncConsultationPayment, loadRazorpay };\n}\n"],"mappings":";;;AAiEA,SAAgB,IAA0B;CACxC,IAAM,IAAc,GAAa,MAA6B;EAM5D,MAAU,MACR,GAAG,EAAU,2IAEf;CACF,GAAG,CAAC,CAAC;CAcL,OAAO;EAAE,sBAZoB,EAC3B,OAAO,MAA2D,EAAY,sBAAsB,GACpG,CAAC,CAAW,CAUL;EAAsB,yBAPC,EAC9B,OAAO,MAA0D,EAAY,yBAAyB,GACtG,CAAC,CAAW,CAKiB;EAAyB,cAAA;CAAa;AACvE"}
@@ -292,11 +292,12 @@ var Dt = a`
292
292
  notes
293
293
  fee
294
294
  status
295
- paymentStatus
296
- paymentProvider
297
- paymentReference
298
- paidAmount
299
- paidAt
295
+ # NO payment fields. BOFF-6030 shipped this UI to main on 2026-09-02 (#328) without its
296
+ # backend half: type Consultation in wspace-healthybowl-svc has no paymentStatus /
297
+ # paymentProvider / paymentReference / paidAmount / paidAt, and PRs #248 and #249 are closed
298
+ # unmerged. A validation error rejects the WHOLE query, so selecting them took six prod pages
299
+ # down for 38 minutes on 2026-09-18 and forced the BOFF-7341 repin to be rolled back.
300
+ # Restore them together with the backend fields, not before.
300
301
  createdAt
301
302
  }
302
303
  }
@@ -313,11 +314,12 @@ var Dt = a`
313
314
  notes
314
315
  fee
315
316
  status
316
- paymentStatus
317
- paymentProvider
318
- paymentReference
319
- paidAmount
320
- paidAt
317
+ # NO payment fields. BOFF-6030 shipped this UI to main on 2026-09-02 (#328) without its
318
+ # backend half: type Consultation in wspace-healthybowl-svc has no paymentStatus /
319
+ # paymentProvider / paymentReference / paidAmount / paidAt, and PRs #248 and #249 are closed
320
+ # unmerged. A validation error rejects the WHOLE query, so selecting them took six prod pages
321
+ # down for 38 minutes on 2026-09-18 and forced the BOFF-7341 repin to be rolled back.
322
+ # Restore them together with the backend fields, not before.
321
323
  createdAt
322
324
  }
323
325
  }
@@ -334,11 +336,12 @@ var Dt = a`
334
336
  notes
335
337
  fee
336
338
  status
337
- paymentStatus
338
- paymentProvider
339
- paymentReference
340
- paidAmount
341
- paidAt
339
+ # NO payment fields. BOFF-6030 shipped this UI to main on 2026-09-02 (#328) without its
340
+ # backend half: type Consultation in wspace-healthybowl-svc has no paymentStatus /
341
+ # paymentProvider / paymentReference / paidAmount / paidAt, and PRs #248 and #249 are closed
342
+ # unmerged. A validation error rejects the WHOLE query, so selecting them took six prod pages
343
+ # down for 38 minutes on 2026-09-18 and forced the BOFF-7341 repin to be rolled back.
344
+ # Restore them together with the backend fields, not before.
342
345
  createdAt
343
346
  }
344
347
  }