@mohasinac/appkit 3.6.4 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/dist/_internal/client/features/layout/DashboardLayoutClient.d.ts +17 -3
  2. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +7 -2
  3. package/dist/_internal/client/features/tour/TourProvider.d.ts +5 -2
  4. package/dist/_internal/client/features/tour/TourProvider.js +125 -12
  5. package/dist/_internal/client/theme/ThemeProvider.js +1 -1
  6. package/dist/_internal/server/features/faqs/og.js +5 -1
  7. package/dist/_internal/server/features/reviews/og.js +5 -1
  8. package/dist/_internal/server/features/seo/manifest.js +2 -1
  9. package/dist/_internal/server/features/seo/og.js +7 -1
  10. package/dist/_internal/server/features/tester/visibility.d.ts +13 -0
  11. package/dist/_internal/server/features/tester/visibility.js +28 -0
  12. package/dist/_internal/server/functions/scheduled.d.ts +2 -1
  13. package/dist/_internal/server/functions/scheduled.js +9 -1
  14. package/dist/_internal/server/jobs/core/jobRunners.js +5 -0
  15. package/dist/_internal/server/jobs/core/resetOtpVerification.d.ts +17 -0
  16. package/dist/_internal/server/jobs/core/resetOtpVerification.js +88 -0
  17. package/dist/_internal/server/jobs/core/testerSandboxCleanup.d.ts +6 -0
  18. package/dist/_internal/server/jobs/core/testerSandboxCleanup.js +35 -0
  19. package/dist/_internal/server/jobs/handlers/_helpers.d.ts +6 -0
  20. package/dist/_internal/server/jobs/handlers/_helpers.js +12 -0
  21. package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
  22. package/dist/_internal/server/jobs/handlers/index.js +2 -0
  23. package/dist/_internal/server/jobs/handlers/messages.d.ts +2 -0
  24. package/dist/_internal/server/jobs/handlers/messages.js +2 -0
  25. package/dist/_internal/server/jobs/handlers/testerSandboxCleanup.d.ts +2 -0
  26. package/dist/_internal/server/jobs/handlers/testerSandboxCleanup.js +2 -0
  27. package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
  28. package/dist/_internal/shared/actions/action-registry.js +48 -0
  29. package/dist/_internal/shared/tokens/index.d.ts +12 -12
  30. package/dist/client.d.ts +15 -3
  31. package/dist/client.js +10 -2
  32. package/dist/constants/api-endpoints.d.ts +36 -12
  33. package/dist/constants/api-endpoints.js +16 -8
  34. package/dist/constants/field-names.d.ts +9 -0
  35. package/dist/constants/field-names.js +12 -0
  36. package/dist/constants/index.d.ts +1 -1
  37. package/dist/constants/index.js +1 -1
  38. package/dist/features/account/components/LinkedAccountsSection.d.ts +11 -0
  39. package/dist/features/account/components/LinkedAccountsSection.js +11 -0
  40. package/dist/features/account/components/UserSidebar.d.ts +3 -1
  41. package/dist/features/account/components/UserSidebar.js +11 -15
  42. package/dist/features/account/hooks/useCollapsedSections.d.ts +20 -0
  43. package/dist/features/account/hooks/useCollapsedSections.js +63 -0
  44. package/dist/features/account/hooks/useProfile.d.ts +8 -0
  45. package/dist/features/account/index.d.ts +1 -0
  46. package/dist/features/account/index.js +1 -0
  47. package/dist/features/admin/components/AdminAddressEditorView.js +2 -2
  48. package/dist/features/admin/components/AdminCarouselView.js +2 -2
  49. package/dist/features/admin/components/AdminCategoryEditorView.js +2 -2
  50. package/dist/features/admin/components/AdminProductEditorView.js +5 -2
  51. package/dist/features/admin/components/AdminSectionsView.js +3 -18
  52. package/dist/features/admin/components/AdminSidebar.js +10 -8
  53. package/dist/features/admin/components/AdminSiteSettingsView.js +133 -127
  54. package/dist/features/admin/components/AdminTesterChecklistItemEditorView.d.ts +9 -0
  55. package/dist/features/admin/components/AdminTesterChecklistItemEditorView.js +129 -0
  56. package/dist/features/admin/components/AdminTesterChecklistView.d.ts +6 -0
  57. package/dist/features/admin/components/AdminTesterChecklistView.js +93 -0
  58. package/dist/features/admin/components/AdminUserEditorView.d.ts +3 -1
  59. package/dist/features/admin/components/AdminUserEditorView.js +7 -1
  60. package/dist/features/admin/components/AdminUsersView.js +1 -1
  61. package/dist/features/admin/components/DataListingView.js +2 -2
  62. package/dist/features/admin/components/analytics/AdminPageViewsReportView.d.ts +8 -0
  63. package/dist/features/admin/components/analytics/AdminPageViewsReportView.js +41 -0
  64. package/dist/features/admin/components/index.d.ts +6 -0
  65. package/dist/features/admin/components/index.js +3 -0
  66. package/dist/features/admin/schemas/firestore.d.ts +0 -7
  67. package/dist/features/admin/schemas/firestore.js +6 -6
  68. package/dist/features/analytics/components/PageViewTracker.d.ts +12 -0
  69. package/dist/features/analytics/components/PageViewTracker.js +22 -0
  70. package/dist/features/analytics/repository/page-views.repository.d.ts +32 -0
  71. package/dist/features/analytics/repository/page-views.repository.js +43 -0
  72. package/dist/features/analytics/types.d.ts +6 -0
  73. package/dist/features/analytics/types.js +13 -0
  74. package/dist/features/auth/components/SocialAuthButtons.js +1 -1
  75. package/dist/features/auth/hooks/useAuth.d.ts +12 -0
  76. package/dist/features/auth/hooks/useAuth.js +109 -0
  77. package/dist/features/auth/permissions/constants.d.ts +1 -1
  78. package/dist/features/auth/schemas/firestore.d.ts +17 -1
  79. package/dist/features/auth/schemas/firestore.js +2 -0
  80. package/dist/features/blog/components/BlogIndexListing.js +2 -2
  81. package/dist/features/blog/schemas/firestore.d.ts +4 -0
  82. package/dist/features/cart/actions/cart-actions.js +20 -2
  83. package/dist/features/categories/components/CategoriesIndexListing.js +2 -2
  84. package/dist/features/categories/components/CategoryBundlesListing.js +2 -2
  85. package/dist/features/categories/components/CategoryDetailPageView.js +3 -1
  86. package/dist/features/categories/components/CategoryProductsListing.js +2 -2
  87. package/dist/features/categories/schemas/firestore.d.ts +4 -0
  88. package/dist/features/classified/components/ClassifiedIndexListing.js +2 -2
  89. package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +2 -2
  90. package/dist/features/email/primitives.d.ts +2 -2
  91. package/dist/features/email/primitives.js +2 -2
  92. package/dist/features/events/components/EventsIndexListing.js +2 -2
  93. package/dist/features/events/schemas/firestore.d.ts +4 -0
  94. package/dist/features/layout/BackToTop.d.ts +6 -1
  95. package/dist/features/layout/BackToTop.js +31 -6
  96. package/dist/features/live/components/LiveItemsIndexListing.js +2 -2
  97. package/dist/features/media/MediaVideo.js +5 -1
  98. package/dist/features/pre-orders/components/PreOrdersIndexListing.js +2 -2
  99. package/dist/features/products/components/AuctionsIndexListing.js +2 -2
  100. package/dist/features/products/components/PrizeDrawsIndexListing.js +2 -2
  101. package/dist/features/products/components/ProductsIndexListing.js +2 -2
  102. package/dist/features/products/constants/action-defs.d.ts +2 -0
  103. package/dist/features/products/constants/action-defs.js +2 -0
  104. package/dist/features/products/schemas/firestore.d.ts +4 -0
  105. package/dist/features/promotions/components/CouponsIndexListing.js +2 -2
  106. package/dist/features/reviews/components/ReviewsIndexListing.js +2 -2
  107. package/dist/features/seller/actions/seller-actions.js +11 -6
  108. package/dist/features/seller/components/SellerAddressesView.js +2 -2
  109. package/dist/features/seller/components/SellerBidsView.js +2 -2
  110. package/dist/features/seller/components/SellerOrdersView.js +2 -2
  111. package/dist/features/seller/components/SellerProductsView.js +2 -2
  112. package/dist/features/seller/components/SellerSidebar.d.ts +3 -1
  113. package/dist/features/seller/components/SellerSidebar.js +11 -10
  114. package/dist/features/seller/components/SellerStoreCategoriesView.js +2 -2
  115. package/dist/features/seller/components/SellerTemplatesView.js +2 -2
  116. package/dist/features/shell/StepForm.js +4 -4
  117. package/dist/features/stores/actions/store-query-actions.d.ts +5 -4
  118. package/dist/features/stores/actions/store-query-actions.js +11 -8
  119. package/dist/features/stores/components/StoreAuctionsListing.js +2 -2
  120. package/dist/features/stores/components/StoreClassifiedsListing.js +2 -2
  121. package/dist/features/stores/components/StoreDigitalCodesListing.js +2 -2
  122. package/dist/features/stores/components/StoreLiveItemsListing.js +2 -2
  123. package/dist/features/stores/components/StorePreOrdersListing.js +2 -2
  124. package/dist/features/stores/components/StoreProductsListing.js +2 -2
  125. package/dist/features/stores/components/StoreReviewsListing.js +2 -2
  126. package/dist/features/stores/components/StoresIndexListing.js +2 -2
  127. package/dist/features/stores/schemas/firestore.d.ts +4 -0
  128. package/dist/features/tester/actions/checklist-item-actions.d.ts +69 -0
  129. package/dist/features/tester/actions/checklist-item-actions.js +42 -0
  130. package/dist/features/tester/actions/index.d.ts +1 -0
  131. package/dist/features/tester/actions/index.js +1 -0
  132. package/dist/features/tester/components/AdminTesterFeedbackIssuesView.d.ts +2 -0
  133. package/dist/features/tester/components/AdminTesterFeedbackIssuesView.js +22 -0
  134. package/dist/features/tester/components/AdminTesterFeedbackListView.d.ts +3 -0
  135. package/dist/features/tester/components/AdminTesterFeedbackListView.js +100 -0
  136. package/dist/features/tester/components/AdminTesterFeedbackReportView.d.ts +2 -0
  137. package/dist/features/tester/components/AdminTesterFeedbackReportView.js +30 -0
  138. package/dist/features/tester/components/AdminTesterFeedbackView.d.ts +2 -0
  139. package/dist/features/tester/components/AdminTesterFeedbackView.js +9 -0
  140. package/dist/features/tester/components/TesterChecklistStepRow.d.ts +18 -0
  141. package/dist/features/tester/components/TesterChecklistStepRow.js +29 -0
  142. package/dist/features/tester/components/TesterFeedbackChart.d.ts +14 -0
  143. package/dist/features/tester/components/TesterFeedbackChart.js +18 -0
  144. package/dist/features/tester/components/TesterHubView.d.ts +5 -0
  145. package/dist/features/tester/components/TesterHubView.js +71 -0
  146. package/dist/features/tester/components/index.d.ts +11 -0
  147. package/dist/features/tester/components/index.js +7 -0
  148. package/dist/features/tester/index.d.ts +2 -0
  149. package/dist/features/tester/index.js +2 -0
  150. package/dist/features/tester/repository/index.d.ts +2 -0
  151. package/dist/features/tester/repository/index.js +2 -0
  152. package/dist/features/tester/repository/tester-checklist-item.repository.d.ts +13 -0
  153. package/dist/features/tester/repository/tester-checklist-item.repository.js +55 -0
  154. package/dist/features/tester/repository/tester-checklist-response.repository.d.ts +42 -0
  155. package/dist/features/tester/repository/tester-checklist-response.repository.js +98 -0
  156. package/dist/features/tester/schemas/firestore.d.ts +85 -0
  157. package/dist/features/tester/schemas/firestore.js +93 -0
  158. package/dist/features/tester/schemas/index.d.ts +1 -0
  159. package/dist/features/tester/schemas/index.js +1 -0
  160. package/dist/features/tester/seed-data/blog-tester-seed-data.d.ts +2 -0
  161. package/dist/features/tester/seed-data/blog-tester-seed-data.js +40 -0
  162. package/dist/features/tester/seed-data/categories-tester-seed-data.d.ts +2 -0
  163. package/dist/features/tester/seed-data/categories-tester-seed-data.js +177 -0
  164. package/dist/features/tester/seed-data/events-tester-seed-data.d.ts +2 -0
  165. package/dist/features/tester/seed-data/events-tester-seed-data.js +50 -0
  166. package/dist/features/tester/seed-data/index.d.ts +6 -0
  167. package/dist/features/tester/seed-data/index.js +6 -0
  168. package/dist/features/tester/seed-data/products-tester-seed-data.d.ts +2 -0
  169. package/dist/features/tester/seed-data/products-tester-seed-data.js +151 -0
  170. package/dist/features/tester/seed-data/stores-tester-seed-data.d.ts +2 -0
  171. package/dist/features/tester/seed-data/stores-tester-seed-data.js +40 -0
  172. package/dist/features/tester/seed-data/tester-checklist-seed-data.d.ts +2 -0
  173. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +248 -0
  174. package/dist/features/tester/seed-data/tester-ttl.d.ts +4 -0
  175. package/dist/features/tester/seed-data/tester-ttl.js +6 -0
  176. package/dist/features/tester/server.d.ts +9 -0
  177. package/dist/features/tester/server.js +8 -0
  178. package/dist/index.d.ts +28 -2
  179. package/dist/index.js +51 -1
  180. package/dist/next/api/api-response.js +5 -1
  181. package/dist/next/api/routeHandler.js +10 -1
  182. package/dist/next/middleware/chain.js +1 -1
  183. package/dist/next/routing/route-map.d.ts +6 -7
  184. package/dist/next/routing/route-map.js +3 -7
  185. package/dist/providers/payment-manual/index.d.ts +2 -2
  186. package/dist/providers/payment-manual/index.js +2 -2
  187. package/dist/react/contexts/SessionContext.d.ts +4 -0
  188. package/dist/react/contexts/SessionContext.js +4 -0
  189. package/dist/repositories/index.d.ts +4 -0
  190. package/dist/repositories/index.js +3 -0
  191. package/dist/security/pii-encrypt.js +12 -2
  192. package/dist/seed/addresses-seed-data.js +1 -1
  193. package/dist/seed/bids-seed-data.js +1 -1
  194. package/dist/seed/blog-posts-seed-data.js +1 -1
  195. package/dist/seed/carousel-slides-seed-data.js +22 -16
  196. package/dist/seed/carousels-seed-data.js +1 -1
  197. package/dist/seed/cart-seed-data.js +1 -1
  198. package/dist/seed/categories-seed-data.js +1 -1
  199. package/dist/seed/claimed-coupons-seed-data.js +1 -1
  200. package/dist/seed/conversations-seed-data.js +1 -1
  201. package/dist/seed/coupon-usage-seed-data.js +1 -1
  202. package/dist/seed/coupons-seed-data.js +1 -1
  203. package/dist/seed/events-seed-data.js +1 -1
  204. package/dist/seed/faq-seed-data.js +119 -3
  205. package/dist/seed/grouped-listings-seed-data.d.ts +2 -0
  206. package/dist/seed/grouped-listings-seed-data.js +1 -1
  207. package/dist/seed/history-seed-data.js +1 -1
  208. package/dist/seed/homepage-sections-seed-data.js +1 -1
  209. package/dist/seed/index.d.ts +2 -2
  210. package/dist/seed/index.js +7 -3
  211. package/dist/seed/lottery-entries-seed-data.js +1 -1
  212. package/dist/seed/manifest.d.ts +4 -3
  213. package/dist/seed/manifest.js +13 -6
  214. package/dist/seed/notifications-seed-data.js +1 -1
  215. package/dist/seed/offers-seed-data.js +1 -1
  216. package/dist/seed/orders-seed-data.js +1 -1
  217. package/dist/seed/payouts-seed-data.js +1 -1
  218. package/dist/seed/products-art-seed-data.js +1 -1
  219. package/dist/seed/products-auctions-seed-data.js +1 -1
  220. package/dist/seed/products-classifieds-seed-data.js +1 -1
  221. package/dist/seed/products-digital-codes-seed-data.js +1 -1
  222. package/dist/seed/products-live-items-seed-data.js +1 -1
  223. package/dist/seed/products-preorders-seed-data.d.ts +2 -0
  224. package/dist/seed/products-preorders-seed-data.js +1 -1
  225. package/dist/seed/products-prize-draws-seed-data.js +1 -1
  226. package/dist/seed/products-standard-seed-data.js +1 -1
  227. package/dist/seed/products-stickers-seed-data.js +1 -1
  228. package/dist/seed/reviews-seed-data.js +1 -1
  229. package/dist/seed/scammers-seed-data.js +1 -1
  230. package/dist/seed/sessions-seed-data.js +1 -1
  231. package/dist/seed/site-settings-seed-data.js +22 -16
  232. package/dist/seed/store-addresses-seed-data.js +1 -1
  233. package/dist/seed/store-extensions-seed-data.js +1 -1
  234. package/dist/seed/stores-seed-data.js +1 -1
  235. package/dist/seed/support-tickets-seed-data.js +1 -1
  236. package/dist/seed/tester-checklist-seed-data.d.ts +2 -0
  237. package/dist/seed/tester-checklist-seed-data.js +248 -0
  238. package/dist/seed/users-seed-data.js +1 -1
  239. package/dist/seed/wishlists-seed-data.js +1 -1
  240. package/dist/server.d.ts +7 -2
  241. package/dist/server.js +19 -12
  242. package/dist/styles.css +163 -147
  243. package/dist/tailwind-utilities.css +1 -1
  244. package/dist/tokens/color-pairs.d.ts +46 -0
  245. package/dist/tokens/color-pairs.js +93 -0
  246. package/dist/tokens/index.d.ts +60 -60
  247. package/dist/tokens/index.js +30 -30
  248. package/dist/tokens/themes/cobalt-night.d.ts +3 -2
  249. package/dist/tokens/themes/cobalt-night.js +3 -2
  250. package/dist/tokens/themes/default-dark.d.ts +4 -1
  251. package/dist/tokens/themes/default-dark.js +44 -41
  252. package/dist/tokens/themes/default-light.d.ts +5 -1
  253. package/dist/tokens/themes/default-light.js +39 -35
  254. package/dist/tokens/themes/sunset.js +4 -4
  255. package/dist/tokens/tokens.css +110 -104
  256. package/dist/ui/components/CollapsibleSection.d.ts +15 -0
  257. package/dist/ui/components/CollapsibleSection.js +13 -0
  258. package/dist/ui/components/ListingToolbar.js +2 -1
  259. package/dist/ui/components/Semantic.style.css +3 -3
  260. package/dist/ui/components/SideDrawer.style.css +19 -19
  261. package/dist/ui/components/Slider.js +1 -1
  262. package/dist/ui/components/StickyToolbar.d.ts +36 -7
  263. package/dist/ui/components/StickyToolbar.js +63 -5
  264. package/dist/ui/components/Tabs.js +17 -1
  265. package/dist/ui/components/Tabs.style.css +10 -0
  266. package/dist/ui/components/Typography.js +7 -0
  267. package/dist/ui/components/surface-tokens.d.ts +0 -7
  268. package/dist/ui/components/surface-tokens.js +7 -0
  269. package/dist/ui/index.d.ts +6 -0
  270. package/dist/ui/index.js +3 -0
  271. package/dist/ui/rich-text/RichText.style.css +20 -20
  272. package/dist/utils/id-generators.d.ts +13 -0
  273. package/dist/utils/id-generators.js +17 -0
  274. package/package.json +1 -1
  275. package/scripts/seed-cli-loader.mjs +15 -0
  276. package/scripts/seed-cli.mjs +71 -17
