@open-mercato/checkout 0.10.1-develop.7874.1.67e097d23a → 0.10.1-develop.7883.1.44ac2125f5
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/.turbo/turbo-build.log +1 -1
- package/build.mjs +1 -0
- package/dist/modules/checkout/components/LinkTemplateForm.js +3 -0
- package/dist/modules/checkout/components/LinkTemplateForm.js.map +2 -2
- package/dist/modules/checkout/i18n/de.json +485 -0
- package/dist/modules/checkout/i18n/en.json +485 -0
- package/dist/modules/checkout/i18n/es.json +485 -0
- package/dist/modules/checkout/i18n/ko.json +485 -0
- package/dist/modules/checkout/i18n/pl.json +485 -0
- package/dist/modules/checkout/lib/customFieldTranslations.js +15 -0
- package/dist/modules/checkout/lib/customFieldTranslations.js.map +7 -0
- package/package.json +5 -5
- package/src/modules/checkout/components/LinkTemplateForm.tsx +3 -0
- package/src/modules/checkout/i18n/de.json +16 -0
- package/src/modules/checkout/i18n/en.json +16 -0
- package/src/modules/checkout/i18n/es.json +16 -0
- package/src/modules/checkout/i18n/ko.json +16 -0
- package/src/modules/checkout/i18n/pl.json +16 -0
- package/src/modules/checkout/lib/__tests__/customFieldTranslations.test.ts +38 -0
- package/src/modules/checkout/lib/__tests__/customFields.test.ts +41 -1
- package/src/modules/checkout/lib/customFieldTranslations.ts +16 -0
|
@@ -111,6 +111,22 @@
|
|
|
111
111
|
"checkout.common.status.inactive": "Inactive",
|
|
112
112
|
"checkout.currencySelect.errors.load": "Failed to load currencies.",
|
|
113
113
|
"checkout.currencySelect.placeholder": "Select currency",
|
|
114
|
+
"checkout.customFields.fields.delivery_timeline.description": "When the customer should expect the next step, call, or deliverable.",
|
|
115
|
+
"checkout.customFields.fields.delivery_timeline.group.title": "Before you pay",
|
|
116
|
+
"checkout.customFields.fields.delivery_timeline.label": "Delivery timeline",
|
|
117
|
+
"checkout.customFields.fields.service_deliverables.description": "Short bullet list or summary of what the customer receives after payment.",
|
|
118
|
+
"checkout.customFields.fields.service_deliverables.group.title": "What is included",
|
|
119
|
+
"checkout.customFields.fields.service_deliverables.label": "What is included",
|
|
120
|
+
"checkout.customFields.fields.session_format.description": "Customer-facing note describing how the service is delivered.",
|
|
121
|
+
"checkout.customFields.fields.session_format.group.title": "Before you pay",
|
|
122
|
+
"checkout.customFields.fields.session_format.label": "Session format",
|
|
123
|
+
"checkout.customFields.fields.support_contact.description": "Public contact detail for customer questions about this pay link.",
|
|
124
|
+
"checkout.customFields.fields.support_contact.group.title": "Support details",
|
|
125
|
+
"checkout.customFields.fields.support_contact.label": "Support contact",
|
|
126
|
+
"checkout.customFields.fieldsets.service_package.description": "Customer-facing details for consulting, services, and appointment-style links.",
|
|
127
|
+
"checkout.customFields.fieldsets.service_package.groups.details.title": "Before you pay",
|
|
128
|
+
"checkout.customFields.fieldsets.service_package.groups.summary.title": "What is included",
|
|
129
|
+
"checkout.customFields.fieldsets.service_package.label": "Service package",
|
|
114
130
|
"checkout.customerFieldsEditor.addField": "Add customer field",
|
|
115
131
|
"checkout.customerFieldsEditor.columns.actions": "Actions",
|
|
116
132
|
"checkout.customerFieldsEditor.columns.fieldKey": "Field key",
|
|
@@ -111,6 +111,22 @@
|
|
|
111
111
|
"checkout.common.status.inactive": "Inactive",
|
|
112
112
|
"checkout.currencySelect.errors.load": "Failed to load currencies.",
|
|
113
113
|
"checkout.currencySelect.placeholder": "Select currency",
|
|
114
|
+
"checkout.customFields.fields.delivery_timeline.description": "Cuándo puede esperar el cliente el siguiente paso, llamada o entrega.",
|
|
115
|
+
"checkout.customFields.fields.delivery_timeline.group.title": "Antes de pagar",
|
|
116
|
+
"checkout.customFields.fields.delivery_timeline.label": "Plazo de entrega",
|
|
117
|
+
"checkout.customFields.fields.service_deliverables.description": "Lista breve o resumen de lo que recibe el cliente después del pago.",
|
|
118
|
+
"checkout.customFields.fields.service_deliverables.group.title": "Qué incluye",
|
|
119
|
+
"checkout.customFields.fields.service_deliverables.label": "Qué incluye",
|
|
120
|
+
"checkout.customFields.fields.session_format.description": "Nota para el cliente que describe cómo se presta el servicio.",
|
|
121
|
+
"checkout.customFields.fields.session_format.group.title": "Antes de pagar",
|
|
122
|
+
"checkout.customFields.fields.session_format.label": "Formato de la sesión",
|
|
123
|
+
"checkout.customFields.fields.support_contact.description": "Datos de contacto públicos para preguntas de clientes sobre este enlace de pago.",
|
|
124
|
+
"checkout.customFields.fields.support_contact.group.title": "Información de soporte",
|
|
125
|
+
"checkout.customFields.fields.support_contact.label": "Contacto de soporte",
|
|
126
|
+
"checkout.customFields.fieldsets.service_package.description": "Información para clientes sobre consultoría, servicios y enlaces para citas.",
|
|
127
|
+
"checkout.customFields.fieldsets.service_package.groups.details.title": "Antes de pagar",
|
|
128
|
+
"checkout.customFields.fieldsets.service_package.groups.summary.title": "Qué incluye",
|
|
129
|
+
"checkout.customFields.fieldsets.service_package.label": "Paquete de servicios",
|
|
114
130
|
"checkout.customerFieldsEditor.addField": "Add customer field",
|
|
115
131
|
"checkout.customerFieldsEditor.columns.actions": "Actions",
|
|
116
132
|
"checkout.customerFieldsEditor.columns.fieldKey": "Field key",
|
|
@@ -111,6 +111,22 @@
|
|
|
111
111
|
"checkout.common.status.inactive": "비활성",
|
|
112
112
|
"checkout.currencySelect.errors.load": "통화를 불러오지 못했습니다.",
|
|
113
113
|
"checkout.currencySelect.placeholder": "통화 선택",
|
|
114
|
+
"checkout.customFields.fields.delivery_timeline.description": "고객이 다음 단계, 통화 또는 결과물을 받을 수 있는 시점입니다.",
|
|
115
|
+
"checkout.customFields.fields.delivery_timeline.group.title": "결제 전 안내",
|
|
116
|
+
"checkout.customFields.fields.delivery_timeline.label": "제공 일정",
|
|
117
|
+
"checkout.customFields.fields.service_deliverables.description": "결제 후 고객이 받게 될 항목에 대한 간단한 목록 또는 요약입니다.",
|
|
118
|
+
"checkout.customFields.fields.service_deliverables.group.title": "포함 사항",
|
|
119
|
+
"checkout.customFields.fields.service_deliverables.label": "포함 사항",
|
|
120
|
+
"checkout.customFields.fields.session_format.description": "서비스 제공 방식을 설명하는 고객 안내입니다.",
|
|
121
|
+
"checkout.customFields.fields.session_format.group.title": "결제 전 안내",
|
|
122
|
+
"checkout.customFields.fields.session_format.label": "진행 방식",
|
|
123
|
+
"checkout.customFields.fields.support_contact.description": "이 결제 링크에 대한 고객 문의를 위한 공개 연락처입니다.",
|
|
124
|
+
"checkout.customFields.fields.support_contact.group.title": "지원 안내",
|
|
125
|
+
"checkout.customFields.fields.support_contact.label": "지원 연락처",
|
|
126
|
+
"checkout.customFields.fieldsets.service_package.description": "컨설팅, 서비스 및 예약형 결제 링크에 대한 고객 안내 정보입니다.",
|
|
127
|
+
"checkout.customFields.fieldsets.service_package.groups.details.title": "결제 전 안내",
|
|
128
|
+
"checkout.customFields.fieldsets.service_package.groups.summary.title": "포함 사항",
|
|
129
|
+
"checkout.customFields.fieldsets.service_package.label": "서비스 패키지",
|
|
114
130
|
"checkout.customerFieldsEditor.addField": "고객 필드 추가",
|
|
115
131
|
"checkout.customerFieldsEditor.columns.actions": "작업",
|
|
116
132
|
"checkout.customerFieldsEditor.columns.fieldKey": "필드 키",
|
|
@@ -111,6 +111,22 @@
|
|
|
111
111
|
"checkout.common.status.inactive": "Nieaktywny",
|
|
112
112
|
"checkout.currencySelect.errors.load": "Nie udało się załadować walut.",
|
|
113
113
|
"checkout.currencySelect.placeholder": "Wybierz walutę",
|
|
114
|
+
"checkout.customFields.fields.delivery_timeline.description": "Kiedy klient może oczekiwać kolejnego kroku, rozmowy lub efektów usługi.",
|
|
115
|
+
"checkout.customFields.fields.delivery_timeline.group.title": "Przed płatnością",
|
|
116
|
+
"checkout.customFields.fields.delivery_timeline.label": "Termin realizacji",
|
|
117
|
+
"checkout.customFields.fields.service_deliverables.description": "Krótka lista lub podsumowanie tego, co klient otrzyma po płatności.",
|
|
118
|
+
"checkout.customFields.fields.service_deliverables.group.title": "Co obejmuje usługa",
|
|
119
|
+
"checkout.customFields.fields.service_deliverables.label": "Co obejmuje usługa",
|
|
120
|
+
"checkout.customFields.fields.session_format.description": "Informacja dla klienta opisująca sposób realizacji usługi.",
|
|
121
|
+
"checkout.customFields.fields.session_format.group.title": "Przed płatnością",
|
|
122
|
+
"checkout.customFields.fields.session_format.label": "Forma spotkania",
|
|
123
|
+
"checkout.customFields.fields.support_contact.description": "Publiczne dane kontaktowe do pytań klientów dotyczących tego linku płatniczego.",
|
|
124
|
+
"checkout.customFields.fields.support_contact.group.title": "Informacje o wsparciu",
|
|
125
|
+
"checkout.customFields.fields.support_contact.label": "Kontakt w sprawie pomocy",
|
|
126
|
+
"checkout.customFields.fieldsets.service_package.description": "Informacje dla klientów dotyczące konsultacji, usług i płatności za wizyty.",
|
|
127
|
+
"checkout.customFields.fieldsets.service_package.groups.details.title": "Przed płatnością",
|
|
128
|
+
"checkout.customFields.fieldsets.service_package.groups.summary.title": "Co obejmuje usługa",
|
|
129
|
+
"checkout.customFields.fieldsets.service_package.label": "Pakiet usług",
|
|
114
130
|
"checkout.customerFieldsEditor.addField": "Dodaj pole klienta",
|
|
115
131
|
"checkout.customerFieldsEditor.columns.actions": "Akcje",
|
|
116
132
|
"checkout.customerFieldsEditor.columns.fieldKey": "Klucz pola",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createTranslator } from '@open-mercato/shared/lib/i18n/translate'
|
|
2
|
+
import { createCheckoutCustomFieldTextResolver } from '../customFieldTranslations'
|
|
3
|
+
import { CHECKOUT_ENTITY_IDS } from '../constants'
|
|
4
|
+
import polishCheckout from '../../i18n/pl.json'
|
|
5
|
+
|
|
6
|
+
describe('checkout custom-field text resolver', () => {
|
|
7
|
+
const context = { entityId: CHECKOUT_ENTITY_IDS.link, path: 'fields.support_contact.label' }
|
|
8
|
+
|
|
9
|
+
it.each([CHECKOUT_ENTITY_IDS.link, CHECKOUT_ENTITY_IDS.template])('translates only opted-in seeded metadata on %s', (entityId) => {
|
|
10
|
+
const resolveText = createCheckoutCustomFieldTextResolver(createTranslator(polishCheckout))
|
|
11
|
+
expect(resolveText('Support contact', { ...context, entityId })).toBe('Kontakt w sprawie pomocy')
|
|
12
|
+
expect(resolveText('Service package', { entityId, path: 'fieldsets.service_package.label' })).toBe('Pakiet usług')
|
|
13
|
+
expect(resolveText('Before you pay', {
|
|
14
|
+
entityId, path: 'fieldsets.service_package.groups.details.title',
|
|
15
|
+
})).toBe('Przed płatnością')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('preserves unrelated entities and tenant fields even when their text matches a dictionary key', () => {
|
|
19
|
+
const translate = jest.fn(createTranslator({ ...polishCheckout, 'common.save': 'Zapisz', 'Support contact': 'Changed' }))
|
|
20
|
+
const resolveText = createCheckoutCustomFieldTextResolver(translate)
|
|
21
|
+
expect(resolveText('Support contact', { ...context, entityId: 'customers:customer_company_profile' })).toBe('Support contact')
|
|
22
|
+
expect(resolveText('Support contact', { ...context, path: 'fields.tenant_note.label' })).toBe('Support contact')
|
|
23
|
+
expect(resolveText('common.save', { ...context, path: 'fields.tenant_note.label' })).toBe('common.save')
|
|
24
|
+
expect(resolveText('Service package', { ...context, path: 'fieldsets.tenant_fields.label' })).toBe('Service package')
|
|
25
|
+
expect(translate).not.toHaveBeenCalled()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('preserves customized seed copy and falls back to stored text for missing translations', () => {
|
|
29
|
+
const translate = jest.fn(createTranslator({}))
|
|
30
|
+
const resolveText = createCheckoutCustomFieldTextResolver(translate)
|
|
31
|
+
expect(resolveText('Our support team', context)).toBe('Our support team')
|
|
32
|
+
expect(translate).not.toHaveBeenCalled()
|
|
33
|
+
expect(resolveText('Support contact', context)).toBe('Support contact')
|
|
34
|
+
expect(translate).toHaveBeenCalledWith('checkout.customFields.fields.support_contact.label', 'Support contact')
|
|
35
|
+
expect(resolveText('Our service bundle', { ...context, path: 'fieldsets.service_package.label' })).toBe('Our service bundle')
|
|
36
|
+
expect(resolveText('Our next steps', { ...context, path: 'fields.delivery_timeline.group.title' })).toBe('Our next steps')
|
|
37
|
+
})
|
|
38
|
+
})
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
loadCustomFieldDefinitionIndex,
|
|
5
5
|
} from '@open-mercato/shared/lib/crud/custom-fields'
|
|
6
6
|
import { loadEntityFieldsetConfigs } from '@open-mercato/core/modules/entities/lib/fieldsets'
|
|
7
|
-
import { resolveCheckoutPublicCustomFields } from '../customFields'
|
|
7
|
+
import { CHECKOUT_LINK_CUSTOM_FIELDS, CHECKOUT_LINK_FIELDSETS, resolveCheckoutPublicCustomFields } from '../customFields'
|
|
8
|
+
import polishCheckout from '../../i18n/pl.json'
|
|
9
|
+
import englishCheckout from '../../i18n/en.json'
|
|
8
10
|
|
|
9
11
|
jest.mock('@open-mercato/shared/lib/crud/custom-fields', () => ({
|
|
10
12
|
decorateRecordWithCustomFields: jest.fn(),
|
|
@@ -98,3 +100,41 @@ describe('resolveCheckoutPublicCustomFields', () => {
|
|
|
98
100
|
)
|
|
99
101
|
})
|
|
100
102
|
})
|
|
103
|
+
|
|
104
|
+
describe('service-package translations', () => {
|
|
105
|
+
it('translates all existing seeded service-package labels, sections and help text into Polish', () => {
|
|
106
|
+
const fieldset = CHECKOUT_LINK_FIELDSETS.find((entry) => entry.code === 'service_package')
|
|
107
|
+
expect(fieldset).toBeDefined()
|
|
108
|
+
if (!fieldset) throw new Error('[internal] Missing service-package fieldset')
|
|
109
|
+
const fields = CHECKOUT_LINK_CUSTOM_FIELDS.filter((field) =>
|
|
110
|
+
field.fieldset === 'service_package' || field.fieldsets?.includes('service_package'),
|
|
111
|
+
)
|
|
112
|
+
const entries = [
|
|
113
|
+
['fieldsets.service_package.label', fieldset.label],
|
|
114
|
+
['fieldsets.service_package.description', fieldset.description],
|
|
115
|
+
...(fieldset.groups ?? []).flatMap((group) => [
|
|
116
|
+
[`fieldsets.service_package.groups.${group.code}.title`, group.title],
|
|
117
|
+
[`fieldsets.service_package.groups.${group.code}.hint`, group.hint],
|
|
118
|
+
]),
|
|
119
|
+
...fields.flatMap((field) => [
|
|
120
|
+
[`fields.${field.key}.label`, field.label],
|
|
121
|
+
[`fields.${field.key}.description`, field.description],
|
|
122
|
+
[`fields.${field.key}.group.title`, field.group?.title],
|
|
123
|
+
[`fields.${field.key}.group.hint`, field.group?.hint],
|
|
124
|
+
]),
|
|
125
|
+
]
|
|
126
|
+
const dictionary: Record<string, string> = polishCheckout
|
|
127
|
+
const defaults: Record<string, string> = englishCheckout
|
|
128
|
+
expect(fields.map((field) => field.key)).toEqual([
|
|
129
|
+
'service_deliverables', 'delivery_timeline', 'session_format', 'support_contact',
|
|
130
|
+
])
|
|
131
|
+
for (const [path, text] of entries) {
|
|
132
|
+
if (typeof text !== 'string') continue
|
|
133
|
+
const key = `checkout.customFields.${path}`
|
|
134
|
+
expect(defaults[key]).toBe(text)
|
|
135
|
+
expect(dictionary[key]).toEqual(expect.any(String))
|
|
136
|
+
expect(dictionary[key]).not.toBe(text)
|
|
137
|
+
expect(dictionary).not.toHaveProperty(text)
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TranslateFn } from '@open-mercato/shared/lib/i18n/context'
|
|
2
|
+
import type { CrudFormProps } from '@open-mercato/ui/backend/CrudForm'
|
|
3
|
+
import englishCheckout from '../i18n/en.json'
|
|
4
|
+
import { CHECKOUT_ENTITY_IDS } from './constants'
|
|
5
|
+
|
|
6
|
+
export function createCheckoutCustomFieldTextResolver(
|
|
7
|
+
translate: TranslateFn,
|
|
8
|
+
): NonNullable<CrudFormProps<Record<string, unknown>>['resolveCustomFieldText']> {
|
|
9
|
+
return (text, { entityId, path }) => {
|
|
10
|
+
if (entityId !== CHECKOUT_ENTITY_IDS.link && entityId !== CHECKOUT_ENTITY_IDS.template) return text
|
|
11
|
+
const translationKey = `checkout.customFields.${path}`
|
|
12
|
+
const defaults: Record<string, string> = englishCheckout
|
|
13
|
+
if (!Object.prototype.hasOwnProperty.call(defaults, translationKey) || defaults[translationKey] !== text) return text
|
|
14
|
+
return translate(translationKey, text)
|
|
15
|
+
}
|
|
16
|
+
}
|