@bigbinary/neeto-molecules 5.5.1 → 5.5.3
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/dist/DocumentEditor.js +1 -1
- package/dist/EmailForm.js +3 -3
- package/dist/EmailPreview.js +1 -1
- package/dist/Onboarding.js +391 -8
- package/dist/Onboarding.js.map +1 -1
- package/dist/OptionFields.js +1 -1
- package/dist/ShareViaEmail.js +3 -3
- package/dist/circle-user-ieD_gMjm.js +19 -0
- package/dist/circle-user-ieD_gMjm.js.map +1 -0
- package/dist/cjs/DocumentEditor.js +1 -1
- package/dist/cjs/EmailForm.js +3 -3
- package/dist/cjs/EmailPreview.js +1 -1
- package/dist/cjs/Onboarding.js +409 -7
- package/dist/cjs/Onboarding.js.map +1 -1
- package/dist/cjs/OptionFields.js +1 -1
- package/dist/cjs/ShareViaEmail.js +3 -3
- package/dist/cjs/circle-user-D5aGw9mw.js +21 -0
- package/dist/cjs/circle-user-D5aGw9mw.js.map +1 -0
- package/dist/cjs/v2/AuditLogs.js +2 -16
- package/dist/cjs/v2/AuditLogs.js.map +1 -1
- package/dist/cjs/v2/DocumentEditor.js +1 -1
- package/dist/cjs/v2/EmailForm.js +3 -3
- package/dist/cjs/v2/EmailPreview.js +1 -1
- package/dist/cjs/v2/Onboarding.js +435 -10
- package/dist/cjs/v2/Onboarding.js.map +1 -1
- package/dist/cjs/v2/OptionFields.js +1 -1
- package/dist/cjs/v2/ShareViaEmail.js +3 -3
- package/dist/v2/AuditLogs.js +1 -15
- package/dist/v2/AuditLogs.js.map +1 -1
- package/dist/v2/DocumentEditor.js +1 -1
- package/dist/v2/EmailForm.js +3 -3
- package/dist/v2/EmailPreview.js +1 -1
- package/dist/v2/Onboarding.js +418 -12
- package/dist/v2/Onboarding.js.map +1 -1
- package/dist/v2/OptionFields.js +1 -1
- package/dist/v2/ShareViaEmail.js +3 -3
- package/package.json +5 -5
- package/src/translations/ar.json +12 -5
- package/src/translations/bg.json +13 -6
- package/src/translations/ca.json +13 -6
- package/src/translations/cs.json +12 -5
- package/src/translations/da.json +13 -6
- package/src/translations/de.json +13 -6
- package/src/translations/en.json +14 -7
- package/src/translations/es-MX.json +13 -6
- package/src/translations/es.json +13 -6
- package/src/translations/et.json +13 -6
- package/src/translations/fi.json +13 -6
- package/src/translations/fil.json +13 -6
- package/src/translations/fr.json +13 -6
- package/src/translations/he.json +13 -6
- package/src/translations/hi.json +12 -5
- package/src/translations/hr.json +12 -5
- package/src/translations/hu.json +13 -6
- package/src/translations/id.json +13 -6
- package/src/translations/it.json +13 -6
- package/src/translations/ja.json +13 -6
- package/src/translations/ko.json +13 -6
- package/src/translations/lv.json +13 -6
- package/src/translations/nl.json +13 -6
- package/src/translations/pl.json +13 -6
- package/src/translations/pt-BR.json +13 -6
- package/src/translations/pt.json +13 -6
- package/src/translations/ro.json +13 -6
- package/src/translations/ru.json +12 -5
- package/src/translations/sk.json +12 -5
- package/src/translations/sl.json +13 -6
- package/src/translations/sv.json +13 -6
- package/src/translations/th.json +12 -5
- package/src/translations/tr.json +13 -6
- package/src/translations/uk.json +13 -6
- package/src/translations/vi.json +13 -6
- package/src/translations/zh-CN.json +12 -5
- package/src/translations/zh-TW.json +13 -6
- package/types/DocumentEditor.d.ts +1 -1
- package/types/Onboarding.d.ts +1 -0
- package/types/v2/DocumentEditor.d.ts +4 -1
- package/types/v2/Onboarding.d.ts +1 -0
|
@@ -10,12 +10,38 @@ var initializers = require('@bigbinary/neeto-commons-frontend/v2/initializers');
|
|
|
10
10
|
var reactConfetti = require('../react-confetti-DdGoyZ0y.js');
|
|
11
11
|
var reactI18next = require('react-i18next');
|
|
12
12
|
var i18next = require('i18next');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var ramda = require('ramda');
|
|
14
|
+
var circleUser = require('../circle-user-D5aGw9mw.js');
|
|
15
15
|
var createLucideIcon = require('../createLucideIcon-BbuuRL2u.js');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var mail = require('../mail-Di35Ay-Z.js');
|
|
18
|
+
var reactQuery = require('@tanstack/react-query');
|
|
19
|
+
var axios = require('axios');
|
|
20
|
+
var constants = require('@bigbinary/neeto-commons-frontend/v2/constants');
|
|
21
|
+
var yup = require('yup');
|
|
22
|
+
var useBreakpoints = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useBreakpoints');
|
|
16
23
|
var injectCss = require('../inject-css-B6qYtOJe.js');
|
|
17
24
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
18
25
|
|
|
26
|
+
function _interopNamespaceDefault(e) {
|
|
27
|
+
var n = Object.create(null);
|
|
28
|
+
if (e) {
|
|
29
|
+
Object.keys(e).forEach(function (k) {
|
|
30
|
+
if (k !== 'default') {
|
|
31
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return e[k]; }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
n.default = e;
|
|
40
|
+
return Object.freeze(n);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
|
|
44
|
+
|
|
19
45
|
/**
|
|
20
46
|
* @license lucide-react v1.24.0 - ISC
|
|
21
47
|
*
|
|
@@ -24,18 +50,384 @@ var reactUtils = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
|
|
|
24
50
|
*/
|
|
25
51
|
|
|
26
52
|
|
|
27
|
-
const __iconNode = [
|
|
53
|
+
const __iconNode$1 = [
|
|
28
54
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
29
55
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
30
56
|
];
|
|
31
|
-
const ArrowRight = createLucideIcon.createLucideIcon("arrow-right", __iconNode);
|
|
57
|
+
const ArrowRight = createLucideIcon.createLucideIcon("arrow-right", __iconNode$1);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @license lucide-react v1.24.0 - ISC
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the ISC license.
|
|
63
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const __iconNode = [
|
|
68
|
+
["path", { d: "M2 6h4", key: "aawbzj" }],
|
|
69
|
+
["path", { d: "M2 10h4", key: "l0bgd4" }],
|
|
70
|
+
["path", { d: "M2 14h4", key: "1gsvsf" }],
|
|
71
|
+
["path", { d: "M2 18h4", key: "1bu2t1" }],
|
|
72
|
+
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", key: "1nb95v" }],
|
|
73
|
+
["path", { d: "M9.5 8h5", key: "11mslq" }],
|
|
74
|
+
["path", { d: "M9.5 12H16", key: "ktog6x" }],
|
|
75
|
+
["path", { d: "M9.5 16H14", key: "p1seyn" }]
|
|
76
|
+
];
|
|
77
|
+
const NotebookText = createLucideIcon.createLucideIcon("notebook-text", __iconNode);
|
|
78
|
+
|
|
79
|
+
var COMMUNITY_OPTIONS = [{
|
|
80
|
+
key: "slack",
|
|
81
|
+
icon: circleUser.CircleUser,
|
|
82
|
+
dataTestid: "onboarding-community-slack-checkbox",
|
|
83
|
+
recipientDataTestids: {
|
|
84
|
+
change: "onboarding-community-slack-email-change-button",
|
|
85
|
+
input: "onboarding-community-slack-email-input",
|
|
86
|
+
save: "onboarding-community-slack-email-save-button",
|
|
87
|
+
cancel: "onboarding-community-slack-email-cancel-button"
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "blog",
|
|
91
|
+
icon: NotebookText,
|
|
92
|
+
dataTestid: "onboarding-community-blog-checkbox",
|
|
93
|
+
recipientDataTestids: {
|
|
94
|
+
change: "onboarding-community-blog-email-change-button",
|
|
95
|
+
input: "onboarding-community-blog-email-input",
|
|
96
|
+
save: "onboarding-community-blog-email-save-button",
|
|
97
|
+
cancel: "onboarding-community-blog-email-cancel-button"
|
|
98
|
+
}
|
|
99
|
+
}];
|
|
100
|
+
|
|
101
|
+
var EmailRecipient = function EmailRecipient(_ref) {
|
|
102
|
+
var email = _ref.email,
|
|
103
|
+
edit = _ref.edit,
|
|
104
|
+
onStartEditing = _ref.onStartEditing,
|
|
105
|
+
onDraftChange = _ref.onDraftChange,
|
|
106
|
+
onSave = _ref.onSave,
|
|
107
|
+
onCancel = _ref.onCancel,
|
|
108
|
+
recipientKey = _ref.recipientKey,
|
|
109
|
+
inputLabelKey = _ref.inputLabelKey,
|
|
110
|
+
dataTestids = _ref.dataTestids;
|
|
111
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
112
|
+
t = _useTranslation.t;
|
|
113
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
114
|
+
if (event.key === "Enter") {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
onSave();
|
|
117
|
+
}
|
|
118
|
+
if (event.key === "Escape") onCancel();
|
|
119
|
+
};
|
|
120
|
+
if (edit) {
|
|
121
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
122
|
+
className: "flex items-start gap-2 ps-6 pt-3",
|
|
123
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
124
|
+
className: "w-72",
|
|
125
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
|
|
126
|
+
autoFocus: true,
|
|
127
|
+
"aria-label": t(inputLabelKey),
|
|
128
|
+
"data-testid": dataTestids.input,
|
|
129
|
+
error: edit.error,
|
|
130
|
+
type: "email",
|
|
131
|
+
value: edit.draft,
|
|
132
|
+
onChange: function onChange(event) {
|
|
133
|
+
return onDraftChange(event.target.value);
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: handleKeyDown
|
|
136
|
+
})
|
|
137
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
138
|
+
"data-testid": dataTestids.save,
|
|
139
|
+
label: t("neetoMolecules.common.actions.save"),
|
|
140
|
+
onClick: onSave
|
|
141
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
142
|
+
"data-testid": dataTestids.cancel,
|
|
143
|
+
label: t("neetoMolecules.common.actions.cancel"),
|
|
144
|
+
variant: "ghost",
|
|
145
|
+
onClick: onCancel
|
|
146
|
+
})]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
150
|
+
className: "flex flex-wrap items-center gap-2 ps-6 pt-3",
|
|
151
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(mail.Mail, {
|
|
152
|
+
"aria-hidden": true,
|
|
153
|
+
className: "text-muted-foreground",
|
|
154
|
+
size: 16
|
|
155
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
156
|
+
color: "muted",
|
|
157
|
+
variant: "body2",
|
|
158
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
159
|
+
components: {
|
|
160
|
+
strong: /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
161
|
+
className: "text-foreground"
|
|
162
|
+
})
|
|
163
|
+
},
|
|
164
|
+
i18nKey: recipientKey,
|
|
165
|
+
values: {
|
|
166
|
+
email: email
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
170
|
+
"data-testid": dataTestids.change,
|
|
171
|
+
label: t("neetoMolecules.onboarding.communityScreen.changeButton"),
|
|
172
|
+
size: "sm",
|
|
173
|
+
variant: "link",
|
|
174
|
+
onClick: onStartEditing
|
|
175
|
+
})]
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
var joinCommunity = function joinCommunity(communityJoin) {
|
|
180
|
+
return axios.post("".concat(constants.BASE_API_V1_URL, "/community_join"), {
|
|
181
|
+
communityJoin: communityJoin
|
|
182
|
+
}, {
|
|
183
|
+
showToastr: false
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
var communityApi = {
|
|
187
|
+
joinCommunity: joinCommunity
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var useJoinCommunity = function useJoinCommunity() {
|
|
191
|
+
return reactQuery.useMutation({
|
|
192
|
+
mutationFn: communityApi.joinCommunity
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var isValidEmail = function isValidEmail(email) {
|
|
197
|
+
return !!email && yup__namespace.string().email().isValidSync(email);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
201
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
202
|
+
|
|
203
|
+
// Tracks the email each option goes to, plus any address being edited, so
|
|
204
|
+
// Continue can pick up a draft the user typed but did not save.
|
|
205
|
+
var useRecipientEmails = function useRecipientEmails(defaultEmail) {
|
|
206
|
+
var _useState = React.useState({
|
|
207
|
+
slack: defaultEmail,
|
|
208
|
+
blog: defaultEmail
|
|
209
|
+
}),
|
|
210
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
211
|
+
emails = _useState2[0],
|
|
212
|
+
setEmails = _useState2[1];
|
|
213
|
+
|
|
214
|
+
// { [key]: { draft, error } } for the options whose email field is open.
|
|
215
|
+
var _useState3 = React.useState({}),
|
|
216
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
217
|
+
edits = _useState4[0],
|
|
218
|
+
setEdits = _useState4[1];
|
|
219
|
+
var startEditing = function startEditing(key) {
|
|
220
|
+
return setEdits(ramda.assoc(key, {
|
|
221
|
+
draft: emails[key],
|
|
222
|
+
error: ""
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
225
|
+
var changeDraft = function changeDraft(key, draft) {
|
|
226
|
+
return setEdits(ramda.assoc(key, {
|
|
227
|
+
draft: draft,
|
|
228
|
+
error: ""
|
|
229
|
+
}));
|
|
230
|
+
};
|
|
231
|
+
var cancel = function cancel(key) {
|
|
232
|
+
return setEdits(ramda.dissoc(key));
|
|
233
|
+
};
|
|
234
|
+
var validate = function validate(key) {
|
|
235
|
+
var draft = edits[key].draft.trim();
|
|
236
|
+
return isValidEmail(draft) ? {
|
|
237
|
+
draft: draft
|
|
238
|
+
} : {
|
|
239
|
+
error: i18next.t("neetoMolecules.onboarding.communityScreen.invalidEmail")
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
var save = function save(key) {
|
|
243
|
+
var _validate = validate(key),
|
|
244
|
+
draft = _validate.draft,
|
|
245
|
+
error = _validate.error;
|
|
246
|
+
if (error) {
|
|
247
|
+
setEdits(ramda.assoc(key, _objectSpread$3(_objectSpread$3({}, edits[key]), {}, {
|
|
248
|
+
error: error
|
|
249
|
+
})));
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
setEmails(ramda.assoc(key, draft));
|
|
253
|
+
setEdits(ramda.dissoc(key));
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// Applies every open draft of the given options. Returns the final emails,
|
|
257
|
+
// or null when a draft is invalid, after showing its error.
|
|
258
|
+
var applyDrafts = function applyDrafts(keys) {
|
|
259
|
+
var nextEmails = emails;
|
|
260
|
+
var nextEdits = edits;
|
|
261
|
+
keys.filter(function (key) {
|
|
262
|
+
return edits[key];
|
|
263
|
+
}).forEach(function (key) {
|
|
264
|
+
var _validate2 = validate(key),
|
|
265
|
+
draft = _validate2.draft,
|
|
266
|
+
error = _validate2.error;
|
|
267
|
+
if (error) {
|
|
268
|
+
nextEdits = ramda.assoc(key, _objectSpread$3(_objectSpread$3({}, edits[key]), {}, {
|
|
269
|
+
error: error
|
|
270
|
+
}), nextEdits);
|
|
271
|
+
} else {
|
|
272
|
+
nextEmails = ramda.assoc(key, draft, nextEmails);
|
|
273
|
+
nextEdits = ramda.dissoc(key, nextEdits);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
setEmails(nextEmails);
|
|
277
|
+
setEdits(nextEdits);
|
|
278
|
+
var hasInvalidDraft = keys.some(function (key) {
|
|
279
|
+
return nextEdits[key];
|
|
280
|
+
});
|
|
281
|
+
return hasInvalidDraft ? null : nextEmails;
|
|
282
|
+
};
|
|
283
|
+
return {
|
|
284
|
+
emails: emails,
|
|
285
|
+
edits: edits,
|
|
286
|
+
startEditing: startEditing,
|
|
287
|
+
changeDraft: changeDraft,
|
|
288
|
+
cancel: cancel,
|
|
289
|
+
save: save,
|
|
290
|
+
applyDrafts: applyDrafts
|
|
291
|
+
};
|
|
292
|
+
};
|
|
32
293
|
|
|
33
294
|
var GENERAL_ONBOARDING_STEPS = {
|
|
34
295
|
WELCOME: "welcome",
|
|
296
|
+
COMMUNITY: "community",
|
|
35
297
|
HELP: "help",
|
|
36
298
|
FINISH: "finish"
|
|
37
299
|
};
|
|
38
300
|
|
|
301
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
302
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
303
|
+
var Community = function Community(_ref) {
|
|
304
|
+
var _globalProps$user, _globalProps$appName;
|
|
305
|
+
var setCurrentStep = _ref.setCurrentStep,
|
|
306
|
+
communityScreenClassName = _ref.communityScreenClassName;
|
|
307
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
308
|
+
t = _useTranslation.t;
|
|
309
|
+
var _useState = React.useState({
|
|
310
|
+
slack: true,
|
|
311
|
+
blog: true
|
|
312
|
+
}),
|
|
313
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
314
|
+
selected = _useState2[0],
|
|
315
|
+
setSelected = _useState2[1];
|
|
316
|
+
|
|
317
|
+
// Both start at the signed-in user's email; each can be changed separately.
|
|
318
|
+
var recipients = useRecipientEmails((_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email);
|
|
319
|
+
var _useJoinCommunity = useJoinCommunity(),
|
|
320
|
+
joinCommunity = _useJoinCommunity.mutate;
|
|
321
|
+
var appName = neetoCist.capitalize((_globalProps$appName = initializers.globalProps.appName) !== null && _globalProps$appName !== void 0 ? _globalProps$appName : "");
|
|
322
|
+
var handleContinue = function handleContinue() {
|
|
323
|
+
var selectedKeys = Object.keys(selected).filter(function (key) {
|
|
324
|
+
return selected[key];
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// An address typed but not saved still counts; an invalid one keeps the
|
|
328
|
+
// user here with its error showing.
|
|
329
|
+
var emails = recipients.applyDrafts(selectedKeys);
|
|
330
|
+
if (!emails) return;
|
|
331
|
+
|
|
332
|
+
// The Slack invite and blog subscription are both sent by email in the
|
|
333
|
+
// background, so onboarding moves on without waiting for them.
|
|
334
|
+
if (selectedKeys.length > 0) {
|
|
335
|
+
joinCommunity(_objectSpread$2(_objectSpread$2({}, selected), {}, {
|
|
336
|
+
slackEmail: emails.slack,
|
|
337
|
+
blogEmail: emails.blog
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
340
|
+
setCurrentStep(GENERAL_ONBOARDING_STEPS.HELP);
|
|
341
|
+
};
|
|
342
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
343
|
+
className: classnames("mx-auto flex w-full max-w-3xl flex-col items-start gap-y-6 px-6 pt-16 pb-6", communityScreenClassName),
|
|
344
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
345
|
+
className: "space-y-2",
|
|
346
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
347
|
+
"data-testid": "onboarding-community-title",
|
|
348
|
+
variant: "h2",
|
|
349
|
+
children: t("neetoMolecules.onboarding.communityScreen.title")
|
|
350
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
351
|
+
"data-testid": "onboarding-community-description",
|
|
352
|
+
variant: "body1",
|
|
353
|
+
children: t("neetoMolecules.onboarding.communityScreen.description", {
|
|
354
|
+
appName: appName
|
|
355
|
+
})
|
|
356
|
+
})]
|
|
357
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
358
|
+
className: "border-border flex w-full flex-col gap-6 rounded-lg border p-3 lg:p-6",
|
|
359
|
+
children: COMMUNITY_OPTIONS.map(function (_ref2) {
|
|
360
|
+
var key = _ref2.key,
|
|
361
|
+
Icon = _ref2.icon,
|
|
362
|
+
dataTestid = _ref2.dataTestid,
|
|
363
|
+
recipientDataTestids = _ref2.recipientDataTestids;
|
|
364
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
365
|
+
className: "w-full",
|
|
366
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, {
|
|
367
|
+
checked: selected[key],
|
|
368
|
+
"data-testid": dataTestid,
|
|
369
|
+
id: dataTestid,
|
|
370
|
+
labelProps: {
|
|
371
|
+
className: "text-xl font-semibold"
|
|
372
|
+
},
|
|
373
|
+
label: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
374
|
+
className: "flex flex-wrap items-center gap-2",
|
|
375
|
+
children: [t("neetoMolecules.onboarding.communityScreen.".concat(key, ".title"), {
|
|
376
|
+
appName: appName
|
|
377
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
378
|
+
"aria-hidden": true,
|
|
379
|
+
size: 24
|
|
380
|
+
})]
|
|
381
|
+
}),
|
|
382
|
+
onCheckedChange: function onCheckedChange(checked) {
|
|
383
|
+
setSelected(ramda.assoc(key, checked));
|
|
384
|
+
if (!checked) recipients.cancel(key);
|
|
385
|
+
}
|
|
386
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
387
|
+
className: "ps-6 pt-2",
|
|
388
|
+
color: "muted",
|
|
389
|
+
variant: "body1",
|
|
390
|
+
children: t("neetoMolecules.onboarding.communityScreen.".concat(key, ".description"))
|
|
391
|
+
}), selected[key] && /*#__PURE__*/jsxRuntime.jsx(EmailRecipient, {
|
|
392
|
+
dataTestids: recipientDataTestids,
|
|
393
|
+
edit: recipients.edits[key],
|
|
394
|
+
email: recipients.emails[key],
|
|
395
|
+
inputLabelKey: "neetoMolecules.onboarding.communityScreen.".concat(key, ".emailInputLabel"),
|
|
396
|
+
recipientKey: "neetoMolecules.onboarding.communityScreen.".concat(key, ".recipient"),
|
|
397
|
+
onCancel: function onCancel() {
|
|
398
|
+
return recipients.cancel(key);
|
|
399
|
+
},
|
|
400
|
+
onDraftChange: function onDraftChange(draft) {
|
|
401
|
+
return recipients.changeDraft(key, draft);
|
|
402
|
+
},
|
|
403
|
+
onSave: function onSave() {
|
|
404
|
+
return recipients.save(key);
|
|
405
|
+
},
|
|
406
|
+
onStartEditing: function onStartEditing() {
|
|
407
|
+
return recipients.startEditing(key);
|
|
408
|
+
}
|
|
409
|
+
})]
|
|
410
|
+
}, key);
|
|
411
|
+
})
|
|
412
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
413
|
+
color: "muted",
|
|
414
|
+
variant: "body2",
|
|
415
|
+
children: t("neetoMolecules.onboarding.communityScreen.unsubscribe")
|
|
416
|
+
}), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
417
|
+
"data-testid": "community-onboarding-continue-button",
|
|
418
|
+
icon: function icon() {
|
|
419
|
+
return /*#__PURE__*/jsxRuntime.jsx(ArrowRight, {
|
|
420
|
+
className: "rtl:scale-x-[-1]",
|
|
421
|
+
size: 16
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
iconPosition: "right",
|
|
425
|
+
label: t("neetoMolecules.onboarding.communityScreen.continueButton"),
|
|
426
|
+
onClick: handleContinue
|
|
427
|
+
})]
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
|
|
39
431
|
var HelpScreen = function HelpScreen(_ref) {
|
|
40
432
|
var setCurrentStep = _ref.setCurrentStep,
|
|
41
433
|
helpScreenClassName = _ref.helpScreenClassName;
|
|
@@ -86,7 +478,14 @@ var HelpScreen = function HelpScreen(_ref) {
|
|
|
86
478
|
|
|
87
479
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
88
480
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
89
|
-
var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName) {
|
|
481
|
+
var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName, isCommunityStepVisible) {
|
|
482
|
+
var communityStep = {
|
|
483
|
+
key: GENERAL_ONBOARDING_STEPS.COMMUNITY,
|
|
484
|
+
label: i18next.t("neetoMolecules.onboarding.communityLabel"),
|
|
485
|
+
element: /*#__PURE__*/jsxRuntime.jsx(Community, {
|
|
486
|
+
setCurrentStep: setCurrentStep
|
|
487
|
+
})
|
|
488
|
+
};
|
|
90
489
|
var helpStep = {
|
|
91
490
|
key: GENERAL_ONBOARDING_STEPS.HELP,
|
|
92
491
|
label: i18next.t("neetoMolecules.onboarding.helpLabel"),
|
|
@@ -96,7 +495,7 @@ var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentS
|
|
|
96
495
|
setCurrentStep: setCurrentStep
|
|
97
496
|
})
|
|
98
497
|
};
|
|
99
|
-
return onboardingSteps.concat(helpStep).map(function (step, idx) {
|
|
498
|
+
return onboardingSteps.concat(isCommunityStepVisible ? [communityStep, helpStep] : helpStep).map(function (step, idx) {
|
|
100
499
|
return _objectSpread$1(_objectSpread$1({}, step), {}, {
|
|
101
500
|
id: idx + 1
|
|
102
501
|
});
|
|
@@ -253,11 +652,27 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
253
652
|
welcomeScreenClassName = _ref$welcomeScreenCla === void 0 ? "" : _ref$welcomeScreenCla,
|
|
254
653
|
_ref$completedScreenC = _ref.completedScreenClassName,
|
|
255
654
|
completedScreenClassName = _ref$completedScreenC === void 0 ? "" : _ref$completedScreenC,
|
|
256
|
-
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage
|
|
655
|
+
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage,
|
|
656
|
+
_ref$isCommunityStepV = _ref.isCommunityStepVisible,
|
|
657
|
+
isCommunityStepVisible = _ref$isCommunityStepV === void 0 ? true : _ref$isCommunityStepV;
|
|
257
658
|
var steps = React.useMemo(function () {
|
|
258
|
-
return createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName);
|
|
259
|
-
}, [onboardingSteps]);
|
|
659
|
+
return createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName, isCommunityStepVisible);
|
|
660
|
+
}, [onboardingSteps, isCommunityStepVisible]);
|
|
260
661
|
var prevStep = React.useRef(currentStep);
|
|
662
|
+
var isStepperNavigation = React.useRef(false);
|
|
663
|
+
var isRedirectingToCommunity = React.useRef(false);
|
|
664
|
+
|
|
665
|
+
// Products move from their last step straight to Help. Send them through
|
|
666
|
+
// the community step first, unless they picked Help in the stepper.
|
|
667
|
+
React.useLayoutEffect(function () {
|
|
668
|
+
var isFromStepper = isStepperNavigation.current;
|
|
669
|
+
isStepperNavigation.current = false;
|
|
670
|
+
var shouldShowCommunityFirst = isCommunityStepVisible && !isFromStepper && currentStep === GENERAL_ONBOARDING_STEPS.HELP && prevStep.current !== currentStep && prevStep.current !== GENERAL_ONBOARDING_STEPS.COMMUNITY;
|
|
671
|
+
if (shouldShowCommunityFirst) {
|
|
672
|
+
isRedirectingToCommunity.current = true;
|
|
673
|
+
setCurrentStep(GENERAL_ONBOARDING_STEPS.COMMUNITY);
|
|
674
|
+
}
|
|
675
|
+
}, [currentStep]);
|
|
261
676
|
var _useState = React.useState(""),
|
|
262
677
|
_useState2 = _slicedToArray(_useState, 2),
|
|
263
678
|
direction = _useState2[0],
|
|
@@ -269,6 +684,13 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
269
684
|
};
|
|
270
685
|
React.useEffect(function () {
|
|
271
686
|
if (currentStep === prevStep.current) return;
|
|
687
|
+
|
|
688
|
+
// Help is skipped over on the way to the community step, so the
|
|
689
|
+
// animation should run from the step before it.
|
|
690
|
+
if (isRedirectingToCommunity.current) {
|
|
691
|
+
isRedirectingToCommunity.current = false;
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
272
694
|
setDirection(getOnboardingStepIndex(currentStep) > getOnboardingStepIndex(prevStep.current) ? "forward" : "backward");
|
|
273
695
|
prevStep.current = currentStep;
|
|
274
696
|
}, [currentStep]);
|
|
@@ -288,7 +710,10 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
288
710
|
});
|
|
289
711
|
}
|
|
290
712
|
var handleStepChange = function handleStepChange(index) {
|
|
291
|
-
|
|
713
|
+
var stepKey = steps[index].key;
|
|
714
|
+
if (stepKey === currentStep) return;
|
|
715
|
+
isStepperNavigation.current = true;
|
|
716
|
+
setCurrentStep(stepKey);
|
|
292
717
|
};
|
|
293
718
|
var isStepperVisible = steps.length > 1;
|
|
294
719
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|