@@ -27,8 +27,11 @@ const PRIORITY_OPTIONS = [
27
27
  { label: "High", value: "high" },
28
28
  { label: "Critical only", value: "critical" },
29
29
  ];
30
- function GroupSaveButton({ isPending }) {
31
- return (_jsx(FormActions, { align: "right", children: _jsx(Button, { type: "submit", isLoading: isPending, disabled: isPending, children: isPending ? "Saving…" : "Save changes" }) }));
30
+ /** Single persistent save action for the whole settings form — every tab writes
31
+ * into the same combined payload, so one save covers whichever tabs were edited
32
+ * regardless of which one is currently active. */
33
+ function SaveAllBar({ isPending, onSave }) {
34
+ return (_jsx(FormActions, { align: "right", children: _jsx(Button, { type: "button", isLoading: isPending, disabled: isPending, onClick: onSave, children: isPending ? "Saving…" : "Save all changes" }) }));
32
35
  }
33
36
  // --- Component ---------------------------------------------------------------
34
37
  export function AdminSiteSettingsView({ labels = {}, ...rest }) {
@@ -199,6 +202,15 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
199
202
  const [resendApiKey, setResendApiKey] = React.useState("");
200
203
  const [notifFromEmail, setNotifFromEmail] = React.useState("");
201
204
  const [notifFromName, setNotifFromName] = React.useState("");
205
+ // Snapshot of the masked placeholder strings the server returned for every
206
+ // credentials.* field, captured once per load. A combined single-save has
207
+ // to send the FULL credentials object on every save (not just the group the
208
+ // admin actually edited), so any untouched field must resolve back to "" —
209
+ // sending its still-masked display value would re-encrypt the mask itself
210
+ // and destroy the real secret. Comparing against this snapshot is how we
211
+ // tell "unedited" from "admin actually typed a new value".
212
+ const originalMaskedRef = React.useRef({});
213
+ const maskedOrReal = (field, current) => current !== (originalMaskedRef.current[field] ?? "") ? current : "";
202
214
  // Populate from query data
203
215
  React.useEffect(() => {
204
216
  if (!s || !Object.keys(s).length)
@@ -328,128 +340,121 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
328
340
  setResendApiKey(s.credentialsMasked?.resendApiKey ?? "");
329
341
  setNotifFromEmail(s.emailSettings?.fromEmail ?? "");
330
342
  setNotifFromName(s.emailSettings?.fromName ?? "");
343
+ originalMaskedRef.current = {
344
+ razorpayKeyId: s.credentialsMasked?.razorpayKeyId ?? "",
345
+ razorpaySecret: s.credentialsMasked?.razorpaySecret ?? "",
346
+ smtpPassword: s.credentialsMasked?.smtpPassword ?? "",
347
+ metaPageAccessToken: s.credentialsMasked?.metaPageAccessToken ?? "",
348
+ metaPageId: s.credentialsMasked?.metaPageId ?? "",
349
+ tiktokClientKey: s.credentialsMasked?.tiktokClientKey ?? "",
350
+ tiktokClientSecret: s.credentialsMasked?.tiktokClientSecret ?? "",
351
+ tiktokAccessToken: s.credentialsMasked?.tiktokAccessToken ?? "",
352
+ deviantartClientId: s.credentialsMasked?.deviantartClientId ?? "",
353
+ deviantartClientSecret: s.credentialsMasked?.deviantartClientSecret ?? "",
354
+ whatsappPhoneNumberId: s.credentialsMasked?.whatsappPhoneNumberId ?? "",
355
+ whatsappCloudApiToken: s.credentialsMasked?.whatsappCloudApiToken ?? "",
356
+ whatsappAdminNotifyNumbers: s.credentialsMasked?.whatsappAdminNotifyNumbers ?? "",
357
+ resendApiKey: s.credentialsMasked?.resendApiKey ?? "",
358
+ };
331
359
  }, [data]);
332
- function useSave(group, payload) {
333
- return useApiMutation({
334
- mutationFn: async () => {
335
- await apiClient.put(ADMIN_ENDPOINTS.ADMIN_SITE, payload());
360
+ // Single combined payload — every group's current field values, assembled
361
+ // into one PUT. Every step/tab is independently jumpable and there is one
362
+ // save action for the whole form, not 19 per-tab mutations.
363
+ function buildFullPayload() {
364
+ return {
365
+ aboutContent: { title: aboutTitle, subtitle: aboutSubtitle, missionTitle: aboutMissionTitle, missionText: aboutMissionText, ctaTitle: aboutCtaTitle },
366
+ siteName, tagline, logo: logoUrl, favicon: faviconUrl,
367
+ maintenance: { enabled: maintenanceMode, message: maintenanceMessage },
368
+ background: {
369
+ light: {
370
+ type: lightBgType,
371
+ value: lightBgValue,
372
+ overlay: { enabled: lightBgOverlayEnabled, color: lightBgOverlayColor, opacity: lightBgOverlayOpacity / 100 },
373
+ },
374
+ dark: {
375
+ type: darkBgType,
376
+ value: darkBgValue,
377
+ overlay: { enabled: darkBgOverlayEnabled, color: darkBgOverlayColor, opacity: darkBgOverlayOpacity / 100 },
378
+ },
336
379
  },
337
- onSuccess: () => {
338
- showToast(`${group} saved.`, "success");
339
- queryClient.invalidateQueries({ queryKey: ["admin", "site-settings"] });
380
+ theme: {
381
+ themes: themeRegistry.themes,
382
+ defaultLightThemeId: themeRegistry.defaultLightThemeId,
383
+ defaultDarkThemeId: themeRegistry.defaultDarkThemeId,
340
384
  },
341
- onError: (err) => showToast(err?.message ?? `Failed to save ${group}.`, "error"),
342
- });
343
- }
344
- const brandingMutation = useSave("Branding", () => ({
345
- siteName, tagline, logo: logoUrl, favicon: faviconUrl,
346
- maintenance: { enabled: maintenanceMode, message: maintenanceMessage },
347
- }));
348
- const appearanceMutation = useSave("Appearance", () => ({
349
- background: {
350
- light: {
351
- type: lightBgType,
352
- value: lightBgValue,
353
- overlay: { enabled: lightBgOverlayEnabled, color: lightBgOverlayColor, opacity: lightBgOverlayOpacity / 100 },
385
+ announcementBar: { enabled: announcementEnabled, text: announcementText, link: announcementLink, backgroundColor: announcementBg },
386
+ seo: { defaultTitle: seoTitle, defaultDescription: seoDescription, defaultOgImage: seoOgImage, noIndex: seoNoIndex, canonicalBaseUrl: canonicalUrl },
387
+ contact: { email: supportEmail, phone: supportPhone, address: supportAddress, supportHours, whatsappNumber: whatsapp },
388
+ socialLinks: { instagram, twitter, facebook, youtube, linkedin, pinterest },
389
+ watermark: { type: watermarkType, text: watermarkText, imageUrl: watermarkImageUrl, size: watermarkSize, opacity: watermarkOpacity },
390
+ commissions: { platformFeePercent, gstPercent, minimumTransactionFee, gatewayFeePercent, payoutHoldDays, minPayoutAmount, auctionListingFee, preOrderListingFee, featuredSlotFee, promotedSlotFee },
391
+ laborRate: { hourlyRatePaise: laborHourlyRatePaise, maxHoursPerDay: laborMaxHoursPerDay },
392
+ emi: {
393
+ enabled: emiEnabled,
394
+ minOrderValueInPaise: emiMinOrderValuePaise,
395
+ tenureOptions: emiTenureOptionsText
396
+ .split(",")
397
+ .map((v) => parseInt(v.trim(), 10))
398
+ .filter((v) => !isNaN(v) && v > 0),
399
+ tokenPercent: emiTokenPercent,
400
+ billingDay: emiBillingDay,
401
+ surchargePercentPerMonth: emiSurchargePercentPerMonth,
402
+ surchargeSellerSharePercent: emiSurchargeSellerSharePercent,
354
403
  },
355
- dark: {
356
- type: darkBgType,
357
- value: darkBgValue,
358
- overlay: { enabled: darkBgOverlayEnabled, color: darkBgOverlayColor, opacity: darkBgOverlayOpacity / 100 },
404
+ gst: {
405
+ enabled: gstEnabled,
406
+ gstin: gstin.trim().toUpperCase(),
407
+ legalName: gstLegalName.trim(),
408
+ address: gstAddress.trim(),
359
409
  },
410
+ // Masked credential fields resolve to "" when untouched — the repository's
411
+ // mergeEncryptedCredentials preserves the existing encrypted value for any
412
+ // "" field, so an unedited tab never overwrites a real secret with its
413
+ // own masked display string.
414
+ credentials: {
415
+ razorpayKeyId: maskedOrReal("razorpayKeyId", razorpayKeyId),
416
+ razorpaySecret: maskedOrReal("razorpaySecret", razorpaySecret),
417
+ smtpPassword: maskedOrReal("smtpPassword", smtpPassword),
418
+ metaPageAccessToken: maskedOrReal("metaPageAccessToken", metaPageAccessToken),
419
+ metaPageId: maskedOrReal("metaPageId", metaPageId),
420
+ tiktokClientKey: maskedOrReal("tiktokClientKey", tiktokClientKey),
421
+ tiktokClientSecret: maskedOrReal("tiktokClientSecret", tiktokClientSecret),
422
+ tiktokAccessToken: maskedOrReal("tiktokAccessToken", tiktokAccessToken),
423
+ deviantartClientId: maskedOrReal("deviantartClientId", deviantartClientId),
424
+ deviantartClientSecret: maskedOrReal("deviantartClientSecret", deviantartClientSecret),
425
+ whatsappPhoneNumberId: maskedOrReal("whatsappPhoneNumberId", waPhoneNumberId),
426
+ whatsappCloudApiToken: maskedOrReal("whatsappCloudApiToken", waCloudApiToken),
427
+ whatsappAdminNotifyNumbers: maskedOrReal("whatsappAdminNotifyNumbers", waAdminNotifyNumbers),
428
+ resendApiKey: maskedOrReal("resendApiKey", resendApiKey),
429
+ },
430
+ emailSettings: {
431
+ host: smtpHost, port: Number(smtpPort), user: smtpUser, fromAddress: smtpFrom,
432
+ fromEmail: notifFromEmail, fromName: notifFromName,
433
+ },
434
+ integrations: { googleAnalyticsId: gaMeasurementId, facebookPixelId: fbPixelId, gtmContainerId },
435
+ shipping: { freeShippingThreshold: freeShippingThreshold * 100, defaultCarrier, maxDeliveryRadius },
436
+ payment: { razorpayEnabled, upiManualEnabled, codEnabled },
437
+ auctionConfig: { minBidIncrement: minBidIncrement * 100, autoExtendWindowMinutes: autoExtendWindow, settlementGracePeriodHours: settlementGrace },
438
+ platformLimits: { maxProductsPerStore, maxImagesPerProduct, maxVideoSizeMb, maxCustomFieldsPerProduct: maxCustomFields, maxCustomSectionsPerProduct: maxCustomSections, orderCancellationWindowHours: orderCancelWindow },
439
+ legalPages: { terms: termsHtml, privacy: privacyHtml, refundPolicy: refundHtml, shipping: shippingPolicyHtml, cookies: cookieHtml },
440
+ notificationChannels: {
441
+ inApp: { enabled: true, readOnly: true },
442
+ email: { enabled: notifEmailEnabled, minPriority: notifEmailMinPriority },
443
+ whatsapp: { enabled: notifWhatsappEnabled, minPriority: notifWhatsappMinPriority, otpEnabled: notifWhatsappOtpEnabled },
444
+ sms: { enabled: notifSmsEnabled, minPriority: notifSmsMinPriority },
445
+ },
446
+ };
447
+ }
448
+ const saveAllMutation = useApiMutation({
449
+ mutationFn: async () => {
450
+ await apiClient.put(ADMIN_ENDPOINTS.ADMIN_SITE, buildFullPayload());
360
451
  },
361
- }));
362
- const themeMutation = useSave("Themes", () => ({
363
- theme: {
364
- themes: themeRegistry.themes,
365
- defaultLightThemeId: themeRegistry.defaultLightThemeId,
366
- defaultDarkThemeId: themeRegistry.defaultDarkThemeId,
367
- },
368
- }));
369
- const announcementMutation = useSave("Announcement", () => ({
370
- announcementBar: { enabled: announcementEnabled, text: announcementText, link: announcementLink, backgroundColor: announcementBg },
371
- }));
372
- const seoMutation = useSave("SEO", () => ({
373
- seo: { defaultTitle: seoTitle, defaultDescription: seoDescription, defaultOgImage: seoOgImage, noIndex: seoNoIndex, canonicalBaseUrl: canonicalUrl },
374
- }));
375
- const contactMutation = useSave("Contact & Social", () => ({
376
- contact: { email: supportEmail, phone: supportPhone, address: supportAddress, supportHours, whatsappNumber: whatsapp },
377
- socialLinks: { instagram, twitter, facebook, youtube, linkedin, pinterest },
378
- }));
379
- const watermarkMutation = useSave("Watermark", () => ({
380
- watermark: { type: watermarkType, text: watermarkText, imageUrl: watermarkImageUrl, size: watermarkSize, opacity: watermarkOpacity },
381
- }));
382
- const feesMutation = useSave("Fees", () => ({
383
- commissions: { platformFeePercent, gstPercent, minimumTransactionFee, gatewayFeePercent, payoutHoldDays, minPayoutAmount, auctionListingFee, preOrderListingFee, featuredSlotFee, promotedSlotFee },
384
- }));
385
- const laborRateMutation = useSave("Procurement", () => ({
386
- laborRate: { hourlyRatePaise: laborHourlyRatePaise, maxHoursPerDay: laborMaxHoursPerDay },
387
- }));
388
- const emiSettingsMutation = useSave("EMI", () => ({
389
- emi: {
390
- enabled: emiEnabled,
391
- minOrderValueInPaise: emiMinOrderValuePaise,
392
- tenureOptions: emiTenureOptionsText
393
- .split(",")
394
- .map((v) => parseInt(v.trim(), 10))
395
- .filter((v) => !isNaN(v) && v > 0),
396
- tokenPercent: emiTokenPercent,
397
- billingDay: emiBillingDay,
398
- surchargePercentPerMonth: emiSurchargePercentPerMonth,
399
- surchargeSellerSharePercent: emiSurchargeSellerSharePercent,
400
- },
401
- }));
402
- const gstSettingsMutation = useSave("GST", () => ({
403
- gst: {
404
- enabled: gstEnabled,
405
- gstin: gstin.trim().toUpperCase(),
406
- legalName: gstLegalName.trim(),
407
- address: gstAddress.trim(),
408
- },
409
- }));
410
- const integrationsMutation = useSave("Integrations", () => ({
411
- credentials: {
412
- razorpayKeyId, razorpaySecret, smtpPassword,
413
- metaPageAccessToken, metaPageId,
414
- tiktokClientKey, tiktokClientSecret, tiktokAccessToken,
415
- deviantartClientId, deviantartClientSecret,
416
- },
417
- emailSettings: { host: smtpHost, port: Number(smtpPort), user: smtpUser, fromAddress: smtpFrom },
418
- integrations: { googleAnalyticsId: gaMeasurementId, facebookPixelId: fbPixelId, gtmContainerId },
419
- }));
420
- const shippingMutation = useSave("Shipping", () => ({
421
- shipping: { freeShippingThreshold: freeShippingThreshold * 100, defaultCarrier, maxDeliveryRadius },
422
- payment: { razorpayEnabled, upiManualEnabled, codEnabled },
423
- }));
424
- const auctionMutation = useSave("Auction Config", () => ({
425
- auctionConfig: { minBidIncrement: minBidIncrement * 100, autoExtendWindowMinutes: autoExtendWindow, settlementGracePeriodHours: settlementGrace },
426
- }));
427
- const limitsMutation = useSave("Platform Limits", () => ({
428
- platformLimits: { maxProductsPerStore, maxImagesPerProduct, maxVideoSizeMb, maxCustomFieldsPerProduct: maxCustomFields, maxCustomSectionsPerProduct: maxCustomSections, orderCancellationWindowHours: orderCancelWindow },
429
- }));
430
- const whatsappMutation = useSave("WhatsApp", () => ({
431
- credentials: {
432
- whatsappPhoneNumberId: waPhoneNumberId,
433
- whatsappCloudApiToken: waCloudApiToken,
434
- whatsappAdminNotifyNumbers: waAdminNotifyNumbers,
435
- },
436
- }));
437
- const legalMutation = useSave("Legal Policies", () => ({
438
- legalPages: { terms: termsHtml, privacy: privacyHtml, refundPolicy: refundHtml, shipping: shippingPolicyHtml, cookies: cookieHtml },
439
- }));
440
- const aboutMutation = useSave("About Page", () => ({
441
- aboutContent: { title: aboutTitle, subtitle: aboutSubtitle, missionTitle: aboutMissionTitle, missionText: aboutMissionText, ctaTitle: aboutCtaTitle },
442
- }));
443
- const notifChannelsMutation = useSave("Notification Channels", () => ({
444
- notificationChannels: {
445
- inApp: { enabled: true, readOnly: true },
446
- email: { enabled: notifEmailEnabled, minPriority: notifEmailMinPriority },
447
- whatsapp: { enabled: notifWhatsappEnabled, minPriority: notifWhatsappMinPriority, otpEnabled: notifWhatsappOtpEnabled },
448
- sms: { enabled: notifSmsEnabled, minPriority: notifSmsMinPriority },
452
+ onSuccess: () => {
453
+ showToast("Site settings saved.", "success");
454
+ queryClient.invalidateQueries({ queryKey: ["admin", "site-settings"] });
449
455
  },
450
- credentials: { resendApiKey },
451
- emailSettings: { fromEmail: notifFromEmail, fromName: notifFromName },
452
- }));
456
+ onError: (err) => showToast(err?.message ?? "Failed to save site settings.", "error"),
457
+ });
453
458
  const BG_TYPE_OPTIONS = [
454
459
  { label: "Solid color", value: "color" },
455
460
  { label: "Gradient", value: "gradient" },
@@ -486,7 +491,7 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
486
491
  ["procurement", "⑮ Procurement"],
487
492
  ["emi", "⑯ EMI"],
488
493
  ["gst", "⑰ GST"],
489
- ].map(([value, label]) => (_jsx(TabsTrigger, { value: value, children: label }, value))) }), _jsx(TabsContent, { value: "about", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); aboutMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Override the About page hero and mission text. Leave blank to use the platform defaults." }), _jsx(Input, { label: "Hero title", value: aboutTitle, onChange: (e) => setAboutTitle(e.target.value), placeholder: "About LetItRip" }), _jsx(Input, { label: "Hero subtitle", value: aboutSubtitle, onChange: (e) => setAboutSubtitle(e.target.value), placeholder: "Connecting buyers, sellers, and bidders in one vibrant marketplace" }), _jsx(Input, { label: "Mission section title", value: aboutMissionTitle, onChange: (e) => setAboutMissionTitle(e.target.value), placeholder: "Our Mission" }), _jsxs(_Fragment, { children: [_jsx(Text, { className: "mb-1", color: "muted", size: "sm", weight: "medium", children: "Mission text" }), _jsx(Textarea, { value: aboutMissionText, onChange: (e) => setAboutMissionText(e.target.value), placeholder: "LetItRip was built to democratise commerce\u2026", rows: 4 })] }), _jsx(Input, { label: "CTA banner title", value: aboutCtaTitle, onChange: (e) => setAboutCtaTitle(e.target.value), placeholder: "Ready to get started?" }), _jsx(GroupSaveButton, { isPending: aboutMutation.isPending })] }) }), _jsx(TabsContent, { value: "branding", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); brandingMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Site name", value: siteName, onChange: (e) => setSiteName(e.target.value), placeholder: "LetItRip" }), _jsx(Input, { label: "Tagline", value: tagline, onChange: (e) => setTagline(e.target.value), placeholder: "India's Largest Collectibles Marketplace" }), _jsx(ImageUpload, { label: "Logo", currentImage: logoUrl, onUpload: (file) => upload(file, "store"), onChange: setLogoUrl }), _jsx(ImageUpload, { label: "Favicon", currentImage: faviconUrl, onUpload: (file) => upload(file, "store"), onChange: setFaviconUrl }), _jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "Maintenance mode", checked: maintenanceMode, onChange: setMaintenanceMode }), _jsx(Input, { label: "Maintenance message", value: maintenanceMessage, onChange: (e) => setMaintenanceMessage(e.target.value), placeholder: "We're back soon.", disabled: !maintenanceMode })] }), _jsx(GroupSaveButton, { isPending: brandingMutation.isPending })] }) }), _jsx(TabsContent, { value: "appearance", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); appearanceMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Sets the background behind the public shell, dashboard sidebars, and any Section/Card that opts into it. Leave the value blank for a plain surface." }), _jsxs(Grid, { cols: 2, gap: "lg", children: [_jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Light mode" }), _jsx(Select, { label: "Type", options: BG_TYPE_OPTIONS, value: lightBgType, onValueChange: (v) => setLightBgType(v) }), lightBgType === "color" ? (_jsx(Input, { type: "color", label: "Color", value: lightBgValue || "#ffffff", onChange: (e) => setLightBgValue(e.target.value), className: "h-10 w-full cursor-pointer", bare: true }) /* audit-hex-tokens-ok: native color picker requires literal hex string fallback */) : lightBgType === "gradient" ? (_jsx(Textarea, { label: "CSS gradient expression", rows: 2, value: lightBgValue, onChange: (e) => setLightBgValue(e.target.value), placeholder: "linear-gradient(...)" })) : (_jsx(MediaUploadField, { label: lightBgType === "video" ? "Background video" : "Background image", kind: lightBgType === "video" ? "video" : "image", value: lightBgValue, onChange: setLightBgValue, onUpload: (file) => upload(file, "store") })), _jsx(Toggle, { label: "Dim overlay", checked: lightBgOverlayEnabled, onChange: setLightBgOverlayEnabled }), lightBgOverlayEnabled && (_jsxs(_Fragment, { children: [_jsx(Input, { type: "color", label: "Overlay color", value: lightBgOverlayColor, onChange: (e) => setLightBgOverlayColor(e.target.value), className: "h-10 w-full cursor-pointer", bare: true }), " ", _jsx(Slider, { label: "Overlay opacity", min: 0, max: 100, value: lightBgOverlayOpacity, onChange: setLightBgOverlayOpacity })] })), _jsx(Text, { size: "xs", color: "muted", children: "Preview" }), _jsx(Div, { className: "relative h-24 w-full", overflow: "hidden", rounded: "md", border: "default", children: _jsx(BackgroundRenderer, { mode: "light", lightMode: {
494
+ ].map(([value, label]) => (_jsx(TabsTrigger, { value: value, children: label }, value))) }), _jsx(TabsContent, { value: "about", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Override the About page hero and mission text. Leave blank to use the platform defaults." }), _jsx(Input, { label: "Hero title", value: aboutTitle, onChange: (e) => setAboutTitle(e.target.value), placeholder: "About LetItRip" }), _jsx(Input, { label: "Hero subtitle", value: aboutSubtitle, onChange: (e) => setAboutSubtitle(e.target.value), placeholder: "Connecting buyers, sellers, and bidders in one vibrant marketplace" }), _jsx(Input, { label: "Mission section title", value: aboutMissionTitle, onChange: (e) => setAboutMissionTitle(e.target.value), placeholder: "Our Mission" }), _jsxs(_Fragment, { children: [_jsx(Text, { className: "mb-1", color: "muted", size: "sm", weight: "medium", children: "Mission text" }), _jsx(Textarea, { value: aboutMissionText, onChange: (e) => setAboutMissionText(e.target.value), placeholder: "LetItRip was built to democratise commerce\u2026", rows: 4 })] }), _jsx(Input, { label: "CTA banner title", value: aboutCtaTitle, onChange: (e) => setAboutCtaTitle(e.target.value), placeholder: "Ready to get started?" })] }) }), _jsx(TabsContent, { value: "branding", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Site name", value: siteName, onChange: (e) => setSiteName(e.target.value), placeholder: "LetItRip" }), _jsx(Input, { label: "Tagline", value: tagline, onChange: (e) => setTagline(e.target.value), placeholder: "India's Largest Collectibles Marketplace" }), _jsx(ImageUpload, { label: "Logo", currentImage: logoUrl, onUpload: (file) => upload(file, "store"), onChange: setLogoUrl }), _jsx(ImageUpload, { label: "Favicon", currentImage: faviconUrl, onUpload: (file) => upload(file, "store"), onChange: setFaviconUrl }), _jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "Maintenance mode", checked: maintenanceMode, onChange: setMaintenanceMode }), _jsx(Input, { label: "Maintenance message", value: maintenanceMessage, onChange: (e) => setMaintenanceMessage(e.target.value), placeholder: "We're back soon.", disabled: !maintenanceMode })] })] }) }), _jsx(TabsContent, { value: "appearance", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Sets the background behind the public shell, dashboard sidebars, and any Section/Card that opts into it. Leave the value blank for a plain surface." }), _jsxs(Grid, { cols: 2, gap: "lg", children: [_jsxs(Stack, { gap: "sm", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Light mode" }), _jsx(Select, { label: "Type", options: BG_TYPE_OPTIONS, value: lightBgType, onValueChange: (v) => setLightBgType(v) }), lightBgType === "color" ? (_jsx(Input, { type: "color", label: "Color", value: lightBgValue || "#ffffff", onChange: (e) => setLightBgValue(e.target.value), className: "h-10 w-full cursor-pointer", bare: true }) /* audit-hex-tokens-ok: native color picker requires literal hex string fallback */) : lightBgType === "gradient" ? (_jsx(Textarea, { label: "CSS gradient expression", rows: 2, value: lightBgValue, onChange: (e) => setLightBgValue(e.target.value), placeholder: "linear-gradient(...)" })) : (_jsx(MediaUploadField, { label: lightBgType === "video" ? "Background video" : "Background image", kind: lightBgType === "video" ? "video" : "image", value: lightBgValue, onChange: setLightBgValue, onUpload: (file) => upload(file, "store") })), _jsx(Toggle, { label: "Dim overlay", checked: lightBgOverlayEnabled, onChange: setLightBgOverlayEnabled }), lightBgOverlayEnabled && (_jsxs(_Fragment, { children: [_jsx(Input, { type: "color", label: "Overlay color", value: lightBgOverlayColor, onChange: (e) => setLightBgOverlayColor(e.target.value), className: "h-10 w-full cursor-pointer", bare: true }), " ", _jsx(Slider, { label: "Overlay opacity", min: 0, max: 100, value: lightBgOverlayOpacity, onChange: setLightBgOverlayOpacity })] })), _jsx(Text, { size: "xs", color: "muted", children: "Preview" }), _jsx(Div, { className: "relative h-24 w-full", overflow: "hidden", rounded: "md", border: "default", children: _jsx(BackgroundRenderer, { mode: "light", lightMode: {
490
495
  type: lightBgType,
491
496
  value: lightBgValue,
492
497
  overlay: { enabled: lightBgOverlayEnabled, color: lightBgOverlayColor, opacity: lightBgOverlayOpacity / 100 },
@@ -494,15 +499,16 @@ export function AdminSiteSettingsView({ labels = {}, ...rest }) {
494
499
  type: darkBgType,
495
500
  value: darkBgValue,
496
501
  overlay: { enabled: darkBgOverlayEnabled, color: darkBgOverlayColor, opacity: darkBgOverlayOpacity / 100 },
497
- } }) })] })] }), _jsx(GroupSaveButton, { isPending: appearanceMutation.isPending })] }) }), _jsx(TabsContent, { value: "themes", children: _jsxs(Form, { onSubmit: (e) => {
502
+ } }) })] })] })] }) }), _jsx(TabsContent, { value: "themes", children: _jsx(Form, { onSubmit: (e) => {
498
503
  e.preventDefault();
499
- themeMutation.mutate();
500
- }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(ThemeManagerView, { value: themeRegistry, onChange: setThemeRegistry, previewOrigin: "/" }), _jsx(GroupSaveButton, { isPending: themeMutation.isPending })] }) }), _jsx(TabsContent, { value: "announcement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); announcementMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Toggle, { label: "Show announcement bar", checked: announcementEnabled, onChange: setAnnouncementEnabled }), _jsx(Input, { label: "Announcement text", value: announcementText, onChange: (e) => setAnnouncementText(e.target.value), placeholder: "\uD83C\uDF89 Free shipping on orders \u20B9999+", disabled: !announcementEnabled }), _jsx(Input, { label: "Link URL (optional)", value: announcementLink, onChange: (e) => setAnnouncementLink(e.target.value), placeholder: String(ROUTES.PUBLIC.PRODUCTS), disabled: !announcementEnabled }), _jsxs(Stack, { gap: "none", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", className: "mb-1", children: "Background color" }), _jsx(Input, { type: "color", value: announcementBg || "#1d4ed8", onChange: (e) => setAnnouncementBg(e.target.value), className: "h-10 w-32 cursor-pointer", bare: true, disabled: !announcementEnabled }), " "] }), _jsx(GroupSaveButton, { isPending: announcementMutation.isPending })] }) }), _jsx(TabsContent, { value: "seo", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); seoMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Default meta title", value: seoTitle, onChange: (e) => setSeoTitle(e.target.value), placeholder: "LetItRip \u2014 Buy, Sell & Auction Collectibles in India", maxLength: 60, helperText: "Max 60 chars. Use {page} token for dynamic insertion." }), _jsx(Input, { label: "Default meta description", value: seoDescription, onChange: (e) => setSeoDescription(e.target.value), placeholder: "India's largest collectibles marketplace\u2026", maxLength: 160, helperText: "Max 160 chars." }), _jsx(ImageUpload, { label: "Default OG image", currentImage: seoOgImage, onUpload: (file) => upload(file, "store"), onChange: setSeoOgImage }), _jsx(Input, { label: "Canonical base URL", value: canonicalUrl, onChange: (e) => setCanonicalUrl(e.target.value), placeholder: "https://letitrip.in" }), _jsx(Toggle, { label: "Robots noindex (disables search indexing \u2014 use carefully)", checked: seoNoIndex, onChange: setSeoNoIndex }), _jsx(GroupSaveButton, { isPending: seoMutation.isPending })] }) }), _jsx(TabsContent, { value: "contact", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); contactMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Support email", value: supportEmail, onChange: (e) => setSupportEmail(e.target.value), type: "email", placeholder: "support@letitrip.in" }), _jsx(Input, { label: "Support phone", value: supportPhone, onChange: (e) => setSupportPhone(e.target.value), placeholder: "+91 XXXXX XXXXX" })] }), _jsx(Input, { label: "Physical address", value: supportAddress, onChange: (e) => setSupportAddress(e.target.value), placeholder: "Mumbai, Maharashtra, India" }), _jsx(Input, { label: "Support hours", value: supportHours, onChange: (e) => setSupportHours(e.target.value), placeholder: "Mon\u2013Fri, 10 AM \u2013 6 PM IST" }), _jsx(Text, { className: "pt-[0.5rem]", color: "muted", size: "sm", weight: "medium", children: "Social links" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Instagram URL", value: instagram, onChange: (e) => setInstagram(e.target.value), placeholder: "https://instagram.com/letitrip" }), _jsx(Input, { label: "Twitter / X URL", value: twitter, onChange: (e) => setTwitter(e.target.value), placeholder: "https://twitter.com/letitrip" }), _jsx(Input, { label: "Facebook URL", value: facebook, onChange: (e) => setFacebook(e.target.value), placeholder: "https://facebook.com/letitrip" }), _jsx(Input, { label: "YouTube URL", value: youtube, onChange: (e) => setYoutube(e.target.value), placeholder: "https://youtube.com/@letitrip" }), _jsx(Input, { label: "WhatsApp number", value: whatsapp, onChange: (e) => setWhatsapp(e.target.value), placeholder: "+91XXXXXXXXXX" }), _jsx(Input, { label: "LinkedIn URL", value: linkedin, onChange: (e) => setLinkedin(e.target.value), placeholder: "https://linkedin.com/company/letitrip" }), _jsx(Input, { label: "Pinterest URL", value: pinterest, onChange: (e) => setPinterest(e.target.value), placeholder: "https://pinterest.com/letitrip" })] }), _jsx(GroupSaveButton, { isPending: contactMutation.isPending })] }) }), _jsx(TabsContent, { value: "watermark", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); watermarkMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Select, { label: "Watermark type", options: [{ label: "Text", value: "text" }, { label: "Image", value: "image" }], value: watermarkType, onValueChange: (v) => setWatermarkType(v) }), watermarkType === "text" ? (_jsx(Input, { label: "Watermark text", value: watermarkText, onChange: (e) => setWatermarkText(e.target.value), placeholder: "letitrip.in" })) : (_jsx(ImageUpload, { label: "Watermark image", currentImage: watermarkImageUrl, onUpload: (file) => upload(file, "store"), onChange: setWatermarkImageUrl })), _jsx(Slider, { label: `Size — ${watermarkSize}% of image width`, value: watermarkSize, onChange: setWatermarkSize, min: 5, max: 100, step: 5 }), _jsx(Slider, { label: `Opacity — ${watermarkOpacity}%`, value: watermarkOpacity, onChange: setWatermarkOpacity, min: 5, max: 100, step: 5 }), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Preview (text watermark only)" }), _jsx(Row, { surface: "default", justify: "end", align: "end", className: `relative h-32 ${__O.hidden}`, rounded: "default", children: _jsx(Span, { ref: watermarkPreviewRef, weight: "medium", color: "faint", padding: "1", className: "select-none", children: watermarkText }) })] }), _jsx(GroupSaveButton, { isPending: watermarkMutation.isPending })] }) }), _jsx(TabsContent, { value: "fees", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); feesMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Platform fee \u2014 our cut (%)", helperText: "% charged on order value. Buyer pays this.", value: String(platformFeePercent), onChange: (e) => setPlatformFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "GST on platform fee (%)", helperText: "Applied to our fee only (not full order). Usually 18%.", value: String(gstPercent), onChange: (e) => setGstPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Razorpay gateway cost (%)", helperText: "Gateway's own fee \u2014 absorbed by platform, not passed through.", value: String(gatewayFeePercent), onChange: (e) => setGatewayFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 10, step: 0.01 }), _jsx(Input, { label: "Minimum transaction fee (\u20B9)", helperText: "Per-transaction floor. Total charge will never be below base + this.", value: String(minimumTransactionFee), onChange: (e) => setMinimumTransactionFee(parseFloat(e.target.value) || 0), type: "number", min: 0, step: 0.01 }), _jsx(Input, { label: "Seller payout hold (days)", value: String(payoutHoldDays), onChange: (e) => setPayoutHoldDays(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Minimum payout amount (\u20B9)", value: String(minPayoutAmount), onChange: (e) => setMinPayoutAmount(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Auction listing fee (\u20B9)", value: String(auctionListingFee), onChange: (e) => setAuctionListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Pre-order listing fee (\u20B9)", value: String(preOrderListingFee), onChange: (e) => setPreOrderListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Featured slot fee (\u20B9)", value: String(featuredSlotFee), onChange: (e) => setFeaturedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Promoted slot fee (\u20B9)", value: String(promotedSlotFee), onChange: (e) => setPromotedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 })] }), _jsx(GroupSaveButton, { isPending: feesMutation.isPending })] }) }), _jsx(TabsContent, { value: "procurement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); laborRateMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Used to compute each procurement shipment's labor cost (hours spent \u00D7 hourly rate) and its estimated processing time (hours spent \u00F7 max hours/day)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Hourly rate (\u20B9)", helperText: "Your effective hourly wage for sorting/categorizing/listing a shipment.", value: String(laborHourlyRatePaise / 100), onChange: (e) => setLaborHourlyRatePaise(Math.round((parseFloat(e.target.value) || 0) * 100)), type: "number", min: 0 }), _jsx(Input, { label: "Max hours per day", helperText: "Used only to project how many days a shipment's tracked hours will take.", value: String(laborMaxHoursPerDay), onChange: (e) => setLaborMaxHoursPerDay(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 24 })] }), _jsx(GroupSaveButton, { isPending: laborRateMutation.isPending })] }) }), _jsx(TabsContent, { value: "emi", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); emiSettingsMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "A seller must also opt in via their own Payout Settings for EMI to appear at checkout on their items. See the \"How EMI Works\" public page for buyer-facing copy." }), _jsx(Toggle, { checked: emiEnabled, onChange: setEmiEnabled, label: "Enable EMI platform-wide" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Minimum order value (\u20B9)", helperText: "A seller's cart subtotal must exceed this for EMI to appear as an option.", value: String(emiMinOrderValuePaise / 100), onChange: (e) => setEmiMinOrderValuePaise(Math.round((parseFloat(e.target.value) || 0) * 100)), type: "number", min: 0 }), _jsx(Input, { label: "Tenure options (months, comma-separated)", helperText: "e.g. 2,3,4,5,6", value: emiTenureOptionsText, onChange: (e) => setEmiTenureOptionsText(e.target.value) }), _jsx(Input, { label: "Token / down-payment (%)", helperText: "Collected upfront at checkout.", value: String(emiTokenPercent), onChange: (e) => setEmiTokenPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 }), _jsx(Input, { label: "Billing day (1\u201310)", helperText: "Day of month each installment is due.", value: String(emiBillingDay), onChange: (e) => setEmiBillingDay(parseFloat(e.target.value) || 1), type: "number", min: 1, max: 10 }), _jsx(Input, { label: "Surcharge (% of principal per month)", helperText: "The 'excess EMI fee' the buyer pays for spreading payment.", value: String(emiSurchargePercentPerMonth), onChange: (e) => setEmiSurchargePercentPerMonth(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Seller's share of surcharge (%)", helperText: "The rest of the surcharge goes to the platform.", value: String(emiSurchargeSellerSharePercent), onChange: (e) => setEmiSurchargeSellerSharePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 })] }), _jsx(GroupSaveButton, { isPending: emiSettingsMutation.isPending })] }) }), _jsx(TabsContent, { value: "gst", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); gstSettingsMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Required before enabling GST-inclusive checkout (P-8). Also set a GST rate + HSN code on each taxable product for the tax breakdown to appear." }), _jsx(Toggle, { checked: gstEnabled, onChange: setGstEnabled, label: "Enable GST on checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "GSTIN", helperText: "15-character GST Identification Number.", value: gstin, onChange: (e) => setGstin(e.target.value), placeholder: "29AAAAA0000A1Z5", maxLength: 15 }), _jsx(Input, { label: "Legal name", helperText: "Registered business name for invoices.", value: gstLegalName, onChange: (e) => setGstLegalName(e.target.value), placeholder: "LetItRip Collectibles Pvt Ltd" })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Registered address" }), _jsx(Textarea, { value: gstAddress, onChange: (e) => setGstAddress(e.target.value), placeholder: "Registered business address for GST invoices\u2026", rows: 3 })] }), _jsx(GroupSaveButton, { isPending: gstSettingsMutation.isPending })] }) }), _jsx(TabsContent, { value: "integrations", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); integrationsMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Keys are masked in transit and stored encrypted. Click Reveal to view." }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Razorpay" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Razorpay Key ID", value: razorpayKeyId, onChange: setRazorpayKeyId, placeholder: "rzp_live_\u2026" }), _jsx(MaskedInput, { label: "Razorpay Secret", value: razorpaySecret, onChange: setRazorpaySecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "SMTP / Email" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "SMTP host", value: smtpHost, onChange: (e) => setSmtpHost(e.target.value), placeholder: "smtp.sendgrid.net" }), _jsx(Input, { label: "SMTP port", value: smtpPort, onChange: (e) => setSmtpPort(e.target.value), type: "number", placeholder: "587" }), _jsx(Input, { label: "SMTP user", value: smtpUser, onChange: (e) => setSmtpUser(e.target.value), placeholder: "apikey" }), _jsx(MaskedInput, { label: "SMTP password", value: smtpPassword, onChange: setSmtpPassword, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] }), _jsx(Input, { label: "From address", value: smtpFrom, onChange: (e) => setSmtpFrom(e.target.value), placeholder: "noreply@letitrip.in", type: "email" })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Analytics & Tracking" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Google Analytics ID", value: gaMeasurementId, onChange: (e) => setGaMeasurementId(e.target.value), placeholder: "G-XXXXXXXXXX" }), _jsx(Input, { label: "Facebook Pixel ID", value: fbPixelId, onChange: (e) => setFbPixelId(e.target.value), placeholder: "XXXXXXXXXXXXXXXX" }), _jsx(Input, { label: "GTM Container ID", value: gtmContainerId, onChange: (e) => setGtmContainerId(e.target.value), placeholder: "GTM-XXXXXXX" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Meta (Instagram & Facebook Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Used by the Social Feed section to fetch Instagram and Facebook posts via Meta Graph API v19." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Page Access Token", value: metaPageAccessToken, onChange: setMetaPageAccessToken, placeholder: "EAAxxxxxxx\u2026" }), _jsx(Input, { label: "Page ID (or handle)", value: metaPageId, onChange: (e) => setMetaPageId(e.target.value), placeholder: "letitrip" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "TikTok for Developers (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials + long-lived access token from TikTok for Developers. Used to list your account's public videos." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client Key", value: tiktokClientKey, onChange: setTiktokClientKey, placeholder: "aw\u2026" }), _jsx(MaskedInput, { label: "Client Secret", value: tiktokClientSecret, onChange: setTiktokClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), _jsx(MaskedInput, { label: "Access Token (long-lived)", value: tiktokAccessToken, onChange: setTiktokAccessToken, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "DeviantArt OAuth2 (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials for DeviantArt gallery fetching (client-credentials OAuth2 flow \u2014 no user login required)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client ID", value: deviantartClientId, onChange: setDeviantartClientId, placeholder: "1234" }), _jsx(MaskedInput, { label: "Client Secret", value: deviantartClientSecret, onChange: setDeviantartClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsx(GroupSaveButton, { isPending: integrationsMutation.isPending })] }) }), _jsx(TabsContent, { value: "shipping", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); shippingMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Payment methods" }), _jsx(Toggle, { label: "Razorpay (online card/UPI) enabled \u2014 disabled by default, manual payment is the default", checked: razorpayEnabled, onChange: setRazorpayEnabled }), _jsx(Toggle, { label: "Manual UPI/bank transfer enabled", checked: upiManualEnabled, onChange: setUpiManualEnabled }), _jsx(Toggle, { label: "Cash on delivery (COD) enabled", checked: codEnabled, onChange: setCodEnabled }), _jsx(Input, { label: "Free shipping threshold (\u20B9)", value: String(freeShippingThreshold), onChange: (e) => setFreeShippingThreshold(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Orders above this amount get free shipping." }), _jsx(Select, { label: "Default carrier", options: CARRIER_OPTIONS, value: defaultCarrier, onValueChange: setDefaultCarrier }), _jsx(Input, { label: "Max delivery radius (km, 0 = no limit)", value: String(maxDeliveryRadius), onChange: (e) => setMaxDeliveryRadius(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(GroupSaveButton, { isPending: shippingMutation.isPending })] }) }), _jsx(TabsContent, { value: "auction", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); auctionMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Minimum bid increment (\u20B9)", value: String(minBidIncrement), onChange: (e) => setMinBidIncrement(parseInt(e.target.value) || 0), type: "number", min: 1, helperText: "Global default \u2014 individual auctions may override." }), _jsx(Input, { label: "Auto-extend window (minutes before end)", value: String(autoExtendWindow), onChange: (e) => setAutoExtendWindow(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Extend auction end time if a bid arrives within this window." }), _jsx(Input, { label: "Settlement grace period (hours)", value: String(settlementGrace), onChange: (e) => setSettlementGrace(parseInt(e.target.value) || 0), type: "number", min: 1, helperText: "Time winner has to pay before the auction is re-listed." }), _jsx(GroupSaveButton, { isPending: auctionMutation.isPending })] }) }), _jsx(TabsContent, { value: "limits", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); limitsMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Max products per store", value: String(maxProductsPerStore), onChange: (e) => setMaxProductsPerStore(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max images per product", value: String(maxImagesPerProduct), onChange: (e) => setMaxImagesPerProduct(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max video size (MB)", value: String(maxVideoSizeMb), onChange: (e) => setMaxVideoSizeMb(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max custom fields per product", value: String(maxCustomFields), onChange: (e) => setMaxCustomFields(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Max custom sections per product", value: String(maxCustomSections), onChange: (e) => setMaxCustomSections(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Order cancellation window (hours)", value: String(orderCancelWindow), onChange: (e) => setOrderCancelWindow(parseInt(e.target.value) || 0), type: "number", min: 0 })] }), _jsx(GroupSaveButton, { isPending: limitsMutation.isPending })] }) }), _jsx(TabsContent, { value: "whatsapp", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); whatsappMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Platform-level WhatsApp Business Cloud API credentials. Used for automated purchase announcements to admin numbers when orders are placed. Store owners configure their own credentials in Store \u2192 WhatsApp." }), _jsx(Input, { label: "Phone Number ID", value: waPhoneNumberId, onChange: (e) => setWaPhoneNumberId(e.target.value), placeholder: "987654321098765", helperText: "From Meta for Developers \u2192 App \u2192 WhatsApp \u2192 API Setup" }), _jsx(MaskedInput, { label: "Cloud API System User Token", value: waCloudApiToken, onChange: setWaCloudApiToken, placeholder: "EAAxxxxxxxx\u2026", helperText: "Long-lived system user access token with WhatsApp Business permissions" }), _jsx(Input, { label: "Admin Notify Numbers", value: waAdminNotifyNumbers, onChange: (e) => setWaAdminNotifyNumbers(e.target.value), placeholder: "919876543210,918765432109", helperText: "Comma-separated, digits-only, include country code. These receive a WhatsApp message when any order is placed." }), _jsx(GroupSaveButton, { isPending: whatsappMutation.isPending })] }) }), _jsx(TabsContent, { value: "notifications", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); notifChannelsMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "lg", children: [_jsx(Text, { size: "xs", color: "muted", children: "In-app notifications are always on. Enable external channels below to let the platform fan out to email, WhatsApp, or SMS. Users can further restrict which types they receive." }), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsxs(Row, { justify: "between", gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "In-app (notification bell)" }), _jsx(Span, { color: "success", surface: "success-surface", size: "xs", weight: "semibold", rounded: "full", padding: "pill-xs", children: "Always on" })] }), _jsx(Text, { size: "xs", color: "muted", children: "Displayed in the notification bell and inbox. Cannot be disabled." })] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "Email notifications", checked: notifEmailEnabled, onChange: setNotifEmailEnabled }), notifEmailEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send email", options: PRIORITY_OPTIONS, value: notifEmailMinPriority, onValueChange: setNotifEmailMinPriority }), _jsx(Text, { size: "xs", weight: "medium", color: "muted", className: "pt-[0.25rem]", children: "Resend API (for transactional email)" }), _jsx(MaskedInput, { label: "Resend API Key", value: resendApiKey, onChange: setResendApiKey, placeholder: "re_live_\u2026", helperText: "Get your key at resend.com \u2014 used for all transactional notifications." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "From email", value: notifFromEmail, onChange: (e) => setNotifFromEmail(e.target.value), placeholder: "noreply@letitrip.in", type: "email" }), _jsx(Input, { label: "From name", value: notifFromName, onChange: (e) => setNotifFromName(e.target.value), placeholder: "LetItRip" })] })] }))] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "WhatsApp notifications", checked: notifWhatsappEnabled, onChange: setNotifWhatsappEnabled }), notifWhatsappEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send WhatsApp", options: PRIORITY_OPTIONS, value: notifWhatsappMinPriority, onValueChange: setNotifWhatsappMinPriority }), _jsx(Toggle, { label: "Enable WhatsApp OTP (for login and verification)", checked: notifWhatsappOtpEnabled, onChange: setNotifWhatsappOtpEnabled }), _jsx(Text, { size: "xs", color: "muted", children: "WhatsApp credentials are configured in the WhatsApp tab (\u246C). OTP messages use the same phone number." })] }))] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "SMS notifications", checked: notifSmsEnabled, onChange: setNotifSmsEnabled }), notifSmsEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send SMS", options: PRIORITY_OPTIONS, value: notifSmsMinPriority, onValueChange: setNotifSmsMinPriority }), _jsx(Text, { size: "xs", color: "muted", children: "SMS gateway credentials (e.g. Twilio, MSG91) can be configured in the Integrations tab once an SMS provider is connected." })] }))] }), _jsx(GroupSaveButton, { isPending: notifChannelsMutation.isPending })] }) }), _jsx(TabsContent, { value: "legal", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); legalMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [[
501
- ["Terms of Service", termsHtml, setTermsHtml],
502
- ["Privacy Policy", privacyHtml, setPrivacyHtml],
503
- ["Refund Policy", refundHtml, setRefundHtml],
504
- ["Shipping Policy", shippingPolicyHtml, setShippingPolicyHtml],
505
- ["Cookie Policy", cookieHtml, setCookieHtml],
506
- ].map(([label, value, setter]) => (_jsx(Textarea, { label: label, value: value, onChange: (e) => setter(e.target.value), placeholder: `Enter ${label} HTML here…`, rows: 6, className: "font-mono" }, label))), _jsx(GroupSaveButton, { isPending: legalMutation.isPending })] }) })] }, "tabs"),
504
+ saveAllMutation.mutate();
505
+ }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: _jsx(ThemeManagerView, { value: themeRegistry, onChange: setThemeRegistry, previewOrigin: "/" }) }) }), _jsx(TabsContent, { value: "announcement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Toggle, { label: "Show announcement bar", checked: announcementEnabled, onChange: setAnnouncementEnabled }), _jsx(Input, { label: "Announcement text", value: announcementText, onChange: (e) => setAnnouncementText(e.target.value), placeholder: "\uD83C\uDF89 Free shipping on orders \u20B9999+", disabled: !announcementEnabled }), _jsx(Input, { label: "Link URL (optional)", value: announcementLink, onChange: (e) => setAnnouncementLink(e.target.value), placeholder: String(ROUTES.PUBLIC.PRODUCTS), disabled: !announcementEnabled }), _jsxs(Stack, { gap: "none", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", className: "mb-1", children: "Background color" }), _jsx(Input, { type: "color", value: announcementBg || "#1d4ed8", onChange: (e) => setAnnouncementBg(e.target.value), className: "h-10 w-32 cursor-pointer", bare: true, disabled: !announcementEnabled }), " "] })] }) }), _jsx(TabsContent, { value: "seo", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Default meta title", value: seoTitle, onChange: (e) => setSeoTitle(e.target.value), placeholder: "LetItRip \u2014 Buy, Sell & Auction Collectibles in India", maxLength: 60, helperText: "Max 60 chars. Use {page} token for dynamic insertion." }), _jsx(Input, { label: "Default meta description", value: seoDescription, onChange: (e) => setSeoDescription(e.target.value), placeholder: "India's largest collectibles marketplace\u2026", maxLength: 160, helperText: "Max 160 chars." }), _jsx(ImageUpload, { label: "Default OG image", currentImage: seoOgImage, onUpload: (file) => upload(file, "store"), onChange: setSeoOgImage }), _jsx(Input, { label: "Canonical base URL", value: canonicalUrl, onChange: (e) => setCanonicalUrl(e.target.value), placeholder: "https://letitrip.in" }), _jsx(Toggle, { label: "Robots noindex (disables search indexing \u2014 use carefully)", checked: seoNoIndex, onChange: setSeoNoIndex })] }) }), _jsx(TabsContent, { value: "contact", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Support email", value: supportEmail, onChange: (e) => setSupportEmail(e.target.value), type: "email", placeholder: "support@letitrip.in" }), _jsx(Input, { label: "Support phone", value: supportPhone, onChange: (e) => setSupportPhone(e.target.value), placeholder: "+91 XXXXX XXXXX" })] }), _jsx(Input, { label: "Physical address", value: supportAddress, onChange: (e) => setSupportAddress(e.target.value), placeholder: "Mumbai, Maharashtra, India" }), _jsx(Input, { label: "Support hours", value: supportHours, onChange: (e) => setSupportHours(e.target.value), placeholder: "Mon\u2013Fri, 10 AM \u2013 6 PM IST" }), _jsx(Text, { className: "pt-[0.5rem]", color: "muted", size: "sm", weight: "medium", children: "Social links" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Instagram URL", value: instagram, onChange: (e) => setInstagram(e.target.value), placeholder: "https://instagram.com/letitrip" }), _jsx(Input, { label: "Twitter / X URL", value: twitter, onChange: (e) => setTwitter(e.target.value), placeholder: "https://twitter.com/letitrip" }), _jsx(Input, { label: "Facebook URL", value: facebook, onChange: (e) => setFacebook(e.target.value), placeholder: "https://facebook.com/letitrip" }), _jsx(Input, { label: "YouTube URL", value: youtube, onChange: (e) => setYoutube(e.target.value), placeholder: "https://youtube.com/@letitrip" }), _jsx(Input, { label: "WhatsApp number", value: whatsapp, onChange: (e) => setWhatsapp(e.target.value), placeholder: "+91XXXXXXXXXX" }), _jsx(Input, { label: "LinkedIn URL", value: linkedin, onChange: (e) => setLinkedin(e.target.value), placeholder: "https://linkedin.com/company/letitrip" }), _jsx(Input, { label: "Pinterest URL", value: pinterest, onChange: (e) => setPinterest(e.target.value), placeholder: "https://pinterest.com/letitrip" })] })] }) }), _jsx(TabsContent, { value: "watermark", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Select, { label: "Watermark type", options: [{ label: "Text", value: "text" }, { label: "Image", value: "image" }], value: watermarkType, onValueChange: (v) => setWatermarkType(v) }), watermarkType === "text" ? (_jsx(Input, { label: "Watermark text", value: watermarkText, onChange: (e) => setWatermarkText(e.target.value), placeholder: "letitrip.in" })) : (_jsx(ImageUpload, { label: "Watermark image", currentImage: watermarkImageUrl, onUpload: (file) => upload(file, "store"), onChange: setWatermarkImageUrl })), _jsx(Slider, { label: `Size — ${watermarkSize}% of image width`, value: watermarkSize, onChange: setWatermarkSize, min: 5, max: 100, step: 5 }), _jsx(Slider, { label: `Opacity — ${watermarkOpacity}%`, value: watermarkOpacity, onChange: setWatermarkOpacity, min: 5, max: 100, step: 5 }), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Preview (text watermark only)" }), _jsx(Row, { surface: "default", justify: "end", align: "end", className: `relative h-32 ${__O.hidden}`, rounded: "default", children: _jsx(Span, { ref: watermarkPreviewRef, weight: "medium", color: "faint", padding: "1", className: "select-none", children: watermarkText }) })] })] }) }), _jsx(TabsContent, { value: "fees", children: _jsx(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Platform fee \u2014 our cut (%)", helperText: "% charged on order value. Buyer pays this.", value: String(platformFeePercent), onChange: (e) => setPlatformFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "GST on platform fee (%)", helperText: "Applied to our fee only (not full order). Usually 18%.", value: String(gstPercent), onChange: (e) => setGstPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100, step: 0.1 }), _jsx(Input, { label: "Razorpay gateway cost (%)", helperText: "Gateway's own fee \u2014 absorbed by platform, not passed through.", value: String(gatewayFeePercent), onChange: (e) => setGatewayFeePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 10, step: 0.01 }), _jsx(Input, { label: "Minimum transaction fee (\u20B9)", helperText: "Per-transaction floor. Total charge will never be below base + this.", value: String(minimumTransactionFee), onChange: (e) => setMinimumTransactionFee(parseFloat(e.target.value) || 0), type: "number", min: 0, step: 0.01 }), _jsx(Input, { label: "Seller payout hold (days)", value: String(payoutHoldDays), onChange: (e) => setPayoutHoldDays(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Minimum payout amount (\u20B9)", value: String(minPayoutAmount), onChange: (e) => setMinPayoutAmount(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Auction listing fee (\u20B9)", value: String(auctionListingFee), onChange: (e) => setAuctionListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Pre-order listing fee (\u20B9)", value: String(preOrderListingFee), onChange: (e) => setPreOrderListingFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Featured slot fee (\u20B9)", value: String(featuredSlotFee), onChange: (e) => setFeaturedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Promoted slot fee (\u20B9)", value: String(promotedSlotFee), onChange: (e) => setPromotedSlotFee(parseInt(e.target.value) || 0), type: "number", min: 0 })] }) }) }), _jsx(TabsContent, { value: "procurement", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Used to compute each procurement shipment's labor cost (hours spent \u00D7 hourly rate) and its estimated processing time (hours spent \u00F7 max hours/day)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Hourly rate (\u20B9)", helperText: "Your effective hourly wage for sorting/categorizing/listing a shipment.", value: String(laborHourlyRatePaise / 100), onChange: (e) => setLaborHourlyRatePaise(Math.round((parseFloat(e.target.value) || 0) * 100)), type: "number", min: 0 }), _jsx(Input, { label: "Max hours per day", helperText: "Used only to project how many days a shipment's tracked hours will take.", value: String(laborMaxHoursPerDay), onChange: (e) => setLaborMaxHoursPerDay(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 24 })] })] }) }), _jsx(TabsContent, { value: "emi", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "A seller must also opt in via their own Payout Settings for EMI to appear at checkout on their items. See the \"How EMI Works\" public page for buyer-facing copy." }), _jsx(Toggle, { checked: emiEnabled, onChange: setEmiEnabled, label: "Enable EMI platform-wide" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Minimum order value (\u20B9)", helperText: "A seller's cart subtotal must exceed this for EMI to appear as an option.", value: String(emiMinOrderValuePaise / 100), onChange: (e) => setEmiMinOrderValuePaise(Math.round((parseFloat(e.target.value) || 0) * 100)), type: "number", min: 0 }), _jsx(Input, { label: "Tenure options (months, comma-separated)", helperText: "e.g. 2,3,4,5,6", value: emiTenureOptionsText, onChange: (e) => setEmiTenureOptionsText(e.target.value) }), _jsx(Input, { label: "Token / down-payment (%)", helperText: "Collected upfront at checkout.", value: String(emiTokenPercent), onChange: (e) => setEmiTokenPercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 }), _jsx(Input, { label: "Billing day (1\u201310)", helperText: "Day of month each installment is due.", value: String(emiBillingDay), onChange: (e) => setEmiBillingDay(parseFloat(e.target.value) || 1), type: "number", min: 1, max: 10 }), _jsx(Input, { label: "Surcharge (% of principal per month)", helperText: "The 'excess EMI fee' the buyer pays for spreading payment.", value: String(emiSurchargePercentPerMonth), onChange: (e) => setEmiSurchargePercentPerMonth(parseFloat(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Seller's share of surcharge (%)", helperText: "The rest of the surcharge goes to the platform.", value: String(emiSurchargeSellerSharePercent), onChange: (e) => setEmiSurchargeSellerSharePercent(parseFloat(e.target.value) || 0), type: "number", min: 0, max: 100 })] })] }) }), _jsx(TabsContent, { value: "gst", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Required before enabling GST-inclusive checkout (P-8). Also set a GST rate + HSN code on each taxable product for the tax breakdown to appear." }), _jsx(Toggle, { checked: gstEnabled, onChange: setGstEnabled, label: "Enable GST on checkout" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "GSTIN", helperText: "15-character GST Identification Number.", value: gstin, onChange: (e) => setGstin(e.target.value), placeholder: "29AAAAA0000A1Z5", maxLength: 15 }), _jsx(Input, { label: "Legal name", helperText: "Registered business name for invoices.", value: gstLegalName, onChange: (e) => setGstLegalName(e.target.value), placeholder: "LetItRip Collectibles Pvt Ltd" })] }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: "Registered address" }), _jsx(Textarea, { value: gstAddress, onChange: (e) => setGstAddress(e.target.value), placeholder: "Registered business address for GST invoices\u2026", rows: 3 })] })] }) }), _jsx(TabsContent, { value: "integrations", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Keys are masked in transit and stored encrypted. Click Reveal to view." }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Razorpay" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Razorpay Key ID", value: razorpayKeyId, onChange: setRazorpayKeyId, placeholder: "rzp_live_\u2026" }), _jsx(MaskedInput, { label: "Razorpay Secret", value: razorpaySecret, onChange: setRazorpaySecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "SMTP / Email" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "SMTP host", value: smtpHost, onChange: (e) => setSmtpHost(e.target.value), placeholder: "smtp.sendgrid.net" }), _jsx(Input, { label: "SMTP port", value: smtpPort, onChange: (e) => setSmtpPort(e.target.value), type: "number", placeholder: "587" }), _jsx(Input, { label: "SMTP user", value: smtpUser, onChange: (e) => setSmtpUser(e.target.value), placeholder: "apikey" }), _jsx(MaskedInput, { label: "SMTP password", value: smtpPassword, onChange: setSmtpPassword, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] }), _jsx(Input, { label: "From address", value: smtpFrom, onChange: (e) => setSmtpFrom(e.target.value), placeholder: "noreply@letitrip.in", type: "email" })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Analytics & Tracking" }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Google Analytics ID", value: gaMeasurementId, onChange: (e) => setGaMeasurementId(e.target.value), placeholder: "G-XXXXXXXXXX" }), _jsx(Input, { label: "Facebook Pixel ID", value: fbPixelId, onChange: (e) => setFbPixelId(e.target.value), placeholder: "XXXXXXXXXXXXXXXX" }), _jsx(Input, { label: "GTM Container ID", value: gtmContainerId, onChange: (e) => setGtmContainerId(e.target.value), placeholder: "GTM-XXXXXXX" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Meta (Instagram & Facebook Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Used by the Social Feed section to fetch Instagram and Facebook posts via Meta Graph API v19." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Page Access Token", value: metaPageAccessToken, onChange: setMetaPageAccessToken, placeholder: "EAAxxxxxxx\u2026" }), _jsx(Input, { label: "Page ID (or handle)", value: metaPageId, onChange: (e) => setMetaPageId(e.target.value), placeholder: "letitrip" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "TikTok for Developers (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials + long-lived access token from TikTok for Developers. Used to list your account's public videos." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client Key", value: tiktokClientKey, onChange: setTiktokClientKey, placeholder: "aw\u2026" }), _jsx(MaskedInput, { label: "Client Secret", value: tiktokClientSecret, onChange: setTiktokClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), _jsx(MaskedInput, { label: "Access Token (long-lived)", value: tiktokAccessToken, onChange: setTiktokAccessToken, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "DeviantArt OAuth2 (Social Feed)" }), _jsx(Text, { size: "xs", color: "muted", children: "Client credentials for DeviantArt gallery fetching (client-credentials OAuth2 flow \u2014 no user login required)." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(MaskedInput, { label: "Client ID", value: deviantartClientId, onChange: setDeviantartClientId, placeholder: "1234" }), _jsx(MaskedInput, { label: "Client Secret", value: deviantartClientSecret, onChange: setDeviantartClientSecret, placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" })] })] })] }) }), _jsx(TabsContent, { value: "shipping", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Payment methods" }), _jsx(Toggle, { label: "Razorpay (online card/UPI) enabled \u2014 disabled by default, manual payment is the default", checked: razorpayEnabled, onChange: setRazorpayEnabled }), _jsx(Toggle, { label: "Manual UPI/bank transfer enabled", checked: upiManualEnabled, onChange: setUpiManualEnabled }), _jsx(Toggle, { label: "Cash on delivery (COD) enabled", checked: codEnabled, onChange: setCodEnabled }), _jsx(Input, { label: "Free shipping threshold (\u20B9)", value: String(freeShippingThreshold), onChange: (e) => setFreeShippingThreshold(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Orders above this amount get free shipping." }), _jsx(Select, { label: "Default carrier", options: CARRIER_OPTIONS, value: defaultCarrier, onValueChange: setDefaultCarrier }), _jsx(Input, { label: "Max delivery radius (km, 0 = no limit)", value: String(maxDeliveryRadius), onChange: (e) => setMaxDeliveryRadius(parseInt(e.target.value) || 0), type: "number", min: 0 })] }) }), _jsx(TabsContent, { value: "auction", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Input, { label: "Minimum bid increment (\u20B9)", value: String(minBidIncrement), onChange: (e) => setMinBidIncrement(parseInt(e.target.value) || 0), type: "number", min: 1, helperText: "Global default \u2014 individual auctions may override." }), _jsx(Input, { label: "Auto-extend window (minutes before end)", value: String(autoExtendWindow), onChange: (e) => setAutoExtendWindow(parseInt(e.target.value) || 0), type: "number", min: 0, helperText: "Extend auction end time if a bid arrives within this window." }), _jsx(Input, { label: "Settlement grace period (hours)", value: String(settlementGrace), onChange: (e) => setSettlementGrace(parseInt(e.target.value) || 0), type: "number", min: 1, helperText: "Time winner has to pay before the auction is re-listed." })] }) }), _jsx(TabsContent, { value: "limits", children: _jsx(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "Max products per store", value: String(maxProductsPerStore), onChange: (e) => setMaxProductsPerStore(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max images per product", value: String(maxImagesPerProduct), onChange: (e) => setMaxImagesPerProduct(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max video size (MB)", value: String(maxVideoSizeMb), onChange: (e) => setMaxVideoSizeMb(parseInt(e.target.value) || 0), type: "number", min: 1 }), _jsx(Input, { label: "Max custom fields per product", value: String(maxCustomFields), onChange: (e) => setMaxCustomFields(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Max custom sections per product", value: String(maxCustomSections), onChange: (e) => setMaxCustomSections(parseInt(e.target.value) || 0), type: "number", min: 0 }), _jsx(Input, { label: "Order cancellation window (hours)", value: String(orderCancelWindow), onChange: (e) => setOrderCancelWindow(parseInt(e.target.value) || 0), type: "number", min: 0 })] }) }) }), _jsx(TabsContent, { value: "whatsapp", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [_jsx(Text, { size: "xs", color: "muted", children: "Platform-level WhatsApp Business Cloud API credentials. Used for automated purchase announcements to admin numbers when orders are placed. Store owners configure their own credentials in Store \u2192 WhatsApp." }), _jsx(Input, { label: "Phone Number ID", value: waPhoneNumberId, onChange: (e) => setWaPhoneNumberId(e.target.value), placeholder: "987654321098765", helperText: "From Meta for Developers \u2192 App \u2192 WhatsApp \u2192 API Setup" }), _jsx(MaskedInput, { label: "Cloud API System User Token", value: waCloudApiToken, onChange: setWaCloudApiToken, placeholder: "EAAxxxxxxxx\u2026", helperText: "Long-lived system user access token with WhatsApp Business permissions" }), _jsx(Input, { label: "Admin Notify Numbers", value: waAdminNotifyNumbers, onChange: (e) => setWaAdminNotifyNumbers(e.target.value), placeholder: "919876543210,918765432109", helperText: "Comma-separated, digits-only, include country code. These receive a WhatsApp message when any order is placed." })] }) }), _jsx(TabsContent, { value: "notifications", children: _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "lg", children: [_jsx(Text, { size: "xs", color: "muted", children: "In-app notifications are always on. Enable external channels below to let the platform fan out to email, WhatsApp, or SMS. Users can further restrict which types they receive." }), _jsxs(Stack, { gap: "xs", surface: "muted", rounded: "lg", border: "default", padding: "md", children: [_jsxs(Row, { justify: "between", gap: "sm", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "In-app (notification bell)" }), _jsx(Span, { color: "success", surface: "success-surface", size: "xs", weight: "semibold", rounded: "full", padding: "pill-xs", children: "Always on" })] }), _jsx(Text, { size: "xs", color: "muted", children: "Displayed in the notification bell and inbox. Cannot be disabled." })] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "Email notifications", checked: notifEmailEnabled, onChange: setNotifEmailEnabled }), notifEmailEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send email", options: PRIORITY_OPTIONS, value: notifEmailMinPriority, onValueChange: setNotifEmailMinPriority }), _jsx(Text, { size: "xs", weight: "medium", color: "muted", className: "pt-[0.25rem]", children: "Resend API (for transactional email)" }), _jsx(MaskedInput, { label: "Resend API Key", value: resendApiKey, onChange: setResendApiKey, placeholder: "re_live_\u2026", helperText: "Get your key at resend.com \u2014 used for all transactional notifications." }), _jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(Input, { label: "From email", value: notifFromEmail, onChange: (e) => setNotifFromEmail(e.target.value), placeholder: "noreply@letitrip.in", type: "email" }), _jsx(Input, { label: "From name", value: notifFromName, onChange: (e) => setNotifFromName(e.target.value), placeholder: "LetItRip" })] })] }))] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "WhatsApp notifications", checked: notifWhatsappEnabled, onChange: setNotifWhatsappEnabled }), notifWhatsappEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send WhatsApp", options: PRIORITY_OPTIONS, value: notifWhatsappMinPriority, onValueChange: setNotifWhatsappMinPriority }), _jsx(Toggle, { label: "Enable WhatsApp OTP (for login and verification)", checked: notifWhatsappOtpEnabled, onChange: setNotifWhatsappOtpEnabled }), _jsx(Text, { size: "xs", color: "muted", children: "WhatsApp credentials are configured in the WhatsApp tab (\u246C). OTP messages use the same phone number." })] }))] }), _jsxs(Stack, { gap: "md", rounded: "lg", border: "default", padding: "md", children: [_jsx(Toggle, { label: "SMS notifications", checked: notifSmsEnabled, onChange: setNotifSmsEnabled }), notifSmsEnabled && (_jsxs(Stack, { gap: "md", className: NOTIF_CHANNEL_INDENT, children: [_jsx(Select, { label: "Minimum priority to send SMS", options: PRIORITY_OPTIONS, value: notifSmsMinPriority, onValueChange: setNotifSmsMinPriority }), _jsx(Text, { size: "xs", color: "muted", children: "SMS gateway credentials (e.g. Twilio, MSG91) can be configured in the Integrations tab once an SMS provider is connected." })] }))] })] }) }), _jsx(TabsContent, { value: "legal", children: _jsx(Form, { onSubmit: (e) => { e.preventDefault(); saveAllMutation.mutate(); }, className: "pt-[var(--appkit-space-4)]", spacing: "md", children: [
506
+ ["Terms of Service", termsHtml, setTermsHtml],
507
+ ["Privacy Policy", privacyHtml, setPrivacyHtml],
508
+ ["Refund Policy", refundHtml, setRefundHtml],
509
+ ["Shipping Policy", shippingPolicyHtml, setShippingPolicyHtml],
510
+ ["Cookie Policy", cookieHtml, setCookieHtml],
511
+ ].map(([label, value, setter]) => (_jsx(Textarea, { label: label, value: value, onChange: (e) => setter(e.target.value), placeholder: `Enter ${label} HTML here…`, rows: 6, className: "font-mono" }, label))) }) })] }, "tabs"),
512
+ _jsx(SaveAllBar, { isPending: saveAllMutation.isPending, onSave: () => saveAllMutation.mutate() }, "save-all"),
507
513
  ] }));
