@mohasinac/appkit 4.62.0 → 4.62.1

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.
Files changed (204) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/server/features/checkout/actions.d.ts +80 -0
  3. package/dist/_internal/server/features/checkout/actions.js +542 -26
  4. package/dist/_internal/server/features/invoicing/allocate.d.ts +63 -0
  5. package/dist/_internal/server/features/invoicing/allocate.js +162 -0
  6. package/dist/_internal/server/features/invoicing/credit-note.d.ts +57 -0
  7. package/dist/_internal/server/features/invoicing/credit-note.js +126 -0
  8. package/dist/_internal/server/features/invoicing/gstr1.d.ts +74 -0
  9. package/dist/_internal/server/features/invoicing/gstr1.js +251 -0
  10. package/dist/_internal/server/features/invoicing/issue.d.ts +96 -0
  11. package/dist/_internal/server/features/invoicing/issue.js +202 -0
  12. package/dist/_internal/server/features/orders/actions.d.ts +8 -1
  13. package/dist/_internal/server/features/orders/actions.js +81 -8
  14. package/dist/_internal/server/features/orders/adapters.js +33 -0
  15. package/dist/_internal/server/features/orders/cancellation-refund.d.ts +15 -9
  16. package/dist/_internal/server/features/orders/cancellation-refund.js +15 -9
  17. package/dist/_internal/server/features/points/award.js +46 -4
  18. package/dist/_internal/server/features/refunds/actions.js +26 -0
  19. package/dist/_internal/server/features/shipping/courier-block.d.ts +69 -0
  20. package/dist/_internal/server/features/shipping/courier-block.js +239 -0
  21. package/dist/_internal/server/features/site-settings/adapters.d.ts +1 -1
  22. package/dist/_internal/server/features/site-settings/adapters.js +15 -0
  23. package/dist/_internal/server/features/stores/adapters.d.ts +2 -2
  24. package/dist/_internal/server/features/stores/adapters.js +51 -0
  25. package/dist/_internal/server/functions/scheduled.js +38 -1
  26. package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +9 -2
  27. package/dist/_internal/server/jobs/core/dailyStatusDigest.d.ts +4 -0
  28. package/dist/_internal/server/jobs/core/dailyStatusDigest.js +19 -2
  29. package/dist/_internal/server/jobs/core/index.d.ts +2 -1
  30. package/dist/_internal/server/jobs/core/index.js +2 -1
  31. package/dist/_internal/server/jobs/core/onJobCreated.d.ts +30 -7
  32. package/dist/_internal/server/jobs/core/onJobCreated.js +78 -45
  33. package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +7 -0
  34. package/dist/_internal/server/jobs/core/onOrderStatusChange.js +62 -0
  35. package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +33 -0
  36. package/dist/_internal/server/jobs/core/runJobOnce.d.ts +48 -0
  37. package/dist/_internal/server/jobs/core/runJobOnce.js +195 -0
  38. package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +10 -2
  39. package/dist/_internal/server/jobs/handlers/onOrderStatusChange.js +17 -0
  40. package/dist/_internal/server/notifications/channel-health.d.ts +26 -3
  41. package/dist/_internal/shared/actions/action-registry.js +28 -0
  42. package/dist/_internal/shared/checkout/coupon-discount.d.ts +43 -1
  43. package/dist/_internal/shared/checkout/coupon-discount.js +26 -1
  44. package/dist/_internal/shared/checkout/order-math.d.ts +145 -0
  45. package/dist/_internal/shared/checkout/order-math.js +173 -0
  46. package/dist/_internal/shared/checkout/refundable-base.d.ts +25 -0
  47. package/dist/_internal/shared/checkout/refundable-base.js +13 -1
  48. package/dist/_internal/shared/checkout/split.d.ts +87 -0
  49. package/dist/_internal/shared/checkout/split.js +100 -0
  50. package/dist/_internal/shared/content/disclaimers.d.ts +88 -0
  51. package/dist/_internal/shared/content/disclaimers.js +217 -0
  52. package/dist/_internal/shared/content/published-values.d.ts +88 -0
  53. package/dist/_internal/shared/content/published-values.js +198 -0
  54. package/dist/_internal/shared/features/admin/integrations.d.ts +109 -0
  55. package/dist/_internal/shared/features/admin/integrations.js +253 -0
  56. package/dist/_internal/shared/features/orders/dispute-reasons.d.ts +113 -0
  57. package/dist/_internal/shared/features/orders/dispute-reasons.js +181 -0
  58. package/dist/_internal/shared/features/orders/refund-copy.d.ts +1 -1
  59. package/dist/_internal/shared/features/orders/refund-copy.js +18 -1
  60. package/dist/_internal/shared/features/points/accepts.d.ts +36 -0
  61. package/dist/_internal/shared/features/points/accepts.js +43 -0
  62. package/dist/_internal/shared/features/shipping/shared-purchase.d.ts +91 -0
  63. package/dist/_internal/shared/features/shipping/shared-purchase.js +108 -0
  64. package/dist/_internal/shared/features/site-settings/types.d.ts +11 -0
  65. package/dist/_internal/shared/fees/calculator.d.ts +33 -1
  66. package/dist/_internal/shared/fees/calculator.js +32 -2
  67. package/dist/client.d.ts +11 -0
  68. package/dist/client.js +30 -0
  69. package/dist/constants/api-endpoints.d.ts +42 -0
  70. package/dist/constants/api-endpoints.js +14 -0
  71. package/dist/constants/field-names.d.ts +1 -0
  72. package/dist/constants/field-names.js +5 -0
  73. package/dist/contracts/index.d.ts +1 -1
  74. package/dist/contracts/shipping.d.ts +45 -0
  75. package/dist/contracts/shipping.js +15 -0
  76. package/dist/features/about/components/AboutView.js +1 -1
  77. package/dist/features/account/components/BuyerAuctionsGuideView.js +4 -1
  78. package/dist/features/account/components/UserOrdersView.js +19 -33
  79. package/dist/features/admin/components/AdminCouponEditorView.js +17 -0
  80. package/dist/features/admin/components/AdminInvoicingView.d.ts +2 -0
  81. package/dist/features/admin/components/AdminInvoicingView.js +65 -0
  82. package/dist/features/admin/components/AdminOrderEditorView.d.ts +18 -1
  83. package/dist/features/admin/components/AdminOrderEditorView.js +11 -2
  84. package/dist/features/admin/components/AdminOrdersGuideView.js +23 -2
  85. package/dist/features/admin/components/AdminOrdersView.js +67 -5
  86. package/dist/features/admin/components/OwnerQuickActions.js +24 -2
  87. package/dist/features/admin/constants/filter-tabs.d.ts +6 -0
  88. package/dist/features/admin/constants/filter-tabs.js +6 -0
  89. package/dist/features/admin/constants/site-settings-tabs.d.ts +1 -1
  90. package/dist/features/admin/hooks/useAdminListingData.js +16 -0
  91. package/dist/features/admin/schemas/admin-user-form.d.ts +2 -2
  92. package/dist/features/admin/schemas/firestore.d.ts +30 -0
  93. package/dist/features/admin/schemas/firestore.js +5 -0
  94. package/dist/features/audit-log/schemas/firestore.d.ts +30 -0
  95. package/dist/features/audit-log/schemas/firestore.js +15 -0
  96. package/dist/features/auth/permissions/constants.js +13 -0
  97. package/dist/features/cart/components/CartPriceBreakdown.d.ts +13 -0
  98. package/dist/features/cart/components/CartPriceBreakdown.js +6 -2
  99. package/dist/features/cart/components/PointsTenderPicker.d.ts +61 -0
  100. package/dist/features/cart/components/PointsTenderPicker.js +15 -0
  101. package/dist/features/cart/components/StoreAddonsPicker.js +2 -1
  102. package/dist/features/cart/components/index.d.ts +2 -0
  103. package/dist/features/cart/components/index.js +1 -0
  104. package/dist/features/cart/repository/cart.repository.d.ts +19 -0
  105. package/dist/features/cart/repository/cart.repository.js +27 -0
  106. package/dist/features/cart/schemas/firestore.d.ts +92 -0
  107. package/dist/features/contact/email.d.ts +27 -10
  108. package/dist/features/contact/email.js +20 -3
  109. package/dist/features/dispute-reasons/repository/dispute-reasons.repository.d.ts +38 -0
  110. package/dist/features/dispute-reasons/repository/dispute-reasons.repository.js +80 -0
  111. package/dist/features/dispute-reasons/schemas/firestore.d.ts +64 -0
  112. package/dist/features/dispute-reasons/schemas/firestore.js +40 -0
  113. package/dist/features/faq/components/FAQAccordion.d.ts +13 -1
  114. package/dist/features/faq/components/FAQAccordion.js +29 -4
  115. package/dist/features/invoicing/schemas/firestore.d.ts +112 -0
  116. package/dist/features/invoicing/schemas/firestore.js +45 -0
  117. package/dist/features/invoicing/utils/financial-year.d.ts +43 -0
  118. package/dist/features/invoicing/utils/financial-year.js +53 -0
  119. package/dist/features/jobs/actions/enqueue-job.js +18 -1
  120. package/dist/features/jobs/repository/jobs.repository.d.ts +62 -1
  121. package/dist/features/jobs/repository/jobs.repository.js +84 -1
  122. package/dist/features/jobs/schemas/firestore.d.ts +80 -0
  123. package/dist/features/jobs/schemas/firestore.js +37 -0
  124. package/dist/features/lottery/schemas/zod.d.ts +6 -6
  125. package/dist/features/media/MediaImage.js +22 -1
  126. package/dist/features/media/upload/ImageUpload.js +1 -1
  127. package/dist/features/obligations/constants/policies.js +24 -1
  128. package/dist/features/orders/components/OrderPaymentSummary.js +10 -1
  129. package/dist/features/orders/components/OrderProvenanceCard.d.ts +8 -0
  130. package/dist/features/orders/components/OrderProvenanceCard.js +185 -0
  131. package/dist/features/orders/components/RaiseDisputeForm.d.ts +14 -0
  132. package/dist/features/orders/components/RaiseDisputeForm.js +111 -0
  133. package/dist/features/orders/components/RefundRequestView.js +19 -1
  134. package/dist/features/orders/components/index.d.ts +4 -0
  135. package/dist/features/orders/components/index.js +2 -0
  136. package/dist/features/orders/constants/order-lane-tabs.d.ts +69 -0
  137. package/dist/features/orders/constants/order-lane-tabs.js +88 -0
  138. package/dist/features/orders/repository/orders.repository.d.ts +57 -0
  139. package/dist/features/orders/repository/orders.repository.js +145 -0
  140. package/dist/features/orders/schemas/firestore.d.ts +196 -1
  141. package/dist/features/orders/schemas/index.d.ts +54 -6
  142. package/dist/features/orders/schemas/index.js +12 -0
  143. package/dist/features/orders/types/index.d.ts +26 -0
  144. package/dist/features/orders/utils/courier-block.d.ts +25 -0
  145. package/dist/features/orders/utils/courier-block.js +23 -0
  146. package/dist/features/payment-cases/schemas/firestore.d.ts +26 -1
  147. package/dist/features/payment-cases/schemas/firestore.js +1 -0
  148. package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -2
  149. package/dist/features/products/components/ProductDetailPageView.d.ts +17 -1
  150. package/dist/features/products/components/ProductDetailPageView.js +2 -2
  151. package/dist/features/products/schemas/product-features.validators.d.ts +10 -10
  152. package/dist/features/promotions/actions/coupon-stacking.d.ts +30 -3
  153. package/dist/features/promotions/actions/coupon-stacking.js +21 -2
  154. package/dist/features/promotions/components/CouponCard.js +13 -0
  155. package/dist/features/promotions/constants/coupon-help.d.ts +2 -2
  156. package/dist/features/promotions/constants/coupon-help.js +9 -1
  157. package/dist/features/promotions/schemas/firestore.d.ts +24 -0
  158. package/dist/features/promotions/schemas/firestore.js +4 -0
  159. package/dist/features/promotions/types/index.d.ts +19 -1
  160. package/dist/features/scams/components/ScamProfileView.js +2 -2
  161. package/dist/features/scams/components/ScamRegistryView.js +2 -2
  162. package/dist/features/search/action-index/tab-entries.js +1 -1
  163. package/dist/features/seller/actions/seller-actions.js +33 -3
  164. package/dist/features/seller/components/SellerOrdersView.js +129 -27
  165. package/dist/features/seller/hooks/useSellerListingData.js +25 -0
  166. package/dist/features/shipments/schemas/validation.d.ts +4 -4
  167. package/dist/features/shipping-boxes/repository/shipping-boxes.repository.d.ts +43 -0
  168. package/dist/features/shipping-boxes/repository/shipping-boxes.repository.js +90 -0
  169. package/dist/features/shipping-boxes/schemas/firestore.d.ts +82 -0
  170. package/dist/features/shipping-boxes/schemas/firestore.js +53 -0
  171. package/dist/features/store-extensions/schemas/report-create-form.d.ts +2 -2
  172. package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +2 -2
  173. package/dist/features/stores/components/StoreOrdersGuideView.js +6 -1
  174. package/dist/features/stores/schemas/firestore.d.ts +71 -0
  175. package/dist/features/stores/types/index.d.ts +19 -0
  176. package/dist/features/support/schemas/index.d.ts +6 -6
  177. package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
  178. package/dist/index.d.ts +6 -1
  179. package/dist/index.js +14 -1
  180. package/dist/next/routing/route-map.d.ts +20 -0
  181. package/dist/next/routing/route-map.js +10 -0
  182. package/dist/providers/shipping-shiprocket/index.d.ts +27 -1
  183. package/dist/providers/shipping-shiprocket/index.js +84 -1
  184. package/dist/schemas/registry.d.ts +47 -18
  185. package/dist/schemas/sieve.d.ts +2 -2
  186. package/dist/server-entry.d.ts +2 -2
  187. package/dist/server-entry.js +8 -1
  188. package/dist/server.d.ts +10 -1
  189. package/dist/server.js +39 -1
  190. package/dist/styles.css +64 -80
  191. package/dist/tailwind-utilities.css +1 -1
  192. package/dist/tokens/themes/default-dark.js +1 -0
  193. package/dist/tokens/themes/default-light.js +1 -0
  194. package/dist/tokens/themes/required.d.ts +1 -1
  195. package/dist/tokens/themes/required.js +1 -0
  196. package/dist/tokens/tokens.css +15 -0
  197. package/dist/ui/components/Disclaimer.d.ts +19 -0
  198. package/dist/ui/components/Disclaimer.js +74 -0
  199. package/dist/ui/components/tabs-overflow.js +64 -11
  200. package/dist/ui/index.d.ts +2 -0
  201. package/dist/ui/index.js +6 -0
  202. package/dist/ui/rich-text/RichText.style.css +48 -79
  203. package/package.json +1 -1
  204. package/scripts/seed-cli.mjs +1831 -1822
