@mohasinac/appkit 4.61.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.
- package/dist/.build-stamp.json +3 -3
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +19 -3
- package/dist/_internal/client/features/maintenance/views/AnalysisRunnerView.js +1 -1
- package/dist/_internal/client/features/maintenance/views/CloudLogsListView.js +1 -1
- package/dist/_internal/server/features/checkout/actions.d.ts +80 -0
- package/dist/_internal/server/features/checkout/actions.js +542 -26
- package/dist/_internal/server/features/invoicing/allocate.d.ts +63 -0
- package/dist/_internal/server/features/invoicing/allocate.js +162 -0
- package/dist/_internal/server/features/invoicing/credit-note.d.ts +57 -0
- package/dist/_internal/server/features/invoicing/credit-note.js +126 -0
- package/dist/_internal/server/features/invoicing/gstr1.d.ts +74 -0
- package/dist/_internal/server/features/invoicing/gstr1.js +251 -0
- package/dist/_internal/server/features/invoicing/issue.d.ts +96 -0
- package/dist/_internal/server/features/invoicing/issue.js +202 -0
- package/dist/_internal/server/features/orders/actions.d.ts +8 -1
- package/dist/_internal/server/features/orders/actions.js +81 -8
- package/dist/_internal/server/features/orders/adapters.js +33 -0
- package/dist/_internal/server/features/orders/cancellation-refund.d.ts +15 -9
- package/dist/_internal/server/features/orders/cancellation-refund.js +15 -9
- package/dist/_internal/server/features/points/award.js +46 -4
- package/dist/_internal/server/features/refunds/actions.js +26 -0
- package/dist/_internal/server/features/shipping/courier-block.d.ts +69 -0
- package/dist/_internal/server/features/shipping/courier-block.js +239 -0
- package/dist/_internal/server/features/site-settings/adapters.d.ts +1 -1
- package/dist/_internal/server/features/site-settings/adapters.js +15 -0
- package/dist/_internal/server/features/stores/adapters.d.ts +2 -2
- package/dist/_internal/server/features/stores/adapters.js +51 -0
- package/dist/_internal/server/functions/scheduled.js +38 -1
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +9 -2
- package/dist/_internal/server/jobs/core/dailyStatusDigest.d.ts +4 -0
- package/dist/_internal/server/jobs/core/dailyStatusDigest.js +19 -2
- package/dist/_internal/server/jobs/core/index.d.ts +2 -1
- package/dist/_internal/server/jobs/core/index.js +2 -1
- package/dist/_internal/server/jobs/core/onJobCreated.d.ts +30 -7
- package/dist/_internal/server/jobs/core/onJobCreated.js +78 -45
- package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +7 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +62 -0
- package/dist/_internal/server/jobs/core/paymentReconcile.js +87 -97
- package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +33 -0
- package/dist/_internal/server/jobs/core/runJobOnce.d.ts +48 -0
- package/dist/_internal/server/jobs/core/runJobOnce.js +195 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +10 -2
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.js +17 -0
- package/dist/_internal/server/notifications/channel-health.d.ts +26 -3
- package/dist/_internal/shared/actions/action-registry.js +177 -9
- package/dist/_internal/shared/checkout/coupon-discount.d.ts +43 -1
- package/dist/_internal/shared/checkout/coupon-discount.js +26 -1
- package/dist/_internal/shared/checkout/order-math.d.ts +145 -0
- package/dist/_internal/shared/checkout/order-math.js +173 -0
- package/dist/_internal/shared/checkout/refundable-base.d.ts +25 -0
- package/dist/_internal/shared/checkout/refundable-base.js +13 -1
- package/dist/_internal/shared/checkout/split.d.ts +87 -0
- package/dist/_internal/shared/checkout/split.js +100 -0
- package/dist/_internal/shared/content/disclaimers.d.ts +88 -0
- package/dist/_internal/shared/content/disclaimers.js +217 -0
- package/dist/_internal/shared/content/published-values.d.ts +88 -0
- package/dist/_internal/shared/content/published-values.js +198 -0
- package/dist/_internal/shared/features/admin/integrations.d.ts +109 -0
- package/dist/_internal/shared/features/admin/integrations.js +253 -0
- package/dist/_internal/shared/features/orders/dispute-reasons.d.ts +113 -0
- package/dist/_internal/shared/features/orders/dispute-reasons.js +181 -0
- package/dist/_internal/shared/features/orders/refund-copy.d.ts +1 -1
- package/dist/_internal/shared/features/orders/refund-copy.js +18 -1
- package/dist/_internal/shared/features/points/accepts.d.ts +36 -0
- package/dist/_internal/shared/features/points/accepts.js +43 -0
- package/dist/_internal/shared/features/shipping/shared-purchase.d.ts +91 -0
- package/dist/_internal/shared/features/shipping/shared-purchase.js +108 -0
- package/dist/_internal/shared/features/site-settings/types.d.ts +11 -0
- package/dist/_internal/shared/fees/calculator.d.ts +33 -1
- package/dist/_internal/shared/fees/calculator.js +32 -2
- package/dist/_internal/shared/media/limits.d.ts +10 -0
- package/dist/_internal/shared/media/limits.js +10 -0
- package/dist/_internal/shared/types/action-result.js +15 -1
- package/dist/client/api/surface-error.js +16 -2
- package/dist/client/api/useApiMutation.js +17 -1
- package/dist/client.d.ts +12 -1
- package/dist/client.js +31 -1
- package/dist/constants/api-endpoints.d.ts +45 -0
- package/dist/constants/api-endpoints.js +15 -0
- package/dist/constants/field-names.d.ts +18 -0
- package/dist/constants/field-names.js +28 -0
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/shipping.d.ts +45 -0
- package/dist/contracts/shipping.js +15 -0
- package/dist/core/server-action.js +19 -3
- package/dist/errors/error-mapping.js +26 -1
- package/dist/features/about/components/AboutView.js +1 -1
- package/dist/features/account/components/BuyerAuctionsGuideView.js +4 -1
- package/dist/features/account/components/UserOffersPanel.js +5 -3
- package/dist/features/account/components/UserOrdersView.js +19 -33
- package/dist/features/admin/components/AdminActionIndexView.js +100 -5
- package/dist/features/admin/components/AdminAddressClustersView.js +21 -2
- package/dist/features/admin/components/AdminBlogEditorView.js +8 -8
- package/dist/features/admin/components/AdminCarouselEditorView.js +1 -1
- package/dist/features/admin/components/AdminCarouselView.js +96 -4
- package/dist/features/admin/components/AdminCouponEditorView.js +17 -0
- package/dist/features/admin/components/AdminFulfillmentView.js +3 -2
- package/dist/features/admin/components/AdminInvoicingView.d.ts +2 -0
- package/dist/features/admin/components/AdminInvoicingView.js +65 -0
- package/dist/features/admin/components/AdminMediaView.js +36 -3
- package/dist/features/admin/components/AdminNavigationView.js +4 -1
- package/dist/features/admin/components/AdminOffersView.js +2 -1
- package/dist/features/admin/components/AdminOrderEditorView.d.ts +18 -1
- package/dist/features/admin/components/AdminOrderEditorView.js +11 -2
- package/dist/features/admin/components/AdminOrdersGuideView.js +23 -2
- package/dist/features/admin/components/AdminOrdersView.js +67 -5
- package/dist/features/admin/components/AdminPaymentClustersView.js +19 -2
- package/dist/features/admin/components/AdminProductEditorView.js +2 -2
- package/dist/features/admin/components/AdminSectionsView.d.ts +10 -0
- package/dist/features/admin/components/AdminSectionsView.js +486 -224
- package/dist/features/admin/components/OwnerQuickActions.js +24 -2
- package/dist/features/admin/components/ReferenceRecordEditor.js +1 -1
- package/dist/features/admin/constants/filter-tabs.d.ts +6 -0
- package/dist/features/admin/constants/filter-tabs.js +6 -0
- package/dist/features/admin/constants/site-settings-tabs.d.ts +1 -1
- package/dist/features/admin/hooks/useAdminListingData.js +16 -0
- package/dist/features/admin/hooks/useOptimisticRowFlag.d.ts +33 -0
- package/dist/features/admin/hooks/useOptimisticRowFlag.js +87 -0
- package/dist/features/admin/repository/notification.repository.d.ts +15 -0
- package/dist/features/admin/repository/notification.repository.js +32 -0
- package/dist/features/admin/schemas/action-index-form.d.ts +34 -0
- package/dist/features/admin/schemas/action-index-form.js +115 -0
- package/dist/features/admin/schemas/admin-user-form.d.ts +2 -2
- package/dist/features/admin/schemas/firestore.d.ts +30 -0
- package/dist/features/admin/schemas/firestore.js +5 -0
- package/dist/features/audit-log/schemas/firestore.d.ts +30 -0
- package/dist/features/audit-log/schemas/firestore.js +15 -0
- package/dist/features/auth/components/RegisterForm.js +2 -1
- package/dist/features/auth/permissions/constants.js +13 -0
- package/dist/features/cart/components/CartPriceBreakdown.d.ts +13 -0
- package/dist/features/cart/components/CartPriceBreakdown.js +6 -2
- package/dist/features/cart/components/PointsTenderPicker.d.ts +61 -0
- package/dist/features/cart/components/PointsTenderPicker.js +15 -0
- package/dist/features/cart/components/StoreAddonsPicker.js +2 -1
- package/dist/features/cart/components/index.d.ts +2 -0
- package/dist/features/cart/components/index.js +1 -0
- package/dist/features/cart/repository/cart.repository.d.ts +19 -0
- package/dist/features/cart/repository/cart.repository.js +27 -0
- package/dist/features/cart/schemas/firestore.d.ts +92 -0
- package/dist/features/catalogue/components/CatalogueItemEditorView.js +3 -3
- package/dist/features/contact/email.d.ts +27 -10
- package/dist/features/contact/email.js +20 -3
- package/dist/features/dispute-reasons/repository/dispute-reasons.repository.d.ts +38 -0
- package/dist/features/dispute-reasons/repository/dispute-reasons.repository.js +80 -0
- package/dist/features/dispute-reasons/schemas/firestore.d.ts +64 -0
- package/dist/features/dispute-reasons/schemas/firestore.js +40 -0
- package/dist/features/events/components/AdminEventEditorView.js +8 -6
- package/dist/features/faq/components/FAQAccordion.d.ts +13 -1
- package/dist/features/faq/components/FAQAccordion.js +29 -4
- package/dist/features/invoicing/schemas/firestore.d.ts +112 -0
- package/dist/features/invoicing/schemas/firestore.js +45 -0
- package/dist/features/invoicing/utils/financial-year.d.ts +43 -0
- package/dist/features/invoicing/utils/financial-year.js +53 -0
- package/dist/features/jobs/actions/enqueue-job.js +18 -1
- package/dist/features/jobs/repository/jobs.repository.d.ts +62 -1
- package/dist/features/jobs/repository/jobs.repository.js +84 -1
- package/dist/features/jobs/schemas/firestore.d.ts +80 -0
- package/dist/features/jobs/schemas/firestore.js +37 -0
- package/dist/features/layout/hooks/useFormBottomActions.js +20 -1
- package/dist/features/lottery/schemas/zod.d.ts +6 -6
- package/dist/features/media/MediaImage.js +22 -1
- package/dist/features/media/upload/ImageUpload.js +1 -1
- package/dist/features/obligations/constants/policies.js +24 -1
- package/dist/features/orders/components/EmiInstallmentsPanel.js +25 -7
- package/dist/features/orders/components/OrderPaymentSummary.js +10 -1
- package/dist/features/orders/components/OrderProvenanceCard.d.ts +8 -0
- package/dist/features/orders/components/OrderProvenanceCard.js +185 -0
- package/dist/features/orders/components/RaiseDisputeForm.d.ts +14 -0
- package/dist/features/orders/components/RaiseDisputeForm.js +111 -0
- package/dist/features/orders/components/RefundRequestView.js +22 -4
- package/dist/features/orders/components/index.d.ts +4 -0
- package/dist/features/orders/components/index.js +2 -0
- package/dist/features/orders/constants/order-lane-tabs.d.ts +69 -0
- package/dist/features/orders/constants/order-lane-tabs.js +88 -0
- package/dist/features/orders/repository/orders.repository.d.ts +57 -0
- package/dist/features/orders/repository/orders.repository.js +145 -0
- package/dist/features/orders/schemas/firestore.d.ts +196 -1
- package/dist/features/orders/schemas/index.d.ts +60 -12
- package/dist/features/orders/schemas/index.js +12 -0
- package/dist/features/orders/types/index.d.ts +26 -0
- package/dist/features/orders/utils/courier-block.d.ts +25 -0
- package/dist/features/orders/utils/courier-block.js +23 -0
- package/dist/features/payment-cases/schemas/firestore.d.ts +26 -1
- package/dist/features/payment-cases/schemas/firestore.js +1 -0
- package/dist/features/products/components/GroupMemberPicker.js +4 -1
- package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -2
- package/dist/features/products/components/PrizeDrawEntryActions.js +2 -1
- package/dist/features/products/components/ProductDetailActions.js +2 -1
- package/dist/features/products/components/ProductDetailPageView.d.ts +17 -1
- package/dist/features/products/components/ProductDetailPageView.js +2 -2
- package/dist/features/products/schemas/product-features.validators.d.ts +10 -10
- package/dist/features/promotions/actions/coupon-stacking.d.ts +30 -3
- package/dist/features/promotions/actions/coupon-stacking.js +21 -2
- package/dist/features/promotions/components/CouponCard.js +13 -0
- package/dist/features/promotions/constants/coupon-help.d.ts +2 -2
- package/dist/features/promotions/constants/coupon-help.js +9 -1
- package/dist/features/promotions/schemas/firestore.d.ts +24 -0
- package/dist/features/promotions/schemas/firestore.js +4 -0
- package/dist/features/promotions/types/index.d.ts +19 -1
- package/dist/features/scams/components/ScamProfileView.js +2 -2
- package/dist/features/scams/components/ScamRegistryView.js +2 -2
- package/dist/features/search/action-index/tab-entries.js +1 -1
- package/dist/features/seller/actions/seller-actions.js +33 -3
- package/dist/features/seller/components/FulfillmentView.js +3 -2
- package/dist/features/seller/components/SellerAddressesView.js +32 -4
- package/dist/features/seller/components/SellerAnalyticsAlertsView.js +62 -3
- package/dist/features/seller/components/SellerBundlesView.js +53 -14
- package/dist/features/seller/components/SellerGroupedListingsView.js +23 -3
- package/dist/features/seller/components/SellerListingTypeView.js +56 -10
- package/dist/features/seller/components/SellerOrdersView.js +129 -27
- package/dist/features/seller/components/SellerPayoutMethodsView.js +33 -1
- package/dist/features/seller/components/SellerPayoutSettingsView.js +48 -9
- package/dist/features/seller/components/SellerProductsView.js +5 -1
- package/dist/features/seller/components/SellerShippingConfigsView.js +33 -1
- package/dist/features/seller/components/SellerShippingView.js +2 -1
- package/dist/features/seller/components/SellerStoreCategoriesView.js +33 -1
- package/dist/features/seller/components/SellerSupportView.js +69 -2
- package/dist/features/seller/hooks/useSellerListingData.js +25 -0
- package/dist/features/shell/SectionForm.js +20 -16
- package/dist/features/shell/build-sections.js +14 -1
- package/dist/features/shipments/components/AdminShipmentLotItemsView.js +54 -1
- package/dist/features/shipments/components/AdminShipmentProjectionsView.js +3 -2
- package/dist/features/shipments/schemas/validation.d.ts +4 -4
- package/dist/features/shipping-boxes/repository/shipping-boxes.repository.d.ts +43 -0
- package/dist/features/shipping-boxes/repository/shipping-boxes.repository.js +90 -0
- package/dist/features/shipping-boxes/schemas/firestore.d.ts +82 -0
- package/dist/features/shipping-boxes/schemas/firestore.js +53 -0
- package/dist/features/sticker-trace/components/StickerCommitPanel.js +2 -1
- package/dist/features/sticker-trace/components/StickerPrintPanel.js +2 -1
- package/dist/features/sticker-trace/components/StickerRetryPanel.js +24 -4
- package/dist/features/sticker-trace/components/StickerTraceStudio.js +2 -1
- package/dist/features/store-extensions/schemas/report-create-form.d.ts +2 -2
- package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +2 -2
- package/dist/features/stores/components/StoreOrdersGuideView.js +6 -1
- package/dist/features/stores/schemas/firestore.d.ts +71 -0
- package/dist/features/stores/types/index.d.ts +19 -0
- package/dist/features/support/schemas/index.d.ts +6 -6
- package/dist/features/tester/components/AdminTesterFeedbackIssuesView.js +3 -2
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +17 -2
- package/dist/next/routing/route-map.d.ts +24 -0
- package/dist/next/routing/route-map.js +19 -0
- package/dist/providers/shipping-shiprocket/index.d.ts +27 -1
- package/dist/providers/shipping-shiprocket/index.js +84 -1
- package/dist/schemas/registry.d.ts +51 -22
- package/dist/schemas/sieve.d.ts +5 -5
- package/dist/server-entry.d.ts +2 -2
- package/dist/server-entry.js +8 -1
- package/dist/server.d.ts +11 -2
- package/dist/server.js +40 -2
- package/dist/styles.css +64 -80
- package/dist/tailwind-utilities.css +1 -1
- package/dist/tokens/themes/default-dark.js +1 -0
- package/dist/tokens/themes/default-light.js +1 -0
- package/dist/tokens/themes/required.d.ts +1 -1
- package/dist/tokens/themes/required.js +1 -0
- package/dist/tokens/tokens.css +15 -0
- package/dist/ui/components/Checkbox.js +10 -2
- package/dist/ui/components/DateInput.js +8 -1
- package/dist/ui/components/Disclaimer.d.ts +19 -0
- package/dist/ui/components/Disclaimer.js +74 -0
- package/dist/ui/components/Input.js +22 -2
- package/dist/ui/components/PaginatedSelect.d.ts +8 -19
- package/dist/ui/components/PaginatedSelect.js +43 -9
- package/dist/ui/components/Radio.js +8 -1
- package/dist/ui/components/Select.js +10 -2
- package/dist/ui/components/TagInput.d.ts +8 -1
- package/dist/ui/components/TagInput.js +4 -3
- package/dist/ui/components/Textarea.js +10 -2
- package/dist/ui/components/tabs-overflow.js +64 -11
- package/dist/ui/forms/FieldCheckbox.js +1 -1
- package/dist/ui/forms/FormErrorList.d.ts +0 -16
- package/dist/ui/forms/FormErrorList.js +34 -1
- package/dist/ui/forms/apply-zod-issues.d.ts +19 -1
- package/dist/ui/forms/apply-zod-issues.js +23 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/rich-text/RichText.style.css +48 -79
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +1831 -1822
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimers — one registry, rendered by `<Disclaimer id>` (Phase 12).
|
|
3
|
+
*
|
|
4
|
+
* ## 🛑 Why a registry and not a sentence per surface
|
|
5
|
+
*
|
|
6
|
+
* Same failure mode as the published numbers in Phase 9: if each surface
|
|
7
|
+
* writes its own, they drift, and **the legally material ones end up
|
|
8
|
+
* weakest** — because the surface that most needs a careful disclaimer is
|
|
9
|
+
* usually the one whose author was busiest. The scam registry is the example:
|
|
10
|
+
* naming a person a scammer is defamation exposure, and it had no disclaimer
|
|
11
|
+
* at all.
|
|
12
|
+
*
|
|
13
|
+
* ## The three rules every entry obeys
|
|
14
|
+
*
|
|
15
|
+
* 1. **Visible BEFORE the decision it qualifies**, not only on a policy page
|
|
16
|
+
* reachable from the footer. The protection disclaimer belongs beside the
|
|
17
|
+
* checkbox, not in `/refund-policy`.
|
|
18
|
+
* 2. **It names a LIMIT or an EXCLUSION.** A disclaimer that only says "we
|
|
19
|
+
* try our best" qualifies nothing and is worse than none — it reads as
|
|
20
|
+
* cover while providing none.
|
|
21
|
+
* 3. **It AGREES with the code.** Limits render from the constants that
|
|
22
|
+
* enforce them (`SALE_PROTECTION_MAX_VALUE`, the claim windows), through
|
|
23
|
+
* the same `{{token}}` mechanism as Phase 9, so a constant change updates
|
|
24
|
+
* the published terms rather than contradicting them.
|
|
25
|
+
*
|
|
26
|
+
* ## 🛑 NOT a cookie-banner blanket
|
|
27
|
+
*
|
|
28
|
+
* A disclaimer that appears everywhere is read nowhere. Each entry names the
|
|
29
|
+
* specific surfaces that need it, and `audit-disclaimer-coverage` checks those
|
|
30
|
+
* surfaces render one — not that every page does.
|
|
31
|
+
*/
|
|
32
|
+
export type DisclaimerId =
|
|
33
|
+
/** Naming a person a scammer. The highest-exposure entry in this file. */
|
|
34
|
+
"scam-registry"
|
|
35
|
+
/** Prize draws and the lottery — state-specific gaming law. */
|
|
36
|
+
| "prize-draw"
|
|
37
|
+
/** Collectibles shown with historical prices. */
|
|
38
|
+
| "not-investment-advice"
|
|
39
|
+
/** The realised-price index. */
|
|
40
|
+
| "price-index"
|
|
41
|
+
/** Authenticity and grading. */
|
|
42
|
+
| "authenticity"
|
|
43
|
+
/** Buyer protection cover — OUR cover, not insurance. */
|
|
44
|
+
| "protection-cover"
|
|
45
|
+
/** P&L, trial balance, GSTR-1 draft. */
|
|
46
|
+
| "accounting-output"
|
|
47
|
+
/** Live animals and plants. */
|
|
48
|
+
| "live-items"
|
|
49
|
+
/** Pre-orders. */
|
|
50
|
+
| "pre-order"
|
|
51
|
+
/** Auctions. */
|
|
52
|
+
| "auction-binding"
|
|
53
|
+
/** EMI. */
|
|
54
|
+
| "emi"
|
|
55
|
+
/** Delivery estimates. */
|
|
56
|
+
| "delivery-estimate"
|
|
57
|
+
/** Reviews, catalogue entries, blog comments. */
|
|
58
|
+
| "user-content"
|
|
59
|
+
/** GST shown on an invoice. */
|
|
60
|
+
| "tax-computation"
|
|
61
|
+
/** An automated decision — a timer cancelled, approved or completed something. */
|
|
62
|
+
| "automated-decision";
|
|
63
|
+
export interface DisclaimerEntry {
|
|
64
|
+
/** Short heading, when the surface renders one. Omit for inline notes. */
|
|
65
|
+
heading?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The text. May contain `{{token}}`s resolved by `resolvePublishedCopy`.
|
|
68
|
+
*
|
|
69
|
+
* 🛑 Must name a limit or an exclusion — see rule 2 in the header. An entry
|
|
70
|
+
* that does not is not a disclaimer, and `audit-disclaimer-coverage` checks
|
|
71
|
+
* for it rather than trusting the author.
|
|
72
|
+
*/
|
|
73
|
+
body: string;
|
|
74
|
+
/**
|
|
75
|
+
* Tone, which decides the rendered variant.
|
|
76
|
+
*
|
|
77
|
+
* `legal` is the quiet grey note; `warning` is the one a user must not scroll
|
|
78
|
+
* past. 🛑 Reserved for the entries where ignoring it has a consequence the
|
|
79
|
+
* user cannot undo — not used to make a disclaimer feel important.
|
|
80
|
+
*/
|
|
81
|
+
tone: "legal" | "warning";
|
|
82
|
+
/**
|
|
83
|
+
* Where this must appear, as a free-text note for the reviewer and the
|
|
84
|
+
* audit's own registry.
|
|
85
|
+
*/
|
|
86
|
+
surfaces: readonly string[];
|
|
87
|
+
}
|
|
88
|
+
export declare const DISCLAIMERS: Record<DisclaimerId, DisclaimerEntry>;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimers — one registry, rendered by `<Disclaimer id>` (Phase 12).
|
|
3
|
+
*
|
|
4
|
+
* ## 🛑 Why a registry and not a sentence per surface
|
|
5
|
+
*
|
|
6
|
+
* Same failure mode as the published numbers in Phase 9: if each surface
|
|
7
|
+
* writes its own, they drift, and **the legally material ones end up
|
|
8
|
+
* weakest** — because the surface that most needs a careful disclaimer is
|
|
9
|
+
* usually the one whose author was busiest. The scam registry is the example:
|
|
10
|
+
* naming a person a scammer is defamation exposure, and it had no disclaimer
|
|
11
|
+
* at all.
|
|
12
|
+
*
|
|
13
|
+
* ## The three rules every entry obeys
|
|
14
|
+
*
|
|
15
|
+
* 1. **Visible BEFORE the decision it qualifies**, not only on a policy page
|
|
16
|
+
* reachable from the footer. The protection disclaimer belongs beside the
|
|
17
|
+
* checkbox, not in `/refund-policy`.
|
|
18
|
+
* 2. **It names a LIMIT or an EXCLUSION.** A disclaimer that only says "we
|
|
19
|
+
* try our best" qualifies nothing and is worse than none — it reads as
|
|
20
|
+
* cover while providing none.
|
|
21
|
+
* 3. **It AGREES with the code.** Limits render from the constants that
|
|
22
|
+
* enforce them (`SALE_PROTECTION_MAX_VALUE`, the claim windows), through
|
|
23
|
+
* the same `{{token}}` mechanism as Phase 9, so a constant change updates
|
|
24
|
+
* the published terms rather than contradicting them.
|
|
25
|
+
*
|
|
26
|
+
* ## 🛑 NOT a cookie-banner blanket
|
|
27
|
+
*
|
|
28
|
+
* A disclaimer that appears everywhere is read nowhere. Each entry names the
|
|
29
|
+
* specific surfaces that need it, and `audit-disclaimer-coverage` checks those
|
|
30
|
+
* surfaces render one — not that every page does.
|
|
31
|
+
*/
|
|
32
|
+
export const DISCLAIMERS = {
|
|
33
|
+
/*
|
|
34
|
+
* ── 🛑 THE DEFAMATION ONE. Read this before editing it ────────────────────
|
|
35
|
+
*
|
|
36
|
+
* A scam profile names a real person, with their payment handle and their
|
|
37
|
+
* phone number, on a public page. That is defamation exposure, and the
|
|
38
|
+
* registry had NO disclaimer of any kind.
|
|
39
|
+
*
|
|
40
|
+
* Four things this text must do, each for a specific reason:
|
|
41
|
+
*
|
|
42
|
+
* 1. **Distinguish an ALLEGATION from a verified finding.** The status badge
|
|
43
|
+
* already says `pending_review` vs `verified`, but a visitor reads the
|
|
44
|
+
* name and the amount, not the badge — so the distinction has to be in
|
|
45
|
+
* words.
|
|
46
|
+
* 2. **State the evidence standard**, because "we checked" is not a standard
|
|
47
|
+
* and invites the reader to assume a higher one than we applied.
|
|
48
|
+
* 3. **Name the removal route.** A person named here needs a way to contest
|
|
49
|
+
* it that does not begin with a lawyer, and publishing one is itself part
|
|
50
|
+
* of the defence.
|
|
51
|
+
* 4. 🛑 **Refuse the shared-guilt inference.** `relatedScammerIds` means
|
|
52
|
+
* SAME IDENTITY — the same person under another handle — and never
|
|
53
|
+
* "similar pattern". A reader who takes it as the latter concludes that
|
|
54
|
+
* everyone in a cluster is guilty of everyone else's conduct, which is
|
|
55
|
+
* the single most damaging misreading this page permits.
|
|
56
|
+
*/
|
|
57
|
+
"scam-registry": {
|
|
58
|
+
heading: "About these reports",
|
|
59
|
+
body: "These are reports submitted by buyers and sellers, not findings of fact or a legal judgment. " +
|
|
60
|
+
"A profile marked **under review** is an unverified allegation. A profile marked **verified** means " +
|
|
61
|
+
"our team has seen supporting evidence — payment records, messages or delivery proof — supplied by the " +
|
|
62
|
+
"person reporting; it is not a court finding and we are not able to investigate beyond the documents " +
|
|
63
|
+
"we are shown. " +
|
|
64
|
+
"Linked profiles indicate the SAME person under another name or handle, and never that separate people " +
|
|
65
|
+
"are connected to each other's conduct. " +
|
|
66
|
+
"If you are named here and believe it is wrong, contact us and we will review the report and remove it " +
|
|
67
|
+
"if it is not supported.",
|
|
68
|
+
tone: "warning",
|
|
69
|
+
surfaces: ["ScamProfileView", "ScamRegistryView", "/report"],
|
|
70
|
+
},
|
|
71
|
+
/*
|
|
72
|
+
* Gaming law in India is STATE-SPECIFIC, and the distinction that matters
|
|
73
|
+
* legally is skill versus chance. The entry names the exclusions rather than
|
|
74
|
+
* claiming a position we cannot defend in every state.
|
|
75
|
+
*/
|
|
76
|
+
"prize-draw": {
|
|
77
|
+
heading: "Prize draw terms",
|
|
78
|
+
body: "Entry requires a purchase and is void where prohibited by local law. Residents of states that " +
|
|
79
|
+
"restrict prize draws or games of chance are not eligible, and an entry from such a state will be " +
|
|
80
|
+
"refunded rather than drawn. Prizes are as described on the listing, are not transferable and cannot " +
|
|
81
|
+
"be exchanged for cash. The draw is run by LetItRip and is not affiliated with any government lottery.",
|
|
82
|
+
tone: "warning",
|
|
83
|
+
surfaces: ["PrizeDrawDetailPageView", "/prize-draws", "/lottery", "PrizeRevealModal"],
|
|
84
|
+
},
|
|
85
|
+
/*
|
|
86
|
+
* 🛑 Shown wherever a historical price appears. Collectibles displayed with
|
|
87
|
+
* past realised prices invite an appreciation inference, and the moment a
|
|
88
|
+
* buyer treats that as a projection we are giving investment advice we are
|
|
89
|
+
* not licensed to give.
|
|
90
|
+
*/
|
|
91
|
+
"not-investment-advice": {
|
|
92
|
+
body: "Prices shown are past transactions, not a valuation, a projection or a guarantee. Collectibles can " +
|
|
93
|
+
"fall in value as easily as rise, may be difficult to sell at any price, and LetItRip does not provide " +
|
|
94
|
+
"investment advice. Nothing here should be relied on as a reason to buy.",
|
|
95
|
+
tone: "legal",
|
|
96
|
+
surfaces: ["PriceIndexView", "RealisedPriceStrip", "/franchise", "ProductDetailPageView"],
|
|
97
|
+
},
|
|
98
|
+
/*
|
|
99
|
+
* 🛑 Names the SAMPLE, because an index built from four sales reads exactly
|
|
100
|
+
* like one built from four hundred — and "asked ≠ sold" is the distinction a
|
|
101
|
+
* seller pricing against it most needs.
|
|
102
|
+
*/
|
|
103
|
+
"price-index": {
|
|
104
|
+
body: "Each figure is drawn from a limited number of observed sales over the period shown, and a small " +
|
|
105
|
+
"sample can move sharply on one unusual transaction. Asking prices are not sale prices: an item " +
|
|
106
|
+
"listed at a figure may never have sold at it.",
|
|
107
|
+
tone: "legal",
|
|
108
|
+
surfaces: ["PriceIndexView", "PriceBandChart"],
|
|
109
|
+
},
|
|
110
|
+
"authenticity": {
|
|
111
|
+
body: "LetItRip is not an authentication or grading service. We do not inspect, test or re-grade items, " +
|
|
112
|
+
"and a grade shown on a listing is the one the seller states a third-party grader assigned. " +
|
|
113
|
+
"Guidance on spotting a counterfeit is general information, not a verification of any particular item.",
|
|
114
|
+
tone: "legal",
|
|
115
|
+
surfaces: ["/spot-a-fake", "ProductDetailPageView", "authenticityKnowledge"],
|
|
116
|
+
},
|
|
117
|
+
/*
|
|
118
|
+
* 🛑 **"Not insurance" is the load-bearing phrase.** There is no insurer —
|
|
119
|
+
* this is our own cover, funded by us, and calling it insurance would be a
|
|
120
|
+
* regulatory misstatement as well as a false one.
|
|
121
|
+
*
|
|
122
|
+
* Every limit renders from the constant that enforces it, so a change to
|
|
123
|
+
* `SALE_PROTECTION_MAX_VALUE` or a claim window updates this text rather
|
|
124
|
+
* than contradicting it.
|
|
125
|
+
*/
|
|
126
|
+
"protection-cover": {
|
|
127
|
+
heading: "What protection covers",
|
|
128
|
+
body: "Buyer protection is cover provided by LetItRip. It is **not insurance** and there is no insurer. " +
|
|
129
|
+
"Shipment protection covers loss or damage in transit and must be claimed within " +
|
|
130
|
+
"{{shipmentClaimHours}} hours of delivery. Sale protection covers an item up to " +
|
|
131
|
+
"{{saleProtectionMaxValue}} and must be claimed within {{saleClaimHours}} hours of delivery. " +
|
|
132
|
+
"Neither covers a change of mind, an item sold as final sale, or a claim made after its window has " +
|
|
133
|
+
"closed.",
|
|
134
|
+
tone: "legal",
|
|
135
|
+
surfaces: ["StoreAddonsPicker", "/fees", "/refund-policy", "ProtectionClaimForm"],
|
|
136
|
+
},
|
|
137
|
+
/*
|
|
138
|
+
* 🛑 "Management figures, not audited accounts" — and the GSTR-1 export is
|
|
139
|
+
* the INPUT to a filing, never a filing. Implying a return had been filed
|
|
140
|
+
* when it had not is the most consequential thing this product could say.
|
|
141
|
+
*/
|
|
142
|
+
"accounting-output": {
|
|
143
|
+
body: "These are management figures produced from this platform's own records. They are not audited " +
|
|
144
|
+
"accounts and have not been reviewed by an accountant. The GSTR-1 export is a draft for your " +
|
|
145
|
+
"accountant to check and use — nothing here is filed with any tax authority, and LetItRip has no " +
|
|
146
|
+
"connection to the GST portal.",
|
|
147
|
+
tone: "warning",
|
|
148
|
+
surfaces: ["AdminInvoicingView", "AdminAnalyticsView", "ProfitLossView", "TrialBalanceView"],
|
|
149
|
+
},
|
|
150
|
+
"live-items": {
|
|
151
|
+
heading: "Live item terms",
|
|
152
|
+
body: "Live animals and plants ship only where law permits, and some species cannot be sent across state " +
|
|
153
|
+
"or international borders at all — CITES-listed species in particular. The buyer is responsible for " +
|
|
154
|
+
"holding any licence their own jurisdiction requires. No guarantee of health, size, sex or lifespan " +
|
|
155
|
+
"is given beyond what the listing states, and a live item cannot be returned for a change of mind.",
|
|
156
|
+
tone: "warning",
|
|
157
|
+
surfaces: ["LiveItemDetailPageView", "/live"],
|
|
158
|
+
},
|
|
159
|
+
"pre-order": {
|
|
160
|
+
body: "A release date on a pre-order is the manufacturer's estimate and can move or be cancelled by them. " +
|
|
161
|
+
"Your deposit is refundable until the item ships; the remaining balance is charged when it is ready " +
|
|
162
|
+
"to dispatch, against the terms shown when you placed the pre-order.",
|
|
163
|
+
tone: "legal",
|
|
164
|
+
surfaces: ["PreOrderDetailPageView", "/pre-orders"],
|
|
165
|
+
},
|
|
166
|
+
"auction-binding": {
|
|
167
|
+
body: "A bid is a binding offer to buy at that price and cannot be withdrawn. If the reserve price is not " +
|
|
168
|
+
"met the item does not sell, even if yours was the highest bid. Winning starts a payment window — " +
|
|
169
|
+
"miss it and the win is forfeited.",
|
|
170
|
+
tone: "warning",
|
|
171
|
+
surfaces: ["PlaceBidForm", "AuctionDetailPageView", "/auctions"],
|
|
172
|
+
},
|
|
173
|
+
"emi": {
|
|
174
|
+
body: "EMI adds a surcharge to the order total, shown before you pay. The instalment plan is between you " +
|
|
175
|
+
"and LetItRip rather than a bank, and a missed instalment may suspend access to the order and is " +
|
|
176
|
+
"recoverable as a debt.",
|
|
177
|
+
tone: "legal",
|
|
178
|
+
surfaces: ["CheckoutRouteClient", "/fees", "EmiScheduleTable"],
|
|
179
|
+
},
|
|
180
|
+
"delivery-estimate": {
|
|
181
|
+
body: "Delivery dates are estimates from the courier, not guarantees, and can be affected by weather, " +
|
|
182
|
+
"strikes and customs. A late delivery is not by itself grounds for a refund.",
|
|
183
|
+
tone: "legal",
|
|
184
|
+
surfaces: ["CheckoutRouteClient", "ProductDetailPageView", "OrderTrackView"],
|
|
185
|
+
},
|
|
186
|
+
"user-content": {
|
|
187
|
+
body: "Reviews, catalogue entries and comments are the opinions of the people who wrote them, not " +
|
|
188
|
+
"LetItRip's. We remove content that breaks our rules when it is reported, but we do not verify every " +
|
|
189
|
+
"claim made in it.",
|
|
190
|
+
tone: "legal",
|
|
191
|
+
surfaces: ["ReviewsList", "ReviewDetailShell", "PublicProfileView", "BlogPostView"],
|
|
192
|
+
},
|
|
193
|
+
"tax-computation": {
|
|
194
|
+
body: "GST shown is computed from the information available to us at the time of supply — the item's tax " +
|
|
195
|
+
"code and the delivery address you gave. Your own tax position, including any input credit, is yours " +
|
|
196
|
+
"to determine with your accountant.",
|
|
197
|
+
tone: "legal",
|
|
198
|
+
surfaces: ["InvoicePageView", "/gst", "OrderSummary"],
|
|
199
|
+
},
|
|
200
|
+
/*
|
|
201
|
+
* 🛑 The Phase 5b obligations act on timers — cancelling orders, approving
|
|
202
|
+
* returns, completing orders. A buyer whose order was cancelled by a sweep
|
|
203
|
+
* must be TOLD it was automatic and how to contest it; otherwise the first
|
|
204
|
+
* they know is a refund they did not request, which reads as us losing their
|
|
205
|
+
* order.
|
|
206
|
+
*/
|
|
207
|
+
"automated-decision": {
|
|
208
|
+
body: "This was done automatically, by a time limit rather than by a person. If you think it was wrong, " +
|
|
209
|
+
"reply to this notification or open a support ticket and a person will look at it.",
|
|
210
|
+
tone: "legal",
|
|
211
|
+
surfaces: [
|
|
212
|
+
"obligation notifications",
|
|
213
|
+
"OrderStatusTimeline",
|
|
214
|
+
"AdminObligationsView",
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Published numbers — ONE definition, rendered everywhere (Phase 9).
|
|
3
|
+
*
|
|
4
|
+
* ## 🛑 The problem this solves, stated as a measurement
|
|
5
|
+
*
|
|
6
|
+
* The same fact was published in four places with different answers. The
|
|
7
|
+
* refund timeline appeared as "5–7 business days via Razorpay" (policy page,
|
|
8
|
+
* naming the wrong gateway), "5–7 business days" (`REFUND_COPY`) and "3–5
|
|
9
|
+
* business days" (the FAQ). The return window appeared as 7 days, 2 days and
|
|
10
|
+
* 48 hours. The seller's return-response window is 48 hours in the FAQ and 3
|
|
11
|
+
* days in `AdminOrdersGuideView`. The offer checkout deadline is 48h in code
|
|
12
|
+
* and 24h in both the FAQ and the seed.
|
|
13
|
+
*
|
|
14
|
+
* Four owners, nothing reconciling them, and one of the four — the FAQ — is
|
|
15
|
+
* **seeded into Firestore and then admin-editable**, so a number quoted there
|
|
16
|
+
* drifts *after* deployment with no audit able to see it.
|
|
17
|
+
*
|
|
18
|
+
* ## 🛑 So copy carries TOKENS, and the token resolves at render time
|
|
19
|
+
*
|
|
20
|
+
* `{{returnWindowDays}}` in an FAQ answer is a promise that cannot drift: the
|
|
21
|
+
* FAQ is still admin-editable, but the NUMBER inside it comes from here. An
|
|
22
|
+
* admin can rewrite the sentence and cannot contradict the code.
|
|
23
|
+
*
|
|
24
|
+
* ## 🛑 This is NOT a settings group, and must not become one
|
|
25
|
+
*
|
|
26
|
+
* Nothing here is admin-editable. These are the values the CODE enforces —
|
|
27
|
+
* `ORDER_RETURN_WINDOW_MS`, the obligation policies, `LANE_CHECKOUT_WINDOW_MS`
|
|
28
|
+
* — surfaced for rendering. An editable copy of an enforced constant is two
|
|
29
|
+
* sources of truth with a settings UI making the wrong one look
|
|
30
|
+
* authoritative, which is the 18-dead-settings pattern (D28/D44/D57/D60)
|
|
31
|
+
* arriving from the opposite direction: not a control that does nothing, but a
|
|
32
|
+
* control that appears to do something the code ignores.
|
|
33
|
+
*
|
|
34
|
+
* Where a value genuinely IS configurable, the entry derives it from the
|
|
35
|
+
* setting rather than restating it — see `resolvePublishedValues`.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Every token that may appear in published copy.
|
|
39
|
+
*
|
|
40
|
+
* 🛑 A `Record` over this union, so a token added to the type without a value
|
|
41
|
+
* is a COMPILE error — and a token used in copy that is not in the union is
|
|
42
|
+
* caught by `resolvePublishedCopy` leaving it visibly unresolved rather than
|
|
43
|
+
* silently blanking it. Both directions matter: a blanked token reads as a
|
|
44
|
+
* sentence with a word missing, which nobody reports, while `{{wrongKey}}` on
|
|
45
|
+
* a live page gets reported in minutes.
|
|
46
|
+
*/
|
|
47
|
+
export type PublishedValueKey = "returnWindowDays" | "sellerAcceptDays" | "sellerDispatchBusinessDays" | "returnRespondHours" | "returnPostDays" | "offerCheckoutHours" | "paymentWindowMinutes" | "deliveryConfirmDays" | "orderCompleteDays" | "shipmentClaimHours" | "saleClaimHours" | "disputeTransitWindowDays" | "disputeNotReachedGraceDays" | "platformFeeMax" | "platformFeePercent" | "shipmentProtectionPercent" | "shipmentProtectionMin" | "saleProtectionPercent" | "saleProtectionMin" | "saleProtectionMaxValue" | "codHandlingPercent" | "codDepositPercent" | "giftWrapFee" | "pointsEarnPercent" | "pointsMaxRedemptionPercent" | "pointsExpiryMonths" | "refundBusinessDaysMin" | "refundBusinessDaysMax";
|
|
48
|
+
export type PublishedValues = Record<PublishedValueKey, string>;
|
|
49
|
+
/**
|
|
50
|
+
* The settings this registry reads, where a value genuinely is configurable.
|
|
51
|
+
*
|
|
52
|
+
* Deliberately a narrow shape rather than `SiteSettingsDocument`: this module
|
|
53
|
+
* is imported by client components to render copy, and widening it to the
|
|
54
|
+
* whole settings document would invite a caller to pass one in — which is Root
|
|
55
|
+
* Cause #70's leak (a raw document reaching a Client Component prop, where
|
|
56
|
+
* TypeScript's structural typing strips nothing at runtime).
|
|
57
|
+
*/
|
|
58
|
+
export interface PublishedValueSettings {
|
|
59
|
+
platformFeeMax?: number;
|
|
60
|
+
platformFeePercent?: number;
|
|
61
|
+
shipmentProtectionFeePercent?: number;
|
|
62
|
+
shipmentProtectionFeeMin?: number;
|
|
63
|
+
saleProtectionFeePercent?: number;
|
|
64
|
+
saleProtectionFeeMin?: number;
|
|
65
|
+
codHandlingFeePercent?: number;
|
|
66
|
+
codDepositPercent?: number;
|
|
67
|
+
giftWrapFee?: number;
|
|
68
|
+
returnWindowDays?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve every published value.
|
|
72
|
+
*
|
|
73
|
+
* 🛑 Settings are read where they exist and the CODE is read where it does
|
|
74
|
+
* not. A value with no setting is not a gap to fill with a literal — it is a
|
|
75
|
+
* constant the code enforces, and restating it here is how the four
|
|
76
|
+
* contradictions above happened in the first place.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolvePublishedValues(settings?: PublishedValueSettings): PublishedValues;
|
|
79
|
+
/**
|
|
80
|
+
* Replace every `{{token}}` in a string.
|
|
81
|
+
*
|
|
82
|
+
* 🛑 An UNKNOWN token is left verbatim, never blanked. A blanked token reads
|
|
83
|
+
* as a sentence with a word missing — which looks like clumsy copy and nobody
|
|
84
|
+
* reports — while a visible `{{returnWindowDayz}}` on a live page is reported
|
|
85
|
+
* within minutes. Failing loudly is the whole point of a token system whose
|
|
86
|
+
* copy is admin-editable.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolvePublishedCopy(text: string, values: PublishedValues): string;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Published numbers — ONE definition, rendered everywhere (Phase 9).
|
|
3
|
+
*
|
|
4
|
+
* ## 🛑 The problem this solves, stated as a measurement
|
|
5
|
+
*
|
|
6
|
+
* The same fact was published in four places with different answers. The
|
|
7
|
+
* refund timeline appeared as "5–7 business days via Razorpay" (policy page,
|
|
8
|
+
* naming the wrong gateway), "5–7 business days" (`REFUND_COPY`) and "3–5
|
|
9
|
+
* business days" (the FAQ). The return window appeared as 7 days, 2 days and
|
|
10
|
+
* 48 hours. The seller's return-response window is 48 hours in the FAQ and 3
|
|
11
|
+
* days in `AdminOrdersGuideView`. The offer checkout deadline is 48h in code
|
|
12
|
+
* and 24h in both the FAQ and the seed.
|
|
13
|
+
*
|
|
14
|
+
* Four owners, nothing reconciling them, and one of the four — the FAQ — is
|
|
15
|
+
* **seeded into Firestore and then admin-editable**, so a number quoted there
|
|
16
|
+
* drifts *after* deployment with no audit able to see it.
|
|
17
|
+
*
|
|
18
|
+
* ## 🛑 So copy carries TOKENS, and the token resolves at render time
|
|
19
|
+
*
|
|
20
|
+
* `{{returnWindowDays}}` in an FAQ answer is a promise that cannot drift: the
|
|
21
|
+
* FAQ is still admin-editable, but the NUMBER inside it comes from here. An
|
|
22
|
+
* admin can rewrite the sentence and cannot contradict the code.
|
|
23
|
+
*
|
|
24
|
+
* ## 🛑 This is NOT a settings group, and must not become one
|
|
25
|
+
*
|
|
26
|
+
* Nothing here is admin-editable. These are the values the CODE enforces —
|
|
27
|
+
* `ORDER_RETURN_WINDOW_MS`, the obligation policies, `LANE_CHECKOUT_WINDOW_MS`
|
|
28
|
+
* — surfaced for rendering. An editable copy of an enforced constant is two
|
|
29
|
+
* sources of truth with a settings UI making the wrong one look
|
|
30
|
+
* authoritative, which is the 18-dead-settings pattern (D28/D44/D57/D60)
|
|
31
|
+
* arriving from the opposite direction: not a control that does nothing, but a
|
|
32
|
+
* control that appears to do something the code ignores.
|
|
33
|
+
*
|
|
34
|
+
* Where a value genuinely IS configurable, the entry derives it from the
|
|
35
|
+
* setting rather than restating it — see `resolvePublishedValues`.
|
|
36
|
+
*/
|
|
37
|
+
/*
|
|
38
|
+
* 🛑 Every import here is the thing that ENFORCES the value, not a mirror of
|
|
39
|
+
* it. That is what makes "the code wins" structural rather than a convention
|
|
40
|
+
* somebody has to remember — and it is why there is no literal for the offer
|
|
41
|
+
* deadline or the claim windows even though both appear in published copy.
|
|
42
|
+
*/
|
|
43
|
+
import { OBLIGATION_POLICIES } from "../../../features/obligations/constants/policies.js";
|
|
44
|
+
import { POINTS_EARN_PERCENT, POINTS_EXPIRY_MONTHS, POINTS_MAX_REDEMPTION_PERCENT, } from "../../../features/points/schemas/firestore.js";
|
|
45
|
+
import { PAYMENT_WINDOW_MINUTES } from "../../../features/orders/constants/payment-window.js";
|
|
46
|
+
import { SALE_PROTECTION_MAX_VALUE } from "../features/shipping/protections.js";
|
|
47
|
+
import { LANE_CHECKOUT_WINDOW_MS } from "../checkout/lanes.js";
|
|
48
|
+
import { DISPUTE_TRANSIT_WINDOW_DAYS, DISPUTE_NOT_REACHED_GRACE_DAYS, } from "../features/orders/dispute-reasons.js";
|
|
49
|
+
/**
|
|
50
|
+
* The offer checkout deadline, in hours, derived from the constant the lapse
|
|
51
|
+
* sweep actually enforces.
|
|
52
|
+
*
|
|
53
|
+
* 🛑 Decision 23: the CODE wins this contradiction, not the FAQ's 24h and not
|
|
54
|
+
* the seed's. An offer accepted yesterday carries a 48h `checkoutDeadline`
|
|
55
|
+
* stored on it, so publishing 24 would be telling a buyer their live offer
|
|
56
|
+
* expires sooner than it does — and changing the code to match the FAQ would
|
|
57
|
+
* shorten deadlines already granted.
|
|
58
|
+
*/
|
|
59
|
+
const OFFER_CHECKOUT_HOURS = Math.round(LANE_CHECKOUT_WINDOW_MS.offer / 3600000);
|
|
60
|
+
/*
|
|
61
|
+
* ── The decided values (decision 23) ─────────────────────────────────────────
|
|
62
|
+
*
|
|
63
|
+
* Two live contradictions are resolved by NAMING A WINNER rather than
|
|
64
|
+
* averaging:
|
|
65
|
+
*
|
|
66
|
+
* - **return-response: 48 hours.** The FAQ wins over
|
|
67
|
+
* `AdminOrdersGuideView`'s 3 days, because 48h is the buyer-facing promise
|
|
68
|
+
* and the one a buyer has already read.
|
|
69
|
+
* - **offer checkout: 48 hours.** The CODE wins over the FAQ's and the seed's
|
|
70
|
+
* 24h, because changing it would break live offers — an offer accepted
|
|
71
|
+
* yesterday has a 48h deadline stored on it.
|
|
72
|
+
*
|
|
73
|
+
* Both are derived from the obligation policies and `LANE_CHECKOUT_WINDOW_MS`
|
|
74
|
+
* below rather than restated here, so "the code wins" is structural.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* A policy's duration in minutes, whatever unit it declares.
|
|
78
|
+
*
|
|
79
|
+
* 🛑 EXHAUSTIVE over `DurationUnit`, which is `minutes | hours | days` — not
|
|
80
|
+
* the two-case ternary this started as. A `minutes` duration read by a
|
|
81
|
+
* hours-or-days ternary would be published as that many HOURS: a 15-minute
|
|
82
|
+
* window rendered to a buyer as 15 hours, with nothing erroring. The
|
|
83
|
+
* `switch` with no default is what makes a fourth unit a compile error rather
|
|
84
|
+
* than a silent 60× on a published promise.
|
|
85
|
+
*/
|
|
86
|
+
function policyMinutes(kind) {
|
|
87
|
+
const d = OBLIGATION_POLICIES[kind].duration;
|
|
88
|
+
switch (d.unit) {
|
|
89
|
+
case "minutes":
|
|
90
|
+
return d.value;
|
|
91
|
+
case "hours":
|
|
92
|
+
return d.value * 60;
|
|
93
|
+
case "days":
|
|
94
|
+
return d.value * 24 * 60;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Days, rounded.
|
|
99
|
+
*
|
|
100
|
+
* 🛑 `Math.round`, not `Math.floor`. A 36-hour window floors to 1 day, which
|
|
101
|
+
* UNDERSTATES a promise to a buyer — and a published window shorter than the
|
|
102
|
+
* one the code enforces is the direction that generates complaints. Rounding
|
|
103
|
+
* up-or-nearest can only overstate, which is the safe error. A policy whose
|
|
104
|
+
* duration does not divide cleanly into days should be published in hours
|
|
105
|
+
* instead; this is for the ones that do.
|
|
106
|
+
*/
|
|
107
|
+
function policyDays(kind) {
|
|
108
|
+
return Math.round(policyMinutes(kind) / (24 * 60));
|
|
109
|
+
}
|
|
110
|
+
/** Hours, from the obligation policy that enforces it. */
|
|
111
|
+
function policyHours(kind) {
|
|
112
|
+
return Math.round(policyMinutes(kind) / 60);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Resolve every published value.
|
|
116
|
+
*
|
|
117
|
+
* 🛑 Settings are read where they exist and the CODE is read where it does
|
|
118
|
+
* not. A value with no setting is not a gap to fill with a literal — it is a
|
|
119
|
+
* constant the code enforces, and restating it here is how the four
|
|
120
|
+
* contradictions above happened in the first place.
|
|
121
|
+
*/
|
|
122
|
+
export function resolvePublishedValues(settings) {
|
|
123
|
+
return {
|
|
124
|
+
// ── Windows: every one of these comes from the thing that enforces it ──
|
|
125
|
+
returnWindowDays: String(settings?.returnWindowDays ?? 7),
|
|
126
|
+
sellerAcceptDays: String(policyDays("seller-accept")),
|
|
127
|
+
sellerDispatchBusinessDays: String(policyDays("seller-dispatch")),
|
|
128
|
+
returnRespondHours: String(policyHours("return-respond")),
|
|
129
|
+
returnPostDays: String(policyDays("return-post")),
|
|
130
|
+
offerCheckoutHours: String(OFFER_CHECKOUT_HOURS),
|
|
131
|
+
paymentWindowMinutes: String(PAYMENT_WINDOW_MINUTES),
|
|
132
|
+
deliveryConfirmDays: String(policyDays("delivery-confirm")),
|
|
133
|
+
orderCompleteDays: String(policyDays("order-complete")),
|
|
134
|
+
shipmentClaimHours: String(policyHours("claim-shipping")),
|
|
135
|
+
saleClaimHours: String(policyHours("claim-sale")),
|
|
136
|
+
/*
|
|
137
|
+
* Straight from the dispute module's own constants, not re-typed here.
|
|
138
|
+
* Two copies of a published number is the exact drift Phase 9 exists to
|
|
139
|
+
* remove — the table in this file's own header records a return window
|
|
140
|
+
* that code said 7, one FAQ said 2 and another said 48 hours.
|
|
141
|
+
*/
|
|
142
|
+
disputeTransitWindowDays: String(DISPUTE_TRANSIT_WINDOW_DAYS),
|
|
143
|
+
disputeNotReachedGraceDays: String(DISPUTE_NOT_REACHED_GRACE_DAYS),
|
|
144
|
+
// ── Money: settings-driven, with the schema defaults as the fallback ───
|
|
145
|
+
platformFeeMax: formatRupees(settings?.platformFeeMax ?? 10),
|
|
146
|
+
platformFeePercent: String(settings?.platformFeePercent ?? 2),
|
|
147
|
+
shipmentProtectionPercent: String(settings?.shipmentProtectionFeePercent ?? 2),
|
|
148
|
+
shipmentProtectionMin: formatRupees(settings?.shipmentProtectionFeeMin ?? 30),
|
|
149
|
+
saleProtectionPercent: String(settings?.saleProtectionFeePercent ?? 3),
|
|
150
|
+
saleProtectionMin: formatRupees(settings?.saleProtectionFeeMin ?? 49),
|
|
151
|
+
saleProtectionMaxValue: formatRupees(SALE_PROTECTION_MAX_VALUE),
|
|
152
|
+
codHandlingPercent: String(settings?.codHandlingFeePercent ?? 2),
|
|
153
|
+
codDepositPercent: String(settings?.codDepositPercent ?? 10),
|
|
154
|
+
giftWrapFee: formatRupees(settings?.giftWrapFee ?? 0),
|
|
155
|
+
// ── Points ─────────────────────────────────────────────────────────────
|
|
156
|
+
pointsEarnPercent: String(POINTS_EARN_PERCENT),
|
|
157
|
+
pointsMaxRedemptionPercent: String(POINTS_MAX_REDEMPTION_PERCENT),
|
|
158
|
+
pointsExpiryMonths: String(POINTS_EXPIRY_MONTHS),
|
|
159
|
+
// ── Refunds ────────────────────────────────────────────────────────────
|
|
160
|
+
/*
|
|
161
|
+
* 🛑 The gateway's own processing time, and the ONE value here that no
|
|
162
|
+
* code enforces — so it is a literal, and that is stated rather than
|
|
163
|
+
* hidden. It is also where the three-way contradiction lived (5–7 / 5–7 /
|
|
164
|
+
* 3–5), which is the argument for putting it here at all: a number nothing
|
|
165
|
+
* enforces is exactly the one that drifts.
|
|
166
|
+
*
|
|
167
|
+
* 🛑 And the published copy must NOT name the gateway. The policy page
|
|
168
|
+
* said "via Razorpay" while payment ran through PhonePe, and it will be
|
|
169
|
+
* wrong again the next time a provider changes — a fact about our vendor
|
|
170
|
+
* is not a fact the buyer needs.
|
|
171
|
+
*/
|
|
172
|
+
refundBusinessDaysMin: "5",
|
|
173
|
+
refundBusinessDaysMax: "7",
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Replace every `{{token}}` in a string.
|
|
178
|
+
*
|
|
179
|
+
* 🛑 An UNKNOWN token is left verbatim, never blanked. A blanked token reads
|
|
180
|
+
* as a sentence with a word missing — which looks like clumsy copy and nobody
|
|
181
|
+
* reports — while a visible `{{returnWindowDayz}}` on a live page is reported
|
|
182
|
+
* within minutes. Failing loudly is the whole point of a token system whose
|
|
183
|
+
* copy is admin-editable.
|
|
184
|
+
*/
|
|
185
|
+
export function resolvePublishedCopy(text, values) {
|
|
186
|
+
return text.replace(/\{\{(\w+)\}\}/g, (whole, key) => {
|
|
187
|
+
const resolved = values[key];
|
|
188
|
+
return resolved ?? whole;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/** `₹10`, `₹1,499.50` — no trailing `.00` on a whole rupee figure. */
|
|
192
|
+
function formatRupees(amount) {
|
|
193
|
+
const whole = Number.isInteger(amount);
|
|
194
|
+
return `₹${amount.toLocaleString("en-IN", {
|
|
195
|
+
minimumFractionDigits: whole ? 0 : 2,
|
|
196
|
+
maximumFractionDigits: 2,
|
|
197
|
+
})}`;
|
|
198
|
+
}
|