@capillarytech/creatives-library 6.8.4 → 6.8.5

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 (53) hide show
  1. package/app.js +1 -0
  2. package/package.json +1 -1
  3. package/utils/tagValidations.js +137 -0
  4. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  5. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  6. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  7. package/v2Components/TemplatePreview/_templatePreview.scss +380 -380
  8. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  9. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  10. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  11. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  12. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  13. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  14. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  15. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  16. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  17. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  18. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  19. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  20. package/v2Containers/CreativesContainer/actions.js +27 -27
  21. package/v2Containers/CreativesContainer/constants.js +17 -17
  22. package/v2Containers/CreativesContainer/index.scss +44 -44
  23. package/v2Containers/CreativesContainer/messages.js +305 -305
  24. package/v2Containers/CreativesContainer/reducer.js +29 -29
  25. package/v2Containers/CreativesContainer/sagas.js +11 -11
  26. package/v2Containers/CreativesContainer/selectors.js +30 -30
  27. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  28. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  29. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  30. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  31. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  32. package/v2Containers/Line/Container/Text/index.js +19 -4
  33. package/v2Containers/Line/Container/Text/messages.js +4 -0
  34. package/v2Containers/Templates/_templates.scss +405 -405
  35. package/v2Containers/Templates/actions.js +117 -117
  36. package/v2Containers/Templates/constants.js +47 -47
  37. package/v2Containers/Templates/reducer.js +145 -145
  38. package/v2Containers/Templates/sagas.js +179 -179
  39. package/v2Containers/Templates/tests/actions.test.js +18 -18
  40. package/v2Containers/Templates/tests/index.test.js +10 -10
  41. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  42. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  43. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  44. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  45. package/v2Containers/TemplatesV2/actions.js +16 -16
  46. package/v2Containers/TemplatesV2/constants.js +10 -10
  47. package/v2Containers/TemplatesV2/messages.js +61 -61
  48. package/v2Containers/TemplatesV2/selectors.js +25 -25
  49. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  50. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  51. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  52. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  53. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
