@open-mercato/checkout 0.6.5-develop.5187.1.82e5532561 → 0.6.5-develop.5212.1.b47932beef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/checkout/__integration__/TC-UNDO-001-no-undo-affordance.spec.js +40 -0
  3. package/dist/modules/checkout/__integration__/TC-UNDO-001-no-undo-affordance.spec.js.map +7 -0
  4. package/dist/modules/checkout/__integration__/TC-UNDO-001-pay-link.spec.js +205 -0
  5. package/dist/modules/checkout/__integration__/TC-UNDO-001-pay-link.spec.js.map +7 -0
  6. package/dist/modules/checkout/__integration__/TC-UNDO-001-template.spec.js +171 -0
  7. package/dist/modules/checkout/__integration__/TC-UNDO-001-template.spec.js.map +7 -0
  8. package/dist/modules/checkout/components/LinkTemplateForm.js +30 -2
  9. package/dist/modules/checkout/components/LinkTemplateForm.js.map +2 -2
  10. package/dist/modules/checkout/lib/recordNotFound.js +20 -0
  11. package/dist/modules/checkout/lib/recordNotFound.js.map +7 -0
  12. package/package.json +5 -5
  13. package/src/modules/checkout/__integration__/TC-UNDO-001-no-undo-affordance.spec.ts +51 -0
  14. package/src/modules/checkout/__integration__/TC-UNDO-001-pay-link.spec.ts +266 -0
  15. package/src/modules/checkout/__integration__/TC-UNDO-001-template.spec.ts +228 -0
  16. package/src/modules/checkout/components/LinkTemplateForm.tsx +39 -2
  17. package/src/modules/checkout/i18n/de.json +4 -0
  18. package/src/modules/checkout/i18n/en.json +4 -0
  19. package/src/modules/checkout/i18n/es.json +4 -0
  20. package/src/modules/checkout/i18n/pl.json +4 -0
  21. package/src/modules/checkout/lib/__tests__/recordNotFound.test.ts +30 -0
  22. package/src/modules/checkout/lib/recordNotFound.ts +17 -0
@@ -245,6 +245,10 @@
245
245
  "checkout.linkTemplateForm.messages.tabs.cancel": "Cancel",
246
246
  "checkout.linkTemplateForm.messages.tabs.error": "Error",
247
247
  "checkout.linkTemplateForm.messages.tabs.success": "Success",
248
+ "checkout.linkTemplateForm.notFound.link.description": "This pay link no longer exists. It may have been deleted in another tab or by another user.",
249
+ "checkout.linkTemplateForm.notFound.link.title": "Pay link not found",
250
+ "checkout.linkTemplateForm.notFound.template.description": "This template no longer exists. It may have been deleted in another tab or by another user.",
251
+ "checkout.linkTemplateForm.notFound.template.title": "Template not found",
248
252
  "checkout.linkTemplateForm.payment.fields.gatewayProvider": "Gateway provider",
249
253
  "checkout.linkTemplateForm.payment.placeholders.provider": "Select a provider…",
250
254
  "checkout.linkTemplateForm.payment.providerUnavailableSuffix": "(zuerst in Integrations konfigurieren)",
@@ -245,6 +245,10 @@
245
245
  "checkout.linkTemplateForm.messages.tabs.cancel": "Cancel",
246
246
  "checkout.linkTemplateForm.messages.tabs.error": "Error",
247
247
  "checkout.linkTemplateForm.messages.tabs.success": "Success",
248
+ "checkout.linkTemplateForm.notFound.link.description": "This pay link no longer exists. It may have been deleted in another tab or by another user.",
249
+ "checkout.linkTemplateForm.notFound.link.title": "Pay link not found",
250
+ "checkout.linkTemplateForm.notFound.template.description": "This template no longer exists. It may have been deleted in another tab or by another user.",
251
+ "checkout.linkTemplateForm.notFound.template.title": "Template not found",
248
252
  "checkout.linkTemplateForm.payment.fields.gatewayProvider": "Gateway provider",
249
253
  "checkout.linkTemplateForm.payment.placeholders.provider": "Select a provider…",
250
254
  "checkout.linkTemplateForm.payment.providerUnavailableSuffix": "(configure in Integrations first)",
@@ -245,6 +245,10 @@
245
245
  "checkout.linkTemplateForm.messages.tabs.cancel": "Cancel",
246
246
  "checkout.linkTemplateForm.messages.tabs.error": "Error",
