@plusscommunities/pluss-core-app 4.0.4-auth.0 → 6.0.0-auth.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 (195) hide show
  1. package/dist/module/actions/FollowerActions.js +34 -0
  2. package/dist/module/actions/FollowerActions.js.map +1 -0
  3. package/dist/module/actions/MediaActions.js +29 -0
  4. package/dist/module/actions/MediaActions.js.map +1 -0
  5. package/dist/module/actions/ResidentActions.js +26 -0
  6. package/dist/module/actions/ResidentActions.js.map +1 -0
  7. package/dist/module/actions/UserActions.js +223 -0
  8. package/dist/module/actions/UserActions.js.map +1 -0
  9. package/dist/module/actions/UserSettingsActions.js +14 -0
  10. package/dist/module/actions/UserSettingsActions.js.map +1 -0
  11. package/dist/module/actions/index.js +6 -0
  12. package/dist/module/actions/index.js.map +1 -0
  13. package/dist/module/actions/types.js +17 -0
  14. package/dist/module/actions/types.js.map +1 -0
  15. package/dist/module/apis/analyticsActions.js +20 -0
  16. package/dist/module/apis/analyticsActions.js.map +1 -0
  17. package/dist/module/apis/contactActions.js +27 -0
  18. package/dist/module/apis/contactActions.js.map +1 -0
  19. package/dist/module/apis/eventActions.js +161 -0
  20. package/dist/module/apis/eventActions.js.map +1 -0
  21. package/dist/module/apis/fileActions.js +86 -0
  22. package/dist/module/apis/fileActions.js.map +1 -0
  23. package/dist/module/apis/followerActions.js +38 -0
  24. package/dist/module/apis/followerActions.js.map +1 -0
  25. package/dist/module/apis/index.js +12 -0
  26. package/dist/module/apis/index.js.map +1 -0
  27. package/dist/module/apis/notificationActions.js +60 -0
  28. package/dist/module/apis/notificationActions.js.map +1 -0
  29. package/dist/module/apis/profileActions.js +14 -0
  30. package/dist/module/apis/profileActions.js.map +1 -0
  31. package/dist/module/apis/reactionActions.js +76 -0
  32. package/dist/module/apis/reactionActions.js.map +1 -0
  33. package/dist/module/apis/stringActions.js +30 -0
  34. package/dist/module/apis/stringActions.js.map +1 -0
  35. package/dist/module/apis/typeActions.js +15 -0
  36. package/dist/module/apis/typeActions.js.map +1 -0
  37. package/dist/module/apis/userActions.js +104 -0
  38. package/dist/module/apis/userActions.js.map +1 -0
  39. package/dist/module/assets/icons/reactions/heart.png +0 -0
  40. package/dist/module/assets/icons/reactions/party.png +0 -0
  41. package/dist/module/assets/icons/reactions/sad.png +0 -0
  42. package/dist/module/assets/icons/reactions/smile.png +0 -0
  43. package/dist/module/colours.js +168 -0
  44. package/dist/module/colours.js.map +1 -0
  45. package/dist/module/components/AddButton.js +43 -0
  46. package/dist/module/components/AddButton.js.map +1 -0
  47. package/dist/module/components/AddToCalendarButton.js +225 -0
  48. package/dist/module/components/AddToCalendarButton.js.map +1 -0
  49. package/dist/module/components/Attachment.js +54 -0
  50. package/dist/module/components/Attachment.js.map +1 -0
  51. package/dist/module/components/AudienceSelectorLauncher.js +64 -0
  52. package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
  53. package/dist/module/components/AudienceSelectorPage.js +350 -0
  54. package/dist/module/components/AudienceSelectorPage.js.map +1 -0
  55. package/dist/module/components/AutoOffsetImage.js +186 -0
  56. package/dist/module/components/AutoOffsetImage.js.map +1 -0
  57. package/dist/module/components/BackButton.js +58 -0
  58. package/dist/module/components/BackButton.js.map +1 -0
  59. package/dist/module/components/CategoryTabs.js +154 -0
  60. package/dist/module/components/CategoryTabs.js.map +1 -0
  61. package/dist/module/components/CommentReply.js +328 -0
  62. package/dist/module/components/CommentReply.js.map +1 -0
  63. package/dist/module/components/CommentSection.js +822 -0
  64. package/dist/module/components/CommentSection.js.map +1 -0
  65. package/dist/module/components/ConfirmPopup.js +108 -0
  66. package/dist/module/components/ConfirmPopup.js.map +1 -0
  67. package/dist/module/components/ConfirmationPopup.js +72 -0
  68. package/dist/module/components/ConfirmationPopup.js.map +1 -0
  69. package/dist/module/components/DropDownItem.js +74 -0
  70. package/dist/module/components/DropDownItem.js.map +1 -0
  71. package/dist/module/components/DropDownMenu.js +41 -0
  72. package/dist/module/components/DropDownMenu.js.map +1 -0
  73. package/dist/module/components/EmptyStateMain.js +50 -0
  74. package/dist/module/components/EmptyStateMain.js.map +1 -0
  75. package/dist/module/components/EmptyStateWidget.js +47 -0
  76. package/dist/module/components/EmptyStateWidget.js.map +1 -0
  77. package/dist/module/components/FontScaleButton.js +36 -0
  78. package/dist/module/components/FontScaleButton.js.map +1 -0
  79. package/dist/module/components/FontScalePopup.js +75 -0
  80. package/dist/module/components/FontScalePopup.js.map +1 -0
  81. package/dist/module/components/FormCard.js +25 -0
  82. package/dist/module/components/FormCard.js.map +1 -0
  83. package/dist/module/components/FormCardSection.js +212 -0
  84. package/dist/module/components/FormCardSection.js.map +1 -0
  85. package/dist/module/components/FormCardSectionOptionLauncher.js +72 -0
  86. package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
  87. package/dist/module/components/FormattedText.js +131 -0
  88. package/dist/module/components/FormattedText.js.map +1 -0
  89. package/dist/module/components/GenericInput.js +148 -0
  90. package/dist/module/components/GenericInput.js.map +1 -0
  91. package/dist/module/components/GenericInputSection.js +158 -0
  92. package/dist/module/components/GenericInputSection.js.map +1 -0
  93. package/dist/module/components/Header.js +458 -0
  94. package/dist/module/components/Header.js.map +1 -0
  95. package/dist/module/components/ImagePopup.js +240 -0
  96. package/dist/module/components/ImagePopup.js.map +1 -0
  97. package/dist/module/components/ImageUploadProgress.js +68 -0
  98. package/dist/module/components/ImageUploadProgress.js.map +1 -0
  99. package/dist/module/components/ImageUploader.js +795 -0
  100. package/dist/module/components/ImageUploader.js.map +1 -0
  101. package/dist/module/components/InlineButton.js +65 -0
  102. package/dist/module/components/InlineButton.js.map +1 -0
  103. package/dist/module/components/Input.js +154 -0
  104. package/dist/module/components/Input.js.map +1 -0
  105. package/dist/module/components/LoadingCircles.js +220 -0
  106. package/dist/module/components/LoadingCircles.js.map +1 -0
  107. package/dist/module/components/LoadingIndicator.js +86 -0
  108. package/dist/module/components/LoadingIndicator.js.map +1 -0
  109. package/dist/module/components/LoadingStateWidget.js +46 -0
  110. package/dist/module/components/LoadingStateWidget.js.map +1 -0
  111. package/dist/module/components/MediaPlayer.js +418 -0
  112. package/dist/module/components/MediaPlayer.js.map +1 -0
  113. package/dist/module/components/MiddlePopup.js +43 -0
  114. package/dist/module/components/MiddlePopup.js.map +1 -0
  115. package/dist/module/components/PDFPopup.js +191 -0
  116. package/dist/module/components/PDFPopup.js.map +1 -0
  117. package/dist/module/components/PlussChat.js +986 -0
  118. package/dist/module/components/PlussChat.js.map +1 -0
  119. package/dist/module/components/PlussChatMessage.js +262 -0
  120. package/dist/module/components/PlussChatMessage.js.map +1 -0
  121. package/dist/module/components/PlussChatTime.js +58 -0
  122. package/dist/module/components/PlussChatTime.js.map +1 -0
  123. package/dist/module/components/Popup.js +125 -0
  124. package/dist/module/components/Popup.js.map +1 -0
  125. package/dist/module/components/PopupMenu.js +119 -0
  126. package/dist/module/components/PopupMenu.js.map +1 -0
  127. package/dist/module/components/PositionedImage.js +313 -0
  128. package/dist/module/components/PositionedImage.js.map +1 -0
  129. package/dist/module/components/ProfilePic.js +106 -0
  130. package/dist/module/components/ProfilePic.js.map +1 -0
  131. package/dist/module/components/RadioButton.js +77 -0
  132. package/dist/module/components/RadioButton.js.map +1 -0
  133. package/dist/module/components/Reaction.js +116 -0
  134. package/dist/module/components/Reaction.js.map +1 -0
  135. package/dist/module/components/Reactions.js +71 -0
  136. package/dist/module/components/Reactions.js.map +1 -0
  137. package/dist/module/components/SharingTools.js +154 -0
  138. package/dist/module/components/SharingTools.js.map +1 -0
  139. package/dist/module/components/Spinner.js +22 -0
  140. package/dist/module/components/Spinner.js.map +1 -0
  141. package/dist/module/components/StickyFooter.js +34 -0
  142. package/dist/module/components/StickyFooter.js.map +1 -0
  143. package/dist/module/components/TextStyle.js +45 -0
  144. package/dist/module/components/TextStyle.js.map +1 -0
  145. package/dist/module/components/Toggle.js +65 -0
  146. package/dist/module/components/Toggle.js.map +1 -0
  147. package/dist/module/components/TouchableSearchBar.js +67 -0
  148. package/dist/module/components/TouchableSearchBar.js.map +1 -0
  149. package/dist/module/components/UserListPopup.js +135 -0
  150. package/dist/module/components/UserListPopup.js.map +1 -0
  151. package/dist/module/components/UserListing.js +267 -0
  152. package/dist/module/components/UserListing.js.map +1 -0
  153. package/dist/module/components/VideoPopup.js +113 -0
  154. package/dist/module/components/VideoPopup.js.map +1 -0
  155. package/dist/module/components/WarningPopup.js +82 -0
  156. package/dist/module/components/WarningPopup.js.map +1 -0
  157. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +289 -0
  158. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
  159. package/dist/module/components/expo-image-picker-multiple/ImageTile.js +116 -0
  160. package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
  161. package/dist/module/components/index.js +55 -0
  162. package/dist/module/components/index.js.map +1 -0
  163. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +385 -0
  164. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
  165. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +387 -0
  166. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
  167. package/dist/module/config.js +32 -0
  168. package/dist/module/config.js.map +1 -0
  169. package/dist/module/constants.js +19 -0
  170. package/dist/module/constants.js.map +1 -0
  171. package/dist/module/fonts/index.js +2 -0
  172. package/dist/module/fonts/index.js.map +1 -0
  173. package/dist/module/fonts/pluss60-icons.js +5 -0
  174. package/dist/module/fonts/pluss60-icons.js.map +1 -0
  175. package/dist/module/fonts/pluss60-icons.json +1097 -0
  176. package/dist/module/helper.js +397 -0
  177. package/dist/module/helper.js.map +1 -0
  178. package/dist/module/index.js +13 -0
  179. package/dist/module/index.js.map +1 -0
  180. package/dist/module/js/images/detectFaces.js +30 -0
  181. package/dist/module/js/images/detectFaces.js.map +1 -0
  182. package/dist/module/js/images/findLandmarkRange.js +93 -0
  183. package/dist/module/js/images/findLandmarkRange.js.map +1 -0
  184. package/dist/module/js/images/getScaledOffset.js +81 -0
  185. package/dist/module/js/images/getScaledOffset.js.map +1 -0
  186. package/dist/module/js/site/getSiteLevelFromState.js +29 -0
  187. package/dist/module/js/site/getSiteLevelFromState.js.map +1 -0
  188. package/dist/module/js/site/isTVEnabled.js +10 -0
  189. package/dist/module/js/site/isTVEnabled.js.map +1 -0
  190. package/dist/module/session.js +58 -0
  191. package/dist/module/session.js.map +1 -0
  192. package/dist/module/styles.js +67 -0
  193. package/dist/module/styles.js.map +1 -0
  194. package/package.json +20 -24
  195. package/src/js/images/detectFaces.js +8 -4
