@aws-amplify/ui-react-native 0.0.0-in-app-messaging-20220826014803
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/.eslintrc.js +100 -0
- package/.lintstagedrc.js +6 -0
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +11 -0
- package/LICENSE +201 -0
- package/README.md +25 -0
- package/babel.config.js +3 -0
- package/dist/InAppMessaging/components/BannerMessage/BannerMessage.d.ts +3 -0
- package/dist/InAppMessaging/components/BannerMessage/BannerMessage.js +16 -0
- package/dist/InAppMessaging/components/BannerMessage/index.d.ts +2 -0
- package/dist/InAppMessaging/components/BannerMessage/index.js +1 -0
- package/dist/InAppMessaging/components/BannerMessage/styles.d.ts +7 -0
- package/dist/InAppMessaging/components/BannerMessage/styles.js +77 -0
- package/dist/InAppMessaging/components/BannerMessage/types.d.ts +12 -0
- package/dist/InAppMessaging/components/BannerMessage/types.js +1 -0
- package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.d.ts +3 -0
- package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.js +20 -0
- package/dist/InAppMessaging/components/CarouselMessage/CarouselMessageItem.d.ts +3 -0
- package/dist/InAppMessaging/components/CarouselMessage/CarouselMessageItem.js +18 -0
- package/dist/InAppMessaging/components/CarouselMessage/index.d.ts +2 -0
- package/dist/InAppMessaging/components/CarouselMessage/index.js +1 -0
- package/dist/InAppMessaging/components/CarouselMessage/styles.d.ts +5 -0
- package/dist/InAppMessaging/components/CarouselMessage/styles.js +98 -0
- package/dist/InAppMessaging/components/CarouselMessage/types.d.ts +18 -0
- package/dist/InAppMessaging/components/CarouselMessage/types.js +1 -0
- package/dist/InAppMessaging/components/FullScreenMessage/FullScreenMessage.d.ts +3 -0
- package/dist/InAppMessaging/components/FullScreenMessage/FullScreenMessage.js +18 -0
- package/dist/InAppMessaging/components/FullScreenMessage/index.d.ts +2 -0
- package/dist/InAppMessaging/components/FullScreenMessage/index.js +1 -0
- package/dist/InAppMessaging/components/FullScreenMessage/styles.d.ts +3 -0
- package/dist/InAppMessaging/components/FullScreenMessage/styles.js +86 -0
- package/dist/InAppMessaging/components/FullScreenMessage/types.d.ts +6 -0
- package/dist/InAppMessaging/components/FullScreenMessage/types.js +1 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.d.ts +10 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.js +29 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.d.ts +3 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +24 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/index.d.ts +2 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/index.js +1 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/types.d.ts +24 -0
- package/dist/InAppMessaging/components/InAppMessageDisplay/types.js +1 -0
- package/dist/InAppMessaging/components/MessageLayout/MessageLayout.d.ts +3 -0
- package/dist/InAppMessaging/components/MessageLayout/MessageLayout.js +34 -0
- package/dist/InAppMessaging/components/MessageLayout/index.d.ts +1 -0
- package/dist/InAppMessaging/components/MessageLayout/index.js +1 -0
- package/dist/InAppMessaging/components/MessageLayout/types.d.ts +7 -0
- package/dist/InAppMessaging/components/MessageLayout/types.js +1 -0
- package/dist/InAppMessaging/components/MessageWrapper/MessageWrapper.d.ts +3 -0
- package/dist/InAppMessaging/components/MessageWrapper/MessageWrapper.js +20 -0
- package/dist/InAppMessaging/components/MessageWrapper/index.d.ts +2 -0
- package/dist/InAppMessaging/components/MessageWrapper/index.js +1 -0
- package/dist/InAppMessaging/components/MessageWrapper/styles.d.ts +2 -0
- package/dist/InAppMessaging/components/MessageWrapper/styles.js +5 -0
- package/dist/InAppMessaging/components/MessageWrapper/types.d.ts +10 -0
- package/dist/InAppMessaging/components/MessageWrapper/types.js +1 -0
- package/dist/InAppMessaging/components/ModalMessage/ModalMessage.d.ts +3 -0
- package/dist/InAppMessaging/components/ModalMessage/ModalMessage.js +18 -0
- package/dist/InAppMessaging/components/ModalMessage/index.d.ts +2 -0
- package/dist/InAppMessaging/components/ModalMessage/index.js +1 -0
- package/dist/InAppMessaging/components/ModalMessage/styles.d.ts +4 -0
- package/dist/InAppMessaging/components/ModalMessage/styles.js +99 -0
- package/dist/InAppMessaging/components/ModalMessage/types.d.ts +6 -0
- package/dist/InAppMessaging/components/ModalMessage/types.js +1 -0
- package/dist/InAppMessaging/components/index.d.ts +6 -0
- package/dist/InAppMessaging/components/index.js +2 -0
- package/dist/InAppMessaging/components/withInAppMessaging/index.d.ts +1 -0
- package/dist/InAppMessaging/components/withInAppMessaging/index.js +1 -0
- package/dist/InAppMessaging/components/withInAppMessaging/withInAppMessaging.d.ts +5 -0
- package/dist/InAppMessaging/components/withInAppMessaging/withInAppMessaging.js +11 -0
- package/dist/InAppMessaging/constants.d.ts +31 -0
- package/dist/InAppMessaging/constants.js +43 -0
- package/dist/InAppMessaging/hooks/index.d.ts +2 -0
- package/dist/InAppMessaging/hooks/index.js +2 -0
- package/dist/InAppMessaging/hooks/useMessageImage/constants.d.ts +8 -0
- package/dist/InAppMessaging/hooks/useMessageImage/constants.js +18 -0
- package/dist/InAppMessaging/hooks/useMessageImage/index.d.ts +2 -0
- package/dist/InAppMessaging/hooks/useMessageImage/index.js +1 -0
- package/dist/InAppMessaging/hooks/useMessageImage/types.d.ts +15 -0
- package/dist/InAppMessaging/hooks/useMessageImage/types.js +6 -0
- package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +10 -0
- package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.js +50 -0
- package/dist/InAppMessaging/hooks/useMessageImage/utils.d.ts +4 -0
- package/dist/InAppMessaging/hooks/useMessageImage/utils.js +56 -0
- package/dist/InAppMessaging/hooks/useMessageProps/index.d.ts +2 -0
- package/dist/InAppMessaging/hooks/useMessageProps/index.js +1 -0
- package/dist/InAppMessaging/hooks/useMessageProps/types.d.ts +109 -0
- package/dist/InAppMessaging/hooks/useMessageProps/types.js +1 -0
- package/dist/InAppMessaging/hooks/useMessageProps/useMessageProps.d.ts +12 -0
- package/dist/InAppMessaging/hooks/useMessageProps/useMessageProps.js +49 -0
- package/dist/InAppMessaging/hooks/useMessageProps/utils.d.ts +43 -0
- package/dist/InAppMessaging/hooks/useMessageProps/utils.js +192 -0
- package/dist/InAppMessaging/index.d.ts +2 -0
- package/dist/InAppMessaging/index.js +2 -0
- package/dist/__mocks__/react-native-safe-area-context.d.ts +3 -0
- package/dist/__mocks__/react-native-safe-area-context.js +4 -0
- package/dist/assets/close.png +0 -0
- package/dist/assets/index.d.ts +5 -0
- package/dist/assets/index.js +4 -0
- package/dist/assets/index.ts +7 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDeviceOrientation/index.d.ts +1 -0
- package/dist/hooks/useDeviceOrientation/index.js +1 -0
- package/dist/hooks/useDeviceOrientation/useDeviceOrientation.d.ts +6 -0
- package/dist/hooks/useDeviceOrientation/useDeviceOrientation.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/primitives/Button/Button.d.ts +3 -0
- package/dist/primitives/Button/Button.js +8 -0
- package/dist/primitives/Button/index.d.ts +2 -0
- package/dist/primitives/Button/index.js +1 -0
- package/dist/primitives/Button/styles.d.ts +2 -0
- package/dist/primitives/Button/styles.js +4 -0
- package/dist/primitives/Button/types.d.ts +7 -0
- package/dist/primitives/Button/types.js +1 -0
- package/dist/primitives/Carousel/Carousel.d.ts +3 -0
- package/dist/primitives/Carousel/Carousel.js +58 -0
- package/dist/primitives/Carousel/CarouselPageIndicator.d.ts +3 -0
- package/dist/primitives/Carousel/CarouselPageIndicator.js +10 -0
- package/dist/primitives/Carousel/constants.d.ts +9 -0
- package/dist/primitives/Carousel/constants.js +18 -0
- package/dist/primitives/Carousel/index.d.ts +3 -0
- package/dist/primitives/Carousel/index.js +2 -0
- package/dist/primitives/Carousel/styles.d.ts +2 -0
- package/dist/primitives/Carousel/styles.js +11 -0
- package/dist/primitives/Carousel/types.d.ts +19 -0
- package/dist/primitives/Carousel/types.js +1 -0
- package/dist/primitives/IconButton/IconButton.d.ts +3 -0
- package/dist/primitives/IconButton/IconButton.js +9 -0
- package/dist/primitives/IconButton/index.d.ts +2 -0
- package/dist/primitives/IconButton/index.js +1 -0
- package/dist/primitives/IconButton/styles.d.ts +2 -0
- package/dist/primitives/IconButton/styles.js +9 -0
- package/dist/primitives/IconButton/types.d.ts +18 -0
- package/dist/primitives/IconButton/types.js +1 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4 -0
- package/jest.config.js +20 -0
- package/package.json +55 -0
- package/src/InAppMessaging/components/BannerMessage/BannerMessage.tsx +37 -0
- package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +138 -0
- package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +224 -0
- package/src/InAppMessaging/components/BannerMessage/index.ts +2 -0
- package/src/InAppMessaging/components/BannerMessage/styles.ts +105 -0
- package/src/InAppMessaging/components/BannerMessage/types.ts +15 -0
- package/src/InAppMessaging/components/CarouselMessage/CarouselMessage.tsx +42 -0
- package/src/InAppMessaging/components/CarouselMessage/CarouselMessageItem.tsx +37 -0
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +55 -0
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +56 -0
- package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +86 -0
- package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessageItem.spec.tsx.snap +248 -0
- package/src/InAppMessaging/components/CarouselMessage/index.ts +2 -0
- package/src/InAppMessaging/components/CarouselMessage/styles.ts +125 -0
- package/src/InAppMessaging/components/CarouselMessage/types.ts +28 -0
- package/src/InAppMessaging/components/FullScreenMessage/FullScreenMessage.tsx +38 -0
- package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +53 -0
- package/src/InAppMessaging/components/FullScreenMessage/__tests__/__snapshots__/FullScreenMessage.spec.tsx.snap +236 -0
- package/src/InAppMessaging/components/FullScreenMessage/index.ts +2 -0
- package/src/InAppMessaging/components/FullScreenMessage/styles.ts +106 -0
- package/src/InAppMessaging/components/FullScreenMessage/types.ts +7 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.tsx +48 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +33 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/__snapshots__/InAppMessageDisplay.spec.tsx.snap +9 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/handleMessageLinkAction.spec.ts +51 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.ts +30 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/index.ts +2 -0
- package/src/InAppMessaging/components/InAppMessageDisplay/types.ts +32 -0
- package/src/InAppMessaging/components/MessageLayout/MessageLayout.tsx +102 -0
- package/src/InAppMessaging/components/MessageLayout/index.ts +1 -0
- package/src/InAppMessaging/components/MessageLayout/types.ts +15 -0
- package/src/InAppMessaging/components/MessageWrapper/MessageWrapper.tsx +34 -0
- package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +19 -0
- package/src/InAppMessaging/components/MessageWrapper/__tests__/__snapshots__/MessageWrapper.spec.tsx.snap +35 -0
- package/src/InAppMessaging/components/MessageWrapper/index.ts +2 -0
- package/src/InAppMessaging/components/MessageWrapper/styles.ts +7 -0
- package/src/InAppMessaging/components/MessageWrapper/types.ts +12 -0
- package/src/InAppMessaging/components/ModalMessage/ModalMessage.tsx +37 -0
- package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +155 -0
- package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +323 -0
- package/src/InAppMessaging/components/ModalMessage/index.ts +2 -0
- package/src/InAppMessaging/components/ModalMessage/styles.ts +132 -0
- package/src/InAppMessaging/components/ModalMessage/types.ts +8 -0
- package/src/InAppMessaging/components/index.ts +6 -0
- package/src/InAppMessaging/components/withInAppMessaging/__tests__/__snapshots__/withInAppMessaging.spec.tsx.snap +3 -0
- package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +15 -0
- package/src/InAppMessaging/components/withInAppMessaging/index.ts +1 -0
- package/src/InAppMessaging/components/withInAppMessaging/withInAppMessaging.tsx +18 -0
- package/src/InAppMessaging/constants.ts +56 -0
- package/src/InAppMessaging/hooks/index.ts +9 -0
- package/src/InAppMessaging/hooks/useMessageImage/__tests__/useMessageImage.spec.ts +141 -0
- package/src/InAppMessaging/hooks/useMessageImage/__tests__/utils.spec.ts +107 -0
- package/src/InAppMessaging/hooks/useMessageImage/constants.ts +27 -0
- package/src/InAppMessaging/hooks/useMessageImage/index.ts +2 -0
- package/src/InAppMessaging/hooks/useMessageImage/types.ts +18 -0
- package/src/InAppMessaging/hooks/useMessageImage/useMessageImage.ts +74 -0
- package/src/InAppMessaging/hooks/useMessageImage/utils.ts +80 -0
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/__snapshots__/utils.spec.ts.snap +223 -0
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/useMessageProps.spec.ts +162 -0
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/utils.spec.ts +354 -0
- package/src/InAppMessaging/hooks/useMessageProps/index.ts +8 -0
- package/src/InAppMessaging/hooks/useMessageProps/types.ts +131 -0
- package/src/InAppMessaging/hooks/useMessageProps/useMessageProps.ts +70 -0
- package/src/InAppMessaging/hooks/useMessageProps/utils.ts +274 -0
- package/src/InAppMessaging/index.ts +14 -0
- package/src/__mocks__/react-native-safe-area-context.ts +6 -0
- package/src/__tests__/__snapshots__/index.spec.ts.snap +15 -0
- package/src/__tests__/index.spec.ts +8 -0
- package/src/assets/close.png +0 -0
- package/src/assets/index.ts +7 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useDeviceOrientation/__tests__/useDeviceOrientation.spec.ts +87 -0
- package/src/hooks/useDeviceOrientation/index.ts +4 -0
- package/src/hooks/useDeviceOrientation/useDeviceOrientation.ts +47 -0
- package/src/index.ts +1 -0
- package/src/primitives/Button/Button.tsx +21 -0
- package/src/primitives/Button/__tests__/Button.spec.tsx +24 -0
- package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +52 -0
- package/src/primitives/Button/index.ts +2 -0
- package/src/primitives/Button/styles.ts +6 -0
- package/src/primitives/Button/types.ts +9 -0
- package/src/primitives/Carousel/Carousel.tsx +115 -0
- package/src/primitives/Carousel/CarouselPageIndicator.tsx +39 -0
- package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +185 -0
- package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +71 -0
- package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +216 -0
- package/src/primitives/Carousel/__tests__/__snapshots__/CarouselPageIndicator.spec.tsx.snap +191 -0
- package/src/primitives/Carousel/constants.ts +25 -0
- package/src/primitives/Carousel/index.ts +3 -0
- package/src/primitives/Carousel/styles.ts +14 -0
- package/src/primitives/Carousel/types.ts +22 -0
- package/src/primitives/IconButton/IconButton.tsx +20 -0
- package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +13 -0
- package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +34 -0
- package/src/primitives/IconButton/index.ts +2 -0
- package/src/primitives/IconButton/styles.ts +16 -0
- package/src/primitives/IconButton/types.ts +27 -0
- package/src/primitives/index.ts +3 -0
- package/src/utils/index.ts +6 -0
- package/tsconfig.dist.json +4 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`FullScreenMessage renders as expected in landscape mode 1`] = `
|
|
4
|
+
<MessageWrapper
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"backgroundColor": "#fff",
|
|
9
|
+
"flex": 1,
|
|
10
|
+
},
|
|
11
|
+
Object {},
|
|
12
|
+
Object {},
|
|
13
|
+
Object {},
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
>
|
|
17
|
+
<MessageLayout
|
|
18
|
+
hasButtons={false}
|
|
19
|
+
hasPrimaryButton={false}
|
|
20
|
+
hasRenderableImage={false}
|
|
21
|
+
hasSecondaryButton={false}
|
|
22
|
+
layout="FULL_SCREEN"
|
|
23
|
+
orientation="landscape"
|
|
24
|
+
shouldRenderMessage={true}
|
|
25
|
+
styles={
|
|
26
|
+
Object {
|
|
27
|
+
"body": Array [
|
|
28
|
+
Object {
|
|
29
|
+
"fontSize": 16,
|
|
30
|
+
"fontWeight": "400",
|
|
31
|
+
"lineHeight": 24,
|
|
32
|
+
},
|
|
33
|
+
Object {},
|
|
34
|
+
undefined,
|
|
35
|
+
],
|
|
36
|
+
"buttonsContainer": Object {
|
|
37
|
+
"flexDirection": "row",
|
|
38
|
+
"justifyContent": "center",
|
|
39
|
+
},
|
|
40
|
+
"container": Array [
|
|
41
|
+
Object {
|
|
42
|
+
"flex": 1,
|
|
43
|
+
"padding": 16,
|
|
44
|
+
},
|
|
45
|
+
Object {},
|
|
46
|
+
Object {},
|
|
47
|
+
],
|
|
48
|
+
"contentContainer": Object {
|
|
49
|
+
"flex": 1,
|
|
50
|
+
"flexDirection": "row",
|
|
51
|
+
},
|
|
52
|
+
"header": Array [
|
|
53
|
+
Object {
|
|
54
|
+
"fontSize": 18,
|
|
55
|
+
"fontWeight": "400",
|
|
56
|
+
"lineHeight": 27,
|
|
57
|
+
},
|
|
58
|
+
Object {},
|
|
59
|
+
undefined,
|
|
60
|
+
],
|
|
61
|
+
"iconButton": Object {
|
|
62
|
+
"container": Array [
|
|
63
|
+
Object {
|
|
64
|
+
"alignSelf": "flex-start",
|
|
65
|
+
"marginBottom": 8,
|
|
66
|
+
"marginLeft": "auto",
|
|
67
|
+
"marginRight": 8,
|
|
68
|
+
},
|
|
69
|
+
undefined,
|
|
70
|
+
],
|
|
71
|
+
"iconColor": undefined,
|
|
72
|
+
},
|
|
73
|
+
"image": Array [
|
|
74
|
+
Object {
|
|
75
|
+
"height": null,
|
|
76
|
+
"width": null,
|
|
77
|
+
},
|
|
78
|
+
undefined,
|
|
79
|
+
],
|
|
80
|
+
"imageContainer": Object {
|
|
81
|
+
"alignItems": "center",
|
|
82
|
+
"justifyContent": "center",
|
|
83
|
+
"margin": 12,
|
|
84
|
+
},
|
|
85
|
+
"primaryButton": Object {
|
|
86
|
+
"container": [Function],
|
|
87
|
+
"text": Array [
|
|
88
|
+
Object {
|
|
89
|
+
"fontSize": 16,
|
|
90
|
+
"fontWeight": "400",
|
|
91
|
+
"lineHeight": 24,
|
|
92
|
+
"textAlign": "center",
|
|
93
|
+
},
|
|
94
|
+
Object {},
|
|
95
|
+
Object {},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
"secondaryButton": Object {
|
|
99
|
+
"container": [Function],
|
|
100
|
+
"text": Array [
|
|
101
|
+
Object {
|
|
102
|
+
"fontSize": 16,
|
|
103
|
+
"fontWeight": "400",
|
|
104
|
+
"lineHeight": 24,
|
|
105
|
+
"textAlign": "center",
|
|
106
|
+
},
|
|
107
|
+
Object {},
|
|
108
|
+
Object {},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
"textContainer": Object {
|
|
112
|
+
"flex": 1,
|
|
113
|
+
"justifyContent": "center",
|
|
114
|
+
"paddingHorizontal": 8,
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/>
|
|
119
|
+
</MessageWrapper>
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
exports[`FullScreenMessage renders as expected in portrait mode 1`] = `
|
|
123
|
+
<MessageWrapper
|
|
124
|
+
style={
|
|
125
|
+
Array [
|
|
126
|
+
Object {
|
|
127
|
+
"backgroundColor": "#fff",
|
|
128
|
+
},
|
|
129
|
+
Object {},
|
|
130
|
+
Object {},
|
|
131
|
+
Object {},
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
<MessageLayout
|
|
136
|
+
hasButtons={false}
|
|
137
|
+
hasPrimaryButton={false}
|
|
138
|
+
hasRenderableImage={false}
|
|
139
|
+
hasSecondaryButton={false}
|
|
140
|
+
layout="FULL_SCREEN"
|
|
141
|
+
orientation="portrait"
|
|
142
|
+
shouldRenderMessage={true}
|
|
143
|
+
styles={
|
|
144
|
+
Object {
|
|
145
|
+
"body": Array [
|
|
146
|
+
Object {
|
|
147
|
+
"fontSize": 16,
|
|
148
|
+
"fontWeight": "400",
|
|
149
|
+
"lineHeight": 24,
|
|
150
|
+
},
|
|
151
|
+
Object {},
|
|
152
|
+
undefined,
|
|
153
|
+
],
|
|
154
|
+
"buttonsContainer": Object {
|
|
155
|
+
"flexDirection": "row",
|
|
156
|
+
"justifyContent": "center",
|
|
157
|
+
"marginTop": "auto",
|
|
158
|
+
},
|
|
159
|
+
"container": Array [
|
|
160
|
+
Object {
|
|
161
|
+
"flex": 1,
|
|
162
|
+
"padding": 16,
|
|
163
|
+
},
|
|
164
|
+
Object {},
|
|
165
|
+
Object {},
|
|
166
|
+
],
|
|
167
|
+
"contentContainer": Object {
|
|
168
|
+
"flex": 1,
|
|
169
|
+
},
|
|
170
|
+
"header": Array [
|
|
171
|
+
Object {
|
|
172
|
+
"fontSize": 18,
|
|
173
|
+
"fontWeight": "400",
|
|
174
|
+
"lineHeight": 27,
|
|
175
|
+
},
|
|
176
|
+
Object {},
|
|
177
|
+
undefined,
|
|
178
|
+
],
|
|
179
|
+
"iconButton": Object {
|
|
180
|
+
"container": Array [
|
|
181
|
+
Object {
|
|
182
|
+
"alignSelf": "flex-start",
|
|
183
|
+
"marginBottom": 8,
|
|
184
|
+
"marginLeft": "auto",
|
|
185
|
+
"marginRight": 8,
|
|
186
|
+
},
|
|
187
|
+
undefined,
|
|
188
|
+
],
|
|
189
|
+
"iconColor": undefined,
|
|
190
|
+
},
|
|
191
|
+
"image": Array [
|
|
192
|
+
Object {
|
|
193
|
+
"height": null,
|
|
194
|
+
"width": null,
|
|
195
|
+
},
|
|
196
|
+
undefined,
|
|
197
|
+
],
|
|
198
|
+
"imageContainer": Object {
|
|
199
|
+
"alignItems": "center",
|
|
200
|
+
"margin": 12,
|
|
201
|
+
},
|
|
202
|
+
"primaryButton": Object {
|
|
203
|
+
"container": [Function],
|
|
204
|
+
"text": Array [
|
|
205
|
+
Object {
|
|
206
|
+
"fontSize": 16,
|
|
207
|
+
"fontWeight": "400",
|
|
208
|
+
"lineHeight": 24,
|
|
209
|
+
"textAlign": "center",
|
|
210
|
+
},
|
|
211
|
+
Object {},
|
|
212
|
+
Object {},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
"secondaryButton": Object {
|
|
216
|
+
"container": [Function],
|
|
217
|
+
"text": Array [
|
|
218
|
+
Object {
|
|
219
|
+
"fontSize": 16,
|
|
220
|
+
"fontWeight": "400",
|
|
221
|
+
"lineHeight": 24,
|
|
222
|
+
"textAlign": "center",
|
|
223
|
+
},
|
|
224
|
+
Object {},
|
|
225
|
+
Object {},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
"textContainer": Object {
|
|
229
|
+
"marginVertical": 12,
|
|
230
|
+
"paddingHorizontal": 8,
|
|
231
|
+
},
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/>
|
|
235
|
+
</MessageWrapper>
|
|
236
|
+
`;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ImageStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { GetDefaultStyle } from '../../hooks';
|
|
4
|
+
import {
|
|
5
|
+
BORDER_RADIUS_BASE,
|
|
6
|
+
COLOR_LIGHT_GREY,
|
|
7
|
+
COLOR_WHITE,
|
|
8
|
+
FONT_SIZE_BASE,
|
|
9
|
+
FONT_SIZE_LARGE,
|
|
10
|
+
FONT_WEIGHT_BASE,
|
|
11
|
+
LINE_HEIGHT_BASE,
|
|
12
|
+
LINE_HEIGHT_LARGE,
|
|
13
|
+
SPACING_EXTRA_LARGE,
|
|
14
|
+
SPACING_LARGE,
|
|
15
|
+
SPACING_MEDIUM,
|
|
16
|
+
} from '../../constants';
|
|
17
|
+
|
|
18
|
+
import { FullScreenMessageStyle } from './types';
|
|
19
|
+
|
|
20
|
+
const commonStyles: Omit<FullScreenMessageStyle, 'image'> = {
|
|
21
|
+
body: {
|
|
22
|
+
fontSize: FONT_SIZE_BASE,
|
|
23
|
+
fontWeight: FONT_WEIGHT_BASE,
|
|
24
|
+
lineHeight: LINE_HEIGHT_BASE,
|
|
25
|
+
},
|
|
26
|
+
buttonContainer: {
|
|
27
|
+
backgroundColor: COLOR_LIGHT_GREY,
|
|
28
|
+
borderRadius: BORDER_RADIUS_BASE,
|
|
29
|
+
flex: 1,
|
|
30
|
+
margin: SPACING_MEDIUM,
|
|
31
|
+
padding: SPACING_LARGE,
|
|
32
|
+
},
|
|
33
|
+
buttonsContainer: {
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
},
|
|
37
|
+
buttonText: {
|
|
38
|
+
fontSize: FONT_SIZE_BASE,
|
|
39
|
+
fontWeight: FONT_WEIGHT_BASE,
|
|
40
|
+
lineHeight: LINE_HEIGHT_BASE,
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
},
|
|
43
|
+
container: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
padding: SPACING_EXTRA_LARGE,
|
|
46
|
+
},
|
|
47
|
+
contentContainer: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
},
|
|
50
|
+
header: {
|
|
51
|
+
fontSize: FONT_SIZE_LARGE,
|
|
52
|
+
fontWeight: FONT_WEIGHT_BASE,
|
|
53
|
+
lineHeight: LINE_HEIGHT_LARGE,
|
|
54
|
+
},
|
|
55
|
+
iconButton: {
|
|
56
|
+
alignSelf: 'flex-start',
|
|
57
|
+
marginBottom: SPACING_MEDIUM,
|
|
58
|
+
marginLeft: 'auto',
|
|
59
|
+
marginRight: SPACING_MEDIUM,
|
|
60
|
+
},
|
|
61
|
+
imageContainer: {
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
margin: SPACING_LARGE,
|
|
64
|
+
},
|
|
65
|
+
textContainer: {
|
|
66
|
+
paddingHorizontal: SPACING_MEDIUM,
|
|
67
|
+
},
|
|
68
|
+
wrapper: {
|
|
69
|
+
backgroundColor: COLOR_WHITE,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const getPortraitStyles: GetDefaultStyle = (imageDimensions) => ({
|
|
74
|
+
...commonStyles,
|
|
75
|
+
buttonsContainer: {
|
|
76
|
+
...commonStyles.buttonsContainer,
|
|
77
|
+
marginTop: 'auto',
|
|
78
|
+
},
|
|
79
|
+
image: imageDimensions,
|
|
80
|
+
textContainer: {
|
|
81
|
+
...commonStyles.textContainer,
|
|
82
|
+
marginVertical: SPACING_LARGE,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const getLandscapeStyles: GetDefaultStyle = (imageDimensions) => ({
|
|
87
|
+
...commonStyles,
|
|
88
|
+
contentContainer: {
|
|
89
|
+
...commonStyles.contentContainer,
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
},
|
|
92
|
+
image: { ...imageDimensions } as ImageStyle,
|
|
93
|
+
imageContainer: {
|
|
94
|
+
...commonStyles.imageContainer,
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
},
|
|
97
|
+
textContainer: {
|
|
98
|
+
...commonStyles.textContainer,
|
|
99
|
+
flex: 1,
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
},
|
|
102
|
+
wrapper: {
|
|
103
|
+
...commonStyles.wrapper,
|
|
104
|
+
flex: 1,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FullScreenMessageCommonProps } from '@aws-amplify/ui-react-core';
|
|
2
|
+
import { MessageDefaultStyle, MessageOverrideStyle } from '../../hooks';
|
|
3
|
+
|
|
4
|
+
export interface FullScreenMessageProps
|
|
5
|
+
extends FullScreenMessageCommonProps<MessageOverrideStyle | undefined> {}
|
|
6
|
+
|
|
7
|
+
export interface FullScreenMessageStyle extends MessageDefaultStyle {}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
handleMessageAction,
|
|
5
|
+
OnMessageAction,
|
|
6
|
+
useMessage,
|
|
7
|
+
} from '@aws-amplify/ui-react-core';
|
|
8
|
+
|
|
9
|
+
import { BannerMessage } from '../BannerMessage';
|
|
10
|
+
import { FullScreenMessage } from '../FullScreenMessage';
|
|
11
|
+
import { CarouselMessage } from '../CarouselMessage';
|
|
12
|
+
import { ModalMessage } from '../ModalMessage';
|
|
13
|
+
|
|
14
|
+
import handleMessageLinkAction from './handleMessageLinkAction';
|
|
15
|
+
import { InAppMessageDisplayProps, MessageDefaultComponents } from './types';
|
|
16
|
+
|
|
17
|
+
const platformComponents: MessageDefaultComponents = {
|
|
18
|
+
BannerMessage,
|
|
19
|
+
CarouselMessage,
|
|
20
|
+
FullScreenMessage,
|
|
21
|
+
ModalMessage,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onMessageAction: OnMessageAction = ({ action, url }) => {
|
|
25
|
+
handleMessageAction({ action, url, handleMessageLinkAction });
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function InAppMessageDisplay({
|
|
29
|
+
components: overrideComponents,
|
|
30
|
+
}: InAppMessageDisplayProps): JSX.Element | null {
|
|
31
|
+
const components = React.useMemo(
|
|
32
|
+
() => ({ ...platformComponents, ...overrideComponents }),
|
|
33
|
+
[overrideComponents]
|
|
34
|
+
);
|
|
35
|
+
const { Component, props } = useMessage({
|
|
36
|
+
components,
|
|
37
|
+
onMessageAction,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return <Component {...props} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
InAppMessageDisplay.BannerMessage = BannerMessage;
|
|
44
|
+
InAppMessageDisplay.CarouselMessage = CarouselMessage;
|
|
45
|
+
InAppMessageDisplay.FullScreenMessage = FullScreenMessage;
|
|
46
|
+
InAppMessageDisplay.ModalMessage = ModalMessage;
|
|
47
|
+
|
|
48
|
+
export default InAppMessageDisplay;
|
package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import TestRenderer from 'react-test-renderer';
|
|
4
|
+
import { useMessage } from '@aws-amplify/ui-react-core';
|
|
5
|
+
|
|
6
|
+
import InAppMessageDisplay from '../InAppMessageDisplay';
|
|
7
|
+
|
|
8
|
+
// mock amplify core to turn off browser related Logger warning during tests
|
|
9
|
+
jest.mock('@aws-amplify/core');
|
|
10
|
+
jest.mock('@aws-amplify/ui-react-core');
|
|
11
|
+
|
|
12
|
+
const mockUseMessage = useMessage as jest.Mock;
|
|
13
|
+
|
|
14
|
+
describe('InAppMessageDisplay', () => {
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
jest.clearAllMocks();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('renders the expected component in the happy path', () => {
|
|
20
|
+
const Component = ({ layout }) => (
|
|
21
|
+
<View>
|
|
22
|
+
<Text>{layout}</Text>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
const props = { layout: 'TEST_COMPONENT' };
|
|
26
|
+
|
|
27
|
+
mockUseMessage.mockReturnValueOnce({ Component, props });
|
|
28
|
+
|
|
29
|
+
const inAppMessageDisplay = TestRenderer.create(<InAppMessageDisplay />);
|
|
30
|
+
|
|
31
|
+
expect(inAppMessageDisplay.toJSON()).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
});
|
package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/handleMessageLinkAction.spec.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Linking } from 'react-native';
|
|
2
|
+
import { ConsoleLogger as Logger } from '@aws-amplify/core';
|
|
3
|
+
|
|
4
|
+
import handleMessageLinkAction from '../handleMessageLinkAction';
|
|
5
|
+
|
|
6
|
+
jest.mock('react-native', () => ({
|
|
7
|
+
Linking: { canOpenURL: jest.fn(), openURL: jest.fn() },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
// use empty mockImplementation to turn off console output
|
|
11
|
+
const warnSpy = jest.spyOn(Logger.prototype, 'warn').mockImplementation();
|
|
12
|
+
|
|
13
|
+
const url = 'https://docs.amplify.aws/';
|
|
14
|
+
const error = 'ERROR';
|
|
15
|
+
|
|
16
|
+
describe('handleAction', () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
jest.clearAllMocks();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('logs a warning when Linking.canOpenUrl returns false', async () => {
|
|
22
|
+
(Linking.canOpenURL as jest.Mock).mockResolvedValueOnce(false);
|
|
23
|
+
|
|
24
|
+
await handleMessageLinkAction(url);
|
|
25
|
+
|
|
26
|
+
expect(Linking.canOpenURL).toHaveBeenCalledTimes(1);
|
|
27
|
+
expect(warnSpy).toHaveBeenCalledWith(`Unsupported url provided: ${url}`);
|
|
28
|
+
expect(Linking.openURL).not.toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('logs an error when Linking.canOpenUrl fails', async () => {
|
|
32
|
+
(Linking.canOpenURL as jest.Mock).mockRejectedValueOnce(error);
|
|
33
|
+
|
|
34
|
+
await handleMessageLinkAction(url);
|
|
35
|
+
|
|
36
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
37
|
+
`Call to Linking.canOpenURL failed: ${error}`
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('logs an error when Linking.openUrl fails', async () => {
|
|
42
|
+
(Linking.canOpenURL as jest.Mock).mockResolvedValueOnce(true);
|
|
43
|
+
(Linking.openURL as jest.Mock).mockRejectedValue(error);
|
|
44
|
+
|
|
45
|
+
await handleMessageLinkAction(url);
|
|
46
|
+
|
|
47
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
48
|
+
`Call to Linking.openURL failed: ${error}`
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Linking } from 'react-native';
|
|
2
|
+
import { ConsoleLogger as Logger } from '@aws-amplify/core';
|
|
3
|
+
import { HandleMessageLinkAction } from '@aws-amplify/ui-react-core';
|
|
4
|
+
|
|
5
|
+
const logger = new Logger('Notifications.InAppMessaging');
|
|
6
|
+
|
|
7
|
+
const handleMessageLinkAction: HandleMessageLinkAction = async (
|
|
8
|
+
url: string
|
|
9
|
+
) => {
|
|
10
|
+
let supported: boolean = false;
|
|
11
|
+
try {
|
|
12
|
+
supported = await Linking.canOpenURL(url);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
logger.warn(`Call to Linking.canOpenURL failed: ${e}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!supported) {
|
|
18
|
+
logger.warn(`Unsupported url provided: ${url}`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
logger.info(`Opening url: ${url}`);
|
|
24
|
+
await Linking.openURL(url);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
logger.warn(`Call to Linking.openURL failed: ${e}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default handleMessageLinkAction;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BannerMessageComponent,
|
|
3
|
+
CarouselMessageComponent,
|
|
4
|
+
FullScreenMessageComponent,
|
|
5
|
+
ModalMessageComponent,
|
|
6
|
+
} from '@aws-amplify/ui-react-core';
|
|
7
|
+
|
|
8
|
+
import { BannerMessageProps } from '../BannerMessage';
|
|
9
|
+
import { CarouselMessageProps } from '../CarouselMessage';
|
|
10
|
+
import { FullScreenMessageProps } from '../FullScreenMessage';
|
|
11
|
+
import { ModalMessageProps } from '../ModalMessage';
|
|
12
|
+
|
|
13
|
+
type BannerStyle = BannerMessageProps['style'];
|
|
14
|
+
type CarouselStyle = CarouselMessageProps['style'];
|
|
15
|
+
type FullScreenStyle = FullScreenMessageProps['style'];
|
|
16
|
+
type ModalStyle = ModalMessageProps['style'];
|
|
17
|
+
|
|
18
|
+
export interface MessageDefaultComponents {
|
|
19
|
+
BannerMessage: BannerMessageComponent<BannerStyle>;
|
|
20
|
+
CarouselMessage: CarouselMessageComponent<CarouselStyle>;
|
|
21
|
+
FullScreenMessage: FullScreenMessageComponent<FullScreenStyle>;
|
|
22
|
+
ModalMessage: ModalMessageComponent<ModalStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface MessageComponents extends Partial<MessageDefaultComponents> {}
|
|
26
|
+
|
|
27
|
+
export interface InAppMessageDisplayProps {
|
|
28
|
+
/**
|
|
29
|
+
* Message override UI components
|
|
30
|
+
*/
|
|
31
|
+
components?: MessageComponents;
|
|
32
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image, Text, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import icons from '../../../assets';
|
|
6
|
+
import { Button, IconButton } from '../../../primitives';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ICON_BUTTON_HIT_SLOP,
|
|
10
|
+
ICON_BUTTON_SIZE,
|
|
11
|
+
IN_APP_MESSAGING_TEST_ID,
|
|
12
|
+
} from '../../constants';
|
|
13
|
+
|
|
14
|
+
import { LayoutProps } from './types';
|
|
15
|
+
|
|
16
|
+
export default function MessageLayout({
|
|
17
|
+
orientation,
|
|
18
|
+
...props
|
|
19
|
+
}: LayoutProps): JSX.Element {
|
|
20
|
+
const {
|
|
21
|
+
body,
|
|
22
|
+
hasButtons,
|
|
23
|
+
hasPrimaryButton,
|
|
24
|
+
hasRenderableImage,
|
|
25
|
+
hasSecondaryButton,
|
|
26
|
+
header,
|
|
27
|
+
image,
|
|
28
|
+
onClose,
|
|
29
|
+
primaryButton,
|
|
30
|
+
secondaryButton,
|
|
31
|
+
styles,
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
const iconButton = (
|
|
35
|
+
<IconButton
|
|
36
|
+
color={styles.iconButton.iconColor}
|
|
37
|
+
hitSlop={ICON_BUTTON_HIT_SLOP}
|
|
38
|
+
onPress={onClose}
|
|
39
|
+
size={ICON_BUTTON_SIZE}
|
|
40
|
+
source={icons.close}
|
|
41
|
+
style={styles.iconButton.container}
|
|
42
|
+
testID={IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View style={styles.container}>
|
|
48
|
+
<View style={styles.contentContainer}>
|
|
49
|
+
{orientation === 'portrait' && iconButton}
|
|
50
|
+
{hasRenderableImage && (
|
|
51
|
+
<View style={styles.imageContainer}>
|
|
52
|
+
<Image
|
|
53
|
+
source={{ uri: image?.src }}
|
|
54
|
+
style={styles.image}
|
|
55
|
+
testID={IN_APP_MESSAGING_TEST_ID.IMAGE}
|
|
56
|
+
/>
|
|
57
|
+
</View>
|
|
58
|
+
)}
|
|
59
|
+
<View style={styles.textContainer}>
|
|
60
|
+
{header?.content && (
|
|
61
|
+
<Text
|
|
62
|
+
style={styles.header}
|
|
63
|
+
testID={IN_APP_MESSAGING_TEST_ID.HEADER}
|
|
64
|
+
>
|
|
65
|
+
{header.content}
|
|
66
|
+
</Text>
|
|
67
|
+
)}
|
|
68
|
+
{body?.content && (
|
|
69
|
+
<Text style={styles.body} testID={IN_APP_MESSAGING_TEST_ID.BODY}>
|
|
70
|
+
{body.content}
|
|
71
|
+
</Text>
|
|
72
|
+
)}
|
|
73
|
+
</View>
|
|
74
|
+
{orientation === 'landscape' && iconButton}
|
|
75
|
+
</View>
|
|
76
|
+
{hasButtons && (
|
|
77
|
+
<View style={styles.buttonsContainer}>
|
|
78
|
+
{hasSecondaryButton && (
|
|
79
|
+
<Button
|
|
80
|
+
onPress={secondaryButton?.onAction}
|
|
81
|
+
style={styles.secondaryButton.container}
|
|
82
|
+
testID={IN_APP_MESSAGING_TEST_ID.SECONDARY_BUTTON}
|
|
83
|
+
textStyle={styles.secondaryButton.text}
|
|
84
|
+
>
|
|
85
|
+
{secondaryButton?.title}
|
|
86
|
+
</Button>
|
|
87
|
+
)}
|
|
88
|
+
{hasPrimaryButton && (
|
|
89
|
+
<Button
|
|
90
|
+
onPress={primaryButton?.onAction}
|
|
91
|
+
style={styles.primaryButton.container}
|
|
92
|
+
testID={IN_APP_MESSAGING_TEST_ID.PRIMARY_BUTTON}
|
|
93
|
+
textStyle={styles.primaryButton.text}
|
|
94
|
+
>
|
|
95
|
+
{primaryButton?.title}
|
|
96
|
+
</Button>
|
|
97
|
+
)}
|
|
98
|
+
</View>
|
|
99
|
+
)}
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MessageLayout } from './MessageLayout';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MessageComponentBaseProps } from '@aws-amplify/ui-react-core';
|
|
2
|
+
|
|
3
|
+
import { DeviceOrientation } from '../../../hooks';
|
|
4
|
+
import {
|
|
5
|
+
MessageComponentStyles,
|
|
6
|
+
MessageOverrideStyle,
|
|
7
|
+
UseMessageProps,
|
|
8
|
+
} from '../../hooks';
|
|
9
|
+
|
|
10
|
+
export interface LayoutProps
|
|
11
|
+
extends Omit<MessageComponentBaseProps<MessageOverrideStyle>, 'style'>,
|
|
12
|
+
Omit<UseMessageProps, 'shouldRenderMessage' | 'styles'> {
|
|
13
|
+
orientation: DeviceOrientation;
|
|
14
|
+
styles: Omit<MessageComponentStyles, 'wrapper'>;
|
|
15
|
+
}
|