react-native-moengage-cards 1.0.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.
- package/README.md +10 -0
- package/ReactNativeMoEngageCards.podspec +25 -0
- package/android/.editorconfig +8 -0
- package/android/build.gradle +58 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +18 -0
- package/android/gradle.properties +14 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +16 -0
- package/android/src/main/java/com/moengage/react/cards/Constants.kt +12 -0
- package/android/src/main/java/com/moengage/react/cards/EventEmitterImpl.kt +62 -0
- package/android/src/main/java/com/moengage/react/cards/MoEngageCardsBridge.kt +228 -0
- package/android/src/main/java/com/moengage/react/cards/MoEngageCardsPackage.kt +35 -0
- package/android/src/main/java/com/moengage/react/cards/PayloadGenerator.kt +26 -0
- package/ios/Cards.xcodeproj/project.pbxproj +302 -0
- package/ios/Cards.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Cards.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/MoEngageCardsBridge.h +9 -0
- package/ios/MoEngageCardsBridge.m +149 -0
- package/ios/MoEngageCardsReactConstants.h +14 -0
- package/ios/MoEngageCardsReactConstants.m +15 -0
- package/ios/MoEngageCardsReactUtil.h +15 -0
- package/ios/MoEngageCardsReactUtil.m +44 -0
- package/package.json +42 -0
- package/src/ReactMoEngageCards.ts +212 -0
- package/src/index.ts +58 -0
- package/src/internal/Constants.ts +86 -0
- package/src/internal/MoEngageCardHandler.ts +265 -0
- package/src/internal/MoEngageCardsCache.ts +31 -0
- package/src/internal/utils/JsonToModelMapper.ts +267 -0
- package/src/internal/utils/ModelToJsonMapper.ts +250 -0
- package/src/internal/utils/PayloadBuilder.ts +68 -0
- package/src/internal/utils/PayloadParser.ts +53 -0
- package/src/internal/utils/PlatformPayloadBuilder.ts +81 -0
- package/src/internal/utils/Util.ts +16 -0
- package/src/model/CampaignState.ts +54 -0
- package/src/model/Card.ts +51 -0
- package/src/model/CardInfo.ts +36 -0
- package/src/model/CardsData.ts +29 -0
- package/src/model/Container.ts +59 -0
- package/src/model/DisplayControl.ts +70 -0
- package/src/model/MetaData.ts +90 -0
- package/src/model/ShowTime.ts +27 -0
- package/src/model/SyncData.ts +30 -0
- package/src/model/Template.ts +37 -0
- package/src/model/Widget.ts +59 -0
- package/src/model/action/Action.ts +22 -0
- package/src/model/action/NavigationAction.ts +39 -0
- package/src/model/enums/ActionType.ts +16 -0
- package/src/model/enums/NavigationType.ts +28 -0
- package/src/model/enums/SyncType.ts +28 -0
- package/src/model/enums/TemplateType.ts +22 -0
- package/src/model/enums/WidgetType.ts +28 -0
- package/src/model/styles/ButtonStyle.ts +23 -0
- package/src/model/styles/ContainerStyle.ts +20 -0
- package/src/model/styles/ImageStyle.ts +16 -0
- package/src/model/styles/TextStyle.ts +19 -0
- package/src/model/styles/WidgetStyle.ts +19 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import ShowTime from "./ShowTime";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delivery Controls defined during campaign creation.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
class DisplayControl {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Absolute time at which the card should be expired.
|
|
13
|
+
*
|
|
14
|
+
* Value in seconds.
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
expireAt: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Time duration after which card should be expired once it is seen.
|
|
21
|
+
*
|
|
22
|
+
* Value in seconds.
|
|
23
|
+
* @since 1.0.0
|
|
24
|
+
*/
|
|
25
|
+
expireAfterSeen: number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Time duration after which the card should be expired once it is delivered on the device.
|
|
29
|
+
*
|
|
30
|
+
* Value in seconds.
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
expireAfterDelivered: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Maximum number of times a campaign should be shown to the user across devices.
|
|
37
|
+
* @since 1.0.0
|
|
38
|
+
*/
|
|
39
|
+
maxCount: number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* True if the campaign is pinned on top, else false.
|
|
43
|
+
* @since 1.0.0
|
|
44
|
+
*/
|
|
45
|
+
isPinned: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Time during the day when the campaign should be shown.
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
*/
|
|
51
|
+
showTime: ShowTime;
|
|
52
|
+
|
|
53
|
+
constructor(
|
|
54
|
+
expireAt: number,
|
|
55
|
+
expireAfterSeen: number,
|
|
56
|
+
expireAfterDelivered: number,
|
|
57
|
+
maxCount: number,
|
|
58
|
+
isPinned: boolean,
|
|
59
|
+
showTime: ShowTime
|
|
60
|
+
) {
|
|
61
|
+
this.expireAt = expireAt;
|
|
62
|
+
this.expireAfterSeen = expireAfterSeen;
|
|
63
|
+
this.expireAfterDelivered = expireAfterDelivered;
|
|
64
|
+
this.maxCount = maxCount;
|
|
65
|
+
this.isPinned = isPinned;
|
|
66
|
+
this.showTime = showTime;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default DisplayControl;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import CampaignState from "./CampaignState";
|
|
2
|
+
import DisplayControl from "./DisplayControl";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Meta data related to a campaign.
|
|
6
|
+
*
|
|
7
|
+
* @author Abhishek Kumar
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
class MetaData {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* True if the campaign should be pinned to the top else false.
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
isPinned: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* True if the campaign hasn't been delivered to the inbox, else false.
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*/
|
|
22
|
+
isNewCard: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Current state of the campaign.
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
*/
|
|
28
|
+
campaignState: CampaignState;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Time at which the campaign would be deleted from local store.
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
34
|
+
deletionTime: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Delivery Controls defined during campaign creation.
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
*/
|
|
40
|
+
displayControl: DisplayControl;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Additional meta data regarding campaign used for tracking purposes.
|
|
44
|
+
* @since 1.0.0
|
|
45
|
+
*/
|
|
46
|
+
metaData: { [k: string]: any };
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creation time for the campaign.
|
|
50
|
+
* Notes: Available in iOS, default value is -1
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
*/
|
|
53
|
+
createdAt: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Last time the campaign was updated.
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
*/
|
|
59
|
+
updatedTime: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Complete Campaign payload.
|
|
63
|
+
* @since 1.0.0
|
|
64
|
+
*/
|
|
65
|
+
campaignPayload: { [k: string]: any };
|
|
66
|
+
|
|
67
|
+
constructor(
|
|
68
|
+
isPinned: boolean,
|
|
69
|
+
isNewCard: boolean,
|
|
70
|
+
campaignState: CampaignState,
|
|
71
|
+
deletionTime: number,
|
|
72
|
+
displayControl: DisplayControl,
|
|
73
|
+
metaData: { [k: string]: any },
|
|
74
|
+
createdAt: number,
|
|
75
|
+
updatedTime: number,
|
|
76
|
+
campaignPayload: { [k: string]: any }
|
|
77
|
+
) {
|
|
78
|
+
this.isPinned = isPinned;
|
|
79
|
+
this.isNewCard = isNewCard;
|
|
80
|
+
this.campaignState = campaignState;
|
|
81
|
+
this.deletionTime = deletionTime;
|
|
82
|
+
this.displayControl = displayControl;
|
|
83
|
+
this.metaData = metaData;
|
|
84
|
+
this.createdAt = createdAt;
|
|
85
|
+
this.updatedTime = updatedTime;
|
|
86
|
+
this.campaignPayload = campaignPayload;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default MetaData;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time span during card can be shown
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
class ShowTime {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Start time for the time range.
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
startTime: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* End time for the time range.
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
endTime: string;
|
|
20
|
+
|
|
21
|
+
constructor(startTime: string, endTime: string) {
|
|
22
|
+
this.startTime = startTime;
|
|
23
|
+
this.endTime = endTime;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default ShowTime;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import SyncType from "./enums/SyncType";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Data on API sync complete.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
class SyncCompleteData {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Indicating if there were any updates in the cards post sync. true if there are any new
|
|
13
|
+
* updates present else false. This value is true even if card(s) are deleted.
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
hasUpdates: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Condition under which sync was triggered. Refer to {@link SyncType}
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*/
|
|
22
|
+
syncType: SyncType;
|
|
23
|
+
|
|
24
|
+
constructor(hasUpdates: boolean, syncType: SyncType) {
|
|
25
|
+
this.hasUpdates = hasUpdates;
|
|
26
|
+
this.syncType = syncType;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default SyncCompleteData;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Container from "./Container";
|
|
2
|
+
import TemplateType from "./enums/TemplateType";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Card Template data.
|
|
6
|
+
*
|
|
7
|
+
* @author Abhishek Kumar
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
class Template {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Type of Template.
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
templateType: TemplateType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Containers in the template.
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*/
|
|
22
|
+
containers: Array<Container>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Additional data associated to the template
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
*/
|
|
28
|
+
kvPairs: { [k: string]: any };
|
|
29
|
+
|
|
30
|
+
constructor(templateType: TemplateType, containers: Array<Container>, kvPairs: { [k: string]: any }) {
|
|
31
|
+
this.templateType = templateType;
|
|
32
|
+
this.containers = containers;
|
|
33
|
+
this.kvPairs = kvPairs;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Template;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Action from "./action/Action";
|
|
2
|
+
import WidgetType from "./enums/WidgetType";
|
|
3
|
+
import WidgetStyle from "./styles/WidgetStyle";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* UI element in a card.
|
|
7
|
+
*
|
|
8
|
+
* @author Abhishek Kumar
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
class Widget {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Identifier for the widget.
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
id: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Type of widget
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
widgetType: WidgetType;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Content to be loaded in the widget.
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
content: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Style associated with the widget
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
*/
|
|
35
|
+
style: WidgetStyle | undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Actions to be performed on widget click
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
*/
|
|
41
|
+
actionList: Array<Action>;
|
|
42
|
+
|
|
43
|
+
constructor(
|
|
44
|
+
id: number,
|
|
45
|
+
widgetType: WidgetType,
|
|
46
|
+
content: string,
|
|
47
|
+
style: WidgetStyle | undefined,
|
|
48
|
+
actionList: Array<Action>
|
|
49
|
+
) {
|
|
50
|
+
this.id = id;
|
|
51
|
+
this.widgetType = widgetType;
|
|
52
|
+
this.content = content;
|
|
53
|
+
this.style = style;
|
|
54
|
+
this.actionList = actionList;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export default Widget;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ActionType from "../enums/ActionType";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base class for actions.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
abstract class Action {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Action type
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*/
|
|
15
|
+
actionType: ActionType;
|
|
16
|
+
|
|
17
|
+
constructor(actionType: ActionType) {
|
|
18
|
+
this.actionType = actionType;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Action;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ActionType from "../enums/ActionType";
|
|
2
|
+
import NavigationType from "../enums/NavigationType";
|
|
3
|
+
import Action from "./Action";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Navigation Action object.
|
|
7
|
+
*
|
|
8
|
+
* @author Abhishek Kumar
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
class NavigationAction extends Action {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Type of Navigation action.
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
navigationType: NavigationType;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Url/Screen-name to which the user should be navigated.
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
23
|
+
value: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Key-Value pair added on the MoEngage Platform for navigation action.
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
kvPairs: { [k: string]: any };
|
|
30
|
+
|
|
31
|
+
constructor(actionType: ActionType, navigationType: NavigationType, value: string, kvPairs: { [k: string]: any }) {
|
|
32
|
+
super(actionType);
|
|
33
|
+
this.navigationType = navigationType;
|
|
34
|
+
this.value = value;
|
|
35
|
+
this.kvPairs = kvPairs;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default NavigationAction;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported action types on card click.
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
enum ActionType {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Action to navigate user to a different screen.
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
NAVIGATE = "NAVIGATE"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ActionType;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of navigation action.
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
enum NavigationType {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Navigation is done using a deep-link Url or http(s) url.
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
DEEPLINK = "DEEPLINK",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Navigation to a rich-landing url
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
RICHLANDING = "RICHLANDING",
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Navigation is done using activity name or screen name.
|
|
23
|
+
* @since 1.0.0
|
|
24
|
+
*/
|
|
25
|
+
SCREENNAME = "SCREENNAME"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default NavigationType;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Condition/Situation when sync
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
enum SyncType {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Sync when application comes to foreground.
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
APP_OPEN = "APP_OPEN",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sync when inbox screen opened.
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
INBOX_OPEN = "INBOX_OPEN",
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sync when SwipeToRefresh widget is pulled.
|
|
23
|
+
* @since 1.0.0
|
|
24
|
+
*/
|
|
25
|
+
PULL_TO_REFRESH = "PULL_TO_REFRESH"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default SyncType;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported template types.
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
enum TemplateType {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Basic Template
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
BASIC = "BASIC",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Illustration Template
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
ILLUSTRATION = "ILLUSTRATION"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default TemplateType;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of UI widgets supported.
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
enum WidgetType {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Widget that loads an image or gif
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
IMAGE = "IMAGE",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Widget that loads text content.
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
TEXT = "TEXT",
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Widget that loads button content.
|
|
23
|
+
* @since 1.0.0
|
|
24
|
+
*/
|
|
25
|
+
BUTTON = "BUTTON"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default WidgetType;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import WidgetStyle from "./WidgetStyle";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Style attributes for a Button Widget.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
class ButtonStyle extends WidgetStyle {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Font size of the button text.
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*/
|
|
15
|
+
fontSize: number;
|
|
16
|
+
|
|
17
|
+
constructor(backgroundColor: string, fontSize: number) {
|
|
18
|
+
super(backgroundColor);
|
|
19
|
+
this.fontSize = fontSize;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default ButtonStyle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style attributes of a [Container]
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
class ContainerStyle {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Background color of the container.
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
|
|
15
|
+
constructor(backgroundColor: string) {
|
|
16
|
+
this.backgroundColor = backgroundColor;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default ContainerStyle;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import WidgetStyle from "./WidgetStyle";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Style attributes for an Image Widget.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
class ImageStyle extends WidgetStyle {
|
|
10
|
+
|
|
11
|
+
constructor(backgroundColor: string) {
|
|
12
|
+
super(backgroundColor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ImageStyle;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import WidgetStyle from "./WidgetStyle";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Style attributes for the Text widget.
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
class TextStyle extends WidgetStyle {
|
|
10
|
+
|
|
11
|
+
fontSize: number;
|
|
12
|
+
|
|
13
|
+
constructor(backgroundColor: string, fontSize: number) {
|
|
14
|
+
super(backgroundColor);
|
|
15
|
+
this.fontSize = fontSize;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default TextStyle;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base style for all widgets.
|
|
3
|
+
*
|
|
4
|
+
* @author Abhishek Kumar
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
abstract class WidgetStyle {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Background color of the Button.
|
|
11
|
+
*/
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
|
|
14
|
+
constructor(backgroundColor: string) {
|
|
15
|
+
this.backgroundColor = backgroundColor;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default WidgetStyle;
|