package/app.js CHANGED
@@ -76,6 +76,7 @@ Bugsnag.start({
76
76
  // eslint-disable-next-line no-undef
77
77
  apiKey: BUGSNAG_API_KEY,
78
78
  releaseStage: window.location.hostname,
79
+ enabledReleaseStages: ['production', 'staging'],
79
80
  plugins: [new BugsnagPluginReact()],
80
81
  onError: bugSnagErrorCallback,
81
82
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.8.4",
4
+ "version": "6.8.5",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,137 @@
1
+ /*
2
+ * This file is to maintain the tag validations
3
+ * across the forms used in creatives, very
4
+ * similar to the FormBuilder component.
5
+ * The motive is to chizzling out the dependency from
6
+ * FormBuilder component into meaningful blocks
7
+ */
8
+
9
+ import lodashForEach from 'lodash/forEach';
10
+ import lodashCloneDeep from 'lodash/cloneDeep';
11
+
12
+ const DEFAULT = 'default';
13
+ const SUBTAGS = 'subtags';
14
+
15
+ export const validateTags = ({
16
+ content,
17
+ tagsParam,
18
+ injectedTagsParams,
19
+ location,
20
+ tagModule,
21
+ }) => {
22
+ const tags = tagsParam;
23
+ const injectedTags = transformInjectedTags(injectedTagsParams);
24
+ let currentModule = location.query.module ? location.query.module : DEFAULT;
25
+ if (tagModule) {
26
+ currentModule = tagModule;
27
+ }
28
+ const response = {
29
+ valid: true,
30
+ missingTags: [],
31
+ unsupportedTags: [],
32
+ };
33
+ if(tags && tags.length) {
34
+ lodashForEach(tags, ({
35
+ definition: {
36
+ supportedModules,
37
+ value,
38
+ },
39
+ }) => {
40
+ lodashForEach(supportedModules, (module) => {
41
+ if (module.mandatory && (currentModule === module.context)) {
42
+ if (content.indexOf(`{{${value}}}`) === -1) {
43
+ response.valid = false;
44
+ response.missingTags.push(value);
45
+ }
46
+ }
47
+ });
48
+ });
49
+ const regex = /{{[(A-Z\w+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g;
50
+ let match = regex.exec(content);
51
+ while (match !== null) {
52
+ const tagValue = match[0].substring(indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
53
+ match = regex.exec(content);
54
+ let ifSupported = false;
55
+ lodashForEach(tags, (tag) => {
56
+ if (tag.definition.value === tagValue) {
57
+ ifSupported = true;
58
+ }
59
+ });
60
+ const ifSkipped = skipTags(tagValue);
61
+ if (ifSkipped) {
62
+ ifSupported = true;
63
+ let isUnsubscribeSkipped = tagValue.indexOf("unsubscribe") != -1 ;
64
+ if (isUnsubscribeSkipped) {
65
+ const missingTagIndex = response.missingTags.indexOf("unsubscribe");
66
+ if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
67
+ response.missingTags.splice(missingTagIndex, 1);
68
+ }
69
+ }
70
+ }
71
+ ifSupported = ifSupported || checkIfSupportedTag(tagValue, injectedTags);
72
+ if (!ifSupported) {
73
+ response.unsupportedTags.push(tagValue);
74
+ response.valid = false;
75
+ }
76
+ if (response.unsupportedTags.length == 0 && response.missingTags.length == 0 ) {
77
+ response.valid = true;
78
+ }
79
+ }
80
+ }
81
+ return response;
82
+ }
83
+
84
+ const checkIfSupportedTag = (checkingTag, injectedTags) => {
85
+ let result = false;
86
+ lodashForEach(injectedTags, (tag, key) => {
87
+ if (tag.subtags && checkIfSupportedTag(checkingTag, tag.subtags)) {
88
+ result = true;
89
+ } else if (checkingTag === key) {
90
+ result = true;
91
+ }
92
+ });
93
+
94
+ return result;
95
+ }
96
+
97
+ const indexOfEnd = (targetString, string) => {
98
+ let io = targetString.indexOf(string);
99
+ return io == -1 ? -1 : io + string.length;
100
+ }
101
+
102
+ const skipTags = (tag) => {
103
+ const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN","^[A-Za-z].*\\([\\d]*\\)"];
104
+ let skipped = false;
105
+ lodashForEach(regexGroups, (group) => {
106
+ const groupRegex = new RegExp(group, "g");
107
+ let match = groupRegex.exec(tag);
108
+ if (match !== null ) {
109
+ skipped = true;
110
+ return true;
111
+ }
112
+ return true;
113
+ });
114
+ return skipped;
115
+ }
116
+
117
+ const transformInjectedTags = (tags) => {
118
+ lodashForEach(tags, (tag) => {
119
+ const temp = tag;
120
+ let subKey = '';
121
+ Object.keys(tag).map( (k) => {
122
+ if (k.indexOf(SUBTAGS) !== -1) {
123
+ subKey = k;
124
+ }
125
+ return true;
126
+ });
127
+ if (subKey !== '') {
128
+ temp['tag-header'] = true;
129
+ if (subKey !== SUBTAGS) {
130
+ temp.subtags =lodashCloneDeep(temp[subKey]);
131
+ delete temp[subKey];
132
+ }
133
+ temp.subtags = transformInjectedTags(temp.subtags);
134
+ }
135
+ });
136
+ return tags;
137
+ }
@@ -1,152 +1,152 @@
1
- @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
-
3
- .shell-lock-screen-android .main-screen-preview .wechatMsgContainer{
4
- position: absolute;
5
- left: 53.5%;
6
- top:28%;
7
- background: white;
8
- width: 19.5%;
9
- text-align: left;
10
- height: fit-content;
11
- border-radius: 0.285rem;
12
- }
13
-
14
- .shell-lock-screen-android .lock-screen-preview{
15
- .wechat-android-sender-id{
16
- position: absolute;
17
- top: 46%;
18
- font-size: 10px;
19
- left: 28%;
20
- }
21
- .wechat-android-title{
22
- position: absolute;
23
- top: 49%;
24
- font-size: 10px;
25
- left: 28%;
26
- color: #5e6c84;
27
- }
28
- .wechat-android-action-buttons{
29
- position: absolute;
30
- left: 28%;
31
- top: 53%;
32
- font-size: 10px;
33
- color: #3861ca;
34
- font-weight: 500;
35
- }
36
- .wechat-ios-sender-id{
37
- position: absolute;
38
- top: 44%;
39
- font-size: 10px;
40
- left: 28.5%;
41
- }
42
- .wechat-ios-title{
43
- position: absolute;
44
- top: 47%;
45
- font-size: 10px;
46
- left: 28.5%;
47
- color: #5e6c84;
48
- }
49
- .wechat-ios-action-reply{
50
- position: absolute;
51
- left: 35%;
52
- top: 59%;
53
- font-size: 12px;
54
- color: #3861ca;
55
- font-weight: 500;
56
- }
57
- .wechat-ios-action-cancel{
58
- position: absolute;
59
- left: 34.5%;
60
- top: 66%;
61
- font-size: 12px;
62
- color: #3861ca;
63
- font-weight: 500;
64
- }
65
- }
66
-
67
- .wechatMsgContainer{
68
- position: absolute;
69
- left: 30%;
70
- top: 20%;
71
- background: white;
72
- width: 40%;
73
- text-align: left;
74
- height: fit-content;
75
- border-radius: $CAP_SPACE_04;
76
- .richmedia-template {
77
- .richmedia-image-container {
78
- width: 100%;
79
- height: 102px;
80
- position: relative;
81
- img {
82
- border-top-left-radius: 4px;
83
- border-top-right-radius: 4px;
84
- }
85
- }
86
- .name-container-with-abstract {
87
- padding: $CAP_SPACE_12;
88
- height: 68px;
89
- }
90
- .name-container {
91
- position: absolute;
92
- bottom: 0px;
93
- height: 44px;
94
- padding-top: 16px;
95
- padding-left: 12px;
96
- color: $CAP_WHITE;
97
- opacity: 0.7;
98
- width: 100%;
99
- background-image: linear-gradient(to top,black 0% ,transparent 100%);
100
- }
101
- .additional-richmedia-container {
102
- display: flex;
103
- justify-content: space-between;
104
- margin: 8px;
105
- padding-bottom: 8px;
106
- img {
107
- border-radius: 4px;
108
- }
109
- }
110
- .additional-richmedia-container:not(:last-child) {
111
- border-bottom: 1px solid #dfe2e7;
112
- }
113
- div {
114
- text-overflow: ellipsis;
115
- overflow: hidden;
116
- white-space: nowrap;
117
- }
118
- }
119
- }
120
- .wechatMsgContainerOutbound{
121
- position: absolute;
122
- left: 35%;
123
- top: 20%;
124
- background: white;
125
- width: 30%;
126
- text-align: left;
127
- }
128
- .wechatMsgContainerCardLayout {
129
- position: absolute;
130
- left: 20%;
131
- top: 20%;
132
- background: white;
133
- width: 60%;
134
- text-align: left;
135
- }
136
- .overflow-handle-preview {
137
- overflow-y: auto;
138
- }
139
- .overflow-handle-preview-outbound {
140
- height: 330px;
141
- overflow-y: auto;
142
- }
143
- .preview-overflow-wrap-fields {
144
- text-overflow: ellipsis;
145
- overflow: hidden;
146
- overflow-wrap: break-word;
147
- display: -webkit-box !important;
148
- -webkit-box-orient: vertical;
149
- -webkit-line-clamp: 2;
150
- text-align: left;
151
- width: 200px;
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .shell-lock-screen-android .main-screen-preview .wechatMsgContainer{
4
+ position: absolute;
5
+ left: 53.5%;
6
+ top:28%;
7
+ background: white;
8
+ width: 19.5%;
9
+ text-align: left;
10
+ height: fit-content;
11
+ border-radius: 0.285rem;
12
+ }
13
+
14
+ .shell-lock-screen-android .lock-screen-preview{
15
+ .wechat-android-sender-id{
16
+ position: absolute;
17
+ top: 46%;
18
+ font-size: 10px;
19
+ left: 28%;
20
+ }
21
+ .wechat-android-title{
22
+ position: absolute;
23
+ top: 49%;
24
+ font-size: 10px;
25
+ left: 28%;
26
+ color: #5e6c84;
27
+ }
28
+ .wechat-android-action-buttons{
29
+ position: absolute;
30
+ left: 28%;
31
+ top: 53%;
32
+ font-size: 10px;
33
+ color: #3861ca;
34
+ font-weight: 500;
35
+ }
36
+ .wechat-ios-sender-id{
37
+ position: absolute;
38
+ top: 44%;
39
+ font-size: 10px;
40
+ left: 28.5%;
41
+ }
42
+ .wechat-ios-title{
43
+ position: absolute;
44
+ top: 47%;
45
+ font-size: 10px;
46
+ left: 28.5%;
47
+ color: #5e6c84;
48
+ }
49
+ .wechat-ios-action-reply{
50
+ position: absolute;
51
+ left: 35%;
52
+ top: 59%;
53
+ font-size: 12px;
54
+ color: #3861ca;
55
+ font-weight: 500;
56
+ }
57
+ .wechat-ios-action-cancel{
58
+ position: absolute;
59
+ left: 34.5%;
60
+ top: 66%;
61
+ font-size: 12px;
62
+ color: #3861ca;
63
+ font-weight: 500;
64
+ }
65
+ }
66
+
67
+ .wechatMsgContainer{
68
+ position: absolute;
69
+ left: 30%;
70
+ top: 20%;
71
+ background: white;
72
+ width: 40%;
73
+ text-align: left;
74
+ height: fit-content;
75
+ border-radius: $CAP_SPACE_04;
76
+ .richmedia-template {
77
+ .richmedia-image-container {
78
+ width: 100%;
79
+ height: 102px;
80
+ position: relative;
81
+ img {
82
+ border-top-left-radius: 4px;
83
+ border-top-right-radius: 4px;
84
+ }
85
+ }
86
+ .name-container-with-abstract {
87
+ padding: $CAP_SPACE_12;
88
+ height: 68px;
89
+ }
90
+ .name-container {
91
+ position: absolute;
92
+ bottom: 0px;
93
+ height: 44px;
94
+ padding-top: 16px;
95
+ padding-left: 12px;
96
+ color: $CAP_WHITE;
97
+ opacity: 0.7;
98
+ width: 100%;
99
+ background-image: linear-gradient(to top,black 0% ,transparent 100%);
100
+ }
101
+ .additional-richmedia-container {
102
+ display: flex;
103
+ justify-content: space-between;
104
+ margin: 8px;
105
+ padding-bottom: 8px;
106
+ img {
107
+ border-radius: 4px;
108
+ }
109
+ }
110
+ .additional-richmedia-container:not(:last-child) {
111
+ border-bottom: 1px solid #dfe2e7;
112
+ }
113
+ div {
114
+ text-overflow: ellipsis;
115
+ overflow: hidden;
116
+ white-space: nowrap;
117
+ }
118
+ }
119
+ }
120
+ .wechatMsgContainerOutbound{
121
+ position: absolute;
122
+ left: 35%;
123
+ top: 20%;
124
+ background: white;
125
+ width: 30%;
126
+ text-align: left;
127
+ }
128
+ .wechatMsgContainerCardLayout {
129
+ position: absolute;
130
+ left: 20%;
131
+ top: 20%;
132
+ background: white;
133
+ width: 60%;
134
+ text-align: left;
135
+ }
136
+ .overflow-handle-preview {
137
+ overflow-y: auto;
138
+ }
139
+ .overflow-handle-preview-outbound {
140
+ height: 330px;
141
+ overflow-y: auto;
142
+ }
143
+ .preview-overflow-wrap-fields {
144
+ text-overflow: ellipsis;
145
+ overflow: hidden;
146
+ overflow-wrap: break-word;
147
+ display: -webkit-box !important;
148
+ -webkit-box-orient: vertical;
149
+ -webkit-line-clamp: 2;
150
+ text-align: left;
151
+ width: 200px;
152
152
  }
@@ -1,33 +1,33 @@
1
- /*
2
- * WechatRichmediaTemplatePreview Messages
3
- *
4
- * This contains all the text for the WechatRichmediaTemplatePreview component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'creatives.components.WechatRichmediaTemplatePreview.header',
11
- defaultMessage: 'This is the WechatRichmediaTemplatePreview component !',
12
- },
13
- select: {
14
- id: 'creatives.components.WechatRichmediaTemplatePreview.select',
15
- defaultMessage: 'Select',
16
- },
17
- edit: {
18
- id: 'creatives.components.WechatRichmediaTemplatePreview.edit',
19
- defaultMessage: 'Edit',
20
- },
21
- MarkAsRead: {
22
- id: 'creatives.components.WechatRichmediaTemplatePreview.MarkAsRead',
23
- defaultMessage: 'Mark as read',
24
- },
25
- reply: {
26
- id: 'creatives.components.WechatRichmediaTemplatePreview.reply',
27
- defaultMessage: 'Reply',
28
- },
29
- cancel: {
30
- id: 'creatives.components.WechatRichmediaTemplatePreview.cancel',
31
- defaultMessage: 'Cancel',
32
- },
33
- });
1
+ /*
2
+ * WechatRichmediaTemplatePreview Messages
3
+ *
4
+ * This contains all the text for the WechatRichmediaTemplatePreview component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'creatives.components.WechatRichmediaTemplatePreview.header',
11
+ defaultMessage: 'This is the WechatRichmediaTemplatePreview component !',
12
+ },
13
+ select: {
14
+ id: 'creatives.components.WechatRichmediaTemplatePreview.select',
15
+ defaultMessage: 'Select',
16
+ },
17
+ edit: {
18
+ id: 'creatives.components.WechatRichmediaTemplatePreview.edit',
19
+ defaultMessage: 'Edit',
20
+ },
21
+ MarkAsRead: {
22
+ id: 'creatives.components.WechatRichmediaTemplatePreview.MarkAsRead',
23
+ defaultMessage: 'Mark as read',
24
+ },
25
+ reply: {
26
+ id: 'creatives.components.WechatRichmediaTemplatePreview.reply',
27
+ defaultMessage: 'Reply',
28
+ },
29
+ cancel: {
30
+ id: 'creatives.components.WechatRichmediaTemplatePreview.cancel',
31
+ defaultMessage: 'Cancel',
32
+ },
33
+ });
@@ -1,10 +1,10 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import WechatRichmediaTemplatePreview from '../index';
5
-
6
- describe('<WechatRichmediaTemplatePreview />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import WechatRichmediaTemplatePreview from '../index';
5
+
6
+ describe('<WechatRichmediaTemplatePreview />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });