@player-ui/player 0.15.4-next.0 → 0.16.0--canary.866.36538
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/Player.native.js +714 -10
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +586 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +577 -6
- package/dist/index.mjs +577 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/a2ui/__tests__/adapter.bench.ts +209 -0
- package/src/a2ui/__tests__/adapter.test.ts +280 -0
- package/src/a2ui/__tests__/binding.test.ts +89 -0
- package/src/a2ui/__tests__/integration.test.ts +155 -0
- package/src/a2ui/__tests__/schema.test.ts +192 -0
- package/src/a2ui/adapter.ts +400 -0
- package/src/a2ui/binding.ts +90 -0
- package/src/a2ui/dynamic.ts +124 -0
- package/src/a2ui/index.ts +25 -0
- package/src/a2ui/schema.ts +266 -0
- package/src/a2ui/types.ts +74 -0
- package/src/controllers/data/utils.ts +1 -1
- package/src/index.ts +1 -0
- package/src/player.ts +13 -4
- package/types/a2ui/adapter.d.ts +16 -0
- package/types/a2ui/binding.d.ts +42 -0
- package/types/a2ui/dynamic.d.ts +28 -0
- package/types/a2ui/index.d.ts +7 -0
- package/types/a2ui/schema.d.ts +25 -0
- package/types/a2ui/types.d.ts +55 -0
- package/types/index.d.ts +1 -0
- package/types/player.d.ts +2 -1
package/dist/Player.native.js
CHANGED
|
@@ -1533,6 +1533,412 @@ var Player = function() {
|
|
|
1533
1533
|
});
|
|
1534
1534
|
return batchTxn;
|
|
1535
1535
|
};
|
|
1536
|
+
var pointerToBinding = function pointerToBinding(pointer) {
|
|
1537
|
+
if (!pointer || pointer === "/") return "";
|
|
1538
|
+
var absolute = pointer.startsWith("/");
|
|
1539
|
+
var raw = absolute ? pointer.slice(1) : pointer;
|
|
1540
|
+
var segments = raw.split("/").map(decodeSegment);
|
|
1541
|
+
var out = "";
|
|
1542
|
+
for(var i = 0; i < segments.length; i++){
|
|
1543
|
+
var seg = segments[i];
|
|
1544
|
+
if (NUMERIC_SEGMENT.test(seg)) {
|
|
1545
|
+
out += "[".concat(seg, "]");
|
|
1546
|
+
} else {
|
|
1547
|
+
out += i === 0 ? seg : ".".concat(seg);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
return out;
|
|
1551
|
+
};
|
|
1552
|
+
var bindingToSegments = function bindingToSegments(binding) {
|
|
1553
|
+
if (!binding) return [];
|
|
1554
|
+
var segments = [];
|
|
1555
|
+
var parts = binding.split(".");
|
|
1556
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1557
|
+
try {
|
|
1558
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1559
|
+
var part = _step.value;
|
|
1560
|
+
var match = part.match(/^([^[]+)((?:\[\d+\])*)$/);
|
|
1561
|
+
if (!match) {
|
|
1562
|
+
segments.push(part);
|
|
1563
|
+
continue;
|
|
1564
|
+
}
|
|
1565
|
+
var _match = _sliced_to_array(match, 3), name = _match[1], arrays = _match[2];
|
|
1566
|
+
if (name) segments.push(name);
|
|
1567
|
+
if (arrays) {
|
|
1568
|
+
var _segments;
|
|
1569
|
+
var _arrays_match;
|
|
1570
|
+
var arrayMatches = (_arrays_match = arrays.match(/\[\d+\]/g)) !== null && _arrays_match !== void 0 ? _arrays_match : [];
|
|
1571
|
+
(_segments = segments).push.apply(_segments, _to_consumable_array(arrayMatches));
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
} catch (err) {
|
|
1575
|
+
_didIteratorError = true;
|
|
1576
|
+
_iteratorError = err;
|
|
1577
|
+
} finally{
|
|
1578
|
+
try {
|
|
1579
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1580
|
+
_iterator.return();
|
|
1581
|
+
}
|
|
1582
|
+
} finally{
|
|
1583
|
+
if (_didIteratorError) {
|
|
1584
|
+
throw _iteratorError;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
return segments;
|
|
1589
|
+
};
|
|
1590
|
+
var interpolatePointers = function interpolatePointers(input) {
|
|
1591
|
+
return input.replace(/\$\{([^}]+)\}/g, function(_, pointer) {
|
|
1592
|
+
return "{{".concat(pointerToBinding(pointer), "}}");
|
|
1593
|
+
});
|
|
1594
|
+
};
|
|
1595
|
+
var translateFunctionCall = function translateFunctionCall(call, logger) {
|
|
1596
|
+
if (call.call === "formatString") {
|
|
1597
|
+
var _call_args;
|
|
1598
|
+
var value = (_call_args = call.args) === null || _call_args === void 0 ? void 0 : _call_args.value;
|
|
1599
|
+
if (typeof value === "string") return interpolatePointers(value);
|
|
1600
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] formatString received non-string 'value' arg; emitting expression form");
|
|
1601
|
+
}
|
|
1602
|
+
var argList = renderArgList(call.args);
|
|
1603
|
+
if (call.call === "formatString") {
|
|
1604
|
+
return "@[formatString(".concat(argList, ")]@");
|
|
1605
|
+
}
|
|
1606
|
+
return "@[".concat(call.call, "(").concat(argList, ")]@");
|
|
1607
|
+
};
|
|
1608
|
+
var renderArgList = function renderArgList(args) {
|
|
1609
|
+
if (!args) return "";
|
|
1610
|
+
return Object.values(args).map(renderArg).join(", ");
|
|
1611
|
+
};
|
|
1612
|
+
var newBuilder = function newBuilder() {
|
|
1613
|
+
return {
|
|
1614
|
+
schema: {
|
|
1615
|
+
ROOT: {}
|
|
1616
|
+
},
|
|
1617
|
+
knownTypes: /* @__PURE__ */ new Set([
|
|
1618
|
+
"ROOT"
|
|
1619
|
+
])
|
|
1620
|
+
};
|
|
1621
|
+
};
|
|
1622
|
+
var findBoundPath = function findBoundPath(component, logger) {
|
|
1623
|
+
var lookupProp = INPUT_BINDING_PROPS[component.component];
|
|
1624
|
+
if (lookupProp) {
|
|
1625
|
+
var prop = component[lookupProp];
|
|
1626
|
+
if (isPathRef(prop)) return prop.path;
|
|
1627
|
+
}
|
|
1628
|
+
var pathRefs = collectPathRefs(component);
|
|
1629
|
+
if (pathRefs.length === 1) return pathRefs[0];
|
|
1630
|
+
if (pathRefs.length > 1) {
|
|
1631
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Component '".concat(component.id, "' (").concat(component.component, ") has checks but multiple {path} refs; skipping schema synthesis for this component"));
|
|
1632
|
+
} else {
|
|
1633
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Component '".concat(component.id, "' (").concat(component.component, ") has checks but no bound path could be determined; skipping"));
|
|
1634
|
+
}
|
|
1635
|
+
return void 0;
|
|
1636
|
+
};
|
|
1637
|
+
var collectPathRefs = function collectPathRefs(component) {
|
|
1638
|
+
var found = [];
|
|
1639
|
+
var walk = function walk1(v) {
|
|
1640
|
+
if (!v || (typeof v === "undefined" ? "undefined" : _type_of(v)) !== "object") return;
|
|
1641
|
+
if (Array.isArray(v)) {
|
|
1642
|
+
v.forEach(walk);
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
if (isPathRef(v)) {
|
|
1646
|
+
found.push(v.path);
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
Object.values(v).forEach(walk);
|
|
1650
|
+
};
|
|
1651
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1652
|
+
try {
|
|
1653
|
+
for(var _iterator = Object.entries(component)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1654
|
+
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
1655
|
+
if (k === "id" || k === "component" || k === "checks" || k === "action") {
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
walk(v);
|
|
1659
|
+
}
|
|
1660
|
+
} catch (err) {
|
|
1661
|
+
_didIteratorError = true;
|
|
1662
|
+
_iteratorError = err;
|
|
1663
|
+
} finally{
|
|
1664
|
+
try {
|
|
1665
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1666
|
+
_iterator.return();
|
|
1667
|
+
}
|
|
1668
|
+
} finally{
|
|
1669
|
+
if (_didIteratorError) {
|
|
1670
|
+
throw _iteratorError;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return found;
|
|
1675
|
+
};
|
|
1676
|
+
var translateCheck = function translateCheck(check, logger) {
|
|
1677
|
+
var _check_args;
|
|
1678
|
+
var type = CHECK_TO_VALIDATOR[check.call];
|
|
1679
|
+
if (!type) {
|
|
1680
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Unknown validation check '".concat(check.call, "'; dropping"));
|
|
1681
|
+
return void 0;
|
|
1682
|
+
}
|
|
1683
|
+
var ref = {
|
|
1684
|
+
type: type,
|
|
1685
|
+
severity: "error"
|
|
1686
|
+
};
|
|
1687
|
+
if (check.message) ref.message = check.message;
|
|
1688
|
+
if (check.call === "regex" && ((_check_args = check.args) === null || _check_args === void 0 ? void 0 : _check_args.pattern)) {
|
|
1689
|
+
ref.regex = unwrapLiteral(check.args.pattern);
|
|
1690
|
+
}
|
|
1691
|
+
if (check.call === "length") {
|
|
1692
|
+
var _check_args1, _check_args2;
|
|
1693
|
+
if (((_check_args1 = check.args) === null || _check_args1 === void 0 ? void 0 : _check_args1.min) !== void 0) ref.min = unwrapLiteral(check.args.min);
|
|
1694
|
+
if (((_check_args2 = check.args) === null || _check_args2 === void 0 ? void 0 : _check_args2.max) !== void 0) ref.max = unwrapLiteral(check.args.max);
|
|
1695
|
+
}
|
|
1696
|
+
return ref;
|
|
1697
|
+
};
|
|
1698
|
+
var unwrapLiteral = function unwrapLiteral(value) {
|
|
1699
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
1700
|
+
return value;
|
|
1701
|
+
}
|
|
1702
|
+
return value;
|
|
1703
|
+
};
|
|
1704
|
+
var installAtPath = function installAtPath(builder, binding, leafType, validations, logger) {
|
|
1705
|
+
var segments = bindingToSegments(binding).filter(function(s) {
|
|
1706
|
+
return !s.startsWith("[");
|
|
1707
|
+
});
|
|
1708
|
+
if (segments.length === 0) {
|
|
1709
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("[a2ui] Cannot install schema validation at empty path; skipping");
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
var currentNode = builder.schema.ROOT;
|
|
1713
|
+
var ownerPath = [];
|
|
1714
|
+
for(var i = 0; i < segments.length - 1; i++){
|
|
1715
|
+
var seg = segments[i];
|
|
1716
|
+
ownerPath.push(seg);
|
|
1717
|
+
var typeName = "".concat(TYPE_PREFIX).concat(ownerPath.join("_"));
|
|
1718
|
+
var existing = currentNode[seg];
|
|
1719
|
+
if (!existing) {
|
|
1720
|
+
currentNode[seg] = {
|
|
1721
|
+
type: typeName
|
|
1722
|
+
};
|
|
1723
|
+
} else if (existing.type !== typeName) {}
|
|
1724
|
+
var ref = currentNode[seg].type;
|
|
1725
|
+
if (!builder.schema[ref]) {
|
|
1726
|
+
builder.schema[ref] = {};
|
|
1727
|
+
builder.knownTypes.add(ref);
|
|
1728
|
+
}
|
|
1729
|
+
currentNode = builder.schema[ref];
|
|
1730
|
+
}
|
|
1731
|
+
var leafSeg = segments[segments.length - 1];
|
|
1732
|
+
var existingLeaf = currentNode[leafSeg];
|
|
1733
|
+
if (existingLeaf) {
|
|
1734
|
+
var _existingLeaf_validation;
|
|
1735
|
+
var merged = _object_spread_props(_object_spread({}, existingLeaf), {
|
|
1736
|
+
type: pickLeafType(existingLeaf.type, leafType),
|
|
1737
|
+
validation: _to_consumable_array((_existingLeaf_validation = existingLeaf.validation) !== null && _existingLeaf_validation !== void 0 ? _existingLeaf_validation : []).concat(_to_consumable_array(validations))
|
|
1738
|
+
});
|
|
1739
|
+
currentNode[leafSeg] = merged;
|
|
1740
|
+
} else {
|
|
1741
|
+
currentNode[leafSeg] = {
|
|
1742
|
+
type: leafType,
|
|
1743
|
+
validation: validations
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
var pickLeafType = function pickLeafType(existing, incoming) {
|
|
1748
|
+
if (incoming !== "string") return incoming;
|
|
1749
|
+
return existing;
|
|
1750
|
+
};
|
|
1751
|
+
var defaultLeafType = function defaultLeafType(component, checks) {
|
|
1752
|
+
if (component.component === "CheckBox") return "boolean";
|
|
1753
|
+
if (checks.some(function(c) {
|
|
1754
|
+
return c.call === "numeric";
|
|
1755
|
+
})) return "number";
|
|
1756
|
+
return "string";
|
|
1757
|
+
};
|
|
1758
|
+
var synthesizeSchema = function synthesizeSchema(components, logger) {
|
|
1759
|
+
var builder = newBuilder();
|
|
1760
|
+
var found = false;
|
|
1761
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1762
|
+
try {
|
|
1763
|
+
for(var _iterator = components[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1764
|
+
var component = _step.value;
|
|
1765
|
+
if (!component.checks || component.checks.length === 0) continue;
|
|
1766
|
+
var pointer = findBoundPath(component, logger);
|
|
1767
|
+
if (!pointer) continue;
|
|
1768
|
+
var binding = pointerToBinding(pointer);
|
|
1769
|
+
if (!binding) continue;
|
|
1770
|
+
var validations = component.checks.map(function(c) {
|
|
1771
|
+
return translateCheck(c, logger);
|
|
1772
|
+
}).filter(function(v) {
|
|
1773
|
+
return v !== void 0;
|
|
1774
|
+
});
|
|
1775
|
+
if (validations.length === 0) continue;
|
|
1776
|
+
installAtPath(builder, binding, defaultLeafType(component, component.checks), validations, logger);
|
|
1777
|
+
found = true;
|
|
1778
|
+
}
|
|
1779
|
+
} catch (err) {
|
|
1780
|
+
_didIteratorError = true;
|
|
1781
|
+
_iteratorError = err;
|
|
1782
|
+
} finally{
|
|
1783
|
+
try {
|
|
1784
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1785
|
+
_iterator.return();
|
|
1786
|
+
}
|
|
1787
|
+
} finally{
|
|
1788
|
+
if (_didIteratorError) {
|
|
1789
|
+
throw _iteratorError;
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
return found ? builder.schema : void 0;
|
|
1794
|
+
};
|
|
1795
|
+
var resolveAndInline = function resolveAndInline(id, ctx, templateScope) {
|
|
1796
|
+
var component = ctx.byId.get(id);
|
|
1797
|
+
if (!component) {
|
|
1798
|
+
throw new Error("[a2ui] Component reference '".concat(id, "' could not be resolved in the snapshot."));
|
|
1799
|
+
}
|
|
1800
|
+
return inlineComponent(component, ctx, templateScope);
|
|
1801
|
+
};
|
|
1802
|
+
var wrapInlined = function wrapInlined(asset) {
|
|
1803
|
+
return {
|
|
1804
|
+
asset: asset
|
|
1805
|
+
};
|
|
1806
|
+
};
|
|
1807
|
+
var scopedBinding = function scopedBinding(pointer, scope) {
|
|
1808
|
+
if (!pointer || pointer === "/") return scope !== null && scope !== void 0 ? scope : "";
|
|
1809
|
+
if (pointer.startsWith("/")) return pointerToBinding(pointer);
|
|
1810
|
+
if (!scope) return pointerToBinding(pointer);
|
|
1811
|
+
var relative = pointerToBinding(pointer);
|
|
1812
|
+
return relative ? "".concat(scope, "._index_.").concat(relative) : "".concat(scope, "._index_");
|
|
1813
|
+
};
|
|
1814
|
+
var scopedPointer = function scopedPointer(pointer, scope) {
|
|
1815
|
+
if (pointer.startsWith("/")) return pointer;
|
|
1816
|
+
return "/".concat(scope, "/_index_/").concat(pointer);
|
|
1817
|
+
};
|
|
1818
|
+
var translateAction = function translateAction(action, ctx) {
|
|
1819
|
+
if ("event" in action) {
|
|
1820
|
+
var _action_event = action.event, name = _action_event.name, context = _action_event.context;
|
|
1821
|
+
ctx.eventNames.add(name);
|
|
1822
|
+
var result = {
|
|
1823
|
+
value: name
|
|
1824
|
+
};
|
|
1825
|
+
if (context && Object.keys(context).length > 0) {
|
|
1826
|
+
result.exp = buildContextWriteExpressions(context);
|
|
1827
|
+
}
|
|
1828
|
+
return result;
|
|
1829
|
+
}
|
|
1830
|
+
return {
|
|
1831
|
+
exp: translateFunctionCall(action.functionCall, ctx.logger)
|
|
1832
|
+
};
|
|
1833
|
+
};
|
|
1834
|
+
var buildContextWriteExpressions = function buildContextWriteExpressions(context) {
|
|
1835
|
+
return Object.entries(context).map(function(param) {
|
|
1836
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
1837
|
+
var lhs = "{{".concat(A2UI_EVENT_CONTEXT_NAMESPACE, ".").concat(key, "}}");
|
|
1838
|
+
return "".concat(lhs, " = ").concat(renderRhs(value));
|
|
1839
|
+
});
|
|
1840
|
+
};
|
|
1841
|
+
var buildNavigation = function buildNavigation(surfaceId, eventNames) {
|
|
1842
|
+
var view = {
|
|
1843
|
+
state_type: "VIEW",
|
|
1844
|
+
ref: surfaceId,
|
|
1845
|
+
transitions: {
|
|
1846
|
+
"*": "END_Done"
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
var endStates = {
|
|
1850
|
+
END_Done: {
|
|
1851
|
+
state_type: "END",
|
|
1852
|
+
outcome: "done"
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1856
|
+
try {
|
|
1857
|
+
for(var _iterator = eventNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1858
|
+
var name = _step.value;
|
|
1859
|
+
var endName = "END_".concat(name);
|
|
1860
|
+
view.transitions[name] = endName;
|
|
1861
|
+
endStates[endName] = {
|
|
1862
|
+
state_type: "END",
|
|
1863
|
+
outcome: name
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
} catch (err) {
|
|
1867
|
+
_didIteratorError = true;
|
|
1868
|
+
_iteratorError = err;
|
|
1869
|
+
} finally{
|
|
1870
|
+
try {
|
|
1871
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1872
|
+
_iterator.return();
|
|
1873
|
+
}
|
|
1874
|
+
} finally{
|
|
1875
|
+
if (_didIteratorError) {
|
|
1876
|
+
throw _iteratorError;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
var flow = _object_spread({
|
|
1881
|
+
startState: "VIEW_1",
|
|
1882
|
+
VIEW_1: view
|
|
1883
|
+
}, endStates);
|
|
1884
|
+
return {
|
|
1885
|
+
BEGIN: "FLOW_1",
|
|
1886
|
+
FLOW_1: flow
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
var adaptA2UIToFlow = function adaptA2UIToFlow(snapshot, logger) {
|
|
1890
|
+
var _snapshot_data;
|
|
1891
|
+
if (!snapshot || !Array.isArray(snapshot.components)) {
|
|
1892
|
+
throw new Error("[a2ui] snapshot.components must be an array");
|
|
1893
|
+
}
|
|
1894
|
+
var byId = /* @__PURE__ */ new Map();
|
|
1895
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1896
|
+
try {
|
|
1897
|
+
for(var _iterator = snapshot.components[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1898
|
+
var component = _step.value;
|
|
1899
|
+
if (!(component === null || component === void 0 ? void 0 : component.id)) {
|
|
1900
|
+
throw new Error("[a2ui] every component must have an id");
|
|
1901
|
+
}
|
|
1902
|
+
byId.set(component.id, component);
|
|
1903
|
+
}
|
|
1904
|
+
} catch (err) {
|
|
1905
|
+
_didIteratorError = true;
|
|
1906
|
+
_iteratorError = err;
|
|
1907
|
+
} finally{
|
|
1908
|
+
try {
|
|
1909
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1910
|
+
_iterator.return();
|
|
1911
|
+
}
|
|
1912
|
+
} finally{
|
|
1913
|
+
if (_didIteratorError) {
|
|
1914
|
+
throw _iteratorError;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
var root = byId.get("root");
|
|
1919
|
+
if (!root) {
|
|
1920
|
+
throw new Error("[a2ui] snapshot must contain a component with id 'root'");
|
|
1921
|
+
}
|
|
1922
|
+
var ctx = {
|
|
1923
|
+
byId: byId,
|
|
1924
|
+
inProgress: /* @__PURE__ */ new Set(),
|
|
1925
|
+
eventNames: /* @__PURE__ */ new Set(),
|
|
1926
|
+
logger: logger
|
|
1927
|
+
};
|
|
1928
|
+
var rootAsset = inlineComponent(root, ctx);
|
|
1929
|
+
rootAsset.id = snapshot.surfaceId;
|
|
1930
|
+
var schema = synthesizeSchema(snapshot.components, logger);
|
|
1931
|
+
var flow = {
|
|
1932
|
+
id: snapshot.surfaceId,
|
|
1933
|
+
views: [
|
|
1934
|
+
rootAsset
|
|
1935
|
+
],
|
|
1936
|
+
data: (_snapshot_data = snapshot.data) !== null && _snapshot_data !== void 0 ? _snapshot_data : {},
|
|
1937
|
+
navigation: buildNavigation(snapshot.surfaceId, ctx.eventNames)
|
|
1938
|
+
};
|
|
1939
|
+
if (schema) flow.schema = schema;
|
|
1940
|
+
return flow;
|
|
1941
|
+
};
|
|
1536
1942
|
var __create = Object.create;
|
|
1537
1943
|
var __defProp = Object.defineProperty;
|
|
1538
1944
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1752,7 +2158,7 @@ var Player = function() {
|
|
|
1752
2158
|
}
|
|
1753
2159
|
return out;
|
|
1754
2160
|
}
|
|
1755
|
-
function
|
|
2161
|
+
function isObject2(o) {
|
|
1756
2162
|
return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
|
|
1757
2163
|
}
|
|
1758
2164
|
function addLast2(array, val) {
|
|
@@ -1825,7 +2231,7 @@ var Player = function() {
|
|
|
1825
2231
|
if (idx === path.length - 1) {
|
|
1826
2232
|
newValue = val;
|
|
1827
2233
|
} else {
|
|
1828
|
-
var nestedObj =
|
|
2234
|
+
var nestedObj = isObject2(obj) && isObject2(obj[key]) ? obj[key] : typeof path[idx + 1] === "number" ? [] : {};
|
|
1829
2235
|
newValue = doSetIn(nestedObj, path, val, idx + 1);
|
|
1830
2236
|
}
|
|
1831
2237
|
return set2(obj, key, newValue);
|
|
@@ -1955,7 +2361,7 @@ var Player = function() {
|
|
|
1955
2361
|
var key = keys[j];
|
|
1956
2362
|
if (fAddDefaults && out[key] !== void 0) continue;
|
|
1957
2363
|
var nextVal = obj[key];
|
|
1958
|
-
if (fDeep &&
|
|
2364
|
+
if (fDeep && isObject2(out[key]) && isObject2(nextVal)) {
|
|
1959
2365
|
nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal);
|
|
1960
2366
|
}
|
|
1961
2367
|
if (nextVal === void 0 || nextVal === out[key]) continue;
|
|
@@ -2105,6 +2511,9 @@ var Player = function() {
|
|
|
2105
2511
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/index.ts
|
|
2106
2512
|
var src_exports = {};
|
|
2107
2513
|
__export(src_exports, {
|
|
2514
|
+
A2UI_EVENT_CONTEXT_NAMESPACE: function A2UI_EVENT_CONTEXT_NAMESPACE1() {
|
|
2515
|
+
return A2UI_EVENT_CONTEXT_NAMESPACE;
|
|
2516
|
+
},
|
|
2108
2517
|
ApplicabilityPlugin: function ApplicabilityPlugin1() {
|
|
2109
2518
|
return ApplicabilityPlugin;
|
|
2110
2519
|
},
|
|
@@ -2249,6 +2658,9 @@ var Player = function() {
|
|
|
2249
2658
|
ViewInstance: function ViewInstance1() {
|
|
2250
2659
|
return ViewInstance;
|
|
2251
2660
|
},
|
|
2661
|
+
adaptA2UIToFlow: function adaptA2UIToFlow1() {
|
|
2662
|
+
return adaptA2UIToFlow;
|
|
2663
|
+
},
|
|
2252
2664
|
caresAboutDataChanges: function caresAboutDataChanges1() {
|
|
2253
2665
|
return caresAboutDataChanges;
|
|
2254
2666
|
},
|
|
@@ -2279,6 +2691,9 @@ var Player = function() {
|
|
|
2279
2691
|
hasTemplateValues: function hasTemplateValues1() {
|
|
2280
2692
|
return hasTemplateValues;
|
|
2281
2693
|
},
|
|
2694
|
+
interpolatePointers: function interpolatePointers1() {
|
|
2695
|
+
return interpolatePointers;
|
|
2696
|
+
},
|
|
2282
2697
|
isAwaitable: function isAwaitable1() {
|
|
2283
2698
|
return isAwaitable;
|
|
2284
2699
|
},
|
|
@@ -2291,9 +2706,15 @@ var Player = function() {
|
|
|
2291
2706
|
isExpressionNode: function isExpressionNode1() {
|
|
2292
2707
|
return isExpressionNode;
|
|
2293
2708
|
},
|
|
2709
|
+
isFunctionCall: function isFunctionCall1() {
|
|
2710
|
+
return isFunctionCall;
|
|
2711
|
+
},
|
|
2294
2712
|
isObjectExpression: function isObjectExpression1() {
|
|
2295
2713
|
return isObjectExpression;
|
|
2296
2714
|
},
|
|
2715
|
+
isPathRef: function isPathRef1() {
|
|
2716
|
+
return isPathRef;
|
|
2717
|
+
},
|
|
2297
2718
|
isPromiseLike: function isPromiseLike1() {
|
|
2298
2719
|
return isPromiseLike;
|
|
2299
2720
|
},
|
|
@@ -2306,6 +2727,9 @@ var Player = function() {
|
|
|
2306
2727
|
parseExpression: function parseExpression1() {
|
|
2307
2728
|
return parseExpression;
|
|
2308
2729
|
},
|
|
2730
|
+
pointerToBinding: function pointerToBinding1() {
|
|
2731
|
+
return pointerToBinding;
|
|
2732
|
+
},
|
|
2309
2733
|
removeBindingAndChildrenFromMap: function removeBindingAndChildrenFromMap1() {
|
|
2310
2734
|
return removeBindingAndChildrenFromMap;
|
|
2311
2735
|
},
|
|
@@ -2321,12 +2745,21 @@ var Player = function() {
|
|
|
2321
2745
|
severities: function severities1() {
|
|
2322
2746
|
return severities;
|
|
2323
2747
|
},
|
|
2748
|
+
synthesizeSchema: function synthesizeSchema1() {
|
|
2749
|
+
return synthesizeSchema;
|
|
2750
|
+
},
|
|
2324
2751
|
toModel: function toModel1() {
|
|
2325
2752
|
return toModel;
|
|
2326
2753
|
},
|
|
2327
2754
|
toNodeResolveOptions: function toNodeResolveOptions1() {
|
|
2328
2755
|
return toNodeResolveOptions;
|
|
2329
2756
|
},
|
|
2757
|
+
translateDynamicValue: function translateDynamicValue1() {
|
|
2758
|
+
return translateDynamicValue;
|
|
2759
|
+
},
|
|
2760
|
+
translateFunctionCall: function translateFunctionCall1() {
|
|
2761
|
+
return translateFunctionCall;
|
|
2762
|
+
},
|
|
2330
2763
|
withParser: function withParser1() {
|
|
2331
2764
|
return withParser;
|
|
2332
2765
|
},
|
|
@@ -8017,9 +8450,279 @@ var Player = function() {
|
|
|
8017
8450
|
ref: Symbol("not-started"),
|
|
8018
8451
|
status: "not-started"
|
|
8019
8452
|
};
|
|
8453
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/a2ui/types.ts
|
|
8454
|
+
var A2UI_EVENT_CONTEXT_NAMESPACE = "agent.event.context";
|
|
8455
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/a2ui/binding.ts
|
|
8456
|
+
var NUMERIC_SEGMENT = /^(0|[1-9]\d*)$/;
|
|
8457
|
+
var decodeSegment = function decodeSegment(segment) {
|
|
8458
|
+
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
8459
|
+
};
|
|
8460
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/a2ui/dynamic.ts
|
|
8461
|
+
var isObject = function isObject(v) {
|
|
8462
|
+
return (typeof v === "undefined" ? "undefined" : _type_of(v)) === "object" && v !== null && !Array.isArray(v);
|
|
8463
|
+
};
|
|
8464
|
+
var isPathRef = function isPathRef(v) {
|
|
8465
|
+
return isObject(v) && typeof v.path === "string" && Object.keys(v).length === 1;
|
|
8466
|
+
};
|
|
8467
|
+
var isFunctionCall = function isFunctionCall(v) {
|
|
8468
|
+
return isObject(v) && typeof v.call === "string";
|
|
8469
|
+
};
|
|
8470
|
+
function translateDynamicValue(value, logger) {
|
|
8471
|
+
if (value === null || value === void 0) return value;
|
|
8472
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
8473
|
+
return value;
|
|
8474
|
+
}
|
|
8475
|
+
if (Array.isArray(value)) {
|
|
8476
|
+
return value.map(function(v) {
|
|
8477
|
+
return translateDynamicValue(v, logger);
|
|
8478
|
+
});
|
|
8479
|
+
}
|
|
8480
|
+
if (isPathRef(value)) {
|
|
8481
|
+
return pointerToBinding(value.path);
|
|
8482
|
+
}
|
|
8483
|
+
if (isFunctionCall(value)) {
|
|
8484
|
+
return translateFunctionCall(value, logger);
|
|
8485
|
+
}
|
|
8486
|
+
var out = {};
|
|
8487
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8488
|
+
try {
|
|
8489
|
+
for(var _iterator = Object.entries(value)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8490
|
+
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
8491
|
+
out[k] = translateDynamicValue(v, logger);
|
|
8492
|
+
}
|
|
8493
|
+
} catch (err) {
|
|
8494
|
+
_didIteratorError = true;
|
|
8495
|
+
_iteratorError = err;
|
|
8496
|
+
} finally{
|
|
8497
|
+
try {
|
|
8498
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8499
|
+
_iterator.return();
|
|
8500
|
+
}
|
|
8501
|
+
} finally{
|
|
8502
|
+
if (_didIteratorError) {
|
|
8503
|
+
throw _iteratorError;
|
|
8504
|
+
}
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
return out;
|
|
8508
|
+
}
|
|
8509
|
+
function renderArg(value) {
|
|
8510
|
+
if (value === null) return "null";
|
|
8511
|
+
if (value === void 0) return "null";
|
|
8512
|
+
if (typeof value === "boolean") return String(value);
|
|
8513
|
+
if (typeof value === "number") return String(value);
|
|
8514
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
8515
|
+
if (Array.isArray(value)) {
|
|
8516
|
+
return "[".concat(value.map(renderArg).join(", "), "]");
|
|
8517
|
+
}
|
|
8518
|
+
if (isPathRef(value)) {
|
|
8519
|
+
return "{{".concat(pointerToBinding(value.path), "}}");
|
|
8520
|
+
}
|
|
8521
|
+
if (isFunctionCall(value)) {
|
|
8522
|
+
var inner = translateFunctionCall(value);
|
|
8523
|
+
return inner.replace(/^@\[/, "").replace(/\]@$/, "");
|
|
8524
|
+
}
|
|
8525
|
+
return JSON.stringify(value);
|
|
8526
|
+
}
|
|
8527
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/a2ui/schema.ts
|
|
8528
|
+
var INPUT_BINDING_PROPS = {
|
|
8529
|
+
TextField: "text",
|
|
8530
|
+
CheckBox: "checked",
|
|
8531
|
+
DateTimeInput: "value",
|
|
8532
|
+
ChoicePicker: "value",
|
|
8533
|
+
Slider: "value"
|
|
8534
|
+
};
|
|
8535
|
+
var CHECK_TO_VALIDATOR = {
|
|
8536
|
+
required: "required",
|
|
8537
|
+
regex: "regex",
|
|
8538
|
+
email: "email",
|
|
8539
|
+
length: "length",
|
|
8540
|
+
numeric: "numeric"
|
|
8541
|
+
};
|
|
8542
|
+
var TYPE_PREFIX = "T_";
|
|
8543
|
+
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/a2ui/adapter.ts
|
|
8544
|
+
var STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
|
|
8545
|
+
"id",
|
|
8546
|
+
"component",
|
|
8547
|
+
"child",
|
|
8548
|
+
"children",
|
|
8549
|
+
"checks",
|
|
8550
|
+
"action"
|
|
8551
|
+
]);
|
|
8552
|
+
function inlineComponent(component, ctx, templateScope) {
|
|
8553
|
+
if (ctx.inProgress.has(component.id)) {
|
|
8554
|
+
throw new Error("[a2ui] Component cycle detected at id '".concat(component.id, "'. A2UI requires the component graph to be a tree."));
|
|
8555
|
+
}
|
|
8556
|
+
ctx.inProgress.add(component.id);
|
|
8557
|
+
var asset = {
|
|
8558
|
+
id: component.id,
|
|
8559
|
+
type: component.component
|
|
8560
|
+
};
|
|
8561
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8562
|
+
try {
|
|
8563
|
+
for(var _iterator = Object.entries(component)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8564
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
8565
|
+
if (STRUCTURAL_KEYS.has(key)) continue;
|
|
8566
|
+
asset[key] = translatePropValue(value, templateScope, ctx, key);
|
|
8567
|
+
}
|
|
8568
|
+
} catch (err) {
|
|
8569
|
+
_didIteratorError = true;
|
|
8570
|
+
_iteratorError = err;
|
|
8571
|
+
} finally{
|
|
8572
|
+
try {
|
|
8573
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8574
|
+
_iterator.return();
|
|
8575
|
+
}
|
|
8576
|
+
} finally{
|
|
8577
|
+
if (_didIteratorError) {
|
|
8578
|
+
throw _iteratorError;
|
|
8579
|
+
}
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
if (typeof component.child === "string") {
|
|
8583
|
+
var childId = component.child;
|
|
8584
|
+
asset.child = wrapInlined(resolveAndInline(childId, ctx, templateScope));
|
|
8585
|
+
}
|
|
8586
|
+
if (component.children) {
|
|
8587
|
+
if (Array.isArray(component.children)) {
|
|
8588
|
+
asset.children = component.children.map(function(id) {
|
|
8589
|
+
return wrapInlined(resolveAndInline(id, ctx, templateScope));
|
|
8590
|
+
});
|
|
8591
|
+
} else {
|
|
8592
|
+
var _component_children = component.children, path = _component_children.path, componentId = _component_children.componentId;
|
|
8593
|
+
var data = scopedBinding(path, templateScope);
|
|
8594
|
+
var templateComponent = ctx.byId.get(componentId);
|
|
8595
|
+
if (!templateComponent) {
|
|
8596
|
+
throw new Error("[a2ui] Templated children reference unknown componentId '".concat(componentId, "' on component '").concat(component.id, "'."));
|
|
8597
|
+
}
|
|
8598
|
+
var templated = inlineComponent(_object_spread_props(_object_spread({}, templateComponent), {
|
|
8599
|
+
id: "".concat(templateComponent.id, "-_index_")
|
|
8600
|
+
}), ctx, data);
|
|
8601
|
+
asset.template = [
|
|
8602
|
+
{
|
|
8603
|
+
data: data,
|
|
8604
|
+
output: "children",
|
|
8605
|
+
value: {
|
|
8606
|
+
asset: templated
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8609
|
+
];
|
|
8610
|
+
}
|
|
8611
|
+
}
|
|
8612
|
+
if (component.action) {
|
|
8613
|
+
Object.assign(asset, translateAction(component.action, ctx));
|
|
8614
|
+
}
|
|
8615
|
+
ctx.inProgress.delete(component.id);
|
|
8616
|
+
return asset;
|
|
8617
|
+
}
|
|
8618
|
+
var CHILD_KEY_RE = /(?:^|[a-z])Child$|^child$/;
|
|
8619
|
+
var CHILDREN_KEY_RE = /(?:^|[a-z])Children$|^children$/;
|
|
8620
|
+
function translatePropValue(value, templateScope, ctx, parentKey) {
|
|
8621
|
+
if (value === null || value === void 0) return value;
|
|
8622
|
+
if (parentKey && CHILD_KEY_RE.test(parentKey) && typeof value === "string") {
|
|
8623
|
+
return wrapInlined(resolveAndInline(value, ctx, templateScope));
|
|
8624
|
+
}
|
|
8625
|
+
if (parentKey && CHILDREN_KEY_RE.test(parentKey)) {
|
|
8626
|
+
if (Array.isArray(value) && value.every(function(v) {
|
|
8627
|
+
return typeof v === "string";
|
|
8628
|
+
})) {
|
|
8629
|
+
return value.map(function(id) {
|
|
8630
|
+
return wrapInlined(resolveAndInline(id, ctx, templateScope));
|
|
8631
|
+
});
|
|
8632
|
+
}
|
|
8633
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && !Array.isArray(value) && "componentId" in value) {
|
|
8634
|
+
var _ctx_logger;
|
|
8635
|
+
(_ctx_logger = ctx.logger) === null || _ctx_logger === void 0 ? void 0 : _ctx_logger.warn("[a2ui] Templated children are only supported at top-level 'children'; '".concat(parentKey, "' will be left unresolved."));
|
|
8636
|
+
}
|
|
8637
|
+
}
|
|
8638
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return value;
|
|
8639
|
+
if (Array.isArray(value)) {
|
|
8640
|
+
return value.map(function(v) {
|
|
8641
|
+
return translatePropValue(v, templateScope, ctx, void 0);
|
|
8642
|
+
});
|
|
8643
|
+
}
|
|
8644
|
+
if (isPathRef(value)) {
|
|
8645
|
+
return scopedBinding(value.path, templateScope);
|
|
8646
|
+
}
|
|
8647
|
+
if (isFunctionCall(value)) {
|
|
8648
|
+
if (templateScope) {
|
|
8649
|
+
return translateFunctionCall(rewritePathsInCall(value, templateScope), ctx.logger);
|
|
8650
|
+
}
|
|
8651
|
+
return translateFunctionCall(value, ctx.logger);
|
|
8652
|
+
}
|
|
8653
|
+
var out = {};
|
|
8654
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8655
|
+
try {
|
|
8656
|
+
for(var _iterator = Object.entries(value)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8657
|
+
var _step_value = _sliced_to_array(_step.value, 2), k = _step_value[0], v = _step_value[1];
|
|
8658
|
+
out[k] = translatePropValue(v, templateScope, ctx, k);
|
|
8659
|
+
}
|
|
8660
|
+
} catch (err) {
|
|
8661
|
+
_didIteratorError = true;
|
|
8662
|
+
_iteratorError = err;
|
|
8663
|
+
} finally{
|
|
8664
|
+
try {
|
|
8665
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8666
|
+
_iterator.return();
|
|
8667
|
+
}
|
|
8668
|
+
} finally{
|
|
8669
|
+
if (_didIteratorError) {
|
|
8670
|
+
throw _iteratorError;
|
|
8671
|
+
}
|
|
8672
|
+
}
|
|
8673
|
+
}
|
|
8674
|
+
return out;
|
|
8675
|
+
}
|
|
8676
|
+
function rewritePathsInCall(value, scope) {
|
|
8677
|
+
if (!value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return value;
|
|
8678
|
+
if (Array.isArray(value)) {
|
|
8679
|
+
return value.map(function(v) {
|
|
8680
|
+
return rewritePathsInCall(v, scope);
|
|
8681
|
+
});
|
|
8682
|
+
}
|
|
8683
|
+
if (isPathRef(value)) {
|
|
8684
|
+
return {
|
|
8685
|
+
path: scopedPointer(value.path, scope)
|
|
8686
|
+
};
|
|
8687
|
+
}
|
|
8688
|
+
if (isFunctionCall(value)) {
|
|
8689
|
+
return _object_spread_props(_object_spread({}, value), {
|
|
8690
|
+
args: value.args ? Object.fromEntries(Object.entries(value.args).map(function(param) {
|
|
8691
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
8692
|
+
return [
|
|
8693
|
+
k,
|
|
8694
|
+
rewritePathsInCall(v, scope)
|
|
8695
|
+
];
|
|
8696
|
+
})) : value.args
|
|
8697
|
+
});
|
|
8698
|
+
}
|
|
8699
|
+
return Object.fromEntries(Object.entries(value).map(function(param) {
|
|
8700
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
8701
|
+
return [
|
|
8702
|
+
k,
|
|
8703
|
+
rewritePathsInCall(v, scope)
|
|
8704
|
+
];
|
|
8705
|
+
}));
|
|
8706
|
+
}
|
|
8707
|
+
function renderRhs(value) {
|
|
8708
|
+
if (value === null || value === void 0) return "null";
|
|
8709
|
+
if (typeof value === "boolean") return String(value);
|
|
8710
|
+
if (typeof value === "number") return String(value);
|
|
8711
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
8712
|
+
if (Array.isArray(value)) {
|
|
8713
|
+
return "[".concat(value.map(renderRhs).join(", "), "]");
|
|
8714
|
+
}
|
|
8715
|
+
if (isPathRef(value)) {
|
|
8716
|
+
return "{{".concat(pointerToBinding(value.path), "}}");
|
|
8717
|
+
}
|
|
8718
|
+
if (isFunctionCall(value)) {
|
|
8719
|
+
return translateFunctionCall(value).replace(/^@\[/, "").replace(/\]@$/, "");
|
|
8720
|
+
}
|
|
8721
|
+
return JSON.stringify(value);
|
|
8722
|
+
}
|
|
8020
8723
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
8021
|
-
var PLAYER_VERSION = true ? "0.
|
|
8022
|
-
var COMMIT = true ? "
|
|
8724
|
+
var PLAYER_VERSION = true ? "0.16.0--canary.866.36538" : "unknown";
|
|
8725
|
+
var COMMIT = true ? "0186f1bd04fda238cbc62b8d293c8048ab26efc2" : "unknown";
|
|
8023
8726
|
var _Player = /*#__PURE__*/ function() {
|
|
8024
8727
|
function _Player(config) {
|
|
8025
8728
|
var _this = this;
|
|
@@ -8347,14 +9050,15 @@ var Player = function() {
|
|
|
8347
9050
|
},
|
|
8348
9051
|
{
|
|
8349
9052
|
key: "start",
|
|
8350
|
-
value: function start(payload) {
|
|
9053
|
+
value: function start(payload, options) {
|
|
8351
9054
|
return _async_to_generator(function() {
|
|
8352
|
-
var _this, _ref, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
9055
|
+
var _this, _ref, flow, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8353
9056
|
return _ts_generator(this, function(_state) {
|
|
8354
9057
|
switch(_state.label){
|
|
8355
9058
|
case 0:
|
|
8356
9059
|
_this = this;
|
|
8357
|
-
|
|
9060
|
+
flow = (options === null || options === void 0 ? void 0 : options.format) === "a2ui" ? adaptA2UIToFlow(payload, this.logger) : payload;
|
|
9061
|
+
ref = Symbol((_ref = flow === null || flow === void 0 ? void 0 : flow.id) !== null && _ref !== void 0 ? _ref : "payload");
|
|
8358
9062
|
maybeUpdateState = function maybeUpdateState(newState) {
|
|
8359
9063
|
if (_this.state.ref !== ref) {
|
|
8360
9064
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8375,7 +9079,7 @@ var Player = function() {
|
|
|
8375
9079
|
,
|
|
8376
9080
|
4
|
|
8377
9081
|
]);
|
|
8378
|
-
_this_setupFlow = this.setupFlow(
|
|
9082
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8379
9083
|
this.setState(_object_spread({
|
|
8380
9084
|
ref: ref
|
|
8381
9085
|
}, state));
|
|
@@ -8410,7 +9114,7 @@ var Player = function() {
|
|
|
8410
9114
|
errorState = {
|
|
8411
9115
|
status: "error",
|
|
8412
9116
|
ref: ref,
|
|
8413
|
-
flow:
|
|
9117
|
+
flow: flow,
|
|
8414
9118
|
error: error
|
|
8415
9119
|
};
|
|
8416
9120
|
maybeUpdateState(errorState);
|