@bigbinary/neeto-molecules 5.5.1 → 5.5.2
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/Onboarding.js +391 -8
- package/dist/Onboarding.js.map +1 -1
- package/dist/circle-user-ieD_gMjm.js +19 -0
- package/dist/circle-user-ieD_gMjm.js.map +1 -0
- package/dist/cjs/Onboarding.js +409 -7
- package/dist/cjs/Onboarding.js.map +1 -1
- 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/Onboarding.js +435 -10
- package/dist/cjs/v2/Onboarding.js.map +1 -1
- package/dist/v2/AuditLogs.js +1 -15
- package/dist/v2/AuditLogs.js.map +1 -1
- package/dist/v2/Onboarding.js +418 -12
- package/dist/v2/Onboarding.js.map +1 -1
- package/package.json +1 -1
- 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/Onboarding.d.ts +1 -0
- package/types/v2/Onboarding.d.ts +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { c as createLucideIcon } from './createLucideIcon--oLqczpc.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v1.24.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
13
|
+
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }],
|
|
14
|
+
["path", { d: "M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662", key: "154egf" }]
|
|
15
|
+
];
|
|
16
|
+
const CircleUser = createLucideIcon("circle-user", __iconNode);
|
|
17
|
+
|
|
18
|
+
export { CircleUser as C };
|
|
19
|
+
//# sourceMappingURL=circle-user-ieD_gMjm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle-user-ieD_gMjm.js","sources":["../node_modules/lucide-react/dist/esm/icons/circle-user.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"circle\", { cx: \"12\", cy: \"10\", r: \"3\", key: \"ilqhr7\" }],\n [\"path\", { d: \"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662\", key: \"154egf\" }]\n];\nconst CircleUser = createLucideIcon(\"circle-user\", __iconNode);\n\nexport { __iconNode, CircleUser as default };\n//# sourceMappingURL=circle-user.mjs.map\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC5D,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC3D,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,kDAAkD,EAAE,GAAG,EAAE,QAAQ,EAAE;AACnF,CAAC;AACI,MAAC,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,UAAU;;;;","x_google_ignoreList":[0]}
|
package/dist/cjs/Onboarding.js
CHANGED
|
@@ -12,18 +12,387 @@ var Typography = require('@bigbinary/neetoui/Typography');
|
|
|
12
12
|
var reactConfetti = require('./react-confetti-DdGoyZ0y.js');
|
|
13
13
|
var reactI18next = require('react-i18next');
|
|
14
14
|
var i18next = require('i18next');
|
|
15
|
-
var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
|
|
16
15
|
var RightArrow = require('@bigbinary/neeto-icons/RightArrow');
|
|
16
|
+
var Checkbox = require('@bigbinary/neetoui/Checkbox');
|
|
17
|
+
var ramda = require('ramda');
|
|
18
|
+
var Notes = require('@bigbinary/neeto-icons/Notes');
|
|
19
|
+
var UserCircle = require('@bigbinary/neeto-icons/UserCircle');
|
|
20
|
+
var Email = require('@bigbinary/neeto-icons/Email');
|
|
21
|
+
var Input = require('@bigbinary/neetoui/Input');
|
|
17
22
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
|
+
var reactQuery = require('@tanstack/react-query');
|
|
24
|
+
var axios = require('axios');
|
|
25
|
+
var constants = require('@bigbinary/neeto-commons-frontend/constants');
|
|
26
|
+
var yup = require('yup');
|
|
27
|
+
var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
|
|
18
28
|
var injectCss = require('./inject-css-B6qYtOJe.js');
|
|
19
29
|
var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
|
|
20
30
|
|
|
31
|
+
function _interopNamespaceDefault(e) {
|
|
32
|
+
var n = Object.create(null);
|
|
33
|
+
if (e) {
|
|
34
|
+
Object.keys(e).forEach(function (k) {
|
|
35
|
+
if (k !== 'default') {
|
|
36
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
37
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return e[k]; }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
n.default = e;
|
|
45
|
+
return Object.freeze(n);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
|
|
49
|
+
|
|
50
|
+
var COMMUNITY_OPTIONS = [{
|
|
51
|
+
key: "slack",
|
|
52
|
+
icon: UserCircle,
|
|
53
|
+
dataTestid: "onboarding-community-slack-checkbox",
|
|
54
|
+
recipientDataTestids: {
|
|
55
|
+
change: "onboarding-community-slack-email-change-button",
|
|
56
|
+
input: "onboarding-community-slack-email-input",
|
|
57
|
+
save: "onboarding-community-slack-email-save-button",
|
|
58
|
+
cancel: "onboarding-community-slack-email-cancel-button"
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "blog",
|
|
62
|
+
icon: Notes,
|
|
63
|
+
dataTestid: "onboarding-community-blog-checkbox",
|
|
64
|
+
recipientDataTestids: {
|
|
65
|
+
change: "onboarding-community-blog-email-change-button",
|
|
66
|
+
input: "onboarding-community-blog-email-input",
|
|
67
|
+
save: "onboarding-community-blog-email-save-button",
|
|
68
|
+
cancel: "onboarding-community-blog-email-cancel-button"
|
|
69
|
+
}
|
|
70
|
+
}];
|
|
71
|
+
|
|
72
|
+
var EmailRecipient = function EmailRecipient(_ref) {
|
|
73
|
+
var email = _ref.email,
|
|
74
|
+
edit = _ref.edit,
|
|
75
|
+
onStartEditing = _ref.onStartEditing,
|
|
76
|
+
onDraftChange = _ref.onDraftChange,
|
|
77
|
+
onSave = _ref.onSave,
|
|
78
|
+
onCancel = _ref.onCancel,
|
|
79
|
+
recipientKey = _ref.recipientKey,
|
|
80
|
+
inputLabelKey = _ref.inputLabelKey,
|
|
81
|
+
dataTestids = _ref.dataTestids;
|
|
82
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
83
|
+
t = _useTranslation.t;
|
|
84
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
85
|
+
if (event.key === "Enter") {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
onSave();
|
|
88
|
+
}
|
|
89
|
+
if (event.key === "Escape") onCancel();
|
|
90
|
+
};
|
|
91
|
+
if (edit) {
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
93
|
+
className: "flex items-start gap-2 ps-6 pt-3",
|
|
94
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
95
|
+
className: "w-72",
|
|
96
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
97
|
+
autoFocus: true,
|
|
98
|
+
"aria-label": t(inputLabelKey),
|
|
99
|
+
"data-testid": dataTestids.input,
|
|
100
|
+
error: edit.error,
|
|
101
|
+
type: "email",
|
|
102
|
+
value: edit.draft,
|
|
103
|
+
onChange: function onChange(event) {
|
|
104
|
+
return onDraftChange(event.target.value);
|
|
105
|
+
},
|
|
106
|
+
onKeyDown: handleKeyDown
|
|
107
|
+
})
|
|
108
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
109
|
+
"data-testid": dataTestids.save,
|
|
110
|
+
label: t("neetoMolecules.common.actions.save"),
|
|
111
|
+
onClick: onSave
|
|
112
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
113
|
+
"data-testid": dataTestids.cancel,
|
|
114
|
+
label: t("neetoMolecules.common.actions.cancel"),
|
|
115
|
+
style: "text",
|
|
116
|
+
onClick: onCancel
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
121
|
+
className: "flex flex-wrap items-center gap-2 ps-6 pt-3",
|
|
122
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Email, {
|
|
123
|
+
"aria-hidden": true,
|
|
124
|
+
className: "neeto-ui-text-gray-500",
|
|
125
|
+
size: 16
|
|
126
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
127
|
+
className: "neeto-ui-text-gray-600",
|
|
128
|
+
style: "body2",
|
|
129
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
130
|
+
components: {
|
|
131
|
+
strong: /*#__PURE__*/jsxRuntime.jsx("strong", {
|
|
132
|
+
className: "neeto-ui-text-gray-800"
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
i18nKey: recipientKey,
|
|
136
|
+
values: {
|
|
137
|
+
email: email
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
141
|
+
"data-testid": dataTestids.change,
|
|
142
|
+
label: t("neetoMolecules.onboarding.communityScreen.changeButton"),
|
|
143
|
+
size: "small",
|
|
144
|
+
style: "link",
|
|
145
|
+
onClick: onStartEditing
|
|
146
|
+
})]
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
var joinCommunity = function joinCommunity(communityJoin) {
|
|
151
|
+
return axios.post("".concat(constants.BASE_API_V1_URL, "/community_join"), {
|
|
152
|
+
communityJoin: communityJoin
|
|
153
|
+
}, {
|
|
154
|
+
showToastr: false
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
var communityApi = {
|
|
158
|
+
joinCommunity: joinCommunity
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
var useJoinCommunity = function useJoinCommunity() {
|
|
162
|
+
return reactQuery.useMutation({
|
|
163
|
+
mutationFn: communityApi.joinCommunity
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var isValidEmail = function isValidEmail(email) {
|
|
168
|
+
return !!email && yup__namespace.string().email().isValidSync(email);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
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; }
|
|
172
|
+
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; }
|
|
173
|
+
|
|
174
|
+
// Tracks the email each option goes to, plus any address being edited, so
|
|
175
|
+
// Continue can pick up a draft the user typed but did not save.
|
|
176
|
+
var useRecipientEmails = function useRecipientEmails(defaultEmail) {
|
|
177
|
+
var _useState = React.useState({
|
|
178
|
+
slack: defaultEmail,
|
|
179
|
+
blog: defaultEmail
|
|
180
|
+
}),
|
|
181
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
182
|
+
emails = _useState2[0],
|
|
183
|
+
setEmails = _useState2[1];
|
|
184
|
+
|
|
185
|
+
// { [key]: { draft, error } } for the options whose email field is open.
|
|
186
|
+
var _useState3 = React.useState({}),
|
|
187
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
188
|
+
edits = _useState4[0],
|
|
189
|
+
setEdits = _useState4[1];
|
|
190
|
+
var startEditing = function startEditing(key) {
|
|
191
|
+
return setEdits(ramda.assoc(key, {
|
|
192
|
+
draft: emails[key],
|
|
193
|
+
error: ""
|
|
194
|
+
}));
|
|
195
|
+
};
|
|
196
|
+
var changeDraft = function changeDraft(key, draft) {
|
|
197
|
+
return setEdits(ramda.assoc(key, {
|
|
198
|
+
draft: draft,
|
|
199
|
+
error: ""
|
|
200
|
+
}));
|
|
201
|
+
};
|
|
202
|
+
var cancel = function cancel(key) {
|
|
203
|
+
return setEdits(ramda.dissoc(key));
|
|
204
|
+
};
|
|
205
|
+
var validate = function validate(key) {
|
|
206
|
+
var draft = edits[key].draft.trim();
|
|
207
|
+
return isValidEmail(draft) ? {
|
|
208
|
+
draft: draft
|
|
209
|
+
} : {
|
|
210
|
+
error: i18next.t("neetoMolecules.onboarding.communityScreen.invalidEmail")
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
var save = function save(key) {
|
|
214
|
+
var _validate = validate(key),
|
|
215
|
+
draft = _validate.draft,
|
|
216
|
+
error = _validate.error;
|
|
217
|
+
if (error) {
|
|
218
|
+
setEdits(ramda.assoc(key, _objectSpread$3(_objectSpread$3({}, edits[key]), {}, {
|
|
219
|
+
error: error
|
|
220
|
+
})));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
setEmails(ramda.assoc(key, draft));
|
|
224
|
+
setEdits(ramda.dissoc(key));
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Applies every open draft of the given options. Returns the final emails,
|
|
228
|
+
// or null when a draft is invalid, after showing its error.
|
|
229
|
+
var applyDrafts = function applyDrafts(keys) {
|
|
230
|
+
var nextEmails = emails;
|
|
231
|
+
var nextEdits = edits;
|
|
232
|
+
keys.filter(function (key) {
|
|
233
|
+
return edits[key];
|
|
234
|
+
}).forEach(function (key) {
|
|
235
|
+
var _validate2 = validate(key),
|
|
236
|
+
draft = _validate2.draft,
|
|
237
|
+
error = _validate2.error;
|
|
238
|
+
if (error) {
|
|
239
|
+
nextEdits = ramda.assoc(key, _objectSpread$3(_objectSpread$3({}, edits[key]), {}, {
|
|
240
|
+
error: error
|
|
241
|
+
}), nextEdits);
|
|
242
|
+
} else {
|
|
243
|
+
nextEmails = ramda.assoc(key, draft, nextEmails);
|
|
244
|
+
nextEdits = ramda.dissoc(key, nextEdits);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
setEmails(nextEmails);
|
|
248
|
+
setEdits(nextEdits);
|
|
249
|
+
var hasInvalidDraft = keys.some(function (key) {
|
|
250
|
+
return nextEdits[key];
|
|
251
|
+
});
|
|
252
|
+
return hasInvalidDraft ? null : nextEmails;
|
|
253
|
+
};
|
|
254
|
+
return {
|
|
255
|
+
emails: emails,
|
|
256
|
+
edits: edits,
|
|
257
|
+
startEditing: startEditing,
|
|
258
|
+
changeDraft: changeDraft,
|
|
259
|
+
cancel: cancel,
|
|
260
|
+
save: save,
|
|
261
|
+
applyDrafts: applyDrafts
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
21
265
|
var GENERAL_ONBOARDING_STEPS = {
|
|
22
266
|
WELCOME: "welcome",
|
|
267
|
+
COMMUNITY: "community",
|
|
23
268
|
HELP: "help",
|
|
24
269
|
FINISH: "finish"
|
|
25
270
|
};
|
|
26
271
|
|
|
272
|
+
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; }
|
|
273
|
+
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; }
|
|
274
|
+
var Community = function Community(_ref) {
|
|
275
|
+
var _globalProps$user, _globalProps$appName;
|
|
276
|
+
var setCurrentStep = _ref.setCurrentStep,
|
|
277
|
+
communityScreenClassName = _ref.communityScreenClassName;
|
|
278
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
279
|
+
t = _useTranslation.t;
|
|
280
|
+
var _useState = React.useState({
|
|
281
|
+
slack: true,
|
|
282
|
+
blog: true
|
|
283
|
+
}),
|
|
284
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
285
|
+
selected = _useState2[0],
|
|
286
|
+
setSelected = _useState2[1];
|
|
287
|
+
|
|
288
|
+
// Both start at the signed-in user's email; each can be changed separately.
|
|
289
|
+
var recipients = useRecipientEmails((_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email);
|
|
290
|
+
var _useJoinCommunity = useJoinCommunity(),
|
|
291
|
+
joinCommunity = _useJoinCommunity.mutate;
|
|
292
|
+
var appName = neetoCist.capitalize((_globalProps$appName = initializers.globalProps.appName) !== null && _globalProps$appName !== void 0 ? _globalProps$appName : "");
|
|
293
|
+
var handleContinue = function handleContinue() {
|
|
294
|
+
var selectedKeys = Object.keys(selected).filter(function (key) {
|
|
295
|
+
return selected[key];
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// An address typed but not saved still counts; an invalid one keeps the
|
|
299
|
+
// user here with its error showing.
|
|
300
|
+
var emails = recipients.applyDrafts(selectedKeys);
|
|
301
|
+
if (!emails) return;
|
|
302
|
+
|
|
303
|
+
// The Slack invite and blog subscription are both sent by email in the
|
|
304
|
+
// background, so onboarding moves on without waiting for them.
|
|
305
|
+
if (selectedKeys.length > 0) {
|
|
306
|
+
joinCommunity(_objectSpread$2(_objectSpread$2({}, selected), {}, {
|
|
307
|
+
slackEmail: emails.slack,
|
|
308
|
+
blogEmail: emails.blog
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
setCurrentStep(GENERAL_ONBOARDING_STEPS.HELP);
|
|
312
|
+
};
|
|
313
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
314
|
+
className: classnames("mx-auto flex w-full max-w-3xl flex-col items-start gap-y-6 px-6 pt-16 pb-6", communityScreenClassName),
|
|
315
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
316
|
+
className: "space-y-2",
|
|
317
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
318
|
+
"data-testid": "onboarding-community-title",
|
|
319
|
+
style: "h1",
|
|
320
|
+
children: t("neetoMolecules.onboarding.communityScreen.title")
|
|
321
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
322
|
+
"data-testid": "onboarding-community-description",
|
|
323
|
+
style: "body1",
|
|
324
|
+
children: t("neetoMolecules.onboarding.communityScreen.description", {
|
|
325
|
+
appName: appName
|
|
326
|
+
})
|
|
327
|
+
})]
|
|
328
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
329
|
+
className: "neeto-ui-rounded-lg neeto-ui-border-gray-200 flex w-full flex-col gap-6 border p-3 lg:p-6",
|
|
330
|
+
children: COMMUNITY_OPTIONS.map(function (_ref2) {
|
|
331
|
+
var key = _ref2.key,
|
|
332
|
+
Icon = _ref2.icon,
|
|
333
|
+
dataTestid = _ref2.dataTestid,
|
|
334
|
+
recipientDataTestids = _ref2.recipientDataTestids;
|
|
335
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
336
|
+
className: "w-full",
|
|
337
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
338
|
+
checked: selected[key],
|
|
339
|
+
"data-testid": dataTestid,
|
|
340
|
+
id: dataTestid,
|
|
341
|
+
labelProps: {
|
|
342
|
+
className: "text-xl font-semibold"
|
|
343
|
+
},
|
|
344
|
+
label: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
345
|
+
className: "flex flex-wrap items-center gap-2",
|
|
346
|
+
children: [t("neetoMolecules.onboarding.communityScreen.".concat(key, ".title"), {
|
|
347
|
+
appName: appName
|
|
348
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
349
|
+
"aria-hidden": true,
|
|
350
|
+
size: 24
|
|
351
|
+
})]
|
|
352
|
+
}),
|
|
353
|
+
onChange: function onChange(event) {
|
|
354
|
+
setSelected(ramda.assoc(key, event.target.checked));
|
|
355
|
+
if (!event.target.checked) recipients.cancel(key);
|
|
356
|
+
}
|
|
357
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
358
|
+
className: "neeto-ui-text-gray-600 ps-6 pt-2",
|
|
359
|
+
style: "body1",
|
|
360
|
+
children: t("neetoMolecules.onboarding.communityScreen.".concat(key, ".description"))
|
|
361
|
+
}), selected[key] && /*#__PURE__*/jsxRuntime.jsx(EmailRecipient, {
|
|
362
|
+
dataTestids: recipientDataTestids,
|
|
363
|
+
edit: recipients.edits[key],
|
|
364
|
+
email: recipients.emails[key],
|
|
365
|
+
inputLabelKey: "neetoMolecules.onboarding.communityScreen.".concat(key, ".emailInputLabel"),
|
|
366
|
+
recipientKey: "neetoMolecules.onboarding.communityScreen.".concat(key, ".recipient"),
|
|
367
|
+
onCancel: function onCancel() {
|
|
368
|
+
return recipients.cancel(key);
|
|
369
|
+
},
|
|
370
|
+
onDraftChange: function onDraftChange(draft) {
|
|
371
|
+
return recipients.changeDraft(key, draft);
|
|
372
|
+
},
|
|
373
|
+
onSave: function onSave() {
|
|
374
|
+
return recipients.save(key);
|
|
375
|
+
},
|
|
376
|
+
onStartEditing: function onStartEditing() {
|
|
377
|
+
return recipients.startEditing(key);
|
|
378
|
+
}
|
|
379
|
+
})]
|
|
380
|
+
}, key);
|
|
381
|
+
})
|
|
382
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
383
|
+
className: "neeto-ui-text-gray-600",
|
|
384
|
+
style: "body2",
|
|
385
|
+
children: t("neetoMolecules.onboarding.communityScreen.unsubscribe")
|
|
386
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
387
|
+
"data-testid": "community-onboarding-continue-button",
|
|
388
|
+
icon: RightArrow,
|
|
389
|
+
iconPosition: "right",
|
|
390
|
+
label: t("neetoMolecules.onboarding.communityScreen.continueButton"),
|
|
391
|
+
onClick: handleContinue
|
|
392
|
+
})]
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
|
|
27
396
|
var HelpScreen = function HelpScreen(_ref) {
|
|
28
397
|
var setCurrentStep = _ref.setCurrentStep,
|
|
29
398
|
helpScreenClassName = _ref.helpScreenClassName;
|
|
@@ -76,7 +445,14 @@ var HelpScreen = function HelpScreen(_ref) {
|
|
|
76
445
|
|
|
77
446
|
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; }
|
|
78
447
|
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; }
|
|
79
|
-
var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName) {
|
|
448
|
+
var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName, isCommunityStepVisible) {
|
|
449
|
+
var communityStep = {
|
|
450
|
+
key: GENERAL_ONBOARDING_STEPS.COMMUNITY,
|
|
451
|
+
label: i18next.t("neetoMolecules.onboarding.communityLabel"),
|
|
452
|
+
element: /*#__PURE__*/jsxRuntime.jsx(Community, {
|
|
453
|
+
setCurrentStep: setCurrentStep
|
|
454
|
+
})
|
|
455
|
+
};
|
|
80
456
|
var helpStep = {
|
|
81
457
|
key: GENERAL_ONBOARDING_STEPS.HELP,
|
|
82
458
|
label: i18next.t("neetoMolecules.onboarding.helpLabel"),
|
|
@@ -86,7 +462,7 @@ var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentS
|
|
|
86
462
|
setCurrentStep: setCurrentStep
|
|
87
463
|
})
|
|
88
464
|
};
|
|
89
|
-
return onboardingSteps.concat(helpStep).map(function (step, idx) {
|
|
465
|
+
return onboardingSteps.concat(isCommunityStepVisible ? [communityStep, helpStep] : helpStep).map(function (step, idx) {
|
|
90
466
|
return _objectSpread$1(_objectSpread$1({}, step), {}, {
|
|
91
467
|
id: idx + 1
|
|
92
468
|
});
|
|
@@ -244,11 +620,27 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
244
620
|
welcomeScreenClassName = _ref$welcomeScreenCla === void 0 ? "" : _ref$welcomeScreenCla,
|
|
245
621
|
_ref$completedScreenC = _ref.completedScreenClassName,
|
|
246
622
|
completedScreenClassName = _ref$completedScreenC === void 0 ? "" : _ref$completedScreenC,
|
|
247
|
-
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage
|
|
623
|
+
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage,
|
|
624
|
+
_ref$isCommunityStepV = _ref.isCommunityStepVisible,
|
|
625
|
+
isCommunityStepVisible = _ref$isCommunityStepV === void 0 ? true : _ref$isCommunityStepV;
|
|
248
626
|
var steps = React.useMemo(function () {
|
|
249
|
-
return createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName);
|
|
250
|
-
}, [onboardingSteps]);
|
|
627
|
+
return createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName, isCommunityStepVisible);
|
|
628
|
+
}, [onboardingSteps, isCommunityStepVisible]);
|
|
251
629
|
var prevStep = React.useRef(currentStep);
|
|
630
|
+
var isStepperNavigation = React.useRef(false);
|
|
631
|
+
var isRedirectingToCommunity = React.useRef(false);
|
|
632
|
+
|
|
633
|
+
// Products move from their last step straight to Help. Send them through
|
|
634
|
+
// the community step first, unless they picked Help in the stepper.
|
|
635
|
+
React.useLayoutEffect(function () {
|
|
636
|
+
var isFromStepper = isStepperNavigation.current;
|
|
637
|
+
isStepperNavigation.current = false;
|
|
638
|
+
var shouldShowCommunityFirst = isCommunityStepVisible && !isFromStepper && currentStep === GENERAL_ONBOARDING_STEPS.HELP && prevStep.current !== currentStep && prevStep.current !== GENERAL_ONBOARDING_STEPS.COMMUNITY;
|
|
639
|
+
if (shouldShowCommunityFirst) {
|
|
640
|
+
isRedirectingToCommunity.current = true;
|
|
641
|
+
setCurrentStep(GENERAL_ONBOARDING_STEPS.COMMUNITY);
|
|
642
|
+
}
|
|
643
|
+
}, [currentStep]);
|
|
252
644
|
var _useState = React.useState(""),
|
|
253
645
|
_useState2 = _slicedToArray(_useState, 2),
|
|
254
646
|
direction = _useState2[0],
|
|
@@ -260,6 +652,13 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
260
652
|
};
|
|
261
653
|
React.useEffect(function () {
|
|
262
654
|
if (currentStep === prevStep.current) return;
|
|
655
|
+
|
|
656
|
+
// Help is skipped over on the way to the community step, so the
|
|
657
|
+
// animation should run from the step before it.
|
|
658
|
+
if (isRedirectingToCommunity.current) {
|
|
659
|
+
isRedirectingToCommunity.current = false;
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
263
662
|
setDirection(getOnboardingStepIndex(currentStep) > getOnboardingStepIndex(prevStep.current) ? "forward" : "backward");
|
|
264
663
|
prevStep.current = currentStep;
|
|
265
664
|
}, [currentStep]);
|
|
@@ -279,7 +678,10 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
279
678
|
});
|
|
280
679
|
}
|
|
281
680
|
var handleStepChange = function handleStepChange(index) {
|
|
282
|
-
|
|
681
|
+
var stepKey = steps[index].key;
|
|
682
|
+
if (stepKey === currentStep) return;
|
|
683
|
+
isStepperNavigation.current = true;
|
|
684
|
+
setCurrentStep(stepKey);
|
|
283
685
|
};
|
|
284
686
|
var isStepperVisible = steps.length > 1;
|
|
285
687
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|