@lookiero/checkout 14.3.0 → 14.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/fake-dependencies/@lookiero/payments-front/index.js +1 -1
  2. package/dist/src/ExpoRoot.js +2 -2
  3. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +3 -2
  4. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +28 -1
  5. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +1 -1
  6. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -1
  7. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +3 -4
  8. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +0 -3
  9. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +0 -3
  10. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -5
  11. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +1 -2
  12. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -3
  13. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -3
  14. package/dist/src/projection/pricing/pricing.d.ts +25 -1
  15. package/dist/src/projection/pricing/pricing.js +12 -1
  16. package/dist/src/version.d.ts +2 -2
  17. package/dist/src/version.js +2 -2
  18. package/fake-dependencies/@lookiero/payments-front/index.tsx +1 -1
  19. package/package.json +6 -4
  20. package/src/ExpoRoot.tsx +2 -2
  21. package/src/domain/checkout/model/checkouts.ts +6 -4
  22. package/src/domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem.ts +1 -2
  23. package/src/domain/checkoutBooking/event/createToastNotificationWhenCheckoutBookingExpired.ts +1 -2
  24. package/src/domain/checkoutBooking/model/checkoutBookings.ts +6 -4
  25. package/src/domain/checkoutFeedback/model/checkoutFeedbacks.ts +6 -4
  26. package/src/domain/checkoutItem/event/createModalNotificationWhenCheckoutItemReplaced.ts +1 -2
  27. package/src/domain/checkoutItem/model/checkoutItems.ts +6 -4
  28. package/src/infrastructure/delivery/mock/dataSourceCheckoutBookings.ts +1 -2
  29. package/src/infrastructure/delivery/mock/dataSourceCheckoutFeedbacks.ts +1 -2
  30. package/src/infrastructure/delivery/mock/dataSourceCheckoutItems.ts +1 -2
  31. package/src/infrastructure/domain/checkout/react/useStartCheckout.test.ts +1 -5
  32. package/src/infrastructure/domain/checkout/react/useSubmitCheckout.test.ts +1 -5
  33. package/src/infrastructure/domain/checkoutFeedback/model/httpCheckoutFeedbacks.ts +1 -2
  34. package/src/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.test.ts +1 -5
  35. package/src/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.test.ts +1 -5
  36. package/src/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.test.ts +1 -5
  37. package/src/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.test.ts +1 -5
  38. package/src/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.test.ts +1 -5
  39. package/src/infrastructure/projection/pricing/pricing.mock.ts +34 -2
  40. package/src/infrastructure/tracking/tracking.ts +4 -2
  41. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +1 -1
  42. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +1 -1
  43. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +0 -3
  44. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +3 -4
  45. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +102 -144
  46. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +8 -9
  47. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +102 -233
  48. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +1 -2
  49. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +30 -69
  50. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +2 -3
  51. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -3
  52. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +62 -144
  53. package/src/projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem.ts +2 -1
  54. package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +1 -2
  55. package/src/projection/checkout/viewFiveItemsDiscountByCustomerId.ts +1 -2
  56. package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +1 -2
  57. package/src/projection/checkout/viewIsSizeChangeEnabledByCheckoutId.ts +1 -2
  58. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +2 -1
  59. package/src/projection/payment/viewPaymentFlowPayloadByCheckoutId.ts +1 -2
  60. package/src/projection/pricing/pricing.ts +29 -1
  61. package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.ts +1 -2
@@ -1,5 +1,10 @@
1
1
  import { Currency } from "@lookiero/sty-psp-locale";
2
- import { PricingProjection } from "../../../projection/pricing/pricing";
2
+ import {
3
+ CheckoutPricingProjection,
4
+ CheckoutPrincingContext,
5
+ CheckoutPrincingType,
6
+ PricingProjection,
7
+ } from "../../../projection/pricing/pricing";
3
8
 
4
9
  interface PricingFunctionArgs {
5
10
  readonly paidWithPromocode: boolean;
@@ -50,4 +55,31 @@ const pricing: PricingFunction = ({ paidWithPromocode } = { paidWithPromocode: f
50
55
  },
51
56
  });
52
57
 