@@ -117,6 +117,42 @@ const serviceabilityResponse = z.object({
117
117
  .nullish(),
118
118
  }),
119
119
  });
120
+ /*
121
+ * Measured against the live API 2026-10-22 (read-only probe, one auth + GETs):
122
+ *
123
+ * GET /account/details/wallet-balance -> 200 { data: { balance_amount: string } }
124
+ * GET /account/details -> 404
125
+ *
126
+ * 🛑 `balance_amount` is a STRING, and there is NO credit-limit field — so
127
+ * postpaid headroom is not readable from this API at all. See `WalletBalance`
128
+ * in contracts/shipping.ts for why no such field is declared.
129
+ */
130
+ const walletBalanceResponse = z.object({
131
+ data: z.object({
132
+ balance_amount: z.union([z.number(), z.string()]).nullish(),
133
+ }),
134
+ });
135
+ /**
136
+ * Does this upstream error body look like "your wallet is empty"?
137
+ *
138
+ * 🛑 The substring list is UNVERIFIED and that is acceptable, because of where
139
+ * it sits in the design: a funding failure and any other booking failure take
140
+ * the SAME path — the order gets a `courierBlock`, the admin is alerted, the
141
+ * seller is offered retry-or-self-ship. Classifying only changes the WORDING
142
+ * of the operator's alert. So a false negative costs a less specific message
143
+ * and never a wrong action, which is why this is allowed to be a heuristic
144
+ * rather than something this plan pretended to have confirmed.
145
+ *
146
+ * Triggering the real error would mean deliberately booking a shipment against
147
+ * a drained wallet, which is not a probe anyone should run on a live account.
148
+ */
149
+ export function looksLikeInsufficientFunds(body) {
150
+ const s = body.toLowerCase();
151
+ return (s.includes("insufficient") ||
152
+ s.includes("low balance") ||
153
+ s.includes("recharge") ||
154
+ (s.includes("wallet") && s.includes("balance")));
155
+ }
120
156
  function num(v, fallback = 0) {
121
157
  const n = typeof v === "string" ? Number.parseFloat(v) : v;
122
158
  return typeof n === "number" && Number.isFinite(n) ? n : fallback;
@@ -230,7 +266,24 @@ export class ShiprocketShippingProvider extends IShippingProvider {
230
266
  res = await attempt(true);
231
267
  }
232
268
  if (!res.ok) {
233
- throw new ApiError(502, `Shiprocket ${path} failed (${res.status}).`, { code: "SHIPROCKET_REQUEST_FAILED" });
269
+ /*
270
+ * The body is read and carried, not discarded.
271
+ *
272
+ * It used to throw on `res.status` alone, which meant a funding failure
273
+ * and a malformed-address failure were indistinguishable to every
274
+ * caller — and the first of those is the one an operator can actually
275
+ * fix, by topping up.
276
+ *
277
+ * Truncated, because an upstream error page can be a whole HTML
278
+ * document and this string ends up in a log line.
279
+ */
280
+ const body = await res.text().catch(() => "");
281
+ const insufficient = looksLikeInsufficientFunds(body);
282
+ throw new ApiError(502, `Shiprocket ${path} failed (${res.status}).`, {
283
+ code: insufficient ? "SHIPROCKET_INSUFFICIENT_FUNDS" : "SHIPROCKET_REQUEST_FAILED",
284
+ upstreamStatus: res.status,
285
+ upstreamBody: body.slice(0, 500),
286
+ });
234
287
  }
235
288
  const json = await res.json();
236
289
  return parseUpstream(contract, json, path);
@@ -331,6 +384,36 @@ export class ShiprocketShippingProvider extends IShippingProvider {
331
384
  })),
