@web-site-utilities/feedback 0.0.14 → 0.0.16

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.
@@ -117,6 +117,7 @@ export type PopupForm = {
117
117
  export type FormConfig = {
118
118
  id: string;
119
119
  domainId: string;
120
+ versionId: string;
120
121
  inlineForm: Nullable<InlineForm>;
121
122
  popupForm: Nullable<PopupForm>;
122
123
  attributes: {
package/dist/index.cjs.js CHANGED
@@ -1360,206 +1360,8 @@ const createBaseApi = () => {
1360
1360
  }
1361
1361
  };
1362
1362
  };
1363
- const formMock = {
1364
- meta: { name: "asd" },
1365
- steps: [
1366
- {
1367
- title: "Overall altitude",
1368
- meta: { name: "overall" },
1369
- fields: [
1370
- {
1371
- type: "matrix",
1372
- meta: { name: "asd", fieldKey: "recommendationChance" },
1373
- validations: {
1374
- required: true
1375
- },
1376
- label: {
1377
- default: "How likely are you to recommend this company to a friend or colleague?"
1378
- },
1379
- max: 10
1380
- },
1381
- {
1382
- type: "radio-group",
1383
- meta: { name: "asd", fieldKey: "satisfactionLevel" },
1384
- label: {
1385
- default: "Overall, how satisfied or dissatisfied are you with our company?"
1386
- },
1387
- validations: { required: true },
1388
- options: [
1389
- { label: "Very satisfied", id: "1" },
1390
- { label: "Somewhat satisfied", id: "2" },
1391
- { label: "Neither satisfied nor dissatisfied", id: "3" },
1392
- { label: "Somewhat dissatisfied", id: "4" },
1393
- { label: "Very dissatisfied", id: "5" }
1394
- ]
1395
- },
1396
- {
1397
- type: "rating",
1398
- icon: "star2",
1399
- max: 5,
1400
- meta: { name: "asd", fieldKey: "satisfactionRating" },
1401
- label: { default: "What is your general satisfaction?" },
1402
- validations: { required: true }
1403
- }
1404
- ]
1405
- },
1406
- {
1407
- meta: { name: "products" },
1408
- title: "Product questions",
1409
- fields: [
1410
- {
1411
- type: "checkbox-group",
1412
- meta: { name: "asd", fieldKey: "productDescribeWords" },
1413
- label: {
1414
- default: "Which of the following words best describes your experience with our products?"
1415
- },
1416
- validations: { required: true },
1417
- options: [
1418
- { label: "Reliable", id: "1" },
1419
- { label: "High quality", id: "2" },
1420
- { label: "Useful", id: "3" },
1421
- { label: "Unique", id: "4" },
1422
- { label: "Value for money", id: "5" },
1423
- { label: "Overpriced", id: "6" },
1424
- { label: "Ineffective", id: "7" },
1425
- { label: "Poor quality", id: "8" },
1426
- { label: "Unreliable", id: "9" }
1427
- ]
1428
- },
1429
- {
1430
- type: "radio-group",
1431
- meta: { name: "asd", fieldKey: "productExpectations" },
1432
- label: {
1433
- default: "How well products meet your expectations?"
1434
- },
1435
- validations: { required: true },
1436
- options: [
1437
- { label: "Extremely well", id: "1" },
1438
- { label: "Well", id: "2" },
1439
- { label: "Somewhat well", id: "3" },
1440
- { label: "Not well", id: "4" },
1441
- { label: "Not at all well", id: "5" }
1442
- ]
1443
- },
1444
- {
1445
- type: "matrix",
1446
- meta: { name: "asd", fieldKey: "productQuality" },
1447
- label: {
1448
- default: "How would you rate the quality of our products?"
1449
- },
1450
- validations: { required: true },
1451
- max: 10,
1452
- minText: "Poor quality",
1453
- maxText: "Good quality"
1454
- }
1455
- ]
1456
- },
1457
- {
1458
- meta: { name: "final-questions" },
1459
- title: "Final questions",
1460
- fields: [
1461
- {
1462
- type: "range-slide",
1463
- defaultValue: 77,
1464
- meta: { name: "asd", fieldKey: "productsImpressionLevel" },
1465
- label: {
1466
- default: "What is your overall impression level of our products?"
1467
- }
1468
- },
1469
- {
1470
- type: "rating",
1471
- icon: "heart",
1472
- max: 5,
1473
- meta: { name: "asd", fieldKey: "productExpectations" },
1474
- label: {
1475
- default: "Do you like our service and products?"
1476
- },
1477
- validations: { required: true }
1478
- },
1479
- {
1480
- type: "select",
1481
- meta: { name: "asd", fieldKey: "fromWhereDidYouHearAboutUs" },
1482
- label: {
1483
- default: "From where did you hear about us?"
1484
- },
1485
- validations: { required: true },
1486
- options: [
1487
- { label: "Facebook", id: "1" },
1488
- { label: "Instagram", id: "2" },
1489
- { label: "Google search", id: "3" },
1490
- { label: "AD", id: "4" },
1491
- { label: "Other", id: "5" }
1492
- ]
1493
- },
1494
- {
1495
- type: "textarea",
1496
- meta: { name: "asd", fieldKey: "lastComments" },
1497
- validations: { required: false },
1498
- label: {
1499
- values: [
1500
- {
1501
- conditions: [
1502
- {
1503
- fieldName: "satisfactionRating",
1504
- lessThan: 4
1505
- }
1506
- ],
1507
- value: "How can we improve our service? (optional)"
1508
- }
1509
- ],
1510
- default: "What you would like to tell us about your experience with this company? (optional)?"
1511
- }
1512
- }
1513
- ]
1514
- }
1515
- ]
1516
- };
1517
- const getFormConfigMock = (_payload, _options) => {
1518
- return new Promise((resolve) => {
1519
- resolve({
1520
- id: "",
1521
- domainId: "",
1522
- attributes: {
1523
- theme: {},
1524
- useSystemTheme: true,
1525
- variant: "primary"
1526
- },
1527
- popupForm: {
1528
- meta: {
1529
- name: "popupForm"
1530
- },
1531
- config: {
1532
- canReturnToPreviousStep: true,
1533
- nextButtonText: "Next",
1534
- previousButtonText: "Previous",
1535
- submitButtonText: "Submit",
1536
- formTitle: "We are looking forward to hear from you!",
1537
- buttonText: "Feedback"
1538
- },
1539
- styles: {
1540
- left: null,
1541
- top: 0,
1542
- bottom: -20,
1543
- right: 0
1544
- },
1545
- form: formMock
1546
- },
1547
- inlineForm: {
1548
- meta: {
1549
- name: "asd"
1550
- },
1551
- config: {
1552
- canReturnToPreviousStep: true,
1553
- nextButtonText: "Next",
1554
- previousButtonText: "Previous",
1555
- submitButtonText: "Submit",
1556
- formTitle: "We are looking forward to hear from you!"
1557
- },
1558
- form: formMock
1559
- }
1560
- });
1561
- });
1562
- };
1363
+ const baseApi$1 = createBaseApi();
1364
+ const getFormConf = (formId, options) => baseApi$1.get(`/feedback-receiver/config/${formId}`, options);
1563
1365
  const useRequest = (request) => {
1564
1366
  const [data, setData] = React.useState();
1565
1367
  const [loading, setLoading] = React.useState(true);
@@ -4059,11 +3861,8 @@ const PopupForm = (props) => {
4059
3861
  };
4060
3862
  const App = (props) => {
4061
3863
  const [isClient, setIsClient] = React.useState(false);
4062
- props.locale ?? "en-US";
4063
3864
  let { data, loading, error } = useRequest(
4064
- () => getFormConfigMock({
4065
- formId: props.formId
4066
- })
3865
+ () => getFormConf(props.formId)
4067
3866
  );
4068
3867
  React.useEffect(() => setIsClient(true), []);
4069
3868
  const inPlaceForm = React.useMemo(() => {
package/dist/index.es.js CHANGED
@@ -1358,206 +1358,8 @@ const createBaseApi = () => {
1358
1358
  }
1359
1359
  };
1360
1360
  };
1361
- const formMock = {
1362
- meta: { name: "asd" },
1363
- steps: [
1364
- {
1365
- title: "Overall altitude",
1366
- meta: { name: "overall" },
1367
- fields: [
1368
- {
1369
- type: "matrix",
1370
- meta: { name: "asd", fieldKey: "recommendationChance" },
1371
- validations: {
1372
- required: true
1373
- },
1374
- label: {
1375
- default: "How likely are you to recommend this company to a friend or colleague?"
1376
- },
1377
- max: 10
1378
- },
1379
- {
1380
- type: "radio-group",
1381
- meta: { name: "asd", fieldKey: "satisfactionLevel" },
1382
- label: {
1383
- default: "Overall, how satisfied or dissatisfied are you with our company?"
1384
- },
1385
- validations: { required: true },
1386
- options: [
1387
- { label: "Very satisfied", id: "1" },
1388
- { label: "Somewhat satisfied", id: "2" },
1389
- { label: "Neither satisfied nor dissatisfied", id: "3" },
1390
- { label: "Somewhat dissatisfied", id: "4" },
1391
- { label: "Very dissatisfied", id: "5" }
1392
- ]
1393
- },
1394
- {
1395
- type: "rating",
1396
- icon: "star2",
1397
- max: 5,
1398
- meta: { name: "asd", fieldKey: "satisfactionRating" },
1399
- label: { default: "What is your general satisfaction?" },
1400
- validations: { required: true }
1401
- }
1402
- ]
1403
- },
1404
- {
1405
- meta: { name: "products" },
1406
- title: "Product questions",
1407
- fields: [
1408
- {
1409
- type: "checkbox-group",
1410
- meta: { name: "asd", fieldKey: "productDescribeWords" },
1411
- label: {
1412
- default: "Which of the following words best describes your experience with our products?"
1413
- },
1414
- validations: { required: true },
1415
- options: [
1416
- { label: "Reliable", id: "1" },
1417
- { label: "High quality", id: "2" },
1418
- { label: "Useful", id: "3" },
1419
- { label: "Unique", id: "4" },
1420
- { label: "Value for money", id: "5" },
1421
- { label: "Overpriced", id: "6" },
1422
- { label: "Ineffective", id: "7" },
1423
- { label: "Poor quality", id: "8" },
1424
- { label: "Unreliable", id: "9" }
1425
- ]
1426
- },
1427
- {
1428
- type: "radio-group",
1429
- meta: { name: "asd", fieldKey: "productExpectations" },
1430
- label: {
1431
- default: "How well products meet your expectations?"
1432
- },
1433
- validations: { required: true },
1434
- options: [
1435
- { label: "Extremely well", id: "1" },
1436
- { label: "Well", id: "2" },
1437
- { label: "Somewhat well", id: "3" },
1438
- { label: "Not well", id: "4" },
1439
- { label: "Not at all well", id: "5" }
1440
- ]
1441
- },
1442
- {
1443
- type: "matrix",
1444
- meta: { name: "asd", fieldKey: "productQuality" },
1445
- label: {
1446
- default: "How would you rate the quality of our products?"
1447
- },
1448
- validations: { required: true },
1449
- max: 10,
1450
- minText: "Poor quality",
1451
- maxText: "Good quality"
1452
- }
1453
- ]
1454
- },
1455
- {
1456
- meta: { name: "final-questions" },
1457
- title: "Final questions",
1458
- fields: [
1459
- {
1460
- type: "range-slide",
1461
- defaultValue: 77,
1462
- meta: { name: "asd", fieldKey: "productsImpressionLevel" },
1463
- label: {
1464
- default: "What is your overall impression level of our products?"
1465
- }
1466
- },
1467
- {
1468
- type: "rating",
1469
- icon: "heart",
1470
- max: 5,
1471
- meta: { name: "asd", fieldKey: "productExpectations" },
1472
- label: {
1473
- default: "Do you like our service and products?"
1474
- },
1475
- validations: { required: true }
1476
- },
1477
- {
1478
- type: "select",
1479
- meta: { name: "asd", fieldKey: "fromWhereDidYouHearAboutUs" },
1480
- label: {
1481
- default: "From where did you hear about us?"
1482
- },
1483
- validations: { required: true },
1484
- options: [
1485
- { label: "Facebook", id: "1" },
1486
- { label: "Instagram", id: "2" },
1487
- { label: "Google search", id: "3" },
1488
- { label: "AD", id: "4" },
1489
- { label: "Other", id: "5" }
1490
- ]
1491
- },
1492
- {
1493
- type: "textarea",
1494
- meta: { name: "asd", fieldKey: "lastComments" },
1495
- validations: { required: false },
1496
- label: {
1497
- values: [
1498
- {
1499
- conditions: [
1500
- {
1501
- fieldName: "satisfactionRating",
1502
- lessThan: 4
1503
- }
1504
- ],
1505
- value: "How can we improve our service? (optional)"
1506
- }
1507
- ],
1508
- default: "What you would like to tell us about your experience with this company? (optional)?"
1509
- }
1510
- }
1511
- ]
1512
- }
1513
- ]
1514
- };
1515
- const getFormConfigMock = (_payload, _options) => {
1516
- return new Promise((resolve) => {
1517
- resolve({
1518
- id: "",
1519
- domainId: "",
1520
- attributes: {
1521
- theme: {},
1522
- useSystemTheme: true,
1523
- variant: "primary"
1524
- },
1525
- popupForm: {
1526
- meta: {
1527
- name: "popupForm"
1528
- },
1529
- config: {
1530
- canReturnToPreviousStep: true,
1531
- nextButtonText: "Next",
1532
- previousButtonText: "Previous",
1533
- submitButtonText: "Submit",
1534
- formTitle: "We are looking forward to hear from you!",
1535
- buttonText: "Feedback"
1536
- },
1537
- styles: {
1538
- left: null,
1539
- top: 0,
1540
- bottom: -20,
1541
- right: 0
1542
- },
1543
- form: formMock
1544
- },
1545
- inlineForm: {
1546
- meta: {
1547
- name: "asd"
1548
- },
1549
- config: {
1550
- canReturnToPreviousStep: true,
1551
- nextButtonText: "Next",
1552
- previousButtonText: "Previous",
1553
- submitButtonText: "Submit",
1554
- formTitle: "We are looking forward to hear from you!"
1555
- },
1556
- form: formMock
1557
- }
1558
- });
1559
- });
1560
- };
1361
+ const baseApi$1 = createBaseApi();
1362
+ const getFormConf = (formId, options) => baseApi$1.get(`/feedback-receiver/config/${formId}`, options);
1561
1363
  const useRequest = (request) => {
1562
1364
  const [data, setData] = useState();
1563
1365
  const [loading, setLoading] = useState(true);
@@ -4057,11 +3859,8 @@ const PopupForm = (props) => {
4057
3859
  };
4058
3860
  const App = (props) => {
4059
3861
  const [isClient, setIsClient] = React.useState(false);
4060
- props.locale ?? "en-US";
4061
3862
  let { data, loading, error } = useRequest(
4062
- () => getFormConfigMock({
4063
- formId: props.formId
4064
- })
3863
+ () => getFormConf(props.formId)
4065
3864
  );
4066
3865
  React.useEffect(() => setIsClient(true), []);
4067
3866
  const inPlaceForm = useMemo(() => {
@@ -1358,206 +1358,8 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
1358
1358
  }
1359
1359
  };
1360
1360
  };
1361
- const formMock = {
1362
- meta: { name: "asd" },
1363
- steps: [
1364
- {
1365
- title: "Overall altitude",
1366
- meta: { name: "overall" },
1367
- fields: [
1368
- {
1369
- type: "matrix",
1370
- meta: { name: "asd", fieldKey: "recommendationChance" },
1371
- validations: {
1372
- required: true
1373
- },
1374
- label: {
1375
- default: "How likely are you to recommend this company to a friend or colleague?"
1376
- },
1377
- max: 10
1378
- },
1379
- {
1380
- type: "radio-group",
1381
- meta: { name: "asd", fieldKey: "satisfactionLevel" },
1382
- label: {
1383
- default: "Overall, how satisfied or dissatisfied are you with our company?"
1384
- },
1385
- validations: { required: true },
1386
- options: [
1387
- { label: "Very satisfied", id: "1" },
1388
- { label: "Somewhat satisfied", id: "2" },
1389
- { label: "Neither satisfied nor dissatisfied", id: "3" },
1390
- { label: "Somewhat dissatisfied", id: "4" },
1391
- { label: "Very dissatisfied", id: "5" }
1392
- ]
1393
- },
1394
- {
1395
- type: "rating",
1396
- icon: "star2",
1397
- max: 5,
1398
- meta: { name: "asd", fieldKey: "satisfactionRating" },
1399
- label: { default: "What is your general satisfaction?" },
1400
- validations: { required: true }
1401
- }
1402
- ]
1403
- },
1404
- {
1405
- meta: { name: "products" },
1406
- title: "Product questions",
1407
- fields: [
1408
- {
1409
- type: "checkbox-group",
1410
- meta: { name: "asd", fieldKey: "productDescribeWords" },
1411
- label: {
1412
- default: "Which of the following words best describes your experience with our products?"
1413
- },
1414
- validations: { required: true },
1415
- options: [
1416
- { label: "Reliable", id: "1" },
1417
- { label: "High quality", id: "2" },
1418
- { label: "Useful", id: "3" },
1419
- { label: "Unique", id: "4" },
1420
- { label: "Value for money", id: "5" },
1421
- { label: "Overpriced", id: "6" },
1422
- { label: "Ineffective", id: "7" },
1423
- { label: "Poor quality", id: "8" },
1424
- { label: "Unreliable", id: "9" }
1425
- ]
1426
- },
1427
- {
1428
- type: "radio-group",
1429
- meta: { name: "asd", fieldKey: "productExpectations" },
1430
- label: {
1431
- default: "How well products meet your expectations?"
1432
- },
1433
- validations: { required: true },
1434
- options: [
1435
- { label: "Extremely well", id: "1" },
1436
- { label: "Well", id: "2" },
1437
- { label: "Somewhat well", id: "3" },
1438
- { label: "Not well", id: "4" },
1439
- { label: "Not at all well", id: "5" }
1440
- ]
1441
- },
1442
- {
1443
- type: "matrix",
1444
- meta: { name: "asd", fieldKey: "productQuality" },
1445
- label: {
1446
- default: "How would you rate the quality of our products?"
1447
- },
1448
- validations: { required: true },
1449
- max: 10,
1450
- minText: "Poor quality",
1451
- maxText: "Good quality"
1452
- }
1453
- ]
1454
- },
1455
- {
1456
- meta: { name: "final-questions" },
1457
- title: "Final questions",
1458
- fields: [
1459
- {
1460
- type: "range-slide",
1461
- defaultValue: 77,
1462
- meta: { name: "asd", fieldKey: "productsImpressionLevel" },
1463
- label: {
1464
- default: "What is your overall impression level of our products?"
1465
- }
1466
- },
1467
- {
1468
- type: "rating",
1469
- icon: "heart",
1470
- max: 5,
1471
- meta: { name: "asd", fieldKey: "productExpectations" },
1472
- label: {
1473
- default: "Do you like our service and products?"
1474
- },
1475
- validations: { required: true }
1476
- },
1477
- {
1478
- type: "select",
1479
- meta: { name: "asd", fieldKey: "fromWhereDidYouHearAboutUs" },
1480
- label: {
1481
- default: "From where did you hear about us?"
1482
- },
1483
- validations: { required: true },
1484
- options: [
1485
- { label: "Facebook", id: "1" },
1486
- { label: "Instagram", id: "2" },
1487
- { label: "Google search", id: "3" },
1488
- { label: "AD", id: "4" },
1489
- { label: "Other", id: "5" }
1490
- ]
1491
- },
1492
- {
1493
- type: "textarea",
1494
- meta: { name: "asd", fieldKey: "lastComments" },
1495
- validations: { required: false },
1496
- label: {
1497
- values: [
1498
- {
1499
- conditions: [
1500
- {
1501
- fieldName: "satisfactionRating",
1502
- lessThan: 4
1503
- }
1504
- ],
1505
- value: "How can we improve our service? (optional)"
1506
- }
1507
- ],
1508
- default: "What you would like to tell us about your experience with this company? (optional)?"
1509
- }
1510
- }
1511
- ]
1512
- }
1513
- ]
1514
- };
1515
- const getFormConfigMock = (_payload, _options) => {
1516
- return new Promise((resolve) => {
1517
- resolve({
1518
- id: "",
1519
- domainId: "",
1520
- attributes: {
1521
- theme: {},
1522
- useSystemTheme: true,
1523
- variant: "primary"
1524
- },
1525
- popupForm: {
1526
- meta: {
1527
- name: "popupForm"
1528
- },
1529
- config: {
1530
- canReturnToPreviousStep: true,
1531
- nextButtonText: "Next",
1532
- previousButtonText: "Previous",
1533
- submitButtonText: "Submit",
1534
- formTitle: "We are looking forward to hear from you!",
1535
- buttonText: "Feedback"
1536
- },
1537
- styles: {
1538
- left: null,
1539
- top: 0,
1540
- bottom: -20,
1541
- right: 0
1542
- },
1543
- form: formMock
1544
- },
1545
- inlineForm: {
1546
- meta: {
1547
- name: "asd"
1548
- },
1549
- config: {
1550
- canReturnToPreviousStep: true,
1551
- nextButtonText: "Next",
1552
- previousButtonText: "Previous",
1553
- submitButtonText: "Submit",
1554
- formTitle: "We are looking forward to hear from you!"
1555
- },
1556
- form: formMock
1557
- }
1558
- });
1559
- });
1560
- };
1361
+ const baseApi$1 = createBaseApi();
1362
+ const getFormConf = (formId, options) => baseApi$1.get(`/feedback-receiver/config/${formId}`, options);
1561
1363
  const useRequest = (request) => {
1562
1364
  const [data, setData] = React2.useState();
1563
1365
  const [loading, setLoading] = React2.useState(true);
@@ -4057,11 +3859,8 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
4057
3859
  };
4058
3860
  const App = (props) => {
4059
3861
  const [isClient, setIsClient] = React2.useState(false);
4060
- props.locale ?? "en-US";
4061
3862
  let { data, loading, error } = useRequest(
4062
- () => getFormConfigMock({
4063
- formId: props.formId
4064
- })
3863
+ () => getFormConf(props.formId)
4065
3864
  );
4066
3865
  React2.useEffect(() => setIsClient(true), []);
4067
3866
  const inPlaceForm = React2.useMemo(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-site-utilities/feedback",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "workspaces": [
5
5
  "src/**",
6
6
  "examples/**"