508
514
  }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { StackedViewShellProps } from "../../../ui";
3
+ export interface AdminTesterChecklistItemEditorViewProps extends Omit<StackedViewShellProps, "sections"> {
4
+ itemId?: string;
5
+ onSaved?: (id: string) => void;
6
+ onDeleted?: () => void;
7
+ embedded?: boolean;
8
+ }
9
+ export declare function AdminTesterChecklistItemEditorView({ itemId, onSaved, onDeleted, embedded, ...rest }: AdminTesterChecklistItemEditorViewProps): React.JSX.Element;
@@ -0,0 +1,129 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useApiMutation } from "@mohasinac/appkit/client";
4
+ import React from "react";
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { z } from "zod";
7
+ import { Button, ConfirmDeleteModal, Div, Form, Input, Row, Stack, StackedViewShell, Text, Toggle, useToast, } from "../../../ui";
8
+ import { FieldInput, FieldTextarea } from "../../../ui/forms";
9
+ import { apiClient } from "../../../http";
10
+ import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
11
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
12
+ const checklistItemFormSchema = z.object({
13
+ groupKey: z.string().min(1, "Group key is required").max(100),
14
+ groupLabel: z.string().min(1, "Group label is required").max(200),
15
+ pageKey: z.string().min(1, "Page key is required").max(100),
16
+ pageLabel: z.string().min(1, "Page label is required").max(200),
17
+ label: z.string().min(3, "Label must be at least 3 characters").max(500),
18
+ }).passthrough();
19
+ const __P = {
20
+ p4: "p-[var(--appkit-space-4)]",
21
+ };
22
+ const __O = {
23
+ yAuto: "overflow-y-auto",
24
+ };
25
+ function slugifyKey(str) {
26
+ return str
27
+ .toLowerCase()
28
+ .trim()
29
+ .replace(/[^a-z0-9]+/g, "-")
30
+ .replace(/^-+|-+$/g, "");
31
+ }
32
+ export function AdminTesterChecklistItemEditorView({ itemId, onSaved, onDeleted, embedded, ...rest }) {
33
+ const isEdit = Boolean(itemId);
34
+ const [groupKey, setGroupKey] = React.useState("");
35
+ const [groupLabel, setGroupLabel] = React.useState("");
36
+ const [pageKey, setPageKey] = React.useState("");
37
+ const [pageLabel, setPageLabel] = React.useState("");
38
+ const [label, setLabel] = React.useState("");
39
+ const [description, setDescription] = React.useState("");
40
+ const [href, setHref] = React.useState("");
41
+ const [order, setOrder] = React.useState(0);
42
+ const [isActive, setIsActive] = React.useState(true);
43
+ const [deleteConfirmOpen, setDeleteConfirmOpen] = React.useState(false);
44
+ const { showToast } = useToast();
45
+ const itemQuery = useQuery({
46
+ queryKey: ["admin", "tester-checklist-items", itemId],
47
+ queryFn: async () => {
48
+ const res = await apiClient.get(ADMIN_ENDPOINTS.TESTER_CHECKLIST_ITEM_BY_ID(itemId));
49
+ return res?.data ?? res;
50
+ },
51
+ enabled: isEdit,
52
+ });
53
+ React.useEffect(() => {
54
+ const item = itemQuery.data;
55
+ if (!item)
56
+ return;
57
+ setGroupKey(item.groupKey ?? "");
58
+ setGroupLabel(item.groupLabel ?? "");
59
+ setPageKey(item.pageKey ?? "");
60
+ setPageLabel(item.pageLabel ?? "");
61
+ setLabel(item.label ?? "");
62
+ setDescription(item.description ?? "");
63
+ setHref(item.href ?? "");
64
+ setOrder(typeof item.order === "number" ? item.order : 0);
65
+ setIsActive(item.isActive ?? true);
66
+ }, [itemQuery.data]);
67
+ const handleGroupLabelChange = (value) => {
68
+ setGroupLabel(value);
69
+ if (!isEdit)
70
+ setGroupKey(slugifyKey(value));
71
+ };
72
+ const handlePageLabelChange = (value) => {
73
+ setPageLabel(value);
74
+ if (!isEdit)
75
+ setPageKey(slugifyKey(value));
76
+ };
77
+ const saveMutation = useApiMutation({
78
+ mutationFn: async () => {
79
+ const payload = {
80
+ groupKey: groupKey || slugifyKey(groupLabel),
81
+ groupLabel,
82
+ pageKey: pageKey || slugifyKey(pageLabel),
83
+ pageLabel,
84
+ label,
85
+ description: description || "",
86
+ href: href || "",
87
+ order,
88
+ isActive,
89
+ };
90
+ if (isEdit) {
91
+ return apiClient.put(ADMIN_ENDPOINTS.TESTER_CHECKLIST_ITEM_BY_ID(itemId), payload);
92
+ }
93
+ return apiClient.post(ADMIN_ENDPOINTS.TESTER_CHECKLIST_ITEMS, payload);
94
+ },
95
+ onSuccess: (res) => {
96
+ const id = res?.data?.id ?? res?.id ?? itemId;
97
+ showToast(isEdit ? "Checklist item updated." : "Checklist item created.", "success");
98
+ if (onSaved && id)
99
+ onSaved(id);
100
+ },
101
+ onError: (err) => {
102
+ showToast(err?.message ?? "Failed to save checklist item.", "error");
103
+ },
104
+ });
105
+ const deleteMutation = useApiMutation({
106
+ mutationFn: () => apiClient.delete(ADMIN_ENDPOINTS.TESTER_CHECKLIST_ITEM_BY_ID(itemId)),
107
+ onSuccess: () => {
108
+ showToast("Checklist item deleted.", "success");
109
+ if (onDeleted)
110
+ onDeleted();
111
+ },
112
+ onError: (err) => showToast(err?.message ?? "Failed to delete checklist item.", "error"),
113
+ });
114
+ const isSubmitting = saveMutation.isPending || itemQuery.isLoading;
115
+ const canSave = Boolean(groupLabel.trim()) && Boolean(pageLabel.trim()) && Boolean(label.trim());
116
+ const formSection = (_jsxs(_Fragment, { children: [_jsx(Form, { schema: checklistItemFormSchema, onSubmit: (e) => e.preventDefault(), spacing: "md", children: ({ setFieldError, clearErrors }) => (_jsxs(_Fragment, { children: [_jsxs(Div, { layout: "grid", gap: "4", className: "grid-cols-2", children: [_jsx(FieldInput, { name: "groupLabel", label: "Group", value: groupLabel, onChange: handleGroupLabelChange, required: true, placeholder: "e.g. Buying", hint: "Top-level accordion section on the Tester Hub." }), _jsx(Input, { label: "Group key", value: groupKey, onChange: (e) => setGroupKey(e.target.value), placeholder: "buying", helperText: "Auto-generated from the group name." })] }), _jsxs(Div, { layout: "grid", gap: "4", className: "grid-cols-2", children: [_jsx(FieldInput, { name: "pageLabel", label: "Page", value: pageLabel, onChange: handlePageLabelChange, required: true, placeholder: "e.g. Checkout", hint: "Sub-accordion within the group." }), _jsx(Input, { label: "Page key", value: pageKey, onChange: (e) => setPageKey(e.target.value), placeholder: "checkout", helperText: "Auto-generated from the page name." })] }), _jsx(FieldInput, { name: "label", label: "Test case (Yes/No question)", value: label, onChange: setLabel, required: true, placeholder: "e.g. Coupon discount is correctly reflected in the order total" }), _jsx(FieldTextarea, { name: "description", label: "Description (optional)", value: description, onChange: setDescription, placeholder: "Extra context for the tester." }), _jsx(FieldInput, { name: "href", label: "Deep link (optional)", value: href, onChange: setHref, placeholder: "/cart", hint: "Jumps the tester straight to the feature being tested." }), _jsx(Input, { label: "Display order", value: String(order), onChange: (e) => setOrder(parseInt(e.target.value, 10) || 0), type: "number", min: 0, helperText: "Lower = shown first within the page." }), _jsxs(Stack, { className: `${__P.p4}`, gap: "3", rounded: "lg", border: "default", children: [_jsx(Text, { size: "sm", weight: "medium", color: "muted", children: "Visibility" }), _jsx(Toggle, { label: "Active (visible to testers)", checked: isActive, onChange: setIsActive })] }), _jsxs(Row, { gap: "3", padding: "t-xs", children: [_jsx(Button, { type: "submit", isLoading: isSubmitting, disabled: !canSave || isSubmitting, onClick: () => {
117
+ clearErrors();
118
+ if (!label.trim()) {
119
+ setFieldError("label", "Test case label is required");
120
+ return;
121
+ }
122
+ saveMutation.mutate();
123
+ }, children: isEdit ? "Save changes" : "Create checklist item" }), isEdit && (_jsx(Button, { type: "button", variant: "danger", isLoading: deleteMutation.isPending, onClick: () => setDeleteConfirmOpen(true), children: "Delete" }))] })] })) }, "tester-checklist-item-form"), deleteConfirmOpen && (_jsx(ConfirmDeleteModal, { isOpen: true, title: ACTIONS.ADMIN["delete-checklist-item"].confirmation?.title ?? "Delete checklist item", message: ACTIONS.ADMIN["delete-checklist-item"].confirmation?.body ??
124
+ "Delete this checklist item? This cannot be undone.", onConfirm: () => { deleteMutation.mutate(); setDeleteConfirmOpen(false); }, onClose: () => setDeleteConfirmOpen(false), isDeleting: deleteMutation.isPending }))] }));
125
+ if (embedded) {
126
+ return _jsx(Div, { className: `${__O.yAuto} ${__P.p4}`, children: formSection });
127
+ }
128
+ return (_jsx(StackedViewShell, { portal: "admin", ...rest, title: isEdit ? "Edit checklist item" : "New checklist item", sections: [formSection] }));
129
+ }
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { ListingLayoutProps } from "../../../ui";
3
+ export interface AdminTesterChecklistViewProps extends ListingLayoutProps {
4
+ onBulkDelete?: (ids: string[]) => Promise<void>;
5
+ }
6
+ export declare function AdminTesterChecklistView({ children, onBulkDelete, ...props }: AdminTesterChecklistViewProps): React.JSX.Element;