@mohasinac/appkit 4.17.0 → 4.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +3 -1
- package/dist/_internal/client/features/lottery/LotteryPullForm.js +3 -1
- package/dist/_internal/shared/features/lottery/config-form.d.ts +58 -0
- package/dist/_internal/shared/features/lottery/config-form.js +71 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.js +8 -0
- package/dist/features/account/schemas/index.d.ts +23 -0
- package/dist/features/account/schemas/index.js +21 -0
- package/dist/features/admin/components/AdminAdEditorView.js +4 -2
- package/dist/features/admin/components/AdminAddressEditorView.js +4 -2
- package/dist/features/admin/components/AdminEmployeeEditorView.js +3 -1
- package/dist/features/admin/components/AdminFeatureFlagsView.js +4 -2
- package/dist/features/admin/components/AdminOrderEditorView.js +4 -2
- package/dist/features/admin/components/AdminSiteSettingsView.js +8 -6
- package/dist/features/admin/components/AdminSiteView.js +4 -2
- package/dist/features/admin/components/AdminStoreEditorView.js +11 -9
- package/dist/features/admin/components/AdminUserEditorView.js +14 -12
- package/dist/features/admin/components/AdminUsersView.js +4 -2
- package/dist/features/admin/schemas/admin-editor-forms.d.ts +119 -0
- package/dist/features/admin/schemas/admin-editor-forms.js +141 -0
- package/dist/features/admin/schemas/admin-ops-forms.d.ts +123 -0
- package/dist/features/admin/schemas/admin-ops-forms.js +147 -0
- package/dist/features/admin/schemas/admin-user-form.d.ts +82 -0
- package/dist/features/admin/schemas/admin-user-form.js +102 -0
- package/dist/features/admin/schemas/site-settings-form.d.ts +309 -0
- package/dist/features/admin/schemas/site-settings-form.js +159 -0
- package/dist/features/auctions/components/PlaceBidFormClient.js +3 -2
- package/dist/features/orders/schemas/buyer-forms.d.ts +46 -0
- package/dist/features/orders/schemas/buyer-forms.js +81 -0
- package/dist/features/scams/schemas/report-form.d.ts +63 -0
- package/dist/features/scams/schemas/report-form.js +88 -0
- package/dist/features/store-extensions/schemas/sublisting-category-form.d.ts +15 -0
- package/dist/features/store-extensions/schemas/sublisting-category-form.js +41 -0
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +4 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/schemas/registry.d.ts +682 -0
- package/dist/schemas/registry.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const scamReportFormSchema: z.ZodEffects<z.ZodObject<{
|
|
3
|
+
displayName: z.ZodString;
|
|
4
|
+
phones: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5
|
+
upiIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
emails: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
scamType: z.ZodString;
|
|
8
|
+
scamPlatform: z.ZodOptional<z.ZodString>;
|
|
9
|
+
amountLost: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
itemInvolved: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodString;
|
|
12
|
+
reportedByAnon: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
agreed: z.ZodLiteral<true>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
displayName: string;
|
|
16
|
+
description: string;
|
|
17
|
+
scamType: string;
|
|
18
|
+
agreed: true;
|
|
19
|
+
reportedByAnon?: boolean | undefined;
|
|
20
|
+
scamPlatform?: string | undefined;
|
|
21
|
+
amountLost?: number | undefined;
|
|
22
|
+
itemInvolved?: string | undefined;
|
|
23
|
+
phones?: string[] | undefined;
|
|
24
|
+
upiIds?: string[] | undefined;
|
|
25
|
+
emails?: string[] | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
displayName: string;
|
|
28
|
+
description: string;
|
|
29
|
+
scamType: string;
|
|
30
|
+
agreed: true;
|
|
31
|
+
reportedByAnon?: boolean | undefined;
|
|
32
|
+
scamPlatform?: string | undefined;
|
|
33
|
+
amountLost?: number | undefined;
|
|
34
|
+
itemInvolved?: string | undefined;
|
|
35
|
+
phones?: string[] | undefined;
|
|
36
|
+
upiIds?: string[] | undefined;
|
|
37
|
+
emails?: string[] | undefined;
|
|
38
|
+
}>, {
|
|
39
|
+
displayName: string;
|
|
40
|
+
description: string;
|
|
41
|
+
scamType: string;
|
|
42
|
+
agreed: true;
|
|
43
|
+
reportedByAnon?: boolean | undefined;
|
|
44
|
+
scamPlatform?: string | undefined;
|
|
45
|
+
amountLost?: number | undefined;
|
|
46
|
+
itemInvolved?: string | undefined;
|
|
47
|
+
phones?: string[] | undefined;
|
|
48
|
+
upiIds?: string[] | undefined;
|
|
49
|
+
emails?: string[] | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
displayName: string;
|
|
52
|
+
description: string;
|
|
53
|
+
scamType: string;
|
|
54
|
+
agreed: true;
|
|
55
|
+
reportedByAnon?: boolean | undefined;
|
|
56
|
+
scamPlatform?: string | undefined;
|
|
57
|
+
amountLost?: number | undefined;
|
|
58
|
+
itemInvolved?: string | undefined;
|
|
59
|
+
phones?: string[] | undefined;
|
|
60
|
+
upiIds?: string[] | undefined;
|
|
61
|
+
emails?: string[] | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
export type ScamReportFormValues = z.infer<typeof scamReportFormSchema>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: The public scam-report form (`/scams/report`) rendered `<Form>` with no
|
|
3
|
+
* schema. It is the highest-consequence unvalidated form in the app: a
|
|
4
|
+
* submission names a real person or business by phone number, UPI ID or
|
|
5
|
+
* email and asks the platform to publish an accusation against them.
|
|
6
|
+
*
|
|
7
|
+
* Everything was free text. `amountLost` in particular was a string with
|
|
8
|
+
* no bound, and it is displayed on the public scammer profile.
|
|
9
|
+
*
|
|
10
|
+
* WHAT: The submit contract.
|
|
11
|
+
*
|
|
12
|
+
* ## At least one identifier is required, and no single one is
|
|
13
|
+
*
|
|
14
|
+
* A report naming nobody is unactionable, but demanding a phone number would
|
|
15
|
+
* reject a report about an email-only scammer. So the requirement is on the
|
|
16
|
+
* SET, checked in a `superRefine` — the same shape the payout-method schema
|
|
17
|
+
* uses for its per-type bank rules.
|
|
18
|
+
*
|
|
19
|
+
* ## `agreed` is `z.literal(true)`
|
|
20
|
+
*
|
|
21
|
+
* An unticked declaration is not a submission carrying `false`; it is a form
|
|
22
|
+
* that must not send. The user is asserting the accusation is truthful, and
|
|
23
|
+
* that assertion is what makes publishing it defensible.
|
|
24
|
+
*
|
|
25
|
+
* EXPORTS: scamReportFormSchema, type ScamReportFormValues
|
|
26
|
+
*
|
|
27
|
+
* @tag domain:scams
|
|
28
|
+
* @tag layer:schema
|
|
29
|
+
* @tag pattern:none
|
|
30
|
+
* @tag access:isomorphic
|
|
31
|
+
* @tag consumers:scams/report page
|
|
32
|
+
* @tag sideEffects:none
|
|
33
|
+
*/
|
|
34
|
+
import { z } from "zod";
|
|
35
|
+
import { annotate } from "../../shell/field-ui-meta";
|
|
36
|
+
const UPI_VPA_RE = /^[\w.\-_]{2,256}@[a-zA-Z]{2,64}$/;
|
|
37
|
+
const PHONE_RE = /^(\+?91[-\s]?)?[6-9]\d{9}$/;
|
|
38
|
+
export const scamReportFormSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
displayName: annotate(z.string().trim().min(2, "Give the name or handle they used.").max(160), { section: "who", sectionLabel: "Who", sectionRequired: true, quick: true, order: 1, row: "full" }),
|
|
41
|
+
// Each entry is shape-checked; the SET is checked in the superRefine.
|
|
42
|
+
phones: annotate(z.array(z.string().trim().regex(PHONE_RE, "Enter a 10-digit Indian mobile number.")).max(10).optional(), { section: "who", order: 2, row: "full", kind: "list" }),
|
|
43
|
+
upiIds: annotate(z.array(z.string().trim().regex(UPI_VPA_RE, "Enter a valid UPI ID, e.g. name@bank.")).max(10).optional(), { section: "who", order: 3, row: "full", kind: "list" }),
|
|
44
|
+
emails: annotate(z.array(z.string().trim().toLowerCase().email("Enter a valid email address.")).max(10).optional(), { section: "who", order: 4, row: "full", kind: "list" }),
|
|
45
|
+
scamType: annotate(z.string().trim().min(1, "Choose what kind of scam this was."), {
|
|
46
|
+
section: "what", sectionLabel: "What happened", sectionRequired: true, quick: true, order: 1, row: "pair",
|
|
47
|
+
}),
|
|
48
|
+
scamPlatform: annotate(z.string().trim().max(120).optional(), {
|
|
49
|
+
section: "what", order: 2, row: "pair",
|
|
50
|
+
}),
|
|
51
|
+
/*
|
|
52
|
+
* Coerced and bounded. It arrives from a text input and is rendered on the
|
|
53
|
+
* public profile, so an unbounded string could publish "one MILLION crore"
|
|
54
|
+
* as a loss figure. Empty is allowed — plenty of reports are about an
|
|
55
|
+
* attempt that cost nothing.
|
|
56
|
+
*/
|
|
57
|
+
amountLost: annotate(z.coerce
|
|
58
|
+
.number({ invalid_type_error: "Enter the amount as a number." })
|
|
59
|
+
.min(0, "An amount cannot be negative.")
|
|
60
|
+
.max(100000000, "That looks like a typo.")
|
|
61
|
+
.optional(), { section: "what", order: 3, row: "pair", kind: "number" }),
|
|
62
|
+
itemInvolved: annotate(z.string().trim().max(200).optional(), {
|
|
63
|
+
section: "what", order: 4, row: "pair",
|
|
64
|
+
}),
|
|
65
|
+
description: annotate(z
|
|
66
|
+
.string()
|
|
67
|
+
.trim()
|
|
68
|
+
.min(30, "Describe what happened in at least 30 characters — this is the evidence.")
|
|
69
|
+
.max(5000, "Keep the description under 5000 characters."), { section: "what", order: 5, row: "full", kind: "textarea" }),
|
|
70
|
+
reportedByAnon: annotate(z.boolean().optional(), {
|
|
71
|
+
section: "declare", sectionLabel: "Declaration", order: 1, row: "quarter",
|
|
72
|
+
}),
|
|
73
|
+
agreed: annotate(z.literal(true, {
|
|
74
|
+
errorMap: () => ({ message: "You must confirm this report is truthful before submitting." }),
|
|
75
|
+
}), { section: "declare", order: 2, row: "full" }),
|
|
76
|
+
})
|
|
77
|
+
.superRefine((v, ctx) => {
|
|
78
|
+
const count = (v.phones?.length ?? 0) + (v.upiIds?.length ?? 0) + (v.emails?.length ?? 0);
|
|
79
|
+
if (count === 0) {
|
|
80
|
+
// Reported on `phones` so the message has a field to land on; the text
|
|
81
|
+
// names all three, because any one of them satisfies the rule.
|
|
82
|
+
ctx.addIssue({
|
|
83
|
+
code: z.ZodIssueCode.custom,
|
|
84
|
+
path: ["phones"],
|
|
85
|
+
message: "Add at least one phone number, UPI ID or email — a report with no identifier cannot be acted on.",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const sublistingCategoryFormSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
itemCode: z.ZodOptional<z.ZodString>;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string | undefined;
|
|
9
|
+
itemCode?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
itemCode?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type SublistingCategoryFormValues = z.infer<typeof sublistingCategoryFormSchema>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: Both sub-listing-category pages (`new` and `[id]/edit`) rendered
|
|
3
|
+
* `<Form>` with no schema and guarded only on `!name.trim()`. A
|
|
4
|
+
* sub-listing category groups the same real-world collectible across
|
|
5
|
+
* grades and conditions, so its `itemCode` is the identifier buyers match
|
|
6
|
+
* against — and it was unbounded free text.
|
|
7
|
+
*
|
|
8
|
+
* WHAT: One schema for both pages.
|
|
9
|
+
*
|
|
10
|
+
* `slug`/`seo` are absent: the route derives them, and the sibling route
|
|
11
|
+
* already recomputes `seo.title`/`seo.description` on rename (verified, not
|
|
12
|
+
* assumed — it is one of the RC #39 instances that turned out already fixed).
|
|
13
|
+
*
|
|
14
|
+
* EXPORTS: sublistingCategoryFormSchema, type SublistingCategoryFormValues
|
|
15
|
+
*
|
|
16
|
+
* @tag domain:store-extensions
|
|
17
|
+
* @tag layer:schema
|
|
18
|
+
* @tag pattern:none
|
|
19
|
+
* @tag access:isomorphic
|
|
20
|
+
* @tag consumers:store/sublisting-categories pages
|
|
21
|
+
* @tag sideEffects:none
|
|
22
|
+
*/
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import { annotate } from "../../shell/field-ui-meta";
|
|
25
|
+
export const sublistingCategoryFormSchema = z.object({
|
|
26
|
+
name: annotate(z.string().trim().min(2, "A name is required.").max(160), {
|
|
27
|
+
section: "basics", sectionLabel: "Sub-listing", sectionRequired: true,
|
|
28
|
+
quick: true, order: 1, row: "full",
|
|
29
|
+
}),
|
|
30
|
+
/*
|
|
31
|
+
* The catalogue identifier buyers match on — e.g. "108/120". Bounded and
|
|
32
|
+
* trimmed so it stays comparable; a stray space made two otherwise identical
|
|
33
|
+
* codes distinct.
|
|
34
|
+
*/
|
|
35
|
+
itemCode: annotate(z.string().trim().max(80, "Keep the item code under 80 characters.").optional(), {
|
|
36
|
+
section: "basics", quick: true, order: 2, row: "pair",
|
|
37
|
+
}),
|
|
38
|
+
description: annotate(z.string().trim().max(1000, "Keep the description under 1000 characters.").optional(), {
|
|
39
|
+
section: "basics", order: 3, row: "full", kind: "textarea",
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
@@ -16,6 +16,8 @@ import { apiClient } from "../../../http";
|
|
|
16
16
|
import { WHATSAPP_SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
17
17
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
18
18
|
import { buildPurchaseAnnouncementMessage } from "../helpers/whatsapp";
|
|
19
|
+
import { whatsappSettingsSchema } from "../../admin/schemas/admin-user-form";
|
|
20
|
+
import { FormErrorSummary } from "../../../ui/forms/FormErrorSummary";
|
|
19
21
|
// ---------------------------------------------------------------------------
|
|
20
22
|
// Sub-components
|
|
21
23
|
// ---------------------------------------------------------------------------
|
|
@@ -187,10 +189,10 @@ export function SellerWhatsAppSettingsView({ hasCapability }) {
|
|
|
187
189
|
? cfg?.connected === true
|
|
188
190
|
: Boolean(cfg?.[step.checkKey]);
|
|
189
191
|
return (_jsxs(Row, { gap: "sm", align: "start", children: [_jsx(Row, { textWeight: "bold", textSize: "xs", className: `flex-shrink-0 w-6 h-6 mt-0.5 ${done ? "bg-[var(--appkit-color-success)] text-white" : "bg-[var(--appkit-color-surface-elevated)] text-[var(--appkit-color-text-muted)] dark:text-[var(--appkit-color-text-faint)]"}`, align: "center", justify: "center", rounded: "full", children: done ? "✓" : step.n }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", weight: "medium", color: "primary", children: step.title }), _jsx(Text, { className: "mt-0.5", color: "muted", size: "xs", children: step.body })] })] }, step.n));
|
|
190
|
-
}) })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsxs(Row, { justify: "between", align: "center", className: "mb-4", children: [_jsx(Heading, { level: 2, size: "sm", weight: "semibold", color: "primary", children: "Connection" }), isLoading ? null : cfg?.connected ? (_jsx(Badge, { variant: "success", children: "Connected" })) : (_jsx(Badge, { variant: "default", children: "Not configured" }))] }), _jsxs(Form, { onSubmit: (e) => {
|
|
192
|
+
}) })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsxs(Row, { justify: "between", align: "center", className: "mb-4", children: [_jsx(Heading, { level: 2, size: "sm", weight: "semibold", color: "primary", children: "Connection" }), isLoading ? null : cfg?.connected ? (_jsx(Badge, { variant: "success", children: "Connected" })) : (_jsx(Badge, { variant: "default", children: "Not configured" }))] }), _jsxs(Form, { schema: whatsappSettingsSchema, onSubmit: (e) => {
|
|
191
193
|
e.preventDefault();
|
|
192
194
|
saveMutation.mutate();
|
|
193
|
-
}, spacing: "md", children: [_jsx(Input, { label: "WhatsApp Business Phone Number", value: phoneNumber, onChange: (e) => setPhoneNumber(e.target.value), placeholder: "919876543210", helperText: "Digits only, include country code (e.g. 91 for India)" }), _jsx(Input, { label: "WABA ID (WhatsApp Business Account ID)", value: wabaId, onChange: (e) => setWabaId(e.target.value), placeholder: "123456789012345", helperText: "From Meta Business Manager \u2192 WhatsApp Accounts" }), _jsx(Input, { label: "Catalog ID", value: catalogId, onChange: (e) => setCatalogId(e.target.value), placeholder: "987654321098765", helperText: "From Meta Commerce Manager \u2192 Catalogs" }), _jsx(MaskedTokenInput, { label: "System User Access Token", value: accessToken, onChange: setAccessToken, placeholder: "EAAxxxxxxxx\u2026", helperText: "Long-lived token with WhatsApp Business permissions" }), _jsx(FormActions, { align: "right", children: _jsx(Button, { type: "submit", isLoading: saveMutation.isPending, disabled: saveMutation.isPending, children: saveMutation.isPending ? "Saving…" : ACTIONS.STORE["whatsapp-connect"].label }) })] })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsx(Heading, { level: 2, className: "mb-4", color: "primary", size: "sm", weight: "semibold", children: "Catalog Sync" }), _jsxs(Row, { justify: "between", align: "center", className: "mb-4", children: [_jsxs(Div, { children: [_jsx(Text, { size: "sm", color: "muted", children: "Enable catalog sync" }), _jsx(Text, { size: "xs", color: "muted", children: "When enabled, your published standard products can be synced to WhatsApp." })] }), _jsx(Toggle, { checked: syncEnabled, onChange: setSyncEnabled, disabled: !cfg?.connected })] }), cfg?.lastCatalogSyncAt && (_jsxs(Row, { color: "muted", textSize: "xs", gap: "sm", align: "center", className: "mb-3", children: [_jsxs(Text, { children: ["Last sync: ", new Date(cfg.lastCatalogSyncAt).toLocaleString("en-IN")] }), cfg.lastSyncCount !== undefined && _jsxs(Text, { children: ["\u00B7 ", cfg.lastSyncCount, " products"] }), cfg.lastSyncStatus && (_jsx(Badge, { variant: STATUS_VARIANT[cfg.lastSyncStatus] ?? "default", children: cfg.lastSyncStatus }))] })), _jsx(Text, { className: "mb-3", color: "faint", size: "xs", children: "Only published standard products are synced. Auctions and pre-orders are excluded. Batches of up to 50 products per call." }), _jsxs(Row, { gap: "3", children: [_jsx(Button, { onClick: () => syncMutation.mutate(), isLoading: syncMutation.isPending, disabled: !cfg?.connected || !syncEnabled || syncMutation.isPending, variant: "secondary", children: syncMutation.isPending ? "Syncing…" : ACTIONS.STORE["whatsapp-catalog-sync"].label }), _jsx(Button, { onClick: () => void startImport(), isLoading: importing, disabled: !cfg?.connected || !syncEnabled || importing, variant: "secondary", children: importing ? "Importing…" : ACTIONS.STORE["whatsapp-catalog-import"].label })] }), _jsxs(Text, { className: "mt-3", color: "faint", size: "xs", children: [_jsx(Span, { weight: "bold", children: "Push" }), " sends your published standard products to WhatsApp.", " ", _jsx(Span, { weight: "bold", children: "Import" }), " creates draft products from your WhatsApp catalog. Products are matched by slug in the description field."] })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsx(Heading, { level: 2, className: "mb-2", color: "primary", size: "sm", weight: "semibold", children: "Purchase Announcement Preview" }), _jsx(Text, { className: "mb-3", color: "muted", size: "xs", children: "This message is sent automatically to your phone and the platform admin when a new order is placed." }), _jsx(Div, { textSize: "sm", className: "font-mono", color: "primary", surface: "muted", padding: "inline", rounded: "lg", children: buildPurchaseAnnouncementMessage({
|
|
195
|
+
}, spacing: "md", children: [_jsx(FormErrorSummary, {}), _jsx(Input, { label: "WhatsApp Business Phone Number", value: phoneNumber, onChange: (e) => setPhoneNumber(e.target.value), placeholder: "919876543210", helperText: "Digits only, include country code (e.g. 91 for India)" }), _jsx(Input, { label: "WABA ID (WhatsApp Business Account ID)", value: wabaId, onChange: (e) => setWabaId(e.target.value), placeholder: "123456789012345", helperText: "From Meta Business Manager \u2192 WhatsApp Accounts" }), _jsx(Input, { label: "Catalog ID", value: catalogId, onChange: (e) => setCatalogId(e.target.value), placeholder: "987654321098765", helperText: "From Meta Commerce Manager \u2192 Catalogs" }), _jsx(MaskedTokenInput, { label: "System User Access Token", value: accessToken, onChange: setAccessToken, placeholder: "EAAxxxxxxxx\u2026", helperText: "Long-lived token with WhatsApp Business permissions" }), _jsx(FormActions, { align: "right", children: _jsx(Button, { type: "submit", isLoading: saveMutation.isPending, disabled: saveMutation.isPending, children: saveMutation.isPending ? "Saving…" : ACTIONS.STORE["whatsapp-connect"].label }) })] })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsx(Heading, { level: 2, className: "mb-4", color: "primary", size: "sm", weight: "semibold", children: "Catalog Sync" }), _jsxs(Row, { justify: "between", align: "center", className: "mb-4", children: [_jsxs(Div, { children: [_jsx(Text, { size: "sm", color: "muted", children: "Enable catalog sync" }), _jsx(Text, { size: "xs", color: "muted", children: "When enabled, your published standard products can be synced to WhatsApp." })] }), _jsx(Toggle, { checked: syncEnabled, onChange: setSyncEnabled, disabled: !cfg?.connected })] }), cfg?.lastCatalogSyncAt && (_jsxs(Row, { color: "muted", textSize: "xs", gap: "sm", align: "center", className: "mb-3", children: [_jsxs(Text, { children: ["Last sync: ", new Date(cfg.lastCatalogSyncAt).toLocaleString("en-IN")] }), cfg.lastSyncCount !== undefined && _jsxs(Text, { children: ["\u00B7 ", cfg.lastSyncCount, " products"] }), cfg.lastSyncStatus && (_jsx(Badge, { variant: STATUS_VARIANT[cfg.lastSyncStatus] ?? "default", children: cfg.lastSyncStatus }))] })), _jsx(Text, { className: "mb-3", color: "faint", size: "xs", children: "Only published standard products are synced. Auctions and pre-orders are excluded. Batches of up to 50 products per call." }), _jsxs(Row, { gap: "3", children: [_jsx(Button, { onClick: () => syncMutation.mutate(), isLoading: syncMutation.isPending, disabled: !cfg?.connected || !syncEnabled || syncMutation.isPending, variant: "secondary", children: syncMutation.isPending ? "Syncing…" : ACTIONS.STORE["whatsapp-catalog-sync"].label }), _jsx(Button, { onClick: () => void startImport(), isLoading: importing, disabled: !cfg?.connected || !syncEnabled || importing, variant: "secondary", children: importing ? "Importing…" : ACTIONS.STORE["whatsapp-catalog-import"].label })] }), _jsxs(Text, { className: "mt-3", color: "faint", size: "xs", children: [_jsx(Span, { weight: "bold", children: "Push" }), " sends your published standard products to WhatsApp.", " ", _jsx(Span, { weight: "bold", children: "Import" }), " creates draft products from your WhatsApp catalog. Products are matched by slug in the description field."] })] }), _jsxs(Section, { className: CLS_SECTION_CARD, children: [_jsx(Heading, { level: 2, className: "mb-2", color: "primary", size: "sm", weight: "semibold", children: "Purchase Announcement Preview" }), _jsx(Text, { className: "mb-3", color: "muted", size: "xs", children: "This message is sent automatically to your phone and the platform admin when a new order is placed." }), _jsx(Div, { textSize: "sm", className: "font-mono", color: "primary", surface: "muted", padding: "inline", rounded: "lg", children: buildPurchaseAnnouncementMessage({
|
|
194
196
|
buyerName: "Ravi K.",
|
|
195
197
|
firstItemName: "Charizard PSA 9",
|
|
196
198
|
additionalItemCount: 2,
|
package/dist/index.d.ts
CHANGED
|
@@ -3286,3 +3286,11 @@ export type { NormalizedError, NormalizedApiError, NormalizedAppError, Normalize
|
|
|
3286
3286
|
export { CART_LANE, CART_LANE_PRIORITY, CART_LANE_LABELS, laneOf, activeLane, laneItems, laneCounts, isLaneCheckoutable, laneBlockReason, isLockedLane, canAddNewItems, type CartLane, type LaneAssignable, } from "./_internal/shared/checkout/lanes";
|
|
3287
3287
|
export { newsletterSubscribeSchema, quickCreateTaxonomySchema, payoutMarkPaidSchema, } from "./features/admin/schemas/small-forms";
|
|
3288
3288
|
export { raffleEntrySchema } from "./features/contact/schemas/inquiry-forms";
|
|
3289
|
+
export { orderCancelSchema, paymentProofSchema, } from "./features/orders/schemas/buyer-forms";
|
|
3290
|
+
export { scamReportFormSchema } from "./features/scams/schemas/report-form";
|
|
3291
|
+
export { sublistingCategoryFormSchema } from "./features/store-extensions/schemas/sublisting-category-form";
|
|
3292
|
+
export { adminAddressFormSchema, adminStoreUpdateSchema, announcementBarSchema, } from "./features/admin/schemas/admin-editor-forms";
|
|
3293
|
+
export { adminOrderUpdateSchema, employeeInviteSchema, hardBanReasonSchema, featureFlagsUpdateSchema, adminAdFormSchema, } from "./features/admin/schemas/admin-ops-forms";
|
|
3294
|
+
export { changeEmailSchema } from "./features/account/schemas/index";
|
|
3295
|
+
export { adminUserUpdateSchema, whatsappSettingsSchema, lotteryPullSchema, } from "./features/admin/schemas/admin-user-form";
|
|
3296
|
+
export { siteSettingsFormSchema } from "./features/admin/schemas/site-settings-form";
|
package/dist/index.js
CHANGED
|
@@ -5695,3 +5695,11 @@ export { normalizeError, getErrorMessage, isApiNormalized, isAppNormalized, isFi
|
|
|
5695
5695
|
export { CART_LANE, CART_LANE_PRIORITY, CART_LANE_LABELS, laneOf, activeLane, laneItems, laneCounts, isLaneCheckoutable, laneBlockReason, isLockedLane, canAddNewItems, } from "./_internal/shared/checkout/lanes";
|
|
5696
5696
|
export { newsletterSubscribeSchema, quickCreateTaxonomySchema, payoutMarkPaidSchema, } from "./features/admin/schemas/small-forms";
|
|
5697
5697
|
export { raffleEntrySchema } from "./features/contact/schemas/inquiry-forms";
|
|
5698
|
+
export { orderCancelSchema, paymentProofSchema, } from "./features/orders/schemas/buyer-forms";
|
|
5699
|
+
export { scamReportFormSchema } from "./features/scams/schemas/report-form";
|
|
5700
|
+
export { sublistingCategoryFormSchema } from "./features/store-extensions/schemas/sublisting-category-form";
|
|
5701
|
+
export { adminAddressFormSchema, adminStoreUpdateSchema, announcementBarSchema, } from "./features/admin/schemas/admin-editor-forms";
|
|
5702
|
+
export { adminOrderUpdateSchema, employeeInviteSchema, hardBanReasonSchema, featureFlagsUpdateSchema, adminAdFormSchema, } from "./features/admin/schemas/admin-ops-forms";
|
|
5703
|
+
export { changeEmailSchema } from "./features/account/schemas/index";
|
|
5704
|
+
export { adminUserUpdateSchema, whatsappSettingsSchema, lotteryPullSchema, } from "./features/admin/schemas/admin-user-form";
|
|
5705
|
+
export { siteSettingsFormSchema } from "./features/admin/schemas/site-settings-form";
|