@@ -0,0 +1,168 @@
1
+ // const COLOUR_1 = '#011d5c';
2
+ // const COLOUR_2 = '#3179cb';
3
+ // const COLOUR_3 = '#1bb7ee';
4
+ const TEXT_DARKEST = '#3e4245';
5
+ const TEXT_DARK = TEXT_DARKEST;
6
+ const TEXT_BLUEGREY = '#6c7a90';
7
+ // const TEXT_DARK_ALPHA50 = 'rgba(60, 60, 80, .5)';
8
+ // const TEXT_DARK_ALPHA20 = 'rgba(60, 60, 80, .2)';
9
+ // const TEXT_DARK_ALPHA10 = 'rgba(60, 60, 80, .1)';
10
+ const TEXT_MID = '#5a5a6e';
11
+ // const TEXT_MID_ALPHA50 = 'rgba(90, 90, 110, .5)';
12
+ const TEXT_LIGHT = '#717b81';
13
+ const TEXT_LIGHTER = 'rgba(113, 123, 129, 0.8)';
14
+ const TEXT_SUPER_LIGHT = '#d1d1d1';
15
+ const BG_GREY = '#e9e9ef';
16
+ const LINEGREY = '#d5dde4';
17
+ const BOXGREY = '#ebeff2';
18
+ const PINKISH_GREY = '#c4c4c4';
19
+ // const PALE_GREY = '#f6f7f9';
20
+ const INACTIVE_BUTTON = '#d5d9e1';
21
+ const INACTIVE_TEXT = 'rgba(113, 123, 130, 0.8)';
22
+ const COLOUR_TEAL = '#82d6e5';
23
+ // const COLOUR_TEAL_ALPHA50 = 'rgba(4, 196, 169, 0.2)';
24
+ // const COLOUR_BLUE = '#0083ee';
25
+ // const COLOUR_BLUE_LIVE = 'rgb(0, 173, 238)';
26
+ // const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';
27
+ // const COLOUR_DARKBLUE = '#191e78';
28
+ // const COLOUR_PURPLE = '#8e44ad';
29
+ const COLOUR_RED = '#C52F40';
30
+ const COLOUR_GRAPEFRUIT = '#FF6363';
31
+ const COLOUR_GREEN = '#00cc76';
32
+ const COLOUR_GREEN_LIGHT = '#58dba4';
33
+ const COLOUR_TANGERINE = '#ff8c75';
34
+ // const COLOUR_CITRON = '#bdbd27';
35
+ // const DARK_OVERLAY = 'rgba(19,19,26,.6)';
36
+ // const FACEBOOK_BLUE = '#3B5998';
37
+ // const COLOUR_NAV_GREY = '#f6f6f6';
38
+ const COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';
39
+ // const COLOUR_SIDEBAR = '#303030';
40
+ const COLOUR_BRANDING_MAIN = '#FF6363';
41
+ // const COLOUR_BRANDING_OFF = '#FCE1E1';
42
+ const COLOUR_BRANDING_LIGHT = '#FCE1E1';
43
+ // const COLOUR_BRANDING_SECONDARY = COLOUR_BRANDING_MAIN;
44
+ const COLOUR_BRANDING_DARK = '#D13636';
45
+ // const COLOUR_DAY = '#89c4f4';
46
+ // const COLOUR_NIGHT = '#003159';
47
+ const COLOUR_TAN = '#fff3d1';
48
+
49
+ // const hexToRGB = hex => {
50
+ // // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
51
+ // const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
52
+ // hex = hex.replace(shorthandRegex, (m, r, g, b) => {
53
+ // return r + r + g + g + b + b;
54
+ // });
55
+
56
+ // const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
57
+ // return result
58
+ // ? {
59
+ // r: parseInt(result[1], 16),
60
+ // g: parseInt(result[2], 16),
61
+ // b: parseInt(result[3], 16),
62
+ // }
63
+ // : null;
64
+ // };
65
+
66
+ const hexToRGBAstring = (hex, opacity) => {
67
+ // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
68
+ const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
69
+ hex = hex.replace(shorthandRegex, (m, r, g, b) => {
70
+ return r + r + g + g + b + b;
71
+ });
72
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
73
+ return result ? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacity})` : null;
74
+ };
75
+
76
+ // const pctBtwnColours = (c1, c2, percentage) => {
77
+ // const rgbC1 = hexToRGB(c1);
78
+ // const rgbC2 = hexToRGB(c2);
79
+ // const r = rgbC2.r + (rgbC1.r - rgbC2.r) * percentage;
80
+ // const g = rgbC2.g + (rgbC1.g - rgbC2.g) * percentage;
81
+ // const b = rgbC2.b + (rgbC1.b - rgbC2.b) * percentage;
82
+ // return `rgb(${r}, ${g}, ${b})`;
83
+ // };
84
+
85
+ // const getTabIconColour = (mainColour, footerType, selected) => {
86
+ // if (footerType !== 'white') {
87
+ // return '#fff';
88
+ // }
89
+ // if (selected) {
90
+ // return mainColour;
91
+ // }
92
+ // return TEXT_BLUEGREY;
93
+ // };
94
+
95
+ // const getHeaderBrandingColourFromState = state => {
96
+ // return (state && state.user && state.user.siteBranding && state.user.siteBranding.HeaderBrandingColour) || null;
97
+ // };
98
+
99
+ const getMainBrandingColourFromState = state => {
100
+ return state && state.user && state.user.siteBranding && state.user.siteBranding.MainBrandingColour || COLOUR_BRANDING_MAIN;
101
+ };
102
+ const getDarkBrandingColourFromState = state => {
103
+ return state && state.user && state.user.siteBranding && state.user.siteBranding.DarkBrandingColour || COLOUR_BRANDING_DARK;
104
+ };
105
+ const getLightBrandingColourFromState = state => {
106
+ return state && state.user && state.user.siteBranding && state.user.siteBranding.LightBrandingColour || COLOUR_BRANDING_LIGHT;
107
+ };
108
+
109
+ // const getSecondaryBrandingColourFromState = state => {
110
+ // return (state && state.user && state.user.siteBranding && state.user.siteBranding.SecondaryBrandingColour) || COLOUR_BRANDING_SECONDARY;
111
+ // };
112
+
113
+ // const getMainBrandingColourFromSite = site => {
114
+ // return (site.Branding && site.Branding.MainBrandingColour) || COLOUR_BRANDING_MAIN;
115
+ // };
116
+
117
+ // const getDarkBrandingColourFromSite = site => {
118
+ // return (site.Branding && site.Branding.DarkBrandingColour) || COLOUR_BRANDING_DARK;
119
+ // };
120
+
121
+ // const getLightBrandingColourFromSite = site => {
122
+ // return (site.Branding && site.Branding.LightBrandingColour) || COLOUR_BRANDING_LIGHT;
123
+ // };
124
+
125
+ export {
126
+ // COLOUR_1,
127
+ // COLOUR_2,
128
+ // COLOUR_3,
129
+ TEXT_DARKEST, TEXT_BLUEGREY, TEXT_DARK,
130
+ // TEXT_DARK_ALPHA50,
131
+ // TEXT_DARK_ALPHA20,
132
+ // TEXT_DARK_ALPHA10,
133
+ TEXT_MID,
134
+ // TEXT_MID_ALPHA50,
135
+ TEXT_LIGHT, TEXT_LIGHTER, TEXT_SUPER_LIGHT, BG_GREY, LINEGREY, PINKISH_GREY, BOXGREY,
136
+ // PALE_GREY,
137
+ INACTIVE_BUTTON, INACTIVE_TEXT, COLOUR_TEAL,
138
+ // COLOUR_TEAL_ALPHA50,
139
+ // COLOUR_BLUE,
140
+ // COLOUR_BLUE_LIVE,
141
+ // COLOUR_BLUE_ALPHA10,
142
+ // COLOUR_DARKBLUE,
143
+ // COLOUR_PURPLE,
144
+ COLOUR_RED, COLOUR_TANGERINE,
145
+ // COLOUR_CITRON,
146
+ // DARK_OVERLAY,
147
+ // hexToRGB,
148
+ hexToRGBAstring,
149
+ // pctBtwnColours,
150
+ // FACEBOOK_BLUE,
151
+ // COLOUR_NAV_GREY,
152
+ COLOUR_TRANSPARENT,
153
+ // COLOUR_SIDEBAR,
154
+ COLOUR_BRANDING_MAIN,
155
+ // COLOUR_BRANDING_OFF,
156
+ COLOUR_BRANDING_LIGHT, COLOUR_BRANDING_DARK, COLOUR_GREEN, COLOUR_GREEN_LIGHT, COLOUR_GRAPEFRUIT,
157
+ // COLOUR_DAY,
158
+ // COLOUR_NIGHT,
159
+ COLOUR_TAN,
160
+ // getHeaderBrandingColourFromState,
161
+ getMainBrandingColourFromState, getDarkBrandingColourFromState, getLightBrandingColourFromState
162
+ // getSecondaryBrandingColourFromState,
163
+ // getMainBrandingColourFromSite,
164
+ // getDarkBrandingColourFromSite,
165
+ // getLightBrandingColourFromSite,
166
+ // getTabIconColour,
167
+ };
168
+ //# sourceMappingURL=colours.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TEXT_DARKEST","TEXT_DARK","TEXT_BLUEGREY","TEXT_MID","TEXT_LIGHT","TEXT_LIGHTER","TEXT_SUPER_LIGHT","BG_GREY","LINEGREY","BOXGREY","PINKISH_GREY","INACTIVE_BUTTON","INACTIVE_TEXT","COLOUR_TEAL","COLOUR_RED","COLOUR_GRAPEFRUIT","COLOUR_GREEN","COLOUR_GREEN_LIGHT","COLOUR_TANGERINE","COLOUR_TRANSPARENT","COLOUR_BRANDING_MAIN","COLOUR_BRANDING_LIGHT","COLOUR_BRANDING_DARK","COLOUR_TAN","hexToRGBAstring","hex","opacity","shorthandRegex","replace","m","r","g","b","result","exec","parseInt","getMainBrandingColourFromState","state","user","siteBranding","MainBrandingColour","getDarkBrandingColourFromState","DarkBrandingColour","getLightBrandingColourFromState","LightBrandingColour"],"sources":["colours.js"],"sourcesContent":["// const COLOUR_1 = '#011d5c';\n// const COLOUR_2 = '#3179cb';\n// const COLOUR_3 = '#1bb7ee';\nconst TEXT_DARKEST = '#3e4245';\nconst TEXT_DARK = TEXT_DARKEST;\nconst TEXT_BLUEGREY = '#6c7a90';\n// const TEXT_DARK_ALPHA50 = 'rgba(60, 60, 80, .5)';\n// const TEXT_DARK_ALPHA20 = 'rgba(60, 60, 80, .2)';\n// const TEXT_DARK_ALPHA10 = 'rgba(60, 60, 80, .1)';\nconst TEXT_MID = '#5a5a6e';\n// const TEXT_MID_ALPHA50 = 'rgba(90, 90, 110, .5)';\nconst TEXT_LIGHT = '#717b81';\nconst TEXT_LIGHTER = 'rgba(113, 123, 129, 0.8)';\nconst TEXT_SUPER_LIGHT = '#d1d1d1';\nconst BG_GREY = '#e9e9ef';\nconst LINEGREY = '#d5dde4';\nconst BOXGREY = '#ebeff2';\nconst PINKISH_GREY = '#c4c4c4';\n// const PALE_GREY = '#f6f7f9';\nconst INACTIVE_BUTTON = '#d5d9e1';\nconst INACTIVE_TEXT = 'rgba(113, 123, 130, 0.8)';\nconst COLOUR_TEAL = '#82d6e5';\n// const COLOUR_TEAL_ALPHA50 = 'rgba(4, 196, 169, 0.2)';\n// const COLOUR_BLUE = '#0083ee';\n// const COLOUR_BLUE_LIVE = 'rgb(0, 173, 238)';\n// const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';\n// const COLOUR_DARKBLUE = '#191e78';\n// const COLOUR_PURPLE = '#8e44ad';\nconst COLOUR_RED = '#C52F40';\nconst COLOUR_GRAPEFRUIT = '#FF6363';\nconst COLOUR_GREEN = '#00cc76';\nconst COLOUR_GREEN_LIGHT = '#58dba4';\nconst COLOUR_TANGERINE = '#ff8c75';\n// const COLOUR_CITRON = '#bdbd27';\n// const DARK_OVERLAY = 'rgba(19,19,26,.6)';\n// const FACEBOOK_BLUE = '#3B5998';\n// const COLOUR_NAV_GREY = '#f6f6f6';\nconst COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';\n// const COLOUR_SIDEBAR = '#303030';\nconst COLOUR_BRANDING_MAIN = '#FF6363';\n// const COLOUR_BRANDING_OFF = '#FCE1E1';\nconst COLOUR_BRANDING_LIGHT = '#FCE1E1';\n// const COLOUR_BRANDING_SECONDARY = COLOUR_BRANDING_MAIN;\nconst COLOUR_BRANDING_DARK = '#D13636';\n// const COLOUR_DAY = '#89c4f4';\n// const COLOUR_NIGHT = '#003159';\nconst COLOUR_TAN = '#fff3d1';\n\n// const hexToRGB = hex => {\n// // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n// const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n// hex = hex.replace(shorthandRegex, (m, r, g, b) => {\n// return r + r + g + g + b + b;\n// });\n\n// const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n// return result\n// ? {\n// r: parseInt(result[1], 16),\n// g: parseInt(result[2], 16),\n// b: parseInt(result[3], 16),\n// }\n// : null;\n// };\n\nconst hexToRGBAstring = (hex, opacity) => {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, (m, r, g, b) => {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacity})` : null;\n};\n\n// const pctBtwnColours = (c1, c2, percentage) => {\n// const rgbC1 = hexToRGB(c1);\n// const rgbC2 = hexToRGB(c2);\n// const r = rgbC2.r + (rgbC1.r - rgbC2.r) * percentage;\n// const g = rgbC2.g + (rgbC1.g - rgbC2.g) * percentage;\n// const b = rgbC2.b + (rgbC1.b - rgbC2.b) * percentage;\n// return `rgb(${r}, ${g}, ${b})`;\n// };\n\n// const getTabIconColour = (mainColour, footerType, selected) => {\n// if (footerType !== 'white') {\n// return '#fff';\n// }\n// if (selected) {\n// return mainColour;\n// }\n// return TEXT_BLUEGREY;\n// };\n\n// const getHeaderBrandingColourFromState = state => {\n// return (state && state.user && state.user.siteBranding && state.user.siteBranding.HeaderBrandingColour) || null;\n// };\n\nconst getMainBrandingColourFromState = state => {\n return (state && state.user && state.user.siteBranding && state.user.siteBranding.MainBrandingColour) || COLOUR_BRANDING_MAIN;\n};\n\nconst getDarkBrandingColourFromState = state => {\n return (state && state.user && state.user.siteBranding && state.user.siteBranding.DarkBrandingColour) || COLOUR_BRANDING_DARK;\n};\n\nconst getLightBrandingColourFromState = state => {\n return (state && state.user && state.user.siteBranding && state.user.siteBranding.LightBrandingColour) || COLOUR_BRANDING_LIGHT;\n};\n\n// const getSecondaryBrandingColourFromState = state => {\n// return (state && state.user && state.user.siteBranding && state.user.siteBranding.SecondaryBrandingColour) || COLOUR_BRANDING_SECONDARY;\n// };\n\n// const getMainBrandingColourFromSite = site => {\n// return (site.Branding && site.Branding.MainBrandingColour) || COLOUR_BRANDING_MAIN;\n// };\n\n// const getDarkBrandingColourFromSite = site => {\n// return (site.Branding && site.Branding.DarkBrandingColour) || COLOUR_BRANDING_DARK;\n// };\n\n// const getLightBrandingColourFromSite = site => {\n// return (site.Branding && site.Branding.LightBrandingColour) || COLOUR_BRANDING_LIGHT;\n// };\n\nexport {\n // COLOUR_1,\n // COLOUR_2,\n // COLOUR_3,\n TEXT_DARKEST,\n TEXT_BLUEGREY,\n TEXT_DARK,\n // TEXT_DARK_ALPHA50,\n // TEXT_DARK_ALPHA20,\n // TEXT_DARK_ALPHA10,\n TEXT_MID,\n // TEXT_MID_ALPHA50,\n TEXT_LIGHT,\n TEXT_LIGHTER,\n TEXT_SUPER_LIGHT,\n BG_GREY,\n LINEGREY,\n PINKISH_GREY,\n BOXGREY,\n // PALE_GREY,\n INACTIVE_BUTTON,\n INACTIVE_TEXT,\n COLOUR_TEAL,\n // COLOUR_TEAL_ALPHA50,\n // COLOUR_BLUE,\n // COLOUR_BLUE_LIVE,\n // COLOUR_BLUE_ALPHA10,\n // COLOUR_DARKBLUE,\n // COLOUR_PURPLE,\n COLOUR_RED,\n COLOUR_TANGERINE,\n // COLOUR_CITRON,\n // DARK_OVERLAY,\n // hexToRGB,\n hexToRGBAstring,\n // pctBtwnColours,\n // FACEBOOK_BLUE,\n // COLOUR_NAV_GREY,\n COLOUR_TRANSPARENT,\n // COLOUR_SIDEBAR,\n COLOUR_BRANDING_MAIN,\n // COLOUR_BRANDING_OFF,\n COLOUR_BRANDING_LIGHT,\n COLOUR_BRANDING_DARK,\n COLOUR_GREEN,\n COLOUR_GREEN_LIGHT,\n COLOUR_GRAPEFRUIT,\n // COLOUR_DAY,\n // COLOUR_NIGHT,\n COLOUR_TAN,\n // getHeaderBrandingColourFromState,\n getMainBrandingColourFromState,\n getDarkBrandingColourFromState,\n getLightBrandingColourFromState,\n // getSecondaryBrandingColourFromState,\n // getMainBrandingColourFromSite,\n // getDarkBrandingColourFromSite,\n // getLightBrandingColourFromSite,\n // getTabIconColour,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,SAAS;AAC9B,MAAMC,SAAS,GAAGD,YAAY;AAC9B,MAAME,aAAa,GAAG,SAAS;AAC/B;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,SAAS;AAC1B;AACA,MAAMC,UAAU,GAAG,SAAS;AAC5B,MAAMC,YAAY,GAAG,0BAA0B;AAC/C,MAAMC,gBAAgB,GAAG,SAAS;AAClC,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,QAAQ,GAAG,SAAS;AAC1B,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,YAAY,GAAG,SAAS;AAC9B;AACA,MAAMC,eAAe,GAAG,SAAS;AACjC,MAAMC,aAAa,GAAG,0BAA0B;AAChD,MAAMC,WAAW,GAAG,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG,SAAS;AAC5B,MAAMC,iBAAiB,GAAG,SAAS;AACnC,MAAMC,YAAY,GAAG,SAAS;AAC9B,MAAMC,kBAAkB,GAAG,SAAS;AACpC,MAAMC,gBAAgB,GAAG,SAAS;AAClC;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,eAAe;AAC1C;AACA,MAAMC,oBAAoB,GAAG,SAAS;AACtC;AACA,MAAMC,qBAAqB,GAAG,SAAS;AACvC;AACA,MA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ACC,IAAI,CAACC,YAAY,CAACG,kBAAkB,IAAKpB,oBAAoB;AAC/H,CAAC;AAED,MAAMqB,+BAA+B,GAAGN,KAAK,IAAI;EAC/C,OAAQA,KAAK,IAAIA,KAAK,CAACC,IAAI,IAAID,KAAK,CAACC,IAAI,CAACC,YAAY,IAAIF,KAAK,CAACC,IAAI,CAACC,YAAY,CAACK,mBAAmB,IAAKvB,qBAAqB;AACjI,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACE;AACA;AACA;AACArB,YAAY,EACZE,aAAa,EACbD,SAAS;AACT;AACA;AACA;AACAE,QAAQ;AACR;AACAC,UAAU,EACVC,YAAY,EACZC,gBAAgB,EAChBC,OAAO,EACPC,QAAQ,EACRE,YAAY,EACZD,OAAO;AACP;AACAE,eAAe,EACfC,aAAa,EACbC,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACAC,UAAU,EACVI,gBAAgB;AAChB;AACA;AACA;AACAM,eAAe;AACf;AACA;AACA;AACAL,kBAAkB;AAClB;AACAC,oBAAoB;AACpB;AACAC,qBAAqB,EACrBC,oBAAoB,EACpBN,YAAY,EACZC,kBAAkB,EAClBF,iBAAiB;AACjB;AACA;AACAQ,UAAU;AACV;AACAa,8BAA8B,EAC9BK,8BAA8B,EAC9BE;AACA;AACA;AACA;AACA;AACA;AAAA"}
@@ -0,0 +1,43 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { TouchableOpacity } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import Styles from '../styles';
5
+ import { Pl60Icon } from '../fonts';
6
+ import { getMainBrandingColourFromState } from '../colours';
7
+
8
+ /*
9
+ Props-
10
+ onPress - onPress action
11
+ diameter - size of button
12
+ iconSize - size of inner plus
13
+ color - default will be aveoMain
14
+ */
15
+
16
+ class AddButton extends PureComponent {
17
+ render() {
18
+ const size = this.props.diameter || 48;
19
+ const radius = size / 2;
20
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
21
+ style: [Styles.addButton, {
22
+ height: size,
23
+ width: size,
24
+ borderRadius: radius,
25
+ backgroundColor: this.props.colourBrandingMain
26
+ }, this.props.color && {
27
+ backgroundColor: this.props.color
28
+ }, this.props.style],
29
+ onPress: this.props.onPress
30
+ }, /*#__PURE__*/React.createElement(Pl60Icon, {
31
+ name: "pluss",
32
+ style: Styles.addButtonIcon
33
+ }));
34
+ }
35
+ }
36
+ const mapStateToProps = state => {
37
+ return {
38
+ colourBrandingMain: getMainBrandingColourFromState(state)
39
+ };
40
+ };
41
+ const addButton = connect(mapStateToProps, {})(AddButton);
42
+ export { addButton as AddButton };
43
+ //# sourceMappingURL=AddButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","PureComponent","TouchableOpacity","connect","Styles","Pl60Icon","getMainBrandingColourFromState","AddButton","render","size","props","diameter","radius","createElement","style","addButton","height","width","borderRadius","backgroundColor","colourBrandingMain","color","onPress","name","addButtonIcon","mapStateToProps","state"],"sources":["AddButton.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\nimport Styles from '../styles';\nimport { Pl60Icon } from '../fonts';\nimport { getMainBrandingColourFromState } from '../colours';\n\n/* \nProps- \n onPress - onPress action\n diameter - size of button\n iconSize - size of inner plus\n color - default will be aveoMain\n*/\n\nclass AddButton extends PureComponent {\n render() {\n const size = this.props.diameter || 48;\n const radius = size / 2;\n return (\n <TouchableOpacity\n style={[\n Styles.addButton,\n { height: size, width: size, borderRadius: radius, backgroundColor: this.props.colourBrandingMain },\n this.props.color && { backgroundColor: this.props.color },\n this.props.style,\n ]}\n onPress={this.props.onPress}\n >\n <Pl60Icon name=\"pluss\" style={Styles.addButtonIcon} />\n </TouchableOpacity>\n );\n }\n}\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst addButton = connect(mapStateToProps, {})(AddButton);\nexport { addButton as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IR,SAAS"}
@@ -0,0 +1,225 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ import React, { Component } from 'react';
6
+ import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
7
+ import { connect } from 'react-redux';
8
+ import _ from 'lodash';
9
+ import * as Calendar from 'expo-calendar';
10
+ import { TEXT_DARK, getMainBrandingColourFromState } from '../colours';
11
+ import { InlineButton } from './InlineButton';
12
+ import { Popup } from './Popup';
13
+ import { MiddlePopup } from './MiddlePopup';
14
+ const DEFAULT_TITLE = 'Add to Calendar';
15
+ const ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';
16
+
17
+ // Required: eventToAdd
18
+ // Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event
19
+ class AddToCalendarButton extends Component {
20
+ constructor(props) {
21
+ super(props);
22
+ _defineProperty(this, "showWarningPopup", () => {
23
+ if (Platform.OS !== 'ios') return;
24
+ this.setState({
25
+ showPermissionWarning: true
26
+ });
27
+ });
28
+ _defineProperty(this, "closeWarningPopup", () => {
29
+ this.setState({
30
+ showPermissionWarning: false
31
+ });
32
+ });
33
+ _defineProperty(this, "goToPermissionSettings", () => {
34
+ Linking.openURL('app-settings:');
35
+ this.setState({
36
+ showPermissionWarning: false
37
+ });
38
+ });
39
+ _defineProperty(this, "onAdd", async () => {
40
+ if (!this.props.eventToAdd) {
41
+ this.setState({
42
+ message: 'There is no event to add'
43
+ });
44
+ return;
45
+ }
46
+ const {
47
+ status
48
+ } = await Calendar.requestCalendarPermissionsAsync();
49
+ if (status !== 'granted') {
50
+ this.showWarningPopup();
51
+ } else {
52
+ let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);
53
+ // console.log('all calendars', calendars);
54
+ if (calendars && calendars.length > 0) {
55
+ calendars = calendars.filter(c => c.allowsModifications).map(c => {
56
+ return {
57
+ id: c.id,
58
+ title: c.title,
59
+ source: c.source.name,
60
+ color: c.color,
61
+ type: c.type
62
+ };
63
+ });
64
+ calendars = _.orderBy(calendars, ['source', 'title']);
65
+ // console.log('sorted calendars', calendars);
66
+ }
67
+
68
+ this.setState({
69
+ calendars
70
+ });
71
+ }
72
+ });
73
+ _defineProperty(this, "onCloseCalendars", () => {
74
+ this.setState({
75
+ calendars: null
76
+ });
77
+ });
78
+ _defineProperty(this, "onSelectCalendar", async calendar => {
79
+ try {
80
+ const {
81
+ eventToAdd
82
+ } = this.props;
83
+ if (!eventToAdd) return;
84
+ const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);
85
+ this.setState({
86
+ calendars: null,
87
+ message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD
88
+ });
89
+ } catch (error) {
90
+ console.log('onSelectCalendar', error);
91
+ this.setState({
92
+ calendars: null,
93
+ message: ERROR_EVENT_ADD
94
+ });
95
+ }
96
+ });
97
+ _defineProperty(this, "onCloseMessage", () => {
98
+ this.setState({
99
+ message: null
100
+ });
101
+ });
102
+ this.state = {
103
+ showPermissionWarning: false,
104
+ calendars: null,
105
+ message: null
106
+ };
107
+ }
108
+ renderPermission() {
109
+ return /*#__PURE__*/React.createElement(Popup, {
110
+ title: "Permissions missing",
111
+ text: "You must grant access to the Calendars. Tap Go to settings to change your permission settings.",
112
+ options: [{
113
+ text: 'Go to settings',
114
+ action: this.goToPermissionSettings,
115
+ bold: true
116
+ }, {
117
+ text: 'Ignore',
118
+ action: this.closeWarningPopup
119
+ }]
120
+ });
121
+ }
122
+ renderCalendars(calendars) {
123
+ return /*#__PURE__*/React.createElement(MiddlePopup, {
124
+ style: [styles.calendarsPopup, {
125
+ height: calendars.length * 60 + 120
126
+ }],
127
+ onClose: this.onCloseCalendars
128
+ }, /*#__PURE__*/React.createElement(Text, {
129
+ style: styles.calendarPopupTitle
130
+ }, "Select Calendar"), /*#__PURE__*/React.createElement(View, {
131
+ style: styles.calendarPopupContainer
132
+ }, /*#__PURE__*/React.createElement(ScrollView, {
133
+ style: {
134
+ flex: 1
135
+ },
136
+ showsVerticalScrollIndicator: false
137
+ }, calendars.map(cal => {
138
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
139
+ key: cal.id,
140
+ onPress: () => this.onSelectCalendar(cal)
141
+ }, /*#__PURE__*/React.createElement(View, {
142
+ style: [styles.calendarContainer, {
143
+ backgroundColor: cal.color
144
+ }]
145
+ }, /*#__PURE__*/React.createElement(Text, {
146
+ style: styles.calendarText
147
+ }, `${cal.source}${cal.source === cal.title ? '' : `\n${cal.title}`}`)));
148
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
149
+ key: 'cancel',
150
+ onPress: this.onCloseCalendars
151
+ }, /*#__PURE__*/React.createElement(View, {
152
+ style: [styles.calendarContainer, {
153
+ marginTop: 20,
154
+ backgroundColor: this.props.colourBrandingMain
155
+ }]
156
+ }, /*#__PURE__*/React.createElement(Text, {
157
+ style: styles.calendarText
158
+ }, "Cancel")))));
159
+ }
160
+ renderMessage(message) {
161
+ return /*#__PURE__*/React.createElement(Popup, {
162
+ title: "Add to Calendar",
163
+ text: message,
164
+ options: [{
165
+ text: 'Ok',
166
+ action: this.onCloseMessage
167
+ }]
168
+ });
169
+ }
170
+ render() {
171
+ const {
172
+ showPermissionWarning,
173
+ calendars,
174
+ message
175
+ } = this.state;
176
+ if (showPermissionWarning) return this.renderPermission();
177
+ if (calendars && calendars.length > 0) return this.renderCalendars(calendars);
178
+ if (message) return this.renderMessage(message);
179
+ return /*#__PURE__*/React.createElement(InlineButton, _extends({}, this.props, {
180
+ onPress: this.onAdd
181
+ }), this.props.children || DEFAULT_TITLE);
182
+ }
183
+ }
184
+ const styles = StyleSheet.create({
185
+ calendarsPopup: {
186
+ width: 250,
187
+ maxHeight: 400,
188
+ padding: 16,
189
+ borderRadius: 12
190
+ },
191
+ calendarPopupTitle: {
192
+ fontFamily: 'sf-bold',
193
+ color: TEXT_DARK,
194
+ fontSize: 18,
195
+ marginBottom: 16
196
+ },
197
+ calendarPopupContainer: {
198
+ flex: 1,
199
+ justifyContent: 'space-between'
200
+ },
201
+ calendarContainer: {
202
+ flexDirection: 'row',
203
+ alignItems: 'center',
204
+ width: 200,
205
+ height: 40,
206
+ paddingHorizontal: 8,
207
+ borderRadius: 4,
208
+ marginBottom: 10
209
+ },
210
+ calendarText: {
211
+ color: '#fff',
212
+ textAlign: 'center',
213
+ fontFamily: 'sf-semibold',
214
+ fontSize: 13,
215
+ flex: 1
216
+ }
217
+ });
218
+ const mapStateToProps = state => {
219
+ return {
220
+ colourBrandingMain: getMainBrandingColourFromState(state)
221
+ };
222
+ };
223
+ const button = connect(mapStateToProps, {})(AddToCalendarButton);
224
+ export { button as AddToCalendarButton };
225
+ //# sourceMappingURL=AddToCalendarButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Component","Platform","Linking","StyleSheet","Text","View","TouchableOpacity","ScrollView","connect","_","Calendar","TEXT_DARK","getMainBrandingColourFromState","InlineButton","Popup","MiddlePopup","DEFAULT_TITLE","ERROR_EVENT_ADD","AddToCalendarButton","constructor","props","_defineProperty","OS","setState","showPermissionWarning","openURL","eventToAdd","message","status","requestCalendarPermissionsAsync","showWarningPopup","calendars","getCalendarsAsync","EntityTypes","EVENT","length","filter","c","allowsModifications","map","id","title","source","name","color","type","orderBy","calendar","eventId","createEventAsync","error","console","log","state","renderPermission","createElement","text","options","action","goToPermissionSettings","bold","closeWarningPopup","renderCalendars","style","styles","calendarsPopup","height","onClose","onCloseCalendars","calendarPopupTitle","calendarPopupContainer","flex","showsVerticalScrollIndicator","cal","key","onPress","onSelectCalendar","calendarContainer","backgroundColor","calendarText","marginTop","colourBrandingMain","renderMessage","onCloseMessage","render","_extends","onAdd","children","create","width","maxHeight","padding","borderRadius","fontFamily","fontSize","marginBottom","justifyContent","flexDirection","alignItems","paddingHorizontal","textAlign","mapStateToProps","button"],"sources":["AddToCalendarButton.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport * as Calendar from 'expo-calendar';\nimport { TEXT_DARK, getMainBrandingColourFromState } from '../colours';\nimport { InlineButton } from './InlineButton';\nimport { Popup } from './Popup';\nimport { MiddlePopup } from './MiddlePopup';\n\nconst DEFAULT_TITLE = 'Add to Calendar';\nconst ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';\n\n// Required: eventToAdd\n// Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event\nclass AddToCalendarButton extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showPermissionWarning: false,\n calendars: null,\n message: null,\n };\n }\n\n showWarningPopup = () => {\n if (Platform.OS !== 'ios') return;\n this.setState({ showPermissionWarning: true });\n };\n\n closeWarningPopup = () => {\n this.setState({ showPermissionWarning: false });\n };\n\n goToPermissionSettings = () => {\n Linking.openURL('app-settings:');\n this.setState({ showPermissionWarning: false });\n };\n\n onAdd = async () => {\n if (!this.props.eventToAdd) {\n this.setState({ message: 'There is no event to add' });\n return;\n }\n\n const { status } = await Calendar.requestCalendarPermissionsAsync();\n if (status !== 'granted') {\n this.showWarningPopup();\n } else {\n let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);\n // console.log('all calendars', calendars);\n if (calendars && calendars.length > 0) {\n calendars = calendars\n .filter(c => c.allowsModifications)\n .map(c => {\n return {\n id: c.id,\n title: c.title,\n source: c.source.name,\n color: c.color,\n type: c.type,\n };\n });\n calendars = _.orderBy(calendars, ['source', 'title']);\n // console.log('sorted calendars', calendars);\n }\n this.setState({ calendars });\n }\n };\n\n onCloseCalendars = () => {\n this.setState({ calendars: null });\n };\n\n onSelectCalendar = async calendar => {\n try {\n const { eventToAdd } = this.props;\n if (!eventToAdd) return;\n\n const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);\n\n this.setState({\n calendars: null,\n message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD,\n });\n } catch (error) {\n console.log('onSelectCalendar', error);\n this.setState({ calendars: null, message: ERROR_EVENT_ADD });\n }\n };\n\n onCloseMessage = () => {\n this.setState({ message: null });\n };\n\n renderPermission() {\n return (\n <Popup\n title=\"Permissions missing\"\n text=\"You must grant access to the Calendars. Tap Go to settings to change your permission settings.\"\n options={[\n {\n text: 'Go to settings',\n action: this.goToPermissionSettings,\n bold: true,\n },\n {\n text: 'Ignore',\n action: this.closeWarningPopup,\n },\n ]}\n />\n );\n }\n\n renderCalendars(calendars) {\n return (\n <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 60 + 120 }]} onClose={this.onCloseCalendars}>\n <Text style={styles.calendarPopupTitle}>Select Calendar</Text>\n <View style={styles.calendarPopupContainer}>\n <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>\n {calendars.map(cal => {\n return (\n <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>\n <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>\n <Text style={styles.calendarText}>{`${cal.source}${cal.source === cal.title ? '' : `\\n${cal.title}`}`}</Text>\n </View>\n </TouchableOpacity>\n );\n })}\n </ScrollView>\n <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>\n <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>\n <Text style={styles.calendarText}>Cancel</Text>\n </View>\n </TouchableOpacity>\n </View>\n </MiddlePopup>\n );\n }\n\n renderMessage(message) {\n return (\n <Popup\n title=\"Add to Calendar\"\n text={message}\n options={[\n {\n text: 'Ok',\n action: this.onCloseMessage,\n },\n ]}\n />\n );\n }\n\n render() {\n const { showPermissionWarning, calendars, message } = this.state;\n\n if (showPermissionWarning) return this.renderPermission();\n if (calendars && calendars.length > 0) return this.renderCalendars(calendars);\n if (message) return this.renderMessage(message);\n\n return (\n <InlineButton {...this.props} onPress={this.onAdd}>\n {this.props.children || DEFAULT_TITLE}\n </InlineButton>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n calendarsPopup: {\n width: 250,\n maxHeight: 400,\n padding: 16,\n borderRadius: 12,\n },\n calendarPopupTitle: {\n fontFamily: 'sf-bold',\n color: TEXT_DARK,\n fontSize: 18,\n marginBottom: 16,\n },\n calendarPopupContainer: {\n flex: 1,\n justifyContent: 'space-between',\n },\n calendarContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: 200,\n height: 40,\n paddingHorizontal: 8,\n borderRadius: 4,\n marginBottom: 10,\n },\n calendarText: {\n color: '#fff',\n textAlign: 'center',\n fontFamily: 'sf-semibold',\n fontSize: 13,\n flex: 1,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst button = connect(mapStateToProps, {})(AddToCalendarButton);\nexport { button as AddToCalendarButton };\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AACtG,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,OAAO,KAA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YAAY,EAAE;EAChB,CAAC;EACDhB,YAAY,EAAE;IACZnC,KAAK,EAAE,MAAM;IACbwD,SAAS,EAAE,QAAQ;IACnBP,UAAU,EAAE,aAAa;IACzBC,QAAQ,EAAE,EAAE;IACZvB,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAEF,MAAM8B,eAAe,GAAGhD,KAAK,IAAI;EAC/B,OAAO;IACL4B,kBAAkB,EAAErE,8BAA8B,CAACyC,KAAK;EAC1D,CAAC;AACH,CAAC;AAED,MAAMiD,MAAM,GAAG9F,OAAO,CAAC6F,eAAe,EAAE,CAAC,CAAC,CAAC,CAACnF,mBAAmB,CAAC;AAChE,SAASoF,MAAM,IAAIpF,mBAAmB"}
@@ -0,0 +1,54 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { TouchableOpacity, View, Text } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import { Icon } from 'react-native-elements';
5
+ import { getLightBrandingColourFromState, getMainBrandingColourFromState } from '../colours';
6
+ class Attachment extends PureComponent {
7
+ render() {
8
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
9
+ key: this.props.key,
10
+ onPress: this.props.onPress
11
+ }, /*#__PURE__*/React.createElement(View, {
12
+ style: [styles.pdfAttachment, {
13
+ backgroundColor: this.props.colourBrandingLight
14
+ }]
15
+ }, /*#__PURE__*/React.createElement(Icon, {
16
+ name: "paperclip",
17
+ type: "font-awesome",
18
+ iconStyle: [styles.pdfAttachmentIcon, {
19
+ color: this.props.colourBrandingMain
20
+ }]
21
+ }), /*#__PURE__*/React.createElement(Text, {
22
+ style: [styles.pdfAttachmentText, {
23
+ color: this.props.colourBrandingMain
24
+ }]
25
+ }, this.props.title)));
26
+ }
27
+ }
28
+ const styles = {
29
+ pdfAttachment: {
30
+ padding: 4,
31
+ flexDirection: 'row',
32
+ borderRadius: 2,
33
+ marginTop: 8,
34
+ alignItems: 'center',
35
+ alignSelf: 'flex-start'
36
+ },
37
+ pdfAttachmentIcon: {
38
+ fontSize: 16,
39
+ marginRight: 4
40
+ },
41
+ pdfAttachmentText: {
42
+ fontFamily: 'sf-semibold',
43
+ fontSize: 13
44
+ }
45
+ };
46
+ const mapStateToProps = state => {
47
+ return {
48
+ colourBrandingMain: getMainBrandingColourFromState(state),
49
+ colourBrandingLight: getLightBrandingColourFromState(state)
50
+ };
51
+ };
52
+ const attachment = connect(mapStateToProps, {})(Attachment);
53
+ export { attachment as Attachment };
54
+ //# sourceMappingURL=Attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","PureComponent","TouchableOpacity","View","Text","connect","Icon","getLightBrandingColourFromState","getMainBrandingColourFromState","Attachment","render","createElement","key","props","onPress","style","styles","pdfAttachment","backgroundColor","colourBrandingLight","name","type","iconStyle","pdfAttachmentIcon","color","colourBrandingMain","pdfAttachmentText","title","padding","flexDirection","borderRadius","marginTop","alignItems","alignSelf","fontSize","marginRight","fontFamily","mapStateToProps","state","attachment"],"sources":["Attachment.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { TouchableOpacity, View, Text } from 'react-native';\nimport { connect } from 'react-redux';\nimport { Icon } from 'react-native-elements';\nimport { getLightBrandingColourFromState, getMainBrandingColourFromState } from '../colours';\n\nclass Attachment extends PureComponent {\n render() {\n return (\n <TouchableOpacity key={this.props.key} onPress={this.props.onPress}>\n <View style={[styles.pdfAttachment, { backgroundColor: this.props.colourBrandingLight }]}>\n <Icon name=\"paperclip\" type=\"font-awesome\" iconStyle={[styles.pdfAttachmentIcon, { color: this.props.colourBrandingMain }]} />\n <Text style={[styles.pdfAttachmentText, { color: this.props.colourBrandingMain }]}>{this.props.title}</Text>\n </View>\n </TouchableOpacity>\n );\n }\n}\n\nconst styles = {\n pdfAttachment: {\n padding: 4,\n flexDirection: 'row',\n borderRadius: 2,\n marginTop: 8,\n alignItems: 'center',\n alignSelf: 'flex-start',\n },\n pdfAttachmentIcon: {\n fontSize: 16,\n marginRight: 4,\n },\n pdfAttachmentText: {\n fontFamily: 'sf-semibold',\n fontSize: 13,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n colourBrandingLight: getLightBrandingColourFromState(state),\n };\n};\n\nconst attachment = connect(mapStateToProps, {})(Attachment);\nexport { attachment as Attachment };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAC3D,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,+BAA+B,EAAEC,8BAA8B,QAAQ,YAAY;AAE5F,MAAMC,UAAU,SAASR,aAAa,CAAC;EACrCS,MAAMA,CAAA,EAAG;IACP,oBACEV,KAAA,CAAAW,aAAA,CAACT,gBAAgB;MAACU,GAAG,EAAE,IAAI,CAACC,KAAK,CAACD,GAAI;MAACE,OAAO,EAAE,IAAI,CAACD,KAAK,CAACC;IAAQ,gBACjEd,KAAA,CAAAW,aAAA,CAACR,IAAI;MAACY,KAAK,EAAE,CAACC,MAAM,CAACC,aAAa,EAAE;QAAEC,eAAe,EAAE,IAAI,CAACL,KAAK,CAACM;MAAoB,CAAC;IAAE,gBACvFnB,KAAA,CAAAW,aAAA,CAACL,IAAI;MAACc,IAAI,EAAC,WAAW;MAACC,IAAI,EAAC,cAAc;MAACC,SAAS,EAAE,CAACN,MAAM,CAACO,iBAAiB,EAAE;QAAEC,KAAK,EAAE,IAAI,CAACX,KAAK,CAACY;MAAmB,CAAC;IAAE,CAAE,CAAC,eAC9HzB,KAAA,CAAAW,aAAA,CAACP,IAAI;MAACW,KAAK,EAAE,CAACC,MAAM,CAACU,iBAAiB,EAAE;QAAEF,KAAK,EAAE,IAAI,CAACX,KAAK,CAACY;MAAmB,CAAC;IAAE,GAAE,IAAI,CAACZ,KAAK,CAACc,KAAY,CACvG,CACU,CAAC;EAEvB;AACF;AAEA,MAAMX,MAAM,GAAG;EACbC,aAAa,EAAE;IACbW,OAAO,EAAE,CAAC;IACVC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,UAAU,EAAE,QAAQ;IACpBC,SAAS,EAAE;EACb,CAAC;EACDV,iBAAiB,EAAE;IACjBW,QAAQ,EAAE,EAAE;IACZC,WAAW,EAAE;EACf,CAAC;EACDT,iBAAiB,EAAE;IACjBU,UAAU,EAAE,aAAa;IACzBF,QAAQ,EAAE;EACZ;AACF,CAAC;AAED,MAAMG,eAAe,GAAGC,KAAK,IAAI;EAC/B,OAAO;IACLb,kBAAkB,EAAEjB,8BAA8B,CAAC8B,KAAK,CAAC;IACzDnB,mBAAmB,EAAEZ,+BAA+B,CAAC+B,KAAK;EAC5D,CAAC;AACH,CAAC;AAED,MAAMC,UAAU,GAAGlC,OAAO,CAACgC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC5B,UAAU,CAAC;AAC3D,SAAS8B,UAAU,IAAI9B,UAAU"}
@@ -0,0 +1,64 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import React, { PureComponent } from 'react';
5
+ import { StyleSheet } from 'react-native';
6
+ import { connect } from 'react-redux';
7
+ import { FormCardSectionOptionLauncher } from './FormCardSectionOptionLauncher';
8
+ import { getMainBrandingColourFromState, TEXT_DARK } from '../colours';
9
+ import { Services } from '../config';
10
+ class AudienceSelectorLauncher extends PureComponent {
11
+ constructor(...args) {
12
+ super(...args);
13
+ _defineProperty(this, "onPressAudience", () => {
14
+ const {
15
+ user,
16
+ audienceType,
17
+ audienceTypeSelection
18
+ } = this.props;
19
+ Services.navigation.navigate('audienceSelectorPage', {
20
+ site: user.site,
21
+ audienceType: audienceType || 'Custom',
22
+ audienceTypeSelection: audienceTypeSelection || [],
23
+ onChange: (audienceType, audienceTypeSelection) => {
24
+ if (this.props.onChange) this.props.onChange(audienceType, audienceTypeSelection);
25
+ }
26
+ });
27
+ });
28
+ }
29
+ render() {
30
+ const {
31
+ style,
32
+ textStyle,
33
+ audienceTypeSelection
34
+ } = this.props;
35
+ const selected = audienceTypeSelection && audienceTypeSelection.length > 0 ? `Current selection: ${audienceTypeSelection.map(i => i.Title).join(', ')}` : '';
36
+ return /*#__PURE__*/React.createElement(FormCardSectionOptionLauncher, {
37
+ sectionStyle: [styles.audienceSection, style],
38
+ textStyle: [styles.audienceText, textStyle],
39
+ onPress: this.onPressAudience,
40
+ title: "Audience",
41
+ description: selected,
42
+ value: selected ? 'Custom' : 'All Users'
43
+ });
44
+ }
45
+ }
46
+ const styles = StyleSheet.create({
47
+ audienceSection: {
48
+ paddingHorizontal: 0
49
+ },
50
+ audienceText: {
51
+ fontFamily: 'sf-semibold',
52
+ fontSize: 16,
53
+ color: TEXT_DARK
54
+ }
55
+ });
56
+ const mapStateToProps = state => {
57
+ return {
58
+ user: state.user,
59
+ colourBrandingMain: getMainBrandingColourFromState(state)
60
+ };
61
+ };
62
+ const audienceSelectorLauncher = connect(mapStateToProps, {})(AudienceSelectorLauncher);
63
+ export { audienceSelectorLauncher as AudienceSelectorLauncher };
64
+ //# sourceMappingURL=AudienceSelectorLauncher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","PureComponent","StyleSheet","connect","FormCardSectionOptionLauncher","getMainBrandingColourFromState","TEXT_DARK","Services","AudienceSelectorLauncher","constructor","args","_defineProperty","user","audienceType","audienceTypeSelection","props","navigation","navigate","site","onChange","render","style","textStyle","selected","length","map","i","Title","join","createElement","sectionStyle","styles","audienceSection","audienceText","onPress","onPressAudience","title","description","value","create","paddingHorizontal","fontFamily","fontSize","color","mapStateToProps","state","colourBrandingMain","audienceSelectorLauncher"],"sources":["AudienceSelectorLauncher.js"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport { FormCardSectionOptionLauncher } from './FormCardSectionOptionLauncher';\nimport { getMainBrandingColourFromState, TEXT_DARK } from '../colours';\nimport { Services } from '../config';\n\nclass AudienceSelectorLauncher extends PureComponent {\n onPressAudience = () => {\n const { user, audienceType, audienceTypeSelection } = this.props;\n\n Services.navigation.navigate('audienceSelectorPage', {\n site: user.site,\n audienceType: audienceType || 'Custom',\n audienceTypeSelection: audienceTypeSelection || [],\n onChange: (audienceType, audienceTypeSelection) => {\n if (this.props.onChange) this.props.onChange(audienceType, audienceTypeSelection);\n },\n });\n };\n\n render() {\n const { style, textStyle, audienceTypeSelection } = this.props;\n const selected =\n audienceTypeSelection && audienceTypeSelection.length > 0\n ? `Current selection: ${audienceTypeSelection.map(i => i.Title).join(', ')}`\n : '';\n\n return (\n <FormCardSectionOptionLauncher\n sectionStyle={[styles.audienceSection, style]}\n textStyle={[styles.audienceText, textStyle]}\n onPress={this.onPressAudience}\n title=\"Audience\"\n description={selected}\n value={selected ? 'Custom' : 'All Users'}\n />\n );\n }\n}\n\nconst styles = StyleSheet.create({\n audienceSection: {\n paddingHorizontal: 0,\n },\n audienceText: {\n fontFamily: 'sf-semibold',\n fontSize: 16,\n color: TEXT_DARK,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n user: state.user,\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst audienceSelectorLauncher = connect(mapStateToProps, {})(AudienceSelectorLauncher);\nexport { audienceSelectorLauncher as AudienceSelectorLauncher };\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,SAASC,UAAU,QAAQ,cAA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