@bigbinary/neeto-molecules 1.16.3 → 1.17.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.
- package/dist/Onboarding.js +181 -9
- package/dist/Onboarding.js.map +1 -1
- package/dist/ProductEmbed.js +235 -102
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/Settings.js +5 -2
- package/dist/Settings.js.map +1 -1
- package/dist/cjs/Onboarding.js +180 -7
- package/dist/cjs/Onboarding.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +231 -98
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/dist/cjs/Settings.js +5 -2
- package/dist/cjs/Settings.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +9 -0
- package/types/Onboarding.d.ts +38 -108
- package/types/ProductEmbed.d.ts +1 -0
- package/types/Settings.d.ts +1 -0
- package/dist/ShareRecording.js +0 -218
- package/dist/ShareRecording.js.map +0 -1
- package/dist/cjs/ShareRecording.js +0 -224
- package/dist/cjs/ShareRecording.js.map +0 -1
- package/types/ShareRecording.d.ts +0 -35
package/dist/ProductEmbed.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { _ as _defineProperty } from './defineProperty-549061a7.js';
|
|
2
2
|
import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
|
|
3
|
-
import React__default, {
|
|
3
|
+
import React__default, { useState, useEffect } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { Code as Code$1, Eye, LeftArrow } from '@bigbinary/neeto-icons';
|
|
6
|
-
import { Typography, Callout,
|
|
7
|
-
import { mergeDeepLeft, toPairs, mergeLeft } from 'ramda';
|
|
5
|
+
import { Code as Code$1, Eye, Delete, Plus, LeftArrow } from '@bigbinary/neeto-icons';
|
|
6
|
+
import { Label, Input, Button, Typography, Callout, Checkbox, Select, ColorPicker, Tab, Radio, Spinner } from '@bigbinary/neetoui';
|
|
7
|
+
import { mergeDeepLeft, toPairs, isEmpty, mergeLeft } from 'ramda';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
import Codeblock from './Codeblock.js';
|
|
10
10
|
import { t } from 'i18next';
|
|
11
|
+
import { _ as _toConsumableArray } from './toConsumableArray-1cc38429.js';
|
|
11
12
|
import { n } from './inject-css-c86de496.js';
|
|
12
13
|
import './extends-093996c9.js';
|
|
13
14
|
import 'react-syntax-highlighter';
|
|
@@ -60,12 +61,211 @@ var DEFAULT_CUSTOMIZATION = _defineProperty(_defineProperty(_defineProperty({},
|
|
|
60
61
|
});
|
|
61
62
|
var SCRIPT_ID = "embed-script";
|
|
62
63
|
|
|
64
|
+
var FLOATING_BUTTON_POSITIONS = [{
|
|
65
|
+
label: t("neetoMolecules.productEmbed.customization.position.bottomLeft"),
|
|
66
|
+
value: "bottomLeft"
|
|
67
|
+
}, {
|
|
68
|
+
label: t("neetoMolecules.productEmbed.customization.position.bottomRight"),
|
|
69
|
+
value: "bottomRight"
|
|
70
|
+
}];
|
|
71
|
+
var INITIAL_QUERY_PARAM = {
|
|
72
|
+
name: "",
|
|
73
|
+
value: ""
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var embedBaseScript = function embedBaseScript(embedScriptLink) {
|
|
77
|
+
return "<script>window.".concat(globalProps.appName, " = window.").concat(globalProps.appName, " || { embed: function(){(").concat(globalProps.appName, ".q=").concat(globalProps.appName, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
|
|
78
|
+
};
|
|
79
|
+
var embedEnv = function embedEnv() {
|
|
80
|
+
return globalProps.railsEnv !== "production" ? "\n\t env: \"".concat(globalProps.railsEnv, "\",") : "";
|
|
81
|
+
};
|
|
82
|
+
var embedQueryParam = function embedQueryParam(queryParams) {
|
|
83
|
+
return queryParams ? "\n\t queryParams: ".concat(queryParams, ",") : "";
|
|
84
|
+
};
|
|
85
|
+
var parseExtraArgs = function parseExtraArgs(extraArgs) {
|
|
86
|
+
return toPairs(extraArgs).map(function (_ref) {
|
|
87
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
88
|
+
key = _ref2[0],
|
|
89
|
+
value = _ref2[1];
|
|
90
|
+
return "\n\t ".concat(key, ": \"").concat(value, "\"");
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var inlineEmbedCode = function inlineEmbedCode(_ref3) {
|
|
94
|
+
var customization = _ref3.customization,
|
|
95
|
+
id = _ref3.id,
|
|
96
|
+
embedScriptLink = _ref3.embedScriptLink,
|
|
97
|
+
extraArgs = _ref3.extraArgs;
|
|
98
|
+
var elementSelector = customization.elementSelector,
|
|
99
|
+
_customization$width = customization.width,
|
|
100
|
+
width = _customization$width === void 0 ? 100 : _customization$width,
|
|
101
|
+
_customization$height = customization.height,
|
|
102
|
+
height = _customization$height === void 0 ? 100 : _customization$height,
|
|
103
|
+
queryParams = customization.queryParams;
|
|
104
|
+
return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"min-width: 90vw; height: 90vh;\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
|
|
105
|
+
};
|
|
106
|
+
var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
|
|
107
|
+
var customization = _ref4.customization,
|
|
108
|
+
id = _ref4.id,
|
|
109
|
+
embedScriptLink = _ref4.embedScriptLink,
|
|
110
|
+
extraArgs = _ref4.extraArgs;
|
|
111
|
+
var btnTextColor = customization.btnTextColor,
|
|
112
|
+
showIcon = customization.showIcon,
|
|
113
|
+
btnText = customization.btnText,
|
|
114
|
+
btnPosition = customization.btnPosition,
|
|
115
|
+
btnColor = customization.btnColor,
|
|
116
|
+
icon = customization.icon,
|
|
117
|
+
queryParams = customization.queryParams;
|
|
118
|
+
return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n\t\tshowIcon: ".concat(showIcon, ",") : "", "\n },").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
|
|
119
|
+
};
|
|
120
|
+
var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
|
|
121
|
+
var customization = _ref5.customization,
|
|
122
|
+
id = _ref5.id,
|
|
123
|
+
embedScriptLink = _ref5.embedScriptLink,
|
|
124
|
+
extraArgs = _ref5.extraArgs;
|
|
125
|
+
var elementSelector = customization.elementSelector,
|
|
126
|
+
queryParams = customization.queryParams;
|
|
127
|
+
return "\n <!-- ".concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
|
|
128
|
+
};
|
|
129
|
+
var embedCode = function embedCode(_ref6) {
|
|
130
|
+
var type = _ref6.type,
|
|
131
|
+
customization = _ref6.customization,
|
|
132
|
+
id = _ref6.id,
|
|
133
|
+
embedScriptLink = _ref6.embedScriptLink,
|
|
134
|
+
_ref6$extraArgs = _ref6.extraArgs,
|
|
135
|
+
extraArgs = _ref6$extraArgs === void 0 ? {} : _ref6$extraArgs;
|
|
136
|
+
switch (type) {
|
|
137
|
+
case "inline":
|
|
138
|
+
return inlineEmbedCode({
|
|
139
|
+
customization: customization,
|
|
140
|
+
id: id,
|
|
141
|
+
embedScriptLink: embedScriptLink,
|
|
142
|
+
extraArgs: extraArgs
|
|
143
|
+
});
|
|
144
|
+
case "floatingPopup":
|
|
145
|
+
return floatingPopupEmbedCode({
|
|
146
|
+
customization: customization,
|
|
147
|
+
id: id,
|
|
148
|
+
embedScriptLink: embedScriptLink,
|
|
149
|
+
extraArgs: extraArgs
|
|
150
|
+
});
|
|
151
|
+
case "elementPopup":
|
|
152
|
+
return elementPopupEmbedCode({
|
|
153
|
+
customization: customization,
|
|
154
|
+
id: id,
|
|
155
|
+
embedScriptLink: embedScriptLink,
|
|
156
|
+
extraArgs: extraArgs
|
|
157
|
+
});
|
|
158
|
+
default:
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var buildDefaultCustomization = function buildDefaultCustomization(defaultCustomizations) {
|
|
163
|
+
return mergeDeepLeft(defaultCustomizations, DEFAULT_CUSTOMIZATION);
|
|
164
|
+
};
|
|
165
|
+
var buildQueryParamsFromInputFields = function buildQueryParamsFromInputFields(inputFields) {
|
|
166
|
+
var filteredInputFields = inputFields.filter(function (_ref7) {
|
|
167
|
+
var name = _ref7.name,
|
|
168
|
+
value = _ref7.value;
|
|
169
|
+
return name && value;
|
|
170
|
+
});
|
|
171
|
+
var queryParams = filteredInputFields.reduce(function (queryParams, _ref8) {
|
|
172
|
+
var name = _ref8.name,
|
|
173
|
+
value = _ref8.value;
|
|
174
|
+
queryParams[name] = value;
|
|
175
|
+
return queryParams;
|
|
176
|
+
}, {});
|
|
177
|
+
if (isEmpty(queryParams)) return "";
|
|
178
|
+
var queryParamJsonString = JSON.stringify(queryParams, null, 2);
|
|
179
|
+
return queryParamJsonString.replace(/"([^"]+)":/g, "$1: ").replace(/\n/g, " ").replace(/\s\s+/g, " ");
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
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; }
|
|
183
|
+
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), !0).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; }
|
|
184
|
+
var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
185
|
+
var updateCustomization = _ref.updateCustomization;
|
|
186
|
+
var _useTranslation = useTranslation(),
|
|
187
|
+
t = _useTranslation.t;
|
|
188
|
+
var _useState = useState([INITIAL_QUERY_PARAM]),
|
|
189
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
190
|
+
queryParams = _useState2[0],
|
|
191
|
+
setQueryParams = _useState2[1];
|
|
192
|
+
var handleAddQueryParam = function handleAddQueryParam() {
|
|
193
|
+
setQueryParams([].concat(_toConsumableArray(queryParams), [INITIAL_QUERY_PARAM]));
|
|
194
|
+
};
|
|
195
|
+
var handleRemoveQueryParam = function handleRemoveQueryParam(index) {
|
|
196
|
+
var newQueryParams = queryParams.filter(function (_, i) {
|
|
197
|
+
return i !== index;
|
|
198
|
+
});
|
|
199
|
+
setQueryParams(newQueryParams);
|
|
200
|
+
};
|
|
201
|
+
var handleInputChange = function handleInputChange(index, field, value) {
|
|
202
|
+
var newQueryParams = queryParams.map(function (param, i) {
|
|
203
|
+
return i === index ? _objectSpread$1(_objectSpread$1({}, param), {}, _defineProperty({}, field, value)) : param;
|
|
204
|
+
});
|
|
205
|
+
setQueryParams(newQueryParams);
|
|
206
|
+
};
|
|
207
|
+
useEffect(function () {
|
|
208
|
+
updateCustomization({
|
|
209
|
+
queryParams: buildQueryParamsFromInputFields(queryParams)
|
|
210
|
+
});
|
|
211
|
+
}, [queryParams]);
|
|
212
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Label, {
|
|
213
|
+
className: "mb-2",
|
|
214
|
+
"data-cy": "dynamic-query-params-label"
|
|
215
|
+
}, t("neetoMolecules.productEmbed.customization.queryParam.label")), queryParams.map(function (param, index) {
|
|
216
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
217
|
+
className: "mb-1 flex gap-1",
|
|
218
|
+
key: index
|
|
219
|
+
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
220
|
+
"data-cy": "dynamic-query-key-name-input",
|
|
221
|
+
"data-testid": "dynamic-query-key-name-input",
|
|
222
|
+
name: "queryParams.".concat(index, ".name"),
|
|
223
|
+
value: param.name,
|
|
224
|
+
placeholder: t("neetoMolecules.productEmbed.customization.queryParam.keyNamePlaceholder"),
|
|
225
|
+
onChange: function onChange(e) {
|
|
226
|
+
return handleInputChange(index, "name", e.target.value);
|
|
227
|
+
}
|
|
228
|
+
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
229
|
+
"data-cy": "dynamic-query-key-value-input",
|
|
230
|
+
"data-testid": "dynamic-query-key-value-input",
|
|
231
|
+
name: "queryParams.".concat(index, ".value"),
|
|
232
|
+
value: param.value,
|
|
233
|
+
placeholder: t("neetoMolecules.productEmbed.customization.queryParam.keyValuePlaceholder"),
|
|
234
|
+
onChange: function onChange(e) {
|
|
235
|
+
return handleInputChange(index, "value", e.target.value);
|
|
236
|
+
}
|
|
237
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
238
|
+
"data-cy": "dynamic-query-delete-button",
|
|
239
|
+
icon: Delete,
|
|
240
|
+
style: "text",
|
|
241
|
+
onClick: function onClick() {
|
|
242
|
+
return handleRemoveQueryParam(index);
|
|
243
|
+
}
|
|
244
|
+
}));
|
|
245
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
246
|
+
className: "my-2",
|
|
247
|
+
"data-cy": "dynamic-query-add-new-button",
|
|
248
|
+
icon: Plus,
|
|
249
|
+
iconPosition: "left",
|
|
250
|
+
style: "link",
|
|
251
|
+
label: t("neetoMolecules.productEmbed.customization.queryParam.addQueryParam"),
|
|
252
|
+
onClick: handleAddQueryParam
|
|
253
|
+
}));
|
|
254
|
+
};
|
|
255
|
+
|
|
63
256
|
var ElementPopup$1 = function ElementPopup(_ref) {
|
|
64
257
|
var customization = _ref.customization,
|
|
65
|
-
updateCustomization = _ref.updateCustomization
|
|
258
|
+
updateCustomization = _ref.updateCustomization,
|
|
259
|
+
isQueryParamsEnabled = _ref.isQueryParamsEnabled;
|
|
66
260
|
var elementSelector = customization.elementSelector;
|
|
67
261
|
var _useTranslation = useTranslation(),
|
|
68
262
|
t = _useTranslation.t;
|
|
263
|
+
useEffect(function () {
|
|
264
|
+
if (isQueryParamsEnabled) return;
|
|
265
|
+
updateCustomization({
|
|
266
|
+
queryParams: undefined
|
|
267
|
+
});
|
|
268
|
+
}, []);
|
|
69
269
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
70
270
|
className: "space-y-6"
|
|
71
271
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
@@ -85,20 +285,15 @@ var ElementPopup$1 = function ElementPopup(_ref) {
|
|
|
85
285
|
elementSelector: e.target.value
|
|
86
286
|
});
|
|
87
287
|
}
|
|
288
|
+
}), isQueryParamsEnabled && /*#__PURE__*/React__default.createElement(DynamicQueryParams, {
|
|
289
|
+
updateCustomization: updateCustomization
|
|
88
290
|
}));
|
|
89
291
|
};
|
|
90
292
|
|
|
91
|
-
var FLOATING_BUTTON_POSITIONS = [{
|
|
92
|
-
label: t("neetoMolecules.productEmbed.customization.position.bottomLeft"),
|
|
93
|
-
value: "bottomLeft"
|
|
94
|
-
}, {
|
|
95
|
-
label: t("neetoMolecules.productEmbed.customization.position.bottomRight"),
|
|
96
|
-
value: "bottomRight"
|
|
97
|
-
}];
|
|
98
|
-
|
|
99
293
|
var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
100
294
|
var customization = _ref.customization,
|
|
101
|
-
updateCustomization = _ref.updateCustomization
|
|
295
|
+
updateCustomization = _ref.updateCustomization,
|
|
296
|
+
isQueryParamsEnabled = _ref.isQueryParamsEnabled;
|
|
102
297
|
var _useTranslation = useTranslation(),
|
|
103
298
|
t = _useTranslation.t;
|
|
104
299
|
var btnTextColor = customization.btnTextColor,
|
|
@@ -107,6 +302,12 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
|
107
302
|
btnPosition = customization.btnPosition,
|
|
108
303
|
btnColor = customization.btnColor,
|
|
109
304
|
icon = customization.icon;
|
|
305
|
+
useEffect(function () {
|
|
306
|
+
if (isQueryParamsEnabled) return;
|
|
307
|
+
updateCustomization({
|
|
308
|
+
queryParams: undefined
|
|
309
|
+
});
|
|
310
|
+
}, []);
|
|
110
311
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
111
312
|
className: "space-y-6"
|
|
112
313
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
@@ -170,12 +371,15 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
|
170
371
|
btnTextColor: e.hex
|
|
171
372
|
});
|
|
172
373
|
}
|
|
173
|
-
}))
|
|
374
|
+
})), isQueryParamsEnabled && /*#__PURE__*/React__default.createElement(DynamicQueryParams, {
|
|
375
|
+
updateCustomization: updateCustomization
|
|
376
|
+
}));
|
|
174
377
|
};
|
|
175
378
|
|
|
176
379
|
var Inline$1 = function Inline(_ref) {
|
|
177
380
|
var customization = _ref.customization,
|
|
178
|
-
updateCustomization = _ref.updateCustomization
|
|
381
|
+
updateCustomization = _ref.updateCustomization,
|
|
382
|
+
isQueryParamsEnabled = _ref.isQueryParamsEnabled;
|
|
179
383
|
var height = customization.height,
|
|
180
384
|
width = customization.width,
|
|
181
385
|
elementSelector = customization.elementSelector;
|
|
@@ -185,6 +389,12 @@ var Inline$1 = function Inline(_ref) {
|
|
|
185
389
|
var value = _ref2.target.value;
|
|
186
390
|
return updateCustomization(_defineProperty({}, attribute, value));
|
|
187
391
|
};
|
|
392
|
+
useEffect(function () {
|
|
393
|
+
if (isQueryParamsEnabled) return;
|
|
394
|
+
updateCustomization({
|
|
395
|
+
queryParams: undefined
|
|
396
|
+
});
|
|
397
|
+
}, []);
|
|
188
398
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
189
399
|
className: "flex flex-col gap-y-6"
|
|
190
400
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
@@ -233,17 +443,21 @@ var Inline$1 = function Inline(_ref) {
|
|
|
233
443
|
onChange: function onChange(e) {
|
|
234
444
|
return handleInputChange(e, "elementSelector");
|
|
235
445
|
}
|
|
236
|
-
}))
|
|
446
|
+
})), isQueryParamsEnabled && /*#__PURE__*/React__default.createElement(DynamicQueryParams, {
|
|
447
|
+
updateCustomization: updateCustomization
|
|
448
|
+
}));
|
|
237
449
|
};
|
|
238
450
|
|
|
239
451
|
var Customization = function Customization(_ref) {
|
|
240
452
|
var option = _ref.option,
|
|
241
453
|
customization = _ref.customization,
|
|
242
|
-
updateCustomization = _ref.updateCustomization
|
|
454
|
+
updateCustomization = _ref.updateCustomization,
|
|
455
|
+
isQueryParamsEnabled = _ref.isQueryParamsEnabled;
|
|
243
456
|
var type = _defineProperty(_defineProperty(_defineProperty({}, EMBED_OPTIONS.INLINE, Inline$1), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup$1), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup$1);
|
|
244
457
|
var Component = type[option];
|
|
245
458
|
return /*#__PURE__*/React__default.createElement(Component, {
|
|
246
459
|
customization: customization,
|
|
460
|
+
isQueryParamsEnabled: isQueryParamsEnabled,
|
|
247
461
|
updateCustomization: updateCustomization
|
|
248
462
|
});
|
|
249
463
|
};
|
|
@@ -436,90 +650,6 @@ var Preview = function Preview(_ref) {
|
|
|
436
650
|
var css = ".neeto-molecules-product-embed-size-input.neeto-ui-input__wrapper .neeto-ui-input__prefix{align-self:stretch;background-color:rgb(var(--neeto-ui-gray-200));margin-left:0!important;padding-left:12px;padding-right:12px}.neeto-molecules-product-embed-tab{gap:.5rem}.neeto-molecules-product-embed-tab .neeto-ui-tab{border-radius:var(--neeto-ui-btn-border-radius);color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-product-embed-tab .neeto-ui-tab:not(.active):hover{background-color:rgb(var(--neeto-ui-gray-100))}.neeto-molecules-product-embed-tab .neeto-ui-tab.active{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-embed-left-sidebar{align-items:flex-start;display:flex;flex-direction:column;flex-shrink:0;max-width:28rem;overflow-y:auto;padding:1.5rem;width:100%}";
|
|
437
651
|
n(css,{});
|
|
438
652
|
|
|
439
|
-
var embedBaseScript = function embedBaseScript(embedScriptLink) {
|
|
440
|
-
return "<script>window.".concat(globalProps.appName, " = window.").concat(globalProps.appName, " || { embed: function(){(").concat(globalProps.appName, ".q=").concat(globalProps.appName, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
|
|
441
|
-
};
|
|
442
|
-
var embedEnv = function embedEnv() {
|
|
443
|
-
return globalProps.railsEnv !== "production" ? "\n\t env: \"".concat(globalProps.railsEnv, "\",") : "";
|
|
444
|
-
};
|
|
445
|
-
var parseExtraArgs = function parseExtraArgs(extraArgs) {
|
|
446
|
-
return toPairs(extraArgs).map(function (_ref) {
|
|
447
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
448
|
-
key = _ref2[0],
|
|
449
|
-
value = _ref2[1];
|
|
450
|
-
return "\n\t ".concat(key, ": \"").concat(value, "\"");
|
|
451
|
-
});
|
|
452
|
-
};
|
|
453
|
-
var inlineEmbedCode = function inlineEmbedCode(_ref3) {
|
|
454
|
-
var customization = _ref3.customization,
|
|
455
|
-
id = _ref3.id,
|
|
456
|
-
embedScriptLink = _ref3.embedScriptLink,
|
|
457
|
-
extraArgs = _ref3.extraArgs;
|
|
458
|
-
var elementSelector = customization.elementSelector,
|
|
459
|
-
_customization$width = customization.width,
|
|
460
|
-
width = _customization$width === void 0 ? 100 : _customization$width,
|
|
461
|
-
_customization$height = customization.height,
|
|
462
|
-
height = _customization$height === void 0 ? 100 : _customization$height;
|
|
463
|
-
return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"min-width: 90vw; height: 90vh;\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
|
|
464
|
-
};
|
|
465
|
-
var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
|
|
466
|
-
var customization = _ref4.customization,
|
|
467
|
-
id = _ref4.id,
|
|
468
|
-
embedScriptLink = _ref4.embedScriptLink,
|
|
469
|
-
extraArgs = _ref4.extraArgs;
|
|
470
|
-
var btnTextColor = customization.btnTextColor,
|
|
471
|
-
showIcon = customization.showIcon,
|
|
472
|
-
btnText = customization.btnText,
|
|
473
|
-
btnPosition = customization.btnPosition,
|
|
474
|
-
btnColor = customization.btnColor,
|
|
475
|
-
icon = customization.icon;
|
|
476
|
-
return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n\t\tshowIcon: ".concat(showIcon, ",") : "", "\n },").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
|
|
477
|
-
};
|
|
478
|
-
var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
|
|
479
|
-
var customization = _ref5.customization,
|
|
480
|
-
id = _ref5.id,
|
|
481
|
-
embedScriptLink = _ref5.embedScriptLink,
|
|
482
|
-
extraArgs = _ref5.extraArgs;
|
|
483
|
-
var elementSelector = customization.elementSelector;
|
|
484
|
-
return "\n <!-- ".concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
|
|
485
|
-
};
|
|
486
|
-
var embedCode = function embedCode(_ref6) {
|
|
487
|
-
var type = _ref6.type,
|
|
488
|
-
customization = _ref6.customization,
|
|
489
|
-
id = _ref6.id,
|
|
490
|
-
embedScriptLink = _ref6.embedScriptLink,
|
|
491
|
-
_ref6$extraArgs = _ref6.extraArgs,
|
|
492
|
-
extraArgs = _ref6$extraArgs === void 0 ? {} : _ref6$extraArgs;
|
|
493
|
-
switch (type) {
|
|
494
|
-
case "inline":
|
|
495
|
-
return inlineEmbedCode({
|
|
496
|
-
customization: customization,
|
|
497
|
-
id: id,
|
|
498
|
-
embedScriptLink: embedScriptLink,
|
|
499
|
-
extraArgs: extraArgs
|
|
500
|
-
});
|
|
501
|
-
case "floatingPopup":
|
|
502
|
-
return floatingPopupEmbedCode({
|
|
503
|
-
customization: customization,
|
|
504
|
-
id: id,
|
|
505
|
-
embedScriptLink: embedScriptLink,
|
|
506
|
-
extraArgs: extraArgs
|
|
507
|
-
});
|
|
508
|
-
case "elementPopup":
|
|
509
|
-
return elementPopupEmbedCode({
|
|
510
|
-
customization: customization,
|
|
511
|
-
id: id,
|
|
512
|
-
embedScriptLink: embedScriptLink,
|
|
513
|
-
extraArgs: extraArgs
|
|
514
|
-
});
|
|
515
|
-
default:
|
|
516
|
-
return "";
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
var buildDefaultCustomization = function buildDefaultCustomization(defaultCustomizations) {
|
|
520
|
-
return mergeDeepLeft(defaultCustomizations, DEFAULT_CUSTOMIZATION);
|
|
521
|
-
};
|
|
522
|
-
|
|
523
653
|
function ownKeys(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; }
|
|
524
654
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
525
655
|
var ProductEmbed = function ProductEmbed(_ref) {
|
|
@@ -532,6 +662,8 @@ var ProductEmbed = function ProductEmbed(_ref) {
|
|
|
532
662
|
_ref$goBackLink = _ref.goBackLink,
|
|
533
663
|
goBackLink = _ref$goBackLink === void 0 ? "" : _ref$goBackLink,
|
|
534
664
|
id = _ref.id,
|
|
665
|
+
_ref$isQueryParamsEna = _ref.isQueryParamsEnabled,
|
|
666
|
+
isQueryParamsEnabled = _ref$isQueryParamsEna === void 0 ? false : _ref$isQueryParamsEna,
|
|
535
667
|
_ref$options = _ref.options,
|
|
536
668
|
options = _ref$options === void 0 ? {} : _ref$options,
|
|
537
669
|
_ref$extraArgs = _ref.extraArgs,
|
|
@@ -609,6 +741,7 @@ var ProductEmbed = function ProductEmbed(_ref) {
|
|
|
609
741
|
selectedOption: selectedOption,
|
|
610
742
|
setSelectedOption: setSelectedOption
|
|
611
743
|
}), /*#__PURE__*/React__default.createElement(Customization, {
|
|
744
|
+
isQueryParamsEnabled: isQueryParamsEnabled,
|
|
612
745
|
updateCustomization: updateCustomization,
|
|
613
746
|
customization: customizations[selectedOption],
|
|
614
747
|
option: selectedOption
|