247
247
  "checkout.linkTemplateForm.messages.tabs.success": "Success",
248
+ "checkout.linkTemplateForm.notFound.link.description": "This pay link no longer exists. It may have been deleted in another tab or by another user.",
249
+ "checkout.linkTemplateForm.notFound.link.title": "Pay link not found",
250
+ "checkout.linkTemplateForm.notFound.template.description": "This template no longer exists. It may have been deleted in another tab or by another user.",
251
+ "checkout.linkTemplateForm.notFound.template.title": "Template not found",
248
252
  "checkout.linkTemplateForm.payment.fields.gatewayProvider": "Gateway provider",
249
253
  "checkout.linkTemplateForm.payment.placeholders.provider": "Select a provider…",
250
254
  "checkout.linkTemplateForm.payment.providerUnavailableSuffix": "(configure primero en Integrations)",
@@ -245,6 +245,10 @@
245
245
  "checkout.linkTemplateForm.messages.tabs.cancel": "Anulowanie",
246
246
  "checkout.linkTemplateForm.messages.tabs.error": "Błąd",
247
247
  "checkout.linkTemplateForm.messages.tabs.success": "Sukces",
248
+ "checkout.linkTemplateForm.notFound.link.description": "Ten link płatności już nie istnieje. Mógł zostać usunięty w innej karcie lub przez innego użytkownika.",
249
+ "checkout.linkTemplateForm.notFound.link.title": "Nie znaleziono linku płatności",
250
+ "checkout.linkTemplateForm.notFound.template.description": "Ten szablon już nie istnieje. Mógł zostać usunięty w innej karcie lub przez innego użytkownika.",
251
+ "checkout.linkTemplateForm.notFound.template.title": "Nie znaleziono szablonu",
248
252
  "checkout.linkTemplateForm.payment.fields.gatewayProvider": "Dostawca bramki",
249
253
  "checkout.linkTemplateForm.payment.placeholders.provider": "Wybierz dostawcę…",
250
254
  "checkout.linkTemplateForm.payment.providerUnavailableSuffix": "(najpierw skonfiguruj w Integracjach)",
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @jest-environment node
3
+ */
4
+
5
+ import { isRecordNotFoundError } from '../recordNotFound'
6
+
7
+ describe('isRecordNotFoundError', () => {
8
+ it('detects a 404 status on the thrown error (raiseCrudError shape)', () => {
9
+ const error = Object.assign(new Error('Template not found'), { status: 404 })
10
+ expect(isRecordNotFoundError(error)).toBe(true)
11
+ })
12
+
13
+ it('detects a 404 status nested under body/response/data', () => {
14
+ expect(isRecordNotFoundError({ body: { status: 404 } })).toBe(true)
15
+ expect(isRecordNotFoundError({ response: { status: 404 } })).toBe(true)
16
+ expect(isRecordNotFoundError({ data: { status: 404 } })).toBe(true)
17
+ })
18
+
19
+ it('returns false for optimistic-lock conflicts and other statuses', () => {
20
+ expect(isRecordNotFoundError(Object.assign(new Error('conflict'), { status: 409 }))).toBe(false)
21
+ expect(isRecordNotFoundError(Object.assign(new Error('boom'), { status: 500 }))).toBe(false)
22
+ })
23
+
24
+ it('returns false when no status is present or the value is not an object', () => {
25
+ expect(isRecordNotFoundError(new Error('network down'))).toBe(false)
26
+ expect(isRecordNotFoundError(null)).toBe(false)
27
+ expect(isRecordNotFoundError('Not found')).toBe(false)
28
+ expect(isRecordNotFoundError({ status: '404' })).toBe(false)
29
+ })
30
+ })
@@ -0,0 +1,17 @@
1
+ function readErrorStatus(error: unknown): number | null {
2
+ if (!error || typeof error !== 'object') return null
3
+ const candidate = error as Record<string, unknown>
4
+ if (typeof candidate.status === 'number') return candidate.status
5
+ for (const key of ['body', 'response', 'data']) {
6
+ const nested = candidate[key]
7
+ if (nested && typeof nested === 'object') {
8
+ const status = (nested as Record<string, unknown>).status
9
+ if (typeof status === 'number') return status
10
+ }
11
+ }
12
+ return null
13
+ }
14
+
15
+ export function isRecordNotFoundError(error: unknown): boolean {
16
+ return readErrorStatus(error) === 404
17
+ }