332
385
  };
333
386
  }
387
+ /**
388
+ * The prepaid wallet balance. Read-only; never charges anything.
389
+ *
390
+ * 🛑 Returns `{ known: false, supported: true }` on ANY failure rather than
391
+ * `0`. Shiprocket HAS a wallet, so `supported` is true regardless — the
392
+ * caller must treat "unreadable" as "attempt the booking anyway and let the
393
+ * attempt's own failure decide", because refusing on an unreadable balance
394
+ * would block every order on a transient network blip. A `0` here is a real
395
+ * decision to skip; an unreadable balance is not.
396
+ */
397
+ async getWalletBalance() {
398
+ try {
399
+ const out = await this.call("/account/details/wallet-balance", { method: "GET" }, walletBalanceResponse);
400
+ const raw = out.data.balance_amount;
401
+ /*
402
+ * `num()` would silently fold an unparseable string into its fallback,
403
+ * which is exactly the 0-means-unknown conflation this type exists to
404
+ * prevent. Parsed explicitly so a bad payload reports `known: false`.
405
+ */
406
+ const parsed = typeof raw === "string" ? Number.parseFloat(raw) : raw;
407
+ if (typeof parsed !== "number" || !Number.isFinite(parsed)) {
408
+ return { known: false, supported: true, reason: "unparseable balance_amount" };
409
+ }
410
+ return { known: true, amount: parsed, currency: "INR" };
411
+ }
412
+ catch (err) {
413
+ const normalized = normalizeError(err);
414
+ return { known: false, supported: true, reason: normalized.message };
415
+ }
416
+ }
334
417
  async cancelShipment(shipmentId) {
335
418
  await this.call("/orders/cancel", { method: "POST", body: JSON.stringify({ ids: [shipmentId] }) },
336
419
  // Their cancel returns a message envelope we do not read; accepting any
@@ -2895,6 +2895,15 @@ export declare const SCHEMAS: {
2895
2895
  proofDocumentUrl: import("zod").ZodOptional<import("zod").ZodString>;
2896
2896
  proofDocumentMimeType: import("zod").ZodOptional<import("zod").ZodString>;
2897
2897
  overrideReason: import("zod").ZodOptional<import("zod").ZodString>;
2898
+ creditNoteNumber: import("zod").ZodOptional<import("zod").ZodString>;
2899
+ creditNoteIssuedAt: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodDate, import("zod").ZodString, import("zod").ZodObject<{
2900
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2901
+ }, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
2902
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2903
+ }, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
2904
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2905
+ }, import("zod").ZodTypeAny, "passthrough">>]>>;
2906
+ creditNoteStoragePath: import("zod").ZodOptional<import("zod").ZodString>;
2898
2907
  }, "strip", import("zod").ZodTypeAny, {
2899
2908
  type: "full" | "partial";
2900
2909
  amount: number;
@@ -2905,8 +2914,8 @@ export declare const SCHEMAS: {
2905
2914
  }, import("zod").ZodTypeAny, "passthrough">;
2906
2915
  refundedBy: string;
2907
2916
  status?: "failed" | "processed" | "reserved" | undefined;
2908
- failureReason?: string | undefined;
2909
2917
  gateway?: string | undefined;
2918
+ failureReason?: string | undefined;
2910
2919
  itemIds?: string[] | undefined;
2911
2920
  reasonCode?: string | undefined;
2912
2921
  gatewayRefundId?: string | undefined;
@@ -2916,6 +2925,11 @@ export declare const SCHEMAS: {
2916
2925
  proofDocumentUrl?: string | undefined;
2917
2926
  proofDocumentMimeType?: string | undefined;
2918
2927
  overrideReason?: string | undefined;
2928
+ creditNoteNumber?: string | undefined;
2929
+ creditNoteIssuedAt?: string | Date | import("zod").objectOutputType<{
2930
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2931
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
2932
+ creditNoteStoragePath?: string | undefined;
2919
2933
  }, {
2920
2934
  type: "full" | "partial";
2921
2935
  amount: number;
@@ -2926,8 +2940,8 @@ export declare const SCHEMAS: {
2926
2940
  }, import("zod").ZodTypeAny, "passthrough">;
2927
2941
  refundedBy: string;
2928
2942
  status?: "failed" | "processed" | "reserved" | undefined;
2929
- failureReason?: string | undefined;
2930
2943
  gateway?: string | undefined;
2944
+ failureReason?: string | undefined;
2931
2945
  itemIds?: string[] | undefined;
2932
2946
  reasonCode?: string | undefined;
2933
2947
  gatewayRefundId?: string | undefined;
@@ -2937,6 +2951,11 @@ export declare const SCHEMAS: {
2937
2951
  proofDocumentUrl?: string | undefined;
2938
2952
  proofDocumentMimeType?: string | undefined;
2939
2953
  overrideReason?: string | undefined;
2954
+ creditNoteNumber?: string | undefined;
2955
+ creditNoteIssuedAt?: string | Date | import("zod").objectInputType<{
2956
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
2957
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
2958
+ creditNoteStoragePath?: string | undefined;
2940
2959
  }>, "many">>;
2941
2960
  contestable: import("zod").ZodOptional<import("zod").ZodBoolean>;
2942
2961
  adminBypassBy: import("zod").ZodOptional<import("zod").ZodString>;
@@ -3107,8 +3126,8 @@ export declare const SCHEMAS: {
3107
3126
  }, import("zod").ZodTypeAny, "passthrough">;
3108
3127
  refundedBy: string;
3109
3128
  status?: "failed" | "processed" | "reserved" | undefined;
3110
- failureReason?: string | undefined;
3111
3129
  gateway?: string | undefined;
3130
+ failureReason?: string | undefined;
3112
3131
  itemIds?: string[] | undefined;
3113
3132
  reasonCode?: string | undefined;
3114
3133
  gatewayRefundId?: string | undefined;
@@ -3118,6 +3137,11 @@ export declare const SCHEMAS: {
3118
3137
  proofDocumentUrl?: string | undefined;
3119
3138
  proofDocumentMimeType?: string | undefined;
3120
3139
  overrideReason?: string | undefined;
3140
+ creditNoteNumber?: string | undefined;
3141
+ creditNoteIssuedAt?: string | Date | import("zod").objectOutputType<{
3142
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3143
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3144
+ creditNoteStoragePath?: string | undefined;
3121
3145
  }[] | undefined;
3122
3146
  contestable?: boolean | undefined;
3123
3147
  adminBypassBy?: string | undefined;
@@ -3261,8 +3285,8 @@ export declare const SCHEMAS: {
3261
3285
  }, import("zod").ZodTypeAny, "passthrough">;
3262
3286
  refundedBy: string;
3263
3287
  status?: "failed" | "processed" | "reserved" | undefined;
3264
- failureReason?: string | undefined;
3265
3288
  gateway?: string | undefined;
3289
+ failureReason?: string | undefined;
3266
3290
  itemIds?: string[] | undefined;
3267
3291
  reasonCode?: string | undefined;
3268
3292
  gatewayRefundId?: string | undefined;
@@ -3272,6 +3296,11 @@ export declare const SCHEMAS: {
3272
3296
  proofDocumentUrl?: string | undefined;
3273
3297
  proofDocumentMimeType?: string | undefined;
3274
3298
  overrideReason?: string | undefined;
3299
+ creditNoteNumber?: string | undefined;
3300
+ creditNoteIssuedAt?: string | Date | import("zod").objectInputType<{
3301
+ toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
3302
+ }, import("zod").ZodTypeAny, "passthrough"> | undefined;
3303
+ creditNoteStoragePath?: string | undefined;
3275
3304
  }[] | undefined;
3276
3305
  contestable?: boolean | undefined;
3277
3306
  adminBypassBy?: string | undefined;
@@ -4510,11 +4539,11 @@ export declare const SCHEMAS: {
4510
4539
  attachments?: string[] | undefined;
4511
4540
  }[];
4512
4541
  orderId?: string | undefined;
4513
- assignedTo?: string | undefined;
4514
- resolvedAt?: string | Date | import("zod").objectOutputType<{
4542
+ closedAt?: string | Date | import("zod").objectOutputType<{
4515
4543
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4516
4544
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4517
- closedAt?: string | Date | import("zod").objectOutputType<{
4545
+ assignedTo?: string | undefined;
4546
+ resolvedAt?: string | Date | import("zod").objectOutputType<{
4518
4547
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4519
4548
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4520
4549
  assignedToName?: string | undefined;
@@ -4553,11 +4582,11 @@ export declare const SCHEMAS: {
4553
4582
  attachments?: string[] | undefined;
4554
4583
  }[];
4555
4584
  orderId?: string | undefined;
4556
- assignedTo?: string | undefined;
4557
- resolvedAt?: string | Date | import("zod").objectInputType<{
4585
+ closedAt?: string | Date | import("zod").objectInputType<{
4558
4586
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4559
4587
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4560
- closedAt?: string | Date | import("zod").objectInputType<{
4588
+ assignedTo?: string | undefined;
4589
+ resolvedAt?: string | Date | import("zod").objectInputType<{
4561
4590
  toDate: import("zod").ZodFunction<import("zod").ZodTuple<[], import("zod").ZodUnknown>, import("zod").ZodDate>;
4562
4591
  }, import("zod").ZodTypeAny, "passthrough"> | undefined;
4563
4592
  assignedToName?: string | undefined;
@@ -4997,7 +5026,7 @@ export declare const SCHEMAS: {
4997
5026
  category: "shipping" | "seller" | "custom" | "condition" | "auction" | "platform" | "preorder";
4998
5027
  isActive: boolean;
4999
5028
  displayOrder: number;
5000
- productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "product" | "preorder")[];
5029
+ productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "preorder" | "product")[];
5001
5030
  storeId?: string | undefined;
5002
5031
  description?: string | undefined;
5003
5032
  iconColor?: string | undefined;
@@ -5008,7 +5037,7 @@ export declare const SCHEMAS: {
5008
5037
  category: "shipping" | "seller" | "custom" | "condition" | "auction" | "platform" | "preorder";
5009
5038
  isActive: boolean;
5010
5039
  displayOrder: number;
5011
- productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "product" | "preorder")[];
5040
+ productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "preorder" | "product")[];
5012
5041
  storeId?: string | undefined;
5013
5042
  description?: string | undefined;
5014
5043
  iconColor?: string | undefined;
@@ -5019,7 +5048,7 @@ export declare const SCHEMAS: {
5019
5048
  category: "shipping" | "seller" | "custom" | "condition" | "auction" | "platform" | "preorder";
5020
5049
  isActive: boolean;
5021
5050
  displayOrder: number;
5022
- productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "product" | "preorder")[];
5051
+ productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "preorder" | "product")[];
5023
5052
  storeId?: string | undefined;
5024
5053
  description?: string | undefined;
5025
5054
  iconColor?: string | undefined;
@@ -5030,7 +5059,7 @@ export declare const SCHEMAS: {
5030
5059
  category: "shipping" | "seller" | "custom" | "condition" | "auction" | "platform" | "preorder";
5031
5060
  isActive: boolean;
5032
5061
  displayOrder: number;
5033
- productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "product" | "preorder")[];
5062
+ productTypes: ("all" | "classified" | "auction" | "prize-draw" | "digital-code" | "live" | "preorder" | "product")[];
5034
5063
  storeId?: string | undefined;
5035
5064
  description?: string | undefined;
5036
5065
  iconColor?: string | undefined;
@@ -5341,14 +5370,14 @@ export declare const SCHEMAS: {
5341
5370
  }, "strict", import("zod").ZodTypeAny, {
5342
5371
  entityId: string;
5343
5372
  entityType: import("..").ReportEntityType;
5344
- detail: string;
5345
5373
  reason: import("..").ReportReason;
5374
+ detail: string;
5346
5375
  evidenceUrls?: string[] | undefined;
5347
5376
  }, {
5348
5377
  entityId: string;
5349
5378
  entityType: import("..").ReportEntityType;
5350
- detail: string;
5351
5379
  reason: import("..").ReportReason;
5380
+ detail: string;
5352
5381
  evidenceUrls?: string[] | undefined;
5353
5382
  }>;
5354
5383
  readonly itemRequest: import("zod").ZodObject<{
@@ -6254,13 +6283,13 @@ export declare const SCHEMAS: {
6254
6283
  userPhone: import("zod").ZodUnion<[import("zod").ZodOptional<import("zod").ZodString>, import("zod").ZodLiteral<"">]>;
6255
6284
  }, "strip", import("zod").ZodTypeAny, {
6256
6285
  transactionId: string;
6257
- sourceType: "event" | "product";
6286
+ sourceType: "product" | "event";
6258
6287
  paymentTime: string;
6259
6288
  purchasedItemNumber: number;
6260
6289
  userPhone?: string | undefined;
6261
6290
  }, {
6262
6291
  transactionId: string;
6263
- sourceType: "event" | "product";
6292
+ sourceType: "product" | "event";
6264
6293
  paymentTime: string;
6265
6294
  purchasedItemNumber: number;
6266
6295
  userPhone?: string | undefined;
@@ -7,13 +7,13 @@ export declare const sieveGrammarSchema: z.ZodObject<{
7
7
  }, "strip", z.ZodTypeAny, {
8
8
  page: number;
9
9
  pageSize: number;
10
- filters: string;
11
10
  sorts: string;
11
+ filters: string;
12
12
  }, {
13
13
  page?: number | undefined;
14
14
  pageSize?: number | undefined;
15
- filters?: string | undefined;
16
15
  sorts?: string | undefined;
16
+ filters?: string | undefined;
17
17
  }>;
18
18
  export type SieveGrammar = z.infer<typeof sieveGrammarSchema>;
19
19
  export declare const sieveWhereOpSchema: z.ZodEnum<["==", "!=", "<", "<=", ">", ">=", "array-contains", "in", "not-in", "array-contains-any"]>;
@@ -68,8 +68,8 @@ export { renderScamOg, renderScamOgImage, type ScamOgData, getScammerForDetail,
68
68
  export { getCategoryForDetail, listRootCategories, listFeaturedCategories, listMenuCategories, getCategoryTree, listSitemapCategories, CATEGORIES_PAGE_SIZE, CATEGORIES_ROOT_TIER, CATEGORIES_MAX_DEPTH, CATEGORIES_SITEMAP_LIMIT, CATEGORIES_FEATURED_LIMIT, CATEGORIES_MENU_LIMIT, } from "./_internal/server/features/categories/index";
69
69
  export { getGroupedListingForDetail, getGroupedListingWithItems, listGroupedListings, listFeaturedGroupedListings, listSitemapGroupedListings, getGroupsForProduct, getGroupsWithItemsForProduct, GROUPED_LISTINGS_PAGE_SIZE, GROUPED_LISTINGS_FEATURED_LIMIT, GROUPED_LISTINGS_SITEMAP_LIMIT, buildGroupedListingMetadata, renderGroupedListingOg, type GroupedListingWithItems, type ListGroupedListingsParams, type SitemapGroupedListing, type GroupedListingMetadataOptions, } from "./_internal/server/features/grouped/index";
70
70
  export { createCheckoutOrderAction, attachPaymentAction, verifyAndPlaceGatewayOrderAction, previewCheckoutPricing, resolveShippingCost, formatShippingAddress, CHECKOUT_DEFAULT_COMMISSIONS, CHECKOUT_PAYMENT_METHODS, type CreateCheckoutOrderInput, type VerifyAndPlaceGatewayOrderInput, type CheckoutOrderResult, type CheckoutPaymentMethod, type CheckoutPricingPreviewInput, type CheckoutPricingPreview, } from "./_internal/server/features/checkout/index";
71
- export { unitPriceFor, lineTotalFor, sumGroupGst, computePreOrderDepositAmount, type GroupGstSummary, type GstRateSlice, } from "./_internal/shared/checkout/order-math";
72
- export { computeGroupCouponDiscount, computeCartCouponDiscount, type GroupCouponDiscountResult, } from "./_internal/shared/checkout/coupon-discount";
71
+ export { unitPriceFor, lineTotalFor, sumGroupGst, computePreOrderDepositAmount, allocatePointsAcrossGroups, resolvePointsTender, type GroupGstSummary, type GstRateSlice, } from "./_internal/shared/checkout/order-math";
72
+ export { computeGroupCouponDiscount, computeCartCouponDiscount, type GroupCouponDiscountResult, type CartCouponDiscountResult, } from "./_internal/shared/checkout/coupon-discount";
73
73
  export { refundCapacity, refundableBase, committedRefundTotal, platformFeeWithheld, wouldBeFullRefund, MONEY_EPSILON, type RefundCapacity, type RefundableOrderLike, } from "./_internal/shared/checkout/refundable-base";
74
74
  export { processRefundAction, type ProcessRefundInput, } from "./_internal/server/features/refunds/actions";
75
75
  export { getSublistingCategoryForDetail } from "./_internal/server/features/sublisting-categories/index";
@@ -106,7 +106,14 @@ export { createCheckoutOrderAction, attachPaymentAction, verifyAndPlaceGatewayOr
106
106
  // GST entirely, so the buyer was shown the tax, charged without it, and the
107
107
  // order recorded none — with the verify-side mismatch guard omitting it too, so
108
108
  // the three were consistently wrong and the undercharge was undetectable.
109
- export { unitPriceFor, lineTotalFor, sumGroupGst, computePreOrderDepositAmount, } from "./_internal/shared/checkout/order-math.js";
109
+ // `allocatePointsAcrossGroups` is the FOURTH symbol exported here for the same
110
+ // reason as the three above it, and the pattern is now the point: every money
111
+ // rule that `/api/payment/create-order` needs has had to be exported after that
112
+ // route was found hand-rolling it or omitting it. The points tender is exported
113
+ // BEFORE the route can get it wrong rather than after — which is the only
114
+ // difference between this entry and the three defects recorded in the comment
115
+ // above (D37, D38, C0c defect 1).
116
+ export { unitPriceFor, lineTotalFor, sumGroupGst, computePreOrderDepositAmount, allocatePointsAcrossGroups, resolvePointsTender, } from "./_internal/shared/checkout/order-math.js";
110
117
  /*
111
118
  * The coupon discount, exported for the SAME reason `sumGroupGst` above was —
112
119
  * and it is the third defect of that exact shape in this one route.
package/dist/server.d.ts CHANGED
@@ -260,7 +260,7 @@ export { updateEvent } from "./features/events/server";
260
260
  export { triggerEventRaffleAction, assignSpinPrizeAction, resolveEventIdAction, } from "./_internal/server/features/raffle/actions";
261
261
  export { reasonToHttp, EVENT_DRAW_REASON, type EventDrawReason, type EventDrawHttpMapping, } from "./_internal/server/jobs/core/event-draw-reasons";
262
262
  export { processRefundAction, type ProcessRefundInput, } from "./_internal/server/features/refunds/actions";
263
- export { computeCheckoutFees, computePayoutDeduction, computeCodHandlingFee, computeGiftWrapFee, computeShipmentProtectionFee, computeSaleProtectionFee, } from "./_internal/shared/fees/calculator";
263
+ export { computeCheckoutFees, allocateCheckoutFees, computePayoutDeduction, computeCodHandlingFee, computeGiftWrapFee, computeShipmentProtectionFee, computeSaleProtectionFee, } from "./_internal/shared/fees/calculator";
264
264
  export { searchPriceIndex, getPriceIndexBandsForIds, PRICE_INDEX_SEARCH_LIMIT, PRICE_INDEX_MIN_QUERY_LENGTH } from "./_internal/server/features/price-index/search";
265
265
  export type { PriceIndexSearchResponse, PriceIndexSearchResult, PriceIndexSearchResultBand, } from "./_internal/server/features/price-index/search";
266
266
  export { getPriceIndexMarketForIds } from "./_internal/server/features/price-index/market";
@@ -573,6 +573,8 @@ export type { ActionIndexDocument } from "./features/search/action-index/reposit
573
573
  export { REFUND_COPY } from "./_internal/shared/features/orders/refund-copy";
574
574
  export { RETURN_REASON, FINAL_SALE_EXEMPT_REASONS, RETURN_REASON_LABEL, RETURN_REASON_GROUP_LABEL, isFinalSaleExempt, isReturnReason, selectableReturnReasons, } from "./_internal/shared/features/orders/return-reasons";
575
575
  export type { ReturnReason } from "./_internal/shared/features/orders/return-reasons";
576
+ export { INTEGRATIONS, INTEGRATION_ORDER, readIntegrationStates, integrationPatch, allIntegrationsPatch, } from "./_internal/shared/features/admin/integrations";
577
+ export type { IntegrationId, IntegrationDescriptor, IntegrationState, } from "./_internal/shared/features/admin/integrations";
576
578
  export { draftToProductInput, productToDraft, } from "./features/seller/utils/product-draft-mapping";
577
579
  export { RETURN_CUSTODY_STATES, RETURN_CUSTODY_COPY, isTerminalCustody, canAdvanceCustody, nextCustodyState, custodyOwner, isActionableBy, } from "./_internal/shared/features/returns/custody";
578
580
  export type { ReturnCustodyState } from "./_internal/shared/features/returns/custody";
@@ -604,3 +606,10 @@ export type { FileGrievanceInput } from "./_internal/server/features/grievance";
604
606
  export { GRIEVANCE_PERIODS } from "./features/support/schemas/firestore";
605
607
  export { getRateableItemsAction, rateOrderItemAction, markOrderCompleteAction, } from "./_internal/server/features/order-completion";
606
608
  export type { RateableOrderItem, RateOrderItemInput, } from "./_internal/server/features/order-completion";
609
+ export { allocateSeriesNumber, type AllocateSeriesNumberInput, type AllocateSeriesNumberResult, } from "./_internal/server/features/invoicing/allocate";
610
+ export { issueInvoiceForOrder, readStoredInvoice, storeRenderedInvoice, INVOICE_PREFIX_PATH, type InvoiceRenderer, type IssueInvoiceResult, } from "./_internal/server/features/invoicing/issue";
611
+ export { issueCreditNoteForRefund, CREDIT_NOTE_PREFIX_PATH, type CreditNoteRenderer, type IssueCreditNoteResult, } from "./_internal/server/features/invoicing/credit-note";
612
+ export { financialYearLabel, formatSeriesNumber, INVOICE_PREFIX, CREDIT_NOTE_PREFIX, } from "./features/invoicing/utils/financial-year";
613
+ export type { InvoiceCounterDocument, InvoiceAllocationDocument, InvoiceSeriesKind, } from "./features/invoicing/schemas/firestore";
614
+ export { buildGstr1Export, gstr1ToCsv, type Gstr1Export, type Gstr1Row, } from "./_internal/server/features/invoicing/gstr1";
615
+ export { quoteSharedPurchase, countDestinations, type SharedPurchaseRates, type SharedPurchaseQuote, type SharedPurchaseQuoteInput, } from "./_internal/shared/features/shipping/shared-purchase";
package/dist/server.js CHANGED
@@ -861,7 +861,7 @@ export { reasonToHttp, EVENT_DRAW_REASON, } from "./_internal/server/jobs/core/e
861
861
  // [SERVER-ONLY] S-SBUNI-RULES — refund action (Razorpay + manual paths)
862
862
  export { processRefundAction, } from "./_internal/server/features/refunds/actions.js";
863
863
  // [SERVER-ONLY] Shared fee calculator — platform/gateway/GST/COD handling/addon fee math.
864
- export { computeCheckoutFees, computePayoutDeduction, computeCodHandlingFee, computeGiftWrapFee, computeShipmentProtectionFee, computeSaleProtectionFee, } from "./_internal/shared/fees/calculator.js";
864
+ export { computeCheckoutFees, allocateCheckoutFees, computePayoutDeduction, computeCodHandlingFee, computeGiftWrapFee, computeShipmentProtectionFee, computeSaleProtectionFee, } from "./_internal/shared/fees/calculator.js";
865
865
  // C5e buyer protections — the pure three-tier gate plus the one fee pair
866
866
  // every money path must agree on. Public API because the capture route
867
867
  // (/api/payment/create-order) is one of the three sites that must agree.
@@ -1539,6 +1539,17 @@ export { REFUND_COPY } from "./_internal/shared/features/orders/refund-copy.js";
1539
1539
  // See the module docstring for why the exempt set is "seller or carrier fault"
1540
1540
  // rather than "serious reasons".
1541
1541
  export { RETURN_REASON, FINAL_SALE_EXEMPT_REASONS, RETURN_REASON_LABEL, RETURN_REASON_GROUP_LABEL, isFinalSaleExempt, isReturnReason, selectableReturnReasons, } from "./_internal/shared/features/orders/return-reasons.js";
1542
+ /*
1543
+ * The integration switches, SERVER side — this is the half the route guards
1544
+ * use. `readIntegrationStates` is the one expression that answers "is this
1545
+ * integration on", and both the admin page (via `client.ts`) and every guard
1546
+ * resolve through it so they cannot disagree.
1547
+ *
1548
+ * `IntegrationDescriptor.failClosed` is what a guard reads to decide which way
1549
+ * to fail when the settings read itself throws. It differs per integration on
1550
+ * purpose: closed for money, open for support.
1551
+ */
1552
+ export { INTEGRATIONS, INTEGRATION_ORDER, readIntegrationStates, integrationPatch, allIntegrationsPatch, } from "./_internal/shared/features/admin/integrations.js";
1542
1553
  // Seller listing form draft <-> product write payload. The flat form keys and
1543
1554
  // the nested document blocks are different shapes, and nothing translated
1544
1555
  // between them — see the module docstring.
@@ -1638,3 +1649,30 @@ export { GRIEVANCE_PERIODS } from "./features/support/schemas/firestore.js";
1638
1649
  * obligation early opens the payout gate early as a consequence.
1639
1650
  */
1640
1651
  export { getRateableItemsAction, rateOrderItemAction, markOrderCompleteAction, } from "./_internal/server/features/order-completion/index.js";
1652
+ /*
1653
+ * [SERVER-ONLY] Phase 7 invoicing (D12) — the two gapless FY series.
1654
+ *
1655
+ * Exported here because `_internal/*` is NOT a published subpath (appkit has 46
1656
+ * export keys and none of them is `./_internal/*`), so a consumer route cannot
1657
+ * deep-import these. That is the same wall `cancelOrderWithRefund` and
1658
+ * `adjustUserPoints` hit; `server.ts` is the sanctioned door.
1659
+ *
1660
+ * 🛑 `allocateSeriesNumber` is exported deliberately and should be reached for
1661
+ * rarely: it CONSUMES a number from a gapless series, and a number cannot be
1662
+ * withdrawn without leaving a gap an auditor will ask about. The two callers
1663
+ * that should exist are the paid-transition trigger and the refund settle path,
1664
+ * both already wired. A backfill is the only other legitimate use.
1665
+ */
1666
+ export { allocateSeriesNumber, } from "./_internal/server/features/invoicing/allocate.js";
1667
+ export { issueInvoiceForOrder, readStoredInvoice, storeRenderedInvoice, INVOICE_PREFIX_PATH, } from "./_internal/server/features/invoicing/issue.js";
1668
+ export { issueCreditNoteForRefund, CREDIT_NOTE_PREFIX_PATH, } from "./_internal/server/features/invoicing/credit-note.js";
1669
+ export { financialYearLabel, formatSeriesNumber, INVOICE_PREFIX, CREDIT_NOTE_PREFIX, } from "./features/invoicing/utils/financial-year.js";
1670
+ export { buildGstr1Export, gstr1ToCsv, } from "./_internal/server/features/invoicing/gstr1.js";
1671
+ /*
1672
+ * [SERVER-ONLY] S5a shared purchase — one payer, N destinations.
1673
+ *
1674
+ * Exported for the capture route, which is the FOURTH money path and the one
1675
+ * D37 proves gets left behind. Pure arithmetic with no Firestore and no
1676
+ * settings read; the rates are passed in snapshotted.
1677
+ */
1678
+ export { quoteSharedPurchase, countDestinations, } from "./_internal/shared/features/shipping/shared-purchase.js";