Skip to content

Commit 6c9a6ca

Browse files
committed
Merge branch 'main' into component-templates
2 parents 49d5830 + 6a56d06 commit 6c9a6ca

File tree

8 files changed

+93
-15
lines changed

8 files changed

+93
-15
lines changed

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v1.26.5](https://github.com/nyaruka/floweditor/compare/v1.26.4...v1.26.5)
8+
9+
> 4 March 2024
10+
11+
- Bump spec version to 13.3 [`f78035f`](https://github.com/nyaruka/floweditor/commit/f78035fa67a70722752e14c96766e8fadaffcbee)
12+
13+
#### [v1.26.4](https://github.com/nyaruka/floweditor/compare/v1.26.3...v1.26.4)
14+
15+
> 21 February 2024
16+
17+
- Bump follow-redirects from 1.14.8 to 1.15.4 [`#1215`](https://github.com/nyaruka/floweditor/pull/1215)
18+
- Bump ip from 1.1.5 to 1.1.9 [`#1220`](https://github.com/nyaruka/floweditor/pull/1220)
19+
- Add support to the simulator to display warnings [`#1218`](https://github.com/nyaruka/floweditor/pull/1218)
20+
21+
#### [v1.26.3](https://github.com/nyaruka/floweditor/compare/v1.26.2...v1.26.3)
22+
23+
> 4 January 2024
24+
25+
- Revert change to remove result name default on open ticket action [`5f7e185`](https://github.com/nyaruka/floweditor/commit/5f7e1853b1a7ca4a12918f04bc3b96cf21ba3354)
26+
727
#### [v1.26.2](https://github.com/nyaruka/floweditor/compare/v1.26.1...v1.26.2)
828

929
> 4 January 2024

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nyaruka/flow-editor",
33
"license": "AGPL-3.0",
44
"repository": "git://github.com/nyaruka/floweditor.git",
5-
"version": "1.26.2",
5+
"version": "1.26.5",
66
"description": "'Standalone flow editing tool designed for use within the RapidPro suite of messaging tools but can be adopted for use outside of that ecosystem.'",
77
"browser": "umd/flow-editor.min.js",
88
"unpkg": "umd/flow-editor.min.js",

src/components/flow/routers/ticket/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const getOriginalAction = (settings: NodeEditorSettings): OpenTicket => {
2020
export const nodeToState = (settings: NodeEditorSettings): TicketRouterFormState => {
2121
let subject = { value: '@run.flow.name' };
2222
let body = { value: '' };
23-
let resultName = { value: '' };
23+
let resultName = { value: 'Result' };
2424
let assignee: FormEntry = { value: null };
2525
let topic: FormEntry = { value: null };
2626

src/components/simulator/LogEvent.module.scss

+19-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
transform: scale(0.2);
66
opacity: 0;
77
}
8+
89
to {
910
transform: scale(1);
1011
opacity: 1;
@@ -20,6 +21,7 @@
2021
.msg_text {
2122
padding: 8px 15px;
2223
}
24+
2325
.ivr_msg,
2426
.send_msg {
2527
border-radius: 10px;
@@ -50,6 +52,16 @@
5052
}
5153
}
5254

55+
.warning {
56+
float: inherit;
57+
color: $yellow;
58+
font-size: 11px;
59+
border: none;
60+
text-align: center;
61+
padding: 10px 15px;
62+
border-radius: 11px;
63+
}
64+
5365
.error {
5466
float: inherit;
5567
color: $red;
@@ -72,6 +84,7 @@
7284
.email {
7385
text-decoration: underline;
7486
cursor: pointer;
87+
7588
&:hover {
7689
color: #999;
7790
}
@@ -81,6 +94,7 @@
8194
word-break: break-all;
8295
text-decoration: underline;
8396
cursor: pointer;
97+
8498
&:hover {
8599
color: #999;
86100
}
@@ -145,12 +159,14 @@
145159
white-space: -pre-wrap;
146160
white-space: -o-pre-wrap;
147161
word-wrap: break-word;
162+
148163
::first-line {
149164
font-family: 'Roboto', sans-serif;
150165
font-size: 16px;
151166
font-weight: 400;
152167
line-height: 34px;
153168
}
169+
154170
.response {
155171
padding-top: 20px;
156172
}
@@ -182,11 +198,13 @@
182198
width: 100%;
183199
font-size: 90%;
184200
color: #bbb;
201+
185202
td {
186203
padding: 0 5px;
187204
}
205+
188206
td:last-child {
189207
text-align: right;
190208
font-size: 90%;
191209
}
192-
}
210+
}

src/components/simulator/LogEvent.test.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ describe(LogEvent.name, () => {
101101
...commonEventProps
102102
});
103103
});
104+
it('should render warning event', () => {
105+
testEventRender({
106+
type: 'warning',
107+
text: "I'm an warning",
108+
...commonEventProps
109+
});
110+
});
104111
it('should render error event', () => {
105112
testEventRender({
106113
type: 'error',

src/components/simulator/LogEvent.tsx

+20-6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ const getStyleForDirection = (direction: Direction): string => {
101101
return direction === Direction.MO ? styles.msg_received : styles.send_msg;
102102
};
103103

104+
const renderWarning = (warning: string): JSX.Element => {
105+
return (
106+
<div className={styles.warning}>
107+
<span>Warning: {warning}</span>
108+
</div>
109+
);
110+
};
111+
104112
const renderError = (error: string): JSX.Element => {
105113
return (
106114
<div className={styles.error}>
@@ -109,6 +117,10 @@ const renderError = (error: string): JSX.Element => {
109117
);
110118
};
111119

120+
const renderInfoStyles = (allStyles: any[]): string => {
121+
return allStyles.join(' ');
122+
};
123+
112124
const renderInfo = (info: string, extraStyles?: any[]): JSX.Element => {
113125
// localized text can have html entities, so this isn't as dangerous as it looks
114126
const infoStyle = [styles.info];
@@ -120,9 +132,6 @@ const renderInfo = (info: string, extraStyles?: any[]): JSX.Element => {
120132
</div>
121133
);
122134
};
123-
const renderInfoStyles = (allStyles: any[]): string => {
124-
return allStyles.join(' ');
125-
};
126135

127136
const renderAttachment = (attachment: string): JSX.Element => {
128137
const idx = attachment.indexOf(':');
@@ -381,6 +390,8 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
381390
return renderMessage(this.props.msg.text, this.props.msg.attachments, Direction.MT);
382391
case 'ivr_created':
383392
return renderMessage(this.props.msg.text, this.props.msg.attachments, Direction.MT);
393+
case 'warning':
394+
return renderWarning(this.props.text);
384395
case 'error':
385396
return renderError(this.props.text);
386397
case 'failure':
@@ -391,7 +402,7 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
391402
return this.renderGroupsChanged();
392403
case 'contact_urns_changed':
393404
return renderInfo('Added a URN for the contact');
394-
case 'contact_field_changed':
405+
case 'contact_field_changed': {
395406
const value = this.getValue(this.props.value);
396407
if (value !== '') {
397408
return renderInfo(
@@ -407,6 +418,7 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
407418
})
408419
);
409420
}
421+
}
410422
case 'run_result_changed':
411423
return renderInfo(
412424
i18n.t('simulator.run_result_changed', 'Set result "[[field]]" to "[[value]]"', {
@@ -423,9 +435,10 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
423435
case 'email_created':
424436
case 'email_sent':
425437
return this.renderEmailSent();
426-
case 'broadcast_created':
438+
case 'broadcast_created': {
427439
const translation = this.props.translations[this.props.base_language];
428440
return renderMessage(translation.text, translation.attachments, Direction.MT);
441+
}
429442
case 'resthook_called':
430443
return renderInfo(
431444
i18n.t('simulator.resthook_called', 'Triggered flow event "[[resthook]]"', {
@@ -475,7 +488,7 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
475488
topic: this.props.ticket.topic.name
476489
})
477490
);
478-
case 'airtime_transferred':
491+
case 'airtime_transferred': {
479492
const event = this.props as AirtimeTransferEvent;
480493
return (
481494
<>
@@ -494,6 +507,7 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
494507
)}
495508
</>
496509
);
510+
}
497511
}
498512

499513
// should only get here if we are get an unexpected event

src/components/simulator/__snapshots__/LogEvent.test.tsx.snap

+19
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,22 @@ exports[`LogEvent should render ticket_opened event 1`] = `
406406
</div>
407407
</body>
408408
`;
409+
410+
exports[`LogEvent should render warning event 1`] = `
411+
<body>
412+
<div>
413+
<div
414+
class="evt"
415+
>
416+
<div
417+
class="warning"
418+
>
419+
<span>
420+
Warning:
421+
I'm an warning
422+
</span>
423+
</div>
424+
</div>
425+
</div>
426+
</body>
427+
`;

yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -5868,9 +5868,9 @@ fn-name@~2.0.1:
58685868
integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=
58695869

58705870
follow-redirects@^1.0.0, follow-redirects@^1.14.0:
5871-
version "1.14.8"
5872-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
5873-
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
5871+
version "1.15.4"
5872+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
5873+
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==
58745874

58755875
for-in@^0.1.3:
58765876
version "0.1.8"
@@ -6922,9 +6922,9 @@ ip-regex@^2.1.0:
69226922
integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=
69236923

69246924
ip@^1.1.0, ip@^1.1.5:
6925-
version "1.1.5"
6926-
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
6927-
integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=
6925+
version "1.1.9"
6926+
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396"
6927+
integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==
69286928

69296929
[email protected], ipaddr.js@^1.9.0:
69306930
version "1.9.1"

0 commit comments

Comments
 (0)