@open-mercato/core 0.5.1-develop.2949.009dcdd2d5 → 0.5.1-develop.2954.610bab2d08
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/helpers/integration/salesUi.js +25 -23
- package/dist/helpers/integration/salesUi.js.map +2 -2
- package/dist/modules/api_docs/frontend/docs/api/Explorer.js +24 -24
- package/dist/modules/api_docs/frontend/docs/api/Explorer.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js +15 -7
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
- package/dist/modules/attachments/fields/attachment.js +4 -6
- package/dist/modules/attachments/fields/attachment.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +63 -23
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/users/create/page.js +26 -26
- package/dist/modules/auth/backend/users/create/page.js.map +2 -2
- package/dist/modules/business_rules/components/ActionRow.js +36 -25
- package/dist/modules/business_rules/components/ActionRow.js.map +2 -2
- package/dist/modules/business_rules/components/ConditionGroup.js +14 -5
- package/dist/modules/business_rules/components/ConditionGroup.js.map +2 -2
- package/dist/modules/business_rules/components/ConditionRow.js +19 -10
- package/dist/modules/business_rules/components/ConditionRow.js.map +2 -2
- package/dist/modules/business_rules/components/RuleSetMembers.js +16 -10
- package/dist/modules/business_rules/components/RuleSetMembers.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +30 -34
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +220 -223
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +20 -19
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductUomSection.js +42 -37
- package/dist/modules/catalog/components/products/ProductUomSection.js.map +2 -2
- package/dist/modules/catalog/components/products/VariantBuilder.js +22 -18
- package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +18 -26
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +4 -6
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +5 -4
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +2 -2
- package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js +19 -7
- package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/page.js +24 -21
- package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
- package/dist/modules/customers/components/AddressEditor.js +24 -7
- package/dist/modules/customers/components/AddressEditor.js.map +2 -2
- package/dist/modules/customers/components/AddressFormatSettings.js +35 -25
- package/dist/modules/customers/components/AddressFormatSettings.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivityForm.js +20 -12
- package/dist/modules/customers/components/detail/ActivityForm.js.map +2 -2
- package/dist/modules/customers/components/detail/AnnualRevenueField.js +2 -2
- package/dist/modules/customers/components/detail/AnnualRevenueField.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +19 -14
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/formConfig.js +16 -12
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js +3 -2
- package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js +18 -10
- package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js +3 -2
- package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js +3 -2
- package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js.map +2 -2
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +27 -28
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js +14 -6
- package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js +14 -6
- package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js +3 -2
- package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js +3 -2
- package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js.map +2 -2
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js +17 -8
- package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +40 -23
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/components/IntegrationScheduleTab.js +15 -6
- package/dist/modules/data_sync/components/IntegrationScheduleTab.js.map +2 -2
- package/dist/modules/dictionaries/components/AppearanceSelector.js +4 -4
- package/dist/modules/dictionaries/components/AppearanceSelector.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js +4 -5
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +22 -14
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
- package/dist/modules/dictionaries/fields/dictionary.js +18 -13
- package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
- package/dist/modules/entities/components/EncryptionManager.js +23 -19
- package/dist/modules/entities/components/EncryptionManager.js.map +2 -2
- package/dist/modules/feature_toggles/components/formConfig.js +17 -9
- package/dist/modules/feature_toggles/components/formConfig.js.map +2 -2
- package/dist/modules/feature_toggles/components/overrideFormConfig.js +17 -9
- package/dist/modules/feature_toggles/components/overrideFormConfig.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js +15 -8
- package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js.map +2 -2
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +37 -22
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +22 -17
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +12 -6
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/dist/modules/planner/components/AvailabilityRulesEditor.js +19 -12
- package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
- package/dist/modules/resources/components/ResourceCrudForm.js +15 -10
- package/dist/modules/resources/components/ResourceCrudForm.js.map +3 -3
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +15 -18
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/components/ProviderFieldInput.js +23 -20
- package/dist/modules/sales/components/ProviderFieldInput.js.map +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js +25 -17
- package/dist/modules/sales/components/ShippingMethodsSettings.js.map +3 -3
- package/dist/modules/sales/components/channels/ChannelOfferForm.js +35 -42
- package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
- package/dist/modules/sales/components/documents/AddressesSection.js +87 -90
- package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentDialog.js +17 -6
- package/dist/modules/sales/components/documents/AdjustmentDialog.js.map +3 -3
- package/dist/modules/sales/components/documents/LineItemDialog.js +42 -25
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +96 -87
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js +20 -11
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js +20 -11
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js +36 -22
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js.map +2 -2
- package/dist/modules/staff/components/TeamMemberForm.js +14 -9
- package/dist/modules/staff/components/TeamMemberForm.js.map +3 -3
- package/dist/modules/workflows/backend/tasks/[id]/page.js +42 -21
- package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
- package/dist/modules/workflows/components/ActivitiesEditor.js +14 -6
- package/dist/modules/workflows/components/ActivitiesEditor.js.map +3 -3
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js +25 -17
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +3 -3
- package/dist/modules/workflows/components/EdgeEditDialog.js +48 -45
- package/dist/modules/workflows/components/EdgeEditDialog.js.map +2 -2
- package/dist/modules/workflows/components/NodeEditDialog.js +90 -90
- package/dist/modules/workflows/components/NodeEditDialog.js.map +2 -2
- package/dist/modules/workflows/components/StepsEditor.js +14 -6
- package/dist/modules/workflows/components/StepsEditor.js.map +3 -3
- package/dist/modules/workflows/components/TransitionsEditor.js +31 -26
- package/dist/modules/workflows/components/TransitionsEditor.js.map +3 -3
- package/dist/modules/workflows/components/fields/ActivityArrayEditor.js +19 -11
- package/dist/modules/workflows/components/fields/ActivityArrayEditor.js.map +3 -3
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +12 -14
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +24 -16
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +3 -3
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +12 -13
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileTaskForm.js +12 -8
- package/dist/modules/workflows/components/mobile/MobileTaskForm.js.map +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js +43 -46
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/package.json +3 -3
- package/src/helpers/integration/salesUi.ts +40 -30
- package/src/modules/api_docs/frontend/docs/api/Explorer.tsx +25 -19
- package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +21 -11
- package/src/modules/attachments/fields/attachment.tsx +4 -6
- package/src/modules/auth/api/users/route.ts +75 -25
- package/src/modules/auth/backend/users/create/page.tsx +16 -20
- package/src/modules/business_rules/components/ActionRow.tsx +51 -32
- package/src/modules/business_rules/components/ConditionGroup.tsx +20 -9
- package/src/modules/business_rules/components/ConditionRow.tsx +24 -15
- package/src/modules/business_rules/components/RuleSetMembers.tsx +23 -13
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +47 -53
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +84 -87
- package/src/modules/catalog/components/PriceKindSettings.tsx +9 -9
- package/src/modules/catalog/components/products/ProductUomSection.tsx +85 -83
- package/src/modules/catalog/components/products/VariantBuilder.tsx +49 -33
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +12 -27
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +4 -6
- package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +5 -4
- package/src/modules/customers/backend/config/customers/pipeline-stages/page.tsx +28 -15
- package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +37 -26
- package/src/modules/customers/components/AddressEditor.tsx +30 -16
- package/src/modules/customers/components/AddressFormatSettings.tsx +25 -19
- package/src/modules/customers/components/detail/ActivityForm.tsx +35 -23
- package/src/modules/customers/components/detail/AnnualRevenueField.tsx +2 -2
- package/src/modules/customers/components/detail/DealForm.tsx +33 -20
- package/src/modules/customers/components/formConfig.tsx +25 -17
- package/src/modules/customers/widgets/dashboard/customer-todos/widget.client.tsx +3 -2
- package/src/modules/customers/widgets/dashboard/new-customers/widget.client.tsx +21 -11
- package/src/modules/customers/widgets/dashboard/new-deals/widget.client.tsx +3 -2
- package/src/modules/customers/widgets/dashboard/next-interactions/widget.client.tsx +3 -2
- package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +17 -22
- package/src/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.tsx +17 -7
- package/src/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.tsx +20 -10
- package/src/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.tsx +3 -2
- package/src/modules/dashboards/widgets/dashboard/top-customers/widget.client.tsx +3 -2
- package/src/modules/dashboards/widgets/dashboard/top-products/widget.client.tsx +20 -9
- package/src/modules/data_sync/backend/data-sync/page.tsx +64 -38
- package/src/modules/data_sync/components/IntegrationScheduleTab.tsx +18 -7
- package/src/modules/dictionaries/components/AppearanceSelector.tsx +4 -4
- package/src/modules/dictionaries/components/DictionaryEntriesEditor.tsx +3 -4
- package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +27 -21
- package/src/modules/dictionaries/fields/dictionary.tsx +36 -23
- package/src/modules/entities/components/EncryptionManager.tsx +49 -33
- package/src/modules/feature_toggles/components/formConfig.tsx +20 -10
- package/src/modules/feature_toggles/components/overrideFormConfig.tsx +20 -10
- package/src/modules/inbox_ops/backend/inbox-ops/settings/page.tsx +19 -10
- package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +49 -26
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +20 -11
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +19 -9
- package/src/modules/planner/components/AvailabilityRulesEditor.tsx +34 -21
- package/src/modules/resources/components/ResourceCrudForm.tsx +24 -15
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +12 -15
- package/src/modules/sales/components/ProviderFieldInput.tsx +26 -17
- package/src/modules/sales/components/ShippingMethodsSettings.tsx +28 -20
- package/src/modules/sales/components/channels/ChannelOfferForm.tsx +51 -46
- package/src/modules/sales/components/documents/AddressesSection.tsx +78 -76
- package/src/modules/sales/components/documents/AdjustmentDialog.tsx +27 -15
- package/src/modules/sales/components/documents/LineItemDialog.tsx +69 -51
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +98 -87
- package/src/modules/sales/widgets/dashboard/new-orders/widget.client.tsx +23 -12
- package/src/modules/sales/widgets/dashboard/new-quotes/widget.client.tsx +23 -12
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.tsx +35 -19
- package/src/modules/staff/components/TeamMemberForm.tsx +23 -14
- package/src/modules/workflows/backend/tasks/[id]/page.tsx +51 -23
- package/src/modules/workflows/components/ActivitiesEditor.tsx +20 -10
- package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +28 -18
- package/src/modules/workflows/components/EdgeEditDialog.tsx +51 -40
- package/src/modules/workflows/components/NodeEditDialog.tsx +81 -77
- package/src/modules/workflows/components/StepsEditor.tsx +20 -10
- package/src/modules/workflows/components/TransitionsEditor.tsx +61 -44
- package/src/modules/workflows/components/fields/ActivityArrayEditor.tsx +22 -12
- package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +9 -13
- package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +27 -17
- package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +9 -12
- package/src/modules/workflows/components/mobile/MobileTaskForm.tsx +19 -11
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +71 -60
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/components/mobile/MobileTaskForm.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Checkbox } from '@open-mercato/ui/primitives/checkbox'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Separator } from '@open-mercato/ui/primitives/separator'\nimport { JsonDisplay } from '@open-mercato/ui/backend/JsonDisplay'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { UserTaskResponse, UserTaskStatus, JsonSchemaField } from '../../data/types'\n\ninterface MobileTaskFormProps {\n task: UserTaskResponse\n formData: Record<string, string | number | boolean>\n comments: string\n submitting: boolean\n isCompletable: boolean\n isOverdue: boolean | null | undefined\n onFieldChange: (fieldName: string, value: string | number | boolean) => void\n onCommentsChange: (value: string) => void\n onSubmit: (e: React.FormEvent) => void\n onCancel: () => void\n getStatusBadgeClass: (status: UserTaskStatus) => string\n}\n\nexport function MobileTaskForm({\n task,\n formData,\n comments,\n submitting,\n isCompletable,\n isOverdue,\n onFieldChange,\n onCommentsChange,\n onSubmit,\n onCancel,\n getStatusBadgeClass,\n}: MobileTaskFormProps) {\n const t = useT()\n\n const fieldValue = (fieldName: string): string | number => {\n const val = formData[fieldName]\n if (val == null || val === false) return ''\n if (typeof val === 'boolean') return ''\n return val\n }\n\n const renderFormField = (fieldName: string, fieldSchema: JsonSchemaField) => {\n const fieldType = fieldSchema.type || 'string'\n const fieldTitle = fieldSchema.title || fieldName\n const fieldDescription = fieldSchema.description\n const required = task.formSchema?.required?.includes(fieldName) || false\n const enumValues = fieldSchema.enum\n\n if (enumValues && Array.isArray(enumValues)) {\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <select\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n className=\"w-full h-11 px-3 py-2 border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring text-base\"\n >\n <option value=\"\">{t('workflows.tasks.detail.form.selectOption')}</option>\n {enumValues.map((value: string) => (\n <option key={value} value={value}>{value}</option>\n ))}\n </select>\n </div>\n )\n }\n\n switch (fieldType) {\n case 'string':\n if (fieldSchema.maxLength && fieldSchema.maxLength > 200) {\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Textarea\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n rows={4}\n className=\"text-base\"\n />\n </div>\n )\n }\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type={fieldSchema.format === 'email' ? 'email' : fieldSchema.format === 'date' ? 'date' : 'text'}\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n className=\"h-11 text-base\"\n />\n </div>\n )\n\n case 'number':\n case 'integer':\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type=\"number\"\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value ? Number(e.target.value) : '')}\n required={required}\n step={fieldType === 'integer' ? 1 : 'any'}\n className=\"h-11 text-base\"\n />\n </div>\n )\n\n case 'boolean':\n return (\n <div key={fieldName} className=\"space-y-2\">\n <div className=\"flex items-center gap-3 h-11\">\n <Checkbox\n id={fieldName}\n checked={!!formData[fieldName]}\n onCheckedChange={(checked) => onFieldChange(fieldName, !!checked)}\n />\n <Label htmlFor={fieldName} className=\"font-medium\">\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n </div>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n </div>\n )\n\n default:\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type=\"text\"\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n className=\"h-11 text-base\"\n />\n </div>\n )\n }\n }\n\n return (\n <div className=\"space-y-4 pb-4\">\n <div className=\"flex items-start justify-between gap-2\">\n <h1 className=\"text-lg font-semibold\">{task.taskName}</h1>\n <span className={`shrink-0 inline-flex items-center px-2 py-1 rounded text-xs font-medium ${getStatusBadgeClass(task.status)}`}>\n {t(`workflows.tasks.statuses.${task.status}`)}\n </span>\n </div>\n\n {task.description && (\n <p className=\"text-sm text-muted-foreground\">{task.description}</p>\n )}\n\n {isOverdue && (\n <div className=\"bg-status-error-bg border border-status-error-border rounded-lg p-3\">\n <p className=\"text-sm text-status-error-text font-medium\">{t('workflows.tasks.detail.overdueWarning')}</p>\n </div>\n )}\n\n <div className=\"rounded-lg bg-muted/50 p-3 space-y-2.5\">\n <h2 className=\"text-xs font-semibold uppercase text-muted-foreground\">{t('workflows.tasks.detail.sections.taskInfo')}</h2>\n <div className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.fields.createdAt')}:</span>\n <span className=\"text-right text-xs\">{new Date(task.createdAt).toLocaleString()}</span>\n </div>\n {task.dueDate && (\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.fields.dueDate')}:</span>\n <span className={`text-right text-xs ${isOverdue ? 'text-status-error-text font-medium' : ''}`}>\n {new Date(task.dueDate).toLocaleString()}\n </span>\n </div>\n )}\n {task.assignedTo && (\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.detail.assignedTo')}:</span>\n <span className=\"text-right\">{task.assignedTo}</span>\n </div>\n )}\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.detail.workflowInstance')}:</span>\n <Link\n href={`/backend/instances/${task.workflowInstanceId}`}\n className=\"text-primary hover:underline text-xs font-mono\"\n >\n {task.workflowInstanceId.slice(0, 8)}...\n </Link>\n </div>\n </div>\n </div>\n\n {!isCompletable && (\n <div className=\"bg-status-info-bg border border-status-info-border rounded-lg p-3\">\n <p className=\"text-sm text-status-info-text\">{t('workflows.tasks.detail.cannotComplete')}</p>\n </div>\n )}\n\n {isCompletable && (\n <form onSubmit={onSubmit} className=\"space-y-4\">\n {task.formSchema?.properties && (\n <>\n <Separator />\n <h2 className=\"text-base font-semibold\">{t('workflows.tasks.detail.sections.form')}</h2>\n <div className=\"space-y-4\">\n {Object.keys(task.formSchema!.properties!).map((fieldName) =>\n renderFormField(fieldName, task.formSchema!.properties![fieldName])\n )}\n </div>\n </>\n )}\n\n {!task.formSchema?.properties && (\n <div className=\"bg-status-info-bg border border-status-info-border rounded-lg p-3\">\n <p className=\"text-sm text-status-info-text\">{t('workflows.tasks.detail.noFormSchema')}</p>\n </div>\n )}\n\n <Separator />\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"m-comments\">\n {t('workflows.tasks.detail.comments')} ({t('workflows.tasks.detail.optional')})\n </Label>\n <Textarea\n id=\"m-comments\"\n value={comments}\n onChange={(e) => onCommentsChange(e.target.value)}\n rows={3}\n className=\"text-base\"\n placeholder={t('workflows.tasks.detail.commentsPlaceholder')}\n />\n </div>\n\n <div className=\"sticky bottom-0 border-t bg-background p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] z-10\">\n <div className=\"flex gap-3\">\n <Button\n type=\"submit\"\n disabled={submitting}\n className=\"flex-1 h-11\"\n >\n {submitting ? t('workflows.tasks.detail.submitting') : t('workflows.tasks.detail.completeTask')}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel}\n disabled={submitting}\n className=\"h-11\"\n >\n {t('common.cancel')}\n </Button>\n </div>\n </div>\n </form>\n )}\n\n {task.status === 'COMPLETED' && task.formData && (\n <>\n <Separator />\n <JsonDisplay\n data={task.formData}\n title={t('workflows.tasks.detail.sections.submittedData')}\n maxInitialDepth={2}\n />\n {task.comments && (\n <div className=\"bg-muted/50 rounded-lg p-3\">\n <p className=\"text-sm font-medium text-foreground mb-1\">{t('workflows.tasks.detail.comments')}:</p>\n <p className=\"text-sm text-muted-foreground whitespace-pre-wrap\">{task.comments}</p>\n </div>\n )}\n </>\n )}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Checkbox } from '@open-mercato/ui/primitives/checkbox'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Separator } from '@open-mercato/ui/primitives/separator'\nimport { JsonDisplay } from '@open-mercato/ui/backend/JsonDisplay'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { UserTaskResponse, UserTaskStatus, JsonSchemaField } from '../../data/types'\n\ninterface MobileTaskFormProps {\n task: UserTaskResponse\n formData: Record<string, string | number | boolean>\n comments: string\n submitting: boolean\n isCompletable: boolean\n isOverdue: boolean | null | undefined\n onFieldChange: (fieldName: string, value: string | number | boolean) => void\n onCommentsChange: (value: string) => void\n onSubmit: (e: React.FormEvent) => void\n onCancel: () => void\n getStatusBadgeClass: (status: UserTaskStatus) => string\n}\n\nexport function MobileTaskForm({\n task,\n formData,\n comments,\n submitting,\n isCompletable,\n isOverdue,\n onFieldChange,\n onCommentsChange,\n onSubmit,\n onCancel,\n getStatusBadgeClass,\n}: MobileTaskFormProps) {\n const t = useT()\n\n const fieldValue = (fieldName: string): string | number => {\n const val = formData[fieldName]\n if (val == null || val === false) return ''\n if (typeof val === 'boolean') return ''\n return val\n }\n\n const renderFormField = (fieldName: string, fieldSchema: JsonSchemaField) => {\n const fieldType = fieldSchema.type || 'string'\n const fieldTitle = fieldSchema.title || fieldName\n const fieldDescription = fieldSchema.description\n const required = task.formSchema?.required?.includes(fieldName) || false\n const enumValues = fieldSchema.enum\n\n if (enumValues && Array.isArray(enumValues)) {\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Select\n value={fieldValue(fieldName) ? String(fieldValue(fieldName)) : undefined}\n onValueChange={(value) => onFieldChange(fieldName, value ?? '')}\n >\n <SelectTrigger id={fieldName} size=\"lg\" aria-required={required}>\n <SelectValue placeholder={t('workflows.tasks.detail.form.selectOption')} />\n </SelectTrigger>\n <SelectContent>\n {enumValues.map((value: string) => (\n <SelectItem key={value} value={value}>{value}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n switch (fieldType) {\n case 'string':\n if (fieldSchema.maxLength && fieldSchema.maxLength > 200) {\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Textarea\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n rows={4}\n className=\"text-base\"\n />\n </div>\n )\n }\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type={fieldSchema.format === 'email' ? 'email' : fieldSchema.format === 'date' ? 'date' : 'text'}\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n className=\"h-11 text-base\"\n />\n </div>\n )\n\n case 'number':\n case 'integer':\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type=\"number\"\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value ? Number(e.target.value) : '')}\n required={required}\n step={fieldType === 'integer' ? 1 : 'any'}\n className=\"h-11 text-base\"\n />\n </div>\n )\n\n case 'boolean':\n return (\n <div key={fieldName} className=\"space-y-2\">\n <div className=\"flex items-center gap-3 h-11\">\n <Checkbox\n id={fieldName}\n checked={!!formData[fieldName]}\n onCheckedChange={(checked) => onFieldChange(fieldName, !!checked)}\n />\n <Label htmlFor={fieldName} className=\"font-medium\">\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n </div>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n </div>\n )\n\n default:\n return (\n <div key={fieldName} className=\"space-y-2\">\n <Label htmlFor={fieldName}>\n {fieldTitle}\n {required && <span className=\"text-status-error-text ml-1\">*</span>}\n </Label>\n {fieldDescription && <p className=\"text-xs text-muted-foreground\">{fieldDescription}</p>}\n <Input\n type=\"text\"\n id={fieldName}\n value={fieldValue(fieldName)}\n onChange={(e) => onFieldChange(fieldName, e.target.value)}\n required={required}\n className=\"h-11 text-base\"\n />\n </div>\n )\n }\n }\n\n return (\n <div className=\"space-y-4 pb-4\">\n <div className=\"flex items-start justify-between gap-2\">\n <h1 className=\"text-lg font-semibold\">{task.taskName}</h1>\n <span className={`shrink-0 inline-flex items-center px-2 py-1 rounded text-xs font-medium ${getStatusBadgeClass(task.status)}`}>\n {t(`workflows.tasks.statuses.${task.status}`)}\n </span>\n </div>\n\n {task.description && (\n <p className=\"text-sm text-muted-foreground\">{task.description}</p>\n )}\n\n {isOverdue && (\n <div className=\"bg-status-error-bg border border-status-error-border rounded-lg p-3\">\n <p className=\"text-sm text-status-error-text font-medium\">{t('workflows.tasks.detail.overdueWarning')}</p>\n </div>\n )}\n\n <div className=\"rounded-lg bg-muted/50 p-3 space-y-2.5\">\n <h2 className=\"text-xs font-semibold uppercase text-muted-foreground\">{t('workflows.tasks.detail.sections.taskInfo')}</h2>\n <div className=\"space-y-2 text-sm\">\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.fields.createdAt')}:</span>\n <span className=\"text-right text-xs\">{new Date(task.createdAt).toLocaleString()}</span>\n </div>\n {task.dueDate && (\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.fields.dueDate')}:</span>\n <span className={`text-right text-xs ${isOverdue ? 'text-status-error-text font-medium' : ''}`}>\n {new Date(task.dueDate).toLocaleString()}\n </span>\n </div>\n )}\n {task.assignedTo && (\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.detail.assignedTo')}:</span>\n <span className=\"text-right\">{task.assignedTo}</span>\n </div>\n )}\n <div className=\"flex justify-between\">\n <span className=\"text-muted-foreground\">{t('workflows.tasks.detail.workflowInstance')}:</span>\n <Link\n href={`/backend/instances/${task.workflowInstanceId}`}\n className=\"text-primary hover:underline text-xs font-mono\"\n >\n {task.workflowInstanceId.slice(0, 8)}...\n </Link>\n </div>\n </div>\n </div>\n\n {!isCompletable && (\n <div className=\"bg-status-info-bg border border-status-info-border rounded-lg p-3\">\n <p className=\"text-sm text-status-info-text\">{t('workflows.tasks.detail.cannotComplete')}</p>\n </div>\n )}\n\n {isCompletable && (\n <form onSubmit={onSubmit} className=\"space-y-4\">\n {task.formSchema?.properties && (\n <>\n <Separator />\n <h2 className=\"text-base font-semibold\">{t('workflows.tasks.detail.sections.form')}</h2>\n <div className=\"space-y-4\">\n {Object.keys(task.formSchema!.properties!).map((fieldName) =>\n renderFormField(fieldName, task.formSchema!.properties![fieldName])\n )}\n </div>\n </>\n )}\n\n {!task.formSchema?.properties && (\n <div className=\"bg-status-info-bg border border-status-info-border rounded-lg p-3\">\n <p className=\"text-sm text-status-info-text\">{t('workflows.tasks.detail.noFormSchema')}</p>\n </div>\n )}\n\n <Separator />\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"m-comments\">\n {t('workflows.tasks.detail.comments')} ({t('workflows.tasks.detail.optional')})\n </Label>\n <Textarea\n id=\"m-comments\"\n value={comments}\n onChange={(e) => onCommentsChange(e.target.value)}\n rows={3}\n className=\"text-base\"\n placeholder={t('workflows.tasks.detail.commentsPlaceholder')}\n />\n </div>\n\n <div className=\"sticky bottom-0 border-t bg-background p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] z-10\">\n <div className=\"flex gap-3\">\n <Button\n type=\"submit\"\n disabled={submitting}\n className=\"flex-1 h-11\"\n >\n {submitting ? t('workflows.tasks.detail.submitting') : t('workflows.tasks.detail.completeTask')}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel}\n disabled={submitting}\n className=\"h-11\"\n >\n {t('common.cancel')}\n </Button>\n </div>\n </div>\n </form>\n )}\n\n {task.status === 'COMPLETED' && task.formData && (\n <>\n <Separator />\n <JsonDisplay\n data={task.formData}\n title={t('workflows.tasks.detail.sections.submittedData')}\n maxInitialDepth={2}\n />\n {task.comments && (\n <div className=\"bg-muted/50 rounded-lg p-3\">\n <p className=\"text-sm font-medium text-foreground mb-1\">{t('workflows.tasks.detail.comments')}:</p>\n <p className=\"text-sm text-muted-foreground whitespace-pre-wrap\">{task.comments}</p>\n </div>\n )}\n </>\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAmEU,SAsLE,UApLa,KAFf;AAhEV,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AAiBd,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,IAAI,KAAK;AAEf,QAAM,aAAa,CAAC,cAAuC;AACzD,UAAM,MAAM,SAAS,SAAS;AAC9B,QAAI,OAAO,QAAQ,QAAQ,MAAO,QAAO;AACzC,QAAI,OAAO,QAAQ,UAAW,QAAO;AACrC,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,CAAC,WAAmB,gBAAiC;AAC3E,UAAM,YAAY,YAAY,QAAQ;AACtC,UAAM,aAAa,YAAY,SAAS;AACxC,UAAM,mBAAmB,YAAY;AACrC,UAAM,WAAW,KAAK,YAAY,UAAU,SAAS,SAAS,KAAK;AACnE,UAAM,aAAa,YAAY;AAE/B,QAAI,cAAc,MAAM,QAAQ,UAAU,GAAG;AAC3C,aACE,qBAAC,SAA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,OAAE,WAAU,qDAAqD,eAAK,UAAS;AAAA,SAClF;AAAA,OAEJ;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect, useCallback } from "react";
|
|
4
4
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
5
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
6
|
+
import {
|
|
7
|
+
Select,
|
|
8
|
+
SelectContent,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectTrigger,
|
|
11
|
+
SelectValue
|
|
12
|
+
} from "@open-mercato/ui/primitives/select";
|
|
5
13
|
import Link from "next/link";
|
|
6
14
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
7
15
|
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
@@ -548,16 +556,13 @@ function CheckoutDemoPage() {
|
|
|
548
556
|
] }),
|
|
549
557
|
fieldDescription && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: fieldDescription }),
|
|
550
558
|
/* @__PURE__ */ jsxs(
|
|
551
|
-
|
|
559
|
+
Select,
|
|
552
560
|
{
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
onChange: (e) => handleFieldChange(fieldName, e.target.value),
|
|
556
|
-
required,
|
|
557
|
-
className: inputClasses,
|
|
561
|
+
value: formData[fieldName] || void 0,
|
|
562
|
+
onValueChange: (value) => handleFieldChange(fieldName, value ?? ""),
|
|
558
563
|
children: [
|
|
559
|
-
/* @__PURE__ */ jsx(
|
|
560
|
-
enumValues.map((value) => /* @__PURE__ */ jsx(
|
|
564
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: fieldName, className: inputClasses, "aria-required": required, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("workflows.checkoutDemo.formField.selectOption", "-- Select an option --") }) }),
|
|
565
|
+
/* @__PURE__ */ jsx(SelectContent, { children: enumValues.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: value }, value)) })
|
|
561
566
|
]
|
|
562
567
|
}
|
|
563
568
|
)
|
|
@@ -573,14 +578,13 @@ function CheckoutDemoPage() {
|
|
|
573
578
|
] }),
|
|
574
579
|
fieldDescription && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: fieldDescription }),
|
|
575
580
|
/* @__PURE__ */ jsx(
|
|
576
|
-
|
|
581
|
+
Input,
|
|
577
582
|
{
|
|
578
583
|
type: "email",
|
|
579
584
|
id: fieldName,
|
|
580
585
|
value: formData[fieldName] || "",
|
|
581
586
|
onChange: (e) => handleFieldChange(fieldName, e.target.value),
|
|
582
|
-
required
|
|
583
|
-
className: inputClasses
|
|
587
|
+
required
|
|
584
588
|
}
|
|
585
589
|
)
|
|
586
590
|
] }, fieldName);
|
|
@@ -632,14 +636,13 @@ function CheckoutDemoPage() {
|
|
|
632
636
|
] }),
|
|
633
637
|
fieldDescription && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: fieldDescription }),
|
|
634
638
|
/* @__PURE__ */ jsx(
|
|
635
|
-
|
|
639
|
+
Input,
|
|
636
640
|
{
|
|
637
641
|
type: "text",
|
|
638
642
|
id: fieldName,
|
|
639
643
|
value: formData[fieldName] || "",
|
|
640
644
|
onChange: (e) => handleFieldChange(fieldName, e.target.value),
|
|
641
|
-
required
|
|
642
|
-
className: inputClasses
|
|
645
|
+
required
|
|
643
646
|
}
|
|
644
647
|
)
|
|
645
648
|
] }, fieldName);
|
|
@@ -652,15 +655,14 @@ function CheckoutDemoPage() {
|
|
|
652
655
|
] }),
|
|
653
656
|
fieldDescription && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: fieldDescription }),
|
|
654
657
|
/* @__PURE__ */ jsx(
|
|
655
|
-
|
|
658
|
+
Input,
|
|
656
659
|
{
|
|
657
660
|
type: "number",
|
|
658
661
|
id: fieldName,
|
|
659
662
|
value: formData[fieldName] || "",
|
|
660
663
|
onChange: (e) => handleFieldChange(fieldName, e.target.value ? Number(e.target.value) : ""),
|
|
661
664
|
required,
|
|
662
|
-
step: fieldType === "integer" ? 1 : "any"
|
|
663
|
-
className: inputClasses
|
|
665
|
+
step: fieldType === "integer" ? 1 : "any"
|
|
664
666
|
}
|
|
665
667
|
)
|
|
666
668
|
] }, fieldName);
|
|
@@ -692,14 +694,13 @@ function CheckoutDemoPage() {
|
|
|
692
694
|
] }),
|
|
693
695
|
fieldDescription && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: fieldDescription }),
|
|
694
696
|
/* @__PURE__ */ jsx(
|
|
695
|
-
|
|
697
|
+
Input,
|
|
696
698
|
{
|
|
697
699
|
type: "text",
|
|
698
700
|
id: fieldName,
|
|
699
701
|
value: formData[fieldName] || "",
|
|
700
702
|
onChange: (e) => handleFieldChange(fieldName, e.target.value),
|
|
701
|
-
required
|
|
702
|
-
className: inputClasses
|
|
703
|
+
required
|
|
703
704
|
}
|
|
704
705
|
)
|
|
705
706
|
] }, fieldName);
|
|
@@ -727,32 +728,31 @@ function CheckoutDemoPage() {
|
|
|
727
728
|
t("workflows.checkoutDemo.customer.loading", "Loading customers...")
|
|
728
729
|
] }) : customers.length === 0 ? /* @__PURE__ */ jsx("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm text-yellow-800", children: t("workflows.checkoutDemo.customer.noneFound", "No customers found. Please create a customer first.") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
729
730
|
/* @__PURE__ */ jsxs(
|
|
730
|
-
|
|
731
|
+
Select,
|
|
731
732
|
{
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
onChange: (e) => setSelectedCustomerId(e.target.value),
|
|
735
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring text-sm",
|
|
733
|
+
value: selectedCustomerId || void 0,
|
|
734
|
+
onValueChange: (value) => setSelectedCustomerId(value ?? ""),
|
|
736
735
|
children: [
|
|
737
|
-
/* @__PURE__ */ jsx(
|
|
738
|
-
customers.map((customer) => /* @__PURE__ */ jsx(
|
|
736
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: "customer-select", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("workflows.checkoutDemo.customer.selectPlaceholder", "-- Select a customer --") }) }),
|
|
737
|
+
/* @__PURE__ */ jsx(SelectContent, { children: customers.map((customer) => /* @__PURE__ */ jsx(SelectItem, { value: customer.id, children: customer.display_name || customer.id }, customer.id)) })
|
|
739
738
|
]
|
|
740
739
|
}
|
|
741
740
|
),
|
|
742
741
|
/* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
743
742
|
/* @__PURE__ */ jsx("label", { htmlFor: "currency-select", className: "block text-xs font-medium text-gray-600 mb-1", children: t("workflows.checkoutDemo.currency.label", "Currency") }),
|
|
744
743
|
/* @__PURE__ */ jsxs(
|
|
745
|
-
|
|
744
|
+
Select,
|
|
746
745
|
{
|
|
747
|
-
id: "currency-select",
|
|
748
746
|
value: selectedCurrency,
|
|
749
|
-
|
|
750
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring text-sm",
|
|
747
|
+
onValueChange: (value) => setSelectedCurrency(value),
|
|
751
748
|
children: [
|
|
752
|
-
/* @__PURE__ */ jsx(
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
|
|
755
|
-
|
|
749
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: "currency-select", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
750
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
751
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "USD", children: "USD - US Dollar" }),
|
|
752
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "EUR", children: "EUR - Euro" }),
|
|
753
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "GBP", children: "GBP - British Pound" }),
|
|
754
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "PLN", children: "PLN - Polish Zloty" })
|
|
755
|
+
] })
|
|
756
756
|
]
|
|
757
757
|
}
|
|
758
758
|
)
|
|
@@ -766,34 +766,31 @@ function CheckoutDemoPage() {
|
|
|
766
766
|
t("workflows.checkoutDemo.product.loading", "Loading products...")
|
|
767
767
|
] }) : products.length === 0 ? /* @__PURE__ */ jsx("div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm text-yellow-800", children: t("workflows.checkoutDemo.product.noneFound", "No products found. Please create products in the catalog first.") }) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
768
768
|
/* @__PURE__ */ jsxs(
|
|
769
|
-
|
|
769
|
+
Select,
|
|
770
770
|
{
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
const product = products.find((p) => p.id ===
|
|
771
|
+
value: void 0,
|
|
772
|
+
onValueChange: (value) => {
|
|
773
|
+
const product = products.find((p) => p.id === value);
|
|
774
774
|
if (product) {
|
|
775
775
|
addToCart({
|
|
776
776
|
id: product.id,
|
|
777
777
|
title: product.title || product.display_name || "Untitled Product",
|
|
778
778
|
pricing: product.pricing || null
|
|
779
779
|
});
|
|
780
|
-
e.target.value = "";
|
|
781
780
|
}
|
|
782
781
|
},
|
|
783
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring text-sm",
|
|
784
|
-
value: "",
|
|
785
782
|
children: [
|
|
786
|
-
/* @__PURE__ */ jsx(
|
|
787
|
-
products.map((product) => {
|
|
783
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: "product-select", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("workflows.checkoutDemo.product.selectPlaceholder", "-- Select a product to add --") }) }),
|
|
784
|
+
/* @__PURE__ */ jsx(SelectContent, { children: products.map((product) => {
|
|
788
785
|
const basePrice = product.pricing?.unit_price_gross || product.pricing?.unit_price_net || 99.99;
|
|
789
786
|
const displayPrice = (basePrice * exchangeRate).toFixed(2);
|
|
790
|
-
return /* @__PURE__ */ jsxs(
|
|
787
|
+
return /* @__PURE__ */ jsxs(SelectItem, { value: product.id, children: [
|
|
791
788
|
product.title || product.display_name || "Untitled",
|
|
792
789
|
" - ",
|
|
793
790
|
currencySymbol,
|
|
794
791
|
displayPrice
|
|
795
792
|
] }, product.id);
|
|
796
|
-
})
|
|
793
|
+
}) })
|
|
797
794
|
]
|
|
798
795
|
}
|
|
799
796
|
),
|