53
- export { pricing };
58
+ const mockCheckoutPricingProjection: CheckoutPricingProjection = {
59
+ currency: Currency.EUR,
60
+ final: 12127,
61
+ original: 21195,
62
+ modifiers: [
63
+ {
64
+ amount: 7068,
65
+ percentage: 35,
66
+ type: CheckoutPrincingType.DISCOUNT,
67
+ context: CheckoutPrincingContext.PROMOCODE,
68
+ translationKey: "summary.discount",
69
+ },
70
+ {
71
+ amount: 1000,
72
+ type: CheckoutPrincingType.DISCOUNT,
73
+ context: CheckoutPrincingContext.BALANCE,
74
+ translationKey: "summary.credit",
75
+ },
76
+ {
77
+ amount: 1000,
78
+ type: CheckoutPrincingType.DISCOUNT,
79
+ context: CheckoutPrincingContext.PS_FEE,
80
+ translationKey: "summary.fee",
81
+ },
82
+ ],
83
+ };
84
+
85
+ export { pricing, mockCheckoutPricingProjection };
@@ -110,8 +110,10 @@ interface PressPreviousTrackingEvent extends CheckoutBaseTrackingEvent<TrackingE
110
110
  readonly to: string;
111
111
  }
112
112
 
113
- interface CheckoutTrackingEvent
114
- extends CheckoutBaseTrackingEvent<TrackingEventName.CHECKOUT, TrackingEventCategory.ECOMMERCE> {
113
+ interface CheckoutTrackingEvent extends CheckoutBaseTrackingEvent<
114
+ TrackingEventName.CHECKOUT,
115
+ TrackingEventCategory.ECOMMERCE
116
+ > {
115
117
  readonly userId: string;
116
118
  readonly sizeChanges: number;
117
119
  // readonly isFirstOrder: boolean;
@@ -128,7 +128,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({ checkout: checkoutProjection
128
128
  setStartLegacyBoxCheckoutStatus("error");
129
129
 
130
130
  createNotification({
131
- bodyI18nKey: payload.metadata?.toaster?.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
131
+ bodyI18nKey: payload.metadata?.translation || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
132
132
  level: NotificationLevel.ERROR,
133
133
  });
134
134
  },
@@ -1,7 +1,7 @@
1
1
  import React, { FC, useCallback, useMemo } from "react";
2
2
  import { View } from "react-native";
3
- import { Button } from "@lookiero/aurora";
4
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
+ import { Button } from "@lookiero/sty-psp-ui";
5
5
  import {
6
6
  CheckoutFeedbackProjection,
7
7
  CheckoutFeedbackQuestionProjection,
@@ -5,9 +5,6 @@ const style = () => {
5
5
  const { space6, space8 } = theme();
6
6
 
7
7
  return StyleSheet.create({
8
- button: {
9
- flex: 0,
10
- },
11
8
  buttonText: {
12
9
  textAlign: "center",
13
10
  width: "100%",
@@ -1,8 +1,7 @@
1
1
  import React, { FC, useMemo } from "react";
2
2
  import { View } from "react-native";
3
- import { Button, BUTTON_VARIANT } from "@lookiero/aurora";
4
3
  import { useI18nMessage } from "@lookiero/i18n-react";
5
- import { Modal, Text } from "@lookiero/sty-psp-ui";
4
+ import { Button, Modal, Text } from "@lookiero/sty-psp-ui";
6
5
  import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
7
6
  import { style as getOutOfCheckoutModalStyle } from "./GetOutOfCheckoutModal.style";
8
7
 
@@ -34,7 +33,7 @@ const GetOutOfCheckoutModal: FC<GetOutOfCheckoutModalProps> = ({ visible, onDism
34
33
  <Text level={3} style={style.description}>
35
34
  {descriptionText}
36
35
  </Text>
37
- <Button style={style.button} onPress={onDismiss}>
36
+ <Button onPress={onDismiss}>
38
37
  <Text
39
38
  level={3}
40
39
  selectable={false}
@@ -44,7 +43,7 @@ const GetOutOfCheckoutModal: FC<GetOutOfCheckoutModalProps> = ({ visible, onDism
44
43
  {dismissButtonText}
45
44
  </Text>
46
45
  </Button>
47
- <Button style={[style.button, style.confirmButton]} variant={BUTTON_VARIANT.SECONDARY} onPress={onConfirm}>
46
+ <Button style={{ button: style.confirmButton }} variant="secondary" onPress={onConfirm}>
48
47
  <Text
49
48
  level={3}
50
49
  selectable={false}
@@ -215,7 +215,6 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
215
215
  get_out_of_checkout_modal.description
216
216
  </Text>
217
217
  <View
218
- accessibilityRole="button"
219
218
  accessibilityState={
220
219
  {
221
220
  "busy": undefined,
@@ -236,9 +235,7 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
236
235
  accessible={true}
237
236
  collapsable={false}
238
237
  focusable={true}
239
- onBlur={[Function]}
240
238
  onClick={[Function]}
241
- onFocus={[Function]}
242
239
  onLayout={[Function]}
243
240
  onResponderGrant={[Function]}
244
241
  onResponderMove={[Function]}
@@ -247,38 +244,10 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
247
244
  onResponderTerminationRequest={[Function]}
248
245
  onStartShouldSetResponder={[Function]}
249
246
  style={
250
- [
251
- [
252
- {
253
- "_container": {
254
- "overflow": "hidden",
255
- },
256
- "_pressed": {
257
- "bottom": 0,
258
- "left": 0,
259
- "right": 0,
260
- "top": 0,
261
- },
262
- "alignSelf": "flex-start",
263
- "container": {
264
- "overflow": "hidden",
265
- },
266
- "flex": 0,
267
- "height": 64,
268
- "overflow": "hidden",
269
- "pressed": {
270
- "bottom": 0,
271
- "left": 0,
272
- "right": 0,
273
- "top": 0,
274
- },
275
- "width": "100%",
276
- },
277
- ],
278
- {
279
- "opacity": 1,
280
- },
281
- ]
247
+ {
248
+ "height": 64,
249
+ "opacity": 1,
250
+ }
282
251
  }
283
252
  >
284
253
  <ViewManagerAdapter_ExpoLinearGradient
@@ -301,28 +270,19 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
301
270
  ]
302
271
  }
303
272
  style={
304
- [
305
- {
306
- "alignContent": "center",
307
- "height": 64,
308
- "justifyContent": "center",
309
- "overflow": "hidden",
310
- "paddingLeft": 24,
311
- "paddingRight": 24,
312
- "position": "relative",
313
- },
314
- {},
315
- undefined,
316
- undefined,
317
- false,
318
- {
319
- "borderRadius": 9999,
320
- },
321
- ]
273
+ {
274
+ "alignContent": "center",
275
+ "borderRadius": 9999,
276
+ "height": 64,
277
+ "justifyContent": "center",
278
+ "overflow": "hidden",
279
+ "paddingLeft": 24,
280
+ "paddingRight": 24,
281
+ "position": "relative",
282
+ }
322
283
  }
323
284
  >
324
285
  <View
325
- collapsable={false}
326
286
  pointerEvents="none"
327
287
  style={
328
288
  [
@@ -335,24 +295,21 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
335
295
  "top": 0,
336
296
  },
337
297
  {
338
- "width": "0%",
298
+ "width": 0,
339
299
  },
340
300
  ]
341
301
  }
342
302
  />
343
303
  <View
344
304
  style={
345
- [
346
- {
347
- "alignItems": "center",
348
- "flexDirection": "row",
349
- "justifyContent": "center",
350
- },
351
- ]
305
+ {
306
+ "alignItems": "center",
307
+ "flexDirection": "row",
308
+ "justifyContent": "center",
309
+ }
352
310
  }
353
311
  >
354
312
  <Text
355
- selectable={false}
356
313
  style={
357
314
  [
358
315
  {
@@ -366,23 +323,46 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
366
323
  },
367
324
  [
368
325
  {
326
+ "color": "#FFFFFF",
369
327
  "textAlign": "center",
370
- "width": "100%",
371
- },
372
- {
373
- "textTransform": "uppercase",
374
328
  },
329
+ undefined,
375
330
  ],
376
331
  ]
377
332
  }
378
333
  >
379
- get_out_of_checkout_modal.dismiss_button
334
+ <Text
335
+ selectable={false}
336
+ style={
337
+ [
338
+ {
339
+ "color": "#0C0A0A",
340
+ "fontFamily": "AreaNormal-Extrabold",
341
+ "fontSize": 15,
342
+ "fontStyle": "normal",
343
+ "fontWeight": "normal",
344
+ "letterSpacing": -0.2,
345
+ "lineHeight": 20,
346
+ },
347
+ [
348
+ {
349
+ "textAlign": "center",
350
+ "width": "100%",
351
+ },
352
+ {
353
+ "textTransform": "uppercase",
354
+ },
355
+ ],
356
+ ]
357
+ }
358
+ >
359
+ get_out_of_checkout_modal.dismiss_button
360
+ </Text>
380
361
  </Text>
381
362
  </View>
382
363
  </ViewManagerAdapter_ExpoLinearGradient>
383
364
  </View>
384
365
  <View
385
- accessibilityRole="button"
386
366
  accessibilityState={
387
367
  {
388
368
  "busy": undefined,
@@ -403,9 +383,7 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
403
383
  accessible={true}
404
384
  collapsable={false}
405
385
  focusable={true}
406
- onBlur={[Function]}
407
386
  onClick={[Function]}
408
- onFocus={[Function]}
409
387
  onLayout={[Function]}
410
388
  onResponderGrant={[Function]}
411
389
  onResponderMove={[Function]}
@@ -414,39 +392,11 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
414
392
  onResponderTerminationRequest={[Function]}
415
393
  onStartShouldSetResponder={[Function]}
416
394
  style={
417
- [
418
- [
419
- {
420
- "_container": {
421
- "overflow": "hidden",
422
- },
423
- "_pressed": {
424
- "bottom": 0,
425
- "left": 0,
426
- "right": 0,
427
- "top": 0,
428
- },
429
- "alignSelf": "flex-start",
430
- "container": {
431
- "overflow": "hidden",
432
- },
433
- "flex": 0,
434
- "height": 64,
435
- "marginTop": 32,
436
- "overflow": "hidden",
437
- "pressed": {
438
- "bottom": 0,
439
- "left": 0,
440
- "right": 0,
441
- "top": 0,
442
- },
443
- "width": "100%",
444
- },
445
- ],
446
- {
447
- "opacity": 1,
448
- },
449
- ]
395
+ {
396
+ "height": 64,
397
+ "marginTop": 32,
398
+ "opacity": 1,
399
+ }
450
400
  }
451
401
  >
452
402
  <ViewManagerAdapter_ExpoLinearGradient
@@ -469,35 +419,22 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
469
419
  ]
470
420
  }
471
421
  style={
472
- [
473
- {
474
- "alignContent": "center",
475
- "height": 64,
476
- "justifyContent": "center",
477
- "overflow": "hidden",
478
- "paddingLeft": 24,
479
- "paddingRight": 24,
480
- "position": "relative",
481
- },
482
- {
483
- "borderColor": "#0C0A0A",
484
- "borderStyle": "solid",
485
- "borderWidth": 2,
486
- "height": 64,
487
- "paddingLeft": 24,
488
- "paddingRight": 24,
489
- },
490
- undefined,
491
- undefined,
492
- false,
493
- {
494
- "borderRadius": 9999,
495
- },
496
- ]
422
+ {
423
+ "alignContent": "center",
424
+ "borderColor": "#0C0A0A",
425
+ "borderRadius": 9999,
426
+ "borderStyle": "solid",
427
+ "borderWidth": 2,
428
+ "height": 64,
429
+ "justifyContent": "center",
430
+ "overflow": "hidden",
431
+ "paddingLeft": 24,
432
+ "paddingRight": 24,
433
+ "position": "relative",
434
+ }
497
435
  }
498
436
  >
499
437
  <View
500
- collapsable={false}
501
438
  pointerEvents="none"
502
439
  style={
503
440
  [
@@ -510,24 +447,21 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
510
447
  "top": 0,
511
448
  },
512
449
  {
513
- "width": "0%",
450
+ "width": 0,
514
451
  },
515
452
  ]
516
453
  }
517
454
  />
518
455
  <View
519
456
  style={
520
- [
521
- {
522
- "alignItems": "center",
523
- "flexDirection": "row",
524
- "justifyContent": "center",
525
- },
526
- ]
457
+ {
458
+ "alignItems": "center",
459
+ "flexDirection": "row",
460
+ "justifyContent": "center",
461
+ }
527
462
  }
528
463
  >
529
464
  <Text
530
- selectable={false}
531
465
  style={
532
466
  [
533
467
  {
@@ -541,17 +475,41 @@ exports[`GetOutOfCheckoutModal component matches the snapshot 1`] = `
541
475
  },
542
476
  [
543
477
  {
478
+ "color": "#0C0C0A",
544
479
  "textAlign": "center",
545
- "width": "100%",
546
- },
547
- {
548
- "textTransform": "uppercase",
549
480
  },
481
+ undefined,
550
482
  ],
551
483
  ]
552
484
  }
553
485
  >
554
- get_out_of_checkout_modal.confirm_button
486
+ <Text
487
+ selectable={false}
488
+ style={
489
+ [
490
+ {
491
+ "color": "#0C0A0A",
492
+ "fontFamily": "AreaNormal-Extrabold",
493
+ "fontSize": 15,
494
+ "fontStyle": "normal",
495
+ "fontWeight": "normal",
496
+ "letterSpacing": -0.2,
497
+ "lineHeight": 20,
498
+ },
499
+ [
500
+ {
501
+ "textAlign": "center",
502
+ "width": "100%",
503
+ },
504
+ {
505
+ "textTransform": "uppercase",
506
+ },
507
+ ],
508
+ ]
509
+ }
510
+ >
511
+ get_out_of_checkout_modal.confirm_button
512
+ </Text>
555
513
  </Text>
556
514
  </View>
557
515
  </ViewManagerAdapter_ExpoLinearGradient>
@@ -1,9 +1,8 @@
1
1
  import React, { FC, useCallback, useMemo, useState } from "react";
2
2
  import { LayoutRectangle, View } from "react-native";
3
- import { Button, BUTTON_VARIANT } from "@lookiero/aurora";
4
3
  import { useI18nMessage } from "@lookiero/i18n-react";
5
4
  import { Country } from "@lookiero/sty-psp-locale";
6
- import { Sticky } from "@lookiero/sty-psp-ui";
5
+ import { Button, Sticky } from "@lookiero/sty-psp-ui";
7
6
  import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
8
7
  import { size } from "../../../../../../projection/size/size";
9
8
  import { Body } from "../../../../components/layouts/body/Body";
@@ -70,10 +69,10 @@ const ItemActions: FC<ItemActionsProps> = ({
70
69
  <View style={style.actionsRow}>
71
70
  {!currentProductVariant.size.unique && productVariants ? (
72
71
  <Button
73
- style={style.sizeSelector}
72
+ size="small"
73
+ style={{ button: style.sizeSelector }}
74
74
  testID="size-selector"
75
- variant={BUTTON_VARIANT.SECONDARY}
76
- small
75
+ variant="secondary"
77
76
  onPress={handleOnPressSelectField}
78
77
  >
79
78
  {changeSizeButtonText}
@@ -81,17 +80,17 @@ const ItemActions: FC<ItemActionsProps> = ({
81
80
  ) : null}
82
81
 
83
82
  <Button
84
- style={style.returnButton}
83
+ size="small"
84
+ style={{ button: style.returnButton }}
85
85
  testID="return-button"
86
- variant={BUTTON_VARIANT.SECONDARY}
87
- small
86
+ variant="secondary"
88
87
  onPress={onReturn}
89
88
  >
90
89
  {returnButtonText}
91
90
  </Button>
92
91
  </View>
93
92
 
94
- <Button testID="keep-button" small onPress={onKeep}>
93
+ <Button size="small" testID="keep-button" onPress={onKeep}>
95
94
  {keepButtonText}
96
95
  </Button>
97
96
  </Body>